@prisma/composer-prisma-cloud 0.3.0-dev.8 → 0.3.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/compute-main.mjs +4 -20
- package/dist/compute-main.mjs.map +1 -1
- package/dist/control.d.mts +1 -1
- package/dist/control.mjs +17 -28
- package/dist/control.mjs.map +1 -1
- package/dist/cron/index.d.mts +26 -33
- package/dist/cron/index.d.mts.map +1 -1
- package/dist/cron/index.mjs +77 -202
- package/dist/cron/index.mjs.map +1 -1
- package/dist/cron/scheduler-entrypoint.mjs +114 -133
- package/dist/cron/scheduler-entrypoint.mjs.map +1 -1
- package/dist/cron/scheduler-service.mjs +76 -200
- package/dist/cron/scheduler-service.mjs.map +1 -1
- package/dist/email/email-entrypoint.mjs +126 -162
- package/dist/email/email-entrypoint.mjs.map +1 -1
- package/dist/email/email-service.mjs +79 -230
- package/dist/email/email-service.mjs.map +1 -1
- package/dist/email/index.d.mts +29 -33
- package/dist/email/index.d.mts.map +1 -1
- package/dist/email/index.mjs +84 -236
- package/dist/email/index.mjs.map +1 -1
- package/dist/email/testing.mjs +89 -112
- package/dist/email/testing.mjs.map +1 -1
- package/dist/index.d.mts +43 -51
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +51 -47
- package/dist/index.mjs.map +1 -1
- package/dist/local-target.mjs +1 -1
- package/dist/local-target.mjs.map +1 -1
- package/dist/{secret-BVGxqHxY-DYDfiULl.mjs → param-BTzY0ne5-CW6ojZ3E.mjs} +4 -45
- package/dist/param-BTzY0ne5-CW6ojZ3E.mjs.map +1 -0
- package/dist/{preflight-names-CpJUd9ZA-BCU-W3cT.mjs → preflight-names-BPL-qsZF-BfoRgbgb.mjs} +14 -30
- package/dist/{preflight-names-CpJUd9ZA-BCU-W3cT.mjs.map → preflight-names-BPL-qsZF-BfoRgbgb.mjs.map} +1 -1
- package/dist/{provisioned-edges-Cxy18aoh-CUnaY96r.mjs → provisioned-edges-C1wSO3cx-YC5C19f9.mjs} +3 -3
- package/dist/{provisioned-edges-Cxy18aoh-CUnaY96r.mjs.map → provisioned-edges-C1wSO3cx-YC5C19f9.mjs.map} +1 -1
- package/dist/secret-rz_ZqNeq-_xd97Jd9.mjs +47 -0
- package/dist/secret-rz_ZqNeq-_xd97Jd9.mjs.map +1 -0
- package/dist/serializer-CJiOhF2d-DJUjQj1i.mjs +251 -0
- package/dist/serializer-CJiOhF2d-DJUjQj1i.mjs.map +1 -0
- package/dist/{serializer-BD_6nkr4-DWn5NNTC.d.mts → serializer-Cx5slrV4-xJfH6EWS.d.mts} +2 -2
- package/dist/serializer-Cx5slrV4-xJfH6EWS.d.mts.map +1 -0
- package/dist/storage/index.d.mts +26 -31
- package/dist/storage/index.d.mts.map +1 -1
- package/dist/storage/index.mjs +89 -215
- package/dist/storage/index.mjs.map +1 -1
- package/dist/storage/storage-entrypoint.mjs +122 -147
- package/dist/storage/storage-entrypoint.mjs.map +1 -1
- package/dist/storage/storage-service.mjs +87 -212
- package/dist/storage/storage-service.mjs.map +1 -1
- package/dist/streams/index.d.mts +22 -29
- package/dist/streams/index.d.mts.map +1 -1
- package/dist/streams/index.mjs +88 -213
- package/dist/streams/index.mjs.map +1 -1
- package/dist/streams/streams-entrypoint.mjs +118 -139
- package/dist/streams/streams-entrypoint.mjs.map +1 -1
- package/dist/streams/streams-service.mjs +87 -212
- package/dist/streams/streams-service.mjs.map +1 -1
- package/dist/testing.d.mts +5 -19
- package/dist/testing.d.mts.map +1 -1
- package/dist/testing.mjs +3 -11
- package/dist/testing.mjs.map +1 -1
- package/package.json +18 -18
- package/dist/secret-BVGxqHxY-DYDfiULl.mjs.map +0 -1
- package/dist/serializer-BD_6nkr4-DWn5NNTC.d.mts.map +0 -1
- package/dist/serializer-sVE4UAmg-CikRngbR.mjs +0 -475
- package/dist/serializer-sVE4UAmg-CikRngbR.mjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { isParamSource, paramSource
|
|
1
|
+
import { isParamSource, paramSource } from "@prisma/composer";
|
|
2
2
|
import { blindCast } from "@prisma/composer/casts";
|
|
3
|
-
//#region ../../1-prisma-cloud/1-extensions/target/dist/
|
|
3
|
+
//#region ../../1-prisma-cloud/1-extensions/target/dist/param-BTzY0ne5.mjs
|
|
4
4
|
/**
|
|
5
5
|
* Brands the payload `envParam` builds. Core's `paramSource()` is a public
|
|
6
6
|
* SPI, so a user could bypass `envParam` and bind a raw `paramSource('x')`;
|
|
@@ -60,48 +60,7 @@ function paramBindingFor(bindings, serviceAddress, slot) {
|
|
|
60
60
|
if (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.`);
|
|
61
61
|
return binding;
|
|
62
62
|
}
|
|
63
|
-
/**
|
|
64
|
-
* Brands the payload `envSecret` builds. Core's `secretSource()` is a public
|
|
65
|
-
* SPI, so a user could bypass `envSecret` and bind a raw `secretSource('x')`;
|
|
66
|
-
* the brand lets `secretName` reject such a source (or another target's) with a
|
|
67
|
-
* clear error instead of reading an absent `.name`.
|
|
68
|
-
*/
|
|
69
|
-
const PRISMA_CLOUD_SECRET_SOURCE = blindCast(Symbol.for("prisma:prisma-cloud-secret-source"));
|
|
70
|
-
const RESERVED_SECRET_PREFIX = "COMPOSER_";
|
|
71
|
-
const POISONED_SECRET_NAMES = /* @__PURE__ */ new Set(["DATABASE_URL", "DATABASE_URL_POOLED"]);
|
|
72
|
-
/**
|
|
73
|
-
* Binds a secret slot to a named Prisma Cloud platform env var (ADR-0029). The
|
|
74
|
-
* value is provisioned out-of-band; only the name is carried. The name may not
|
|
75
|
-
* use the framework's reserved `COMPOSER_` prefix or the poisoned
|
|
76
|
-
* `DATABASE_URL(_POOLED)` keys.
|
|
77
|
-
*/
|
|
78
|
-
function envSecret(name) {
|
|
79
|
-
if (typeof name !== "string" || name.length === 0) throw new Error("envSecret() requires a non-empty platform env-var name, e.g. envSecret('STRIPE_SECRET_KEY').");
|
|
80
|
-
if (name.startsWith(RESERVED_SECRET_PREFIX)) throw new Error(`envSecret name "${name}" may not start with "${RESERVED_SECRET_PREFIX}" — that prefix is reserved for the framework's own generated config keys.`);
|
|
81
|
-
if (POISONED_SECRET_NAMES.has(name)) throw new Error(`envSecret name "${name}" is reserved — ${[...POISONED_SECRET_NAMES].join(" and ")} are poisoned at project provision and cannot back a secret.`);
|
|
82
|
-
return secretSource({
|
|
83
|
-
[PRISMA_CLOUD_SECRET_SOURCE]: true,
|
|
84
|
-
name
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
/** True only for a payload that `envSecret` built — i.e. one carrying the brand. */
|
|
88
|
-
function isEnvSecretPayload(payload) {
|
|
89
|
-
return typeof payload === "object" && payload !== null && blindCast(payload)[PRISMA_CLOUD_SECRET_SOURCE] === true;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Reads the Prisma Cloud env-var name back out of an opaque secret source —
|
|
93
|
-
* an `envSecret` leaf of an input binding (ADR-0042). A source not built by
|
|
94
|
-
* `envSecret` (a raw `secretSource(...)` or another target's source) carries
|
|
95
|
-
* no name — reject it here, with `where` naming the leaf's position, so a
|
|
96
|
-
* foreign source fails early and clearly rather than producing a broken
|
|
97
|
-
* deploy with an undefined name.
|
|
98
|
-
*/
|
|
99
|
-
function secretName(source, where) {
|
|
100
|
-
const payload = source.payload;
|
|
101
|
-
if (!isEnvSecretPayload(payload)) throw new Error(`${where} is bound to a secret source not created by envSecret() — bind secrets with envSecret('NAME') from @prisma/composer-prisma-cloud.`);
|
|
102
|
-
return payload.name;
|
|
103
|
-
}
|
|
104
63
|
//#endregion
|
|
105
|
-
export { paramName as
|
|
64
|
+
export { paramName as i, isEnvParamSource as n, paramBindingFor as r, envParam as t };
|
|
106
65
|
|
|
107
|
-
//# sourceMappingURL=
|
|
66
|
+
//# sourceMappingURL=param-BTzY0ne5-CW6ojZ3E.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"param-BTzY0ne5-CW6ojZ3E.mjs","names":[],"sources":["../../../1-prisma-cloud/1-extensions/target/dist/param-BTzY0ne5.mjs"],"sourcesContent":["import { isParamSource, paramSource } from \"@internal/core\";\nimport { blindCast } from \"@internal/foundation/casts\";\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 { paramName as i, isEnvParamSource as n, paramBindingFor as r, envParam as t };\n\n//# sourceMappingURL=param-BTzY0ne5.mjs.map"],"mappings":";;;;;;;;;AASA,MAAM,4BAA4B,UAAU,OAAO,IAAI,kCAAkC,CAAC;AAC1F,MAAM,wBAAwB;AAC9B,MAAM,uCAAuC,IAAI,IAAI,CAAC,gBAAgB,qBAAqB,CAAC;;;;;;;;;AAS5F,SAAS,SAAS,MAAM;CACvB,IAAI,OAAO,SAAS,YAAY,KAAK,WAAW,GAAG,MAAM,IAAI,MAAM,qFAAqF;CACxJ,IAAI,KAAK,WAAW,qBAAqB,GAAG,MAAM,IAAI,MAAM,kBAAkB,KAAK,wBAAwB,sBAAsB,2EAA2E;CAC5M,IAAI,qBAAqB,IAAI,IAAI,GAAG,MAAM,IAAI,MAAM,kBAAkB,KAAK,kBAAkB,CAAC,GAAG,oBAAoB,CAAC,CAAC,KAAK,OAAO,EAAE,4DAA4D;CACjM,OAAO,YAAY;GACjB,4BAA4B;EAC7B;CACD,CAAC;AACF;;AAEA,SAAS,kBAAkB,SAAS;CACnC,OAAO,OAAO,YAAY,YAAY,YAAY,QAAQ,UAAU,OAAO,CAAC,CAAC,+BAA+B;AAC7G;;AAEA,SAAS,iBAAiB,OAAO;CAChC,OAAO,cAAc,KAAK,KAAK,kBAAkB,MAAM,OAAO;AAC/D;;;;;;;;;AASA,SAAS,UAAU,SAAS;CAC3B,MAAM,EAAE,SAAS,UAAU;CAC3B,IAAI,CAAC,iBAAiB,KAAK,GAAG,MAAM,IAAI,MAAM,eAAe,QAAQ,KAAK,gBAAgB,QAAQ,eAAe,qIAAqI;CACtP,OAAO,MAAM,QAAQ;AACtB;;;;;;;;AAQA,SAAS,gBAAgB,UAAU,gBAAgB,MAAM;CACxD,MAAM,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"}
|
package/dist/{preflight-names-CpJUd9ZA-BCU-W3cT.mjs → preflight-names-BPL-qsZF-BfoRgbgb.mjs}
RENAMED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as secretName } from "./secret-rz_ZqNeq-_xd97Jd9.mjs";
|
|
2
|
+
import { i as paramName, n as isEnvParamSource } from "./param-BTzY0ne5-CW6ojZ3E.mjs";
|
|
2
3
|
import { r as withConnectionRetry, t as normalizeSslMode } from "./pg-connection-CadPZuEK-CF3FsSQu.mjs";
|
|
3
|
-
import {
|
|
4
|
+
import { paramManifest, provisionManifest } from "@prisma/composer";
|
|
4
5
|
import { createManagementApiClient } from "@prisma/management-api-sdk";
|
|
5
6
|
import * as Context from "effect/Context";
|
|
6
7
|
import * as Effect from "effect/Effect";
|
|
@@ -761,7 +762,7 @@ function mintKeyPair() {
|
|
|
761
762
|
};
|
|
762
763
|
}
|
|
763
764
|
//#endregion
|
|
764
|
-
//#region ../../1-prisma-cloud/1-extensions/target/dist/preflight-names-
|
|
765
|
+
//#region ../../1-prisma-cloud/1-extensions/target/dist/preflight-names-BPL-qsZF.mjs
|
|
765
766
|
const PRISMA_CLOUD_EXTENSION_ID = "@prisma/composer-prisma-cloud";
|
|
766
767
|
var PrismaCloudContainer = class {
|
|
767
768
|
input;
|
|
@@ -1232,37 +1233,20 @@ function dedupedNames(entries) {
|
|
|
1232
1233
|
for (const entry of entries) if (!byName.has(entry.name)) byName.set(entry.name, entry);
|
|
1233
1234
|
return [...byName.values()];
|
|
1234
1235
|
}
|
|
1235
|
-
/**
|
|
1236
|
-
function collectSecretLeafNames(binding, serviceAddress, out) {
|
|
1237
|
-
if (isSecretSource(binding)) {
|
|
1238
|
-
out.push(secretName(binding, `an input-binding secret leaf of service "${serviceAddress}"`));
|
|
1239
|
-
return;
|
|
1240
|
-
}
|
|
1241
|
-
if (typeof binding !== "object" || binding === null) return;
|
|
1242
|
-
const members = Array.isArray(binding) ? binding : Object.values(binding);
|
|
1243
|
-
for (const member of members) collectSecretLeafNames(member, serviceAddress, out);
|
|
1244
|
-
}
|
|
1245
|
-
/** Walks each service's input binding for `envSecret` leaves, and `graph.params` for env-sourced params (ADR-0042). */
|
|
1236
|
+
/** Walks `graph.secrets`/`graph.params` exactly as `runPreflight` did before this extraction. */
|
|
1246
1237
|
function collectPreflightNames(graph) {
|
|
1247
|
-
const secretEntries = [];
|
|
1248
|
-
for (const { serviceAddress, binding } of inputManifest(graph)) {
|
|
1249
|
-
const leafNames = [];
|
|
1250
|
-
collectSecretLeafNames(binding, serviceAddress, leafNames);
|
|
1251
|
-
for (const name of leafNames) secretEntries.push({
|
|
1252
|
-
name,
|
|
1253
|
-
serviceAddress
|
|
1254
|
-
});
|
|
1255
|
-
}
|
|
1256
|
-
const envParams = dedupedNames(paramManifest(graph).filter((binding) => isEnvParamSource(binding.binding)).map((binding) => ({
|
|
1257
|
-
name: paramName(binding),
|
|
1258
|
-
serviceAddress: binding.serviceAddress
|
|
1259
|
-
})));
|
|
1260
1238
|
return {
|
|
1261
|
-
secrets: dedupedNames(
|
|
1262
|
-
|
|
1239
|
+
secrets: dedupedNames(provisionManifest(graph).map((binding) => ({
|
|
1240
|
+
name: secretName(binding),
|
|
1241
|
+
serviceAddress: binding.serviceAddress
|
|
1242
|
+
}))),
|
|
1243
|
+
envParams: dedupedNames(paramManifest(graph).filter((binding) => isEnvParamSource(binding.binding)).map((binding) => ({
|
|
1244
|
+
name: paramName(binding),
|
|
1245
|
+
serviceAddress: binding.serviceAddress
|
|
1246
|
+
})))
|
|
1263
1247
|
};
|
|
1264
1248
|
}
|
|
1265
1249
|
//#endregion
|
|
1266
1250
|
export { PrismaApiError as A, EnvironmentVariable as C, Bucket as D, packageComputeArtifact as E, callVoid as M, fromEnv as N, BucketKey as O, layer as P, Deployment as S, ServiceKeyProvider as T, Connection as _, PnMigrationProvider as a, COMPUTE_REGIONS as b, S3CredentialsProvider as c, deserialize as d, prismaCloudContainerOf as f, providers as g, Providers as h, PnMigration as i, call as j, ManagementClient as k, collectPreflightNames as l, mintKeyPair as m, PgWarm as n, PrismaCloudContainer as o, resolveTargetRef as p, PgWarmProvider as r, S3Credentials as s, PRISMA_CLOUD_EXTENSION_ID as t, containerDescriptor as u, Database as v, ServiceKey as w, ComputeService as x, Project as y };
|
|
1267
1251
|
|
|
1268
|
-
//# sourceMappingURL=preflight-names-
|
|
1252
|
+
//# sourceMappingURL=preflight-names-BPL-qsZF-BfoRgbgb.mjs.map
|