@prisma/composer-prisma-cloud 0.1.0-dev.1 → 0.1.0-dev.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/control.d.mts +44 -4
- package/dist/control.mjs +155 -37
- package/dist/control.mjs.map +1 -1
- package/dist/cron/index.mjs +73 -8
- package/dist/cron/index.mjs.map +1 -1
- package/dist/cron/scheduler-entrypoint.mjs +158 -93
- package/dist/cron/scheduler-entrypoint.mjs.map +1 -1
- package/dist/cron/scheduler-service.mjs +73 -8
- package/dist/cron/scheduler-service.mjs.map +1 -1
- package/dist/index.d.mts +34 -15
- package/dist/index.mjs +4 -5
- package/dist/index.mjs.map +1 -1
- package/dist/{prisma-next-COrwlg3N.mjs → prisma-next-qPB8_Az6.mjs} +2 -2
- package/dist/prisma-next-qPB8_Az6.mjs.map +1 -0
- package/dist/prisma-next.d.mts +1 -1
- package/dist/prisma-next.mjs +1 -1
- package/dist/{param-DB0B8m15-IvzNq9BM.mjs → provisioned-edges-DIQAR4q4-Bn9op-JG.mjs} +87 -28
- package/dist/provisioned-edges-DIQAR4q4-Bn9op-JG.mjs.map +1 -0
- package/dist/{serializer-DAEWRfnm-D3GW9dOZ.mjs → serializer-CX4VYdf_-KKGoAxfx.mjs} +29 -3
- package/dist/{serializer-DAEWRfnm-D3GW9dOZ.mjs.map → serializer-CX4VYdf_-KKGoAxfx.mjs.map} +1 -1
- package/dist/serializer-Cx5slrV4-xJfH6EWS.d.mts +36 -0
- package/dist/storage/index.d.mts +11 -11
- package/dist/storage/index.mjs +74 -8
- package/dist/storage/index.mjs.map +1 -1
- package/dist/storage/storage-entrypoint.mjs +7197 -12
- package/dist/storage/storage-entrypoint.mjs.map +1 -1
- package/dist/storage/storage-service.mjs +74 -8
- package/dist/storage/storage-service.mjs.map +1 -1
- package/dist/storage/testing.mjs.map +1 -1
- package/dist/streams/index.d.mts +224 -22
- package/dist/streams/index.mjs +3637 -37
- package/dist/streams/index.mjs.map +1 -1
- package/dist/streams/streams-entrypoint.mjs +7731 -221
- package/dist/streams/streams-entrypoint.mjs.map +1 -1
- package/dist/streams/streams-service.mjs +400 -21
- package/dist/streams/streams-service.mjs.map +1 -1
- package/dist/streams/testing.d.mts +1 -1
- package/dist/streams/testing.mjs.map +1 -1
- package/dist/testing.d.mts +1 -1
- package/dist/testing.mjs +1 -1
- package/dist/testing.mjs.map +1 -1
- package/package.json +14 -14
- package/dist/param-DB0B8m15-IvzNq9BM.mjs.map +0 -1
- package/dist/prisma-next-COrwlg3N.mjs.map +0 -1
package/dist/testing.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Config, Deps, Expose, Params, RunnableServiceNode } from "@prisma/composer";
|
|
2
2
|
//#region ../../1-prisma-cloud/1-extensions/target/dist/testing.d.mts
|
|
3
|
-
//#region src/testing.d.ts
|
|
3
|
+
//#region src/exports/testing.d.ts
|
|
4
4
|
/** What `bootstrapService` hands back: a live, driveable instance of the booted entry. */
|
|
5
5
|
interface BootstrappedService {
|
|
6
6
|
readonly url: string;
|
package/dist/testing.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { u as stash } from "./serializer-
|
|
1
|
+
import { u as stash } from "./serializer-CX4VYdf_-KKGoAxfx.mjs";
|
|
2
2
|
//#region ../../1-prisma-cloud/1-extensions/target/dist/testing.mjs
|
|
3
3
|
/**
|
|
4
4
|
* Boots `service`'s real entry against `config`, in-process. By default the
|
package/dist/testing.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.mjs","names":[],"sources":["../../../1-prisma-cloud/1-extensions/target/dist/testing.mjs"],"sourcesContent":["import { c as stash } from \"./serializer-
|
|
1
|
+
{"version":3,"file":"testing.mjs","names":[],"sources":["../../../1-prisma-cloud/1-extensions/target/dist/testing.mjs"],"sourcesContent":["import { c as stash } from \"./serializer-CX4VYdf_.mjs\";\n//#region src/exports/testing.ts\n/**\n* Boots `service`'s real entry against `config`, in-process. By default the\n* entry is `service.build.entry` resolved against `service.build.module` —\n* exactly how the printed deploy bootstrap imports it (see `@internal/lowering`'s\n* artifact.ts) — which fits a build adapter whose `entry` is a plain\n* module-relative path (`@prisma/composer/node`'s). A build adapter whose bootable\n* path isn't module-relative (`@prisma/composer/nextjs`'s standalone output)\n* supplies its own `boot` thunk; the target owns that resolution.\n*\n* `config.service.port` must be concrete — the entry self-listens and never\n* reports an OS-assigned port back. No `close()`: teardown rides bun-test's\n* per-file process isolation (H3's resolved decision).\n*/\nasync function bootstrapService(service, config, boot) {\n\tconst port = config.service[\"port\"];\n\tif (typeof port !== \"number\") throw new Error(\"bootstrapService(): config.service.port must be a concrete port number — the booted entry self-listens with no way to report an OS-assigned one back to the caller.\");\n\tconst bootEntry = boot ?? (async () => {\n\t\tawait import(new URL(service.build.entry, service.build.module).href);\n\t});\n\tstash(service, config);\n\tawait bootEntry();\n\treturn {\n\t\turl: `http://localhost:${port}/`,\n\t\tfetch\n\t};\n}\n//#endregion\nexport { bootstrapService };\n\n//# sourceMappingURL=testing.mjs.map"],"mappings":";;;;;;;;;;;;;;;AAeA,eAAe,iBAAiB,SAAS,QAAQ,MAAM;CACtD,MAAM,OAAO,OAAO,QAAQ;CAC5B,IAAI,OAAO,SAAS,UAAU,MAAM,IAAI,MAAM,qKAAqK;CACnN,MAAM,YAAY,SAAS,YAAY;EACtC,MAAM,OAAO,IAAI,IAAI,QAAQ,MAAM,OAAO,QAAQ,MAAM,MAAM,CAAC,CAAC;CACjE;CACA,MAAM,SAAS,MAAM;CACrB,MAAM,UAAU;CAChB,OAAO;EACN,KAAK,oBAAoB,KAAK;EAC9B;CACD;AACD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/composer-prisma-cloud",
|
|
3
|
-
"version": "0.1.0-dev.
|
|
3
|
+
"version": "0.1.0-dev.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The Prisma Cloud target for Prisma Composer: compute(), postgres(), the target extension, and first-party modules realized on Prisma Cloud (cron).",
|
|
6
6
|
"exports": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@prisma-next/migration-tools": "0.15.0",
|
|
29
29
|
"@prisma-next/postgres": "0.15.0",
|
|
30
30
|
"@prisma-next/sql-contract": "0.15.0",
|
|
31
|
-
"@prisma/composer": "0.1.0-dev.
|
|
31
|
+
"@prisma/composer": "0.1.0-dev.11",
|
|
32
32
|
"@prisma/management-api-sdk": "^1.47.0",
|
|
33
33
|
"@standard-schema/spec": "^1.1.0",
|
|
34
34
|
"alchemy": "2.0.0-beta.59",
|
|
@@ -37,20 +37,20 @@
|
|
|
37
37
|
"pathe": "^2.0.3",
|
|
38
38
|
"pg": "8.22.0",
|
|
39
39
|
"postgres": "^3.4.9",
|
|
40
|
-
"tsdown": "^0.22.
|
|
40
|
+
"tsdown": "^0.22.7"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@internal/core": "0.1.0-dev.
|
|
44
|
-
"@internal/cron": "0.1.0-dev.
|
|
45
|
-
"@internal/foundation": "0.1.0-dev.
|
|
46
|
-
"@internal/lowering": "0.1.0-dev.
|
|
47
|
-
"@internal/nextjs": "0.1.0-dev.
|
|
48
|
-
"@internal/node": "0.1.0-dev.
|
|
49
|
-
"@internal/prisma-cloud": "0.1.0-dev.
|
|
50
|
-
"@internal/rpc": "0.1.0-dev.
|
|
51
|
-
"@internal/storage": "0.1.0-dev.
|
|
52
|
-
"@internal/streams": "0.1.0-dev.
|
|
53
|
-
"@internal/tsdown-config": "0.1.0-dev.
|
|
43
|
+
"@internal/core": "0.1.0-dev.11",
|
|
44
|
+
"@internal/cron": "0.1.0-dev.11",
|
|
45
|
+
"@internal/foundation": "0.1.0-dev.11",
|
|
46
|
+
"@internal/lowering": "0.1.0-dev.11",
|
|
47
|
+
"@internal/nextjs": "0.1.0-dev.11",
|
|
48
|
+
"@internal/node": "0.1.0-dev.11",
|
|
49
|
+
"@internal/prisma-cloud": "0.1.0-dev.11",
|
|
50
|
+
"@internal/service-rpc": "0.1.0-dev.11",
|
|
51
|
+
"@internal/storage": "0.1.0-dev.11",
|
|
52
|
+
"@internal/streams": "0.1.0-dev.11",
|
|
53
|
+
"@internal/tsdown-config": "0.1.0-dev.11",
|
|
54
54
|
"@types/node": "^25.9.3",
|
|
55
55
|
"typescript": "^6.0.3"
|
|
56
56
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"param-DB0B8m15-IvzNq9BM.mjs","names":[],"sources":["../../../1-prisma-cloud/1-extensions/target/dist/param-DB0B8m15.mjs"],"sourcesContent":["import { t as configKey } from \"./serializer-DAEWRfnm.mjs\";\nimport { isParamSource, paramSource } from \"@internal/core\";\nimport { blindCast } from \"@internal/foundation/casts\";\nimport { RPC_PEER_KEY } from \"@internal/rpc\";\n//#region src/service-keys.ts\n/** Every faceted RPC edge in the graph — scans each dependency edge's consumer-side input for the need. */\nfunction serviceKeyEdges(graph) {\n\tconst edges = [];\n\tfor (const edge of graph.edges) {\n\t\tif (edge.kind !== \"dependency\") continue;\n\t\tconst consumer = graph.nodes.find((n) => n.id === edge.to)?.node;\n\t\tif (consumer === void 0 || consumer.kind !== \"service\") continue;\n\t\tconst slot = consumer.inputs[edge.input];\n\t\tif (slot === void 0) continue;\n\t\tif (slot.connection.params[\"serviceKey\"]?.provision?.brand !== RPC_PEER_KEY) continue;\n\t\tedges.push({\n\t\t\tedgeId: `${edge.to}.${edge.input}`,\n\t\t\tconsumerAddress: edge.to,\n\t\t\tinput: edge.input,\n\t\t\tproviderAddress: edge.from\n\t\t});\n\t}\n\treturn edges;\n}\n/** The reserved accepted-keys env var: COMPOSER_<addr>_RPC_ACCEPTED_KEYS (\"\" ↦ @internal/rpc's RPC_ACCEPTED_KEYS_ENV). */\nconst serviceKeyEnvName = (address) => configKey(address, {\n\towner: \"service\",\n\tname: \"RPC_ACCEPTED_KEYS\"\n});\n//#endregion\n//#region src/param.ts\n/**\n* Brands the payload `envParam` builds. Core's `paramSource()` is a public\n* SPI, so a user could bypass `envParam` and bind a raw `paramSource('x')`;\n* the brand lets `paramName` reject such a source (or another target's) with\n* a clear error instead of reading an absent `.name`.\n*/\nconst PRISMA_CLOUD_PARAM_SOURCE = blindCast(Symbol.for(\"prisma:prisma-cloud-param-source\"));\nconst RESERVED_PARAM_PREFIX = \"COMPOSER_\";\nconst POISONED_PARAM_NAMES = /* @__PURE__ */ new Set([\"DATABASE_URL\", \"DATABASE_URL_POOLED\"]);\n/**\n* Binds a param slot to a named Prisma Cloud platform env var — the non-secret\n* sibling of `envSecret` (spec: env-sourced config params). The platform\n* injects the value into the running instance per stage; the param's own\n* schema validates it at boot, unredacted. The name may not use the\n* framework's reserved `COMPOSER_` prefix or the poisoned\n* `DATABASE_URL(_POOLED)` keys — same parity as `envSecret`.\n*/\nfunction envParam(name) {\n\tif (typeof name !== \"string\" || name.length === 0) throw new Error(\"envParam() requires a non-empty platform env-var name, e.g. envParam('APP_ORIGIN').\");\n\tif (name.startsWith(RESERVED_PARAM_PREFIX)) throw new Error(`envParam name \"${name}\" may not start with \"${RESERVED_PARAM_PREFIX}\" — that prefix is reserved for the framework's own generated config keys.`);\n\tif (POISONED_PARAM_NAMES.has(name)) throw new Error(`envParam name \"${name}\" is reserved — ${[...POISONED_PARAM_NAMES].join(\" and \")} are poisoned at project provision and cannot back a param.`);\n\treturn paramSource({\n\t\t[PRISMA_CLOUD_PARAM_SOURCE]: true,\n\t\tname\n\t});\n}\n/** True only for a payload that `envParam` built — i.e. one carrying the brand. */\nfunction isEnvParamPayload(payload) {\n\treturn typeof payload === \"object\" && payload !== null && blindCast(payload)[PRISMA_CLOUD_PARAM_SOURCE] === true;\n}\n/** True iff a resolved param value is an env-sourced pointer this target built (as opposed to a literal, or a foreign/raw `ParamSource`). */\nfunction isEnvParamSource(value) {\n\treturn isParamSource(value) && isEnvParamPayload(value.payload);\n}\n/**\n* Reads the Prisma Cloud env-var name back out of a param binding's opaque\n* source. A source not built by `envParam` (a raw `paramSource(...)` or\n* another target's source) carries no name — reject it here. `paramName` runs\n* in preflight and at serialize before any value ever crosses the wire, so a\n* foreign source fails early and clearly rather than producing a broken\n* deploy with an undefined name.\n*/\nfunction paramName(binding) {\n\tconst { binding: bound } = binding;\n\tif (!isEnvParamSource(bound)) throw new Error(`param slot \"${binding.slot}\" of service \"${binding.serviceAddress}\" is bound to a source not created by envParam() — bind env-sourced params with envParam('NAME') from @prisma/composer-prisma-cloud.`);\n\treturn bound.payload.name;\n}\n/**\n* Finds the manifest entry for one service param slot. `serialize` calls this\n* only after confirming `buildConfig` resolved the slot to a `ParamSource`\n* (`isParamSource(value)`), so a miss here means `graph.params` and the\n* resolved `Config` have drifted — a Load invariant violation, surfaced\n* loudly rather than producing a pointer row with an undefined name.\n*/\nfunction paramBindingFor(bindings, serviceAddress, slot) {\n\tconst binding = bindings.find((b) => b.serviceAddress === serviceAddress && b.slot === slot);\n\tif (binding === void 0) throw new Error(`param slot \"${slot}\" of \"${serviceAddress}\" resolved to a source but has no bound entry in the manifest — Load should have recorded it.`);\n\treturn binding;\n}\n//#endregion\nexport { serviceKeyEdges as a, paramName as i, isEnvParamSource as n, serviceKeyEnvName as o, paramBindingFor as r, envParam as t };\n\n//# sourceMappingURL=param-DB0B8m15.mjs.map"],"mappings":";;;;;;AAMA,SAAS,gBAAgB,OAAO;CAC/B,MAAM,QAAQ,CAAC;CACf,KAAK,MAAM,QAAQ,MAAM,OAAO;EAC/B,IAAI,KAAK,SAAS,cAAc;EAChC,MAAM,WAAW,MAAM,MAAM,MAAM,MAAM,EAAE,OAAO,KAAK,EAAE,CAAC,EAAE;EAC5D,IAAI,aAAa,KAAK,KAAK,SAAS,SAAS,WAAW;EACxD,MAAM,OAAO,SAAS,OAAO,KAAK;EAClC,IAAI,SAAS,KAAK,GAAG;EACrB,IAAI,KAAK,WAAW,OAAO,aAAa,EAAE,WAAW,UAAU,cA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AM,UAAU,SAAS,MAAM,MAAM,EAAE,mBAAmB,kBAAkB,EAAE,SAAS,IAAI;CAC3F,IAAI,YAAY,KAAK,GAAG,MAAM,IAAI,MAAM,eAAe,KAAK,QAAQ,eAAe,8FAA8F;CACjL,OAAO;AACR"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prisma-next-COrwlg3N.mjs","names":[],"sources":["../../../1-prisma-cloud/1-extensions/target/dist/pg-connection.mjs","../../../1-prisma-cloud/1-extensions/target/dist/prisma-next.mjs"],"sourcesContent":["//#region src/pg-connection.ts\n/** Connection resilience helpers for Prisma Postgres cold-starts (FT-5226); no heavy imports (no `effect`/`alchemy`/`pg`), so the deploy lowerings, the pnPostgres runtime client, and bun-runnable services (the storage store, via the pure `@internal/prisma-cloud/connection` subpath) all share one implementation. */\n/** Network-level socket failures node-postgres surfaces as `err.code`. */\nconst TRANSIENT_CODES = /* @__PURE__ */ new Set([\n\t\"ECONNREFUSED\",\n\t\"ECONNRESET\",\n\t\"ETIMEDOUT\",\n\t\"EPIPE\",\n\t\"ENOTFOUND\",\n\t\"EAI_AGAIN\"\n]);\n/** Connection-establishment failure messages (no useful `err.code`). */\nconst TRANSIENT_MESSAGE_FRAGMENTS = [\n\t\"upstream database\",\n\t\"connection terminated\",\n\t\"connection refused\",\n\t\"terminating connection\",\n\t\"server closed the connection\",\n\t\"connection timeout\",\n\t\"timeout expired\"\n];\n/** Whether an error is a transient connection failure worth retrying, as opposed to a real query error that must surface at once. */\nfunction isTransientConnectionError(error) {\n\tif (typeof error !== \"object\" || error === null) return false;\n\tconst code = \"code\" in error && typeof error.code === \"string\" ? error.code : void 0;\n\tif (code !== void 0 && TRANSIENT_CODES.has(code)) return true;\n\tconst message = \"message\" in error && typeof error.message === \"string\" ? error.message.toLowerCase() : \"\";\n\treturn TRANSIENT_MESSAGE_FRAGMENTS.some((fragment) => message.includes(fragment));\n}\n/**\n* Rewrites a deprecating `sslmode` (`require`/`prefer`/`verify-ca`) to the\n* explicit `verify-full` these already mean, silencing node-postgres's\n* deprecation warning. `disable`/`no-verify`/unset are left untouched.\n*/\nfunction normalizeSslMode(url) {\n\tlet parsed;\n\ttry {\n\t\tparsed = new URL(url);\n\t} catch {\n\t\treturn url;\n\t}\n\tconst sslmode = parsed.searchParams.get(\"sslmode\");\n\tif (sslmode === \"require\" || sslmode === \"prefer\" || sslmode === \"verify-ca\") {\n\t\tparsed.searchParams.set(\"sslmode\", \"verify-full\");\n\t\treturn parsed.toString();\n\t}\n\treturn url;\n}\n/**\n* Retries an operation past a transient connection failure, bounded (default\n* ~1 min). `shouldRetry` decides what's transient — defaults to retrying\n* everything; the runtime client passes {@link isTransientConnectionError}.\n*/\nasync function withConnectionRetry(operation, opts = {}) {\n\tconst attempts = opts.attempts ?? 12;\n\tconst delayMs = opts.delayMs ?? 5e3;\n\tconst sleep = opts.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));\n\tconst shouldRetry = opts.shouldRetry ?? (() => true);\n\tlet lastError;\n\tfor (let attempt = 1; attempt <= attempts; attempt++) try {\n\t\treturn await operation();\n\t} catch (error) {\n\t\tif (!shouldRetry(error)) throw error;\n\t\tlastError = error;\n\t\tif (attempt < attempts) await sleep(delayMs);\n\t}\n\tthrow lastError;\n}\n/** Retries acquiring a connection past a transient cold-start; {@link withConnectionRetry} with {@link isTransientConnectionError} fixed as the predicate. */\nfunction retryTransientConnect(acquire, opts = {}) {\n\treturn withConnectionRetry(acquire, {\n\t\t...opts,\n\t\tshouldRetry: isTransientConnectionError\n\t});\n}\n//#endregion\nexport { isTransientConnectionError, normalizeSslMode, retryTransientConnect, withConnectionRetry };\n\n//# sourceMappingURL=pg-connection.mjs.map","import { normalizeSslMode, retryTransientConnect } from \"./pg-connection.mjs\";\nimport { ResourceNodeBase, dependency, freezeNode, string } from \"@internal/core\";\nimport { blindCast } from \"@internal/foundation/casts\";\nimport pg from \"pg\";\nimport pnPostgresRuntime from \"@prisma-next/postgres/runtime\";\n//#region src/prisma-next.ts\n/**\n* The `prisma-next` resource node: a core Resource node plus `config`, the\n* `prisma-next.config.ts` path the deploy-only migration lowering loads to\n* find the migrations directory — the app build never imports it.\n*/\nvar PnPostgresResourceNode = class extends ResourceNodeBase {\n\tconfig;\n\tconstructor(def) {\n\t\tsuper({\n\t\t\tname: def.name,\n\t\t\textension: \"@prisma/composer-prisma-cloud\",\n\t\t\tprovides: def.contract\n\t\t});\n\t\tthis.config = def.config;\n\t\tif (def.targetRef !== void 0) this.targetRef = def.targetRef;\n\t\tfreezeNode(this);\n\t}\n};\n/** Narrows `ctx.node` to a `pnPostgres` resource node so the deploy lowering reads `config` without a bare cast. Structural, never `instanceof`. */\nfunction isPnPostgresResourceNode(node) {\n\treturn node.kind === \"resource\" && node.type === \"prisma-next\" && \"config\" in node && typeof node.config === \"string\";\n}\nfunction pnContract(contract) {\n\tconst value = {\n\t\tkind: \"prisma-next\",\n\t\t__cmp: { contractJson: contract },\n\t\tsatisfies: (required) => {\n\t\t\tconst requiredHash = storageHashOf(required);\n\t\t\treturn requiredHash !== void 0 && requiredHash === storageHashOf(value);\n\t\t}\n\t};\n\treturn Object.freeze(value);\n}\nfunction pnPostgres(arg) {\n\tif (!isPnPostgresContract(arg)) return new PnPostgresResourceNode(arg);\n\tconst contract = arg;\n\treturn dependency({\n\t\ttype: \"prisma-next\",\n\t\tconnection: {\n\t\t\tparams: { url: string() },\n\t\t\thydrate: ({ url }) => buildClient(contract, url)\n\t\t},\n\t\trequired: contract\n\t});\n}\nfunction isPnPostgresContract(value) {\n\treturn typeof value === \"object\" && value !== null && \"kind\" in value && value.kind === \"prisma-next\" && \"__cmp\" in value && \"satisfies\" in value;\n}\n/**\n* Builds the typed Prisma Next client over a connection pool that rides out\n* a transient cold-start (FT-5226). We pass our own `pg.Pool` rather than a\n* bare `url`: the runtime's bare-`url` connect is a one-shot that fails\n* permanently, but a pool connects lazily on first query, so a bounded retry there suffices.\n*/\nfunction buildClient(contract, url) {\n\treturn pnPostgresRuntime({\n\t\tcontractJson: contract.__cmp.contractJson,\n\t\tbinding: {\n\t\t\tkind: \"pgPool\",\n\t\t\tpool: resilientPool(url)\n\t\t}\n\t});\n}\n/**\n* A `pg.Pool` whose connection acquisition retries a transient cold-start\n* (bounded ~1 min). Only `pool.connect()` is wrapped — a real query error\n* still surfaces at once from `client.query()`.\n*/\nfunction resilientPool(url) {\n\tconst pool = new pg.Pool({\n\t\tconnectionString: normalizeSslMode(url),\n\t\tconnectionTimeoutMillis: 2e4,\n\t\tidleTimeoutMillis: 5e3\n\t});\n\tpool.on(\"error\", (err) => console.error(\"pg pool idle client error\", err));\n\tconst acquire = pool.connect.bind(pool);\n\tpool.connect = blindCast(() => retryTransientConnect(() => acquire()));\n\treturn pool;\n}\n/** Reads `__cmp.contractJson.storage.storageHash` off a `prisma-next` Contract, defensively — `__cmp` is opaque to core, so nothing guarantees its shape without a runtime check. */\nfunction storageHashOf(contract) {\n\tif (contract === void 0) return void 0;\n\tconst cmp = contract.__cmp;\n\tif (typeof cmp !== \"object\" || cmp === null || !(\"contractJson\" in cmp)) return void 0;\n\tconst contractJson = cmp.contractJson;\n\tif (typeof contractJson !== \"object\" || contractJson === null || !(\"storage\" in contractJson)) return;\n\tconst storage = contractJson.storage;\n\tif (typeof storage !== \"object\" || storage === null || !(\"storageHash\" in storage)) return void 0;\n\tconst hash = storage.storageHash;\n\treturn typeof hash === \"string\" ? hash : void 0;\n}\n//#endregion\nexport { PnPostgresResourceNode, isPnPostgresResourceNode, pnContract, pnPostgres };\n\n//# sourceMappingURL=prisma-next.mjs.map"],"mappings":";;;;;;;AAGA,MAAM,kCAAkC,IAAI,IAAI;CAC/C;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;;AAED,MAAM,8BAA8B;CACnC;CACA;CACA;CACA;CACA;CACA;CACA;AACD;;AAEA,SAAS,2BAA2B,OAAO;CAC1C,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM,OAAO;CACxD,MAAM,OAAO,UAAU,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