@prisma/orm-mongo 8.0.1-dev.43 → 8.0.1-dev.45
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/{mongo-static-D0gxIAFR-D4Ugp6Ri.mjs → mongo-static-DXgxqad2-EexeYfrg.mjs} +3 -3
- package/dist/{mongo-static-D0gxIAFR-D4Ugp6Ri.mjs.map → mongo-static-DXgxqad2-EexeYfrg.mjs.map} +1 -1
- package/dist/runtime.mjs +1 -1
- package/dist/runtime.mjs.map +1 -1
- package/dist/static.mjs +1 -1
- package/package.json +12 -12
- package/skills/prisma-8/SKILL.md +3 -3
- package/skills/prisma-8/references/contract.md +1 -1
- package/skills/prisma-8/references/scripts/find-detection-hits.ts +57 -0
- package/skills/prisma-8/references/upgrade-app.md +29 -10
- package/skills/prisma-8/references/upgrade-extension.md +24 -7
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.25-to-8.0.0-rc.26/instructions.md +139 -42
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.25-to-8.0.0-rc.26/scripts/contract-hash-inputs/contract-hash-inputs.ts +164 -12
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.25-to-8.0.0-rc.26/scripts/contract-signature-names/contract-signature-names.ts +110 -18
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.25-to-8.0.0-rc.26/scripts/facade-paths-an-application-uses/facade-paths-an-application-uses.ts +28 -6
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.25-to-8.0.0-rc.26/scripts/platform-paths-an-extension-uses/platform-paths-an-extension-uses.ts +70 -13
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.25-to-8.0.0-rc.26/scripts/stored-files-format-version/stored-files-format-version.ts +98 -13
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.26-to-8.0.0-rc.27/instructions.md +102 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.27-to-8.0.0-rc.28/instructions.md +5 -0
- package/skills/prisma-8/upgrading/extension/upgrades/0.10-to-0.11/instructions.md +2 -1
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.25-to-8.0.0-rc.26/instructions.md +33 -19
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.25-to-8.0.0-rc.26/scripts/contract-hash-inputs/contract-hash-inputs.ts +164 -12
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.25-to-8.0.0-rc.26/scripts/contract-signature-names/contract-signature-names.ts +110 -18
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.25-to-8.0.0-rc.26/scripts/facade-paths-an-application-uses/facade-paths-an-application-uses.ts +28 -6
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.25-to-8.0.0-rc.26/scripts/platform-paths-an-extension-uses/platform-paths-an-extension-uses.ts +70 -13
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.25-to-8.0.0-rc.26/scripts/stored-files-format-version/stored-files-format-version.ts +98 -13
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.26-to-8.0.0-rc.27/instructions.md +56 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.27-to-8.0.0-rc.28/instructions.md +5 -0
|
@@ -9,8 +9,8 @@ import { buildNamespacedEnums } from "@prisma/orm-framework/contract/enum-access
|
|
|
9
9
|
import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
|
|
10
10
|
import { mongoQuery } from "@prisma/orm-family-mongo/query-builder";
|
|
11
11
|
import { assertDefined } from "@prisma/orm-framework/utils/assertions";
|
|
12
|
-
//#region ../../../3-targets/mongo/9-facade/dist/mongo-static-
|
|
13
|
-
var version = "8.0.1-dev.
|
|
12
|
+
//#region ../../../3-targets/mongo/9-facade/dist/mongo-static-DXgxqad2.mjs
|
|
13
|
+
var version = "8.0.1-dev.45";
|
|
14
14
|
const serializer = new MongoContractSerializer();
|
|
15
15
|
const validator = `${mongoRuntimeTarget.targetId}@${version}`;
|
|
16
16
|
/**
|
|
@@ -71,4 +71,4 @@ function mongoStatic(options) {
|
|
|
71
71
|
//#endregion
|
|
72
72
|
export { validateMongoContract as i, contractFromJson as n, mongoStatic as r, buildMongoStaticContext as t };
|
|
73
73
|
|
|
74
|
-
//# sourceMappingURL=mongo-static-
|
|
74
|
+
//# sourceMappingURL=mongo-static-DXgxqad2-EexeYfrg.mjs.map
|
package/dist/{mongo-static-D0gxIAFR-D4Ugp6Ri.mjs.map → mongo-static-DXgxqad2-EexeYfrg.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mongo-static-
|
|
1
|
+
{"version":3,"file":"mongo-static-DXgxqad2-EexeYfrg.mjs","names":[],"sources":["../../../../3-targets/mongo/9-facade/dist/mongo-static-DXgxqad2.mjs"],"sourcesContent":["import mongoRuntimeAdapter from \"@internal/adapter-mongo/runtime\";\nimport { mongoRaw } from \"@internal/mongo-orm\";\nimport { createMongoExecutionContext, createMongoExecutionStack, enumMemberCodecFor } from \"@internal/mongo-runtime\";\nimport mongoRuntimeTarget from \"@internal/target-mongo/runtime\";\nimport { isContractBuiltInMemory } from \"@internal/contract/stored-format\";\nimport { validateContractOnce } from \"@internal/contract/validate-once\";\nimport { MongoContractSerializer } from \"@internal/family-mongo/ir\";\nimport { buildNamespacedEnums } from \"@internal/contract/enum-accessor\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { mongoQuery } from \"@internal/mongo-query-builder\";\nimport { assertDefined } from \"@internal/utils/assertions\";\n//#region package.json\nvar version = \"8.0.1-dev.45\";\n//#endregion\n//#region src/static/contract-from-json.ts\nconst serializer = new MongoContractSerializer();\nconst validator = `${mongoRuntimeTarget.targetId}@${version}`;\n/**\n* Validates an emitted Mongo `contract.json` and returns it as the contract type the application\n* names, ready to pass to `mongo({ contract })` and `mongoStatic({ contract })`. Clients built from\n* 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}\n/** Validates a contract value for a Mongo client, once per value. */\nfunction validateMongoContract(contract) {\n\treturn validateContractOnce(contract, validator, () => serializer.deserializeContract(isContractBuiltInMemory(contract) ? serializer.serializeContract(contract) : contract));\n}\n//#endregion\n//#region src/static/mongo-static.ts\nfunction buildMongoStaticContext(contract, stack) {\n\tconst context = createMongoExecutionContext({\n\t\tcontract,\n\t\tstack\n\t});\n\tconst enums = Object.freeze(buildNamespacedEnums(context.contract.domain, enumMemberCodecFor(context.codecs)))[UNBOUND_NAMESPACE_ID];\n\tassertDefined(enums, \"the unbound namespace always exists on a mongo builder output\");\n\treturn {\n\t\tcontext,\n\t\tcontract,\n\t\tenums,\n\t\tquery: mongoQuery({ context }),\n\t\traw: mongoRaw({ context })\n\t};\n}\n/**\n* The query surfaces of a Mongo client without a driver: `query`, `raw` and `enums`. Use it where\n* loading `mongodb` is not wanted.\n*\n* @example\n* ```ts\n* const { enums } = mongoStatic({ contract: contractFromJson<Contract>(contractJson) });\n* ```\n*/\nfunction mongoStatic(options) {\n\tconst stack = createMongoExecutionStack({\n\t\ttarget: mongoRuntimeTarget,\n\t\tadapter: mongoRuntimeAdapter,\n\t\textensions: options.extensions ?? []\n\t});\n\treturn buildMongoStaticContext(validateMongoContract(options.contract), stack);\n}\n//#endregion\nexport { validateMongoContract as i, mongoStatic as n, contractFromJson as r, buildMongoStaticContext as t };\n\n//# sourceMappingURL=mongo-static-DXgxqad2.mjs.map"],"mappings":";;;;;;;;;;;;AAYA,IAAI,UAAU;AAGd,MAAM,aAAa,IAAI,wBAAwB;AAC/C,MAAM,YAAY,GAAG,mBAAmB,SAAS,GAAG;;;;;;;;;;;;;;;;;AAiBpD,SAAS,iBAAiB,MAAM;CAC/B,OAAO,qBAAqB,MAAM,YAAY,UAAU,WAAW,oBAAoB,KAAK,CAAC;AAC9F;;AAEA,SAAS,sBAAsB,UAAU;CACxC,OAAO,qBAAqB,UAAU,iBAAiB,WAAW,oBAAoB,wBAAwB,QAAQ,IAAI,WAAW,kBAAkB,QAAQ,IAAI,QAAQ,CAAC;AAC7K;AAGA,SAAS,wBAAwB,UAAU,OAAO;CACjD,MAAM,UAAU,4BAA4B;EAC3C;EACA;CACD,CAAC;CACD,MAAM,QAAQ,OAAO,OAAO,qBAAqB,QAAQ,SAAS,QAAQ,mBAAmB,QAAQ,MAAM,CAAC,CAAC,CAAC,CAAC;CAC/G,cAAc,OAAO,+DAA+D;CACpF,OAAO;EACN;EACA;EACA;EACA,OAAO,WAAW,EAAE,QAAQ,CAAC;EAC7B,KAAK,SAAS,EAAE,QAAQ,CAAC;CAC1B;AACD;;;;;;;;;;AAUA,SAAS,YAAY,SAAS;CAC7B,MAAM,QAAQ,0BAA0B;EACvC,QAAQ;EACR,SAAS;EACT,YAAY,QAAQ,cAAc,CAAC;CACpC,CAAC;CACD,OAAO,wBAAwB,sBAAsB,QAAQ,QAAQ,GAAG,KAAK;AAC9E"}
|
package/dist/runtime.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as validateMongoContract, t as buildMongoStaticContext } from "./mongo-static-
|
|
1
|
+
import { i as validateMongoContract, t as buildMongoStaticContext } from "./mongo-static-DXgxqad2-EexeYfrg.mjs";
|
|
2
2
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
3
3
|
import mongoRuntimeAdapter from "@prisma/orm-target-mongo/adapter/runtime";
|
|
4
4
|
import { mongoOrm } from "@prisma/orm-family-mongo/orm";
|
package/dist/runtime.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.mjs","names":[],"sources":["../../../../3-targets/mongo/9-facade/dist/runtime.mjs"],"sourcesContent":["import { i as validateMongoContract, t as buildMongoStaticContext } from \"./mongo-static-D0gxIAFR.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { isStructuredError, structuredError } from \"@internal/utils/structured-error\";\nimport mongoRuntimeAdapter from \"@internal/adapter-mongo/runtime\";\nimport mongoRuntimeDriver from \"@internal/driver-mongo/runtime\";\nimport { AsyncIterableResult } from \"@internal/framework-components/runtime\";\nimport { mongoOrm } from \"@internal/mongo-orm\";\nimport { createMongoExecutionStack, createMongoRuntime } from \"@internal/mongo-runtime\";\nimport mongoRuntimeTarget from \"@internal/target-mongo/runtime\";\nimport { InvariantError } from \"@internal/utils/invariant-error\";\nimport { ConnectionString } from \"mongodb-connection-string-url\";\nimport { blindCast } from \"@internal/utils/casts\";\n//#region src/runtime/mongo-errors.ts\nfunction mongoError(code, message, options) {\n\treturn structuredError(code, message, {\n\t\t...options,\n\t\tmeta: {\n\t\t\t...options?.meta,\n\t\t\textension: \"mongo\"\n\t\t}\n\t});\n}\n//#endregion\n//#region src/runtime/binding.ts\nconst URL_SCHEME_PATTERN = /^([a-z][a-z\\d+.-]*):\\/\\//i;\nconst MONGO_SCHEMES = /* @__PURE__ */ new Set([\"mongodb\", \"mongodb+srv\"]);\nfunction validateMongoUrl(url) {\n\tconst trimmed = url.trim();\n\tif (trimmed.length === 0) throw mongoError(\"RUNTIME.BINDING_INVALID\", \"Mongo URL must be a non-empty string\");\n\tconst scheme = URL_SCHEME_PATTERN.exec(trimmed)?.[1];\n\tif (scheme === void 0) throw mongoError(\"RUNTIME.BINDING_INVALID\", \"Mongo URL must be a valid URL\");\n\tif (!MONGO_SCHEMES.has(scheme)) throw mongoError(\"RUNTIME.BINDING_INVALID\", \"Mongo URL must use mongodb:// or mongodb+srv://\");\n\ttry {\n\t\treturn new ConnectionString(trimmed);\n\t} catch {\n\t\tthrow mongoError(\"RUNTIME.BINDING_INVALID\", \"Mongo URL must be a valid URL\");\n\t}\n}\nfunction extractDbNameFromUrl(parsed) {\n\tconst [encodedDbName = \"\"] = parsed.pathname.slice(1).split(\"/\");\n\tif (encodedDbName.length === 0) return;\n\ttry {\n\t\treturn decodeURIComponent(encodedDbName);\n\t} catch {\n\t\tthrow mongoError(\"RUNTIME.BINDING_INVALID\", \"Mongo URL must be a valid URL\");\n\t}\n}\nfunction resolveMongoBinding(options) {\n\tconst providedCount = Number(options.binding !== void 0) + Number(options.url !== void 0) + Number(options.uri !== void 0) + Number(options.mongoClient !== void 0);\n\tif (providedCount !== 1) throw mongoError(\"RUNTIME.BINDING_INVALID\", \"Provide one binding input: binding, url, uri+dbName, or mongoClient+dbName\", { meta: { received: providedCount } });\n\tif (options.binding !== void 0) return options.binding;\n\tif (options.url !== void 0) {\n\t\tconst parsed = validateMongoUrl(options.url);\n\t\tif (options.dbName !== void 0 && options.dbName.trim().length === 0) throw mongoError(\"RUNTIME.BINDING_INVALID\", \"Mongo binding via { url, dbName } requires a non-empty dbName\");\n\t\tconst explicitDbName = options.dbName?.trim();\n\t\tconst dbName = explicitDbName !== void 0 && explicitDbName.length > 0 ? explicitDbName : extractDbNameFromUrl(parsed);\n\t\tif (dbName === void 0 || dbName.length === 0) throw mongoError(\"RUNTIME.BINDING_INVALID\", \"Mongo URL must include a database name in its path (e.g. mongodb://host:27017/mydb), or pass dbName explicitly\");\n\t\treturn {\n\t\t\tkind: \"url\",\n\t\t\turl: options.url.trim(),\n\t\t\tdbName\n\t\t};\n\t}\n\tif (options.uri !== void 0) {\n\t\tvalidateMongoUrl(options.uri);\n\t\tconst dbName = options.dbName?.trim();\n\t\tif (dbName === void 0 || dbName.length === 0) throw mongoError(\"RUNTIME.BINDING_INVALID\", \"Mongo binding via { uri, dbName } requires a non-empty dbName\");\n\t\treturn {\n\t\t\tkind: \"url\",\n\t\t\turl: options.uri.trim(),\n\t\t\tdbName\n\t\t};\n\t}\n\tconst mongoClient = options.mongoClient;\n\tif (mongoClient === void 0) throw new InvariantError(\"Invariant violation: expected mongo binding after validation\");\n\tconst dbName = options.dbName?.trim();\n\tif (dbName === void 0 || dbName.length === 0) throw mongoError(\"RUNTIME.BINDING_INVALID\", \"Mongo binding via { mongoClient, dbName } requires a non-empty dbName\");\n\treturn {\n\t\tkind: \"mongoClient\",\n\t\tclient: mongoClient,\n\t\tdbName\n\t};\n}\nfunction resolveOptionalMongoBinding(options) {\n\tconst providedCount = Number(options.binding !== void 0) + Number(options.url !== void 0) + Number(options.uri !== void 0) + Number(options.mongoClient !== void 0);\n\tif (providedCount === 0) return;\n\tif (providedCount !== 1) throw mongoError(\"RUNTIME.BINDING_INVALID\", \"Provide one binding input: binding, url, uri+dbName, or mongoClient+dbName\", { meta: { received: providedCount } });\n\tif (options.binding !== void 0) return resolveMongoBinding({ binding: options.binding });\n\tif (options.url !== void 0) return resolveMongoBinding(options.dbName !== void 0 ? {\n\t\turl: options.url,\n\t\tdbName: options.dbName\n\t} : { url: options.url });\n\tif (options.uri !== void 0) return resolveMongoBinding({\n\t\turi: options.uri,\n\t\tdbName: options.dbName ?? \"\"\n\t});\n\tif (options.mongoClient !== void 0) return resolveMongoBinding({\n\t\tmongoClient: options.mongoClient,\n\t\tdbName: options.dbName ?? \"\"\n\t});\n\tthrow new InvariantError(\"Invariant violation: expected one mongo binding branch\");\n}\n//#endregion\n//#region src/runtime/prepared-row-query.ts\nasync function prepareMongoQuery(runtime, declaration, callback) {\n\tlet description;\n\tconst statement = await runtime.prepare(declaration, (placeholders) => {\n\t\tconst authored = callback(placeholders);\n\t\tif (\"plan\" in authored) {\n\t\t\tdescription = authored;\n\t\t\treturn authored.plan;\n\t\t}\n\t\treturn authored;\n\t});\n\treturn blindCast(description ? createMongoPreparedRowQuery(description, statement) : statement);\n}\nfunction createMongoPreparedRowQuery(description, statement) {\n\treturn Object.freeze({ query(target, params, options) {\n\t\treturn description.consume(statement.query(target, params, options));\n\t} });\n}\n//#endregion\n//#region src/runtime/mongo.ts\n/**\n* Creates a lazy Mongo 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 `orm` and `query` surfaces are\n* available at once; the driver connects on the first query or `connect()`.\n*\n* @example\n* ```ts\n* import { contractFromJson } from '@prisma/orm-mongo/static';\n* import mongo from '@prisma/orm-mongo/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 = mongo({ contract, url: process.env['MONGODB_URL']! });\n* ```\n*/\nfunction mongo(options) {\n\tconst contract = validateMongoContract(options.contract);\n\tlet binding = resolveOptionalMongoBinding(options);\n\tconst stack = createMongoExecutionStack({\n\t\ttarget: mongoRuntimeTarget,\n\t\tadapter: mongoRuntimeAdapter,\n\t\tdriver: mongoRuntimeDriver,\n\t\textensions: options.extensions ?? []\n\t});\n\tconst { context, query, enums, raw } = buildMongoStaticContext(contract, stack);\n\tlet runtimePromise;\n\tlet closed = false;\n\tlet runtimeInstance;\n\tconst closedError = () => mongoError(\"DRIVER.NOT_CONNECTED\", \"Mongo client is closed\");\n\tconst createRuntime = () => {\n\t\tif (runtimeInstance !== void 0) return runtimeInstance;\n\t\tconst driver = stack.driver.create();\n\t\truntimeInstance = {\n\t\t\truntime: createMongoRuntime({\n\t\t\t\tcontext,\n\t\t\t\tadapter: stack.adapter.create(stack),\n\t\t\t\tdriver,\n\t\t\t\t...ifDefined(\"mode\", options.mode),\n\t\t\t\t...ifDefined(\"middleware\", options.middleware),\n\t\t\t\t...ifDefined(\"log\", options.log)\n\t\t\t}),\n\t\t\tdriver\n\t\t};\n\t\treturn runtimeInstance;\n\t};\n\tconst buildRuntime = async (resolvedBinding) => {\n\t\tconst { runtime, driver } = createRuntime();\n\t\tawait driver.connect(resolvedBinding);\n\t\treturn runtime;\n\t};\n\tconst getRuntime = () => {\n\t\tif (closed) return Promise.reject(closedError());\n\t\tif (runtimePromise !== void 0) return runtimePromise;\n\t\tif (binding === void 0) return Promise.reject(mongoError(\"RUNTIME.BINDING_MISSING\", \"Mongo binding not configured. Pass url/uri+dbName/mongoClient+dbName/binding to mongo(...) or call db.connect({ ... }).\"));\n\t\truntimePromise = buildRuntime(binding).catch((err) => {\n\t\t\truntimePromise = void 0;\n\t\t\tthrow err;\n\t\t});\n\t\treturn runtimePromise;\n\t};\n\tfunction queryRows(plan) {\n\t\tasync function* iterate() {\n\t\t\tyield* (await getRuntime()).query(plan);\n\t\t}\n\t\treturn new AsyncIterableResult(iterate());\n\t}\n\tasync function executeStats(plan) {\n\t\treturn (await getRuntime()).execute(plan);\n\t}\n\treturn {\n\t\torm: mongoOrm({\n\t\t\tcontext,\n\t\t\truntime: {\n\t\t\t\tquery: queryRows,\n\t\t\t\texecute: executeStats\n\t\t\t}\n\t\t}),\n\t\tquery,\n\t\traw,\n\t\tcontract,\n\t\tenums,\n\t\tcontext,\n\t\tasync connect(bindingInput) {\n\t\t\tif (closed) throw closedError();\n\t\t\tif (runtimePromise !== void 0) {\n\t\t\t\tif (bindingInput !== void 0) throw mongoError(\"DRIVER.ALREADY_CONNECTED\", \"Mongo client is already bound\", {\n\t\t\t\t\twhy: \"connect() was given options after the client was bound to a database.\",\n\t\t\t\t\tfix: \"Call connect() without options, or create a new client for another database.\"\n\t\t\t\t});\n\t\t\t\tconst runtime = await runtimePromise;\n\t\t\t\tif (closed) throw closedError();\n\t\t\t\treturn runtime;\n\t\t\t}\n\t\t\tif (bindingInput !== void 0) binding = resolveMongoBinding(bindingInput);\n\t\t\tif (binding === void 0) throw mongoError(\"RUNTIME.BINDING_MISSING\", \"Mongo binding not configured. Pass url/uri+dbName/mongoClient+dbName/binding to mongo(...) or call db.connect({ ... }).\");\n\t\t\tconst runtime = await getRuntime();\n\t\t\tif (closed) throw closedError();\n\t\t\treturn runtime;\n\t\t},\n\t\truntime() {\n\t\t\treturn getRuntime();\n\t\t},\n\t\tasync prepare(declaration, callback) {\n\t\t\tif (closed) throw closedError();\n\t\t\treturn prepareMongoQuery(createRuntime().runtime, declaration, callback);\n\t\t},\n\t\tasync close() {\n\t\t\tif (closed) return;\n\t\t\tclosed = true;\n\t\t\tawait runtimePromise?.catch(() => void 0);\n\t\t\tawait runtimeInstance?.runtime.close();\n\t\t},\n\t\t[Symbol.asyncDispose]() {\n\t\t\treturn this.close();\n\t\t}\n\t};\n}\n//#endregion\nexport { mongo as default, isStructuredError };\n\n//# sourceMappingURL=runtime.mjs.map"],"mappings":";;;;;;;;;;;;;AAaA,SAAS,WAAW,MAAM,SAAS,SAAS;CAC3C,OAAO,gBAAgB,MAAM,SAAS;EACrC,GAAG;EACH,MAAM;GACL,GAAG,SAAS;GACZ,WAAW;EACZ;CACD,CAAC;AACF;AAGA,MAAM,qBAAqB;AAC3B,MAAM,gCAAgC,IAAI,IAAI,CAAC,WAAW,aAAa,CAAC;AACxE,SAAS,iBAAiB,KAAK;CAC9B,MAAM,UAAU,IAAI,KAAK;CACzB,IAAI,QAAQ,WAAW,GAAG,MAAM,WAAW,2BAA2B,sCAAsC;CAC5G,MAAM,SAAS,mBAAmB,KAAK,OAAO,CAAC,GAAG;CAClD,IAAI,WAAW,KAAK,GAAG,MAAM,WAAW,2BAA2B,+BAA+B;CAClG,IAAI,CAAC,cAAc,IAAI,MAAM,GAAG,MAAM,WAAW,2BAA2B,iDAAiD;CAC7H,IAAI;EACH,OAAO,IAAI,iBAAiB,OAAO;CACpC,QAAQ;EACP,MAAM,WAAW,2BAA2B,+BAA+B;CAC5E;AACD;AACA,SAAS,qBAAqB,QAAQ;CACrC,MAAM,CAAC,gBAAgB,MAAM,OAAO,SAAS,MAAM,CAAC,CAAC,CAAC,MAAM,GAAG;CAC/D,IAAI,cAAc,WAAW,GAAG;CAChC,IAAI;EACH,OAAO,mBAAmB,aAAa;CACxC,QAAQ;EACP,MAAM,WAAW,2BAA2B,+BAA+B;CAC5E;AACD;AACA,SAAS,oBAAoB,SAAS;CACrC,MAAM,gBAAgB,OAAO,QAAQ,YAAY,KAAK,CAAC,IAAI,O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G,MAAM,IAAI;EACvC;EACA,OAAO,IAAI,oBAAoB,QAAQ,CAAC;CACzC;CACA,eAAe,aAAa,MAAM;EACjC,QAAQ,MAAM,WAAW,EAAA,CAAG,QAAQ,IAAI;CACzC;CACA,OAAO;EACN,KAAK,SAAS;GACb;GACA,SAAS;IACR,OAAO;IACP,SAAS;GACV;EACD,CAAC;EACD;EACA;EACA;EACA;EACA;EACA,MAAM,QAAQ,cAAc;GAC3B,IAAI,QAAQ,MAAM,YAAY;GAC9B,IAAI,mBAAmB,KAAK,GAAG;IAC9B,IAAI,iBAAiB,KAAK,GAAG,MAAM,WAAW,4BAA4B,iCAAiC;KAC1G,KAAK;KACL,KAAK;IACN,CAAC;IACD,MAAM,UAAU,MAAM;IACtB,IAAI,QAAQ,MAAM,YAAY;IAC9B,OAAO;GACR;GACA,IAAI,iBAAiB,KAAK,GAAG,UAAU,oBAAoB,YAAY;GACvE,IAAI,YAAY,KAAK,GAAG,MAAM,WAAW,2BAA2B,yHAAyH;GAC7L,MAAM,UAAU,MAAM,WAAW;GACjC,IAAI,QAAQ,MAAM,YAAY;GAC9B,OAAO;EACR;EACA,UAAU;GACT,OAAO,WAAW;EACnB;EACA,MAAM,QAAQ,aAAa,UAAU;GACpC,IAAI,QAAQ,MAAM,YAAY;GAC9B,OAAO,kBAAkB,cAAc,CAAC,CAAC,SAAS,aAAa,QAAQ;EACxE;EACA,MAAM,QAAQ;GACb,IAAI,QAAQ;GACZ,SAAS;GACT,MAAM,gBAAgB,YAAY,KAAK,CAAC;GACxC,MAAM,iBAAiB,QAAQ,MAAM;EACtC;EACA,CAAC,OAAO,gBAAgB;GACvB,OAAO,KAAK,MAAM;EACnB;CACD;AACD"}
|
|
1
|
+
{"version":3,"file":"runtime.mjs","names":[],"sources":["../../../../3-targets/mongo/9-facade/dist/runtime.mjs"],"sourcesContent":["import { i as validateMongoContract, t as buildMongoStaticContext } from \"./mongo-static-DXgxqad2.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { isStructuredError, structuredError } from \"@internal/utils/structured-error\";\nimport mongoRuntimeAdapter from \"@internal/adapter-mongo/runtime\";\nimport mongoRuntimeDriver from \"@internal/driver-mongo/runtime\";\nimport { AsyncIterableResult } from \"@internal/framework-components/runtime\";\nimport { mongoOrm } from \"@internal/mongo-orm\";\nimport { createMongoExecutionStack, createMongoRuntime } from \"@internal/mongo-runtime\";\nimport mongoRuntimeTarget from \"@internal/target-mongo/runtime\";\nimport { InvariantError } from \"@internal/utils/invariant-error\";\nimport { ConnectionString } from \"mongodb-connection-string-url\";\nimport { blindCast } from \"@internal/utils/casts\";\n//#region src/runtime/mongo-errors.ts\nfunction mongoError(code, message, options) {\n\treturn structuredError(code, message, {\n\t\t...options,\n\t\tmeta: {\n\t\t\t...options?.meta,\n\t\t\textension: \"mongo\"\n\t\t}\n\t});\n}\n//#endregion\n//#region src/runtime/binding.ts\nconst URL_SCHEME_PATTERN = /^([a-z][a-z\\d+.-]*):\\/\\//i;\nconst MONGO_SCHEMES = /* @__PURE__ */ new Set([\"mongodb\", \"mongodb+srv\"]);\nfunction validateMongoUrl(url) {\n\tconst trimmed = url.trim();\n\tif (trimmed.length === 0) throw mongoError(\"RUNTIME.BINDING_INVALID\", \"Mongo URL must be a non-empty string\");\n\tconst scheme = URL_SCHEME_PATTERN.exec(trimmed)?.[1];\n\tif (scheme === void 0) throw mongoError(\"RUNTIME.BINDING_INVALID\", \"Mongo URL must be a valid URL\");\n\tif (!MONGO_SCHEMES.has(scheme)) throw mongoError(\"RUNTIME.BINDING_INVALID\", \"Mongo URL must use mongodb:// or mongodb+srv://\");\n\ttry {\n\t\treturn new ConnectionString(trimmed);\n\t} catch {\n\t\tthrow mongoError(\"RUNTIME.BINDING_INVALID\", \"Mongo URL must be a valid URL\");\n\t}\n}\nfunction extractDbNameFromUrl(parsed) {\n\tconst [encodedDbName = \"\"] = parsed.pathname.slice(1).split(\"/\");\n\tif (encodedDbName.length === 0) return;\n\ttry {\n\t\treturn decodeURIComponent(encodedDbName);\n\t} catch {\n\t\tthrow mongoError(\"RUNTIME.BINDING_INVALID\", \"Mongo URL must be a valid URL\");\n\t}\n}\nfunction resolveMongoBinding(options) {\n\tconst providedCount = Number(options.binding !== void 0) + Number(options.url !== void 0) + Number(options.uri !== void 0) + Number(options.mongoClient !== void 0);\n\tif (providedCount !== 1) throw mongoError(\"RUNTIME.BINDING_INVALID\", \"Provide one binding input: binding, url, uri+dbName, or mongoClient+dbName\", { meta: { received: providedCount } });\n\tif (options.binding !== void 0) return options.binding;\n\tif (options.url !== void 0) {\n\t\tconst parsed = validateMongoUrl(options.url);\n\t\tif (options.dbName !== void 0 && options.dbName.trim().length === 0) throw mongoError(\"RUNTIME.BINDING_INVALID\", \"Mongo binding via { url, dbName } requires a non-empty dbName\");\n\t\tconst explicitDbName = options.dbName?.trim();\n\t\tconst dbName = explicitDbName !== void 0 && explicitDbName.length > 0 ? explicitDbName : extractDbNameFromUrl(parsed);\n\t\tif (dbName === void 0 || dbName.length === 0) throw mongoError(\"RUNTIME.BINDING_INVALID\", \"Mongo URL must include a database name in its path (e.g. mongodb://host:27017/mydb), or pass dbName explicitly\");\n\t\treturn {\n\t\t\tkind: \"url\",\n\t\t\turl: options.url.trim(),\n\t\t\tdbName\n\t\t};\n\t}\n\tif (options.uri !== void 0) {\n\t\tvalidateMongoUrl(options.uri);\n\t\tconst dbName = options.dbName?.trim();\n\t\tif (dbName === void 0 || dbName.length === 0) throw mongoError(\"RUNTIME.BINDING_INVALID\", \"Mongo binding via { uri, dbName } requires a non-empty dbName\");\n\t\treturn {\n\t\t\tkind: \"url\",\n\t\t\turl: options.uri.trim(),\n\t\t\tdbName\n\t\t};\n\t}\n\tconst mongoClient = options.mongoClient;\n\tif (mongoClient === void 0) throw new InvariantError(\"Invariant violation: expected mongo binding after validation\");\n\tconst dbName = options.dbName?.trim();\n\tif (dbName === void 0 || dbName.length === 0) throw mongoError(\"RUNTIME.BINDING_INVALID\", \"Mongo binding via { mongoClient, dbName } requires a non-empty dbName\");\n\treturn {\n\t\tkind: \"mongoClient\",\n\t\tclient: mongoClient,\n\t\tdbName\n\t};\n}\nfunction resolveOptionalMongoBinding(options) {\n\tconst providedCount = Number(options.binding !== void 0) + Number(options.url !== void 0) + Number(options.uri !== void 0) + Number(options.mongoClient !== void 0);\n\tif (providedCount === 0) return;\n\tif (providedCount !== 1) throw mongoError(\"RUNTIME.BINDING_INVALID\", \"Provide one binding input: binding, url, uri+dbName, or mongoClient+dbName\", { meta: { received: providedCount } });\n\tif (options.binding !== void 0) return resolveMongoBinding({ binding: options.binding });\n\tif (options.url !== void 0) return resolveMongoBinding(options.dbName !== void 0 ? {\n\t\turl: options.url,\n\t\tdbName: options.dbName\n\t} : { url: options.url });\n\tif (options.uri !== void 0) return resolveMongoBinding({\n\t\turi: options.uri,\n\t\tdbName: options.dbName ?? \"\"\n\t});\n\tif (options.mongoClient !== void 0) return resolveMongoBinding({\n\t\tmongoClient: options.mongoClient,\n\t\tdbName: options.dbName ?? \"\"\n\t});\n\tthrow new InvariantError(\"Invariant violation: expected one mongo binding branch\");\n}\n//#endregion\n//#region src/runtime/prepared-row-query.ts\nasync function prepareMongoQuery(runtime, declaration, callback) {\n\tlet description;\n\tconst statement = await runtime.prepare(declaration, (placeholders) => {\n\t\tconst authored = callback(placeholders);\n\t\tif (\"plan\" in authored) {\n\t\t\tdescription = authored;\n\t\t\treturn authored.plan;\n\t\t}\n\t\treturn authored;\n\t});\n\treturn blindCast(description ? createMongoPreparedRowQuery(description, statement) : statement);\n}\nfunction createMongoPreparedRowQuery(description, statement) {\n\treturn Object.freeze({ query(target, params, options) {\n\t\treturn description.consume(statement.query(target, params, options));\n\t} });\n}\n//#endregion\n//#region src/runtime/mongo.ts\n/**\n* Creates a lazy Mongo 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 `orm` and `query` surfaces are\n* available at once; the driver connects on the first query or `connect()`.\n*\n* @example\n* ```ts\n* import { contractFromJson } from '@prisma/orm-mongo/static';\n* import mongo from '@prisma/orm-mongo/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 = mongo({ contract, url: process.env['MONGODB_URL']! });\n* ```\n*/\nfunction mongo(options) {\n\tconst contract = validateMongoContract(options.contract);\n\tlet binding = resolveOptionalMongoBinding(options);\n\tconst stack = createMongoExecutionStack({\n\t\ttarget: mongoRuntimeTarget,\n\t\tadapter: mongoRuntimeAdapter,\n\t\tdriver: mongoRuntimeDriver,\n\t\textensions: options.extensions ?? []\n\t});\n\tconst { context, query, enums, raw } = buildMongoStaticContext(contract, stack);\n\tlet runtimePromise;\n\tlet closed = false;\n\tlet runtimeInstance;\n\tconst closedError = () => mongoError(\"DRIVER.NOT_CONNECTED\", \"Mongo client is closed\");\n\tconst createRuntime = () => {\n\t\tif (runtimeInstance !== void 0) return runtimeInstance;\n\t\tconst driver = stack.driver.create();\n\t\truntimeInstance = {\n\t\t\truntime: createMongoRuntime({\n\t\t\t\tcontext,\n\t\t\t\tadapter: stack.adapter.create(stack),\n\t\t\t\tdriver,\n\t\t\t\t...ifDefined(\"mode\", options.mode),\n\t\t\t\t...ifDefined(\"middleware\", options.middleware),\n\t\t\t\t...ifDefined(\"log\", options.log)\n\t\t\t}),\n\t\t\tdriver\n\t\t};\n\t\treturn runtimeInstance;\n\t};\n\tconst buildRuntime = async (resolvedBinding) => {\n\t\tconst { runtime, driver } = createRuntime();\n\t\tawait driver.connect(resolvedBinding);\n\t\treturn runtime;\n\t};\n\tconst getRuntime = () => {\n\t\tif (closed) return Promise.reject(closedError());\n\t\tif (runtimePromise !== void 0) return runtimePromise;\n\t\tif (binding === void 0) return Promise.reject(mongoError(\"RUNTIME.BINDING_MISSING\", \"Mongo binding not configured. Pass url/uri+dbName/mongoClient+dbName/binding to mongo(...) or call db.connect({ ... }).\"));\n\t\truntimePromise = buildRuntime(binding).catch((err) => {\n\t\t\truntimePromise = void 0;\n\t\t\tthrow err;\n\t\t});\n\t\treturn runtimePromise;\n\t};\n\tfunction queryRows(plan) {\n\t\tasync function* iterate() {\n\t\t\tyield* (await getRuntime()).query(plan);\n\t\t}\n\t\treturn new AsyncIterableResult(iterate());\n\t}\n\tasync function executeStats(plan) {\n\t\treturn (await getRuntime()).execute(plan);\n\t}\n\treturn {\n\t\torm: mongoOrm({\n\t\t\tcontext,\n\t\t\truntime: {\n\t\t\t\tquery: queryRows,\n\t\t\t\texecute: executeStats\n\t\t\t}\n\t\t}),\n\t\tquery,\n\t\traw,\n\t\tcontract,\n\t\tenums,\n\t\tcontext,\n\t\tasync connect(bindingInput) {\n\t\t\tif (closed) throw closedError();\n\t\t\tif (runtimePromise !== void 0) {\n\t\t\t\tif (bindingInput !== void 0) throw mongoError(\"DRIVER.ALREADY_CONNECTED\", \"Mongo client is already bound\", {\n\t\t\t\t\twhy: \"connect() was given options after the client was bound to a database.\",\n\t\t\t\t\tfix: \"Call connect() without options, or create a new client for another database.\"\n\t\t\t\t});\n\t\t\t\tconst runtime = await runtimePromise;\n\t\t\t\tif (closed) throw closedError();\n\t\t\t\treturn runtime;\n\t\t\t}\n\t\t\tif (bindingInput !== void 0) binding = resolveMongoBinding(bindingInput);\n\t\t\tif (binding === void 0) throw mongoError(\"RUNTIME.BINDING_MISSING\", \"Mongo binding not configured. Pass url/uri+dbName/mongoClient+dbName/binding to mongo(...) or call db.connect({ ... }).\");\n\t\t\tconst runtime = await getRuntime();\n\t\t\tif (closed) throw closedError();\n\t\t\treturn runtime;\n\t\t},\n\t\truntime() {\n\t\t\treturn getRuntime();\n\t\t},\n\t\tasync prepare(declaration, callback) {\n\t\t\tif (closed) throw closedError();\n\t\t\treturn prepareMongoQuery(createRuntime().runtime, declaration, callback);\n\t\t},\n\t\tasync close() {\n\t\t\tif (closed) return;\n\t\t\tclosed = true;\n\t\t\tawait runtimePromise?.catch(() => void 0);\n\t\t\tawait runtimeInstance?.runtime.close();\n\t\t},\n\t\t[Symbol.asyncDispose]() {\n\t\t\treturn this.close();\n\t\t}\n\t};\n}\n//#endregion\nexport { mongo as default, isStructuredError };\n\n//# sourceMappingURL=runtime.mjs.map"],"mappings":";;;;;;;;;;;;;AAaA,SAAS,WAAW,MAAM,SAAS,SAAS;CAC3C,OAAO,gBAAgB,MAAM,SAAS;EACrC,GAAG;EACH,MAAM;GACL,GAAG,SAAS;GACZ,WAAW;EACZ;CACD,CAAC;AACF;AAGA,MAAM,qBAAqB;AAC3B,MAAM,gCAAgC,IAAI,IAAI,CAAC,WAAW,aAAa,CAAC;AACxE,SAAS,iBAAiB,KAAK;CAC9B,MAAM,UAAU,IAAI,KAAK;CACzB,IAAI,QAAQ,WAAW,GAAG,MAAM,WAAW,2BAA2B,sCAAsC;CAC5G,MAAM,SAAS,mBAAmB,KAAK,OAAO,CAAC,GAAG;CAClD,IAAI,WAAW,KAAK,GAAG,MAAM,WAAW,2BAA2B,+BAA+B;CAClG,IAAI,CAAC,cAAc,IAAI,MAAM,GAAG,MAAM,WAAW,2BAA2B,iDAAiD;CAC7H,IAAI;EACH,OAAO,IAAI,iBAAiB,OAAO;CACpC,QAAQ;EACP,MAAM,WAAW,2BAA2B,+BAA+B;CAC5E;AACD;AACA,SAAS,qBAAqB,QAAQ;CACrC,MAAM,CAAC,gBAAgB,MAAM,OAAO,SAAS,MAAM,CAAC,CAAC,CAAC,MAAM,GAAG;CAC/D,IAAI,cAAc,WAAW,GAAG;CAChC,IAAI;EACH,OAAO,mBAAmB,aAAa;CACxC,QAAQ;EACP,MAAM,WAAW,2BAA2B,+BAA+B;CAC5E;AACD;AACA,SAAS,oBAAoB,SAAS;CACrC,MAAM,gBAAgB,OAAO,QAAQ,YAAY,KAAK,CAAC,IAAI,OAAO,QAAQ,QAAQ,KAAK,CAAC,IAAI,OAAO,QAAQ,QAAQ,KAAK,CAAC,IAAI,OAAO,QAAQ,gBAAgB,KAAK,CAAC;CAClK,IAAI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AAG,QAAQ,IAAI;CACzC;CACA,OAAO;EACN,KAAK,SAAS;GACb;GACA,SAAS;IACR,OAAO;IACP,SAAS;GACV;EACD,CAAC;EACD;EACA;EACA;EACA;EACA;EACA,MAAM,QAAQ,cAAc;GAC3B,IAAI,QAAQ,MAAM,YAAY;GAC9B,IAAI,mBAAmB,KAAK,GAAG;IAC9B,IAAI,iBAAiB,KAAK,GAAG,MAAM,WAAW,4BAA4B,iCAAiC;KAC1G,KAAK;KACL,KAAK;IACN,CAAC;IACD,MAAM,UAAU,MAAM;IACtB,IAAI,QAAQ,MAAM,YAAY;IAC9B,OAAO;GACR;GACA,IAAI,iBAAiB,KAAK,GAAG,UAAU,oBAAoB,YAAY;GACvE,IAAI,YAAY,KAAK,GAAG,MAAM,WAAW,2BAA2B,yHAAyH;GAC7L,MAAM,UAAU,MAAM,WAAW;GACjC,IAAI,QAAQ,MAAM,YAAY;GAC9B,OAAO;EACR;EACA,UAAU;GACT,OAAO,WAAW;EACnB;EACA,MAAM,QAAQ,aAAa,UAAU;GACpC,IAAI,QAAQ,MAAM,YAAY;GAC9B,OAAO,kBAAkB,cAAc,CAAC,CAAC,SAAS,aAAa,QAAQ;EACxE;EACA,MAAM,QAAQ;GACb,IAAI,QAAQ;GACZ,SAAS;GACT,MAAM,gBAAgB,YAAY,KAAK,CAAC;GACxC,MAAM,iBAAiB,QAAQ,MAAM;EACtC;EACA,CAAC,OAAO,gBAAgB;GACvB,OAAO,KAAK,MAAM;EACnB;CACD;AACD"}
|
package/dist/static.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as contractFromJson, r as mongoStatic } from "./mongo-static-
|
|
1
|
+
import { n as contractFromJson, r as mongoStatic } from "./mongo-static-DXgxqad2-EexeYfrg.mjs";
|
|
2
2
|
export { contractFromJson, mongoStatic as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/orm-mongo",
|
|
3
|
-
"version": "8.0.1-dev.
|
|
3
|
+
"version": "8.0.1-dev.45",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -19,21 +19,21 @@
|
|
|
19
19
|
"temporal-spec": "1.0.1"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@internal/mongo": "8.0.1-dev.
|
|
23
|
-
"@prisma/orm-family-mongo": "8.0.1-dev.
|
|
24
|
-
"@prisma/orm-framework": "8.0.1-dev.
|
|
25
|
-
"@prisma/orm-target-mongo": "8.0.1-dev.
|
|
26
|
-
"@prisma/orm-toolchain": "8.0.1-dev.
|
|
27
|
-
"@repo/tsconfig": "8.0.1-dev.
|
|
28
|
-
"@repo/tsdown": "8.0.1-dev.
|
|
22
|
+
"@internal/mongo": "8.0.1-dev.45",
|
|
23
|
+
"@prisma/orm-family-mongo": "8.0.1-dev.45",
|
|
24
|
+
"@prisma/orm-framework": "8.0.1-dev.45",
|
|
25
|
+
"@prisma/orm-target-mongo": "8.0.1-dev.45",
|
|
26
|
+
"@prisma/orm-toolchain": "8.0.1-dev.45",
|
|
27
|
+
"@repo/tsconfig": "8.0.1-dev.45",
|
|
28
|
+
"@repo/tsdown": "8.0.1-dev.45",
|
|
29
29
|
"tsdown": "0.22.14",
|
|
30
30
|
"typescript": "5.9.3"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"@prisma/orm-family-mongo": "8.0.1-dev.
|
|
34
|
-
"@prisma/orm-framework": "8.0.1-dev.
|
|
35
|
-
"@prisma/orm-target-mongo": "8.0.1-dev.
|
|
36
|
-
"@prisma/orm-toolchain": "8.0.1-dev.
|
|
33
|
+
"@prisma/orm-family-mongo": "8.0.1-dev.45",
|
|
34
|
+
"@prisma/orm-framework": "8.0.1-dev.45",
|
|
35
|
+
"@prisma/orm-target-mongo": "8.0.1-dev.45",
|
|
36
|
+
"@prisma/orm-toolchain": "8.0.1-dev.45",
|
|
37
37
|
"mongodb": "^7.0.0",
|
|
38
38
|
"temporal-polyfill": "^1.0.8",
|
|
39
39
|
"typescript": ">=5.9"
|
package/skills/prisma-8/SKILL.md
CHANGED
|
@@ -15,7 +15,7 @@ description: >-
|
|
|
15
15
|
ORM 7 or earlier (schema.prisma + @prisma/client).
|
|
16
16
|
metadata:
|
|
17
17
|
library: '@prisma/orm-mongo'
|
|
18
|
-
library_version: '8.0.1-dev.
|
|
18
|
+
library_version: '8.0.1-dev.45'
|
|
19
19
|
version: '2026-09-12'
|
|
20
20
|
---
|
|
21
21
|
|
|
@@ -30,10 +30,10 @@ Prisma 8 moves fast, and your training data about it is very likely outdated. Th
|
|
|
30
30
|
Check these before acting on anything below. Halt on the first one that fails and tell the user what is missing. Pre-conditions 1 and 3 describe an application that is already set up. Check only pre-condition 2 in a package that builds a target or is a Prisma extension, and when setting up a new project, which creates what 1 and 3 check.
|
|
31
31
|
|
|
32
32
|
1. **The project is on Prisma 8.** `prisma.config.ts` exports `definePrismaConfig({ orm: ... })`, and `package.json` depends on the package for its database: `@prisma/orm-postgres`, `@prisma/orm-mongo`, `@prisma/orm-sqlite`, `@prisma/orm-mysql`, `@prisma/orm-mariadb`, or another package that `prisma.config.ts` imports `defineConfig` from. A project with `schema.prisma` and `@prisma/client` is Prisma 7 or earlier; this skill does not apply to it, and its instructions will break such a project.
|
|
33
|
-
2. **The skill matches the installed version.** Compare `metadata.library_version` in this file's frontmatter with the installed `@prisma/orm-*` version in `package.json`. If they differ, run `prisma skills sync` and re-read this file before continuing. If no `@prisma/orm-*` package is installed, as in a project not set up yet, this check passes.
|
|
33
|
+
2. **The skill matches the installed version.** Compare `metadata.library_version` in this file's frontmatter with the installed `@prisma/orm-*` version in `package.json`. If they differ, run `prisma skills sync` and re-read this file before continuing. If no `@prisma/orm-*` package is installed, as in a project not set up yet, this check passes. During an upgrade it does not apply: the upgrade references have you read the skill of the newest published release, which is meant to be newer than the installed packages, and sync only when the upgrade is done ([`references/upgrade-app.md`](references/upgrade-app.md#step-0--read-the-newest-releases-skill), [`references/upgrade-extension.md`](references/upgrade-extension.md#step-0--read-the-newest-releases-skill)).
|
|
34
34
|
3. **The contract artefacts exist.** `contract.json` and `contract.d.ts` sit next to the contract source named by `prisma.config.ts`. If they are missing or older than the source, run `prisma contract emit` first; every query and migration instruction below assumes current artefacts.
|
|
35
35
|
|
|
36
|
-
**Import paths in the references.** The reference files name the published packages an application installs: `@prisma/orm-<target>/<subpath>` (`@prisma/orm-postgres/runtime`, `@prisma/orm-mongo/config`, `@prisma/orm-sqlite/runtime`) and `@prisma/orm-extension-<name>/<subpath>` (`@prisma/orm-extension-pgvector/control`). Some older per-transition instructions under `upgrading/` name a package by the Prisma repository's workspace name, which is not published; find the `@prisma/orm-*` entry that carries the same module before writing it into user code. The `metadata.library_version` in this file's frontmatter is the version it was published with; if it does not match the project's installed Prisma packages, run `prisma skills sync` and re-read.
|
|
36
|
+
**Import paths in the references.** The reference files name the published packages an application installs: `@prisma/orm-<target>/<subpath>` (`@prisma/orm-postgres/runtime`, `@prisma/orm-mongo/config`, `@prisma/orm-sqlite/runtime`) and `@prisma/orm-extension-<name>/<subpath>` (`@prisma/orm-extension-pgvector/control`). Some older per-transition instructions under `upgrading/` name a package by the Prisma repository's workspace name, which is not published; find the `@prisma/orm-*` entry that carries the same module before writing it into user code. The `metadata.library_version` in this file's frontmatter is the version it was published with; if it does not match the project's installed Prisma packages, run `prisma skills sync` and re-read, except during an upgrade, as pre-condition 2 says.
|
|
37
37
|
|
|
38
38
|
## Never reset or drop a database
|
|
39
39
|
|
|
@@ -43,7 +43,7 @@ Both files are **emitted artefacts**. Edit the source; never the JSON or `.d.ts`
|
|
|
43
43
|
|
|
44
44
|
- **The `@prisma/orm-<target>` package is the only surface user-authored code imports from.** For a Postgres app: `@prisma/orm-postgres/config`, `@prisma/orm-postgres/contract-builder`, `@prisma/orm-postgres/control`, `@prisma/orm-postgres/runtime`, `@prisma/orm-postgres/static`. Mongo has the same layout (`@prisma/orm-mongo/config`, `@prisma/orm-mongo/contract-builder`, `@prisma/orm-mongo/runtime`, `@prisma/orm-mongo/static`). Each extension publishes its own entry points — `@prisma/orm-extension-pgvector/control`, `@prisma/orm-extension-postgis/control`. **Never import the platform packages (`@prisma/orm-framework`, `@prisma/orm-family-*`, `@prisma/orm-target-*`, `@prisma/orm-toolchain`) from user code.** The database package bakes the family / target / adapter / driver wiring in. See *Common Pitfalls* #4.
|
|
45
45
|
- **Contract source.** A file the framework reads and lowers to the canonical Contract IR. Two flavours, both first-class:
|
|
46
|
-
- **`contract.prisma` (PSL)** — schema-flavoured DSL. Canonical for typical apps and brownfield Prisma users. Wired by `contract: './<path>/contract.prisma'` — the target config (`ormConfig`, below) detects the `.prisma` extension and routes through the PSL provider. On PostgreSQL the entry is an object that also lists every capability the contract requires: `contract: { path: './<path>/contract.prisma', requiredCapabilities: [...postgres18, ...postgresDriver] }`, with `postgres18` (what PostgreSQL 18 provides; `postgres15` to `postgres17` for older databases) and `postgresDriver` (what the driver's connection provides, such as interactive transactions) imported from `@prisma/orm-postgres/config`. The list must not be empty and nothing is added to it; filter a key out to stop requiring it. The first line of every `.prisma` file is `// use prisma-8`; `orm init` and `contract infer` write it, and the language server only serves diagnostics, completion, and formatting on files that carry it (it still recognises the header earlier releases wrote and rewrites it on Format).
|
|
46
|
+
- **`contract.prisma` (PSL)** — schema-flavoured DSL. Canonical for typical apps and brownfield Prisma users. Wired by `contract: './<path>/contract.prisma'` — the target config (`ormConfig`, below) detects the `.prisma` extension and routes through the PSL provider. On PostgreSQL the entry is an object that also lists every capability the contract requires: `contract: { path: './<path>/contract.prisma', requiredCapabilities: [...postgres18, ...postgresDriver] }`, with `postgres18` (what PostgreSQL 18 provides; `postgres15` to `postgres17` for older databases) and `postgresDriver` (what the driver's connection provides, such as interactive transactions) imported from `@prisma/orm-postgres/config`. The list must not be empty and nothing is added to it; filter a key out to stop requiring it. After changing the list, run `prisma contract emit` and commit the migration snapshot it updates, then sign each existing database again with `prisma db sign --no-advance-ref`, since its signature records the old list. The first line of every `.prisma` file is `// use prisma-8`; `orm init` and `contract infer` write it, and the language server only serves diagnostics, completion, and formatting on files that carry it (it still recognises the header earlier releases wrote and rewrites it on Format).
|
|
47
47
|
- **`contract.ts` (TypeScript builder)** — programmatic authoring with `defineContract({...}, ({ field, model, rel, type }) => ({...}))` from `@prisma/orm-postgres/contract-builder` (or `@prisma/orm-mongo/contract-builder`, `@prisma/orm-sqlite/contract-builder`, `@prisma/orm-mysql/contract-builder`, `@prisma/orm-mariadb/contract-builder`). Wired by `contract: './<path>/contract.ts'` — the database package detects the `.ts` extension and routes through the TS provider. On PostgreSQL, `defineContract` takes `requiredCapabilities: [...postgres18, ...postgresDriver]` the same way, imported from `@prisma/orm-postgres/contract-builder`. Use when you need programmatic composition (per-tenant variants, generated fields) or constructs PSL doesn't yet express (e.g. registering a parameterised extension type — see pgvector's contract).
|
|
48
48
|
- **An existing Prisma schema, during adoption.** A project that still runs an earlier Prisma can point `contract:` at its current `schema.prisma` instead of writing a Prisma 8 contract: `contract: prisma6Schema('prisma/schema.prisma')` from `@prisma/orm-mongo/config` reads a Prisma 6 MongoDB schema, and `prisma7Schema` from `@prisma/orm-postgres/config` reads a Prisma 7 Postgres schema. The earlier Prisma keeps owning the database; after each change there, run `contract emit` and `db sign`. A construct Prisma 8 cannot express fails `contract emit` with a `PSL.PRISMA6_MONGO_*` or `PSL.PRISMA7_*` diagnostic. See the database package READMEs for the details.
|
|
49
49
|
- **`prisma.config.ts`.** Wires the contract source, the database connection, the migrations directory, and any installed extensions. The file is an *envelope*: the unified CLI's `definePrismaConfig({...})` from `prisma/config` wraps an `orm:` section built by the target's `defineConfig` — conventionally imported as `ormConfig` from `@prisma/orm-postgres/config` (or `@prisma/orm-mongo/config`). There is no flat form; a bare `defineConfig({ contract, ... })` default export fails with `CONFIG.VERSION_MARKER_MISSING`. Pass `formatter: { indent, newline }` to `ormConfig` to set how `prisma contract format` and the language server lay out PSL files: `indent` is a whole number of spaces, 1 or more (default 2), or `'tab'`. `newline` is `'LF'` or `'CRLF'`; without it, `contract format` uses the operating system's line ending and the language server uses LF.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Prints the files of the project that a change's `detection` block of an upgrade guide finds, one path per line, relative to the working directory, which is the project root.
|
|
4
|
+
*
|
|
5
|
+
* Usage: node find-detection-hits.ts [--all] <glob> [<pattern>...] [--contains <text>...]
|
|
6
|
+
*
|
|
7
|
+
* A file is a hit when `glob` matches its path and any pattern, compiled with `new RegExp(pattern)` and no flags, matches its whole content, or its content contains any `--contains` text. With `--all`, for a detection with `anyMatch: false`, every pattern must match and every text be contained. Pass each pattern and text as it reads once decoded from the guide's YAML.
|
|
8
|
+
*
|
|
9
|
+
* It skips `node_modules` and `.git`, and does not follow symbolic links: a link to a file in the project is found through that file. A `**` in the glob does not enter a folder whose name starts with a dot, but a glob that names one, such as `.github/workflows/*.yml`, does.
|
|
10
|
+
*/
|
|
11
|
+
import { readdirSync, readFileSync } from 'node:fs';
|
|
12
|
+
import { join, matchesGlob } from 'node:path';
|
|
13
|
+
|
|
14
|
+
const SKIPPED = new Set(['node_modules', '.git']);
|
|
15
|
+
|
|
16
|
+
function* projectFiles(dir: string, prefix: string): Generator<string> {
|
|
17
|
+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
18
|
+
const path = prefix === '' ? entry.name : `${prefix}/${entry.name}`;
|
|
19
|
+
if (entry.isDirectory() && !SKIPPED.has(entry.name))
|
|
20
|
+
yield* projectFiles(join(dir, entry.name), path);
|
|
21
|
+
else if (entry.isFile()) yield path;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function main(args: readonly string[]): number {
|
|
26
|
+
const all = args[0] === '--all';
|
|
27
|
+
const [glob, ...rest] = all ? args.slice(1) : args;
|
|
28
|
+
if (glob === undefined || glob === '' || glob.startsWith('--')) {
|
|
29
|
+
process.stderr.write(
|
|
30
|
+
'Usage: node find-detection-hits.ts [--all] <glob> [<pattern>...] [--contains <text>...]\n',
|
|
31
|
+
);
|
|
32
|
+
return 1;
|
|
33
|
+
}
|
|
34
|
+
const split = rest.includes('--contains') ? rest.indexOf('--contains') : rest.length;
|
|
35
|
+
const patterns = rest.slice(0, split).map((pattern) => new RegExp(pattern));
|
|
36
|
+
const texts = rest.slice(split + 1);
|
|
37
|
+
const root = process.cwd();
|
|
38
|
+
const hits: string[] = [];
|
|
39
|
+
for (const path of projectFiles(root, '')) {
|
|
40
|
+
if (!matchesGlob(path, glob)) continue;
|
|
41
|
+
const content = readFileSync(join(root, path), 'utf8');
|
|
42
|
+
const results = [
|
|
43
|
+
...patterns.map((pattern) => pattern.test(content)),
|
|
44
|
+
...texts.map((text) => content.includes(text)),
|
|
45
|
+
];
|
|
46
|
+
if (all ? results.every(Boolean) : results.some(Boolean)) hits.push(path);
|
|
47
|
+
}
|
|
48
|
+
process.stdout.write(
|
|
49
|
+
hits
|
|
50
|
+
.sort()
|
|
51
|
+
.map((path) => `${path}\n`)
|
|
52
|
+
.join(''),
|
|
53
|
+
);
|
|
54
|
+
return 0;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
process.exitCode = main(process.argv.slice(2));
|
|
@@ -4,11 +4,22 @@ This reference upgrades a project that **consumes** Prisma 8 via the public pack
|
|
|
4
4
|
|
|
5
5
|
The per-transition instructions this reference reads live under [`../upgrading/app/upgrades/`](../upgrading/app/upgrades/).
|
|
6
6
|
|
|
7
|
-
## Step 0 —
|
|
7
|
+
## Step 0 — Read the newest release's skill
|
|
8
8
|
|
|
9
|
-
The
|
|
9
|
+
The skill in the project describes the release installed now. Each release carries the guide of every earlier step, with the corrections made to it since, such as a fixed script, or an instruction to install a later release in place of a step's own `<to>`. An earlier copy lacks the corrections made after it. So read this reference and every step's guide from the skill of the newest published release, even when the user's target is older, and run the guides' scripts from that copy:
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
1. **Find the newest published release.** Run `pnpm view <database package> dist-tags.latest dist-tags.next`, with the project's database package, such as `@prisma/orm-postgres`. Take the greater of the two versions: `8.0.0-rc.27` is greater than `8.0.0-rc.25`, so compare the numbers after `rc.`, not the text, and `8.0.1` is greater than every `8.0.0-rc.N`.
|
|
12
|
+
2. **Download its skill.** Unpack that release's package in a new, empty folder outside the project and outside every agent skills folder (`.agents/skills/`, `.claude/skills/`, `.cursor/skills/`, `.windsurf/skills/`), which `prisma skills sync` writes:
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
dir="$(mktemp -d)"
|
|
16
|
+
curl -fsSL "$(pnpm view <database package>@<newest> dist.tarball)" | tar -xz -C "$dir"
|
|
17
|
+
echo "$dir/package/skills/prisma-8"
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
The folder it prints is the skill's folder, which this reference and the guides call `<skill>`. If the download fails, stop and tell the user: the upgrade's installs need the same registry.
|
|
21
|
+
3. **Read from that copy.** Read this reference again from `<skill>/references/upgrade-app.md`, unless that is the copy you are reading, and follow it from here. Read each step's guide from `<skill>/upgrading/app/upgrades/<from>-to-<to>/instructions.md`. Where a guide runs a script from the project's skill copy, such as `node .agents/skills/prisma-8/upgrading/...`, run the same path under `<skill>`, still from the project root: `node <skill>/upgrading/...`.
|
|
22
|
+
4. **Do not sync the skill until the chain is done.** During the upgrade, do not run `prisma skills sync`, and ignore the line a `prisma` command prints when the project's skill copy differs from the installed packages: a sync would bring back the installed release's copy. Sync once, when the chain is done.
|
|
12
23
|
|
|
13
24
|
## Pre-flight — extension compatibility
|
|
14
25
|
|
|
@@ -78,21 +89,23 @@ If the from-to delta spans more than one release (e.g. `0.6 → 0.8`), build the
|
|
|
78
89
|
|
|
79
90
|
The [`../upgrading/app/upgrades/`](../upgrading/app/upgrades/) directories name the steps — read the chain off the directory names rather than deriving it arithmetically. Each directory is `<from>-to-<to>`. A step normally spans one stable minor (`0.7-to-0.8`) or one release candidate (`8.0.0-rc.1-to-8.0.0-rc.2`). When intermediate versions were not published, a guide may span a larger hop; follow the available directory chain rather than inventing missing steps. Moving onto the RC line from the last stable minor is a single step of its own (`0.17-to-8.0.0-rc.1`).
|
|
80
91
|
|
|
81
|
-
Apply each step in order, fully: bump, install, run instructions, validate, commit — before moving to the next. The one exception is [steps taken together](#steps-taken-together), which the pre-flight decides. Halt the chain on the first failed step; do not skip ahead.
|
|
92
|
+
Apply each step in order, fully: bump, install, run instructions, validate, commit — before moving to the next. The one exception is [steps taken together](#steps-taken-together), which the pre-flight, or a step's own guide, decides. Halt the chain on the first failed step; do not skip ahead.
|
|
82
93
|
|
|
83
|
-
The chain order does not depend on which extensions are installed; the pre-flight
|
|
94
|
+
The chain order does not depend on which extensions are installed; the pre-flight works out how far it can go and which steps are taken together, and a step's own guide can add to that.
|
|
84
95
|
|
|
85
96
|
### Steps taken together
|
|
86
97
|
|
|
87
98
|
An extension with versions of its own may have no release for some steps of the chain and a release for a later one. A release candidate cut after the extension's last release is one such step. The extension at its old release names the old Prisma versions, so the project cannot install those steps with it. The `prisma` command-line tool is the same: for some steps no `prisma` version fits, and a `prisma` command must run on the toolchain of the packages installed at that time. Take those steps, and the later step, together, using the per-step flow's own parts:
|
|
88
99
|
|
|
89
100
|
- Do the bump once, to the later step's versions: the first later step for which every extension has a release and a `prisma` version fits.
|
|
90
|
-
- Install once
|
|
101
|
+
- Install once.
|
|
91
102
|
- Read and apply the upgrade instructions of every step from the first of them to that later step, in the chain's order, with no install in between.
|
|
92
103
|
- Validate once, after the last of them, then commit. Name every step the commit covers in its message.
|
|
93
104
|
|
|
94
105
|
The `prisma` commands that the earlier steps' instructions run, such as `prisma contract emit`, `prisma db sign` and `prisma migration plan`, run on the installed toolchain, which is the later step's. So where an earlier step's guide says what such a command must or must not change, read that against the later step: the command writes the later step's format. If validation fails, report every step taken together, and the change ids whose files the failure names, because the failure can come from any of them.
|
|
95
106
|
|
|
107
|
+
A step's own guide can also tell you to install a later release in place of its own `<to>`, as the `8.0.0-rc.25` to `8.0.0-rc.26` app guide does in step 2 of its "Order of the steps"; the guide gives its reason. The pre-flight can read this in the newest guides before installing anything, and take the steps together from the start, so that the bump happens once. If you find it after installing `<to>`, do as the guide says at the point in its order where it says it: bump again, to the newest release up to the user's target that every extension and a `prisma` version fit, choose `prisma` for that release, and install. Then read this step's guide again, from the skill of the newest published release as [Step 0](#step-0--read-the-newest-releases-skill) describes (fetch it again if a later release has been published since), and continue from the same point in its order. The steps from this one to that release are taken together: apply this guide and each later step's guide in order, and validate and commit once, as above. If no later release fits, or the user's target is this step itself, take the step alone and tell the user; when the project later reaches the step that fixes the fault, that step's guide says how to repair what the fault left.
|
|
108
|
+
|
|
96
109
|
## Per-step flow
|
|
97
110
|
|
|
98
111
|
For each `(from, to)` step in the chain:
|
|
@@ -118,15 +131,21 @@ For each `(from, to)` step in the chain:
|
|
|
118
131
|
|
|
119
132
|
**The `prisma` command-line tool.** Move `prisma` too, or add it as a development dependency if the project does not list it, at a version chosen as [Choosing the `prisma` version](#choosing-the-prisma-version) describes. Write the project's `@prisma/orm-toolchain` and `@prisma/orm-framework` lines exactly at the versions that `prisma` depends on, with no caret or tilde, in place of the caret or tilde the rules above give them, so that the install cannot take a later patch. `prisma` runs the ORM commands from its own copy of the toolchain, and that copy must be the application's, so the application's `@prisma/orm-toolchain` and `@prisma/orm-framework` must resolve to the versions `prisma` depends on. The pre-flight has already found the version for this step. A step no `prisma` version fits is taken together with a later one, or is past where the chain stops.
|
|
120
133
|
|
|
121
|
-
The skill itself ships inside the Prisma packages, so bumping them is what updates
|
|
134
|
+
The skill itself ships inside the Prisma packages, so bumping them is what updates the project's copy, which you sync when the chain is done. There is no separate skill package to bump.
|
|
122
135
|
|
|
123
136
|
2. **Install.** Run `pnpm install` (or the project's lockfile-managing command). The project's code is now broken against the new types — the upgrade instructions for `<from> → <to>` exist to fix it.
|
|
124
137
|
|
|
125
|
-
3. **Read the upgrade instructions.**
|
|
138
|
+
3. **Read the upgrade instructions.** Load `<skill>/upgrading/app/upgrades/<from>-to-<to>/instructions.md`, from the newest release's skill ([Step 0](#step-0--read-the-newest-releases-skill)). Parse the YAML frontmatter and pay particular attention to its `changes[]` array.
|
|
126
139
|
|
|
127
140
|
4. **Apply each change.** When the guide's body has a section that orders the steps, such as `Order of the steps`, apply the changes in that order: it says which script runs before which, and when to sign the databases and when to plan and apply a migration. Where an entry's prose says to sign or migrate, do it at the step that section names. Otherwise take the entries in the order of `changes[]`. For each entry in `changes[]`:
|
|
128
141
|
- If the entry has a `detection` block (glob + content predicate), run it; skip the change if no files match. No `detection` → apply unconditionally. Run the glob over the project's own files: skip `node_modules`, and build output such as `dist`, `build`, `.next` or `out` (whatever directories the project's build writes). A match there is generated code, which the next build rewrites; editing it changes nothing. Migration snapshots under `migrations/snapshots/` are committed files, not build output, so keep them.
|
|
129
|
-
- How a `detection` block runs: `glob` selects files relative to the project root. Each `matches` entry, once read from the YAML, is a JavaScript regular expression, built as `new RegExp(pattern)` with no flags and tested against the whole content of one file at a time;
|
|
142
|
+
- How a `detection` block runs: `glob` selects files relative to the project root. Each `matches` entry, once read from the YAML, is a JavaScript regular expression, built as `new RegExp(pattern)` with no flags and tested against the whole content of one file at a time; some older guides call these entries `regex`, which means the same. Each `contains` entry is a plain substring. A file is a hit when any entry matches it, or, when the block sets `anyMatch: false`, only when every entry matches it; `anyMatch: true` changes nothing. Patterns may span lines, and some look at the whole file (for example, to skip a file that declares something elsewhere in it), so a line-by-line search such as `grep` or `rg` without `-U` is not the same test and can report files the pattern excludes. Do not use `rg --pcre2` either: some patterns have a lookbehind of unbounded length, such as `(?<!\b(?:import|export)\s+(?:type\s+)?\{[^}]*)`, which PCRE2 refuses with "length of lookbehind assertion is not limited". From a shell, run the detection with the skill's script, with Node 24 or later, from the project root. For example, for the `boolean-codec-type-takes-codec-types` change of the `8.0.0-rc.26` to `8.0.0-rc.27` guide:
|
|
143
|
+
|
|
144
|
+
```sh
|
|
145
|
+
node <skill>/references/scripts/find-detection-hits.ts '**/*.{ts,tsx,mts,cts}' '(?<!\b(?:import|export)\s+(?:type\s+)?\{[^}]*)\bBooleanCodecType\b(?!\s*<)'
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
After the script's path, give `--all` if the block sets `anyMatch: false`, then the change's `glob`, then each of its `matches` or `regex` entries; if it has `contains` entries, add `--contains` and then each of them. Pass each entry as it reads once decoded from the YAML: in a single-quoted YAML entry, `''` stands for one `'`; in a double-quoted one, `\\` stands for one `\` and `\"` for one `"`, so `"(['\"])x\\1"` decodes to `(['"])x\1`. Put each argument in single quotes, so that the shell does not expand the glob or change the pattern, and write each `'` inside one as `'\''`. So the YAML entry `'[''"]'` becomes the argument `'['\''"]'`. The script prints each file that is a hit, relative to the project root. It skips `node_modules` and `.git`, and does not follow symbolic links; a `**` does not enter a folder whose name starts with a dot, but a glob that names one, such as `.github/workflows/*.yml`, does. Leave out the hits in build output yourself.
|
|
130
149
|
- If the entry names a `script:` (a relative path next to `instructions.md`), invoke it from the project root:
|
|
131
150
|
- `*.ts` → the command the guide's prose gives, such as `node <script>` (Node 24 or later runs TypeScript directly); with no command in the prose, `pnpm exec tsx <skill>/upgrading/app/upgrades/<from>-to-<to>/<script>`
|
|
132
151
|
- `*.sh` → `bash <skill>/upgrading/app/upgrades/<from>-to-<to>/<script>`
|
|
@@ -165,7 +184,7 @@ Its version numbers are its own, though they look like the ORM's: `prisma@8.0.0-
|
|
|
165
184
|
|
|
166
185
|
## When the chain is done
|
|
167
186
|
|
|
168
|
-
Report back to the user: the number of steps applied, the SHAs of the commits you made, and any open follow-ups (e.g. tests that were already red before the upgrade and still are). If the chain stopped short of the user's target because no `prisma` version carries a later step, say so, and say which step to re-run from once one is published.
|
|
187
|
+
Run `prisma skills sync`, so the project's copy of the skill matches the release now installed, and commit it if the project tracks it. Report back to the user: the number of steps applied, the SHAs of the commits you made, and any open follow-ups (e.g. tests that were already red before the upgrade and still are). If the chain stopped short of the user's target because no `prisma` version carries a later step, say so, and say which step to re-run from once one is published.
|
|
169
188
|
|
|
170
189
|
## Failure surfaces
|
|
171
190
|
|
|
@@ -6,11 +6,22 @@ If the project you are upgrading is a consumer **app** (it depends on a database
|
|
|
6
6
|
|
|
7
7
|
The per-transition instructions this reference reads live under [`../upgrading/extension/upgrades/`](../upgrading/extension/upgrades/).
|
|
8
8
|
|
|
9
|
-
## Step 0 —
|
|
9
|
+
## Step 0 — Read the newest release's skill
|
|
10
10
|
|
|
11
|
-
The
|
|
11
|
+
The skill in the project describes the release installed now. Each release carries the guide of every earlier step, with the corrections made to it since, such as a fixed script, or an instruction to install a later release in place of a step's own `<to>`. An earlier copy lacks the corrections made after it. So read this reference and every step's guide from the skill of the newest published release, even when the user's target is older, and run the guides' scripts from that copy:
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
1. **Find the newest published release.** Run `pnpm view @prisma/orm-postgres dist-tags.latest dist-tags.next`. The skill ships only in the database packages, such as `@prisma/orm-postgres`, and each carries the same skill, so take it from `@prisma/orm-postgres` whatever database the extension serves. Take the greater of the two versions: `8.0.0-rc.27` is greater than `8.0.0-rc.25`, so compare the numbers after `rc.`, not the text, and `8.0.1` is greater than every `8.0.0-rc.N`.
|
|
14
|
+
2. **Download its skill.** Unpack that release's package in a new, empty folder outside the project and outside every agent skills folder (`.agents/skills/`, `.claude/skills/`, `.cursor/skills/`, `.windsurf/skills/`), which `prisma skills sync` writes:
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
dir="$(mktemp -d)"
|
|
18
|
+
curl -fsSL "$(pnpm view @prisma/orm-postgres@<newest> dist.tarball)" | tar -xz -C "$dir"
|
|
19
|
+
echo "$dir/package/skills/prisma-8"
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The folder it prints is the skill's folder, which this reference and the guides call `<skill>`. If the download fails, stop and tell the user: the upgrade's installs need the same registry.
|
|
23
|
+
3. **Read from that copy.** Read this reference again from `<skill>/references/upgrade-extension.md`, unless that is the copy you are reading, and follow it from here. Read each step's guide from `<skill>/upgrading/extension/upgrades/<from>-to-<to>/instructions.md`. Where a guide runs a script from the project's skill copy, such as `node .agents/skills/prisma-8/upgrading/...`, run the same path under `<skill>`, still from the project root: `node <skill>/upgrading/...`.
|
|
24
|
+
4. **Do not sync the skill until the chain is done.** During the upgrade, do not run `prisma skills sync`, and ignore the line a `prisma` command prints when the project's skill copy differs from the installed packages: a sync would bring back the installed release's copy. Sync once, when the chain is done.
|
|
14
25
|
|
|
15
26
|
## Role detection
|
|
16
27
|
|
|
@@ -46,7 +57,7 @@ If the from-to delta spans more than one release (e.g. `0.6 → 0.8`), build the
|
|
|
46
57
|
|
|
47
58
|
The [`../upgrading/extension/upgrades/`](../upgrading/extension/upgrades/) directories name the steps — read the chain off the directory names rather than deriving it arithmetically. Each directory is `<from>-to-<to>`. A step normally spans one stable minor (`0.7-to-0.8`) or one release candidate (`8.0.0-rc.1-to-8.0.0-rc.2`). When intermediate versions were not published, a guide may span a larger hop; follow the available directory chain rather than inventing missing steps. Moving onto the RC line from the last stable minor is a single step of its own (`0.17-to-8.0.0-rc.1`).
|
|
48
59
|
|
|
49
|
-
Apply each step in order, fully: bump, install, run instructions, check pins, validate, commit — before moving to the next. The one exception is a step that a package with versions of its own, or `prisma`, has no release for; the bump step says when to take steps together. Halt the chain on the first failed step.
|
|
60
|
+
Apply each step in order, fully: bump, install, run instructions, check pins, validate, commit — before moving to the next. The one exception is a step that a package with versions of its own, or `prisma`, has no release for; the bump step says when to take steps together. A step's own guide can also tell you to take it together with a later step; do so, as [Steps taken together](upgrade-app.md#steps-taken-together) describes for an application and the bump step below describes for this flow. Halt the chain on the first failed step.
|
|
50
61
|
|
|
51
62
|
## Per-step flow
|
|
52
63
|
|
|
@@ -103,11 +114,17 @@ For each `(from, to)` step in the chain:
|
|
|
103
114
|
|
|
104
115
|
If it fails, the bump step did not rewrite every entry. Fix the entries it printed and run it again before going on.
|
|
105
116
|
|
|
106
|
-
4. **Read the upgrade instructions.**
|
|
117
|
+
4. **Read the upgrade instructions.** Load `<skill>/upgrading/extension/upgrades/<from>-to-<to>/instructions.md`, from the newest release's skill ([Step 0](#step-0--read-the-newest-releases-skill)). Parse the YAML frontmatter and pay particular attention to its `changes[]` array.
|
|
107
118
|
|
|
108
119
|
5. **Apply each change.** When the guide's body has a section that orders the steps, such as `Order of the steps`, apply the changes in that order: it says which script runs before which, and when to sign the databases and when to plan and apply a migration. Where an entry's prose says to sign or migrate, do it at the step that section names. Otherwise take the entries in the order of `changes[]`. For each entry in `changes[]`:
|
|
109
120
|
- If the entry has a `detection` block (a glob + content predicate), run it. If no files match, skip this change. Run the glob over the project's own files: skip `node_modules`, and build output such as `dist`, `build`, `.next` or `out` (whatever directories the project's build writes). A match there is generated code, which the next build rewrites; editing it changes nothing. Migration snapshots under `migrations/snapshots/` are committed files, not build output, so keep them.
|
|
110
|
-
- How a `detection` block runs: `glob` selects files relative to the project root. Each `matches` entry, once read from the YAML, is a JavaScript regular expression, built as `new RegExp(pattern)` with no flags and tested against the whole content of one file at a time;
|
|
121
|
+
- How a `detection` block runs: `glob` selects files relative to the project root. Each `matches` entry, once read from the YAML, is a JavaScript regular expression, built as `new RegExp(pattern)` with no flags and tested against the whole content of one file at a time; some older guides call these entries `regex`, which means the same. Each `contains` entry is a plain substring. A file is a hit when any entry matches it, or, when the block sets `anyMatch: false`, only when every entry matches it; `anyMatch: true` changes nothing. Patterns may span lines, and some look at the whole file (for example, to skip a file that declares something elsewhere in it), so a line-by-line search such as `grep` or `rg` without `-U` is not the same test and can report files the pattern excludes. Do not use `rg --pcre2` either: some patterns have a lookbehind of unbounded length, such as `(?<!\b(?:import|export)\s+(?:type\s+)?\{[^}]*)`, which PCRE2 refuses with "length of lookbehind assertion is not limited". From a shell, run the detection with the skill's script, with Node 24 or later, from the project root. For example, for the `boolean-codec-type-takes-codec-types` change of the `8.0.0-rc.26` to `8.0.0-rc.27` guide:
|
|
122
|
+
|
|
123
|
+
```sh
|
|
124
|
+
node <skill>/references/scripts/find-detection-hits.ts '**/*.{ts,tsx,mts,cts}' '(?<!\b(?:import|export)\s+(?:type\s+)?\{[^}]*)\bBooleanCodecType\b(?!\s*<)'
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
After the script's path, give `--all` if the block sets `anyMatch: false`, then the change's `glob`, then each of its `matches` or `regex` entries; if it has `contains` entries, add `--contains` and then each of them. Pass each entry as it reads once decoded from the YAML: in a single-quoted YAML entry, `''` stands for one `'`; in a double-quoted one, `\\` stands for one `\` and `\"` for one `"`, so `"(['\"])x\\1"` decodes to `(['"])x\1`. Put each argument in single quotes, so that the shell does not expand the glob or change the pattern, and write each `'` inside one as `'\''`. So the YAML entry `'[''"]'` becomes the argument `'['\''"]'`. The script prints each file that is a hit, relative to the project root. It skips `node_modules` and `.git`, and does not follow symbolic links; a `**` does not enter a folder whose name starts with a dot, but a glob that names one, such as `.github/workflows/*.yml`, does. Leave out the hits in build output yourself.
|
|
111
128
|
- If the entry has no `detection`, apply unconditionally.
|
|
112
129
|
- If the entry names a `script:` (a relative path next to `instructions.md`), invoke it from the project root:
|
|
113
130
|
- `*.ts` → the command the guide's prose gives, such as `node <script>` (Node 24 or later runs TypeScript directly); with no command in the prose, `pnpm exec tsx <skill>/upgrading/extension/upgrades/<from>-to-<to>/<script>`
|
|
@@ -166,7 +183,7 @@ The convention has two costs. A feature of yours that needs no newer Prisma rele
|
|
|
166
183
|
|
|
167
184
|
## When the chain is done
|
|
168
185
|
|
|
169
|
-
Report back to the user: the number of steps applied, the SHAs of the commits you made, and any open follow-ups. If the overrides for `prisma` are in place, say so: do not publish a release built with them. Once a `prisma` version that fits is published, move `prisma` to it, remove the overrides, and install and validate again.
|
|
186
|
+
Run `prisma skills sync`, so the project's copy of the skill matches the release now installed, and commit it if the project tracks it. Report back to the user: the number of steps applied, the SHAs of the commits you made, and any open follow-ups. If the overrides for `prisma` are in place, say so: do not publish a release built with them. Once a `prisma` version that fits is published, move `prisma` to it, remove the overrides, and install and validate again.
|
|
170
187
|
|
|
171
188
|
## Failure surfaces
|
|
172
189
|
|