@prisma/composer 0.39.0-dev.1 → 0.39.0-dev.11
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-UeKFBma7-CohaMmWp.d.mts → app-config-DriAu5RU-C8hYpR38.d.mts} +88 -83
- package/dist/app-config-DriAu5RU-C8hYpR38.d.mts.map +1 -0
- package/dist/{app-configuration-file-CeJvBAti-D3uDlheX.mjs → app-configuration-file-D0rB5g65-CdMrjkCc.mjs} +50 -85
- package/dist/app-configuration-file-D0rB5g65-CdMrjkCc.mjs.map +1 -0
- package/dist/app-converge-bS1l9jIf-DRGbjw2D.mjs +88 -0
- package/dist/app-converge-bS1l9jIf-DRGbjw2D.mjs.map +1 -0
- package/dist/arktype.d.mts +7 -5
- package/dist/arktype.d.mts.map +1 -1
- package/dist/arktype.mjs +7 -5
- package/dist/arktype.mjs.map +1 -1
- package/dist/config-Bpi8QVLB.d.mts +1 -0
- package/dist/config.d.mts +3 -3
- package/dist/config.mjs +2 -2
- package/dist/control.d.mts +19 -21
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +4 -4
- package/dist/control.mjs.map +1 -1
- package/dist/converge-in-process-CTomEXaD-BnDylZP8.d.mts +67 -0
- package/dist/converge-in-process-CTomEXaD-BnDylZP8.d.mts.map +1 -0
- package/dist/converge-in-process-x89zb2MF-Dvj-J8xo.mjs +258 -0
- package/dist/converge-in-process-x89zb2MF-Dvj-J8xo.mjs.map +1 -0
- package/dist/{deploy-3EXLVrtG.mjs → deploy-CSU0kr4j.mjs} +130 -38
- package/dist/deploy-CSU0kr4j.mjs.map +1 -0
- package/dist/deploy-DHgEJDpg.d.mts +32 -0
- package/dist/deploy-DHgEJDpg.d.mts.map +1 -0
- package/dist/deploy.d.mts +4 -4
- package/dist/deploy.mjs +3 -3
- package/dist/{deployment-summary-p88NV5m5-SgniM8TX.d.mts → deployment-summary-6LgQDUuu-Cu_6UNhc.d.mts} +7 -4
- package/dist/deployment-summary-6LgQDUuu-Cu_6UNhc.d.mts.map +1 -0
- package/dist/{deployment-summary-D74WrJX7-DQ3LDUuO.mjs → deployment-summary-CVJZn2v0-Dz-gX1rp.mjs} +16 -44
- package/dist/deployment-summary-CVJZn2v0-Dz-gX1rp.mjs.map +1 -0
- package/dist/{describe-kind-Cpm_euxo-CkhlGJUL.mjs → describe-kind-Cpm_euxo-DsSPENQa.mjs} +4 -4
- package/dist/describe-kind-Cpm_euxo-DsSPENQa.mjs.map +1 -0
- package/dist/dev-converge-messages-DML4rTz7-C_EAB5M_.mjs +165 -0
- package/dist/dev-converge-messages-DML4rTz7-C_EAB5M_.mjs.map +1 -0
- package/dist/dev-converge-worker.d.mts +1 -0
- package/dist/dev-converge-worker.mjs +142 -0
- package/dist/dev-converge-worker.mjs.map +1 -0
- package/dist/{dev-current-wD5YDLjA-CzyFYXni.mjs → dev-current-lAlj53eX-DrtBnAmA.mjs} +11 -7
- package/dist/dev-current-lAlj53eX-DrtBnAmA.mjs.map +1 -0
- package/dist/{dev-environment-name-6eEr5PW8-BwusWVKi.mjs → dev-environment-name-6eEr5PW8-7ntm9Xhs.mjs} +3 -3
- package/dist/{dev-environment-name-6eEr5PW8-BwusWVKi.mjs.map → dev-environment-name-6eEr5PW8-7ntm9Xhs.mjs.map} +1 -1
- package/dist/{dist-ynqBR6y8.mjs → dist-Cf_mZHaH.mjs} +4 -26
- package/dist/dist-Cf_mZHaH.mjs.map +1 -0
- package/dist/{emulator-retry-CV8rl69G-BgUzkxc-.mjs → emulator-retry-CV8rl69G-scQ105wk.mjs} +2 -2
- package/dist/{emulator-retry-CV8rl69G-BgUzkxc-.mjs.map → emulator-retry-CV8rl69G-scQ105wk.mjs.map} +1 -1
- package/dist/{errors-0e8IVwzi.mjs → errors-DI3TBXE-.mjs} +7 -2
- package/dist/{errors-0e8IVwzi.mjs.map → errors-DI3TBXE-.mjs.map} +1 -1
- package/dist/{execute-deploy-destroy-DOzo2Psp-DmS5miT4.mjs → execute-deploy-destroy-DN16ETAk-BaopEKsA.mjs} +376 -86
- package/dist/execute-deploy-destroy-DN16ETAk-BaopEKsA.mjs.map +1 -0
- package/dist/{execute-dev-BIyOI3Ys-BbDOLlV4.mjs → execute-dev-DnVmNpc1-kSyPML7l.mjs} +455 -221
- package/dist/execute-dev-DnVmNpc1-kSyPML7l.mjs.map +1 -0
- package/dist/{execute-dev-current-CKOzjWuO-BPecs6Lf.mjs → execute-dev-current-CZdmxVQ4-Bij2LeBY.mjs} +7 -7
- package/dist/{execute-dev-current-CKOzjWuO-BPecs6Lf.mjs.map → execute-dev-current-CZdmxVQ4-Bij2LeBY.mjs.map} +1 -1
- package/dist/{execute-log-BDdHor71-B2p8Zae2.mjs → execute-log-Bl-j6izb-BTAo6tRM.mjs} +8 -8
- package/dist/{execute-log-BDdHor71-B2p8Zae2.mjs.map → execute-log-Bl-j6izb-BTAo6tRM.mjs.map} +1 -1
- package/dist/{graph-C7mdtisq-RnKiwVsx.d.mts → graph-CUYXjK8S-BzL-mhjq.d.mts} +3 -3
- package/dist/graph-CUYXjK8S-BzL-mhjq.d.mts.map +1 -0
- package/dist/{graph-BzPLUUsB-D7EnB1F5.mjs → graph-D2WMLL43-CeiC5wdy.mjs} +150 -107
- package/dist/graph-D2WMLL43-CeiC5wdy.mjs.map +1 -0
- package/dist/{graph-types-s5V7pGj2-BxSqB1ZH.d.mts → graph-types-D4PrtP-l-B0uuchTl.d.mts} +101 -98
- package/dist/graph-types-D4PrtP-l-B0uuchTl.d.mts.map +1 -0
- package/dist/http.d.mts +2 -2
- package/dist/http.mjs +2 -2
- package/dist/{index-DyuwxTtd.d.mts → index-D8chHe55.d.mts} +3 -3
- package/dist/{index-DyuwxTtd.d.mts.map → index-D8chHe55.d.mts.map} +1 -1
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +4 -4
- package/dist/internal-app-configuration-file.d.mts +7 -10
- package/dist/internal-app-configuration-file.d.mts.map +1 -1
- package/dist/internal-app-configuration-file.mjs +2 -2
- package/dist/internal-converge-contract.d.mts +16 -0
- package/dist/internal-converge-contract.d.mts.map +1 -0
- package/dist/internal-converge-contract.mjs +16 -0
- package/dist/internal-converge-contract.mjs.map +1 -0
- package/dist/internal-converge.d.mts +5 -0
- package/dist/internal-converge.mjs +4 -0
- package/dist/load-entry-CEoVBdMj-CHOz7jKf.mjs +527 -0
- package/dist/load-entry-CEoVBdMj-CHOz7jKf.mjs.map +1 -0
- package/dist/local-target-7KRsLMDO.d.mts +31 -0
- package/dist/local-target-7KRsLMDO.d.mts.map +1 -0
- package/dist/{local-target-Dd8FJEb5.mjs → local-target-DhU1vaxd.mjs} +8 -8
- package/dist/{local-target-Dd8FJEb5.mjs.map → local-target-DhU1vaxd.mjs.map} +1 -1
- package/dist/local-target.d.mts +3 -31
- package/dist/local-target.mjs +1 -1
- package/dist/{nextjs-DLyeRR7M-0lw_cBIr.d.mts → nextjs-DLyeRR7M-CzUbvPaJ.d.mts} +3 -3
- package/dist/{nextjs-DLyeRR7M-0lw_cBIr.d.mts.map → nextjs-DLyeRR7M-CzUbvPaJ.d.mts.map} +1 -1
- package/dist/nextjs-control.d.mts +4 -4
- package/dist/nextjs.d.mts +1 -1
- package/dist/node-control.d.mts +3 -3
- package/dist/node.d.mts +2 -2
- package/dist/{pointer-CyQZZugO-D7k3vibs.d.mts → pointer-BX2KJ720-BxcfpaHP.d.mts} +8 -6
- package/dist/{pointer-CyQZZugO-D7k3vibs.d.mts.map → pointer-BX2KJ720-BxcfpaHP.d.mts.map} +1 -1
- package/dist/{preflight-transport-DmmtoFPH-CnDWufmu.mjs → preflight-transport-2d6iIchu-B-v7Di6I.mjs} +7 -44
- package/dist/preflight-transport-2d6iIchu-B-v7Di6I.mjs.map +1 -0
- package/dist/{redaction-DXung4ip-bBoNomi3.mjs → redaction-DY6eDC12-W-FzW7_r.mjs} +32 -15
- package/dist/redaction-DY6eDC12-W-FzW7_r.mjs.map +1 -0
- package/dist/{redaction-Bf8FvTFH-D_HvoMrf.d.mts → redaction-Dn7BRdaP-BcLSPhLV.d.mts} +65 -16
- package/dist/redaction-Dn7BRdaP-BcLSPhLV.d.mts.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/service-rpc.d.mts +2 -2
- package/dist/service-rpc.mjs +2 -2
- package/dist/steps-BZXNqW6U-C_ME2VLd.mjs +112 -0
- package/dist/steps-BZXNqW6U-C_ME2VLd.mjs.map +1 -0
- package/dist/testing.d.mts +1 -1
- package/dist/validate-environment-DCZiNSlR-C7lv0cH1.mjs +344 -0
- package/dist/validate-environment-DCZiNSlR-C7lv0cH1.mjs.map +1 -0
- package/dist/zod.d.mts +6 -5
- package/dist/zod.d.mts.map +1 -1
- package/dist/zod.mjs +6 -5
- package/dist/zod.mjs.map +1 -1
- package/package.json +15 -13
- package/skills/prisma-composer-core-concepts/SKILL.md +47 -66
- package/src/exports/dev-converge-worker.ts +2 -0
- package/src/exports/internal-converge-contract.ts +1 -0
- package/src/exports/internal-converge.ts +1 -0
- package/dist/app-config-UeKFBma7-CohaMmWp.d.mts.map +0 -1
- package/dist/app-configuration-file-CeJvBAti-D3uDlheX.mjs.map +0 -1
- package/dist/config-BeZEgGCg.d.mts +0 -1
- package/dist/deploy-3EXLVrtG.mjs.map +0 -1
- package/dist/deploy-Xi4_JrtE.d.mts +0 -2
- package/dist/deployment-summary-D74WrJX7-DQ3LDUuO.mjs.map +0 -1
- package/dist/deployment-summary-p88NV5m5-SgniM8TX.d.mts.map +0 -1
- package/dist/describe-kind-Cpm_euxo-CkhlGJUL.mjs.map +0 -1
- package/dist/dev-current-wD5YDLjA-CzyFYXni.mjs.map +0 -1
- package/dist/dist-ynqBR6y8.mjs.map +0 -1
- package/dist/execute-deploy-destroy-DOzo2Psp-DmS5miT4.mjs.map +0 -1
- package/dist/execute-dev-BIyOI3Ys-BbDOLlV4.mjs.map +0 -1
- package/dist/graph-BzPLUUsB-D7EnB1F5.mjs.map +0 -1
- package/dist/graph-C7mdtisq-RnKiwVsx.d.mts.map +0 -1
- package/dist/graph-types-s5V7pGj2-BxSqB1ZH.d.mts.map +0 -1
- package/dist/local-target.d.mts.map +0 -1
- package/dist/preflight-transport-DmmtoFPH-CnDWufmu.mjs.map +0 -1
- package/dist/redaction-Bf8FvTFH-D_HvoMrf.d.mts.map +0 -1
- package/dist/redaction-DXung4ip-bBoNomi3.mjs.map +0 -1
- package/dist/run-alchemy-CRLAyOtt-CBUV28We.mjs +0 -236
- package/dist/run-alchemy-CRLAyOtt-CBUV28We.mjs.map +0 -1
- package/dist/validate-environment-D1BTCkTs-BQprjyNP.mjs +0 -739
- package/dist/validate-environment-D1BTCkTs-BQprjyNP.mjs.map +0 -1
|
@@ -1,22 +1,25 @@
|
|
|
1
|
-
import { F as ModuleNode, K as ProvisionNeed, R as NodeId, Z as ResourceNode, o as BuildAdapter, r as AppRootNode, s as Config, st as ServiceNode, t as AppConfigurationRead, y as Graph } from "./graph-types-
|
|
2
|
-
import "./graph-
|
|
1
|
+
import { F as ModuleNode, K as ProvisionNeed, R as NodeId, Z as ResourceNode, o as BuildAdapter, r as AppRootNode, s as Config, st as ServiceNode, t as AppConfigurationRead, y as Graph } from "./graph-types-D4PrtP-l-B0uuchTl.mjs";
|
|
2
|
+
import "./graph-CUYXjK8S-BzL-mhjq.mjs";
|
|
3
3
|
import * as Alchemy from "alchemy";
|
|
4
4
|
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-DriAu5RU.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
|
}
|
|
@@ -99,19 +83,14 @@ declare function preflightEnvVarName(extensionId: string): string;
|
|
|
99
83
|
declare function preflightEnv(payloads: ReadonlyMap<string, string>): Record<string, string>;
|
|
100
84
|
/** 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). */
|
|
101
85
|
declare function readPreflightPayload(extensionId: string, env: Readonly<Record<string, string | undefined>>): PreflightPayload;
|
|
102
|
-
/** Where a platform variable is named: a service's input field,
|
|
86
|
+
/** Where a platform variable is named: a service's input field, or a resource no service reads. */
|
|
103
87
|
type PlatformVariableReader = {
|
|
104
88
|
readonly kind: 'field';
|
|
105
89
|
readonly service: string;
|
|
106
90
|
readonly path: string;
|
|
107
|
-
} | {
|
|
108
|
-
readonly kind: 'param';
|
|
109
|
-
readonly service: string;
|
|
110
|
-
readonly param: string;
|
|
111
91
|
} | {
|
|
112
92
|
readonly kind: 'unread';
|
|
113
93
|
readonly node: string;
|
|
114
|
-
readonly nodeKind: 'module' | 'resource';
|
|
115
94
|
};
|
|
116
95
|
/** A platform variable with no value that nothing requires, with its readers and the commands that set it. */
|
|
117
96
|
interface UnsetPlatformVariable {
|
|
@@ -126,12 +105,6 @@ interface PreflightFindings {
|
|
|
126
105
|
}
|
|
127
106
|
/** One reader as the deploy prints it, for example `read by service "shop.email", field "apiKey"`. */
|
|
128
107
|
declare function platformVariableReaderText(reader: PlatformVariableReader): string;
|
|
129
|
-
/** 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. */
|
|
130
|
-
declare const PREFLIGHT_FINDINGS_ENV_VAR = "PRISMA_COMPOSER_PREFLIGHT_FINDINGS";
|
|
131
|
-
/** 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. */
|
|
132
|
-
declare function preflightFindingsEnv(findings: PreflightFindings): Record<string, string>;
|
|
133
|
-
/** 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. */
|
|
134
|
-
declare function readPreflightFindings(env: Readonly<Record<string, string | undefined>>): PreflightFindings;
|
|
135
108
|
//#endregion
|
|
136
109
|
//#region src/control/deploy.d.ts
|
|
137
110
|
/** The Layer shape every Alchemy state store must satisfy — what `LowerOptions.state` and `PrismaAppConfig.state` both traffic in. */
|
|
@@ -168,7 +141,7 @@ interface ProvisionerDescriptor {
|
|
|
168
141
|
/**
|
|
169
142
|
* The phased service SPI. `P` and `S` are the descriptor's OWN intra-node
|
|
170
143
|
* handoff types — provision's product consumed by serialize/deploy, and
|
|
171
|
-
* serialize's product consumed by deploy. Core threads them through without
|
|
144
|
+
* serialize's product consumed by package/deploy. Core threads them through without
|
|
172
145
|
* inspection; only the descriptor that writes them reads them.
|
|
173
146
|
*
|
|
174
147
|
* Method syntax (not property-arrow) is required: the heterogeneous
|
|
@@ -192,9 +165,10 @@ interface ServiceLowering<P = unknown, S = unknown> {
|
|
|
192
165
|
/**
|
|
193
166
|
* Prints the bootstrap and assembles the deployable artifact from the
|
|
194
167
|
* app-built bundle. Must be byte-deterministic: an unchanged service noops
|
|
195
|
-
* on redeploy.
|
|
168
|
+
* on redeploy. `serialized` is this service's `serialize` product. It must
|
|
169
|
+
* not write a secret, or a value the deploy has not resolved, into the artifact.
|
|
196
170
|
*/
|
|
197
|
-
package(ctx: LowerContext, input: PackageInput): Effect.Effect<Artifact, unknown, unknown>;
|
|
171
|
+
package(ctx: LowerContext, input: PackageInput, serialized: S): Effect.Effect<Artifact, unknown, unknown>;
|
|
198
172
|
/** Ships the packaged artifact into the provisioned thing and runs it. Returns the node's outputs for dependents, plus the entities it became on the deployment target. */
|
|
199
173
|
deploy(ctx: LowerContext, provisioned: P, artifact: Artifact, serialized: S): Effect.Effect<LoweredResult, unknown, unknown>;
|
|
200
174
|
/**
|
|
@@ -231,12 +205,13 @@ interface LowerContext {
|
|
|
231
205
|
*/
|
|
232
206
|
readonly application: unknown;
|
|
233
207
|
/**
|
|
234
|
-
* The owning extension's resolved container
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
* 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.
|
|
238
211
|
*/
|
|
239
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;
|
|
240
215
|
/** Already-lowered deps (topo order). */
|
|
241
216
|
readonly lowered: ReadonlyMap<NodeId, Outputs>;
|
|
242
217
|
/** Every provisioned param value minted this lowering, keyed by edge id (ADR-0031). */
|
|
@@ -302,16 +277,16 @@ interface DeploymentResult {
|
|
|
302
277
|
interface LowerOptions {
|
|
303
278
|
/** Stack + root node id. */
|
|
304
279
|
readonly name: string;
|
|
305
|
-
/** The environment being deployed, as `--environment` gave it. Required by any value over `environment.name`;
|
|
280
|
+
/** The environment being deployed, as `--environment` gave it. Required by any value over `environment.name`; every caller passes it. */
|
|
306
281
|
readonly environment?: string;
|
|
307
|
-
/** What the
|
|
282
|
+
/** What the caller's Load read from the app configuration (ADR-0062). Load takes the root's input from it. */
|
|
308
283
|
readonly appConfigurationRead?: AppConfigurationRead;
|
|
309
|
-
/** 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. */
|
|
310
285
|
readonly firstProcessNodeAddresses?: readonly string[];
|
|
311
286
|
readonly bundles: Record<string, Bundle>;
|
|
312
287
|
/** Alchemy state store for the stack. Defaults to the config's own state layer. */
|
|
313
288
|
readonly state?: AlchemyStateLayer;
|
|
314
|
-
/** Explicit provider set for the stack. Defaults to the config's own merged `providers()` (`mergedProviders`) — the same override precedence as `state`.
|
|
289
|
+
/** Explicit provider set for the stack. Defaults to the config's own merged `providers()` (`mergedProviders`) — the same override precedence as `state`. `prisma dev` passes `localTargetProviders(...)` here (ADR-0041); `lower()` itself learns nothing about the local target. */
|
|
315
290
|
readonly providers?: Layer.Layer<never>;
|
|
316
291
|
/**
|
|
317
292
|
* Invoked once per deploy, during apply, with the Deploy operation's result
|
|
@@ -321,8 +296,16 @@ interface LowerOptions {
|
|
|
321
296
|
* declared at all.
|
|
322
297
|
*/
|
|
323
298
|
readonly report?: (result: DeploymentResult) => void;
|
|
324
|
-
/** Addresses lowered without an artifact: `package` and `deploy` are skipped and `reserve` runs instead (ADR-0056). Only
|
|
299
|
+
/** Addresses lowered without an artifact: `package` and `deploy` are skipped and `reserve` runs instead (ADR-0056). Only `prisma dev` sets it. */
|
|
325
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;
|
|
326
309
|
}
|
|
327
310
|
/** A build descriptor's normalized output: the produced bundle dir plus the app's runnable entry within it. */
|
|
328
311
|
interface Bundle {
|
|
@@ -377,6 +360,8 @@ interface Artifact {
|
|
|
377
360
|
declare class LowerError extends Error {
|
|
378
361
|
constructor(message: string);
|
|
379
362
|
}
|
|
363
|
+
/** The `name` of the error `lower()` fails with when it builds a graph whose node addresses differ from `firstProcessNodeAddresses`. */
|
|
364
|
+
declare const GRAPH_CHANGED_ERROR = "GraphChangedError";
|
|
380
365
|
/**
|
|
381
366
|
* Assembles a service's typed Config. Connection params come from the
|
|
382
367
|
* dependency edge's lowered outputs — or, for a param carrying a `provision`
|
|
@@ -413,7 +398,7 @@ declare function joinDeployment(graph: Graph, entries: readonly {
|
|
|
413
398
|
address: string;
|
|
414
399
|
entities: readonly DeployedEntity[];
|
|
415
400
|
}[]): readonly DeployedNode[];
|
|
416
|
-
/** The deploy report: every deployed node joined with its graph node, and the
|
|
401
|
+
/** The deploy report: every deployed node joined with its graph node, and the deploy preflight's findings. */
|
|
417
402
|
declare function deploymentResult(app: string, graph: Graph, entries: readonly {
|
|
418
403
|
address: string;
|
|
419
404
|
entities: readonly DeployedEntity[];
|
|
@@ -431,16 +416,22 @@ declare function resolveStateLayer(opts: LowerOptions, config: PrismaAppConfig,
|
|
|
431
416
|
* extension without `providers` is skipped; no used-extensions-only
|
|
432
417
|
* filtering (ADR-0017's pinned providers rule).
|
|
433
418
|
*/
|
|
434
|
-
declare function mergedProviders(config: PrismaAppConfig): Layer.Layer<never>;
|
|
419
|
+
declare function mergedProviders(config: PrismaAppConfig, credentials?: CallerCredentials): Layer.Layer<never>;
|
|
435
420
|
/**
|
|
436
421
|
* Composable form for mixed stacks: hand-wired Alchemy resources alongside Prisma App nodes in one stack effect.
|
|
437
422
|
* Fails with LowerError or whatever an extension's lowering raises — the error type is open.
|
|
438
423
|
*/
|
|
439
424
|
declare function lowering(root: ModuleNode | AppRootNode, config: PrismaAppConfig, opts: LowerOptions): Effect.Effect<undefined, LowerError, unknown>;
|
|
425
|
+
interface TransportedLowerInputs {
|
|
426
|
+
readonly containers: ReadonlyMap<string, ContainerInstance>;
|
|
427
|
+
readonly preflightPayloads: ReadonlyMap<string, string>;
|
|
428
|
+
}
|
|
429
|
+
/** The containers and preflight payloads a host wrote into the environment of a stack file it runs as a child. */
|
|
430
|
+
declare function transportedLowerInputs(config: PrismaAppConfig): TransportedLowerInputs;
|
|
440
431
|
/**
|
|
441
432
|
* The whole-stack wrapper: Load → route each node through the config's
|
|
442
|
-
* extension registries → an Alchemy Stack
|
|
443
|
-
* CLI
|
|
433
|
+
* extension registries → an Alchemy Stack, which `deploy` hands to
|
|
434
|
+
* `Alchemist.plan` and a generated stack file exports for the alchemy CLI.
|
|
444
435
|
*/
|
|
445
436
|
declare function lower(root: ModuleNode | AppRootNode, config: PrismaAppConfig, opts: LowerOptions): Alchemy.ConfiguredStack<undefined, never>;
|
|
446
437
|
//#endregion
|
|
@@ -459,8 +450,11 @@ interface ExtensionDescriptor {
|
|
|
459
450
|
readonly provisions?: ReadonlyMap<symbol, ProvisionerDescriptor>;
|
|
460
451
|
/** Once-per-lowering hook — the application's shared infrastructure (e.g. prisma-cloud's Project). */
|
|
461
452
|
readonly application?: ApplicationDescriptor;
|
|
462
|
-
/**
|
|
463
|
-
|
|
453
|
+
/**
|
|
454
|
+
* The extension's Alchemy providers — merged across all configured extensions (config order).
|
|
455
|
+
* METHOD SYNTAX REQUIRED, like `preflight`: an extension types `input` against its own client, which assigns here only through method bivariance.
|
|
456
|
+
*/
|
|
457
|
+
providers?(input: ProvidersInput): Layer.Layer<never>;
|
|
464
458
|
/** 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. */
|
|
465
459
|
readonly checkGraph?: (graph: Graph) => void;
|
|
466
460
|
/**
|
|
@@ -470,10 +464,10 @@ interface ExtensionDescriptor {
|
|
|
470
464
|
* platform variable a service needs has a value) and throws to abort the
|
|
471
465
|
* deploy. Async: it talks to the platform (ADR-0064).
|
|
472
466
|
*
|
|
473
|
-
* What it returns
|
|
474
|
-
*
|
|
475
|
-
*
|
|
476
|
-
*
|
|
467
|
+
* What it returns reaches this same extension's lowering as
|
|
468
|
+
* `LowerContext.preflight`: as a value under `deploy` and `prisma dev`, and
|
|
469
|
+
* through the environment (preflight-transport.ts) for `destroy`'s alchemy
|
|
470
|
+
* child, which re-imports the config from scratch. The payload
|
|
477
471
|
* is the extension's own opaque string; the framework never reads it, and a
|
|
478
472
|
* secret value must never go in it. What it hands `input.report` reaches the
|
|
479
473
|
* deploy report through the framework's own transport, not this payload.
|
|
@@ -528,10 +522,15 @@ interface ExtensionDescriptor {
|
|
|
528
522
|
interface StateDescriptor {
|
|
529
523
|
/** The owning extension's id — matched against `ExtensionDescriptor.id`. */
|
|
530
524
|
readonly extension: string;
|
|
531
|
-
/** Build the state layer. `container` is the owning extension's resolved instance; `undefined` when it declared no container descriptor. */
|
|
532
|
-
create(container: ContainerInstance | undefined): AlchemyStateLayer;
|
|
525
|
+
/** 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. */
|
|
526
|
+
create(container: ContainerInstance | undefined, credentials?: CallerCredentials): AlchemyStateLayer;
|
|
527
|
+
}
|
|
528
|
+
/** What `ExtensionDescriptor.providers` receives. `C` erases to `unknown` at the framework boundary, exactly as on `PreflightInput`. */
|
|
529
|
+
interface ProvidersInput<C = unknown> {
|
|
530
|
+
/** What the caller already authenticated (`LowerOptions.credentials`). Absent means the extension falls back to its own credential protocol. */
|
|
531
|
+
readonly credentials?: CallerCredentials<C> | undefined;
|
|
533
532
|
}
|
|
534
|
-
/** The resolved deploy context handed to an extension's `preflight` hook. `C` erases to `unknown` at the framework boundary — see
|
|
533
|
+
/** The resolved deploy context handed to an extension's `preflight` hook. `C` erases to `unknown` at the framework boundary — see CallerCredentials. */
|
|
535
534
|
interface PreflightInput<C = unknown> {
|
|
536
535
|
/** The loaded application graph — the manifest of prerequisites is read from it (`provisionManifest`). */
|
|
537
536
|
readonly graph: Graph;
|
|
@@ -544,7 +543,7 @@ interface PreflightInput<C = unknown> {
|
|
|
544
543
|
/** The app secrets the command read for this environment. */
|
|
545
544
|
readonly secrets: AppSecrets;
|
|
546
545
|
/** What the caller has already authenticated, for the platform calls preflight makes. Absent means the extension falls back to its own credential protocol. */
|
|
547
|
-
readonly credentials?:
|
|
546
|
+
readonly credentials?: CallerCredentials<C> | undefined;
|
|
548
547
|
/** Hands the deploy how many platform variables the check read and which have no value. */
|
|
549
548
|
readonly report?: ((check: PlatformVariableCheck) => void) | undefined;
|
|
550
549
|
/** Shows the user a warning that does not stop the run. Only `prisma dev` passes it and shows the warnings; deploy passes none. */
|
|
@@ -589,7 +588,7 @@ interface ReportBeginInput<C = unknown> {
|
|
|
589
588
|
*/
|
|
590
589
|
readonly reportId: string | undefined;
|
|
591
590
|
/** 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. */
|
|
592
|
-
readonly credentials?:
|
|
591
|
+
readonly credentials?: CallerCredentials<C> | undefined;
|
|
593
592
|
}
|
|
594
593
|
/** The deploy context handed to `RunReporter.attach`, once containers exist. */
|
|
595
594
|
interface ReportAttachInput {
|
|
@@ -656,8 +655,8 @@ interface LocalTargetDescriptor {
|
|
|
656
655
|
providers(input: LocalTargetProvidersInput): Layer.Layer<never>;
|
|
657
656
|
/** A stable local identity — resolved without any platform call. */
|
|
658
657
|
readonly container: ContainerDescriptor;
|
|
659
|
-
/**
|
|
660
|
-
preflight?(input: PreflightInput): Promise<
|
|
658
|
+
/** Works out the platform variables' values, where deploy's preflight runs. Its payload reaches the alchemy process the same way deploy's preflight payload does. */
|
|
659
|
+
preflight?(input: PreflightInput): Promise<DevPreflightResult>;
|
|
661
660
|
/** Ensure the emulator daemons this topology's node kinds need are running, plus any per-node emulator state that must exist before converge (idempotent; daemons persist across sessions). */
|
|
662
661
|
emulators?(input: LocalTargetEmulatorsInput): Promise<void>;
|
|
663
662
|
/** The dev session's view of the running app. Core renders it and never learns an emulator's API. */
|
|
@@ -672,6 +671,12 @@ interface LocalTargetDescriptor {
|
|
|
672
671
|
*/
|
|
673
672
|
current?(input: LocalTargetCurrentInput): Promise<LocalTargetCurrentApp | undefined>;
|
|
674
673
|
}
|
|
674
|
+
/** What a local target's preflight found. */
|
|
675
|
+
interface DevPreflightResult {
|
|
676
|
+
readonly payload: PreflightPayload;
|
|
677
|
+
/** The text of each plain platform variable a service reads, by name. Never a secret. */
|
|
678
|
+
readonly plainVariableText: Readonly<Record<string, string>>;
|
|
679
|
+
}
|
|
675
680
|
interface LocalTargetCurrentInput {
|
|
676
681
|
/** Absolute path of the environment's dev state directory (`devEnvironmentDir`, under the cwd). */
|
|
677
682
|
readonly devDir: string;
|
|
@@ -724,9 +729,9 @@ interface LocalTargetProvidersInput {
|
|
|
724
729
|
readonly container: ContainerInstance | undefined;
|
|
725
730
|
/** Absolute path of the environment's dev state directory (`devEnvironmentDir`, under the cwd). */
|
|
726
731
|
readonly devDir: string;
|
|
727
|
-
/** The text of each
|
|
728
|
-
readonly
|
|
729
|
-
/** The app secrets the graph's
|
|
732
|
+
/** The text of each plain platform variable a service reads, by name. Never a secret. */
|
|
733
|
+
readonly plainVariableText: Readonly<Record<string, string>>;
|
|
734
|
+
/** The app secrets the graph's platform secrets name, which `prisma dev` hands its converge worker thread in memory. A local deployment takes the text its secret `$platform` markers name from it. */
|
|
730
735
|
readonly namedSecrets: NamedSecrets;
|
|
731
736
|
}
|
|
732
737
|
interface LocalTargetEmulatorsInput {
|
|
@@ -835,11 +840,11 @@ interface ConfigAdapterInput {
|
|
|
835
840
|
type ConfigValues = Readonly<Record<string, unknown>>;
|
|
836
841
|
/** A function in the `config` or `secrets` list of the `composer` section (ADR-0062): it receives the environment and returns that environment's values. Only the command's first process calls it; the second process reads what the first read from the app configuration file. */
|
|
837
842
|
type ConfigAdapter = (input: ConfigAdapterInput) => ConfigValues | Promise<ConfigValues>;
|
|
838
|
-
/** The app configuration (ADR-0062): what the `config` adapters return, merged by top-level key, a later adapter winning. It is the root's input, and
|
|
843
|
+
/** The app configuration (ADR-0062): what the `config` adapters return, merged by top-level key, a later adapter winning. It is the root's input, and under `prisma dev` it also holds the text of each plain platform variable. */
|
|
839
844
|
type AppConfiguration = Readonly<Record<string, unknown>>;
|
|
840
|
-
/** The app secrets (ADR-0062): what the `secrets` adapters return, merged the same way. Every value is text. Nothing fills a platform variable from them. `prisma dev` hands
|
|
845
|
+
/** The app secrets (ADR-0062): what the `secrets` adapters return, merged the same way. Every value is text. Nothing fills a platform variable from them. `prisma dev` hands the local target's providers the values under the secrets keys of the graph's secret sources, and Composer redacts those values wherever it prints. */
|
|
841
846
|
type AppSecrets = Readonly<Record<string, string>>;
|
|
842
|
-
/** The app secrets under the secrets keys of the graph's secret sources, each with text. `prisma dev`
|
|
847
|
+
/** The app secrets under the secrets keys of the graph's secret sources, each with text. `prisma dev` hands them to the local target's providers, in memory. */
|
|
843
848
|
type NamedSecrets = Readonly<Record<string, string>>;
|
|
844
849
|
/**
|
|
845
850
|
* The config file's default export. `extensions` lists every extension the
|
|
@@ -860,5 +865,5 @@ interface PrismaAppConfig {
|
|
|
860
865
|
/** Typed identity — exists so the `composer` section of `prisma.config.ts` gets checked against PrismaAppConfig where it is written. */
|
|
861
866
|
declare function defineConfig(config: PrismaAppConfig): PrismaAppConfig;
|
|
862
867
|
//#endregion
|
|
863
|
-
export {
|
|
864
|
-
//# sourceMappingURL=app-config-
|
|
868
|
+
export { ReportBeginInput as $, LocalTargetDescriptor as A, NodeDescriptor as B, LocalNodeCondition as C, preflightEnvVarName as Ct, LocalTargetAttachment as D, LocalTargetAttachInput as E, transportedLowerInputs as Et, LowerError as F, PreflightFindings as G, PackageInput as H, LowerOptions as I, PrismaAppConfig as J, PreflightInput as K, LoweredResult as L, LocalTargetProvidersInput as M, LocateContainerInput as N, LocalTargetCurrentApp as O, LowerContext as P, ReportAttachInput as Q, Lowering as R, GRAPH_CHANGED_ERROR as S, preflightEnv as St, LocalNodeStopped as T, resolveStateLayer as Tt, PlatformVariableCheck as U, Outputs as V, PlatformVariableReader as W, ProvisionEdge as X, ProvidersInput as Y, ProvisionerDescriptor as Z, DeployedNode as _, joinDeployment as _t, Artifact as a, StateDescriptor as at, DevServer as b, mergedProviders as bt, CallerCredentials as c, buildConfig as ct, ConfigValues as d, containerEnvVarName as dt, ReporterDescriptor as et, ContainerDescriptor as f, defineConfig as ft, DeployedEntity as g, isBuildOnlyExtension as gt, DEV_ENVIRONMENT_NAME_FILE as h, devEnvironmentDir as ht, ApplicationDescriptor as i, ServiceLowering as it, LocalTargetEmulatorsInput as j, LocalTargetCurrentInput as k, ConfigAdapter as l, connectionInputs as lt, DEV_DIR as m, deserializeContainers as mt, AppConfiguration as n, RunReporter as nt, AssembleInput as o, TeardownInput as ot, ContainerInstance as p, deploymentResult as pt, PreflightPayload as q, AppSecrets as r, ServeInput as rt, Bundle as s, UnsetPlatformVariable as st, AlchemyStateLayer as t, RunOutcome as tt, ConfigAdapterInput as u, containerEnv as ut, DeploymentResult as v, lower as vt, LocalNodeLocation as w, readPreflightPayload as wt, ExtensionDescriptor as x, platformVariableReaderText as xt, DevPreflightResult as y, lowering as yt, NamedSecrets as z };
|
|
869
|
+
//# sourceMappingURL=app-config-DriAu5RU-C8hYpR38.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-config-DriAu5RU-C8hYpR38.d.mts","names":[],"sources":["../../../0-framework/1-core/core/dist/app-config-DriAu5RU.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,sBAAsB,qBAAqB,+BAA+B,KAAK,SAAS,sCAAsC,oBAAoB;;;;KAI9J;;iBAEY,oBAAoB;;iBAEpB,aAAa,UAAU,8BAA8B;;iBAErD,qBAAqB,qBAAqB,KAAK,SAAS,sCAAsC;;KAE1G;WACM;WACA;WACA;;WAEA;WACA;;;UAGD;WACC;WACA,kBAAkB;;WAElB;;;UAGD;WACC,gBAAgB;;;iBAGV,2BAA2B,QAAQ;;;;KAI/C,oBAAoB,MAAM,MAAM,cAAc;;;;;;UAMzC;EACR,UAAU,KAAK,eAAe,OAAO;;;;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;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"}
|
|
@@ -1,21 +1,48 @@
|
|
|
1
|
-
import { t as CliStructuredError } from "./errors-
|
|
1
|
+
import { t as CliStructuredError } from "./errors-DI3TBXE-.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-D0rB5g65.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, consequence) {
|
|
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}". ${consequence}`, { 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
|
-
/** `prisma dev` only: the named secrets, as a JSON object. */
|
|
9
|
-
const NAMED_SECRETS_ENV = "PRISMA_COMPOSER_NAMED_SECRETS";
|
|
10
41
|
const FILE_NAME = /^app-configuration-(\d+)(-[^/]*)?\.json$/;
|
|
11
|
-
/** The app configuration file a
|
|
42
|
+
/** The app configuration file a destroy run writes: unique per run, so concurrent runs from one checkout never share one. */
|
|
12
43
|
function deployAppConfigurationFile(cwd, runId) {
|
|
13
44
|
return path$1.join(cwd, ".prisma-composer", `app-configuration-${String(process.pid)}-${runId}.json`);
|
|
14
45
|
}
|
|
15
|
-
/** The app configuration file `prisma dev` writes in an environment's folder. */
|
|
16
|
-
function devAppConfigurationFile(devDir) {
|
|
17
|
-
return path$1.join(devDir, `app-configuration-${String(process.pid)}.json`);
|
|
18
|
-
}
|
|
19
46
|
function isRunning(pid) {
|
|
20
47
|
try {
|
|
21
48
|
process.kill(pid, 0);
|
|
@@ -54,64 +81,20 @@ function removeLeftoverAppConfigurationFiles(cwd) {
|
|
|
54
81
|
}
|
|
55
82
|
}
|
|
56
83
|
}
|
|
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
84
|
/**
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
* never the value.
|
|
74
|
-
*/
|
|
75
|
-
function refuseSecretsIn(read, knownSecrets) {
|
|
76
|
-
const places = [...read.rootInput.flatMap((field) => textIn(field.value, field.path).map(({ at, text }) => ({
|
|
77
|
-
where: `Root input field input.${at.join(".")}`,
|
|
78
|
-
text
|
|
79
|
-
}))), ...Object.entries(read.configurationKeyText).map(([key, text]) => ({
|
|
80
|
-
where: `Configuration key "${key}"`,
|
|
81
|
-
text
|
|
82
|
-
}))];
|
|
83
|
-
for (const { where, text } of places) {
|
|
84
|
-
const name = knownSecrets.nameIn(text);
|
|
85
|
-
if (name === void 0) continue;
|
|
86
|
-
throw new CliStructuredError("CONFIG.SECRET_AS_PLAIN_VALUE", `${where} holds the value of the secret "${name}", which an envSecret() 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: `Read the secret with envSecret('${name}') where it is used, or give this plain value text that does not contain the value of "${name}".` });
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* First process: the handover to the second process (ADR-0062). The app configuration file at
|
|
91
|
-
* `file` holds what Load read and the graph's node addresses. With `appSecrets`, which only
|
|
92
|
-
* `prisma dev` passes, the environment also carries the named secrets: the app secrets under
|
|
93
|
-
* the graph's secrets keys, each with text. Refuses when the file would hold any of
|
|
94
|
-
* `knownSecrets`. Every other input is plain data from the graph, such as
|
|
95
|
-
* `graph.appConfigurationRead`, `nodeAddresses(graph)` and `secretsKeys(graph)`, so a caller with
|
|
96
|
-
* its own copy of Composer's core can pass them. The exception is `knownSecrets`, a
|
|
97
|
-
* `KnownSecrets`, which such a caller builds from the testing entry.
|
|
85
|
+
* First process: the app configuration file and the environment the second process starts with (ADR-0062).
|
|
86
|
+
* Refuses a file that would hold any of `knownSecrets`.
|
|
98
87
|
*/
|
|
99
88
|
function prepareSecondProcess(input) {
|
|
100
|
-
const { file
|
|
101
|
-
|
|
89
|
+
const { file } = input;
|
|
90
|
+
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.");
|
|
91
|
+
refuseSecretsInPlainVariables(input.plainVariableText, input.knownSecrets, "Composer hands the second process every plain value in a file, and never writes a secret to a file.");
|
|
102
92
|
const contents = {
|
|
103
93
|
appConfigurationRead: input.appConfigurationRead,
|
|
94
|
+
plainVariableText: input.plainVariableText,
|
|
104
95
|
nodeAddresses: input.nodeAddresses
|
|
105
96
|
};
|
|
106
97
|
const env = { [APP_CONFIGURATION_FILE_ENV]: file };
|
|
107
|
-
if (appSecrets !== void 0) {
|
|
108
|
-
const named = {};
|
|
109
|
-
for (const key of input.secretsKeys) {
|
|
110
|
-
const text = appSecrets[key];
|
|
111
|
-
if (text !== void 0 && text !== "") named[key] = text;
|
|
112
|
-
}
|
|
113
|
-
env[NAMED_SECRETS_ENV] = JSON.stringify(named);
|
|
114
|
-
}
|
|
115
98
|
const remove = () => {
|
|
116
99
|
try {
|
|
117
100
|
fs$1.rmSync(file, { force: true });
|
|
@@ -135,7 +118,7 @@ function prepareSecondProcess(input) {
|
|
|
135
118
|
};
|
|
136
119
|
}
|
|
137
120
|
function missingVariable(name, what) {
|
|
138
|
-
return `${name} is not set. This stack file runs as the second process of a Composer
|
|
121
|
+
return `${name} is not set. This stack file runs as the second process of a Composer destroy, which ${what}.`;
|
|
139
122
|
}
|
|
140
123
|
function isRecord(value) {
|
|
141
124
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -175,7 +158,7 @@ function readAppConfigurationFile(env) {
|
|
|
175
158
|
const message = cause instanceof Error ? cause.message : String(cause);
|
|
176
159
|
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 });
|
|
177
160
|
}
|
|
178
|
-
const notComposers = (what) => /* @__PURE__ */ new Error(`The app configuration file ${file} is not
|
|
161
|
+
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.`);
|
|
179
162
|
let parsed;
|
|
180
163
|
try {
|
|
181
164
|
parsed = JSON.parse(text);
|
|
@@ -187,35 +170,17 @@ function readAppConfigurationFile(env) {
|
|
|
187
170
|
if (!isRecord(read)) throw notComposers("appConfigurationRead is not an object");
|
|
188
171
|
const rootInput = rootFieldsOf(read["rootInput"]);
|
|
189
172
|
if (rootInput === void 0) throw notComposers("rootInput is not a list of fields");
|
|
190
|
-
const
|
|
191
|
-
if (
|
|
173
|
+
const plainVariableText = textByKeyOf(parsed["plainVariableText"]);
|
|
174
|
+
if (plainVariableText === void 0) throw notComposers("plainVariableText is not an object of text");
|
|
192
175
|
const addresses = parsed["nodeAddresses"];
|
|
193
176
|
if (!isTextList(addresses)) throw notComposers("nodeAddresses is not a list of node addresses");
|
|
194
177
|
return {
|
|
195
|
-
appConfigurationRead: {
|
|
196
|
-
|
|
197
|
-
configurationKeyText
|
|
198
|
-
},
|
|
178
|
+
appConfigurationRead: { rootInput },
|
|
179
|
+
plainVariableText,
|
|
199
180
|
nodeAddresses: addresses
|
|
200
181
|
};
|
|
201
182
|
}
|
|
202
|
-
/** Second process, under `prisma dev`: the named secrets the first process handed it. */
|
|
203
|
-
function namedSecretsFromEnvironment(env) {
|
|
204
|
-
const text = env[NAMED_SECRETS_ENV];
|
|
205
|
-
if (text === void 0 || text === "") throw new Error(missingVariable(NAMED_SECRETS_ENV, "hands the secrets the local services need there"));
|
|
206
|
-
let parsed;
|
|
207
|
-
try {
|
|
208
|
-
parsed = JSON.parse(text);
|
|
209
|
-
} catch {
|
|
210
|
-
parsed = void 0;
|
|
211
|
-
}
|
|
212
|
-
const byKey = textByKeyOf(parsed);
|
|
213
|
-
if (byKey === void 0) throw new Error(`${NAMED_SECRETS_ENV} is not a JSON object of text.`);
|
|
214
|
-
const secrets = Object.create(null);
|
|
215
|
-
Object.assign(secrets, byKey);
|
|
216
|
-
return Object.freeze(secrets);
|
|
217
|
-
}
|
|
218
183
|
//#endregion
|
|
219
|
-
export {
|
|
184
|
+
export { refuseSecretsInRootInput as a, refuseSecretsInPlainVariables as i, prepareSecondProcess as n, removeLeftoverAppConfigurationFiles as o, readAppConfigurationFile as r, deployAppConfigurationFile as t };
|
|
220
185
|
|
|
221
|
-
//# sourceMappingURL=app-configuration-file-
|
|
186
|
+
//# sourceMappingURL=app-configuration-file-D0rB5g65-CdMrjkCc.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-configuration-file-D0rB5g65-CdMrjkCc.mjs","names":["path","fs"],"sources":["../../../0-framework/3-tooling/cli/dist/app-configuration-file-D0rB5g65.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, consequence) {\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}\". ${consequence}`, { 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\";\nconst FILE_NAME = /^app-configuration-(\\d+)(-[^/]*)?\\.json$/;\n/** The app configuration file a 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}\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 } = 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, \"Composer hands the second process every plain value in a file, and never writes a secret to a file.\");\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\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, 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//#endregion\nexport { refuseSecretsInPlainVariables as a, removeLeftoverAppConfigurationFiles as i, prepareSecondProcess as n, refuseSecretsInRootInput as o, readAppConfigurationFile as r, deployAppConfigurationFile as t };\n\n//# sourceMappingURL=app-configuration-file-D0rB5g65.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,MAAM,IAAI,CAAC,CAAC,KAAK,EAAE,IAAI,YAAY;EAC3G,OAAO,0BAA0B,GAAG,KAAK,GAAG;EAC5C;CACD,EAAE,CAAC;CACH,KAAK,MAAM,EAAE,OAAO,UAAU,YAAY;EACzC,MAAM,OAAO,aAAa,OAAO,IAAI;EACrC,IAAI,SAAS,KAAK,GAAG;EACrB,MAAM,IAAI,mBAAmB,gCAAgC,GAAG,MAAM,2CAA2C,KAAK,KAAK,eAAe,EAAE,KAAK,0CAA0C,KAAK,mGAA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