MCPcopy
hub / github.com/drizzle-team/drizzle-orm / normaliseSQLiteUrl

Function normaliseSQLiteUrl

drizzle-kit/src/utils.ts:310–338  ·  view source on GitHub ↗
(
	it: string,
	type: 'libsql' | 'better-sqlite',
)

Source from the content-addressed store, hash-verified

308};
309
310export const normaliseSQLiteUrl = (
311 it: string,
312 type: 'libsql' | 'better-sqlite',
313) => {
314 if (type === 'libsql') {
315 if (it.startsWith('file:')) {
316 return it;
317 }
318 try {
319 const url = parse(it);
320 if (url.protocol === null) {
321 return `file:${it}`;
322 }
323 return it;
324 } catch (e) {
325 return `file:${it}`;
326 }
327 }
328
329 if (type === 'better-sqlite') {
330 if (it.startsWith('file:')) {
331 return it.substring(5);
332 }
333
334 return it;
335 }
336
337 assertUnreachable(type);
338};
339
340export const normalisePGliteUrl = (
341 it: string,

Callers 2

connectToSQLiteFunction · 0.90
connectToLibSQLFunction · 0.90

Calls 2

assertUnreachableFunction · 0.90
parseFunction · 0.85

Tested by

no test coverage detected