Home / Function/ createClient() — astro Function Reference

createClient() — astro Function Reference

Architecture documentation for the createClient() function in libsql-web.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  4d384bdd_3079_a248_3303_dbe56b263f9e["createClient()"]
  0c246b8a_3e19_99e9_f551_6de1e4736ea4["libsql-web.ts"]
  4d384bdd_3079_a248_3303_dbe56b263f9e -->|defined in| 0c246b8a_3e19_99e9_f551_6de1e4736ea4
  style 4d384bdd_3079_a248_3303_dbe56b263f9e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/db/src/core/db-client/libsql-web.ts lines 10–33

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

Frequently Asked Questions

What does createClient() do?
createClient() is a function in the astro codebase, defined in packages/db/src/core/db-client/libsql-web.ts.
Where is createClient() defined?
createClient() is defined in packages/db/src/core/db-client/libsql-web.ts at line 10.

Analyze Your Own Codebase

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

Try Supermodel Free