@prisma/composer 0.1.0 → 0.2.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-BPb3LCdH-CH7b8Khi.d.mts +411 -0
- package/dist/app-config-BPb3LCdH-CH7b8Khi.d.mts.map +1 -0
- package/dist/assertions.d.mts +1 -1
- package/dist/assertions.d.mts.map +1 -0
- package/dist/bin.mjs +166 -256
- package/dist/bin.mjs.map +1 -1
- package/dist/casts.d.mts +1 -1
- package/dist/casts.d.mts.map +1 -0
- package/dist/config-Cqu_-Hna.d.mts +1 -0
- package/dist/config.d.mts +3 -2
- package/dist/config.mjs +2 -1
- package/dist/config.mjs.map +1 -1
- package/dist/container-transport-DKmKg5JQ-DKWs0ubK.mjs +45 -0
- package/dist/container-transport-DKmKg5JQ-DKWs0ubK.mjs.map +1 -0
- package/dist/deploy-Cqu_-Hna.d.mts +1 -0
- package/dist/deploy.d.mts +3 -2
- package/dist/deploy.mjs +181 -23
- package/dist/deploy.mjs.map +1 -1
- package/dist/{dist-zBU8ASQW.mjs → dist-B0axxnBf.mjs} +16 -4
- package/dist/dist-B0axxnBf.mjs.map +1 -0
- package/dist/{graph-BYdCQKya-BI0njTow.mjs → graph-BmrUEdo9-6Oq1hSmS.mjs} +102 -9
- package/dist/graph-BmrUEdo9-6Oq1hSmS.mjs.map +1 -0
- package/dist/graph-DUSgjmzA-DhtkTqoz.d.mts +18 -0
- package/dist/graph-DUSgjmzA-DhtkTqoz.d.mts.map +1 -0
- package/dist/{config-ob5OhCSP-sP3GW3uu.d.mts → graph-types-BcbVhojU-C3fhxjPK.d.mts} +205 -114
- package/dist/graph-types-BcbVhojU-C3fhxjPK.d.mts.map +1 -0
- package/dist/{index-CZSc9drz.d.mts → index-BFBNz7Aw.d.mts} +5 -20
- package/dist/index-BFBNz7Aw.d.mts.map +1 -0
- package/dist/index.d.mts +4 -3
- package/dist/index.mjs +3 -3
- package/dist/{index-Dh4Zro0y.d.mts → nextjs-DLyeRR7M-DwnBjryZ.d.mts} +6 -5
- package/dist/nextjs-DLyeRR7M-DwnBjryZ.d.mts.map +1 -0
- package/dist/nextjs-control.d.mts +6 -5
- package/dist/nextjs-control.d.mts.map +1 -0
- package/dist/nextjs-control.mjs +7 -10
- package/dist/nextjs-control.mjs.map +1 -1
- package/dist/nextjs.d.mts +2 -2
- package/dist/nextjs.mjs.map +1 -1
- package/dist/node-control.d.mts +5 -3
- package/dist/node-control.d.mts.map +1 -0
- package/dist/node-control.mjs +96 -24
- package/dist/node-control.mjs.map +1 -1
- package/dist/node.d.mts +18 -5
- package/dist/node.d.mts.map +1 -0
- package/dist/node.mjs +2 -1
- package/dist/node.mjs.map +1 -1
- package/dist/report.d.mts +17 -0
- package/dist/report.d.mts.map +1 -0
- package/dist/report.mjs +79 -0
- package/dist/report.mjs.map +1 -0
- package/dist/service-rpc.d.mts +61 -0
- package/dist/service-rpc.d.mts.map +1 -0
- package/dist/service-rpc.mjs +353 -0
- package/dist/service-rpc.mjs.map +1 -0
- package/dist/testing.d.mts +2 -3
- package/dist/testing.d.mts.map +1 -0
- package/package.json +20 -18
- package/src/exports/assertions.ts +1 -0
- package/src/exports/casts.ts +1 -0
- package/src/exports/config.ts +1 -0
- package/src/exports/deploy.ts +1 -0
- package/src/exports/index.ts +1 -0
- package/src/exports/nextjs-control.ts +1 -0
- package/src/exports/nextjs.ts +2 -0
- package/src/exports/node-control.ts +1 -0
- package/src/exports/node.ts +2 -0
- package/src/exports/report.ts +1 -0
- package/src/exports/service-rpc.ts +1 -0
- package/src/exports/testing.ts +1 -0
- package/dist/app-config-BUqyK6N6-CVq3uvHF.d.mts +0 -188
- package/dist/config-BVVgDSdq.d.mts +0 -1
- package/dist/deploy-BVVgDSdq.d.mts +0 -1
- package/dist/dist-zBU8ASQW.mjs.map +0 -1
- package/dist/graph-BYdCQKya-BI0njTow.mjs.map +0 -1
- package/dist/rpc.d.mts +0 -43
- package/dist/rpc.mjs +0 -132
- package/dist/rpc.mjs.map +0 -1
- package/dist/tsdown.d.mts +0 -9
- package/dist/tsdown.mjs +0 -35
- package/dist/tsdown.mjs.map +0 -1
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
import { A as ProvisionNeed, H as ServiceNode, N as ResourceNode, S as NodeId, d as Graph, n as Config, t as BuildAdapter, y as ModuleNode } from "./graph-types-BcbVhojU-C3fhxjPK.mjs";
|
|
2
|
+
import "./graph-DUSgjmzA-DhtkTqoz.mjs";
|
|
3
|
+
import * as Alchemy from "alchemy";
|
|
4
|
+
import { Input, StackServices } from "alchemy";
|
|
5
|
+
import * as Effect from "effect/Effect";
|
|
6
|
+
import * as Layer from "effect/Layer";
|
|
7
|
+
import { State } from "alchemy/State/State";
|
|
8
|
+
//#region ../../0-framework/1-core/core/dist/app-config-BPb3LCdH.d.mts
|
|
9
|
+
//#region src/container-transport.d.ts
|
|
10
|
+
/**
|
|
11
|
+
* Carries resolved containers from the CLI process into the alchemy process
|
|
12
|
+
* (ADR-0037). A deploy runs as two processes: the CLI resolves each
|
|
13
|
+
* extension's containers, then spawns `alchemy`, which re-imports the config
|
|
14
|
+
* from scratch and needs those containers back — and env vars are the only
|
|
15
|
+
* channel between the two. So the CLI writes each instance's `serialize()`
|
|
16
|
+
* output into one env var per extension, and in the alchemy process
|
|
17
|
+
* `deserializeContainers` reads each var back through the same extension's
|
|
18
|
+
* descriptor. The framework owns the vars; it never reads their contents.
|
|
19
|
+
*/
|
|
20
|
+
/** The key an extension resolves a container from: which app, which stage. */
|
|
21
|
+
interface LocateContainerInput {
|
|
22
|
+
/** The application name (root node's name, or `--name`). */
|
|
23
|
+
readonly appName: string;
|
|
24
|
+
/** The named stage, or `undefined` for the default (production) stage. */
|
|
25
|
+
readonly stage: string | undefined;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* One resolved container. The framework sees only this interface; the
|
|
29
|
+
* extension that produced the instance narrows it back to its own concrete
|
|
30
|
+
* type wherever the framework hands it back (ADR-0037).
|
|
31
|
+
*/
|
|
32
|
+
interface ContainerInstance {
|
|
33
|
+
readonly input: LocateContainerInput;
|
|
34
|
+
/** Serialize to a non-empty string for the process transport above. The format is the extension's own; only its `deserialize` reads it. */
|
|
35
|
+
serialize(): string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The platform containers an app deploys into, as one lifecycle. `I` is
|
|
39
|
+
* the extension's own instance type — the same descriptor produces and
|
|
40
|
+
* consumes it, so the extension gets full typing internally while the
|
|
41
|
+
* framework stores the erased form. METHOD SYNTAX REQUIRED on all four
|
|
42
|
+
* members: the erased assignment into ExtensionDescriptor compiles only
|
|
43
|
+
* through method bivariance; property-arrow members are checked
|
|
44
|
+
* contravariantly and the assignment fails (same rule as
|
|
45
|
+
* ServiceLowering<P, S> — ADR-0033).
|
|
46
|
+
*/
|
|
47
|
+
interface ContainerDescriptor<I extends ContainerInstance = ContainerInstance> {
|
|
48
|
+
/** Resolve the container for (appName, stage), creating anything absent. Called by `deploy`. */
|
|
49
|
+
ensure(input: LocateContainerInput): Promise<I>;
|
|
50
|
+
/** Find the container for (appName, stage); `undefined` when nothing exists. Called by `destroy` — never creates. */
|
|
51
|
+
locate(input: LocateContainerInput): Promise<I | undefined>;
|
|
52
|
+
/** Remove the container after a successful destroy, after every extension's `teardown` has run. Failure policy is the extension's. */
|
|
53
|
+
remove(instance: I): Promise<void>;
|
|
54
|
+
/** Reconstruct an instance from its own `serialize()` output — the far end of the framework's parent→child transport. */
|
|
55
|
+
deserialize(serialized: string): I;
|
|
56
|
+
}
|
|
57
|
+
/** '@prisma/composer-prisma-cloud' → 'PRISMA_COMPOSER_CONTAINER_PRISMA_COMPOSER_PRISMA_CLOUD' */
|
|
58
|
+
declare function containerEnvVarName(extensionId: string): string;
|
|
59
|
+
/** The env entries the CLI sets on the alchemy process: `{ [containerEnvVarName(id)]: instance.serialize() }` for every resolved instance. */
|
|
60
|
+
declare function containerEnv(instances: ReadonlyMap<string, ContainerInstance>): Record<string, string>;
|
|
61
|
+
/** The slice of `PrismaAppConfig.extensions` this module needs — kept narrow so this shared-plane module never imports the control-plane `ExtensionDescriptor`/`PrismaAppConfig` types (ADR-0028's plane split). */
|
|
62
|
+
interface ContainerTransportExtension {
|
|
63
|
+
readonly id: string;
|
|
64
|
+
readonly container?: ContainerDescriptor;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The alchemy-process side: for each extension with a container descriptor
|
|
68
|
+
* whose var is present in `env`, call its deserialize. Absent var → no entry.
|
|
69
|
+
*/
|
|
70
|
+
declare function deserializeContainers(extensions: readonly ContainerTransportExtension[], env: Readonly<Record<string, string | undefined>>): ReadonlyMap<string, ContainerInstance>;
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region src/control/deploy.d.ts
|
|
73
|
+
/** The Layer shape every Alchemy state store must satisfy — what `LowerOptions.state` and `PrismaAppConfig.state` both traffic in. */
|
|
74
|
+
type AlchemyStateLayer = Layer.Layer<State, never, StackServices>;
|
|
75
|
+
/**
|
|
76
|
+
* An extension's application-level descriptor: shared infrastructure that runs
|
|
77
|
+
* once per lowering, before any node. Its outputs reach the extension's own
|
|
78
|
+
* SPI calls via LowerContext.application.
|
|
79
|
+
*/
|
|
80
|
+
interface ApplicationDescriptor {
|
|
81
|
+
provision(ctx: LowerContext): Effect.Effect<unknown, unknown, unknown>;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* One provisioned param need, resolved against the CONSUMER extension's
|
|
85
|
+
* `provisions` registry (ADR-0031). `edgeId` — `${consumerAddress}.${input}`
|
|
86
|
+
* — is the mint's stable resource key, so a provisioner's own resource ids
|
|
87
|
+
* derive from it and stay stable across redeploys.
|
|
88
|
+
*/
|
|
89
|
+
interface ProvisionEdge {
|
|
90
|
+
readonly edgeId: string;
|
|
91
|
+
readonly consumerAddress: string;
|
|
92
|
+
readonly providerAddress: string;
|
|
93
|
+
readonly input: string;
|
|
94
|
+
/** Opaque; forwarded from the param's declared need. Core never reads its payload. */
|
|
95
|
+
readonly need: ProvisionNeed;
|
|
96
|
+
}
|
|
97
|
+
/** One extension-registered provisioner, keyed by a need's brand (ADR-0031). */
|
|
98
|
+
interface ProvisionerDescriptor {
|
|
99
|
+
/** Mints one stable value for one provisioned edge; yields the platform resource, returns an opaque ref core forwards into config. */
|
|
100
|
+
provision(edge: ProvisionEdge): Effect.Effect<unknown, unknown, unknown>;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* The phased service SPI. `P` and `S` are the descriptor's OWN intra-node
|
|
104
|
+
* handoff types — provision's product consumed by serialize/deploy, and
|
|
105
|
+
* serialize's product consumed by deploy. Core threads them through without
|
|
106
|
+
* inspection; only the descriptor that writes them reads them.
|
|
107
|
+
*
|
|
108
|
+
* Method syntax (not property-arrow) is required: the heterogeneous
|
|
109
|
+
* descriptor registry (`NodeDescriptor`) assigns concrete descriptors to
|
|
110
|
+
* this interface's `unknown` defaults through TypeScript's method
|
|
111
|
+
* bivariance — a property-arrow form is checked contravariantly and breaks
|
|
112
|
+
* that assignment.
|
|
113
|
+
*/
|
|
114
|
+
interface ServiceLowering<P = unknown, S = unknown> {
|
|
115
|
+
/** Makes the platform-specific thing that will host the service — identity-bearing infrastructure only, no code runs. */
|
|
116
|
+
provision(ctx: LowerContext): Effect.Effect<P, unknown, unknown>;
|
|
117
|
+
/**
|
|
118
|
+
* Encodes the typed Config into the service's runtime environment. Boot-side
|
|
119
|
+
* deserialize reverses it through the same serializer. Returns the env-var
|
|
120
|
+
* records so `deploy` can reference them.
|
|
121
|
+
*/
|
|
122
|
+
serialize(ctx: LowerContext, provisioned: P, config: Config): Effect.Effect<S, unknown, unknown>;
|
|
123
|
+
/**
|
|
124
|
+
* Prints the bootstrap and assembles the deployable artifact from the
|
|
125
|
+
* app-built bundle. Must be byte-deterministic: an unchanged service noops
|
|
126
|
+
* on redeploy.
|
|
127
|
+
*/
|
|
128
|
+
package(ctx: LowerContext, input: PackageInput): Effect.Effect<Artifact, unknown, unknown>;
|
|
129
|
+
/** 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. */
|
|
130
|
+
deploy(ctx: LowerContext, provisioned: P, artifact: Artifact, serialized: S): Effect.Effect<LoweredResult, unknown, unknown>;
|
|
131
|
+
}
|
|
132
|
+
/** Input to an extension's package() step: the built bundle and the node's graph address. */
|
|
133
|
+
interface PackageInput {
|
|
134
|
+
/** The build descriptor's normalized output: the bundle dir + the app's runnable. */
|
|
135
|
+
readonly assembled: Bundle;
|
|
136
|
+
/** The node's graph address — baked into the printed bootstrap. */
|
|
137
|
+
readonly address: string;
|
|
138
|
+
}
|
|
139
|
+
/** One node's realization. Runs inside the Alchemy stack effect. */
|
|
140
|
+
type Lowering = (ctx: LowerContext) => Effect.Effect<LoweredResult, unknown, unknown>;
|
|
141
|
+
interface LowerContext {
|
|
142
|
+
readonly id: NodeId;
|
|
143
|
+
/**
|
|
144
|
+
* The node's deployment address: its full, dot-joined hierarchical
|
|
145
|
+
* position in the graph (e.g. "auth.api"). The config-key namespace and
|
|
146
|
+
* the bootstrap parameter.
|
|
147
|
+
*/
|
|
148
|
+
readonly address: string;
|
|
149
|
+
readonly node: ServiceNode | ResourceNode;
|
|
150
|
+
readonly graph: Graph;
|
|
151
|
+
readonly opts: LowerOptions;
|
|
152
|
+
/**
|
|
153
|
+
* The owning extension's application hook product; `undefined` when the
|
|
154
|
+
* extension declares no hook. Core never reads it; the extension narrows
|
|
155
|
+
* it with its own type guard.
|
|
156
|
+
*/
|
|
157
|
+
readonly application: unknown;
|
|
158
|
+
/**
|
|
159
|
+
* The owning extension's resolved container, deserialized from the
|
|
160
|
+
* framework transport; core never reads it — the extension narrows it
|
|
161
|
+
* with its own type guard. `undefined` when the extension declares no
|
|
162
|
+
* container descriptor.
|
|
163
|
+
*/
|
|
164
|
+
readonly container: ContainerInstance | undefined;
|
|
165
|
+
/** Already-lowered deps (topo order). */
|
|
166
|
+
readonly lowered: ReadonlyMap<NodeId, Outputs>;
|
|
167
|
+
/** Every provisioned param value minted this lowering, keyed by edge id (ADR-0031). */
|
|
168
|
+
readonly provisioned: ReadonlyMap<string, unknown>;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* The values a node provides to its dependents — what a consumer's declared
|
|
172
|
+
* connection params resolve against (buildConfig reads them by param name).
|
|
173
|
+
* Name-keyed and unknown-valued of necessity: core cannot know extension
|
|
174
|
+
* types, and which producer feeds which consumer is decided by the user's
|
|
175
|
+
* graph at runtime. The connection declaration is the contract.
|
|
176
|
+
*/
|
|
177
|
+
type Outputs = Readonly<Record<string, unknown>>;
|
|
178
|
+
/**
|
|
179
|
+
* One thing a node became on the deployment target, RESOLVED — what the report
|
|
180
|
+
* consumer sees. The descriptor names it; core never infers meaning from it.
|
|
181
|
+
* `url` is present ONLY when the descriptor declares the address publicly
|
|
182
|
+
* reachable — a connection string is never a `url`.
|
|
183
|
+
*
|
|
184
|
+
* A descriptor constructing one holds `svc.id` / `deployment.deployedUrl` —
|
|
185
|
+
* `Output<T>` references, not values, because the stack effect runs before
|
|
186
|
+
* Alchemy applies anything. So construction sites traffic in
|
|
187
|
+
* `Input<DeployedEntity>` (Alchemy's own idiom for "this shape, fields possibly
|
|
188
|
+
* unresolved"); apply resolves it before any reader sees it.
|
|
189
|
+
*/
|
|
190
|
+
interface DeployedEntity {
|
|
191
|
+
readonly kind: string;
|
|
192
|
+
readonly id: string;
|
|
193
|
+
readonly url?: string;
|
|
194
|
+
readonly details?: Readonly<Record<string, string>>;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* What a node's final lowering phase produces: outputs for dependents,
|
|
198
|
+
* entities for reporting.
|
|
199
|
+
*
|
|
200
|
+
* `entities` is REQUIRED, not optional. "This node became nothing reportable
|
|
201
|
+
* on the deployment target" is a claim, and an optional field lets a
|
|
202
|
+
* descriptor make it by saying nothing at all — no error, no type complaint,
|
|
203
|
+
* no failing test. That is the shared bag's sin in miniature (ADR-0033): a
|
|
204
|
+
* claim made anonymously, with nothing recording that a claim was made. `[]`
|
|
205
|
+
* costs one token and puts the assertion on the record where a reviewer can
|
|
206
|
+
* see it.
|
|
207
|
+
*/
|
|
208
|
+
interface LoweredResult {
|
|
209
|
+
readonly outputs: Outputs;
|
|
210
|
+
readonly entities: readonly Input<DeployedEntity>[];
|
|
211
|
+
}
|
|
212
|
+
/** What one graph node became — in-process only (it holds the node itself, so it never crosses the stack boundary). */
|
|
213
|
+
interface DeployedNode {
|
|
214
|
+
readonly address: string;
|
|
215
|
+
readonly node: ServiceNode | ResourceNode;
|
|
216
|
+
readonly entities: readonly DeployedEntity[];
|
|
217
|
+
}
|
|
218
|
+
/** The result of the Deploy operation: the app and every node it deployed, in topo order. */
|
|
219
|
+
interface DeploymentResult {
|
|
220
|
+
readonly app: string;
|
|
221
|
+
readonly nodes: readonly DeployedNode[];
|
|
222
|
+
}
|
|
223
|
+
interface LowerOptions {
|
|
224
|
+
/** Stack + root node id. */
|
|
225
|
+
readonly name: string;
|
|
226
|
+
readonly bundles: Record<string, Bundle>;
|
|
227
|
+
readonly stage?: string;
|
|
228
|
+
/** Alchemy state store for the stack. Defaults to the config's own state layer. */
|
|
229
|
+
readonly state?: AlchemyStateLayer;
|
|
230
|
+
/**
|
|
231
|
+
* Invoked once per deploy, during apply, with the Deploy operation's result
|
|
232
|
+
* — the app and every node it deployed, resolved, in topo order.
|
|
233
|
+
* Presentation belongs to the caller (the CLI wires its renderer here);
|
|
234
|
+
* core never formats. Absent means no report is assembled and no Action is
|
|
235
|
+
* declared at all.
|
|
236
|
+
*/
|
|
237
|
+
readonly report?: (result: DeploymentResult) => void;
|
|
238
|
+
}
|
|
239
|
+
/** A build descriptor's normalized output: the produced bundle dir plus the app's runnable entry within it. */
|
|
240
|
+
interface Bundle {
|
|
241
|
+
readonly dir: string;
|
|
242
|
+
readonly entry: string;
|
|
243
|
+
}
|
|
244
|
+
/** Shared input shape for every extension's build descriptor. */
|
|
245
|
+
interface AssembleInput {
|
|
246
|
+
readonly build: BuildAdapter;
|
|
247
|
+
/** The service's graph address (e.g. "storefront.web"). Unique per service, so the assembler uses it to name this service's own working directory: `<cwd>/.prisma-composer/artifacts/<address>/`. */
|
|
248
|
+
readonly address: string;
|
|
249
|
+
/** The directory the deploy command was run from. The assembler puts its working directory under it (`<cwd>/.prisma-composer/`), the same place the CLI writes its other generated files. */
|
|
250
|
+
readonly cwd: string;
|
|
251
|
+
}
|
|
252
|
+
/** package()'s product. */
|
|
253
|
+
interface Artifact {
|
|
254
|
+
readonly path: string;
|
|
255
|
+
readonly sha256: string;
|
|
256
|
+
}
|
|
257
|
+
declare class LowerError extends Error {
|
|
258
|
+
constructor(message: string);
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Assembles a service's typed Config. Connection params come from the
|
|
262
|
+
* dependency edge's lowered outputs — or, for a param carrying a `provision`
|
|
263
|
+
* need (ADR-0031), from `provisioned` (keyed by edge id): the framework mints
|
|
264
|
+
* it, the producer hands nothing over. The service's own params resolve via
|
|
265
|
+
* `resolveParam` (provision-time binding, then default, then loud
|
|
266
|
+
* unbound-required failure).
|
|
267
|
+
*
|
|
268
|
+
* This is also where the connection contract is enforced: a producer that fails to
|
|
269
|
+
* supply a required param its consumer's connection declares fails the deploy
|
|
270
|
+
* here, naming the edge, rather than reaching the consumer as `undefined`.
|
|
271
|
+
*/
|
|
272
|
+
declare function buildConfig(node: ServiceNode, id: NodeId, graph: Graph, lowered: ReadonlyMap<NodeId, Outputs>, provisioned: ReadonlyMap<string, unknown>): Config;
|
|
273
|
+
/**
|
|
274
|
+
* Joins resolved report entries back to their graph nodes — the last step of a
|
|
275
|
+
* deploy report, run inside the Action with apply's resolved values.
|
|
276
|
+
*
|
|
277
|
+
* The entries cross Alchemy's action-input boundary, so they carry addresses
|
|
278
|
+
* and plain entities only; the graph is held by closure on this side. That
|
|
279
|
+
* split is why this join exists at all, and it is what keeps functions and
|
|
280
|
+
* Standard Schemas (which a node carries, and which the plan's input hash
|
|
281
|
+
* would have to serialize) out of the input.
|
|
282
|
+
*
|
|
283
|
+
* Skips an address the graph no longer holds: entries are data, the graph is
|
|
284
|
+
* truth.
|
|
285
|
+
*/
|
|
286
|
+
declare function joinDeployment(graph: Graph, entries: readonly {
|
|
287
|
+
address: string;
|
|
288
|
+
entities: readonly DeployedEntity[];
|
|
289
|
+
}[]): readonly DeployedNode[];
|
|
290
|
+
/**
|
|
291
|
+
* The state-layer precedence a deploy resolves to: an explicit opts.state
|
|
292
|
+
* always wins; failing that, the config's own (required) state descriptor,
|
|
293
|
+
* created with its owning extension's resolved container (`undefined` when
|
|
294
|
+
* that extension declared none). A pure function so the precedence is
|
|
295
|
+
* testable without booting Alchemy.
|
|
296
|
+
*/
|
|
297
|
+
declare function resolveStateLayer(opts: LowerOptions, config: PrismaAppConfig, containers: ReadonlyMap<string, ContainerInstance>): AlchemyStateLayer;
|
|
298
|
+
/**
|
|
299
|
+
* All configured extensions' providers merged, config array order — an
|
|
300
|
+
* extension without `providers` is skipped; no used-extensions-only
|
|
301
|
+
* filtering (ADR-0017's pinned providers rule).
|
|
302
|
+
*/
|
|
303
|
+
declare function mergedProviders(config: PrismaAppConfig): Layer.Layer<never>;
|
|
304
|
+
/**
|
|
305
|
+
* Composable form for mixed stacks: hand-wired Alchemy resources alongside Prisma App nodes in one stack effect.
|
|
306
|
+
* Fails with LowerError or whatever an extension's lowering raises — the error type is open.
|
|
307
|
+
*/
|
|
308
|
+
declare function lowering(root: ModuleNode, config: PrismaAppConfig, opts: LowerOptions): Effect.Effect<undefined, LowerError, unknown>;
|
|
309
|
+
/**
|
|
310
|
+
* The whole-stack wrapper: Load → route each node through the config's
|
|
311
|
+
* extension registries → an Alchemy Stack (the default export the alchemy
|
|
312
|
+
* CLI consumes).
|
|
313
|
+
*/
|
|
314
|
+
declare function lower(root: ModuleNode, config: PrismaAppConfig, opts: LowerOptions): Effect.Effect<Alchemy.CompiledStack<undefined, any>, import("effect/Config").ConfigError, never>;
|
|
315
|
+
//#endregion
|
|
316
|
+
//#region src/control/app-config.d.ts
|
|
317
|
+
/**
|
|
318
|
+
* One extension's control-plane registry: everything the deploy pipeline may
|
|
319
|
+
* look up for a node whose `extension` field names this package. `nodes` is
|
|
320
|
+
* keyed by the node's within-extension ID (`node.type` / `build.type`).
|
|
321
|
+
*/
|
|
322
|
+
interface ExtensionDescriptor {
|
|
323
|
+
/** The extension's package name, e.g. "@prisma/composer-prisma-cloud" — what a node's `extension` field is matched against. */
|
|
324
|
+
readonly id: string;
|
|
325
|
+
/** ONE registry per extension, keyed by node ID. */
|
|
326
|
+
readonly nodes: Record<string, NodeDescriptor>;
|
|
327
|
+
/** Param provisioners this extension supplies, keyed by need brand (ADR-0031). Core resolves a param's ProvisionNeed against the CONSUMER extension's map. */
|
|
328
|
+
readonly provisions?: ReadonlyMap<symbol, ProvisionerDescriptor>;
|
|
329
|
+
/** Once-per-lowering hook — the application's shared infrastructure (e.g. prisma-cloud's Project). */
|
|
330
|
+
readonly application?: ApplicationDescriptor;
|
|
331
|
+
/** The extension's Alchemy providers — merged across all configured extensions (config order). */
|
|
332
|
+
readonly providers?: () => Layer.Layer<never>;
|
|
333
|
+
/**
|
|
334
|
+
* Deploy-time prerequisite check — the CLI runs it once, after the app's
|
|
335
|
+
* Project/Branch are resolved and BEFORE any stack file is written or Alchemy
|
|
336
|
+
* runs. A target uses it to verify platform prerequisites (e.g. that every
|
|
337
|
+
* secret env var in the provision manifest exists for the resolved stage) and
|
|
338
|
+
* throws to abort the deploy. Async: it talks to the platform (ADR-0029).
|
|
339
|
+
*/
|
|
340
|
+
readonly preflight?: (input: PreflightInput) => Promise<void>;
|
|
341
|
+
/**
|
|
342
|
+
* Destroy-time cleanup — the CLI runs it once, after `alchemy destroy`
|
|
343
|
+
* succeeds and BEFORE the stage's Project/Branch are removed. A target uses
|
|
344
|
+
* it to remove infrastructure it owns outside the stack (e.g. the deploy
|
|
345
|
+
* state store, which the destroy above was still reading). Throwing aborts
|
|
346
|
+
* the destroy before the containers go; a target that would rather warn than
|
|
347
|
+
* fail the command handles that itself. Async: it talks to the platform.
|
|
348
|
+
*/
|
|
349
|
+
readonly teardown?: (input: TeardownInput) => Promise<void>;
|
|
350
|
+
/**
|
|
351
|
+
* The extension's container lifecycle, when its platform has containers
|
|
352
|
+
* (ADR-0038). The CLI resolves containers after assembly and before any
|
|
353
|
+
* stack file or Alchemy run (deploy ensures, destroy locates); the
|
|
354
|
+
* resolved instance reaches the alchemy process through the env transport
|
|
355
|
+
* in container-transport.ts.
|
|
356
|
+
*/
|
|
357
|
+
readonly container?: ContainerDescriptor;
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* The deploy's one state store. It names its owning extension so core knows
|
|
361
|
+
* whose resolved container to pass into `create` (ADR-0038).
|
|
362
|
+
*/
|
|
363
|
+
interface StateDescriptor {
|
|
364
|
+
/** The owning extension's id — matched against `ExtensionDescriptor.id`. */
|
|
365
|
+
readonly extension: string;
|
|
366
|
+
/** Build the state layer. `container` is the owning extension's resolved instance; `undefined` when it declared no container descriptor. */
|
|
367
|
+
create(container: ContainerInstance | undefined): AlchemyStateLayer;
|
|
368
|
+
}
|
|
369
|
+
/** The resolved deploy context handed to an extension's `preflight` hook. */
|
|
370
|
+
interface PreflightInput {
|
|
371
|
+
/** The loaded application graph — the manifest of prerequisites is read from it (`provisionManifest`). */
|
|
372
|
+
readonly graph: Graph;
|
|
373
|
+
/** The calling extension's own resolved container; `undefined` when it declares no container descriptor. Narrow with the extension's guard. */
|
|
374
|
+
readonly container: ContainerInstance | undefined;
|
|
375
|
+
/** The stage name (`--stage`), or `undefined` for the default stage — for diagnostics/scope. */
|
|
376
|
+
readonly stage: string | undefined;
|
|
377
|
+
}
|
|
378
|
+
/** The resolved destroy context handed to an extension's `teardown` hook. */
|
|
379
|
+
interface TeardownInput {
|
|
380
|
+
/** The calling extension's own resolved container; `undefined` when it declares no container descriptor. Narrow with the extension's guard. */
|
|
381
|
+
readonly container: ContainerInstance | undefined;
|
|
382
|
+
/** The stage name (`--stage`), or `undefined` for the default stage — for diagnostics/scope. */
|
|
383
|
+
readonly stage: string | undefined;
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* What one registry entry can do. The `kind` discriminant is checked at every
|
|
387
|
+
* lookup site against what the site needs — a resource node looked up against
|
|
388
|
+
* a `service` descriptor is an error naming (extension, type, expected kind).
|
|
389
|
+
*/
|
|
390
|
+
type NodeDescriptor = ({
|
|
391
|
+
readonly kind: 'resource';
|
|
392
|
+
} & Lowering) | ({
|
|
393
|
+
readonly kind: 'service';
|
|
394
|
+
} & ServiceLowering) | {
|
|
395
|
+
readonly kind: 'build';
|
|
396
|
+
assemble(input: AssembleInput): Promise<Bundle>;
|
|
397
|
+
};
|
|
398
|
+
/**
|
|
399
|
+
* The config file's default export. `extensions` lists every extension the
|
|
400
|
+
* app deploys through; `state` is the ONE state store per deploy — explicit,
|
|
401
|
+
* platform-agnostic, never defaulted by an extension.
|
|
402
|
+
*/
|
|
403
|
+
interface PrismaAppConfig {
|
|
404
|
+
readonly extensions: ExtensionDescriptor[];
|
|
405
|
+
readonly state: StateDescriptor;
|
|
406
|
+
}
|
|
407
|
+
/** Typed identity — exists so `prisma-composer.config.ts` gets checked against PrismaAppConfig where it is written. */
|
|
408
|
+
declare function defineConfig(config: PrismaAppConfig): PrismaAppConfig;
|
|
409
|
+
//#endregion
|
|
410
|
+
export { containerEnvVarName as A, ProvisionEdge as C, TeardownInput as D, StateDescriptor as E, lowering as F, mergedProviders as I, resolveStateLayer as L, deserializeContainers as M, joinDeployment as N, buildConfig as O, lower as P, PrismaAppConfig as S, ServiceLowering as T, Lowering as _, Bundle as a, PackageInput as b, DeployedEntity as c, ExtensionDescriptor as d, LocateContainerInput as f, LoweredResult as g, LowerOptions as h, AssembleInput as i, defineConfig as j, containerEnv as k, DeployedNode as l, LowerError as m, ApplicationDescriptor as n, ContainerDescriptor as o, LowerContext as p, Artifact as r, ContainerInstance as s, AlchemyStateLayer as t, DeploymentResult as u, NodeDescriptor as v, ProvisionerDescriptor as w, PreflightInput as x, Outputs as y };
|
|
411
|
+
//# sourceMappingURL=app-config-BPb3LCdH-CH7b8Khi.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-config-BPb3LCdH-CH7b8Khi.d.mts","names":[],"sources":["../../../0-framework/1-core/core/dist/app-config-BPb3LCdH.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;UAmBU;;WAEC;;WAEA;;;;;;;UAOD;WACC,OAAO;;EAEhB;;;;;;;;;;;;UAYQ,oBAAoB,UAAU,oBAAoB;;EAE1D,OAAO,OAAO,uBAAuB,QAAQ;;EAE7C,OAAO,OAAO,uBAAuB,QAAQ;;EAE7C,OAAO,UAAU,IAAI;;EAErB,YAAY,qBAAqB;;;iBAGlB,oBAAoB;;iBAEpB,aAAa,WAAW,oBAAoB,qBAAqB;;UAExE;WACC;WACA,YAAY;;;;;;iBAMN,sBAAsB,qBAAqB,+BAA+B,KAAK,SAAS,sCAAsC,oBAAoB;;;;KAI9J,oBAAoB,MAAM,MAAM,cAAc;;;;;;UAMzC;EACR,UAAU,KAAK,eAAe,OAAO;;;;;;;;UAQ7B;WACC;WACA;WACA;WACA;;WAEA,MAAM;;;UAGP;;EAER,UAAU,MAAM,gBAAgB,OAAO;;;;;;;;;;;;;;UAc/B,gBAAgB,aAAa;;EAErC,UAAU,KAAK,eAAe,OAAO,OAAO;;;;;;EAM5C,UAAU,KAAK,cAAc,aAAa,GAAG,QAAQ,SAAS,OAAO,OAAO;;;;;;EAM5E,QAAQ,KAAK,cAAc,OAAO,eAAe,OAAO,OAAO;;EAE/D,OAAO,KAAK,cAAc,aAAa,GAAG,UAAU,UAAU,YAAY,IAAI,OAAO,OAAO;;;UAGpF;;WAEC,WAAW;;WAEX;;;KAGN,YAAY,KAAK,iBAAiB,OAAO,OAAO;UAC3C;WACC,IAAI;;;;;;WAMJ;WACA,MAAM,cAAc;WACpB,OAAO;WACP,MAAM;;;;;;WAMN;;;;;;;WAOA,WAAW;;WAEX,SAAS,YAAY,QAAQ;;WAE7B,aAAa;;;;;;;;;KASnB,UAAU,SAAS;;;;;;;;;;;;;UAad;WACC;WACA;WACA;WACA,UAAU,SAAS;;;;;;;;;;;;;;UAcpB;WACC,SAAS;WACT,mBAAmB,MAAM;;;UAG1B;WACC;WACA,MAAM,cAAc;WACpB,mBAAmB;;;UAGpB;WACC;WACA,gBAAgB;;UAEjB;;WAEC;WACA,SAAS,eAAe;WACxB;;WAEA,QAAQ;;;;;;;;WAQR,UAAU,QAAQ;;;UAGnB;WACC;WACA;;;UAGD;WACC,OAAO;;WAEP;;WAEA;;;UAGD;WACC;WACA;;cAEG,mBAAmB;EAC/B,YAAY;;;;;;;;;;;;;;iBAcG,YAAY,MAAM,aAAa,IAAI,QAAQ,OAAO,OAAO,SAAS,YAAY,QAAQ,UAAU,aAAa,+BAA+B;;;;;;;;;;;;;;iBAc5I,eAAe,OAAO,OAAO;EAC5C;EACA,mBAAmB;eACN;;;;;;;;iBAQE,kBAAkB,MAAM,cAAc,QAAQ,iBAAiB,YAAY,oBAAoB,qBAAqB;;;;;;iBAMpH,gBAAgB,QAAQ,kBAAkB,MAAM;;;;;iBAKhD,SAAS,MAAM,YAAY,QAAQ,iBAAiB,MAAM,eAAe,OAAO,kBAAkB;;;;;;iBAMlG,MAAM,MAAM,YAAY,QAAQ,iBAAiB,MAAM,eAAe,OAAO,OAAO,QAAQ,uDAAuD;;;;;;;;UAQ1J;;WAEC;;WAEA,OAAO,eAAe;;WAEtB,aAAa,oBAAoB;;WAEjC,cAAc;;WAEd,kBAAkB,MAAM;;;;;;;;WAQxB,aAAa,OAAO,mBAAmB;;;;;;;;;WASvC,YAAY,OAAO,kBAAkB;;;;;;;;WAQrC,YAAY;;;;;;UAMb;;WAEC;;EAET,OAAO,WAAW,gCAAgC;;;UAG1C;;WAEC,OAAO;;WAEP,WAAW;;WAEX;;;UAGD;;WAEC,WAAW;;WAEX;;;;;;;KAON;WACM;IACP;WACO;IACP;WACO;EACT,SAAS,OAAO,gBAAgB,QAAQ;;;;;;;UAOhC;WACC,YAAY;WACZ,OAAO;;;iBAGD,aAAa,QAAQ,kBAAkB"}
|
package/dist/assertions.d.mts
CHANGED
|
@@ -25,7 +25,7 @@ declare function assertDefined<T>(value: T | null | undefined, message: string):
|
|
|
25
25
|
* invariant(edges.length > 0, 'A wired module must have at least one connection');
|
|
26
26
|
* ```
|
|
27
27
|
*/
|
|
28
|
-
declare function invariant(condition: boolean, message: string): asserts condition;
|
|
28
|
+
declare function invariant(condition: boolean, message: string): asserts condition;
|
|
29
29
|
//#endregion
|
|
30
30
|
export { assertDefined, invariant };
|
|
31
31
|
//# sourceMappingURL=assertions.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertions.d.mts","names":[],"sources":["../../../0-framework/0-foundation/foundation/dist/assertions.d.mts"],"mappings":";;;;;;;;;;;;;;;iBAciB,cAAc,GAAG,OAAO,sBAAsB,0BAA0B,SAAS;;;;;;;;;;;;iBAYjF,UAAU,oBAAoB,0BAA0B"}
|