@prisma/composer 0.39.0-dev.3 → 0.39.0-dev.5
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-CxdIiCvU-7vQWECm1.d.mts → app-config-Ubi4CftJ-DUSDjI2i.d.mts} +58 -57
- package/dist/app-config-Ubi4CftJ-DUSDjI2i.d.mts.map +1 -0
- package/dist/{app-configuration-file-Cw9autUL-DebaEvDz.mjs → app-configuration-file-Bbfq5PR3-D4DUNKUM.mjs} +40 -40
- package/dist/app-configuration-file-Bbfq5PR3-D4DUNKUM.mjs.map +1 -0
- package/dist/config-BmRE_eTa.d.mts +1 -0
- package/dist/config.d.mts +3 -3
- package/dist/config.mjs +2 -2
- package/dist/control.d.mts +21 -8
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +3 -3
- package/dist/control.mjs.map +1 -1
- package/dist/converge-in-process-BBBeood8-C7VG5b35.d.mts +67 -0
- package/dist/converge-in-process-BBBeood8-C7VG5b35.d.mts.map +1 -0
- package/dist/deploy-BW_F4Y9W.d.mts +12 -0
- package/dist/deploy-BW_F4Y9W.d.mts.map +1 -0
- package/dist/{deploy-BzRRAmns.mjs → deploy-NArSOken.mjs} +65 -16
- package/dist/deploy-NArSOken.mjs.map +1 -0
- package/dist/deploy.d.mts +3 -3
- package/dist/deploy.mjs +3 -3
- package/dist/{deployment-summary-p88NV5m5-3Ga91LRH.d.mts → deployment-summary-6LgQDUuu-DtCvw9UQ.d.mts} +7 -4
- package/dist/deployment-summary-6LgQDUuu-DtCvw9UQ.d.mts.map +1 -0
- package/dist/{deployment-summary-B6rYxEZe-E4IIcngK.mjs → deployment-summary-YP7eMPJI-CQsj7BHh.mjs} +16 -44
- package/dist/deployment-summary-YP7eMPJI-CQsj7BHh.mjs.map +1 -0
- package/dist/{dev-current-D8GwJQex-C8F3EUBY.mjs → dev-current-Dp3jvXGN-C1Y2BAtC.mjs} +5 -5
- package/dist/{dev-current-D8GwJQex-C8F3EUBY.mjs.map → dev-current-Dp3jvXGN-C1Y2BAtC.mjs.map} +1 -1
- package/dist/{dist-BN9EXWWX.mjs → dist-BxtsHOfP.mjs} +2 -2
- package/dist/{dist-BN9EXWWX.mjs.map → dist-BxtsHOfP.mjs.map} +1 -1
- package/dist/{execute-deploy-destroy-1SIH5uAu-DVRY18xU.mjs → execute-deploy-destroy-J0buFSWK-BhVTX4-E.mjs} +272 -36
- package/dist/execute-deploy-destroy-J0buFSWK-BhVTX4-E.mjs.map +1 -0
- package/dist/{execute-dev-xPaS5SAl-BUeHjmYV.mjs → execute-dev-B5YaMqpD-BAxU6Smm.mjs} +10 -11
- package/dist/{execute-dev-xPaS5SAl-BUeHjmYV.mjs.map → execute-dev-B5YaMqpD-BAxU6Smm.mjs.map} +1 -1
- package/dist/{execute-dev-current-DsAsDBB1-DwfOidWf.mjs → execute-dev-current-C7le-kh2-BoUej3LZ.mjs} +4 -4
- package/dist/{execute-dev-current-DsAsDBB1-DwfOidWf.mjs.map → execute-dev-current-C7le-kh2-BoUej3LZ.mjs.map} +1 -1
- package/dist/{execute-log-Be9DYRI6-WnytA3d7.mjs → execute-log-BcmA2gDv-CPrOZtEh.mjs} +4 -4
- package/dist/{execute-log-Be9DYRI6-WnytA3d7.mjs.map → execute-log-BcmA2gDv-CPrOZtEh.mjs.map} +1 -1
- package/dist/{graph-K7VOpCAj-D6UHSltu.mjs → graph-C6Fqe2gn-DMa2udEA.mjs} +4 -4
- package/dist/graph-C6Fqe2gn-DMa2udEA.mjs.map +1 -0
- package/dist/http.mjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/internal-app-configuration-file.d.mts +4 -4
- package/dist/internal-app-configuration-file.d.mts.map +1 -1
- package/dist/internal-app-configuration-file.mjs +1 -1
- package/dist/internal-converge-contract.d.mts +14 -0
- package/dist/internal-converge-contract.d.mts.map +1 -0
- package/dist/internal-converge-contract.mjs +14 -0
- package/dist/internal-converge-contract.mjs.map +1 -0
- package/dist/internal-converge.d.mts +4 -0
- package/dist/internal-converge.mjs +228 -0
- package/dist/internal-converge.mjs.map +1 -0
- package/dist/local-target.d.mts +1 -1
- package/dist/nextjs-control.d.mts +3 -3
- package/dist/node-control.d.mts +3 -3
- package/dist/{preflight-transport-DJjTWvyH-CEJ9WlaN.mjs → preflight-transport-C7_3abXW-Bza_hn9G.mjs} +3 -39
- package/dist/preflight-transport-C7_3abXW-Bza_hn9G.mjs.map +1 -0
- package/dist/{redaction-CqdeMBKw-BECjU4HR.d.mts → redaction-CIaE4m9U-DJGrkcn3.d.mts} +7 -6
- package/dist/redaction-CIaE4m9U-DJGrkcn3.d.mts.map +1 -0
- package/dist/{redaction-C-NnlVUh-B1nJc6rb.mjs → redaction-CjMYXtGp-CEQ5z1PK.mjs} +17 -6
- package/dist/redaction-CjMYXtGp-CEQ5z1PK.mjs.map +1 -0
- package/dist/report.d.mts +3 -3
- package/dist/report.mjs +2 -2
- package/dist/report.mjs.map +1 -1
- package/dist/{run-alchemy-CyciV8i0-BxPAyrch.mjs → run-alchemy-BlYyc4Oh-mIzYC4lq.mjs} +3 -3
- package/dist/{run-alchemy-CyciV8i0-BxPAyrch.mjs.map → run-alchemy-BlYyc4Oh-mIzYC4lq.mjs.map} +1 -1
- package/dist/service-rpc.mjs +2 -2
- package/dist/{validate-environment-DyW59rJ7-u8hQkzuY.mjs → validate-environment-XwVDifWN-BhPOzWN8.mjs} +6 -6
- package/dist/{validate-environment-DyW59rJ7-u8hQkzuY.mjs.map → validate-environment-XwVDifWN-BhPOzWN8.mjs.map} +1 -1
- package/package.json +15 -13
- package/skills/prisma-composer-core-concepts/SKILL.md +9 -23
- package/src/exports/internal-converge-contract.ts +1 -0
- package/src/exports/internal-converge.ts +1 -0
- package/dist/app-config-CxdIiCvU-7vQWECm1.d.mts.map +0 -1
- package/dist/app-configuration-file-Cw9autUL-DebaEvDz.mjs.map +0 -1
- package/dist/config-BcT6edff.d.mts +0 -1
- package/dist/deploy-BzRRAmns.mjs.map +0 -1
- package/dist/deploy-D7NHGXag.d.mts +0 -2
- package/dist/deployment-summary-B6rYxEZe-E4IIcngK.mjs.map +0 -1
- package/dist/deployment-summary-p88NV5m5-3Ga91LRH.d.mts.map +0 -1
- package/dist/execute-deploy-destroy-1SIH5uAu-DVRY18xU.mjs.map +0 -1
- package/dist/graph-K7VOpCAj-D6UHSltu.mjs.map +0 -1
- package/dist/preflight-transport-DJjTWvyH-CEJ9WlaN.mjs.map +0 -1
- package/dist/redaction-C-NnlVUh-B1nJc6rb.mjs.map +0 -1
- package/dist/redaction-CqdeMBKw-BECjU4HR.d.mts.map +0 -1
|
@@ -5,18 +5,21 @@ import { Input, StackServices } from "alchemy";
|
|
|
5
5
|
import * as Effect from "effect/Effect";
|
|
6
6
|
import * as Layer from "effect/Layer";
|
|
7
7
|
import { State } from "alchemy/State/State";
|
|
8
|
-
//#region ../../0-framework/1-core/core/dist/app-config-
|
|
9
|
-
//#region src/
|
|
8
|
+
//#region ../../0-framework/1-core/core/dist/app-config-Ubi4CftJ.d.mts
|
|
9
|
+
//#region src/caller-credentials.d.ts
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* from scratch and needs those containers back — and env vars are the only
|
|
15
|
-
* channel between the two. So the CLI writes each instance's `serialize()`
|
|
16
|
-
* output into one env var per extension, and in the alchemy process
|
|
17
|
-
* `deserializeContainers` reads each var back through the same extension's
|
|
18
|
-
* descriptor. The framework owns the vars; it never reads their contents.
|
|
11
|
+
* What the caller has already authenticated, handed unchanged to every
|
|
12
|
+
* extension hook that talks to the platform. `C` is the extension's own client
|
|
13
|
+
* type: this module cannot import a platform SDK.
|
|
19
14
|
*/
|
|
15
|
+
interface CallerCredentials<C = unknown> {
|
|
16
|
+
/** The workspace the caller acts in. `undefined` when the caller has no workspace to name — the extension decides whether it can proceed. */
|
|
17
|
+
readonly workspaceId: string | undefined;
|
|
18
|
+
/** An already-authenticated platform API client. Present means the extension must not build its own from the environment. */
|
|
19
|
+
readonly client?: C | undefined;
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/container-transport.d.ts
|
|
20
23
|
/** The key an extension resolves a container from: which app, which environment. */
|
|
21
24
|
interface LocateContainerInput {
|
|
22
25
|
/** The application name (root node's name, or `--name`). */
|
|
@@ -36,25 +39,6 @@ interface ContainerInstance {
|
|
|
36
39
|
/** Serialize to a non-empty string for the process transport above. The format is the extension's own; only its `deserialize` reads it. */
|
|
37
40
|
serialize(): string;
|
|
38
41
|
}
|
|
39
|
-
/**
|
|
40
|
-
* What the caller has already authenticated, handed to one container
|
|
41
|
-
* lifecycle call. A caller that holds neither omits the argument, and the
|
|
42
|
-
* extension falls back to whatever credential protocol it defines for
|
|
43
|
-
* itself (for Prisma Cloud, its env vars — which is how the alchemy child
|
|
44
|
-
* process still resolves containers).
|
|
45
|
-
*
|
|
46
|
-
* `C` is the extension's own platform-client type, left as a type parameter
|
|
47
|
-
* because this shared-plane module must not import a platform SDK; the
|
|
48
|
-
* framework only carries the value, never calls it. The framework stores the
|
|
49
|
-
* erased `C = unknown` form and the extension recovers its concrete client
|
|
50
|
-
* through the same method bivariance that erases `I` below.
|
|
51
|
-
*/
|
|
52
|
-
interface ContainerCredentials<C = unknown> {
|
|
53
|
-
/** The workspace the container lives in. `undefined` when the caller has no workspace to name — the extension decides whether it can proceed. */
|
|
54
|
-
readonly workspaceId: string | undefined;
|
|
55
|
-
/** An already-authenticated platform API client. Present means the extension must not build its own from the environment. */
|
|
56
|
-
readonly client?: C | undefined;
|
|
57
|
-
}
|
|
58
42
|
/**
|
|
59
43
|
* The platform containers an app deploys into, as one lifecycle. `I` is
|
|
60
44
|
* the extension's own instance type — the same descriptor produces and
|
|
@@ -67,11 +51,11 @@ interface ContainerCredentials<C = unknown> {
|
|
|
67
51
|
*/
|
|
68
52
|
interface ContainerDescriptor<I extends ContainerInstance = ContainerInstance, C = unknown> {
|
|
69
53
|
/** Resolve the container for (appName, environment), creating anything absent. Called by `deploy`. */
|
|
70
|
-
ensure(input: LocateContainerInput, credentials?:
|
|
54
|
+
ensure(input: LocateContainerInput, credentials?: CallerCredentials<C>): Promise<I>;
|
|
71
55
|
/** Find the container for (appName, environment); `undefined` when nothing exists. Called by `destroy` — never creates. */
|
|
72
|
-
locate(input: LocateContainerInput, credentials?:
|
|
56
|
+
locate(input: LocateContainerInput, credentials?: CallerCredentials<C>): Promise<I | undefined>;
|
|
73
57
|
/** Remove the container after a successful destroy, after every extension's `teardown` has run. Failure policy is the extension's. */
|
|
74
|
-
remove(instance: I, credentials?:
|
|
58
|
+
remove(instance: I, credentials?: CallerCredentials<C>): Promise<void>;
|
|
75
59
|
/** Reconstruct an instance from its own `serialize()` output — the far end of the framework's parent→child transport. */
|
|
76
60
|
deserialize(serialized: string): I;
|
|
77
61
|
}
|
|
@@ -121,12 +105,6 @@ interface PreflightFindings {
|
|
|
121
105
|
}
|
|
122
106
|
/** One reader as the deploy prints it, for example `read by service "shop.email", field "apiKey"`. */
|
|
123
107
|
declare function platformVariableReaderText(reader: PlatformVariableReader): string;
|
|
124
|
-
/** The variable that carries every extension's deploy preflight findings from the first process to the second. No extension's preflight variable may take this name. */
|
|
125
|
-
declare const PREFLIGHT_FINDINGS_ENV_VAR = "PRISMA_COMPOSER_PREFLIGHT_FINDINGS";
|
|
126
|
-
/** The env entry the CLI sets on the second process. It is always set, and empty when nothing was found, so a stale value in the shell never reads as this run's. */
|
|
127
|
-
declare function preflightFindingsEnv(findings: PreflightFindings): Record<string, string>;
|
|
128
|
-
/** The second process's side: the findings the CLI carried, or none. Throws on a value that does not decode: that is a framework bug. */
|
|
129
|
-
declare function readPreflightFindings(env: Readonly<Record<string, string | undefined>>): PreflightFindings;
|
|
130
108
|
//#endregion
|
|
131
109
|
//#region src/control/deploy.d.ts
|
|
132
110
|
/** The Layer shape every Alchemy state store must satisfy — what `LowerOptions.state` and `PrismaAppConfig.state` both traffic in. */
|
|
@@ -227,12 +205,13 @@ interface LowerContext {
|
|
|
227
205
|
*/
|
|
228
206
|
readonly application: unknown;
|
|
229
207
|
/**
|
|
230
|
-
* The owning extension's resolved container
|
|
231
|
-
*
|
|
232
|
-
*
|
|
233
|
-
* container descriptor.
|
|
208
|
+
* The owning extension's resolved container; core never reads it — the
|
|
209
|
+
* extension narrows it with its own type guard. `undefined` when the
|
|
210
|
+
* extension declares no container descriptor.
|
|
234
211
|
*/
|
|
235
212
|
readonly container: ContainerInstance | undefined;
|
|
213
|
+
/** What the owning extension's preflight handed back this run; `undefined` when it returned nothing or ran no preflight. Core never reads it. */
|
|
214
|
+
readonly preflight: PreflightPayload;
|
|
236
215
|
/** Already-lowered deps (topo order). */
|
|
237
216
|
readonly lowered: ReadonlyMap<NodeId, Outputs>;
|
|
238
217
|
/** Every provisioned param value minted this lowering, keyed by edge id (ADR-0031). */
|
|
@@ -300,9 +279,9 @@ interface LowerOptions {
|
|
|
300
279
|
readonly name: string;
|
|
301
280
|
/** The environment being deployed, as `--environment` gave it. Required by any value over `environment.name`; the generated stack files always pass it. */
|
|
302
281
|
readonly environment?: string;
|
|
303
|
-
/** What the
|
|
282
|
+
/** What the caller's Load read from the app configuration (ADR-0062). Load takes the root's input from it. */
|
|
304
283
|
readonly appConfigurationRead?: AppConfigurationRead;
|
|
305
|
-
/** The node addresses of the graph the
|
|
284
|
+
/** The node addresses of the graph the caller built. When given, lowering refuses a graph whose addresses differ. */
|
|
306
285
|
readonly firstProcessNodeAddresses?: readonly string[];
|
|
307
286
|
readonly bundles: Record<string, Bundle>;
|
|
308
287
|
/** Alchemy state store for the stack. Defaults to the config's own state layer. */
|
|
@@ -319,6 +298,14 @@ interface LowerOptions {
|
|
|
319
298
|
readonly report?: (result: DeploymentResult) => void;
|
|
320
299
|
/** Addresses lowered without an artifact: `package` and `deploy` are skipped and `reserve` runs instead (ADR-0056). Only the dev stack file sets it. */
|
|
321
300
|
readonly unassembled?: readonly string[];
|
|
301
|
+
/** Each extension's resolved container, by extension id. Pass both `containers` and `preflightPayloads`, or neither. When both are absent, `lower()` reads both from the environment transports through `transportedLowerInputs(config)`. When exactly one is passed, `lower()` throws. */
|
|
302
|
+
readonly containers?: ReadonlyMap<string, ContainerInstance> | undefined;
|
|
303
|
+
/** What each extension's preflight returned, by extension id. Each lowering context gets its own extension's entry as `LowerContext.preflight`. */
|
|
304
|
+
readonly preflightPayloads?: ReadonlyMap<string, string> | undefined;
|
|
305
|
+
/** The platform variables with no value that the deploy preflight found. The deploy report carries them. Absent means none. */
|
|
306
|
+
readonly findings?: PreflightFindings;
|
|
307
|
+
/** What the caller already authenticated, handed to every extension's `providers()` and to the state descriptor's `create()`. Absent means each extension falls back to its own credential protocol. */
|
|
308
|
+
readonly credentials?: CallerCredentials | undefined;
|
|
322
309
|
}
|
|
323
310
|
/** A build descriptor's normalized output: the produced bundle dir plus the app's runnable entry within it. */
|
|
324
311
|
interface Bundle {
|
|
@@ -409,7 +396,7 @@ declare function joinDeployment(graph: Graph, entries: readonly {
|
|
|
409
396
|
address: string;
|
|
410
397
|
entities: readonly DeployedEntity[];
|
|
411
398
|
}[]): readonly DeployedNode[];
|
|
412
|
-
/** The deploy report: every deployed node joined with its graph node, and the
|
|
399
|
+
/** The deploy report: every deployed node joined with its graph node, and the deploy preflight's findings. */
|
|
413
400
|
declare function deploymentResult(app: string, graph: Graph, entries: readonly {
|
|
414
401
|
address: string;
|
|
415
402
|
entities: readonly DeployedEntity[];
|
|
@@ -427,16 +414,22 @@ declare function resolveStateLayer(opts: LowerOptions, config: PrismaAppConfig,
|
|
|
427
414
|
* extension without `providers` is skipped; no used-extensions-only
|
|
428
415
|
* filtering (ADR-0017's pinned providers rule).
|
|
429
416
|
*/
|
|
430
|
-
declare function mergedProviders(config: PrismaAppConfig): Layer.Layer<never>;
|
|
417
|
+
declare function mergedProviders(config: PrismaAppConfig, credentials?: CallerCredentials): Layer.Layer<never>;
|
|
431
418
|
/**
|
|
432
419
|
* Composable form for mixed stacks: hand-wired Alchemy resources alongside Prisma App nodes in one stack effect.
|
|
433
420
|
* Fails with LowerError or whatever an extension's lowering raises — the error type is open.
|
|
434
421
|
*/
|
|
435
422
|
declare function lowering(root: ModuleNode | AppRootNode, config: PrismaAppConfig, opts: LowerOptions): Effect.Effect<undefined, LowerError, unknown>;
|
|
423
|
+
interface TransportedLowerInputs {
|
|
424
|
+
readonly containers: ReadonlyMap<string, ContainerInstance>;
|
|
425
|
+
readonly preflightPayloads: ReadonlyMap<string, string>;
|
|
426
|
+
}
|
|
427
|
+
/** The containers and preflight payloads a host wrote into the environment of a stack file it runs as a child. */
|
|
428
|
+
declare function transportedLowerInputs(config: PrismaAppConfig): TransportedLowerInputs;
|
|
436
429
|
/**
|
|
437
430
|
* The whole-stack wrapper: Load → route each node through the config's
|
|
438
|
-
* extension registries → an Alchemy Stack
|
|
439
|
-
* CLI
|
|
431
|
+
* extension registries → an Alchemy Stack, which `deploy` hands to
|
|
432
|
+
* `Alchemist.plan` and a generated stack file exports for the alchemy CLI.
|
|
440
433
|
*/
|
|
441
434
|
declare function lower(root: ModuleNode | AppRootNode, config: PrismaAppConfig, opts: LowerOptions): Alchemy.ConfiguredStack<undefined, never>;
|
|
442
435
|
//#endregion
|
|
@@ -455,8 +448,11 @@ interface ExtensionDescriptor {
|
|
|
455
448
|
readonly provisions?: ReadonlyMap<symbol, ProvisionerDescriptor>;
|
|
456
449
|
/** Once-per-lowering hook — the application's shared infrastructure (e.g. prisma-cloud's Project). */
|
|
457
450
|
readonly application?: ApplicationDescriptor;
|
|
458
|
-
/**
|
|
459
|
-
|
|
451
|
+
/**
|
|
452
|
+
* The extension's Alchemy providers — merged across all configured extensions (config order).
|
|
453
|
+
* METHOD SYNTAX REQUIRED, like `preflight`: an extension types `input` against its own client, which assigns here only through method bivariance.
|
|
454
|
+
*/
|
|
455
|
+
providers?(input: ProvidersInput): Layer.Layer<never>;
|
|
460
456
|
/** Refuses a loaded graph this extension cannot deploy by throwing `GraphCheckError`. The CLI calls it right after Load in every command that runs Load. Any other throw is a bug. */
|
|
461
457
|
readonly checkGraph?: (graph: Graph) => void;
|
|
462
458
|
/**
|
|
@@ -524,10 +520,15 @@ interface ExtensionDescriptor {
|
|
|
524
520
|
interface StateDescriptor {
|
|
525
521
|
/** The owning extension's id — matched against `ExtensionDescriptor.id`. */
|
|
526
522
|
readonly extension: string;
|
|
527
|
-
/** Build the state layer. `container` is the owning extension's resolved instance; `undefined` when it declared no container descriptor. */
|
|
528
|
-
create(container: ContainerInstance | undefined): AlchemyStateLayer;
|
|
523
|
+
/** Build the state layer. `container` is the owning extension's resolved instance; `undefined` when it declared no container descriptor. `credentials` is as `ExtensionDescriptor.providers` receives it. */
|
|
524
|
+
create(container: ContainerInstance | undefined, credentials?: CallerCredentials): AlchemyStateLayer;
|
|
525
|
+
}
|
|
526
|
+
/** What `ExtensionDescriptor.providers` receives. `C` erases to `unknown` at the framework boundary, exactly as on `PreflightInput`. */
|
|
527
|
+
interface ProvidersInput<C = unknown> {
|
|
528
|
+
/** What the caller already authenticated (`LowerOptions.credentials`). Absent means the extension falls back to its own credential protocol. */
|
|
529
|
+
readonly credentials?: CallerCredentials<C> | undefined;
|
|
529
530
|
}
|
|
530
|
-
/** The resolved deploy context handed to an extension's `preflight` hook. `C` erases to `unknown` at the framework boundary — see
|
|
531
|
+
/** The resolved deploy context handed to an extension's `preflight` hook. `C` erases to `unknown` at the framework boundary — see CallerCredentials. */
|
|
531
532
|
interface PreflightInput<C = unknown> {
|
|
532
533
|
/** The loaded application graph — the manifest of prerequisites is read from it (`provisionManifest`). */
|
|
533
534
|
readonly graph: Graph;
|
|
@@ -540,7 +541,7 @@ interface PreflightInput<C = unknown> {
|
|
|
540
541
|
/** The app secrets the command read for this environment. */
|
|
541
542
|
readonly secrets: AppSecrets;
|
|
542
543
|
/** What the caller has already authenticated, for the platform calls preflight makes. Absent means the extension falls back to its own credential protocol. */
|
|
543
|
-
readonly credentials?:
|
|
544
|
+
readonly credentials?: CallerCredentials<C> | undefined;
|
|
544
545
|
/** Hands the deploy how many platform variables the check read and which have no value. */
|
|
545
546
|
readonly report?: ((check: PlatformVariableCheck) => void) | undefined;
|
|
546
547
|
/** Shows the user a warning that does not stop the run. Only `prisma dev` passes it and shows the warnings; deploy passes none. */
|
|
@@ -585,7 +586,7 @@ interface ReportBeginInput<C = unknown> {
|
|
|
585
586
|
*/
|
|
586
587
|
readonly reportId: string | undefined;
|
|
587
588
|
/** What the caller has already authenticated, exactly as `preflight` and the container lifecycle receive it. Present means the reporter must not build a client from the environment. */
|
|
588
|
-
readonly credentials?:
|
|
589
|
+
readonly credentials?: CallerCredentials<C> | undefined;
|
|
589
590
|
}
|
|
590
591
|
/** The deploy context handed to `RunReporter.attach`, once containers exist. */
|
|
591
592
|
interface ReportAttachInput {
|
|
@@ -862,5 +863,5 @@ interface PrismaAppConfig {
|
|
|
862
863
|
/** Typed identity — exists so the `composer` section of `prisma.config.ts` gets checked against PrismaAppConfig where it is written. */
|
|
863
864
|
declare function defineConfig(config: PrismaAppConfig): PrismaAppConfig;
|
|
864
865
|
//#endregion
|
|
865
|
-
export { ReporterDescriptor as $, LocalTargetEmulatorsInput as A, Outputs as B, LocalNodeLocation as C,
|
|
866
|
-
//# sourceMappingURL=app-config-
|
|
866
|
+
export { ReporterDescriptor as $, LocalTargetEmulatorsInput as A, Outputs as B, LocalNodeLocation as C, readPreflightPayload as Ct, LocalTargetCurrentApp as D, LocalTargetAttachment as E, LowerOptions as F, PreflightInput as G, PlatformVariableCheck as H, LoweredResult as I, ProvidersInput as J, PreflightPayload as K, Lowering as L, LocateContainerInput as M, LowerContext as N, LocalTargetCurrentInput as O, LowerError as P, ReportBeginInput as Q, NamedSecrets as R, LocalNodeCondition as S, preflightEnvVarName as St, LocalTargetAttachInput as T, transportedLowerInputs as Tt, PlatformVariableReader as U, PackageInput as V, PreflightFindings as W, ProvisionerDescriptor as X, ProvisionEdge as Y, ReportAttachInput as Z, DeployedNode as _, lower as _t, Artifact as a, TeardownInput as at, DevServer as b, platformVariableReaderText as bt, CallerCredentials as c, connectionInputs as ct, ConfigValues as d, defineConfig as dt, RunOutcome as et, ContainerDescriptor as f, deploymentResult as ft, DeployedEntity as g, joinDeployment as gt, DEV_ENVIRONMENT_NAME_FILE as h, isBuildOnlyExtension as ht, ApplicationDescriptor as i, StateDescriptor as it, LocalTargetProvidersInput as j, LocalTargetDescriptor as k, ConfigAdapter as l, containerEnv as lt, DEV_DIR as m, devEnvironmentDir as mt, AppConfiguration as n, ServeInput as nt, AssembleInput as o, UnsetPlatformVariable as ot, ContainerInstance as p, deserializeContainers as pt, PrismaAppConfig as q, AppSecrets as r, ServiceLowering as rt, Bundle as s, buildConfig as st, AlchemyStateLayer as t, RunReporter as tt, ConfigAdapterInput as u, containerEnvVarName as ut, DeploymentResult as v, lowering as vt, LocalNodeStopped as w, resolveStateLayer as wt, ExtensionDescriptor as x, preflightEnv as xt, DevPreflightResult as y, mergedProviders as yt, NodeDescriptor as z };
|
|
867
|
+
//# sourceMappingURL=app-config-Ubi4CftJ-DUSDjI2i.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-config-Ubi4CftJ-DUSDjI2i.d.mts","names":[],"sources":["../../../0-framework/1-core/core/dist/app-config-Ubi4CftJ.d.mts"],"mappings":";;;;;;;;;;;;;;UAaU,kBAAkB;;WAEjB;;WAEA,SAAS;;;;;UAKV;;WAEC;;WAEA;;;;;;;UAOD;WACC,OAAO;;WAEP;;EAET;;;;;;;;;;;;UAYQ,oBAAoB,UAAU,oBAAoB,mBAAmB;;EAE7E,OAAO,OAAO,sBAAsB,cAAc,kBAAkB,KAAK,QAAQ;;EAEjF,OAAO,OAAO,sBAAsB,cAAc,kBAAkB,KAAK,QAAQ;;EAEjF,OAAO,UAAU,GAAG,cAAc,kBAAkB,KAAK;;EAEzD,YAAY,qBAAqB;;;iBAGlB,oBAAoB;;iBAEpB,aAAa,WAAW,oBAAoB,qBAAqB;;UAExE;WACC;WACA,YAAY;;;;;;iBAMN,sBAA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A;;WAEA;WACA;;WAEA;;;;;;;;KAQN;UACK;WACC;WACA;;UAED;;WAEC,WAAW;;WAEX;;WAEA,mBAAmB,SAAS;;WAE5B,cAAc;;UAEf;;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,eAAe;;aAEf,SAAS;MAChB;aACO;;;EAGX,WAAW;;;;;;EAMX;;;cAGY;;;;;;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;;KAExB,iBAAiB,OAAO,uBAAuB,eAAe,QAAQ;;KAEtE,mBAAmB,SAAS;;KAE5B,aAAa,SAAS;;KAEtB,eAAe,SAAS;;;;;;;UAOnB;;WAEC;WACA,YAAY;WACZ,OAAO;;WAEP,kBAAkB;;WAElB,mBAAmB;;;iBAGb,aAAa,QAAQ,kBAAkB"}
|
|
@@ -2,7 +2,40 @@ import { t as CliStructuredError } from "./errors-0e8IVwzi.mjs";
|
|
|
2
2
|
import { t as DEV_DIR } from "./app-config-CErnR6NK-D9NgSBH4.mjs";
|
|
3
3
|
import * as path$1 from "node:path";
|
|
4
4
|
import * as fs$1 from "node:fs";
|
|
5
|
-
//#region ../../0-framework/3-tooling/cli/dist/app-configuration-file-
|
|
5
|
+
//#region ../../0-framework/3-tooling/cli/dist/app-configuration-file-Bbfq5PR3.mjs
|
|
6
|
+
function textIn(value, at) {
|
|
7
|
+
if (typeof value === "string") return [{
|
|
8
|
+
at,
|
|
9
|
+
text: value
|
|
10
|
+
}];
|
|
11
|
+
if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") return [{
|
|
12
|
+
at,
|
|
13
|
+
text: String(value)
|
|
14
|
+
}];
|
|
15
|
+
if (Array.isArray(value)) return value.flatMap((member, index) => textIn(member, [...at, String(index)]));
|
|
16
|
+
if (typeof value === "object" && value !== null) return Object.entries(value).flatMap(([key, member]) => textIn(member, [...at, key]));
|
|
17
|
+
return [];
|
|
18
|
+
}
|
|
19
|
+
/** Throws `CONFIG.SECRET_AS_PLAIN_VALUE` when a root input field Load read holds a known secret. */
|
|
20
|
+
function refuseSecretsInRootInput(read, knownSecrets, consequence) {
|
|
21
|
+
const readPlaces = read.rootInput.flatMap((field) => textIn(field.value, field.path).map(({ at, text }) => ({
|
|
22
|
+
where: `Root input field input.${at.join(".")}`,
|
|
23
|
+
text
|
|
24
|
+
})));
|
|
25
|
+
for (const { where, text } of readPlaces) {
|
|
26
|
+
const name = knownSecrets.nameIn(text);
|
|
27
|
+
if (name === void 0) continue;
|
|
28
|
+
throw new CliStructuredError("CONFIG.SECRET_AS_PLAIN_VALUE", `${where} holds the value of the platform secret "${name}". ${consequence}`, { fix: `Pass the value of the platform secret "${name}" to where this value is used, or give this plain value text that does not contain the value of "${name}".` });
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/** Throws `CONFIG.SECRET_AS_PLAIN_VALUE` when a plain platform variable's text holds a known secret. */
|
|
32
|
+
function refuseSecretsInPlainVariables(plainVariableText, knownSecrets) {
|
|
33
|
+
for (const [variable, text] of Object.entries(plainVariableText)) {
|
|
34
|
+
const name = knownSecrets.nameIn(text);
|
|
35
|
+
if (name === void 0) continue;
|
|
36
|
+
throw new CliStructuredError("CONFIG.SECRET_AS_PLAIN_VALUE", `The platform variable "${variable}", which prisma dev read from the \`config\` adapters, holds the value of the platform secret "${name}". Composer hands the second process every plain value in a file, and never writes a secret to a file.`, { fix: `Keep the value of "${name}" out of the platform variable "${variable}", or give "${variable}" a different value.` });
|
|
37
|
+
}
|
|
38
|
+
}
|
|
6
39
|
/** Names the app configuration file the first process wrote for this run (ADR-0062). */
|
|
7
40
|
const APP_CONFIGURATION_FILE_ENV = "PRISMA_COMPOSER_APP_CONFIGURATION_FILE";
|
|
8
41
|
/** `prisma dev` only: the named secrets, as a JSON object. */
|
|
@@ -54,47 +87,14 @@ function removeLeftoverAppConfigurationFiles(cwd) {
|
|
|
54
87
|
}
|
|
55
88
|
}
|
|
56
89
|
}
|
|
57
|
-
function textIn(value, at) {
|
|
58
|
-
if (typeof value === "string") return [{
|
|
59
|
-
at,
|
|
60
|
-
text: value
|
|
61
|
-
}];
|
|
62
|
-
if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") return [{
|
|
63
|
-
at,
|
|
64
|
-
text: String(value)
|
|
65
|
-
}];
|
|
66
|
-
if (Array.isArray(value)) return value.flatMap((member, index) => textIn(member, [...at, String(index)]));
|
|
67
|
-
if (typeof value === "object" && value !== null) return Object.entries(value).flatMap(([key, member]) => textIn(member, [...at, key]));
|
|
68
|
-
return [];
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Refuses when the file would hold a known secret in a plain value, a number or a boolean
|
|
72
|
-
* compared as its text (`KnownSecrets.nameIn`). The message names where and the secrets key,
|
|
73
|
-
* never the value.
|
|
74
|
-
*/
|
|
75
|
-
function refuseSecretsIn(read, plainVariableText, knownSecrets) {
|
|
76
|
-
const readPlaces = read.rootInput.flatMap((field) => textIn(field.value, field.path).map(({ at, text }) => ({
|
|
77
|
-
where: `Root input field input.${at.join(".")}`,
|
|
78
|
-
text
|
|
79
|
-
})));
|
|
80
|
-
for (const { where, text } of readPlaces) {
|
|
81
|
-
const name = knownSecrets.nameIn(text);
|
|
82
|
-
if (name === void 0) continue;
|
|
83
|
-
throw new CliStructuredError("CONFIG.SECRET_AS_PLAIN_VALUE", `${where} holds the value of the secret "${name}", which a platform secret in the graph reads. Composer hands the second process every plain value Load read, in a file, and never writes a secret to a file.`, { fix: `Pass the value of the platform secret "${name}" to where this value is used, or give this plain value text that does not contain the value of "${name}".` });
|
|
84
|
-
}
|
|
85
|
-
for (const [variable, text] of Object.entries(plainVariableText)) {
|
|
86
|
-
const name = knownSecrets.nameIn(text);
|
|
87
|
-
if (name === void 0) continue;
|
|
88
|
-
throw new CliStructuredError("CONFIG.SECRET_AS_PLAIN_VALUE", `The platform variable "${variable}", which prisma dev read from the \`config\` adapters, holds the value of the secret "${name}". Composer hands the second process every plain value in a file, and never writes a secret to a file.`, { fix: `Keep the value of "${name}" out of the platform variable "${variable}", or give "${variable}" a different value.` });
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
90
|
/**
|
|
92
91
|
* First process: the app configuration file and the environment the second process starts with (ADR-0062).
|
|
93
92
|
* Refuses a file that would hold any of `knownSecrets`.
|
|
94
93
|
*/
|
|
95
94
|
function prepareSecondProcess(input) {
|
|
96
95
|
const { file, appSecrets } = input;
|
|
97
|
-
|
|
96
|
+
refuseSecretsInRootInput(input.appConfigurationRead, input.knownSecrets, "Composer hands the second process every plain value Load read, in a file, and never writes a secret to a file.");
|
|
97
|
+
refuseSecretsInPlainVariables(input.plainVariableText, input.knownSecrets);
|
|
98
98
|
const contents = {
|
|
99
99
|
appConfigurationRead: input.appConfigurationRead,
|
|
100
100
|
plainVariableText: input.plainVariableText,
|
|
@@ -132,7 +132,7 @@ function prepareSecondProcess(input) {
|
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
134
|
function missingVariable(name, what) {
|
|
135
|
-
return `${name} is not set. This stack file runs as the second process of a Composer
|
|
135
|
+
return `${name} is not set. This stack file runs as the second process of a Composer destroy or prisma dev, which ${what}.`;
|
|
136
136
|
}
|
|
137
137
|
function isRecord(value) {
|
|
138
138
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -172,7 +172,7 @@ function readAppConfigurationFile(env) {
|
|
|
172
172
|
const message = cause instanceof Error ? cause.message : String(cause);
|
|
173
173
|
throw new Error(`Could not read the app configuration file ${file}: ${message}. Composer deletes it when the run ends, so a stack file run by hand after that cannot read it; run the command again.`, { cause });
|
|
174
174
|
}
|
|
175
|
-
const notComposers = (what) => /* @__PURE__ */ new Error(`The app configuration file ${file} is not
|
|
175
|
+
const notComposers = (what) => /* @__PURE__ */ new Error(`The app configuration file ${file} is not in the shape this version of Composer reads: ${what}. The usual cause is a \`prisma\` CLI and an app on different Composer versions. Put the \`prisma\` CLI and the app's \`@prisma/composer\` on the same version.`);
|
|
176
176
|
let parsed;
|
|
177
177
|
try {
|
|
178
178
|
parsed = JSON.parse(text);
|
|
@@ -211,6 +211,6 @@ function namedSecretsFromEnvironment(env) {
|
|
|
211
211
|
return Object.freeze(secrets);
|
|
212
212
|
}
|
|
213
213
|
//#endregion
|
|
214
|
-
export { readAppConfigurationFile as a, prepareSecondProcess as i, devAppConfigurationFile as n,
|
|
214
|
+
export { readAppConfigurationFile as a, prepareSecondProcess as i, devAppConfigurationFile as n, refuseSecretsInRootInput as o, namedSecretsFromEnvironment as r, removeLeftoverAppConfigurationFiles as s, deployAppConfigurationFile as t };
|
|
215
215
|
|
|
216
|
-
//# sourceMappingURL=app-configuration-file-
|
|
216
|
+
//# sourceMappingURL=app-configuration-file-Bbfq5PR3-D4DUNKUM.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-configuration-file-Bbfq5PR3-D4DUNKUM.mjs","names":["path","fs"],"sources":["../../../0-framework/3-tooling/cli/dist/app-configuration-file-Bbfq5PR3.mjs"],"sourcesContent":["import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { CliStructuredError } from \"@internal/foundation/errors\";\nimport { DEV_DIR } from \"@internal/core/config\";\n//#region src/secret-as-plain-value.ts\nfunction textIn(value, at) {\n\tif (typeof value === \"string\") return [{\n\t\tat,\n\t\ttext: value\n\t}];\n\tif (typeof value === \"number\" || typeof value === \"boolean\" || typeof value === \"bigint\") return [{\n\t\tat,\n\t\ttext: String(value)\n\t}];\n\tif (Array.isArray(value)) return value.flatMap((member, index) => textIn(member, [...at, String(index)]));\n\tif (typeof value === \"object\" && value !== null) return Object.entries(value).flatMap(([key, member]) => textIn(member, [...at, key]));\n\treturn [];\n}\n/** Throws `CONFIG.SECRET_AS_PLAIN_VALUE` when a root input field Load read holds a known secret. */\nfunction refuseSecretsInRootInput(read, knownSecrets, consequence) {\n\tconst readPlaces = read.rootInput.flatMap((field) => textIn(field.value, field.path).map(({ at, text }) => ({\n\t\twhere: `Root input field input.${at.join(\".\")}`,\n\t\ttext\n\t})));\n\tfor (const { where, text } of readPlaces) {\n\t\tconst name = knownSecrets.nameIn(text);\n\t\tif (name === void 0) continue;\n\t\tthrow new CliStructuredError(\"CONFIG.SECRET_AS_PLAIN_VALUE\", `${where} holds the value of the platform secret \"${name}\". ${consequence}`, { fix: `Pass the value of the platform secret \"${name}\" to where this value is used, or give this plain value text that does not contain the value of \"${name}\".` });\n\t}\n}\n/** Throws `CONFIG.SECRET_AS_PLAIN_VALUE` when a plain platform variable's text holds a known secret. */\nfunction refuseSecretsInPlainVariables(plainVariableText, knownSecrets) {\n\tfor (const [variable, text] of Object.entries(plainVariableText)) {\n\t\tconst name = knownSecrets.nameIn(text);\n\t\tif (name === void 0) continue;\n\t\tthrow new CliStructuredError(\"CONFIG.SECRET_AS_PLAIN_VALUE\", `The platform variable \"${variable}\", which prisma dev read from the \\`config\\` adapters, holds the value of the platform secret \"${name}\". Composer hands the second process every plain value in a file, and never writes a secret to a file.`, { fix: `Keep the value of \"${name}\" out of the platform variable \"${variable}\", or give \"${variable}\" a different value.` });\n\t}\n}\n//#endregion\n//#region src/app-configuration-file.ts\n/** Names the app configuration file the first process wrote for this run (ADR-0062). */\nconst APP_CONFIGURATION_FILE_ENV = \"PRISMA_COMPOSER_APP_CONFIGURATION_FILE\";\n/** `prisma dev` only: the named secrets, as a JSON object. */\nconst NAMED_SECRETS_ENV = \"PRISMA_COMPOSER_NAMED_SECRETS\";\nconst FILE_NAME = /^app-configuration-(\\d+)(-[^/]*)?\\.json$/;\n/** The app configuration file a deploy or destroy run writes: unique per run, so concurrent runs from one checkout never share one. */\nfunction deployAppConfigurationFile(cwd, runId) {\n\treturn path.join(cwd, \".prisma-composer\", `app-configuration-${String(process.pid)}-${runId}.json`);\n}\n/** The app configuration file `prisma dev` writes in an environment's folder. */\nfunction devAppConfigurationFile(devDir) {\n\treturn path.join(devDir, `app-configuration-${String(process.pid)}.json`);\n}\nfunction isRunning(pid) {\n\ttry {\n\t\tprocess.kill(pid, 0);\n\t\treturn true;\n\t} catch (error) {\n\t\treturn error instanceof Error && \"code\" in error && error.code === \"EPERM\";\n\t}\n}\n/**\n* Deletes the app configuration files that earlier runs left in `.prisma-composer/` and in\n* each dev environment's folder: a run killed before its exit handler ran leaves its file. A\n* file is deleted only when its process is not running and it is older than\n* `LEFTOVER_APP_CONFIGURATION_FILE_AGE_MS`. Never throws.\n*/\nfunction removeLeftoverAppConfigurationFiles(cwd) {\n\tconst devRoot = path.join(cwd, DEV_DIR);\n\tconst dirs = [path.join(cwd, \".prisma-composer\")];\n\ttry {\n\t\tfor (const entry of fs.readdirSync(devRoot, { withFileTypes: true })) if (entry.isDirectory()) dirs.push(path.join(devRoot, entry.name));\n\t} catch {}\n\tfor (const dir of dirs) {\n\t\tlet names;\n\t\ttry {\n\t\t\tnames = fs.readdirSync(dir);\n\t\t} catch {\n\t\t\tcontinue;\n\t\t}\n\t\tfor (const name of names) {\n\t\t\tconst pid = Number(FILE_NAME.exec(name)?.[1]);\n\t\t\tif (Number.isNaN(pid) || pid === process.pid || isRunning(pid)) continue;\n\t\t\tconst file = path.join(dir, name);\n\t\t\ttry {\n\t\t\t\tif (Date.now() - fs.statSync(file).mtimeMs < 6e5) continue;\n\t\t\t\tfs.rmSync(file, { force: true });\n\t\t\t} catch {}\n\t\t}\n\t}\n}\n/**\n* First process: the app configuration file and the environment the second process starts with (ADR-0062).\n* Refuses a file that would hold any of `knownSecrets`.\n*/\nfunction prepareSecondProcess(input) {\n\tconst { file, appSecrets } = input;\n\trefuseSecretsInRootInput(input.appConfigurationRead, input.knownSecrets, \"Composer hands the second process every plain value Load read, in a file, and never writes a secret to a file.\");\n\trefuseSecretsInPlainVariables(input.plainVariableText, input.knownSecrets);\n\tconst contents = {\n\t\tappConfigurationRead: input.appConfigurationRead,\n\t\tplainVariableText: input.plainVariableText,\n\t\tnodeAddresses: input.nodeAddresses\n\t};\n\tconst env = { [APP_CONFIGURATION_FILE_ENV]: file };\n\tif (appSecrets !== void 0) {\n\t\tconst named = {};\n\t\tfor (const key of input.secretsKeys) {\n\t\t\tconst text = appSecrets[key];\n\t\t\tif (text !== void 0 && text !== \"\") named[key] = text;\n\t\t}\n\t\tenv[NAMED_SECRETS_ENV] = JSON.stringify(named);\n\t}\n\tconst remove = () => {\n\t\ttry {\n\t\t\tfs.rmSync(file, { force: true });\n\t\t} catch {}\n\t};\n\treturn {\n\t\tenv,\n\t\twriteFile() {\n\t\t\tfs.rmSync(file, { force: true });\n\t\t\tfs.writeFileSync(file, JSON.stringify(contents), {\n\t\t\t\tmode: 384,\n\t\t\t\tflag: \"wx\"\n\t\t\t});\n\t\t\tprocess.off(\"exit\", remove);\n\t\t\tprocess.on(\"exit\", remove);\n\t\t},\n\t\tremoveFile() {\n\t\t\tprocess.off(\"exit\", remove);\n\t\t\tremove();\n\t\t}\n\t};\n}\nfunction missingVariable(name, what) {\n\treturn `${name} is not set. This stack file runs as the second process of a Composer destroy or prisma dev, which ${what}.`;\n}\nfunction isRecord(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nfunction isTextList(value) {\n\treturn Array.isArray(value) && value.every((member) => typeof member === \"string\");\n}\nfunction rootFieldsOf(value) {\n\tif (!Array.isArray(value)) return void 0;\n\tconst fields = [];\n\tfor (const member of value) {\n\t\tif (!isRecord(member) || !isTextList(member[\"path\"])) return void 0;\n\t\tfields.push(\"value\" in member ? {\n\t\t\tpath: member[\"path\"],\n\t\t\tvalue: member[\"value\"]\n\t\t} : { path: member[\"path\"] });\n\t}\n\treturn fields;\n}\nfunction textByKeyOf(value) {\n\tif (!isRecord(value)) return void 0;\n\tconst byKey = {};\n\tfor (const [key, member] of Object.entries(value)) {\n\t\tif (typeof member !== \"string\") return void 0;\n\t\tbyKey[key] = member;\n\t}\n\treturn byKey;\n}\n/** Second process: the app configuration file the first process named in its environment. */\nfunction readAppConfigurationFile(env) {\n\tconst file = env[APP_CONFIGURATION_FILE_ENV];\n\tif (file === void 0 || file === \"\") throw new Error(missingVariable(APP_CONFIGURATION_FILE_ENV, \"names the app configuration file it wrote there\"));\n\tlet text;\n\ttry {\n\t\ttext = fs.readFileSync(file, \"utf8\");\n\t} catch (cause) {\n\t\tconst message = cause instanceof Error ? cause.message : String(cause);\n\t\tthrow new Error(`Could not read the app configuration file ${file}: ${message}. Composer deletes it when the run ends, so a stack file run by hand after that cannot read it; run the command again.`, { cause });\n\t}\n\tconst notComposers = (what) => /* @__PURE__ */ new Error(`The app configuration file ${file} is not in the shape this version of Composer reads: ${what}. The usual cause is a \\`prisma\\` CLI and an app on different Composer versions. Put the \\`prisma\\` CLI and the app's \\`@prisma/composer\\` on the same version.`);\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse(text);\n\t} catch {\n\t\tthrow notComposers(\"it is not JSON\");\n\t}\n\tif (!isRecord(parsed)) throw notComposers(\"it is not JSON\");\n\tconst read = parsed[\"appConfigurationRead\"];\n\tif (!isRecord(read)) throw notComposers(\"appConfigurationRead is not an object\");\n\tconst rootInput = rootFieldsOf(read[\"rootInput\"]);\n\tif (rootInput === void 0) throw notComposers(\"rootInput is not a list of fields\");\n\tconst plainVariableText = textByKeyOf(parsed[\"plainVariableText\"]);\n\tif (plainVariableText === void 0) throw notComposers(\"plainVariableText is not an object of text\");\n\tconst addresses = parsed[\"nodeAddresses\"];\n\tif (!isTextList(addresses)) throw notComposers(\"nodeAddresses is not a list of node addresses\");\n\treturn {\n\t\tappConfigurationRead: { rootInput },\n\t\tplainVariableText,\n\t\tnodeAddresses: addresses\n\t};\n}\n/** Second process, under `prisma dev`: the named secrets the first process handed it. */\nfunction namedSecretsFromEnvironment(env) {\n\tconst text = env[NAMED_SECRETS_ENV];\n\tif (text === void 0 || text === \"\") throw new Error(missingVariable(NAMED_SECRETS_ENV, \"hands the secrets the local services need there\"));\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse(text);\n\t} catch {\n\t\tparsed = void 0;\n\t}\n\tconst byKey = textByKeyOf(parsed);\n\tif (byKey === void 0) throw new Error(`${NAMED_SECRETS_ENV} is not a JSON object of text.`);\n\tconst secrets = Object.create(null);\n\tObject.assign(secrets, byKey);\n\treturn Object.freeze(secrets);\n}\n//#endregion\nexport { readAppConfigurationFile as a, prepareSecondProcess as i, devAppConfigurationFile as n, removeLeftoverAppConfigurationFiles as o, namedSecretsFromEnvironment as r, refuseSecretsInRootInput as s, deployAppConfigurationFile as t };\n\n//# sourceMappingURL=app-configuration-file-Bbfq5PR3.mjs.map"],"mappings":";;;;;AAKA,SAAS,OAAO,OAAO,IAAI;CAC1B,IAAI,OAAO,UAAU,UAAU,OAAO,CAAC;EACtC;EACA,MAAM;CACP,CAAC;CACD,IAAI,OAAO,UAAU,YAAY,OAAO,UAAU,aAAa,OAAO,UAAU,UAAU,OAAO,CAAC;EACjG;EACA,MAAM,OAAO,KAAK;CACnB,CAAC;CACD,IAAI,MAAM,QAAQ,KAAK,GAAG,OAAO,MAAM,SAAS,QAAQ,UAAU,OAAO,QAAQ,CAAC,GAAG,IAAI,OAAO,KAAK,CAAC,CAAC,CAAC;CACxG,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM,OAAO,OAAO,QAAQ,KAAK,CAAC,CAAC,SAAS,CAAC,KAAK,YAAY,OAAO,QAAQ,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC;CACrI,OAAO,CAAC;AACT;;AAEA,SAAS,yBAAyB,MAAM,cAAc,aAAa;CAClE,MAAM,aAAa,KAAK,UAAU,SAAS,UAAU,OAAO,MAAM,OAAO,MAA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Q,YAAY,MAAM;CAChC,IAAI,UAAU,KAAK,GAAG,MAAM,IAAI,MAAM,GAAG,kBAAkB,+BAA+B;CAC1F,MAAM,UAAU,OAAO,OAAO,IAAI;CAClC,OAAO,OAAO,SAAS,KAAK;CAC5B,OAAO,OAAO,OAAO,OAAO;AAC7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./app-config-Ubi4CftJ-DUSDjI2i.mjs";
|
package/dist/config.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as ReporterDescriptor, A as LocalTargetEmulatorsInput, C as LocalNodeLocation, Ct as
|
|
2
|
-
import "./config-
|
|
1
|
+
import { $ as ReporterDescriptor, A as LocalTargetEmulatorsInput, C as LocalNodeLocation, Ct as readPreflightPayload, D as LocalTargetCurrentApp, E as LocalTargetAttachment, G as PreflightInput, H as PlatformVariableCheck, J as ProvidersInput, K as PreflightPayload, M as LocateContainerInput, O as LocalTargetCurrentInput, Q as ReportBeginInput, R as NamedSecrets, S as LocalNodeCondition, St as preflightEnvVarName, T as LocalTargetAttachInput, U as PlatformVariableReader, W as PreflightFindings, Z as ReportAttachInput, at as TeardownInput, bt as platformVariableReaderText, c as CallerCredentials, d as ConfigValues, dt as defineConfig, et as RunOutcome, f as ContainerDescriptor, g as DeployedEntity, h as DEV_ENVIRONMENT_NAME_FILE, ht as isBuildOnlyExtension, it as StateDescriptor, j as LocalTargetProvidersInput, k as LocalTargetDescriptor, l as ConfigAdapter, lt as containerEnv, m as DEV_DIR, mt as devEnvironmentDir, n as AppConfiguration, ot as UnsetPlatformVariable, p as ContainerInstance, pt as deserializeContainers, q as PrismaAppConfig, r as AppSecrets, tt as RunReporter, u as ConfigAdapterInput, ut as containerEnvVarName, w as LocalNodeStopped, x as ExtensionDescriptor, xt as preflightEnv, y as DevPreflightResult, z as NodeDescriptor } from "./app-config-Ubi4CftJ-DUSDjI2i.mjs";
|
|
2
|
+
import "./config-BmRE_eTa.mjs";
|
|
3
3
|
//#region ../../0-framework/3-tooling/cli/dist/config.d.mts
|
|
4
4
|
//#region src/config-adapters.d.ts
|
|
5
5
|
/** Reads the process environment when called: every variable whose value is a string. The default for both `config` and `secrets`. */
|
|
@@ -12,5 +12,5 @@ declare function environmentVariables(): ConfigAdapter;
|
|
|
12
12
|
*/
|
|
13
13
|
declare function dotenv(): ConfigAdapter;
|
|
14
14
|
//#endregion
|
|
15
|
-
export { AppConfiguration, AppSecrets, ConfigAdapter, ConfigAdapterInput, ConfigValues, type
|
|
15
|
+
export { AppConfiguration, AppSecrets, type CallerCredentials, ConfigAdapter, ConfigAdapterInput, ConfigValues, type ContainerDescriptor, type ContainerInstance, DEV_DIR, DEV_ENVIRONMENT_NAME_FILE, type DeployedEntity, DevPreflightResult, ExtensionDescriptor, LocalNodeCondition, LocalNodeLocation, LocalNodeStopped, LocalTargetAttachInput, LocalTargetAttachment, LocalTargetCurrentApp, LocalTargetCurrentInput, LocalTargetDescriptor, LocalTargetEmulatorsInput, LocalTargetProvidersInput, type LocateContainerInput, NamedSecrets, NodeDescriptor, PlatformVariableCheck, type PlatformVariableReader, type PreflightFindings, PreflightInput, type PreflightPayload, PrismaAppConfig, ProvidersInput, ReportAttachInput, ReportBeginInput, ReporterDescriptor, RunOutcome, RunReporter, StateDescriptor, TeardownInput, type UnsetPlatformVariable, containerEnv, containerEnvVarName, defineConfig, deserializeContainers, devEnvironmentDir, dotenv, environmentVariables, isBuildOnlyExtension, platformVariableReaderText, preflightEnv, preflightEnvVarName, readPreflightPayload };
|
|
16
16
|
//# sourceMappingURL=config.d.mts.map
|
package/dist/config.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { n as environmentVariables, t as dotenv } from "./config-adapters-DG-uhGfv-Bt1M9f8b.mjs";
|
|
2
|
-
import { a as
|
|
2
|
+
import { a as preflightEnv, i as platformVariableReaderText, n as containerEnvVarName, o as preflightEnvVarName, r as deserializeContainers, s as readPreflightPayload, t as containerEnv } from "./preflight-transport-C7_3abXW-Bza_hn9G.mjs";
|
|
3
3
|
import { a as isBuildOnlyExtension, i as devEnvironmentDir, n as DEV_ENVIRONMENT_NAME_FILE, r as defineConfig, t as DEV_DIR } from "./app-config-CErnR6NK-D9NgSBH4.mjs";
|
|
4
|
-
export { DEV_DIR, DEV_ENVIRONMENT_NAME_FILE,
|
|
4
|
+
export { DEV_DIR, DEV_ENVIRONMENT_NAME_FILE, containerEnv, containerEnvVarName, defineConfig, deserializeContainers, devEnvironmentDir, dotenv, environmentVariables, isBuildOnlyExtension, platformVariableReaderText, preflightEnv, preflightEnvVarName, readPreflightPayload };
|
package/dist/control.d.mts
CHANGED
|
@@ -1,21 +1,33 @@
|
|
|
1
1
|
import { Rt as CliStructuredError } from "./graph-types-Bzj1fahC-C8rOVj0c.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import "./config-
|
|
4
|
-
import { n as DeploymentSummary, t as DeployedNodeSummary } from "./deployment-summary-
|
|
2
|
+
import { U as PlatformVariableReader, W as PreflightFindings, ot as UnsetPlatformVariable } from "./app-config-Ubi4CftJ-DUSDjI2i.mjs";
|
|
3
|
+
import "./config-BmRE_eTa.mjs";
|
|
4
|
+
import { n as DeploymentSummary, t as DeployedNodeSummary } from "./deployment-summary-6LgQDUuu-DtCvw9UQ.mjs";
|
|
5
5
|
import "./index-B8s0bLZY.mjs";
|
|
6
|
-
import { a as ExecutionDiagnostics, c as executionDiagnostics, d as Result, i as DevSession, l as NotOk, n as DevEvent, o as ServiceEndpoint, r as DevInput, s as dev, t as ComposerConfigSource, u as Ok } from "./redaction-
|
|
7
|
-
//#region ../../0-framework/3-tooling/cli/dist/dev-current-
|
|
6
|
+
import { a as ExecutionDiagnostics, c as executionDiagnostics, d as Result, i as DevSession, l as NotOk, n as DevEvent, o as ServiceEndpoint, r as DevInput, s as dev, t as ComposerConfigSource, u as Ok } from "./redaction-CIaE4m9U-DJGrkcn3.mjs";
|
|
7
|
+
//#region ../../0-framework/3-tooling/cli/dist/dev-current-BUfC8loc.d.mts
|
|
8
8
|
//#region src/operations/deploy.d.ts
|
|
9
|
-
/** A deploy step. `assemble-service` steps run inside `assemble`, one per service. */
|
|
9
|
+
/** A deploy step. `assemble-service` steps run inside `assemble`, one per service, and `apply-resource` steps inside `apply`, one per resource Alchemy touches. */
|
|
10
10
|
type DeployStep = {
|
|
11
11
|
readonly name: 'prepare' | 'assemble' | 'connect' | 'preflight' | 'apply' | 'record';
|
|
12
12
|
} | {
|
|
13
13
|
readonly name: 'assemble-service';
|
|
14
14
|
readonly address: string;
|
|
15
|
+
} | {
|
|
16
|
+
readonly name: 'apply-resource';
|
|
17
|
+
/** The resource's ID (ADR-0057): its node's address, or the address and the resource's role in that node. */
|
|
18
|
+
readonly resourceId: string;
|
|
19
|
+
readonly resourceType: string;
|
|
20
|
+
/** Alchemy's word for what is happening to the resource, such as `creating` or `created`, for people to read. It changes between a step's start and finish, and its values are Alchemy's, so do not branch on it. */
|
|
21
|
+
readonly status: string;
|
|
15
22
|
};
|
|
16
23
|
type DeployEvent = {
|
|
17
24
|
readonly kind: 'step-started';
|
|
18
25
|
readonly step: DeployStep;
|
|
26
|
+
} | {
|
|
27
|
+
readonly kind: 'message';
|
|
28
|
+
readonly severity: 'info' | 'warn' | 'verbose';
|
|
29
|
+
/** A line Alchemy logged while it planned or applied. */
|
|
30
|
+
readonly text: string;
|
|
19
31
|
} | {
|
|
20
32
|
readonly kind: 'step-finished';
|
|
21
33
|
readonly step: DeployStep;
|
|
@@ -58,10 +70,11 @@ interface DeployInput {
|
|
|
58
70
|
readonly reportId?: string | undefined;
|
|
59
71
|
/** Each step as it starts and finishes, in real time. Rendering is the host's. */
|
|
60
72
|
readonly onEvent?: ((event: DeployEvent) => void) | undefined;
|
|
73
|
+
/** Interrupts the plan or apply when it aborts. The deploy then fails with `DEPLOY.INTERRUPTED`, after releasing the environment's state lease. */
|
|
74
|
+
readonly signal?: AbortSignal | undefined;
|
|
61
75
|
}
|
|
62
76
|
interface DeploySuccess {
|
|
63
|
-
/**
|
|
64
|
-
* did not write one (injected fake alchemy, or a report-less apply). */
|
|
77
|
+
/** What the apply deployed. Undefined when the apply produced no report. */
|
|
65
78
|
readonly summary: DeploymentSummary | undefined;
|
|
66
79
|
/** How long the whole deploy took, from the call to its result. */
|
|
67
80
|
readonly durationMs: number;
|
package/dist/control.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control.d.mts","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/dev-current-
|
|
1
|
+
{"version":3,"file":"control.d.mts","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/dev-current-BUfC8loc.d.mts","../../../0-framework/3-tooling/cli/dist/control.d.mts"],"mappings":";;;;;;;;;KAOK;WACM;;WAEA;WACA;;WAEA;;WAEA;WACA;;WAEA;;KAEN;WACM;WACA,MAAM;;WAEN;WACA;;WAEA;;WAEA;WACA,MAAM;WACN;WACA;;WAEA,OAAO,SAAS;;;;WAIhB;WACA,UAAU;;UAIX;;;;WAIC,QAAQ;;WAER;;WAEA;;WAEA;;WAEA;;;;;;;WAOA;;;;;;;WAOA;;WAEA,YAAY,OAAO;;WAEnB,SAAS;;UAEV;;WAEC,SAAS;;WAET;;iBAEM,OAAO,OAAO,cAAc,QAAQ,OAAO,eAAe;;;UAOjE;;WAEC,QAAQ;;WAER;;WAEA;;WAEA;;UAED;WACC;;WAEA;;WAEA;;WAEA;;WAEA;;UAED;WACC,QAAQ;;WAER;;WAEA;;WAEA;;WAEA;;UAED;;WAEC;;WAEA;;WAEA;aACE;aACA;;;;iBAII,OAAO,OAAO,cAAc,QAAQ,OAAO,QAAQ;;iBAEnD,QAAQ,OAAO,eAAe,QAAQ,OAAO,YAAY;;;;KC9HrE;;;WAGM;WACA;;UAED;;;;WAIC,QAAQ;;WAER;WACA;;WAEA;WACA;;WAEA,YAAY,OAAO;;iBAEb,QAAQ,OAAO,eAAe,QAAQ,aAAe;;;UAG5D;WACC;WACA;;KAEN;;;WAGM;WACA;;;;;WAKA;WACA;;UAED;;;;;WAKC,QAAQ;;WAER;WACA;;WAEA;;WAEA;;WAEA;WACA;;WAEA,SAAS;WACT,YAAY,OAAO;;UAEpB;;WAEC;;;WAGA,mBAAmB;;WAEnB,OAAO,cAAc;;iBAEf,IAAI,OAAO,WAAW,QAAQ,OAAS,aAAa;;;;cAIvD;;cAEA;UACJ;;WAEC;WACA;;;;;;;UAOD;WACC;WACA;;WAEA;WACA;WACA,gBAAgB;WAChB,SAAS"}
|
package/dist/control.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as CliStructuredError } from "./errors-0e8IVwzi.mjs";
|
|
2
|
-
import { a as executionDiagnostics, i as devUrl, l as notOk, n as dev, o as executorLoadFailure, r as devStop, t as deploy } from "./dev-current-
|
|
2
|
+
import { a as executionDiagnostics, i as devUrl, l as notOk, n as dev, o as executorLoadFailure, r as devStop, t as deploy } from "./dev-current-Dp3jvXGN-C1Y2BAtC.mjs";
|
|
3
3
|
import { n as RUN_REPORT_VERSION, t as RUN_REPORT_FILE_ENV } from "./run-report-CmBz2-xc-Cc8rV1CX.mjs";
|
|
4
4
|
//#region ../../0-framework/3-tooling/cli/dist/control.mjs
|
|
5
5
|
/**
|
|
@@ -21,7 +21,7 @@ async function destroyWithDeps(input, deps) {
|
|
|
21
21
|
const cwd = input.cwd ?? process.cwd();
|
|
22
22
|
let executor;
|
|
23
23
|
try {
|
|
24
|
-
executor = await import("./execute-deploy-destroy-
|
|
24
|
+
executor = await import("./execute-deploy-destroy-J0buFSWK-BhVTX4-E.mjs");
|
|
25
25
|
} catch (error) {
|
|
26
26
|
return notOk(executorLoadFailure("destroy", error));
|
|
27
27
|
}
|
|
@@ -43,7 +43,7 @@ async function logWithDeps(input, deps) {
|
|
|
43
43
|
const cwd = input.cwd ?? process.cwd();
|
|
44
44
|
let executor;
|
|
45
45
|
try {
|
|
46
|
-
executor = await import("./execute-log-
|
|
46
|
+
executor = await import("./execute-log-BcmA2gDv-CPrOZtEh.mjs");
|
|
47
47
|
} catch (error) {
|
|
48
48
|
return notOk(executorLoadFailure("log", error));
|
|
49
49
|
}
|
package/dist/control.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control.mjs","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/control.mjs"],"sourcesContent":["import { c as executionDiagnostics, l as executorLoadFailure, n as devUrl, o as deploy, r as dev, t as devStop } from \"./dev-current-
|
|
1
|
+
{"version":3,"file":"control.mjs","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/control.mjs"],"sourcesContent":["import { c as executionDiagnostics, l as executorLoadFailure, n as devUrl, o as deploy, r as dev, t as devStop } from \"./dev-current-Dp3jvXGN.mjs\";\nimport { n as RUN_REPORT_VERSION, t as RUN_REPORT_FILE_ENV } from \"./run-report-CmBz2-xc.mjs\";\nimport { CliStructuredError } from \"@internal/foundation/errors\";\nimport { notOk } from \"@internal/foundation/result\";\n//#region src/operations/destroy.ts\n/**\n* The programmatic `destroy` operation (`@prisma/composer/control`): typed\n* input, structured result, no argv, no console, no process.exit. No CLI\n* command wraps it. The executor\n* loads lazily, so importing this module executes nothing; an executor that\n* fails to load comes back as a structured failure, never a throw out of\n* the host.\n*/\nasync function destroy(input) {\n\treturn destroyWithDeps(input, {});\n}\n/** In-package variant threading the injection seam, for the unit tests.\n* Deliberately NOT re-exported through `./control` — the seam mirrors\n* internal types and is not part of the published surface. */\nasync function destroyWithDeps(input, deps) {\n\tif (typeof input.environment !== \"string\" || input.environment.length === 0) return notOk(environmentRequired());\n\tconst cwd = input.cwd ?? process.cwd();\n\tlet executor;\n\ttry {\n\t\texecutor = await import(\"./execute-deploy-destroy-J0buFSWK.mjs\");\n\t} catch (error) {\n\t\treturn notOk(executorLoadFailure(\"destroy\", error));\n\t}\n\treturn executor.executeDestroy(input, deps, cwd);\n}\nfunction environmentRequired() {\n\treturn new CliStructuredError(\"DEPLOY.ENVIRONMENT_REQUIRED\", \"destroy needs the name of the environment to destroy.\", {\n\t\twhy: \"Destroy never defaults to production, so a call without a name has no target.\",\n\t\tfix: \"Pass `environment`, for example `destroy({ environment: 'staging', config })`.\"\n\t});\n}\n//#endregion\n//#region src/operations/log.ts\nasync function log(input) {\n\treturn logWithDeps(input, {});\n}\n/** In-package variant threading the injection seam, for the unit tests.\n* Deliberately NOT re-exported through `./control` — the seam\n* mirrors internal types and is not part of the published surface. */\nasync function logWithDeps(input, deps) {\n\tconst cwd = input.cwd ?? process.cwd();\n\tlet executor;\n\ttry {\n\t\texecutor = await import(\"./execute-log-BcmA2gDv.mjs\");\n\t} catch (error) {\n\t\treturn notOk(executorLoadFailure(\"log\", error));\n\t}\n\treturn executor.executeLog(input, deps, cwd);\n}\n//#endregion\nexport { RUN_REPORT_FILE_ENV, RUN_REPORT_VERSION, deploy, destroy, dev, devStop, devUrl, executionDiagnostics, log };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;AAaA,eAAe,QAAQ,OAAO;CAC7B,OAAO,gBAAgB,OAAO,CAAC,CAAC;AACjC;;;;AAIA,eAAe,gBAAgB,OAAO,MAAM;CAC3C,IAAI,OAAO,MAAM,gBAAgB,YAAY,MAAM,YAAY,WAAW,GAAG,OAAO,MAAM,oBAAoB,CAAC;CAC/G,MAAM,MAAM,MAAM,OAAO,QAAQ,IAAI;CACrC,IAAI;CACJ,IAAI;EACH,WAAW,MAAM,OAAO;CACzB,SAAS,OAAO;EACf,OAAO,MAAM,oBAAoB,WAAW,KAAK,CAAC;CACnD;CACA,OAAO,SAAS,eAAe,OAAO,MAAM,GAAG;AAChD;AACA,SAAS,sBAAsB;CAC9B,OAAO,IAAI,mBAAmB,+BAA+B,yDAAyD;EACrH,KAAK;EACL,KAAK;CACN,CAAC;AACF;AAGA,eAAe,IAAI,OAAO;CACzB,OAAO,YAAY,OAAO,CAAC,CAAC;AAC7B;;;;AAIA,eAAe,YAAY,OAAO,MAAM;CACvC,MAAM,MAAM,MAAM,OAAO,QAAQ,IAAI;CACrC,IAAI;CACJ,IAAI;EACH,WAAW,MAAM,OAAO;CACzB,SAAS,OAAO;EACf,OAAO,MAAM,oBAAoB,OAAO,KAAK,CAAC;CAC/C;CACA,OAAO,SAAS,WAAW,OAAO,MAAM,GAAG;AAC5C"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { _t as lower } from "./app-config-Ubi4CftJ-DUSDjI2i.mjs";
|
|
2
|
+
import "./deploy-BW_F4Y9W.mjs";
|
|
3
|
+
import "alchemy/Alchemist";
|
|
4
|
+
import "effect/Cause";
|
|
5
|
+
//#region ../../0-framework/3-tooling/cli/dist/converge-in-process-BBBeood8.d.mts
|
|
6
|
+
//#region src/converge-in-process.d.ts
|
|
7
|
+
/** What `lower()` returns: the stack value `Alchemist.plan` takes. */
|
|
8
|
+
type LoweredStack = ReturnType<typeof lower>;
|
|
9
|
+
/** Where a resource is in its apply. `pending` is planned but not yet touched. */
|
|
10
|
+
type ResourcePhase = 'pending' | 'running' | 'done' | 'failed';
|
|
11
|
+
type ConvergeEvent = {
|
|
12
|
+
readonly kind: 'resource';
|
|
13
|
+
readonly fqn: string;
|
|
14
|
+
readonly resourceType: string;
|
|
15
|
+
/** Alchemy's own status word, such as `creating` or `updated`. */
|
|
16
|
+
readonly status: string;
|
|
17
|
+
readonly phase: ResourcePhase;
|
|
18
|
+
readonly message?: string | undefined;
|
|
19
|
+
} | {
|
|
20
|
+
readonly kind: 'log';
|
|
21
|
+
readonly severity: 'info' | 'warn' | 'verbose';
|
|
22
|
+
readonly text: string;
|
|
23
|
+
};
|
|
24
|
+
interface ConvergeRequest {
|
|
25
|
+
readonly operation: 'deploy';
|
|
26
|
+
readonly stack: LoweredStack;
|
|
27
|
+
readonly stage: string;
|
|
28
|
+
/** The directory Alchemy runs in: where it reads `.env` and keeps `.alchemy`. */
|
|
29
|
+
readonly cwd: string;
|
|
30
|
+
/** Set in `process.env` while Alchemy plans and applies, and restored after; `undefined` removes the variable for that time. Alchemy reads its configuration only from there. */
|
|
31
|
+
readonly env: Readonly<Record<string, string | undefined>>;
|
|
32
|
+
readonly signal?: AbortSignal | undefined;
|
|
33
|
+
readonly onEvent?: ((event: ConvergeEvent) => void) | undefined;
|
|
34
|
+
/** Receives what Alchemy writes to the terminal itself. A throw from it is ignored. Absent means stderr. */
|
|
35
|
+
readonly output?: ((text: string) => void) | undefined;
|
|
36
|
+
}
|
|
37
|
+
/** One error a failed converge ended with: the error's tag or class name, and its message. */
|
|
38
|
+
interface ConvergeFailureReason {
|
|
39
|
+
readonly tag: string;
|
|
40
|
+
readonly message: string;
|
|
41
|
+
}
|
|
42
|
+
type ConvergeOutcome = {
|
|
43
|
+
readonly kind: 'applied';
|
|
44
|
+
} | {
|
|
45
|
+
readonly kind: 'interrupted';
|
|
46
|
+
} | {
|
|
47
|
+
readonly kind: 'failed';
|
|
48
|
+
readonly reasons: readonly ConvergeFailureReason[];
|
|
49
|
+
} |
|
|
50
|
+
/** Nothing ran: another converge holds this process's environment and working directory, or this is a worker thread that cannot change directory. */
|
|
51
|
+
{
|
|
52
|
+
readonly kind: 'refused';
|
|
53
|
+
readonly reason: 'already-running' | 'worker-thread';
|
|
54
|
+
};
|
|
55
|
+
/** Plans and applies a lowered stack. The deploy executor's default is {@link convergeInProcess}. */
|
|
56
|
+
type Converge = (request: ConvergeRequest) => Promise<ConvergeOutcome>;
|
|
57
|
+
/**
|
|
58
|
+
* Plans and applies `stack` in this process, as `alchemy deploy --yes` would.
|
|
59
|
+
* The plan's scope, and the state-store lease it holds, closes before this
|
|
60
|
+
* returns, including when `signal` interrupts it. One converge runs at a time
|
|
61
|
+
* per process, across every install of this module: a second call while one
|
|
62
|
+
* runs is refused.
|
|
63
|
+
*/
|
|
64
|
+
declare const convergeInProcess: Converge;
|
|
65
|
+
//#endregion
|
|
66
|
+
export { ConvergeRequest as a, ConvergeOutcome as i, ConvergeEvent as n, LoweredStack as o, ConvergeFailureReason as r, convergeInProcess as s, Converge as t };
|
|
67
|
+
//# sourceMappingURL=converge-in-process-BBBeood8-C7VG5b35.d.mts.map
|