@prisma/composer 0.36.0-dev.6 → 0.36.0-dev.8
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/{app-config-RX-7kHbF-BroG2yMY.d.mts → app-config-Bf_y5R7o-BEZAnKqM.d.mts} +31 -31
- package/dist/app-config-Bf_y5R7o-BEZAnKqM.d.mts.map +1 -0
- package/dist/app-configuration-file-CeJvBAti-D3uDlheX.mjs +221 -0
- package/dist/app-configuration-file-CeJvBAti-D3uDlheX.mjs.map +1 -0
- package/dist/arktype.mjs +1 -2
- package/dist/arktype.mjs.map +1 -1
- package/dist/config-CDkq5Ayl.d.mts +1 -0
- package/dist/config-adapters-DG-uhGfv-Bt1M9f8b.mjs +47 -0
- package/dist/config-adapters-DG-uhGfv-Bt1M9f8b.mjs.map +1 -0
- package/dist/config.d.mts +7 -9
- package/dist/config.d.mts.map +1 -1
- package/dist/config.mjs +1 -1
- package/dist/control.d.mts +6 -183
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +4 -4
- package/dist/control.mjs.map +1 -1
- package/dist/deploy-CmiYExQA.mjs +373 -0
- package/dist/deploy-CmiYExQA.mjs.map +1 -0
- package/dist/deploy-DQyaIoNe.d.mts +2 -0
- package/dist/deploy.d.mts +4 -3
- package/dist/deploy.mjs +3 -365
- package/dist/{deployment-summary-QkZexVIS-DqL4znd4.mjs → deployment-summary-BiBkPWlB-CyC2pudN.mjs} +9 -46
- package/dist/deployment-summary-BiBkPWlB-CyC2pudN.mjs.map +1 -0
- package/dist/{deployment-summary-Cm4lN6w9-CGdGdlFC.d.mts → deployment-summary-p88NV5m5-BJOosgmI.d.mts} +4 -5
- package/dist/deployment-summary-p88NV5m5-BJOosgmI.d.mts.map +1 -0
- package/dist/{secret-DoWGmN7m-CI5Yrldp.mjs → describe-kind-Cpm_euxo-CkhlGJUL.mjs} +13 -2
- package/dist/describe-kind-Cpm_euxo-CkhlGJUL.mjs.map +1 -0
- package/dist/{dev-current-BurA9uhA-DixUKm8W.mjs → dev-current-D0Kn6Mf4-DDWYu-3j.mjs} +5 -5
- package/dist/{dev-current-BurA9uhA-DixUKm8W.mjs.map → dev-current-D0Kn6Mf4-DDWYu-3j.mjs.map} +1 -1
- package/dist/{dev-environment-name-6eEr5PW8-BbNUVxlS.mjs → dev-environment-name-6eEr5PW8-BwusWVKi.mjs} +3 -3
- package/dist/{dev-environment-name-6eEr5PW8-BbNUVxlS.mjs.map → dev-environment-name-6eEr5PW8-BwusWVKi.mjs.map} +1 -1
- package/dist/{dist-DiYPSVUE.mjs → dist-BtzrklYG.mjs} +2 -2
- package/dist/{dist-DiYPSVUE.mjs.map → dist-BtzrklYG.mjs.map} +1 -1
- package/dist/{dist-DLOn1x6Z.mjs → dist-C7SnNTD3.mjs} +2 -2
- package/dist/{dist-DLOn1x6Z.mjs.map → dist-C7SnNTD3.mjs.map} +1 -1
- package/dist/{execute-deploy-destroy-Cww6zOSC-D8eKSdMX.mjs → execute-deploy-destroy-Dh1CQ9X6-DY4c9egd.mjs} +59 -35
- package/dist/execute-deploy-destroy-Dh1CQ9X6-DY4c9egd.mjs.map +1 -0
- package/dist/{execute-dev-4KYkqSMh-Ny8ATEfU.mjs → execute-dev-Bl-5Q-Av-DILne6iY.mjs} +79 -48
- package/dist/execute-dev-Bl-5Q-Av-DILne6iY.mjs.map +1 -0
- package/dist/{execute-dev-current-Cd4YEUZk-DBj9y27X.mjs → execute-dev-current-D3USgHJ4-CNQe5ADb.mjs} +6 -6
- package/dist/{execute-dev-current-Cd4YEUZk-DBj9y27X.mjs.map → execute-dev-current-D3USgHJ4-CNQe5ADb.mjs.map} +1 -1
- package/dist/{execute-log-BC5o35wQ-photDb2l.mjs → execute-log-Dm3DkQQP-BSjoy6Wd.mjs} +6 -6
- package/dist/{execute-log-BC5o35wQ-photDb2l.mjs.map → execute-log-Dm3DkQQP-BSjoy6Wd.mjs.map} +1 -1
- package/dist/{graph-nazLWyK2-BBciBJje.mjs → graph-Bqr7PSGl-BM-M-TlO.mjs} +169 -40
- package/dist/graph-Bqr7PSGl-BM-M-TlO.mjs.map +1 -0
- package/dist/{graph-B_szUZs6--jpigkBW.d.mts → graph-DI1v3WKX-3g1lTRbh.d.mts} +8 -4
- package/dist/graph-DI1v3WKX-3g1lTRbh.d.mts.map +1 -0
- package/dist/{graph-types-CViux_yr-CVV2nQ0l.d.mts → graph-types-DRe9UUOp-C85Yr-sJ.d.mts} +60 -14
- package/dist/graph-types-DRe9UUOp-C85Yr-sJ.d.mts.map +1 -0
- package/dist/http.d.mts +2 -2
- package/dist/http.mjs +2 -2
- package/dist/{index-BNYl6MsF.d.mts → index-DWQ6BSgm.d.mts} +3 -3
- package/dist/{index-BNYl6MsF.d.mts.map → index-DWQ6BSgm.d.mts.map} +1 -1
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +3 -3
- package/dist/internal-app-configuration-file.d.mts +19 -0
- package/dist/internal-app-configuration-file.d.mts.map +1 -0
- package/dist/internal-app-configuration-file.mjs +2 -0
- package/dist/{local-target-zSdLvLyy.mjs → local-target-Dd8FJEb5.mjs} +4 -3
- package/dist/{local-target-zSdLvLyy.mjs.map → local-target-Dd8FJEb5.mjs.map} +1 -1
- package/dist/local-target.d.mts +2 -2
- package/dist/local-target.d.mts.map +1 -1
- package/dist/local-target.mjs +1 -1
- package/dist/{nextjs-DLyeRR7M-C9O2M7Z4.d.mts → nextjs-DLyeRR7M-RtoHcY1c.d.mts} +3 -3
- package/dist/{nextjs-DLyeRR7M-C9O2M7Z4.d.mts.map → nextjs-DLyeRR7M-RtoHcY1c.d.mts.map} +1 -1
- package/dist/nextjs-control.d.mts +4 -4
- package/dist/nextjs-control.mjs +2 -2
- package/dist/nextjs.d.mts +1 -1
- package/dist/node-control.d.mts +3 -3
- package/dist/node-control.mjs +2 -2
- package/dist/node.d.mts +2 -2
- package/dist/redaction-Bf8FvTFH-BTsKD9B5.d.mts +183 -0
- package/dist/redaction-Bf8FvTFH-BTsKD9B5.d.mts.map +1 -0
- package/dist/redaction-HnbkSFrK-BXRZ3B33.mjs +295 -0
- package/dist/redaction-HnbkSFrK-BXRZ3B33.mjs.map +1 -0
- package/dist/report.d.mts +3 -3
- package/dist/report.mjs +1 -1
- package/dist/report.mjs.map +1 -1
- package/dist/{run-alchemy-B-Z6i3cD-C30mHT0u.mjs → run-alchemy-OS_ix5g0-DCvUYZ7T.mjs} +30 -13
- package/dist/run-alchemy-OS_ix5g0-DCvUYZ7T.mjs.map +1 -0
- package/dist/{run-report-CmBz2-xc-S50d4g5V.mjs → run-report-CmBz2-xc-Cc8rV1CX.mjs} +2 -2
- package/dist/{run-report-CmBz2-xc-S50d4g5V.mjs.map → run-report-CmBz2-xc-Cc8rV1CX.mjs.map} +1 -1
- package/dist/service-rpc.d.mts +2 -2
- package/dist/service-rpc.mjs +2 -2
- package/dist/testing.d.mts +1 -1
- package/dist/{validate-environment-BNZC6W46-CNGrBiHh.mjs → validate-environment-D_dECxgO-B-gqpVEf.mjs} +76 -13
- package/dist/validate-environment-D_dECxgO-B-gqpVEf.mjs.map +1 -0
- package/dist/zod.mjs +1 -2
- package/dist/zod.mjs.map +1 -1
- package/package.json +13 -13
- package/skills/prisma-composer-core-concepts/SKILL.md +6 -5
- package/src/exports/internal-app-configuration-file.ts +1 -0
- package/dist/app-config-RX-7kHbF-BroG2yMY.d.mts.map +0 -1
- package/dist/config-Dp3ZVNnN.d.mts +0 -1
- package/dist/config-adapters-BA_IeiX0-BiE51GeB.mjs +0 -84
- package/dist/config-adapters-BA_IeiX0-BiE51GeB.mjs.map +0 -1
- package/dist/config-pools-DiYw7wMu-DzeWrJdm.mjs +0 -63
- package/dist/config-pools-DiYw7wMu-DzeWrJdm.mjs.map +0 -1
- package/dist/deploy-Dp3ZVNnN.d.mts +0 -1
- package/dist/deploy.mjs.map +0 -1
- package/dist/deployment-summary-Cm4lN6w9-CGdGdlFC.d.mts.map +0 -1
- package/dist/deployment-summary-QkZexVIS-DqL4znd4.mjs.map +0 -1
- package/dist/describe-kind-Cpm_euxo-JFh8ejof.mjs +0 -14
- package/dist/describe-kind-Cpm_euxo-JFh8ejof.mjs.map +0 -1
- package/dist/execute-deploy-destroy-Cww6zOSC-D8eKSdMX.mjs.map +0 -1
- package/dist/execute-dev-4KYkqSMh-Ny8ATEfU.mjs.map +0 -1
- package/dist/graph-B_szUZs6--jpigkBW.d.mts.map +0 -1
- package/dist/graph-nazLWyK2-BBciBJje.mjs.map +0 -1
- package/dist/graph-types-CViux_yr-CVV2nQ0l.d.mts.map +0 -1
- package/dist/internal-pools.d.mts +0 -18
- package/dist/internal-pools.d.mts.map +0 -1
- package/dist/internal-pools.mjs +0 -2
- package/dist/run-alchemy-B-Z6i3cD-C30mHT0u.mjs.map +0 -1
- package/dist/secret-DoWGmN7m-CI5Yrldp.mjs.map +0 -1
- package/dist/validate-environment-BNZC6W46-CNGrBiHh.mjs.map +0 -1
- package/src/exports/internal-pools.ts +0 -1
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { t as blindCast } from "./casts-DpaahrlC-C5XMnP9S.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { t as describeKind } from "./describe-kind-Cpm_euxo-CkhlGJUL.mjs";
|
|
3
|
+
import { a as assertAppName, b as secretsKeys, c as isNode, t as Load } from "./graph-Bqr7PSGl-BM-M-TlO.mjs";
|
|
4
|
+
import { t as InternalError } from "./internal-error-Dfur7Zqt-D96dWHZK.mjs";
|
|
3
5
|
import { t as CliStructuredError } from "./errors-0e8IVwzi.mjs";
|
|
4
|
-
import "./dist-
|
|
5
|
-
import { n as
|
|
6
|
+
import "./dist-C7SnNTD3.mjs";
|
|
7
|
+
import { n as environmentVariables } from "./config-adapters-DG-uhGfv-Bt1M9f8b.mjs";
|
|
8
|
+
import "./deploy-CmiYExQA.mjs";
|
|
9
|
+
import { l as valuesUnderSecretsKeys, r as credentialLookingValues, t as SecretRedaction } from "./redaction-HnbkSFrK-BXRZ3B33.mjs";
|
|
6
10
|
import * as mod from "node:module";
|
|
11
|
+
import * as path$1 from "node:path";
|
|
7
12
|
import * as fs$1 from "node:fs";
|
|
8
13
|
import { existsSync } from "node:fs";
|
|
9
|
-
import * as path$1 from "node:path";
|
|
10
14
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
11
15
|
import { spawnSync } from "node:child_process";
|
|
12
16
|
//#region ../../0-framework/3-tooling/cli/dist/composer-config-DO_iG0iR.mjs
|
|
@@ -348,7 +352,64 @@ async function assembleServices(graph, config, cwd, run, onEvent, options = {})
|
|
|
348
352
|
};
|
|
349
353
|
}
|
|
350
354
|
//#endregion
|
|
351
|
-
//#region ../../0-framework/3-tooling/cli/dist/validate-environment-
|
|
355
|
+
//#region ../../0-framework/3-tooling/cli/dist/validate-environment-D_dECxgO.mjs
|
|
356
|
+
function adapterInvalid(list, index, input, summary, fix) {
|
|
357
|
+
return new CliStructuredError("CONFIG.ADAPTER_INVALID", summary, {
|
|
358
|
+
fix,
|
|
359
|
+
where: { path: input.configFile },
|
|
360
|
+
meta: { field: `${list}[${index}]` }
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
function isValues(value) {
|
|
364
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
365
|
+
}
|
|
366
|
+
function isText(values) {
|
|
367
|
+
return Object.values(values).every((value) => typeof value === "string");
|
|
368
|
+
}
|
|
369
|
+
async function readAdapters(list, adapters, input) {
|
|
370
|
+
const adapterInput = Object.freeze({
|
|
371
|
+
environment: input.environment,
|
|
372
|
+
configDirectory: path$1.dirname(input.configFile)
|
|
373
|
+
});
|
|
374
|
+
const merged = Object.create(null);
|
|
375
|
+
for (const [index, adapter] of adapters.entries()) {
|
|
376
|
+
const field = `composer.${list}[${index}]`;
|
|
377
|
+
let values;
|
|
378
|
+
try {
|
|
379
|
+
values = await adapter(adapterInput);
|
|
380
|
+
} catch (thrown) {
|
|
381
|
+
throw new CliStructuredError("CONFIG.ADAPTER_FAILED", `\`${field}\` failed to read the values for the environment "${input.environment}".`, {
|
|
382
|
+
why: `It threw: ${thrown instanceof Error ? thrown.message : String(thrown)}`,
|
|
383
|
+
fix: `Fix the adapter, or remove it from \`composer.${list}\` in prisma.config.ts.`,
|
|
384
|
+
where: { path: input.configFile },
|
|
385
|
+
meta: { field: `${list}[${index}]` },
|
|
386
|
+
cause: thrown
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
if (typeof values === "function") throw adapterInvalid(list, index, input, `\`${field}\` returned a function, not an object of values.`, "An adapter factory was put in the list instead of the adapter it makes: write `dotenv()`, not `dotenv`.");
|
|
390
|
+
if (!isValues(values)) throw adapterInvalid(list, index, input, `\`${field}\` returned ${describeKind(values)}, not an object of values.`, "Return an object whose keys are the names of the values, e.g. `{ EMAIL_FROM: 'shop@example.com' }`.");
|
|
391
|
+
for (const [key, value] of Object.entries(values)) {
|
|
392
|
+
if (value === void 0) continue;
|
|
393
|
+
if (list === "secrets" && typeof value !== "string") throw adapterInvalid(list, index, input, `\`${field}\` returned ${describeKind(value)} for "${key}", but a secret is text.`, "Return the secret as a string. A platform variable holds text.");
|
|
394
|
+
merged[key] = value;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
return Object.freeze(merged);
|
|
398
|
+
}
|
|
399
|
+
/** Calls the section's `config` adapters (default `[environmentVariables()]`) and merges what they return: the app configuration. */
|
|
400
|
+
function readAppConfiguration(section, input) {
|
|
401
|
+
return readAdapters("config", section.config ?? [environmentVariables()], input);
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Calls the section's `secrets` adapters (default `[environmentVariables()]`) and merges what they
|
|
405
|
+
* return: the app secrets. Every value must be text. A value is a known secret only once the graph
|
|
406
|
+
* names it, so this adds none.
|
|
407
|
+
*/
|
|
408
|
+
async function readAppSecrets(section, input) {
|
|
409
|
+
const merged = await readAdapters("secrets", section.secrets ?? [environmentVariables()], input);
|
|
410
|
+
if (!isText(merged)) throw new InternalError("readAdapters admitted a secret that is not text");
|
|
411
|
+
return merged;
|
|
412
|
+
}
|
|
352
413
|
/**
|
|
353
414
|
* Synchronous Node resolve hook so that entry modules may import relative
|
|
354
415
|
* files using the specifier forms TypeScript accepts by default —
|
|
@@ -617,20 +678,21 @@ async function runPipeline(entry, overrideName, environment, cwd, source, deps =
|
|
|
617
678
|
const entryModule = await loadEntry(resolved.path, cwd, resolved.fix);
|
|
618
679
|
const name = overrideName ?? entryModule.root.name;
|
|
619
680
|
if (name.length === 0) throw new CliStructuredError("COMPOSE.NAME_MISSING", "The root node has no name.", { fix: "Name it at authoring, or pass --name." });
|
|
620
|
-
const
|
|
681
|
+
const redaction = deps.redaction ?? new SecretRedaction(process.env);
|
|
682
|
+
const adapterInput = {
|
|
621
683
|
environment,
|
|
622
684
|
configFile: configSource.file
|
|
623
685
|
};
|
|
624
|
-
const
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
};
|
|
686
|
+
const secrets = deps.readSecrets === true ? await readAppSecrets(config, adapterInput) : NO_SECRETS;
|
|
687
|
+
const configuration = await readAppConfiguration(config, adapterInput);
|
|
688
|
+
redaction.addCredentialLookingValues(credentialLookingValues(configuration));
|
|
628
689
|
const graph = Load(entryModule.root, {
|
|
629
690
|
id: name,
|
|
630
691
|
environment: { name: environment },
|
|
631
|
-
|
|
692
|
+
configuration
|
|
632
693
|
});
|
|
633
694
|
if (graph.root.node.kind !== "module") throw new CliStructuredError("COMPOSE.ROOT_NOT_MODULE", "The deploy root must be a module.", { fix: "Wrap your service, e.g. export default module('name', ({ provision }) => { provision(service); })." });
|
|
695
|
+
redaction.addKnownSecrets(valuesUnderSecretsKeys(configuration, secrets, secretsKeys(graph)));
|
|
634
696
|
validateRegistryCoverage(graph, config);
|
|
635
697
|
deps.onEvent?.({ kind: "loaded" });
|
|
636
698
|
let assembled;
|
|
@@ -646,7 +708,8 @@ async function runPipeline(entry, overrideName, environment, cwd, source, deps =
|
|
|
646
708
|
graph,
|
|
647
709
|
name,
|
|
648
710
|
assembled,
|
|
649
|
-
|
|
711
|
+
configuration,
|
|
712
|
+
secrets
|
|
650
713
|
};
|
|
651
714
|
}
|
|
652
715
|
/** Letters, digits, `-` and `_`, starting with a letter or digit: always a valid git ref, so no `git` is needed to check it. */
|
|
@@ -661,4 +724,4 @@ function validateEnvironmentName(environment, spawn = spawnSync) {
|
|
|
661
724
|
//#endregion
|
|
662
725
|
export { noComposerExportMessage as a, validateEnvironmentName as i, resolveAppIdentity as n, runPipeline as r, checkConfigSource as t };
|
|
663
726
|
|
|
664
|
-
//# sourceMappingURL=validate-environment-
|
|
727
|
+
//# sourceMappingURL=validate-environment-D_dECxgO-B-gqpVEf.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-environment-D_dECxgO-B-gqpVEf.mjs","names":["fs","path","path","fs"],"sources":["../../../0-framework/3-tooling/cli/dist/composer-config-DO_iG0iR.mjs","../../../0-framework/3-tooling/assemble/dist/index.mjs","../../../0-framework/3-tooling/cli/dist/validate-environment-D_dECxgO.mjs"],"sourcesContent":["import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\n//#region src/composer-config.ts\n/**\n* What makes a `composer` section valid, shared by the CLI's section validator and the programmatic operations.\n* It imports nothing from the CLI engine, because `@prisma/composer` must not depend on it.\n*/\nconst SECTION_FIX = \"Write `composer: composer({ entry: './module.ts', extensions: [...], state: ... })` in prisma.config.ts, with `import { defineConfig as composer } from '@prisma/composer/config'`.\";\nconst MOVE_TO_SECTION_FIX = `${SECTION_FIX} If the project has a prisma-composer.config.ts, move its extensions and state into that section and delete the file.`;\nconst SECTION_IS_THE_ONLY_SOURCE = \"Composer reads its configuration only from the `composer` section of prisma.config.ts.\";\nconst DESCRIPTOR_FIX = \"Use the descriptor the extension factory returns, unchanged, instead of building one by hand.\";\nconst RETIRED_FILE_NAMES = [\n\t\"ts\",\n\t\"mts\",\n\t\"mjs\",\n\t\"js\"\n].map((extension) => `prisma-composer.config.${extension}`);\nconst sectionMissing = {\n\tcode: \"CONFIG.SECTION_MISSING\",\n\tsummary: \"No loaded prisma.config.ts declares a `composer` section.\",\n\twhy: `${SECTION_IS_THE_ONLY_SOURCE} A prisma-composer.config.ts file is no longer read.`,\n\tfix: MOVE_TO_SECTION_FIX\n};\n/** What the generated stack file throws when the file it imports has no `composer` export. */\nfunction noComposerExportMessage(configFile) {\n\treturn `${configFile} declares no \\`composer\\` section. Pass the prisma.config.ts that declares it.`;\n}\nfunction configFileMissing(file) {\n\treturn {\n\t\tcode: \"CONFIG.FILE_MISSING\",\n\t\tsummary: `${file} does not exist.`,\n\t\tfix: \"Pass the path of the prisma.config.ts that declares the `composer` section.\",\n\t\twhere: file\n\t};\n}\n/** A prisma-composer.config.* beside the declaring file would otherwise be silently ignored. */\n/** The path with symlinks resolved; the path itself when it cannot be resolved, so the check never throws. */\nfunction realPath(file) {\n\ttry {\n\t\treturn fs.realpathSync(file);\n\t} catch {\n\t\treturn file;\n\t}\n}\nfunction retiredFileFinding(configFile) {\n\tconst directory = path.dirname(realPath(configFile));\n\tconst found = RETIRED_FILE_NAMES.map((name) => path.join(directory, name)).find((file) => fs.existsSync(file));\n\tif (found === void 0) return void 0;\n\treturn {\n\t\tcode: \"CONFIG.FILE_RETIRED\",\n\t\tsummary: `${found} is no longer read.`,\n\t\twhy: SECTION_IS_THE_ONLY_SOURCE,\n\t\tfix: MOVE_TO_SECTION_FIX,\n\t\twhere: found\n\t};\n}\nfunction isObject(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nfunction isExtensionDescriptor(value) {\n\treturn isObject(value) && typeof value[\"id\"] === \"string\" && value[\"id\"].length > 0 && isObject(value[\"nodes\"]);\n}\nfunction isStateDescriptor(value) {\n\treturn isObject(value) && typeof value[\"extension\"] === \"string\" && typeof value[\"create\"] === \"function\";\n}\nconst stateInvalid = {\n\tcode: \"CONFIG.FIELD_INVALID\",\n\tsummary: \"`composer.state` must be a state descriptor with a string `extension` and a `create` function.\",\n\tfix: \"Set `state` to the state descriptor an extension provides, e.g. `state: prismaState()`.\",\n\tfield: \"state\"\n};\nconst SECTION_FIELDS = /* @__PURE__ */ new Set([\n\t\"entry\",\n\t\"extensions\",\n\t\"state\",\n\t\"config\",\n\t\"secrets\"\n]);\nconst entryInvalid = {\n\tcode: \"CONFIG.FIELD_INVALID\",\n\tsummary: \"`composer.entry` must be a non-empty string: the path to the module whose default export is the app.\",\n\tfix: \"Set `entry` to that module's path, relative to prisma.config.ts, e.g. `entry: './module.ts'`.\",\n\tfield: \"entry\"\n};\n/** Neither the section's `entry` nor an override names the module whose default export is the app. */\nconst entryMissing = {\n\tcode: \"CONFIG.ENTRY_MISSING\",\n\tsummary: \"No entry module is set, so there is no app to load.\",\n\twhy: \"The entry is the module whose default export is the app root, built with module(...).\",\n\tfix: \"Set `entry: './module.ts'` in the `composer` section of prisma.config.ts, or pass `--entry <path>` (the `entry` input when calling @prisma/composer/control).\",\n\tfield: \"entry\"\n};\nfunction unknownField(key) {\n\treturn {\n\t\tcode: \"CONFIG.FIELD_UNKNOWN\",\n\t\tsummary: `The \\`composer\\` section has no field \\`${key}\\`.`,\n\t\tfix: key === \"composer\" ? \"Pass the `composer` property of the prisma.config.ts export, not the whole export. The section takes only `entry`, `extensions`, `state`, `config` and `secrets`.\" : `Remove \\`${key}\\`. The section takes only \\`entry\\`, \\`extensions\\`, \\`state\\`, \\`config\\` and \\`secrets\\`.`,\n\t\tfield: key\n\t};\n}\nfunction checkExtensions(value) {\n\tif (!Array.isArray(value)) return {\n\t\textensions: [],\n\t\tfindings: [{\n\t\t\tcode: \"CONFIG.FIELD_INVALID\",\n\t\t\tsummary: \"`composer.extensions` must be an array of extension descriptors.\",\n\t\t\tfix: \"Set `extensions` to the descriptors your extensions provide, e.g. `extensions: [nodeBuild()]`.\",\n\t\t\tfield: \"extensions\"\n\t\t}]\n\t};\n\tconst findings = [];\n\tconst extensions = [];\n\tconst seen = /* @__PURE__ */ new Set();\n\tfor (const [index, entry] of value.entries()) {\n\t\tconst field = `extensions[${index}]`;\n\t\tif (!isObject(entry)) {\n\t\t\tfindings.push({\n\t\t\t\tcode: \"CONFIG.FIELD_INVALID\",\n\t\t\t\tsummary: `\\`composer.${field}\\` must be an extension descriptor object.`,\n\t\t\t\tfix: \"Put the descriptor an extension factory returns here, e.g. `nodeBuild()`, not the factory itself.\",\n\t\t\t\tfield\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst id = entry[\"id\"];\n\t\tif (typeof id !== \"string\" || id.length === 0) findings.push({\n\t\t\tcode: \"CONFIG.FIELD_INVALID\",\n\t\t\tsummary: `\\`composer.${field}.id\\` must be a non-empty string (the extension package name).`,\n\t\t\tfix: DESCRIPTOR_FIX,\n\t\t\tfield: `${field}.id`\n\t\t});\n\t\telse if (seen.has(id)) findings.push({\n\t\t\tcode: \"CONFIG.EXTENSION_DUPLICATE\",\n\t\t\tsummary: `Extension \"${id}\" is listed more than once in \\`composer.extensions\\`.`,\n\t\t\tfix: `Remove the repeated \"${id}\" entry from \\`extensions\\`.`,\n\t\t\tfield: `${field}.id`\n\t\t});\n\t\telse seen.add(id);\n\t\tif (!isObject(entry[\"nodes\"])) findings.push({\n\t\t\tcode: \"CONFIG.FIELD_INVALID\",\n\t\t\tsummary: `\\`composer.${field}.nodes\\` must be an object (the node-ID → control registry).`,\n\t\t\tfix: DESCRIPTOR_FIX,\n\t\t\tfield: `${field}.nodes`\n\t\t});\n\t\tif (isExtensionDescriptor(entry)) extensions.push(entry);\n\t}\n\treturn {\n\t\tfindings,\n\t\textensions\n\t};\n}\nfunction isAdapterList(value) {\n\treturn Array.isArray(value) && value.every((entry) => typeof entry === \"function\");\n}\nfunction checkAdapters(list, value) {\n\tif (value === void 0) return [];\n\tif (!Array.isArray(value)) return [{\n\t\tcode: \"CONFIG.FIELD_INVALID\",\n\t\tsummary: `\\`composer.${list}\\` must be an array of adapters.`,\n\t\tfix: `Set \\`${list}\\` to a list of adapters, e.g. \\`${list}: [dotenv(), environmentVariables()]\\`, imported from '@prisma/composer/config'.`,\n\t\tfield: list\n\t}];\n\treturn value.flatMap((entry, index) => typeof entry === \"function\" ? [] : [{\n\t\tcode: \"CONFIG.FIELD_INVALID\",\n\t\tsummary: `\\`composer.${list}[${index}]\\` must be an adapter: a function that receives the environment and returns its values.`,\n\t\tfix: \"Put an adapter here, e.g. `dotenv()`.\",\n\t\tfield: `${list}[${index}]`\n\t}]);\n}\nfunction checkFields(section) {\n\tif (Object.hasOwn(section, \"configPath\")) return {\n\t\tok: false,\n\t\tfindings: [{\n\t\t\tcode: \"CONFIG.FIELD_RETIRED\",\n\t\t\tsummary: \"`composer.configPath` is no longer supported: prisma-composer.config.ts is no longer read.\",\n\t\t\twhy: SECTION_IS_THE_ONLY_SOURCE,\n\t\t\tfix: `Replace \\`configPath\\` with the section itself. ${MOVE_TO_SECTION_FIX}`,\n\t\t\tfield: \"configPath\"\n\t\t}]\n\t};\n\tif (Object.hasOwn(section, \"composer\")) return {\n\t\tok: false,\n\t\tfindings: [unknownField(\"composer\")]\n\t};\n\tconst findings = Object.keys(section).filter((key) => !SECTION_FIELDS.has(key)).map(unknownField);\n\tconst checked = checkExtensions(section[\"extensions\"]);\n\tfindings.push(...checked.findings);\n\tconst state = section[\"state\"];\n\tif (!isStateDescriptor(state)) findings.push(stateInvalid);\n\tconst entry = section[\"entry\"];\n\tconst entryValid = entry === void 0 || typeof entry === \"string\" && entry.length > 0;\n\tif (!entryValid) findings.push(entryInvalid);\n\tconst config = section[\"config\"];\n\tconst secrets = section[\"secrets\"];\n\tfindings.push(...checkAdapters(\"config\", config), ...checkAdapters(\"secrets\", secrets));\n\tconst [first, ...rest] = findings;\n\tif (first === void 0 && isStateDescriptor(state) && entryValid && (config === void 0 || isAdapterList(config)) && (secrets === void 0 || isAdapterList(secrets))) return {\n\t\tok: true,\n\t\tvalue: {\n\t\t\textensions: checked.extensions,\n\t\t\tstate,\n\t\t\t...entry === void 0 ? {} : { entry },\n\t\t\t...config === void 0 ? {} : { config },\n\t\t\t...secrets === void 0 ? {} : { secrets }\n\t\t}\n\t};\n\treturn {\n\t\tok: false,\n\t\tfindings: [first ?? stateInvalid, ...rest]\n\t};\n}\n/**\n* Checks the fields that identify each descriptor and returns the descriptors as the config file's own objects.\n* Never throws: a section's values are user code, and a throwing getter or Proxy trap becomes a finding.\n*/\nfunction checkComposerSection(raw) {\n\tif (!isObject(raw)) return {\n\t\tok: false,\n\t\tfindings: [{\n\t\t\tcode: \"CONFIG.FIELD_INVALID\",\n\t\t\tsummary: \"The `composer` section of prisma.config.ts must be an object.\",\n\t\t\tfix: SECTION_FIX\n\t\t}]\n\t};\n\ttry {\n\t\treturn checkFields({ ...raw });\n\t} catch (cause) {\n\t\treturn {\n\t\t\tok: false,\n\t\t\tfindings: [{\n\t\t\t\tcode: \"CONFIG.FIELD_INVALID\",\n\t\t\t\tsummary: \"The `composer` section of prisma.config.ts could not be read.\",\n\t\t\t\twhy: `Reading it threw: ${cause instanceof Error ? cause.message : String(cause)}`,\n\t\t\t\tfix: SECTION_FIX\n\t\t\t}]\n\t\t};\n\t}\n}\n/**\n* The whole check, shared by the section validator and the programmatic operations so both report the same findings in the same order: the retired file beside the declaring `configFile` (resolved through symlinks), then every field finding.\n*/\nfunction checkComposerConfig(raw, configFile) {\n\tconst retired = retiredFileFinding(configFile);\n\tconst checked = checkComposerSection(raw);\n\tif (retired === void 0) return checked;\n\treturn {\n\t\tok: false,\n\t\tfindings: checked.ok ? [retired] : [retired, ...checked.findings]\n\t};\n}\n//#endregion\nexport { sectionMissing as a, noComposerExportMessage as i, configFileMissing as n, entryMissing as r, checkComposerConfig as t };\n\n//# sourceMappingURL=composer-config-DO_iG0iR.mjs.map","import { CliStructuredError } from \"@internal/foundation/errors\";\n//#region src/assemble-error.ts\n/**\n* A user-facing assembly failure, structured at origin (base-type rule 6):\n* a `CliStructuredError` whose code names which way assembly went wrong.\n* This package's second consumer is the programmatic deploy API, not just\n* the CLI — hosts branch on `error.code`, the CLI renders the envelope.\n*/\nvar AssembleError = class extends CliStructuredError {\n\tconstructor(code, summary, options) {\n\t\tsuper(code, summary, options);\n\t}\n};\n//#endregion\n//#region src/assemble-services.ts\n/**\n* The registry route for one service's build: extension by\n* `build.extension`, node descriptor by `build.type`, kind must be \"build\".\n* The CLI's coverage validation reports the same misses earlier with the\n* config fix; these errors are the backstop for programmatic callers.\n*/\nfunction buildDescriptorAssemble(config, node, address, cwd, report) {\n\tconst { extension, type } = node.build;\n\tconst extensionDescriptor = config.extensions.find((candidate) => candidate.id === extension);\n\tif (extensionDescriptor === void 0) throw new AssembleError(\"ASSEMBLE.EXTENSION_MISSING\", `No extension \"${extension}\" is configured (needed by service \"${node.name}\"'s build).`, { fix: \"Add it to `extensions` in the `composer` section of prisma.config.ts.\" });\n\tconst nodeDescriptor = extensionDescriptor.nodes[type];\n\tif (nodeDescriptor === void 0) throw new AssembleError(\"ASSEMBLE.DESCRIPTOR_MISSING\", `Extension \"${extension}\" has no descriptor for build type \"${type}\".`, { why: `Known types: ${Object.keys(extensionDescriptor.nodes).join(\", \")}.` });\n\tif (nodeDescriptor.kind !== \"build\") throw new AssembleError(\"ASSEMBLE.DESCRIPTOR_KIND_MISMATCH\", `Extension \"${extension}\"'s descriptor for type \"${type}\" is a \"${nodeDescriptor.kind}\" descriptor.`, { why: \"Assembling a service build needs a \\\"build\\\" descriptor.\" });\n\treturn nodeDescriptor.assemble({\n\t\tbuild: node.build,\n\t\taddress,\n\t\tcwd,\n\t\treport\n\t});\n}\n/**\n* The dev server a service's build descriptor declares, or `undefined` when it\n* declares none — including when the registry route misses, which the\n* assemble that follows reports with its own pinned error.\n*/\nasync function buildDescriptorServe(config, node, address) {\n\tconst { extension, type } = node.build;\n\tconst nodeDescriptor = config.extensions.find((candidate) => candidate.id === extension)?.nodes[type];\n\tif (nodeDescriptor?.kind !== \"build\" || nodeDescriptor.serve === void 0) return void 0;\n\ttry {\n\t\treturn await nodeDescriptor.serve({\n\t\t\tbuild: node.build,\n\t\t\taddress\n\t\t});\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) throw error;\n\t\tthrow new CliStructuredError(\"DEV.DEV_SERVER_UNAVAILABLE\", `service \"${address}\" cannot run its dev server: ${error instanceof Error ? error.message : String(error)}`, {\n\t\t\tmeta: { address },\n\t\t\tcause: error\n\t\t});\n\t}\n}\nasync function assembleServices(graph, config, cwd, run, onEvent, options = {}) {\n\tconst runAssembler = run ?? ((node, address, nodeCwd, report) => buildDescriptorAssemble(config, node, address, nodeCwd, report));\n\tconst serviceNodes = graph.nodes.filter((n) => n.node.kind === \"service\");\n\tif (serviceNodes.length === 0) throw new AssembleError(\"ASSEMBLE.SERVICE_MISSING\", \"The loaded graph has no service to assemble.\");\n\tconst bundles = {};\n\tconst devServers = {};\n\tfor (const { id, node } of serviceNodes) {\n\t\tif (options.devServers === true) {\n\t\t\tconst server = await buildDescriptorServe(config, node, id);\n\t\t\tif (server !== void 0) {\n\t\t\t\tdevServers[id] = server;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tonEvent?.({\n\t\t\tkind: \"service-started\",\n\t\t\taddress: id\n\t\t});\n\t\tconst data = {};\n\t\tlet artifact;\n\t\ttry {\n\t\t\tartifact = await runAssembler(node, id, cwd, (reported) => Object.assign(data, reported));\n\t\t} catch (error) {\n\t\t\tif (CliStructuredError.is(error)) throw error;\n\t\t\tthrow new AssembleError(\"ASSEMBLE.BUILD_FAILED\", error instanceof Error ? error.message : String(error), {\n\t\t\t\tmeta: { address: id },\n\t\t\t\tcause: error\n\t\t\t});\n\t\t}\n\t\tbundles[id] = artifact;\n\t\tonEvent?.({\n\t\t\tkind: \"service-assembled\",\n\t\t\taddress: id,\n\t\t\tdata\n\t\t});\n\t}\n\treturn {\n\t\tbundles,\n\t\tdevServers\n\t};\n}\n//#endregion\nexport { AssembleError, assembleServices };\n\n//# sourceMappingURL=index.mjs.map","import { n as environmentVariables } from \"./config-adapters-DG-uhGfv.mjs\";\nimport { n as configFileMissing, r as entryMissing, t as checkComposerConfig } from \"./composer-config-DO_iG0iR.mjs\";\nimport { i as credentialLookingValues, n as SecretRedaction, u as valuesUnderSecretsKeys } from \"./redaction-HnbkSFrK.mjs\";\nimport * as mod from \"node:module\";\nimport * as fs from \"node:fs\";\nimport { existsSync } from \"node:fs\";\nimport * as path from \"node:path\";\nimport { assembleServices } from \"@internal/assemble\";\nimport { Load, assertAppName, isNode } from \"@internal/core\";\nimport { secretsKeys } from \"@internal/core/deploy\";\nimport { CliStructuredError, InternalError, describeKind } from \"@internal/foundation/errors\";\nimport { fileURLToPath, pathToFileURL } from \"node:url\";\nimport { blindCast } from \"@internal/foundation/casts\";\nimport { spawnSync } from \"node:child_process\";\n//#region src/app-configuration.ts\nfunction adapterInvalid(list, index, input, summary, fix) {\n\treturn new CliStructuredError(\"CONFIG.ADAPTER_INVALID\", summary, {\n\t\tfix,\n\t\twhere: { path: input.configFile },\n\t\tmeta: { field: `${list}[${index}]` }\n\t});\n}\nfunction isValues(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nfunction isText(values) {\n\treturn Object.values(values).every((value) => typeof value === \"string\");\n}\nasync function readAdapters(list, adapters, input) {\n\tconst adapterInput = Object.freeze({\n\t\tenvironment: input.environment,\n\t\tconfigDirectory: path.dirname(input.configFile)\n\t});\n\tconst merged = Object.create(null);\n\tfor (const [index, adapter] of adapters.entries()) {\n\t\tconst field = `composer.${list}[${index}]`;\n\t\tlet values;\n\t\ttry {\n\t\t\tvalues = await adapter(adapterInput);\n\t\t} catch (thrown) {\n\t\t\tthrow new CliStructuredError(\"CONFIG.ADAPTER_FAILED\", `\\`${field}\\` failed to read the values for the environment \"${input.environment}\".`, {\n\t\t\t\twhy: `It threw: ${thrown instanceof Error ? thrown.message : String(thrown)}`,\n\t\t\t\tfix: `Fix the adapter, or remove it from \\`composer.${list}\\` in prisma.config.ts.`,\n\t\t\t\twhere: { path: input.configFile },\n\t\t\t\tmeta: { field: `${list}[${index}]` },\n\t\t\t\tcause: thrown\n\t\t\t});\n\t\t}\n\t\tif (typeof values === \"function\") throw adapterInvalid(list, index, input, `\\`${field}\\` returned a function, not an object of values.`, \"An adapter factory was put in the list instead of the adapter it makes: write `dotenv()`, not `dotenv`.\");\n\t\tif (!isValues(values)) throw adapterInvalid(list, index, input, `\\`${field}\\` returned ${describeKind(values)}, not an object of values.`, \"Return an object whose keys are the names of the values, e.g. `{ EMAIL_FROM: 'shop@example.com' }`.\");\n\t\tfor (const [key, value] of Object.entries(values)) {\n\t\t\tif (value === void 0) continue;\n\t\t\tif (list === \"secrets\" && typeof value !== \"string\") throw adapterInvalid(list, index, input, `\\`${field}\\` returned ${describeKind(value)} for \"${key}\", but a secret is text.`, \"Return the secret as a string. A platform variable holds text.\");\n\t\t\tmerged[key] = value;\n\t\t}\n\t}\n\treturn Object.freeze(merged);\n}\n/** Calls the section's `config` adapters (default `[environmentVariables()]`) and merges what they return: the app configuration. */\nfunction readAppConfiguration(section, input) {\n\treturn readAdapters(\"config\", section.config ?? [environmentVariables()], input);\n}\n/**\n* Calls the section's `secrets` adapters (default `[environmentVariables()]`) and merges what they\n* return: the app secrets. Every value must be text. A value is a known secret only once the graph\n* names it, so this adds none.\n*/\nasync function readAppSecrets(section, input) {\n\tconst merged = await readAdapters(\"secrets\", section.secrets ?? [environmentVariables()], input);\n\tif (!isText(merged)) throw new InternalError(\"readAdapters admitted a secret that is not text\");\n\treturn merged;\n}\n//#endregion\n//#region src/entry-resolution.ts\n/**\n* Synchronous Node resolve hook so that entry modules may import relative\n* files using the specifier forms TypeScript accepts by default —\n* extensionless `./service` and `./service.js` for a `.ts` source file —\n* without requiring `allowImportingTsExtensions` in every consumer's tsconfig.\n*\n* Resolution only; uses TypeScript's own documented mapping: for a specifier\n* Node could not resolve, strip any JS-family extension and probe the\n* corresponding TypeScript source; first candidate that exists on disk wins.\n* Format-specific rules: `.mjs` → `.mts`; `.cjs` → `.cts`; `.js` and\n* extensionless → `.ts`, `.mts`, `.tsx`, then `./index.ts`. Bare and package\n* specifiers are never touched. Existing `./x.ts` imports keep working —\n* Node resolves them before the hook fires (ADR-0005: no transform, no\n* guessing, deterministic TypeScript rule).\n*\n* Bun resolves `./x.js` and `./x` to `x.ts` natively, so the hook is a\n* no-op under Bun. Nothing is registered there.\n*/\nlet registered = false;\n/**\n* Registers the resolve hook once (idempotent). Call at the start of\n* `loadEntry` so every module in the entry graph benefits, including those\n* imported lazily after the entry itself loads.\n*/\nfunction registerEntryResolution() {\n\tif (registered || typeof process.versions.bun === \"string\") return;\n\tif (typeof mod.registerHooks !== \"function\") return;\n\tregistered = true;\n\tmod.registerHooks({ resolve(specifier, context, nextResolve) {\n\t\ttry {\n\t\t\treturn nextResolve(specifier, context);\n\t\t} catch (error) {\n\t\t\tif (!isRelativeSpecifier(specifier) || context.parentURL === void 0 || !isModuleNotFoundError(error)) throw error;\n\t\t\tfor (const candidate of sourceCandidates(new URL(specifier, context.parentURL))) if (existsSync(fileURLToPath(candidate))) return nextResolve(candidate.href, context);\n\t\t\tthrow error;\n\t\t}\n\t} });\n}\n/**\n* TypeScript's extension mapping: for a JS-family or extensionless URL,\n* produce the source candidates to probe. Format-specific: `.mjs` maps only\n* to `.mts`; `.cjs` maps only to `.cts`; `.js` and extensionless probe\n* `.ts`, `.mts`, `.tsx` (keeping `.tsx` so the JSX diagnostic fires), then\n* `./index.ts`.\n*/\nfunction sourceCandidates(resolved) {\n\tconst href = resolved.href;\n\tif (href.endsWith(\".mjs\")) {\n\t\tconst base = href.slice(0, -4);\n\t\treturn [new URL(`${base}.mts`)];\n\t}\n\tif (href.endsWith(\".cjs\")) {\n\t\tconst base = href.slice(0, -4);\n\t\treturn [new URL(`${base}.cts`)];\n\t}\n\tconst base = href.endsWith(\".js\") ? href.slice(0, -3) : href;\n\treturn [\n\t\tnew URL(`${base}.ts`),\n\t\tnew URL(`${base}.mts`),\n\t\tnew URL(`${base}.tsx`),\n\t\tnew URL(`${base}/index.ts`)\n\t];\n}\nfunction isRelativeSpecifier(specifier) {\n\treturn specifier.startsWith(\"./\") || specifier.startsWith(\"../\");\n}\nfunction isModuleNotFoundError(error) {\n\tif (!(error instanceof Error)) return false;\n\tif (!(\"code\" in error)) return false;\n\treturn error.code === \"ERR_MODULE_NOT_FOUND\";\n}\n//#endregion\n//#region src/jsx-load-error.ts\n/**\n* `loadEntry` imports a user's topology with the host runtime's own module\n* loader — under node (the CLI's shebang runtime), that loader strips\n* TypeScript types but has no JSX transform (ADR-0005: the framework\n* doesn't bundle or transform the app's code; deploy loading is no\n* exception). A `.tsx`/`.jsx` file anywhere in the topology's import graph\n* dies with node's raw `ERR_UNKNOWN_FILE_EXTENSION`, which names the file\n* but not the cause or the fix. This turns that one case into structured\n* error parts (summary/why/fix) that do — every other load failure (syntax\n* errors, missing files, non-JSX unknown extensions) is untouched.\n*/\nconst UNKNOWN_EXTENSION_CODE = \"ERR_UNKNOWN_FILE_EXTENSION\";\nconst JSX_EXTENSIONS = [\".tsx\", \".jsx\"];\nfunction errorCode(error) {\n\treturn \"code\" in error && typeof error.code === \"string\" ? error.code : void 0;\n}\nfunction unknownExtensionPath(error) {\n\tif (!(error instanceof Error)) return void 0;\n\tif (errorCode(error) !== UNKNOWN_EXTENSION_CODE) return void 0;\n\treturn /Unknown file extension \"\\.\\w+\" for (.+)$/.exec(error.message)?.[1];\n}\n/**\n* Returns structured error parts when `error` is node's\n* `ERR_UNKNOWN_FILE_EXTENSION` for a `.tsx`/`.jsx` file — `undefined` for\n* every other error (including unknown-extension failures for some other\n* extension), so the caller can fall through to its normal rethrow.\n*/\nfunction explainJsxLoadError(error, entryPath) {\n\tconst offendingPath = unknownExtensionPath(error);\n\tif (offendingPath === void 0) return void 0;\n\tif (!JSX_EXTENSIONS.some((ext) => offendingPath.endsWith(ext))) return void 0;\n\treturn {\n\t\tsummary: `\"${offendingPath}\" can't be loaded.`,\n\t\twhy: `deploy loads \"${entryPath}\"'s topology with node's own module loader, which strips TypeScript types but has no JSX transform — so a .tsx/.jsx file can't sit anywhere in that import graph.`,\n\t\tfix: \"Precompile that file in your own build (transform the JSX away, keep the real npm packages external) and import the compiled output instead of the raw .tsx/.jsx — see examples/email/scripts/build.ts in the prisma/composer repo for a worked example.\"\n\t};\n}\n//#endregion\n//#region src/load-entry.ts\n/**\n* Pipeline step 2 (deploy-cli.md § The pipeline): import the entry module\n* (resolved against cwd) and require its default export to be a node — a\n* service or module, branded by core's factories. Whatever this module exports\n* IS the application; nothing else marks a root (ADR-0003).\n*/\n/** `unloadableFix`, when given, says where the path came from, so a wrong path names its source. */\nasync function loadEntry(entryArg, cwd, unloadableFix) {\n\tregisterEntryResolution();\n\tconst resolvedPath = path.resolve(cwd, entryArg);\n\tlet mod;\n\ttry {\n\t\tmod = await import(pathToFileURL(resolvedPath).href);\n\t} catch (error) {\n\t\tconst explained = explainJsxLoadError(error, resolvedPath);\n\t\tif (explained !== void 0) throw new CliStructuredError(\"COMPOSE.ENTRY_UNLOADABLE\", explained.summary, {\n\t\t\twhy: explained.why,\n\t\t\tfix: explained.fix,\n\t\t\twhere: { path: resolvedPath },\n\t\t\tcause: error\n\t\t});\n\t\tthrow new CliStructuredError(\"COMPOSE.ENTRY_UNLOADABLE\", `Failed to import entry module \"${resolvedPath}\": ${error instanceof Error ? error.message : String(error)}`, {\n\t\t\t...unloadableFix === void 0 ? {} : { fix: unloadableFix },\n\t\t\twhere: { path: resolvedPath },\n\t\t\tcause: error\n\t\t});\n\t}\n\tconst root = blindCast(mod).default;\n\tif (!isNode(root) || root.kind === \"dependency\" || root.kind === \"resource\") throw new CliStructuredError(\"COMPOSE.ENTRY_EXPORT_INVALID\", `Entry module \"${resolvedPath}\" must default-export a node (a service or a module).`, {\n\t\tfix: \"Construct it with service() or module() from @prisma/composer.\",\n\t\twhere: { path: resolvedPath }\n\t});\n\treturn {\n\t\tpath: resolvedPath,\n\t\troot: blindCast(root)\n\t};\n}\n//#endregion\n//#region src/validate-coverage.ts\nfunction lookup(extensions, extension, type, expectedKind, what) {\n\tconst ext = extensions.get(extension);\n\tif (ext === void 0) throw new CliStructuredError(\"CONFIG.EXTENSION_MISSING\", `No extension \"${extension}\" is configured (needed by ${what}).`, {\n\t\tfix: \"Add it to `extensions` in the `composer` section of prisma.config.ts (import its /control entry and list its descriptor).\",\n\t\tmeta: {\n\t\t\textension,\n\t\t\ttype\n\t\t}\n\t});\n\tconst descriptor = ext.nodes[type];\n\tif (descriptor === void 0) throw new CliStructuredError(\"CONFIG.DESCRIPTOR_MISSING\", `Extension \"${extension}\" has no descriptor for node type \"${type}\" (needed by ${what}).`, {\n\t\twhy: `Known types: ${Object.keys(ext.nodes).join(\", \")}.`,\n\t\tmeta: {\n\t\t\textension,\n\t\t\ttype\n\t\t}\n\t});\n\tif (descriptor.kind !== expectedKind) throw new CliStructuredError(\"CONFIG.DESCRIPTOR_KIND_MISMATCH\", `Extension \"${extension}\"'s descriptor for node type \"${type}\" is a \"${descriptor.kind}\" descriptor — ${what} needs a \"${expectedKind}\" descriptor.`, { meta: {\n\t\textension,\n\t\ttype,\n\t\tkind: descriptor.kind\n\t} });\n}\n/** Throws a structured CONFIG.* error on the first uncovered `(extension, type)`; silent when the config covers the whole graph. */\nfunction validateRegistryCoverage(graph, config) {\n\tconst extensions = new Map(config.extensions.map((descriptor) => [descriptor.id, descriptor]));\n\tfor (const { id, node } of graph.nodes) {\n\t\tif (node.kind === \"resource\") {\n\t\t\tlookup(extensions, node.extension, node.type, \"resource\", `resource node \"${id}\"`);\n\t\t\tcontinue;\n\t\t}\n\t\tif (node.kind !== \"service\") continue;\n\t\tlookup(extensions, node.extension, node.type, \"service\", `service node \"${id}\"`);\n\t\tlookup(extensions, node.build.extension, node.build.type, \"build\", `service node \"${id}\"'s build descriptor`);\n\t}\n}\n//#endregion\n//#region src/pipeline.ts\n/**\n* The shared prefix of `deploy`/`destroy`/`dev` (deploy-cli.md § The\n* pipeline; local-dev spec § 6): entry load, Load,\n* registry coverage validation, name resolution, assemble. Deploy and dev\n* diverge after this — deploy resolves containers/preflight/stack file\n* against the hosted providers, dev against the local ones — so everything\n* up to and including assemble lives here once, consumed verbatim by both\n* `run()` (main.ts) and `runDev()` (dev/run-dev.ts), so the two pipelines\n* cannot drift.\n*/\nconst NO_SECRETS = Object.freeze({});\nfunction configError(findings, file) {\n\tconst [first] = findings;\n\treturn new CliStructuredError(first.code, first.summary, {\n\t\t...first.why === void 0 ? {} : { why: first.why },\n\t\tfix: first.fix,\n\t\twhere: { path: first.where ?? file },\n\t\tmeta: {\n\t\t\t...first.field === void 0 ? {} : { field: first.field },\n\t\t\tfindings\n\t\t}\n\t});\n}\n/**\n* Refuses a caller's config with the same findings, in the same order, as the CLI's section validator.\n* The error is the first finding and carries all of them in `meta.findings`. Returns the config with `file` resolved against `cwd`.\n*/\nfunction checkConfigSource(source, cwd) {\n\tconst file = path.resolve(cwd, source.file);\n\tif (!fs.existsSync(file)) throw configError([configFileMissing(file)], file);\n\tconst checked = checkComposerConfig(source.value, file);\n\tif (!checked.ok) throw configError(checked.findings, file);\n\treturn {\n\t\tvalue: checked.value,\n\t\tfile\n\t};\n}\n/**\n* Resolves the entry module. An override (`--entry`, or an operation's `entry` input) resolves\n* against `cwd`; the section's `entry` resolves against the directory of the file that declares it,\n* as the CLI engine resolves path fields in prisma.config.ts.\n*/\nfunction resolveEntryPath(override, source, cwd) {\n\tif (override !== void 0) return {\n\t\tpath: path.resolve(cwd, override),\n\t\tfix: `Check the \\`--entry\\` path (the \\`entry\\` input when calling @prisma/composer/control) \"${override}\". It is relative to the current directory, ${cwd}.`\n\t};\n\tconst configured = source.value.entry;\n\tif (configured === void 0) throw configError([entryMissing], source.file);\n\treturn {\n\t\tpath: path.resolve(path.dirname(source.file), configured),\n\t\tfix: `Check \\`entry: \"${configured}\"\\` in ${source.file}. It is relative to that file's directory.`\n\t};\n}\n/**\n* The pipeline's front — entry load and name resolution —\n* WITHOUT Load, coverage, or assemble. `log` needs only who the app is (its\n* config and resolved name) to reach the already-running local instance; it\n* neither builds nor provisions, so it must not require the user's built\n* output the way the full pipeline does.\n*/\nasync function resolveAppIdentity(entry, overrideName, cwd, config) {\n\tconst checked = checkConfigSource(config, cwd);\n\tconst { value } = checked;\n\tconst resolved = resolveEntryPath(entry, checked, cwd);\n\tconst entryModule = await loadEntry(resolved.path, cwd, resolved.fix);\n\tconst name = overrideName ?? entryModule.root.name;\n\tif (name.length === 0) throw new CliStructuredError(\"COMPOSE.NAME_MISSING\", \"The root node has no name.\", { fix: \"Name it at authoring, or pass --name.\" });\n\tassertAppName(name);\n\treturn {\n\t\tconfig: value,\n\t\tname\n\t};\n}\n/**\n* Runs entry load, name resolution, Load, registry coverage, and assemble — steps 1–5 of `run()`. `onAssembleError`, when\n* given, lets a caller decorate an assemble failure with command-specific\n* guidance (destroy's \"build first\" hint) without this shared step knowing\n* about any one command.\n*/\nasync function runPipeline(entry, overrideName, environment, cwd, source, deps = {}, onAssembleError) {\n\tconst configSource = checkConfigSource(source, cwd);\n\tconst config = configSource.value;\n\tconst resolved = resolveEntryPath(entry, configSource, cwd);\n\tconst entryModule = await loadEntry(resolved.path, cwd, resolved.fix);\n\tconst name = overrideName ?? entryModule.root.name;\n\tif (name.length === 0) throw new CliStructuredError(\"COMPOSE.NAME_MISSING\", \"The root node has no name.\", { fix: \"Name it at authoring, or pass --name.\" });\n\tconst redaction = deps.redaction ?? new SecretRedaction(process.env);\n\tconst adapterInput = {\n\t\tenvironment,\n\t\tconfigFile: configSource.file\n\t};\n\tconst secrets = deps.readSecrets === true ? await readAppSecrets(config, adapterInput) : NO_SECRETS;\n\tconst configuration = await readAppConfiguration(config, adapterInput);\n\tredaction.addCredentialLookingValues(credentialLookingValues(configuration));\n\tconst graph = Load(entryModule.root, {\n\t\tid: name,\n\t\tenvironment: { name: environment },\n\t\tconfiguration\n\t});\n\tif (graph.root.node.kind !== \"module\") throw new CliStructuredError(\"COMPOSE.ROOT_NOT_MODULE\", \"The deploy root must be a module.\", { fix: \"Wrap your service, e.g. export default module('name', ({ provision }) => { provision(service); }).\" });\n\tredaction.addKnownSecrets(valuesUnderSecretsKeys(configuration, secrets, secretsKeys(graph)));\n\tvalidateRegistryCoverage(graph, config);\n\tdeps.onEvent?.({ kind: \"loaded\" });\n\tlet assembled;\n\ttry {\n\t\tassembled = await assembleServices(graph, config, cwd, deps.runAssembler, deps.onEvent, { devServers: deps.devServers === true });\n\t} catch (error) {\n\t\tif (onAssembleError !== void 0 && error instanceof Error) throw onAssembleError(error);\n\t\tthrow error;\n\t}\n\treturn {\n\t\tconfigSource,\n\t\tentryModule,\n\t\tgraph,\n\t\tname,\n\t\tassembled,\n\t\tconfiguration,\n\t\tsecrets\n\t};\n}\n//#endregion\n//#region src/validate-environment.ts\n/** Letters, digits, `-` and `_`, starting with a letter or digit: always a valid git ref, so no `git` is needed to check it. */\nconst PLAIN_ENVIRONMENT_NAME = /^[A-Za-z0-9][A-Za-z0-9_-]*$/;\n/** An environment name must be a valid git ref (deploy-cli.md) — checked via `git check-ref-format`, never silently normalized. Runs before anything platform-specific. */\nfunction validateEnvironmentName(environment, spawn = spawnSync) {\n\tif (PLAIN_ENVIRONMENT_NAME.test(environment)) return;\n\tconst result = spawn(\"git\", [\"check-ref-format\", `refs/heads/${environment}`], { stdio: \"ignore\" });\n\tif (result.error) throw new CliStructuredError(\"DEPLOY.ENVIRONMENT_UNVALIDATABLE\", `git is required to validate --environment \"${environment}\" (git check-ref-format): ${result.error.message}.`, { cause: result.error });\n\tif (result.status !== 0) throw new CliStructuredError(\"DEPLOY.ENVIRONMENT_INVALID\", `Invalid --environment \"${environment}\": must be a valid git ref name (git check-ref-format rejected \"refs/heads/${environment}\").`);\n}\n//#endregion\nexport { runPipeline as i, checkConfigSource as n, resolveAppIdentity as r, validateEnvironmentName as t };\n\n//# sourceMappingURL=validate-environment-D_dECxgO.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;AAOA,MAAM,cAAc;AACpB,MAAM,sBAAsB,GAAG,YAAY;AAC3C,MAAM,6BAA6B;AACnC,MAAM,iBAAiB;AACvB,MAAM,qBAA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Q,WAAW;CAChE,IAAI,uBAAuB,KAAK,WAAW,GAAG;CAC9C,MAAM,SAAS,MAAM,OAAO,CAAC,oBAAoB,cAAc,aAAa,GAAG,EAAE,OAAO,SAAS,CAAC;CAClG,IAAI,OAAO,OAAO,MAAM,IAAI,mBAAmB,oCAAoC,8CAA8C,YAAY,4BAA4B,OAAO,MAAM,QAAQ,IAAI,EAAE,OAAO,OAAO,MAAM,CAAC;CACzN,IAAI,OAAO,WAAW,GAAG,MAAM,IAAI,mBAAmB,8BAA8B,0BAA0B,YAAY,6EAA6E,YAAY,IAAI;AACxN"}
|
package/dist/zod.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { t as blindCast } from "./casts-DpaahrlC-C5XMnP9S.mjs";
|
|
2
|
-
import { a as
|
|
3
|
-
import { t as describeKind } from "./describe-kind-Cpm_euxo-JFh8ejof.mjs";
|
|
2
|
+
import { a as isPlainPointer, o as isSecretPointer, r as isSecretString, t as describeKind } from "./describe-kind-Cpm_euxo-CkhlGJUL.mjs";
|
|
4
3
|
import { z } from "zod";
|
|
5
4
|
//#region ../../0-framework/0-foundation/foundation/dist/zod.mjs
|
|
6
5
|
/**
|
package/dist/zod.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod.mjs","names":[],"sources":["../../../0-framework/0-foundation/foundation/dist/zod.mjs"],"sourcesContent":["import { t as blindCast } from \"./casts-DpaahrlC.mjs\";\nimport { t as describeKind } from \"./describe-kind-Cpm_euxo.mjs\";\nimport { n as isSecretString } from \"./secret-DoWGmN7m.mjs\";\nimport { n as isPlainPointer, r as isSecretPointer } from \"./pointer-Cw3E-nrh.mjs\";\nimport { z } from \"zod\";\n//#region src/zod.ts\n/**\n* Zod spellings of the framework's schema leaves. Opt-in: the framework\n* accepts any Standard Schema library (ADR-0042) and nothing outside this\n* module imports zod, so an app that uses ArkType never loads it.\n*/\n/**\n* A schema leaf that accepts only a redacting `SecretString` box or a secret\n* pointer, so `input().<field>.expose()` type-checks and binding a plain\n* literal there fails the deploy (ADR-0042). Its error names the refused\n* value's kind, never the value.\n*\n* ```ts\n* input: z.object({ signingKey: secretString() })\n* ```\n*/\nconst secretString = () => z.custom((value) => isSecretString(value) || isSecretPointer(value), { error: (issue) => `must be a SecretString box — bind this field to a secret (was ${isPlainPointer(issue.input) ? \"a value known only at boot that is not a secret\" : describeKind(issue.input)})` });\n/**\n* Wraps the schema of one leaf field so the field also accepts a plain\n* pointer, which stands for a value known only at boot. The field's input type\n* is `In | Pointer<In>` and its output type `Out | Pointer<In>`, where `In` and\n* `Out` are `inner`'s. A value that is not a pointer gets `inner`'s error.\n* Wrap a leaf, never an object schema.\n*\n* ```ts\n* input: z.object({ from: field(z.string()), port: field(z.string().transform(Number)) })\n* ```\n*/\nfunction field(inner) {\n\tconst pointer = z.custom((value) => isPlainPointer(value));\n\treturn blindCast(z.union([inner, pointer], { error: (issue) => issue.code === \"invalid_union\" ? issue.errors[0]?.[0]?.message : void 0 }));\n}\n//#endregion\nexport { field, secretString };\n\n//# sourceMappingURL=zod.mjs.map"],"mappings":"
|
|
1
|
+
{"version":3,"file":"zod.mjs","names":[],"sources":["../../../0-framework/0-foundation/foundation/dist/zod.mjs"],"sourcesContent":["import { t as blindCast } from \"./casts-DpaahrlC.mjs\";\nimport { t as describeKind } from \"./describe-kind-Cpm_euxo.mjs\";\nimport { n as isSecretString } from \"./secret-DoWGmN7m.mjs\";\nimport { n as isPlainPointer, r as isSecretPointer } from \"./pointer-Cw3E-nrh.mjs\";\nimport { z } from \"zod\";\n//#region src/zod.ts\n/**\n* Zod spellings of the framework's schema leaves. Opt-in: the framework\n* accepts any Standard Schema library (ADR-0042) and nothing outside this\n* module imports zod, so an app that uses ArkType never loads it.\n*/\n/**\n* A schema leaf that accepts only a redacting `SecretString` box or a secret\n* pointer, so `input().<field>.expose()` type-checks and binding a plain\n* literal there fails the deploy (ADR-0042). Its error names the refused\n* value's kind, never the value.\n*\n* ```ts\n* input: z.object({ signingKey: secretString() })\n* ```\n*/\nconst secretString = () => z.custom((value) => isSecretString(value) || isSecretPointer(value), { error: (issue) => `must be a SecretString box — bind this field to a secret (was ${isPlainPointer(issue.input) ? \"a value known only at boot that is not a secret\" : describeKind(issue.input)})` });\n/**\n* Wraps the schema of one leaf field so the field also accepts a plain\n* pointer, which stands for a value known only at boot. The field's input type\n* is `In | Pointer<In>` and its output type `Out | Pointer<In>`, where `In` and\n* `Out` are `inner`'s. A value that is not a pointer gets `inner`'s error.\n* Wrap a leaf, never an object schema.\n*\n* ```ts\n* input: z.object({ from: field(z.string()), port: field(z.string().transform(Number)) })\n* ```\n*/\nfunction field(inner) {\n\tconst pointer = z.custom((value) => isPlainPointer(value));\n\treturn blindCast(z.union([inner, pointer], { error: (issue) => issue.code === \"invalid_union\" ? issue.errors[0]?.[0]?.message : void 0 }));\n}\n//#endregion\nexport { field, secretString };\n\n//# sourceMappingURL=zod.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;AAqBA,MAAM,qBAAqB,EAAE,QAAQ,UAAU,eAAe,KAAK,KAAK,gBAAgB,KAAK,GAAG,EAAE,QAAQ,UAAU,iEAAiE,eAAe,MAAM,KAAK,IAAI,oDAAoD,aAAa,MAAM,KAAK,EAAE,GAAG,CAAC;;;;;;;;;;;;AAYrS,SAAS,MAAM,OAAO;CACrB,MAAM,UAAU,EAAE,QAAQ,UAAU,eAAe,KAAK,CAAC;CACzD,OAAO,UAAU,EAAE,MAAM,CAAC,OAAO,OAAO,GAAG,EAAE,QAAQ,UAAU,MAAM,SAAS,kBAAkB,MAAM,OAAO,EAAE,GAAG,EAAE,EAAE,UAAU,KAAK,EAAE,CAAC,CAAC;AAC1I"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/composer",
|
|
3
|
-
"version": "0.36.0-dev.
|
|
3
|
+
"version": "0.36.0-dev.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Prisma Composer — build a Prisma App by composing Modules. Core authoring, deploy pipeline, and the service-rpc/http/node/nextjs authoring surfaces. The command family the `prisma` CLI mounts lives in @prisma/composer-cli.",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": "./dist/index.mjs",
|
|
8
8
|
"./config": "./dist/config.mjs",
|
|
9
|
-
"./internal/
|
|
9
|
+
"./internal/app-configuration-file": "./dist/internal-app-configuration-file.mjs",
|
|
10
10
|
"./control": "./dist/control.mjs",
|
|
11
11
|
"./deploy": "./dist/deploy.mjs",
|
|
12
12
|
"./local-target": "./dist/local-target.mjs",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@standard-schema/spec": "^1.1.0",
|
|
34
34
|
"alchemy": "2.0.0-beta.84",
|
|
35
35
|
"cross-spawn": "^7.0.6",
|
|
36
|
-
"dotenv": "
|
|
36
|
+
"dotenv-flow": "4.1.0",
|
|
37
37
|
"effect": "4.0.5",
|
|
38
38
|
"esbuild": "^0.28.1",
|
|
39
39
|
"@prisma/management-api-sdk": "^1.80.0"
|
|
@@ -51,16 +51,16 @@
|
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@internal/assemble": "0.36.0-dev.
|
|
55
|
-
"@internal/cli": "0.36.0-dev.
|
|
56
|
-
"@internal/core": "0.36.0-dev.
|
|
57
|
-
"@internal/foundation": "0.36.0-dev.
|
|
58
|
-
"@internal/http": "0.36.0-dev.
|
|
59
|
-
"@internal/lowering": "0.36.0-dev.
|
|
60
|
-
"@internal/nextjs": "0.36.0-dev.
|
|
61
|
-
"@internal/node": "0.36.0-dev.
|
|
62
|
-
"@internal/service-rpc": "0.36.0-dev.
|
|
63
|
-
"@internal/tsdown-config": "0.36.0-dev.
|
|
54
|
+
"@internal/assemble": "0.36.0-dev.8",
|
|
55
|
+
"@internal/cli": "0.36.0-dev.8",
|
|
56
|
+
"@internal/core": "0.36.0-dev.8",
|
|
57
|
+
"@internal/foundation": "0.36.0-dev.8",
|
|
58
|
+
"@internal/http": "0.36.0-dev.8",
|
|
59
|
+
"@internal/lowering": "0.36.0-dev.8",
|
|
60
|
+
"@internal/nextjs": "0.36.0-dev.8",
|
|
61
|
+
"@internal/node": "0.36.0-dev.8",
|
|
62
|
+
"@internal/service-rpc": "0.36.0-dev.8",
|
|
63
|
+
"@internal/tsdown-config": "0.36.0-dev.8",
|
|
64
64
|
"@types/node": "^26.0.1",
|
|
65
65
|
"tsdown": "^0.22.7",
|
|
66
66
|
"typescript": "^6.0.3",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: prisma-composer-core-concepts
|
|
3
3
|
metadata:
|
|
4
4
|
library: "@prisma/composer"
|
|
5
|
-
library_version: "0.36.0-dev.
|
|
5
|
+
library_version: "0.36.0-dev.8"
|
|
6
6
|
version: 2026.9.1
|
|
7
7
|
description: >-
|
|
8
8
|
Use when deploying or managing an app that uses Prisma Composer
|
|
@@ -143,7 +143,7 @@ platform variable and never carries the value.
|
|
|
143
143
|
Rules that bite:
|
|
144
144
|
|
|
145
145
|
1. **Secretness is checked by the binding's type and by the deploy.** A `provision()` binding, a service's or a module's, is typed from the schema: a literal or a `SecretBox` where the schema expects `SecretString`, or `envSecret` in a text field, fails to compile, and the deploy refuses it where the schema has no types. An ArkType schema with a `SecretString` field cannot also transform its input: a morph anywhere in it (`'string.trim'`, `.pipe()`, `field(type('string.integer.parse'))`) or `'+': 'delete'` copies the input, the copied secret loses its value, and the deploy refuses it. Transform in the service code instead; a Zod schema keeps the box.
|
|
146
|
-
2. **`envParam` values arrive as raw strings**; bind them to string fields. A field of a narrower type, such as `email()`'s `deliveryMode`, refuses `envParam` at compile time; declare that field in the root's `input` instead, for `email()` from the exported `emailDeliveryModes`. In a service's `input`, the deploy reads the variable from the
|
|
146
|
+
2. **`envParam` values arrive as raw strings**; bind them to string fields. A field of a narrower type, such as `email()`'s `deliveryMode`, refuses `envParam` at compile time; declare that field in the root's `input` instead, for `email()` from the exported `emailDeliveryModes`. In a service's `input`, the deploy reads the variable from the app configuration on every deploy and writes its value into the input document. As a service param, the deploy writes a pointer row to a platform variable, which the service reads at boot. `envSecret` always lives on the platform: each environment keeps its own copy, and the app secrets only seed a missing name (the deploy fails early, naming the variable, when both lack it).
|
|
147
147
|
3. **Absence is the schema's call.** An env-bound field whose variable is
|
|
148
148
|
unset or empty resolves to *key omitted*, which is legal only if the
|
|
149
149
|
schema allows it (optional field, union arm). The deploy report prints the
|
|
@@ -165,9 +165,9 @@ Rules that bite:
|
|
|
165
165
|
|
|
166
166
|
The graph is the same in every environment; only configuration may differ.
|
|
167
167
|
|
|
168
|
-
- A module declares `input` (one Standard Schema) as a service does; `provision(module, { input })` binds it, and the body receives `input`, a dictionary of values: it passes each field on by name into a binding or, for a plain field, lists it in `resolve()`. Passing the whole `input` on fails to compile, and the deploy refuses it. A root's `input` is the
|
|
168
|
+
- A module declares `input` (one Standard Schema) as a service does; `provision(module, { input })` binds it, and the body receives `input`, a dictionary of values: it passes each field on by name into a binding or, for a plain field, lists it in `resolve()`. Passing the whole `input` on fails to compile, and the deploy refuses it. A root's `input` is the app configuration, and a module's `input` takes every source a service's does.
|
|
169
169
|
- `field(inner)` from `@prisma/composer/arktype` or `@prisma/composer/zod` wraps one leaf field's schema (`field(type('string'))`, `field(z.string())`) so it also accepts a plain pointer, which is what a value known only at boot such as `serviceOrigin()` is at deploy. In the body the field is `Value<string | Pointer<string>>`: pass it into another wrapped field or a service's input, never a plain `string` field (compile error). Wrap leaves, not object schemas; an ArkType default goes outside: `field(type('string')).default('x')`. Other schema libraries: `Pointer`, `isPlainPointer()` and `isSecretPointer()` from `@prisma/composer`. Wrap every leaf of a reusable module's schema other than a `secretString()` field, unless a `resolve()` lists it; keep a root's fields plain. `field(secretString())` is wrong: it accepts a plain pointer into a secret field, and the service fails at boot.
|
|
170
|
-
- `composer({ config: [...], secrets: [...] })` lists config adapters; each gets the environment's name and returns values, later wins by top-level key. Both default to `[environmentVariables()]` (the shell); a list you write replaces the default. `dotenv()` reads `.env`, `.env.local`, `.env.<environment>`, `.env.<environment>.local`, later wins. The
|
|
170
|
+
- `composer({ config: [...], secrets: [...] })` lists config adapters; each gets the environment's name and returns values, later wins by top-level key. Both default to `[environmentVariables()]` (the shell); a list you write replaces the default. `dotenv()` reads `.env`, `.env.local`, `.env.<environment>`, `.env.<environment>.local`, later wins. The app configuration is the root's input and what `envParam()` reads; pass the root's input fields on by name, as every module does; its whole `input` would be the whole app configuration, by default every shell variable. The app secrets only seed `envSecret()` platform variables and `prisma dev`'s secrets, never the root's input. Both import from `@prisma/composer/config`. Credentials (`PRISMA_SERVICE_TOKEN`) still come from the shell. `dotenv()` reads `.env`, `.env.local`, `.env.<environment>`, `.env.<environment>.local` through `dotenv-flow` (no `.env.local` for `test`); remove `import 'dotenv/config'` when you list it. Composer redacts the values under the names an `envSecret()` reads, in either list; the lists' other values are not secrets and print as they are, apart from values that look like credentials. Under the CLI the deploy engine's own output is not redacted yet.
|
|
171
171
|
- A field exists only under a plain object: a path into a string, an array or a secret, such as `input.tags[0]`, fails the deploy naming the path.
|
|
172
172
|
- A truthiness check such as `if (input.enabled)` is not caught: the field is an object, so the branch always runs, in every environment. A module's structure cannot depend on its input; to provision something only sometimes, let the parent decide whether to provision it.
|
|
173
173
|
- The module body receives `environment`; `environment.name` is a value standing for the name `--environment` gave (`production` for `prisma deploy`, `dev` for `prisma dev` by default).
|
|
@@ -234,7 +234,8 @@ module's `api` port is a raw HTTP port: wire it with `rawHttp()`.
|
|
|
234
234
|
|
|
235
235
|
**Public URLs.** A service is reachable from the internet only through a
|
|
236
236
|
public URL the app declares:
|
|
237
|
-
`provision(publicUrl({
|
|
237
|
+
`provision(publicUrl({ id: 'site', url, target: web.http }))`, where `id`
|
|
238
|
+
sets the address (`shop.site`) and changing it replaces the URL, and where
|
|
238
239
|
`web` exposes `http: rawHttpContract` (an RPC interface as `target` fails
|
|
239
240
|
`tsc`; a module's forwarded HTTP interface lands on the service inside it).
|
|
240
241
|
`url` is required and is one of two strategies: `publicUrl.prismaBuild()`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@internal/cli/app-configuration-file';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"app-config-RX-7kHbF-BroG2yMY.d.mts","names":[],"sources":["../../../0-framework/1-core/core/dist/app-config-RX-7kHbF.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;UAmBU;;WAEC;;WAEA;;;;;;;UAOD;WACC,OAAO;;WAEP;;EAET;;;;;;;;;;;;;;;UAeQ,qBAAqB;;WAEpB;;WAEA,SAAS;;;;;;;;;;;;UAYV,oBAAoB,UAAU,oBAAoB,mBAAmB;;EAE7E,OAAO,OAAO,sBAAsB,cAAc,qBAAqB,KAAK,QAAQ;;EAEpF,OAAO,OAAO,sBAAsB,cAAc,qBAAqB,KAAK,QAAQ;;EAEpF,OAAO,UAAU,GAAG,cAAc,qBAAqB,KAAK;;EAE5D,YAAY,qBAAqB;;;iBAGlB,oBAAoB;;iBAEpB,aAAa,WAAW,oBAAoB,qBAAqB;;UAExE;WACC;WACA,YAAY;;;;;;iBAMN,sBAAsB,qBAAqB,+BAA+B,KAAK,SAAS,sCAAsC,oBAAoB;;;;KAI9J;;iBAEY,oBAAoB;;iBAEpB,aAAa,UAAU,8BAA8B;;iBAErD,qBAAqB,qBAAqB,KAAK,SAAS,sCAAsC;;;;KAI1G,oBAAoB,MAAM,MAAM,cAAc;;;;;;UAMzC;EACR,UAAU,KAAK,eAAe,OAAO;;;;;;;;UAQ7B;;WAEC;WACA;WACA;WACA;WACA;;WAEA,MAAM;;;UAGP;;EAER,UAAU,MAAM,gBAAgB,OAAO;;;;;;;;;;;;;;UAc/B,gBAAgB,aAAa;;;;;EAKrC,UAAU,KAAK,eAAe,OAAO,OAAO;;;;;;EAM5C,UAAU,KAAK,cAAc,aAAa,GAAG,QAAQ,SAAS,OAAO,OAAO;;;;;;EAM5E,QAAQ,KAAK,cAAc,OAAO,eAAe,OA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SAAS,OAAO,0BAA0B,QAAQ;;UAE1C;;WAEC;WACA;WACA;;;UAGD;WACC;;WAEA;;EAET,OAAO,kBAAkB,QAAQ;;EAEjC,QAAQ,iBAAiB;;;KAGtB;WACM;WACA;WACA;;WAEA;;WAEA;WACA,WAAW;;WAEX;;WAEA;;WAEA;WACA;;WAEA;;;;;;;;KAQN;UACK;WACC;WACA;;UAED;;WAEC,WAAW;;WAEX;;WAEA,OAAO;;UAER;;WAEC,OAAO;WACP,WAAW;;WAEX;;UAED;WACC,WAAW;;WAEX;;UAED;;EAER,iBAAiB;;EAEjB,aAAa;aACF;aACA;;;EAGX,KAAK,QAAQ,aAAa;aACf;aACA;MACP;aACO;aACA;;;;;;;;EAQX,OAAO;aACI;aACA,MAAM;aACN,QAAQ;;aAER,OAAO;MACd;aACO;;;EAGX,WAAW;;;cAGC;;;;;;iBAMG,kBAAkB;;;;;;cAMrB;;;;;;;;;iBASG,qBAAqB,WAAW;;;;;;KAM5C;WACM;IACP;WACO;IACP;WACO;EACT,SAAS,OAAO,gBAAgB,QAAQ;;;;;EAKxC,OAAO,OAAO,aAAa,QAAQ;;;UAG3B;;WAEC;;WAEA;;;KAGN,eAAe,SAAS;;;;;;;KAOxB,iBAAiB,OAAO,uBAAuB,eAAe,QAAQ;;KAEtE,aAAa,SAAS;;KAEtB,cAAc,SAAS;;UAElB;WACC,QAAQ;WACR,SAAS;;;;;;;;UAQV;;WAEC;WACA,YAAY;WACZ,OAAO;;WAEP,kBAAkB;;WAElB,mBAAmB;;;iBAGb,aAAa,QAAQ,kBAAkB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import "./app-config-RX-7kHbF-BroG2yMY.mjs";
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import * as fs$1 from "node:fs";
|
|
2
|
-
import * as path$1 from "node:path";
|
|
3
|
-
import { parse } from "dotenv";
|
|
4
|
-
//#region ../../0-framework/3-tooling/cli/dist/config-adapters-BA_IeiX0.mjs
|
|
5
|
-
/** The prefix of the variables Composer sets for itself, such as the ones it passes its own child processes. */
|
|
6
|
-
const COMPOSER_PREFIX = "PRISMA_COMPOSER_";
|
|
7
|
-
/**
|
|
8
|
-
* Set on a child Composer starts. It maps each variable without Composer's prefix
|
|
9
|
-
* that Composer set or changed for the child to the parent's own value, or to null
|
|
10
|
-
* where the parent had none, so the child's environmentVariables() returns what the
|
|
11
|
-
* parent's did.
|
|
12
|
-
*/
|
|
13
|
-
const PARENT_VALUES_ENV = `${COMPOSER_PREFIX}PARENT_VALUES`;
|
|
14
|
-
/**
|
|
15
|
-
* Reads the process environment when called: every variable whose value is a string,
|
|
16
|
-
* except Composer's own `PRISMA_COMPOSER_` variables. The default for both `config` and `secrets`.
|
|
17
|
-
*/
|
|
18
|
-
function environmentVariables() {
|
|
19
|
-
return () => {
|
|
20
|
-
const values = {};
|
|
21
|
-
for (const [name, value] of Object.entries(process.env)) if (typeof value === "string" && !name.startsWith(COMPOSER_PREFIX)) values[name] = value;
|
|
22
|
-
for (const [name, parentValue] of parentValues()) if (parentValue === null) delete values[name];
|
|
23
|
-
else values[name] = parentValue;
|
|
24
|
-
return values;
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
function parentValues() {
|
|
28
|
-
const text = process.env[PARENT_VALUES_ENV];
|
|
29
|
-
if (text === void 0) return [];
|
|
30
|
-
const parsed = JSON.parse(text);
|
|
31
|
-
if (typeof parsed !== "object" || parsed === null) return [];
|
|
32
|
-
return Object.entries(parsed).filter((entry) => entry[1] === null || typeof entry[1] === "string");
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* The variables Composer adds to a child's environment, plus the record of the parent's
|
|
36
|
-
* own value for each one it sets or changes outside its prefix.
|
|
37
|
-
*/
|
|
38
|
-
function childEnvironment(additions, parent = process.env) {
|
|
39
|
-
const changed = {};
|
|
40
|
-
for (const [name, value] of Object.entries(additions)) {
|
|
41
|
-
if (name.startsWith(COMPOSER_PREFIX) || value === void 0 || parent[name] === value) continue;
|
|
42
|
-
changed[name] = parent[name] ?? null;
|
|
43
|
-
}
|
|
44
|
-
return Object.keys(changed).length === 0 ? { ...additions } : {
|
|
45
|
-
...additions,
|
|
46
|
-
[PARENT_VALUES_ENV]: JSON.stringify(changed)
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
function readEnvFile(file) {
|
|
50
|
-
let text;
|
|
51
|
-
try {
|
|
52
|
-
text = fs$1.readFileSync(file, "utf8");
|
|
53
|
-
} catch (error) {
|
|
54
|
-
if (isMissingFile(error)) return {};
|
|
55
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
56
|
-
throw new Error(`dotenv() could not read ${file}: ${message}`, { cause: error });
|
|
57
|
-
}
|
|
58
|
-
return parse(text);
|
|
59
|
-
}
|
|
60
|
-
function isMissingFile(error) {
|
|
61
|
-
return error instanceof Error && "code" in error && error.code === "ENOENT";
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Reads `.env`, `.env.local`, `.env.<environment>` and `.env.<environment>.local` from the
|
|
65
|
-
* directory of prisma.config.ts, a later file winning. A missing file is skipped. It does
|
|
66
|
-
* not read the process environment.
|
|
67
|
-
*/
|
|
68
|
-
function dotenv() {
|
|
69
|
-
return ({ environment, configDirectory }) => {
|
|
70
|
-
const encoded = encodeURIComponent(environment);
|
|
71
|
-
const values = {};
|
|
72
|
-
for (const name of [
|
|
73
|
-
".env",
|
|
74
|
-
".env.local",
|
|
75
|
-
`.env.${encoded}`,
|
|
76
|
-
`.env.${encoded}.local`
|
|
77
|
-
]) Object.assign(values, readEnvFile(path$1.join(configDirectory, name)));
|
|
78
|
-
return values;
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
//#endregion
|
|
82
|
-
export { dotenv as n, environmentVariables as r, childEnvironment as t };
|
|
83
|
-
|
|
84
|
-
//# sourceMappingURL=config-adapters-BA_IeiX0-BiE51GeB.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config-adapters-BA_IeiX0-BiE51GeB.mjs","names":["fs","path"],"sources":["../../../0-framework/3-tooling/cli/dist/config-adapters-BA_IeiX0.mjs"],"sourcesContent":["import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { parse } from \"dotenv\";\n//#region src/config-adapters.ts\n/** The prefix of the variables Composer sets for itself, such as the ones it passes its own child processes. */\nconst COMPOSER_PREFIX = \"PRISMA_COMPOSER_\";\n/**\n* Set on a child Composer starts. It maps each variable without Composer's prefix\n* that Composer set or changed for the child to the parent's own value, or to null\n* where the parent had none, so the child's environmentVariables() returns what the\n* parent's did.\n*/\nconst PARENT_VALUES_ENV = `${COMPOSER_PREFIX}PARENT_VALUES`;\n/**\n* Reads the process environment when called: every variable whose value is a string,\n* except Composer's own `PRISMA_COMPOSER_` variables. The default for both `config` and `secrets`.\n*/\nfunction environmentVariables() {\n\treturn () => {\n\t\tconst values = {};\n\t\tfor (const [name, value] of Object.entries(process.env)) if (typeof value === \"string\" && !name.startsWith(COMPOSER_PREFIX)) values[name] = value;\n\t\tfor (const [name, parentValue] of parentValues()) if (parentValue === null) delete values[name];\n\t\telse values[name] = parentValue;\n\t\treturn values;\n\t};\n}\nfunction parentValues() {\n\tconst text = process.env[PARENT_VALUES_ENV];\n\tif (text === void 0) return [];\n\tconst parsed = JSON.parse(text);\n\tif (typeof parsed !== \"object\" || parsed === null) return [];\n\treturn Object.entries(parsed).filter((entry) => entry[1] === null || typeof entry[1] === \"string\");\n}\n/**\n* The variables Composer adds to a child's environment, plus the record of the parent's\n* own value for each one it sets or changes outside its prefix.\n*/\nfunction childEnvironment(additions, parent = process.env) {\n\tconst changed = {};\n\tfor (const [name, value] of Object.entries(additions)) {\n\t\tif (name.startsWith(COMPOSER_PREFIX) || value === void 0 || parent[name] === value) continue;\n\t\tchanged[name] = parent[name] ?? null;\n\t}\n\treturn Object.keys(changed).length === 0 ? { ...additions } : {\n\t\t...additions,\n\t\t[PARENT_VALUES_ENV]: JSON.stringify(changed)\n\t};\n}\nfunction readEnvFile(file) {\n\tlet text;\n\ttry {\n\t\ttext = fs.readFileSync(file, \"utf8\");\n\t} catch (error) {\n\t\tif (isMissingFile(error)) return {};\n\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\tthrow new Error(`dotenv() could not read ${file}: ${message}`, { cause: error });\n\t}\n\treturn parse(text);\n}\nfunction isMissingFile(error) {\n\treturn error instanceof Error && \"code\" in error && error.code === \"ENOENT\";\n}\n/**\n* Reads `.env`, `.env.local`, `.env.<environment>` and `.env.<environment>.local` from the\n* directory of prisma.config.ts, a later file winning. A missing file is skipped. It does\n* not read the process environment.\n*/\nfunction dotenv() {\n\treturn ({ environment, configDirectory }) => {\n\t\tconst encoded = encodeURIComponent(environment);\n\t\tconst values = {};\n\t\tfor (const name of [\n\t\t\t\".env\",\n\t\t\t\".env.local\",\n\t\t\t`.env.${encoded}`,\n\t\t\t`.env.${encoded}.local`\n\t\t]) Object.assign(values, readEnvFile(path.join(configDirectory, name)));\n\t\treturn values;\n\t};\n}\n//#endregion\nexport { dotenv as n, environmentVariables as r, childEnvironment as t };\n\n//# sourceMappingURL=config-adapters-BA_IeiX0.mjs.map"],"mappings":";;;;;AAKA,MAAM,kBAAkB;;;;;;;AAOxB,MAAM,oBAAoB,GAAG,gBAAgB;;;;;AAK7C,SAAS,uBAAuB;CAC/B,aAAa;EACZ,MAAM,SAAS,CAAC;EAChB,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,QAAQ,GAAG,GAAG,IAAI,OAAO,UAAU,YAAY,CAAC,KAAK,WAAW,eAAe,GAAG,OAAO,QAAQ;EAC5I,KAAK,MAAM,CAAC,MAAM,gBAAgB,aAAa,GAAG,IAAI,gBAAgB,MAAM,OAAO,OAAO;OACrF,OAAO,QAAQ;EACpB,OAAO;CACR;AACD;AACA,SAAS,eAAe;CACvB,MAAM,OAAO,QAAQ,IAAI;CACzB,IAAI,SAAS,KAAK,GAAG,OAAO,CAAC;CAC7B,MAAM,SAAS,KAAK,MAAM,I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@ -1,63 +0,0 @@
|
|
|
1
|
-
import { t as describeKind } from "./describe-kind-Cpm_euxo-JFh8ejof.mjs";
|
|
2
|
-
import { t as InternalError } from "./internal-error-Dfur7Zqt-D96dWHZK.mjs";
|
|
3
|
-
import { t as CliStructuredError } from "./errors-0e8IVwzi.mjs";
|
|
4
|
-
import { r as environmentVariables } from "./config-adapters-BA_IeiX0-BiE51GeB.mjs";
|
|
5
|
-
import * as path$1 from "node:path";
|
|
6
|
-
//#region ../../0-framework/3-tooling/cli/dist/config-pools-DiYw7wMu.mjs
|
|
7
|
-
function adapterInvalid(list, index, input, summary, fix) {
|
|
8
|
-
return new CliStructuredError("CONFIG.ADAPTER_INVALID", summary, {
|
|
9
|
-
fix,
|
|
10
|
-
where: { path: input.configFile },
|
|
11
|
-
meta: { field: `${list}[${index}]` }
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
function isValues(value) {
|
|
15
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
16
|
-
}
|
|
17
|
-
function isText(pool) {
|
|
18
|
-
return Object.values(pool).every((value) => typeof value === "string");
|
|
19
|
-
}
|
|
20
|
-
async function readPool(list, adapters, input) {
|
|
21
|
-
const adapterInput = Object.freeze({
|
|
22
|
-
environment: input.environment,
|
|
23
|
-
configDirectory: path$1.dirname(input.configFile)
|
|
24
|
-
});
|
|
25
|
-
const pool = Object.create(null);
|
|
26
|
-
for (const [index, adapter] of adapters.entries()) {
|
|
27
|
-
const field = `composer.${list}[${index}]`;
|
|
28
|
-
let values;
|
|
29
|
-
try {
|
|
30
|
-
values = await adapter(adapterInput);
|
|
31
|
-
} catch (thrown) {
|
|
32
|
-
throw new CliStructuredError("CONFIG.ADAPTER_FAILED", `\`${field}\` failed to read the values for the environment "${input.environment}".`, {
|
|
33
|
-
why: `It threw: ${thrown instanceof Error ? thrown.message : String(thrown)}`,
|
|
34
|
-
fix: `Fix the adapter, or remove it from \`composer.${list}\` in prisma.config.ts.`,
|
|
35
|
-
where: { path: input.configFile },
|
|
36
|
-
meta: { field: `${list}[${index}]` },
|
|
37
|
-
cause: thrown
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
if (typeof values === "function") throw adapterInvalid(list, index, input, `\`${field}\` returned a function, not an object of values.`, "An adapter factory was put in the list instead of the adapter it makes: write `dotenv()`, not `dotenv`.");
|
|
41
|
-
if (!isValues(values)) throw adapterInvalid(list, index, input, `\`${field}\` returned ${describeKind(values)}, not an object of values.`, "Return an object whose keys are the names of the values, e.g. `{ EMAIL_FROM: 'shop@example.com' }`.");
|
|
42
|
-
for (const [key, value] of Object.entries(values)) {
|
|
43
|
-
if (value === void 0) continue;
|
|
44
|
-
if (list === "secrets" && typeof value !== "string") throw adapterInvalid(list, index, input, `\`${field}\` returned ${describeKind(value)} for "${key}", but a secret is text.`, "Return the secret as a string. A platform variable holds text.");
|
|
45
|
-
pool[key] = value;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return Object.freeze(pool);
|
|
49
|
-
}
|
|
50
|
-
/** Calls the section's `config` adapters (default `[environmentVariables()]`) and merges what they return: the config pool. */
|
|
51
|
-
function readConfigPool(section, input) {
|
|
52
|
-
return readPool("config", section.config ?? [environmentVariables()], input);
|
|
53
|
-
}
|
|
54
|
-
/** Calls the section's `secrets` adapters (default `[environmentVariables()]`) and merges what they return: the secrets pool. Every value must be text. */
|
|
55
|
-
async function readSecretsPool(section, input) {
|
|
56
|
-
const pool = await readPool("secrets", section.secrets ?? [environmentVariables()], input);
|
|
57
|
-
if (!isText(pool)) throw new InternalError("readPool admitted a secret that is not text");
|
|
58
|
-
return pool;
|
|
59
|
-
}
|
|
60
|
-
//#endregion
|
|
61
|
-
export { readSecretsPool as n, readConfigPool as t };
|
|
62
|
-
|
|
63
|
-
//# sourceMappingURL=config-pools-DiYw7wMu-DzeWrJdm.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config-pools-DiYw7wMu-DzeWrJdm.mjs","names":["path"],"sources":["../../../0-framework/3-tooling/cli/dist/config-pools-DiYw7wMu.mjs"],"sourcesContent":["import { r as environmentVariables } from \"./config-adapters-BA_IeiX0.mjs\";\nimport * as path from \"node:path\";\nimport { CliStructuredError, InternalError, describeKind } from \"@internal/foundation/errors\";\n//#region src/config-pools.ts\nfunction adapterInvalid(list, index, input, summary, fix) {\n\treturn new CliStructuredError(\"CONFIG.ADAPTER_INVALID\", summary, {\n\t\tfix,\n\t\twhere: { path: input.configFile },\n\t\tmeta: { field: `${list}[${index}]` }\n\t});\n}\nfunction isValues(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nfunction isText(pool) {\n\treturn Object.values(pool).every((value) => typeof value === \"string\");\n}\nasync function readPool(list, adapters, input) {\n\tconst adapterInput = Object.freeze({\n\t\tenvironment: input.environment,\n\t\tconfigDirectory: path.dirname(input.configFile)\n\t});\n\tconst pool = Object.create(null);\n\tfor (const [index, adapter] of adapters.entries()) {\n\t\tconst field = `composer.${list}[${index}]`;\n\t\tlet values;\n\t\ttry {\n\t\t\tvalues = await adapter(adapterInput);\n\t\t} catch (thrown) {\n\t\t\tthrow new CliStructuredError(\"CONFIG.ADAPTER_FAILED\", `\\`${field}\\` failed to read the values for the environment \"${input.environment}\".`, {\n\t\t\t\twhy: `It threw: ${thrown instanceof Error ? thrown.message : String(thrown)}`,\n\t\t\t\tfix: `Fix the adapter, or remove it from \\`composer.${list}\\` in prisma.config.ts.`,\n\t\t\t\twhere: { path: input.configFile },\n\t\t\t\tmeta: { field: `${list}[${index}]` },\n\t\t\t\tcause: thrown\n\t\t\t});\n\t\t}\n\t\tif (typeof values === \"function\") throw adapterInvalid(list, index, input, `\\`${field}\\` returned a function, not an object of values.`, \"An adapter factory was put in the list instead of the adapter it makes: write `dotenv()`, not `dotenv`.\");\n\t\tif (!isValues(values)) throw adapterInvalid(list, index, input, `\\`${field}\\` returned ${describeKind(values)}, not an object of values.`, \"Return an object whose keys are the names of the values, e.g. `{ EMAIL_FROM: 'shop@example.com' }`.\");\n\t\tfor (const [key, value] of Object.entries(values)) {\n\t\t\tif (value === void 0) continue;\n\t\t\tif (list === \"secrets\" && typeof value !== \"string\") throw adapterInvalid(list, index, input, `\\`${field}\\` returned ${describeKind(value)} for \"${key}\", but a secret is text.`, \"Return the secret as a string. A platform variable holds text.\");\n\t\t\tpool[key] = value;\n\t\t}\n\t}\n\treturn Object.freeze(pool);\n}\n/** Calls the section's `config` adapters (default `[environmentVariables()]`) and merges what they return: the config pool. */\nfunction readConfigPool(section, input) {\n\treturn readPool(\"config\", section.config ?? [environmentVariables()], input);\n}\n/** Calls the section's `secrets` adapters (default `[environmentVariables()]`) and merges what they return: the secrets pool. Every value must be text. */\nasync function readSecretsPool(section, input) {\n\tconst pool = await readPool(\"secrets\", section.secrets ?? [environmentVariables()], input);\n\tif (!isText(pool)) throw new InternalError(\"readPool admitted a secret that is not text\");\n\treturn pool;\n}\n//#endregion\nexport { readSecretsPool as n, readConfigPool as t };\n\n//# sourceMappingURL=config-pools-DiYw7wMu.mjs.map"],"mappings":";;;;;;AAIA,SAAS,eAAe,MAAM,OAAO,OAAO,SAAS,KAAK;CACzD,OAAO,IAAI,mBAAmB,0BAA0B,SAAS;EAChE;EACA,OAAO,EAAE,MAAM,MAAM,WAAW;EAChC,MAAM,EAAE,OAAO,GAAG,KAAK,GAAG,MAAM,GAAG;CACpC,CAAC;AACF;AACA,SAAS,SAAS,OAAO;CACxB,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC3E;AACA,SAAS,OAAO,MAAM;CACrB,OAAO,OAAO,OAAO,IAAI,CAAC,CAAC,OAAO,UAAU,OAAO,UAAU,QAAQ;AACtE;AACA,eAAe,SAAS,MAAM,UAAU,OAAO;CAC9C,MAAM,eAAe,OAAO,OAAO;EAClC,aAAa,MAAM;EACnB,iBAAiBA,OAAK,QAAQ,MAAM,UAAU;CAC/C,CAAC;CACD,MAAM,OAAO,OAAO,OA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