@prisma/composer-cli 0.35.0 → 0.36.0-dev.1
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-CErnR6NK-6QjHJ7q5.mjs +32 -0
- package/dist/app-config-CErnR6NK-6QjHJ7q5.mjs.map +1 -0
- package/dist/{container-transport-HcvNOGZL-CIoZc7Rs.mjs → config-DiZaanS3.mjs} +32 -2
- package/dist/config-DiZaanS3.mjs.map +1 -0
- package/dist/{dev-current-BB02pfSh-vMKS1rYi.mjs → dev-current-Brb4qugP-BOI9FJdz.mjs} +44 -8
- package/dist/dev-current-Brb4qugP-BOI9FJdz.mjs.map +1 -0
- package/dist/dev-environment-name-6eEr5PW8-lIZmJjfr.mjs +71 -0
- package/dist/dev-environment-name-6eEr5PW8-lIZmJjfr.mjs.map +1 -0
- package/dist/dist-B9-nLeho.mjs.map +1 -1
- package/dist/{execute-deploy-destroy-DwcoZIks-CiW-dlB1.mjs → execute-deploy-destroy-CNt-xpE7-CMQCNQpY.mjs} +32 -56
- package/dist/execute-deploy-destroy-CNt-xpE7-CMQCNQpY.mjs.map +1 -0
- package/dist/{execute-dev-BHRWoEnd-DrGMSTD3.mjs → execute-dev-BUk-XWBJ-DaB9ma8z.mjs} +45 -23
- package/dist/execute-dev-BUk-XWBJ-DaB9ma8z.mjs.map +1 -0
- package/dist/{execute-dev-current-D4RkOtPA-BFoZ0cXm.mjs → execute-dev-current-BdEqeKAB-xCBBITAB.mjs} +70 -34
- package/dist/execute-dev-current-BdEqeKAB-xCBBITAB.mjs.map +1 -0
- package/dist/{family-xJ6y4fXc-CFBu6q4b.d.mts → family-B2JZ8O7U-P_rOUr4w.d.mts} +123 -52
- package/dist/family-B2JZ8O7U-P_rOUr4w.d.mts.map +1 -0
- package/dist/family.d.mts +3 -3
- package/dist/family.d.mts.map +1 -1
- package/dist/family.mjs +103 -47
- package/dist/family.mjs.map +1 -1
- package/dist/{generate-dev-stack-CfneNj97-Yx3Z2-9u.mjs → generate-dev-stack-BkkU2HLE-Dek3CkAQ.mjs} +18 -13
- package/dist/generate-dev-stack-BkkU2HLE-Dek3CkAQ.mjs.map +1 -0
- package/dist/{list-deployed-df3vxBbn.mjs → list-deployed-GhPuf0RC.mjs} +70 -44
- package/dist/list-deployed-GhPuf0RC.mjs.map +1 -0
- package/dist/testing.d.mts +3 -1
- package/dist/testing.d.mts.map +1 -1
- package/dist/testing.mjs +2 -1
- package/dist/testing.mjs.map +1 -1
- package/dist/{pipeline-BmWt-Nhb-Bos4TFXR.mjs → validate-environment-CEhUSEg2-ExABehBM.mjs} +330 -55
- package/dist/validate-environment-CEhUSEg2-ExABehBM.mjs.map +1 -0
- package/package.json +7 -7
- package/src/family/deploy-list.ts +17 -10
- package/src/family/deployed-nodes.ts +10 -10
- package/src/family/emulator-list.ts +7 -4
- package/src/family/list-deployed.ts +12 -12
- package/dist/container-transport-HcvNOGZL-CIoZc7Rs.mjs.map +0 -1
- package/dist/dev-current-BB02pfSh-vMKS1rYi.mjs.map +0 -1
- package/dist/execute-deploy-destroy-DwcoZIks-CiW-dlB1.mjs.map +0 -1
- package/dist/execute-dev-BHRWoEnd-DrGMSTD3.mjs.map +0 -1
- package/dist/execute-dev-current-D4RkOtPA-BFoZ0cXm.mjs.map +0 -1
- package/dist/family-xJ6y4fXc-CFBu6q4b.d.mts.map +0 -1
- package/dist/generate-dev-stack-CfneNj97-Yx3Z2-9u.mjs.map +0 -1
- package/dist/list-deployed-df3vxBbn.mjs.map +0 -1
- package/dist/local-target-CK8gvYV4.mjs +0 -48
- package/dist/local-target-CK8gvYV4.mjs.map +0 -1
- package/dist/pipeline-BmWt-Nhb-Bos4TFXR.mjs.map +0 -1
- package/dist/validate-stage-DxRW3MwT-DOWCXHa_.mjs +0 -13
- package/dist/validate-stage-DxRW3MwT-DOWCXHa_.mjs.map +0 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//#region ../../0-framework/1-core/core/dist/app-config-CErnR6NK.mjs
|
|
2
|
+
/** `<cwd>/.prisma-composer/dev` — local dev's state directory (ADR-0041, ADR-0004's tool-state rule), holding one folder per environment. */
|
|
3
|
+
const DEV_DIR = ".prisma-composer/dev";
|
|
4
|
+
/**
|
|
5
|
+
* The folder, relative to the cwd, that holds one environment's local copy.
|
|
6
|
+
* The environment name is percent-encoded (`encodeURIComponent`), so a name
|
|
7
|
+
* with `/` stays one folder and `decodeURIComponent` gives the name back.
|
|
8
|
+
*/
|
|
9
|
+
function devEnvironmentDir(environment) {
|
|
10
|
+
return `${DEV_DIR}/${encodeURIComponent(environment)}`;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The file in an environment's folder that holds the environment's exact
|
|
14
|
+
* name. On a case-insensitive filesystem `Dev` and `dev` share one folder;
|
|
15
|
+
* the recorded name tells them apart.
|
|
16
|
+
*/
|
|
17
|
+
const DEV_ENVIRONMENT_NAME_FILE = "environment-name";
|
|
18
|
+
/**
|
|
19
|
+
* True when an extension only participates in assembly (every `nodes` entry
|
|
20
|
+
* is `kind: 'build'`, and it declares none of `providers`/`application`/
|
|
21
|
+
* `provisions`/`container`) — it owns no resources or services, so it has
|
|
22
|
+
* nothing to emulate and is exempt from local-target-capability requirements
|
|
23
|
+
* (ADR-0041). Shared by `localTargetProviders` and every local-target hook
|
|
24
|
+
* iteration.
|
|
25
|
+
*/
|
|
26
|
+
function isBuildOnlyExtension(extension) {
|
|
27
|
+
return Object.values(extension.nodes).every((node) => node.kind === "build") && extension.providers === void 0 && extension.application === void 0 && extension.provisions === void 0 && extension.container === void 0;
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { devEnvironmentDir as n, isBuildOnlyExtension as r, DEV_ENVIRONMENT_NAME_FILE as t };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=app-config-CErnR6NK-6QjHJ7q5.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-config-CErnR6NK-6QjHJ7q5.mjs","names":[],"sources":["../../../0-framework/1-core/core/dist/app-config-CErnR6NK.mjs"],"sourcesContent":["//#region src/control/app-config.ts\n/** `<cwd>/.prisma-composer/dev` — local dev's state directory (ADR-0041, ADR-0004's tool-state rule), holding one folder per environment. */\nconst DEV_DIR = \".prisma-composer/dev\";\n/**\n* The folder, relative to the cwd, that holds one environment's local copy.\n* The environment name is percent-encoded (`encodeURIComponent`), so a name\n* with `/` stays one folder and `decodeURIComponent` gives the name back.\n*/\nfunction devEnvironmentDir(environment) {\n\treturn `${DEV_DIR}/${encodeURIComponent(environment)}`;\n}\n/**\n* The file in an environment's folder that holds the environment's exact\n* name. On a case-insensitive filesystem `Dev` and `dev` share one folder;\n* the recorded name tells them apart.\n*/\nconst DEV_ENVIRONMENT_NAME_FILE = \"environment-name\";\n/**\n* True when an extension only participates in assembly (every `nodes` entry\n* is `kind: 'build'`, and it declares none of `providers`/`application`/\n* `provisions`/`container`) — it owns no resources or services, so it has\n* nothing to emulate and is exempt from local-target-capability requirements\n* (ADR-0041). Shared by `localTargetProviders` and every local-target hook\n* iteration.\n*/\nfunction isBuildOnlyExtension(extension) {\n\treturn Object.values(extension.nodes).every((node) => node.kind === \"build\") && extension.providers === void 0 && extension.application === void 0 && extension.provisions === void 0 && extension.container === void 0;\n}\n/** Typed identity — exists so the `composer` section of `prisma.config.ts` gets checked against PrismaAppConfig where it is written. */\nfunction defineConfig(config) {\n\treturn config;\n}\n//#endregion\nexport { isBuildOnlyExtension as a, devEnvironmentDir as i, DEV_ENVIRONMENT_NAME_FILE as n, defineConfig as r, DEV_DIR as t };\n\n//# sourceMappingURL=app-config-CErnR6NK.mjs.map"],"mappings":";;AAEA,MAAM,UAAU;;;;;;AAMhB,SAAS,kBAAkB,aAAa;CACvC,OAAO,GAAG,QAAQ,GAAG,mBAAmB,WAAW;AACpD;;;;;;AAMA,MAAM,4BAA4B;;;;;;;;;AASlC,SAAS,qBAAqB,WAAW;CACxC,OAAO,OAAO,OAAO,UAAU,KAAK,CAAC,CAAC,OAAO,SAAS,KAAK,SAAS,OAAO,KAAK,UAAU,cAAc,KAAK,KAAK,UAAU,gBAAgB,KAAK,KAAK,UAAU,eAAe,KAAK,KAAK,UAAU,cAAc,KAAK;AACvN"}
|
|
@@ -29,6 +29,36 @@ function containerEnv(instances) {
|
|
|
29
29
|
return env;
|
|
30
30
|
}
|
|
31
31
|
//#endregion
|
|
32
|
-
|
|
32
|
+
//#region ../../0-framework/1-core/core/dist/config.mjs
|
|
33
|
+
/**
|
|
34
|
+
* Carries an extension's preflight payload from the CLI process to the
|
|
35
|
+
* alchemy child (which re-imports the config from scratch) — one env var per
|
|
36
|
+
* extension, same channel as containers (container-transport.ts), filled by
|
|
37
|
+
* whichever preflight the run executed: the deploy preflight or the local
|
|
38
|
+
* target's dev preflight. The framework never reads the contents, so an
|
|
39
|
+
* extension that implements both must tell its own payload kinds apart.
|
|
40
|
+
* Payloads carry metadata only, never secret values: the child's environment
|
|
41
|
+
* is not a secret store.
|
|
42
|
+
*/
|
|
43
|
+
/** '@prisma/composer-prisma-cloud' → 'PRISMA_COMPOSER_PREFLIGHT_PRISMA_COMPOSER_PRISMA_CLOUD' */
|
|
44
|
+
function preflightEnvVarName(extensionId) {
|
|
45
|
+
return `PRISMA_COMPOSER_PREFLIGHT_${envVarSafeExtensionId(extensionId)}`;
|
|
46
|
+
}
|
|
47
|
+
/** The env entries the CLI sets on the alchemy process: `{ [preflightEnvVarName(id)]: payload }` for every extension whose preflight returned one. */
|
|
48
|
+
function preflightEnv(payloads) {
|
|
49
|
+
const env = {};
|
|
50
|
+
const ownerByVarName = /* @__PURE__ */ new Map();
|
|
51
|
+
for (const [extensionId, payload] of payloads) {
|
|
52
|
+
if (payload.length === 0) continue;
|
|
53
|
+
const varName = preflightEnvVarName(extensionId);
|
|
54
|
+
const owner = ownerByVarName.get(varName);
|
|
55
|
+
if (owner !== void 0) throw new Error(`Extension ids "${owner}" and "${extensionId}" both map to the preflight transport variable "${varName}" — rename one of the extensions.`);
|
|
56
|
+
ownerByVarName.set(varName, extensionId);
|
|
57
|
+
env[varName] = payload;
|
|
58
|
+
}
|
|
59
|
+
return env;
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
export { preflightEnvVarName as n, containerEnv as r, preflightEnv as t };
|
|
33
63
|
|
|
34
|
-
//# sourceMappingURL=
|
|
64
|
+
//# sourceMappingURL=config-DiZaanS3.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-DiZaanS3.mjs","names":[],"sources":["../../../0-framework/1-core/core/dist/container-transport-HcvNOGZL.mjs","../../../0-framework/1-core/core/dist/config.mjs"],"sourcesContent":["//#region src/container-transport.ts\n/** '@prisma/composer-prisma-cloud' → 'PRISMA_COMPOSER_PRISMA_CLOUD': uppercased, every non-alphanumeric run replaced by one underscore. */\nfunction envVarSafeExtensionId(extensionId) {\n\treturn extensionId.toUpperCase().replace(/[^A-Z0-9]+/g, \"_\").replace(/^_+|_+$/g, \"\");\n}\n/** '@prisma/composer-prisma-cloud' → 'PRISMA_COMPOSER_CONTAINER_PRISMA_COMPOSER_PRISMA_CLOUD' */\nfunction containerEnvVarName(extensionId) {\n\treturn `PRISMA_COMPOSER_CONTAINER_${envVarSafeExtensionId(extensionId)}`;\n}\nfunction collisionError(a, b, varName) {\n\treturn /* @__PURE__ */ new Error(`Extension ids \"${a}\" and \"${b}\" both map to the container transport variable \"${varName}\" — rename one of the extensions.`);\n}\nfunction emptySerializeError(extensionId) {\n\treturn /* @__PURE__ */ new Error(`Extension \"${extensionId}\"'s container instance serialized to an empty string — ContainerInstance.serialize() must return a non-empty string.`);\n}\n/** The env entries the CLI sets on the alchemy process: `{ [containerEnvVarName(id)]: instance.serialize() }` for every resolved instance. */\nfunction containerEnv(instances) {\n\tconst env = {};\n\tconst ownerByVarName = /* @__PURE__ */ new Map();\n\tfor (const [extensionId, instance] of instances) {\n\t\tconst varName = containerEnvVarName(extensionId);\n\t\tconst owner = ownerByVarName.get(varName);\n\t\tif (owner !== void 0) throw collisionError(owner, extensionId, varName);\n\t\townerByVarName.set(varName, extensionId);\n\t\tconst serialized = instance.serialize();\n\t\tif (serialized.length === 0) throw emptySerializeError(extensionId);\n\t\tenv[varName] = serialized;\n\t}\n\treturn env;\n}\n/**\n* The alchemy-process side: for each extension with a container descriptor\n* whose var is present in `env`, call its deserialize. Absent var → no entry.\n*/\nfunction deserializeContainers(extensions, env) {\n\tconst instances = /* @__PURE__ */ new Map();\n\tfor (const extension of extensions) {\n\t\tconst descriptor = extension.container;\n\t\tif (descriptor === void 0) continue;\n\t\tconst serialized = env[containerEnvVarName(extension.id)];\n\t\tif (serialized === void 0) continue;\n\t\tinstances.set(extension.id, descriptor.deserialize(serialized));\n\t}\n\treturn instances;\n}\n//#endregion\nexport { envVarSafeExtensionId as i, containerEnvVarName as n, deserializeContainers as r, containerEnv as t };\n\n//# sourceMappingURL=container-transport-HcvNOGZL.mjs.map","import { i as envVarSafeExtensionId, n as containerEnvVarName, r as deserializeContainers, t as containerEnv } from \"./container-transport-HcvNOGZL.mjs\";\nimport { a as isBuildOnlyExtension, i as devEnvironmentDir, n as DEV_ENVIRONMENT_NAME_FILE, r as defineConfig, t as DEV_DIR } from \"./app-config-CErnR6NK.mjs\";\n//#region src/preflight-transport.ts\n/**\n* Carries an extension's preflight payload from the CLI process to the\n* alchemy child (which re-imports the config from scratch) — one env var per\n* extension, same channel as containers (container-transport.ts), filled by\n* whichever preflight the run executed: the deploy preflight or the local\n* target's dev preflight. The framework never reads the contents, so an\n* extension that implements both must tell its own payload kinds apart.\n* Payloads carry metadata only, never secret values: the child's environment\n* is not a secret store.\n*/\n/** '@prisma/composer-prisma-cloud' → 'PRISMA_COMPOSER_PREFLIGHT_PRISMA_COMPOSER_PRISMA_CLOUD' */\nfunction preflightEnvVarName(extensionId) {\n\treturn `PRISMA_COMPOSER_PREFLIGHT_${envVarSafeExtensionId(extensionId)}`;\n}\n/** The env entries the CLI sets on the alchemy process: `{ [preflightEnvVarName(id)]: payload }` for every extension whose preflight returned one. */\nfunction preflightEnv(payloads) {\n\tconst env = {};\n\tconst ownerByVarName = /* @__PURE__ */ new Map();\n\tfor (const [extensionId, payload] of payloads) {\n\t\tif (payload.length === 0) continue;\n\t\tconst varName = preflightEnvVarName(extensionId);\n\t\tconst owner = ownerByVarName.get(varName);\n\t\tif (owner !== void 0) throw new Error(`Extension ids \"${owner}\" and \"${extensionId}\" both map to the preflight transport variable \"${varName}\" — rename one of the extensions.`);\n\t\townerByVarName.set(varName, extensionId);\n\t\tenv[varName] = payload;\n\t}\n\treturn env;\n}\n/** The alchemy-process side: the payload this extension's own preflight wrote, or `undefined` when it wrote none (or when nothing ran a preflight at all). */\nfunction readPreflightPayload(extensionId, env) {\n\tconst payload = env[preflightEnvVarName(extensionId)];\n\treturn payload === void 0 || payload.length === 0 ? void 0 : payload;\n}\n//#endregion\nexport { DEV_DIR, DEV_ENVIRONMENT_NAME_FILE, containerEnv, containerEnvVarName, defineConfig, deserializeContainers, devEnvironmentDir, isBuildOnlyExtension, preflightEnv, preflightEnvVarName, readPreflightPayload };\n\n//# sourceMappingURL=config.mjs.map"],"mappings":";;AAEA,SAAS,sBAAsB,aAAa;CAC3C,OAAO,YAAY,YAAY,CAAC,CAAC,QAAQ,eAAe,GAAG,CAAC,CAAC,QAAQ,YAAY,EAAE;AACpF;;AAEA,SAAS,oBAAoB,aAAa;CACzC,OAAO,6BAA6B,sBAAsB,WAAW;AACtE;AACA,SAAS,eAAe,GAAG,GAAG,SAAS;CACtC,uBAAuB,IAAI,MAAM,kBAAkB,EAAE,SAAS,EAAE,kDAAkD,QAAQ,kCAAkC;AAC7J;AACA,SAAS,oBAAoB,aAAa;CACzC,uBAAuB,IAAI,MAAM,cAAc,YAAY,qHAAqH;AACjL;;AAEA,SAAS,aAAa,WAAW;CAChC,MAAM,MAAM,CAAC;CACb,MAAM,iCAAiC,IAAI,IAAI;CAC/C,KAAK,MAAM,CAAC,aAAa,aAAa,WAAW;EAChD,MAAM,UAAU,oBAAoB,WAAW;EAC/C,MAAM,QAAQ,eAAe,IAAI,OAAO;EACxC,IAAI,UAAU,KAAK,GAAG,MAAM,eAAe,OAAO,aAAa,OAAO;EACtE,eAAe,IAAI,SAAS,WAAW;EACvC,MAAM,aAAa,SAAS,UAAU;EACtC,IAAI,WAAW,WAAW,GAAG,MAAM,oBAAoB,WAAW;EAClE,IAAI,WAAW;CAChB;CACA,OAAO;AACR;;;;;;;;;;;;;;ACfA,SAAS,oBAAoB,aAAa;CACzC,OAAO,6BAA6B,sBAAsB,WAAW;AACtE;;AAEA,SAAS,aAAa,UAAU;CAC/B,MAAM,MAAM,CAAC;CACb,MAAM,iCAAiC,IAAI,IAAI;CAC/C,KAAK,MAAM,CAAC,aAAa,YAAY,UAAU;EAC9C,IAAI,QAAQ,WAAW,GAAG;EAC1B,MAAM,UAAU,oBAAoB,WAAW;EAC/C,MAAM,QAAQ,eAAe,IAAI,OAAO;EACxC,IAAI,UAAU,KAAK,GAAG,MAAM,IAAI,MAAM,kBAAkB,MAAM,SAAS,YAAY,kDAAkD,QAAQ,kCAAkC;EAC/K,eAAe,IAAI,SAAS,WAAW;EACvC,IAAI,WAAW;CAChB;CACA,OAAO;AACR"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as notOk, c as CliStructuredError, o as ok, u as blindCast } from "./run-alchemy-Dl_MWw4g-DaWV9tkH.mjs";
|
|
2
|
-
//#region ../../0-framework/3-tooling/cli/dist/dev-current-
|
|
2
|
+
//#region ../../0-framework/3-tooling/cli/dist/dev-current-Brb4qugP.mjs
|
|
3
3
|
/**
|
|
4
4
|
* Reads the execution diagnostics an engine-failure error carries in
|
|
5
5
|
* `meta.diagnostics`; undefined for every other failure.
|
|
@@ -27,6 +27,42 @@ function executorLoadFailure(operation, error) {
|
|
|
27
27
|
cause: error
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
|
+
const RUN_OF = {
|
|
31
|
+
deploy: {
|
|
32
|
+
running: "this deploy",
|
|
33
|
+
runs: "the deploy"
|
|
34
|
+
},
|
|
35
|
+
destroy: {
|
|
36
|
+
running: "this destroy",
|
|
37
|
+
runs: "the destroy"
|
|
38
|
+
},
|
|
39
|
+
dev: {
|
|
40
|
+
running: "`prisma dev`",
|
|
41
|
+
runs: "`prisma dev`"
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* An extension older than this Composer stores the input it is given but
|
|
46
|
+
* resolves from a key without `environment`, so it may read every name as
|
|
47
|
+
* production, or, locally, put every environment in one copy. Its
|
|
48
|
+
* `deserialize` rebuilds only the fields it knows, so the container the
|
|
49
|
+
* Alchemy child rebuilds shows which environment it really resolved.
|
|
50
|
+
* Refusing here keeps a mismatched install from deploying into, destroying
|
|
51
|
+
* or running the wrong place.
|
|
52
|
+
*/
|
|
53
|
+
function requireContainerForEnvironment(action, extensionId, descriptor, instance, environment) {
|
|
54
|
+
let rebuiltEnvironment;
|
|
55
|
+
try {
|
|
56
|
+
rebuiltEnvironment = descriptor.deserialize(instance.serialize()).input.environment;
|
|
57
|
+
} catch {
|
|
58
|
+
rebuiltEnvironment = void 0;
|
|
59
|
+
}
|
|
60
|
+
if (rebuiltEnvironment === environment) return;
|
|
61
|
+
const { running, runs } = RUN_OF[action];
|
|
62
|
+
throw new CliStructuredError("DEPS.EXTENSION_INCOMPATIBLE", `The extension ${extensionId} is older than the Composer running ${running}, so it would not resolve the environment ${environment}.`, { fix: `Install the same Composer version of ${extensionId} as the Composer that runs ${runs}.` });
|
|
63
|
+
}
|
|
64
|
+
/** The environment `deploy` targets when none is named. */
|
|
65
|
+
const DEFAULT_DEPLOY_ENVIRONMENT = "production";
|
|
30
66
|
/** In-package variant threading the injection seam, which the family's
|
|
31
67
|
* commands and the unit tests use. Deliberately NOT re-exported through `./control` — the seam mirrors
|
|
32
68
|
* internal types and is not part of the published surface. */
|
|
@@ -35,7 +71,7 @@ async function deployWithDeps(input, deps) {
|
|
|
35
71
|
const cwd = input.cwd ?? process.cwd();
|
|
36
72
|
let executor;
|
|
37
73
|
try {
|
|
38
|
-
executor = await import("./execute-deploy-destroy-
|
|
74
|
+
executor = await import("./execute-deploy-destroy-CNt-xpE7-CMQCNQpY.mjs");
|
|
39
75
|
} catch (error) {
|
|
40
76
|
return notOk(executorLoadFailure("deploy", error));
|
|
41
77
|
}
|
|
@@ -53,7 +89,7 @@ async function devWithDeps(input, deps) {
|
|
|
53
89
|
const cwd = input.cwd ?? process.cwd();
|
|
54
90
|
let executor;
|
|
55
91
|
try {
|
|
56
|
-
executor = await import("./execute-dev-
|
|
92
|
+
executor = await import("./execute-dev-BUk-XWBJ-DaB9ma8z.mjs");
|
|
57
93
|
} catch (error) {
|
|
58
94
|
return notOk(executorLoadFailure("dev", error));
|
|
59
95
|
}
|
|
@@ -61,24 +97,24 @@ async function devWithDeps(input, deps) {
|
|
|
61
97
|
}
|
|
62
98
|
async function loadExecutor(operation) {
|
|
63
99
|
try {
|
|
64
|
-
return ok(await import("./execute-dev-current-
|
|
100
|
+
return ok(await import("./execute-dev-current-BdEqeKAB-xCBBITAB.mjs"));
|
|
65
101
|
} catch (error) {
|
|
66
102
|
return notOk(executorLoadFailure(operation, error));
|
|
67
103
|
}
|
|
68
104
|
}
|
|
69
|
-
/** Where the node at `input.address`
|
|
105
|
+
/** Where the node at `input.address` runs locally in the environment. */
|
|
70
106
|
async function devUrl(input) {
|
|
71
107
|
const executor = await loadExecutor("dev url");
|
|
72
108
|
if (!executor.ok) return executor;
|
|
73
109
|
return executor.value.executeDevUrl(input, input.cwd ?? process.cwd());
|
|
74
110
|
}
|
|
75
|
-
/** Stops the
|
|
111
|
+
/** Stops the app's local copy in the environment: its service processes and database servers. Data and ports stay. */
|
|
76
112
|
async function devStop(input) {
|
|
77
113
|
const executor = await loadExecutor("dev stop");
|
|
78
114
|
if (!executor.ok) return executor;
|
|
79
115
|
return executor.value.executeDevStop(input, input.cwd ?? process.cwd());
|
|
80
116
|
}
|
|
81
117
|
//#endregion
|
|
82
|
-
export {
|
|
118
|
+
export { devWithDeps as a, toStructured as c, devUrl as i, deployWithDeps as n, executionDiagnostics as o, devStop as r, requireContainerForEnvironment as s, DEFAULT_DEPLOY_ENVIRONMENT as t };
|
|
83
119
|
|
|
84
|
-
//# sourceMappingURL=dev-current-
|
|
120
|
+
//# sourceMappingURL=dev-current-Brb4qugP-BOI9FJdz.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev-current-Brb4qugP-BOI9FJdz.mjs","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/dev-current-Brb4qugP.mjs"],"sourcesContent":["import { CliStructuredError } from \"@internal/foundation/errors\";\nimport { blindCast } from \"@internal/foundation/casts\";\nimport { notOk, ok } from \"@internal/foundation/result\";\n//#region src/operations/shared.ts\n/**\n* Reads the execution diagnostics an engine-failure error carries in\n* `meta.diagnostics`; undefined for every other failure.\n*/\nfunction executionDiagnostics(f) {\n\tconst diagnostics = f.meta?.[\"diagnostics\"];\n\tif (typeof diagnostics !== \"object\" || diagnostics === null) return void 0;\n\tconst candidate = blindCast(diagnostics);\n\tif (candidate[\"exitCode\"] !== void 0 && typeof candidate[\"exitCode\"] !== \"number\" || candidate[\"signal\"] !== void 0 && typeof candidate[\"signal\"] !== \"string\" || typeof candidate[\"stackFilePath\"] !== \"string\" || typeof candidate[\"reproduceCommand\"] !== \"string\" || typeof candidate[\"cwd\"] !== \"string\") return;\n\treturn blindCast(diagnostics);\n}\n/**\n* Site-specific wrap for foreign extension/environment causes — passthrough\n* when already structured; never a boundary fallback (base-type rule 6(ii)).\n*/\nfunction toStructured(code, error) {\n\treturn CliStructuredError.is(error) ? error : new CliStructuredError(code, error instanceof Error ? error.message : String(error), { cause: error });\n}\n/** A failed executor import: an environmental failure of the consumer's\n* installed tree, not a bug here. The import error rides as the cause. */\nfunction executorLoadFailure(operation, error) {\n\treturn new CliStructuredError(\"DEPS.EXECUTOR_UNLOADABLE\", `Could not load the ${operation} executor: ${error instanceof Error ? error.message : String(error)}`, {\n\t\twhy: `The ${operation} operation's executor imports the deploy engine's provider tree from your app's installed dependencies, and that import failed.`,\n\t\tfix: \"Reinstall your dependencies, and check that `alchemy` is installed and loadable from your app.\",\n\t\tcause: error\n\t});\n}\nconst RUN_OF = {\n\tdeploy: {\n\t\trunning: \"this deploy\",\n\t\truns: \"the deploy\"\n\t},\n\tdestroy: {\n\t\trunning: \"this destroy\",\n\t\truns: \"the destroy\"\n\t},\n\tdev: {\n\t\trunning: \"`prisma dev`\",\n\t\truns: \"`prisma dev`\"\n\t}\n};\n/**\n* An extension older than this Composer stores the input it is given but\n* resolves from a key without `environment`, so it may read every name as\n* production, or, locally, put every environment in one copy. Its\n* `deserialize` rebuilds only the fields it knows, so the container the\n* Alchemy child rebuilds shows which environment it really resolved.\n* Refusing here keeps a mismatched install from deploying into, destroying\n* or running the wrong place.\n*/\nfunction requireContainerForEnvironment(action, extensionId, descriptor, instance, environment) {\n\tlet rebuiltEnvironment;\n\ttry {\n\t\trebuiltEnvironment = descriptor.deserialize(instance.serialize()).input.environment;\n\t} catch {\n\t\trebuiltEnvironment = void 0;\n\t}\n\tif (rebuiltEnvironment === environment) return;\n\tconst { running, runs } = RUN_OF[action];\n\tthrow new CliStructuredError(\"DEPS.EXTENSION_INCOMPATIBLE\", `The extension ${extensionId} is older than the Composer running ${running}, so it would not resolve the environment ${environment}.`, { fix: `Install the same Composer version of ${extensionId} as the Composer that runs ${runs}.` });\n}\n//#endregion\n//#region src/operations/deploy.ts\n/** The environment `deploy` targets when none is named. */\nconst DEFAULT_DEPLOY_ENVIRONMENT = \"production\";\nasync function deploy(input) {\n\treturn deployWithDeps(input, {});\n}\n/** In-package variant threading the injection seam, which the family's\n* commands and the unit tests use. Deliberately NOT re-exported through `./control` — the seam mirrors\n* internal types and is not part of the published surface. */\nasync function deployWithDeps(input, deps) {\n\tconst startedAt = performance.now();\n\tconst cwd = input.cwd ?? process.cwd();\n\tlet executor;\n\ttry {\n\t\texecutor = await import(\"./execute-deploy-destroy-CNt-xpE7.mjs\");\n\t} catch (error) {\n\t\treturn notOk(executorLoadFailure(\"deploy\", error));\n\t}\n\tconst result = await executor.executeDeploy(input, deps, cwd);\n\tif (!result.ok) return result;\n\treturn ok({\n\t\t...result.value,\n\t\tdurationMs: Math.round(performance.now() - startedAt)\n\t});\n}\n//#endregion\n//#region src/operations/dev.ts\nasync function dev(input) {\n\treturn devWithDeps(input, {});\n}\n/** In-package variant threading the injection seam, which the family's\n* commands and the unit tests use. Deliberately NOT re-exported through `./control` — the seam mirrors\n* internal types and is not part of the published surface. */\nasync function devWithDeps(input, deps) {\n\tconst cwd = input.cwd ?? process.cwd();\n\tlet executor;\n\ttry {\n\t\texecutor = await import(\"./execute-dev-BUk-XWBJ.mjs\");\n\t} catch (error) {\n\t\treturn notOk(executorLoadFailure(\"dev\", error));\n\t}\n\treturn executor.executeDev(input, deps, cwd);\n}\n//#endregion\n//#region src/operations/dev-current.ts\nasync function loadExecutor(operation) {\n\ttry {\n\t\treturn ok(await import(\"./execute-dev-current-BdEqeKAB.mjs\"));\n\t} catch (error) {\n\t\treturn notOk(executorLoadFailure(operation, error));\n\t}\n}\n/** Where the node at `input.address` runs locally in the environment. */\nasync function devUrl(input) {\n\tconst executor = await loadExecutor(\"dev url\");\n\tif (!executor.ok) return executor;\n\treturn executor.value.executeDevUrl(input, input.cwd ?? process.cwd());\n}\n/** Stops the app's local copy in the environment: its service processes and database servers. Data and ports stay. */\nasync function devStop(input) {\n\tconst executor = await loadExecutor(\"dev stop\");\n\tif (!executor.ok) return executor;\n\treturn executor.value.executeDevStop(input, input.cwd ?? process.cwd());\n}\n//#endregion\nexport { DEFAULT_DEPLOY_ENVIRONMENT as a, executionDiagnostics as c, toStructured as d, devWithDeps as i, executorLoadFailure as l, devUrl as n, deploy as o, dev as r, deployWithDeps as s, devStop as t, requireContainerForEnvironment as u };\n\n//# sourceMappingURL=dev-current-Brb4qugP.mjs.map"],"mappings":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-0,0 +1,71 @@
|
|
|
1
|
+
import { c as CliStructuredError } from "./run-alchemy-Dl_MWw4g-DaWV9tkH.mjs";
|
|
2
|
+
import { r as isBuildOnlyExtension, t as DEV_ENVIRONMENT_NAME_FILE } from "./app-config-CErnR6NK-6QjHJ7q5.mjs";
|
|
3
|
+
import * as fs from "node:fs";
|
|
4
|
+
import * as path from "node:path";
|
|
5
|
+
import "effect/Layer";
|
|
6
|
+
import "alchemy/State/LocalState";
|
|
7
|
+
//#region ../../0-framework/1-core/core/dist/local-target.mjs
|
|
8
|
+
/** The local-target stack's own provider aggregation (ADR-0041; naming, operator 2026-07-23 — the seam is `localTarget`, "dev" names the user-facing feature only) — the local-target counterpart of `deploy.ts`'s `mergedProviders`, kept in its own module so `lower()` learns nothing about it (deploy.ts's REVISED — operator review of #162). */
|
|
9
|
+
function noLocalTargetSupportError(id) {
|
|
10
|
+
return new CliStructuredError("DEV.TARGET_UNSUPPORTED", `extension "${id}" has no dev support — it declares no \`localTarget\` descriptor (ADR-0041).`);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Resolves every non-build-only configured extension's lazy `localTarget`
|
|
14
|
+
* thunk, once (ADR-0041's lazy local-target reference — operator directive:
|
|
15
|
+
* the production control entry carries only the thunk, never the
|
|
16
|
+
* descriptor, so resolving it is this module's job, not something a deploy
|
|
17
|
+
* path ever does). A build-only extension (`isBuildOnlyExtension`) owns no
|
|
18
|
+
* resources or services and is skipped entirely — never even checked for a
|
|
19
|
+
* `localTarget` thunk. Every other configured extension must be
|
|
20
|
+
* local-target-capable, or the dev command cannot bring the app up at all,
|
|
21
|
+
* so a missing thunk throws naming the extension. The generated dev stack
|
|
22
|
+
* module calls this once and threads the resolved map through every
|
|
23
|
+
* subsequent hook, including `localTargetProviders`.
|
|
24
|
+
*/
|
|
25
|
+
async function resolveLocalTargets(config) {
|
|
26
|
+
const entries = await Promise.all(config.extensions.flatMap((extension) => {
|
|
27
|
+
if (isBuildOnlyExtension(extension)) return [];
|
|
28
|
+
if (extension.localTarget === void 0) throw noLocalTargetSupportError(extension.id);
|
|
29
|
+
return [extension.localTarget().then((descriptor) => [extension.id, descriptor])];
|
|
30
|
+
}));
|
|
31
|
+
return new Map(entries);
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region ../../0-framework/3-tooling/cli/dist/dev-environment-name-6eEr5PW8.mjs
|
|
35
|
+
/**
|
|
36
|
+
* Each environment's folder records the environment's exact name. On a
|
|
37
|
+
* case-insensitive filesystem `--environment Dev` would otherwise open the
|
|
38
|
+
* folder of `dev` and run, or `--fresh` delete, that copy.
|
|
39
|
+
*/
|
|
40
|
+
function recordedName(devDir) {
|
|
41
|
+
const file = path.join(devDir, DEV_ENVIRONMENT_NAME_FILE);
|
|
42
|
+
return fs.existsSync(file) ? fs.readFileSync(file, "utf8").trim() : void 0;
|
|
43
|
+
}
|
|
44
|
+
function nameMismatch(devDir, recorded, environment) {
|
|
45
|
+
return new CliStructuredError("DEV.ENVIRONMENT_NAME_MISMATCH", `The folder ${devDir} holds the local copy of the environment ${recorded}, not ${environment}.`, {
|
|
46
|
+
why: "On a case-insensitive filesystem, such as the default on macOS, environment names that differ only in case share one folder, so they cannot be separate local copies.",
|
|
47
|
+
fix: `Pass \`--environment ${recorded}\` for that copy, or pick a name that differs from ${recorded} by more than case.`,
|
|
48
|
+
meta: {
|
|
49
|
+
devDir,
|
|
50
|
+
recorded,
|
|
51
|
+
environment
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
/** Fails when the folder records another environment's name; a folder with no name recorded passes. */
|
|
56
|
+
function requireDevEnvironmentName(devDir, environment) {
|
|
57
|
+
const recorded = recordedName(devDir);
|
|
58
|
+
if (recorded !== void 0 && recorded !== environment) throw nameMismatch(devDir, recorded, environment);
|
|
59
|
+
}
|
|
60
|
+
/** Records the environment's name in its folder on first use; fails when the folder records another name. */
|
|
61
|
+
function claimDevEnvironmentName(devDir, environment) {
|
|
62
|
+
const recorded = recordedName(devDir);
|
|
63
|
+
if (recorded === environment) return;
|
|
64
|
+
if (recorded !== void 0) throw nameMismatch(devDir, recorded, environment);
|
|
65
|
+
fs.mkdirSync(devDir, { recursive: true });
|
|
66
|
+
fs.writeFileSync(path.join(devDir, DEV_ENVIRONMENT_NAME_FILE), `${environment}\n`);
|
|
67
|
+
}
|
|
68
|
+
//#endregion
|
|
69
|
+
export { requireDevEnvironmentName as n, resolveLocalTargets as r, claimDevEnvironmentName as t };
|
|
70
|
+
|
|
71
|
+
//# sourceMappingURL=dev-environment-name-6eEr5PW8-lIZmJjfr.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev-environment-name-6eEr5PW8-lIZmJjfr.mjs","names":[],"sources":["../../../0-framework/1-core/core/dist/local-target.mjs","../../../0-framework/3-tooling/cli/dist/dev-environment-name-6eEr5PW8.mjs"],"sourcesContent":["import { a as isBuildOnlyExtension, i as devEnvironmentDir, n as DEV_ENVIRONMENT_NAME_FILE, t as DEV_DIR } from \"./app-config-CErnR6NK.mjs\";\nimport { CliStructuredError } from \"@internal/foundation/errors\";\nimport * as Layer from \"effect/Layer\";\nimport { localState } from \"alchemy/State/LocalState\";\n//#region src/control/local-target.ts\n/** The local-target stack's own provider aggregation (ADR-0041; naming, operator 2026-07-23 — the seam is `localTarget`, \"dev\" names the user-facing feature only) — the local-target counterpart of `deploy.ts`'s `mergedProviders`, kept in its own module so `lower()` learns nothing about it (deploy.ts's REVISED — operator review of #162). */\nfunction noLocalTargetSupportError(id) {\n\treturn new CliStructuredError(\"DEV.TARGET_UNSUPPORTED\", `extension \"${id}\" has no dev support — it declares no \\`localTarget\\` descriptor (ADR-0041).`);\n}\n/**\n* Resolves every non-build-only configured extension's lazy `localTarget`\n* thunk, once (ADR-0041's lazy local-target reference — operator directive:\n* the production control entry carries only the thunk, never the\n* descriptor, so resolving it is this module's job, not something a deploy\n* path ever does). A build-only extension (`isBuildOnlyExtension`) owns no\n* resources or services and is skipped entirely — never even checked for a\n* `localTarget` thunk. Every other configured extension must be\n* local-target-capable, or the dev command cannot bring the app up at all,\n* so a missing thunk throws naming the extension. The generated dev stack\n* module calls this once and threads the resolved map through every\n* subsequent hook, including `localTargetProviders`.\n*/\nasync function resolveLocalTargets(config) {\n\tconst entries = await Promise.all(config.extensions.flatMap((extension) => {\n\t\tif (isBuildOnlyExtension(extension)) return [];\n\t\tif (extension.localTarget === void 0) throw noLocalTargetSupportError(extension.id);\n\t\treturn [extension.localTarget().then((descriptor) => [extension.id, descriptor])];\n\t}));\n\treturn new Map(entries);\n}\n/**\n* All configured extensions' local-target providers merged, config array\n* order (ADR-0041), from the ALREADY-RESOLVED descriptor map\n* (`resolveLocalTargets`'s product — this function itself never touches a\n* `localTarget` thunk). The generated dev stack module is this\n* aggregator's one caller, passing the result as `LowerOptions.providers`.\n*/\nfunction localTargetProviders(resolved, containers, devDir) {\n\tconst [first, ...rest] = [...resolved.entries()].map(([id, descriptor]) => descriptor.providers({\n\t\tcontainer: containers.get(id),\n\t\tdevDir\n\t}));\n\treturn first === void 0 ? Layer.empty : Layer.mergeAll(first, ...rest);\n}\n/** The state store `prisma dev` converges against: Alchemy's file store in the app's working directory. */\nfunction devState() {\n\treturn localState();\n}\n//#endregion\nexport { DEV_DIR, DEV_ENVIRONMENT_NAME_FILE, devEnvironmentDir, devState, localTargetProviders, resolveLocalTargets };\n\n//# sourceMappingURL=local-target.mjs.map","import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { CliStructuredError } from \"@internal/foundation/errors\";\nimport { DEV_ENVIRONMENT_NAME_FILE } from \"@internal/core/local-target\";\n//#region src/operations/dev-environment-name.ts\n/**\n* Each environment's folder records the environment's exact name. On a\n* case-insensitive filesystem `--environment Dev` would otherwise open the\n* folder of `dev` and run, or `--fresh` delete, that copy.\n*/\nfunction recordedName(devDir) {\n\tconst file = path.join(devDir, DEV_ENVIRONMENT_NAME_FILE);\n\treturn fs.existsSync(file) ? fs.readFileSync(file, \"utf8\").trim() : void 0;\n}\nfunction nameMismatch(devDir, recorded, environment) {\n\treturn new CliStructuredError(\"DEV.ENVIRONMENT_NAME_MISMATCH\", `The folder ${devDir} holds the local copy of the environment ${recorded}, not ${environment}.`, {\n\t\twhy: \"On a case-insensitive filesystem, such as the default on macOS, environment names that differ only in case share one folder, so they cannot be separate local copies.\",\n\t\tfix: `Pass \\`--environment ${recorded}\\` for that copy, or pick a name that differs from ${recorded} by more than case.`,\n\t\tmeta: {\n\t\t\tdevDir,\n\t\t\trecorded,\n\t\t\tenvironment\n\t\t}\n\t});\n}\n/** Fails when the folder records another environment's name; a folder with no name recorded passes. */\nfunction requireDevEnvironmentName(devDir, environment) {\n\tconst recorded = recordedName(devDir);\n\tif (recorded !== void 0 && recorded !== environment) throw nameMismatch(devDir, recorded, environment);\n}\n/** Records the environment's name in its folder on first use; fails when the folder records another name. */\nfunction claimDevEnvironmentName(devDir, environment) {\n\tconst recorded = recordedName(devDir);\n\tif (recorded === environment) return;\n\tif (recorded !== void 0) throw nameMismatch(devDir, recorded, environment);\n\tfs.mkdirSync(devDir, { recursive: true });\n\tfs.writeFileSync(path.join(devDir, DEV_ENVIRONMENT_NAME_FILE), `${environment}\\n`);\n}\n//#endregion\nexport { requireDevEnvironmentName as n, claimDevEnvironmentName as t };\n\n//# sourceMappingURL=dev-environment-name-6eEr5PW8.mjs.map"],"mappings":";;;;;;;;AAMA,SAAS,0BAA0B,IAAI;CACtC,OAAO,IAAI,mBAAmB,0BAA0B,cAAc,GAAG,6EAA6E;AACvJ;;;;;;;;;;;;;;AAcA,eAAe,oBAAoB,QAAQ;CAC1C,MAAM,UAAU,MAAM,QAAQ,IAAI,OAAO,WAAW,SAAS,cAAc;EAC1E,IAAI,qBAAqB,SAAS,GAAG,OAAO,CAAC;EAC7C,IAAI,UAAU,gBAAgB,KAAK,GAAG,MAAM,0BAA0B,UAAU,EAAE;EAClF,OAAO,CAAC,UAAU,YAAY,CAAC,CAAC,MAAM,eAA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