@prisma/composer 0.36.0 → 0.37.0-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{app-config-DNnd7Zu--BQ1vHaMK.d.mts → app-config-lMqqcFA1-DacpRpC4.d.mts} +48 -8
- package/dist/app-config-lMqqcFA1-DacpRpC4.d.mts.map +1 -0
- package/dist/app-configuration-file-CeJvBAti-D3uDlheX.mjs +221 -0
- package/dist/app-configuration-file-CeJvBAti-D3uDlheX.mjs.map +1 -0
- package/dist/arktype.d.mts +20 -6
- package/dist/arktype.d.mts.map +1 -1
- package/dist/arktype.mjs +45 -6
- package/dist/arktype.mjs.map +1 -1
- package/dist/config-Bpbj7Riz.d.mts +1 -0
- package/dist/config-adapters-DG-uhGfv-Bt1M9f8b.mjs +47 -0
- package/dist/config-adapters-DG-uhGfv-Bt1M9f8b.mjs.map +1 -0
- package/dist/config.d.mts +16 -3
- package/dist/config.d.mts.map +1 -0
- package/dist/config.mjs +2 -1
- package/dist/control.d.mts +6 -174
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +4 -4
- package/dist/control.mjs.map +1 -1
- package/dist/deploy-DergV8De.mjs +375 -0
- package/dist/deploy-DergV8De.mjs.map +1 -0
- package/dist/deploy-Dh_I6YLS.d.mts +2 -0
- package/dist/deploy.d.mts +4 -3
- package/dist/deploy.mjs +3 -364
- package/dist/{deployment-summary-CDHdLtnO-DrE7GsHq.mjs → deployment-summary-BiBkPWlB-CyC2pudN.mjs} +10 -23
- package/dist/deployment-summary-BiBkPWlB-CyC2pudN.mjs.map +1 -0
- package/dist/{deployment-summary-p88NV5m5-SaPCCX2C.d.mts → deployment-summary-p88NV5m5-Bqd0Uf4H.d.mts} +3 -3
- package/dist/{deployment-summary-p88NV5m5-SaPCCX2C.d.mts.map → deployment-summary-p88NV5m5-Bqd0Uf4H.d.mts.map} +1 -1
- package/dist/{secret-DoWGmN7m-DO5Brq1Y.mjs → describe-kind-Cpm_euxo-CkhlGJUL.mjs} +29 -2
- package/dist/describe-kind-Cpm_euxo-CkhlGJUL.mjs.map +1 -0
- package/dist/{dev-current-Brb4qugP-CG0_96FZ.mjs → dev-current-D-Qb6Yem-Cvy2dWhe.mjs} +5 -5
- package/dist/{dev-current-Brb4qugP-CG0_96FZ.mjs.map → dev-current-D-Qb6Yem-Cvy2dWhe.mjs.map} +1 -1
- package/dist/{dev-environment-name-6eEr5PW8-CGk1ijP7.mjs → dev-environment-name-6eEr5PW8-BwusWVKi.mjs} +3 -3
- package/dist/{dev-environment-name-6eEr5PW8-CGk1ijP7.mjs.map → dev-environment-name-6eEr5PW8-BwusWVKi.mjs.map} +1 -1
- package/dist/{dist-DiYPSVUE.mjs → dist-BtzrklYG.mjs} +2 -2
- package/dist/{dist-DiYPSVUE.mjs.map → dist-BtzrklYG.mjs.map} +1 -1
- package/dist/{dist-CZ_yEZ7F.mjs → dist-NyTyCEnG.mjs} +11 -4
- package/dist/dist-NyTyCEnG.mjs.map +1 -0
- package/dist/errors-0e8IVwzi.mjs.map +1 -1
- package/dist/{execute-deploy-destroy-CNt-xpE7-CYaa3sYk.mjs → execute-deploy-destroy-C6EsdmLz-BO5xEJsJ.mjs} +60 -29
- package/dist/execute-deploy-destroy-C6EsdmLz-BO5xEJsJ.mjs.map +1 -0
- package/dist/{execute-dev-current-BdEqeKAB-BLUs2eQv.mjs → execute-dev-current-tBKmDAjV-0LnPjGGi.mjs} +6 -6
- package/dist/{execute-dev-current-BdEqeKAB-BLUs2eQv.mjs.map → execute-dev-current-tBKmDAjV-0LnPjGGi.mjs.map} +1 -1
- package/dist/{execute-dev-BUk-XWBJ-ZHX5A8cR.mjs → execute-dev-gjIKYybU-BMpgGLtS.mjs} +99 -44
- package/dist/execute-dev-gjIKYybU-BMpgGLtS.mjs.map +1 -0
- package/dist/{execute-log-aiHhujIh-C_aXmb6j.mjs → execute-log-c0_dL_Bv-Dq1glmTO.mjs} +6 -6
- package/dist/{execute-log-aiHhujIh-C_aXmb6j.mjs.map → execute-log-c0_dL_Bv-Dq1glmTO.mjs.map} +1 -1
- package/dist/{graph-MGOZJdDt-CyI8-9r7.mjs → graph-CBt9CRBT-yMupsISb.mjs} +681 -214
- package/dist/graph-CBt9CRBT-yMupsISb.mjs.map +1 -0
- package/dist/{graph-BzTSXnoQ-BvGVq0bm.d.mts → graph-D1zpgcLm-YlrEdzUB.d.mts} +9 -5
- package/dist/graph-D1zpgcLm-YlrEdzUB.d.mts.map +1 -0
- package/dist/{graph-types-DfsG9Rkg-D_ARjMo7.d.mts → graph-types-BiFZrE06-D6vaGxXz.d.mts} +287 -122
- package/dist/graph-types-BiFZrE06-D6vaGxXz.d.mts.map +1 -0
- package/dist/http.d.mts +2 -2
- package/dist/http.mjs +2 -2
- package/dist/{index-D89ftK2z.d.mts → index-CMklpG87.d.mts} +3 -3
- package/dist/index-CMklpG87.d.mts.map +1 -0
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +4 -4
- package/dist/internal-app-configuration-file.d.mts +19 -0
- package/dist/internal-app-configuration-file.d.mts.map +1 -0
- package/dist/internal-app-configuration-file.mjs +2 -0
- package/dist/{local-target-DySKw61w.mjs → local-target-Dd8FJEb5.mjs} +5 -3
- package/dist/{local-target-DySKw61w.mjs.map → local-target-Dd8FJEb5.mjs.map} +1 -1
- package/dist/local-target.d.mts +2 -2
- package/dist/local-target.d.mts.map +1 -1
- package/dist/local-target.mjs +1 -1
- package/dist/{nextjs-DLyeRR7M-BeiYsLuZ.d.mts → nextjs-DLyeRR7M-RqgYxqhI.d.mts} +3 -3
- package/dist/{nextjs-DLyeRR7M-BeiYsLuZ.d.mts.map → nextjs-DLyeRR7M-RqgYxqhI.d.mts.map} +1 -1
- package/dist/nextjs-control.d.mts +4 -4
- package/dist/nextjs-control.mjs +2 -2
- package/dist/nextjs.d.mts +1 -1
- package/dist/node-control.d.mts +3 -3
- package/dist/node-control.mjs +2 -2
- package/dist/node.d.mts +2 -2
- package/dist/pointer-CyQZZugO-D7k3vibs.d.mts +42 -0
- package/dist/pointer-CyQZZugO-D7k3vibs.d.mts.map +1 -0
- package/dist/redaction-Bf8FvTFH-pjMN5nIB.d.mts +183 -0
- package/dist/redaction-Bf8FvTFH-pjMN5nIB.d.mts.map +1 -0
- package/dist/redaction-HnbkSFrK-BXRZ3B33.mjs +295 -0
- package/dist/redaction-HnbkSFrK-BXRZ3B33.mjs.map +1 -0
- package/dist/report.d.mts +3 -3
- package/dist/report.mjs +1 -1
- package/dist/report.mjs.map +1 -1
- package/dist/{run-alchemy-Dl_MWw4g-BZaLckHp.mjs → run-alchemy-OS_ix5g0-DCvUYZ7T.mjs} +30 -12
- package/dist/run-alchemy-OS_ix5g0-DCvUYZ7T.mjs.map +1 -0
- package/dist/{run-report-CmBz2-xc-S50d4g5V.mjs → run-report-CmBz2-xc-Cc8rV1CX.mjs} +2 -2
- package/dist/{run-report-CmBz2-xc-S50d4g5V.mjs.map → run-report-CmBz2-xc-Cc8rV1CX.mjs.map} +1 -1
- package/dist/service-rpc.d.mts +2 -2
- package/dist/service-rpc.mjs +2 -2
- package/dist/testing.d.mts +2 -2
- package/dist/testing.d.mts.map +1 -1
- package/dist/{validate-environment-CEhUSEg2-DmAtiQhe.mjs → validate-environment-CpQLC3CA-COmDdusV.mjs} +124 -21
- package/dist/validate-environment-CpQLC3CA-COmDdusV.mjs.map +1 -0
- package/dist/zod.d.mts +30 -0
- package/dist/zod.d.mts.map +1 -0
- package/dist/zod.mjs +39 -0
- package/dist/zod.mjs.map +1 -0
- package/package.json +31 -18
- package/skills/prisma-composer-core-concepts/SKILL.md +54 -29
- package/src/exports/config.ts +1 -0
- package/src/exports/internal-app-configuration-file.ts +1 -0
- package/src/exports/zod.ts +1 -0
- package/dist/app-config-DNnd7Zu--BQ1vHaMK.d.mts.map +0 -1
- package/dist/config-RKyUvtGC.d.mts +0 -1
- package/dist/deploy-RKyUvtGC.d.mts +0 -1
- package/dist/deploy.mjs.map +0 -1
- package/dist/deployment-summary-CDHdLtnO-DrE7GsHq.mjs.map +0 -1
- package/dist/dist-CZ_yEZ7F.mjs.map +0 -1
- package/dist/execute-deploy-destroy-CNt-xpE7-CYaa3sYk.mjs.map +0 -1
- package/dist/execute-dev-BUk-XWBJ-ZHX5A8cR.mjs.map +0 -1
- package/dist/graph-BzTSXnoQ-BvGVq0bm.d.mts.map +0 -1
- package/dist/graph-MGOZJdDt-CyI8-9r7.mjs.map +0 -1
- package/dist/graph-types-DfsG9Rkg-D_ARjMo7.d.mts.map +0 -1
- package/dist/index-D89ftK2z.d.mts.map +0 -1
- package/dist/run-alchemy-Dl_MWw4g-BZaLckHp.mjs.map +0 -1
- package/dist/secret-CHOw4LBU-C8yXoC9N.d.mts +0 -25
- package/dist/secret-CHOw4LBU-C8yXoC9N.d.mts.map +0 -1
- package/dist/secret-DoWGmN7m-DO5Brq1Y.mjs.map +0 -1
- package/dist/validate-environment-CEhUSEg2-DmAtiQhe.mjs.map +0 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { a as SecretString, t as Pointer } from "./pointer-CyQZZugO-D7k3vibs.mjs";
|
|
1
2
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
2
3
|
//#region ../../0-framework/0-foundation/foundation/dist/errors.d.mts
|
|
3
4
|
//#region src/structured-error.d.ts
|
|
@@ -77,7 +78,7 @@ declare class CliStructuredError extends Error implements StructuredError {
|
|
|
77
78
|
static is(error: unknown): error is CliStructuredError;
|
|
78
79
|
}
|
|
79
80
|
//#endregion
|
|
80
|
-
//#region ../../0-framework/1-core/core/dist/graph-types-
|
|
81
|
+
//#region ../../0-framework/1-core/core/dist/graph-types-BiFZrE06.d.mts
|
|
81
82
|
//#region src/contract.d.ts
|
|
82
83
|
/**
|
|
83
84
|
* A Contract is the declared interface of a service-to-service dependency: a
|
|
@@ -138,7 +139,7 @@ interface Connection<P extends Params = Params, C = unknown> {
|
|
|
138
139
|
* absent). `schema` is a data-only projection of the param's Standard Schema
|
|
139
140
|
* (JSON Schema when the vendor supports the optional conversion, a `{ vendor }`
|
|
140
141
|
* tag otherwise) — never the param's functions. Physical locations are the
|
|
141
|
-
* target pack's business. Secrets are not here
|
|
142
|
+
* target pack's business. Secrets are not here: they are `secretString()` fields of a service's input, bound with `envSecret()`.
|
|
142
143
|
*/
|
|
143
144
|
interface ConfigDeclaration {
|
|
144
145
|
readonly owner: 'service' | {
|
|
@@ -178,7 +179,7 @@ declare function configOf(root: ServiceNode): readonly ConfigDeclaration[];
|
|
|
178
179
|
* verifies each `envSecret` leaf's platform var exists before deploy; the
|
|
179
180
|
* values are provisioned out-of-band).
|
|
180
181
|
*/
|
|
181
|
-
declare function inputManifest(graph: Graph): readonly
|
|
182
|
+
declare function inputManifest(graph: Graph): readonly InputBindingUse[];
|
|
182
183
|
/**
|
|
183
184
|
* The app's param-binding manifest: every param a `provision()` call bound —
|
|
184
185
|
* literal or an opaque, target-defined `ParamSource` — at the address that
|
|
@@ -188,6 +189,12 @@ declare function inputManifest(graph: Graph): readonly ServiceInputBinding[];
|
|
|
188
189
|
* `default` at `buildConfig`.
|
|
189
190
|
*/
|
|
190
191
|
declare function paramManifest(graph: Graph): readonly ParamBinding[];
|
|
192
|
+
/**
|
|
193
|
+
* Every secret source a binding in the graph names, wherever it sits: what a
|
|
194
|
+
* deploy target's preflight checks.
|
|
195
|
+
* Pure graph introspection, TARGET-AGNOSTIC.
|
|
196
|
+
*/
|
|
197
|
+
declare function secretSourceManifest(graph: Graph): readonly SecretSourceUse[];
|
|
191
198
|
interface ParamOptions<T> {
|
|
192
199
|
readonly optional?: boolean;
|
|
193
200
|
readonly default?: T;
|
|
@@ -213,31 +220,75 @@ type ValueOrigin<T> = {
|
|
|
213
220
|
readonly kind: 'computed';
|
|
214
221
|
readonly dependencies: readonly Value<unknown>[];
|
|
215
222
|
readonly compute: (values: readonly unknown[]) => T;
|
|
223
|
+
} | {
|
|
224
|
+
readonly kind: 'input';
|
|
225
|
+
/** The address of the module whose input this field is. */
|
|
226
|
+
readonly module: string;
|
|
227
|
+
/** The key path inside that module's input; `[]` is the whole input, which Load refuses wherever it is passed on. */
|
|
228
|
+
readonly path: readonly string[];
|
|
229
|
+
} | {
|
|
230
|
+
readonly kind: 'source';
|
|
231
|
+
readonly sourceKind: 'param';
|
|
232
|
+
/** How an error names the source, e.g. `envParam('REGION')`. */
|
|
233
|
+
readonly label: string;
|
|
234
|
+
/** The app configuration key whose text at deploy is the real value, as for `envParam()`. `undefined` for a value known only at boot, whose real value is `source`, a pointer. */
|
|
235
|
+
readonly configurationKey: string | undefined;
|
|
236
|
+
/** The source itself. Not enumerable, so a copy's origin compares equal and the origin holds no cycle. */
|
|
237
|
+
readonly source: ParamSource;
|
|
238
|
+
} | {
|
|
239
|
+
readonly kind: 'source';
|
|
240
|
+
readonly sourceKind: 'secret';
|
|
241
|
+
/** How an error names the source, e.g. `envSecret('STRIPE_KEY')`. */
|
|
242
|
+
readonly label: string;
|
|
243
|
+
/** The app secrets key that holds the secret's value, as for `envSecret()`. `undefined` for a secret source built without one. */
|
|
244
|
+
readonly secretsKey: string | undefined;
|
|
245
|
+
/** The source itself. Not enumerable, so a copy's origin compares equal and the origin holds no cycle. */
|
|
246
|
+
readonly source: SecretSource;
|
|
216
247
|
};
|
|
217
248
|
/**
|
|
218
|
-
* An opaque stand-in a module body can pass wherever a `T` is accepted
|
|
219
|
-
*
|
|
220
|
-
* `resolve()` returns one computed from others
|
|
249
|
+
* An opaque stand-in a module body can pass wherever a `T` is accepted
|
|
250
|
+
* (ADR-0062). `environment.name` is one; each field of a module's `input` is
|
|
251
|
+
* one; `resolve()` returns one computed from others; a deploy target's source,
|
|
252
|
+
* such as `envParam()` or `envSecret()`, is one too. A deploy-time value's real
|
|
253
|
+
* value is known by the end of Load; a runtime value's real value at deploy is a pointer.
|
|
221
254
|
*/
|
|
222
255
|
interface Value<T> {
|
|
223
256
|
readonly [VALUE]: true;
|
|
224
257
|
readonly [VALUE_TYPE]?: T;
|
|
225
258
|
readonly [VALUE_ORIGIN]: ValueOrigin<T>;
|
|
226
259
|
}
|
|
260
|
+
/** A value known only at boot (ADR-0062): its real value at deploy is a `Pointer<T>`, which names the platform variable the service reads at boot. */
|
|
261
|
+
type RuntimeValue<T> = Value<Pointer<T>>;
|
|
227
262
|
/** The tuple of real-value types a dependency tuple stands for: what `resolve()`'s `fn` receives. */
|
|
228
|
-
type RealValuesOf<D extends readonly
|
|
229
|
-
/**
|
|
263
|
+
type RealValuesOf<D extends readonly unknown[]> = { readonly [K in keyof D]: D[K] extends Value<infer T> ? T : never; };
|
|
264
|
+
/**
|
|
265
|
+
* `true` when `T` is a `Pointer` or holds one, through arrays and plain object types.
|
|
266
|
+
* It looks eight levels deep, so a recursive type such as `PlainData` ends; Load checks deeper.
|
|
267
|
+
*/
|
|
268
|
+
type HoldsPointer<T, Depth extends readonly unknown[] = []> = Depth['length'] extends 8 ? false : T extends Pointer<unknown> ? true : T extends readonly (infer E)[] ? HoldsPointer<E, [...Depth, unknown]> : T extends Record<PropertyKey, unknown> ? HoldsPointer<T[keyof T], [...Depth, unknown]> : false;
|
|
269
|
+
/** `true` for a real-value type a `resolve()` function can compute with: one that holds no pointer. `any` and `unknown` pass; Load checks those. */
|
|
270
|
+
type IsDeployTime<T> = 0 extends 1 & T ? true : true extends HoldsPointer<T> ? false : true;
|
|
271
|
+
/** The type error an author sees for a dependency that is not a deploy-time value. */
|
|
272
|
+
type NotDeployTime = 'a resolve() dependency must be a deploy-time value, never a value known only at boot or a field wrapped with field(); to compute with an input field, declare it plain';
|
|
273
|
+
/** A dependency `resolve()` accepts only to refuse it with a message: a module body's whole `input`. */
|
|
274
|
+
type RefusedDependency = ModuleInput<StandardSchemaV1>;
|
|
275
|
+
/** `D` with each dependency that is not a deploy-time value replaced by the message saying so. */
|
|
276
|
+
type DeployTimeDependencies<D extends readonly (Value<unknown> | RefusedDependency)[]> = { readonly [K in keyof D]: D[K] extends Value<infer T> ? IsDeployTime<T> extends true ? D[K] : NotDeployTime : D[K] extends RefusedDependency ? ModuleInputIsNotAValue : D[K]; };
|
|
277
|
+
/** Plain data: what a `resolve()` function may return. */
|
|
230
278
|
type PlainData = string | number | boolean | null | readonly PlainData[] | {
|
|
231
279
|
readonly [key: string]: PlainData;
|
|
232
280
|
};
|
|
233
281
|
/**
|
|
234
282
|
* A value computed from other values. `fn` receives the dependencies' real
|
|
235
|
-
* values as one tuple, in order, and returns plain data.
|
|
236
|
-
*
|
|
237
|
-
*
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
283
|
+
* values as one tuple, in order, and returns plain data. Each dependency must
|
|
284
|
+
* be a deploy-time value: listing a runtime value or a field wrapped with
|
|
285
|
+
* `field()` fails to compile, and Load refuses a dependency whose real value
|
|
286
|
+
* holds a pointer. Load runs `fn` after every module body, with `provision`
|
|
287
|
+
* disabled (ADR-0062). `fn` must be a pure function of its dependencies: a
|
|
288
|
+
* deploy runs it in two processes.
|
|
289
|
+
*/
|
|
290
|
+
declare function resolve<const D extends readonly (Value<unknown> | RefusedDependency)[], T>(dependencies: DeployTimeDependencies<D>, fn: (values: RealValuesOf<D>) => T): Value<T>;
|
|
291
|
+
/** True if `value` is a `Value`, a source included (checks the brand only, never a prototype). */
|
|
241
292
|
declare function isValue(value: unknown): value is Value<unknown>;
|
|
242
293
|
/** The deploy-time facts a module body receives, each as a value (ADR-0062). */
|
|
243
294
|
interface EnvironmentFacts {
|
|
@@ -247,30 +298,67 @@ interface EnvironmentFacts {
|
|
|
247
298
|
/** The real values of the environment facts: what Load is given for the environment being loaded. */
|
|
248
299
|
type EnvironmentRealValues = { readonly [K in keyof EnvironmentFacts]: EnvironmentFacts[K] extends Value<infer T> ? T : never; };
|
|
249
300
|
//#endregion
|
|
301
|
+
//#region src/module-input.d.ts
|
|
302
|
+
declare const MODULE_INPUT: unique symbol;
|
|
303
|
+
type PlainObject = {
|
|
304
|
+
readonly [key: string]: unknown;
|
|
305
|
+
};
|
|
306
|
+
/**
|
|
307
|
+
* What a module body holds for an input field whose real value has type `T`:
|
|
308
|
+
* a value, plus one `ModuleInputField` per key when `T` is a plain object.
|
|
309
|
+
*/
|
|
310
|
+
type ModuleInputField<T> = Value<T> & FieldsOf<T>;
|
|
311
|
+
type FieldsOf<T> = [NonNullable<T>] extends [never] ? unknown : [NonNullable<T>] extends [readonly unknown[]] ? unknown : [NonNullable<T>] extends [PlainObject] ? Fields<NonNullable<T>, undefined extends T ? undefined : never> : unknown;
|
|
312
|
+
type Fields<O, Absent> = { readonly [K in keyof O & string]-?: ModuleInputField<FieldType<O, K> | Absent>; };
|
|
313
|
+
type FieldType<O, K extends keyof O> = Record<never, never> extends Pick<O, K> ? O[K] | undefined : O[K];
|
|
314
|
+
/**
|
|
315
|
+
* The `input` a module body receives for its input schema `S`: a dictionary
|
|
316
|
+
* with one value per field, typed from the schema's output (ADR-0061). It is
|
|
317
|
+
* not itself a value, and no binding accepts it: pass its fields on by name.
|
|
318
|
+
*/
|
|
319
|
+
type ModuleInput<S extends StandardSchemaV1> = {
|
|
320
|
+
readonly [MODULE_INPUT]: true;
|
|
321
|
+
} & FieldsOf<StandardSchemaV1.InferOutput<S>>;
|
|
322
|
+
/** The type error an author sees for a module body's whole input passed where a value is accepted. */
|
|
323
|
+
type ModuleInputIsNotAValue = 'the whole input of a module is not a value; pass its fields on by name';
|
|
324
|
+
/**
|
|
325
|
+
* Required of every object a binding accepts, so a module body's whole `input`
|
|
326
|
+
* fits none. Unlike `NotDeployTime`, a message string, it is an object
|
|
327
|
+
* constraint: its property's type is the message.
|
|
328
|
+
*/
|
|
329
|
+
type NotModuleInput = {
|
|
330
|
+
readonly [MODULE_INPUT]?: ModuleInputIsNotAValue;
|
|
331
|
+
};
|
|
332
|
+
//#endregion
|
|
250
333
|
//#region src/node.d.ts
|
|
251
334
|
declare const NODE: unique symbol;
|
|
252
|
-
declare const SECRET_NEED: unique symbol;
|
|
253
335
|
declare const SECRET_SOURCE: unique symbol;
|
|
254
|
-
/** A
|
|
255
|
-
interface
|
|
256
|
-
readonly [SECRET_NEED]: true;
|
|
257
|
-
readonly kind: 'secret';
|
|
258
|
-
}
|
|
259
|
-
/** A module's secret-forwarding slots: name → the need it declares. */
|
|
260
|
-
type Secrets = Record<string, SecretNeed>;
|
|
261
|
-
/** The wiring value bound to a secret slot: a target-defined payload core forwards but never inspects. A target (e.g. @prisma/composer-prisma-cloud's `envSecret`) builds one via `secretSource()`. */
|
|
262
|
-
interface SecretSource<T = unknown> {
|
|
336
|
+
/** 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 (e.g. @prisma/composer-prisma-cloud's `envSecret`) builds one with `secretSource()`. */
|
|
337
|
+
interface SecretSource<T = unknown> extends Value<unknown> {
|
|
263
338
|
readonly [SECRET_SOURCE]: true;
|
|
264
339
|
/** Target-defined. Core never reads this; the target that authored the source reads it back. */
|
|
265
340
|
readonly payload: T;
|
|
266
341
|
}
|
|
267
|
-
/** What
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
342
|
+
/** What a deploy target says about a source it builds. */
|
|
343
|
+
interface SourceOptions {
|
|
344
|
+
/** How errors name the source, e.g. `envSecret('STRIPE_KEY')`. Defaults to `a secret source` or `a param source`. */
|
|
345
|
+
readonly label?: string;
|
|
346
|
+
}
|
|
347
|
+
/** What a deploy target says about a secret source it builds. */
|
|
348
|
+
interface SecretSourceOptions extends SourceOptions {
|
|
349
|
+
/** The app secrets key that holds this secret's value, as `envSecret('NAME')`'s `NAME`. Composer redacts the value under it wherever it prints, and `prisma dev` hands it to its second process. */
|
|
350
|
+
readonly secretsKey?: string;
|
|
351
|
+
}
|
|
352
|
+
/** What a deploy target says about a param source it builds. */
|
|
353
|
+
interface ParamSourceOptions extends SourceOptions {
|
|
354
|
+
/** The app configuration key whose text at deploy is the source's real value, as for `envParam()`. Without one the source is known only at boot, and its real value is the source itself, a pointer. */
|
|
355
|
+
readonly configurationKey?: string;
|
|
356
|
+
/** For a source known only at boot: `true` makes the source a secret pointer, whose variable holds a secret; otherwise it is a plain pointer. */
|
|
357
|
+
readonly redacted?: boolean;
|
|
358
|
+
}
|
|
359
|
+
/** Builds a secret source from a target-defined payload: the SPI a deploy target's own constructor (e.g. `envSecret`) calls. The source is a value whose real value at deploy is itself, a pointer. Core forwards it and never inspects the payload. */
|
|
360
|
+
declare function secretSource<P, T = unknown>(payload: P, options?: SecretSourceOptions): SecretSource<P> & Value<T>;
|
|
361
|
+
/** True if `value` is a secret source, such as an `envSecret()` result. */
|
|
274
362
|
declare function isSecretSource(value: unknown): value is SecretSource;
|
|
275
363
|
declare const PROVISION_NEED: unique symbol;
|
|
276
364
|
/** A param value the framework mints. Opaque to core: it forwards the payload to the resolved provisioner and never reads it (ADR-0031). */
|
|
@@ -286,43 +374,39 @@ declare function provisionNeed<T = undefined>(brand: symbol, payload?: T): Provi
|
|
|
286
374
|
/** True if `value` is a provisioning need (a `provisionNeed()` result). */
|
|
287
375
|
declare function isProvisionNeed(value: unknown): value is ProvisionNeed;
|
|
288
376
|
declare const PARAM_SOURCE: unique symbol;
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
interface ParamSource<T = unknown> {
|
|
377
|
+
/** A param's source: a target-defined payload core forwards but never inspects. It is a value too: known at deploy when it names an app configuration key (`envParam`), otherwise 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()`. */
|
|
378
|
+
interface ParamSource<T = unknown> extends Value<unknown> {
|
|
292
379
|
readonly [PARAM_SOURCE]: true;
|
|
293
380
|
/** Target-defined. Core never reads this; the target that authored the source reads it back. */
|
|
294
381
|
readonly payload: T;
|
|
295
382
|
}
|
|
296
|
-
/** Builds
|
|
297
|
-
declare function paramSource<T>(payload:
|
|
298
|
-
/** True if `value` is a param source
|
|
383
|
+
/** Builds a param source from a target-defined payload: the SPI a deploy target's own constructor (e.g. `envParam`) calls. Core forwards it and never inspects the payload. */
|
|
384
|
+
declare function paramSource<P, T = unknown>(payload: P, options?: ParamSourceOptions): ParamSource<P> & Value<T>;
|
|
385
|
+
/** True if `value` is a param source, such as an `envParam()` result. */
|
|
299
386
|
declare function isParamSource(value: unknown): value is ParamSource;
|
|
300
|
-
/** A module's declared param-forwarding slot — nameless, schema-less; the root (or an ancestor module) binds a `ParamSource` and the topology forwards it into a child's real, schema-bearing param. */
|
|
301
|
-
interface ParamNeed {
|
|
302
|
-
readonly [PARAM_NEED]: true;
|
|
303
|
-
readonly kind: 'param';
|
|
304
|
-
}
|
|
305
|
-
/** A module's param-forwarding slots: name → the need it declares. */
|
|
306
|
-
type ParamNeeds = Record<string, ParamNeed>;
|
|
307
|
-
/** Declares a module param-forwarding NEED. Nameless — bound to a `ParamSource` by an enclosing scope and forwarded into a child's real param. */
|
|
308
|
-
declare function paramNeed(): ParamNeed;
|
|
309
387
|
/** What `provision(service, { params })` accepts per declared param: a literal (schema-validated when config is built) or an opaque `ParamSource`, taking precedence over `param.default`. Every entry is optional — an unbound param falls back to its `default`. */
|
|
310
388
|
type ParamBindings<P extends Params> = { readonly [K in keyof P]?: StandardSchemaV1.InferOutput<P[K]['schema']> | ParamSource | (StandardSchemaV1.InferOutput<P[K]['schema']> extends PlainData ? Value<StandardSchemaV1.InferOutput<P[K]['schema']>> : never); };
|
|
311
|
-
/**
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
*
|
|
315
|
-
*
|
|
316
|
-
*
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
389
|
+
/**
|
|
390
|
+
* What `provision(node, { input })` accepts, for a module or a service, where
|
|
391
|
+
* the node's input schema expects `T` (its Standard Schema input type): the
|
|
392
|
+
* data, a value standing for it, or, for a `SecretString` field, a secret
|
|
393
|
+
* source. A `SecretString` or a `Pointer` is never written as a literal. An
|
|
394
|
+
* optional key also takes a value that may stand for `undefined`.
|
|
395
|
+
*/
|
|
396
|
+
type InputBinding<T> = Value<T> | (T extends Pointer<unknown> ? never : T extends SecretString ? SecretSource : T extends readonly (infer E)[] ? readonly InputBinding<E>[] : T extends {
|
|
397
|
+
readonly [key: string]: unknown;
|
|
398
|
+
} ? { readonly [K in keyof T]: InputBinding<T[K]> | (Record<never, never> extends Pick<T, K> ? Value<T[K] | undefined> : never); } & NotModuleInput : T);
|
|
399
|
+
/** What `provision()` accepts as the `input` of a node whose input schema is `I`. */
|
|
400
|
+
type InputBindingOf<I extends StandardSchemaV1 | undefined> = InputBinding<StandardSchemaV1.InferInput<NonNullable<I>>>;
|
|
401
|
+
/**
|
|
402
|
+
* `T` with every pointer removed, at any depth: what a service reads at boot,
|
|
403
|
+
* when each pointer has been replaced by the text of the variable it names.
|
|
404
|
+
* Only arrays and plain object types are walked; a class instance such as a
|
|
405
|
+
* `Date` or a `SecretString` is kept as it is.
|
|
406
|
+
*/
|
|
407
|
+
type WithoutPointers<T> = T extends Pointer<unknown> ? never : T extends readonly unknown[] ? { [K in keyof T]: WithoutPointers<T[K]>; } : T extends Record<PropertyKey, unknown> ? { [K in keyof T]: WithoutPointers<T[K]>; } : T;
|
|
408
|
+
/** What `input()` returns: the schema's validated output type with every pointer removed; `never` on a service that declares no input schema. */
|
|
409
|
+
type InputValueOf<I> = I extends StandardSchemaV1 ? WithoutPointers<StandardSchemaV1.InferOutput<I>> : never;
|
|
326
410
|
/** Opaque `Contract<any, any>` bound shared by every node/port type that doesn't care which contract. */
|
|
327
411
|
type AnyContract = Contract<any, any>;
|
|
328
412
|
/** How a service's app becomes a runnable artifact — the build descriptor's routing key (`extension`/`type`) plus paths resolved relative to the authoring module. */
|
|
@@ -362,10 +446,10 @@ interface ResourceNode<C extends AnyContract | undefined = AnyContract, D extend
|
|
|
362
446
|
/** A resource's configuration: plain data and values, nested in objects and arrays. */
|
|
363
447
|
type ResourceProps = {
|
|
364
448
|
readonly [key: string]: ResourcePropsMember;
|
|
365
|
-
};
|
|
366
|
-
type ResourcePropsMember = string | number | boolean | null | Value<PlainData> | readonly ResourcePropsMember[] | {
|
|
449
|
+
} & NotModuleInput;
|
|
450
|
+
type ResourcePropsMember = string | number | boolean | null | Value<PlainData> | readonly ResourcePropsMember[] | ({
|
|
367
451
|
readonly [key: string]: ResourcePropsMember;
|
|
368
|
-
};
|
|
452
|
+
} & NotModuleInput);
|
|
369
453
|
/**
|
|
370
454
|
* A Service: inputs + its own declared params + how it is built. Inspectable,
|
|
371
455
|
* inert until run, and carries NO runtime behavior — an extension's factory
|
|
@@ -416,35 +500,56 @@ interface DependencyEnd<C = unknown, Req = unknown> {
|
|
|
416
500
|
readonly required: Req | undefined;
|
|
417
501
|
}
|
|
418
502
|
/** A Module: the same Deps/Expose boundary a service has, around transparent wiring instead of a black-box body — its `body` runs at Load, not at authoring. */
|
|
419
|
-
interface ModuleNode<D extends Deps = Deps, E extends Expose = Expose,
|
|
503
|
+
interface ModuleNode<D extends Deps = Deps, E extends Expose = Expose, I extends StandardSchemaV1 | undefined = StandardSchemaV1 | undefined> {
|
|
420
504
|
readonly [NODE]: true;
|
|
421
505
|
readonly kind: 'module';
|
|
422
506
|
/** Human-readable, given at authoring — logs/diagnostics only. */
|
|
423
507
|
readonly name: string;
|
|
424
508
|
readonly deps: D;
|
|
425
|
-
/**
|
|
426
|
-
readonly
|
|
427
|
-
/** Declared param-forwarding slots (authored as `params`) — forwarded to internals via `ctx.params`, the same rail secrets ride on. */
|
|
428
|
-
readonly paramSlots: PN;
|
|
509
|
+
/** The module's whole incoming configuration as one Standard Schema (authored as `input`, ADR-0061), or `undefined` when it takes none. Load only calls its `~standard.validate`. */
|
|
510
|
+
readonly inputSchema: I;
|
|
429
511
|
readonly expose: E;
|
|
430
|
-
body(ctx: ModuleContext<D,
|
|
512
|
+
body(ctx: ModuleContext<D, I>): ModuleOutputs<E> | void;
|
|
513
|
+
/** `false`: a `module()` node can be provisioned. The app root, built with `appRoot()`, is the deploy's entry and cannot be. It answers `false` even when a `module()` node is the deploy's entry. */
|
|
514
|
+
isRoot(): false;
|
|
515
|
+
}
|
|
516
|
+
/** The app's root, built with `appRoot()`: a module node that nothing provisions, with no `deps` and no `expose`. */
|
|
517
|
+
interface AppRootNode<I extends StandardSchemaV1 | undefined = StandardSchemaV1 | undefined> {
|
|
518
|
+
readonly [NODE]: true;
|
|
519
|
+
readonly kind: 'module';
|
|
520
|
+
/** The app's name. */
|
|
521
|
+
readonly name: string;
|
|
522
|
+
readonly deps: Record<never, never>;
|
|
523
|
+
/** The app configuration's schema, or `undefined` when the root takes none. */
|
|
524
|
+
readonly inputSchema: I;
|
|
525
|
+
readonly expose: Record<never, never>;
|
|
526
|
+
body(ctx: AppRootContext<I>): void;
|
|
527
|
+
/** `true`: the app root is the deploy's entry and cannot be provisioned. */
|
|
528
|
+
isRoot(): true;
|
|
431
529
|
}
|
|
432
530
|
/**
|
|
433
531
|
* What a module's body receives: its declared dependencies as forwardable wiring
|
|
434
532
|
* values, plus `provision` to register the owned services/modules it wires them into.
|
|
435
533
|
*/
|
|
436
|
-
interface ModuleContext<D extends Deps,
|
|
534
|
+
interface ModuleContext<D extends Deps, I extends StandardSchemaV1 | undefined = StandardSchemaV1 | undefined> {
|
|
437
535
|
/** The module's declared dependencies as wiring values — pass them into provision(). */
|
|
438
536
|
readonly deps: { [K in keyof D]: InputRef<D[K]>; };
|
|
439
|
-
/** The module's
|
|
440
|
-
readonly
|
|
441
|
-
/** The module's declared param-forwarding slots as forwardable sources — pass them into a child's `params`. */
|
|
442
|
-
readonly params: { readonly [K in keyof PN]: ParamSource; };
|
|
537
|
+
/** The module's input: a dictionary with one value per field, typed from its input schema's output (ADR-0061); `undefined` when it declares none. It is not itself a value: pass its fields on by name, into a provision() binding or, for a plain field, as a resolve() dependency. A root's input is the app configuration, validated by its schema. */
|
|
538
|
+
readonly input: I extends StandardSchemaV1 ? ModuleInput<I> : undefined;
|
|
443
539
|
/** The deploy-time facts of the environment, each a value (ADR-0062). List `environment.name` as a `resolve()` dependency. Never environment variables: user code never reads those. */
|
|
444
540
|
readonly environment: EnvironmentFacts;
|
|
445
541
|
/** Registers an owned child (service or module) under a stable id. */
|
|
446
542
|
readonly provision: ModuleBuilder['provision'];
|
|
447
543
|
}
|
|
544
|
+
/** What an app root's body receives: its input, the environment's facts, and `provision`. */
|
|
545
|
+
interface AppRootContext<I extends StandardSchemaV1 | undefined = StandardSchemaV1 | undefined> {
|
|
546
|
+
/** The app configuration, one value per field, typed from the root's input schema; `undefined` when it declares none. */
|
|
547
|
+
readonly input: I extends StandardSchemaV1 ? ModuleInput<I> : undefined;
|
|
548
|
+
/** The deploy-time facts of the environment, each a value (ADR-0062). */
|
|
549
|
+
readonly environment: EnvironmentFacts;
|
|
550
|
+
/** Registers an owned child (resource, service or module) under a stable id. */
|
|
551
|
+
readonly provision: ModuleBuilder['provision'];
|
|
552
|
+
}
|
|
448
553
|
/**
|
|
449
554
|
* A module's forwarded-input value: the same ref-port shape a producer's
|
|
450
555
|
* output carries, so it flows down a nested `provision()` call indistinguishably
|
|
@@ -491,7 +596,7 @@ type ServiceProvisionArgs<D extends Deps, I extends StandardSchemaV1 | undefined
|
|
|
491
596
|
params?: PB;
|
|
492
597
|
}] : [opts: {
|
|
493
598
|
id?: string;
|
|
494
|
-
input:
|
|
599
|
+
input: InputBindingOf<I>;
|
|
495
600
|
params?: PB;
|
|
496
601
|
}] : I extends undefined ? [opts: {
|
|
497
602
|
id?: string;
|
|
@@ -500,31 +605,26 @@ type ServiceProvisionArgs<D extends Deps, I extends StandardSchemaV1 | undefined
|
|
|
500
605
|
}] : [opts: {
|
|
501
606
|
id?: string;
|
|
502
607
|
deps: DepBindings<D>;
|
|
503
|
-
input:
|
|
608
|
+
input: InputBindingOf<I>;
|
|
504
609
|
params?: PB;
|
|
505
610
|
}];
|
|
506
611
|
/**
|
|
507
|
-
* A child-MODULE provision's trailing options: `deps
|
|
508
|
-
* exactly when the module declares
|
|
509
|
-
* slot may be bound to a `ParamSource`.
|
|
612
|
+
* A child-MODULE provision's trailing options: `deps` and `input` each
|
|
613
|
+
* required exactly when the module declares them.
|
|
510
614
|
*/
|
|
511
|
-
type
|
|
512
|
-
id?: string;
|
|
513
|
-
params?: PB;
|
|
514
|
-
}] : [opts: {
|
|
515
|
-
id?: string;
|
|
516
|
-
secrets: SecretBindings<S>;
|
|
517
|
-
params?: PB;
|
|
518
|
-
}] : [keyof S] extends [never] ? [opts: {
|
|
519
|
-
id?: string;
|
|
520
|
-
deps: DepBindings<D>;
|
|
521
|
-
params?: PB;
|
|
522
|
-
}] : [opts: {
|
|
615
|
+
type ModuleProvisionOptions<D extends Deps, I extends StandardSchemaV1 | undefined> = {
|
|
523
616
|
id?: string;
|
|
617
|
+
} & ([keyof D] extends [never] ? unknown : {
|
|
524
618
|
deps: DepBindings<D>;
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
}
|
|
619
|
+
}) & (I extends StandardSchemaV1 ? {
|
|
620
|
+
input: InputBindingOf<I>;
|
|
621
|
+
} : unknown);
|
|
622
|
+
/** The options are optional exactly when nothing is required. */
|
|
623
|
+
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>];
|
|
624
|
+
/** The options `provision()` takes after a service or module node `N`. */
|
|
625
|
+
type ProvisionArgs<N> = 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;
|
|
626
|
+
/** The contracts a service or module node `N` exposes. */
|
|
627
|
+
type ExposeOf<N> = N extends ServiceNode<Deps, Params, infer E, StandardSchemaV1 | undefined> ? E : N extends ModuleNode<Deps, infer E, StandardSchemaV1 | undefined> ? E : never;
|
|
528
628
|
interface ModuleBuilder {
|
|
529
629
|
/** Provisions an owned resource; its id defaults to the node's `name`. */
|
|
530
630
|
provision<C extends AnyContract | undefined>(resource: ResourceNode<C>, opts?: {
|
|
@@ -534,27 +634,44 @@ interface ModuleBuilder {
|
|
|
534
634
|
} & (C extends AnyContract ? RefPort<C> : Record<never, never>);
|
|
535
635
|
/** 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 `ParamSource`), overriding its default. */
|
|
536
636
|
provision<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>;
|
|
637
|
+
/** Registers an owned child module; its id defaults to the node's `name`; `deps` and `input` are required iff it declares them. */
|
|
638
|
+
provision<D extends Deps, E extends Expose, I extends StandardSchemaV1 | undefined>(child: ModuleNode<D, E, I>, ...args: ModuleProvisionArgs<D, I>): ProvisionedRef<E>;
|
|
537
639
|
/**
|
|
538
|
-
* The service call with `deps
|
|
539
|
-
*
|
|
640
|
+
* The service call with `deps` written out. `ServiceProvisionArgs` above
|
|
641
|
+
* cannot resolve while `D` or `I` is still an unbound type parameter — a
|
|
540
642
|
* generic wrapper like `cron()` provisioning a caller-supplied service — so
|
|
541
|
-
* that call site resolves to this
|
|
643
|
+
* that call site resolves to this overload, or to the next one for a
|
|
644
|
+
* service without an input schema.
|
|
542
645
|
*/
|
|
543
646
|
provision<D extends Deps, P extends Params, E extends Expose, I extends StandardSchemaV1 | undefined>(service: ServiceNode<D, P, E, I>, opts: {
|
|
544
647
|
id?: string;
|
|
545
648
|
deps: DepBindings<D>;
|
|
546
|
-
input
|
|
649
|
+
input: InputBindingOf<I>;
|
|
547
650
|
params?: ParamBindings<P>;
|
|
548
651
|
}): ProvisionedRef<E>;
|
|
549
|
-
|
|
550
|
-
provision<D extends Deps, E extends Expose, S extends Secrets, PN extends ParamNeeds>(child: ModuleNode<D, E, S, PN>, ...args: ModuleProvisionArgs<D, S, ParamNeedBindings<PN>>): ProvisionedRef<E>;
|
|
551
|
-
/** The child-module call with `deps`/`secrets` spelled out — the same generic-wrapper escape as the service overload above. */
|
|
552
|
-
provision<D extends Deps, E extends Expose, S extends Secrets, PN extends ParamNeeds>(child: ModuleNode<D, E, S, PN>, opts: {
|
|
652
|
+
provision<D extends Deps, P extends Params, E extends Expose>(service: ServiceNode<D, P, E, undefined>, opts: {
|
|
553
653
|
id?: string;
|
|
554
654
|
deps: DepBindings<D>;
|
|
555
|
-
|
|
556
|
-
params?:
|
|
655
|
+
input?: never;
|
|
656
|
+
params?: ParamBindings<P>;
|
|
557
657
|
}): ProvisionedRef<E>;
|
|
658
|
+
/** The child-module call with `deps` written out — the same generic-wrapper escape as the two service overloads above. */
|
|
659
|
+
provision<D extends Deps, E extends Expose, I extends StandardSchemaV1 | undefined>(child: ModuleNode<D, E, I>, opts: {
|
|
660
|
+
id?: string;
|
|
661
|
+
deps: DepBindings<D>;
|
|
662
|
+
input: InputBindingOf<I>;
|
|
663
|
+
}): ProvisionedRef<E>;
|
|
664
|
+
provision<D extends Deps, E extends Expose>(child: ModuleNode<D, E, undefined>, opts: {
|
|
665
|
+
id?: string;
|
|
666
|
+
deps: DepBindings<D>;
|
|
667
|
+
input?: never;
|
|
668
|
+
}): ProvisionedRef<E>;
|
|
669
|
+
/**
|
|
670
|
+
* Any service or child module. Declared last, so a call no overload accepts
|
|
671
|
+
* reports this overload's error, which names the binding key that does not
|
|
672
|
+
* fit, or says a module's whole input is not a value.
|
|
673
|
+
*/
|
|
674
|
+
provision<N extends ServiceNode | ModuleNode>(node: N, ...args: ProvisionArgs<N>): ProvisionedRef<ExposeOf<N>>;
|
|
558
675
|
}
|
|
559
676
|
/** Dependency map: name → the slot the service declares. Only declarations are admitted, never a concrete ResourceNode. */
|
|
560
677
|
type Deps = Record<string, DependencyEnd<any, any>>;
|
|
@@ -641,35 +758,72 @@ declare function dependency<P extends Params, C, Req = unknown>(def: {
|
|
|
641
758
|
* closed-root shape — `module(name, body)` instead of `module(name, {}, () =>
|
|
642
759
|
* ({}))`.
|
|
643
760
|
*/
|
|
644
|
-
declare function module(name: string, body: (ctx: ModuleContext<Record<never, never>,
|
|
761
|
+
declare function module(name: string, body: (ctx: ModuleContext<Record<never, never>, undefined>) => void): ModuleNode<Record<never, never>, Record<never, never>, undefined>;
|
|
645
762
|
/**
|
|
646
763
|
* A module with a boundary: `deps` and/or `expose` declare what wires in and
|
|
647
764
|
* out, the same way a service does. The body returns one port per `expose` key.
|
|
648
765
|
*/
|
|
649
|
-
declare function module<D extends Deps = Record<never, never>, E extends Expose = Record<never, never>,
|
|
766
|
+
declare function module<D extends Deps = Record<never, never>, E extends Expose = Record<never, never>, I extends StandardSchemaV1 | undefined = undefined>(name: string, boundary: {
|
|
650
767
|
deps?: D;
|
|
651
|
-
|
|
652
|
-
params?: PN;
|
|
768
|
+
input?: I;
|
|
653
769
|
expose?: E;
|
|
654
|
-
}, body: (ctx: ModuleContext<D,
|
|
770
|
+
}, body: (ctx: ModuleContext<D, I>) => ModuleOutputs<E> | void): ModuleNode<D, E, I>;
|
|
771
|
+
/** Builds the app's root, the module the entry default-exports. It takes no `deps` and no `expose`, and nothing can provision it. */
|
|
772
|
+
declare function appRoot(name: string, body: (ctx: AppRootContext<undefined>) => void): AppRootNode<undefined>;
|
|
773
|
+
declare function appRoot<I extends StandardSchemaV1 | undefined = undefined>(name: string, options: {
|
|
774
|
+
input?: I;
|
|
775
|
+
deps?: never;
|
|
776
|
+
expose?: never;
|
|
777
|
+
}, body: (ctx: AppRootContext<I>) => void): AppRootNode<I>;
|
|
655
778
|
/**
|
|
656
779
|
* True if `value` was constructed by this module's factories. Checks the
|
|
657
780
|
* brand only, never a prototype — a graph may mix nodes from a different
|
|
658
781
|
* installed copy of core (dual-package hazard).
|
|
659
782
|
*/
|
|
660
|
-
declare function isNode(value: unknown): value is ServiceNode | ResourceNode | DependencyEnd | ModuleNode;
|
|
783
|
+
declare function isNode(value: unknown): value is ServiceNode | ResourceNode | DependencyEnd | ModuleNode | AppRootNode;
|
|
661
784
|
/** A node's dependency slots. A resource node built by another installed copy of core may have no `inputs`; that means none. */
|
|
662
785
|
declare function slotsOf(node: ServiceNode | ResourceNode): ServiceNode['inputs'];
|
|
663
786
|
//#endregion
|
|
664
787
|
//#region src/graph-types.d.ts
|
|
665
788
|
/** Path-derived: root-scope children are bare ids ("auth", "db"); a nested module's own children dot-join under its address ("auth.db"). */
|
|
666
789
|
type NodeId = string;
|
|
667
|
-
|
|
790
|
+
/** One field of the root's input that its body names, with the real value the root's schema produced there. */
|
|
791
|
+
interface RootInputField {
|
|
792
|
+
/** The key path inside the root's input, such as `['smtp', 'host']`. */
|
|
793
|
+
readonly path: readonly string[];
|
|
794
|
+
/** The real value; absent when it is `undefined`. */
|
|
795
|
+
readonly value?: unknown;
|
|
796
|
+
}
|
|
797
|
+
/**
|
|
798
|
+
* What a Load read from the app configuration (ADR-0062). The deploy's and `prisma dev`'s
|
|
799
|
+
* first process writes it to the app configuration file, and their second process Loads with
|
|
800
|
+
* it in place of the app configuration.
|
|
801
|
+
*/
|
|
802
|
+
interface AppConfigurationRead {
|
|
803
|
+
/** 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. */
|
|
804
|
+
readonly rootInput: readonly RootInputField[];
|
|
805
|
+
/** 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. */
|
|
806
|
+
readonly configurationKeyText: Readonly<Record<string, string>>;
|
|
807
|
+
}
|
|
808
|
+
interface CommonLoadOptions {
|
|
668
809
|
/** The root's address: the app name. Defaults to the root's `name`. */
|
|
669
810
|
readonly id?: NodeId;
|
|
670
811
|
/** The facts of the environment being loaded. `name` is what `--environment` gave. Required by any value over `environment.name`. */
|
|
671
812
|
readonly environment?: EnvironmentRealValues;
|
|
672
813
|
}
|
|
814
|
+
/** Load's options in the first process, or wherever the app configuration is at hand. */
|
|
815
|
+
interface FirstProcessLoadOptions extends CommonLoadOptions {
|
|
816
|
+
/** The app configuration (ADR-0062): what the `config` adapters return. It is the root's input, which the root's schema checks, and what a source with a configuration key, such as `envParam('NAME')`, reads. */
|
|
817
|
+
readonly configuration?: Readonly<Record<string, unknown>>;
|
|
818
|
+
readonly appConfigurationRead?: never;
|
|
819
|
+
}
|
|
820
|
+
/** Load's options in the deploy's and dev's second process. */
|
|
821
|
+
interface SecondProcessLoadOptions extends CommonLoadOptions {
|
|
822
|
+
readonly configuration?: never;
|
|
823
|
+
/** What the first process's Load read, from the app configuration file. Load takes each root field from it without running the root's schema. */
|
|
824
|
+
readonly appConfigurationRead: AppConfigurationRead;
|
|
825
|
+
}
|
|
826
|
+
type LoadOptions = FirstProcessLoadOptions | SecondProcessLoadOptions;
|
|
673
827
|
interface GraphNode {
|
|
674
828
|
readonly id: NodeId;
|
|
675
829
|
/**
|
|
@@ -679,7 +833,7 @@ interface GraphNode {
|
|
|
679
833
|
* (the platform's application topology included) treats the id as opaque.
|
|
680
834
|
*/
|
|
681
835
|
readonly parent: NodeId | undefined;
|
|
682
|
-
readonly node: ServiceNode | ResourceNode | DependencyEnd | ModuleNode;
|
|
836
|
+
readonly node: ServiceNode | ResourceNode | DependencyEnd | ModuleNode | AppRootNode;
|
|
683
837
|
}
|
|
684
838
|
/** The reserved name of a resource's single anonymous output port. Rejected as a user-declared port name (node.ts). */
|
|
685
839
|
declare const RESOURCE_OUT_PORT = "$out";
|
|
@@ -727,16 +881,14 @@ interface Edge {
|
|
|
727
881
|
readonly kind: 'input' | 'dependency';
|
|
728
882
|
}
|
|
729
883
|
/**
|
|
730
|
-
*
|
|
731
|
-
*
|
|
732
|
-
* address. Core never walks it beyond usage tracking; the deploy target's
|
|
733
|
-
* recursive descent classifies its leaves (literals, `envParam`, `envSecret`).
|
|
884
|
+
* The binding a `provision()` call supplied as a service's input (ADR-0042),
|
|
885
|
+
* recorded at the service's address. The deploy target resolves its leaves.
|
|
734
886
|
*/
|
|
735
|
-
interface
|
|
887
|
+
interface InputBindingUse {
|
|
736
888
|
/** The graph address of the service that declares the input schema. */
|
|
737
889
|
readonly serviceAddress: NodeId;
|
|
738
890
|
/** The binding object supplied at provision. */
|
|
739
|
-
readonly binding:
|
|
891
|
+
readonly binding: unknown;
|
|
740
892
|
}
|
|
741
893
|
/**
|
|
742
894
|
* A resolved param binding: a `provision()` call bound a service's param
|
|
@@ -754,6 +906,15 @@ interface ParamBinding {
|
|
|
754
906
|
/** A literal value (schema-validated by `buildConfig`) or an opaque `ParamSource` (the deploy target reads its own payload back) — check with `isParamSource`. Core never inspects a `ParamSource`'s payload. */
|
|
755
907
|
readonly binding: unknown;
|
|
756
908
|
}
|
|
909
|
+
/** 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. */
|
|
910
|
+
interface SecretSourceUse {
|
|
911
|
+
/** The source, as its target built it. Core never reads its payload. */
|
|
912
|
+
readonly source: SecretSource;
|
|
913
|
+
/** A service whose final binding holds it, if one does. Otherwise the module whose input holds it. */
|
|
914
|
+
readonly address: NodeId;
|
|
915
|
+
/** That node's kind. */
|
|
916
|
+
readonly nodeKind: 'service' | 'module' | 'resource';
|
|
917
|
+
}
|
|
757
918
|
interface Graph {
|
|
758
919
|
readonly root: GraphNode;
|
|
759
920
|
/** Root + one per input, topo-ordered (deps first). */
|
|
@@ -764,9 +925,13 @@ interface Graph {
|
|
|
764
925
|
/** The authored (pre-dereference) edges between boundary ports, in declaration order. */
|
|
765
926
|
readonly authoredEdges: readonly AuthoredEdge[];
|
|
766
927
|
/** Every service input binding a `provision()` call supplied (ADR-0042). */
|
|
767
|
-
readonly inputBindings: readonly
|
|
928
|
+
readonly inputBindings: readonly InputBindingUse[];
|
|
768
929
|
/** Every service param bound at provision — literal or source; unbound params are absent here and fall back to their `default` (see `buildConfig`). */
|
|
769
930
|
readonly params: readonly ParamBinding[];
|
|
931
|
+
/** Every secret source a binding names, once each, in the order Load met them (ADR-0029). */
|
|
932
|
+
readonly secretSources: readonly SecretSourceUse[];
|
|
933
|
+
/** What this Load read from the app configuration (ADR-0062). Empty when Load was given none. */
|
|
934
|
+
readonly appConfigurationRead: AppConfigurationRead;
|
|
770
935
|
}
|
|
771
936
|
/**
|
|
772
937
|
* Thrown by Load when the graph is malformed. Structured at origin
|
|
@@ -780,5 +945,5 @@ declare class LoadError extends CliStructuredError {
|
|
|
780
945
|
});
|
|
781
946
|
}
|
|
782
947
|
//#endregion
|
|
783
|
-
export {
|
|
784
|
-
//# sourceMappingURL=graph-types-
|
|
948
|
+
export { ResourcePropsMember as $, ModuleBuilder as A, service as At, ParamSource as B, InputBinding as C, paramManifest as Ct, InputValueOf as D, resource as Dt, InputRef as E, resolve as Et, ModuleOutputs as F, ProvisionNeed as G, Params as H, NODE as I, RealValuesOf as J, ProvisionedRef as K, NodeId as L, ModuleInput as M, string as Mt, ModuleInputField as N, CliStructuredError as Nt, LoadError as O, secretSource as Ot, ModuleNode as P, ResourceProps as Q, ParamBinding as R, HydratedDeps as S, param as St, InputBindingUse as T, provisionNeed as Tt, PlainData as U, ParamSourceOptions as V, PortEndpoint as W, ResourceNode as X, RefPort as Y, ResourceNodeBase as Z, EnvironmentFacts as _, isProvisionNeed as _t, BoundaryPort as a, SecretSourceUse as at, GraphNode as b, module as bt, ConfigDeclaration as c, Value as ct, Contract as d, configOf as dt, RootInputField as et, ContractStyle as f, dependency as ft, Edge as g, isParamSource as gt, Deps as h, isNode as ht, AuthoredEdge as i, SecretSourceOptions as it, ModuleContext as j, slotsOf as jt, LoadOptions as k, secretSourceManifest as kt, ConfigParam as l, Values as lt, DependencyEnd as m, inputManifest as mt, AppRootContext as n, RuntimeValue as nt, BuildAdapter as o, ServiceNode as ot, DepBindings as p, freezeNode as pt, RESOURCE_OUT_PORT as q, AppRootNode as r, SecretSource as rt, Config as s, SourceOptions as st, AppConfigurationRead as t, RunnableServiceNode as tt, Connection as u, appRoot as ut, Expose as v, isSecretSource as vt, InputBindingOf as w, paramSource as wt, Hydrated as x, number as xt, Graph as y, isValue as yt, ParamBindings as z };
|
|
949
|
+
//# sourceMappingURL=graph-types-BiFZrE06-D6vaGxXz.d.mts.map
|