apps/libsql-viewer
Variables
'Read the “', Variables, '” section'default: DevToolbarApp;
Defined in: studiocms/packages/studiocms_devapps/src/apps/libsql-viewer.ts:77
Defines a toolbar application for viewing and interacting with a libSQL database.
The canvas element where the app will be initialized.
The event target for handling outside click events.
import libsqlViewer from './libsql-viewer';
const canvas = document.getElementById('appCanvas') as HTMLCanvasElement;const eventTarget = new EventTarget();
libsqlViewer.init(canvas, eventTarget);
This function creates an iframe to display the libSQL database viewer and sets up event listeners to handle SQL query and transaction requests via postMessage.
The iframe’s source URL and authentication token are retrieved from the dbEnv
object.
The createClient
function is used to create a client for executing SQL queries and transactions.
The closeOnOutsideClick
function is used to close the app window when a click is detected outside of it.
The transformTursoResult
function is used to transform the results of SQL queries and transactions.
The biome-ignore
comments are used to suppress linting warnings for non-null assertions.
- createClient
- closeOnOutsideClick
- transformTursoResult
Functions
'Read the “', Functions, '” section'getIFrameSrc()
'Read the “', getIFrameSrc(), '” section'function getIFrameSrc(dbUrl: string): | "https://studio.outerbase.com/embed/turso?theme=dark" | "https://studio.outerbase.com/embed/sqlite?theme=dark"
Defined in: studiocms/packages/studiocms_devapps/src/apps/libsql-viewer.ts:34
Generates the source URL for an iframe based on the provided database URL.
Parameters
'Read the “', Parameters, '” section'string
The URL of the database.
| "https://studio.outerbase.com/embed/turso?theme=dark"
| "https://studio.outerbase.com/embed/sqlite?theme=dark"
The source URL for the iframe. If the database URL contains ‘turso.io’,
it returns tursoURL
. Otherwise, it returns sqlLiteUrl
.