Home / File/ libsql-web.ts — astro Source File

libsql-web.ts — astro Source File

Architecture documentation for libsql-web.ts, a typescript file in the astro codebase. 3 imports, 0 dependents.

File typescript CoreAstro CoreMiddleware 3 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  0c246b8a_3e19_99e9_f551_6de1e4736ea4["libsql-web.ts"]
  18405672_85cf_603b_7e5d_ab7ea1416038["./utils.js"]
  0c246b8a_3e19_99e9_f551_6de1e4736ea4 --> 18405672_85cf_603b_7e5d_ab7ea1416038
  c7a92086_d535_5104_5519_02e2ae9e1060["web"]
  0c246b8a_3e19_99e9_f551_6de1e4736ea4 --> c7a92086_d535_5104_5519_02e2ae9e1060
  8237a9de_4bce_5fa6_3750_c76ca2235b29["web"]
  0c246b8a_3e19_99e9_f551_6de1e4736ea4 --> 8237a9de_4bce_5fa6_3750_c76ca2235b29
  style 0c246b8a_3e19_99e9_f551_6de1e4736ea4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { createClient as createLibsqlClient } from '@libsql/client/web';
import { drizzle as drizzleLibsql } from 'drizzle-orm/libsql/web';
import { parseLibSQLConfig } from './utils.js';

type RemoteDbClientOptions = {
	token: string;
	url: string;
};

export function createClient(opts: RemoteDbClientOptions) {
	const { token, url: rawUrl } = opts;

	let parsedUrl = new URL(rawUrl);

	const options: Record<string, string> = Object.fromEntries(parsedUrl.searchParams.entries());

	parsedUrl.search = '';

	let url = parsedUrl.toString();

	const supportedProtocols = ['http:', 'https:', 'libsql:'];

	if (!supportedProtocols.includes(parsedUrl.protocol)) {
		throw new Error(
			`Unsupported protocol "${parsedUrl.protocol}" for libSQL web client. Supported protocols are: ${supportedProtocols.join(', ')}.`,
		);
	}

	const libSQLOptions = parseLibSQLConfig(options);

	const client = createLibsqlClient({ ...libSQLOptions, url, authToken: token });
	return drizzleLibsql(client);
}

Domain

Subdomains

Functions

Dependencies

  • ./utils.js
  • web
  • web

Frequently Asked Questions

What does libsql-web.ts do?
libsql-web.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, CoreMiddleware subdomain.
What functions are defined in libsql-web.ts?
libsql-web.ts defines 1 function(s): createClient.
What does libsql-web.ts depend on?
libsql-web.ts imports 3 module(s): ./utils.js, web, web.
Where is libsql-web.ts in the architecture?
libsql-web.ts is located at packages/db/src/core/db-client/libsql-web.ts (domain: CoreAstro, subdomain: CoreMiddleware, directory: packages/db/src/core/db-client).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free