@prisma/composer-cli 0.38.0 → 0.39.0-dev.10
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-converge-C_YkTIBF-RmqGOR45.mjs +88 -0
- package/dist/app-converge-C_YkTIBF-RmqGOR45.mjs.map +1 -0
- package/dist/composer-config-QKdY85G--CEXrb2Uc.mjs +254 -0
- package/dist/composer-config-QKdY85G--CEXrb2Uc.mjs.map +1 -0
- package/dist/{validate-environment-CpQLC3CA-Ct-PXoKN.mjs → deploy-Br1yvLe3.mjs} +341 -1082
- package/dist/deploy-Br1yvLe3.mjs.map +1 -0
- package/dist/dev-converge-messages-DML4rTz7-B6uxtpZG.mjs +256 -0
- package/dist/dev-converge-messages-DML4rTz7-B6uxtpZG.mjs.map +1 -0
- package/dist/dev-converge-worker.d.mts +1 -0
- package/dist/dev-converge-worker.mjs +143 -0
- package/dist/dev-converge-worker.mjs.map +1 -0
- package/dist/{dev-current-D-Qb6Yem-CvaY4xsk.mjs → dev-current-DANgmcle-RwunETUJ.mjs} +12 -18
- package/dist/dev-current-DANgmcle-RwunETUJ.mjs.map +1 -0
- package/dist/dev-environment-name-6eEr5PW8-CCY7WNWz.mjs +43 -0
- package/dist/dev-environment-name-6eEr5PW8-CCY7WNWz.mjs.map +1 -0
- package/dist/{dist-BH6HQ6zZ.mjs → dist-C0OGaDnj.mjs} +4 -3
- package/dist/{dist-BH6HQ6zZ.mjs.map → dist-C0OGaDnj.mjs.map} +1 -1
- package/dist/errors-CVYwN2km.mjs +93 -0
- package/dist/errors-CVYwN2km.mjs.map +1 -0
- package/dist/{execute-deploy-destroy-C6EsdmLz-DqdToZ_i.mjs → execute-deploy-destroy-DIR9uvA_-Bk0HBMTz.mjs} +385 -141
- package/dist/execute-deploy-destroy-DIR9uvA_-Bk0HBMTz.mjs.map +1 -0
- package/dist/{execute-dev-gjIKYybU-hRndPEgC.mjs → execute-dev-Cu9_LsQi-CsyIqphZ.mjs} +450 -127
- package/dist/execute-dev-Cu9_LsQi-CsyIqphZ.mjs.map +1 -0
- package/dist/{execute-dev-current-tBKmDAjV-DOOMGrl5.mjs → execute-dev-current-Bs0lE_5--BU3A2hsC.mjs} +9 -6
- package/dist/{execute-dev-current-tBKmDAjV-DOOMGrl5.mjs.map → execute-dev-current-Bs0lE_5--BU3A2hsC.mjs.map} +1 -1
- package/dist/{redaction-Bf8FvTFH-D0dXGsO8.d.mts → family-DfwviKFj-CS1L-EvS.d.mts} +484 -204
- package/dist/family-DfwviKFj-CS1L-EvS.d.mts.map +1 -0
- package/dist/family.d.mts +1 -1
- package/dist/family.mjs +350 -270
- package/dist/family.mjs.map +1 -1
- package/dist/internal-error-Dfur7Zqt-B8J8e7ac.mjs +58 -0
- package/dist/internal-error-Dfur7Zqt-B8J8e7ac.mjs.map +1 -0
- package/dist/{list-deployed-IL0MgmTX.mjs → list-deployed-slo4P7dl.mjs} +6 -5
- package/dist/list-deployed-slo4P7dl.mjs.map +1 -0
- package/dist/local-target-CZzICh5R.mjs +34 -0
- package/dist/local-target-CZzICh5R.mjs.map +1 -0
- package/dist/{config-DiZaanS3.mjs → preflight-transport-2d6iIchu-ArIJUY1L.mjs} +11 -19
- package/dist/preflight-transport-2d6iIchu-ArIJUY1L.mjs.map +1 -0
- package/dist/{redaction-HnbkSFrK-CCKJNRwi.mjs → redaction-DY6eDC12-BrK1aSN5.mjs} +55 -262
- package/dist/redaction-DY6eDC12-BrK1aSN5.mjs.map +1 -0
- package/dist/result-CttmabB6.mjs +91 -0
- package/dist/result-CttmabB6.mjs.map +1 -0
- package/dist/rolldown-runtime-C7HZzL1F.mjs +26 -0
- package/dist/steps-BZXNqW6U-BM2Aa8Bp.mjs +287 -0
- package/dist/steps-BZXNqW6U-BM2Aa8Bp.mjs.map +1 -0
- package/dist/testing.d.mts +4 -49
- package/dist/testing.d.mts.map +1 -1
- package/dist/testing.mjs +2 -75
- package/dist/testing.mjs.map +1 -1
- package/dist/validate-environment-DCZiNSlR-idVge-kq.mjs +983 -0
- package/dist/validate-environment-DCZiNSlR-idVge-kq.mjs.map +1 -0
- package/dist/value-reads-change-text-DcRCv7Zy-Ca8m3bal.mjs +15 -0
- package/dist/value-reads-change-text-DcRCv7Zy-Ca8m3bal.mjs.map +1 -0
- package/package.json +11 -11
- package/src/exports/dev-converge-worker.ts +2 -0
- package/src/exports/testing.ts +1 -4
- package/dist/app-configuration-file-CeJvBAti-Dk65W3Az.mjs +0 -140
- package/dist/app-configuration-file-CeJvBAti-Dk65W3Az.mjs.map +0 -1
- package/dist/config-DiZaanS3.mjs.map +0 -1
- package/dist/dev-current-D-Qb6Yem-CvaY4xsk.mjs.map +0 -1
- package/dist/dev-environment-name-6eEr5PW8-DpdGjmTb.mjs +0 -71
- package/dist/dev-environment-name-6eEr5PW8-DpdGjmTb.mjs.map +0 -1
- package/dist/execute-deploy-destroy-C6EsdmLz-DqdToZ_i.mjs.map +0 -1
- package/dist/execute-dev-gjIKYybU-hRndPEgC.mjs.map +0 -1
- package/dist/generate-dev-stack-BV_n-X9n-BDBjgphH.mjs +0 -100
- package/dist/generate-dev-stack-BV_n-X9n-BDBjgphH.mjs.map +0 -1
- package/dist/list-deployed-IL0MgmTX.mjs.map +0 -1
- package/dist/redaction-Bf8FvTFH-D0dXGsO8.d.mts.map +0 -1
- package/dist/redaction-HnbkSFrK-CCKJNRwi.mjs.map +0 -1
- package/dist/result-sR7PBi61.mjs +0 -229
- package/dist/result-sR7PBi61.mjs.map +0 -1
- package/dist/run-alchemy-OS_ix5g0-DSlHsv2p.mjs +0 -236
- package/dist/run-alchemy-OS_ix5g0-DSlHsv2p.mjs.map +0 -1
- package/dist/validate-environment-CpQLC3CA-Ct-PXoKN.mjs.map +0 -1
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { CommandFamily, RedirectSpec } from "@prisma/cli-engine";
|
|
2
|
+
import * as Alchemy from "alchemy";
|
|
2
3
|
import { Input, StackServices } from "alchemy";
|
|
3
4
|
import * as Effect from "effect/Effect";
|
|
4
5
|
import * as Layer from "effect/Layer";
|
|
6
|
+
import "alchemy/Alchemist";
|
|
7
|
+
import "effect/Cause";
|
|
5
8
|
import { State } from "alchemy/State/State";
|
|
9
|
+
import "alchemy/Provider";
|
|
6
10
|
//#region ../../0-framework/0-foundation/foundation/dist/errors.d.mts
|
|
7
11
|
//#region src/structured-error.d.ts
|
|
8
12
|
interface StructuredError extends Error {
|
|
@@ -98,7 +102,7 @@ declare class SecretBox<T> {
|
|
|
98
102
|
/** The common case: a secret string. */
|
|
99
103
|
type SecretString = SecretBox<string>;
|
|
100
104
|
//#endregion
|
|
101
|
-
//#region ../../0-framework/0-foundation/foundation/dist/pointer-
|
|
105
|
+
//#region ../../0-framework/0-foundation/foundation/dist/pointer-BX2KJ720.d.mts
|
|
102
106
|
//#region src/pointer.d.ts
|
|
103
107
|
declare const POINTER: unique symbol;
|
|
104
108
|
declare const POINTER_TYPE: unique symbol;
|
|
@@ -108,7 +112,7 @@ interface PointerWithKind<T, K extends PointerKind> {
|
|
|
108
112
|
readonly [POINTER]: K;
|
|
109
113
|
readonly [POINTER_TYPE]?: T;
|
|
110
114
|
}
|
|
111
|
-
/** The real value at deploy of a value known only at boot: it names the platform
|
|
115
|
+
/** The real value at deploy of a value known only at boot: it names the variable on the platform that holds the text of a `T`. Its kind is `'secret'` when `T` is a `SecretString` and `'plain'` otherwise. */
|
|
112
116
|
type Pointer<T> = PointerWithKind<T, unknown extends T ? PointerKind : T extends SecretString ? 'secret' : 'plain'>;
|
|
113
117
|
//#endregion
|
|
114
118
|
//#region ../../../node_modules/@standard-schema/spec/dist/index.d.ts
|
|
@@ -188,7 +192,7 @@ declare namespace StandardSchemaV1 {
|
|
|
188
192
|
type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
|
|
189
193
|
}
|
|
190
194
|
//#endregion
|
|
191
|
-
//#region ../../0-framework/1-core/core/dist/graph-types-
|
|
195
|
+
//#region ../../0-framework/1-core/core/dist/graph-types-D4PrtP-l.d.mts
|
|
192
196
|
//#region src/contract.d.ts
|
|
193
197
|
/**
|
|
194
198
|
* A Contract is the declared interface of a service-to-service dependency: a
|
|
@@ -259,6 +263,7 @@ interface Config {
|
|
|
259
263
|
//#region src/value.d.ts
|
|
260
264
|
declare const VALUE: unique symbol;
|
|
261
265
|
declare const VALUE_ORIGIN: unique symbol;
|
|
266
|
+
declare const VALUE_RESOURCE: unique symbol;
|
|
262
267
|
declare const VALUE_TYPE: unique symbol;
|
|
263
268
|
/** Where Load gets a value's real value. Internal to core; not re-exported from the public barrel. */
|
|
264
269
|
type ValueOrigin<T> = {
|
|
@@ -278,34 +283,33 @@ type ValueOrigin<T> = {
|
|
|
278
283
|
} | {
|
|
279
284
|
readonly kind: 'source';
|
|
280
285
|
readonly sourceKind: 'param';
|
|
281
|
-
/** How an error names the source
|
|
286
|
+
/** How an error names the source. */
|
|
282
287
|
readonly label: string;
|
|
283
|
-
|
|
284
|
-
readonly configurationKey: string | undefined;
|
|
288
|
+
readonly resource: NodeId | undefined;
|
|
285
289
|
/** The source itself. Not enumerable, so a copy's origin compares equal and the origin holds no cycle. */
|
|
286
290
|
readonly source: ParamSource;
|
|
287
291
|
} | {
|
|
288
292
|
readonly kind: 'source';
|
|
289
293
|
readonly sourceKind: 'secret';
|
|
290
|
-
/** How an error names the source
|
|
294
|
+
/** How an error names the source. */
|
|
291
295
|
readonly label: string;
|
|
292
|
-
/** The app secrets key that holds the secret's value
|
|
296
|
+
/** The app secrets key that holds the secret's value. `undefined` for a secret source built without one. */
|
|
293
297
|
readonly secretsKey: string | undefined;
|
|
298
|
+
readonly resource: NodeId | undefined;
|
|
294
299
|
/** The source itself. Not enumerable, so a copy's origin compares equal and the origin holds no cycle. */
|
|
295
300
|
readonly source: SecretSource;
|
|
296
301
|
};
|
|
297
302
|
/**
|
|
298
|
-
*
|
|
299
|
-
*
|
|
300
|
-
* one; `resolve()` returns one computed from others; a deploy target's source,
|
|
301
|
-
* such as `envParam()` or `envSecret()`, is one too. A deploy-time value's real
|
|
302
|
-
* value is known by the end of Load; a runtime value's real value at deploy is a pointer.
|
|
303
|
+
* A stand-in a module body passes wherever a `T` is accepted (ADR-0062): `environment.name`, an input field, a `resolve()` result or a target's source.
|
|
304
|
+
* A deploy-time value is known by the end of Load; a runtime value's real value at deploy is a pointer.
|
|
303
305
|
*/
|
|
304
306
|
interface Value<T> {
|
|
305
307
|
readonly [VALUE]: true;
|
|
306
308
|
readonly [VALUE_TYPE]?: T;
|
|
307
309
|
readonly [VALUE_ORIGIN]: ValueOrigin<T>;
|
|
308
310
|
}
|
|
311
|
+
/** A value known only at boot (ADR-0062): its real value at deploy is a `Pointer<T>`, which names the variable on the platform that the service reads at boot. */
|
|
312
|
+
type RuntimeValue<T> = Value<Pointer<T>>;
|
|
309
313
|
/** Plain data: what a `resolve()` function may return. */
|
|
310
314
|
type PlainData = string | number | boolean | null | readonly PlainData[] | {
|
|
311
315
|
readonly [key: string]: PlainData;
|
|
@@ -351,7 +355,7 @@ type NotModuleInput = {
|
|
|
351
355
|
//#region src/node.d.ts
|
|
352
356
|
declare const NODE: unique symbol;
|
|
353
357
|
declare const SECRET_SOURCE: unique symbol;
|
|
354
|
-
/** A secret's source: a target-defined payload core forwards but never inspects. It is a value too, known only at boot; its real value at deploy is the source itself, a secret pointer. A target
|
|
358
|
+
/** A secret's source: a target-defined payload core forwards but never inspects. It is a value too, known only at boot; its real value at deploy is the source itself, a secret pointer. A target builds one with `secretSource()`. */
|
|
355
359
|
interface SecretSource<T = unknown> extends Value<unknown> {
|
|
356
360
|
readonly [SECRET_SOURCE]: true;
|
|
357
361
|
/** Target-defined. Core never reads this; the target that authored the source reads it back. */
|
|
@@ -367,14 +371,14 @@ interface ProvisionNeed<T = unknown> {
|
|
|
367
371
|
readonly payload: T;
|
|
368
372
|
}
|
|
369
373
|
declare const PARAM_SOURCE: unique symbol;
|
|
370
|
-
/** A param's source: a target-defined payload core forwards but never inspects. It is a value too
|
|
374
|
+
/** A param's source: a target-defined payload core forwards but never inspects. It is a value too, known only at boot, with the source itself as its real value: a secret pointer when it is redacted, a plain pointer otherwise. A target builds one with `paramSource()`. */
|
|
371
375
|
interface ParamSource<T = unknown> extends Value<unknown> {
|
|
372
376
|
readonly [PARAM_SOURCE]: true;
|
|
373
377
|
/** Target-defined. Core never reads this; the target that authored the source reads it back. */
|
|
374
378
|
readonly payload: T;
|
|
375
379
|
}
|
|
376
|
-
/** What `provision(service, { params })` accepts per declared param: a literal (schema-validated when config is built) or
|
|
377
|
-
type ParamBindings<P extends Params> = { readonly [K in keyof P]?: StandardSchemaV1.InferOutput<P[K]['schema']> |
|
|
380
|
+
/** What `provision(service, { params })` accepts per declared param: a literal (schema-validated when config is built) or a deploy-time value, taking precedence over `param.default`. Every entry is optional — an unbound param falls back to its `default`. */
|
|
381
|
+
type ParamBindings<P extends Params> = { readonly [K in keyof P]?: StandardSchemaV1.InferOutput<P[K]['schema']> | (StandardSchemaV1.InferOutput<P[K]['schema']> extends PlainData ? Value<StandardSchemaV1.InferOutput<P[K]['schema']>> : never); };
|
|
378
382
|
/**
|
|
379
383
|
* What `provision(node, { input })` accepts, for a module or a service, where
|
|
380
384
|
* the node's input schema expects `T` (its Standard Schema input type): the
|
|
@@ -516,8 +520,8 @@ interface AppRootContext<I extends StandardSchemaV1 | undefined = StandardSchema
|
|
|
516
520
|
readonly input: I extends StandardSchemaV1 ? ModuleInput<I> : undefined;
|
|
517
521
|
/** The deploy-time facts of the environment, each a value (ADR-0062). */
|
|
518
522
|
readonly environment: EnvironmentFacts;
|
|
519
|
-
/** Registers an owned child (resource, service or
|
|
520
|
-
readonly provision:
|
|
523
|
+
/** Registers an owned child (resource, service, module or value resource) under a stable id. */
|
|
524
|
+
readonly provision: AppRootProvision;
|
|
521
525
|
}
|
|
522
526
|
/**
|
|
523
527
|
* A module's forwarded-input value: the same ref-port shape a producer's
|
|
@@ -590,21 +594,25 @@ type ModuleProvisionOptions<D extends Deps, I extends StandardSchemaV1 | undefin
|
|
|
590
594
|
} : unknown);
|
|
591
595
|
/** The options are optional exactly when nothing is required. */
|
|
592
596
|
type ModuleProvisionArgs<D extends Deps, I extends StandardSchemaV1 | undefined> = I extends StandardSchemaV1 ? [opts: ModuleProvisionOptions<D, I>] : [keyof D] extends [never] ? [opts?: ModuleProvisionOptions<D, I>] : [opts: ModuleProvisionOptions<D, I>];
|
|
593
|
-
|
|
594
|
-
|
|
597
|
+
type ProvisionArgs<N> = N extends ValueResourceNode ? [opts?: {
|
|
598
|
+
id?: string;
|
|
599
|
+
}] : N extends ServiceNode<infer D, infer P, Expose, infer I> ? ServiceProvisionArgs<D, I, ParamBindings<P>> : N extends ModuleNode<infer D, Expose, infer I> ? ModuleProvisionArgs<D, I> : never;
|
|
595
600
|
/** The contracts a service or module node `N` exposes. */
|
|
596
601
|
type ExposeOf<N> = N extends ServiceNode<Deps, Params, infer E, StandardSchemaV1 | undefined> ? E : N extends ModuleNode<Deps, infer E, StandardSchemaV1 | undefined> ? E : never;
|
|
597
|
-
|
|
602
|
+
type OnlyInAppRoot = "Only appRoot() can provision a resource that is a value. Provision it in the app root and pass its value down through this module's input.";
|
|
603
|
+
interface SharedProvision {
|
|
598
604
|
/** Provisions an owned resource; its id defaults to the node's `name`. */
|
|
599
|
-
|
|
605
|
+
<C extends AnyContract | undefined>(resource: ResourceNode<C> & {
|
|
606
|
+
readonly [VALUE_RESOURCE]?: undefined;
|
|
607
|
+
}, opts?: {
|
|
600
608
|
id?: string;
|
|
601
609
|
}): {
|
|
602
610
|
readonly id: string;
|
|
603
611
|
} & (C extends AnyContract ? RefPort<C> : Record<never, never>);
|
|
604
|
-
/** Registers an owned service; its id defaults to the node's `name`; `deps`/`input` are required iff it declares them; a reserved param may be bound (literal or
|
|
605
|
-
|
|
612
|
+
/** Registers an owned service; its id defaults to the node's `name`; `deps`/`input` are required iff it declares them; a reserved param may be bound (literal or deploy-time value), overriding its default. */
|
|
613
|
+
<D extends Deps, P extends Params, E extends Expose, I extends StandardSchemaV1 | undefined>(service: ServiceNode<D, P, E, I>, ...args: ServiceProvisionArgs<D, I, ParamBindings<P>>): ProvisionedRef<E>;
|
|
606
614
|
/** Registers an owned child module; its id defaults to the node's `name`; `deps` and `input` are required iff it declares them. */
|
|
607
|
-
|
|
615
|
+
<D extends Deps, E extends Expose, I extends StandardSchemaV1 | undefined>(child: ModuleNode<D, E, I>, ...args: ModuleProvisionArgs<D, I>): ProvisionedRef<E>;
|
|
608
616
|
/**
|
|
609
617
|
* The service call with `deps` written out. `ServiceProvisionArgs` above
|
|
610
618
|
* cannot resolve while `D` or `I` is still an unbound type parameter — a
|
|
@@ -612,40 +620,52 @@ interface ModuleBuilder {
|
|
|
612
620
|
* that call site resolves to this overload, or to the next one for a
|
|
613
621
|
* service without an input schema.
|
|
614
622
|
*/
|
|
615
|
-
|
|
623
|
+
<D extends Deps, P extends Params, E extends Expose, I extends StandardSchemaV1 | undefined>(service: ServiceNode<D, P, E, I>, opts: {
|
|
616
624
|
id?: string;
|
|
617
625
|
deps: DepBindings<D>;
|
|
618
626
|
input: InputBindingOf<I>;
|
|
619
627
|
params?: ParamBindings<P>;
|
|
620
628
|
}): ProvisionedRef<E>;
|
|
621
|
-
|
|
629
|
+
<D extends Deps, P extends Params, E extends Expose>(service: ServiceNode<D, P, E, undefined>, opts: {
|
|
622
630
|
id?: string;
|
|
623
631
|
deps: DepBindings<D>;
|
|
624
632
|
input?: never;
|
|
625
633
|
params?: ParamBindings<P>;
|
|
626
634
|
}): ProvisionedRef<E>;
|
|
627
635
|
/** The child-module call with `deps` written out — the same generic-wrapper escape as the two service overloads above. */
|
|
628
|
-
|
|
636
|
+
<D extends Deps, E extends Expose, I extends StandardSchemaV1 | undefined>(child: ModuleNode<D, E, I>, opts: {
|
|
629
637
|
id?: string;
|
|
630
638
|
deps: DepBindings<D>;
|
|
631
639
|
input: InputBindingOf<I>;
|
|
632
640
|
}): ProvisionedRef<E>;
|
|
633
|
-
|
|
641
|
+
<D extends Deps, E extends Expose>(child: ModuleNode<D, E, undefined>, opts: {
|
|
634
642
|
id?: string;
|
|
635
643
|
deps: DepBindings<D>;
|
|
636
644
|
input?: never;
|
|
637
645
|
}): ProvisionedRef<E>;
|
|
638
|
-
/**
|
|
639
|
-
* Any service or child module. Declared last, so a call no overload accepts
|
|
640
|
-
* reports this overload's error, which names the binding key that does not
|
|
641
|
-
* fit, or says a module's whole input is not a value.
|
|
642
|
-
*/
|
|
643
|
-
provision<N extends ServiceNode | ModuleNode>(node: N, ...args: ProvisionArgs<N>): ProvisionedRef<ExposeOf<N>>;
|
|
644
646
|
}
|
|
647
|
+
type ProvisionInModule = <N extends ServiceNode | ModuleNode | ValueResourceNode>(node: N extends ValueResourceNode ? OnlyInAppRoot : N, ...args: ProvisionArgs<N>) => ProvisionedRef<ExposeOf<N>>;
|
|
648
|
+
type ProvisionValue = <V extends SourceValue>(node: ValueResourceNode<V>, opts?: {
|
|
649
|
+
readonly id?: string;
|
|
650
|
+
}) => V & {
|
|
651
|
+
readonly id: string;
|
|
652
|
+
};
|
|
653
|
+
type ProvisionInAppRoot = <N extends ServiceNode | ModuleNode | ValueResourceNode>(node: N, ...args: ProvisionArgs<N>) => ProvisionedRef<ExposeOf<N>>;
|
|
654
|
+
interface ModuleBuilder {
|
|
655
|
+
/** Registers an owned child (resource, service or module) under a stable id. */
|
|
656
|
+
readonly provision: SharedProvision & ProvisionInModule;
|
|
657
|
+
}
|
|
658
|
+
type AppRootProvision = ProvisionValue & SharedProvision & ProvisionInAppRoot;
|
|
645
659
|
/** Dependency map: name → the slot the service declares. Only declarations are admitted, never a concrete ResourceNode. */
|
|
646
660
|
type Deps = Record<string, DependencyEnd<any, any>>;
|
|
647
661
|
/** Output-port map: name → the Contract a service exposes for others to depend on. */
|
|
648
662
|
type Expose = Readonly<Record<string, AnyContract>>;
|
|
663
|
+
/** What a value resource holds: a secret source or a param source, known only at boot. */
|
|
664
|
+
type SourceValue = (SecretSource | ParamSource) & RuntimeValue<unknown>;
|
|
665
|
+
/** A resource node that is also a value. Only `provision()` in an app root's body takes its value out. It provides no contract and has no dependencies. */
|
|
666
|
+
type ValueResourceNode<V extends SourceValue = SourceValue> = ResourceNode<undefined, Record<never, never>> & {
|
|
667
|
+
readonly [VALUE_RESOURCE]: V;
|
|
668
|
+
};
|
|
649
669
|
//#endregion
|
|
650
670
|
//#region src/graph-types.d.ts
|
|
651
671
|
/** Path-derived: root-scope children are bare ids ("auth", "db"); a nested module's own children dot-join under its address ("auth.db"). */
|
|
@@ -658,15 +678,14 @@ interface RootInputField {
|
|
|
658
678
|
readonly value?: unknown;
|
|
659
679
|
}
|
|
660
680
|
/**
|
|
661
|
-
* What a Load read from the app configuration (ADR-0062).
|
|
662
|
-
*
|
|
663
|
-
*
|
|
681
|
+
* What a Load read from the app configuration (ADR-0062). A later Load takes it in place of the
|
|
682
|
+
* app configuration: `lower()` under `deploy` (on the main thread) and `prisma dev` (in its
|
|
683
|
+
* converge worker thread), and `destroy`'s second process, which reads it from the app
|
|
684
|
+
* configuration file.
|
|
664
685
|
*/
|
|
665
686
|
interface AppConfigurationRead {
|
|
666
687
|
/** Each field of the root's input that its body names, as the root's schema produced it. Empty when the root declares no input. */
|
|
667
688
|
readonly rootInput: readonly RootInputField[];
|
|
668
|
-
/** The text the app configuration holds for each configuration key a source reads, such as `envParam('NAME')`'s `NAME`. A key the app configuration does not hold, or holds as `''`, is absent. */
|
|
669
|
-
readonly configurationKeyText: Readonly<Record<string, string>>;
|
|
670
689
|
}
|
|
671
690
|
interface GraphNode {
|
|
672
691
|
readonly id: NodeId;
|
|
@@ -732,31 +751,32 @@ interface InputBindingUse {
|
|
|
732
751
|
/** The binding object supplied at provision. */
|
|
733
752
|
readonly binding: unknown;
|
|
734
753
|
}
|
|
735
|
-
/**
|
|
736
|
-
* A resolved param binding: a `provision()` call bound a service's param
|
|
737
|
-
* slot to either a literal value or an opaque `ParamSource` — the non-secret
|
|
738
|
-
* sibling of `SecretBinding`. Unlike a secret, a param binding is not
|
|
739
|
-
* required for every declared param (a param may fall back to its own
|
|
740
|
-
* `default`), so this list only carries the ones a `provision()` call
|
|
741
|
-
* actually bound.
|
|
742
|
-
*/
|
|
743
754
|
interface ParamBinding {
|
|
744
755
|
/** The graph address of the service that declares the param. */
|
|
745
756
|
readonly serviceAddress: NodeId;
|
|
746
757
|
/** The param name on that service. */
|
|
747
758
|
readonly slot: string;
|
|
748
|
-
/** A literal value
|
|
759
|
+
/** A literal value, schema-validated by `buildConfig`. */
|
|
749
760
|
readonly binding: unknown;
|
|
750
761
|
}
|
|
751
|
-
/** A secret source a binding in the graph names, wherever it sits (ADR-0029). Deploy preflight checks every one, including one in a module's input that no service receives. */
|
|
762
|
+
/** A secret source a binding in the graph names, or a secret value resource, wherever it sits (ADR-0029). Deploy preflight checks every one, including one in a module's input that no service receives. */
|
|
752
763
|
interface SecretSourceUse {
|
|
753
764
|
/** The source, as its target built it. Core never reads its payload. */
|
|
754
765
|
readonly source: SecretSource;
|
|
755
|
-
/** A service whose final binding holds it, if one does. Otherwise the module whose input holds it. */
|
|
766
|
+
/** A service whose final binding holds it, if one does. Otherwise the secret value resource itself, or the module whose input holds it. */
|
|
756
767
|
readonly address: NodeId;
|
|
757
768
|
/** That node's kind. */
|
|
758
769
|
readonly nodeKind: 'service' | 'module' | 'resource';
|
|
759
770
|
}
|
|
771
|
+
/** One service reading one value resource's value. */
|
|
772
|
+
interface ValueRead {
|
|
773
|
+
/** The service whose resolved binding holds the value. */
|
|
774
|
+
readonly reader: NodeId;
|
|
775
|
+
/** The address of the value resource. */
|
|
776
|
+
readonly resource: NodeId;
|
|
777
|
+
/** The dotted key path in the service's input binding; `''` for the whole binding. */
|
|
778
|
+
readonly path: string;
|
|
779
|
+
}
|
|
760
780
|
interface Graph {
|
|
761
781
|
readonly root: GraphNode;
|
|
762
782
|
/** Root + one per input, topo-ordered (deps first). */
|
|
@@ -768,26 +788,31 @@ interface Graph {
|
|
|
768
788
|
readonly authoredEdges: readonly AuthoredEdge[];
|
|
769
789
|
/** Every service input binding a `provision()` call supplied (ADR-0042). */
|
|
770
790
|
readonly inputBindings: readonly InputBindingUse[];
|
|
771
|
-
/** Every service param bound at provision
|
|
791
|
+
/** Every service param bound at provision; unbound params are absent here and fall back to their `default` (see `buildConfig`). */
|
|
772
792
|
readonly params: readonly ParamBinding[];
|
|
773
|
-
/** Every secret source a binding names,
|
|
793
|
+
/** Every secret source a binding names, and every secret value resource, once each (ADR-0029). */
|
|
774
794
|
readonly secretSources: readonly SecretSourceUse[];
|
|
795
|
+
/** Each service that reads a value resource's value, and where in its binding it reads it. */
|
|
796
|
+
readonly valueReads: readonly ValueRead[];
|
|
775
797
|
/** What this Load read from the app configuration (ADR-0062). Empty when Load was given none. */
|
|
776
798
|
readonly appConfigurationRead: AppConfigurationRead;
|
|
777
799
|
}
|
|
778
800
|
//#endregion
|
|
779
|
-
//#region ../../0-framework/1-core/core/dist/app-config-
|
|
780
|
-
//#region src/
|
|
801
|
+
//#region ../../0-framework/1-core/core/dist/app-config-DriAu5RU.d.mts
|
|
802
|
+
//#region src/caller-credentials.d.ts
|
|
781
803
|
/**
|
|
782
|
-
*
|
|
783
|
-
*
|
|
784
|
-
*
|
|
785
|
-
* from scratch and needs those containers back — and env vars are the only
|
|
786
|
-
* channel between the two. So the CLI writes each instance's `serialize()`
|
|
787
|
-
* output into one env var per extension, and in the alchemy process
|
|
788
|
-
* `deserializeContainers` reads each var back through the same extension's
|
|
789
|
-
* descriptor. The framework owns the vars; it never reads their contents.
|
|
804
|
+
* What the caller has already authenticated, handed unchanged to every
|
|
805
|
+
* extension hook that talks to the platform. `C` is the extension's own client
|
|
806
|
+
* type: this module cannot import a platform SDK.
|
|
790
807
|
*/
|
|
808
|
+
interface CallerCredentials<C = unknown> {
|
|
809
|
+
/** The workspace the caller acts in. `undefined` when the caller has no workspace to name — the extension decides whether it can proceed. */
|
|
810
|
+
readonly workspaceId: string | undefined;
|
|
811
|
+
/** An already-authenticated platform API client. Present means the extension must not build its own from the environment. */
|
|
812
|
+
readonly client?: C | undefined;
|
|
813
|
+
}
|
|
814
|
+
//#endregion
|
|
815
|
+
//#region src/container-transport.d.ts
|
|
791
816
|
/** The key an extension resolves a container from: which app, which environment. */
|
|
792
817
|
interface LocateContainerInput {
|
|
793
818
|
/** The application name (root node's name, or `--name`). */
|
|
@@ -807,25 +832,6 @@ interface ContainerInstance {
|
|
|
807
832
|
/** Serialize to a non-empty string for the process transport above. The format is the extension's own; only its `deserialize` reads it. */
|
|
808
833
|
serialize(): string;
|
|
809
834
|
}
|
|
810
|
-
/**
|
|
811
|
-
* What the caller has already authenticated, handed to one container
|
|
812
|
-
* lifecycle call. A caller that holds neither omits the argument, and the
|
|
813
|
-
* extension falls back to whatever credential protocol it defines for
|
|
814
|
-
* itself (for Prisma Cloud, its env vars — which is how the alchemy child
|
|
815
|
-
* process still resolves containers).
|
|
816
|
-
*
|
|
817
|
-
* `C` is the extension's own platform-client type, left as a type parameter
|
|
818
|
-
* because this shared-plane module must not import a platform SDK; the
|
|
819
|
-
* framework only carries the value, never calls it. The framework stores the
|
|
820
|
-
* erased `C = unknown` form and the extension recovers its concrete client
|
|
821
|
-
* through the same method bivariance that erases `I` below.
|
|
822
|
-
*/
|
|
823
|
-
interface ContainerCredentials<C = unknown> {
|
|
824
|
-
/** The workspace the container lives in. `undefined` when the caller has no workspace to name — the extension decides whether it can proceed. */
|
|
825
|
-
readonly workspaceId: string | undefined;
|
|
826
|
-
/** An already-authenticated platform API client. Present means the extension must not build its own from the environment. */
|
|
827
|
-
readonly client?: C | undefined;
|
|
828
|
-
}
|
|
829
835
|
/**
|
|
830
836
|
* The platform containers an app deploys into, as one lifecycle. `I` is
|
|
831
837
|
* the extension's own instance type — the same descriptor produces and
|
|
@@ -838,11 +844,11 @@ interface ContainerCredentials<C = unknown> {
|
|
|
838
844
|
*/
|
|
839
845
|
interface ContainerDescriptor<I extends ContainerInstance = ContainerInstance, C = unknown> {
|
|
840
846
|
/** Resolve the container for (appName, environment), creating anything absent. Called by `deploy`. */
|
|
841
|
-
ensure(input: LocateContainerInput, credentials?:
|
|
847
|
+
ensure(input: LocateContainerInput, credentials?: CallerCredentials<C>): Promise<I>;
|
|
842
848
|
/** Find the container for (appName, environment); `undefined` when nothing exists. Called by `destroy` — never creates. */
|
|
843
|
-
locate(input: LocateContainerInput, credentials?:
|
|
849
|
+
locate(input: LocateContainerInput, credentials?: CallerCredentials<C>): Promise<I | undefined>;
|
|
844
850
|
/** Remove the container after a successful destroy, after every extension's `teardown` has run. Failure policy is the extension's. */
|
|
845
|
-
remove(instance: I, credentials?:
|
|
851
|
+
remove(instance: I, credentials?: CallerCredentials<C>): Promise<void>;
|
|
846
852
|
/** Reconstruct an instance from its own `serialize()` output — the far end of the framework's parent→child transport. */
|
|
847
853
|
deserialize(serialized: string): I;
|
|
848
854
|
}
|
|
@@ -850,6 +856,26 @@ interface ContainerDescriptor<I extends ContainerInstance = ContainerInstance, C
|
|
|
850
856
|
//#region src/preflight-transport.d.ts
|
|
851
857
|
/** A string only this extension reads back, or `undefined` when it has nothing to carry. */
|
|
852
858
|
type PreflightPayload = string | undefined;
|
|
859
|
+
/** Where a platform variable is named: a service's input field, or a resource no service reads. */
|
|
860
|
+
type PlatformVariableReader = {
|
|
861
|
+
readonly kind: 'field';
|
|
862
|
+
readonly service: string;
|
|
863
|
+
readonly path: string;
|
|
864
|
+
} | {
|
|
865
|
+
readonly kind: 'unread';
|
|
866
|
+
readonly node: string;
|
|
867
|
+
};
|
|
868
|
+
/** A platform variable with no value that nothing requires, with its readers and the commands that set it. */
|
|
869
|
+
interface UnsetPlatformVariable {
|
|
870
|
+
readonly name: string;
|
|
871
|
+
readonly readers: readonly PlatformVariableReader[];
|
|
872
|
+
/** Shell commands that each set it, in the order to offer them. */
|
|
873
|
+
readonly commands: readonly string[];
|
|
874
|
+
}
|
|
875
|
+
/** What a deploy preflight found that does not stop the deploy. Names and readers only, never a value. */
|
|
876
|
+
interface PreflightFindings {
|
|
877
|
+
readonly unset: readonly UnsetPlatformVariable[];
|
|
878
|
+
}
|
|
853
879
|
//#endregion
|
|
854
880
|
//#region src/control/deploy.d.ts
|
|
855
881
|
/** The Layer shape every Alchemy state store must satisfy — what `LowerOptions.state` and `PrismaAppConfig.state` both traffic in. */
|
|
@@ -886,7 +912,7 @@ interface ProvisionerDescriptor {
|
|
|
886
912
|
/**
|
|
887
913
|
* The phased service SPI. `P` and `S` are the descriptor's OWN intra-node
|
|
888
914
|
* handoff types — provision's product consumed by serialize/deploy, and
|
|
889
|
-
* serialize's product consumed by deploy. Core threads them through without
|
|
915
|
+
* serialize's product consumed by package/deploy. Core threads them through without
|
|
890
916
|
* inspection; only the descriptor that writes them reads them.
|
|
891
917
|
*
|
|
892
918
|
* Method syntax (not property-arrow) is required: the heterogeneous
|
|
@@ -910,9 +936,10 @@ interface ServiceLowering<P = unknown, S = unknown> {
|
|
|
910
936
|
/**
|
|
911
937
|
* Prints the bootstrap and assembles the deployable artifact from the
|
|
912
938
|
* app-built bundle. Must be byte-deterministic: an unchanged service noops
|
|
913
|
-
* on redeploy.
|
|
939
|
+
* on redeploy. `serialized` is this service's `serialize` product. It must
|
|
940
|
+
* not write a secret, or a value the deploy has not resolved, into the artifact.
|
|
914
941
|
*/
|
|
915
|
-
package(ctx: LowerContext, input: PackageInput): Effect.Effect<Artifact, unknown, unknown>;
|
|
942
|
+
package(ctx: LowerContext, input: PackageInput, serialized: S): Effect.Effect<Artifact, unknown, unknown>;
|
|
916
943
|
/** 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. */
|
|
917
944
|
deploy(ctx: LowerContext, provisioned: P, artifact: Artifact, serialized: S): Effect.Effect<LoweredResult, unknown, unknown>;
|
|
918
945
|
/**
|
|
@@ -949,12 +976,13 @@ interface LowerContext {
|
|
|
949
976
|
*/
|
|
950
977
|
readonly application: unknown;
|
|
951
978
|
/**
|
|
952
|
-
* The owning extension's resolved container
|
|
953
|
-
*
|
|
954
|
-
*
|
|
955
|
-
* container descriptor.
|
|
979
|
+
* The owning extension's resolved container; core never reads it — the
|
|
980
|
+
* extension narrows it with its own type guard. `undefined` when the
|
|
981
|
+
* extension declares no container descriptor.
|
|
956
982
|
*/
|
|
957
983
|
readonly container: ContainerInstance | undefined;
|
|
984
|
+
/** What the owning extension's preflight handed back this run; `undefined` when it returned nothing or ran no preflight. Core never reads it. */
|
|
985
|
+
readonly preflight: PreflightPayload;
|
|
958
986
|
/** Already-lowered deps (topo order). */
|
|
959
987
|
readonly lowered: ReadonlyMap<NodeId, Outputs>;
|
|
960
988
|
/** Every provisioned param value minted this lowering, keyed by edge id (ADR-0031). */
|
|
@@ -1014,20 +1042,22 @@ interface DeployedNode {
|
|
|
1014
1042
|
interface DeploymentResult {
|
|
1015
1043
|
readonly app: string;
|
|
1016
1044
|
readonly nodes: readonly DeployedNode[];
|
|
1045
|
+
/** What every extension's deploy preflight found that did not stop the deploy. */
|
|
1046
|
+
readonly findings: PreflightFindings;
|
|
1017
1047
|
}
|
|
1018
1048
|
interface LowerOptions {
|
|
1019
1049
|
/** Stack + root node id. */
|
|
1020
1050
|
readonly name: string;
|
|
1021
|
-
/** The environment being deployed, as `--environment` gave it. Required by any value over `environment.name`;
|
|
1051
|
+
/** The environment being deployed, as `--environment` gave it. Required by any value over `environment.name`; every caller passes it. */
|
|
1022
1052
|
readonly environment?: string;
|
|
1023
|
-
/** What the
|
|
1053
|
+
/** What the caller's Load read from the app configuration (ADR-0062). Load takes the root's input from it. */
|
|
1024
1054
|
readonly appConfigurationRead?: AppConfigurationRead;
|
|
1025
|
-
/** The node addresses of the graph the
|
|
1055
|
+
/** The node addresses of the graph the caller built. When given, lowering refuses a graph whose addresses differ. */
|
|
1026
1056
|
readonly firstProcessNodeAddresses?: readonly string[];
|
|
1027
1057
|
readonly bundles: Record<string, Bundle>;
|
|
1028
1058
|
/** Alchemy state store for the stack. Defaults to the config's own state layer. */
|
|
1029
1059
|
readonly state?: AlchemyStateLayer;
|
|
1030
|
-
/** Explicit provider set for the stack. Defaults to the config's own merged `providers()` (`mergedProviders`) — the same override precedence as `state`.
|
|
1060
|
+
/** 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. */
|
|
1031
1061
|
readonly providers?: Layer.Layer<never>;
|
|
1032
1062
|
/**
|
|
1033
1063
|
* Invoked once per deploy, during apply, with the Deploy operation's result
|
|
@@ -1037,8 +1067,16 @@ interface LowerOptions {
|
|
|
1037
1067
|
* declared at all.
|
|
1038
1068
|
*/
|
|
1039
1069
|
readonly report?: (result: DeploymentResult) => void;
|
|
1040
|
-
/** Addresses lowered without an artifact: `package` and `deploy` are skipped and `reserve` runs instead (ADR-0056). Only
|
|
1070
|
+
/** Addresses lowered without an artifact: `package` and `deploy` are skipped and `reserve` runs instead (ADR-0056). Only `prisma dev` sets it. */
|
|
1041
1071
|
readonly unassembled?: readonly string[];
|
|
1072
|
+
/** 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. */
|
|
1073
|
+
readonly containers?: ReadonlyMap<string, ContainerInstance> | undefined;
|
|
1074
|
+
/** What each extension's preflight returned, by extension id. Each lowering context gets its own extension's entry as `LowerContext.preflight`. */
|
|
1075
|
+
readonly preflightPayloads?: ReadonlyMap<string, string> | undefined;
|
|
1076
|
+
/** The platform variables with no value that the deploy preflight found. The deploy report carries them. Absent means none. */
|
|
1077
|
+
readonly findings?: PreflightFindings;
|
|
1078
|
+
/** 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. */
|
|
1079
|
+
readonly credentials?: CallerCredentials | undefined;
|
|
1042
1080
|
}
|
|
1043
1081
|
/** A build descriptor's normalized output: the produced bundle dir plus the app's runnable entry within it. */
|
|
1044
1082
|
interface Bundle {
|
|
@@ -1090,6 +1128,12 @@ interface Artifact {
|
|
|
1090
1128
|
readonly path: string;
|
|
1091
1129
|
readonly sha256: string;
|
|
1092
1130
|
}
|
|
1131
|
+
/**
|
|
1132
|
+
* The whole-stack wrapper: Load → route each node through the config's
|
|
1133
|
+
* extension registries → an Alchemy Stack, which `deploy` hands to
|
|
1134
|
+
* `Alchemist.plan` and a generated stack file exports for the alchemy CLI.
|
|
1135
|
+
*/
|
|
1136
|
+
declare function lower(root: ModuleNode | AppRootNode, config: PrismaAppConfig, opts: LowerOptions): Alchemy.ConfiguredStack<undefined, never>;
|
|
1093
1137
|
//#endregion
|
|
1094
1138
|
//#region src/control/app-config.d.ts
|
|
1095
1139
|
/**
|
|
@@ -1106,21 +1150,27 @@ interface ExtensionDescriptor {
|
|
|
1106
1150
|
readonly provisions?: ReadonlyMap<symbol, ProvisionerDescriptor>;
|
|
1107
1151
|
/** Once-per-lowering hook — the application's shared infrastructure (e.g. prisma-cloud's Project). */
|
|
1108
1152
|
readonly application?: ApplicationDescriptor;
|
|
1109
|
-
/**
|
|
1110
|
-
|
|
1153
|
+
/**
|
|
1154
|
+
* The extension's Alchemy providers — merged across all configured extensions (config order).
|
|
1155
|
+
* METHOD SYNTAX REQUIRED, like `preflight`: an extension types `input` against its own client, which assigns here only through method bivariance.
|
|
1156
|
+
*/
|
|
1157
|
+
providers?(input: ProvidersInput): Layer.Layer<never>;
|
|
1158
|
+
/** 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. */
|
|
1159
|
+
readonly checkGraph?: (graph: Graph) => void;
|
|
1111
1160
|
/**
|
|
1112
1161
|
* Deploy-time prerequisite check — the CLI runs it once, after the app's
|
|
1113
1162
|
* Project/Branch are resolved and BEFORE any stack file is written or Alchemy
|
|
1114
1163
|
* runs. A target uses it to verify platform prerequisites (e.g. that every
|
|
1115
|
-
*
|
|
1116
|
-
*
|
|
1164
|
+
* platform variable a service needs has a value) and throws to abort the
|
|
1165
|
+
* deploy. Async: it talks to the platform (ADR-0064).
|
|
1117
1166
|
*
|
|
1118
|
-
* What it returns
|
|
1119
|
-
*
|
|
1120
|
-
*
|
|
1121
|
-
*
|
|
1167
|
+
* What it returns reaches this same extension's lowering as
|
|
1168
|
+
* `LowerContext.preflight`: as a value under `deploy` and `prisma dev`, and
|
|
1169
|
+
* through the environment (preflight-transport.ts) for `destroy`'s alchemy
|
|
1170
|
+
* child, which re-imports the config from scratch. The payload
|
|
1122
1171
|
* is the extension's own opaque string; the framework never reads it, and a
|
|
1123
|
-
* secret value must never go in it.
|
|
1172
|
+
* secret value must never go in it. What it hands `input.report` reaches the
|
|
1173
|
+
* deploy report through the framework's own transport, not this payload.
|
|
1124
1174
|
*
|
|
1125
1175
|
* METHOD SYNTAX REQUIRED, for the same reason ContainerDescriptor's members
|
|
1126
1176
|
* need it: the framework hands over the erased `PreflightInput<unknown>`,
|
|
@@ -1172,10 +1222,15 @@ interface ExtensionDescriptor {
|
|
|
1172
1222
|
interface StateDescriptor {
|
|
1173
1223
|
/** The owning extension's id — matched against `ExtensionDescriptor.id`. */
|
|
1174
1224
|
readonly extension: string;
|
|
1175
|
-
/** Build the state layer. `container` is the owning extension's resolved instance; `undefined` when it declared no container descriptor. */
|
|
1176
|
-
create(container: ContainerInstance | undefined): AlchemyStateLayer;
|
|
1225
|
+
/** 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. */
|
|
1226
|
+
create(container: ContainerInstance | undefined, credentials?: CallerCredentials): AlchemyStateLayer;
|
|
1227
|
+
}
|
|
1228
|
+
/** What `ExtensionDescriptor.providers` receives. `C` erases to `unknown` at the framework boundary, exactly as on `PreflightInput`. */
|
|
1229
|
+
interface ProvidersInput<C = unknown> {
|
|
1230
|
+
/** What the caller already authenticated (`LowerOptions.credentials`). Absent means the extension falls back to its own credential protocol. */
|
|
1231
|
+
readonly credentials?: CallerCredentials<C> | undefined;
|
|
1177
1232
|
}
|
|
1178
|
-
/** The resolved deploy context handed to an extension's `preflight` hook. `C` erases to `unknown` at the framework boundary — see
|
|
1233
|
+
/** The resolved deploy context handed to an extension's `preflight` hook. `C` erases to `unknown` at the framework boundary — see CallerCredentials. */
|
|
1179
1234
|
interface PreflightInput<C = unknown> {
|
|
1180
1235
|
/** The loaded application graph — the manifest of prerequisites is read from it (`provisionManifest`). */
|
|
1181
1236
|
readonly graph: Graph;
|
|
@@ -1183,17 +1238,21 @@ interface PreflightInput<C = unknown> {
|
|
|
1183
1238
|
readonly container: ContainerInstance | undefined;
|
|
1184
1239
|
/** The environment name. */
|
|
1185
1240
|
readonly environment: string;
|
|
1186
|
-
/** The app configuration the command read for this environment.
|
|
1241
|
+
/** The app configuration the command read for this environment. */
|
|
1187
1242
|
readonly configuration: AppConfiguration;
|
|
1188
|
-
/** The app secrets the command read for this environment.
|
|
1243
|
+
/** The app secrets the command read for this environment. */
|
|
1189
1244
|
readonly secrets: AppSecrets;
|
|
1190
1245
|
/** What the caller has already authenticated, for the platform calls preflight makes. Absent means the extension falls back to its own credential protocol. */
|
|
1191
|
-
readonly credentials?:
|
|
1192
|
-
/** Hands the deploy
|
|
1193
|
-
readonly report?: ((
|
|
1246
|
+
readonly credentials?: CallerCredentials<C> | undefined;
|
|
1247
|
+
/** Hands the deploy how many platform variables the check read and which have no value. */
|
|
1248
|
+
readonly report?: ((check: PlatformVariableCheck) => void) | undefined;
|
|
1194
1249
|
/** Shows the user a warning that does not stop the run. Only `prisma dev` passes it and shows the warnings; deploy passes none. */
|
|
1195
1250
|
readonly warn?: ((message: string) => void) | undefined;
|
|
1196
1251
|
}
|
|
1252
|
+
/** What a deploy preflight's check of platform variables found: how many it read, and the ones with no value that nothing requires. */
|
|
1253
|
+
interface PlatformVariableCheck extends PreflightFindings {
|
|
1254
|
+
readonly checked: number;
|
|
1255
|
+
}
|
|
1197
1256
|
/** The resolved destroy context handed to an extension's `teardown` hook. */
|
|
1198
1257
|
interface TeardownInput {
|
|
1199
1258
|
/** The calling extension's own resolved container; `undefined` when it declares no container descriptor. Narrow with the extension's guard. */
|
|
@@ -1229,7 +1288,7 @@ interface ReportBeginInput<C = unknown> {
|
|
|
1229
1288
|
*/
|
|
1230
1289
|
readonly reportId: string | undefined;
|
|
1231
1290
|
/** 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. */
|
|
1232
|
-
readonly credentials?:
|
|
1291
|
+
readonly credentials?: CallerCredentials<C> | undefined;
|
|
1233
1292
|
}
|
|
1234
1293
|
/** The deploy context handed to `RunReporter.attach`, once containers exist. */
|
|
1235
1294
|
interface ReportAttachInput {
|
|
@@ -1296,8 +1355,8 @@ interface LocalTargetDescriptor {
|
|
|
1296
1355
|
providers(input: LocalTargetProvidersInput): Layer.Layer<never>;
|
|
1297
1356
|
/** A stable local identity — resolved without any platform call. */
|
|
1298
1357
|
readonly container: ContainerDescriptor;
|
|
1299
|
-
/**
|
|
1300
|
-
preflight?(input: PreflightInput): Promise<
|
|
1358
|
+
/** 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. */
|
|
1359
|
+
preflight?(input: PreflightInput): Promise<DevPreflightResult>;
|
|
1301
1360
|
/** 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). */
|
|
1302
1361
|
emulators?(input: LocalTargetEmulatorsInput): Promise<void>;
|
|
1303
1362
|
/** The dev session's view of the running app. Core renders it and never learns an emulator's API. */
|
|
@@ -1312,6 +1371,12 @@ interface LocalTargetDescriptor {
|
|
|
1312
1371
|
*/
|
|
1313
1372
|
current?(input: LocalTargetCurrentInput): Promise<LocalTargetCurrentApp | undefined>;
|
|
1314
1373
|
}
|
|
1374
|
+
/** What a local target's preflight found. */
|
|
1375
|
+
interface DevPreflightResult {
|
|
1376
|
+
readonly payload: PreflightPayload;
|
|
1377
|
+
/** The text of each plain platform variable a service reads, by name. Never a secret. */
|
|
1378
|
+
readonly plainVariableText: Readonly<Record<string, string>>;
|
|
1379
|
+
}
|
|
1315
1380
|
interface LocalTargetCurrentInput {
|
|
1316
1381
|
/** Absolute path of the environment's dev state directory (`devEnvironmentDir`, under the cwd). */
|
|
1317
1382
|
readonly devDir: string;
|
|
@@ -1364,9 +1429,9 @@ interface LocalTargetProvidersInput {
|
|
|
1364
1429
|
readonly container: ContainerInstance | undefined;
|
|
1365
1430
|
/** Absolute path of the environment's dev state directory (`devEnvironmentDir`, under the cwd). */
|
|
1366
1431
|
readonly devDir: string;
|
|
1367
|
-
/** The text of each
|
|
1368
|
-
readonly
|
|
1369
|
-
/** The app secrets the graph's
|
|
1432
|
+
/** The text of each plain platform variable a service reads, by name. Never a secret. */
|
|
1433
|
+
readonly plainVariableText: Readonly<Record<string, string>>;
|
|
1434
|
+
/** 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. */
|
|
1370
1435
|
readonly namedSecrets: NamedSecrets;
|
|
1371
1436
|
}
|
|
1372
1437
|
interface LocalTargetEmulatorsInput {
|
|
@@ -1416,6 +1481,12 @@ interface LocalTargetAttachment {
|
|
|
1416
1481
|
}>;
|
|
1417
1482
|
/** Stop everything the target runs for the app, so nothing of it keeps running after the session (emulators and data persist). */
|
|
1418
1483
|
stopApp(): Promise<void>;
|
|
1484
|
+
/**
|
|
1485
|
+
* Does what `stopApp()` does and returns only once it is done, without the event loop: for a
|
|
1486
|
+
* process that is exiting and cannot await. Optional: without it, an exit that interrupts
|
|
1487
|
+
* `stopApp()` leaves the app running.
|
|
1488
|
+
*/
|
|
1489
|
+
stopAppBeforeExit?(): void;
|
|
1419
1490
|
}
|
|
1420
1491
|
/**
|
|
1421
1492
|
* What one registry entry can do. The `kind` discriminant is checked at every
|
|
@@ -1446,11 +1517,11 @@ interface ConfigAdapterInput {
|
|
|
1446
1517
|
type ConfigValues = Readonly<Record<string, unknown>>;
|
|
1447
1518
|
/** 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. */
|
|
1448
1519
|
type ConfigAdapter = (input: ConfigAdapterInput) => ConfigValues | Promise<ConfigValues>;
|
|
1449
|
-
/** 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
|
|
1520
|
+
/** 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. */
|
|
1450
1521
|
type AppConfiguration = Readonly<Record<string, unknown>>;
|
|
1451
|
-
/** The app secrets (ADR-0062): what the `secrets` adapters return, merged the same way. Every value is text.
|
|
1522
|
+
/** 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. */
|
|
1452
1523
|
type AppSecrets = Readonly<Record<string, string>>;
|
|
1453
|
-
/** The app secrets
|
|
1524
|
+
/** 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. */
|
|
1454
1525
|
type NamedSecrets = Readonly<Record<string, string>>;
|
|
1455
1526
|
/**
|
|
1456
1527
|
* The config file's default export. `extensions` lists every extension the
|
|
@@ -1469,15 +1540,75 @@ interface PrismaAppConfig {
|
|
|
1469
1540
|
readonly secrets?: readonly ConfigAdapter[];
|
|
1470
1541
|
}
|
|
1471
1542
|
//#endregion
|
|
1472
|
-
//#region ../../0-framework/3-tooling/
|
|
1543
|
+
//#region ../../0-framework/3-tooling/cli/dist/deployment-summary-6LgQDUuu.d.mts
|
|
1544
|
+
//#region src/deployment-summary.d.ts
|
|
1545
|
+
/** The serializable projection of DeploymentResult — what CAN cross the process
|
|
1546
|
+
* boundary. Writer (report hook) and reader (deploy operation) share this shape. */
|
|
1547
|
+
interface DeployedNodeSummary {
|
|
1548
|
+
readonly address: string;
|
|
1549
|
+
readonly entities: readonly DeployedEntity[];
|
|
1550
|
+
}
|
|
1551
|
+
interface DeploymentSummary {
|
|
1552
|
+
readonly app: string;
|
|
1553
|
+
readonly nodes: readonly DeployedNodeSummary[];
|
|
1554
|
+
/** The platform variables with no value that the deploy preflight found. */
|
|
1555
|
+
readonly findings: PreflightFindings;
|
|
1556
|
+
}
|
|
1473
1557
|
//#endregion
|
|
1474
|
-
//#region
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1558
|
+
//#region ../../0-framework/3-tooling/cli/dist/converge-in-process-CTomEXaD.d.mts
|
|
1559
|
+
//#region src/converge-in-process.d.ts
|
|
1560
|
+
/** What `lower()` returns: the stack value `Alchemist.plan` takes. */
|
|
1561
|
+
type LoweredStack = ReturnType<typeof lower>;
|
|
1562
|
+
/** Where a resource is in its apply. `pending` is planned but not yet touched. */
|
|
1563
|
+
type ResourcePhase = 'pending' | 'running' | 'done' | 'failed';
|
|
1564
|
+
type ConvergeEvent = {
|
|
1565
|
+
readonly kind: 'resource';
|
|
1566
|
+
readonly fqn: string;
|
|
1567
|
+
readonly resourceType: string;
|
|
1568
|
+
/** Alchemy's own status word, such as `creating` or `updated`. */
|
|
1569
|
+
readonly status: string;
|
|
1570
|
+
readonly phase: ResourcePhase;
|
|
1571
|
+
readonly message?: string | undefined;
|
|
1572
|
+
} | {
|
|
1573
|
+
readonly kind: 'log';
|
|
1574
|
+
readonly severity: 'info' | 'warn' | 'verbose';
|
|
1575
|
+
readonly text: string;
|
|
1576
|
+
};
|
|
1577
|
+
interface ConvergeRequest {
|
|
1578
|
+
readonly operation: 'deploy';
|
|
1579
|
+
readonly stack: LoweredStack;
|
|
1580
|
+
readonly stage: string;
|
|
1581
|
+
/** The directory Alchemy runs in: where it reads `.env` and keeps `.alchemy`. */
|
|
1582
|
+
readonly cwd: string;
|
|
1583
|
+
/** 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. */
|
|
1584
|
+
readonly env: Readonly<Record<string, string | undefined>>;
|
|
1585
|
+
readonly signal?: AbortSignal | undefined;
|
|
1586
|
+
readonly onEvent?: ((event: ConvergeEvent) => void) | undefined;
|
|
1587
|
+
/** Receives what Alchemy writes to the terminal itself. A throw from it is ignored. Absent means stderr. */
|
|
1588
|
+
readonly output?: ((text: string) => void) | undefined;
|
|
1589
|
+
}
|
|
1590
|
+
/** One error a failed converge ended with: the error's tag or class name, and its message. */
|
|
1591
|
+
interface ConvergeFailureReason {
|
|
1592
|
+
readonly tag: string;
|
|
1593
|
+
readonly message: string;
|
|
1480
1594
|
}
|
|
1595
|
+
type ConvergeOutcome = {
|
|
1596
|
+
readonly kind: 'applied';
|
|
1597
|
+
} | {
|
|
1598
|
+
readonly kind: 'interrupted';
|
|
1599
|
+
} | {
|
|
1600
|
+
readonly kind: 'failed';
|
|
1601
|
+
readonly reasons: readonly ConvergeFailureReason[];
|
|
1602
|
+
} |
|
|
1603
|
+
/** Nothing ran: another converge holds this process's environment and working directory, or this is a worker thread that cannot change directory. */
|
|
1604
|
+
{
|
|
1605
|
+
readonly kind: 'refused';
|
|
1606
|
+
readonly reason: 'already-running' | 'worker-thread';
|
|
1607
|
+
};
|
|
1608
|
+
/** Plans and applies a lowered stack. The deploy executor's default is {@link convergeInProcess}. */
|
|
1609
|
+
type Converge = (request: ConvergeRequest) => Promise<ConvergeOutcome>;
|
|
1610
|
+
//#endregion
|
|
1611
|
+
//#region ../../0-framework/3-tooling/assemble/dist/index.d.mts
|
|
1481
1612
|
/** What a build adapter measured during one assemble, for progress output. Never read here. */
|
|
1482
1613
|
type AssembleReport = (data: Readonly<Record<string, string | number>>) => void;
|
|
1483
1614
|
/** Assembles one service node — the seam tests substitute to avoid a real build. */
|
|
@@ -1511,7 +1642,19 @@ interface NotOk<F> {
|
|
|
1511
1642
|
*/
|
|
1512
1643
|
type Result$1<T, F> = Ok<T> | NotOk<F>;
|
|
1513
1644
|
//#endregion
|
|
1514
|
-
//#region ../../0-framework/
|
|
1645
|
+
//#region ../../0-framework/1-core/core/dist/local-target.d.mts
|
|
1646
|
+
/**
|
|
1647
|
+
* All configured extensions' local-target providers merged, config array
|
|
1648
|
+
* order (ADR-0041), from the ALREADY-RESOLVED descriptor map
|
|
1649
|
+
* (`resolveLocalTargets`'s product — this function itself never touches a
|
|
1650
|
+
* `localTarget` thunk). `prisma dev`'s converge worker thread is this
|
|
1651
|
+
* aggregator's one caller, passing the result as `LowerOptions.providers`.
|
|
1652
|
+
*/
|
|
1653
|
+
declare function localTargetProviders(resolved: ReadonlyMap<string, LocalTargetDescriptor>, containers: ReadonlyMap<string, ContainerInstance>, devDir: string, plainVariableText: Readonly<Record<string, string>>, namedSecrets: NamedSecrets): Layer.Layer<never>;
|
|
1654
|
+
/** The state store `prisma dev` converges against: Alchemy's file store in the app's working directory. */
|
|
1655
|
+
declare function devState(): AlchemyStateLayer;
|
|
1656
|
+
//#endregion
|
|
1657
|
+
//#region ../../0-framework/3-tooling/cli/dist/redaction-Dn7BRdaP.d.mts
|
|
1515
1658
|
//#region src/composer-config.d.ts
|
|
1516
1659
|
/** Composer's configuration and the `prisma.config.ts` that declares it. */
|
|
1517
1660
|
interface ComposerConfigSource {
|
|
@@ -1521,6 +1664,15 @@ interface ComposerConfigSource {
|
|
|
1521
1664
|
readonly file: string;
|
|
1522
1665
|
}
|
|
1523
1666
|
//#endregion
|
|
1667
|
+
//#region src/app-converge.d.ts
|
|
1668
|
+
/** The app install's `lower`, its converge (`convergeInProcess`), and the local target's providers and state store for `prisma dev`. */
|
|
1669
|
+
interface AppConvergeEntry {
|
|
1670
|
+
readonly lower: typeof lower;
|
|
1671
|
+
readonly converge: Converge;
|
|
1672
|
+
readonly localTargetProviders: typeof localTargetProviders;
|
|
1673
|
+
readonly devState: typeof devState;
|
|
1674
|
+
}
|
|
1675
|
+
//#endregion
|
|
1524
1676
|
//#region src/dev/watch.d.ts
|
|
1525
1677
|
interface WatchTarget {
|
|
1526
1678
|
readonly address: string;
|
|
@@ -1543,7 +1695,9 @@ interface WatchHandle {
|
|
|
1543
1695
|
* watched file; proven by the delete-recreate test failing on Linux CI
|
|
1544
1696
|
* only). Directory targets are watched recursively as themselves; a
|
|
1545
1697
|
* nonexistent path is treated as a file target, so it starts reporting the
|
|
1546
|
-
* moment something creates it.
|
|
1698
|
+
* moment something creates it. A file whose directory does not exist yet is
|
|
1699
|
+
* watched through its nearest existing ancestor, following only the
|
|
1700
|
+
* directories on the way to it.
|
|
1547
1701
|
*/
|
|
1548
1702
|
declare function startWatch(targets: readonly WatchTarget[], onChange: () => void, onError?: (error: unknown) => void): WatchHandle;
|
|
1549
1703
|
//#endregion
|
|
@@ -1566,7 +1720,7 @@ interface AlchemyInvocation {
|
|
|
1566
1720
|
readonly cwd: string;
|
|
1567
1721
|
readonly stage: string;
|
|
1568
1722
|
readonly env: Readonly<Record<string, string | undefined>>;
|
|
1569
|
-
/** The known secrets and the credential-looking values, for `spawnAlchemy`'s stream redactor
|
|
1723
|
+
/** The known secrets and the credential-looking values, for `spawnAlchemy`'s stream redactor. Never in `env` or on the command line, which the engine may log. */
|
|
1570
1724
|
readonly redactedValues: readonly string[];
|
|
1571
1725
|
}
|
|
1572
1726
|
/** The command line an invocation becomes, once a binary has been resolved. */
|
|
@@ -1589,12 +1743,82 @@ interface AlchemyOutcome {
|
|
|
1589
1743
|
/** The command line the adapter started, when it can say; failures print it as the reproduce command. */
|
|
1590
1744
|
readonly commandLine?: AlchemyCommandLine;
|
|
1591
1745
|
}
|
|
1592
|
-
/** Starts the converge and resolves when it ends
|
|
1593
|
-
* by `ctx.spawn`, which gives the child the terminal and does not redact its
|
|
1594
|
-
* output; hosts get `spawnAlchemy`, which pipes the output through the stream
|
|
1595
|
-
* redactor (ADR-0062). */
|
|
1746
|
+
/** Starts the converge and resolves when it ends; `spawnAlchemy` by default. */
|
|
1596
1747
|
type RunAlchemy = (invocation: AlchemyInvocation) => Promise<AlchemyOutcome>;
|
|
1597
1748
|
//#endregion
|
|
1749
|
+
//#region src/dev/value-reads-change.d.ts
|
|
1750
|
+
/** A graph's value reads and the props of each value resource they read, as data a worker thread can receive. */
|
|
1751
|
+
interface ValueReadsSnapshot {
|
|
1752
|
+
readonly reads: readonly ValueRead[];
|
|
1753
|
+
readonly props: Readonly<Record<string, unknown>>;
|
|
1754
|
+
}
|
|
1755
|
+
interface ValueReadsChange {
|
|
1756
|
+
readonly added: readonly string[];
|
|
1757
|
+
readonly removed: readonly string[];
|
|
1758
|
+
readonly changed: readonly string[];
|
|
1759
|
+
}
|
|
1760
|
+
//#endregion
|
|
1761
|
+
//#region src/operations/dev-converge.d.ts
|
|
1762
|
+
/** Everything a dev converge needs from the session, as data a worker thread can receive. */
|
|
1763
|
+
interface DevConvergeJob {
|
|
1764
|
+
/** The `prisma.config.ts` that declares the `composer` section. Absolute. */
|
|
1765
|
+
readonly configFile: string;
|
|
1766
|
+
/** The entry module. Absolute. */
|
|
1767
|
+
readonly entry: string;
|
|
1768
|
+
/** Where the app's own `@prisma/composer` resolves from. */
|
|
1769
|
+
readonly appDir: string;
|
|
1770
|
+
readonly cwd: string;
|
|
1771
|
+
readonly name: string;
|
|
1772
|
+
readonly environment: string;
|
|
1773
|
+
readonly appConfigurationRead: AppConfigurationRead;
|
|
1774
|
+
/** Each service's assembled bundle: only the fields lowering reads. */
|
|
1775
|
+
readonly bundles: Readonly<Record<string, {
|
|
1776
|
+
readonly dir: string;
|
|
1777
|
+
readonly entry: string;
|
|
1778
|
+
}>>;
|
|
1779
|
+
readonly unassembled: readonly string[];
|
|
1780
|
+
/** Each extension's local container, as its `serialize()` text, by extension id. */
|
|
1781
|
+
readonly containers: Readonly<Record<string, string>>;
|
|
1782
|
+
readonly preflightPayloads: Readonly<Record<string, string>>;
|
|
1783
|
+
readonly devDir: string;
|
|
1784
|
+
readonly plainVariableText: Readonly<Record<string, string>>;
|
|
1785
|
+
readonly namedSecrets: Readonly<Record<string, string>>;
|
|
1786
|
+
/** The node addresses of the graph the session started with. */
|
|
1787
|
+
readonly nodeAddresses: readonly string[];
|
|
1788
|
+
/** The value reads of the graph the session started with. */
|
|
1789
|
+
readonly valueReads: ValueReadsSnapshot;
|
|
1790
|
+
}
|
|
1791
|
+
/** Where a dev converge reports what happens while it runs. */
|
|
1792
|
+
interface DevConvergeReport {
|
|
1793
|
+
readonly onEvent: (event: ConvergeEvent) => void;
|
|
1794
|
+
/** Text written to the terminal while it runs: Alchemy's own, and anything the app's code prints. */
|
|
1795
|
+
readonly output: (text: string) => void;
|
|
1796
|
+
}
|
|
1797
|
+
/**
|
|
1798
|
+
* What one dev converge came to; each variant lists the app files the converge's import loaded.
|
|
1799
|
+
* `outcome`: the converge ran, or the runner refused or ended it, to this outcome.
|
|
1800
|
+
* `error`: a structured error stopped it before it began, as its envelope.
|
|
1801
|
+
* `value-reads-changed`: the app now reads other platform variables than the session prepared
|
|
1802
|
+
* for, so nothing was converged.
|
|
1803
|
+
*/
|
|
1804
|
+
type DevConvergeResult = {
|
|
1805
|
+
readonly kind: 'outcome';
|
|
1806
|
+
readonly outcome: ConvergeOutcome;
|
|
1807
|
+
readonly appFiles: readonly string[];
|
|
1808
|
+
} | {
|
|
1809
|
+
readonly kind: 'error';
|
|
1810
|
+
readonly error: CliErrorEnvelope;
|
|
1811
|
+
/** Set when the runtime keeps the failed lookup of a directory import that would now succeed, so only a new process loads it. */
|
|
1812
|
+
readonly lookupKept?: true;
|
|
1813
|
+
readonly appFiles: readonly string[];
|
|
1814
|
+
} | {
|
|
1815
|
+
readonly kind: 'value-reads-changed';
|
|
1816
|
+
readonly change: ValueReadsChange;
|
|
1817
|
+
readonly appFiles: readonly string[];
|
|
1818
|
+
};
|
|
1819
|
+
/** Runs one dev converge and reports its events. Never rejects: every failure is a result. */
|
|
1820
|
+
type RunDevConverge = (job: DevConvergeJob, report: DevConvergeReport, signal?: AbortSignal) => Promise<DevConvergeResult>;
|
|
1821
|
+
//#endregion
|
|
1598
1822
|
//#region src/operations/shared.d.ts
|
|
1599
1823
|
/** A running service's dotted address plus its local URL — what `dev` reports
|
|
1600
1824
|
* as the front door and `log` reports as the tailable services. */
|
|
@@ -1606,18 +1830,20 @@ interface ServiceEndpoint {
|
|
|
1606
1830
|
}
|
|
1607
1831
|
/**
|
|
1608
1832
|
* The operations' in-package injection seam — lets the CLI's own tests drive
|
|
1609
|
-
* them without a real wrapper build or alchemy process.
|
|
1833
|
+
* them without a real wrapper build, Alchemy converge or alchemy process.
|
|
1610
1834
|
* Threaded through the *WithDeps variants, never part of the published
|
|
1611
1835
|
* surface: the fields mirror internal types.
|
|
1612
1836
|
*/
|
|
1613
1837
|
interface OperationDeps {
|
|
1614
1838
|
readonly runAssembler?: RunAssembler | undefined;
|
|
1615
|
-
/**
|
|
1616
|
-
* Starts the converge child. The CLI passes one backed by the engine's
|
|
1617
|
-
* `ctx.spawn`, so the terminal reaches the child natively and the engine
|
|
1618
|
-
* owns signal policy; hosts get the default `spawnAlchemy`.
|
|
1619
|
-
*/
|
|
1839
|
+
/** Starts the converge child for `destroy`; defaults to `spawnAlchemy`. Tests substitute it. */
|
|
1620
1840
|
readonly alchemy?: RunAlchemy | undefined;
|
|
1841
|
+
/** The `lower` and converge functions `deploy` runs; defaults to the app's own install (`loadAppConvergeEntry`). Tests substitute it. */
|
|
1842
|
+
readonly appConvergeEntry?: AppConvergeEntry | undefined;
|
|
1843
|
+
/** Runs one `dev` converge and reports its events; defaults to a new worker thread per converge (`runDevConvergeInWorker`). Tests substitute it. */
|
|
1844
|
+
readonly runDevConverge?: RunDevConverge | undefined;
|
|
1845
|
+
/** What `deploy` and `dev` redact from everything they report. Defaults to one built from `process.env`; the CLI passes its own so its console redirect redacts the same values. */
|
|
1846
|
+
readonly redaction?: SecretRedaction | undefined;
|
|
1621
1847
|
/** Starts a file watch for `dev`; defaults to chokidar-backed `startWatch`. Tests substitute it to drive changes directly. */
|
|
1622
1848
|
readonly watch?: typeof startWatch | undefined;
|
|
1623
1849
|
/**
|
|
@@ -1634,11 +1860,46 @@ interface OperationDeps {
|
|
|
1634
1860
|
* call", and both commands are credential-free by contract: there is no
|
|
1635
1861
|
* authenticated call on those paths for this to reach.
|
|
1636
1862
|
*/
|
|
1637
|
-
readonly credentials?:
|
|
1863
|
+
readonly credentials?: CallerCredentials | undefined;
|
|
1638
1864
|
}
|
|
1639
1865
|
//#endregion
|
|
1866
|
+
//#region src/operations/steps.d.ts
|
|
1867
|
+
/** A step event, over the operation's own step type. */
|
|
1868
|
+
type StepEvent<Step> = {
|
|
1869
|
+
readonly kind: 'step-started';
|
|
1870
|
+
readonly step: Step;
|
|
1871
|
+
} | {
|
|
1872
|
+
readonly kind: 'message';
|
|
1873
|
+
readonly severity: 'info' | 'warn' | 'verbose';
|
|
1874
|
+
/** A line Alchemy logged while it planned or applied. */
|
|
1875
|
+
readonly text: string;
|
|
1876
|
+
} | {
|
|
1877
|
+
readonly kind: 'step-finished';
|
|
1878
|
+
readonly step: Step;
|
|
1879
|
+
readonly outcome: 'ok' | 'failed';
|
|
1880
|
+
readonly durationMs: number;
|
|
1881
|
+
/** What the step measured, as its build adapter or deploy target reported it. The fields vary by adapter and target. */
|
|
1882
|
+
readonly data?: Readonly<Record<string, string | number>> | undefined;
|
|
1883
|
+
};
|
|
1884
|
+
//#endregion
|
|
1640
1885
|
//#region src/operations/dev.d.ts
|
|
1886
|
+
/** A step of a converge. Each converge is one `converge` step, `dev.converge` for the first and `dev.rebuild.<n>` for the n-th rebuild, and each resource Alchemy touches is an `apply-resource` step inside it. */
|
|
1887
|
+
type DevStep = {
|
|
1888
|
+
readonly name: 'converge';
|
|
1889
|
+
readonly id: string;
|
|
1890
|
+
} | {
|
|
1891
|
+
readonly name: 'apply-resource';
|
|
1892
|
+
/** The id of the converge step it belongs to. */
|
|
1893
|
+
readonly converge: string;
|
|
1894
|
+
/** The resource's ID (ADR-0057): its node's address, or the address and the resource's role in that node. */
|
|
1895
|
+
readonly resourceId: string;
|
|
1896
|
+
readonly resourceType: string;
|
|
1897
|
+
/** Alchemy's status word for what is happening to it, such as `creating` or `created`. */
|
|
1898
|
+
readonly status: string;
|
|
1899
|
+
};
|
|
1641
1900
|
type DevEvent =
|
|
1901
|
+
/** A converge's steps and Alchemy's log lines. Every step a converge opens is finished when it ends, as `failed` when it failed or was interrupted. */
|
|
1902
|
+
StepEvent<DevStep> |
|
|
1642
1903
|
/** Initial front door + after each successful re-converge. */
|
|
1643
1904
|
{
|
|
1644
1905
|
readonly kind: 'ready';
|
|
@@ -1669,12 +1930,22 @@ type DevEvent =
|
|
|
1669
1930
|
{
|
|
1670
1931
|
readonly kind: 'values-changed';
|
|
1671
1932
|
} |
|
|
1672
|
-
/** The app
|
|
1933
|
+
/** The value resources the app reads changed since the session started. `added` holds the nodes whose reads were only added, `removed` those whose reads were only removed, and `changed` every other changed node, each by address. The session stops rebuilding until it is restarted. */
|
|
1934
|
+
{
|
|
1935
|
+
readonly kind: 'value-reads-changed';
|
|
1936
|
+
readonly added: readonly string[];
|
|
1937
|
+
readonly removed: readonly string[];
|
|
1938
|
+
readonly changed: readonly string[];
|
|
1939
|
+
} |
|
|
1940
|
+
/** A rebuild's converge failed, or was refused: `DEV.CONVERGE_RUNNING` when another converge on this thread holds the process state, `DEV.WORKER_THREAD` when dev was called from a thread that cannot change the process's working directory. The app keeps running, still watching. */
|
|
1673
1941
|
{
|
|
1674
1942
|
readonly kind: 'converge-failed';
|
|
1675
|
-
readonly
|
|
1676
|
-
readonly
|
|
1677
|
-
readonly
|
|
1943
|
+
readonly code: 'DEV.CONVERGE_FAILED' | 'DEV.CONVERGE_RUNNING' | 'DEV.WORKER_THREAD';
|
|
1944
|
+
readonly message: string;
|
|
1945
|
+
readonly reasons: readonly {
|
|
1946
|
+
readonly tag: string;
|
|
1947
|
+
readonly message: string;
|
|
1948
|
+
}[];
|
|
1678
1949
|
} |
|
|
1679
1950
|
/** Once per service that runs its build adapter's dev server, before the first converge (ADR-0056). `cwd` is absolute. */
|
|
1680
1951
|
{
|
|
@@ -1722,16 +1993,18 @@ interface DevInput {
|
|
|
1722
1993
|
* `devStop` stops the app later.
|
|
1723
1994
|
*/
|
|
1724
1995
|
readonly detach?: boolean | undefined;
|
|
1996
|
+
/** The app's directory, where `.prisma-composer/` and Alchemy's `.alchemy` live. Defaults to `process.cwd()`. For the length of each converge, the process's working directory is `cwd`; it is restored after. */
|
|
1725
1997
|
readonly cwd?: string | undefined;
|
|
1726
1998
|
readonly onEvent?: ((event: DevEvent) => void) | undefined;
|
|
1999
|
+
/** Interrupts a running converge and stops dev. During the first converge, dev then fails with `DEV.INTERRUPTED`; once the session has started, it stops as `stop()` stops it. Only one converge runs at a time on the thread that called dev, which holds the converge flag while dev's converge worker runs: a `deploy` on that thread while dev converges is refused, and so is a dev converge while a deploy runs there. A converge on another thread of the process is not refused. */
|
|
2000
|
+
readonly signal?: AbortSignal | undefined;
|
|
1727
2001
|
}
|
|
1728
|
-
/** A running dev session. The operation NEVER touches process signal handlers
|
|
1729
|
-
* the host owns signals (and must evict alchemy's import-time SIGINT/SIGTERM
|
|
1730
|
-
* listeners before installing its own; see run-dev.ts). */
|
|
2002
|
+
/** A running dev session. The operation NEVER touches process signal handlers: the host owns signals. */
|
|
1731
2003
|
interface DevSession {
|
|
1732
2004
|
/** The initial front door, already merged across attachments. */
|
|
1733
2005
|
readonly endpoints: readonly ServiceEndpoint[];
|
|
1734
2006
|
/** Stop the watch loop and the app's services (emulators and data stay up).
|
|
2007
|
+
* A converge still running is interrupted, and its worker thread ends before the services stop.
|
|
1735
2008
|
* Idempotent; emits 'stopping'/'stopped'; resolves `closed`. A no-op for a detached session. */
|
|
1736
2009
|
stop(): Promise<void>;
|
|
1737
2010
|
/** Settles when the session has fully stopped (via stop()); already settled for a detached session. */
|
|
@@ -1742,38 +2015,69 @@ interface DevSession {
|
|
|
1742
2015
|
* internal types and is not part of the published surface. */
|
|
1743
2016
|
declare function devWithDeps(input: DevInput, deps: OperationDeps): Promise<Result$1<DevSession, CliStructuredError>>;
|
|
1744
2017
|
//#endregion
|
|
1745
|
-
//#region
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
readonly address: string;
|
|
1751
|
-
readonly entities: readonly DeployedEntity[];
|
|
2018
|
+
//#region src/redaction.d.ts
|
|
2019
|
+
/** A value under a secrets key, with that key. */
|
|
2020
|
+
interface KnownSecret {
|
|
2021
|
+
readonly name: string;
|
|
2022
|
+
readonly value: string;
|
|
1752
2023
|
}
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
2024
|
+
/**
|
|
2025
|
+
* The known secrets of one command: the values under the secrets keys the graph names, in the app
|
|
2026
|
+
* secrets and the app configuration (ADR-0062). The app configuration file must not hold any of them.
|
|
2027
|
+
*/
|
|
2028
|
+
declare class KnownSecrets {
|
|
2029
|
+
#private;
|
|
2030
|
+
constructor(secrets?: Iterable<KnownSecret>);
|
|
2031
|
+
/** Adds each secret whose value is not empty. A value already known keeps its first name. */
|
|
2032
|
+
add(secrets: Iterable<KnownSecret>): void;
|
|
2033
|
+
values(): ReadonlySet<string>;
|
|
2034
|
+
/**
|
|
2035
|
+
* The name of a known secret `text` holds, or undefined. A secret of
|
|
2036
|
+
* `MIN_SECRET_LENGTH_INSIDE_A_VALUE` characters or more is found anywhere in `text`; a shorter
|
|
2037
|
+
* one only when it is all of `text`.
|
|
2038
|
+
*/
|
|
2039
|
+
nameIn(text: string): string | undefined;
|
|
2040
|
+
}
|
|
2041
|
+
/**
|
|
2042
|
+
* What one command hides from everything it prints, returns or reports (ADR-0062): its known
|
|
2043
|
+
* secrets, and the credential-looking values, which only look like secrets by the name of the
|
|
2044
|
+
* variable they are under. It starts with the credential-looking values of the process
|
|
2045
|
+
* environment.
|
|
2046
|
+
*/
|
|
2047
|
+
declare class SecretRedaction {
|
|
2048
|
+
readonly knownSecrets: KnownSecrets;
|
|
2049
|
+
private readonly credentialLooking;
|
|
2050
|
+
private matcher;
|
|
2051
|
+
constructor(env: Readonly<Record<string, string | undefined>>);
|
|
2052
|
+
addKnownSecrets(secrets: Iterable<KnownSecret>): void;
|
|
2053
|
+
addCredentialLookingValues(values: Iterable<string>): void;
|
|
2054
|
+
/** The known secrets and the credential-looking values, longest first. */
|
|
2055
|
+
allValues(): readonly string[];
|
|
2056
|
+
/** `text` with every known secret and credential-looking value replaced by `[redacted]` at any length, then bearer tokens, JWTs, URL passwords and `token=…` pairs. */
|
|
2057
|
+
redact(text: string): string;
|
|
1756
2058
|
}
|
|
1757
2059
|
//#endregion
|
|
1758
|
-
//#region ../../0-framework/3-tooling/cli/dist/dev-current-
|
|
2060
|
+
//#region ../../0-framework/3-tooling/cli/dist/dev-current-BiJzvHNz.d.mts
|
|
1759
2061
|
//#region src/operations/deploy.d.ts
|
|
1760
|
-
/** A deploy step. `assemble-service` steps run inside `assemble`, one per service. */
|
|
2062
|
+
/** A deploy step. `assemble-service` steps run inside `assemble`, one per service, and `apply-resource` steps inside `apply`, one per resource Alchemy touches. */
|
|
1761
2063
|
type DeployStep = {
|
|
1762
2064
|
readonly name: 'prepare' | 'assemble' | 'connect' | 'preflight' | 'apply' | 'record';
|
|
1763
2065
|
} | {
|
|
1764
2066
|
readonly name: 'assemble-service';
|
|
1765
2067
|
readonly address: string;
|
|
1766
|
-
};
|
|
1767
|
-
type DeployEvent = {
|
|
1768
|
-
readonly kind: 'step-started';
|
|
1769
|
-
readonly step: DeployStep;
|
|
1770
2068
|
} | {
|
|
1771
|
-
readonly
|
|
1772
|
-
|
|
1773
|
-
readonly
|
|
1774
|
-
readonly
|
|
1775
|
-
/**
|
|
1776
|
-
readonly
|
|
2069
|
+
readonly name: 'apply-resource';
|
|
2070
|
+
/** The resource's ID (ADR-0057): its node's address, or the address and the resource's role in that node. */
|
|
2071
|
+
readonly resourceId: string;
|
|
2072
|
+
readonly resourceType: string;
|
|
2073
|
+
/** 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. */
|
|
2074
|
+
readonly status: string;
|
|
2075
|
+
};
|
|
2076
|
+
type DeployEvent = StepEvent<DeployStep> |
|
|
2077
|
+
/** Right after the preflight step, when it found platform variables with no value that no service needs. */
|
|
2078
|
+
{
|
|
2079
|
+
readonly kind: 'preflight-findings';
|
|
2080
|
+
readonly findings: PreflightFindings;
|
|
1777
2081
|
};
|
|
1778
2082
|
/** The environment `deploy` targets when none is named. */
|
|
1779
2083
|
declare const DEFAULT_DEPLOY_ENVIRONMENT = "production";
|
|
@@ -1806,10 +2110,11 @@ interface DeployInput {
|
|
|
1806
2110
|
readonly reportId?: string | undefined;
|
|
1807
2111
|
/** Each step as it starts and finishes, in real time. Rendering is the host's. */
|
|
1808
2112
|
readonly onEvent?: ((event: DeployEvent) => void) | undefined;
|
|
2113
|
+
/** Interrupts the plan or apply when it aborts. The deploy then fails with `DEPLOY.INTERRUPTED`, after releasing the environment's state lease. */
|
|
2114
|
+
readonly signal?: AbortSignal | undefined;
|
|
1809
2115
|
}
|
|
1810
2116
|
interface DeploySuccess {
|
|
1811
|
-
/**
|
|
1812
|
-
* did not write one (injected fake alchemy, or a report-less apply). */
|
|
2117
|
+
/** What the apply deployed. Undefined when the apply produced no report. */
|
|
1813
2118
|
readonly summary: DeploymentSummary | undefined;
|
|
1814
2119
|
/** How long the whole deploy took, from the call to its result. */
|
|
1815
2120
|
readonly durationMs: number;
|
|
@@ -1868,7 +2173,7 @@ declare function devUrl(input: DevUrlInput): Promise<Result$1<DevUrl, CliStructu
|
|
|
1868
2173
|
/** Stops the app's local copy in the environment: its service processes and database servers. Data and ports stay. */
|
|
1869
2174
|
declare function devStop(input: DevStopInput): Promise<Result$1<DevStopped, CliStructuredError>>;
|
|
1870
2175
|
//#endregion
|
|
1871
|
-
//#region ../../0-framework/3-tooling/cli/dist/family-
|
|
2176
|
+
//#region ../../0-framework/3-tooling/cli/dist/family-DfwviKFj.d.mts
|
|
1872
2177
|
//#region src/family/family.d.ts
|
|
1873
2178
|
/**
|
|
1874
2179
|
* The control-plane operations the family's handlers call. These are the
|
|
@@ -1894,30 +2199,5 @@ interface CreateComposerFamilyOptions {
|
|
|
1894
2199
|
readonly redirects?: readonly RedirectSpec[] | undefined;
|
|
1895
2200
|
}
|
|
1896
2201
|
//#endregion
|
|
1897
|
-
|
|
1898
|
-
//#
|
|
1899
|
-
/** A value under a secrets key, with that key. */
|
|
1900
|
-
interface KnownSecret {
|
|
1901
|
-
readonly name: string;
|
|
1902
|
-
readonly value: string;
|
|
1903
|
-
}
|
|
1904
|
-
/**
|
|
1905
|
-
* The known secrets of one command: the values under the secrets keys the graph names, in the app
|
|
1906
|
-
* secrets and the app configuration (ADR-0062). The app configuration file must not hold any of them.
|
|
1907
|
-
*/
|
|
1908
|
-
declare class KnownSecrets {
|
|
1909
|
-
#private;
|
|
1910
|
-
constructor(secrets?: Iterable<KnownSecret>);
|
|
1911
|
-
/** Adds each secret whose value is not empty. A value already known keeps its first name. */
|
|
1912
|
-
add(secrets: Iterable<KnownSecret>): void;
|
|
1913
|
-
values(): ReadonlySet<string>;
|
|
1914
|
-
/**
|
|
1915
|
-
* The name of a known secret `text` holds, or undefined. A secret of
|
|
1916
|
-
* `MIN_SECRET_LENGTH_INSIDE_A_VALUE` characters or more is found anywhere in `text`; a shorter
|
|
1917
|
-
* one only when it is all of `text`.
|
|
1918
|
-
*/
|
|
1919
|
-
nameIn(text: string): string | undefined;
|
|
1920
|
-
}
|
|
1921
|
-
//#endregion
|
|
1922
|
-
export { CliStructuredError as C, AppConfigurationRead as S, OperationDeps as _, DEFAULT_DEPLOY_ENVIRONMENT as a, AssembledServices as b, DeploySuccess as c, DevUrl as d, DevUrlInput as f, DevSession as g, DevInput as h, realOperations as i, DevStopInput as l, DevEvent as m, ComposerOperations as n, DeployEvent as o, ComposerConfigSource as p, CreateComposerFamilyOptions as r, DeployInput as s, KnownSecrets as t, DevStopped as u, ServiceEndpoint as v, AppSecrets as x, Result$1 as y };
|
|
1923
|
-
//# sourceMappingURL=redaction-Bf8FvTFH-D0dXGsO8.d.mts.map
|
|
2202
|
+
export { ServiceEndpoint as _, DeployEvent as a, DevStopInput as c, DevUrlInput as d, ComposerConfigSource as f, OperationDeps as g, DevSession as h, DEFAULT_DEPLOY_ENVIRONMENT as i, DevStopped as l, DevInput as m, CreateComposerFamilyOptions as n, DeployInput as o, DevEvent as p, realOperations as r, DeploySuccess as s, ComposerOperations as t, DevUrl as u, Result$1 as v, CliStructuredError as y };
|
|
2203
|
+
//# sourceMappingURL=family-DfwviKFj-CS1L-EvS.d.mts.map
|