@prisma/composer-prisma-cloud 0.1.0

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/index.mjs ADDED
@@ -0,0 +1,179 @@
1
+ import { a as envSecret, l as stash, n as deserialize, r as deserializeSecrets, s as secretName, t as configKey, u as stashSecrets } from "./serializer-C2CsA7xm-29Eg2Tjl.mjs";
2
+ import { dependency, hydrateSecrets, hydrateSync, number, resource, service, string } from "@prisma/composer";
3
+ import { blindCast } from "@prisma/composer/casts";
4
+ //#region ../../1-prisma-cloud/1-extensions/target/dist/index.mjs
5
+ const reservedParams = { port: number({ default: 3e3 }) };
6
+ /**
7
+ * A Prisma Compute service — declarations only (deps + params + build + the
8
+ * ports it exposes), no descriptor. `params` merges with the reserved
9
+ * `ReservedParams` (`port`); a user param whose name collides with a reserved
10
+ * one fails at authoring, the same way a colliding dependency name does.
11
+ * Returns the extension's runnable/loadable node:
12
+ * · run(address, boot) — the process controller: deserialize the platform
13
+ * environment (keyed off `address`, the extension's ONE env read) into a
14
+ * typed Config, re-emit it under address-free process-local stash keys,
15
+ * then call boot() to start the app's entry.
16
+ * · load() / config() — called from inside the app's entry: read the stash;
17
+ * load() hydrates + memoizes the deps, config() returns the typed params.
18
+ * Separate accessors so a dep and a param never share a namespace (ADR-0021).
19
+ *
20
+ * `service()`'s underlying node carries `extension: '@prisma/composer-prisma-cloud'` —
21
+ * the control-plane registry key `prisma-composer deploy` resolves through the
22
+ * app's `prisma-composer.config.ts` (ADR-0017). This module loads nothing at
23
+ * deploy time; nodes are pure data.
24
+ */
25
+ const compute = (def) => {
26
+ const userParams = def.params ?? blindCast({});
27
+ for (const reserved of Object.keys(reservedParams)) {
28
+ if (reserved in def.deps) throw new Error(`compute(): dependency "${reserved}" collides with the reserved service param of the same name — rename the dependency.`);
29
+ if (reserved in userParams) throw new Error(`compute(): param "${reserved}" collides with the reserved service param of the same name — rename the param.`);
30
+ }
31
+ const params = blindCast({
32
+ ...userParams,
33
+ ...reservedParams
34
+ });
35
+ const node = service({
36
+ name: def.name,
37
+ extension: "@prisma/composer-prisma-cloud",
38
+ type: "compute",
39
+ inputs: def.deps,
40
+ params,
41
+ ...def.secrets !== void 0 ? { secrets: def.secrets } : {},
42
+ build: def.build,
43
+ ...def.expose !== void 0 ? { expose: def.expose } : {}
44
+ });
45
+ let resolved;
46
+ let loadedDeps;
47
+ let loadedParams;
48
+ let loadedSecrets;
49
+ function processConfig() {
50
+ if (resolved === void 0) resolved = deserialize(node, "");
51
+ return resolved;
52
+ }
53
+ const runnable = {
54
+ ...node,
55
+ async run(address, boot) {
56
+ const config = deserialize(node, address);
57
+ stash(node, config);
58
+ stashSecrets(node, address);
59
+ const port = config.service["port"];
60
+ if (typeof port === "number") process.env["PORT"] = String(port);
61
+ return boot();
62
+ },
63
+ load() {
64
+ if (loadedDeps === void 0) loadedDeps = blindCast(hydrateSync(node, processConfig()));
65
+ return loadedDeps;
66
+ },
67
+ config() {
68
+ if (loadedParams === void 0) loadedParams = blindCast(processConfig().service);
69
+ return loadedParams;
70
+ },
71
+ secrets() {
72
+ if (loadedSecrets === void 0) loadedSecrets = blindCast(hydrateSecrets(node, deserializeSecrets(node, "")));
73
+ return loadedSecrets;
74
+ }
75
+ };
76
+ return Object.freeze(blindCast(runnable));
77
+ };
78
+ const defaultHttpClient = (cfg) => ({
79
+ url: cfg.url,
80
+ fetch: (path, init) => fetch(new URL(path, cfg.url), init)
81
+ });
82
+ /**
83
+ * A service-to-service dependency. Its binding (what `load()` returns) is a
84
+ * derived HttpClient — a thin URL-anchored fetch wrapper (fetch is standard
85
+ * across runtimes — no driver, no runtime coupling). http() is a
86
+ * protocol-owned kind: the framework owns the transport, so the client is
87
+ * kind-canonical and derived from the contract, with no user client in the
88
+ * declaration (ADR-0015). The typed generated client arrives with the
89
+ * interface primitive (a later extension point).
90
+ */
91
+ const http = (opts) => dependency({
92
+ name: opts.name,
93
+ type: "http",
94
+ connection: {
95
+ params: { url: string() },
96
+ hydrate: (v) => defaultHttpClient({ url: v.url })
97
+ }
98
+ });
99
+ /**
100
+ * The contract a Postgres provides — and the contract its consumers require.
101
+ * `satisfies` compares KIND, not identity: an extension module can be duplicated
102
+ * across a workspace (same rationale as the Symbol.for node brand), and every
103
+ * duplicate's contract must still satisfy. `__cmp` is the connection config a
104
+ * postgres offers; core never inspects it.
105
+ */
106
+ const postgresContract = Object.freeze({
107
+ kind: "postgres",
108
+ __cmp: { url: "" },
109
+ satisfies: (required) => required.kind === "postgres"
110
+ });
111
+ function postgres(opts) {
112
+ if (opts?.name !== void 0) return resource({
113
+ name: opts.name,
114
+ extension: "@prisma/composer-prisma-cloud",
115
+ provides: postgresContract
116
+ });
117
+ return dependency({
118
+ type: "postgres",
119
+ connection: {
120
+ params: { url: string() },
121
+ hydrate: (v) => v
122
+ },
123
+ required: postgresContract
124
+ });
125
+ }
126
+ /**
127
+ * The contract the `s3-credentials` resource provides — a minted SigV4 key
128
+ * pair. `satisfies` compares KIND only (mirrors `postgresContract`); `__cmp` is
129
+ * the config the resource offers, which core never inspects.
130
+ */
131
+ const credentialsContract = Object.freeze({
132
+ kind: "credentials",
133
+ __cmp: {
134
+ accessKeyId: "",
135
+ secretAccessKey: ""
136
+ },
137
+ satisfies: (required) => required.kind === "credentials"
138
+ });
139
+ function s3Credentials(opts) {
140
+ if (opts?.name !== void 0) return resource({
141
+ name: opts.name,
142
+ extension: "@prisma/composer-prisma-cloud",
143
+ provides: credentialsContract
144
+ });
145
+ return dependency({
146
+ type: "credentials",
147
+ connection: {
148
+ params: {
149
+ accessKeyId: string(),
150
+ secretAccessKey: string()
151
+ },
152
+ hydrate: (v) => v
153
+ },
154
+ required: credentialsContract
155
+ });
156
+ }
157
+ /**
158
+ * The storage service authoring factory — a `compute` service routed to the
159
+ * `s3-store` lowering instead of `compute`'s. It is exactly `compute`'s
160
+ * runnable (run/load/config, deps, params, build, expose) with the routing
161
+ * `type` overridden to `'s3-store'`: nothing at runtime keys off `type` (the
162
+ * serializer keys off the deployment address and each param's owner/name, and
163
+ * `load`/`config` off deps/params), so only the deploy-time descriptor lookup
164
+ * sees the override and routes to the extended-output lowering (§ 5). The
165
+ * return type is compute's exactly (including the reserved `port` param). The
166
+ * storage module (D4b) calls this with its `db`/`credentials` deps, a `bucket`
167
+ * param, and `expose: { store: s3Contract }`.
168
+ */
169
+ function s3StoreService(def) {
170
+ const node = compute(def);
171
+ return Object.freeze(blindCast({
172
+ ...node,
173
+ type: "s3-store"
174
+ }));
175
+ }
176
+ //#endregion
177
+ export { compute, configKey, credentialsContract, envSecret, http, postgres, postgresContract, s3Credentials, s3StoreService, secretName };
178
+
179
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../1-prisma-cloud/1-extensions/target/dist/index.mjs"],"sourcesContent":["import { c as stashSecrets, l as envSecret, n as deserialize, r as deserializeSecrets, s as stash, t as configKey, u as secretName } from \"./serializer-C2CsA7xm.mjs\";\nimport { dependency, hydrateSecrets, hydrateSync, number, resource, service, string } from \"@internal/core\";\nimport { blindCast } from \"@internal/foundation/casts\";\n//#region src/compute.ts\nconst reservedParams = { port: number({ default: 3e3 }) };\n/**\n* A Prisma Compute service — declarations only (deps + params + build + the\n* ports it exposes), no descriptor. `params` merges with the reserved\n* `ReservedParams` (`port`); a user param whose name collides with a reserved\n* one fails at authoring, the same way a colliding dependency name does.\n* Returns the extension's runnable/loadable node:\n* · run(address, boot) — the process controller: deserialize the platform\n* environment (keyed off `address`, the extension's ONE env read) into a\n* typed Config, re-emit it under address-free process-local stash keys,\n* then call boot() to start the app's entry.\n* · load() / config() — called from inside the app's entry: read the stash;\n* load() hydrates + memoizes the deps, config() returns the typed params.\n* Separate accessors so a dep and a param never share a namespace (ADR-0021).\n*\n* `service()`'s underlying node carries `extension: '@prisma/composer-prisma-cloud'` —\n* the control-plane registry key `prisma-composer deploy` resolves through the\n* app's `prisma-composer.config.ts` (ADR-0017). This module loads nothing at\n* deploy time; nodes are pure data.\n*/\nconst compute = (def) => {\n\tconst userParams = def.params ?? blindCast({});\n\tfor (const reserved of Object.keys(reservedParams)) {\n\t\tif (reserved in def.deps) throw new Error(`compute(): dependency \"${reserved}\" collides with the reserved service param of the same name — rename the dependency.`);\n\t\tif (reserved in userParams) throw new Error(`compute(): param \"${reserved}\" collides with the reserved service param of the same name — rename the param.`);\n\t}\n\tconst params = blindCast({\n\t\t...userParams,\n\t\t...reservedParams\n\t});\n\tconst node = service({\n\t\tname: def.name,\n\t\textension: \"@prisma/composer-prisma-cloud\",\n\t\ttype: \"compute\",\n\t\tinputs: def.deps,\n\t\tparams,\n\t\t...def.secrets !== void 0 ? { secrets: def.secrets } : {},\n\t\tbuild: def.build,\n\t\t...def.expose !== void 0 ? { expose: def.expose } : {}\n\t});\n\tlet resolved;\n\tlet loadedDeps;\n\tlet loadedParams;\n\tlet loadedSecrets;\n\tfunction processConfig() {\n\t\tif (resolved === void 0) resolved = deserialize(node, \"\");\n\t\treturn resolved;\n\t}\n\tconst runnable = {\n\t\t...node,\n\t\tasync run(address, boot) {\n\t\t\tconst config = deserialize(node, address);\n\t\t\tstash(node, config);\n\t\t\tstashSecrets(node, address);\n\t\t\tconst port = config.service[\"port\"];\n\t\t\tif (typeof port === \"number\") process.env[\"PORT\"] = String(port);\n\t\t\treturn boot();\n\t\t},\n\t\tload() {\n\t\t\tif (loadedDeps === void 0) loadedDeps = blindCast(hydrateSync(node, processConfig()));\n\t\t\treturn loadedDeps;\n\t\t},\n\t\tconfig() {\n\t\t\tif (loadedParams === void 0) loadedParams = blindCast(processConfig().service);\n\t\t\treturn loadedParams;\n\t\t},\n\t\tsecrets() {\n\t\t\tif (loadedSecrets === void 0) loadedSecrets = blindCast(hydrateSecrets(node, deserializeSecrets(node, \"\")));\n\t\t\treturn loadedSecrets;\n\t\t}\n\t};\n\treturn Object.freeze(blindCast(runnable));\n};\n//#endregion\n//#region src/http.ts\nconst defaultHttpClient = (cfg) => ({\n\turl: cfg.url,\n\tfetch: (path, init) => fetch(new URL(path, cfg.url), init)\n});\n/**\n* A service-to-service dependency. Its binding (what `load()` returns) is a\n* derived HttpClient — a thin URL-anchored fetch wrapper (fetch is standard\n* across runtimes — no driver, no runtime coupling). http() is a\n* protocol-owned kind: the framework owns the transport, so the client is\n* kind-canonical and derived from the contract, with no user client in the\n* declaration (ADR-0015). The typed generated client arrives with the\n* interface primitive (a later extension point).\n*/\nconst http = (opts) => dependency({\n\tname: opts.name,\n\ttype: \"http\",\n\tconnection: {\n\t\tparams: { url: string() },\n\t\thydrate: (v) => defaultHttpClient({ url: v.url })\n\t}\n});\n//#endregion\n//#region src/postgres.ts\n/**\n* The contract a Postgres provides — and the contract its consumers require.\n* `satisfies` compares KIND, not identity: an extension module can be duplicated\n* across a workspace (same rationale as the Symbol.for node brand), and every\n* duplicate's contract must still satisfy. `__cmp` is the connection config a\n* postgres offers; core never inspects it.\n*/\nconst postgresContract = Object.freeze({\n\tkind: \"postgres\",\n\t__cmp: { url: \"\" },\n\tsatisfies: (required) => required.kind === \"postgres\"\n});\nfunction postgres(opts) {\n\tif (opts?.name !== void 0) return resource({\n\t\tname: opts.name,\n\t\textension: \"@prisma/composer-prisma-cloud\",\n\t\tprovides: postgresContract\n\t});\n\treturn dependency({\n\t\ttype: \"postgres\",\n\t\tconnection: {\n\t\t\tparams: { url: string() },\n\t\t\thydrate: (v) => v\n\t\t},\n\t\trequired: postgresContract\n\t});\n}\n//#endregion\n//#region src/s3-credentials.ts\n/**\n* The contract the `s3-credentials` resource provides — a minted SigV4 key\n* pair. `satisfies` compares KIND only (mirrors `postgresContract`); `__cmp` is\n* the config the resource offers, which core never inspects.\n*/\nconst credentialsContract = Object.freeze({\n\tkind: \"credentials\",\n\t__cmp: {\n\t\taccessKeyId: \"\",\n\t\tsecretAccessKey: \"\"\n\t},\n\tsatisfies: (required) => required.kind === \"credentials\"\n});\nfunction s3Credentials(opts) {\n\tif (opts?.name !== void 0) return resource({\n\t\tname: opts.name,\n\t\textension: \"@prisma/composer-prisma-cloud\",\n\t\tprovides: credentialsContract\n\t});\n\treturn dependency({\n\t\ttype: \"credentials\",\n\t\tconnection: {\n\t\t\tparams: {\n\t\t\t\taccessKeyId: string(),\n\t\t\t\tsecretAccessKey: string()\n\t\t\t},\n\t\t\thydrate: (v) => v\n\t\t},\n\t\trequired: credentialsContract\n\t});\n}\n//#endregion\n//#region src/s3-store.ts\n/**\n* The storage service authoring factory — a `compute` service routed to the\n* `s3-store` lowering instead of `compute`'s. It is exactly `compute`'s\n* runnable (run/load/config, deps, params, build, expose) with the routing\n* `type` overridden to `'s3-store'`: nothing at runtime keys off `type` (the\n* serializer keys off the deployment address and each param's owner/name, and\n* `load`/`config` off deps/params), so only the deploy-time descriptor lookup\n* sees the override and routes to the extended-output lowering (§ 5). The\n* return type is compute's exactly (including the reserved `port` param). The\n* storage module (D4b) calls this with its `db`/`credentials` deps, a `bucket`\n* param, and `expose: { store: s3Contract }`.\n*/\nfunction s3StoreService(def) {\n\tconst node = compute(def);\n\treturn Object.freeze(blindCast({\n\t\t...node,\n\t\ttype: \"s3-store\"\n\t}));\n}\n//#endregion\nexport { compute, configKey, credentialsContract, envSecret, http, postgres, postgresContract, s3Credentials, s3StoreService, secretName };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;AAIA,MAAM,iBAAiB,EAAE,MAAM,OAAO,EAAE,SAAS,IAAI,CAAC,EAAE;;;;;;;;;;;;;;;;;;;;AAoBxD,MAAM,WAAW,QAAQ;CACxB,MAAM,aAAa,IAAI,UAAU,UAAU,CAAC,CAAC;CAC7C,KAAK,MAAM,YAAY,OAAO,KAAK,cAAc,GAAG;EACnD,IAAI,YAAY,IAAI,MAAM,MAAM,IAAI,MAAM,0BAA0B,SAAS,qFAAqF;EAClK,IAAI,YAAY,YAAY,MAAM,IAAI,MAAM,qBAAqB,SAAS,gFAAgF;CAC3J;CACA,MAAM,SAAS,UAAU;EACxB,GAAG;EACH,GAAG;CAC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;CACN,YAAY;EACX,QAAQ,EAAE,KAAK,OAAO,EAAE;EACxB,UAAU,MAAM,kBAAkB,EAAE,KAAK,EAAE,IAAI,CAAC;CACjD;AACD,CAAC;;;;;;;;AAUD,MAAM,mBAAmB,OAAO,OAAO;CACtC,MAAM;CACN,OAAO,EAAE,KAAK,GAAG;CACjB,YAAY,aAAa,SAAS,SAAS;AAC5C,CAAC;AACD,SAAS,SAAS,MAAM;CACvB,IAAI,MAAM,SAAS,KAAK,GAAG,OAAO,SAAS;EAC1C,MAAM,KAAK;EACX,WAAW;EACX,UAAU;CACX,CAAC;CACD,OAAO,WAAW;EACjB,MAAM;EACN,YAAY;GACX,QAAQ,EAAE,KAAK,OAAO,EAAE;GACxB,UAAU,MAAM;EACjB;EACA,UAAU;CACX,CAAC;AACF;;;;;;AAQA,MAAM,sBAAsB,OAAO,OAAO;CACzC,MAAM;CACN,OAAO;EACN,aAAa;EACb,iBAAiB;CAClB;CACA,YAAY,aAAa,SAAS,SAAS;AAC5C,CAAC;AACD,SAAS,cAAc,MAAM;CAC5B,IAAI,MAAM,SAAS,KAAK,GAAG,OAAO,SAAS;EAC1C,MAAM,KAAK;EACX,WAAW;EACX,UAAU;CACX,CAAC;CACD,OAAO,WAAW;EACjB,MAAM;EACN,YAAY;GACX,QAAQ;IACP,aAAa,OAAO;IACpB,iBAAiB,OAAO;GACzB;GACA,UAAU,MAAM;EACjB;EACA,UAAU;CACX,CAAC;AACF;;;;;;;;;;;;;AAeA,SAAS,eAAe,KAAK;CAC5B,MAAM,OAAO,QAAQ,GAAG;CACxB,OAAO,OAAO,OAAO,UAAU;EAC9B,GAAG;EACH,MAAM;CACP,CAAC,CAAC;AACH"}
@@ -0,0 +1,176 @@
1
+ import { ResourceNodeBase, dependency, freezeNode, string } from "@prisma/composer";
2
+ import { blindCast } from "@prisma/composer/casts";
3
+ import pg from "pg";
4
+ import pnPostgresRuntime from "@prisma-next/postgres/runtime";
5
+ //#region ../../1-prisma-cloud/1-extensions/target/dist/pg-connection.mjs
6
+ /** 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. */
7
+ /** Network-level socket failures node-postgres surfaces as `err.code`. */
8
+ const TRANSIENT_CODES = /* @__PURE__ */ new Set([
9
+ "ECONNREFUSED",
10
+ "ECONNRESET",
11
+ "ETIMEDOUT",
12
+ "EPIPE",
13
+ "ENOTFOUND",
14
+ "EAI_AGAIN"
15
+ ]);
16
+ /** Connection-establishment failure messages (no useful `err.code`). */
17
+ const TRANSIENT_MESSAGE_FRAGMENTS = [
18
+ "upstream database",
19
+ "connection terminated",
20
+ "connection refused",
21
+ "terminating connection",
22
+ "server closed the connection",
23
+ "connection timeout",
24
+ "timeout expired"
25
+ ];
26
+ /** Whether an error is a transient connection failure worth retrying, as opposed to a real query error that must surface at once. */
27
+ function isTransientConnectionError(error) {
28
+ if (typeof error !== "object" || error === null) return false;
29
+ const code = "code" in error && typeof error.code === "string" ? error.code : void 0;
30
+ if (code !== void 0 && TRANSIENT_CODES.has(code)) return true;
31
+ const message = "message" in error && typeof error.message === "string" ? error.message.toLowerCase() : "";
32
+ return TRANSIENT_MESSAGE_FRAGMENTS.some((fragment) => message.includes(fragment));
33
+ }
34
+ /**
35
+ * Rewrites a deprecating `sslmode` (`require`/`prefer`/`verify-ca`) to the
36
+ * explicit `verify-full` these already mean, silencing node-postgres's
37
+ * deprecation warning. `disable`/`no-verify`/unset are left untouched.
38
+ */
39
+ function normalizeSslMode(url) {
40
+ let parsed;
41
+ try {
42
+ parsed = new URL(url);
43
+ } catch {
44
+ return url;
45
+ }
46
+ const sslmode = parsed.searchParams.get("sslmode");
47
+ if (sslmode === "require" || sslmode === "prefer" || sslmode === "verify-ca") {
48
+ parsed.searchParams.set("sslmode", "verify-full");
49
+ return parsed.toString();
50
+ }
51
+ return url;
52
+ }
53
+ /**
54
+ * Retries an operation past a transient connection failure, bounded (default
55
+ * ~1 min). `shouldRetry` decides what's transient — defaults to retrying
56
+ * everything; the runtime client passes {@link isTransientConnectionError}.
57
+ */
58
+ async function withConnectionRetry(operation, opts = {}) {
59
+ const attempts = opts.attempts ?? 12;
60
+ const delayMs = opts.delayMs ?? 5e3;
61
+ const sleep = opts.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
62
+ const shouldRetry = opts.shouldRetry ?? (() => true);
63
+ let lastError;
64
+ for (let attempt = 1; attempt <= attempts; attempt++) try {
65
+ return await operation();
66
+ } catch (error) {
67
+ if (!shouldRetry(error)) throw error;
68
+ lastError = error;
69
+ if (attempt < attempts) await sleep(delayMs);
70
+ }
71
+ throw lastError;
72
+ }
73
+ /** Retries acquiring a connection past a transient cold-start; {@link withConnectionRetry} with {@link isTransientConnectionError} fixed as the predicate. */
74
+ function retryTransientConnect(acquire, opts = {}) {
75
+ return withConnectionRetry(acquire, {
76
+ ...opts,
77
+ shouldRetry: isTransientConnectionError
78
+ });
79
+ }
80
+ //#endregion
81
+ //#region ../../1-prisma-cloud/1-extensions/target/dist/prisma-next.mjs
82
+ /**
83
+ * The `prisma-next` resource node: a core Resource node plus `config`, the
84
+ * `prisma-next.config.ts` path the deploy-only migration lowering loads to
85
+ * find the migrations directory — the app build never imports it.
86
+ */
87
+ var PnPostgresResourceNode = class extends ResourceNodeBase {
88
+ config;
89
+ constructor(def) {
90
+ super({
91
+ name: def.name,
92
+ extension: "@prisma/composer-prisma-cloud",
93
+ provides: def.contract
94
+ });
95
+ this.config = def.config;
96
+ if (def.targetRef !== void 0) this.targetRef = def.targetRef;
97
+ freezeNode(this);
98
+ }
99
+ };
100
+ /** Narrows `ctx.node` to a `pnPostgres` resource node so the deploy lowering reads `config` without a bare cast. Structural, never `instanceof`. */
101
+ function isPnPostgresResourceNode(node) {
102
+ return node.kind === "resource" && node.type === "prisma-next" && "config" in node && typeof node.config === "string";
103
+ }
104
+ function pnContract(contract) {
105
+ const value = {
106
+ kind: "prisma-next",
107
+ __cmp: { contractJson: contract },
108
+ satisfies: (required) => {
109
+ const requiredHash = storageHashOf(required);
110
+ return requiredHash !== void 0 && requiredHash === storageHashOf(value);
111
+ }
112
+ };
113
+ return Object.freeze(value);
114
+ }
115
+ function pnPostgres(arg) {
116
+ if (!isPnPostgresContract(arg)) return new PnPostgresResourceNode(arg);
117
+ const contract = arg;
118
+ return dependency({
119
+ type: "prisma-next",
120
+ connection: {
121
+ params: { url: string() },
122
+ hydrate: ({ url }) => buildClient(contract, url)
123
+ },
124
+ required: contract
125
+ });
126
+ }
127
+ function isPnPostgresContract(value) {
128
+ return typeof value === "object" && value !== null && "kind" in value && value.kind === "prisma-next" && "__cmp" in value && "satisfies" in value;
129
+ }
130
+ /**
131
+ * Builds the typed Prisma Next client over a connection pool that rides out
132
+ * a transient cold-start (FT-5226). We pass our own `pg.Pool` rather than a
133
+ * bare `url`: the runtime's bare-`url` connect is a one-shot that fails
134
+ * permanently, but a pool connects lazily on first query, so a bounded retry there suffices.
135
+ */
136
+ function buildClient(contract, url) {
137
+ return pnPostgresRuntime({
138
+ contractJson: contract.__cmp.contractJson,
139
+ binding: {
140
+ kind: "pgPool",
141
+ pool: resilientPool(url)
142
+ }
143
+ });
144
+ }
145
+ /**
146
+ * A `pg.Pool` whose connection acquisition retries a transient cold-start
147
+ * (bounded ~1 min). Only `pool.connect()` is wrapped — a real query error
148
+ * still surfaces at once from `client.query()`.
149
+ */
150
+ function resilientPool(url) {
151
+ const pool = new pg.Pool({
152
+ connectionString: normalizeSslMode(url),
153
+ connectionTimeoutMillis: 2e4,
154
+ idleTimeoutMillis: 5e3
155
+ });
156
+ pool.on("error", (err) => console.error("pg pool idle client error", err));
157
+ const acquire = pool.connect.bind(pool);
158
+ pool.connect = blindCast(() => retryTransientConnect(() => acquire()));
159
+ return pool;
160
+ }
161
+ /** 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. */
162
+ function storageHashOf(contract) {
163
+ if (contract === void 0) return void 0;
164
+ const cmp = contract.__cmp;
165
+ if (typeof cmp !== "object" || cmp === null || !("contractJson" in cmp)) return void 0;
166
+ const contractJson = cmp.contractJson;
167
+ if (typeof contractJson !== "object" || contractJson === null || !("storage" in contractJson)) return;
168
+ const storage = contractJson.storage;
169
+ if (typeof storage !== "object" || storage === null || !("storageHash" in storage)) return void 0;
170
+ const hash = storage.storageHash;
171
+ return typeof hash === "string" ? hash : void 0;
172
+ }
173
+ //#endregion
174
+ export { normalizeSslMode as a, pnPostgres as i, isPnPostgresResourceNode as n, withConnectionRetry as o, pnContract as r, PnPostgresResourceNode as t };
175
+
176
+ //# sourceMappingURL=prisma-next-COrwlg3N.mjs.map
@@ -0,0 +1 @@
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, isPnPostgres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AM;EAC7B,SAAS;GACR,MAAM;GACN,MAAM,cAAc,GAAG;EACxB;CACD,CAAC;AACF;;;;;;AAMA,SAAS,cAAc,KAAK;CAC3B,MAAM,OAAO,IAAI,GAAG,KAAK;EACxB,kBAAkB,iBAAiB,GAAG;EACtC,yBAAyB;EACzB,mBAAmB;CACpB,CAAC;CACD,KAAK,GAAG,UAAU,QAAQ,QAAQ,MAAM,6BAA6B,GAAG,CAAC;CACzE,MAAM,UAAU,KAAK,QAAQ,KAAK,IAAI;CACtC,KAAK,UAAU,gBAAgB,4BAA4B,QAAQ,CAAC,CAAC;CACrE,OAAO;AACR;;AAEA,SAAS,cAAc,UAAU;CAChC,IAAI,aAAa,KAAK,GAAG,OAAO,KAAK;CACrC,MAAM,MAAM,SAAS;CACrB,IAAI,OAAO,QAAQ,YAAY,QAAQ,QAAQ,EAAE,kBAAkB,MAAM,OAAO,KAAK;CACrF,MAAM,eAAe,IAAI;CACzB,IAAI,OAAO,iBAAiB,YAAY,iBAAiB,QAAQ,EAAE,aAAa,eAAe;CAC/F,MAAM,UAAU,aAAa;CAC7B,IAAI,OAAO,YAAY,YAAY,YAAY,QAAQ,EAAE,iBAAiB,UAAU,OAAO,KAAK;CAChG,MAAM,OAAO,QAAQ;CACrB,OAAO,OAAO,SAAS,WAAW,OAAO,KAAK;AAC/C"}
@@ -0,0 +1,72 @@
1
+ import { Contract, DependencyEnd, ResourceNode, ResourceNodeBase, ServiceNode } from "@prisma/composer";
2
+ import { PostgresClient } from "@prisma-next/postgres/runtime";
3
+ import { SqlStorage } from "@prisma-next/sql-contract/types";
4
+
5
+ //#region ../../1-prisma-cloud/1-extensions/target/dist/prisma-next.d.mts
6
+ //#region src/prisma-next.d.ts
7
+ /**
8
+ * Any Prisma Next contract this primitive can carry — the bound both
9
+ * authoring modes (TS no-emit `defineContract()`, or PSL/emitted
10
+ * `contract.d.ts`) satisfy.
11
+ */
12
+ type AnyPnContract = import('@prisma-next/contract/types').Contract<SqlStorage>;
13
+ /**
14
+ * The comparison payload behind a `prisma-next` Contract. `_contract` is a
15
+ * type-only anchor so plain assignability between two `PnCmp`s means the
16
+ * branded `storageHash` literals match.
17
+ */
18
+ interface PnCmp<C extends AnyPnContract = AnyPnContract> {
19
+ readonly contractJson: unknown;
20
+ readonly _contract?: C;
21
+ }
22
+ /** The `prisma-next` kind: a Contract whose `Cmp` is `PnCmp`. */
23
+ type PnPostgresContract<C extends AnyPnContract = AnyPnContract> = Contract<'prisma-next', PnCmp<C>>;
24
+ /** Recovers the emitted contract type `C` a `prisma-next` Contract carries. */
25
+ type PnContractOf<Ct> = Ct extends PnPostgresContract<infer C> ? C : never;
26
+ /** The typed client a consumer's `pnPostgres(contract)` dependency hydrates to. */
27
+ type Client<Ct> = PostgresClient<PnContractOf<Ct>>;
28
+ /**
29
+ * The `prisma-next` resource node: a core Resource node plus `config`, the
30
+ * `prisma-next.config.ts` path the deploy-only migration lowering loads to
31
+ * find the migrations directory — the app build never imports it.
32
+ */
33
+ declare class PnPostgresResourceNode<C extends PnPostgresContract = PnPostgresContract> extends ResourceNodeBase<C> {
34
+ readonly config: string;
35
+ /** Optional target ref NAME (`migrations/app/refs/<name>.json`) — see `pnPostgres`. */
36
+ readonly targetRef?: string;
37
+ constructor(def: {
38
+ name: string;
39
+ contract: C;
40
+ config: string;
41
+ targetRef?: string;
42
+ });
43
+ }
44
+ /** Narrows `ctx.node` to a `pnPostgres` resource node so the deploy lowering reads `config` without a bare cast. Structural, never `instanceof`. */
45
+ declare function isPnPostgresResourceNode(node: ServiceNode | ResourceNode): node is PnPostgresResourceNode;
46
+ /**
47
+ * Wraps a resolved Prisma Next contract value into the framework's
48
+ * `prisma-next` Contract kind. Two overloads: TS-authored (`C` inferred) vs.
49
+ * emitted JSON (`C` passed explicitly, e.g. `pnContract<Contract>(contractJson)`).
50
+ */
51
+ declare function pnContract<const C extends AnyPnContract>(contract: C): PnPostgresContract<C>;
52
+ declare function pnContract<C extends AnyPnContract>(contractJson: unknown): PnPostgresContract<C>;
53
+ /**
54
+ * `{ name, contract, config, targetRef? }` — the resource identity a module
55
+ * provisions. `config` is the deploy-only `prisma-next.config.ts` path;
56
+ * `targetRef` optionally names a ref as the migration target.
57
+ */
58
+ declare function pnPostgres<C extends PnPostgresContract>(opts: {
59
+ name: string;
60
+ contract: C;
61
+ config: string;
62
+ targetRef?: string;
63
+ }): PnPostgresResourceNode<C>;
64
+ /**
65
+ * `pnPostgres(contract)` — a service's dependency on a Prisma Next-typed
66
+ * Postgres. Its binding is the typed Prisma Next client, constructed by the
67
+ * framework in hydrate from the contract plus the injected connection URL.
68
+ */
69
+ declare function pnPostgres<C extends PnPostgresContract>(contract: C): DependencyEnd<Client<C>, C>; //#endregion
70
+ //#endregion
71
+ export { AnyPnContract, Client, PnCmp, PnContractOf, PnPostgresContract, PnPostgresResourceNode, isPnPostgresResourceNode, pnContract, pnPostgres };
72
+ //# sourceMappingURL=prisma-next.d.mts.map
@@ -0,0 +1,2 @@
1
+ import { i as pnPostgres, n as isPnPostgresResourceNode, r as pnContract, t as PnPostgresResourceNode } from "./prisma-next-COrwlg3N.mjs";
2
+ export { PnPostgresResourceNode, isPnPostgresResourceNode, pnContract, pnPostgres };