@prisma/orm-postgres 8.0.0-rc.11-dev.32 → 8.0.0-rc.11-dev.34

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.
@@ -1,11 +1,11 @@
1
1
  import { PG_ENUM_CODEC_ID } from "@prisma/orm-target-postgres/target/codec-ids";
2
+ import { blindCast } from "@prisma/orm-framework/utils/casts";
2
3
  import { buildNamespacedEnums, createEnumAccessor } from "@prisma/orm-framework/contract/enum-accessor";
3
4
  import postgresAdapter from "@prisma/orm-target-postgres/adapter/runtime";
4
5
  import { createRawLane, sql } from "@prisma/orm-family-sql/builder/runtime";
5
6
  import { createExecutionContext, createSqlExecutionStack } from "@prisma/orm-family-sql/runtime";
6
7
  import postgresTarget, { PostgresContractSerializer } from "@prisma/orm-target-postgres/target/runtime";
7
- import { blindCast } from "@prisma/orm-framework/utils/casts";
8
- //#region ../../../3-extensions/postgres/dist/postgres-static-DBYpkrmX.mjs
8
+ //#region ../../../3-extensions/postgres/dist/postgres-static-KmLmp8vV.mjs
9
9
  /**
10
10
  * Reads the namespace's `valueSet` entries directly off the plain contract
11
11
  * shape (`storage.namespaces[id].entries.valueSet`), not through a hydrated
@@ -73,4 +73,4 @@ function postgresStatic(options) {
73
73
  //#endregion
74
74
  export { buildPostgresStaticContext as n, postgresStatic as r, buildNamespacedNativeEnums as t };
75
75
 
76
- //# sourceMappingURL=postgres-static-DBYpkrmX-W8VjIiiv.mjs.map
76
+ //# sourceMappingURL=postgres-static-KmLmp8vV-qgkhJAEz.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"postgres-static-DBYpkrmX-W8VjIiiv.mjs","names":[],"sources":["../../../../3-extensions/postgres/dist/postgres-static-DBYpkrmX.mjs"],"sourcesContent":["import { PG_ENUM_CODEC_ID } from \"@internal/target-postgres/codec-ids\";\nimport { buildNamespacedEnums, createEnumAccessor } from \"@internal/contract/enum-accessor\";\nimport postgresAdapter from \"@internal/adapter-postgres/runtime\";\nimport { createRawLane, sql } from \"@internal/sql-builder/runtime\";\nimport { createExecutionContext, createSqlExecutionStack } from \"@internal/sql-runtime\";\nimport postgresTarget, { PostgresContractSerializer } from \"@internal/target-postgres/runtime\";\nimport { blindCast } from \"@internal/utils/casts\";\n//#region src/runtime/native-enums.ts\n/**\n* Reads the namespace's `valueSet` entries directly off the plain contract\n* shape (`storage.namespaces[id].entries.valueSet`), not through a hydrated\n* `PostgresSchema` class instance — the same plain-data path `db.enums`\n* reads `domain.namespaces[id].enum` through. Works on a `validateContract`'d\n* JSON contract as well as one produced by `PostgresContractSerializer`.\n*\n* A native enum is never re-emitted as its own entity: once `native_enum` is\n* lowered, its member values live on in the `valueSet` entry it derives (the\n* SQL family's generic `deriveValueSet` mechanism) — the same slot\n* `column.valueSet`-typed columns read. A member is a value, not a\n* name→value pair (matching `CREATE TYPE … AS ENUM ('a', 'b')`), so each\n* value doubles as its own accessor name.\n*/\nfunction buildNativeEnumsMapForNamespace(storage, namespaceId) {\n\tconst result = {};\n\tconst valueSets = storage.namespaces[namespaceId]?.entries.valueSet;\n\tif (!valueSets) return result;\n\tfor (const [name, valueSet] of Object.entries(valueSets)) result[name] = createEnumAccessor({\n\t\tcodecId: PG_ENUM_CODEC_ID,\n\t\tmembers: valueSet.values.map((value) => ({\n\t\t\tname: String(value),\n\t\t\tvalue\n\t\t}))\n\t});\n\treturn result;\n}\nfunction buildNamespacedNativeEnums(storage) {\n\tconst result = {};\n\tfor (const namespaceId of Object.keys(storage.namespaces)) result[namespaceId] = buildNativeEnumsMapForNamespace(storage, namespaceId);\n\treturn result;\n}\n//#endregion\n//#region src/static/postgres-static.ts\nfunction buildPostgresStaticContext(context, rawCodecInferer) {\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\tconst enums = Object.freeze(buildNamespacedEnums(context.contract.domain));\n\tconst nativeEnums = blindCast(Object.freeze(buildNamespacedNativeEnums(context.contract.storage)));\n\treturn {\n\t\tcontext,\n\t\tcontract: context.contract,\n\t\tenums,\n\t\tnativeEnums,\n\t\tsql: sqlDb,\n\t\traw\n\t};\n}\nfunction postgresStatic(options) {\n\tconst contract = blindCast(new PostgresContractSerializer().deserializeContract(options.contractJson));\n\tconst stack = createSqlExecutionStack({\n\t\ttarget: postgresTarget,\n\t\tadapter: postgresAdapter,\n\t\textensions: options.extensions ?? []\n\t});\n\treturn buildPostgresStaticContext(createExecutionContext({\n\t\tcontract,\n\t\tstack\n\t}), stack.adapter.rawCodecInferer);\n}\n//#endregion\nexport { postgresStatic as n, buildNamespacedNativeEnums as r, buildPostgresStaticContext as t };\n\n//# sourceMappingURL=postgres-static-DBYpkrmX.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAsBA,SAAS,gCAAgC,SAAS,aAAa;CAC9D,MAAM,SAAS,CAAC;CAChB,MAAM,YAAY,QAAQ,WAAW,YAAY,EAAE,QAAQ;CAC3D,IAAI,CAAC,WAAW,OAAO;CACvB,KAAK,MAAM,CAAC,MAAM,aAAa,OAAO,QAAQ,SAAS,GAAG,OAAO,QAAQ,mBAAmB;EAC3F,SAAS;EACT,SAAS,SAAS,OAAO,KAAK,WAAW;GACxC,MAAM,OAAO,KAAK;GAClB;EACD,EAAE;CACH,CAAC;CACD,OAAO;AACR;AACA,SAAS,2BAA2B,SAAS;CAC5C,MAAM,SAAS,CAAC;CAChB,KAAK,MAAM,eAAe,OAAO,KAAK,QAAQ,UAAU,GAAG,OAAO,eAAe,gCAAgC,SAAS,WAAW;CACrI,OAAO;AACR;AAGA,SAAS,2BAA2B,SAAS,iBAAiB;CAC7D,MAAM,QAAQ,IAAI;EACjB;EACA;CACD,CAAC;CACD,MAAM,MAAM,cAAc;EACzB;EACA;CACD,CAAC;CACD,MAAM,QAAQ,OAAO,OAAO,qBAAqB,QAAQ,SAAS,MAAM,CAAC;CACzE,MAAM,cAAc,UAAU,OAAO,OAAO,2BAA2B,QAAQ,SAAS,OAAO,CAAC,CAAC;CACjG,OAAO;EACN;EACA,UAAU,QAAQ;EAClB;EACA;EACA,KAAK;EACL;CACD;AACD;AACA,SAAS,eAAe,SAAS;CAChC,MAAM,WAAW,UAAU,IAAI,2BAA2B,CAAC,CAAC,oBAAoB,QAAQ,YAAY,CAAC;CACrG,MAAM,QAAQ,wBAAwB;EACrC,QAAQ;EACR,SAAS;EACT,YAAY,QAAQ,cAAc,CAAC;CACpC,CAAC;CACD,OAAO,2BAA2B,uBAAuB;EACxD;EACA;CACD,CAAC,GAAG,MAAM,QAAQ,eAAe;AAClC"}
1
+ {"version":3,"file":"postgres-static-KmLmp8vV-qgkhJAEz.mjs","names":[],"sources":["../../../../3-extensions/postgres/dist/postgres-static-KmLmp8vV.mjs"],"sourcesContent":["import { PG_ENUM_CODEC_ID } from \"@internal/target-postgres/codec-ids\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { buildNamespacedEnums, createEnumAccessor } from \"@internal/contract/enum-accessor\";\nimport postgresAdapter from \"@internal/adapter-postgres/runtime\";\nimport { createRawLane, sql } from \"@internal/sql-builder/runtime\";\nimport { createExecutionContext, createSqlExecutionStack } from \"@internal/sql-runtime\";\nimport postgresTarget, { PostgresContractSerializer } from \"@internal/target-postgres/runtime\";\n//#region src/runtime/native-enums.ts\n/**\n* Reads the namespace's `valueSet` entries directly off the plain contract\n* shape (`storage.namespaces[id].entries.valueSet`), not through a hydrated\n* `PostgresSchema` class instance — the same plain-data path `db.enums`\n* reads `domain.namespaces[id].enum` through. Works on a `validateContract`'d\n* JSON contract as well as one produced by `PostgresContractSerializer`.\n*\n* A native enum is never re-emitted as its own entity: once `native_enum` is\n* lowered, its member values live on in the `valueSet` entry it derives (the\n* SQL family's generic `deriveValueSet` mechanism) — the same slot\n* `column.valueSet`-typed columns read. A member is a value, not a\n* name→value pair (matching `CREATE TYPE … AS ENUM ('a', 'b')`), so each\n* value doubles as its own accessor name.\n*/\nfunction buildNativeEnumsMapForNamespace(storage, namespaceId) {\n\tconst result = {};\n\tconst valueSets = storage.namespaces[namespaceId]?.entries.valueSet;\n\tif (!valueSets) return result;\n\tfor (const [name, valueSet] of Object.entries(valueSets)) result[name] = createEnumAccessor({\n\t\tcodecId: PG_ENUM_CODEC_ID,\n\t\tmembers: valueSet.values.map((value) => ({\n\t\t\tname: String(value),\n\t\t\tvalue\n\t\t}))\n\t});\n\treturn result;\n}\nfunction buildNamespacedNativeEnums(storage) {\n\tconst result = {};\n\tfor (const namespaceId of Object.keys(storage.namespaces)) result[namespaceId] = buildNativeEnumsMapForNamespace(storage, namespaceId);\n\treturn result;\n}\n//#endregion\n//#region src/static/postgres-static.ts\nfunction buildPostgresStaticContext(context, rawCodecInferer) {\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\tconst enums = Object.freeze(buildNamespacedEnums(context.contract.domain));\n\tconst nativeEnums = blindCast(Object.freeze(buildNamespacedNativeEnums(context.contract.storage)));\n\treturn {\n\t\tcontext,\n\t\tcontract: context.contract,\n\t\tenums,\n\t\tnativeEnums,\n\t\tsql: sqlDb,\n\t\traw\n\t};\n}\nfunction postgresStatic(options) {\n\tconst contract = blindCast(new PostgresContractSerializer().deserializeContract(options.contractJson));\n\tconst stack = createSqlExecutionStack({\n\t\ttarget: postgresTarget,\n\t\tadapter: postgresAdapter,\n\t\textensions: options.extensions ?? []\n\t});\n\treturn buildPostgresStaticContext(createExecutionContext({\n\t\tcontract,\n\t\tstack\n\t}), stack.adapter.rawCodecInferer);\n}\n//#endregion\nexport { postgresStatic as n, buildNamespacedNativeEnums as r, buildPostgresStaticContext as t };\n\n//# sourceMappingURL=postgres-static-KmLmp8vV.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAsBA,SAAS,gCAAgC,SAAS,aAAa;CAC9D,MAAM,SAAS,CAAC;CAChB,MAAM,YAAY,QAAQ,WAAW,YAAY,EAAE,QAAQ;CAC3D,IAAI,CAAC,WAAW,OAAO;CACvB,KAAK,MAAM,CAAC,MAAM,aAAa,OAAO,QAAQ,SAAS,GAAG,OAAO,QAAQ,mBAAmB;EAC3F,SAAS;EACT,SAAS,SAAS,OAAO,KAAK,WAAW;GACxC,MAAM,OAAO,KAAK;GAClB;EACD,EAAE;CACH,CAAC;CACD,OAAO;AACR;AACA,SAAS,2BAA2B,SAAS;CAC5C,MAAM,SAAS,CAAC;CAChB,KAAK,MAAM,eAAe,OAAO,KAAK,QAAQ,UAAU,GAAG,OAAO,eAAe,gCAAgC,SAAS,WAAW;CACrI,OAAO;AACR;AAGA,SAAS,2BAA2B,SAAS,iBAAiB;CAC7D,MAAM,QAAQ,IAAI;EACjB;EACA;CACD,CAAC;CACD,MAAM,MAAM,cAAc;EACzB;EACA;CACD,CAAC;CACD,MAAM,QAAQ,OAAO,OAAO,qBAAqB,QAAQ,SAAS,MAAM,CAAC;CACzE,MAAM,cAAc,UAAU,OAAO,OAAO,2BAA2B,QAAQ,SAAS,OAAO,CAAC,CAAC;CACjG,OAAO;EACN;EACA,UAAU,QAAQ;EAClB;EACA;EACA,KAAK;EACL;CACD;AACD;AACA,SAAS,eAAe,SAAS;CAChC,MAAM,WAAW,UAAU,IAAI,2BAA2B,CAAC,CAAC,oBAAoB,QAAQ,YAAY,CAAC;CACrG,MAAM,QAAQ,wBAAwB;EACrC,QAAQ;EACR,SAAS;EACT,YAAY,QAAQ,cAAc,CAAC;CACpC,CAAC;CACD,OAAO,2BAA2B,uBAAuB;EACxD;EACA;CACD,CAAC,GAAG,MAAM,QAAQ,eAAe;AAClC"}
package/dist/runtime.mjs CHANGED
@@ -1,13 +1,13 @@
1
1
  import { t as postgresError } from "./errors-DfWK9xep-CYOOg0sB.mjs";
2
- import { n as buildPostgresStaticContext, t as buildNamespacedNativeEnums } from "./postgres-static-DBYpkrmX-W8VjIiiv.mjs";
2
+ import { n as buildPostgresStaticContext, t as buildNamespacedNativeEnums } from "./postgres-static-KmLmp8vV-qgkhJAEz.mjs";
3
3
  import { t as PostgresRuntimeImpl } from "./postgres-runtime-oM2EIAjm-CZIDUstk.mjs";
4
4
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
5
5
  import { InternalError } from "@prisma/orm-framework/utils/internal-error";
6
+ import { blindCast, castAs } from "@prisma/orm-framework/utils/casts";
6
7
  import postgresAdapter from "@prisma/orm-target-postgres/adapter/runtime";
7
8
  import { sql } from "@prisma/orm-family-sql/builder/runtime";
8
9
  import { createExecutionContext, createSqlExecutionStack, withTransaction } from "@prisma/orm-family-sql/runtime";
9
10
  import postgresTarget, { PostgresContractSerializer } from "@prisma/orm-target-postgres/target/runtime";
10
- import { blindCast, castAs } from "@prisma/orm-framework/utils/casts";
11
11
  import postgresDriver, { suppressIdleConnectionErrors } from "@prisma/orm-target-postgres/driver/runtime";
12
12
  import { instantiateExecutionStack } from "@prisma/orm-framework/components/execution";
13
13
  import { orm, prepareQuery } from "@prisma/orm-family-sql/orm-client";
@@ -70,7 +70,7 @@ function resolvePostgresBinding(options) {
70
70
  }
71
71
  function resolveOptionalPostgresBinding(options) {
72
72
  if (Number(options.binding !== void 0) + Number(options.url !== void 0) + Number(options.pg !== void 0) === 0) return;
73
- return resolvePostgresBinding(options);
73
+ return resolvePostgresBinding(blindCast(options));
74
74
  }
75
75
  function hasContractJson(options) {
76
76
  return "contractJson" in options;
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.mjs","names":[],"sources":["../../../../3-extensions/postgres/dist/runtime.mjs"],"sourcesContent":["import { t as postgresError } from \"./errors-DfWK9xep.mjs\";\nimport { r as buildNamespacedNativeEnums, t as buildPostgresStaticContext } from \"./postgres-static-DBYpkrmX.mjs\";\nimport { t as PostgresRuntimeImpl } from \"./postgres-runtime-oM2EIAjm.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport postgresAdapter from \"@internal/adapter-postgres/runtime\";\nimport postgresDriver, { suppressIdleConnectionErrors } from \"@internal/driver-postgres/runtime\";\nimport { instantiateExecutionStack } from \"@internal/framework-components/execution\";\nimport { sql } from \"@internal/sql-builder/runtime\";\nimport { orm, prepareQuery } from \"@internal/sql-orm-client\";\nimport { createExecutionContext, createSqlExecutionStack, withTransaction } from \"@internal/sql-runtime\";\nimport postgresTarget, { PostgresContractSerializer } from \"@internal/target-postgres/runtime\";\nimport { blindCast, castAs } from \"@internal/utils/casts\";\nimport { Pool } from \"pg\";\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) {\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: \"postgres\",\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: \"postgres\",\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: \"postgres\",\n\t\treason: \"wrong scheme\",\n\t\treceived: parsed.protocol\n\t} });\n\treturn trimmed;\n}\nfunction resolvePostgresBinding(options) {\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: \"postgres\",\n\t\t\treason: \"zero or multiple binding inputs\"\n\t\t}\n\t});\n\tif (options.binding !== void 0) return options.binding;\n\tif (options.url !== void 0) return {\n\t\tkind: \"url\",\n\t\turl: validatePostgresUrl(options.url)\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 `binding: { kind: \\\"pgPool\\\", pool }` or `binding: { kind: \\\"pgClient\\\", client }` instead of `pg`.\",\n\t\tmeta: {\n\t\t\textension: \"postgres\",\n\t\t\treason: \"unrecognizable pg object\"\n\t\t}\n\t});\n}\nfunction resolveOptionalPostgresBinding(options) {\n\tif (Number(options.binding !== void 0) + Number(options.url !== void 0) + Number(options.pg !== void 0) === 0) return;\n\treturn resolvePostgresBinding(options);\n}\n//#endregion\n//#region src/runtime/postgres.ts\nfunction hasContractJson(options) {\n\treturn \"contractJson\" in options;\n}\nconst contractSerializer = new PostgresContractSerializer();\nfunction resolveContract(options) {\n\tconst contractJson = hasContractJson(options) ? options.contractJson : contractSerializer.serializeContract(options.contract);\n\treturn blindCast(contractSerializer.deserializeContract(contractJson));\n}\nfunction toRuntimeBinding(binding, options) {\n\tif (binding.kind !== \"url\") return binding;\n\treturn {\n\t\tkind: \"pgPool\",\n\t\tpool: suppressIdleConnectionErrors(new Pool({\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}))\n\t};\n}\nfunction postgres(options) {\n\tconst contract = resolveContract(options);\n\tlet binding = resolveOptionalPostgresBinding(options);\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: sql$1, raw: rawSqlTag, enums, nativeEnums } = buildPostgresStaticContext(context, stack.adapter.rawCodecInferer);\n\tlet runtimeInstance;\n\tlet runtimeDriver;\n\tlet driverConnected = false;\n\tlet connectPromise;\n\tlet backgroundConnectError;\n\tlet closed = false;\n\tlet ownedDispose;\n\tconst connectDriver = async (resolvedBinding) => {\n\t\tif (driverConnected) return;\n\t\tif (!runtimeDriver) throw new InternalError(\"Postgres runtime driver missing\");\n\t\tif (connectPromise) return connectPromise;\n\t\tconst runtimeBinding = toRuntimeBinding(resolvedBinding, options);\n\t\tif (resolvedBinding.kind === \"url\" && runtimeBinding.kind === \"pgPool\") {\n\t\t\tconst pool = runtimeBinding.pool;\n\t\t\tlet disposed = false;\n\t\t\townedDispose = async () => {\n\t\t\t\tif (disposed) return;\n\t\t\t\tdisposed = true;\n\t\t\t\tawait pool.end().then(() => void 0);\n\t\t\t};\n\t\t}\n\t\tconnectPromise = runtimeDriver.connect(runtimeBinding).then(() => {\n\t\t\tdriverConnected = true;\n\t\t}).catch(async (err) => {\n\t\t\tbackgroundConnectError = err;\n\t\t\tconnectPromise = void 0;\n\t\t\tawait ownedDispose?.().catch(() => void 0);\n\t\t\tthrow err;\n\t\t});\n\t\treturn connectPromise;\n\t};\n\tconst getRuntime = () => {\n\t\tif (closed) throw postgresError(\"DRIVER.NOT_CONNECTED\", \"Postgres client is closed\", {\n\t\t\twhy: \"close() was called on this client.\",\n\t\t\tfix: \"Create a new postgres(...) client.\",\n\t\t\tmeta: { extension: \"postgres\" }\n\t\t});\n\t\tif (backgroundConnectError !== void 0) throw backgroundConnectError;\n\t\tif (runtimeInstance) return runtimeInstance;\n\t\tconst stackInstance = instantiateExecutionStack(stack);\n\t\tconst driverDescriptor = stack.driver;\n\t\tif (!driverDescriptor) throw new InternalError(\"Driver descriptor missing from execution stack\");\n\t\tconst driver = driverDescriptor.create({ cursor: { disabled: true } });\n\t\truntimeDriver = driver;\n\t\tif (binding !== void 0) connectDriver(binding).catch(() => void 0);\n\t\truntimeInstance = new PostgresRuntimeImpl({\n\t\t\tcontext,\n\t\t\tadapter: stackInstance.adapter,\n\t\t\tdriver,\n\t\t\t...ifDefined(\"verifyMarker\", options.verifyMarker),\n\t\t\t...ifDefined(\"middleware\", options.middleware)\n\t\t});\n\t\treturn runtimeInstance;\n\t};\n\tconst orm$1 = orm({\n\t\truntime: {\n\t\t\tquery(plan) {\n\t\t\t\treturn getRuntime().query(plan);\n\t\t\t},\n\t\t\texecute(plan) {\n\t\t\t\treturn getRuntime().execute(plan);\n\t\t\t},\n\t\t\tconnection() {\n\t\t\t\treturn getRuntime().connection();\n\t\t\t}\n\t\t},\n\t\tcontext\n\t});\n\tfunction prepare(declaration, callback) {\n\t\treturn prepareQuery(getRuntime(), declaration, callback);\n\t}\n\treturn {\n\t\tsql: sql$1,\n\t\torm: orm$1,\n\t\tenums,\n\t\tnativeEnums,\n\t\traw: rawSqlTag,\n\t\tcontext,\n\t\tcontract,\n\t\tstack,\n\t\tasync connect(bindingInput) {\n\t\t\tif (closed) throw postgresError(\"DRIVER.NOT_CONNECTED\", \"Postgres client is closed\", {\n\t\t\t\twhy: \"close() was called on this client.\",\n\t\t\t\tfix: \"Create a new postgres(...) client.\",\n\t\t\t\tmeta: { extension: \"postgres\" }\n\t\t\t});\n\t\t\tif (driverConnected || connectPromise) throw postgresError(\"DRIVER.ALREADY_CONNECTED\", \"Postgres client already connected\", {\n\t\t\t\tfix: \"Call connect() at most once per client.\",\n\t\t\t\tmeta: { extension: \"postgres\" }\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\treturn runtime;\n\t\t},\n\t\truntime() {\n\t\t\treturn getRuntime();\n\t\t},\n\t\tprepare,\n\t\ttransaction(fn) {\n\t\t\treturn withTransaction(getRuntime(), (txCtx) => {\n\t\t\t\tconst rawCodecInferer = stack.adapter.rawCodecInferer;\n\t\t\t\tconst txSql = sql({\n\t\t\t\t\tcontext,\n\t\t\t\t\trawCodecInferer\n\t\t\t\t});\n\t\t\t\tconst txOrm = orm({\n\t\t\t\t\truntime: {\n\t\t\t\t\t\tquery(plan) {\n\t\t\t\t\t\t\treturn txCtx.query(plan);\n\t\t\t\t\t\t},\n\t\t\t\t\t\texecute(plan) {\n\t\t\t\t\t\t\treturn txCtx.execute(plan);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tcontext\n\t\t\t\t});\n\t\t\t\treturn fn(Object.assign(castAs(Object.create(txCtx)), {\n\t\t\t\t\tsql: txSql,\n\t\t\t\t\torm: txOrm,\n\t\t\t\t\tenums,\n\t\t\t\t\tnativeEnums\n\t\t\t\t}));\n\t\t\t});\n\t\t},\n\t\tasync close() {\n\t\t\tif (closed) return;\n\t\t\tclosed = true;\n\t\t\tawait connectPromise?.catch(() => void 0);\n\t\t\tawait ownedDispose?.();\n\t\t},\n\t\t[Symbol.asyncDispose]() {\n\t\t\treturn this.close();\n\t\t}\n\t};\n}\n//#endregion\nexport { PostgresRuntimeImpl, buildNamespacedNativeEnums, postgres as default, isPgClient, isPgPool };\n\n//# sourceMappingURL=runtime.mjs.map"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAM,YAAY,OAAO,gBAAgB,MAAM,eAAe,MAAM,kBAAkB;AACtF,MAAM,cAAc,OAAO,sBAAsB,MAAM,mBAAmB;AAC1E,SA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;EACA,MAAM,QAAQ;GACb,IAAI,QAAQ;GACZ,SAAS;GACT,MAAM,gBAAgB,YAAY,KAAK,CAAC;GACxC,MAAM,eAAe;EACtB;EACA,CAAC,OAAO,gBAAgB;GACvB,OAAO,KAAK,MAAM;EACnB;CACD;AACD"}
1
+ {"version":3,"file":"runtime.mjs","names":[],"sources":["../../../../3-extensions/postgres/dist/runtime.mjs"],"sourcesContent":["import { t as postgresError } from \"./errors-DfWK9xep.mjs\";\nimport { r as buildNamespacedNativeEnums, t as buildPostgresStaticContext } from \"./postgres-static-KmLmp8vV.mjs\";\nimport { t as PostgresRuntimeImpl } from \"./postgres-runtime-oM2EIAjm.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { blindCast, castAs } from \"@internal/utils/casts\";\nimport postgresAdapter from \"@internal/adapter-postgres/runtime\";\nimport postgresDriver, { suppressIdleConnectionErrors } from \"@internal/driver-postgres/runtime\";\nimport { instantiateExecutionStack } from \"@internal/framework-components/execution\";\nimport { sql } from \"@internal/sql-builder/runtime\";\nimport { orm, prepareQuery } from \"@internal/sql-orm-client\";\nimport { createExecutionContext, createSqlExecutionStack, withTransaction } from \"@internal/sql-runtime\";\nimport postgresTarget, { PostgresContractSerializer } from \"@internal/target-postgres/runtime\";\nimport { Pool } from \"pg\";\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) {\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: \"postgres\",\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: \"postgres\",\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: \"postgres\",\n\t\treason: \"wrong scheme\",\n\t\treceived: parsed.protocol\n\t} });\n\treturn trimmed;\n}\nfunction resolvePostgresBinding(options) {\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: \"postgres\",\n\t\t\treason: \"zero or multiple binding inputs\"\n\t\t}\n\t});\n\tif (options.binding !== void 0) return options.binding;\n\tif (options.url !== void 0) return {\n\t\tkind: \"url\",\n\t\turl: validatePostgresUrl(options.url)\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 `binding: { kind: \\\"pgPool\\\", pool }` or `binding: { kind: \\\"pgClient\\\", client }` instead of `pg`.\",\n\t\tmeta: {\n\t\t\textension: \"postgres\",\n\t\t\treason: \"unrecognizable pg object\"\n\t\t}\n\t});\n}\nfunction resolveOptionalPostgresBinding(options) {\n\tif (Number(options.binding !== void 0) + Number(options.url !== void 0) + Number(options.pg !== void 0) === 0) return;\n\treturn resolvePostgresBinding(blindCast(options));\n}\n//#endregion\n//#region src/runtime/postgres.ts\nfunction hasContractJson(options) {\n\treturn \"contractJson\" in options;\n}\nconst contractSerializer = new PostgresContractSerializer();\nfunction resolveContract(options) {\n\tconst contractJson = hasContractJson(options) ? options.contractJson : contractSerializer.serializeContract(options.contract);\n\treturn blindCast(contractSerializer.deserializeContract(contractJson));\n}\nfunction toRuntimeBinding(binding, options) {\n\tif (binding.kind !== \"url\") return binding;\n\treturn {\n\t\tkind: \"pgPool\",\n\t\tpool: suppressIdleConnectionErrors(new Pool({\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}))\n\t};\n}\nfunction postgres(options) {\n\tconst contract = resolveContract(options);\n\tlet binding = resolveOptionalPostgresBinding(options);\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: sql$1, raw: rawSqlTag, enums, nativeEnums } = buildPostgresStaticContext(context, stack.adapter.rawCodecInferer);\n\tlet runtimeInstance;\n\tlet runtimeDriver;\n\tlet driverConnected = false;\n\tlet connectPromise;\n\tlet backgroundConnectError;\n\tlet closed = false;\n\tlet ownedDispose;\n\tconst connectDriver = async (resolvedBinding) => {\n\t\tif (driverConnected) return;\n\t\tif (!runtimeDriver) throw new InternalError(\"Postgres runtime driver missing\");\n\t\tif (connectPromise) return connectPromise;\n\t\tconst runtimeBinding = toRuntimeBinding(resolvedBinding, options);\n\t\tif (resolvedBinding.kind === \"url\" && runtimeBinding.kind === \"pgPool\") {\n\t\t\tconst pool = runtimeBinding.pool;\n\t\t\tlet disposed = false;\n\t\t\townedDispose = async () => {\n\t\t\t\tif (disposed) return;\n\t\t\t\tdisposed = true;\n\t\t\t\tawait pool.end().then(() => void 0);\n\t\t\t};\n\t\t}\n\t\tconnectPromise = runtimeDriver.connect(runtimeBinding).then(() => {\n\t\t\tdriverConnected = true;\n\t\t}).catch(async (err) => {\n\t\t\tbackgroundConnectError = err;\n\t\t\tconnectPromise = void 0;\n\t\t\tawait ownedDispose?.().catch(() => void 0);\n\t\t\tthrow err;\n\t\t});\n\t\treturn connectPromise;\n\t};\n\tconst getRuntime = () => {\n\t\tif (closed) throw postgresError(\"DRIVER.NOT_CONNECTED\", \"Postgres client is closed\", {\n\t\t\twhy: \"close() was called on this client.\",\n\t\t\tfix: \"Create a new postgres(...) client.\",\n\t\t\tmeta: { extension: \"postgres\" }\n\t\t});\n\t\tif (backgroundConnectError !== void 0) throw backgroundConnectError;\n\t\tif (runtimeInstance) return runtimeInstance;\n\t\tconst stackInstance = instantiateExecutionStack(stack);\n\t\tconst driverDescriptor = stack.driver;\n\t\tif (!driverDescriptor) throw new InternalError(\"Driver descriptor missing from execution stack\");\n\t\tconst driver = driverDescriptor.create({ cursor: { disabled: true } });\n\t\truntimeDriver = driver;\n\t\tif (binding !== void 0) connectDriver(binding).catch(() => void 0);\n\t\truntimeInstance = new PostgresRuntimeImpl({\n\t\t\tcontext,\n\t\t\tadapter: stackInstance.adapter,\n\t\t\tdriver,\n\t\t\t...ifDefined(\"verifyMarker\", options.verifyMarker),\n\t\t\t...ifDefined(\"middleware\", options.middleware)\n\t\t});\n\t\treturn runtimeInstance;\n\t};\n\tconst orm$1 = orm({\n\t\truntime: {\n\t\t\tquery(plan) {\n\t\t\t\treturn getRuntime().query(plan);\n\t\t\t},\n\t\t\texecute(plan) {\n\t\t\t\treturn getRuntime().execute(plan);\n\t\t\t},\n\t\t\tconnection() {\n\t\t\t\treturn getRuntime().connection();\n\t\t\t}\n\t\t},\n\t\tcontext\n\t});\n\tfunction prepare(declaration, callback) {\n\t\treturn prepareQuery(getRuntime(), declaration, callback);\n\t}\n\treturn {\n\t\tsql: sql$1,\n\t\torm: orm$1,\n\t\tenums,\n\t\tnativeEnums,\n\t\traw: rawSqlTag,\n\t\tcontext,\n\t\tcontract,\n\t\tstack,\n\t\tasync connect(bindingInput) {\n\t\t\tif (closed) throw postgresError(\"DRIVER.NOT_CONNECTED\", \"Postgres client is closed\", {\n\t\t\t\twhy: \"close() was called on this client.\",\n\t\t\t\tfix: \"Create a new postgres(...) client.\",\n\t\t\t\tmeta: { extension: \"postgres\" }\n\t\t\t});\n\t\t\tif (driverConnected || connectPromise) throw postgresError(\"DRIVER.ALREADY_CONNECTED\", \"Postgres client already connected\", {\n\t\t\t\tfix: \"Call connect() at most once per client.\",\n\t\t\t\tmeta: { extension: \"postgres\" }\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\treturn runtime;\n\t\t},\n\t\truntime() {\n\t\t\treturn getRuntime();\n\t\t},\n\t\tprepare,\n\t\ttransaction(fn) {\n\t\t\treturn withTransaction(getRuntime(), (txCtx) => {\n\t\t\t\tconst rawCodecInferer = stack.adapter.rawCodecInferer;\n\t\t\t\tconst txSql = sql({\n\t\t\t\t\tcontext,\n\t\t\t\t\trawCodecInferer\n\t\t\t\t});\n\t\t\t\tconst txOrm = orm({\n\t\t\t\t\truntime: {\n\t\t\t\t\t\tquery(plan) {\n\t\t\t\t\t\t\treturn txCtx.query(plan);\n\t\t\t\t\t\t},\n\t\t\t\t\t\texecute(plan) {\n\t\t\t\t\t\t\treturn txCtx.execute(plan);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tcontext\n\t\t\t\t});\n\t\t\t\treturn fn(Object.assign(castAs(Object.create(txCtx)), {\n\t\t\t\t\tsql: txSql,\n\t\t\t\t\torm: txOrm,\n\t\t\t\t\tenums,\n\t\t\t\t\tnativeEnums\n\t\t\t\t}));\n\t\t\t});\n\t\t},\n\t\tasync close() {\n\t\t\tif (closed) return;\n\t\t\tclosed = true;\n\t\t\tawait connectPromise?.catch(() => void 0);\n\t\t\tawait ownedDispose?.();\n\t\t},\n\t\t[Symbol.asyncDispose]() {\n\t\t\treturn this.close();\n\t\t}\n\t};\n}\n//#endregion\nexport { PostgresRuntimeImpl, buildNamespacedNativeEnums, postgres as default, isPgClient, isPgPool };\n\n//# sourceMappingURL=runtime.mjs.map"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAM,YAAY,OAAO,gBAAgB,MAAM,eAAe,MAAM,kBAAkB;AACtF,MAAM,cAAc,OAAO,sBAAsB,MAAM,mBAAmB;AAC1E,SAAS,oBAAoB,KAAK;CACjC,MAAM,UAAU,IAAI,KAAK;CACzB,IAAI,QAAQ,WAAW,GAAG,MAAM,cAAc,2BAA2B,2CAA2C,EAAE,MAAM;EAC3H,WAAW;EACX,QAAQ;CACT,EAAE,CAAC;CACH,IAAI;CACJ,IAAI;EACH,SAAS,IAAI,IAAI,OAAO;CACzB,QAAQ;EACP,MAAM,cAAc,2BAA2B,oCAAoC,EAAE,MAAM;GAC1F,WAAW;GACX,QAAQ;EACT,EAAE,CAAC;CACJ;CACA,IAAI,OAAO,aAAa,eAAe,OAAO,aAAa,eAAe,MAAM,cAAc,2BAA2B,sDAAsD,EAAE,MAAM;EACtL,WAAW;EACX,QAAQ;EACR,UAAU,OAAO;CAClB,EAAE,CAAC;CACH,OAAO;AACR;AACA,SAAS,uBAAuB,SAAS;CACxC,IAAI,OAAO,QAAQ,YAAY,KAAK,CAAC,IAAI,OAAO,QAAQ,QAAQ,KAAK,CAAC,IAAI,OAAO,QAAQ,OAAO,KAAK,CAAC,MAAM,GAAG,MAAM,cAAc,2BAA2B,kDAAkD;EAC/M,KAAK;EACL,MAAM;GACL,WAA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AAW;GAC3B,IAAI,iBAAiB,OAAO;GAC5B,MAAM,cAAc,OAAO;GAC3B,OAAO;EACR;EACA,UAAU;GACT,OAAO,WAAW;EACnB;EACA;EACA,YAAY,IAAI;GACf,OAAO,gBAAgB,WAAW,IAAI,UAAU;IAC/C,MAAM,kBAAkB,MAAM,QAAQ;IACtC,MAAM,QAAQ,IAAI;KACjB;KACA;IACD,CAAC;IACD,MAAM,QAAQ,IAAI;KACjB,SAAS;MACR,MAAM,MAAM;OACX,OAAO,MAAM,MAAM,IAAI;MACxB;MACA,QAAQ,MAAM;OACb,OAAO,MAAM,QAAQ,IAAI;MAC1B;KACD;KACA;IACD,CAAC;IACD,OAAO,GAAG,OAAO,OAAO,OAAO,OAAO,OAAO,KAAK,CAAC,GAAG;KACrD,KAAK;KACL,KAAK;KACL;KACA;IACD,CAAC,CAAC;GACH,CAAC;EACF;EACA,MAAM,QAAQ;GACb,IAAI,QAAQ;GACZ,SAAS;GACT,MAAM,gBAAgB,YAAY,KAAK,CAAC;GACxC,MAAM,eAAe;EACtB;EACA,CAAC,OAAO,gBAAgB;GACvB,OAAO,KAAK,MAAM;EACnB;CACD;AACD"}
@@ -2,6 +2,7 @@ import { t as postgresError } from "./errors-DfWK9xep-CYOOg0sB.mjs";
2
2
  import { t as PostgresRuntimeImpl } from "./postgres-runtime-oM2EIAjm-CZIDUstk.mjs";
3
3
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
4
4
  import { InternalError } from "@prisma/orm-framework/utils/internal-error";
5
+ import { blindCast } from "@prisma/orm-framework/utils/casts";
5
6
  import postgresAdapter from "@prisma/orm-target-postgres/adapter/runtime";
6
7
  import { sql } from "@prisma/orm-family-sql/builder/runtime";
7
8
  import { createExecutionContext, createSqlExecutionStack } from "@prisma/orm-family-sql/runtime";
@@ -16,7 +17,7 @@ function hasContractJson(options) {
16
17
  const contractSerializer = new PostgresContractSerializer();
17
18
  function resolveContract(options) {
18
19
  const contractJson = hasContractJson(options) ? options.contractJson : contractSerializer.serializeContract(options.contract);
19
- return contractSerializer.deserializeContract(contractJson);
20
+ return blindCast(contractSerializer.deserializeContract(contractJson));
20
21
  }
21
22
  function validateConnectionString(url) {
22
23
  const trimmed = url.trim();
@@ -76,7 +77,7 @@ function postgresServerless(options) {
76
77
  writable: false,
77
78
  enumerable: false
78
79
  });
79
- return runtime;
80
+ return blindCast(runtime);
80
81
  }
81
82
  };
82
83
  }
@@ -1 +1 @@
1
- {"version":3,"file":"serverless.mjs","names":[],"sources":["../../../../3-extensions/postgres/dist/serverless.mjs"],"sourcesContent":["import { t as postgresError } from \"./errors-DfWK9xep.mjs\";\nimport { t as PostgresRuntimeImpl } from \"./postgres-runtime-oM2EIAjm.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport postgresAdapter from \"@internal/adapter-postgres/runtime\";\nimport postgresDriver, { suppressIdleConnectionErrors } from \"@internal/driver-postgres/runtime\";\nimport { instantiateExecutionStack } from \"@internal/framework-components/execution\";\nimport { sql } from \"@internal/sql-builder/runtime\";\nimport { createExecutionContext, createSqlExecutionStack } from \"@internal/sql-runtime\";\nimport postgresTarget, { PostgresContractSerializer } from \"@internal/target-postgres/runtime\";\nimport { Client } from \"pg\";\n//#region src/runtime/postgres-serverless.ts\nfunction hasContractJson(options) {\n\treturn \"contractJson\" in options;\n}\nconst contractSerializer = new PostgresContractSerializer();\nfunction resolveContract(options) {\n\tconst contractJson = hasContractJson(options) ? options.contractJson : contractSerializer.serializeContract(options.contract);\n\treturn contractSerializer.deserializeContract(contractJson);\n}\nfunction validateConnectionString(url) {\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: \"postgres\",\n\t\treason: \"empty url\"\n\t} });\n\treturn trimmed;\n}\nfunction postgresServerless(options) {\n\tconst contract = resolveContract(options);\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});\n\treturn {\n\t\tsql: sql({\n\t\t\tcontext,\n\t\t\trawCodecInferer: stack.adapter.rawCodecInferer\n\t\t}),\n\t\tcontext,\n\t\tstack,\n\t\tcontract,\n\t\tasync connect(binding) {\n\t\t\tconst url = validateConnectionString(binding.url);\n\t\t\tconst driverDescriptor = stack.driver;\n\t\t\tif (!driverDescriptor) throw new InternalError(\"Driver descriptor missing from execution stack\");\n\t\t\tconst stackInstance = instantiateExecutionStack(stack);\n\t\t\tconst driver = driverDescriptor.create({ ...ifDefined(\"cursor\", options.cursor) });\n\t\t\tconst client = suppressIdleConnectionErrors(new Client({ connectionString: url }));\n\t\t\tawait driver.connect({\n\t\t\t\tkind: \"pgClient\",\n\t\t\t\tclient\n\t\t\t});\n\t\t\tlet runtime;\n\t\t\ttry {\n\t\t\t\truntime = new PostgresRuntimeImpl({\n\t\t\t\t\tcontext,\n\t\t\t\t\tadapter: stackInstance.adapter,\n\t\t\t\t\tdriver,\n\t\t\t\t\t...ifDefined(\"verifyMarker\", options.verifyMarker),\n\t\t\t\t\t...ifDefined(\"middleware\", options.middleware)\n\t\t\t\t});\n\t\t\t} catch (err) {\n\t\t\t\tawait driver.close().catch(() => void 0);\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tObject.defineProperty(runtime, Symbol.asyncDispose, {\n\t\t\t\tvalue: () => runtime.close(),\n\t\t\t\tconfigurable: true,\n\t\t\t\twritable: false,\n\t\t\t\tenumerable: false\n\t\t\t});\n\t\t\treturn runtime;\n\t\t}\n\t};\n}\n//#endregion\nexport { postgresServerless as default };\n\n//# sourceMappingURL=serverless.mjs.map"],"mappings":";;;;;;;;;;;;AAYA,SAAS,gBAAgB,SAAS;CACjC,OAAO,kBAAkB;AAC1B;AACA,MAAM,qBAAqB,IAAI,2BAA2B;A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CAAC,YAAY,KAAK,CAAC;IACvC,MAAM;GACP;GACA,OAAO,eAAe,SAAS,OAAO,cAAc;IACnD,aAAa,QAAQ,MAAM;IAC3B,cAAc;IACd,UAAU;IACV,YAAY;GACb,CAAC;GACD,OAAO;EACR;CACD;AACD"}
1
+ {"version":3,"file":"serverless.mjs","names":[],"sources":["../../../../3-extensions/postgres/dist/serverless.mjs"],"sourcesContent":["import { t as postgresError } from \"./errors-DfWK9xep.mjs\";\nimport { t as PostgresRuntimeImpl } from \"./postgres-runtime-oM2EIAjm.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport postgresAdapter from \"@internal/adapter-postgres/runtime\";\nimport postgresDriver, { suppressIdleConnectionErrors } from \"@internal/driver-postgres/runtime\";\nimport { instantiateExecutionStack } from \"@internal/framework-components/execution\";\nimport { sql } from \"@internal/sql-builder/runtime\";\nimport { createExecutionContext, createSqlExecutionStack } from \"@internal/sql-runtime\";\nimport postgresTarget, { PostgresContractSerializer } from \"@internal/target-postgres/runtime\";\nimport { Client } from \"pg\";\n//#region src/runtime/postgres-serverless.ts\nfunction hasContractJson(options) {\n\treturn \"contractJson\" in options;\n}\nconst contractSerializer = new PostgresContractSerializer();\nfunction resolveContract(options) {\n\tconst contractJson = hasContractJson(options) ? options.contractJson : contractSerializer.serializeContract(options.contract);\n\treturn blindCast(contractSerializer.deserializeContract(contractJson));\n}\nfunction validateConnectionString(url) {\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: \"postgres\",\n\t\treason: \"empty url\"\n\t} });\n\treturn trimmed;\n}\nfunction postgresServerless(options) {\n\tconst contract = resolveContract(options);\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});\n\treturn {\n\t\tsql: sql({\n\t\t\tcontext,\n\t\t\trawCodecInferer: stack.adapter.rawCodecInferer\n\t\t}),\n\t\tcontext,\n\t\tstack,\n\t\tcontract,\n\t\tasync connect(binding) {\n\t\t\tconst url = validateConnectionString(binding.url);\n\t\t\tconst driverDescriptor = stack.driver;\n\t\t\tif (!driverDescriptor) throw new InternalError(\"Driver descriptor missing from execution stack\");\n\t\t\tconst stackInstance = instantiateExecutionStack(stack);\n\t\t\tconst driver = driverDescriptor.create({ ...ifDefined(\"cursor\", options.cursor) });\n\t\t\tconst client = suppressIdleConnectionErrors(new Client({ connectionString: url }));\n\t\t\tawait driver.connect({\n\t\t\t\tkind: \"pgClient\",\n\t\t\t\tclient\n\t\t\t});\n\t\t\tlet runtime;\n\t\t\ttry {\n\t\t\t\truntime = new PostgresRuntimeImpl({\n\t\t\t\t\tcontext,\n\t\t\t\t\tadapter: stackInstance.adapter,\n\t\t\t\t\tdriver,\n\t\t\t\t\t...ifDefined(\"verifyMarker\", options.verifyMarker),\n\t\t\t\t\t...ifDefined(\"middleware\", options.middleware)\n\t\t\t\t});\n\t\t\t} catch (err) {\n\t\t\t\tawait driver.close().catch(() => void 0);\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tObject.defineProperty(runtime, Symbol.asyncDispose, {\n\t\t\t\tvalue: () => runtime.close(),\n\t\t\t\tconfigurable: true,\n\t\t\t\twritable: false,\n\t\t\t\tenumerable: false\n\t\t\t});\n\t\t\treturn blindCast(runtime);\n\t\t}\n\t};\n}\n//#endregion\nexport { postgresServerless as default };\n\n//# sourceMappingURL=serverless.mjs.map"],"mappings":";;;;;;;;;;;;;AAaA,SAAS,gBAAgB,SAAS;CACjC,OAAO,kBAAkB;AAC1B;AACA,MAAM,qBAAqB,IAAI,2BAA2B;AAC1D,SAAS,gBAAgB,SAAS;CACjC,MAAM,eAAe,gBAAgB,OA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,OAAO,eAAe,SAAS,OAAO,cAAc;IACnD,aAAa,QAAQ,MAAM;IAC3B,cAAc;IACd,UAAU;IACV,YAAY;GACb,CAAC;GACD,OAAO,UAAU,OAAO;EACzB;CACD;AACD"}
package/dist/static.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { r as postgresStatic } from "./postgres-static-DBYpkrmX-W8VjIiiv.mjs";
1
+ import { r as postgresStatic } from "./postgres-static-KmLmp8vV-qgkhJAEz.mjs";
2
2
  export { postgresStatic as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/orm-postgres",
3
- "version": "8.0.0-rc.11-dev.32",
3
+ "version": "8.0.0-rc.11-dev.34",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -10,20 +10,20 @@
10
10
  "skills"
11
11
  ],
12
12
  "dependencies": {
13
- "@prisma/orm-family-sql": "8.0.0-rc.11-dev.32",
14
- "@prisma/orm-framework": "8.0.0-rc.11-dev.32",
15
- "@prisma/orm-target-postgres": "8.0.0-rc.11-dev.32",
16
- "@prisma/orm-toolchain": "8.0.0-rc.11-dev.32",
13
+ "@prisma/orm-family-sql": "8.0.0-rc.11-dev.34",
14
+ "@prisma/orm-framework": "8.0.0-rc.11-dev.34",
15
+ "@prisma/orm-target-postgres": "8.0.0-rc.11-dev.34",
16
+ "@prisma/orm-toolchain": "8.0.0-rc.11-dev.34",
17
17
  "@types/node": "26.1.2",
18
18
  "@types/pg": "8.20.4",
19
19
  "pathe": "^2.0.3",
20
20
  "pg": "8.22.0"
21
21
  },
22
22
  "devDependencies": {
23
- "@internal/postgres": "8.0.0-rc.11-dev.32",
24
- "@repo/tsconfig": "8.0.0-rc.11-dev.32",
25
- "@internal/publish-surface": "8.0.0-rc.11-dev.32",
26
- "@repo/tsdown": "8.0.0-rc.11-dev.32",
23
+ "@internal/postgres": "8.0.0-rc.11-dev.34",
24
+ "@repo/tsconfig": "8.0.0-rc.11-dev.34",
25
+ "@internal/publish-surface": "8.0.0-rc.11-dev.34",
26
+ "@repo/tsdown": "8.0.0-rc.11-dev.34",
27
27
  "tsdown": "0.22.14",
28
28
  "typescript": "5.9.3",
29
29
  "vitest": "5.0.0-rc.2"
@@ -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.11-dev.32'
18
+ library_version: '8.0.0-rc.11-dev.34'
19
19
  version: '2026-09-12'
20
20
  ---
21
21