@prisma/orm-postgres 8.0.0-rc.24-dev.31 → 8.0.0-rc.24-dev.33

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.
Files changed (36) hide show
  1. package/dist/{binding-DkfRsUZE-Co5ssUZw.mjs → binding-Cg5nms1Y-Bk8OB_I5.mjs} +4 -3
  2. package/dist/{binding-DkfRsUZE-Co5ssUZw.mjs.map → binding-Cg5nms1Y-Bk8OB_I5.mjs.map} +1 -1
  3. package/dist/{binding-BN5X69gf-CIDnIWcw.d.mts → binding-Q21lKDeA-CQ2oKakQ.d.mts} +3 -3
  4. package/dist/{binding-BN5X69gf-CIDnIWcw.d.mts.map → binding-Q21lKDeA-CQ2oKakQ.d.mts.map} +1 -1
  5. package/dist/contract-builder.d.mts +2 -2
  6. package/dist/contract-builder.d.mts.map +1 -1
  7. package/dist/{contract-from-json-CuzxHkGa-CoiMbCP1.mjs → contract-from-json-C6uR3W9i-DVRdyn3s.mjs} +3 -3
  8. package/dist/{contract-from-json-CuzxHkGa-CoiMbCP1.mjs.map → contract-from-json-C6uR3W9i-DVRdyn3s.mjs.map} +1 -1
  9. package/dist/init-quick-reference.md +1 -1
  10. package/dist/init.mjs +5 -0
  11. package/dist/init.mjs.map +1 -1
  12. package/dist/internal__options.d.mts +2 -2
  13. package/dist/internal__options.mjs +1 -1
  14. package/dist/internal__static-context.mjs +1 -1
  15. package/dist/internal__transaction-members.d.mts +1 -1
  16. package/dist/internal__validate-contract.mjs +1 -1
  17. package/dist/{postgres-members-DQvChDJ--ByodBWAn.d.mts → postgres-members-D1VTNrCz-8ShwbWgk.d.mts} +3 -3
  18. package/dist/{postgres-members-DQvChDJ--ByodBWAn.d.mts.map → postgres-members-D1VTNrCz-8ShwbWgk.d.mts.map} +1 -1
  19. package/dist/{postgres-options-B0YrJID9-YkuL0Mao.d.mts → postgres-options-C2QR33Rg-BTKXQic1.d.mts} +7 -3
  20. package/dist/postgres-options-C2QR33Rg-BTKXQic1.d.mts.map +1 -0
  21. package/dist/{postgres-static-Dp8FC0q0-L7yDo9e1.mjs → postgres-static-BTm72P3P-h_XgLqsh.mjs} +3 -3
  22. package/dist/{postgres-static-Dp8FC0q0-L7yDo9e1.mjs.map → postgres-static-BTm72P3P-h_XgLqsh.mjs.map} +1 -1
  23. package/dist/runtime.d.mts +3 -3
  24. package/dist/runtime.mjs +3 -3
  25. package/dist/runtime.mjs.map +1 -1
  26. package/dist/serverless.d.mts +2 -2
  27. package/dist/serverless.mjs +3 -3
  28. package/dist/serverless.mjs.map +1 -1
  29. package/dist/static.mjs +2 -2
  30. package/package.json +11 -8
  31. package/skills/prisma-8/SKILL.md +5 -4
  32. package/skills/prisma-8/references/build-a-target-package.md +110 -0
  33. package/skills/prisma-8/references/quickstart.md +1 -1
  34. package/skills/prisma-8/references/runtime.md +3 -2
  35. package/skills/prisma-8/references/supabase.md +1 -1
  36. package/dist/postgres-options-B0YrJID9-YkuL0Mao.d.mts.map +0 -1
@@ -4,7 +4,7 @@ import { InternalError } from "@prisma/orm-framework/utils/internal-error";
4
4
  import postgresTarget from "@prisma/orm-target-postgres/target/runtime";
5
5
  import { createPgPool, suppressIdleConnectionErrors } from "@prisma/orm-target-postgres/driver/runtime";
6
6
  import { blindCast } from "@prisma/orm-framework/utils/casts";
7
- //#region ../../../3-targets/postgres/9-facade/dist/binding-DkfRsUZE.mjs
7
+ //#region ../../../3-targets/postgres/9-facade/dist/binding-Cg5nms1Y.mjs
8
8
  const isPgPool = (pg) => "totalCount" in pg && "idleCount" in pg && "waitingCount" in pg;
9
9
  const isPgClient = (pg) => "escapeIdentifier" in pg && "escapeLiteral" in pg;
10
10
  function validatePostgresUrl(url, extension = "postgres") {
@@ -236,7 +236,8 @@ function toRuntimeBinding(binding, options) {
236
236
  pool: suppressIdleConnectionErrors(createPgPool({
237
237
  connectionString: binding.url,
238
238
  connectionTimeoutMillis: options.poolOptions?.connectionTimeoutMillis ?? 2e4,
239
- idleTimeoutMillis: options.poolOptions?.idleTimeoutMillis ?? 3e4
239
+ idleTimeoutMillis: options.poolOptions?.idleTimeoutMillis ?? 3e4,
240
+ ...ifDefined("max", options.poolOptions?.max)
240
241
  }, postgresTarget.sessionSettings ?? {}))
241
242
  };
242
243
  }
@@ -253,4 +254,4 @@ async function connectWithBinding(driver, binding, options) {
253
254
  //#endregion
254
255
  export { resolveOptionalPostgresBinding as a, postgresBindingRules as i, isPgClient as n, resolvePostgresBinding as o, isPgPool as r, validatePostgresUrl as s, connectWithBinding as t };
255
256
 
256
- //# sourceMappingURL=binding-DkfRsUZE-Co5ssUZw.mjs.map
257
+ //# sourceMappingURL=binding-Cg5nms1Y-Bk8OB_I5.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"binding-DkfRsUZE-Co5ssUZw.mjs","names":[],"sources":["../../../../3-targets/postgres/9-facade/dist/binding-DkfRsUZE.mjs"],"sourcesContent":["import { t as postgresError } from \"./errors-DfWK9xep.mjs\";\nimport \"./postgres-options-CZyV9Him.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport postgresTarget from \"@internal/target-postgres/runtime\";\nimport { createPgPool, suppressIdleConnectionErrors } from \"@internal/driver-postgres/runtime\";\nimport { blindCast } from \"@internal/utils/casts\";\n//#region src/runtime/binding.ts\nconst isPgPool = (pg) => \"totalCount\" in pg && \"idleCount\" in pg && \"waitingCount\" in pg;\nconst isPgClient = (pg) => \"escapeIdentifier\" in pg && \"escapeLiteral\" in pg;\nfunction validatePostgresUrl(url, extension = \"postgres\") {\n\tconst trimmed = url.trim();\n\tif (trimmed.length === 0) throw postgresError(\"RUNTIME.BINDING_INVALID\", \"Postgres URL must be a non-empty string\", { meta: {\n\t\textension,\n\t\treason: \"empty url\"\n\t} });\n\tlet parsed;\n\ttry {\n\t\tparsed = new URL(trimmed);\n\t} catch {\n\t\tthrow postgresError(\"RUNTIME.BINDING_INVALID\", \"Postgres URL must be a valid URL\", { meta: {\n\t\t\textension,\n\t\t\treason: \"unparseable url\"\n\t\t} });\n\t}\n\tif (parsed.protocol !== \"postgres:\" && parsed.protocol !== \"postgresql:\") throw postgresError(\"RUNTIME.BINDING_INVALID\", \"Postgres URL must use postgres:// or postgresql://\", { meta: {\n\t\textension,\n\t\treason: \"wrong scheme\",\n\t\t...ifDefined(\"received\", trimmed.toLowerCase().startsWith(`${parsed.protocol}//`) ? parsed.protocol : void 0)\n\t} });\n\treturn trimmed;\n}\nfunction typeOfInput(value) {\n\treturn value === null ? \"null\" : typeof value;\n}\nfunction isObject(value) {\n\treturn typeof value === \"object\" && value !== null;\n}\nconst postgresBindingRules = {\n\textension: \"postgres\",\n\tkinds: {\n\t\turl: true,\n\t\tpgPool: true,\n\t\tpgClient: true\n\t}\n};\nconst bindingForms = {\n\turl: \"{ kind: 'url', url }\",\n\tpgPool: \"{ kind: 'pgPool', pool }\",\n\tpgClient: \"{ kind: 'pgClient', client }\"\n};\nfunction isBindingKind(kind) {\n\treturn typeof kind === \"string\" && Object.hasOwn(bindingForms, kind);\n}\nconst pgObjectNames = {\n\tpgPool: \"pg.Pool\",\n\tpgClient: \"pg.Client\"\n};\nfunction orList(items) {\n\treturn items.length < 2 ? items.join(\"\") : `${items.slice(0, -1).join(\", \")} or ${items[items.length - 1]}`;\n}\nfunction wordingOf(rules) {\n\tconst kinds = Object.keys(bindingForms).filter(isBindingKind).filter((kind) => rules.kinds[kind] === true);\n\tconst pgKinds = kinds.filter((kind) => pgObjectNames[kind] !== void 0);\n\tconst pgNames = pgKinds.flatMap((kind) => pgObjectNames[kind] ?? []);\n\treturn {\n\t\textension: rules.extension,\n\t\tkinds: orList(kinds.map((kind) => `'${kind}'`)),\n\t\tforms: orList(kinds.map((kind) => bindingForms[kind])),\n\t\tpgForms: orList(pgKinds.map((kind) => `binding: ${bindingForms[kind]}`)),\n\t\tpgObjects: orList(pgNames),\n\t\tpgObjectsEach: orList(pgNames.map((name) => `a ${name}`))\n\t};\n}\nfunction invalidInput(wording, input, message, fix) {\n\tconst receivedType = typeOfInput(input.value);\n\treturn postgresError(\"RUNTIME.BINDING_INVALID\", message, {\n\t\twhy: `The ${input.name} is ${receivedType === \"null\" ? \"null\" : `a ${receivedType}`}, and it must be ${input.expected}.`,\n\t\tfix,\n\t\tmeta: {\n\t\t\textension: wording.extension,\n\t\t\treason: input.reason,\n\t\t\treceivedType\n\t\t}\n\t});\n}\nconst echoableKind = /^[A-Za-z_][A-Za-z0-9_]{0,31}$/;\nfunction describeUnknownKind(kind) {\n\tif (kind === void 0) return {\n\t\twhy: \"The binding option has no kind, so it names no database.\",\n\t\treceived: { receivedKind: \"undefined\" }\n\t};\n\tif (typeof kind === \"string\" && echoableKind.test(kind)) return {\n\t\twhy: `The binding option has kind '${kind}', which is not a binding kind this client takes.`,\n\t\treceived: { receivedKind: kind }\n\t};\n\tconst receivedType = typeOfInput(kind);\n\treturn {\n\t\twhy: typeof kind === \"string\" ? \"The binding option has a kind that is a string not in the list of binding kinds.\" : `The binding option has kind of type ${receivedType}, which is not a binding kind.`,\n\t\treceived: typeof kind === \"string\" ? { receivedType } : { receivedKind: receivedType }\n\t};\n}\nfunction unknownKindError(wording, kind) {\n\tconst { why, received } = describeUnknownKind(kind);\n\treturn postgresError(\"RUNTIME.BINDING_INVALID\", `The binding option must have kind ${wording.kinds}`, {\n\t\twhy,\n\t\tfix: `Pass binding: ${wording.forms}.`,\n\t\tmeta: {\n\t\t\textension: wording.extension,\n\t\t\treason: \"unknown binding kind\",\n\t\t\t...received\n\t\t}\n\t});\n}\nfunction checkInputTypes(options, rules, wording) {\n\tconst binding = options.binding;\n\tconst url = options.url;\n\tconst pg = options.pg;\n\tif (binding !== void 0 && !isObject(binding)) throw invalidInput(wording, {\n\t\tname: \"binding option\",\n\t\tvalue: binding,\n\t\texpected: \"an object with a kind\",\n\t\treason: \"invalid binding input\"\n\t}, \"The binding option must be an object with a kind\", `Pass binding: ${wording.forms}.`);\n\tif (url !== void 0 && typeof url !== \"string\") throw invalidInput(wording, {\n\t\tname: \"url option\",\n\t\tvalue: url,\n\t\texpected: \"a connection string\",\n\t\treason: \"invalid url input\"\n\t}, \"The url option must be a string\", \"Pass a postgres:// or postgresql:// connection string as url, and check that the variable it comes from is set.\");\n\tif (pg !== void 0 && !isObject(pg)) throw invalidInput(wording, {\n\t\tname: \"pg option\",\n\t\tvalue: pg,\n\t\texpected: `a ${wording.pgObjects} object`,\n\t\treason: \"invalid pg input\"\n\t}, `The pg option must be ${wording.pgObjectsEach}`, `Pass a ${wording.pgObjects} as pg, or pass a connection string as url.`);\n\tif (binding !== void 0) {\n\t\tconst kind = \"kind\" in binding ? binding.kind : void 0;\n\t\tif (!isBindingKind(kind) || rules.kinds[kind] !== true) throw unknownKindError(wording, kind);\n\t}\n}\nfunction checkBindingContents(binding, wording) {\n\tif (binding.kind === \"url\") {\n\t\tconst url = binding.url;\n\t\tif (typeof url !== \"string\") throw invalidInput(wording, {\n\t\t\tname: \"url in the binding option\",\n\t\t\tvalue: url,\n\t\t\texpected: \"a connection string\",\n\t\t\treason: \"invalid binding url\"\n\t\t}, \"The url in the binding option must be a string\", \"Pass binding: { kind: 'url', url } with a postgres:// or postgresql:// connection string, and check that the variable it comes from is set.\");\n\t\treturn {\n\t\t\tkind: \"url\",\n\t\t\turl: validatePostgresUrl(url, wording.extension)\n\t\t};\n\t}\n\tconst [name, value] = binding.kind === \"pgPool\" ? [\"pool\", binding.pool] : [\"client\", binding.client];\n\tif (!isObject(value)) {\n\t\tconst objectName = binding.kind === \"pgPool\" ? \"pg.Pool\" : \"pg.Client\";\n\t\tthrow invalidInput(wording, {\n\t\t\tname: `${name} in the binding option`,\n\t\t\tvalue,\n\t\t\texpected: `a ${objectName}`,\n\t\t\treason: `invalid binding ${name}`\n\t\t}, `The ${name} in the binding option must be a ${objectName}`, `Pass binding: ${bindingForms[binding.kind]} with a ${objectName}.`);\n\t}\n\treturn binding;\n}\nfunction resolveBinding(options, rules) {\n\tconst wording = wordingOf(rules);\n\tcheckInputTypes(options, rules, wording);\n\tconst binding = resolveInput(options, rules, wording);\n\tif (rules.kinds[binding.kind] !== true) throw refusedInputError(wording, options.url !== void 0 ? \"url\" : \"pg\", binding.kind);\n\treturn binding;\n}\nconst inputDescriptions = {\n\turl: \"a connection string\",\n\tpgPool: \"a pg.Pool\",\n\tpgClient: \"a pg.Client\"\n};\nfunction refusedInputError(wording, option, kind) {\n\tconst pgFix = wording.pgObjectsEach === \"\" ? \"\" : `${wording.pgObjectsEach} as pg, or `;\n\treturn postgresError(\"RUNTIME.BINDING_INVALID\", `The ${option} option is ${inputDescriptions[kind]}, which this client does not take`, {\n\t\tfix: `Pass ${pgFix}binding: ${wording.forms}.`,\n\t\tmeta: {\n\t\t\textension: wording.extension,\n\t\t\treason: `refused ${option} input`,\n\t\t\treceivedKind: kind\n\t\t}\n\t});\n}\nfunction resolveInput(options, rules, wording) {\n\tif (Number(options.binding !== void 0) + Number(options.url !== void 0) + Number(options.pg !== void 0) !== 1) throw postgresError(\"RUNTIME.BINDING_INVALID\", \"Provide one binding input: binding, url, or pg\", {\n\t\tfix: \"Pass exactly one of `binding`, `url`, or `pg`.\",\n\t\tmeta: {\n\t\t\textension: rules.extension,\n\t\t\treason: \"zero or multiple binding inputs\"\n\t\t}\n\t});\n\tif (options.binding !== void 0) return checkBindingContents(options.binding, wording);\n\tif (options.url !== void 0) return {\n\t\tkind: \"url\",\n\t\turl: validatePostgresUrl(options.url, rules.extension)\n\t};\n\tconst pgBinding = options.pg;\n\tif (pgBinding === void 0) throw new InternalError(\"Invariant violation: expected pg binding after validation\");\n\tif (isPgPool(pgBinding)) return {\n\t\tkind: \"pgPool\",\n\t\tpool: pgBinding\n\t};\n\tif (isPgClient(pgBinding)) return {\n\t\tkind: \"pgClient\",\n\t\tclient: pgBinding\n\t};\n\tthrow postgresError(\"RUNTIME.BINDING_INVALID\", \"Unable to determine pg binding type from pg input; use binding with explicit kind\", {\n\t\tfix: `Pass ${wording.pgForms} instead of pg.`,\n\t\tmeta: {\n\t\t\textension: rules.extension,\n\t\t\treason: \"unrecognizable pg object\"\n\t\t}\n\t});\n}\nfunction resolvePostgresBinding(options) {\n\treturn resolveBinding(options, postgresBindingRules);\n}\nfunction resolveOptionalPostgresBinding(options, rules) {\n\tif (Number(options.binding !== void 0) + Number(options.url !== void 0) + Number(options.pg !== void 0) === 0) return;\n\treturn resolveBinding(blindCast(options), rules);\n}\nfunction toRuntimeBinding(binding, options) {\n\tif (binding.kind !== \"url\") return {\n\t\t...binding,\n\t\townedByDriver: false\n\t};\n\treturn {\n\t\tkind: \"pgPool\",\n\t\townedByDriver: true,\n\t\tpool: suppressIdleConnectionErrors(createPgPool({\n\t\t\tconnectionString: binding.url,\n\t\t\tconnectionTimeoutMillis: options.poolOptions?.connectionTimeoutMillis ?? 2e4,\n\t\t\tidleTimeoutMillis: options.poolOptions?.idleTimeoutMillis ?? 3e4\n\t\t}, postgresTarget.sessionSettings ?? {}))\n\t};\n}\n/** Connects `driver` to `binding`, and ends the pool created for a url binding when the connection fails. */\nasync function connectWithBinding(driver, binding, options) {\n\tconst runtimeBinding = toRuntimeBinding(binding, options);\n\ttry {\n\t\tawait driver.connect(runtimeBinding);\n\t} catch (error) {\n\t\tif (runtimeBinding.kind === \"pgPool\" && runtimeBinding.ownedByDriver) await runtimeBinding.pool.end().catch(() => void 0);\n\t\tthrow error;\n\t}\n}\n//#endregion\nexport { resolveOptionalPostgresBinding as a, postgresBindingRules as i, isPgClient as n, resolvePostgresBinding as o, isPgPool as r, validatePostgresUrl as s, connectWithBinding as t };\n\n//# sourceMappingURL=binding-DkfRsUZE.mjs.map"],"mappings":";;;;;;;AAQA,MAAM,YAAY,OAAO,gBAAgB,MAAM,eAAe,MAAM,kBAAkB;AACtF,MAAM,cAAc,OAAO,sBAAsB,MAAM,mBAAmB;AAC1E,SAAS,oBAAoB,KAAK,YAAY,YAAY;CACzD,MAAM,UAAU,IAAI,KAAK;CACzB,IAAI,QAAQ,WAAW,GAAG,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S,OAAO;EACf,IAAI,eAAe,SAAS,YAAY,eAAe,eAAe,MAAM,eAAe,KAAK,IAAI,CAAC,CAAC,YAAY,KAAK,CAAC;EACxH,MAAM;CACP;AACD"}
1
+ {"version":3,"file":"binding-Cg5nms1Y-Bk8OB_I5.mjs","names":[],"sources":["../../../../3-targets/postgres/9-facade/dist/binding-Cg5nms1Y.mjs"],"sourcesContent":["import { t as postgresError } from \"./errors-DfWK9xep.mjs\";\nimport \"./postgres-options-CZyV9Him.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport postgresTarget from \"@internal/target-postgres/runtime\";\nimport { createPgPool, suppressIdleConnectionErrors } from \"@internal/driver-postgres/runtime\";\nimport { blindCast } from \"@internal/utils/casts\";\n//#region src/runtime/binding.ts\nconst isPgPool = (pg) => \"totalCount\" in pg && \"idleCount\" in pg && \"waitingCount\" in pg;\nconst isPgClient = (pg) => \"escapeIdentifier\" in pg && \"escapeLiteral\" in pg;\nfunction validatePostgresUrl(url, extension = \"postgres\") {\n\tconst trimmed = url.trim();\n\tif (trimmed.length === 0) throw postgresError(\"RUNTIME.BINDING_INVALID\", \"Postgres URL must be a non-empty string\", { meta: {\n\t\textension,\n\t\treason: \"empty url\"\n\t} });\n\tlet parsed;\n\ttry {\n\t\tparsed = new URL(trimmed);\n\t} catch {\n\t\tthrow postgresError(\"RUNTIME.BINDING_INVALID\", \"Postgres URL must be a valid URL\", { meta: {\n\t\t\textension,\n\t\t\treason: \"unparseable url\"\n\t\t} });\n\t}\n\tif (parsed.protocol !== \"postgres:\" && parsed.protocol !== \"postgresql:\") throw postgresError(\"RUNTIME.BINDING_INVALID\", \"Postgres URL must use postgres:// or postgresql://\", { meta: {\n\t\textension,\n\t\treason: \"wrong scheme\",\n\t\t...ifDefined(\"received\", trimmed.toLowerCase().startsWith(`${parsed.protocol}//`) ? parsed.protocol : void 0)\n\t} });\n\treturn trimmed;\n}\nfunction typeOfInput(value) {\n\treturn value === null ? \"null\" : typeof value;\n}\nfunction isObject(value) {\n\treturn typeof value === \"object\" && value !== null;\n}\nconst postgresBindingRules = {\n\textension: \"postgres\",\n\tkinds: {\n\t\turl: true,\n\t\tpgPool: true,\n\t\tpgClient: true\n\t}\n};\nconst bindingForms = {\n\turl: \"{ kind: 'url', url }\",\n\tpgPool: \"{ kind: 'pgPool', pool }\",\n\tpgClient: \"{ kind: 'pgClient', client }\"\n};\nfunction isBindingKind(kind) {\n\treturn typeof kind === \"string\" && Object.hasOwn(bindingForms, kind);\n}\nconst pgObjectNames = {\n\tpgPool: \"pg.Pool\",\n\tpgClient: \"pg.Client\"\n};\nfunction orList(items) {\n\treturn items.length < 2 ? items.join(\"\") : `${items.slice(0, -1).join(\", \")} or ${items[items.length - 1]}`;\n}\nfunction wordingOf(rules) {\n\tconst kinds = Object.keys(bindingForms).filter(isBindingKind).filter((kind) => rules.kinds[kind] === true);\n\tconst pgKinds = kinds.filter((kind) => pgObjectNames[kind] !== void 0);\n\tconst pgNames = pgKinds.flatMap((kind) => pgObjectNames[kind] ?? []);\n\treturn {\n\t\textension: rules.extension,\n\t\tkinds: orList(kinds.map((kind) => `'${kind}'`)),\n\t\tforms: orList(kinds.map((kind) => bindingForms[kind])),\n\t\tpgForms: orList(pgKinds.map((kind) => `binding: ${bindingForms[kind]}`)),\n\t\tpgObjects: orList(pgNames),\n\t\tpgObjectsEach: orList(pgNames.map((name) => `a ${name}`))\n\t};\n}\nfunction invalidInput(wording, input, message, fix) {\n\tconst receivedType = typeOfInput(input.value);\n\treturn postgresError(\"RUNTIME.BINDING_INVALID\", message, {\n\t\twhy: `The ${input.name} is ${receivedType === \"null\" ? \"null\" : `a ${receivedType}`}, and it must be ${input.expected}.`,\n\t\tfix,\n\t\tmeta: {\n\t\t\textension: wording.extension,\n\t\t\treason: input.reason,\n\t\t\treceivedType\n\t\t}\n\t});\n}\nconst echoableKind = /^[A-Za-z_][A-Za-z0-9_]{0,31}$/;\nfunction describeUnknownKind(kind) {\n\tif (kind === void 0) return {\n\t\twhy: \"The binding option has no kind, so it names no database.\",\n\t\treceived: { receivedKind: \"undefined\" }\n\t};\n\tif (typeof kind === \"string\" && echoableKind.test(kind)) return {\n\t\twhy: `The binding option has kind '${kind}', which is not a binding kind this client takes.`,\n\t\treceived: { receivedKind: kind }\n\t};\n\tconst receivedType = typeOfInput(kind);\n\treturn {\n\t\twhy: typeof kind === \"string\" ? \"The binding option has a kind that is a string not in the list of binding kinds.\" : `The binding option has kind of type ${receivedType}, which is not a binding kind.`,\n\t\treceived: typeof kind === \"string\" ? { receivedType } : { receivedKind: receivedType }\n\t};\n}\nfunction unknownKindError(wording, kind) {\n\tconst { why, received } = describeUnknownKind(kind);\n\treturn postgresError(\"RUNTIME.BINDING_INVALID\", `The binding option must have kind ${wording.kinds}`, {\n\t\twhy,\n\t\tfix: `Pass binding: ${wording.forms}.`,\n\t\tmeta: {\n\t\t\textension: wording.extension,\n\t\t\treason: \"unknown binding kind\",\n\t\t\t...received\n\t\t}\n\t});\n}\nfunction checkInputTypes(options, rules, wording) {\n\tconst binding = options.binding;\n\tconst url = options.url;\n\tconst pg = options.pg;\n\tif (binding !== void 0 && !isObject(binding)) throw invalidInput(wording, {\n\t\tname: \"binding option\",\n\t\tvalue: binding,\n\t\texpected: \"an object with a kind\",\n\t\treason: \"invalid binding input\"\n\t}, \"The binding option must be an object with a kind\", `Pass binding: ${wording.forms}.`);\n\tif (url !== void 0 && typeof url !== \"string\") throw invalidInput(wording, {\n\t\tname: \"url option\",\n\t\tvalue: url,\n\t\texpected: \"a connection string\",\n\t\treason: \"invalid url input\"\n\t}, \"The url option must be a string\", \"Pass a postgres:// or postgresql:// connection string as url, and check that the variable it comes from is set.\");\n\tif (pg !== void 0 && !isObject(pg)) throw invalidInput(wording, {\n\t\tname: \"pg option\",\n\t\tvalue: pg,\n\t\texpected: `a ${wording.pgObjects} object`,\n\t\treason: \"invalid pg input\"\n\t}, `The pg option must be ${wording.pgObjectsEach}`, `Pass a ${wording.pgObjects} as pg, or pass a connection string as url.`);\n\tif (binding !== void 0) {\n\t\tconst kind = \"kind\" in binding ? binding.kind : void 0;\n\t\tif (!isBindingKind(kind) || rules.kinds[kind] !== true) throw unknownKindError(wording, kind);\n\t}\n}\nfunction checkBindingContents(binding, wording) {\n\tif (binding.kind === \"url\") {\n\t\tconst url = binding.url;\n\t\tif (typeof url !== \"string\") throw invalidInput(wording, {\n\t\t\tname: \"url in the binding option\",\n\t\t\tvalue: url,\n\t\t\texpected: \"a connection string\",\n\t\t\treason: \"invalid binding url\"\n\t\t}, \"The url in the binding option must be a string\", \"Pass binding: { kind: 'url', url } with a postgres:// or postgresql:// connection string, and check that the variable it comes from is set.\");\n\t\treturn {\n\t\t\tkind: \"url\",\n\t\t\turl: validatePostgresUrl(url, wording.extension)\n\t\t};\n\t}\n\tconst [name, value] = binding.kind === \"pgPool\" ? [\"pool\", binding.pool] : [\"client\", binding.client];\n\tif (!isObject(value)) {\n\t\tconst objectName = binding.kind === \"pgPool\" ? \"pg.Pool\" : \"pg.Client\";\n\t\tthrow invalidInput(wording, {\n\t\t\tname: `${name} in the binding option`,\n\t\t\tvalue,\n\t\t\texpected: `a ${objectName}`,\n\t\t\treason: `invalid binding ${name}`\n\t\t}, `The ${name} in the binding option must be a ${objectName}`, `Pass binding: ${bindingForms[binding.kind]} with a ${objectName}.`);\n\t}\n\treturn binding;\n}\nfunction resolveBinding(options, rules) {\n\tconst wording = wordingOf(rules);\n\tcheckInputTypes(options, rules, wording);\n\tconst binding = resolveInput(options, rules, wording);\n\tif (rules.kinds[binding.kind] !== true) throw refusedInputError(wording, options.url !== void 0 ? \"url\" : \"pg\", binding.kind);\n\treturn binding;\n}\nconst inputDescriptions = {\n\turl: \"a connection string\",\n\tpgPool: \"a pg.Pool\",\n\tpgClient: \"a pg.Client\"\n};\nfunction refusedInputError(wording, option, kind) {\n\tconst pgFix = wording.pgObjectsEach === \"\" ? \"\" : `${wording.pgObjectsEach} as pg, or `;\n\treturn postgresError(\"RUNTIME.BINDING_INVALID\", `The ${option} option is ${inputDescriptions[kind]}, which this client does not take`, {\n\t\tfix: `Pass ${pgFix}binding: ${wording.forms}.`,\n\t\tmeta: {\n\t\t\textension: wording.extension,\n\t\t\treason: `refused ${option} input`,\n\t\t\treceivedKind: kind\n\t\t}\n\t});\n}\nfunction resolveInput(options, rules, wording) {\n\tif (Number(options.binding !== void 0) + Number(options.url !== void 0) + Number(options.pg !== void 0) !== 1) throw postgresError(\"RUNTIME.BINDING_INVALID\", \"Provide one binding input: binding, url, or pg\", {\n\t\tfix: \"Pass exactly one of `binding`, `url`, or `pg`.\",\n\t\tmeta: {\n\t\t\textension: rules.extension,\n\t\t\treason: \"zero or multiple binding inputs\"\n\t\t}\n\t});\n\tif (options.binding !== void 0) return checkBindingContents(options.binding, wording);\n\tif (options.url !== void 0) return {\n\t\tkind: \"url\",\n\t\turl: validatePostgresUrl(options.url, rules.extension)\n\t};\n\tconst pgBinding = options.pg;\n\tif (pgBinding === void 0) throw new InternalError(\"Invariant violation: expected pg binding after validation\");\n\tif (isPgPool(pgBinding)) return {\n\t\tkind: \"pgPool\",\n\t\tpool: pgBinding\n\t};\n\tif (isPgClient(pgBinding)) return {\n\t\tkind: \"pgClient\",\n\t\tclient: pgBinding\n\t};\n\tthrow postgresError(\"RUNTIME.BINDING_INVALID\", \"Unable to determine pg binding type from pg input; use binding with explicit kind\", {\n\t\tfix: `Pass ${wording.pgForms} instead of pg.`,\n\t\tmeta: {\n\t\t\textension: rules.extension,\n\t\t\treason: \"unrecognizable pg object\"\n\t\t}\n\t});\n}\nfunction resolvePostgresBinding(options) {\n\treturn resolveBinding(options, postgresBindingRules);\n}\nfunction resolveOptionalPostgresBinding(options, rules) {\n\tif (Number(options.binding !== void 0) + Number(options.url !== void 0) + Number(options.pg !== void 0) === 0) return;\n\treturn resolveBinding(blindCast(options), rules);\n}\nfunction toRuntimeBinding(binding, options) {\n\tif (binding.kind !== \"url\") return {\n\t\t...binding,\n\t\townedByDriver: false\n\t};\n\treturn {\n\t\tkind: \"pgPool\",\n\t\townedByDriver: true,\n\t\tpool: suppressIdleConnectionErrors(createPgPool({\n\t\t\tconnectionString: binding.url,\n\t\t\tconnectionTimeoutMillis: options.poolOptions?.connectionTimeoutMillis ?? 2e4,\n\t\t\tidleTimeoutMillis: options.poolOptions?.idleTimeoutMillis ?? 3e4,\n\t\t\t...ifDefined(\"max\", options.poolOptions?.max)\n\t\t}, postgresTarget.sessionSettings ?? {}))\n\t};\n}\n/** Connects `driver` to `binding`, and ends the pool created for a url binding when the connection fails. */\nasync function connectWithBinding(driver, binding, options) {\n\tconst runtimeBinding = toRuntimeBinding(binding, options);\n\ttry {\n\t\tawait driver.connect(runtimeBinding);\n\t} catch (error) {\n\t\tif (runtimeBinding.kind === \"pgPool\" && runtimeBinding.ownedByDriver) await runtimeBinding.pool.end().catch(() => void 0);\n\t\tthrow error;\n\t}\n}\n//#endregion\nexport { resolveOptionalPostgresBinding as a, postgresBindingRules as i, isPgClient as n, resolvePostgresBinding as o, isPgPool as r, validatePostgresUrl as s, connectWithBinding as t };\n\n//# sourceMappingURL=binding-Cg5nms1Y.mjs.map"],"mappings":";;;;;;;AAQA,MAAM,YAAY,OAAO,gBAAgB,MAAM,eAAe,MAAM,kBAAkB;AACtF,MAAM,cAAc,OAAO,sBAAsB,MAAM,mBAAmB;AAC1E,SAAS,oBAAoB,KAAK,YAAY,YAAY;CACzD,MAAM,UAAU,IAAI,KAAK;CACzB,IAAI,QAAQ,WAAW,GAAG,MAAM,cAAc,2BAA2B,2CAA2C,EAAE,MAAM;EAC3H;EACA,QAAQ;CACT,EAAE,CAAC;CACH,IAAI;CACJ,IAAI;EACH,SAAS,IAAI,IAAI,OAAO;CACzB,QAAQ;EACP,MAAM,cAAc,2BAA2B,oCAAoC,EAAE,MAAM;GAC1F;GACA,QAAQ;EACT,EAAE,CAAC;CACJ;CACA,IAAI,OAAO,aAAa,eAAe,OAAO,aAAa,eAAe,MAAM,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-C2QR33Rg-BTKXQic1.mjs";
2
2
  import { PostgresBinding } from "@prisma/orm-target-postgres/driver/runtime";
3
3
  import { Client, Pool } from "pg";
4
- //#region ../../../3-targets/postgres/9-facade/dist/binding-BN5X69gf.d.mts
4
+ //#region ../../../3-targets/postgres/9-facade/dist/binding-Q21lKDeA.d.mts
5
5
  //#region src/runtime/binding.d.ts
6
6
  declare const isPgPool: (pg: Pool | Client) => pg is Pool;
7
7
  declare const isPgClient: (pg: Pool | Client) => pg is Client;
@@ -48,4 +48,4 @@ declare function connectWithBinding(driver: {
48
48
  }): Promise<void>;
49
49
  //#endregion
50
50
  export { isPgClient as a, connectWithBinding as i, PostgresBindingInput as n, isPgPool as o, PostgresBindingRules as r, resolveOptionalPostgresBinding as s, PostgresBinding$1 as t };
51
- //# sourceMappingURL=binding-BN5X69gf-CIDnIWcw.d.mts.map
51
+ //# sourceMappingURL=binding-Q21lKDeA-CQ2oKakQ.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"binding-BN5X69gf-CIDnIWcw.d.mts","names":[],"sources":["../../../../3-targets/postgres/9-facade/dist/binding-BN5X69gf.d.mts"],"mappings":";;;;;cAIc,WAAW,IAAI,OAAO,WAAW,MAAM;cACvC,aAAa,IAAI,OAAO,WAAW,MAAM;KAClD;WACM;WACA;;WAEA;WACA,MAAM;;WAEN;WACA,QAAQ;;KAEd;WACM,SAAS;WACT;WACA;;WAEA;WACA;WACA;;WAEA,IAAI,OAAO;WACX;WACA;;KAEN;WACM,UAAU;WACV;WACA,KAAK,OAAO;;KAElB,cAAc;;UAET;WACC;WACA,OAAO,SAAS,QAAQ,OAAO;;iBAEzB,+BAA+B,SAAS,uBAAuB,OAAO,uBAAuB;;iBAE7F,mBAAmB;EAClC,QAAQ,SAAS,kBAAkB;GAClC,SAAS,mBAAmB;WACpB,cAAc;IACrB"}
1
+ {"version":3,"file":"binding-Q21lKDeA-CQ2oKakQ.d.mts","names":[],"sources":["../../../../3-targets/postgres/9-facade/dist/binding-Q21lKDeA.d.mts"],"mappings":";;;;;cAIc,WAAW,IAAI,OAAO,WAAW,MAAM;cACvC,aAAa,IAAI,OAAO,WAAW,MAAM;KAClD;WACM;WACA;;WAEA;WACA,MAAM;;WAEN;WACA,QAAQ;;KAEd;WACM,SAAS;WACT;WACA;;WAEA;WACA;WACA;;WAEA,IAAI,OAAO;WACX;WACA;;KAEN;WACM,UAAU;WACV;WACA,KAAK,OAAO;;KAElB,cAAc;;UAET;WACC;WACA,OAAO,SAAS,QAAQ,OAAO;;iBAEzB,+BAA+B,SAAS,uBAAuB,OAAO,uBAAuB;;iBAE7F,mBAAmB;EAClC,QAAQ,SAAS,kBAAkB;GAClC,SAAS,mBAAmB;WACpB,cAAc;IACrB"}
@@ -523,8 +523,8 @@ declare const enumType: BoundEnumType<{
523
523
  readonly traits: "equality" | "order";
524
524
  }, "traits" | "output" | "input">;
525
525
  readonly "pg/interval@1": Pick<{
526
- readonly input: import("@prisma/orm-target-postgres/target/codec-types").PgInterval;
527
- readonly output: import("@prisma/orm-target-postgres/target/codec-types").PgInterval;
526
+ readonly input: import("@prisma/orm-target-postgres/target/codecs").PgInterval;
527
+ readonly output: import("@prisma/orm-target-postgres/target/codecs").PgInterval;
528
528
  readonly json: import("@prisma/orm-framework/contract/types").JsonValue;
529
529
  readonly traits: "equality" | "order";
530
530
  readonly keepsWrittenForm: true;
@@ -1 +1 @@
1
- {"version":3,"file":"contract-builder.d.mts","names":[],"sources":["../../../../3-targets/postgres/9-facade/dist/contract-builder.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;UAkBU,gBAAgB;WACf;WACA,MAAM;WACN;;;;;iBAKM,gBAAgB,qBAAqB,MAAM,MAAM;WACvD,4BAA4B;IACnC,gBAAgB;;;;;;;;;UASV;WACC;aACE;aACA;aACA,QAAQ,eAAe;;;;;;;;UAQ1B,cAAc;WACb;WACA,MAAM;;;UAGP;WACC;;WAEA;aACE,QAAQ;;;;;;;;UAQX,gBAAgB,kBAAkB,qBAAq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SAAS,uBAAuB,YAAY,SAAS;;iBAE/C,oBAAoB,2BAA2B,eAAe,oBAAoB,aAAa,oBAAoB,kBAAkB,iBAAiB,gCAAgC,mCAAmC,QAAQ,QAAQ,SAAS,yBAAyB,MAAM,YAAY,wBAAwB,QAAQ,iBAAiB;iBAC9U,oBAAoB,0BAA0B,eAAe,oBAAoB,aAAa,oBAAoB,kBAAkB,iBAAiB,gCAAgC,mCAAmC,QAAQ,QAAQ,SAAS,wBAAwB,KAAK,YAAY,wBAAwB,mBAAmB,KAAK;;;;;;;;;;;;;UAajV,iBAAiB,8BAA8B,kCAAkC;WAChF;WACA,MAAM;WACN,UAAU;WACV,SAAS;WACT,QAAQ,mBAAmB;;;;;;EAMpC,UAAU,+BAA+B,UAAU,iBAAiB,iBAAiB,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA4B5F,iBAAiB,2BAA2B,gDAAgD,MAAM,SAAS,SAAS,UAAU,iBAAiB,MAAM,MAAM;;;;;;KAMvK,uBAAuB,kDAAkD,4BAA4B;WAC/F;aACE;aACA;aACA,QAAQ,mBAAmB;;;;;;;;;;;;;iBAavB,mBAAmB,2BAA2B,+BAA+B,gDAAgD,QAAQ,iBAAiB,MAAM,UAAU,WAAW,uBAAuB;;cAE3M;WACH,aAAa"}
@@ -1,7 +1,7 @@
1
1
  import postgresTarget, { PostgresContractSerializer } from "@prisma/orm-target-postgres/target/runtime";
2
2
  import { validateContractOnce } from "@prisma/orm-framework/contract/validate-once";
3
- //#region ../../../3-targets/postgres/9-facade/dist/contract-from-json-CuzxHkGa.mjs
4
- var version = "8.0.0-rc.24-dev.31";
3
+ //#region ../../../3-targets/postgres/9-facade/dist/contract-from-json-C6uR3W9i.mjs
4
+ var version = "8.0.0-rc.24-dev.33";
5
5
  const serializer = new PostgresContractSerializer();
6
6
  const validator = `${postgresTarget.targetId}@${version}`;
7
7
  /**
@@ -30,4 +30,4 @@ function validatePostgresContract(contract) {
30
30
  //#endregion
31
31
  export { validatePostgresContract as n, contractFromJson as t };
32
32
 
33
- //# sourceMappingURL=contract-from-json-CuzxHkGa-CoiMbCP1.mjs.map
33
+ //# sourceMappingURL=contract-from-json-C6uR3W9i-DVRdyn3s.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"contract-from-json-CuzxHkGa-CoiMbCP1.mjs","names":[],"sources":["../../../../3-targets/postgres/9-facade/dist/contract-from-json-CuzxHkGa.mjs"],"sourcesContent":["import postgresTarget, { PostgresContractSerializer } from \"@internal/target-postgres/runtime\";\nimport { validateContractOnce } from \"@internal/contract/validate-once\";\n//#region package.json\nvar version = \"8.0.0-rc.24-dev.31\";\n//#endregion\n//#region src/static/contract-from-json.ts\nconst serializer = new PostgresContractSerializer();\nconst validator = `${postgresTarget.targetId}@${version}`;\n/**\n* Validates an emitted Postgres `contract.json` and returns it as the contract type the\n* application names, ready to pass to `postgres({ contract })` and the other Postgres clients.\n* Clients built from the result do not validate it again.\n*\n* The returned value's top level is frozen; its nested objects are not. Do not change `json` or the\n* returned value after the call: clients built from the value later do not validate it again.\n*\n* @example\n* ```ts\n* import type { Contract } from './contract.d';\n* import contractJson from './contract.json' with { type: 'json' };\n*\n* export const contract = contractFromJson<Contract>(contractJson);\n* ```\n*/\nfunction contractFromJson(json) {\n\treturn validateContractOnce(json, validator, (input) => serializer.deserializeContract(input));\n}\n/** Validates a contract value for a Postgres client, once per value. */\nfunction validatePostgresContract(contract) {\n\treturn validateContractOnce(contract, validator, () => serializer.deserializeContract(serializer.serializeContract(contract)));\n}\n//#endregion\nexport { validatePostgresContract as n, contractFromJson as t };\n\n//# sourceMappingURL=contract-from-json-CuzxHkGa.mjs.map"],"mappings":";;;AAGA,IAAI,UAAU;AAGd,MAAM,aAAa,IAAI,2BAA2B;AAClD,MAAM,YAAY,GAAG,eAAe,SAAS,GAAG;;;;;;;;;;;;;;;;;AAiBhD,SAAS,iBAAiB,MAAM;CAC/B,OAAO,qBAAqB,MAAM,YAAY,UAAU,WAAW,oBAAoB,KAAK,CAAC;AAC9F;;AAEA,SAAS,yBAAyB,UAAU;CAC3C,OAAO,qBAAqB,UAAU,iBAAiB,WAAW,oBAAoB,WAAW,kBAAkB,QAAQ,CAAC,CAAC;AAC9H"}
1
+ {"version":3,"file":"contract-from-json-C6uR3W9i-DVRdyn3s.mjs","names":[],"sources":["../../../../3-targets/postgres/9-facade/dist/contract-from-json-C6uR3W9i.mjs"],"sourcesContent":["import postgresTarget, { PostgresContractSerializer } from \"@internal/target-postgres/runtime\";\nimport { validateContractOnce } from \"@internal/contract/validate-once\";\n//#region package.json\nvar version = \"8.0.0-rc.24-dev.33\";\n//#endregion\n//#region src/static/contract-from-json.ts\nconst serializer = new PostgresContractSerializer();\nconst validator = `${postgresTarget.targetId}@${version}`;\n/**\n* Validates an emitted Postgres `contract.json` and returns it as the contract type the\n* application names, ready to pass to `postgres({ contract })` and the other Postgres clients.\n* Clients built from the result do not validate it again.\n*\n* The returned value's top level is frozen; its nested objects are not. Do not change `json` or the\n* returned value after the call: clients built from the value later do not validate it again.\n*\n* @example\n* ```ts\n* import type { Contract } from './contract.d';\n* import contractJson from './contract.json' with { type: 'json' };\n*\n* export const contract = contractFromJson<Contract>(contractJson);\n* ```\n*/\nfunction contractFromJson(json) {\n\treturn validateContractOnce(json, validator, (input) => serializer.deserializeContract(input));\n}\n/** Validates a contract value for a Postgres client, once per value. */\nfunction validatePostgresContract(contract) {\n\treturn validateContractOnce(contract, validator, () => serializer.deserializeContract(serializer.serializeContract(contract)));\n}\n//#endregion\nexport { validatePostgresContract as n, contractFromJson as t };\n\n//# sourceMappingURL=contract-from-json-C6uR3W9i.mjs.map"],"mappings":";;;AAGA,IAAI,UAAU;AAGd,MAAM,aAAa,IAAI,2BAA2B;AAClD,MAAM,YAAY,GAAG,eAAe,SAAS,GAAG;;;;;;;;;;;;;;;;;AAiBhD,SAAS,iBAAiB,MAAM;CAC/B,OAAO,qBAAqB,MAAM,YAAY,UAAU,WAAW,oBAAoB,KAAK,CAAC;AAC9F;;AAEA,SAAS,yBAAyB,UAAU;CAC3C,OAAO,qBAAqB,UAAU,iBAAiB,WAAW,oBAAoB,WAAW,kBAAkB,QAAQ,CAAC,CAAC;AAC9H"}
@@ -22,7 +22,7 @@ const user = await db.orm.public.User
22
22
  .first();
23
23
 
24
24
  // Your editor will show the type of user as
25
- // { id: number; email: string; username: string | null; name: string | null; createdAt: Date; posts: Post[] } | null
25
+ // { id: {{idType}}; email: string; username: string | null; name: string | null; createdAt: Date; posts: Post[] } | null
26
26
  ```
27
27
 
28
28
  Your contract has two companion files in the same directory:
package/dist/init.mjs CHANGED
@@ -90,6 +90,10 @@ function starterContract(mode) {
90
90
  function contractSample(mode) {
91
91
  return mode === "typescript" ? contractSampleTs() : contractSamplePsl();
92
92
  }
93
+ /** The type a query result gives `id` in the starter contract: an integer in PSL, UUID text in TypeScript. */
94
+ function starterIdType(mode) {
95
+ return mode === "typescript" ? "string" : "number";
96
+ }
93
97
  function contractSamplePsl() {
94
98
  return `\`\`\`prisma
95
99
  model User {
@@ -218,6 +222,7 @@ function quickReference(input) {
218
222
  pkg: moduleBase,
219
223
  configEntrypoint: configModule,
220
224
  schemaSample: contractSample(input.mode),
225
+ idType: starterIdType(input.mode),
221
226
  requirements: input.requirements
222
227
  });
223
228
  }
package/dist/init.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"init.mjs","names":[],"sources":["../../../../3-targets/postgres/9-facade/dist/init.mjs"],"sourcesContent":["import { t as moduleBase } from \"./module-base-C02qpQ9x.mjs\";\nimport { dirname, join } from \"pathe\";\nimport { POSTGRES_MIN_SERVER_VERSION } from \"@internal/target-postgres/server-version\";\nimport { readFileSync } from \"node:fs\";\n//#region src/init/probe.ts\n/**\n* Extracts the numeric prefix from a Postgres `version()` row, e.g.\n*\n* `PostgreSQL 14.10 on x86_64-pc-linux-gnu, ...` → `\"14.10\"`\n* `PostgreSQL 16beta1 on …` → `\"16\"` (we\n* conservatively drop the suffix; minimum-version comparisons\n* treat 16beta1 as 16, which is what every reasonable user\n* expects).\n*\n* `undefined` when the row holds no PostgreSQL version.\n*/\nfunction parsePostgresVersion(versionString) {\n\treturn versionString.match(/PostgreSQL\\s+(\\d+(?:\\.\\d+)?)/i)?.[1];\n}\n/** How long the probe waits for the server to accept the connection, and then to answer. */\nconst PROBE_TIMEOUT_MILLIS = 2e4;\nfunction causeMessage(error) {\n\treturn error instanceof Error ? error.message : String(error);\n}\nfunction isModuleNotFound(error) {\n\treturn error instanceof Error && Reflect.get(error, \"code\") === \"ERR_MODULE_NOT_FOUND\";\n}\nasync function probePostgres(databaseUrl, signal, loadDriver = () => import(\"pg\")) {\n\tlet pg;\n\ttry {\n\t\tpg = await loadDriver();\n\t} catch (error) {\n\t\treturn {\n\t\t\tkind: isModuleNotFound(error) ? \"driver-missing\" : \"driver-failed\",\n\t\t\tdriver: \"pg\",\n\t\t\tcause: causeMessage(error)\n\t\t};\n\t}\n\tconst client = new pg.default.Client({\n\t\tconnectionString: databaseUrl,\n\t\tconnectionTimeoutMillis: PROBE_TIMEOUT_MILLIS,\n\t\tquery_timeout: PROBE_TIMEOUT_MILLIS\n\t});\n\tclient.on(\"error\", () => {});\n\tconst endOnAbort = () => {\n\t\tclient.end().catch(() => void 0);\n\t};\n\tsignal.addEventListener(\"abort\", endOnAbort, { once: true });\n\ttry {\n\t\tawait client.connect();\n\t\tconst versionQuery = {\n\t\t\ttext: \"SELECT version() as version\",\n\t\t\tquery_timeout: PROBE_TIMEOUT_MILLIS\n\t\t};\n\t\tlet result;\n\t\ttry {\n\t\t\tresult = await client.query(versionQuery);\n\t\t} catch (error) {\n\t\t\treturn {\n\t\t\t\tkind: \"version-unreadable\",\n\t\t\t\tdetail: `SELECT version() failed: ${causeMessage(error)}`\n\t\t\t};\n\t\t}\n\t\tconst versionString = String(result.rows[0]?.version ?? \"\");\n\t\tconst serverVersion = parsePostgresVersion(versionString);\n\t\treturn serverVersion === void 0 ? {\n\t\t\tkind: \"version-unreadable\",\n\t\t\tdetail: `could not parse PostgreSQL version from \\`${versionString}\\``\n\t\t} : {\n\t\t\tkind: \"server-version\",\n\t\t\tserverVersion\n\t\t};\n\t} finally {\n\t\tsignal.removeEventListener(\"abort\", endOnAbort);\n\t\tawait client.end().catch(() => void 0);\n\t}\n}\n//#endregion\n//#region src/init/render.ts\n/**\n* Fills each `{{name}}` of the template in one pass, so a value is inserted as it is: a value\n* holding `$&` or another placeholder is not read again.\n*/\nfunction renderTemplate(templateFile, vars) {\n\treturn readFileSync(join(import.meta.dirname, templateFile), \"utf-8\").replace(/\\{\\{(\\w+)\\}\\}/g, (placeholder, name) => Object.hasOwn(vars, name) ? vars[name] ?? placeholder : placeholder);\n}\n//#endregion\n//#region src/init/templates.ts\nconst configModule = `${moduleBase}/config`;\nconst builder = `${moduleBase}/contract-builder`;\nfunction starterContract(mode) {\n\treturn mode === \"typescript\" ? starterContractTs() : starterContractPsl();\n}\nfunction contractSample(mode) {\n\treturn mode === \"typescript\" ? contractSampleTs() : contractSamplePsl();\n}\nfunction contractSamplePsl() {\n\treturn `\\`\\`\\`prisma\nmodel User {\n id Int @id @default(autoincrement())\n email String @unique\n username String?\n name String?\n}\n\\`\\`\\``;\n}\nfunction contractSampleTs() {\n\treturn `\\`\\`\\`typescript\nimport { defineContract } from '${builder}';\n\nexport const contract = defineContract(\n {},\n ({ field, model, gen, type }) => ({\n models: {\n User: model('User', {\n fields: {\n id: field.column(type.Uuid()).id().onCreate(gen.uuid(7)),\n email: field.column(type.String()).unique(),\n username: field.column(type.String()).optional(),\n name: field.column(type.String()).optional(),\n },\n }),\n },\n }),\n);\n\\`\\`\\``;\n}\nfunction starterContractPsl() {\n\treturn `// use prisma-8\n\nmodel User {\n id Int @id @default(autoincrement())\n email String @unique\n username String?\n name String?\n posts Post[]\n createdAt DateTime @default(now()) @onCreate(now())\n updatedAt temporal.UpdatedAt\n}\n\nmodel Post {\n id Int @id @default(autoincrement())\n title String\n content String?\n author User @relation(fields: [authorId], references: [id])\n authorId Int\n createdAt DateTime @default(now()) @onCreate(now())\n updatedAt temporal.UpdatedAt\n}\n`;\n}\nfunction starterContractTs() {\n\treturn `import { defineContract, now } from '${builder}';\n\nexport const contract = defineContract({}, ({ field, model, rel, gen, type }) => {\n const User = model('User', {\n fields: {\n id: field.column(type.Uuid()).id().onCreate(gen.uuid(7)),\n email: field.column(type.String()).unique(),\n username: field.column(type.String()).optional(),\n name: field.column(type.String()).optional(),\n createdAt: field.column(type.DateTime()).default(now()).onCreate(gen.now()),\n updatedAt: field.column(type.temporal.UpdatedAt()),\n },\n });\n\n const Post = model('Post', {\n fields: {\n id: field.column(type.Uuid()).id().onCreate(gen.uuid(7)),\n title: field.column(type.String()),\n content: field.column(type.String()).optional(),\n authorId: field.column(type.Uuid()),\n createdAt: field.column(type.DateTime()).default(now()).onCreate(gen.now()),\n updatedAt: field.column(type.temporal.UpdatedAt()),\n },\n });\n\n return {\n models: {\n User: User.relations({\n posts: rel.hasMany(Post, { by: 'authorId' }),\n }),\n Post: Post.relations({\n author: rel.belongsTo(User, { from: 'authorId', to: 'id' }),\n }),\n },\n };\n});\n`;\n}\nfunction databaseFile() {\n\treturn `import 'dotenv/config';\nimport postgres from '${moduleBase}/runtime';\nimport { contractFromJson } from '${moduleBase}/static';\nimport type { Contract } from './contract.d.js';\nimport contractJson from './contract.json' with { type: 'json' };\n\nexport const contract = contractFromJson<Contract>(contractJson);\n\nexport const db = postgres({\n contract,\n url: process.env['DATABASE_URL']!,\n});\n`;\n}\nfunction envExample() {\n\treturn [\n\t\t\"# Connection string for PostgreSQL.\",\n\t\t`# Requires PostgreSQL >= ${POSTGRES_MIN_SERVER_VERSION}.`,\n\t\t\"\",\n\t\t\"DATABASE_URL=\\\"postgresql://user:password@localhost:5432/mydb\\\"\",\n\t\t\"\"\n\t].join(\"\\n\");\n}\n//#endregion\n//#region src/init/init-contribution.ts\nfunction quickReference(input) {\n\tconst schemaDir = dirname(input.schemaPath);\n\treturn renderTemplate(\"init-quick-reference.md\", {\n\t\tschemaPath: input.schemaPath,\n\t\tschemaDir,\n\t\tdbImportPath: `./${schemaDir}/db`,\n\t\tpkgRun: input.cliCommand,\n\t\tpkg: moduleBase,\n\t\tconfigEntrypoint: configModule,\n\t\tschemaSample: contractSample(input.mode),\n\t\trequirements: input.requirements\n\t});\n}\nfunction prisma7QuickReference(input) {\n\treturn renderTemplate(\"init-quick-reference-prisma7.md\", {\n\t\tschemaPath: input.schemaPath,\n\t\toutputDir: input.outputDir,\n\t\tdbImportPath: `./${input.outputDir}/db`,\n\t\tpkgRun: input.cliCommand,\n\t\tpkg: moduleBase,\n\t\tconfigEntrypoint: configModule,\n\t\trequirements: input.requirements,\n\t\tprisma7ConfigSentence: input.prisma7Config === void 0 ? \"\" : ` Prisma 7 reads its own config from \\`${input.prisma7Config}\\`.`,\n\t\tprisma7ConfigRow: input.prisma7Config === void 0 ? \"\" : `\\n| [\\`${input.prisma7Config}\\`](${input.prisma7Config}) | Prisma 7 CLI configuration |`\n\t});\n}\nfunction readme(input) {\n\tconst run = input.runScript;\n\treturn renderTemplate(\"init-readme.md\", {\n\t\tprojectName: input.projectName,\n\t\tcontractPath: input.contractPath,\n\t\trunDev: run(\"dev\"),\n\t\trunContractEmit: run(\"contract:emit\"),\n\t\trunDbInit: run(\"db:init\"),\n\t\trunDbUpdate: run(\"db:update\"),\n\t\trunMigrationPlan: run(\"migration:plan\"),\n\t\trunMigrate: run(\"migrate\"),\n\t\trunDbSeed: run(\"db:seed\")\n\t});\n}\nconst contribution = {\n\tlabel: \"PostgreSQL\",\n\tconfigModule,\n\tpeerPackages: [\"pg\"],\n\tauthoringModes: [\"psl\", \"typescript\"],\n\tstarterContract,\n\tcontractSample,\n\tdatabaseFile,\n\tenvExample,\n\tquickReference,\n\treadme,\n\tserverRequirement: {\n\t\tminVersion: POSTGRES_MIN_SERVER_VERSION,\n\t\tcheckCommand: \"SELECT version()\"\n\t},\n\tprobe: (databaseUrl, signal) => probePostgres(databaseUrl, signal),\n\tprisma7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AI;EACvC,cAAc,MAAM;CACrB,CAAC;AACF;AACA,SAAS,sBAAsB,OAAO;CACrC,OAAO,eAAe,mCAAmC;EACxD,YAAY,MAAM;EAClB,WAAW,MAAM;EACjB,cAAc,KAAK,MAAM,UAAU;EACnC,QAAQ,MAAM;EACd,KAAK;EACL,kBAAkB;EAClB,cAAc,MAAM;EACpB,uBAAuB,MAAM,kBAAkB,KAAK,IAAI,KAAK,yCAAyC,MAAM,cAAc;EAC1H,kBAAkB,MAAM,kBAAkB,KAAK,IAAI,KAAK,UAAU,MAAM,cAAc,MAAM,MAAM,cAAc;CACjH,CAAC;AACF;AACA,SAAS,OAAO,OAAO;CACtB,MAAM,MAAM,MAAM;CAClB,OAAO,eAAe,kBAAkB;EACvC,aAAa,MAAM;EACnB,cAAc,MAAM;EACpB,QAAQ,IAAI,KAAK;EACjB,iBAAiB,IAAI,eAAe;EACpC,WAAW,IAAI,SAAS;EACxB,aAAa,IAAI,WAAW;EAC5B,kBAAkB,IAAI,gBAAgB;EACtC,YAAY,IAAI,SAAS;EACzB,WAAW,IAAI,SAAS;CACzB,CAAC;AACF;AACA,MAAM,eAAe;CACpB,OAAO;CACP;CACA,cAAc,CAAC,IAAI;CACnB,gBAAgB,CAAC,OAAO,YAAY;CACpC;CACA;CACA;CACA;CACA;CACA;CACA,mBAAmB;EAClB,YAAY;EACZ,cAAc;CACf;CACA,QAAQ,aAAa,WAAW,cAAc,aAAa,MAAM;CACjE;AACD"}
1
+ {"version":3,"file":"init.mjs","names":[],"sources":["../../../../3-targets/postgres/9-facade/dist/init.mjs"],"sourcesContent":["import { t as moduleBase } from \"./module-base-C02qpQ9x.mjs\";\nimport { dirname, join } from \"pathe\";\nimport { POSTGRES_MIN_SERVER_VERSION } from \"@internal/target-postgres/server-version\";\nimport { readFileSync } from \"node:fs\";\n//#region src/init/probe.ts\n/**\n* Extracts the numeric prefix from a Postgres `version()` row, e.g.\n*\n* `PostgreSQL 14.10 on x86_64-pc-linux-gnu, ...` → `\"14.10\"`\n* `PostgreSQL 16beta1 on …` → `\"16\"` (we\n* conservatively drop the suffix; minimum-version comparisons\n* treat 16beta1 as 16, which is what every reasonable user\n* expects).\n*\n* `undefined` when the row holds no PostgreSQL version.\n*/\nfunction parsePostgresVersion(versionString) {\n\treturn versionString.match(/PostgreSQL\\s+(\\d+(?:\\.\\d+)?)/i)?.[1];\n}\n/** How long the probe waits for the server to accept the connection, and then to answer. */\nconst PROBE_TIMEOUT_MILLIS = 2e4;\nfunction causeMessage(error) {\n\treturn error instanceof Error ? error.message : String(error);\n}\nfunction isModuleNotFound(error) {\n\treturn error instanceof Error && Reflect.get(error, \"code\") === \"ERR_MODULE_NOT_FOUND\";\n}\nasync function probePostgres(databaseUrl, signal, loadDriver = () => import(\"pg\")) {\n\tlet pg;\n\ttry {\n\t\tpg = await loadDriver();\n\t} catch (error) {\n\t\treturn {\n\t\t\tkind: isModuleNotFound(error) ? \"driver-missing\" : \"driver-failed\",\n\t\t\tdriver: \"pg\",\n\t\t\tcause: causeMessage(error)\n\t\t};\n\t}\n\tconst client = new pg.default.Client({\n\t\tconnectionString: databaseUrl,\n\t\tconnectionTimeoutMillis: PROBE_TIMEOUT_MILLIS,\n\t\tquery_timeout: PROBE_TIMEOUT_MILLIS\n\t});\n\tclient.on(\"error\", () => {});\n\tconst endOnAbort = () => {\n\t\tclient.end().catch(() => void 0);\n\t};\n\tsignal.addEventListener(\"abort\", endOnAbort, { once: true });\n\ttry {\n\t\tawait client.connect();\n\t\tconst versionQuery = {\n\t\t\ttext: \"SELECT version() as version\",\n\t\t\tquery_timeout: PROBE_TIMEOUT_MILLIS\n\t\t};\n\t\tlet result;\n\t\ttry {\n\t\t\tresult = await client.query(versionQuery);\n\t\t} catch (error) {\n\t\t\treturn {\n\t\t\t\tkind: \"version-unreadable\",\n\t\t\t\tdetail: `SELECT version() failed: ${causeMessage(error)}`\n\t\t\t};\n\t\t}\n\t\tconst versionString = String(result.rows[0]?.version ?? \"\");\n\t\tconst serverVersion = parsePostgresVersion(versionString);\n\t\treturn serverVersion === void 0 ? {\n\t\t\tkind: \"version-unreadable\",\n\t\t\tdetail: `could not parse PostgreSQL version from \\`${versionString}\\``\n\t\t} : {\n\t\t\tkind: \"server-version\",\n\t\t\tserverVersion\n\t\t};\n\t} finally {\n\t\tsignal.removeEventListener(\"abort\", endOnAbort);\n\t\tawait client.end().catch(() => void 0);\n\t}\n}\n//#endregion\n//#region src/init/render.ts\n/**\n* Fills each `{{name}}` of the template in one pass, so a value is inserted as it is: a value\n* holding `$&` or another placeholder is not read again.\n*/\nfunction renderTemplate(templateFile, vars) {\n\treturn readFileSync(join(import.meta.dirname, templateFile), \"utf-8\").replace(/\\{\\{(\\w+)\\}\\}/g, (placeholder, name) => Object.hasOwn(vars, name) ? vars[name] ?? placeholder : placeholder);\n}\n//#endregion\n//#region src/init/templates.ts\nconst configModule = `${moduleBase}/config`;\nconst builder = `${moduleBase}/contract-builder`;\nfunction starterContract(mode) {\n\treturn mode === \"typescript\" ? starterContractTs() : starterContractPsl();\n}\nfunction contractSample(mode) {\n\treturn mode === \"typescript\" ? contractSampleTs() : contractSamplePsl();\n}\n/** The type a query result gives `id` in the starter contract: an integer in PSL, UUID text in TypeScript. */\nfunction starterIdType(mode) {\n\treturn mode === \"typescript\" ? \"string\" : \"number\";\n}\nfunction contractSamplePsl() {\n\treturn `\\`\\`\\`prisma\nmodel User {\n id Int @id @default(autoincrement())\n email String @unique\n username String?\n name String?\n}\n\\`\\`\\``;\n}\nfunction contractSampleTs() {\n\treturn `\\`\\`\\`typescript\nimport { defineContract } from '${builder}';\n\nexport const contract = defineContract(\n {},\n ({ field, model, gen, type }) => ({\n models: {\n User: model('User', {\n fields: {\n id: field.column(type.Uuid()).id().onCreate(gen.uuid(7)),\n email: field.column(type.String()).unique(),\n username: field.column(type.String()).optional(),\n name: field.column(type.String()).optional(),\n },\n }),\n },\n }),\n);\n\\`\\`\\``;\n}\nfunction starterContractPsl() {\n\treturn `// use prisma-8\n\nmodel User {\n id Int @id @default(autoincrement())\n email String @unique\n username String?\n name String?\n posts Post[]\n createdAt DateTime @default(now()) @onCreate(now())\n updatedAt temporal.UpdatedAt\n}\n\nmodel Post {\n id Int @id @default(autoincrement())\n title String\n content String?\n author User @relation(fields: [authorId], references: [id])\n authorId Int\n createdAt DateTime @default(now()) @onCreate(now())\n updatedAt temporal.UpdatedAt\n}\n`;\n}\nfunction starterContractTs() {\n\treturn `import { defineContract, now } from '${builder}';\n\nexport const contract = defineContract({}, ({ field, model, rel, gen, type }) => {\n const User = model('User', {\n fields: {\n id: field.column(type.Uuid()).id().onCreate(gen.uuid(7)),\n email: field.column(type.String()).unique(),\n username: field.column(type.String()).optional(),\n name: field.column(type.String()).optional(),\n createdAt: field.column(type.DateTime()).default(now()).onCreate(gen.now()),\n updatedAt: field.column(type.temporal.UpdatedAt()),\n },\n });\n\n const Post = model('Post', {\n fields: {\n id: field.column(type.Uuid()).id().onCreate(gen.uuid(7)),\n title: field.column(type.String()),\n content: field.column(type.String()).optional(),\n authorId: field.column(type.Uuid()),\n createdAt: field.column(type.DateTime()).default(now()).onCreate(gen.now()),\n updatedAt: field.column(type.temporal.UpdatedAt()),\n },\n });\n\n return {\n models: {\n User: User.relations({\n posts: rel.hasMany(Post, { by: 'authorId' }),\n }),\n Post: Post.relations({\n author: rel.belongsTo(User, { from: 'authorId', to: 'id' }),\n }),\n },\n };\n});\n`;\n}\nfunction databaseFile() {\n\treturn `import 'dotenv/config';\nimport postgres from '${moduleBase}/runtime';\nimport { contractFromJson } from '${moduleBase}/static';\nimport type { Contract } from './contract.d.js';\nimport contractJson from './contract.json' with { type: 'json' };\n\nexport const contract = contractFromJson<Contract>(contractJson);\n\nexport const db = postgres({\n contract,\n url: process.env['DATABASE_URL']!,\n});\n`;\n}\nfunction envExample() {\n\treturn [\n\t\t\"# Connection string for PostgreSQL.\",\n\t\t`# Requires PostgreSQL >= ${POSTGRES_MIN_SERVER_VERSION}.`,\n\t\t\"\",\n\t\t\"DATABASE_URL=\\\"postgresql://user:password@localhost:5432/mydb\\\"\",\n\t\t\"\"\n\t].join(\"\\n\");\n}\n//#endregion\n//#region src/init/init-contribution.ts\nfunction quickReference(input) {\n\tconst schemaDir = dirname(input.schemaPath);\n\treturn renderTemplate(\"init-quick-reference.md\", {\n\t\tschemaPath: input.schemaPath,\n\t\tschemaDir,\n\t\tdbImportPath: `./${schemaDir}/db`,\n\t\tpkgRun: input.cliCommand,\n\t\tpkg: moduleBase,\n\t\tconfigEntrypoint: configModule,\n\t\tschemaSample: contractSample(input.mode),\n\t\tidType: starterIdType(input.mode),\n\t\trequirements: input.requirements\n\t});\n}\nfunction prisma7QuickReference(input) {\n\treturn renderTemplate(\"init-quick-reference-prisma7.md\", {\n\t\tschemaPath: input.schemaPath,\n\t\toutputDir: input.outputDir,\n\t\tdbImportPath: `./${input.outputDir}/db`,\n\t\tpkgRun: input.cliCommand,\n\t\tpkg: moduleBase,\n\t\tconfigEntrypoint: configModule,\n\t\trequirements: input.requirements,\n\t\tprisma7ConfigSentence: input.prisma7Config === void 0 ? \"\" : ` Prisma 7 reads its own config from \\`${input.prisma7Config}\\`.`,\n\t\tprisma7ConfigRow: input.prisma7Config === void 0 ? \"\" : `\\n| [\\`${input.prisma7Config}\\`](${input.prisma7Config}) | Prisma 7 CLI configuration |`\n\t});\n}\nfunction readme(input) {\n\tconst run = input.runScript;\n\treturn renderTemplate(\"init-readme.md\", {\n\t\tprojectName: input.projectName,\n\t\tcontractPath: input.contractPath,\n\t\trunDev: run(\"dev\"),\n\t\trunContractEmit: run(\"contract:emit\"),\n\t\trunDbInit: run(\"db:init\"),\n\t\trunDbUpdate: run(\"db:update\"),\n\t\trunMigrationPlan: run(\"migration:plan\"),\n\t\trunMigrate: run(\"migrate\"),\n\t\trunDbSeed: run(\"db:seed\")\n\t});\n}\nconst contribution = {\n\tlabel: \"PostgreSQL\",\n\tconfigModule,\n\tpeerPackages: [\"pg\"],\n\tauthoringModes: [\"psl\", \"typescript\"],\n\tstarterContract,\n\tcontractSample,\n\tdatabaseFile,\n\tenvExample,\n\tquickReference,\n\treadme,\n\tserverRequirement: {\n\t\tminVersion: POSTGRES_MIN_SERVER_VERSION,\n\t\tcheckCommand: \"SELECT version()\"\n\t},\n\tprobe: (databaseUrl, signal) => probePostgres(databaseUrl, signal),\n\tprisma7QuickReference\n};\n//#endregion\nexport { contribution as default };\n\n//# sourceMappingURL=init.mjs.map"],"mappings":";;;;;;;;;;;;;;;;AAgBA,SAAS,qBAAqB,eAAe;CAC5C,OAAO,cAAc,MAAM,+BAA+B,CAAC,GAAG;AAC/D;;AAEA,MAAM,uBAAuB;AAC7B,SAAS,aAAa,OAAO;CAC5B,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAC7D;AACA,SAAS,iBAAiB,OAAO;CAChC,OAAO,iBAAiB,SAAS,QAAQ,IAAI,OAAO,MAAM,MAAM;AACjE;AACA,eAAe,cAAc,aAAa,QAAQ,mBAAmB,OAAO,OAAO;CAClF,IAAI;CACJ,IAAI;EACH,KAAK,MAAM,WAAW;CACvB,SAAS,OAAO;EACf,OAAO;GACN,MAAM,iBAAiB,KAAK,IAAI,mBAAmB;GACnD,QAAQ;GACR,OAAO,aAAa,KAAK;EAC1B;CACD;CACA,MAAM,SAAS,IAAI,GAAG,QAAQ,OAAO;EACpC,kBAAkB;EAClB,yBAAyB;EACzB,eAAe;CAChB,CAAC;CACD,OAAO,GAAG,eAAe,CAAC,CAAC;CAC3B,MAAM,mBAAmB;EACxB,OAAO,IAAI,CAAC,CAAC,YAAY,KAAK,CAAC;CAChC;CACA,OAAO,iBAAiB,SAAS,YAAY,EAAE,MAAM,KAAK,CAAC;CAC3D,IAAI;EACH,MAAM,OAAO,QAAQ;EACrB,MAAM,eAAe;GACpB,MAAM;GACN,eAAe;EAChB;EACA,IAAI;EACJ,IAAI;GACH,SAAS,MAAM,OAAO,MAAM,YAAY;EACzC,SAAS,OAAO;GACf,OAAO;IACN,MAAM;IACN,Q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import { a as toDriverCursorOptions, o as validateCursorOptions, s as validateTransactionOptions } from "./postgres-options-B0YrJID9-YkuL0Mao.mjs";
2
- import { i as connectWithBinding, r as PostgresBindingRules, s as resolveOptionalPostgresBinding } from "./binding-BN5X69gf-CIDnIWcw.mjs";
1
+ import { a as toDriverCursorOptions, o as validateCursorOptions, s as validateTransactionOptions } from "./postgres-options-C2QR33Rg-BTKXQic1.mjs";
2
+ import { i as connectWithBinding, r as PostgresBindingRules, s as resolveOptionalPostgresBinding } from "./binding-Q21lKDeA-CQ2oKakQ.mjs";
3
3
  export { type PostgresBindingRules, connectWithBinding, resolveOptionalPostgresBinding, toDriverCursorOptions, validateCursorOptions, validateTransactionOptions };
@@ -1,3 +1,3 @@
1
1
  import { i as validateTransactionOptions, n as toDriverCursorOptions, r as validateCursorOptions } from "./postgres-options-CZyV9Him-2OSYJKqo.mjs";
2
- import { a as resolveOptionalPostgresBinding, t as connectWithBinding } from "./binding-DkfRsUZE-Co5ssUZw.mjs";
2
+ import { a as resolveOptionalPostgresBinding, t as connectWithBinding } from "./binding-Cg5nms1Y-Bk8OB_I5.mjs";
3
3
  export { connectWithBinding, resolveOptionalPostgresBinding, toDriverCursorOptions, validateCursorOptions, validateTransactionOptions };
@@ -1,2 +1,2 @@
1
- import { n as buildPostgresStaticContext } from "./postgres-static-Dp8FC0q0-L7yDo9e1.mjs";
1
+ import { n as buildPostgresStaticContext } from "./postgres-static-BTm72P3P-h_XgLqsh.mjs";
2
2
  export { buildPostgresStaticContext };
@@ -1,2 +1,2 @@
1
- import { o as buildPostgresQueryMembers } from "./postgres-members-DQvChDJ--ByodBWAn.mjs";
1
+ import { o as buildPostgresQueryMembers } from "./postgres-members-D1VTNrCz-8ShwbWgk.mjs";
2
2
  export { buildPostgresQueryMembers };
@@ -1,2 +1,2 @@
1
- import { n as validatePostgresContract } from "./contract-from-json-CuzxHkGa-CoiMbCP1.mjs";
1
+ import { n as validatePostgresContract } from "./contract-from-json-C6uR3W9i-DVRdyn3s.mjs";
2
2
  export { validatePostgresContract };
@@ -1,5 +1,5 @@
1
1
  import { t as PostgresTargetId } from "./postgres-target-id-C9d1Qq7Q-70StSvqm.mjs";
2
- import { i as PostgresTransactionOptions } from "./postgres-options-B0YrJID9-YkuL0Mao.mjs";
2
+ import { i as PostgresTransactionOptions } from "./postgres-options-C2QR33Rg-BTKXQic1.mjs";
3
3
  import { n as PostgresStaticContext, t as NamespacedNativeEnums } from "./postgres-static-S38TCEK6-Dswb17fx.mjs";
4
4
  import { NamespacedEnums } from "@prisma/orm-framework/contract/enum-accessor";
5
5
  import { ExecutionContext, Runtime, SqlExecutionStackWithDriver, ToSqlMember, TransactionContext } from "@prisma/orm-family-sql/runtime";
@@ -8,7 +8,7 @@ import { Contract } from "@prisma/orm-framework/contract/types";
8
8
  import { SqlStorage } from "@prisma/orm-family-sql/contract/types";
9
9
  import { Db, RawLane } from "@prisma/orm-family-sql/builder/types";
10
10
  import { RuntimeScope } from "@prisma/orm-family-sql/relational-core/types";
11
- //#region ../../../3-targets/postgres/9-facade/dist/postgres-members-DQvChDJ-.d.mts
11
+ //#region ../../../3-targets/postgres/9-facade/dist/postgres-members-D1VTNrCz.d.mts
12
12
  //#region src/runtime/postgres-members.d.ts
13
13
  type OrmClient<TContract extends Contract<SqlStorage>, TCollections extends CollectionClasses> = ReturnType<typeof orm<TContract, TCollections>>;
14
14
  /** The query members of a Postgres client, which its transactions and Supabase's role-bound clients offer with the same types. */
@@ -48,4 +48,4 @@ interface PostgresLifecycleMembers {
48
48
  }
49
49
  //#endregion
50
50
  export { PostgresTransactionContext as a, PostgresStaticMembers as i, PostgresQueryMembers as n, buildPostgresQueryMembers as o, PostgresRuntimeBoundMembers as r, PostgresLifecycleMembers as t };
51
- //# sourceMappingURL=postgres-members-DQvChDJ--ByodBWAn.d.mts.map
51
+ //# sourceMappingURL=postgres-members-D1VTNrCz-8ShwbWgk.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"postgres-members-DQvChDJ--ByodBWAn.d.mts","names":[],"sources":["../../../../3-targets/postgres/9-facade/dist/postgres-members-DQvChDJ-.d.mts"],"mappings":";;;;;;;;;;;;KAWK,UAAU,kBAAkB,SAAS,aAAa,qBAAqB,qBAAqB,kBAAkB,IAAI,WAAW;;UAExH,qBAAqB,kBAAkB,SAAS,aAAa,qBAAqB,oBAAoB,6BAA6B,cAAc,YAAY,cAAc;WAC1K,KAAK,GAAG;WACR,KAAK,UAAU,WAAW;WAC1B,KAAK,QAAQ;;UAEd,2BAA2B,kBAAkB,SAAS,aAAa,qBAAqB,oBAAoB,6BAA6B,oBAAoB,qBAAqB,WAAW;WAC5L,OAAO,gBAAgB;WACvB,aAAa,sBAAsB;EAC5C,YAAY,GAAG,KAAK,IAAI,2BAA2B,WAAW,kBAAkB,YAAY,KAAK,QAAQ;;UAEjG,4BAA4B,kBAAkB,SAAS,aAAa,qBAAqB;WACxF,SAAS,iBAAiB;WAC1B,aAAa;WACb,KAAK,GAAG;WACR,KAAK,QAAQ;WACb,OAAO;WACP,gBAAgB,KAAK;;;;;iBAKf,0BAA0B,kBAAkB,SAAS,aAAa,qBAAqB,mBAAmB,SAAS,4BAA4B,WAAW,eAAe,OAAO,qBAAqB,KAAK,qBAAqB,WAAW,qBAAqB;UACtQ,sBAAsB,kBAAkB,SAAS,qBAAqB,sBAAsB;WAC3F,OAAO,4BAA4B;;UAEpC,4BAA4B,kBAAkB,SAAS,aAAa,qBAAqB,oBAAoB,6BAA6B,cAAc;WACvJ,KAAK,UAAU,WAAW;EACnC,WAAW;EACX,YAAY,GAAG,KAAK,IAAI,2BAA2B,WAAW,kBAAkB,YAAY,IAAI,UAAU,6BAA6B,QAAQ;;UAEvI;EACR,SAAS;GACR,OAAO,iBAAiB"}
1
+ {"version":3,"file":"postgres-members-D1VTNrCz-8ShwbWgk.d.mts","names":[],"sources":["../../../../3-targets/postgres/9-facade/dist/postgres-members-D1VTNrCz.d.mts"],"mappings":";;;;;;;;;;;;KAWK,UAAU,kBAAkB,SAAS,aAAa,qBAAqB,qBAAqB,kBAAkB,IAAI,WAAW;;UAExH,qBAAqB,kBAAkB,SAAS,aAAa,qBAAqB,oBAAoB,6BAA6B,cAAc,YAAY,cAAc;WAC1K,KAAK,GAAG;WACR,KAAK,UAAU,WAAW;WAC1B,KAAK,QAAQ;;UAEd,2BAA2B,kBAAkB,SAAS,aAAa,qBAAqB,oBAAoB,6BAA6B,oBAAoB,qBAAqB,WAAW;WAC5L,OAAO,gBAAgB;WACvB,aAAa,sBAAsB;EAC5C,YAAY,GAAG,KAAK,IAAI,2BAA2B,WAAW,kBAAkB,YAAY,KAAK,QAAQ;;UAEjG,4BAA4B,kBAAkB,SAAS,aAAa,qBAAqB;WACxF,SAAS,iBAAiB;WAC1B,aAAa;WACb,KAAK,GAAG;WACR,KAAK,QAAQ;WACb,OAAO;WACP,gBAAgB,KAAK;;;;;iBAKf,0BAA0B,kBAAkB,SAAS,aAAa,qBAAqB,mBAAmB,SAAS,4BAA4B,WAAW,eAAe,OAAO,qBAAqB,KAAK,qBAAqB,WAAW,qBAAqB;UACtQ,sBAAsB,kBAAkB,SAAS,qBAAqB,sBAAsB;WAC3F,OAAO,4BAA4B;;UAEpC,4BAA4B,kBAAkB,SAAS,aAAa,qBAAqB,oBAAoB,6BAA6B,cAAc;WACvJ,KAAK,UAAU,WAAW;EACnC,WAAW;EACX,YAAY,GAAG,KAAK,IAAI,2BAA2B,WAAW,kBAAkB,YAAY,IAAI,UAAU,6BAA6B,QAAQ;;UAEvI;EACR,SAAS;GACR,OAAO,iBAAiB"}
@@ -2,13 +2,17 @@ import { t as PostgresTargetId } from "./postgres-target-id-C9d1Qq7Q-70StSvqm.mj
2
2
  import { PostgresIsolationLevel } from "@prisma/orm-target-postgres/target/runtime";
3
3
  import { PostgresDriverCreateOptions } from "@prisma/orm-target-postgres/driver/runtime";
4
4
  import { SqlExecutionOptions } from "@prisma/orm-family-sql/runtime";
5
- //#region ../../../3-targets/postgres/9-facade/dist/postgres-options-B0YrJID9.d.mts
5
+ //#region ../../../3-targets/postgres/9-facade/dist/postgres-options-C2QR33Rg.d.mts
6
6
  //#region src/runtime/postgres-options.d.ts
7
7
  type PostgresDriverCursorOptions = NonNullable<PostgresDriverCreateOptions['cursor']>;
8
- /** Timeouts for the pool a client creates from a url. */
8
+ /** Timeouts and size of the pool a client creates from a url. */
9
9
  interface PostgresPoolOptions {
10
+ /** How long to wait for a new connection to open, and for a pooled one to come free, in milliseconds. 20 seconds by default. */
10
11
  readonly connectionTimeoutMillis?: number;
12
+ /** How long a pooled connection may stay idle before the pool closes it, in milliseconds. 30 seconds by default; 0 keeps idle connections open. */
11
13
  readonly idleTimeoutMillis?: number;
14
+ /** The most connections the pool opens, a positive integer. 10 by default. */
15
+ readonly max?: number;
12
16
  }
13
17
  /**
14
18
  * Server-side cursor for reads. Unset reads the whole result before the first row; set streams
@@ -35,4 +39,4 @@ declare function validateCursorOptions(cursor: PostgresCursorOptions | undefined
35
39
  declare function toDriverCursorOptions(cursor: PostgresCursorOptions | undefined): PostgresDriverCursorOptions;
36
40
  //#endregion
37
41
  export { toDriverCursorOptions as a, PostgresTransactionOptions as i, PostgresExecutionOptions as n, validateCursorOptions as o, PostgresPoolOptions as r, validateTransactionOptions as s, PostgresCursorOptions as t };
38
- //# sourceMappingURL=postgres-options-B0YrJID9-YkuL0Mao.d.mts.map
42
+ //# sourceMappingURL=postgres-options-C2QR33Rg-BTKXQic1.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"postgres-options-C2QR33Rg-BTKXQic1.d.mts","names":[],"sources":["../../../../3-targets/postgres/9-facade/dist/postgres-options-C2QR33Rg.d.mts"],"mappings":";;;;;;KAKK,8BAA8B,YAAY;;UAErC;;WAEC;;WAEA;;WAEA;;;;;;;UAOD;WACC;;;;;;UAMD,iCAAiC,oBAAoB;WACpD,SAAS;WACT,qBAAqB;;UAEtB;WACC,iBAAiB;WACjB;;iBAEM,2BAA2B,SAAS,yCAAyC;iBAC7E,sBAAsB,QAAQ,mCAAmC,iBAAiB;iBAClF,sBAAsB,QAAQ,oCAAoC"}
@@ -1,4 +1,4 @@
1
- import { n as validatePostgresContract } from "./contract-from-json-CuzxHkGa-CoiMbCP1.mjs";
1
+ import { n as validatePostgresContract } from "./contract-from-json-C6uR3W9i-DVRdyn3s.mjs";
2
2
  import { PG_ENUM_CODEC_ID } from "@prisma/orm-target-postgres/target/codec-ids";
3
3
  import postgresTarget from "@prisma/orm-target-postgres/target/runtime";
4
4
  import { blindCast } from "@prisma/orm-framework/utils/casts";
@@ -6,7 +6,7 @@ import { buildNamespacedEnums, createEnumAccessor } from "@prisma/orm-framework/
6
6
  import postgresAdapter from "@prisma/orm-target-postgres/adapter/runtime";
7
7
  import { createExecutionContext, createSqlExecutionStack, createToSql } from "@prisma/orm-family-sql/runtime";
8
8
  import { createRawLane, sql } from "@prisma/orm-family-sql/builder/runtime";
9
- //#region ../../../3-targets/postgres/9-facade/dist/postgres-static-Dp8FC0q0.mjs
9
+ //#region ../../../3-targets/postgres/9-facade/dist/postgres-static-BTm72P3P.mjs
10
10
  /**
11
11
  * The accessors for one namespace's value sets, leaving out each value set whose name is a domain enum's in the same namespace: a domain enum's value set takes its enum's name and namespace, and `db.enums` holds that enum. The rest are native enum types, because `native_enum` is the only pack entity that derives a value set today. Reads plain contract data, so a `validateContract`'d JSON contract works as well as a hydrated one. A member is a value, as in `CREATE TYPE … AS ENUM ('a', 'b')`, so each value is also its own name.
12
12
  */
@@ -77,4 +77,4 @@ function postgresStatic(options) {
77
77
  //#endregion
78
78
  export { buildPostgresStaticContext as n, postgresStatic as r, buildNamespacedNativeEnums as t };
79
79
 
80
- //# sourceMappingURL=postgres-static-Dp8FC0q0-L7yDo9e1.mjs.map
80
+ //# sourceMappingURL=postgres-static-BTm72P3P-h_XgLqsh.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"postgres-static-Dp8FC0q0-L7yDo9e1.mjs","names":[],"sources":["../../../../3-targets/postgres/9-facade/dist/postgres-static-Dp8FC0q0.mjs"],"sourcesContent":["import { n as validatePostgresContract } from \"./contract-from-json-CuzxHkGa.mjs\";\nimport { PG_ENUM_CODEC_ID } from \"@internal/target-postgres/codec-ids\";\nimport postgresTarget from \"@internal/target-postgres/runtime\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { buildNamespacedEnums, createEnumAccessor } from \"@internal/contract/enum-accessor\";\nimport postgresAdapter from \"@internal/adapter-postgres/runtime\";\nimport { createExecutionContext, createSqlExecutionStack, createToSql } from \"@internal/sql-runtime\";\nimport { createRawLane, sql } from \"@internal/sql-builder/runtime\";\n//#region src/runtime/native-enums.ts\n/**\n* The accessors for one namespace's value sets, leaving out each value set whose name is a domain enum's in the same namespace: a domain enum's value set takes its enum's name and namespace, and `db.enums` holds that enum. The rest are native enum types, because `native_enum` is the only pack entity that derives a value set today. Reads plain contract data, so a `validateContract`'d JSON contract works as well as a hydrated one. A member is a value, as in `CREATE TYPE … AS ENUM ('a', 'b')`, so each value is also its own name.\n*/\nfunction buildNativeEnumsMapForNamespace(storage, domain, namespaceId) {\n\tconst result = {};\n\tconst valueSets = storage.namespaces[namespaceId]?.entries.valueSet;\n\tif (!valueSets) return result;\n\tconst domainEnums = domain.namespaces[namespaceId]?.enum ?? {};\n\tfor (const [name, valueSet] of Object.entries(valueSets)) {\n\t\tif (Object.hasOwn(domainEnums, name)) continue;\n\t\tresult[name] = createEnumAccessor({\n\t\t\tcodecId: PG_ENUM_CODEC_ID,\n\t\t\tmembers: valueSet.values.map((value) => ({\n\t\t\t\tname: String(value),\n\t\t\t\tvalue\n\t\t\t}))\n\t\t});\n\t}\n\treturn result;\n}\nfunction buildNamespacedNativeEnums(storage, domain) {\n\tconst result = {};\n\tfor (const namespaceId of Object.keys(storage.namespaces)) result[namespaceId] = buildNativeEnumsMapForNamespace(storage, domain, namespaceId);\n\treturn result;\n}\n//#endregion\n//#region src/static/postgres-static.ts\nfunction buildPostgresStaticContext(contract, context, stack) {\n\tconst { rawCodecInferer } = stack.adapter;\n\tconst sqlDb = sql({\n\t\tcontext,\n\t\trawCodecInferer\n\t});\n\tconst raw = createRawLane({\n\t\tcontext,\n\t\trawCodecInferer\n\t});\n\treturn {\n\t\tcontext,\n\t\tcontract,\n\t\tenums: Object.freeze(buildNamespacedEnums(context.contract.domain, (codecId) => context.contractCodecs.forCodecRef({ codecId }))),\n\t\tnativeEnums: blindCast(Object.freeze(buildNamespacedNativeEnums(context.contract.storage, context.contract.domain))),\n\t\tsql: sqlDb,\n\t\traw,\n\t\ttoSql: createToSql(stack, contract)\n\t};\n}\n/**\n* The query surfaces of a Postgres client without a driver: `sql`, `raw`, `enums`, `nativeEnums`\n* and `toSql`. Use it where loading `pg` is not wanted, for example in browser code that reads\n* enums.\n*\n* @example\n* ```ts\n* const { enums } = postgresStatic({ contract: contractFromJson<Contract>(contractJson) });\n* ```\n*/\nfunction postgresStatic(options) {\n\tconst contract = validatePostgresContract(options.contract);\n\tconst stack = createSqlExecutionStack({\n\t\ttarget: postgresTarget,\n\t\tadapter: postgresAdapter,\n\t\textensions: options.extensions ?? []\n\t});\n\treturn buildPostgresStaticContext(contract, createExecutionContext({\n\t\tcontract,\n\t\tstack\n\t}), stack);\n}\n//#endregion\nexport { postgresStatic as n, buildNamespacedNativeEnums as r, buildPostgresStaticContext as t };\n\n//# sourceMappingURL=postgres-static-Dp8FC0q0.mjs.map"],"mappings":";;;;;;;;;;;;AAYA,SAAS,gCAAgC,SAAS,QAAQ,aAAa;CACtE,MAAM,SAAS,CAAC;CAChB,MAAM,YAAY,QAAQ,WAAW,YAAY,EAAE,QAAQ;CAC3D,IAAI,CAAC,WAAW,OAAO;CACvB,MAAM,cAAc,OAAO,WAAW,YAAY,EAAE,QAAQ,CAAC;CAC7D,KAAK,MAAM,CAAC,MAAM,aAAa,OAAO,QAAQ,SAAS,GAAG;EACzD,IAAI,OAAO,OAAO,aAAa,IAAI,GAAG;EACtC,OAAO,QAAQ,mBAAmB;GACjC,SAAS;GACT,SAAS,SAAS,OAAO,KAAK,WAAW;IACxC,MAAM,OAAO,KAAK;IAClB;GACD,EAAE;EACH,CAAC;CACF;CACA,OAAO;AACR;AACA,SAAS,2BAA2B,SAAS,QAAQ;CACpD,MAAM,SAAS,CAAC;CAChB,KAAK,MAAM,eAAe,OAAO,KAAK,QAAQ,UAAU,GAAG,OAAO,eAAe,gCAAgC,SAAS,QAAQ,WAAW;CAC7I,OAAO;AACR;AAGA,SAAS,2BAA2B,UAAU,SAAS,OAAO;CAC7D,MAAM,EAAE,oBAAoB,MAAM;CAClC,MAAM,QAAQ,IAAI;EACjB;EACA;CACD,CAAC;CACD,MAAM,MAAM,cAAc;EACzB;EACA;CACD,CAAC;CACD,OAAO;EACN;EACA;EACA,OAAO,OAAO,OAAO,qBAAqB,QAAQ,SAAS,SAAS,YAAY,QAAQ,eAAe,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC;EAChI,aAAa,UAAU,OAAO,OAAO,2BAA2B,QAAQ,SAAS,SAAS,QAAQ,SAAS,MAAM,CAAC,CAAC;EACnH,KAAK;EACL;EACA,OAAO,YAAY,OAAO,QAAQ;CACnC;AACD;;;;;;;;;;;AAWA,SAAS,eAAe,SAAS;CAChC,MAAM,WAAW,yBAAyB,QAAQ,QAAQ;CAC1D,MAAM,QAAQ,wBAAwB;EACrC,QAAQ;EACR,SAAS;EACT,YAAY,QAAQ,cAAc,CAAC;CACpC,CAAC;CACD,OAAO,2BAA2B,UAAU,uBAAuB;EAClE;EACA;CACD,CAAC,GAAG,KAAK;AACV"}
1
+ {"version":3,"file":"postgres-static-BTm72P3P-h_XgLqsh.mjs","names":[],"sources":["../../../../3-targets/postgres/9-facade/dist/postgres-static-BTm72P3P.mjs"],"sourcesContent":["import { n as validatePostgresContract } from \"./contract-from-json-C6uR3W9i.mjs\";\nimport { PG_ENUM_CODEC_ID } from \"@internal/target-postgres/codec-ids\";\nimport postgresTarget from \"@internal/target-postgres/runtime\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { buildNamespacedEnums, createEnumAccessor } from \"@internal/contract/enum-accessor\";\nimport postgresAdapter from \"@internal/adapter-postgres/runtime\";\nimport { createExecutionContext, createSqlExecutionStack, createToSql } from \"@internal/sql-runtime\";\nimport { createRawLane, sql } from \"@internal/sql-builder/runtime\";\n//#region src/runtime/native-enums.ts\n/**\n* The accessors for one namespace's value sets, leaving out each value set whose name is a domain enum's in the same namespace: a domain enum's value set takes its enum's name and namespace, and `db.enums` holds that enum. The rest are native enum types, because `native_enum` is the only pack entity that derives a value set today. Reads plain contract data, so a `validateContract`'d JSON contract works as well as a hydrated one. A member is a value, as in `CREATE TYPE … AS ENUM ('a', 'b')`, so each value is also its own name.\n*/\nfunction buildNativeEnumsMapForNamespace(storage, domain, namespaceId) {\n\tconst result = {};\n\tconst valueSets = storage.namespaces[namespaceId]?.entries.valueSet;\n\tif (!valueSets) return result;\n\tconst domainEnums = domain.namespaces[namespaceId]?.enum ?? {};\n\tfor (const [name, valueSet] of Object.entries(valueSets)) {\n\t\tif (Object.hasOwn(domainEnums, name)) continue;\n\t\tresult[name] = createEnumAccessor({\n\t\t\tcodecId: PG_ENUM_CODEC_ID,\n\t\t\tmembers: valueSet.values.map((value) => ({\n\t\t\t\tname: String(value),\n\t\t\t\tvalue\n\t\t\t}))\n\t\t});\n\t}\n\treturn result;\n}\nfunction buildNamespacedNativeEnums(storage, domain) {\n\tconst result = {};\n\tfor (const namespaceId of Object.keys(storage.namespaces)) result[namespaceId] = buildNativeEnumsMapForNamespace(storage, domain, namespaceId);\n\treturn result;\n}\n//#endregion\n//#region src/static/postgres-static.ts\nfunction buildPostgresStaticContext(contract, context, stack) {\n\tconst { rawCodecInferer } = stack.adapter;\n\tconst sqlDb = sql({\n\t\tcontext,\n\t\trawCodecInferer\n\t});\n\tconst raw = createRawLane({\n\t\tcontext,\n\t\trawCodecInferer\n\t});\n\treturn {\n\t\tcontext,\n\t\tcontract,\n\t\tenums: Object.freeze(buildNamespacedEnums(context.contract.domain, (codecId) => context.contractCodecs.forCodecRef({ codecId }))),\n\t\tnativeEnums: blindCast(Object.freeze(buildNamespacedNativeEnums(context.contract.storage, context.contract.domain))),\n\t\tsql: sqlDb,\n\t\traw,\n\t\ttoSql: createToSql(stack, contract)\n\t};\n}\n/**\n* The query surfaces of a Postgres client without a driver: `sql`, `raw`, `enums`, `nativeEnums`\n* and `toSql`. Use it where loading `pg` is not wanted, for example in browser code that reads\n* enums.\n*\n* @example\n* ```ts\n* const { enums } = postgresStatic({ contract: contractFromJson<Contract>(contractJson) });\n* ```\n*/\nfunction postgresStatic(options) {\n\tconst contract = validatePostgresContract(options.contract);\n\tconst stack = createSqlExecutionStack({\n\t\ttarget: postgresTarget,\n\t\tadapter: postgresAdapter,\n\t\textensions: options.extensions ?? []\n\t});\n\treturn buildPostgresStaticContext(contract, createExecutionContext({\n\t\tcontract,\n\t\tstack\n\t}), stack);\n}\n//#endregion\nexport { postgresStatic as n, buildNamespacedNativeEnums as r, buildPostgresStaticContext as t };\n\n//# sourceMappingURL=postgres-static-BTm72P3P.mjs.map"],"mappings":";;;;;;;;;;;;AAYA,SAAS,gCAAgC,SAAS,QAAQ,aAAa;CACtE,MAAM,SAAS,CAAC;CAChB,MAAM,YAAY,QAAQ,WAAW,YAAY,EAAE,QAAQ;CAC3D,IAAI,CAAC,WAAW,OAAO;CACvB,MAAM,cAAc,OAAO,WAAW,YAAY,EAAE,QAAQ,CAAC;CAC7D,KAAK,MAAM,CAAC,MAAM,aAAa,OAAO,QAAQ,SAAS,GAAG;EACzD,IAAI,OAAO,OAAO,aAAa,IAAI,GAAG;EACtC,OAAO,QAAQ,mBAAmB;GACjC,SAAS;GACT,SAAS,SAAS,OAAO,KAAK,WAAW;IACxC,MAAM,OAAO,KAAK;IAClB;GACD,EAAE;EACH,CAAC;CACF;CACA,OAAO;AACR;AACA,SAAS,2BAA2B,SAAS,QAAQ;CACpD,MAAM,SAAS,CAAC;CAChB,KAAK,MAAM,eAAe,OAAO,KAAK,QAAQ,UAAU,GAAG,OAAO,eAAe,gCAAgC,SAAS,QAAQ,WAAW;CAC7I,OAAO;AACR;AAGA,SAAS,2BAA2B,UAAU,SAAS,OAAO;CAC7D,MAAM,EAAE,oBAAoB,MAAM;CAClC,MAAM,QAAQ,IAAI;EACjB;EACA;CACD,CAAC;CACD,MAAM,MAAM,cAAc;EACzB;EACA;CACD,CAAC;CACD,OAAO;EACN;EACA;EACA,OAAO,OAAO,OAAO,qBAAqB,QAAQ,SAAS,SAAS,YAAY,QAAQ,eAAe,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC;EAChI,aAAa,UAAU,OAAO,OAAO,2BAA2B,QAAQ,SAAS,SAAS,QAAQ,SAAS,MAAM,CAAC,CAAC;EACnH,KAAK;EACL;EACA,OAAO,YAAY,OAAO,QAAQ;CACnC;AACD;;;;;;;;;;;AAWA,SAAS,eAAe,SAAS;CAChC,MAAM,WAAW,yBAAyB,QAAQ,QAAQ;CAC1D,MAAM,QAAQ,wBAAwB;EACrC,QAAQ;EACR,SAAS;EACT,YAAY,QAAQ,cAAc,CAAC;CACpC,CAAC;CACD,OAAO,2BAA2B,UAAU,uBAAuB;EAClE;EACA;CACD,CAAC,GAAG,KAAK;AACV"}
@@ -1,7 +1,7 @@
1
- import { i as PostgresTransactionOptions, n as PostgresExecutionOptions, r as PostgresPoolOptions, t as PostgresCursorOptions } from "./postgres-options-B0YrJID9-YkuL0Mao.mjs";
2
- import { a as isPgClient, n as PostgresBindingInput, o as isPgPool, t as PostgresBinding$1 } from "./binding-BN5X69gf-CIDnIWcw.mjs";
1
+ import { i as PostgresTransactionOptions, n as PostgresExecutionOptions, r as PostgresPoolOptions, t as PostgresCursorOptions } from "./postgres-options-C2QR33Rg-BTKXQic1.mjs";
2
+ import { a as isPgClient, n as PostgresBindingInput, o as isPgPool, t as PostgresBinding$1 } from "./binding-Q21lKDeA-CQ2oKakQ.mjs";
3
3
  import { r as buildNamespacedNativeEnums, t as NamespacedNativeEnums } from "./postgres-static-S38TCEK6-Dswb17fx.mjs";
4
- import { a as PostgresTransactionContext, i as PostgresStaticMembers, n as PostgresQueryMembers, r as PostgresRuntimeBoundMembers, t as PostgresLifecycleMembers } from "./postgres-members-DQvChDJ--ByodBWAn.mjs";
4
+ import { a as PostgresTransactionContext, i as PostgresStaticMembers, n as PostgresQueryMembers, r as PostgresRuntimeBoundMembers, t as PostgresLifecycleMembers } from "./postgres-members-D1VTNrCz-8ShwbWgk.mjs";
5
5
  import { postgresIsolationLevels as IsolationLevel } from "@prisma/orm-target-postgres/target/runtime";
6
6
  import { Runtime, SqlRuntimeBase } from "@prisma/orm-family-sql/runtime";
7
7
  import { CollectionClasses, NoCollectionClasses } from "@prisma/orm-family-sql/orm-client";
package/dist/runtime.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import { t as postgresError } from "./errors-DfWK9xep-CB07krZF.mjs";
2
2
  import { i as validateTransactionOptions, n as toDriverCursorOptions, r as validateCursorOptions } from "./postgres-options-CZyV9Him-2OSYJKqo.mjs";
3
- import { a as resolveOptionalPostgresBinding, i as postgresBindingRules, n as isPgClient, o as resolvePostgresBinding, r as isPgPool, t as connectWithBinding } from "./binding-DkfRsUZE-Co5ssUZw.mjs";
4
- import { n as validatePostgresContract } from "./contract-from-json-CuzxHkGa-CoiMbCP1.mjs";
5
- import { n as buildPostgresStaticContext, t as buildNamespacedNativeEnums } from "./postgres-static-Dp8FC0q0-L7yDo9e1.mjs";
3
+ import { a as resolveOptionalPostgresBinding, i as postgresBindingRules, n as isPgClient, o as resolvePostgresBinding, r as isPgPool, t as connectWithBinding } from "./binding-Cg5nms1Y-Bk8OB_I5.mjs";
4
+ import { n as validatePostgresContract } from "./contract-from-json-C6uR3W9i-DVRdyn3s.mjs";
5
+ import { n as buildPostgresStaticContext, t as buildNamespacedNativeEnums } from "./postgres-static-BTm72P3P-h_XgLqsh.mjs";
6
6
  import { n as buildPostgresRuntimeBoundMembers } from "./postgres-members-CRPX0rhb-C0keDjWe.mjs";
7
7
  import { t as PostgresRuntimeImpl } from "./postgres-runtime-BKdag6p9-gHVB2jfC.mjs";
8
8
  import { InternalError } from "@prisma/orm-framework/utils/internal-error";
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.mjs","names":[],"sources":["../../../../3-targets/postgres/9-facade/dist/runtime.mjs"],"sourcesContent":["import { t as postgresError } from \"./errors-DfWK9xep.mjs\";\nimport { i as validateTransactionOptions, n as toDriverCursorOptions, r as validateCursorOptions } from \"./postgres-options-CZyV9Him.mjs\";\nimport { a as resolveOptionalPostgresBinding, i as postgresBindingRules, n as isPgClient, o as resolvePostgresBinding, r as isPgPool, t as connectWithBinding } from \"./binding-DkfRsUZE.mjs\";\nimport { r as buildNamespacedNativeEnums, t as buildPostgresStaticContext } from \"./postgres-static-Dp8FC0q0.mjs\";\nimport { n as validatePostgresContract } from \"./contract-from-json-CuzxHkGa.mjs\";\nimport { n as buildPostgresRuntimeBoundMembers } from \"./postgres-members-CRPX0rhb.mjs\";\nimport { t as PostgresRuntimeImpl } from \"./postgres-runtime-BKdag6p9.mjs\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport postgresTarget, { postgresIsolationLevels as IsolationLevel } from \"@internal/target-postgres/runtime\";\nimport postgresDriver from \"@internal/driver-postgres/runtime\";\nimport postgresAdapter from \"@internal/adapter-postgres/runtime\";\nimport { createExecutionContext, createSqlExecutionStack, toRuntimeOptions } from \"@internal/sql-runtime\";\n//#region src/runtime/postgres.ts\n/**\n* Creates a lazy Postgres 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 static query surfaces are available\n* at once; the pool is created on the first query or `connect()`.\n*\n* @example\n* ```ts\n* import { contractFromJson } from '@prisma/orm-postgres/static';\n* import postgres from '@prisma/orm-postgres/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 = postgres({ contract, url: process.env['DATABASE_URL']! });\n* ```\n*/\nfunction postgres(options) {\n\tconst cursor = validateCursorOptions(options.cursor, \"postgres\");\n\tconst transactionOptions = validateTransactionOptions(options.transactionOptions);\n\tconst contract = validatePostgresContract(options.contract);\n\tlet binding = resolveOptionalPostgresBinding(options, postgresBindingRules);\n\tconst stack = createSqlExecutionStack({\n\t\ttarget: postgresTarget,\n\t\tadapter: postgresAdapter,\n\t\tdriver: postgresDriver,\n\t\textensions: options.extensions ?? []\n\t});\n\tconst context = createExecutionContext({\n\t\tcontract,\n\t\tstack,\n\t\tdriver: postgresDriver\n\t});\n\tconst { sql, raw: rawSqlTag, enums, nativeEnums, toSql } = buildPostgresStaticContext(contract, context, stack);\n\tlet runtimeInstance;\n\tlet runtimeDriver;\n\tlet driverConnected = false;\n\tlet connectPromise;\n\tlet backgroundConnectError;\n\tlet closePromise;\n\tconst closedError = () => postgresError(\"DRIVER.NOT_CONNECTED\", \"Postgres client is closed\", {\n\t\twhy: \"close() was called on this client.\",\n\t\tfix: \"Create a new postgres(...) client.\",\n\t\tmeta: { extension: \"postgres\" }\n\t});\n\tconst connectDriver = async (resolvedBinding) => {\n\t\tif (driverConnected) return;\n\t\tif (!runtimeDriver) throw new InternalError(\"Postgres runtime driver missing\");\n\t\tif (connectPromise) return connectPromise;\n\t\tconnectPromise = connectWithBinding(runtimeDriver, resolvedBinding, options).then(() => {\n\t\t\tdriverConnected = true;\n\t\t}).catch((err) => {\n\t\t\tbackgroundConnectError = err;\n\t\t\tconnectPromise = void 0;\n\t\t\tthrow err;\n\t\t});\n\t\treturn connectPromise;\n\t};\n\tconst getRuntime = () => {\n\t\tif (closePromise !== void 0) throw closedError();\n\t\tif (backgroundConnectError !== void 0) throw backgroundConnectError;\n\t\tif (runtimeInstance) return runtimeInstance;\n\t\tconst adapter = stack.adapter.create(stack);\n\t\tconst driver = stack.driver.create({ cursor: toDriverCursorOptions(cursor) });\n\t\truntimeDriver = driver;\n\t\tconst runtime = new PostgresRuntimeImpl({\n\t\t\tcontext,\n\t\t\tadapter,\n\t\t\tdriver,\n\t\t\t...toRuntimeOptions(options),\n\t\t\tcloseRefusal: \"at-once\"\n\t\t});\n\t\truntimeInstance = runtime;\n\t\tif (binding !== void 0) connectDriver(binding).catch(() => void 0);\n\t\treturn runtime;\n\t};\n\tconst closeRuntime = async () => {\n\t\tif (!driverConnected) await connectPromise?.catch(() => void 0);\n\t\tawait runtimeInstance?.close();\n\t};\n\treturn {\n\t\tsql,\n\t\t...buildPostgresRuntimeBoundMembers({\n\t\t\tcontext,\n\t\t\tcollections: options.collections,\n\t\t\tsql,\n\t\t\traw: rawSqlTag,\n\t\t\tenums,\n\t\t\tnativeEnums,\n\t\t\ttoSql,\n\t\t\tgetRuntime,\n\t\t\tgetRuntimeForWork: getRuntime,\n\t\t\ttransactionOptions\n\t\t}),\n\t\tenums,\n\t\tnativeEnums,\n\t\traw: rawSqlTag,\n\t\ttoSql,\n\t\tcontext,\n\t\tcontract,\n\t\tstack,\n\t\tasync connect(bindingInput) {\n\t\t\tif (closePromise !== void 0) throw closedError();\n\t\t\tif (driverConnected || connectPromise) {\n\t\t\t\tif (bindingInput !== void 0) throw postgresError(\"DRIVER.ALREADY_CONNECTED\", \"Postgres 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\tmeta: { extension: \"postgres\" }\n\t\t\t\t});\n\t\t\t\tconst runtime = getRuntime();\n\t\t\t\tawait connectPromise;\n\t\t\t\tif (closePromise !== void 0) throw closedError();\n\t\t\t\treturn runtime;\n\t\t\t}\n\t\t\tif (bindingInput !== void 0) binding = resolvePostgresBinding(bindingInput);\n\t\t\tif (binding === void 0) throw postgresError(\"RUNTIME.BINDING_MISSING\", \"Postgres binding not configured. Pass url/pg/binding to postgres(...) or call db.connect({ ... }).\", { meta: { extension: \"postgres\" } });\n\t\t\tconst runtime = getRuntime();\n\t\t\tif (driverConnected) return runtime;\n\t\t\tawait connectDriver(binding);\n\t\t\tif (closePromise !== void 0) throw closedError();\n\t\t\treturn runtime;\n\t\t},\n\t\tclose() {\n\t\t\tclosePromise ??= closeRuntime();\n\t\t\treturn closePromise;\n\t\t},\n\t\t[Symbol.asyncDispose]() {\n\t\t\treturn this.close();\n\t\t}\n\t};\n}\n//#endregion\nexport { IsolationLevel, PostgresRuntimeImpl, buildNamespacedNativeEnums, postgres as default, isPgClient, isPgPool };\n\n//# sourceMappingURL=runtime.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,SAAS,SAAS,SAAS;CAC1B,MAAM,SAAS,sBAAsB,QAAQ,QAAQ,UAAU;CAC/D,MAAM,qBAAqB,2BAA2B,QAAQ,kBAAkB;CAChF,MAAM,WAAW,yBAAyB,QAAQ,QAAQ;CAC1D,IAAI,UAAU,+BAA+B,SAAS,oBAAoB;CAC1E,MAAM,QAAQ,wBAAwB;EACrC,QAAQ;EACR,SAAS;EACT,QAAQ;EACR,YAAY,QAAQ,cAAc,CAAC;CACpC,CAAC;CACD,MAAM,UAAU,uBAAuB;EACtC;EACA;EACA,QAAQ;CACT,CAAC;CACD,MAAM,EAAE,KAAK,KAAK,WAAW,OAAO,aAAa,UAAU,2BAA2B,UAAU,SAAS,KAAK;CAC9G,IAAI;CACJ,IAAI;CACJ,IAAI,kBAAkB;CACtB,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,MAAM,oBAAoB,cAAc,wBAAwB,6BAA6B;EAC5F,KAAK;EACL,KAAK;EACL,MAAM,EAAE,WAAW,WAAW;CAC/B,CAAC;CACD,MAAM,gBAAgB,OAAO,oBAAoB;EAChD,IAAI,iBAAiB;EACrB,IAAI,CAAC,eAAe,MAAM,IAAI,cAAc,iCAAiC;EAC7E,IAAI,gBAAgB,OAAO;EAC3B,iBAAiB,mBAAmB,eAAe,iBAAiB,OAAO,CAAC,CAAC,WAAW;GACvF,kBAAkB;EACnB,CAAC,CAAC,CAAC,OAAO,QA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G,MAAM,cAAc,2BAA2B,sGAAsG,EAAE,MAAM,EAAE,WAAW,WAAW,EAAE,CAAC;GAChN,MAAM,UAAU,WAAW;GAC3B,IAAI,iBAAiB,OAAO;GAC5B,MAAM,cAAc,OAAO;GAC3B,IAAI,iBAAiB,KAAK,GAAG,MAAM,YAAY;GAC/C,OAAO;EACR;EACA,QAAQ;GACP,iBAAiB,aAAa;GAC9B,OAAO;EACR;EACA,CAAC,OAAO,gBAAgB;GACvB,OAAO,KAAK,MAAM;EACnB;CACD;AACD"}
1
+ {"version":3,"file":"runtime.mjs","names":[],"sources":["../../../../3-targets/postgres/9-facade/dist/runtime.mjs"],"sourcesContent":["import { t as postgresError } from \"./errors-DfWK9xep.mjs\";\nimport { i as validateTransactionOptions, n as toDriverCursorOptions, r as validateCursorOptions } from \"./postgres-options-CZyV9Him.mjs\";\nimport { a as resolveOptionalPostgresBinding, i as postgresBindingRules, n as isPgClient, o as resolvePostgresBinding, r as isPgPool, t as connectWithBinding } from \"./binding-Cg5nms1Y.mjs\";\nimport { r as buildNamespacedNativeEnums, t as buildPostgresStaticContext } from \"./postgres-static-BTm72P3P.mjs\";\nimport { n as validatePostgresContract } from \"./contract-from-json-C6uR3W9i.mjs\";\nimport { n as buildPostgresRuntimeBoundMembers } from \"./postgres-members-CRPX0rhb.mjs\";\nimport { t as PostgresRuntimeImpl } from \"./postgres-runtime-BKdag6p9.mjs\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport postgresTarget, { postgresIsolationLevels as IsolationLevel } from \"@internal/target-postgres/runtime\";\nimport postgresDriver from \"@internal/driver-postgres/runtime\";\nimport postgresAdapter from \"@internal/adapter-postgres/runtime\";\nimport { createExecutionContext, createSqlExecutionStack, toRuntimeOptions } from \"@internal/sql-runtime\";\n//#region src/runtime/postgres.ts\n/**\n* Creates a lazy Postgres 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 static query surfaces are available\n* at once; the pool is created on the first query or `connect()`.\n*\n* @example\n* ```ts\n* import { contractFromJson } from '@prisma/orm-postgres/static';\n* import postgres from '@prisma/orm-postgres/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 = postgres({ contract, url: process.env['DATABASE_URL']! });\n* ```\n*/\nfunction postgres(options) {\n\tconst cursor = validateCursorOptions(options.cursor, \"postgres\");\n\tconst transactionOptions = validateTransactionOptions(options.transactionOptions);\n\tconst contract = validatePostgresContract(options.contract);\n\tlet binding = resolveOptionalPostgresBinding(options, postgresBindingRules);\n\tconst stack = createSqlExecutionStack({\n\t\ttarget: postgresTarget,\n\t\tadapter: postgresAdapter,\n\t\tdriver: postgresDriver,\n\t\textensions: options.extensions ?? []\n\t});\n\tconst context = createExecutionContext({\n\t\tcontract,\n\t\tstack,\n\t\tdriver: postgresDriver\n\t});\n\tconst { sql, raw: rawSqlTag, enums, nativeEnums, toSql } = buildPostgresStaticContext(contract, context, stack);\n\tlet runtimeInstance;\n\tlet runtimeDriver;\n\tlet driverConnected = false;\n\tlet connectPromise;\n\tlet backgroundConnectError;\n\tlet closePromise;\n\tconst closedError = () => postgresError(\"DRIVER.NOT_CONNECTED\", \"Postgres client is closed\", {\n\t\twhy: \"close() was called on this client.\",\n\t\tfix: \"Create a new postgres(...) client.\",\n\t\tmeta: { extension: \"postgres\" }\n\t});\n\tconst connectDriver = async (resolvedBinding) => {\n\t\tif (driverConnected) return;\n\t\tif (!runtimeDriver) throw new InternalError(\"Postgres runtime driver missing\");\n\t\tif (connectPromise) return connectPromise;\n\t\tconnectPromise = connectWithBinding(runtimeDriver, resolvedBinding, options).then(() => {\n\t\t\tdriverConnected = true;\n\t\t}).catch((err) => {\n\t\t\tbackgroundConnectError = err;\n\t\t\tconnectPromise = void 0;\n\t\t\tthrow err;\n\t\t});\n\t\treturn connectPromise;\n\t};\n\tconst getRuntime = () => {\n\t\tif (closePromise !== void 0) throw closedError();\n\t\tif (backgroundConnectError !== void 0) throw backgroundConnectError;\n\t\tif (runtimeInstance) return runtimeInstance;\n\t\tconst adapter = stack.adapter.create(stack);\n\t\tconst driver = stack.driver.create({ cursor: toDriverCursorOptions(cursor) });\n\t\truntimeDriver = driver;\n\t\tconst runtime = new PostgresRuntimeImpl({\n\t\t\tcontext,\n\t\t\tadapter,\n\t\t\tdriver,\n\t\t\t...toRuntimeOptions(options),\n\t\t\tcloseRefusal: \"at-once\"\n\t\t});\n\t\truntimeInstance = runtime;\n\t\tif (binding !== void 0) connectDriver(binding).catch(() => void 0);\n\t\treturn runtime;\n\t};\n\tconst closeRuntime = async () => {\n\t\tif (!driverConnected) await connectPromise?.catch(() => void 0);\n\t\tawait runtimeInstance?.close();\n\t};\n\treturn {\n\t\tsql,\n\t\t...buildPostgresRuntimeBoundMembers({\n\t\t\tcontext,\n\t\t\tcollections: options.collections,\n\t\t\tsql,\n\t\t\traw: rawSqlTag,\n\t\t\tenums,\n\t\t\tnativeEnums,\n\t\t\ttoSql,\n\t\t\tgetRuntime,\n\t\t\tgetRuntimeForWork: getRuntime,\n\t\t\ttransactionOptions\n\t\t}),\n\t\tenums,\n\t\tnativeEnums,\n\t\traw: rawSqlTag,\n\t\ttoSql,\n\t\tcontext,\n\t\tcontract,\n\t\tstack,\n\t\tasync connect(bindingInput) {\n\t\t\tif (closePromise !== void 0) throw closedError();\n\t\t\tif (driverConnected || connectPromise) {\n\t\t\t\tif (bindingInput !== void 0) throw postgresError(\"DRIVER.ALREADY_CONNECTED\", \"Postgres 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\tmeta: { extension: \"postgres\" }\n\t\t\t\t});\n\t\t\t\tconst runtime = getRuntime();\n\t\t\t\tawait connectPromise;\n\t\t\t\tif (closePromise !== void 0) throw closedError();\n\t\t\t\treturn runtime;\n\t\t\t}\n\t\t\tif (bindingInput !== void 0) binding = resolvePostgresBinding(bindingInput);\n\t\t\tif (binding === void 0) throw postgresError(\"RUNTIME.BINDING_MISSING\", \"Postgres binding not configured. Pass url/pg/binding to postgres(...) or call db.connect({ ... }).\", { meta: { extension: \"postgres\" } });\n\t\t\tconst runtime = getRuntime();\n\t\t\tif (driverConnected) return runtime;\n\t\t\tawait connectDriver(binding);\n\t\t\tif (closePromise !== void 0) throw closedError();\n\t\t\treturn runtime;\n\t\t},\n\t\tclose() {\n\t\t\tclosePromise ??= closeRuntime();\n\t\t\treturn closePromise;\n\t\t},\n\t\t[Symbol.asyncDispose]() {\n\t\t\treturn this.close();\n\t\t}\n\t};\n}\n//#endregion\nexport { IsolationLevel, PostgresRuntimeImpl, buildNamespacedNativeEnums, postgres as default, isPgClient, isPgPool };\n\n//# sourceMappingURL=runtime.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,SAAS,SAAS,SAAS;CAC1B,MAAM,SAAS,sBAAsB,QAAQ,QAAQ,UAAU;CAC/D,MAAM,qBAAqB,2BAA2B,QAAQ,kBAAkB;CAChF,MAAM,WAAW,yBAAyB,QAAQ,QAAQ;CAC1D,IAAI,UAAU,+BAA+B,SAAS,oBAAoB;CAC1E,MAAM,QAAQ,wBAAwB;EACrC,QAAQ;EACR,SAAS;EACT,QAAQ;EACR,YAAY,QAAQ,cAAc,CAAC;CACpC,CAAC;CACD,MAAM,UAAU,uBAAuB;EACtC;EACA;EACA,QAAQ;CACT,CAAC;CACD,MAAM,EAAE,KAAK,KAAK,WAAW,OAAO,aAAa,UAAU,2BAA2B,UAAU,SAAS,KAAK;CAC9G,IAAI;CACJ,IAAI;CACJ,IAAI,kBAAkB;CACtB,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,MAAM,oBAAoB,cAAc,wBAAwB,6BAA6B;EAC5F,KAAK;EACL,KAAK;EACL,MAAM,EAAE,WAAW,WAAW;CAC/B,CAAC;CACD,MAAM,gBAA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KAAK;KACL,MAAM,EAAE,WAAW,WAAW;IAC/B,CAAC;IACD,MAAM,UAAU,WAAW;IAC3B,MAAM;IACN,IAAI,iBAAiB,KAAK,GAAG,MAAM,YAAY;IAC/C,OAAO;GACR;GACA,IAAI,iBAAiB,KAAK,GAAG,UAAU,uBAAuB,YAAY;GAC1E,IAAI,YAAY,KAAK,GAAG,MAAM,cAAc,2BAA2B,sGAAsG,EAAE,MAAM,EAAE,WAAW,WAAW,EAAE,CAAC;GAChN,MAAM,UAAU,WAAW;GAC3B,IAAI,iBAAiB,OAAO;GAC5B,MAAM,cAAc,OAAO;GAC3B,IAAI,iBAAiB,KAAK,GAAG,MAAM,YAAY;GAC/C,OAAO;EACR;EACA,QAAQ;GACP,iBAAiB,aAAa;GAC9B,OAAO;EACR;EACA,CAAC,OAAO,gBAAgB;GACvB,OAAO,KAAK,MAAM;EACnB;CACD;AACD"}
@@ -1,5 +1,5 @@
1
- import { i as PostgresTransactionOptions, n as PostgresExecutionOptions, t as PostgresCursorOptions } from "./postgres-options-B0YrJID9-YkuL0Mao.mjs";
2
- import { i as PostgresStaticMembers, n as PostgresQueryMembers, r as PostgresRuntimeBoundMembers, t as PostgresLifecycleMembers } from "./postgres-members-DQvChDJ--ByodBWAn.mjs";
1
+ import { i as PostgresTransactionOptions, n as PostgresExecutionOptions, t as PostgresCursorOptions } from "./postgres-options-C2QR33Rg-BTKXQic1.mjs";
2
+ import { i as PostgresStaticMembers, n as PostgresQueryMembers, r as PostgresRuntimeBoundMembers, t as PostgresLifecycleMembers } from "./postgres-members-D1VTNrCz-8ShwbWgk.mjs";
3
3
  import { postgresIsolationLevels as IsolationLevel } from "@prisma/orm-target-postgres/target/runtime";
4
4
  import { CollectionClasses, NoCollectionClasses } from "@prisma/orm-family-sql/orm-client";
5
5
  import { Contract } from "@prisma/orm-framework/contract/types";
@@ -1,8 +1,8 @@
1
1
  import { t as postgresError } from "./errors-DfWK9xep-CB07krZF.mjs";
2
2
  import { i as validateTransactionOptions, n as toDriverCursorOptions, r as validateCursorOptions, t as DEFAULT_CONNECT_TIMEOUT_MILLIS } from "./postgres-options-CZyV9Him-2OSYJKqo.mjs";
3
- import { s as validatePostgresUrl } from "./binding-DkfRsUZE-Co5ssUZw.mjs";
4
- import { n as validatePostgresContract } from "./contract-from-json-CuzxHkGa-CoiMbCP1.mjs";
5
- import { n as buildPostgresStaticContext } from "./postgres-static-Dp8FC0q0-L7yDo9e1.mjs";
3
+ import { s as validatePostgresUrl } from "./binding-Cg5nms1Y-Bk8OB_I5.mjs";
4
+ import { n as validatePostgresContract } from "./contract-from-json-C6uR3W9i-DVRdyn3s.mjs";
5
+ import { n as buildPostgresStaticContext } from "./postgres-static-BTm72P3P-h_XgLqsh.mjs";
6
6
  import { n as buildPostgresRuntimeBoundMembers } from "./postgres-members-CRPX0rhb-C0keDjWe.mjs";
7
7
  import { t as PostgresRuntimeImpl } from "./postgres-runtime-BKdag6p9-gHVB2jfC.mjs";
8
8
  import { InternalError } from "@prisma/orm-framework/utils/internal-error";
@@ -1 +1 @@
1
- {"version":3,"file":"serverless.mjs","names":[],"sources":["../../../../3-targets/postgres/9-facade/dist/serverless.mjs"],"sourcesContent":["import { t as postgresError } from \"./errors-DfWK9xep.mjs\";\nimport { i as validateTransactionOptions, n as toDriverCursorOptions, r as validateCursorOptions, t as DEFAULT_CONNECT_TIMEOUT_MILLIS } from \"./postgres-options-CZyV9Him.mjs\";\nimport { s as validatePostgresUrl } from \"./binding-DkfRsUZE.mjs\";\nimport { t as buildPostgresStaticContext } from \"./postgres-static-Dp8FC0q0.mjs\";\nimport { n as validatePostgresContract } from \"./contract-from-json-CuzxHkGa.mjs\";\nimport { n as buildPostgresRuntimeBoundMembers } from \"./postgres-members-CRPX0rhb.mjs\";\nimport { t as PostgresRuntimeImpl } from \"./postgres-runtime-BKdag6p9.mjs\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport postgresTarget, { postgresIsolationLevels as IsolationLevel } from \"@internal/target-postgres/runtime\";\nimport postgresDriver, { createPgClient, suppressIdleConnectionErrors } from \"@internal/driver-postgres/runtime\";\nimport postgresAdapter from \"@internal/adapter-postgres/runtime\";\nimport { createExecutionContext, createSqlExecutionStack, toRuntimeOptions } from \"@internal/sql-runtime\";\nimport { redactDatabaseUrl } from \"@internal/utils/redact-db-url\";\n//#region src/runtime/postgres-serverless.ts\nfunction closedConnectionError() {\n\treturn postgresError(\"DRIVER.NOT_CONNECTED\", \"Postgres connection is closed\", {\n\t\twhy: \"close() was called on this connection, or the await using scope that held it has ended.\",\n\t\tfix: \"Call connect({ url }) again to open a new connection.\",\n\t\tmeta: { extension: \"postgres\" }\n\t});\n}\nfunction connectionFailedError(url, cause) {\n\treturn postgresError(\"DRIVER.CONNECTION_FAILED\", \"Database connection failed\", {\n\t\twhy: cause instanceof Error ? cause.message : String(cause),\n\t\tfix: \"Verify the database URL, ensure the database is reachable, and confirm credentials/permissions\",\n\t\tmeta: {\n\t\t\textension: \"postgres\",\n\t\t\t...redactDatabaseUrl(url)\n\t\t},\n\t\tcause\n\t});\n}\n/**\n* Creates a serverless client for serverless and edge runtimes (Cloudflare Workers + Hyperdrive,\n* AWS Lambda, Vercel, Deno Deploy).\n*\n* The serverless client holds no database connection and has the static members. Each\n* `connect({ url })` opens one database connection, a fresh `pg.Client`, and returns a connection\n* with the members of a `postgres()` client except `connect`. It rejects with\n* `DRIVER.CONNECTION_FAILED` when the database refuses the connection, rejects the credentials,\n* or does not answer within 20 seconds. Close the connection with `await using` or `close()`.\n*\n* The client infers its contract type from `contract` and validates it once, when the client is\n* created; connections reuse it.\n*\n* @example\n* ```ts\n* const postgres = postgresServerless({ contract: contractFromJson<Contract>(contractJson) });\n*\n* export default {\n* async fetch(_req: Request, env: Env): Promise<Response> {\n* await using db = await postgres.connect({ url: env.HYPERDRIVE.connectionString });\n* const users = await db.orm.public.User.all();\n* return Response.json(users);\n* },\n* };\n* ```\n*/\nfunction postgresServerless(options) {\n\tconst cursor = validateCursorOptions(options.cursor, \"postgresServerless\");\n\tconst transactionOptions = validateTransactionOptions(options.transactionOptions);\n\tconst contract = validatePostgresContract(options.contract);\n\tconst stack = createSqlExecutionStack({\n\t\ttarget: postgresTarget,\n\t\tadapter: postgresAdapter,\n\t\tdriver: postgresDriver,\n\t\textensions: options.extensions ?? []\n\t});\n\tconst context = createExecutionContext({\n\t\tcontract,\n\t\tstack,\n\t\tdriver: postgresDriver\n\t});\n\tconst { sql, raw, enums, nativeEnums, toSql } = buildPostgresStaticContext(contract, context, stack);\n\tconst buildRuntimeBoundMembers = (getRuntime, getRuntimeForWork) => buildPostgresRuntimeBoundMembers({\n\t\tcontext,\n\t\tcollections: options.collections,\n\t\tsql,\n\t\traw,\n\t\tenums,\n\t\tnativeEnums,\n\t\ttoSql,\n\t\tgetRuntime,\n\t\tgetRuntimeForWork,\n\t\ttransactionOptions\n\t});\n\tconst noRuntime = () => {\n\t\tthrow new InternalError(\"The serverless client has no runtime\");\n\t};\n\tbuildRuntimeBoundMembers(noRuntime, noRuntime);\n\tconst createConnection = (runtime) => {\n\t\tlet closing;\n\t\tconst close = () => {\n\t\t\tclosing ??= runtime.close();\n\t\t\treturn closing;\n\t\t};\n\t\tconst runtimeBoundMembers = buildRuntimeBoundMembers(() => {\n\t\t\tif (closing !== void 0) throw closedConnectionError();\n\t\t\treturn runtime;\n\t\t}, () => runtime);\n\t\treturn {\n\t\t\tsql,\n\t\t\traw,\n\t\t\tenums,\n\t\t\tnativeEnums,\n\t\t\ttoSql,\n\t\t\tcontext,\n\t\t\tcontract,\n\t\t\tstack,\n\t\t\t...runtimeBoundMembers,\n\t\t\tclose,\n\t\t\t[Symbol.asyncDispose]: close\n\t\t};\n\t};\n\treturn {\n\t\tsql,\n\t\traw,\n\t\tenums,\n\t\tnativeEnums,\n\t\ttoSql,\n\t\tcontext,\n\t\tstack,\n\t\tcontract,\n\t\tasync connect(binding) {\n\t\t\tconst url = validatePostgresUrl(binding.url);\n\t\t\tconst driverDescriptor = stack.driver;\n\t\t\tconst adapter = stack.adapter.create(stack);\n\t\t\tconst driver = driverDescriptor.create({ cursor: toDriverCursorOptions(cursor) });\n\t\t\tconst pgClient = suppressIdleConnectionErrors(createPgClient({\n\t\t\t\tconnectionString: url,\n\t\t\t\tconnectionTimeoutMillis: DEFAULT_CONNECT_TIMEOUT_MILLIS\n\t\t\t}, stack.target.sessionSettings ?? {}));\n\t\t\tawait driver.connect({\n\t\t\t\tkind: \"pgClient\",\n\t\t\t\tclient: pgClient,\n\t\t\t\townedByDriver: true\n\t\t\t});\n\t\t\tconst runtime = new PostgresRuntimeImpl({\n\t\t\t\tcontext,\n\t\t\t\tadapter,\n\t\t\t\tdriver,\n\t\t\t\t...toRuntimeOptions(options),\n\t\t\t\tcloseRefusal: \"when-idle\"\n\t\t\t});\n\t\t\tconst connection = createConnection(runtime);\n\t\t\ttry {\n\t\t\t\tawait (await driver.acquireConnection()).release();\n\t\t\t} catch (err) {\n\t\t\t\tawait driver.close().catch(() => void 0);\n\t\t\t\tthrow connectionFailedError(url, err);\n\t\t\t}\n\t\t\treturn connection;\n\t\t}\n\t};\n}\n//#endregion\nexport { IsolationLevel, postgresServerless as default };\n\n//# sourceMappingURL=serverless.mjs.map"],"mappings":";;;;;;;;;;;;;;AAcA,SAAS,wBAAwB;CAChC,OAAO,cAAc,wBAAwB,iCAAiC;EAC7E,KAAK;EACL,KAAK;EACL,MAAM,EAAE,WAAW,WAAW;CAC/B,CAAC;AACF;AACA,SAAS,sBAAsB,KAAK,OAAO;CAC1C,OAAO,cAAc,4BAA4B,8BAA8B;EAC9E,KAAK,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;EAC1D,KAAK;EACL,MAAM;GACL,WAAW;GACX,GAAG,kBAAkB,GAAG;EACzB;EACA;CACD,CAAC;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,SAAS,mBAAmB,SAAS;CACpC,MAAM,SAAS,sBAAsB,QAAQ,QAAQ,oBAAoB;CACzE,MAAM,qBAAqB,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AAe;GAChB,CAAC;GACD,MAAM,UAAU,IAAI,oBAAoB;IACvC;IACA;IACA;IACA,GAAG,iBAAiB,OAAO;IAC3B,cAAc;GACf,CAAC;GACD,MAAM,aAAa,iBAAiB,OAAO;GAC3C,IAAI;IACH,OAAO,MAAM,OAAO,kBAAkB,EAAA,CAAG,QAAQ;GAClD,SAAS,KAAK;IACb,MAAM,OAAO,MAAM,CAAC,CAAC,YAAY,KAAK,CAAC;IACvC,MAAM,sBAAsB,KAAK,GAAG;GACrC;GACA,OAAO;EACR;CACD;AACD"}
1
+ {"version":3,"file":"serverless.mjs","names":[],"sources":["../../../../3-targets/postgres/9-facade/dist/serverless.mjs"],"sourcesContent":["import { t as postgresError } from \"./errors-DfWK9xep.mjs\";\nimport { i as validateTransactionOptions, n as toDriverCursorOptions, r as validateCursorOptions, t as DEFAULT_CONNECT_TIMEOUT_MILLIS } from \"./postgres-options-CZyV9Him.mjs\";\nimport { s as validatePostgresUrl } from \"./binding-Cg5nms1Y.mjs\";\nimport { t as buildPostgresStaticContext } from \"./postgres-static-BTm72P3P.mjs\";\nimport { n as validatePostgresContract } from \"./contract-from-json-C6uR3W9i.mjs\";\nimport { n as buildPostgresRuntimeBoundMembers } from \"./postgres-members-CRPX0rhb.mjs\";\nimport { t as PostgresRuntimeImpl } from \"./postgres-runtime-BKdag6p9.mjs\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport postgresTarget, { postgresIsolationLevels as IsolationLevel } from \"@internal/target-postgres/runtime\";\nimport postgresDriver, { createPgClient, suppressIdleConnectionErrors } from \"@internal/driver-postgres/runtime\";\nimport postgresAdapter from \"@internal/adapter-postgres/runtime\";\nimport { createExecutionContext, createSqlExecutionStack, toRuntimeOptions } from \"@internal/sql-runtime\";\nimport { redactDatabaseUrl } from \"@internal/utils/redact-db-url\";\n//#region src/runtime/postgres-serverless.ts\nfunction closedConnectionError() {\n\treturn postgresError(\"DRIVER.NOT_CONNECTED\", \"Postgres connection is closed\", {\n\t\twhy: \"close() was called on this connection, or the await using scope that held it has ended.\",\n\t\tfix: \"Call connect({ url }) again to open a new connection.\",\n\t\tmeta: { extension: \"postgres\" }\n\t});\n}\nfunction connectionFailedError(url, cause) {\n\treturn postgresError(\"DRIVER.CONNECTION_FAILED\", \"Database connection failed\", {\n\t\twhy: cause instanceof Error ? cause.message : String(cause),\n\t\tfix: \"Verify the database URL, ensure the database is reachable, and confirm credentials/permissions\",\n\t\tmeta: {\n\t\t\textension: \"postgres\",\n\t\t\t...redactDatabaseUrl(url)\n\t\t},\n\t\tcause\n\t});\n}\n/**\n* Creates a serverless client for serverless and edge runtimes (Cloudflare Workers + Hyperdrive,\n* AWS Lambda, Vercel, Deno Deploy).\n*\n* The serverless client holds no database connection and has the static members. Each\n* `connect({ url })` opens one database connection, a fresh `pg.Client`, and returns a connection\n* with the members of a `postgres()` client except `connect`. It rejects with\n* `DRIVER.CONNECTION_FAILED` when the database refuses the connection, rejects the credentials,\n* or does not answer within 20 seconds. Close the connection with `await using` or `close()`.\n*\n* The client infers its contract type from `contract` and validates it once, when the client is\n* created; connections reuse it.\n*\n* @example\n* ```ts\n* const postgres = postgresServerless({ contract: contractFromJson<Contract>(contractJson) });\n*\n* export default {\n* async fetch(_req: Request, env: Env): Promise<Response> {\n* await using db = await postgres.connect({ url: env.HYPERDRIVE.connectionString });\n* const users = await db.orm.public.User.all();\n* return Response.json(users);\n* },\n* };\n* ```\n*/\nfunction postgresServerless(options) {\n\tconst cursor = validateCursorOptions(options.cursor, \"postgresServerless\");\n\tconst transactionOptions = validateTransactionOptions(options.transactionOptions);\n\tconst contract = validatePostgresContract(options.contract);\n\tconst stack = createSqlExecutionStack({\n\t\ttarget: postgresTarget,\n\t\tadapter: postgresAdapter,\n\t\tdriver: postgresDriver,\n\t\textensions: options.extensions ?? []\n\t});\n\tconst context = createExecutionContext({\n\t\tcontract,\n\t\tstack,\n\t\tdriver: postgresDriver\n\t});\n\tconst { sql, raw, enums, nativeEnums, toSql } = buildPostgresStaticContext(contract, context, stack);\n\tconst buildRuntimeBoundMembers = (getRuntime, getRuntimeForWork) => buildPostgresRuntimeBoundMembers({\n\t\tcontext,\n\t\tcollections: options.collections,\n\t\tsql,\n\t\traw,\n\t\tenums,\n\t\tnativeEnums,\n\t\ttoSql,\n\t\tgetRuntime,\n\t\tgetRuntimeForWork,\n\t\ttransactionOptions\n\t});\n\tconst noRuntime = () => {\n\t\tthrow new InternalError(\"The serverless client has no runtime\");\n\t};\n\tbuildRuntimeBoundMembers(noRuntime, noRuntime);\n\tconst createConnection = (runtime) => {\n\t\tlet closing;\n\t\tconst close = () => {\n\t\t\tclosing ??= runtime.close();\n\t\t\treturn closing;\n\t\t};\n\t\tconst runtimeBoundMembers = buildRuntimeBoundMembers(() => {\n\t\t\tif (closing !== void 0) throw closedConnectionError();\n\t\t\treturn runtime;\n\t\t}, () => runtime);\n\t\treturn {\n\t\t\tsql,\n\t\t\traw,\n\t\t\tenums,\n\t\t\tnativeEnums,\n\t\t\ttoSql,\n\t\t\tcontext,\n\t\t\tcontract,\n\t\t\tstack,\n\t\t\t...runtimeBoundMembers,\n\t\t\tclose,\n\t\t\t[Symbol.asyncDispose]: close\n\t\t};\n\t};\n\treturn {\n\t\tsql,\n\t\traw,\n\t\tenums,\n\t\tnativeEnums,\n\t\ttoSql,\n\t\tcontext,\n\t\tstack,\n\t\tcontract,\n\t\tasync connect(binding) {\n\t\t\tconst url = validatePostgresUrl(binding.url);\n\t\t\tconst driverDescriptor = stack.driver;\n\t\t\tconst adapter = stack.adapter.create(stack);\n\t\t\tconst driver = driverDescriptor.create({ cursor: toDriverCursorOptions(cursor) });\n\t\t\tconst pgClient = suppressIdleConnectionErrors(createPgClient({\n\t\t\t\tconnectionString: url,\n\t\t\t\tconnectionTimeoutMillis: DEFAULT_CONNECT_TIMEOUT_MILLIS\n\t\t\t}, stack.target.sessionSettings ?? {}));\n\t\t\tawait driver.connect({\n\t\t\t\tkind: \"pgClient\",\n\t\t\t\tclient: pgClient,\n\t\t\t\townedByDriver: true\n\t\t\t});\n\t\t\tconst runtime = new PostgresRuntimeImpl({\n\t\t\t\tcontext,\n\t\t\t\tadapter,\n\t\t\t\tdriver,\n\t\t\t\t...toRuntimeOptions(options),\n\t\t\t\tcloseRefusal: \"when-idle\"\n\t\t\t});\n\t\t\tconst connection = createConnection(runtime);\n\t\t\ttry {\n\t\t\t\tawait (await driver.acquireConnection()).release();\n\t\t\t} catch (err) {\n\t\t\t\tawait driver.close().catch(() => void 0);\n\t\t\t\tthrow connectionFailedError(url, err);\n\t\t\t}\n\t\t\treturn connection;\n\t\t}\n\t};\n}\n//#endregion\nexport { IsolationLevel, postgresServerless as default };\n\n//# sourceMappingURL=serverless.mjs.map"],"mappings":";;;;;;;;;;;;;;AAcA,SAAS,wBAAwB;CAChC,OAAO,cAAc,wBAAwB,iCAAiC;EAC7E,KAAK;EACL,KAAK;EACL,MAAM,EAAE,WAAW,WAAW;CAC/B,CAAC;AACF;AACA,SAAS,sBAAsB,KAAK,OAAO;CAC1C,OAAO,cAAc,4BAA4B,8BAA8B;EAC9E,KAAK,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;EAC1D,KAAK;EACL,MAAM;GACL,WAAW;GACX,GAAG,kBAAkB,GAAG;EACzB;EACA;CACD,CAAC;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,SAAS,mBAAmB,SAAS;CACpC,MAAM,SAAS,sBAAsB,QAAQ,QAAQ,oBAAoB;CACzE,MAAM,qBAAqB,2BAA2B,QAAQ,kBAAkB;CAChF,MAAM,WAAW,yBAAyB,QAAQ,QAAQ;CAC1D,MAAM,QAAQ,wBAAwB;EACrC,QAAQ;EACR,SAAS;EACT,QAAQ;EACR,YAAY,QAAQ,cAAc,CAAC;CACpC,CAAC;CACD,MAAM,UAAU,uBAAuB;EACtC;EACA;EACA,QAAQ;CACT,CAAC;CACD,MAAM,EAAE,KAAK,KAAK,OAAO,aAAa,UAAU,2BAA2B,UAAU,SAAS,KAAK;C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GAAG;GACrC;GACA,OAAO;EACR;CACD;AACD"}
package/dist/static.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { t as contractFromJson } from "./contract-from-json-CuzxHkGa-CoiMbCP1.mjs";
2
- import { r as postgresStatic } from "./postgres-static-Dp8FC0q0-L7yDo9e1.mjs";
1
+ import { t as contractFromJson } from "./contract-from-json-C6uR3W9i-DVRdyn3s.mjs";
2
+ import { r as postgresStatic } from "./postgres-static-BTm72P3P-h_XgLqsh.mjs";
3
3
  export { contractFromJson, postgresStatic as default };
package/package.json CHANGED
@@ -1,19 +1,22 @@
1
1
  {
2
2
  "name": "@prisma/orm-postgres",
3
- "version": "8.0.0-rc.24-dev.31",
3
+ "version": "8.0.0-rc.24-dev.33",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "description": "Prisma 8 for Postgres: the one package a Postgres application installs",
8
+ "keywords": [
9
+ "prisma-orm-extension"
10
+ ],
8
11
  "files": [
9
12
  "dist",
10
13
  "skills"
11
14
  ],
12
15
  "dependencies": {
13
- "@prisma/orm-family-sql": "8.0.0-rc.24-dev.31",
14
- "@prisma/orm-framework": "8.0.0-rc.24-dev.31",
15
- "@prisma/orm-target-postgres": "8.0.0-rc.24-dev.31",
16
- "@prisma/orm-toolchain": "8.0.0-rc.24-dev.31",
16
+ "@prisma/orm-family-sql": "8.0.0-rc.24-dev.33",
17
+ "@prisma/orm-framework": "8.0.0-rc.24-dev.33",
18
+ "@prisma/orm-target-postgres": "8.0.0-rc.24-dev.33",
19
+ "@prisma/orm-toolchain": "8.0.0-rc.24-dev.33",
17
20
  "@types/node": "26.1.2",
18
21
  "arktype": "^2.2.9",
19
22
  "pathe": "^2.0.3",
@@ -21,9 +24,9 @@
21
24
  "tinyglobby": "^0.2.17"
22
25
  },
23
26
  "devDependencies": {
24
- "@internal/postgres": "8.0.0-rc.24-dev.31",
25
- "@repo/tsconfig": "8.0.0-rc.24-dev.31",
26
- "@repo/tsdown": "8.0.0-rc.24-dev.31",
27
+ "@internal/postgres": "8.0.0-rc.24-dev.33",
28
+ "@repo/tsconfig": "8.0.0-rc.24-dev.33",
29
+ "@repo/tsdown": "8.0.0-rc.24-dev.33",
27
30
  "tsdown": "0.22.14",
28
31
  "typescript": "5.9.3"
29
32
  },
@@ -15,7 +15,7 @@ description: >-
15
15
  ORM 7 or earlier (schema.prisma + @prisma/client).
16
16
  metadata:
17
17
  library: '@prisma/orm-postgres'
18
- library_version: '8.0.0-rc.24-dev.31'
18
+ library_version: '8.0.0-rc.24-dev.33'
19
19
  version: '2026-09-12'
20
20
  ---
21
21
 
@@ -27,10 +27,10 @@ Prisma 8 moves fast, and your training data about it is very likely outdated. Th
27
27
 
28
28
  ## Pre-conditions
29
29
 
30
- Check these before acting on anything below. Halt on the first one that fails and tell the user what is missing.
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
- 1. **The project is on Prisma 8.** `prisma.config.ts` exports `definePrismaConfig({ orm: ... })`, and `package.json` depends on `@prisma/orm-postgres`, `@prisma/orm-sqlite`, or `@prisma/orm-mongo`. 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.
32
+ 1. **The project is on Prisma 8.** `prisma.config.ts` exports `definePrismaConfig({ orm: ... })`, and `package.json` depends on a target package: `@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.
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
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.
@@ -73,6 +73,7 @@ Open the reference whose triggers match the task. If more than one matches, open
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
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/) |
76
+ | Build a target package | [`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` |
76
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 |
77
78
 
78
79
  ## Routing rules
@@ -0,0 +1,110 @@
1
+ # Build a target package
2
+
3
+ This reference is for the author of a package that adds a database target to Prisma 8, outside Prisma's repository. An application installs the package, imports `defineConfig` from it in `prisma.config.ts`, and runs `prisma orm init --target <your package>` and `prisma contract emit` exactly as an application on `@prisma/orm-postgres` does. Prisma's own target packages use the mechanisms below, with no path an outside package lacks.
4
+
5
+ `prisma-orm-acmedb` stands for your package throughout.
6
+
7
+ ## What the package exports
8
+
9
+ | Entrypoint | Holds | Needed for |
10
+ | --- | --- | --- |
11
+ | `/config` | `defineConfig`, which names the two modules below | every command |
12
+ | `/contract-types` | the types a generated `contract.d.ts` imports | `prisma contract emit` |
13
+ | `/migration` | the migration base class, the command-line entry and your operation helpers | `prisma migration plan` |
14
+ | `/init` | the init contribution | `prisma orm init` |
15
+ | `/runtime` | your client factory | the application's `db.ts` |
16
+
17
+ `/contract-builder` (the TypeScript contract builder bound to your target) and `/control` (a client for scripts) are conventions Prisma's packages follow. The Postgres package is the reference for all of these: `packages/3-targets/postgres/` in the prisma/orm repository, whose `9-facade` folder is the package applications install.
18
+
19
+ ## Generated files import from your package
20
+
21
+ An application can import only from packages it depends on directly, which is your package and not the ones it is built from. So the config your `defineConfig` returns names the modules generated files import from:
22
+
23
+ ```ts
24
+ // src/config.ts
25
+ import { defineConfig as defineFrameworkConfig } from '@prisma/orm-framework/config/config-types';
26
+ import { adapter, driver, family, migrationModule, target, typesModule } from './components';
27
+
28
+ export function defineConfig(options: AcmeConfigOptions) {
29
+ return defineFrameworkConfig({
30
+ family,
31
+ target,
32
+ adapter,
33
+ driver,
34
+ contract: { ...contractSource(options), typesModule },
35
+ migrations: { ...options.migrations, module: migrationModule },
36
+ });
37
+ }
38
+ ```
39
+
40
+ - **`contract.typesModule`** is your `/contract-types` module. It only re-exports: the framework's contract types, the family's, and your target's codec and operation types.
41
+
42
+ ```ts
43
+ // src/contract-types.ts
44
+ export type * from '@prisma/orm-framework/contract/types';
45
+ export type * from '@prisma/orm-family-sql/contract/types';
46
+ export type * from './codec-types';
47
+ export type * from './operation-types';
48
+ ```
49
+
50
+ - **`migrations.module`** is your `/migration` module. A migration plan's `renderTypeScript(migrationModule)` receives it; write every import of a rendered `migration.ts` from it, and name no module in the renderer itself. Export `placeholder` from it under that name, so `prisma db migrate` can refuse an unfilled migration.
51
+ - **Your target's and adapter's type declarations name your types module.** When the descriptors live in another package of yours, hand the config copies that do: `restateTypeDeclarations(descriptor, typesModule)` from `@prisma/orm-framework/target-package-config/type-declarations`.
52
+ - **Assemble the components in one file** and build both `defineConfig` and any control client from it, so a command and a script are given the same components.
53
+
54
+ A config that names neither module stops with `CONFIG.CONTRACT_TYPES_MODULE_MISSING` or `CONFIG.MIGRATION_MODULE_MISSING`. A module is named the way a package is imported: a path or a URL is refused, because generated files are written into more than one folder.
55
+
56
+ ## `prisma orm init` writes the project from your package
57
+
58
+ `init` checks that your package lists the `prisma-orm-extension` keyword (see *Package rules*), installs it, loads the default export of its `/init` entrypoint, and writes the project from it:
59
+
60
+ ```ts
61
+ // src/init.ts
62
+ import type { InitContribution } from '@prisma/orm-toolchain/cli/init-contribution';
63
+
64
+ export default {
65
+ label: 'AcmeDB',
66
+ configModule: 'prisma-orm-acmedb/config',
67
+ peerPackages: ['acmedb-driver'],
68
+ authoringModes: ['psl', 'typescript'],
69
+ starterContract: (mode) => (mode === 'psl' ? starterPsl : starterTs),
70
+ contractSample: (mode) => (mode === 'psl' ? samplePsl : sampleTs),
71
+ databaseFile: () => dbFile,
72
+ envExample: () => 'DATABASE_URL="acmedb://user:password@localhost:5000/mydb"\n',
73
+ quickReference: (input) => renderQuickReference(input),
74
+ serverRequirement: { minVersion: ACMEDB_MIN_SERVER_VERSION, checkCommand: 'SELECT version()' },
75
+ probe: (databaseUrl, signal) => probeAcmeDb(databaseUrl, signal),
76
+ } satisfies InitContribution;
77
+ ```
78
+
79
+ | Member | What `init` does with it |
80
+ | --- | --- |
81
+ | `label` | Shows it as the target's name |
82
+ | `configModule` | Writes `prisma.config.ts` importing `defineConfig` from it |
83
+ | `peerPackages` | Installs these driver packages into the application, after the questions |
84
+ | `authoringModes` | Offers these ways to write the contract; a mode you do not list is refused |
85
+ | `starterContract(mode)`, `contractSample(mode)` | Writes the starter contract, and shows the sample in the quick reference |
86
+ | `databaseFile()` | Writes `db.ts`, beside the emitted `contract.json` and `contract.d.ts` |
87
+ | `envExample()` | Writes `.env.example`, and `.env` when the user asks for one |
88
+ | `quickReference(input)` | Writes the getting-started document |
89
+ | `readme(input)` | Optional. Writes a README in a project that already has `src/index.ts` |
90
+ | `serverRequirement` | Optional. States the minimum server version in the quick reference |
91
+ | `probe(databaseUrl, signal)` | Optional. Runs for `--probe-db` |
92
+ | `prisma7QuickReference(input)` | Optional. Required when your `configModule` exports `prisma7Schema` |
93
+
94
+ Rules:
95
+
96
+ - **No framework code runs in `/init`.** Types are fine. The CLI that loads it may be a different installed copy of the framework from the one your package depends on, and two copies in one process do not recognise each other's values.
97
+ - **The connection string is `DATABASE_URL`.** `prisma.config.ts`, `db.ts` and `--probe-db` read it, and `dotenv` is installed with your package, so `db.ts` may import `dotenv/config`. `--probe-db` reads it from the shell's environment, not from `.env`.
98
+ - **Drivers.** `init` reads `peerPackages` only after your package is installed. The first install is your package and `dotenv`; the package manager handles your package's required peers its own way, and a configuration that refuses a package without its peers makes that install fail, which `init` reports. Declare your driver as a required peer dependency, and list it in `peerPackages` so `init` declares it in the application.
99
+ - **The probe** resolves to the server's version, `driver-missing`, `driver-failed`, or `version-unreadable` once connected, and rejects only when it cannot connect. Bound its connect and query with your driver's own timeouts. `init` aborts `signal` after 60 seconds; close your client when it fires.
100
+
101
+ ## Package rules
102
+
103
+ - Name the package `prisma-orm-<name>`, under your scope if you have one, and add the keyword `prisma-orm-extension` to its `package.json`. The keyword is required: `prisma orm init --target` reads it before installing your package and refuses a package without it. `init` checks the copy it is about to load: the registry's `latest` version when it will install your package, and the installed `package.json` when the project already declares your package and has it on disk. It asks the registry without credentials, so a user of a package on a registry that needs them, or on a scope's own registry, installs the package first and then runs `init`.
104
+ - Depend on the Prisma packages your code imports at run time (`@prisma/orm-framework`, your family's package), each pinned to one exact version; see [`upgrade-extension.md`](upgrade-extension.md) § *Exact-pin rule*.
105
+ - `/init` imports only the `InitContribution` type from `@prisma/orm-toolchain`. If that is your package's only use of it, make it a development dependency: as a pinned dependency it gives the application a second copy of the toolchain whenever its `prisma` is another version.
106
+ - Import or name no module beginning `@internal/`. Those are Prisma's private workspace names.
107
+
108
+ ## Check it from outside
109
+
110
+ Pack your package and install the tarball into a scratch application that depends on nothing from Prisma except the CLI. Run `prisma orm init --target <your package>`, `prisma contract emit` and `prisma migration plan`, then typecheck with `skipLibCheck` off. Every import in the generated files names your package, an extension's own package, or a relative path.
@@ -186,7 +186,7 @@ pnpm dlx prisma@latest orm init --yes --target postgres --authoring psl
186
186
 
187
187
  The flags `init` accepts (run `prisma orm init --help` for the source of truth):
188
188
 
189
- - `--target <db>` — `postgres` or `mongodb`.
189
+ - `--target <package>` — `postgres`, `mongodb`, or the name of another target package, such as `@prisma/orm-sqlite`.
190
190
  - `--authoring <style>` — `psl` or `typescript`.
191
191
  - `--schema-path <path>` — where to write the starter schema. Defaults to `src/prisma/contract.prisma` (or `src/prisma/contract.ts` with `--authoring typescript`), the canonical layout above. The extension must agree with `--authoring` (`CLI.INIT_AUTHORING_SCHEMA_PATH_MISMATCH` otherwise).
192
192
  - `--confirm <directory name>` — grant the reinit consent non-interactively. Re-running init in a scaffolded directory asks you to type the directory name back before it overwrites; non-interactive runs pass the name with this flag instead (`--yes` does not grant it).
@@ -309,7 +309,7 @@ Order matters: `beforeEncode` runs in registration order for every middleware be
309
309
 
310
310
  ## Workflow — Configure the connection
311
311
 
312
- The concept: the runtime takes one of three binding shapes — `url`, `pg` (a pre-constructed `pg.Pool` or `pg.Client`), or `binding` (an explicit kind tag). They're mutually exclusive. The `pg` form is for projects that already manage their own pool (e.g. a Lambda layer); `url` is the default. Pool tuning is `poolOptions.connectionTimeoutMillis` / `poolOptions.idleTimeoutMillis` — *not* `driverOptions`. Reads are buffered by default; setting `cursor` (`{ batchSize: 100 }`; `{}` or `{ batchSize: undefined }` for batches of 100; a `batchSize` that is not a positive integer fails the factory call) makes them stream through a server-side cursor, and there is no flag that turns cursors off (see `references/queries.md` § *Streaming*). `postgresServerless()` takes the same `cursor` option. Pass `log` (an object with `info`, `warn`, `error` and an optional `debug`; `console` works, and the type is `Log` from `@prisma/orm-postgres/family-runtime`) to receive what the runtime logs: the marker-verification warnings `CONTRACT.MARKER_MISSING` and `CONTRACT.MARKER_MISMATCH` from the first query, the warnings `lints()` emits for rules whose severity is `warn`, and the errors a middleware's `activityEnded` or `activityFinalized` hook throws, which the runtime logs and swallows. If `log` has a `debug` method, it also receives debug events, for example when a middleware intercepts a statement. `budgets()` violations reach `log` only in `mode: 'permissive'` (see *Lints and budgets middleware*). Without `log`, the runtime drops these events. `postgresServerless()`, `sqlite()` and `supabase()` take the same option.
312
+ The concept: the runtime takes one of three binding shapes — `url`, `pg` (a pre-constructed `pg.Pool` or `pg.Client`), or `binding` (an explicit kind tag). They're mutually exclusive. The `pg` form is for projects that already manage their own pool (e.g. a Lambda layer); `url` is the default. Pool tuning is `poolOptions.connectionTimeoutMillis` / `poolOptions.idleTimeoutMillis` / `poolOptions.max` (pool size, 10 by default) — *not* `driverOptions`. Behind a server-side connection pooler, `poolOptions: { max: 1 }` keeps one connection; queries then take turns on it, so a query waits while a transaction is open. Inside `db.transaction(async (tx) => …)` send every query through `tx`: with one connection, a query through `db` waits for the connection its own transaction holds and fails after `connectionTimeoutMillis`. With one connection, let the client's first query or transaction finish before it takes concurrent work: the contract marker check before the first query needs the connection, and a transaction and a query that both start first fail with `CONTRACT.MARKER_READ_FAILED`. Reads are buffered by default; setting `cursor` (`{ batchSize: 100 }`; `{}` or `{ batchSize: undefined }` for batches of 100; a `batchSize` that is not a positive integer fails the factory call) makes them stream through a server-side cursor, and there is no flag that turns cursors off (see `references/queries.md` § *Streaming*). `postgresServerless()` takes the same `cursor` option. Pass `log` (an object with `info`, `warn`, `error` and an optional `debug`; `console` works, and the type is `Log` from `@prisma/orm-postgres/family-runtime`) to receive what the runtime logs: the marker-verification warnings `CONTRACT.MARKER_MISSING` and `CONTRACT.MARKER_MISMATCH` from the first query, the warnings `lints()` emits for rules whose severity is `warn`, and the errors a middleware's `activityEnded` or `activityFinalized` hook throws, which the runtime logs and swallows. If `log` has a `debug` method, it also receives debug events, for example when a middleware intercepts a statement. `budgets()` violations reach `log` only in `mode: 'permissive'` (see *Lints and budgets middleware*). Without `log`, the runtime drops these events. `postgresServerless()`, `sqlite()` and `supabase()` take the same option.
313
313
 
314
314
  ```typescript
315
315
  // Default — URL string, factory constructs the pool.
@@ -319,6 +319,7 @@ postgres({
319
319
  poolOptions: {
320
320
  connectionTimeoutMillis: 20_000,
321
321
  idleTimeoutMillis: 30_000,
322
+ // max: 10, // optional: the most connections the pool opens
322
323
  },
323
324
  // cursor: { batchSize: 100 }, // optional — stream reads in batches instead of buffering
324
325
  // log: console, // optional — receive marker and lints() warnings
@@ -440,7 +441,7 @@ The runtime side (this skill) is the same regardless: `db.ts` reads `contract.js
440
441
 
441
442
  - **A `/middleware` subpath or a telemetry package.** Neither exists. The middleware surface is `lints`, `budgets`, and the `SqlMiddleware` type on `@prisma/orm-postgres/family-runtime`, plus the separately installed `@prisma/orm-extension-middleware-cache`. Anything else (query log, tracing spans, metrics) is a custom middleware you write on the lifecycle events. File additional gaps you hit via `references/feedback.md`.
442
443
  - **Multi-database routing / read replicas.** Prisma 8 doesn't ship a built-in primary/replica router or shard-aware client. Workaround: configure separate `db.ts` instances per data store and call the right one in your application code. If you need first-class multi-database routing, file a feature request via the `references/feedback.md` skill.
443
- - **Connection pooling as a first-class config field.** `poolOptions.connectionTimeoutMillis` and `poolOptions.idleTimeoutMillis` are wired through, but the rest of `pg.Pool`'s tuning surface (max connections, `allowExitOnIdle`, ssl options, …) is not exposed by name. Workaround: construct the `pg.Pool` yourself and pass it via `pg:`. If you need more pool fields surfaced on the façade, file a feature request via the `references/feedback.md` skill.
444
+ - **Connection pooling as a first-class config field.** `poolOptions.connectionTimeoutMillis`, `poolOptions.idleTimeoutMillis` and `poolOptions.max` are wired through, but the rest of `pg.Pool`'s tuning surface (`allowExitOnIdle`, ssl options, …) is not exposed by name. Workaround: construct the `pg.Pool` yourself and pass it via `pg:`. If you need more pool fields surfaced on the façade, file a feature request via the `references/feedback.md` skill.
444
445
  - **Query logger middleware as a built-in.** Prisma 8 doesn't ship a "log every query" middleware. Workaround: a custom `activityEnded` middleware (see *Workflow — Custom middleware*). If you need a built-in query log, file a feature request via the `references/feedback.md` skill.
445
446
 
446
447
  ## Reference Files
@@ -122,7 +122,7 @@ export const db = await supabase({
122
122
  });
123
123
  ```
124
124
 
125
- Options beyond the basics: `middleware` (same composition as `postgres()` — see `references/runtime.md`; middleware never sees the role-binding `set_config` calls), `poolOptions`, `pg` (BYO `pg.Pool` instead of `url`; a `pg.Client` is rejected with `SUPABASE.CONFIG_INVALID`). Teardown is `await db.close()` / `await using` exactly as in `references/runtime.md` — the same script-hang rules apply.
125
+ Options beyond the basics: `middleware` (same composition as `postgres()` — see `references/runtime.md`; middleware never sees the role-binding `set_config` calls), `poolOptions` (keep `max` at 2 or more unless `verifyMarker` is `false`, and the same for a `pg.Pool` you pass in: the first query's marker check needs a connection besides the role-bound one. If the client's first role-bound queries arrive together and take every connection before one check has finished, they fail when the connection timeout ends; let one query finish before the client takes concurrent work), `pg` (BYO `pg.Pool` instead of `url`; a `pg.Client` is rejected with `SUPABASE.CONFIG_INVALID`). Teardown is `await db.close()` / `await using` exactly as in `references/runtime.md` — the same script-hang rules apply.
126
126
 
127
127
  ## Workflow — Role-bound queries
128
128
 
@@ -1 +0,0 @@
1
- {"version":3,"file":"postgres-options-B0YrJID9-YkuL0Mao.d.mts","names":[],"sources":["../../../../3-targets/postgres/9-facade/dist/postgres-options-B0YrJID9.d.mts"],"mappings":";;;;;;KAKK,8BAA8B,YAAY;;UAErC;WACC;WACA;;;;;;;UAOD;WACC;;;;;;UAMD,iCAAiC,oBAAoB;WACpD,SAAS;WACT,qBAAqB;;UAEtB;WACC,iBAAiB;WACjB;;iBAEM,2BAA2B,SAAS,yCAAyC;iBAC7E,sBAAsB,QAAQ,mCAAmC,iBAAiB;iBAClF,sBAAsB,QAAQ,oCAAoC"}