@prisma/orm-sqlite 8.0.0-rc.19-dev.9 → 8.0.0-rc.19-dev.10
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/dist/config.d.mts +1 -1
- package/dist/config.d.mts.map +1 -1
- package/dist/config.mjs +1 -1
- package/dist/config.mjs.map +1 -1
- package/dist/contract-builder.d.mts +2 -2
- package/dist/contract-builder.d.mts.map +1 -1
- package/dist/contract-builder.mjs +1 -1
- package/dist/contract-builder.mjs.map +1 -1
- package/dist/control.d.mts +1 -1
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +1 -1
- package/dist/control.mjs.map +1 -1
- package/dist/runtime.d.mts +2 -2
- package/dist/runtime.d.mts.map +1 -1
- package/dist/runtime.mjs +2 -2
- package/dist/runtime.mjs.map +1 -1
- package/dist/{sqlite-Yizsft25-m9Hoa392.d.mts → sqlite-Yizsft25-C2Eb0g8b.d.mts} +2 -2
- package/dist/sqlite-Yizsft25-C2Eb0g8b.d.mts.map +1 -0
- package/dist/{sqlite-static-DMWlQGW2-BVWOdPt1.mjs → sqlite-static-BdvkaJVG-vEKKIW5l.mjs} +3 -3
- package/dist/sqlite-static-BdvkaJVG-vEKKIW5l.mjs.map +1 -0
- package/dist/static.d.mts +2 -2
- package/dist/static.d.mts.map +1 -1
- package/dist/static.mjs +1 -1
- package/package.json +8 -8
- package/skills/prisma-8/SKILL.md +1 -1
- package/skills/prisma-8/references/contract.md +4 -4
- package/skills/prisma-8/references/debug.md +1 -1
- package/skills/prisma-8/references/migrations.md +1 -1
- package/skills/prisma-8/references/queries-postgres.md +1 -1
- package/skills/prisma-8/references/runtime.md +2 -2
- package/dist/sqlite-Yizsft25-m9Hoa392.d.mts.map +0 -1
- package/dist/sqlite-static-DMWlQGW2-BVWOdPt1.mjs.map +0 -1
package/dist/config.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PrismaNextConfig } from "@prisma/orm-framework/config/config-types";
|
|
2
2
|
import { ControlExtensionDescriptor } from "@prisma/orm-framework/components/control";
|
|
3
|
-
//#region ../../../3-
|
|
3
|
+
//#region ../../../3-targets/sqlite/9-facade/dist/config.d.mts
|
|
4
4
|
//#region src/config/define-config.d.ts
|
|
5
5
|
interface SqliteConfigOptions {
|
|
6
6
|
readonly contract: string;
|
package/dist/config.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.mts","names":[],"sources":["../../../../3-
|
|
1
|
+
{"version":3,"file":"config.d.mts","names":[],"sources":["../../../../3-targets/sqlite/9-facade/dist/config.d.mts"],"mappings":";;;;UAGU;WACC;WACA;WACA;aACE;;WAEF,sBAAsB;WACtB;aACE;;;iBAGI,aAAa,SAAS,sBAAsB"}
|
package/dist/config.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import sqlite, { sqliteCreateNamespace } from "@prisma/orm-target-sqlite/target/
|
|
|
9
9
|
import sqlitePackRef from "@prisma/orm-target-sqlite/target/pack";
|
|
10
10
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
11
11
|
import { extname, join } from "pathe";
|
|
12
|
-
//#region ../../../3-
|
|
12
|
+
//#region ../../../3-targets/sqlite/9-facade/dist/config.mjs
|
|
13
13
|
function defineConfig(options) {
|
|
14
14
|
const extensions = options.extensions ?? [];
|
|
15
15
|
const output = options.output !== void 0 ? join(options.output, "contract.json") : defaultContractOutputPath(options.contract);
|
package/dist/config.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.mjs","names":[],"sources":["../../../../3-
|
|
1
|
+
{"version":3,"file":"config.mjs","names":[],"sources":["../../../../3-targets/sqlite/9-facade/dist/config.mjs"],"sourcesContent":["import sqliteAdapter from \"@internal/adapter-sqlite/control\";\nimport { defaultContractOutputPath, defineConfig as defineConfig$1 } from \"@internal/config/config-types\";\nimport sqliteDriver from \"@internal/driver-sqlite/control\";\nimport sql from \"@internal/family-sql/control\";\nimport { prismaContract } from \"@internal/sql-contract-psl/provider\";\nimport { typescriptContractFromPath } from \"@internal/sql-contract-ts/config-types\";\nimport { SQLITE_INTEGER_CODEC_ID, SQLITE_TEXT_CODEC_ID } from \"@internal/target-sqlite/codec-ids\";\nimport sqlite, { sqliteCreateNamespace } from \"@internal/target-sqlite/control\";\nimport sqlitePackRef from \"@internal/target-sqlite/pack\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { extname, join } from \"pathe\";\n//#region src/config/define-config.ts\nfunction defineConfig(options) {\n\tconst extensions = options.extensions ?? [];\n\tconst output = options.output !== void 0 ? join(options.output, \"contract.json\") : defaultContractOutputPath(options.contract);\n\treturn defineConfig$1({\n\t\tfamily: sql,\n\t\ttarget: sqlite,\n\t\tadapter: sqliteAdapter,\n\t\tdriver: sqliteDriver,\n\t\textensions,\n\t\tcontract: extname(options.contract) === \".ts\" ? typescriptContractFromPath(options.contract, output) : prismaContract(options.contract, {\n\t\t\toutput,\n\t\t\ttarget: sqlitePackRef,\n\t\t\tcreateNamespace: sqliteCreateNamespace,\n\t\t\tenumInferenceCodecs: {\n\t\t\t\ttext: SQLITE_TEXT_CODEC_ID,\n\t\t\t\tint: SQLITE_INTEGER_CODEC_ID\n\t\t\t}\n\t\t}),\n\t\t...ifDefined(\"db\", options.db),\n\t\t...ifDefined(\"migrations\", options.migrations)\n\t});\n}\n//#endregion\nexport { defineConfig };\n\n//# sourceMappingURL=config.mjs.map"],"mappings":";;;;;;;;;;;;AAYA,SAAS,aAAa,SAAS;CAC9B,MAAM,aAAa,QAAQ,cAAc,CAAC;CAC1C,MAAM,SAAS,QAAQ,WAAW,KAAK,IAAI,KAAK,QAAQ,QAAQ,eAAe,IAAI,0BAA0B,QAAQ,QAAQ;CAC7H,OAAO,eAAe;EACrB,QAAQ;EACR,QAAQ;EACR,SAAS;EACT,QAAQ;EACR;EACA,UAAU,QAAQ,QAAQ,QAAQ,MAAM,QAAQ,2BAA2B,QAAQ,UAAU,MAAM,IAAI,eAAe,QAAQ,UAAU;GACvI;GACA,QAAQ;GACR,iBAAiB;GACjB,qBAAqB;IACpB,MAAM;IACN,KAAK;GACN;EACD,CAAC;EACD,GAAG,UAAU,MAAM,QAAQ,EAAE;EAC7B,GAAG,UAAU,cAAc,QAAQ,UAAU;CAC9C,CAAC;AACF"}
|
|
@@ -7,7 +7,7 @@ import { ExtensionPackRef } from "@prisma/orm-framework/components/components";
|
|
|
7
7
|
import "@prisma/orm-framework/contract/types";
|
|
8
8
|
import { CodecLookupWithDescriptors, ColumnTypeDescriptor, DataTypeLookup } from "@prisma/orm-framework/components/codec";
|
|
9
9
|
import { AuthoredStorageTypeInstance, SqlNamespaceBase, SqlNamespaceInput } from "@prisma/orm-family-sql/contract/types";
|
|
10
|
-
//#region ../../../3-
|
|
10
|
+
//#region ../../../3-targets/sqlite/9-facade/dist/contract-builder.d.mts
|
|
11
11
|
//#region src/contract/define-contract.d.ts
|
|
12
12
|
type SqlFamily = typeof sqlFamilyPack;
|
|
13
13
|
type SqlitePack = typeof sqlitePackRef;
|
|
@@ -53,7 +53,7 @@ declare function defineContract<const DatabaseTypes extends DatabaseTypesConstra
|
|
|
53
53
|
readonly enums?: FactoryEnums;
|
|
54
54
|
}): SqliteResult<DatabaseTypes, Models, Extensions, MergeEnums<ScaffoldEnums, FactoryEnums>, ForeignKeyDefaults>;
|
|
55
55
|
//#endregion
|
|
56
|
-
//#region
|
|
56
|
+
//#region ../../../1-framework/2-authoring/contract/dist/index.d.mts
|
|
57
57
|
//#endregion
|
|
58
58
|
//#region src/enum-type.d.ts
|
|
59
59
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract-builder.d.mts","names":[],"sources":["../../../../3-
|
|
1
|
+
{"version":3,"file":"contract-builder.d.mts","names":[],"sources":["../../../../3-targets/sqlite/9-facade/dist/contract-builder.d.mts"],"mappings":";;;;;;;;;;;KAUK,mBAAmB;KACnB,oBAAoB;KACpB,0BAA0B,eAAe;KACzC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ACP,QAAQ;aACR,yCAAyC;aACzC;;WAEF,iBAAiB;aACf,0CAA0C;aAC1C,2CAA2C;aAC3C,yCAAyC;aACzC;;WAEF,mBAAmB;aACjB;aACA;aACA,yCAAyC;aACzC;;WAEF,yBAAyB;aACvB;aACA;aACA,yCAAyC;aACzC;;WAEF,aAAa;aACX;aACA;aACA,yCAAyC;aACzC;;;;;;;;cAQC,KAAK,kCAAkC,sBAAsB"}
|
|
@@ -6,7 +6,7 @@ import sqlFamilyPack from "@prisma/orm-family-sql/family/pack";
|
|
|
6
6
|
import { assembleDataTypeSupport } from "@prisma/orm-framework/components/authoring";
|
|
7
7
|
import { assembleSqliteCodecRegistry } from "@prisma/orm-target-sqlite/target/codecs";
|
|
8
8
|
import { createGeneratorHelpers } from "@prisma/orm-framework/components/components";
|
|
9
|
-
//#region ../../../3-
|
|
9
|
+
//#region ../../../3-targets/sqlite/9-facade/dist/contract-builder.mjs
|
|
10
10
|
const adapter = sqliteAdapterContractContributions;
|
|
11
11
|
const target = sqlitePackRef;
|
|
12
12
|
function defineContract(definition, factory) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract-builder.mjs","names":[],"sources":["../../../../3-
|
|
1
|
+
{"version":3,"file":"contract-builder.mjs","names":[],"sources":["../../../../3-targets/sqlite/9-facade/dist/contract-builder.mjs"],"sourcesContent":["import { sqliteCreateNamespace } from \"@internal/target-sqlite/control\";\nimport sqlitePackRef from \"@internal/target-sqlite/pack\";\nimport { autoincrement, bindEnumType, buildBoundContract, field, member, model, now, rel, sql } from \"@internal/sql-contract-ts/contract-builder\";\nimport { sqliteAdapterContractContributions } from \"@internal/adapter-sqlite/adapter\";\nimport sqlFamilyPack from \"@internal/family-sql/pack\";\nimport { assembleDataTypeSupport } from \"@internal/framework-components/authoring\";\nimport { assembleSqliteCodecRegistry } from \"@internal/target-sqlite/codecs\";\nimport { createGeneratorHelpers } from \"@internal/framework-components/components\";\n//#region src/contract/define-contract.ts\nconst adapter = sqliteAdapterContractContributions;\nconst target = sqlitePackRef;\nfunction defineContract(definition, factory) {\n\tconst extensionPacks = Object.values(definition.extensions ?? {});\n\tconst bound = {\n\t\t...definition,\n\t\tadapter,\n\t\tcreateNamespace: sqliteCreateNamespace,\n\t\tcodecLookup: definition.codecLookup ?? assembleSqliteCodecRegistry(target, extensionPacks),\n\t\tdataTypeLookup: definition.dataTypeLookup ?? assembleDataTypeSupport([\n\t\t\tsqlFamilyPack,\n\t\t\ttarget,\n\t\t\t...extensionPacks\n\t\t], () => void 0).support.lookup\n\t};\n\tif (factory !== void 0) return buildBoundContract(sqlFamilyPack, sqlitePackRef, bound, factory);\n\treturn buildBoundContract(sqlFamilyPack, sqlitePackRef, bound);\n}\n//#endregion\n//#region src/contract/enum-type.ts\n/** `enumType` bound to the pack's codec types, so each `member()` value is checked against the enum codec's input type. */\nconst enumType = bindEnumType();\n//#endregion\n//#region src/contract/gen.ts\n/**\n* The generator function calls of the `defineContract` callback for SQLite, built from the same family and target packs, for `.onCreate(...)` and `.onUpdate(...)`: `gen.now()`, `gen.uuid(7)`, `gen.cuid(2)`, `gen.ulid()`, `gen.nanoid(16)` and `gen.ksuid()`.\n*/\nconst gen = createGeneratorHelpers([sqlFamilyPack, sqlitePackRef]);\n//#endregion\nexport { autoincrement, defineContract, enumType, field, gen, member, model, now, rel, sql };\n\n//# sourceMappingURL=contract-builder.mjs.map"],"mappings":";;;;;;;;;AASA,MAAM,UAAU;AAChB,MAAM,SAAS;AACf,SAAS,eAAe,YAAY,SAAS;CAC5C,MAAM,iBAAiB,OAAO,OAAO,WAAW,cAAc,CAAC,CAAC;CAChE,MAAM,QAAQ;EACb,GAAG;EACH;EACA,iBAAiB;EACjB,aAAa,WAAW,eAAe,4BAA4B,QAAQ,cAAc;EACzF,gBAAgB,WAAW,kBAAkB,wBAAwB;GACpE;GACA;GACA,GAAG;EACJ,SAAS,KAAK,CAAC,CAAC,CAAC,QAAQ;CAC1B;CACA,IAAI,YAAY,KAAK,GAAG,OAAO,mBAAmB,eAAe,eAAe,OAAO,OAAO;CAC9F,OAAO,mBAAmB,eAAe,eAAe,KAAK;AAC9D;;AAIA,MAAM,WAAW,aAAa;;;;AAM9B,MAAM,MAAM,uBAAuB,CAAC,eAAe,aAAa,CAAC"}
|
package/dist/control.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ControlClient, ControlClientOptions } from "@prisma/orm-toolchain/cli/control-api";
|
|
2
|
-
//#region ../../../3-
|
|
2
|
+
//#region ../../../3-targets/sqlite/9-facade/dist/control.d.mts
|
|
3
3
|
//#region src/exports/control.d.ts
|
|
4
4
|
interface SqliteControlClientOptions {
|
|
5
5
|
readonly connection?: string;
|
package/dist/control.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control.d.mts","names":[],"sources":["../../../../3-
|
|
1
|
+
{"version":3,"file":"control.d.mts","names":[],"sources":["../../../../3-targets/sqlite/9-facade/dist/control.d.mts"],"mappings":";;;UAEU;WACC;WACA,aAAa;;iBAEP,0BAA0B,UAAU,6BAA6B"}
|
package/dist/control.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import sql from "@prisma/orm-family-sql/family/control";
|
|
|
4
4
|
import sqlite from "@prisma/orm-target-sqlite/target/control";
|
|
5
5
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
6
6
|
import { createControlClient } from "@prisma/orm-toolchain/cli/control-api";
|
|
7
|
-
//#region ../../../3-
|
|
7
|
+
//#region ../../../3-targets/sqlite/9-facade/dist/control.mjs
|
|
8
8
|
function createSqliteControlClient(options = {}) {
|
|
9
9
|
return createControlClient({
|
|
10
10
|
family: sql,
|
package/dist/control.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control.mjs","names":[],"sources":["../../../../3-
|
|
1
|
+
{"version":3,"file":"control.mjs","names":[],"sources":["../../../../3-targets/sqlite/9-facade/dist/control.mjs"],"sourcesContent":["import sqliteAdapter from \"@internal/adapter-sqlite/control\";\nimport sqliteDriver from \"@internal/driver-sqlite/control\";\nimport sql from \"@internal/family-sql/control\";\nimport sqlite from \"@internal/target-sqlite/control\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { createControlClient } from \"@internal/cli/control-api\";\n//#region src/exports/control.ts\nfunction createSqliteControlClient(options = {}) {\n\treturn createControlClient({\n\t\tfamily: sql,\n\t\ttarget: sqlite,\n\t\tadapter: sqliteAdapter,\n\t\tdriver: sqliteDriver,\n\t\t...ifDefined(\"connection\", options.connection),\n\t\t...ifDefined(\"extensions\", options.extensions)\n\t});\n}\n//#endregion\nexport { createSqliteControlClient };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;AAOA,SAAS,0BAA0B,UAAU,CAAC,GAAG;CAChD,OAAO,oBAAoB;EAC1B,QAAQ;EACR,QAAQ;EACR,SAAS;EACT,QAAQ;EACR,GAAG,UAAU,cAAc,QAAQ,UAAU;EAC7C,GAAG,UAAU,cAAc,QAAQ,UAAU;CAC9C,CAAC;AACF"}
|
package/dist/runtime.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a as SqliteQueryMembers, c as SqliteTargetId, i as SqliteOrm, l as SqliteTransactionContext, n as SqliteOptions, r as SqliteOptionsBase, s as SqliteStaticMembers, t as SqliteClient, u as sqlite } from "./sqlite-Yizsft25-
|
|
1
|
+
import { a as SqliteQueryMembers, c as SqliteTargetId, i as SqliteOrm, l as SqliteTransactionContext, n as SqliteOptions, r as SqliteOptionsBase, s as SqliteStaticMembers, t as SqliteClient, u as sqlite } from "./sqlite-Yizsft25-C2Eb0g8b.mjs";
|
|
2
2
|
import { Runtime, SqlRuntimeBase } from "@prisma/orm-family-sql/runtime";
|
|
3
3
|
import "@prisma/orm-target-sqlite/driver/runtime";
|
|
4
4
|
import { Contract } from "@prisma/orm-framework/contract/types";
|
|
5
5
|
import { SqlStorage } from "@prisma/orm-family-sql/contract/types";
|
|
6
|
-
//#region ../../../3-
|
|
6
|
+
//#region ../../../3-targets/sqlite/9-facade/dist/runtime.d.mts
|
|
7
7
|
//#region src/runtime/binding.d.ts
|
|
8
8
|
type SqliteBindingInput = {
|
|
9
9
|
readonly path: string;
|
package/dist/runtime.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.mts","names":[],"sources":["../../../../3-
|
|
1
|
+
{"version":3,"file":"runtime.d.mts","names":[],"sources":["../../../../3-targets/sqlite/9-facade/dist/runtime.d.mts"],"mappings":";;;;;;;KAMK;WACM;;;;;;;;;;;UAWD,sBAAsB;cAClB,kBAAkB,kBAAkB,SAAS,cAAc,SAAS,qBAAqB,eAAe"}
|
package/dist/runtime.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as validateSqliteContract, t as buildSqliteStaticContext } from "./sqlite-static-
|
|
1
|
+
import { i as validateSqliteContract, t as buildSqliteStaticContext } from "./sqlite-static-BdvkaJVG-vEKKIW5l.mjs";
|
|
2
2
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
3
3
|
import sqliteAdapter from "@prisma/orm-target-sqlite/adapter/runtime";
|
|
4
4
|
import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
|
|
@@ -11,7 +11,7 @@ import sqliteDriver from "@prisma/orm-target-sqlite/driver/runtime";
|
|
|
11
11
|
import { orm, prepareQuery } from "@prisma/orm-family-sql/orm-client";
|
|
12
12
|
import { InternalError } from "@prisma/orm-framework/utils/internal-error";
|
|
13
13
|
import { structuredError } from "@prisma/orm-framework/utils/structured-error";
|
|
14
|
-
//#region ../../../3-
|
|
14
|
+
//#region ../../../3-targets/sqlite/9-facade/dist/runtime.mjs
|
|
15
15
|
function sqliteError(code, message, options) {
|
|
16
16
|
return structuredError(code, message, options);
|
|
17
17
|
}
|
package/dist/runtime.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.mjs","names":[],"sources":["../../../../3-extensions/sqlite/dist/runtime.mjs"],"sourcesContent":["import { i as validateSqliteContract, t as buildSqliteStaticContext } from \"./sqlite-static-DMWlQGW2.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport sqliteAdapter from \"@internal/adapter-sqlite/runtime\";\nimport sqliteDriver from \"@internal/driver-sqlite/runtime\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { createRawLane, sql } from \"@internal/sql-builder/runtime\";\nimport { orm, prepareQuery } from \"@internal/sql-orm-client\";\nimport { SqlRuntimeBase, activitySource, createExecutionContext, createSqlExecutionStack, delegatingActivitySource, withTransaction, withTransactionMembers } from \"@internal/sql-runtime\";\nimport sqliteTarget from \"@internal/target-sqlite/runtime\";\nimport { assertDefined } from \"@internal/utils/assertions\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { structuredError } from \"@internal/utils/structured-error\";\n//#region src/errors.ts\nfunction sqliteError(code, message, options) {\n\treturn structuredError(code, message, options);\n}\n//#endregion\n//#region src/runtime/binding.ts\nfunction resolveSqliteBinding(input) {\n\treturn {\n\t\tkind: \"path\",\n\t\tpath: input.path\n\t};\n}\nfunction resolveOptionalSqliteBinding(options) {\n\tif (options.path === void 0) return;\n\treturn {\n\t\tkind: \"path\",\n\t\tpath: options.path\n\t};\n}\n//#endregion\n//#region src/runtime/sqlite-runtime.ts\nvar SqliteRuntimeImpl = class extends SqlRuntimeBase {};\n//#endregion\n//#region src/runtime/sqlite.ts\nfunction sqliteOrm(orm) {\n\tconst namespace = orm[UNBOUND_NAMESPACE_ID];\n\tassertDefined(namespace, \"the unbound namespace always exists on a sqlite builder output\");\n\treturn blindCast(Reflect.get(namespace, \"fragment\") === void 0 ? Object.create(namespace, { fragment: { value: Reflect.get(orm, \"fragment\") } }) : namespace);\n}\n/**\n* Builds the members of a SQLite transaction over `txCtx`, so every statement they run goes through the transaction. Preparing sends nothing to the database, so `prepare` uses `prepareRuntime`; the prepared statement runs on the queryable it is given.\n*/\nfunction buildSqliteTransactionMembers(options, txCtx) {\n\tconst { context, collections, rawCodecInferer, enums, toSql, prepareRuntime } = options;\n\tconst sqlNamespace = sql({\n\t\tcontext,\n\t\trawCodecInferer\n\t})[UNBOUND_NAMESPACE_ID];\n\tassertDefined(sqlNamespace, \"the unbound namespace always exists on a sqlite builder output\");\n\treturn {\n\t\tsql: blindCast(sqlNamespace),\n\t\torm: sqliteOrm(orm({\n\t\t\truntime: {\n\t\t\t\tquery(plan) {\n\t\t\t\t\treturn txCtx.query(plan);\n\t\t\t\t},\n\t\t\t\texecute(plan) {\n\t\t\t\t\treturn txCtx.execute(plan);\n\t\t\t\t},\n\t\t\t\t[activitySource]: delegatingActivitySource(() => txCtx)\n\t\t\t},\n\t\t\tcontext,\n\t\t\t...ifDefined(\"collections\", collections)\n\t\t})),\n\t\traw: createRawLane({\n\t\t\tcontext,\n\t\t\trawCodecInferer\n\t\t}),\n\t\tenums,\n\t\ttoSql,\n\t\tprepare(declaration, callback) {\n\t\t\treturn prepareQuery(prepareRuntime(), declaration, callback);\n\t\t}\n\t};\n}\n/**\n* Creates a lazy SQLite client. The client infers its contract type from `contract`: a value from\n* `contractFromJson` for an emitted contract, or a TypeScript-authored contract. A contract is\n* validated once, however many clients are built from it. The database opens on the first query\n* or `connect()`.\n*\n* @example\n* ```ts\n* import { contractFromJson } from '@prisma/orm-sqlite/static';\n* import sqlite from '@prisma/orm-sqlite/runtime';\n* import type { Contract } from './contract.d';\n* import contractJson from './contract.json' with { type: 'json' };\n*\n* export const contract = contractFromJson<Contract>(contractJson);\n* export const db = sqlite({ contract, path: './dev.db' });\n* ```\n*/\nfunction sqlite(options) {\n\tconst contract = validateSqliteContract(options.contract);\n\tlet binding = resolveOptionalSqliteBinding(options);\n\tconst stack = createSqlExecutionStack({\n\t\ttarget: sqliteTarget,\n\t\tadapter: sqliteAdapter,\n\t\tdriver: sqliteDriver,\n\t\textensions: options.extensions ?? []\n\t});\n\tconst context = createExecutionContext({\n\t\tcontract,\n\t\tstack,\n\t\tdriver: sqliteDriver\n\t});\n\tconst { sql, raw: rawSqlTag, enums, toSql } = buildSqliteStaticContext(contract, context, stack);\n\tlet runtimeInstance;\n\tlet runtimeDriver;\n\tlet driverConnected = false;\n\tlet connectPromise;\n\tlet closePromise;\n\tlet backgroundConnectError;\n\tlet closed = false;\n\tlet ownedDispose;\n\tconst connectDriver = async (resolvedBinding) => {\n\t\tif (driverConnected) return;\n\t\tif (!runtimeDriver) throw new InternalError(\"SQLite runtime driver missing\");\n\t\tif (connectPromise) return connectPromise;\n\t\tconnectPromise = runtimeDriver.connect(resolvedBinding).then(() => {\n\t\t\tdriverConnected = true;\n\t\t}).catch((err) => {\n\t\t\tbackgroundConnectError = err;\n\t\t\tconnectPromise = void 0;\n\t\t\tthrow err;\n\t\t});\n\t\treturn connectPromise;\n\t};\n\tconst getRuntime = () => {\n\t\tif (closed) throw sqliteError(\"DRIVER.NOT_CONNECTED\", \"SQLite client is closed\", { meta: { extension: \"sqlite\" } });\n\t\tif (backgroundConnectError !== void 0) throw backgroundConnectError;\n\t\tif (runtimeInstance) return runtimeInstance;\n\t\tconst adapter = stack.adapter.create(stack);\n\t\tconst driverDescriptor = stack.driver;\n\t\tif (!driverDescriptor) throw new InternalError(\"Driver descriptor missing from execution stack\");\n\t\tconst driver = driverDescriptor.create();\n\t\townedDispose = () => driver.close();\n\t\truntimeDriver = driver;\n\t\tif (binding !== void 0) connectDriver(binding).catch(() => void 0);\n\t\truntimeInstance = new SqliteRuntimeImpl({\n\t\t\tcontext,\n\t\t\tadapter,\n\t\t\tdriver,\n\t\t\t...ifDefined(\"verifyMarker\", options.verifyMarker),\n\t\t\t...ifDefined(\"middleware\", options.middleware),\n\t\t\t...ifDefined(\"log\", options.log),\n\t\t\t...ifDefined(\"mode\", options.mode),\n\t\t\tcloseRefusal: \"at-once\"\n\t\t});\n\t\treturn runtimeInstance;\n\t};\n\tconst orm$1 = sqliteOrm(orm({\n\t\tcontext,\n\t\t...ifDefined(\"collections\", options.collections),\n\t\truntime: {\n\t\t\tquery(plan) {\n\t\t\t\treturn getRuntime().query(plan);\n\t\t\t},\n\t\t\texecute(plan) {\n\t\t\t\treturn getRuntime().execute(plan);\n\t\t\t},\n\t\t\tconnection() {\n\t\t\t\treturn getRuntime().connection();\n\t\t\t},\n\t\t\t[activitySource]: delegatingActivitySource(() => getRuntime())\n\t\t}\n\t}));\n\tfunction prepare(declaration, callback) {\n\t\treturn prepareQuery(getRuntime(), declaration, callback);\n\t}\n\treturn {\n\t\tsql,\n\t\torm: orm$1,\n\t\tenums,\n\t\traw: rawSqlTag,\n\t\ttoSql,\n\t\tcontext,\n\t\tcontract,\n\t\tstack,\n\t\tquery(plan, execOptions) {\n\t\t\treturn getRuntime().query(plan, execOptions);\n\t\t},\n\t\texecute(plan, execOptions) {\n\t\t\treturn getRuntime().execute(plan, execOptions);\n\t\t},\n\t\tasync connect(bindingInput) {\n\t\t\tif (closed) throw sqliteError(\"DRIVER.NOT_CONNECTED\", \"SQLite client is closed\", { meta: { extension: \"sqlite\" } });\n\t\t\tif (driverConnected || connectPromise) throw sqliteError(\"DRIVER.ALREADY_CONNECTED\", \"SQLite client already connected\", { meta: { extension: \"sqlite\" } });\n\t\t\tbackgroundConnectError = void 0;\n\t\t\tif (bindingInput !== void 0) binding = resolveSqliteBinding(bindingInput);\n\t\t\tif (binding === void 0) throw sqliteError(\"RUNTIME.BINDING_MISSING\", \"SQLite binding not configured. Pass path to sqlite(...) or call db.connect({ path }).\", { meta: { extension: \"sqlite\" } });\n\t\t\tconst runtime = getRuntime();\n\t\t\tif (driverConnected) return runtime;\n\t\t\tawait connectDriver(binding);\n\t\t\treturn runtime;\n\t\t},\n\t\truntime() {\n\t\t\treturn getRuntime();\n\t\t},\n\t\tprepare,\n\t\ttransaction(fn) {\n\t\t\tlet runtime;\n\t\t\ttry {\n\t\t\t\truntime = getRuntime();\n\t\t\t} catch (err) {\n\t\t\t\treturn Promise.reject(err);\n\t\t\t}\n\t\t\treturn withTransaction(runtime, (txCtx) => {\n\t\t\t\treturn fn(withTransactionMembers(txCtx, buildSqliteTransactionMembers({\n\t\t\t\t\tcontext,\n\t\t\t\t\tcollections: options.collections,\n\t\t\t\t\trawCodecInferer: stack.adapter.rawCodecInferer,\n\t\t\t\t\tenums,\n\t\t\t\t\ttoSql,\n\t\t\t\t\tprepareRuntime: getRuntime\n\t\t\t\t}, txCtx)));\n\t\t\t});\n\t\t},\n\t\tclose() {\n\t\t\tif (closePromise) return closePromise;\n\t\t\tclosed = true;\n\t\t\tclosePromise = (async () => {\n\t\t\t\tawait connectPromise?.catch(() => void 0);\n\t\t\t\tawait ownedDispose?.();\n\t\t\t})();\n\t\t\treturn closePromise;\n\t\t},\n\t\t[Symbol.asyncDispose]() {\n\t\t\treturn this.close();\n\t\t}\n\t};\n}\n//#endregion\nexport { SqliteRuntimeImpl, sqlite as default };\n\n//# sourceMappingURL=runtime.mjs.map"],"mappings":";;;;;;;;;;;;;;AAcA,SAAS,YAAY,MAAM,SAAS,SAAS;CAC5C,OAAO,gBAAgB,MAAM,SAAS,OAAO;AAC9C;AAGA,SAAS,qBAAqB,OAAO;CACpC,OAAO;EACN,MAAM;EACN,MAAM,MAAM;CACb;AACD;AACA,SAAS,6BAA6B,SAAS;CAC9C,IAAI,QAAQ,SAAS,KAAK,GAAG;CAC7B,OAAO;EACN,MAAM;EACN,MAAM,QAAQ;CACf;AACD;AAGA,IAAI,oBAAoB,cAAc,eAAe,CAAC;AAGtD,SAAS,UAAU,KAAK;CACvB,MAAM,YAAY,IAAI;CACtB,cAAc,WAAW,gEAAgE;CACzF,OAAO,UAAU,QAAQ,IAAI,WAAW,UAAU,MAAM,KAAK,IAAI,OAAO,OAAO,WAAW,EAAE,UAAU,EAAE,OAAO,QAAQ,IAAI,KAAK,UAAU,EAAE,EAAE,CAAC,IAAI,SAAS;AAC7J;;;;AAIA,SAAS,8BAA8B,SAAS,O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D"}
|
|
1
|
+
{"version":3,"file":"runtime.mjs","names":[],"sources":["../../../../3-targets/sqlite/9-facade/dist/runtime.mjs"],"sourcesContent":["import { i as validateSqliteContract, t as buildSqliteStaticContext } from \"./sqlite-static-BdvkaJVG.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport sqliteAdapter from \"@internal/adapter-sqlite/runtime\";\nimport sqliteDriver from \"@internal/driver-sqlite/runtime\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { createRawLane, sql } from \"@internal/sql-builder/runtime\";\nimport { orm, prepareQuery } from \"@internal/sql-orm-client\";\nimport { SqlRuntimeBase, activitySource, createExecutionContext, createSqlExecutionStack, delegatingActivitySource, withTransaction, withTransactionMembers } from \"@internal/sql-runtime\";\nimport sqliteTarget from \"@internal/target-sqlite/runtime\";\nimport { assertDefined } from \"@internal/utils/assertions\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { structuredError } from \"@internal/utils/structured-error\";\n//#region src/errors.ts\nfunction sqliteError(code, message, options) {\n\treturn structuredError(code, message, options);\n}\n//#endregion\n//#region src/runtime/binding.ts\nfunction resolveSqliteBinding(input) {\n\treturn {\n\t\tkind: \"path\",\n\t\tpath: input.path\n\t};\n}\nfunction resolveOptionalSqliteBinding(options) {\n\tif (options.path === void 0) return;\n\treturn {\n\t\tkind: \"path\",\n\t\tpath: options.path\n\t};\n}\n//#endregion\n//#region src/runtime/sqlite-runtime.ts\nvar SqliteRuntimeImpl = class extends SqlRuntimeBase {};\n//#endregion\n//#region src/runtime/sqlite.ts\nfunction sqliteOrm(orm) {\n\tconst namespace = orm[UNBOUND_NAMESPACE_ID];\n\tassertDefined(namespace, \"the unbound namespace always exists on a sqlite builder output\");\n\treturn blindCast(Reflect.get(namespace, \"fragment\") === void 0 ? Object.create(namespace, { fragment: { value: Reflect.get(orm, \"fragment\") } }) : namespace);\n}\n/**\n* Builds the members of a SQLite transaction over `txCtx`, so every statement they run goes through the transaction. Preparing sends nothing to the database, so `prepare` uses `prepareRuntime`; the prepared statement runs on the queryable it is given.\n*/\nfunction buildSqliteTransactionMembers(options, txCtx) {\n\tconst { context, collections, rawCodecInferer, enums, toSql, prepareRuntime } = options;\n\tconst sqlNamespace = sql({\n\t\tcontext,\n\t\trawCodecInferer\n\t})[UNBOUND_NAMESPACE_ID];\n\tassertDefined(sqlNamespace, \"the unbound namespace always exists on a sqlite builder output\");\n\treturn {\n\t\tsql: blindCast(sqlNamespace),\n\t\torm: sqliteOrm(orm({\n\t\t\truntime: {\n\t\t\t\tquery(plan) {\n\t\t\t\t\treturn txCtx.query(plan);\n\t\t\t\t},\n\t\t\t\texecute(plan) {\n\t\t\t\t\treturn txCtx.execute(plan);\n\t\t\t\t},\n\t\t\t\t[activitySource]: delegatingActivitySource(() => txCtx)\n\t\t\t},\n\t\t\tcontext,\n\t\t\t...ifDefined(\"collections\", collections)\n\t\t})),\n\t\traw: createRawLane({\n\t\t\tcontext,\n\t\t\trawCodecInferer\n\t\t}),\n\t\tenums,\n\t\ttoSql,\n\t\tprepare(declaration, callback) {\n\t\t\treturn prepareQuery(prepareRuntime(), declaration, callback);\n\t\t}\n\t};\n}\n/**\n* Creates a lazy SQLite client. The client infers its contract type from `contract`: a value from\n* `contractFromJson` for an emitted contract, or a TypeScript-authored contract. A contract is\n* validated once, however many clients are built from it. The database opens on the first query\n* or `connect()`.\n*\n* @example\n* ```ts\n* import { contractFromJson } from '@prisma/orm-sqlite/static';\n* import sqlite from '@prisma/orm-sqlite/runtime';\n* import type { Contract } from './contract.d';\n* import contractJson from './contract.json' with { type: 'json' };\n*\n* export const contract = contractFromJson<Contract>(contractJson);\n* export const db = sqlite({ contract, path: './dev.db' });\n* ```\n*/\nfunction sqlite(options) {\n\tconst contract = validateSqliteContract(options.contract);\n\tlet binding = resolveOptionalSqliteBinding(options);\n\tconst stack = createSqlExecutionStack({\n\t\ttarget: sqliteTarget,\n\t\tadapter: sqliteAdapter,\n\t\tdriver: sqliteDriver,\n\t\textensions: options.extensions ?? []\n\t});\n\tconst context = createExecutionContext({\n\t\tcontract,\n\t\tstack,\n\t\tdriver: sqliteDriver\n\t});\n\tconst { sql, raw: rawSqlTag, enums, toSql } = buildSqliteStaticContext(contract, context, stack);\n\tlet runtimeInstance;\n\tlet runtimeDriver;\n\tlet driverConnected = false;\n\tlet connectPromise;\n\tlet closePromise;\n\tlet backgroundConnectError;\n\tlet closed = false;\n\tlet ownedDispose;\n\tconst connectDriver = async (resolvedBinding) => {\n\t\tif (driverConnected) return;\n\t\tif (!runtimeDriver) throw new InternalError(\"SQLite runtime driver missing\");\n\t\tif (connectPromise) return connectPromise;\n\t\tconnectPromise = runtimeDriver.connect(resolvedBinding).then(() => {\n\t\t\tdriverConnected = true;\n\t\t}).catch((err) => {\n\t\t\tbackgroundConnectError = err;\n\t\t\tconnectPromise = void 0;\n\t\t\tthrow err;\n\t\t});\n\t\treturn connectPromise;\n\t};\n\tconst getRuntime = () => {\n\t\tif (closed) throw sqliteError(\"DRIVER.NOT_CONNECTED\", \"SQLite client is closed\", { meta: { extension: \"sqlite\" } });\n\t\tif (backgroundConnectError !== void 0) throw backgroundConnectError;\n\t\tif (runtimeInstance) return runtimeInstance;\n\t\tconst adapter = stack.adapter.create(stack);\n\t\tconst driverDescriptor = stack.driver;\n\t\tif (!driverDescriptor) throw new InternalError(\"Driver descriptor missing from execution stack\");\n\t\tconst driver = driverDescriptor.create();\n\t\townedDispose = () => driver.close();\n\t\truntimeDriver = driver;\n\t\tif (binding !== void 0) connectDriver(binding).catch(() => void 0);\n\t\truntimeInstance = new SqliteRuntimeImpl({\n\t\t\tcontext,\n\t\t\tadapter,\n\t\t\tdriver,\n\t\t\t...ifDefined(\"verifyMarker\", options.verifyMarker),\n\t\t\t...ifDefined(\"middleware\", options.middleware),\n\t\t\t...ifDefined(\"log\", options.log),\n\t\t\t...ifDefined(\"mode\", options.mode),\n\t\t\tcloseRefusal: \"at-once\"\n\t\t});\n\t\treturn runtimeInstance;\n\t};\n\tconst orm$1 = sqliteOrm(orm({\n\t\tcontext,\n\t\t...ifDefined(\"collections\", options.collections),\n\t\truntime: {\n\t\t\tquery(plan) {\n\t\t\t\treturn getRuntime().query(plan);\n\t\t\t},\n\t\t\texecute(plan) {\n\t\t\t\treturn getRuntime().execute(plan);\n\t\t\t},\n\t\t\tconnection() {\n\t\t\t\treturn getRuntime().connection();\n\t\t\t},\n\t\t\t[activitySource]: delegatingActivitySource(() => getRuntime())\n\t\t}\n\t}));\n\tfunction prepare(declaration, callback) {\n\t\treturn prepareQuery(getRuntime(), declaration, callback);\n\t}\n\treturn {\n\t\tsql,\n\t\torm: orm$1,\n\t\tenums,\n\t\traw: rawSqlTag,\n\t\ttoSql,\n\t\tcontext,\n\t\tcontract,\n\t\tstack,\n\t\tquery(plan, execOptions) {\n\t\t\treturn getRuntime().query(plan, execOptions);\n\t\t},\n\t\texecute(plan, execOptions) {\n\t\t\treturn getRuntime().execute(plan, execOptions);\n\t\t},\n\t\tasync connect(bindingInput) {\n\t\t\tif (closed) throw sqliteError(\"DRIVER.NOT_CONNECTED\", \"SQLite client is closed\", { meta: { extension: \"sqlite\" } });\n\t\t\tif (driverConnected || connectPromise) throw sqliteError(\"DRIVER.ALREADY_CONNECTED\", \"SQLite client already connected\", { meta: { extension: \"sqlite\" } });\n\t\t\tbackgroundConnectError = void 0;\n\t\t\tif (bindingInput !== void 0) binding = resolveSqliteBinding(bindingInput);\n\t\t\tif (binding === void 0) throw sqliteError(\"RUNTIME.BINDING_MISSING\", \"SQLite binding not configured. Pass path to sqlite(...) or call db.connect({ path }).\", { meta: { extension: \"sqlite\" } });\n\t\t\tconst runtime = getRuntime();\n\t\t\tif (driverConnected) return runtime;\n\t\t\tawait connectDriver(binding);\n\t\t\treturn runtime;\n\t\t},\n\t\truntime() {\n\t\t\treturn getRuntime();\n\t\t},\n\t\tprepare,\n\t\ttransaction(fn) {\n\t\t\tlet runtime;\n\t\t\ttry {\n\t\t\t\truntime = getRuntime();\n\t\t\t} catch (err) {\n\t\t\t\treturn Promise.reject(err);\n\t\t\t}\n\t\t\treturn withTransaction(runtime, (txCtx) => {\n\t\t\t\treturn fn(withTransactionMembers(txCtx, buildSqliteTransactionMembers({\n\t\t\t\t\tcontext,\n\t\t\t\t\tcollections: options.collections,\n\t\t\t\t\trawCodecInferer: stack.adapter.rawCodecInferer,\n\t\t\t\t\tenums,\n\t\t\t\t\ttoSql,\n\t\t\t\t\tprepareRuntime: getRuntime\n\t\t\t\t}, txCtx)));\n\t\t\t});\n\t\t},\n\t\tclose() {\n\t\t\tif (closePromise) return closePromise;\n\t\t\tclosed = true;\n\t\t\tclosePromise = (async () => {\n\t\t\t\tawait connectPromise?.catch(() => void 0);\n\t\t\t\tawait ownedDispose?.();\n\t\t\t})();\n\t\t\treturn closePromise;\n\t\t},\n\t\t[Symbol.asyncDispose]() {\n\t\t\treturn this.close();\n\t\t}\n\t};\n}\n//#endregion\nexport { SqliteRuntimeImpl, sqlite as default };\n\n//# sourceMappingURL=runtime.mjs.map"],"mappings":";;;;;;;;;;;;;;AAcA,SAAS,YAAY,MAAM,SAAS,SAAS;CAC5C,OAAO,gBAAgB,MAAM,SAAS,OAAO;AAC9C;AAGA,SAAS,qBAAqB,OAAO;CACpC,OAAO;EACN,MAAM;EACN,MAAM,MAAM;CACb;AACD;AACA,SAAS,6BAA6B,SAAS;CAC9C,IAAI,QAAQ,SAAS,KAAK,GAAG;CAC7B,OAAO;EACN,MAAM;EACN,MAAM,QAAQ;CACf;AACD;AAGA,IAAI,oBAAoB,cAAc,eAAe,CAAC;AAGtD,SAAS,UAAU,KAAK;CACvB,MAAM,YAAY,IAAI;CACtB,cAAc,WAAW,gEAAgE;CACzF,OAAO,UAAU,QAAQ,IAAI,WAAW,UAAU,MAAM,KAAK,IAAI,OAAO,OAAO,WAAW,EAAE,UAAU,EAAE,OAAO,QAAQ,IAAI,KAAK,UAAU,EAAE,EAAE,CAAC,IAAI,S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AAgB;GACvB,OAAO,KAAK,MAAM;EACnB;CACD;AACD"}
|
|
@@ -6,7 +6,7 @@ import { Contract } from "@prisma/orm-framework/contract/types";
|
|
|
6
6
|
import { SqlStorage } from "@prisma/orm-family-sql/contract/types";
|
|
7
7
|
import { Db, RawLane } from "@prisma/orm-family-sql/builder/types";
|
|
8
8
|
import { RuntimeScope } from "@prisma/orm-family-sql/relational-core/types";
|
|
9
|
-
//#region ../../../3-
|
|
9
|
+
//#region ../../../3-targets/sqlite/9-facade/dist/sqlite-Yizsft25.d.mts
|
|
10
10
|
//#region src/static/sqlite-static.d.ts
|
|
11
11
|
type UnboundSql$1<TContract extends Contract<SqlStorage>> = Db<TContract>[typeof UNBOUND_NAMESPACE_ID];
|
|
12
12
|
type UnboundEnums<TContract extends Contract<SqlStorage>> = NamespacedEnums<TContract>[typeof UNBOUND_NAMESPACE_ID];
|
|
@@ -91,4 +91,4 @@ type SqliteOptions<TContract extends Contract<SqlStorage>, TCollections extends
|
|
|
91
91
|
declare function sqlite<TContract extends Contract<SqlStorage>, TCollections extends CollectionClasses = NoCollectionClasses>(options: SqliteOptions<TContract, TCollections>): SqliteClient<TContract, TCollections>;
|
|
92
92
|
//#endregion
|
|
93
93
|
export { SqliteQueryMembers as a, SqliteTargetId as c, sqliteStatic as d, SqliteOrm as i, SqliteTransactionContext as l, SqliteOptions as n, SqliteStaticContext as o, SqliteOptionsBase as r, SqliteStaticMembers as s, SqliteClient as t, sqlite as u };
|
|
94
|
-
//# sourceMappingURL=sqlite-Yizsft25-
|
|
94
|
+
//# sourceMappingURL=sqlite-Yizsft25-C2Eb0g8b.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sqlite-Yizsft25-C2Eb0g8b.d.mts","names":[],"sources":["../../../../3-targets/sqlite/9-facade/dist/sqlite-Yizsft25.d.mts"],"mappings":";;;;;;;;;;KASK,aAAa,kBAAkB,SAAS,eAAe,GAAG,kBAAkB;KAC5E,aAAa,kBAA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SAAS,aAAa,qBAAqB,oBAAoB,uBAAuB;WAChH,UAAU;WACV,cAAc;WACd;;;;;;;;;;;;;;;;;;;iBAmBM,OAAO,kBAAkB,SAAS,aAAa,qBAAqB,oBAAoB,qBAAqB,SAAS,cAAc,WAAW,gBAAgB,aAAa,WAAW"}
|
|
@@ -7,8 +7,8 @@ import { assertDefined } from "@prisma/orm-framework/utils/assertions";
|
|
|
7
7
|
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
8
8
|
import { validateContractOnce } from "@prisma/orm-framework/contract/validate-once";
|
|
9
9
|
import { buildNamespacedEnums } from "@prisma/orm-framework/contract/enum-accessor";
|
|
10
|
-
//#region ../../../3-
|
|
11
|
-
var version = "8.0.0-rc.19-dev.
|
|
10
|
+
//#region ../../../3-targets/sqlite/9-facade/dist/sqlite-static-BdvkaJVG.mjs
|
|
11
|
+
var version = "8.0.0-rc.19-dev.10";
|
|
12
12
|
const serializer = new SqliteContractSerializer();
|
|
13
13
|
const validator = `${sqliteTarget.targetId}@${version}`;
|
|
14
14
|
/**
|
|
@@ -80,4 +80,4 @@ function sqliteStatic(options) {
|
|
|
80
80
|
//#endregion
|
|
81
81
|
export { validateSqliteContract as i, contractFromJson as n, sqliteStatic as r, buildSqliteStaticContext as t };
|
|
82
82
|
|
|
83
|
-
//# sourceMappingURL=sqlite-static-
|
|
83
|
+
//# sourceMappingURL=sqlite-static-BdvkaJVG-vEKKIW5l.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sqlite-static-BdvkaJVG-vEKKIW5l.mjs","names":[],"sources":["../../../../3-targets/sqlite/9-facade/dist/sqlite-static-BdvkaJVG.mjs"],"sourcesContent":["import sqliteAdapter from \"@internal/adapter-sqlite/runtime\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { createRawLane, sql } from \"@internal/sql-builder/runtime\";\nimport { createExecutionContext, createSqlExecutionStack, createToSql } from \"@internal/sql-runtime\";\nimport sqliteTarget, { SqliteContractSerializer } from \"@internal/target-sqlite/runtime\";\nimport { assertDefined } from \"@internal/utils/assertions\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { validateContractOnce } from \"@internal/contract/validate-once\";\nimport { buildNamespacedEnums } from \"@internal/contract/enum-accessor\";\n//#region package.json\nvar version = \"8.0.0-rc.19-dev.10\";\n//#endregion\n//#region src/static/contract-from-json.ts\nconst serializer = new SqliteContractSerializer();\nconst validator = `${sqliteTarget.targetId}@${version}`;\n/**\n* Validates an emitted SQLite `contract.json` and returns it as the contract type the application\n* names, ready to pass to `sqlite({ contract })` and `sqliteStatic({ contract })`. Clients built\n* from the result do not validate it again.\n*\n* The returned value's top level is frozen; its nested objects are not. Do not change `json` or the\n* returned value after the call: clients built from the value later do not validate it again.\n*\n* @example\n* ```ts\n* import type { Contract } from './contract.d';\n* import contractJson from './contract.json' with { type: 'json' };\n*\n* export const contract = contractFromJson<Contract>(contractJson);\n* ```\n*/\nfunction contractFromJson(json) {\n\treturn validateContractOnce(json, validator, (input) => serializer.deserializeContract(input));\n}\nfunction validateSqliteContract(contract) {\n\treturn validateContractOnce(contract, validator, () => serializer.deserializeContract(serializer.serializeContract(contract)));\n}\n//#endregion\n//#region src/static/sqlite-static.ts\nfunction buildSqliteStaticContext(contract, context, stack) {\n\tconst { rawCodecInferer } = stack.adapter;\n\tconst sqlNamespace = sql({\n\t\tcontext,\n\t\trawCodecInferer\n\t})[UNBOUND_NAMESPACE_ID];\n\tassertDefined(sqlNamespace, \"the unbound namespace always exists on a sqlite builder output\");\n\tconst sqlDb = blindCast(sqlNamespace);\n\tconst raw = createRawLane({\n\t\tcontext,\n\t\trawCodecInferer\n\t});\n\tconst enums = Object.freeze(buildNamespacedEnums(context.contract.domain, (codecId) => context.contractCodecs.forCodecRef({ codecId })))[UNBOUND_NAMESPACE_ID];\n\tassertDefined(enums, \"the unbound namespace always exists on a sqlite builder output\");\n\treturn {\n\t\tcontext,\n\t\tcontract,\n\t\tenums,\n\t\tsql: sqlDb,\n\t\traw,\n\t\ttoSql: createToSql(stack, contract)\n\t};\n}\n/**\n* The query surfaces of a SQLite client without a driver: `sql`, `raw`, `enums` and `toSql`. Use\n* it where loading `node:sqlite` is not wanted.\n*\n* @example\n* ```ts\n* const { enums } = sqliteStatic({ contract: contractFromJson<Contract>(contractJson) });\n* ```\n*/\nfunction sqliteStatic(options) {\n\tconst contract = validateSqliteContract(options.contract);\n\tconst stack = createSqlExecutionStack({\n\t\ttarget: sqliteTarget,\n\t\tadapter: sqliteAdapter,\n\t\textensions: options.extensions ?? []\n\t});\n\treturn buildSqliteStaticContext(contract, createExecutionContext({\n\t\tcontract,\n\t\tstack\n\t}), stack);\n}\n//#endregion\nexport { validateSqliteContract as i, sqliteStatic as n, contractFromJson as r, buildSqliteStaticContext as t };\n\n//# sourceMappingURL=sqlite-static-BdvkaJVG.mjs.map"],"mappings":";;;;;;;;;;AAUA,IAAI,UAAU;AAGd,MAAM,aAAa,IAAI,yBAAyB;AAChD,MAAM,YAAY,GAAG,aAAa,SAAS,GAAG;;;;;;;;;;;;;;;;;AAiB9C,SAAS,iBAAiB,MAAM;CAC/B,OAAO,qBAAqB,MAAM,YAAY,UAAU,WAAW,oBAAoB,KAAK,CAAC;AAC9F;AACA,SAAS,uBAAuB,UAAU;CACzC,OAAO,qBAAqB,UAAU,iBAAiB,WAAW,oBAAoB,WAAW,kBAAkB,QAAQ,CAAC,CAAC;AAC9H;AAGA,SAAS,yBAAyB,UAAU,SAAS,OAAO;CAC3D,MAAM,EAAE,oBAAoB,MAAM;CAClC,MAAM,eAAe,IAAI;EACxB;EACA;CACD,CAAC,CAAC,CAAC;CACH,cAAc,cAAc,gEAAgE;CAC5F,MAAM,QAAQ,UAAU,YAAY;CACpC,MAAM,MAAM,cAAc;EACzB;EACA;CACD,CAAC;CACD,MAAM,QAAQ,OAAO,OAAO,qBAAqB,QAAQ,SAAS,SAAS,YAAY,QAAQ,eAAe,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;CACzI,cAAc,OAAO,gEAAgE;CACrF,OAAO;EACN;EACA;EACA;EACA,KAAK;EACL;EACA,OAAO,YAAY,OAAO,QAAQ;CACnC;AACD;;;;;;;;;;AAUA,SAAS,aAAa,SAAS;CAC9B,MAAM,WAAW,uBAAuB,QAAQ,QAAQ;CACxD,MAAM,QAAQ,wBAAwB;EACrC,QAAQ;EACR,SAAS;EACT,YAAY,QAAQ,cAAc,CAAC;CACpC,CAAC;CACD,OAAO,yBAAyB,UAAU,uBAAuB;EAChE;EACA;CACD,CAAC,GAAG,KAAK;AACV"}
|
package/dist/static.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { d as sqliteStatic, o as SqliteStaticContext } from "./sqlite-Yizsft25-
|
|
1
|
+
import { d as sqliteStatic, o as SqliteStaticContext } from "./sqlite-Yizsft25-C2Eb0g8b.mjs";
|
|
2
2
|
import { Contract } from "@prisma/orm-framework/contract/types";
|
|
3
3
|
import { SqlStorage } from "@prisma/orm-family-sql/contract/types";
|
|
4
|
-
//#region ../../../3-
|
|
4
|
+
//#region ../../../3-targets/sqlite/9-facade/dist/static.d.mts
|
|
5
5
|
//#region src/static/contract-from-json.d.ts
|
|
6
6
|
/**
|
|
7
7
|
* Validates an emitted SQLite `contract.json` and returns it as the contract type the application
|
package/dist/static.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"static.d.mts","names":[],"sources":["../../../../3-
|
|
1
|
+
{"version":3,"file":"static.d.mts","names":[],"sources":["../../../../3-targets/sqlite/9-facade/dist/static.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;;iBAoBiB,iBAAiB,kBAAkB,SAAS,aAAa,gBAAgB"}
|
package/dist/static.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as contractFromJson, r as sqliteStatic } from "./sqlite-static-
|
|
1
|
+
import { n as contractFromJson, r as sqliteStatic } from "./sqlite-static-BdvkaJVG-vEKKIW5l.mjs";
|
|
2
2
|
export { contractFromJson, sqliteStatic as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/orm-sqlite",
|
|
3
|
-
"version": "8.0.0-rc.19-dev.
|
|
3
|
+
"version": "8.0.0-rc.19-dev.10",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -10,17 +10,17 @@
|
|
|
10
10
|
"skills"
|
|
11
11
|
],
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@prisma/orm-family-sql": "8.0.0-rc.19-dev.
|
|
14
|
-
"@prisma/orm-framework": "8.0.0-rc.19-dev.
|
|
15
|
-
"@prisma/orm-target-sqlite": "8.0.0-rc.19-dev.
|
|
16
|
-
"@prisma/orm-toolchain": "8.0.0-rc.19-dev.
|
|
13
|
+
"@prisma/orm-family-sql": "8.0.0-rc.19-dev.10",
|
|
14
|
+
"@prisma/orm-framework": "8.0.0-rc.19-dev.10",
|
|
15
|
+
"@prisma/orm-target-sqlite": "8.0.0-rc.19-dev.10",
|
|
16
|
+
"@prisma/orm-toolchain": "8.0.0-rc.19-dev.10",
|
|
17
17
|
"pathe": "^2.0.3",
|
|
18
18
|
"tinyglobby": "^0.2.17"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@internal/sqlite": "8.0.0-rc.19-dev.
|
|
22
|
-
"@repo/tsconfig": "8.0.0-rc.19-dev.
|
|
23
|
-
"@repo/tsdown": "8.0.0-rc.19-dev.
|
|
21
|
+
"@internal/sqlite": "8.0.0-rc.19-dev.10",
|
|
22
|
+
"@repo/tsconfig": "8.0.0-rc.19-dev.10",
|
|
23
|
+
"@repo/tsdown": "8.0.0-rc.19-dev.10",
|
|
24
24
|
"tsdown": "0.22.14",
|
|
25
25
|
"typescript": "5.9.3"
|
|
26
26
|
},
|
package/skills/prisma-8/SKILL.md
CHANGED
|
@@ -126,7 +126,7 @@ Then run `pnpm prisma contract emit` (or rely on the Vite plugin — see `refere
|
|
|
126
126
|
@@index([authorId], where: sql`(archived_at IS NULL)`, name: "posts_author_active")
|
|
127
127
|
```
|
|
128
128
|
|
|
129
|
-
`name:` declares a wire-named index (physical name `<name>_<8-hex hash>`, renames plan as `ALTER INDEX … RENAME`); `map:` adopts an exact physical name verbatim (for infer-captured objects — combining it with a SQL body warns, because drift detection byte-compares the authored text against Postgres's reprint). An `expression:` requires `name:` or `map:`. The TS builder mirrors this via `constraints.index([cols.x], {...})` / `constraints.index({ expression, ... })`, where `expression` and `where` are `sql` values such as ``sql`lower(email)` `` (a string does not compile) — see `packages/2-sql/2-authoring/contract-ts/README.md`.
|
|
129
|
+
`name:` declares a wire-named index (physical name `<name>_<8-hex hash>`, renames plan as `ALTER INDEX … RENAME`); `map:` adopts an exact physical name verbatim (for infer-captured objects — combining it with a SQL body warns, because drift detection byte-compares the authored text against Postgres's reprint). An `expression:` requires `name:` or `map:`. The TS builder mirrors this via `constraints.index([cols.x], {...})` / `constraints.index({ expression, ... })`, where `expression` and `where` are `sql` values such as ``sql`lower(email)` `` (a string does not compile) — see `packages/2-sql-family/2-authoring/contract-ts/README.md`.
|
|
130
130
|
|
|
131
131
|
**Full-text search indexes (PostgreSQL).** Do not hand-write the `to_tsvector` expression — Postgres only uses the index when the query carries the same search document: the same columns, configuration and weights. Declare `@@fullTextIndex`, and the index and the queries `fullTextMatches` / `fullTextRank` / `fullTextHeadline` build are rendered from the same definition (see `references/queries-postgres.md`):
|
|
132
132
|
|
|
@@ -291,7 +291,7 @@ model Feature {
|
|
|
291
291
|
|
|
292
292
|
A variant's base can be in another namespace: write `@@base(ns.Model, "value")`. Such a variant must set `@@map(...)`, because a variant that shares its base's table has to be in the base's namespace.
|
|
293
293
|
|
|
294
|
-
Verify the polymorphism syntax against the interpreter tests if in doubt: `packages/2-sql/2-authoring/contract-psl/test/interpreter.polymorphism.test.ts`.
|
|
294
|
+
Verify the polymorphism syntax against the interpreter tests if in doubt: `packages/2-sql-family/2-authoring/contract-psl/test/interpreter.polymorphism.test.ts`.
|
|
295
295
|
|
|
296
296
|
Mongo PSL takes the same `@@discriminator(field)` / `@@base(Base, "value")` attributes (the Mongo interpreter implements both; `examples/mongo-demo/src/contract.prisma` declares `Post` with `@@discriminator(kind)` and `Article` / `Tutorial` variants via `@@base(Post, "article")`). Variants share the base's collection — there is no `@@map` on a Mongo variant, since there is no second table to join. The TS builder's `discriminator` option on the model is the programmatic equivalent.
|
|
297
297
|
|
|
@@ -524,8 +524,8 @@ Infer captures indexes at full fidelity — expression, partial (`where:`), uniq
|
|
|
524
524
|
## Reference
|
|
525
525
|
|
|
526
526
|
- Run `pnpm prisma contract --help` for the live command surface.
|
|
527
|
-
- PSL feature surface and what the interpreter accepts: `packages/2-sql/2-authoring/contract-psl/README.md`.
|
|
528
|
-
- TS builder surface and the callback-helper vocabulary: `packages/2-sql/2-authoring/contract-ts/README.md`.
|
|
527
|
+
- PSL feature surface and what the interpreter accepts: `packages/2-sql-family/2-authoring/contract-psl/README.md`.
|
|
528
|
+
- TS builder surface and the callback-helper vocabulary: `packages/2-sql-family/2-authoring/contract-ts/README.md`.
|
|
529
529
|
- Layouts (where `contract.prisma`, `contract.json`, `contract.d.ts`, and `migrations/` live):
|
|
530
530
|
- **App layout** (`src/prisma/...` + `migrations/app/...`) — what `examples/prisma-8-demo` demonstrates; the canonical shape consuming applications use.
|
|
531
531
|
- **Contract-space-package layout** (`src/contract.{prisma,ts}` directly, `migrations/<timestamp>_<slug>/` without a space-id segment) — for extensions and aggregate-root packages, documented in `.cursor/rules/contract-space-package-layout.mdc` and ADR 212.
|
|
@@ -51,7 +51,7 @@ Every code is a dotted `NAMESPACE.SUBCODE`; the namespace is the prefix (`CONFIG
|
|
|
51
51
|
|
|
52
52
|
`category` is the prefix of `code` (`PLAN`, `CONTRACT`, `LINT`, `BUDGET`, `RUNTIME`, `ORM`, …). `details` holds the structured context (`details` is the runtime envelope's equivalent of the CLI envelope's `meta`). Recognise either shape programmatically with `isStructuredError` and match on `error.code` — never `instanceof`.
|
|
53
53
|
|
|
54
|
-
**3. SQL driver errors** — surface as `SqlQueryError` / `SqlConnectionError` (see `packages/2-sql/1-core/errors/`). Fields on `SqlQueryError`: `kind: 'sql_query'`, `sqlState` (Postgres SQLSTATE, e.g. `'23505'`), `constraint`, `table`, `column`, `detail`, `cause`. These carry no dotted code — route on `sqlState` and the constraint metadata. SQL driver errors are typically wrapped by middleware before reaching the user, but raw-SQL paths can surface them directly.
|
|
54
|
+
**3. SQL driver errors** — surface as `SqlQueryError` / `SqlConnectionError` (see `packages/2-sql-family/1-core/errors/`). Fields on `SqlQueryError`: `kind: 'sql_query'`, `sqlState` (Postgres SQLSTATE, e.g. `'23505'`), `constraint`, `table`, `column`, `detail`, `cause`. These carry no dotted code — route on `sqlState` and the constraint metadata. SQL driver errors are typically wrapped by middleware before reaching the user, but raw-SQL paths can surface them directly.
|
|
55
55
|
|
|
56
56
|
### Migration apply failures
|
|
57
57
|
|
|
@@ -559,7 +559,7 @@ For the full graph topology: `pnpm prisma migration graph` (also supports `--leg
|
|
|
559
559
|
|
|
560
560
|
## `@@control` and DDL scope
|
|
561
561
|
|
|
562
|
-
Objects whose `@@control` policy excludes them from Prisma 8's managed surface are omitted from planned DDL. The four policies are: `managed` (Prisma plans and applies DDL), `tolerated` (object may exist, no DDL emitted), `external` (object is expected to exist, no DDL), `observed` (Prisma reads but never writes). Declare `@@control(managed|tolerated|external|observed)` in your schema; see `references/contract.md` and [`packages/2-sql/2-authoring/contract-psl/README.md`](https://github.com/prisma/orm/blob/main/packages/2-sql/2-authoring/contract-psl/README.md) for authoring syntax.
|
|
562
|
+
Objects whose `@@control` policy excludes them from Prisma 8's managed surface are omitted from planned DDL. The four policies are: `managed` (Prisma plans and applies DDL), `tolerated` (object may exist, no DDL emitted), `external` (object is expected to exist, no DDL), `observed` (Prisma reads but never writes). Declare `@@control(managed|tolerated|external|observed)` in your schema; see `references/contract.md` and [`packages/2-sql-family/2-authoring/contract-psl/README.md`](https://github.com/prisma/orm/blob/main/packages/2-sql-family/2-authoring/contract-psl/README.md) for authoring syntax.
|
|
563
563
|
|
|
564
564
|
## Telemetry
|
|
565
565
|
|
|
@@ -689,7 +689,7 @@ Cross-namespace relations (e.g. `public.Profile` → `auth.User`) follow the sam
|
|
|
689
689
|
|
|
690
690
|
- Example queries under [`examples/prisma-8-demo/src/orm-client/`](examples/prisma-8-demo/src/orm-client/) and [`examples/prisma-8-demo/src/queries/`](examples/prisma-8-demo/src/queries/) — canonical ORM and SQL-builder shapes.
|
|
691
691
|
- ORM client source under `packages/3-extensions/sql-orm-client/src/`.
|
|
692
|
-
- SQL builder source under `packages/2-sql/4-lanes/sql-builder/src/`.
|
|
692
|
+
- SQL builder source under `packages/2-sql-family/4-lanes/sql-builder/src/`.
|
|
693
693
|
|
|
694
694
|
## Checklist
|
|
695
695
|
|
|
@@ -252,7 +252,7 @@ export const db = postgres({
|
|
|
252
252
|
|
|
253
253
|
`mode` decides what a budget violation does. It is `'strict'` by default, and every `budgets()` violation throws. Pass `mode: 'permissive'` to `postgres()`, `postgresServerless()`, `sqlite()` or `supabase()`, and a violation whose severity is `'warn'` goes to `log.warn` instead, and the query runs; a violation whose severity is `'error'` still throws. `budgets()` gives latency `'warn'` and the row count `'error'` by default, so a row-count limit warns only with `severities: { rowCount: 'warn' }`.
|
|
254
254
|
|
|
255
|
-
For the full option surface, read the source: `packages/2-sql/5-runtime/src/middleware/lints.ts` and `.../budgets.ts`. The `severities` keys (`selectStar`, `noLimit`, `deleteWithoutWhere`, `updateWithoutWhere`, `readOnlyMutation` for lints; `rowCount`, `latency` for budgets) are the source of truth; do not extrapolate to a key that is not in those two files. `lints()` with no argument uses the default severities.
|
|
255
|
+
For the full option surface, read the source: `packages/2-sql-family/5-runtime/src/middleware/lints.ts` and `.../budgets.ts`. The `severities` keys (`selectStar`, `noLimit`, `deleteWithoutWhere`, `updateWithoutWhere`, `readOnlyMutation` for lints; `rowCount`, `latency` for budgets) are the source of truth; do not extrapolate to a key that is not in those two files. `lints()` with no argument uses the default severities.
|
|
256
256
|
|
|
257
257
|
## Workflow — Cache middleware
|
|
258
258
|
|
|
@@ -445,7 +445,7 @@ The runtime side (this skill) is the same regardless: `db.ts` reads `contract.js
|
|
|
445
445
|
|
|
446
446
|
## Reference Files
|
|
447
447
|
|
|
448
|
-
This skill is intentionally body-only; `prisma orm init --help`, the target `defineConfig` (`ormConfig`) factory in `packages/3-
|
|
448
|
+
This skill is intentionally body-only; `prisma orm init --help`, the target `defineConfig` (`ormConfig`) factory in `packages/3-targets/postgres/9-facade/src/config/define-config.ts`, the `postgres()` factory in `packages/3-targets/postgres/9-facade/src/runtime/postgres.ts`, the middleware sources in `packages/2-sql-family/5-runtime/src/middleware/{lints,budgets}.ts`, and `packages/3-extensions/middleware-cache/README.md` are the authoritative surfaces for option-level detail. When in doubt, read the source.
|
|
449
449
|
|
|
450
450
|
## Checklist
|
|
451
451
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite-Yizsft25-m9Hoa392.d.mts","names":[],"sources":["../../../../3-extensions/sqlite/dist/sqlite-Yizsft25.d.mts"],"mappings":";;;;;;;;;;KASK,aAAa,kBAAkB,SAAS,eAAe,GAAG,kBAAkB;KAC5E,aAAa,kBAAkB,SAAS,eAAe,gBAAgB,kBAAkB;UACpF,oBAAoB,kBAAkB,SAAS,qBAAqB;WACnE,SAAS,iBAAiB;WAC1B,UAAU;WACV,OAAO,aAAa;WACpB,KAAK,aAAa;WAClB,KAAK,QAAQ;;;;;;;;;;;iBAWP,aAAa,kBAAkB,SAAS,aAAa;WAC3D,UAAU;WACV,sBAAsB,8BAA8B;IAC3D,oBAAoB;;;KAGnB;KACA,UAAU,kBAAkB,SAAS,aAAa,qBAAqB,qBAAqB,kBAAkB,IAAI,WAAW;KAC7H,WAAW,kBAAkB,SAAS,eAAe,GAAG,kBAAkB;KAC1E,WAAW,kBAAkB,SAAS,aAAa,qBAAqB,qBAAqB,UAAU,WAAW,qBAAqB;;KAEvI,UAAU,kBAAkB,SAAS,aAAa,qBAAqB,oBAAoB,gDAAgD,WAAW,WAAW,gBAAgB,WAAW,WAAW,gBAAgB,WAAW,WAAW,gBAAgB,qBAAqB;;UAE7Q,mBAAmB,kBAAkB,SAAS,aAAa,qBAAqB,oBAAoB,6BAA6B,cAAc,YAAY,cAAc;WACxK,KAAK,WAAW;WAChB,KAAK,UAAU,WAAW;WAC1B,KAAK,QAAQ;;UAEd,yBAAyB,kBAAkB,SAAS,aAAa,qBAAqB,oBAAoB,6BAA6B,oBAAoB,mBAAmB,WAAW;WACxL,OAAO,oBAAoB;;UAE5B,oBAAoB,kBAAkB,SAAS,qBAAqB,oBAAoB;WACvF,OAAO,4BAA4B;;UAEpC,aAAa,kBAAkB,SAAS,aAAa,qBAAqB,oBAAoB,6BAA6B,mBAAmB,WAAW,eAAe,oBAAoB;EACpM,QAAQ;aACG;MACP,QAAQ;EACZ,WAAW;EACX,YAAY,GAAG,KAAK,IAAI,yBAAyB,WAAW,kBAAkB,YAAY,KAAK,QAAQ;EACvG,SAAS;GACR,OAAO,iBAAiB;;UAEjB;WACC,sBAAsB,8BAA8B;WACpD,sBAAsB;WACtB,eAAe;WACf,MAAM;WACN,OAAO;;KAEb,cAAc,kBAAkB,SAAS,aAAa,qBAAqB,oBAAoB,uBAAuB;WAChH,UAAU;WACV,cAAc;WACd;;;;;;;;;;;;;;;;;;;iBAmBM,OAAO,kBAAkB,SAAS,aAAa,qBAAqB,oBAAoB,qBAAqB,SAAS,cAAc,WAAW,gBAAgB,aAAa,WAAW"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite-static-DMWlQGW2-BVWOdPt1.mjs","names":[],"sources":["../../../../3-extensions/sqlite/dist/sqlite-static-DMWlQGW2.mjs"],"sourcesContent":["import sqliteAdapter from \"@internal/adapter-sqlite/runtime\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { createRawLane, sql } from \"@internal/sql-builder/runtime\";\nimport { createExecutionContext, createSqlExecutionStack, createToSql } from \"@internal/sql-runtime\";\nimport sqliteTarget, { SqliteContractSerializer } from \"@internal/target-sqlite/runtime\";\nimport { assertDefined } from \"@internal/utils/assertions\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { validateContractOnce } from \"@internal/contract/validate-once\";\nimport { buildNamespacedEnums } from \"@internal/contract/enum-accessor\";\n//#region package.json\nvar version = \"8.0.0-rc.19-dev.9\";\n//#endregion\n//#region src/static/contract-from-json.ts\nconst serializer = new SqliteContractSerializer();\nconst validator = `${sqliteTarget.targetId}@${version}`;\n/**\n* Validates an emitted SQLite `contract.json` and returns it as the contract type the application\n* names, ready to pass to `sqlite({ contract })` and `sqliteStatic({ contract })`. Clients built\n* from the result do not validate it again.\n*\n* The returned value's top level is frozen; its nested objects are not. Do not change `json` or the\n* returned value after the call: clients built from the value later do not validate it again.\n*\n* @example\n* ```ts\n* import type { Contract } from './contract.d';\n* import contractJson from './contract.json' with { type: 'json' };\n*\n* export const contract = contractFromJson<Contract>(contractJson);\n* ```\n*/\nfunction contractFromJson(json) {\n\treturn validateContractOnce(json, validator, (input) => serializer.deserializeContract(input));\n}\nfunction validateSqliteContract(contract) {\n\treturn validateContractOnce(contract, validator, () => serializer.deserializeContract(serializer.serializeContract(contract)));\n}\n//#endregion\n//#region src/static/sqlite-static.ts\nfunction buildSqliteStaticContext(contract, context, stack) {\n\tconst { rawCodecInferer } = stack.adapter;\n\tconst sqlNamespace = sql({\n\t\tcontext,\n\t\trawCodecInferer\n\t})[UNBOUND_NAMESPACE_ID];\n\tassertDefined(sqlNamespace, \"the unbound namespace always exists on a sqlite builder output\");\n\tconst sqlDb = blindCast(sqlNamespace);\n\tconst raw = createRawLane({\n\t\tcontext,\n\t\trawCodecInferer\n\t});\n\tconst enums = Object.freeze(buildNamespacedEnums(context.contract.domain, (codecId) => context.contractCodecs.forCodecRef({ codecId })))[UNBOUND_NAMESPACE_ID];\n\tassertDefined(enums, \"the unbound namespace always exists on a sqlite builder output\");\n\treturn {\n\t\tcontext,\n\t\tcontract,\n\t\tenums,\n\t\tsql: sqlDb,\n\t\traw,\n\t\ttoSql: createToSql(stack, contract)\n\t};\n}\n/**\n* The query surfaces of a SQLite client without a driver: `sql`, `raw`, `enums` and `toSql`. Use\n* it where loading `node:sqlite` is not wanted.\n*\n* @example\n* ```ts\n* const { enums } = sqliteStatic({ contract: contractFromJson<Contract>(contractJson) });\n* ```\n*/\nfunction sqliteStatic(options) {\n\tconst contract = validateSqliteContract(options.contract);\n\tconst stack = createSqlExecutionStack({\n\t\ttarget: sqliteTarget,\n\t\tadapter: sqliteAdapter,\n\t\textensions: options.extensions ?? []\n\t});\n\treturn buildSqliteStaticContext(contract, createExecutionContext({\n\t\tcontract,\n\t\tstack\n\t}), stack);\n}\n//#endregion\nexport { validateSqliteContract as i, sqliteStatic as n, contractFromJson as r, buildSqliteStaticContext as t };\n\n//# sourceMappingURL=sqlite-static-DMWlQGW2.mjs.map"],"mappings":";;;;;;;;;;AAUA,IAAI,UAAU;AAGd,MAAM,aAAa,IAAI,yBAAyB;AAChD,MAAM,YAAY,GAAG,aAAa,SAAS,GAAG;;;;;;;;;;;;;;;;;AAiB9C,SAAS,iBAAiB,MAAM;CAC/B,OAAO,qBAAqB,MAAM,YAAY,UAAU,WAAW,oBAAoB,KAAK,CAAC;AAC9F;AACA,SAAS,uBAAuB,UAAU;CACzC,OAAO,qBAAqB,UAAU,iBAAiB,WAAW,oBAAoB,WAAW,kBAAkB,QAAQ,CAAC,CAAC;AAC9H;AAGA,SAAS,yBAAyB,UAAU,SAAS,OAAO;CAC3D,MAAM,EAAE,oBAAoB,MAAM;CAClC,MAAM,eAAe,IAAI;EACxB;EACA;CACD,CAAC,CAAC,CAAC;CACH,cAAc,cAAc,gEAAgE;CAC5F,MAAM,QAAQ,UAAU,YAAY;CACpC,MAAM,MAAM,cAAc;EACzB;EACA;CACD,CAAC;CACD,MAAM,QAAQ,OAAO,OAAO,qBAAqB,QAAQ,SAAS,SAAS,YAAY,QAAQ,eAAe,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;CACzI,cAAc,OAAO,gEAAgE;CACrF,OAAO;EACN;EACA;EACA;EACA,KAAK;EACL;EACA,OAAO,YAAY,OAAO,QAAQ;CACnC;AACD;;;;;;;;;;AAUA,SAAS,aAAa,SAAS;CAC9B,MAAM,WAAW,uBAAuB,QAAQ,QAAQ;CACxD,MAAM,QAAQ,wBAAwB;EACrC,QAAQ;EACR,SAAS;EACT,YAAY,QAAQ,cAAc,CAAC;CACpC,CAAC;CACD,OAAO,yBAAyB,UAAU,uBAAuB;EAChE;EACA;CACD,CAAC,GAAG,KAAK;AACV"}
|