@prisma/composer-cli 0.37.0 → 0.38.0-dev.2
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/{dev-current-D0Kn6Mf4-DaV3DWR6.mjs → dev-current-ByDVi5EO-iAhiHuU7.mjs} +5 -5
- package/dist/{dev-current-D0Kn6Mf4-DaV3DWR6.mjs.map → dev-current-ByDVi5EO-iAhiHuU7.mjs.map} +1 -1
- package/dist/{dist-DizJD76s.mjs → dist-BH6HQ6zZ.mjs} +2 -2
- package/dist/{dist-DizJD76s.mjs.map → dist-BH6HQ6zZ.mjs.map} +1 -1
- package/dist/{execute-deploy-destroy-Dh1CQ9X6-XpXuMPxj.mjs → execute-deploy-destroy--N_UkK1g-YbFp_Ldb.mjs} +7 -7
- package/dist/execute-deploy-destroy--N_UkK1g-YbFp_Ldb.mjs.map +1 -0
- package/dist/{execute-dev-Bl-5Q-Av-DK5AoRw1.mjs → execute-dev-Crd7rFYA-DfLFreJv.mjs} +7 -7
- package/dist/{execute-dev-Bl-5Q-Av-DK5AoRw1.mjs.map → execute-dev-Crd7rFYA-DfLFreJv.mjs.map} +1 -1
- package/dist/{execute-dev-current-D3USgHJ4-frlaz_BC.mjs → execute-dev-current-Cj8M-VXO-CIaIGaZQ.mjs} +4 -4
- package/dist/{execute-dev-current-D3USgHJ4-frlaz_BC.mjs.map → execute-dev-current-Cj8M-VXO-CIaIGaZQ.mjs.map} +1 -1
- package/dist/family.d.mts +1 -1
- package/dist/family.mjs +9 -9
- package/dist/family.mjs.map +1 -1
- package/dist/{generate-dev-stack-Cag2Bd4s-CQLqIUWA.mjs → generate-dev-stack-BV_n-X9n-BDBjgphH.mjs} +3 -3
- package/dist/{generate-dev-stack-Cag2Bd4s-CQLqIUWA.mjs.map → generate-dev-stack-BV_n-X9n-BDBjgphH.mjs.map} +1 -1
- package/dist/{list-deployed-Cj37uZ6w.mjs → list-deployed-CGNtb8ly.mjs} +3 -3
- package/dist/list-deployed-CGNtb8ly.mjs.map +1 -0
- package/dist/{redaction-Bf8FvTFH-M5hYsi--.d.mts → redaction-Bf8FvTFH-Ccdv_Smp.d.mts} +29 -4
- package/dist/redaction-Bf8FvTFH-Ccdv_Smp.d.mts.map +1 -0
- package/dist/{redaction-HnbkSFrK-BjFRb2aC.mjs → redaction-HnbkSFrK-CCKJNRwi.mjs} +3 -3
- package/dist/redaction-HnbkSFrK-CCKJNRwi.mjs.map +1 -0
- package/dist/{run-alchemy-OS_ix5g0-BzkuReFx.mjs → run-alchemy-OS_ix5g0-DSlHsv2p.mjs} +2 -2
- package/dist/{run-alchemy-OS_ix5g0-BzkuReFx.mjs.map → run-alchemy-OS_ix5g0-DSlHsv2p.mjs.map} +1 -1
- package/dist/testing.d.mts +1 -1
- package/dist/testing.mjs +3 -3
- package/dist/testing.mjs.map +1 -1
- package/dist/{validate-environment-D_dECxgO-fg8lfCME.mjs → validate-environment-CpQLC3CA-Ct-PXoKN.mjs} +25 -21
- package/dist/validate-environment-CpQLC3CA-Ct-PXoKN.mjs.map +1 -0
- package/package.json +9 -9
- package/src/family/deploy-list.ts +2 -2
- package/dist/execute-deploy-destroy-Dh1CQ9X6-XpXuMPxj.mjs.map +0 -1
- package/dist/list-deployed-Cj37uZ6w.mjs.map +0 -1
- package/dist/redaction-Bf8FvTFH-M5hYsi--.d.mts.map +0 -1
- package/dist/redaction-HnbkSFrK-BjFRb2aC.mjs.map +0 -1
- package/dist/validate-environment-D_dECxgO-fg8lfCME.mjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as configFileMissing, f as entryMissing, i as credentialLookingValues, l as valuesUnderSecretsKeys, n as SecretRedaction, u as checkComposerConfig } from "./redaction-HnbkSFrK-
|
|
1
|
+
import { d as configFileMissing, f as entryMissing, i as credentialLookingValues, l as valuesUnderSecretsKeys, n as SecretRedaction, u as checkComposerConfig } from "./redaction-HnbkSFrK-CCKJNRwi.mjs";
|
|
2
2
|
import { a as InternalError, i as CliStructuredError, o as blindCast } from "./result-sR7PBi61.mjs";
|
|
3
3
|
import * as mod from "node:module";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
@@ -806,7 +806,7 @@ function isSecretString(value) {
|
|
|
806
806
|
return typeof value === "object" && value !== null && blindCast(value)[SECRET_BOX] === true;
|
|
807
807
|
}
|
|
808
808
|
//#endregion
|
|
809
|
-
//#region ../../0-framework/1-core/core/dist/graph-
|
|
809
|
+
//#region ../../0-framework/1-core/core/dist/graph-CBt9CRBT.mjs
|
|
810
810
|
/** The reserved name of a resource's single anonymous output port. Rejected as a user-declared port name (node.ts). */
|
|
811
811
|
const RESOURCE_OUT_PORT = "$out";
|
|
812
812
|
/**
|
|
@@ -983,7 +983,7 @@ function isConfigKeySegment(name) {
|
|
|
983
983
|
* installed copy of core (dual-package hazard).
|
|
984
984
|
*/
|
|
985
985
|
function isNode(value) {
|
|
986
|
-
return typeof value === "object" && value !== null && value[NODE] === true;
|
|
986
|
+
return typeof value === "object" && value !== null && blindCast(value)[NODE] === true;
|
|
987
987
|
}
|
|
988
988
|
/** A node's dependency slots. A resource node built by another installed copy of core may have no `inputs`; that means none. */
|
|
989
989
|
function slotsOf(node) {
|
|
@@ -1357,7 +1357,7 @@ function validateModuleInput(entry, resolved, environment) {
|
|
|
1357
1357
|
if (result instanceof Promise) throw new LoadError(`The input schema of module "${address}" returned a Promise from validate(). A module's input is validated synchronously at Load; use a schema with no asynchronous checks.`);
|
|
1358
1358
|
if (result.issues !== void 0) {
|
|
1359
1359
|
const messages = result.issues.map((issue) => issue.message).join("; ");
|
|
1360
|
-
if (entry.
|
|
1360
|
+
if (entry.isLoadRoot) throw new LoadError(`The input of root module "${address}" does not match its input schema: ${messages}. A root's input is the values the \`config\` adapters in prisma.config.ts return${environment === void 0 ? "" : ` for the environment "${environment.name}"`}.`);
|
|
1361
1361
|
throw new LoadError(`The input binding of module "${address}" does not match the module's input schema: ${messages}`);
|
|
1362
1362
|
}
|
|
1363
1363
|
const bound = sourcesByPath(resolved);
|
|
@@ -1507,7 +1507,7 @@ function resolveValues(input) {
|
|
|
1507
1507
|
const entry = moduleInputByAddress.get(origin.module);
|
|
1508
1508
|
if (entry === void 0) throw new LoadError(`${describeSite(site)} depends on ${inputFieldLabel(origin)} of module "${origin.module}", which this Load does not provision. An input field can be passed on only inside the body of the module that received it.`);
|
|
1509
1509
|
if (origin.path.length === 0) {
|
|
1510
|
-
const everyVariable = entry.
|
|
1510
|
+
const everyVariable = entry.isLoadRoot ? " The root's input is every value the `config` adapters return, which by default is every variable of the process environment, secrets included." : "";
|
|
1511
1511
|
throw new LoadError(`${describeSite(site)} depends on the whole input of module "${origin.module}". A module body's input is a dictionary of values, not a value, so it cannot be passed on whole.${everyVariable} Pass its fields on by name, such as input.from.`);
|
|
1512
1512
|
}
|
|
1513
1513
|
if (entry.checked !== void 0) {
|
|
@@ -1516,7 +1516,7 @@ function resolveValues(input) {
|
|
|
1516
1516
|
result = field.value;
|
|
1517
1517
|
} else {
|
|
1518
1518
|
result = readPath(validatedInputOf(entry), origin);
|
|
1519
|
-
if (entry.
|
|
1519
|
+
if (entry.isLoadRoot) rootFields.set(origin.path.join("\0"), result === void 0 ? { path: origin.path } : {
|
|
1520
1520
|
path: origin.path,
|
|
1521
1521
|
value: result
|
|
1522
1522
|
});
|
|
@@ -1546,7 +1546,7 @@ function resolveValues(input) {
|
|
|
1546
1546
|
validatedInputs.set(entry.moduleAddress, validated);
|
|
1547
1547
|
return validated;
|
|
1548
1548
|
};
|
|
1549
|
-
const rootModuleAddress = () => input.moduleInputs.find((entry) => entry.
|
|
1549
|
+
const rootModuleAddress = () => input.moduleInputs.find((entry) => entry.isLoadRoot)?.moduleAddress ?? "";
|
|
1550
1550
|
const appConfigurationReadOf = (inputBindings, params, secretSources) => {
|
|
1551
1551
|
if (input.configuration !== void 0 || input.appConfigurationRead !== void 0) {
|
|
1552
1552
|
const kept = [...inputBindings.map(({ serviceAddress, binding }) => ({
|
|
@@ -1839,6 +1839,7 @@ function flatten(moduleNode, selfId, wiring, nodes, edges, pending, inputBinding
|
|
|
1839
1839
|
if (localIds.has(id)) throw new LoadError(`Duplicate provision id "${id}" in module "${moduleNode.name}".`);
|
|
1840
1840
|
const untrusted = child;
|
|
1841
1841
|
if (!isNode(untrusted) || untrusted.kind !== "service" && untrusted.kind !== "resource" && untrusted.kind !== "module") throw new LoadError(`provision("${id}") expects a branded service, resource, or module node (construct it with the service()/resource()/module() factories or a pack's own).`);
|
|
1842
|
+
if (untrusted.kind === "module" && typeof untrusted.isRoot === "function" && untrusted.isRoot()) throw new LoadError(`Module "${selfId}" provisions the app root "${untrusted.name}". An app root is the deploy's entry and cannot be provisioned. Build the module with module() instead.`);
|
|
1842
1843
|
localIds.add(id);
|
|
1843
1844
|
const fullAddress = `${selfId}.${id}`;
|
|
1844
1845
|
if (child.kind === "resource") {
|
|
@@ -1922,7 +1923,7 @@ function flatten(moduleNode, selfId, wiring, nodes, edges, pending, inputBinding
|
|
|
1922
1923
|
moduleAddress: fullAddress,
|
|
1923
1924
|
schema: childInputSchema,
|
|
1924
1925
|
binding: provisionInput,
|
|
1925
|
-
|
|
1926
|
+
isLoadRoot: false
|
|
1926
1927
|
});
|
|
1927
1928
|
edges.push(...wiringEdges(localWiring, fullAddress));
|
|
1928
1929
|
recordAuthoredWiring(fullAddress, localWiring);
|
|
@@ -1992,14 +1993,14 @@ function loadModule(root, opts) {
|
|
|
1992
1993
|
moduleAddress: rootId,
|
|
1993
1994
|
schema: root.inputSchema,
|
|
1994
1995
|
binding: void 0,
|
|
1995
|
-
|
|
1996
|
+
isLoadRoot: true,
|
|
1996
1997
|
checked: opts.appConfigurationRead.rootInput
|
|
1997
1998
|
});
|
|
1998
1999
|
else if (opts?.configuration !== void 0) moduleInputs.push({
|
|
1999
2000
|
moduleAddress: rootId,
|
|
2000
2001
|
schema: root.inputSchema,
|
|
2001
2002
|
binding: opts.configuration,
|
|
2002
|
-
|
|
2003
|
+
isLoadRoot: true
|
|
2003
2004
|
});
|
|
2004
2005
|
else throw new LoadError(`Module "${root.name}" declares input and is being deployed as the root, but Load was given no app configuration to fill it from. Pass { configuration } to Load; prisma deploy and prisma dev pass the values the \`config\` adapters return.`);
|
|
2005
2006
|
const nodes = [];
|
|
@@ -2115,13 +2116,13 @@ function assertAppName(name) {
|
|
|
2115
2116
|
* functions.
|
|
2116
2117
|
*/
|
|
2117
2118
|
function Load(root, opts) {
|
|
2118
|
-
if (!isNode(root)) throw new LoadError("Load expects a branded service or
|
|
2119
|
+
if (!isNode(root)) throw new LoadError("Load expects a branded service, module or app root node (construct it with the service(), module() or appRoot() factories).");
|
|
2119
2120
|
if (root.kind === "module") {
|
|
2120
2121
|
assertAppName(opts?.id ?? root.name);
|
|
2121
2122
|
return loadModule(root, opts);
|
|
2122
2123
|
}
|
|
2123
2124
|
if (root.kind === "service") return loadService(root, opts?.id ?? "root");
|
|
2124
|
-
throw new LoadError("Load expects a service or
|
|
2125
|
+
throw new LoadError("Load expects a service, module or app root (received another node kind).");
|
|
2125
2126
|
}
|
|
2126
2127
|
/** The app secrets key of every secret source the graph names, once each, in the order Load met them. A source built without a `secretsKey` is left out. */
|
|
2127
2128
|
function secretsKeys(graph) {
|
|
@@ -2138,7 +2139,7 @@ function nodeAddresses(graph) {
|
|
|
2138
2139
|
return graph.nodes.map(({ id }) => id).sort();
|
|
2139
2140
|
}
|
|
2140
2141
|
//#endregion
|
|
2141
|
-
//#region ../../0-framework/3-tooling/cli/dist/validate-environment-
|
|
2142
|
+
//#region ../../0-framework/3-tooling/cli/dist/validate-environment-CpQLC3CA.mjs
|
|
2142
2143
|
function adapterInvalid(list, index, input, summary, fix) {
|
|
2143
2144
|
return new CliStructuredError("CONFIG.ADAPTER_INVALID", summary, {
|
|
2144
2145
|
fix,
|
|
@@ -2306,9 +2307,9 @@ function explainJsxLoadError(error, entryPath) {
|
|
|
2306
2307
|
}
|
|
2307
2308
|
/**
|
|
2308
2309
|
* Pipeline step 2 (deploy-cli.md § The pipeline): import the entry module
|
|
2309
|
-
* (resolved against cwd) and require its default export to be
|
|
2310
|
-
*
|
|
2311
|
-
*
|
|
2310
|
+
* (resolved against cwd) and require its default export to be the app's root:
|
|
2311
|
+
* an app root built with `appRoot()`, or a module built with `module()`
|
|
2312
|
+
* (ADR-0003).
|
|
2312
2313
|
*/
|
|
2313
2314
|
/** `unloadableFix`, when given, says where the path came from, so a wrong path names its source. */
|
|
2314
2315
|
async function loadEntry(entryArg, cwd, unloadableFix) {
|
|
@@ -2332,13 +2333,17 @@ async function loadEntry(entryArg, cwd, unloadableFix) {
|
|
|
2332
2333
|
});
|
|
2333
2334
|
}
|
|
2334
2335
|
const root = blindCast(mod).default;
|
|
2335
|
-
if (
|
|
2336
|
-
fix: "
|
|
2336
|
+
if (isNode(root) && root.kind === "service") throw new CliStructuredError("COMPOSE.ROOT_NOT_MODULE", `The entry "${resolvedPath}" default-exports a service. The app's root must be a module, built with appRoot().`, {
|
|
2337
|
+
fix: "Provision the service inside a root, e.g. export default appRoot('name', ({ provision }) => { provision(service); }).",
|
|
2338
|
+
where: { path: resolvedPath }
|
|
2339
|
+
});
|
|
2340
|
+
if (!isNode(root) || root.kind !== "module") throw new CliStructuredError("COMPOSE.ENTRY_EXPORT_INVALID", `Entry module "${resolvedPath}" must default-export the app's root.`, {
|
|
2341
|
+
fix: "Build it with appRoot() from @prisma/composer.",
|
|
2337
2342
|
where: { path: resolvedPath }
|
|
2338
2343
|
});
|
|
2339
2344
|
return {
|
|
2340
2345
|
path: resolvedPath,
|
|
2341
|
-
root
|
|
2346
|
+
root
|
|
2342
2347
|
};
|
|
2343
2348
|
}
|
|
2344
2349
|
function lookup(extensions, extension, type, expectedKind, what) {
|
|
@@ -2477,7 +2482,6 @@ async function runPipeline(entry, overrideName, environment, cwd, source, deps =
|
|
|
2477
2482
|
environment: { name: environment },
|
|
2478
2483
|
configuration
|
|
2479
2484
|
});
|
|
2480
|
-
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); })." });
|
|
2481
2485
|
redaction.addKnownSecrets(valuesUnderSecretsKeys(configuration, secrets, secretsKeys(graph)));
|
|
2482
2486
|
validateRegistryCoverage(graph, config);
|
|
2483
2487
|
deps.onEvent?.({ kind: "loaded" });
|
|
@@ -2510,4 +2514,4 @@ function validateEnvironmentName(environment, spawn = spawnSync) {
|
|
|
2510
2514
|
//#endregion
|
|
2511
2515
|
export { nodeAddresses as a, __require as c, validateEnvironmentName as i, __toESM as l, resolveAppIdentity as n, secretsKeys as o, runPipeline as r, __commonJSMin as s, checkConfigSource as t };
|
|
2512
2516
|
|
|
2513
|
-
//# sourceMappingURL=validate-environment-
|
|
2517
|
+
//# sourceMappingURL=validate-environment-CpQLC3CA-Ct-PXoKN.mjs.map
|