@prisma/orm-mongo 8.0.1-dev.14 → 8.0.1-dev.15
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-DE5XLZbh-BSH5dT41.mjs → mongo-static-v-RXQgAe-Pq4eavCP.mjs} +3 -3
- package/dist/{mongo-static-DE5XLZbh-BSH5dT41.mjs.map → mongo-static-v-RXQgAe-Pq4eavCP.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 +2 -2
- package/skills/prisma-8/references/upgrade-app.md +54 -17
- package/skills/prisma-8/references/upgrade-extension.md +33 -10
|
@@ -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-v-RXQgAe.mjs
|
|
13
|
+
var version = "8.0.1-dev.15";
|
|
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-v-RXQgAe-Pq4eavCP.mjs.map
|
package/dist/{mongo-static-DE5XLZbh-BSH5dT41.mjs.map → mongo-static-v-RXQgAe-Pq4eavCP.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mongo-static-
|
|
1
|
+
{"version":3,"file":"mongo-static-v-RXQgAe-Pq4eavCP.mjs","names":[],"sources":["../../../../3-targets/mongo/9-facade/dist/mongo-static-v-RXQgAe.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/internal/format-version\";\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.15\";\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-v-RXQgAe.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-v-RXQgAe-Pq4eavCP.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-DE5XLZbh.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 { InternalError } from \"@internal/utils/internal-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 InternalError(\"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 InternalError(\"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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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-v-RXQgAe.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 { InternalError } from \"@internal/utils/internal-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 InternalError(\"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 InternalError(\"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;AAC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,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-v-RXQgAe-Pq4eavCP.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.15",
|
|
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.15",
|
|
23
|
+
"@prisma/orm-family-mongo": "8.0.1-dev.15",
|
|
24
|
+
"@prisma/orm-framework": "8.0.1-dev.15",
|
|
25
|
+
"@prisma/orm-target-mongo": "8.0.1-dev.15",
|
|
26
|
+
"@prisma/orm-toolchain": "8.0.1-dev.15",
|
|
27
|
+
"@repo/tsconfig": "8.0.1-dev.15",
|
|
28
|
+
"@repo/tsdown": "8.0.1-dev.15",
|
|
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.15",
|
|
34
|
+
"@prisma/orm-framework": "8.0.1-dev.15",
|
|
35
|
+
"@prisma/orm-target-mongo": "8.0.1-dev.15",
|
|
36
|
+
"@prisma/orm-toolchain": "8.0.1-dev.15",
|
|
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.15'
|
|
19
19
|
version: '2026-09-12'
|
|
20
20
|
---
|
|
21
21
|
|
|
@@ -72,7 +72,7 @@ Open the reference whose triggers match the task. If more than one matches, open
|
|
|
72
72
|
| Supabase | [`references/supabase.md`](references/supabase.md) | `@prisma/orm-extension-supabase`, RLS, row level security, policies (`policy_select` / `policy_update` / `@@rls`, `auth.uid()`), role binding (`asUser(jwt)` / `asAnon()` / `asServiceRole()`), `auth.users`, cross-space FKs to `supabase:auth.AuthUser`, JWT / JWKS (`SUPABASE_JWKS_URL`, `SUPABASE_JWT_SECRET`), `SUPABASE.JWT_INVALID`, `SUPABASE.CONFIG_INVALID`, `RoleBoundDb`, session pooler |
|
|
73
73
|
| Debug an error | [`references/debug.md`](references/debug.md) | any structured error envelope (code, severity, why, fix, nextActions, meta), emit failed, query won't typecheck, query crashed, migration won't apply, `MIGRATION.HASH_MISMATCH`, `MIGRATION.SCHEMA_VERIFY_FAILED`, `MIGRATION.PRECHECK_FAILED`, `BUDGET.ROWS_EXCEEDED`, `BUDGET.TIME_EXCEEDED`, `RUNTIME.ABORTED`, `RUNTIME.TEMPORAL_UNAVAILABLE`, `PLAN.HASH_MISMATCH`, `CONTRACT.MARKER_MISSING`, `CONFIG.*` / `CLI.*` / `CONTRACT.*` / `MIGRATION.*` / `ORM.*` / `RUNTIME.*` codes, legacy `PN-*` codes, exit code 4 findings, drift, capability missing, planner conflict, EXPLAIN, query log, script won't exit / close connection |
|
|
74
74
|
| Upgrade Prisma in an app | [`references/upgrade-app.md`](references/upgrade-app.md) | "upgrade Prisma", "upgrade Prisma 8", "bump Prisma 8", "move to Prisma 8 X.Y", `@prisma/orm-*` version bump in an application, per-transition upgrade instructions in [`upgrading/app/upgrades/`](upgrading/app/upgrades/), extension-pin pre-flight, `PN-UPGRADE-*` |
|
|
75
|
-
| Upgrade Prisma in an extension | [`references/upgrade-extension.md`](references/upgrade-extension.md) | the same request in a package that *is* a Prisma extension (`@prisma/orm-framework` / SPI dependency, `^@.*/extension-` name), `prisma-8-check-pins`, exact-pin rule, per-transition instructions in [`upgrading/extension/upgrades/`](upgrading/extension/upgrades/) |
|
|
75
|
+
| Upgrade Prisma in an extension | [`references/upgrade-extension.md`](references/upgrade-extension.md) | the same request in a package that *is* a Prisma extension (`@prisma/orm-framework` / SPI dependency, `^@.*/extension-` name), `prisma-8-check-pins`, exact-pin rule, which `prisma` CLI version an extension's tests use, per-transition instructions in [`upgrading/extension/upgrades/`](upgrading/extension/upgrades/) |
|
|
76
76
|
| Build the package for a new database | [`references/build-a-target-package.md`](references/build-a-target-package.md) | a new database target outside Prisma's repository, `prisma-orm-<name>`, `defineConfig` with `contract.typesModule` and `migrations.module`, `/contract-types`, `restateTypeDeclarations`, the `/init` entrypoint, `InitContribution`, `prisma orm init --target <package>`, `CONFIG.CONTRACT_TYPES_MODULE_MISSING`, `CONFIG.MIGRATION_MODULE_MISSING` |
|
|
77
77
|
| File feedback / ask the team | [`references/feedback.md`](references/feedback.md) | bug report, file an issue, feature request, missing feature, capability gap, "this is broken", surprising behaviour, Q&A / design discussion, ask the Prisma team, Prisma Discord (pris.ly/discord), extension-author questions |
|
|
78
78
|
|
|
@@ -19,25 +19,34 @@ Before changing any code, work out how far the chain can go. The application can
|
|
|
19
19
|
|
|
20
20
|
When the lines disagree, npm refuses the install if the packages that disagree are ones the application lists itself. pnpm, Yarn and Bun install anyway and print a peer dependency warning, so a successful install does not prove that the versions match.
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
**Which packages are released with the ORM.** Some Prisma packages are published from the Prisma ORM repository, `prisma/orm`, at every release, such as `@prisma/orm-extension-pgvector`, `@prisma/orm-postgres-contrib` and `@prisma/orm-better-auth`. Each lists the other Prisma packages at that release, so it moves to `<to>` together with the database package in the bump step below, and does not limit how far the application can go. Other packages have versions of their own and are published when their maintainer chooses, even when their name starts with `@prisma/orm-`: Prisma publishes some from other repositories, and a package released with the ORM can move to a repository of its own.
|
|
23
|
+
|
|
24
|
+
Each published version says where it came from, in the `repository.url` of its `package.json`. Decide at each step of the chain: a package is released with the ORM at that step when it has a version in that step's release (`<to>` itself on the `8.0.0` release candidates; from release 8.0, a version in the `<to>` release, as [Version detection](#version-detection) defines it, such as `8.0.1` or `8.0.1-ea.0` and never `8.0.0-rc.25`), and that version's `repository.url` names the repository `prisma/orm` itself, such as `https://github.com/prisma/orm.git`. A repository whose name only starts the same way, such as `prisma/orm-extension-<name>`, is another repository. `pnpm view <name> versions --json` lists the versions, and `pnpm view <name>@<version> repository.url` reads the field; for the installed version, read `node_modules/<name>/package.json`. Any other package has versions of its own at that step: treat it as an extension published by someone else, which this pre-flight covers. Never derive its version from `<to>`, which can name a version that was never published.
|
|
25
|
+
|
|
26
|
+
If you cannot tell which kind a package is, treat it as one with versions of its own. That is safe: the pre-flight takes the newest release that accepts the step, and for a package released with the ORM that is its version in `<to>`.
|
|
23
27
|
|
|
24
28
|
Steps:
|
|
25
29
|
|
|
26
|
-
1. **Read `prisma.config.ts`** (or its TS-discoverable equivalent at the project root) and enumerate the list of extension packages it imports. Each `extensions: [...]` entry corresponds to an installed npm package.
|
|
27
|
-
2. **For each extension**, read its installed `package.json` from `node_modules/<extension-package-name>/package.json` and find every `@prisma/orm-*` entry under `dependencies`, `peerDependencies`, or `optionalDependencies` (`@prisma/orm-framework`, `@prisma/orm-family-sql` or `@prisma/orm-family-mongo`, `@prisma/orm-toolchain`, and a `@prisma/orm-target-*` package). Until release 8.0, by construction those entries are exact-version pins (e.g. `"8.0.0-rc.11"`), set when the extension author last ran their own upgrade.
|
|
28
|
-
3. **Find each extension's releases.** List its published versions with `pnpm view <extension> versions --json`. For each version, read the
|
|
30
|
+
1. **Read `prisma.config.ts`** (or its TS-discoverable equivalent at the project root) and enumerate the list of extension packages it imports. Each `extensions: [...]` entry corresponds to an installed npm package. Add any other package in the project's `package.json` that names an `@prisma/orm-*` package as a peer dependency, such as a library integration. Leave out a package that is released with the ORM at every step of the chain, as described above.
|
|
31
|
+
2. **For each extension**, read its installed `package.json` from `node_modules/<extension-package-name>/package.json` and find every `@prisma/orm-*` entry under `dependencies`, `peerDependencies`, or `optionalDependencies` (`@prisma/orm-framework`, `@prisma/orm-family-sql` or `@prisma/orm-family-mongo`, `@prisma/orm-toolchain`, and a `@prisma/orm-target-*` package), and every entry there on another package that step 1 listed, which has versions of its own whatever its name. Until release 8.0, by construction those entries are exact-version pins (e.g. `"8.0.0-rc.11"`), set when the extension author last ran their own upgrade.
|
|
32
|
+
3. **Find each extension's releases.** List its published versions with `pnpm view <extension> versions --json`. For each version, read the entries step 2 names, under `dependencies`, `peerDependencies` and `optionalDependencies`: `pnpm view <extension>@<version> dependencies peerDependencies optionalDependencies --json`. Then, for each step in the chain below, work out the version each of those packages has at that step, as the bump step of the per-step flow defines it:
|
|
29
33
|
- on the `8.0.0` release candidates, it is `<to>` itself;
|
|
30
|
-
- from release 8.0, it is that package's first version in the `<to>` release, such as `8.0.1` for a GA package and `8.0.1-ea.0` for one below GA.
|
|
34
|
+
- from release 8.0, it is the version the install will take for the entry the bump step writes: the newest published version that entry accepts. The bump step writes the package's first version in the `<to>` release, as [Version detection](#version-detection) defines it, such as `8.0.1` for a GA package and `8.0.1-ea.0` for one below GA, with a caret or a tilde, so once `8.0.2` is published the install takes `8.0.2`, and an extension that names exactly `8.0.1` does not accept it;
|
|
35
|
+
- for a package with versions of its own, such as another extension, it is the release this pre-flight notes for that package at that step.
|
|
31
36
|
|
|
32
|
-
Note the release of each extension whose every entry accepts its package's version at that step.
|
|
33
|
-
4. **Find the last step every extension allows.** Walk the chain from the first step. The chain can go as far as the last step
|
|
37
|
+
Note, for each step, the newest release of each extension whose every entry accepts its package's version at that step. Several releases can accept the same step; take the newest.
|
|
38
|
+
4. **Find the last step every extension allows.** Walk the chain from the first step. A step for which some extension has no release, while a later step of the chain has one for it, does not stop the chain: the steps up to that later step are taken together, as [Steps taken together](#steps-taken-together) describes. The chain can go as far as the last step for which every extension has a release. If that is short of the user's target, tell the user before installing anything: which extension has no release for which Prisma version, how far the upgrade can go, and their options:
|
|
34
39
|
- (a) Wait for, or ask for, a release of the extension for that version, then re-run.
|
|
35
40
|
- (b) Upgrade only as far as the last step every extension allows.
|
|
36
41
|
- (c) Remove the extension, and upgrade without it.
|
|
37
42
|
|
|
38
|
-
|
|
43
|
+
If an extension does have a release for the step, but that release pins another package with versions of its own exactly, at a version other than the one this pre-flight noted for that package, say that instead of reporting a missing release: name the extension's release, its pin, and the version noted for the other package.
|
|
44
|
+
|
|
45
|
+
5. **Check the `prisma` command-line tool.** If the project lists `prisma`, find for each step the `prisma` version that fits it, as [Choosing the `prisma` version](#choosing-the-prisma-version) describes, and treat `prisma` like an extension with versions of its own. A step no `prisma` version fits, while a later step of the chain has one, is taken together with that later step. The chain goes no further than the last step a `prisma` version fits. If that is short of the user's target, tell the user before installing anything, as in step 4: which step has no `prisma` version, and how far the upgrade can go. When the step is to the newest release, a `prisma` version that carries it is normally published within a few days of the ORM, so the user can wait and re-run. For an older step none will come, so the user can only upgrade that far.
|
|
46
|
+
|
|
47
|
+
Do not skip a step's upgrade instructions, do not install an extension at a release that names another Prisma version, and do not install past the last step every extension and `prisma` allow.
|
|
39
48
|
|
|
40
|
-
If
|
|
49
|
+
If step 1 finds no package to check and the project does not list `prisma`, skip the pre-flight.
|
|
41
50
|
|
|
42
51
|
## Role detection
|
|
43
52
|
|
|
@@ -53,6 +62,7 @@ If the repository also holds an extension, in a `package.json` of its own, run *
|
|
|
53
62
|
- **From-version.** Read the installed Prisma 8 version from `pnpm-lock.yaml` (or `package-lock.json` / `yarn.lock`): take the resolved version of the application's database package, which is `@prisma/orm-postgres`, `@prisma/orm-mongo`, `@prisma/orm-sqlite`, `@prisma/orm-mysql` or `@prisma/orm-mariadb`. Do not read it from an extension published by someone else. Such an extension has its own version, and the pre-flight above deals with it.
|
|
54
63
|
- **On the `8.0.0` release candidates,** compare the full version strings, including the part after the hyphen. `8.0.0-rc.10` and `8.0.0-rc.11` are different versions, and different steps in the chain below.
|
|
55
64
|
- **From release 8.0,** each package has its own patch number or level suffix, and a step is named by the release, which is the major and minor: `8.0-to-8.1`. So the from-version is the release that the database package's version belongs to. `8.0.1-ea.0`, `8.0.1` and `8.0.2` all belong to release `8.0`.
|
|
65
|
+
- **What counts as a version of a release.** Release 8.0 starts at `8.0.1` for a GA package and `8.0.1-ea.0` (or `-preview.0`, `-rc.0`) for one below GA. A version `8.0.0-rc.N` is a release candidate, which is a step of its own, not a version of release 8.0, although its major and minor are `8.0`. A version with `-dev.` in it is a development build and is not a version of any release. Wherever this reference says "a version in the `<to>` release" or "the first version in the `<to>` release", it means this.
|
|
56
66
|
- If the lockfile shows the application's Prisma packages on different releases, which is already a broken state, the **lowest** is the from-version.
|
|
57
67
|
- **To-version.** Either the version the user specified, or whatever `npm view @prisma/orm-postgres dist-tags.latest` reports. Do not assume that is a stable version: while Prisma 8 is a release candidate, `latest` tracks the newest release, `8.0.0-rc.N` included. If the user wants a stable version specifically, they must name it.
|
|
58
68
|
|
|
@@ -68,9 +78,20 @@ If the from-to delta spans more than one release (e.g. `0.6 → 0.8`), build the
|
|
|
68
78
|
|
|
69
79
|
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`).
|
|
70
80
|
|
|
71
|
-
Apply each step in order, fully: bump, install, run instructions, validate, commit — before moving to the next. Halt the chain on the first failed step; do not skip ahead.
|
|
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.
|
|
82
|
+
|
|
83
|
+
The chain order does not depend on which extensions are installed; the pre-flight has already worked out how far it can go, and which steps are taken together.
|
|
84
|
+
|
|
85
|
+
### Steps taken together
|
|
86
|
+
|
|
87
|
+
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:
|
|
72
88
|
|
|
73
|
-
|
|
89
|
+
- 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, and re-sync the skills.
|
|
91
|
+
- 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
|
+
- Validate once, after the last of them, then commit. Name every step the commit covers in its message.
|
|
93
|
+
|
|
94
|
+
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.
|
|
74
95
|
|
|
75
96
|
## Per-step flow
|
|
76
97
|
|
|
@@ -79,9 +100,9 @@ For each `(from, to)` step in the chain:
|
|
|
79
100
|
1. **Bump the app's Prisma packages.** Change these entries in the project's `package.json`, under both `dependencies` and `devDependencies`:
|
|
80
101
|
- the database package, such as `@prisma/orm-postgres`;
|
|
81
102
|
- the platform packages that the database package lists as peer dependencies;
|
|
82
|
-
- every extension or library integration
|
|
103
|
+
- every extension or library integration that is [released with the ORM](#pre-flight--extension-compatibility) at this step, such as `@prisma/orm-extension-pgvector`, `@prisma/orm-postgres-contrib` and `@prisma/orm-better-auth`.
|
|
83
104
|
|
|
84
|
-
Each of these is published at every release and lists the other Prisma packages at that release, so one that is left behind disagrees with the rest.
|
|
105
|
+
Each of these is published at every release and lists the other Prisma packages at that release, so one that is left behind disagrees with the rest. A package whose name starts with `@prisma/orm-` but that has versions of its own at this step is not in this list. It moves as an extension published by someone else, below.
|
|
85
106
|
|
|
86
107
|
**What to write, on the `8.0.0` release candidates.** Rewrite every entry to the exact `<to>` version, with no caret and no tilde. All entries move to the same version.
|
|
87
108
|
|
|
@@ -89,11 +110,13 @@ For each `(from, to)` step in the chain:
|
|
|
89
110
|
- beside a GA database package, a GA entry gets a caret and an entry below GA gets a tilde;
|
|
90
111
|
- beside a database package below GA, every entry gets a tilde.
|
|
91
112
|
|
|
92
|
-
**Write a caret only when `<to>` is the newest published release,** which `pnpm view <
|
|
113
|
+
**Write a caret only when `<to>` is the newest published release of every package this step writes,** which `pnpm view <name> versions --json` shows for each: the database package, each platform package the application lists, and each extension or library integration released with the ORM at this step. The packages of a release are not all published at the same moment, so a platform package can have a later release before the database package does. A caret accepts later releases, so at any other step the install would take a release later than `<to>`, whose instructions have not been applied. That is every step before the last one, and the last one too when the user's target is older than the newest release. At such a step write a tilde in place of the caret: a tilde stays within `<to>` and still takes its fixes. If the upgrade ends on a release that is not the newest, say in the final report that those entries have a tilde where [Versions and support](https://github.com/prisma/orm/blob/main/docs/oss/versioning.md#what-an-application-writes) gives a caret.
|
|
93
114
|
|
|
94
115
|
**A peer dependency the project does not list.** If the database package at `<to>` lists an `@prisma/orm-*` peer dependency that the project's `package.json` does not have, add it, written as that package's entry for `<to>` would be. The application lists every one of them, so that it has one copy of each. A monorepo whose applications are on different Prisma releases can still get two copies under npm workspaces and under Bun's hoisted linker; keep such applications on one release, or use pnpm, Yarn or Bun's isolated linker.
|
|
95
116
|
|
|
96
|
-
**Extensions published by someone else
|
|
117
|
+
**Extensions published by someone else,** and Prisma packages with versions of their own. Set each one to the release the pre-flight noted for this step: the one whose every entry the pre-flight reads accepts that package's version at the step. On the `8.0.0` release candidates, write it exactly. From release 8.0, write it as [Versions and support](https://github.com/prisma/orm/blob/main/docs/oss/versioning.md#what-an-application-writes) gives for its level, by the same rules as the entries above: a caret on a GA version beside a GA database package, a tilde otherwise, such as `~8.0.1-ea.0` for a version below GA, and a tilde in place of the caret where the rule above allows no caret. If that range also accepts a later release of the package that the pre-flight did not note, because that release does not accept the step, write the noted release exactly instead: the install takes the newest release a range accepts. If an extension has no such release and the pre-flight did not take this step together with a later one, halt before this step's install. The project stays at the last step that worked, and the user gets the pre-flight's message for that extension and step.
|
|
118
|
+
|
|
119
|
+
**The `prisma` command-line tool.** If the project lists `prisma`, move it too, to a version chosen as [Choosing the `prisma` version](#choosing-the-prisma-version) describes. `prisma` runs the ORM commands from its own copy of the toolchain, and that copy must be on the application's release. 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.
|
|
97
120
|
|
|
98
121
|
The skill itself ships inside the Prisma packages, so bumping them is what updates it. There is no separate skill package to bump.
|
|
99
122
|
|
|
@@ -121,13 +144,27 @@ For each `(from, to)` step in the chain:
|
|
|
121
144
|
chore: upgrade @prisma/orm-* to <to-version>
|
|
122
145
|
```
|
|
123
146
|
|
|
124
|
-
(Or the project's own commit-message convention.) Never squash steps. The user may squash on merge; the in-flight history must be per-step so a failed step is bisectable.
|
|
147
|
+
(Or the project's own commit-message convention.) Never squash steps, except that [steps taken together](#steps-taken-together) are one commit, which names each of them. The user may squash on merge; the in-flight history must be per-step so a failed step is bisectable.
|
|
125
148
|
|
|
126
149
|
Then move on to the next step.
|
|
127
150
|
|
|
151
|
+
## Choosing the `prisma` version
|
|
152
|
+
|
|
153
|
+
The `prisma` command-line tool is published from another repository, [`prisma/prisma-cli`](https://github.com/prisma/prisma-cli). Each of its versions for Prisma 8 depends on one exact version of `@prisma/orm-toolchain`, and runs the ORM commands, such as `prisma contract emit`, from that copy, not from the copy the project lists. So the files those commands write and read come from the toolchain the `prisma` version brings. From `prisma@8.0.0-rc.36` on, each version also lists `@prisma/orm-framework` at the same exact version. Earlier versions do not list it, and get it through the toolchain. Some ORM release candidates, such as `8.0.0-rc.1`, `8.0.0-rc.6`, `8.0.0-rc.9` and `8.0.0-rc.15`, have no `prisma` version that carries them.
|
|
154
|
+
|
|
155
|
+
Its version numbers are its own, though they look like the ORM's: `prisma@8.0.0-rc.36` carries the ORM at `8.0.0-rc.25`. Never choose `prisma` by its own number. Read its dependencies.
|
|
156
|
+
|
|
157
|
+
1. Run `pnpm view prisma dist-tags.latest`, then `pnpm view prisma@<that version> dependencies`.
|
|
158
|
+
2. That version fits the step when its `@prisma/orm-toolchain`, and its `@prisma/orm-framework` if it lists one, are:
|
|
159
|
+
- on the `8.0.0` release candidates, exactly `<to>`, because file formats changed between release candidates;
|
|
160
|
+
- from release 8.0, versions in the `<to>` release as [Version detection](#version-detection) defines it, with any patch number or level suffix. A `8.0.0-rc.N` version does not fit a step to release 8.0: on the day of release 8.0, `latest` may still carry `8.0.0-rc.25`. The tool is meant to stop when its toolchain and the project's packages are on different releases, and within one release the files it writes and reads stay compatible ([ADR 329](https://github.com/prisma/orm/blob/main/docs/architecture%20docs/adrs/ADR%20329%20-%20An%20application%20lists%20the%20platform%20packages%20and%20our%20packages%20name%20each%20other%20as%20peers.md#the-prisma-command-line-tool)).
|
|
161
|
+
3. If `latest` does not fit, look through `pnpm view prisma versions --json` for the highest version that fits. Never take a version with `-dev.` in it, which is a development build, and never one whose dependencies name no `@prisma/orm-toolchain`, which is a Prisma 7 version.
|
|
162
|
+
4. Write the version exactly, with no caret or tilde, so that a later `prisma` carrying another release is not installed. This has a cost: an ordinary update with the package manager moves the Prisma packages to a new release and leaves `prisma` carrying the old one. This upgrade flow moves `prisma` at each step. After an update made any other way, choose its version again by these steps.
|
|
163
|
+
5. If no version fits a step, take it, and every step after it that no version fits either, together with the next step that a `prisma` version fits, as [Steps taken together](#steps-taken-together) describes. A `prisma` command must run on the toolchain of the packages installed at that time, so those steps cannot be installed one by one. If no `prisma` version fits any of the remaining steps, the run is taken together with the last step of the chain. The application flow then stops before installing that run, as step 5 of the pre-flight says, so the chain ends at the last step a `prisma` version fits. The extension flow instead installs it and uses the overrides stopgap that its bump step describes, because an extension author may need to prepare a release before `prisma` catches up. That is the one difference between the two flows.
|
|
164
|
+
|
|
128
165
|
## When the chain is done
|
|
129
166
|
|
|
130
|
-
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).
|
|
167
|
+
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.
|
|
131
168
|
|
|
132
169
|
## Failure surfaces
|
|
133
170
|
|
|
@@ -30,6 +30,7 @@ If detection is ambiguous, ask the user which role to operate under.
|
|
|
30
30
|
- **From-version.** Read the installed Prisma 8 version from `pnpm-lock.yaml` (or `package-lock.json` / `yarn.lock`): take the resolved version of any `@prisma/orm-*` platform package (`@prisma/orm-framework`, `@prisma/orm-family-*`, `@prisma/orm-target-*`, `@prisma/orm-toolchain`). Do not read it from an extension published by someone else, which has its own version.
|
|
31
31
|
- **On the `8.0.0` release candidates,** compare the full version strings, including the part after the hyphen. `8.0.0-rc.10` and `8.0.0-rc.11` are different versions, and different steps in the chain below.
|
|
32
32
|
- **From release 8.0,** a step is named by the release, which is the major and minor: `8.0-to-8.1`. So the from-version is the release that a package's version belongs to. `8.0.1-ea.0`, `8.0.1` and `8.0.2` all belong to release `8.0`. (A platform package below GA has a level suffix, such as `8.0.1-ea.0` for `@prisma/orm-family-mongo`.)
|
|
33
|
+
- **What counts as a version of a release.** Release 8.0 starts at `8.0.1` for a GA package and `8.0.1-ea.0` (or `-preview.0`, `-rc.0`) for one below GA. A version `8.0.0-rc.N` is a release candidate, which is a step of its own, not a version of release 8.0, although its major and minor are `8.0`. A version with `-dev.` in it is a development build and is not a version of any release. Wherever this reference says "a version in the `<to>` release" or "the first version in the `<to>` release", it means this.
|
|
33
34
|
- If the lockfile shows the platform packages on different releases, the lowest is the from-version.
|
|
34
35
|
- **To-version.** Either the version the user specified, or whatever `npm view @prisma/orm-framework dist-tags.latest` reports. Do not assume that is a stable version: while Prisma 8 is a release candidate, `latest` tracks the newest release, `8.0.0-rc.N` included. If the user wants a stable version specifically, they must name it.
|
|
35
36
|
|
|
@@ -45,7 +46,7 @@ If the from-to delta spans more than one release (e.g. `0.6 → 0.8`), build the
|
|
|
45
46
|
|
|
46
47
|
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`).
|
|
47
48
|
|
|
48
|
-
Apply each step in order, fully: bump, install, run instructions, check pins, validate, commit — before moving to the next. Halt the chain on the first failed step.
|
|
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.
|
|
49
50
|
|
|
50
51
|
## Per-step flow
|
|
51
52
|
|
|
@@ -54,16 +55,37 @@ This flow assumes you are an **external extension author**: your extension lives
|
|
|
54
55
|
For each `(from, to)` step in the chain:
|
|
55
56
|
|
|
56
57
|
1. **Bump `@prisma/orm-*` deps.** What to write depends on the release:
|
|
57
|
-
- **On the `8.0.0` release candidates,** rewrite every `@prisma/orm-*` entry in the extension's `package.json` to the exact `<to>` version, such as `"8.0.0-rc.11"
|
|
58
|
+
- **On the `8.0.0` release candidates,** rewrite every `@prisma/orm-*` entry in the extension's `package.json` to the exact `<to>` version, such as `"8.0.0-rc.11"`, except a package with versions of its own (below): no caret, no tilde, no range, and no `workspace:` specifier. The exact-pin rule below says why. All entries move to the same version. That includes another extension [released with the ORM](upgrade-app.md#pre-flight--extension-compatibility), such as `@prisma/orm-extension-pgvector`: each of those lists the others at that release's version.
|
|
58
59
|
- **From release 8.0,** the two sections of `package.json` differ.
|
|
59
|
-
- Under `peerDependencies`, write the ranges that [the last section](#from-release-80-number-your-package-and-declare-ranges) gives. They say which releases your package accepts, and a caret there need not change at every step.
|
|
60
|
-
- Under `devDependencies`, write each package's first version in the `<to>` release, so that your build and tests run against `<to>`: `8.2.0` for a GA package at the step to release 8.2, whatever the peer range says. Put a tilde in front of every one, such as `~8.2.0` or `~8.2.0-ea.0`. A tilde stays within `<to>` and still takes its fixes. A caret would let the install take a later release, whose instructions have not been applied, and would let a GA package move ahead of a package below GA that the tests use.
|
|
60
|
+
- Under `peerDependencies`, write the ranges that [the last section](#from-release-80-number-your-package-and-declare-ranges) gives, except for a package with versions of its own (below). They say which releases your package accepts, and a caret there need not change at every step.
|
|
61
|
+
- Under `devDependencies`, write each package's first version in the `<to>` release, again except for a package with versions of its own, so that your build and tests run against `<to>`: `8.2.0` for a GA package at the step to release 8.2, whatever the peer range says. Put a tilde in front of every one, such as `~8.2.0` or `~8.2.0-ea.0`. A tilde stays within `<to>` and still takes its fixes. A caret would let the install take a later release, whose instructions have not been applied, and would let a GA package move ahead of a package below GA that the tests use.
|
|
61
62
|
|
|
62
63
|
Where each entry goes is the same on every release:
|
|
63
64
|
- A package that the extension's shipped code imports belongs under `peerDependencies`, and again under `devDependencies`.
|
|
64
65
|
- A package that only the extension's tests use, such as a database package the tests run against, belongs under `devDependencies` alone.
|
|
65
66
|
- Move any entry that is still under `dependencies` or `optionalDependencies`. An extension written for an earlier release had the framework, the family and the toolchain as ordinary dependencies.
|
|
66
67
|
|
|
68
|
+
**A package with versions of its own.** A Prisma package is released with the ORM at this step only when it has a version in the `<to>` release, as [Version detection](#version-detection) defines it, whose `repository.url` names `prisma/orm` itself, as [the application pre-flight](upgrade-app.md#pre-flight--extension-compatibility) describes. Any other package your extension uses has versions of its own, even when its name starts with `@prisma/orm-`: an extension published by someone else, a package Prisma publishes from another repository, or one that moved out of the ORM repository. If you cannot tell which kind a package is, treat it as one with versions of its own; the search below finds the right version for either kind. Do not write `<to>`, or a version derived from it, for such a package: that version may never be published. Find the newest release of it whose every entry accepts this step's versions, reading its entries on `@prisma/orm-*` packages and on the other packages with versions of their own as step 3 of the application pre-flight does. If it has none, but has one for a later step of the chain, take the steps up to that later step together, as [Steps taken together](upgrade-app.md#steps-taken-together) describes for an application. In this flow that means: do step 1, the bump, once, to the later step's versions; step 2, the install, once; step 3, the pin check, once, after the install; then steps 4 and 5, reading and applying the upgrade instructions, for every step from the first of them to the later one, in order; then step 6, validation, and step 7, the commit, once. If no later step has one either, halt before this step's install and tell the user which package has no release for which Prisma version. Write the release you found:
|
|
69
|
+
- on the `8.0.0` release candidates, as its exact version, under `devDependencies`, and also under `peerDependencies` when the extension's shipped code imports it, as above;
|
|
70
|
+
- from release 8.0, under `devDependencies`, with a tilde on that release's version, such as `~8.0.1-ea.0`, or as the exact version when the tilde would also accept a later release of it that does not accept this step, because the install takes the newest release a range accepts; under `peerDependencies`, when the shipped code imports it, the range [the last section](#from-release-80-number-your-package-and-declare-ranges) gives for that package's level, taken from that release's version and not from `<to>`, such as `^8.0.1` for a GA version `8.0.1` or `~8.0.1-ea.0` for a version below GA.
|
|
71
|
+
|
|
72
|
+
**The `prisma` command-line tool.** If the extension lists `prisma` under `devDependencies`, to run `prisma` commands such as `prisma contract emit` in its build or tests, choose its version as [Choosing the `prisma` version](upgrade-app.md#choosing-the-prisma-version) describes: on the `8.0.0` release candidates its toolchain must be exactly `<to>`, and so must its framework where it lists one; from release 8.0 they must be in the `<to>` release, which no `8.0.0-rc.N` version is. This matters more for an extension than for an application: the files your build ships and the commands your tests run come from the toolchain that `prisma` brings, not from the one your extension lists.
|
|
73
|
+
|
|
74
|
+
If no `prisma` version fits a step that is not the last of the chain, take that step, and every step after it that no `prisma` version fits either, together with the next step that a `prisma` version fits, as for a package with versions of its own above: a `prisma` command must run on the toolchain of the packages installed at that time. If no `prisma` version fits any of the remaining steps, take the run together with the last step of the chain, which then uses the overrides below. If none fits the last step, which is normal on the day of a release, because `prisma` is published after the ORM, move `prisma` to its `latest` version and make it use this step's versions with pnpm overrides. Use `<to>` on the release candidates, and from release 8.0 the versions your `devDependencies` resolve to:
|
|
75
|
+
|
|
76
|
+
```json
|
|
77
|
+
"pnpm": {
|
|
78
|
+
"overrides": {
|
|
79
|
+
"prisma>@prisma/orm-toolchain": "<version this step installs>",
|
|
80
|
+
"prisma>@prisma/orm-framework": "<version this step installs>"
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
The toolchain names one exact `@prisma/cli-engine` as a peer dependency. Under the overrides it runs on the engine that `prisma` brings, and the install may print a peer dependency warning for it when the two versions differ. Leave the engine alone: `prisma` itself runs on that engine, and ADR 329 says the toolchain still reads a config made by an engine of another version.
|
|
86
|
+
|
|
87
|
+
The overrides can also go under the `overrides` key of `pnpm-workspace.yaml`, or in your package manager's equivalent. They run `prisma` with a toolchain it was not released with, so they are a stopgap. Do not publish a release of your extension built while they are in place. Once a `prisma` version that fits is published, move `prisma` to it, remove the overrides, and run the install and validation again.
|
|
88
|
+
|
|
67
89
|
The skill itself ships inside the Prisma packages, so bumping them is what updates it. There is no separate skill package to bump.
|
|
68
90
|
|
|
69
91
|
2. **Install.** Run `pnpm install` (or the project's lockfile-managing command). The extension's source is now broken against the new SPI — the upgrade instructions for `<from> → <to>` exist to fix it.
|
|
@@ -73,10 +95,10 @@ For each `(from, to)` step in the chain:
|
|
|
73
95
|
- every such peer dependency must also be under `devDependencies`;
|
|
74
96
|
- none may be under `dependencies` or `optionalDependencies`.
|
|
75
97
|
|
|
76
|
-
A development dependency with no peer entry is one that only the tests use, and passes. This prints any entry that breaks the rule, and exits 1:
|
|
98
|
+
A development dependency with no peer entry is one that only the tests use, and passes. A package with versions of its own keeps the version the bump step chose; name each one after `<to>` so the check does not compare its version with `<to>`. It still checks where the package is listed, that its version is exact, and that its peer and development entries are the same version, also for a named package whose name does not start with `@prisma/orm-`. This prints any entry that breaks the rule, and exits 1:
|
|
77
99
|
|
|
78
100
|
```bash
|
|
79
|
-
node -e 'const p=require("./package.json");const to=process.argv
|
|
101
|
+
node -e 'const p=require("./package.json");const [to,...own]=process.argv.slice(1);const ours=(n)=>n.startsWith("@prisma/orm-");const bad=[];for(const f of ["dependencies","optionalDependencies"])for(const n of Object.keys(p[f]??{}))if(ours(n)||own.includes(n))bad.push(f+": "+n+" belongs in peerDependencies, or in devDependencies alone if only tests use it");for(const f of ["peerDependencies","devDependencies"])for(const [n,v] of Object.entries(p[f]??{}))if((ours(n)||own.includes(n))&&(own.includes(n)?!/^\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?$/.test(v)||(f==="peerDependencies"&&n in (p.devDependencies??{})&&p.devDependencies[n]!==v):v!==to))bad.push(f+": "+n+"@"+v);for(const n of Object.keys(p.peerDependencies??{}))if((ours(n)||own.includes(n))&&!(n in (p.devDependencies??{})))bad.push("devDependencies: "+n+" is missing");if(bad.length){console.error(bad.join("\n"));process.exit(1)}' <to> [<package with versions of its own> ...]
|
|
80
102
|
```
|
|
81
103
|
|
|
82
104
|
If it fails, the bump step did not rewrite every entry. Fix the entries it printed and run it again before going on.
|
|
@@ -103,7 +125,7 @@ For each `(from, to)` step in the chain:
|
|
|
103
125
|
chore: upgrade @prisma/orm-* to <to-version>
|
|
104
126
|
```
|
|
105
127
|
|
|
106
|
-
(Or the extension's own commit-message convention, if it has one.) One commit per step — never squash steps.
|
|
128
|
+
(Or the extension's own commit-message convention, if it has one.) One commit per step — never squash steps, except that [steps taken together](upgrade-app.md#steps-taken-together) are one commit, which names each of them.
|
|
107
129
|
|
|
108
130
|
Move on to the next step. Repeat.
|
|
109
131
|
|
|
@@ -111,7 +133,7 @@ Move on to the next step. Repeat.
|
|
|
111
133
|
|
|
112
134
|
This rule holds until release 8.0, while every Prisma 8 package is published as `8.0.0-rc.N`. From release 8.0, ranges replace it; see [the last section](#from-release-80-number-your-package-and-declare-ranges).
|
|
113
135
|
|
|
114
|
-
A Prisma 8 extension names every `@prisma/orm-*` package its shipped code uses, another extension published from the Prisma repository included, as a **peer dependency** at a single **exact** version (no `^`, no `~`, no range, no wildcard, no `workspace:` specifier in the published `package.json`), and lists the same packages under `devDependencies` at that version, so its own build and tests install them. A package of ours that only its tests use is a development dependency alone, at that version. None of them is an ordinary dependency. All of those entries share the same version. The pin advances after each successful upgrade step, release-candidate steps included.
|
|
136
|
+
A Prisma 8 extension names every `@prisma/orm-*` package its shipped code uses, another extension published from the Prisma repository included, as a **peer dependency** at a single **exact** version (no `^`, no `~`, no range, no wildcard, no `workspace:` specifier in the published `package.json`), and lists the same packages under `devDependencies` at that version, so its own build and tests install them. A package of ours that only its tests use is a development dependency alone, at that version. None of them is an ordinary dependency. All of those entries share the same version. A package with versions of its own is the exception: it goes in the same places, a development dependency always and a peer dependency when the shipped code imports it, but at its own version, which the bump step says how to choose. The pin advances after each successful upgrade step, release-candidate steps included.
|
|
115
137
|
|
|
116
138
|
The version is the one the application's database package (`@prisma/orm-postgres`, `@prisma/orm-mongo`, …) uses.
|
|
117
139
|
|
|
@@ -133,7 +155,8 @@ From release 8.0, Prisma's packages share a release number, which is the major a
|
|
|
133
155
|
| --- | --- | --- |
|
|
134
156
|
| A GA package, and you use only its GA functions | A caret on the first release your package works with | `^8.1.0` |
|
|
135
157
|
| A GA package, and you use a function below GA, such as `preview_search` | A tilde: that function may change in the next release | `~8.1.0` |
|
|
136
|
-
| A package below GA | A tilde on its first version in that release | `~8.1.0-preview.0` |
|
|
158
|
+
| A package below GA, released with the ORM | A tilde on its first version in that release | `~8.1.0-preview.0` |
|
|
159
|
+
| A package with versions of its own | The range for its level, on the newest release of it that accepts the step, found as the bump step says | `^1.4.0` |
|
|
137
160
|
|
|
138
161
|
With a caret, your package keeps working when an application moves to a later release: a package at `8.1.2` that lists `^8.1.0` works in an application on `8.4`. An application on a release below `8.1` gets a mismatch reported at install. With a tilde, you publish a new version of your package for each Prisma release.
|
|
139
162
|
|
|
@@ -143,7 +166,7 @@ The convention has two costs. A feature of yours that needs no newer Prisma rele
|
|
|
143
166
|
|
|
144
167
|
## When the chain is done
|
|
145
168
|
|
|
146
|
-
Report back to the user: the number of steps applied, the SHAs of the commits you made, and any open follow-ups.
|
|
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.
|
|
147
170
|
|
|
148
171
|
## Failure surfaces
|
|
149
172
|
|