hekireki 0.45.0 → 0.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -6
- package/dist/bin/activerecord.js +1 -1
- package/dist/bin/ajv.js +1 -1
- package/dist/bin/arktype.js +1 -1
- package/dist/bin/atlas.js +1 -1
- package/dist/bin/django.js +1 -1
- package/dist/bin/docs.d.ts +1 -0
- package/dist/bin/docs.js +5 -0
- package/dist/bin/drizzle.js +1 -1
- package/dist/bin/ecto.js +1 -1
- package/dist/bin/efcore.js +1 -1
- package/dist/bin/effect.js +1 -1
- package/dist/bin/eloquent.js +1 -1
- package/dist/bin/er.js +1 -1
- package/dist/bin/exposed.js +1 -1
- package/dist/bin/gorm.js +1 -1
- package/dist/bin/hekireki.js +5 -5
- package/dist/bin/kysely.js +1 -1
- package/dist/bin/openapi.js +1 -1
- package/dist/bin/pydantic.js +1 -1
- package/dist/bin/sea-orm.js +1 -1
- package/dist/bin/seed.js +1 -1
- package/dist/bin/sqlalchemy.js +1 -1
- package/dist/bin/typebox.js +1 -1
- package/dist/bin/valibot.js +1 -1
- package/dist/bin/zod.js +1 -1
- package/dist/{bin-DGGtXAJh.js → bin-CeA8S_Qj.js} +6293 -5321
- package/dist/{discover-Dyzb_7x-.js → discover-kVbu9DxT.js} +2 -1
- package/dist/{emit-CbBm_I0C.js → emit-DF8ehOFH.js} +1 -1
- package/dist/{schema-BRtObhQG.js → errors-0PjX4y1Z.js} +218 -2
- package/dist/{migrate-B-EMC7CC.js → migrate-U9pCkJTm.js} +4 -3
- package/dist/native-engine-D1iZDp41.js +537 -0
- package/dist/{plan-DVBOCKsd.js → plan-ChzbNv7_.js} +5 -220
- package/dist/{run-BKHmqvBJ.js → run-Caiu7ebD.js} +4 -4
- package/dist/schema-DzF7tKzG.js +571 -0
- package/dist/{sql-BYvD2bjK.js → sql-DciD3-lE.js} +30 -300
- package/dist/{start-KD0RjI3H.js → start-C1n6SWZ3.js} +8 -505
- package/package.json +2 -1
- package/dist/prisma-model-D98BBcmY.js +0 -287
|
@@ -1,153 +1,40 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { s as readFile, t as exists, u as writeFile } from "./file-BAVQ-zst.js";
|
|
2
2
|
import { b as readPrismaConfig } from "./bin/hekireki.js";
|
|
3
|
-
import {
|
|
3
|
+
import { M as chunks, a as DatabaseUrlNotFoundError, s as makeDatabaseUrl } from "./schema-DzF7tKzG.js";
|
|
4
4
|
import nodeModule from "node:module";
|
|
5
|
-
import {
|
|
5
|
+
import { ConfigProvider, Data, Effect, FileSystem, Schema, SchemaIssue } from "effect";
|
|
6
6
|
import path from "node:path";
|
|
7
|
-
import * as z from "zod";
|
|
8
|
-
import { parseEnv, stripVTControlCharacters } from "node:util";
|
|
9
|
-
import { getDMMF } from "@prisma/get-dmmf";
|
|
10
|
-
import { get_config } from "@prisma/prisma-schema-wasm";
|
|
11
7
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
8
|
+
import { parseEnv } from "node:util";
|
|
12
9
|
import { existsSync, statSync } from "node:fs";
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
/** Prisma rejected the schema; the message is Prisma's, as plain text. */
|
|
18
|
-
var SchemaInvalidError = class extends Data.TaggedError("SchemaInvalidError") {};
|
|
19
|
-
// src/schema/index.ts
|
|
20
|
-
/**
|
|
21
|
-
* The schema file, or every `.prisma` file of the directory and the directories below it, in
|
|
22
|
-
* name order: what Prisma reads for a schema directory.
|
|
23
|
-
*/
|
|
24
|
-
function readSchemaFiles(schemaPath) {
|
|
25
|
-
return Effect.gen(function* () {
|
|
26
|
-
const names = (yield* isDirectory(schemaPath).pipe(Effect.mapError(() => new SchemaFileError({ message: `Schema not found: ${schemaPath}\n Pass --schema <path> pointing at your schema.prisma or a directory of .prisma files.` })))) ? yield* readDirectory(schemaPath, { recursive: true }).pipe(Effect.mapError((error) => new SchemaFileError({ message: error.message }))) : null;
|
|
27
|
-
const paths = names === null ? [schemaPath] : names.filter((name) => name.endsWith(".prisma")).toSorted().map((name) => path.join(schemaPath, name));
|
|
28
|
-
if (paths.length === 0) return yield* new SchemaFileError({ message: `No .prisma files found in ${schemaPath}\n Add a schema.prisma file or pass --schema <path>.` });
|
|
29
|
-
return yield* Effect.forEach(paths, (file) => readFile(file).pipe(Effect.map((content) => ({
|
|
30
|
-
path: file,
|
|
31
|
-
content
|
|
32
|
-
})), Effect.mapError((error) => new SchemaFileError({ message: error.message }))));
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
/** The schema as one text, for the `url` a datasource block may still carry. */
|
|
36
|
-
function schemaText(files) {
|
|
37
|
-
return files.map((file) => file.content).join("\n");
|
|
38
|
-
}
|
|
39
|
-
const GeneratorBlock = z.object({
|
|
40
|
-
provider: z.object({ value: z.string().meta({
|
|
41
|
-
description: "The provider.",
|
|
42
|
-
example: "prisma-client"
|
|
43
|
-
}) }).meta({
|
|
44
|
-
description: "The `provider` of the block.",
|
|
45
|
-
example: { value: "prisma-client" }
|
|
46
|
-
}),
|
|
47
|
-
output: z.object({ value: z.string().meta({
|
|
48
|
-
description: "The output path.",
|
|
49
|
-
example: "../generated"
|
|
50
|
-
}) }).nullable().default(null).meta({
|
|
51
|
-
description: "The `output` of the block, or null without one.",
|
|
52
|
-
example: null
|
|
53
|
-
})
|
|
54
|
-
}).meta({
|
|
55
|
-
description: "The `provider` and `output` of one generator block, as `get_config` writes them",
|
|
56
|
-
example: {
|
|
57
|
-
provider: { value: "prisma-client" },
|
|
58
|
-
output: null
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
const PrismaConfig = z.object({ config: z.object({
|
|
62
|
-
generators: z.array(z.unknown()).meta({
|
|
63
|
-
description: "The generator blocks in declaration order.",
|
|
64
|
-
example: [{
|
|
65
|
-
provider: { value: "prisma-client" },
|
|
66
|
-
output: null
|
|
67
|
-
}]
|
|
68
|
-
}),
|
|
69
|
-
datasources: z.array(z.unknown()).meta({
|
|
70
|
-
description: "The datasource blocks in declaration order.",
|
|
71
|
-
example: [{ provider: "postgresql" }]
|
|
72
|
-
})
|
|
73
|
-
}).meta({
|
|
74
|
-
description: "The parsed configuration blocks.",
|
|
75
|
-
example: {
|
|
76
|
-
generators: [],
|
|
77
|
-
datasources: [{ provider: "postgresql" }]
|
|
78
|
-
}
|
|
79
|
-
}) }).meta({
|
|
80
|
-
description: "The get_config result of prisma-schema-wasm",
|
|
81
|
-
example: { config: {
|
|
82
|
-
generators: [],
|
|
83
|
-
datasources: [{ provider: "postgresql" }]
|
|
84
|
-
} }
|
|
85
|
-
});
|
|
86
|
-
const Datasource = z.object({ provider: z.string().meta({
|
|
87
|
-
description: "The declared provider.",
|
|
88
|
-
example: "postgresql"
|
|
89
|
-
}) }).meta({
|
|
90
|
-
description: "One datasource block",
|
|
91
|
-
example: { provider: "postgresql" }
|
|
92
|
-
});
|
|
93
|
-
/** The generator blocks and the first datasource's provider; none of either when Prisma cannot say. */
|
|
94
|
-
function readConfig(files) {
|
|
95
|
-
return Effect.try(() => JSON.parse(get_config(JSON.stringify({
|
|
96
|
-
prismaSchema: files.map((f) => [f.path, f.content]),
|
|
97
|
-
ignoreEnvVarErrors: true,
|
|
98
|
-
env: {}
|
|
99
|
-
})))).pipe(Effect.orElseSucceed(() => null), Effect.map((json) => {
|
|
100
|
-
const result = PrismaConfig.safeParse(json);
|
|
101
|
-
if (!result.success) return {
|
|
102
|
-
generators: [],
|
|
103
|
-
provider: null
|
|
104
|
-
};
|
|
105
|
-
const { generators, datasources } = result.data.config;
|
|
106
|
-
const datasource = Datasource.safeParse(datasources[0]);
|
|
107
|
-
return {
|
|
108
|
-
generators: generators.flatMap((block) => {
|
|
109
|
-
const read = GeneratorBlock.safeParse(block);
|
|
110
|
-
return read.success ? [read.data] : [];
|
|
111
|
-
}),
|
|
112
|
-
provider: datasource.success ? datasource.data.provider : null
|
|
113
|
-
};
|
|
114
|
-
}));
|
|
10
|
+
// src/sql/identifier.ts
|
|
11
|
+
/** A table or column name as the dialect quotes it, the quote a name holds doubled. */
|
|
12
|
+
function quoteIdentifier(dialect, name) {
|
|
13
|
+
return dialect === "mysql" ? `\`${name.replaceAll("`", "``")}\`` : `"${name.replaceAll("\"", "\"\"")}"`;
|
|
115
14
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
description: "The JSON body get-dmmf puts in Error.message",
|
|
121
|
-
example: { message: "error: ..." }
|
|
122
|
-
});
|
|
123
|
-
/** Prisma's message for a schema it rejects, as plain text. */
|
|
124
|
-
function prismaErrorMessage(raw) {
|
|
125
|
-
return Effect.try(() => JSON.parse(raw)).pipe(Effect.orElseSucceed(() => null), Effect.map((json) => {
|
|
126
|
-
const result = PrismaErrorBody.safeParse(json);
|
|
127
|
-
return stripVTControlCharacters(result.success ? result.data.message : raw).trim();
|
|
128
|
-
}));
|
|
15
|
+
/** The table, schema-qualified when it names a schema. */
|
|
16
|
+
function qualifiedName(dialect, table) {
|
|
17
|
+
const name = quoteIdentifier(dialect, table.table);
|
|
18
|
+
return table.schema === null ? name : `${quoteIdentifier(dialect, table.schema)}.${name}`;
|
|
129
19
|
}
|
|
130
|
-
/** The
|
|
131
|
-
function
|
|
132
|
-
return
|
|
133
|
-
const result = getDMMF({ datamodel: files.map((f) => [f.path, f.content]) });
|
|
134
|
-
if ("type" in result) return yield* new SchemaInvalidError({ message: yield* prismaErrorMessage(result.error.message) });
|
|
135
|
-
return {
|
|
136
|
-
dmmf: result,
|
|
137
|
-
...yield* readConfig(files)
|
|
138
|
-
};
|
|
139
|
-
});
|
|
20
|
+
/** The bound-parameter placeholder: `$n` for PostgreSQL, `?` elsewhere. */
|
|
21
|
+
function placeholder(dialect, index) {
|
|
22
|
+
return dialect === "postgresql" ? `$${index}` : "?";
|
|
140
23
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
24
|
+
/**
|
|
25
|
+
* A string as a SQL literal. Every dialect doubles the quote; MySQL and MariaDB also read a
|
|
26
|
+
* backslash as an escape, so one written as it is would swallow the character after it.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```sql
|
|
30
|
+
* -- the value it's a\b
|
|
31
|
+
* -- PostgreSQL, SQLite 'it''s a\b'
|
|
32
|
+
* -- MySQL, MariaDB 'it''s a\\b'
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
function stringLiteral(dialect, value) {
|
|
36
|
+
const doubled = value.replaceAll("'", "''");
|
|
37
|
+
return `'${dialect === "mysql" ? doubled.replaceAll("\\", "\\\\") : doubled}'`;
|
|
151
38
|
}
|
|
152
39
|
// src/seed/errors.ts
|
|
153
40
|
/** hekireki.config.ts is missing, cannot be loaded, or names something the seeder cannot use. */
|
|
@@ -362,114 +249,6 @@ function withTypeScriptImports(effect) {
|
|
|
362
249
|
hooks?.deregister();
|
|
363
250
|
}));
|
|
364
251
|
}
|
|
365
|
-
// src/database/url.ts
|
|
366
|
-
/** No place named a database URL; `reason` says where one would be looked for. */
|
|
367
|
-
var DatabaseUrlNotFoundError = class extends Data.TaggedError("DatabaseUrlNotFoundError") {};
|
|
368
|
-
/**
|
|
369
|
-
* The `datasource.url` of the Prisma config: a variable, as `env("NAME")`, `process.env.NAME` or
|
|
370
|
-
* `process.env["NAME"]`, or a literal; other shapes are not recognised.
|
|
371
|
-
*/
|
|
372
|
-
function makeDatasourceUrl(input) {
|
|
373
|
-
const block = /datasource\s*:\s*\{([^}]*)\}/u.exec(input.configText)?.[1];
|
|
374
|
-
if (!block) return null;
|
|
375
|
-
const env = /url\s*:\s*env\(\s*["'`]([^"'`]+)["'`]\s*\)/u.exec(block)?.[1] ?? /url\s*:\s*process\.env(?:\.([A-Za-z_$][\w$]*)|\[\s*["'`]([^"'`]+)["'`]\s*\])/u.exec(block)?.slice(1).find((name) => name !== void 0);
|
|
376
|
-
if (env) return {
|
|
377
|
-
kind: "env",
|
|
378
|
-
name: env
|
|
379
|
-
};
|
|
380
|
-
const literal = /url\s*:\s*["'`]([^"'`]+)["'`]/u.exec(block)?.[1];
|
|
381
|
-
return literal ? {
|
|
382
|
-
kind: "literal",
|
|
383
|
-
value: literal
|
|
384
|
-
} : null;
|
|
385
|
-
}
|
|
386
|
-
/** The `url` of the schema's `datasource` block (Prisma 6 and earlier), as `env("NAME")` or a literal. */
|
|
387
|
-
function makeSchemaDatasourceUrl(input) {
|
|
388
|
-
const block = /datasource\s+\w+\s*\{([^}]*)\}/u.exec(input.schemaText)?.[1];
|
|
389
|
-
if (!block) return null;
|
|
390
|
-
const env = /^\s*url\s*=\s*env\(\s*"([^"]+)"\s*\)/mu.exec(block)?.[1];
|
|
391
|
-
if (env) return {
|
|
392
|
-
kind: "env",
|
|
393
|
-
name: env
|
|
394
|
-
};
|
|
395
|
-
const literal = /^\s*url\s*=\s*"([^"]+)"/mu.exec(block)?.[1];
|
|
396
|
-
return literal ? {
|
|
397
|
-
kind: "literal",
|
|
398
|
-
value: literal
|
|
399
|
-
} : null;
|
|
400
|
-
}
|
|
401
|
-
/**
|
|
402
|
-
* A variable of the environment, as the `ConfigProvider` this runs with reads it: the process
|
|
403
|
-
* environment by default, with the `.env` files behind it once `resolveDatabaseUrl` has added them.
|
|
404
|
-
* One set to the empty string counts as not set.
|
|
405
|
-
*/
|
|
406
|
-
function environmentVariable(name) {
|
|
407
|
-
return Config.option(Config.String(name)).pipe(Effect.map((value) => Option.getOrNull(Option.filter(value, (text) => text !== ""))), Effect.orElseSucceed(() => null));
|
|
408
|
-
}
|
|
409
|
-
/**
|
|
410
|
-
* `--url`, then `url` in hekireki.config.ts, then whatever Prisma itself connects with: the
|
|
411
|
-
* variable `datasource.url` names with `env("NAME")` in the Prisma config (or in the schema's
|
|
412
|
-
* `datasource` block, Prisma 6 and earlier), read from the environment and `.env`, or the literal
|
|
413
|
-
* written there. Only when Prisma names nothing is DATABASE_URL, Prisma's own default, looked up.
|
|
414
|
-
*/
|
|
415
|
-
function makeDatabaseUrl(input) {
|
|
416
|
-
return Effect.gen(function* () {
|
|
417
|
-
const fromConfig = input.configText === null ? null : makeDatasourceUrl({ configText: input.configText });
|
|
418
|
-
const fromSchema = input.schemaText === null ? null : makeSchemaDatasourceUrl({ schemaText: input.schemaText });
|
|
419
|
-
const datasource = fromConfig ?? fromSchema;
|
|
420
|
-
const named = datasource?.kind === "env" ? yield* environmentVariable(datasource.name) : null;
|
|
421
|
-
const fallback = datasource === null ? yield* environmentVariable("DATABASE_URL") : null;
|
|
422
|
-
const found = input.explicit !== null ? {
|
|
423
|
-
url: input.explicit,
|
|
424
|
-
source: "flag"
|
|
425
|
-
} : input.configUrl !== null && input.configUrl !== "" ? {
|
|
426
|
-
url: input.configUrl,
|
|
427
|
-
source: "hekireki"
|
|
428
|
-
} : datasource?.kind === "literal" ? {
|
|
429
|
-
url: datasource.value,
|
|
430
|
-
source: "prisma"
|
|
431
|
-
} : named !== null ? {
|
|
432
|
-
url: named,
|
|
433
|
-
source: "prisma"
|
|
434
|
-
} : fallback !== null ? {
|
|
435
|
-
url: fallback,
|
|
436
|
-
source: "env"
|
|
437
|
-
} : null;
|
|
438
|
-
if (found !== null) return found;
|
|
439
|
-
const where = fromConfig === null ? "the schema" : input.configName ?? "prisma.config.ts";
|
|
440
|
-
return yield* new DatabaseUrlNotFoundError({ reason: datasource?.kind === "env" ? `${where} reads the database URL from env("${datasource.name}"), but ${datasource.name} is not set.\n Set it in .env or the environment, or pass --url <connection string>.` : "No database URL found.\n Set `url` in hekireki.config.ts, name the variable in prisma.config.ts (`datasource: { url: env(\"DATABASE_URL\") }`) and set it in .env or the environment, or pass --url <connection string>." });
|
|
441
|
-
});
|
|
442
|
-
}
|
|
443
|
-
/** The dialect from the URL scheme, falling back to the schema provider. */
|
|
444
|
-
function makeDialect(input) {
|
|
445
|
-
const scheme = input.url.split(":")[0]?.toLowerCase() ?? "";
|
|
446
|
-
if (scheme === "postgres" || scheme === "postgresql") return "postgresql";
|
|
447
|
-
if (scheme === "mysql") return "mysql";
|
|
448
|
-
if (scheme === "file") return "sqlite";
|
|
449
|
-
const provider = input.schemaProvider;
|
|
450
|
-
if (provider === "postgresql" || provider === "cockroachdb") return "postgresql";
|
|
451
|
-
if (provider === "mysql") return "mysql";
|
|
452
|
-
if (provider === "sqlite") return "sqlite";
|
|
453
|
-
return null;
|
|
454
|
-
}
|
|
455
|
-
/** The database file for a `file:` URL, relative to the schema directory; `:memory:` stays as is. */
|
|
456
|
-
function makeSqliteFilePath(input) {
|
|
457
|
-
const target = input.url.replace(/^file:/u, "").split("?")[0] ?? "";
|
|
458
|
-
if (target === ":memory:" || target === "") return ":memory:";
|
|
459
|
-
return path.isAbsolute(target) ? target : path.resolve(input.baseDir, target);
|
|
460
|
-
}
|
|
461
|
-
/** Hides the password of a connection URL. */
|
|
462
|
-
function makeRedactedUrl(input) {
|
|
463
|
-
return input.url.replace(/(\/\/[^:/@]+:)[^@/]+@/u, "$1***@");
|
|
464
|
-
}
|
|
465
|
-
/**
|
|
466
|
-
* The `?schema=` of a PostgreSQL URL, as Prisma spells the namespace to use. `pg` ignores the
|
|
467
|
-
* parameter, so Studio sets the search path itself; `public` needs no setting.
|
|
468
|
-
*/
|
|
469
|
-
function makePostgresSchema(input) {
|
|
470
|
-
const name = URL.parse(input.url)?.searchParams.get("schema") ?? null;
|
|
471
|
-
return name === null || name === "" || name === "public" ? null : name;
|
|
472
|
-
}
|
|
473
252
|
// src/database/resolve.ts
|
|
474
253
|
/**
|
|
475
254
|
* The database URL from every place a project puts one, in order: `--url`, `url` in
|
|
@@ -491,55 +270,6 @@ function resolveDatabaseUrl(options) {
|
|
|
491
270
|
}).pipe(Effect.provide(ConfigProvider.layerAdd(ConfigProvider.fromEnvRecord(Object.fromEntries(variables.flat())))), Effect.mapError((error) => options.configError === null ? error : new DatabaseUrlNotFoundError({ reason: `hekireki.config.ts could not be read for its \`url\`: ${options.configError}` })));
|
|
492
271
|
});
|
|
493
272
|
}
|
|
494
|
-
// src/sql/identifier.ts
|
|
495
|
-
/** A table or column name as the dialect quotes it, the quote a name holds doubled. */
|
|
496
|
-
function quoteIdentifier(dialect, name) {
|
|
497
|
-
return dialect === "mysql" ? `\`${name.replaceAll("`", "``")}\`` : `"${name.replaceAll("\"", "\"\"")}"`;
|
|
498
|
-
}
|
|
499
|
-
/** The table, schema-qualified when it names a schema. */
|
|
500
|
-
function qualifiedName(dialect, table) {
|
|
501
|
-
const name = quoteIdentifier(dialect, table.table);
|
|
502
|
-
return table.schema === null ? name : `${quoteIdentifier(dialect, table.schema)}.${name}`;
|
|
503
|
-
}
|
|
504
|
-
/** The bound-parameter placeholder: `$n` for PostgreSQL, `?` elsewhere. */
|
|
505
|
-
function placeholder(dialect, index) {
|
|
506
|
-
return dialect === "postgresql" ? `$${index}` : "?";
|
|
507
|
-
}
|
|
508
|
-
/**
|
|
509
|
-
* A string as a SQL literal. Every dialect doubles the quote; MySQL and MariaDB also read a
|
|
510
|
-
* backslash as an escape, so one written as it is would swallow the character after it.
|
|
511
|
-
*
|
|
512
|
-
* @example
|
|
513
|
-
* ```sql
|
|
514
|
-
* -- the value it's a\b
|
|
515
|
-
* -- PostgreSQL, SQLite 'it''s a\b'
|
|
516
|
-
* -- MySQL, MariaDB 'it''s a\\b'
|
|
517
|
-
* ```
|
|
518
|
-
*/
|
|
519
|
-
function stringLiteral(dialect, value) {
|
|
520
|
-
const doubled = value.replaceAll("'", "''");
|
|
521
|
-
return `'${dialect === "mysql" ? doubled.replaceAll("\\", "\\\\") : doubled}'`;
|
|
522
|
-
}
|
|
523
|
-
// src/sql/format.ts
|
|
524
|
-
/**
|
|
525
|
-
* The statement laid out for reading by sql-formatter, in the dialect the database speaks:
|
|
526
|
-
* a clause per line, a subquery indented inside its parentheses. Only whitespace changes; text
|
|
527
|
-
* the formatter cannot read is returned as it is.
|
|
528
|
-
*
|
|
529
|
-
* @param text - one or more SQL statements
|
|
530
|
-
* @param dialect - the connected database's, or null for standard SQL
|
|
531
|
-
* @returns the same tokens, with the whitespace between them rewritten
|
|
532
|
-
*/
|
|
533
|
-
function formatSql(text, dialect) {
|
|
534
|
-
return Effect.try(() => format(text, {
|
|
535
|
-
language: dialect ?? "sql",
|
|
536
|
-
keywordCase: "preserve",
|
|
537
|
-
paramTypes: {
|
|
538
|
-
positional: true,
|
|
539
|
-
numbered: ["$"]
|
|
540
|
-
}
|
|
541
|
-
})).pipe(Effect.orElseSucceed(() => text));
|
|
542
|
-
}
|
|
543
273
|
// src/seed/sql.ts
|
|
544
274
|
function isSeedList(value) {
|
|
545
275
|
return Array.isArray(value);
|
|
@@ -651,4 +381,4 @@ function makeSeedSql(input) {
|
|
|
651
381
|
"COMMIT;"
|
|
652
382
|
].join("\n")}\n`;
|
|
653
383
|
}
|
|
654
|
-
export {
|
|
384
|
+
export { withTypeScriptImports as a, resolveConfigPath as c, SeedGenerationError as d, placeholder as f, stringLiteral as h, resolveDatabaseUrl as i, SeedConfigError as l, quoteIdentifier as m, renderLiteral as n, loadSeedConfig as o, qualifiedName as p, sequenceSql as r, readConfigUrl as s, makeSeedSql as t, SeedDatabaseError as u };
|