@prisma/orm-sqlite 8.0.0-rc.20-dev.14 → 8.0.0-rc.21
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/contract-builder.d.mts +13 -2
- package/dist/contract-builder.d.mts.map +1 -1
- package/dist/contract-builder.mjs +16 -3
- package/dist/contract-builder.mjs.map +1 -1
- package/dist/family-contract__generated-id-column-aliases.d.mts +1 -0
- package/dist/family-contract__generated-id-column-aliases.mjs +2 -0
- package/dist/runtime.mjs +1 -1
- package/dist/runtime.mjs.map +1 -1
- package/dist/{sqlite-static-6IPSrqCZ-DMDoKImd.mjs → sqlite-static-it8WMwdV-DjZr9Ye9.mjs} +3 -3
- package/dist/sqlite-static-it8WMwdV-DjZr9Ye9.mjs.map +1 -0
- package/dist/static.mjs +1 -1
- package/package.json +9 -8
- package/skills/prisma-8/SKILL.md +1 -1
- package/skills/prisma-8/references/contract.md +11 -11
- package/skills/prisma-8/references/debug.md +1 -1
- package/skills/prisma-8/references/queries-postgres.md +4 -4
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.18-to-8.0.0-rc.19/instructions.md +1 -1
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.19-to-8.0.0-rc.20/instructions.md +2 -2
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.20-to-8.0.0-rc.21/instructions.md +802 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.20-to-8.0.0-rc.21/instructions.md +570 -0
- package/dist/sqlite-static-6IPSrqCZ-DMDoKImd.mjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import sqlitePackRef from "@prisma/orm-target-sqlite/target/pack";
|
|
2
|
-
import { ComposedAuthoringHelpers, ComposedAuthoringHelpers as ComposedAuthoringHelpers$1, ContractDefinition, ContractInput, ContractInput as ContractInput$1, ContractModelBuilder, EnumTypeHandle, FieldNode, ForeignKeyNode, IndexNode, MergeEnums, ModelLike, ModelLike as ModelLike$1, ModelNode, PrimaryKeyNode, RelationNode, ScalarFieldBuilder, SqlExpression, UniqueConstraintNode, autoincrement, buildBoundContract,
|
|
2
|
+
import { ComposedAuthoringHelpers, ComposedAuthoringHelpers as ComposedAuthoringHelpers$1, ContractDefinition, ContractInput, ContractInput as ContractInput$1, ContractModelBuilder, EnumTypeHandle, FieldNode, ForeignKeyNode, IndexNode, MergeEnums, ModelLike, ModelLike as ModelLike$1, ModelNode, PrimaryKeyNode, RelationNode, ScalarFieldBuilder, SqlExpression, UniqueConstraintNode, autoincrement, buildBoundContract, member, model, now, rel, sql } from "@prisma/orm-family-sql/contract-ts/contract-builder";
|
|
3
3
|
import { sqliteAdapterContractContributions } from "@prisma/orm-target-sqlite/adapter/adapter";
|
|
4
4
|
import sqlFamilyPack from "@prisma/orm-family-sql/family/pack";
|
|
5
5
|
import "@prisma/orm-framework/components/authoring";
|
|
@@ -212,11 +212,22 @@ declare const enumType: BoundEnumType<{
|
|
|
212
212
|
}, "traits" | "output" | "input">;
|
|
213
213
|
}>;
|
|
214
214
|
//#endregion
|
|
215
|
+
//#region src/contract/field.d.ts
|
|
216
|
+
type SqliteHelpers = ComposedAuthoringHelpers$1<typeof sqlFamilyPack, typeof sqlitePackRef, undefined>;
|
|
217
|
+
/**
|
|
218
|
+
* The field builders of the `defineContract` callback for SQLite, without extensions: `field.column(type.DateTime())`. Use it outside a contract, for example to declare the fields of a query fragment.
|
|
219
|
+
*/
|
|
220
|
+
declare const field: SqliteHelpers['field'];
|
|
221
|
+
/**
|
|
222
|
+
* The type constructors and type aliases of the `defineContract` callback for SQLite, without extensions, for `field.column(...)`: `type.DateTime()`, `type.sql.Ulid()`, `type.temporal.CreatedAt()`.
|
|
223
|
+
*/
|
|
224
|
+
declare const type: SqliteHelpers['type'];
|
|
225
|
+
//#endregion
|
|
215
226
|
//#region src/contract/gen.d.ts
|
|
216
227
|
/**
|
|
217
228
|
* 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()`.
|
|
218
229
|
*/
|
|
219
230
|
declare const gen: ComposedAuthoringHelpers$1<typeof sqlFamilyPack, typeof sqlitePackRef, undefined>['gen'];
|
|
220
231
|
//#endregion
|
|
221
|
-
export { type ComposedAuthoringHelpers, type ContractDefinition, type ContractInput, type ContractModelBuilder, type FieldNode, type ForeignKeyNode, type IndexNode, type ModelLike, type ModelNode, type PrimaryKeyNode, type RelationNode, type ScalarFieldBuilder, type SqlExpression, type UniqueConstraintNode, autoincrement, defineContract, enumType, field, gen, member, model, now, rel, sql };
|
|
232
|
+
export { type ComposedAuthoringHelpers, type ContractDefinition, type ContractInput, type ContractModelBuilder, type FieldNode, type ForeignKeyNode, type IndexNode, type ModelLike, type ModelNode, type PrimaryKeyNode, type RelationNode, type ScalarFieldBuilder, type SqlExpression, type UniqueConstraintNode, autoincrement, defineContract, enumType, field, gen, member, model, now, rel, sql, type };
|
|
222
233
|
//# sourceMappingURL=contract-builder.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract-builder.d.mts","names":[],"sources":["../../../../3-targets/sqlite/9-facade/dist/contract-builder.d.mts"],"mappings":";;;;;;;;;;;;KAWK,mBAAmB;KACnB,oBAAoB;KACpB,0BAA0B,eAAe;KACzC,mBAAmB,eAAe;KAClC,kBAAkB,eAAe;KACjC,+BAA+B;;KAE/B,uBAAuB;KACvB,aAAa,sBAAsB,yBAAyB,eAAe,kBAAkB,mBAAmB,eAAe,8CAA8C,cAAc,iBAAiB,2BAA2B,4CAA4C,kBAAkB,mBAAmB,WAAW;WAC7T,gBAAgB;WAChB,SAAS;WACT,aAAa;WACb,QAAQ;WACR,SAAS;WACT,qBAAqB;WACrB,kBAAkB,OAAO,sBAAsB;WAC/C,aAAa;WACb,gBAAgB;;KAEtB,mBAAmB,mBAAmB,eAA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EV,SAAS;;WAET;aACE;aACA,OAAO;;;WAGT,QAAQ;;WAER,OAAO;;;;;WAKP,SAAS;;EAElB,IAAI,GAAG;;EAEP,OAAO,GAAG;;EAEV,UAAU,GAAG;;;;;;;;KAQV,eAAe;WACT;;;;;;;;KAQN,WAAW,mBAAmB,cAAc;WACtC;KACN,+BAA+B,aAAa,WAAW;WACjD,aAAa;IACpB;;;;;;;;KAQC,cAAc,mBAAmB,uBAAuB,2BAA2B,cAAc,KAAK,wCAAwC,0BAA0B,mBAAmB,WAAW,YAAY,YAAY,mBAAmB,WAAW,YAAY,YAAY,MAAM,MAAM,OAAO,UAAU,SAAS,YAAY,iBAAiB,MAAM,oBAAoB,WAAW,mBAAmB,WAAW,uBAAuB,WAAW;;;;cAInb,UAAU;WACb,cAAc;aACZ;aACA;aACA,yCAAyC;aACzC;;WAEF,iBAAiB;aACf;aACA;aACA,yCAAyC;aACzC;;WAEF,aAAa;aACX;aACA;aACA,yCAAyC;aACzC;;WAEF,eAAe;aACb;aACA;aACA,yCAAyC;aACzC;;WAEF,iBAAiB;aACf;aACA;aACA,yCAAyC;aACzC;;WAEF,oBAAoB;aAClB;aACA;aACA,yCAAyC;aACzC;;WAEF,iBAAiB;aACf;aACA;aACA,yCAAyC;aACzC;;WAEF,iBAAiB;aACf,OAAO,WAAW;aAClB,QAAQ,WAAW;aACnB,yCAAyC;aACzC;;WAEF,qBAAqB;aACnB,OAAO;aACP,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
|
|
1
|
+
{"version":3,"file":"contract-builder.d.mts","names":[],"sources":["../../../../3-targets/sqlite/9-facade/dist/contract-builder.d.mts"],"mappings":";;;;;;;;;;;;KAWK,m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nB,yCAAyC;aACzC;;WAEF,qBAAqB;aACnB,OAAO;aACP,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;;;;;KAKR,gBAAgB,kCAAkC,sBAAsB;;;;cAI/D,OAAO;;;;cAIP,MAAM;;;;;;cAMN,KAAK,kCAAkC,sBAAsB"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { sqliteCreateNamespace } from "@prisma/orm-target-sqlite/target/control";
|
|
2
2
|
import sqlitePackRef from "@prisma/orm-target-sqlite/target/pack";
|
|
3
|
-
import { autoincrement, bindEnumType, buildBoundContract,
|
|
3
|
+
import { autoincrement, bindEnumType, buildBoundContract, createComposedAuthoringHelpers, member, model, now, rel, sql } from "@prisma/orm-family-sql/contract-ts/contract-builder";
|
|
4
4
|
import { sqliteAdapterContractContributions } from "@prisma/orm-target-sqlite/adapter/adapter";
|
|
5
5
|
import sqlFamilyPack from "@prisma/orm-family-sql/family/pack";
|
|
6
6
|
import { assembleDataTypeSupport } from "@prisma/orm-framework/components/authoring";
|
|
7
|
-
import { assembleSqliteCodecRegistry } from "@prisma/orm-target-sqlite/target/codecs";
|
|
7
|
+
import { assembleSqliteCodecRegistry, createSqliteBuiltinCodecLookup } from "@prisma/orm-target-sqlite/target/codecs";
|
|
8
8
|
import { createGeneratorHelpers } from "@prisma/orm-framework/components/components";
|
|
9
9
|
//#region ../../../3-targets/sqlite/9-facade/dist/contract-builder.mjs
|
|
10
10
|
const adapter = sqliteAdapterContractContributions;
|
|
@@ -27,11 +27,24 @@ function defineContract(definition, factory) {
|
|
|
27
27
|
}
|
|
28
28
|
/** `enumType` bound to the pack's codec types, so each `member()` value is checked against the enum codec's input type. */
|
|
29
29
|
const enumType = bindEnumType();
|
|
30
|
+
const helpers = createComposedAuthoringHelpers({
|
|
31
|
+
family: sqlFamilyPack,
|
|
32
|
+
target: sqlitePackRef,
|
|
33
|
+
codecLookup: createSqliteBuiltinCodecLookup()
|
|
34
|
+
});
|
|
35
|
+
/**
|
|
36
|
+
* The field builders of the `defineContract` callback for SQLite, without extensions: `field.column(type.DateTime())`. Use it outside a contract, for example to declare the fields of a query fragment.
|
|
37
|
+
*/
|
|
38
|
+
const field = helpers.field;
|
|
39
|
+
/**
|
|
40
|
+
* The type constructors and type aliases of the `defineContract` callback for SQLite, without extensions, for `field.column(...)`: `type.DateTime()`, `type.sql.Ulid()`, `type.temporal.CreatedAt()`.
|
|
41
|
+
*/
|
|
42
|
+
const type = helpers.type;
|
|
30
43
|
/**
|
|
31
44
|
* 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()`.
|
|
32
45
|
*/
|
|
33
46
|
const gen = createGeneratorHelpers([sqlFamilyPack, sqlitePackRef]);
|
|
34
47
|
//#endregion
|
|
35
|
-
export { autoincrement, defineContract, enumType, field, gen, member, model, now, rel, sql };
|
|
48
|
+
export { autoincrement, defineContract, enumType, field, gen, member, model, now, rel, sql, type };
|
|
36
49
|
|
|
37
50
|
//# sourceMappingURL=contract-builder.mjs.map
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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, createComposedAuthoringHelpers, 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, createSqliteBuiltinCodecLookup } 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/field.ts\nconst helpers = createComposedAuthoringHelpers({\n\tfamily: sqlFamilyPack,\n\ttarget: sqlitePackRef,\n\tcodecLookup: createSqliteBuiltinCodecLookup()\n});\n/**\n* The field builders of the `defineContract` callback for SQLite, without extensions: `field.column(type.DateTime())`. Use it outside a contract, for example to declare the fields of a query fragment.\n*/\nconst field = helpers.field;\n/**\n* The type constructors and type aliases of the `defineContract` callback for SQLite, without extensions, for `field.column(...)`: `type.DateTime()`, `type.sql.Ulid()`, `type.temporal.CreatedAt()`.\n*/\nconst type = helpers.type;\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, type };\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;AAG9B,MAAM,UAAU,+BAA+B;CAC9C,QAAQ;CACR,QAAQ;CACR,aAAa,+BAA+B;AAC7C,CAAC;;;;AAID,MAAM,QAAQ,QAAQ;;;;AAItB,MAAM,OAAO,QAAQ;;;;AAMrB,MAAM,MAAM,uBAAuB,CAAC,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@prisma/orm-family-sql/contract/generated-id-column-aliases";
|
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-it8WMwdV-DjZr9Ye9.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";
|
package/dist/runtime.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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-6IPSrqCZ.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, delegatingRuntime, 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 workRuntime = delegatingRuntime(getRuntime);\n\tconst orm$1 = sqliteOrm(orm({\n\t\tcontext,\n\t\t...ifDefined(\"collections\", options.collections),\n\t\truntime: workRuntime\n\t}));\n\tfunction prepare(declaration, callback) {\n\t\treturn prepareQuery(workRuntime, 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 workRuntime.query(plan, execOptions);\n\t\t},\n\t\texecute(plan, execOptions) {\n\t\t\treturn workRuntime.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\treturn withTransaction(workRuntime, (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: workRuntime\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,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AAM,aAAa;GAC1B,OAAO,YAAY,QAAQ,MAAM,WAAW;EAC7C;EACA,MAAM,QAAQ,cAAc;GAC3B,IAAI,QAAQ,MAAM,YAAY,wBAAwB,2BAA2B,EAAE,MAAM,EAAE,WAAW,SAAS,EAAE,CAAC;GAClH,IAAI,mBAAmB,gBAAgB,MAAM,YAAY,4BAA4B,mCAAmC,EAAE,MAAM,EAAE,WAAW,SAAS,EAAE,CAAC;GACzJ,yBAAyB,KAAK;GAC9B,IAAI,iBAAiB,KAAK,GAAG,UAAU,qBAAqB,YAAY;GACxE,IAAI,YAAY,KAAK,GAAG,MAAM,YAAY,2BAA2B,yFAAyF,EAAE,MAAM,EAAE,WAAW,SAAS,EAAE,CAAC;GAC/L,MAAM,UAAU,WAAW;GAC3B,IAAI,iBAAiB,OAAO;GAC5B,MAAM,cAAc,OAAO;GAC3B,OAAO;EACR;EACA,UAAU;GACT,OAAO,WAAW;EACnB;EACA;EACA,YAAY,IAAI;GACf,OAAO,gBAAgB,cAAc,UAAU;IAC9C,OAAO,GAAG,uBAAuB,OAAO,8BAA8B;KACrE;KACA,aAAa,QAAQ;KACrB,iBAAiB,MAAM,QAAQ;KAC/B;KACA;KACA,gBAAgB;IACjB,GAAG,KAAK,CAAC,CAAC;GACX,CAAC;EACF;EACA,QAAQ;GACP,IAAI,cAAc,OAAO;GACzB,SAAS;GACT,gBAAgB,YAAY;IAC3B,MAAM,gBAAgB,YAAY,KAAK,CAAC;IACxC,MAAM,eAAe;GACtB,EAAA,CAAG;GACH,OAAO;EACR;EACA,CAAC,OAAO,gBAAgB;GACvB,OAAO,KAAK,MAAM;EACnB;CACD;AACD"}
|
|
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-it8WMwdV.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, delegatingRuntime, 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 workRuntime = delegatingRuntime(getRuntime);\n\tconst orm$1 = sqliteOrm(orm({\n\t\tcontext,\n\t\t...ifDefined(\"collections\", options.collections),\n\t\truntime: workRuntime\n\t}));\n\tfunction prepare(declaration, callback) {\n\t\treturn prepareQuery(workRuntime, 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 workRuntime.query(plan, execOptions);\n\t\t},\n\t\texecute(plan, execOptions) {\n\t\t\treturn workRuntime.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\treturn withTransaction(workRuntime, (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: workRuntime\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,OAAO;CACtD,MAAM,EAAE,SAAS,aAAa,iBAAiB,OAAO,OAAO,mBAAmB;CAChF,MAAM,eAAe,IAAI;EACxB;EACA;CACD,CAAC,CAAC,CAAC;CACH,cAAc,cAAc,gEAAgE;CAC5F,OAAO;EACN,KAAK,UAAU,YAAY;EAC3B,KAAK,UAAU,IAAI;GAClB,SAAS;IACR,MAAM,MAAM;KACX,OAAO,MAAM,MAAM,IAAI;IACxB;IACA,QAAQ,MAAM;KACb,OAAO,MAAM,QAAQ,IAAI;IAC1B;KACC,iBAAiB,+BAA+B,KAAK;GACvD;GACA;GACA,GAAG,UAAU,eAAe,WAAW;EACxC,CAAC,CAAC;EACF,KAAK,cAAc;GAClB;GACA;EACD,C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AU;GACT,OAAO,WAAW;EACnB;EACA;EACA,YAAY,IAAI;GACf,OAAO,gBAAgB,cAAc,UAAU;IAC9C,OAAO,GAAG,uBAAuB,OAAO,8BAA8B;KACrE;KACA,aAAa,QAAQ;KACrB,iBAAiB,MAAM,QAAQ;KAC/B;KACA;KACA,gBAAgB;IACjB,GAAG,KAAK,CAAC,CAAC;GACX,CAAC;EACF;EACA,QAAQ;GACP,IAAI,cAAc,OAAO;GACzB,SAAS;GACT,gBAAgB,YAAY;IAC3B,MAAM,gBAAgB,YAAY,KAAK,CAAC;IACxC,MAAM,eAAe;GACtB,EAAA,CAAG;GACH,OAAO;EACR;EACA,CAAC,OAAO,gBAAgB;GACvB,OAAO,KAAK,MAAM;EACnB;CACD;AACD"}
|
|
@@ -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-targets/sqlite/9-facade/dist/sqlite-static-
|
|
11
|
-
var version = "8.0.0-rc.
|
|
10
|
+
//#region ../../../3-targets/sqlite/9-facade/dist/sqlite-static-it8WMwdV.mjs
|
|
11
|
+
var version = "8.0.0-rc.21";
|
|
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-it8WMwdV-DjZr9Ye9.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sqlite-static-it8WMwdV-DjZr9Ye9.mjs","names":[],"sources":["../../../../3-targets/sqlite/9-facade/dist/sqlite-static-it8WMwdV.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.21\";\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-it8WMwdV.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.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-it8WMwdV-DjZr9Ye9.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.
|
|
3
|
+
"version": "8.0.0-rc.21",
|
|
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.
|
|
14
|
-
"@prisma/orm-framework": "8.0.0-rc.
|
|
15
|
-
"@prisma/orm-target-sqlite": "8.0.0-rc.
|
|
16
|
-
"@prisma/orm-toolchain": "8.0.0-rc.
|
|
13
|
+
"@prisma/orm-family-sql": "8.0.0-rc.21",
|
|
14
|
+
"@prisma/orm-framework": "8.0.0-rc.21",
|
|
15
|
+
"@prisma/orm-target-sqlite": "8.0.0-rc.21",
|
|
16
|
+
"@prisma/orm-toolchain": "8.0.0-rc.21",
|
|
17
17
|
"pathe": "^2.0.3",
|
|
18
18
|
"tinyglobby": "^0.2.17"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@internal/sqlite": "8.0.0-rc.
|
|
22
|
-
"@repo/tsconfig": "8.0.0-rc.
|
|
23
|
-
"@repo/tsdown": "8.0.0-rc.
|
|
21
|
+
"@internal/sqlite": "8.0.0-rc.21",
|
|
22
|
+
"@repo/tsconfig": "8.0.0-rc.21",
|
|
23
|
+
"@repo/tsdown": "8.0.0-rc.21",
|
|
24
24
|
"tsdown": "0.22.14",
|
|
25
25
|
"typescript": "5.9.3"
|
|
26
26
|
},
|
|
@@ -93,6 +93,7 @@
|
|
|
93
93
|
"./family-contract/entity-kinds": "./dist/family-contract__entity-kinds.mjs",
|
|
94
94
|
"./family-contract/factories": "./dist/family-contract__factories.mjs",
|
|
95
95
|
"./family-contract/foreign-key-materialization": "./dist/family-contract__foreign-key-materialization.mjs",
|
|
96
|
+
"./family-contract/generated-id-column-aliases": "./dist/family-contract__generated-id-column-aliases.mjs",
|
|
96
97
|
"./family-contract/index-naming": "./dist/family-contract__index-naming.mjs",
|
|
97
98
|
"./family-contract/index-type-validation": "./dist/family-contract__index-type-validation.mjs",
|
|
98
99
|
"./family-contract/index-types": "./dist/family-contract__index-types.mjs",
|
package/skills/prisma-8/SKILL.md
CHANGED
|
@@ -64,7 +64,7 @@ Both files are **emitted artefacts**. Edit the source; never the JSON or `.d.ts`
|
|
|
64
64
|
|
|
65
65
|
The fields `ormConfig` accepts: `contract` (path string — `.prisma` or `.ts`), `output` (optional override for where `contract.json` lands), `db` (`{ connection?: string }`), `extensions` (array of control descriptors), `migrations` (`{ dir?: string }`). Without `output`, the path for `contract.json` is derived from `contract` (e.g. `./src/prisma/contract.prisma` → `./src/prisma/contract.json`). Keep `import 'dotenv/config'` when the config reads `process.env`.
|
|
66
66
|
- **Emit pipeline.** `prisma contract emit --config <path>?` reads `prisma.config.ts`, calls the provider the façade picked, validates the resulting Contract, then atomically writes `contract.json` + `contract.d.ts` colocated with the source.
|
|
67
|
-
- **Extension namespaces.** Extensions contribute namespaced constructors (`pgvector.Vector(length: 1536)`, `postgis.Geometry(...)`) and
|
|
67
|
+
- **Extension namespaces.** Extensions contribute namespaced constructors (`pgvector.Vector(length: 1536)`, `postgis.Geometry(...)`) and type aliases. Install them by adding the descriptor to **two** places — both fields are named `extensions`, but the two surfaces consume two different descriptor types and shapes:
|
|
68
68
|
- **In the config (façade and core):** `extensions: [pgvector]` — array of *control* descriptors imported from `@internal/extension-<name>/control`.
|
|
69
69
|
- **In the TS builder's `defineContract` (only when authoring `contract.ts`):** `extensions: { pgvector }` — record of *pack* descriptors imported from `@internal/extension-<name>/pack`.
|
|
70
70
|
- **Contract space.** Every package that emits a contract owns its own *contract space* — a `prisma.config.ts` at package root, a contract source, the colocated emitted artefacts, and a `migrations/` directory. **There are two intentional on-disk layouts**, picked by whether the contract space is the consuming application or a contract-space package (an extension, an internal aggregate-root package, etc.):
|
|
@@ -156,17 +156,17 @@ model User {
|
|
|
156
156
|
}
|
|
157
157
|
```
|
|
158
158
|
|
|
159
|
-
An alias is expanded into each field that uses it: the column stores the alias's codec and type params, and the contract stores no alias. An alias may carry `@default`, `@onCreate` and `@onUpdate`, which every field typed by it takes: `UpdatedAt = TimestampString(3) @onCreate(now()) @onUpdate(now())`. It may not carry `@id` or `@unique`; write those on the field. A field may add attributes its alias does not set (`updatedAt UpdatedAt @default(now())`), but repeating one the alias sets is `PSL_DUPLICATE_ATTRIBUTE`. An alias may not name another alias. The targets contribute `temporal.CreatedAt` (generated on create) and `temporal.UpdatedAt` (on create and on update), written bare: `createdAt temporal.CreatedAt`. On Postgres they are `TimestamptzTemporal` columns, with `temporal.CreatedAtString` / `UpdatedAtString` and `CreatedAtJsDate` / `UpdatedAtJsDate` variants; on SQLite `DateTime`; on Mongo `Date`. They take no arguments; for a precision, write the type and attributes, as in `TimestamptzTemporal(3) @onCreate(now())`.
|
|
159
|
+
An alias is expanded into each field that uses it: the column stores the alias's codec and type params, and the contract stores no alias. An alias may carry `@default`, `@onCreate` and `@onUpdate`, which every field typed by it takes: `UpdatedAt = TimestampString(3) @onCreate(now()) @onUpdate(now())`. It may not carry `@id` or `@unique`; write those on the field. A field may add attributes its alias does not set (`updatedAt UpdatedAt @default(now())`), but repeating one the alias sets is `PSL_DUPLICATE_ATTRIBUTE`. An alias may not name another alias. The targets contribute `temporal.CreatedAt` (generated on create) and `temporal.UpdatedAt` (on create and on update), written bare: `createdAt temporal.CreatedAt`. On Postgres they are `TimestamptzTemporal` columns, with `temporal.CreatedAtString` / `UpdatedAtString` and `CreatedAtJsDate` / `UpdatedAtJsDate` variants; on SQLite `DateTime`; on Mongo `Date`. They take no arguments; for a precision, write the type and attributes, as in `TimestamptzTemporal(3) @onCreate(now())`. The SQL targets also contribute an alias for the column of each identifier format the client generates: `sql.UuidString`, `sql.Ulid`, `sql.Nanoid`, `sql.Cuid2` and `sql.Ksuid`, which Postgres also names at the top level, as `Ulid`. Each stores `Char(n)` of its format's length and carries no generator, so the key writes `id Ulid @id @onCreate(ulid())` and a foreign key writes `authorId Ulid`. On Postgres, a UUID is better stored in the native column: `id Uuid @id @onCreate(uuid(7))`.
|
|
160
160
|
|
|
161
161
|
Values the client generates are written `@onCreate(fn())` and `@onUpdate(fn())`: `id String @id @onCreate(uuid(7))`, `slug String @onCreate(nanoid(12))`, `updatedAt DateTime @onCreate(now()) @onUpdate(now())`. `@default(...)` is a database default only (`now()`, `autoincrement()`, a literal, or `` sql`...` ``); `@default(uuid())` is refused with `PSL_GENERATOR_IN_DEFAULT`. In the TS builder, write `.onCreate(gen.uuid(7))` and `.onUpdate(gen.now())`. Column defaults and generators can sit on one field: `@default(now()) @onCreate(now())`.
|
|
162
162
|
|
|
163
|
-
In the TS builder, an alias is a constant passed as the field, because field builders are immutable: `const Slug = field.column(type.VarChar(64))`, `const UpdatedAt = field.column(type.TimestampString(3)).onCreate(gen.now()).onUpdate(gen.now())`, then `slug: Slug, updatedAt: UpdatedAt.default(now())`. `type.*` has a helper for every PSL type constructor, and the contributed aliases are `type.temporal.CreatedAt()` and `type.
|
|
163
|
+
In the TS builder, an alias is a constant passed as the field, because field builders are immutable: `const Slug = field.column(type.VarChar(64))`, `const UpdatedAt = field.column(type.TimestampString(3)).onCreate(gen.now()).onUpdate(gen.now())`, then `slug: Slug, updatedAt: UpdatedAt.default(now())`. `type.*` has a helper for every PSL type constructor, and the contributed aliases are `type.temporal.CreatedAt()`, `type.temporal.UpdatedAt()` and the identifier aliases such as `type.Ulid()` (`type.sql.Ulid()` on every SQL target), used as `field.column(type.temporal.UpdatedAt())` and `field.column(type.Ulid()).id().onCreate(gen.ulid())`. A definition has no `types` key (`CONTRACT.TYPES_KEY_REMOVED`), and `field.namedType(...)` takes only an enum handle.
|
|
164
164
|
|
|
165
165
|
Note: scalar lists (e.g. `String[]`) are gated on the target's `sql.scalarList` capability — PostgreSQL declares it, so `tags String[]` lowers to an array column (with a generated no-NULL-elements check; write `tags String?[]` for a list whose elements may be null, which gets no such check); SQLite does not, and rejects the field with `PSL_SCALAR_LIST_UNSUPPORTED_TARGET`. Implicit Prisma-ORM many-to-many (list navigation on both sides without a join model) is rejected by the SQL interpreter — declare the join model explicitly and the ORM traverses it for you (`references/queries.md`). Composite/embeddable types (`type Address { ... }` with `address Address` on a model) are supported: the interpreter lowers them to `valueObjects` in the domain and stores them as `jsonb` columns. See *Workflow — Value objects* below.
|
|
166
166
|
|
|
167
167
|
## Workflow — Edit a model / field / relation (TS builder)
|
|
168
168
|
|
|
169
|
-
The concept: same model, different authoring surface. The façade re-exports `defineContract`, `field`, `model`, `rel`, plus the `family`/`target` packs as default exports of `@internal/postgres/family` and `@internal/postgres/target`. Use the callback overload (`defineContract({...}, ({ field, model, rel, type }) => ({...}))`) to get the
|
|
169
|
+
The concept: same model, different authoring surface. The façade re-exports `defineContract`, `field`, `model`, `rel`, plus the `family`/`target` packs as default exports of `@internal/postgres/family` and `@internal/postgres/target`. Use the callback overload (`defineContract({...}, ({ field, model, rel, type, gen }) => ({...}))`) to get the type constructors, type aliases and generator calls (`field.column(type.String())`, `field.column(type.Uuid()).id().onCreate(gen.uuid(7))`, `field.column(type.temporal.CreatedAt())`, `type.sql.String(35)`).
|
|
170
170
|
|
|
171
171
|
```typescript
|
|
172
172
|
import sqlFamily from '@internal/postgres/family';
|
|
@@ -178,13 +178,13 @@ export const contract = defineContract(
|
|
|
178
178
|
family: sqlFamily,
|
|
179
179
|
target: postgresPack,
|
|
180
180
|
},
|
|
181
|
-
({ field, model }) => ({
|
|
181
|
+
({ field, model, gen, type }) => ({
|
|
182
182
|
models: {
|
|
183
183
|
User: model('User', {
|
|
184
184
|
fields: {
|
|
185
|
-
id: field.id.
|
|
186
|
-
email: field.
|
|
187
|
-
createdAt: field.temporal.
|
|
185
|
+
id: field.column(type.Uuid()).id().onCreate(gen.uuid(7)),
|
|
186
|
+
email: field.column(type.String()).unique(),
|
|
187
|
+
createdAt: field.column(type.temporal.CreatedAt()),
|
|
188
188
|
},
|
|
189
189
|
}).sql({ table: 'app_user' }),
|
|
190
190
|
},
|
|
@@ -192,13 +192,13 @@ export const contract = defineContract(
|
|
|
192
192
|
);
|
|
193
193
|
```
|
|
194
194
|
|
|
195
|
-
Then `pnpm prisma contract emit`. On Postgres,
|
|
195
|
+
Then `pnpm prisma contract emit`. On Postgres, `@prisma/orm-postgres/contract-builder` exports `field`, `type` and `gen`, the same helpers the callback receives, without the ones an extension adds (such as pgvector's `type.pgvector.Vector`); for those, use the callback's helpers. On other targets `type` and `gen` are only available inside the callback overload.
|
|
196
196
|
|
|
197
197
|
For Mongo, swap every `@internal/postgres/*` import for `@internal/mongo/*`. The Mongo builder also exposes `index` and `valueObject`.
|
|
198
198
|
|
|
199
199
|
Mongo scalar types, as PSL name / TS builder / application type: `String` / `field.string()` / `string`; `Int32` / `field.int32()` / `number`; `Int64` / `field.int64()` / `bigint`; `Double` / `field.double()` / `number`; `Decimal128` / `field.decimal128()` / decimal text as a `string`; `Bool` / `field.bool()` / `boolean`; `Date` / `field.date()` / `Date`; `ObjectId` / `field.objectId()` / `string`; `Binary` / `field.binary()` / `Uint8Array`; `Json` / `field.json()` / `JsonValue`; `Bson` / `field.bson()` / `BsonValue`. `Json` holds a JSON value only, validated as the JSON-representable BSON types; `Bson` holds any BSON value, unconstrained by the validator. The full table, with codec ids and storage types, is [Scalar types](https://github.com/prisma/orm/blob/main/docs/reference/scalar-types.md).
|
|
200
200
|
|
|
201
|
-
Mongo timestamps the ORM fills: in PSL, write `createdAt Date @onCreate(now())` (set on create) or `updatedAt Date @onCreate(now()) @onUpdate(now())` (set on create and on every update with a non-empty payload), or type the field `temporal.CreatedAt` or `temporal.UpdatedAt
|
|
201
|
+
Mongo timestamps the ORM fills: in PSL, write `createdAt Date @onCreate(now())` (set on create) or `updatedAt Date @onCreate(now()) @onUpdate(now())` (set on create and on every update with a non-empty payload), or type the field `temporal.CreatedAt` or `temporal.UpdatedAt`; in TS, use `field.date().onCreate(gen.now())` or `field.date().onCreate(gen.now()).onUpdate(gen.now())`. They store a BSON date read back as `Date`, one value per ORM operation, and an explicit value in the write wins. The fields are optional on create. A field with a generated value cannot be optional (`?`), a list, `@id`, or a field of a composite type.
|
|
202
202
|
|
|
203
203
|
## Workflow — Add an extension-typed scalar (pgvector)
|
|
204
204
|
|
|
@@ -505,7 +505,7 @@ Infer captures indexes at full fidelity — expression, partial (`where:`), uniq
|
|
|
505
505
|
|
|
506
506
|
1. **Forgetting to re-emit after an edit.** `contract.json` and `contract.d.ts` go stale; downstream typecheck and `migration plan` see the old shape. Re-emit, or install the Vite plugin (`references/build.md`).
|
|
507
507
|
2. **Editing the emitted artefacts.** `contract.json` and `contract.d.ts` are emitted; edits there round-trip away on the next emit. Edit the source.
|
|
508
|
-
3. **Wrong factory/import path for the TS builder.** `defineContract`, `field`, `model`, `rel` come from `@internal/postgres/contract-builder` (or `@internal/mongo/contract-builder`). On Postgres the
|
|
508
|
+
3. **Wrong factory/import path for the TS builder.** `defineContract`, `field`, `model`, `rel` come from `@internal/postgres/contract-builder` (or `@internal/mongo/contract-builder`). On Postgres the facade also exports `type` and `gen` (`field.column(type.TimestamptzTemporal())`, `.onCreate(gen.uuid())`) without an extension's helpers; elsewhere, outside the callback overload, the available field constructors are `field.column(...)` and `field.namedType(...)`.
|
|
509
509
|
4. **Reaching into internal packages from user code.** User-authored files (`prisma.config.ts`, `contract.ts`, `db.ts`, control clients) import only from `@internal/<target>/<subpath>` and `@internal/extension-<name>/<subpath>`. Imports from `@internal/cli/*`, `@internal/family-*`, `@internal/target-*`, `@internal/adapter-*`, `@internal/driver-*`, or `@internal/sql-contract-*` are framework-internal — the façade composes them for you. If a façade subpath you need is missing for your target, see *What Prisma 8 doesn't do yet* and route to `references/feedback.md`. The canonical worked examples are `examples/multi-extension-monorepo/app/prisma.config.ts` and `examples/prisma-8-postgis-demo/prisma.config.ts`.
|
|
510
510
|
5. **Confusing the config `extensions` with the TS builder's `extensions`.** Same packs, two surfaces, one field name but two shapes: `ormConfig({ extensions: [pgvector] })` (array of *control* descriptors from `@internal/extension-<name>/control`) versus `defineContract({ extensions: { pgvector } })` (record of *pack* descriptors from `@internal/extension-<name>/pack`).
|
|
511
511
|
6. **Writing a flat `prisma.config.ts`.** `export default defineConfig({ contract, extensions })` from the target config alone is the pre-rc.4 shape and fails with `CONFIG.VERSION_MARKER_MISSING`. Wrap it: `definePrismaConfig({ orm: ormConfig({...}) })`.
|
|
@@ -111,7 +111,7 @@ The single source of truth: read the envelope, find the row by `code`, follow th
|
|
|
111
111
|
| `BUDGET.ROWS_EXCEEDED` / `BUDGET.TIME_EXCEEDED` | Runtime, when the `budgets` middleware is active | Tune `budgets({ maxRows, maxLatencyMs, ... })` or rewrite the query. See `references/runtime.md`. |
|
|
112
112
|
| `LINT.SELECT_STAR` / `LINT.NO_LIMIT` / `LINT.DELETE_WITHOUT_WHERE` / `LINT.UPDATE_WITHOUT_WHERE` / `LINT.READ_ONLY_MUTATION` | Runtime, when the `lints` middleware is active | Fix the query (add a `WHERE` / `LIMIT` / explicit columns), or relax the lint config. See `references/runtime.md`. |
|
|
113
113
|
| `PLAN.HASH_MISMATCH` | Runtime, executing a precompiled plan | The contract the plan was built against does not match the runtime contract. Re-emit, rebuild, redeploy. |
|
|
114
|
-
| `RUNTIME.TEMPORAL_UNAVAILABLE` | Runtime, first read or write touching a Temporal-backed column (`DateTemporal`, `TimestampTemporal(p)`, `TimestampInstant(p)`, `TimestamptzTemporal(p)`, `TimeTemporal(p)`, and `Date`, `DateTime` and `Time`) or a `temporal.
|
|
114
|
+
| `RUNTIME.TEMPORAL_UNAVAILABLE` | Runtime, first read or write touching a Temporal-backed column (`DateTemporal`, `TimestampTemporal(p)`, `TimestampInstant(p)`, `TimestamptzTemporal(p)`, `TimeTemporal(p)`, and `Date`, `DateTime` and `Time`) or a `temporal.UpdatedAt` clock | No global `Temporal`. Node.js 26.8.2 and later ship `globalThis.Temporal`; 26.8.1 and earlier — including every 22 and 24 — do not. Either `import 'temporal-polyfill/full/global'` before the first query, or author the column as `DateString` / `TimestampString(p)` / `TimestamptzString(p)` / `TimeString(p)` to read ISO 8601 text. |
|
|
115
115
|
| `ORM.RELATION_MUTATION_UNSUPPORTED` | ORM nested `create` / `connect` on an N:M relation whose junction has required payload columns | Write the junction table directly or use the SQL builder (`meta.junction`). |
|
|
116
116
|
| `RUNTIME.ABORTED` (`details.phase` = `encode\|decode\|stream\|beforeEncode\|onRow`) | Runtime, when an `AbortSignal` fires mid-execute | Cancellation, not a bug; surface to the caller. |
|
|
117
117
|
| `SqlQueryError` (no dotted code) | Raw-SQL paths surfacing a driver error | Inspect `sqlState` + `constraint` + `table` + `column`. Postgres `23505` = unique violation, `23503` = foreign-key violation, etc. Fix the data or the schema. |
|
|
@@ -416,13 +416,13 @@ await deleteMatching(Post.byAuthor(userId)).toArray();
|
|
|
416
416
|
|
|
417
417
|
A piece of a query used in several places is a function. Do not build a filter object and spread it into each query; write a function and pass it to `.where(...)`, `.orderBy(...)` or `.with(...)`. A **row fragment** is a function of the model accessor, and `.where(...)` and `.orderBy(...)` take it. A **query fragment** (a **fragment** for short) is a function from a collection to a collection, and `.with(...)` runs it. A **scope** is a fragment that only imposes conditions on the query, such as `createdSince` below, and is also run with `.with(...)`. When the condition is a function of one row and needs no declared fields, pass a row fragment to `.where(...)`. When the same condition should apply to every model that has some fields, write a scope: it declares the fields, checks them at run time, and returns the collection with the `Filtered` fact. `.with(...)` also runs what `.where(...)` cannot express, such as a shared `select` and `include`, an order, a limit or offset, or a variant.
|
|
418
418
|
|
|
419
|
-
**The same filter on several models.** Define a scope with `db.orm.fragment(fields, body)`; the method is named `fragment` because it cannot know whether the body only filters. Declare each field the fragment needs with the same builder the schema uses, from the `field` that `@prisma/orm-postgres/contract-builder` exports, adding `.optional()` for a field that may be null. The body sees only those fields:
|
|
419
|
+
**The same filter on several models.** Define a scope with `db.orm.fragment(fields, body)`; the method is named `fragment` because it cannot know whether the body only filters. Declare each field the fragment needs with the same builder the schema uses, from the `field` and `type` that `@prisma/orm-postgres/contract-builder` exports, adding `.optional()` for a field that may be null. The body sees only those fields:
|
|
420
420
|
|
|
421
421
|
```typescript
|
|
422
|
-
import { field } from '@prisma/orm-postgres/contract-builder';
|
|
422
|
+
import { field, type } from '@prisma/orm-postgres/contract-builder';
|
|
423
423
|
|
|
424
424
|
const createdSince = (since: Temporal.Instant) =>
|
|
425
|
-
db.orm.fragment({ createdAt: field.
|
|
425
|
+
db.orm.fragment({ createdAt: field.column(type.TimestamptzTemporal()) }, (rows) =>
|
|
426
426
|
rows.where((r) => r.createdAt.gte(since)),
|
|
427
427
|
);
|
|
428
428
|
|
|
@@ -430,7 +430,7 @@ await db.orm.public.User.with(createdSince(since)).all();
|
|
|
430
430
|
await db.orm.public.Post.with(createdSince(since)).deleteAll();
|
|
431
431
|
```
|
|
432
432
|
|
|
433
|
-
Pick the builder whose codec matches the field's codec in `contract.d.ts`: a PSL `DateTime` is `field.
|
|
433
|
+
Pick the builder whose codec matches the field's codec in `contract.d.ts`: a PSL `DateTime` is `field.column(type.DateTime())` (`pg/timestamptz-temporal@1`), a `String` is `field.column(type.String())` (`pg/text@1`), a `Uuid` is `field.column(type.Uuid())` (`pg/uuid@1`). `field.column(columnType)` is the explicit form. A package that offers a fragment and does not import the facade writes `{ codecId: 'pg/text@1', nullable: false }`, with a codec of the contract. For a list field such as `String[]`, add `.many()` to the builder or `many: { elementNullable: false }` to the object; for a `String?[]`, whose elements may be null, add `.many({ elementsNullable: true })` or `many: { elementNullable: true }`. Without it the declaration does not match a list field, and with it the element nullability must match too. A list of value objects such as `Address[]` is stored as one `jsonb` value and is still a list: `field.column(jsonbColumn).many()`. The body may call `where`, `orderBy`, `limit` and `offset`. The result keeps the collection's class and records the filter, so `update` and `delete` are allowed after a fragment that filters. `updateAll`, `deleteAll` and their `AndCount` forms change every matching row and throw `ORM.ARGUMENT_INVALID` when the chain has a `limit`, `offset`, `cursor`, `distinct` or `distinctOn`, so do not put a limit in a fragment that will be followed by one of them. `update` and `delete` change the one row `first()` returns, so the order, offset, cursor, `distinct` and `distinctOn` choose it, and after `limit(0)` they change nothing and return `null`; `update` with a relation callback throws on an order, a limit, an offset, a cursor, `distinct` or `distinctOn`, because it finds its row by the filter alone. A model without the field, or with the field under another codec or nullability, is a compile error, and a run-time `ORM.FIELD_UNKNOWN`. A custom collection class carries no namespace in its type, so at compile time it matches only a field that every model of that name has, with the same codec and nullability, and its real namespace is checked at run time. The codec, the nullability, whether the field is a list and the nullability of its elements are compared; the column type's parameters are not, so `field.column(type.Char(36))` (`char(36)`) also matches a `char(10)` field.
|
|
434
434
|
|
|
435
435
|
For a filter used inside a larger `where`, a plain function of the row works too. Type the field with `CodecField<Contract, CodecId, Nullable>`, the type of any field with that codec:
|
|
436
436
|
|
|
@@ -645,7 +645,7 @@ prisma db sign --contract <the last migration it applied> --db "$DATABASE_URL"
|
|
|
645
645
|
|
|
646
646
|
Then apply the other migrations with `prisma db migrate` in step 8 of "Order of the steps", after step 7 has written their `ops.json` again.
|
|
647
647
|
|
|
648
|
-
`--contract` takes the migration's directory name, such as `20260917T0818_add_post_expires_at`, or the new hash that migration goes to. To find it, run `prisma migration status` against the database. It prints the start of the old hash the marker holds: `Database marker <hash> is not in the on-disk migration graph`. The error of `prisma db migrate` prints the whole hash: `DB marker is <hash
|
|
648
|
+
`--contract` takes the migration's directory name, such as `20260917T0818_add_post_expires_at`, or the new hash that migration goes to. To find it, run `prisma migration status` against the database. It prints the start of the old hash the marker holds: `Database marker <hash> is not in the on-disk migration graph`. The error of `prisma db migrate` prints the whole hash: `The database's marker names <hash>`, or `DB marker is <hash>` before 8.0.0-rc.21. Recover with `db sign --contract` as this section says, not with the error's next actions: the marker is outside the migration graph only because the upgrade gave the migrations new hashes. Find the line of the script's `<old> -> <new>` list whose old hash is that one. The new hash on that line is the one to sign with, and the migration that goes to it is the last one the database applied.
|
|
649
649
|
|
|
650
650
|
The script also gives each rewritten migration a new hash, and the database's migration history keeps the old ones. After the upgrade, `prisma migration status` therefore no longer marks the migrations applied before it as applied, although it still reports the database as up to date. Nothing else is affected: `prisma db migrate` runs none of them again, `prisma db verify` passes, and migrations you plan and apply after the upgrade are marked as usual.
|
|
651
651
|
|
|
@@ -226,7 +226,7 @@ prisma db sign --contract <the last migration it applied> --db "$DATABASE_URL"
|
|
|
226
226
|
prisma db migrate --db "$DATABASE_URL"
|
|
227
227
|
```
|
|
228
228
|
|
|
229
|
-
`--contract` takes the migration's directory name, such as `20260917T0818_add_post_expires_at`, or the new hash that migration goes to. To find it, run `prisma migration status` against the database. It prints the start of the old hash the marker holds: `Database marker <hash> is not in the on-disk migration graph`. The error of `prisma db migrate` prints the whole hash: `DB marker is <hash
|
|
229
|
+
`--contract` takes the migration's directory name, such as `20260917T0818_add_post_expires_at`, or the new hash that migration goes to. To find it, run `prisma migration status` against the database. It prints the start of the old hash the marker holds: `Database marker <hash> is not in the on-disk migration graph`. The error of `prisma db migrate` prints the whole hash: `The database's marker names <hash>`, or `DB marker is <hash>` before 8.0.0-rc.21. Recover with `db sign --contract` as this section says, not with the error's next actions: the marker is outside the migration graph only because the upgrade gave the migrations new hashes. Find the line of the script's `<old> -> <new>` list whose old hash is that one. The new hash on that line is the one to sign with, and the migration that goes to it is the last one the database applied.
|
|
230
230
|
|
|
231
231
|
The script has already written the new hash into each ref, so when `db sign` advances a ref, such as `migrations/app/refs/db.json`, it prints the new hash twice: `Advanced ref "db" → <new hash> (was <new hash>)`. This is expected, and the database is signed.
|
|
232
232
|
|
|
@@ -251,7 +251,7 @@ model Post {
|
|
|
251
251
|
```
|
|
252
252
|
|
|
253
253
|
- An alias may carry `@default`, `@onCreate` and `@onUpdate`. Each field typed by it gets them. A field may add an attribute its alias does not set, but writing one the alias already sets is the error `PSL_DUPLICATE_ATTRIBUTE`. `@id` and `@unique` belong on the field, not the alias.
|
|
254
|
-
- Postgres, SQLite and MongoDB contribute `temporal.CreatedAt` and `temporal.UpdatedAt`, written bare as a field type. Each stores exactly what `temporal.createdAt()` and `temporal.updatedAt()`
|
|
254
|
+
- Postgres, SQLite and MongoDB contribute `temporal.CreatedAt` and `temporal.UpdatedAt`, written bare as a field type. Each stores exactly what the field presets `temporal.createdAt()` and `temporal.updatedAt()` stored. 8.0.0-rc.21 removes field presets, and its upgrade guide gives the replacement of every preset. Postgres also has `temporal.CreatedAtString`, `temporal.UpdatedAtString`, `temporal.CreatedAtJsDate` and `temporal.UpdatedAtJsDate`.
|
|
255
255
|
|
|
256
256
|
### `ts-types-key-removed`
|
|
257
257
|
|