graphddb 0.7.0 → 0.7.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.
@@ -1,5 +1,291 @@
1
- import { x as ParamDescriptor, y as EntityRef, z as ConditionInput, A as Param, M as ModelStatic, w as DDBModel, Q as QueryModelContract, G as QueryMethodSpec, H as CommandModelContract, I as CommandMethodSpec, J as ContractSpec, K as QuerySpec, L as CommandSpec, N as TransactionSpec, O as ContextSpec, X as DefinitionMap, Y as OperationsDocument, Z as AnyOperationDefinition, _ as Manifest, $ as BridgeBundle, a0 as ConditionSpec } from './maintenance-view-adapter-BP2CJDdz.js';
2
- import { M as MetadataRegistry } from './registry-Cv9nl_3i.js';
1
+ import { Q as QueryModelContract, x as QueryMethodSpec, y as CommandModelContract, z as CommandMethodSpec, A as ContractSpec, G as QuerySpec, H as CommandSpec, I as TransactionSpec, J as ContextSpec, K as SPEC_VERSION, L as ParamSpec, N as PreparedBody, m as EntityMetadata, O as ParamDescriptor, X as EntityRef, Y as ConditionInput, Z as Param, M as ModelStatic, w as DDBModel, _ as DefinitionMap, $ as OperationsDocument, a0 as AnyOperationDefinition, a1 as Manifest, a2 as BridgeBundle, a3 as ConditionSpec } from './maintenance-view-adapter-NBTZbE8-.js';
2
+ import { M as MetadataRegistry } from './registry-BndKbZbg.js';
3
+
4
+ /**
5
+ * Contract-layer serialization (issue #59, CQRS Contract layer, Epic #57;
6
+ * spec `docs/cqrs-contract.md`, "SSoT Schema").
7
+ *
8
+ * The Contract IR (#58, `src/define/contract.ts`) holds, per contract method, a
9
+ * resolved declarative {@link ContractMethodOp} plus the **decided facts** the
10
+ * planner derived (`resolution` / `inputArity` / `result`). This module
11
+ * **serializes** those facts into the JSON SSoT — it does **not** re-derive them:
12
+ *
13
+ * - The `contracts` map (contract name → {@link ContractSpec}) is layered **on
14
+ * top of** the existing `queries` / `commands` / `transactions`. Each method
15
+ * references one of them by name (`ContractName__methodName`), so the existing
16
+ * operation-spec shapes are unchanged and the current runtime keeps working.
17
+ * - The referenced operation spec is produced by **reusing** the proven
18
+ * {@link buildQuerySpec} / {@link buildCommandSpec} planners: a
19
+ * {@link ContractMethodOp} is translated back into the {@link AnyOperationDefinition}
20
+ * shape those planners consume (the contract's sentinel references become the
21
+ * `Param` placeholders the planner already understands), so the symbolic key
22
+ * evaluation, projection, relation chaining, and condition handling are shared
23
+ * — never re-implemented, never drifting.
24
+ *
25
+ * Everything emitted is **JSON-serializable** by construction (only strings /
26
+ * numbers / booleans / arrays / plain objects). A contract-free input emits no
27
+ * `contracts` / `contexts` keys, so the pre-#59 operations document is reproduced
28
+ * byte-for-byte (backward compatibility).
29
+ *
30
+ * ## What this issue serializes vs. defers
31
+ *
32
+ * The #58 IR captures a single declarative op per method with a boolean `select`
33
+ * projection; it does **not** model External Query / Query Composition (no
34
+ * `query(Contract.method, { from(...) })` primitive exists yet). So no #58
35
+ * contract produces a `compose`. The serializer nonetheless **supports** it: when
36
+ * a method op carries composition (a forward-compatible {@link ContractMethodOp}
37
+ * extension), it is emitted per the proposal's `compose` shape. The N+1 checker
38
+ * (#60), boundary lint (#61), and runtime execution (#62) are out of scope here —
39
+ * this is serialization + generator only.
40
+ */
41
+
42
+ /**
43
+ * A contract as accepted by the serializer: either a resolved
44
+ * {@link QueryModelContract} or a {@link CommandModelContract} (the #58 factory
45
+ * output). The Key type is erased — the serializer reads the key **fields** off
46
+ * the resolved op / model metadata, not the phantom type.
47
+ */
48
+ type AnyModelContract = QueryModelContract<unknown, Record<string, QueryMethodSpec<unknown, unknown, unknown>>> | CommandModelContract<unknown, Record<string, CommandMethodSpec<unknown, unknown, unknown>>>;
49
+ /** A map of contract name → resolved contract IR (as passed to the generator). */
50
+ type ContractMap = Record<string, AnyModelContract>;
51
+ /**
52
+ * A context-ownership declaration as authored by the producer: context name →
53
+ * the Model (entity) and Contract names that belong to it. The serializer sorts
54
+ * the member lists deterministically; see {@link ContextSpec}.
55
+ */
56
+ interface ContextOwnership {
57
+ readonly models?: readonly string[];
58
+ readonly contracts?: readonly string[];
59
+ }
60
+ /** A map of context name → its membership (as passed to the generator). */
61
+ type ContextOwnershipMap = Record<string, ContextOwnership>;
62
+ /**
63
+ * The output of {@link buildContracts}: the `contracts` map and the
64
+ * **synthesized** operation specs each method references. The caller merges the
65
+ * synthesized `queries` / `commands` / `transactions` into the document's
66
+ * existing maps (a contract method's referenced op lives alongside hand-written
67
+ * definitions, addressed by name).
68
+ */
69
+ interface BuiltContracts {
70
+ readonly contracts: Record<string, ContractSpec>;
71
+ /** Synthesized read ops referenced by query contract methods. */
72
+ readonly queries: Record<string, QuerySpec>;
73
+ /** Synthesized write ops referenced by command contract methods (single form). */
74
+ readonly commands: Record<string, CommandSpec>;
75
+ /**
76
+ * Synthesized transactions referenced by command contract methods whose array
77
+ * form resolves to a `'transact'` batched write (issue #64). One transaction per
78
+ * such method, named `<Contract>__<method>__batch`: a single `forEach`-over-keys
79
+ * write item that the runtime expands once per key (≤25, atomic), reusing the
80
+ * proven declarative-transaction machinery (#46). Empty when no command method
81
+ * declares a `'transact'` batch.
82
+ */
83
+ readonly transactions: Record<string, TransactionSpec>;
84
+ }
85
+ /**
86
+ * The derived-effect family of one serialized prepared-write transaction item
87
+ * (issue #208). Index-aligned to `TransactionSpec.items`; the AOT loader groups
88
+ * rendered items by category ACROSS the plan's ops so the composed
89
+ * `TransactWriteItems` matches the in-process execution core's order
90
+ * (writes, then all edges, then all derived updates, …) byte-for-byte.
91
+ */
92
+ type PreparedWriteItemCategory = 'base' | 'edge' | 'derive' | 'unique' | 'outbox' | 'idempotency' | 'maintain' | 'maintainOutbox' | 'check';
93
+ /**
94
+ * Serialize a map of resolved contracts into the `contracts` SSoT map plus the
95
+ * synthesized operation specs each method references. Deterministic: contracts
96
+ * and methods are emitted in sorted-key order.
97
+ *
98
+ * @param contracts Contract name → resolved {@link QueryModelContract} /
99
+ * {@link CommandModelContract} (the #58 factory output). Empty → empty output.
100
+ * @throws if a contract method op cannot be serialized (a non-boolean projection
101
+ * slot, an unsupported write condition); or if a contract violates an N+1
102
+ * safety rule (#60, {@link assertContractN1Safe}) — an array into a `range`
103
+ * method, a "list under a list", or a `range` composed child.
104
+ */
105
+ declare function buildContracts(contracts?: ContractMap): BuiltContracts;
106
+ /**
107
+ * Serialize the context-ownership declarations into the SSoT `contexts` map.
108
+ * Member lists are sorted for determinism. An empty input yields an empty map
109
+ * (the caller then omits the key for backward compatibility).
110
+ */
111
+ declare function buildContexts(contexts?: ContextOwnershipMap): Record<string, ContextSpec>;
112
+
113
+ /**
114
+ * Static prepared-plan artifact — the **build-time** (AOT) compilation of
115
+ * `DDBModel.prepare` bodies (issue #208; design #203 phase 4, on top of the #205
116
+ * runtime and the #206 compile-time hoist).
117
+ *
118
+ * `graphddb transform prepared --aot` evaluates each no-capture-verified prepare
119
+ * body at BUILD time (the #206 lint proves build-time evaluability) and this
120
+ * module compiles the evaluated routes into a JSON-serializable
121
+ * {@link PreparedPlanDocument}:
122
+ *
123
+ * - a **write** plan runs the SAME mutation compiler the runtime `prepare` uses
124
+ * (`compileWriteFragment` → lifecycle resolution → derived-effect derivation)
125
+ * and serializes the result through the SAME contract-SSoT path a
126
+ * `.plan(mutation)` command method uses
127
+ * ({@link serializePreparedWriteFragment} → one declarative
128
+ * {@link TransactionSpec} per op: base write + edges / counters / uniqueness
129
+ * guards / outbox / idempotency / maintenance / ConditionChecks) — so the
130
+ * runtime never invokes the mutation compiler again, **including the first
131
+ * call** (the #206 audit's cold-start gap);
132
+ * - a **read** plan serializes the analyzed route products (entity name, select
133
+ * template, per-field param binds, static/dynamic options) plus the
134
+ * {@link QuerySpec} the spec planner derives for it — the same
135
+ * `operations.json` vocabulary the Python runtime consumes (templated
136
+ * `{param}` key conditions, physical ops, execution plan), so a broken read
137
+ * plan fails the BUILD, not the first request.
138
+ *
139
+ * ## Model references are entity NAMES
140
+ *
141
+ * The artifact never carries a class: each plan records the entity names it
142
+ * touches plus a **fingerprint** of each entity's canonical manifest entry
143
+ * ({@link entityFingerprint}). The TS loader (`src/runtime/prepared-loader.ts`)
144
+ * re-binds names against the live {@link MetadataRegistry} and recomputes the
145
+ * fingerprints — a mismatch (model declaration / TableMapping drift since the
146
+ * artifact was generated) is a LOUD reject, never a stale-plan execution.
147
+ *
148
+ * Everything emitted is JSON-serializable by construction (the #206 no-capture
149
+ * lint guarantees the body's templates are static data; the only non-JSON
150
+ * scalars a template may carry — `Date` / `bigint` literals — are encoded
151
+ * explicitly in {@link PreparedBindSpec}).
152
+ */
153
+
154
+ /** The prepared-plan artifact format version (independent of {@link SPEC_VERSION}). */
155
+ declare const PREPARED_FORMAT_VERSION: "1";
156
+ /**
157
+ * One serialized value bind: a `$`-param slot (bound from the caller's
158
+ * `execute(params)` by name) or a static literal recorded at build time. `Date`
159
+ * and `bigint` literals — which JSON cannot carry natively — are encoded
160
+ * explicitly and revived by the loader, so the bound value is the SAME typed
161
+ * value the runtime `prepare` would have captured.
162
+ */
163
+ type PreparedBindSpec = {
164
+ readonly param: string;
165
+ } | {
166
+ readonly literal: string | number | boolean | null;
167
+ } | {
168
+ readonly literalDate: string;
169
+ } | {
170
+ readonly literalBigInt: string;
171
+ };
172
+ /** A `{ field: bind }` map (a serialized slot map). */
173
+ type PreparedBindMap = Readonly<Record<string, PreparedBindSpec>>;
174
+ /** One serialized read route of a prepared READ plan. */
175
+ interface PreparedReadRouteSpec {
176
+ readonly alias: string;
177
+ readonly op: 'query' | 'list';
178
+ /** The target entity name (re-bound via the registry at load). */
179
+ readonly entity: string;
180
+ /** The static, params-independent select template (JSON-safe by the #206 lint). */
181
+ readonly select: Record<string, unknown>;
182
+ /** Key-field binds (`{ field: { param | literal } }`). */
183
+ readonly key: PreparedBindMap;
184
+ /** Static option literals decided at build time. */
185
+ readonly maxDepth?: number;
186
+ readonly order?: 'ASC' | 'DESC';
187
+ readonly filter?: Record<string, unknown>;
188
+ /** Dynamic option binds (a `$` param or a literal, decided per call). */
189
+ readonly consistentRead?: PreparedBindSpec;
190
+ readonly limit?: PreparedBindSpec;
191
+ readonly after?: PreparedBindSpec;
192
+ /**
193
+ * The spec-IR read plan (`operations.json` vocabulary: physical ops, templated
194
+ * `{<field>}` key conditions, relation fan-outs, execution plan) derived from
195
+ * this route at build time. Key-condition tokens are the entity's key FIELD
196
+ * names; the per-call param→field mapping is {@link key}. Deriving it at build
197
+ * time surfaces a broken route as a BUILD failure and freezes the physical
198
+ * plan for drift comparison.
199
+ */
200
+ readonly query: QuerySpec;
201
+ }
202
+ /** One serialized write op of a prepared WRITE plan. */
203
+ interface PreparedWriteOpSpec {
204
+ readonly alias: string;
205
+ readonly entity: string;
206
+ readonly intent: 'create' | 'update' | 'remove';
207
+ /** The target model's primary-key input fields (W1 key/changes split + read-back key). */
208
+ readonly keyFields: readonly string[];
209
+ /** Key-field binds. */
210
+ readonly key: PreparedBindMap;
211
+ /** Input-field binds. */
212
+ readonly input: PreparedBindMap;
213
+ /** In-process write-gate binds (flat equality / existence template), if declared. */
214
+ readonly condition?: PreparedBindMap;
215
+ /** The read-back projection + options, verbatim (JSON-safe by the #206 lint). */
216
+ readonly result?: {
217
+ readonly select?: Record<string, unknown>;
218
+ readonly options?: {
219
+ readonly consistentRead?: boolean;
220
+ readonly maxDepth?: number;
221
+ };
222
+ };
223
+ /**
224
+ * The consistent read-back's spec-IR plan (derived from `result.select` at
225
+ * build time — a broken read-back projection fails the BUILD). Present iff
226
+ * {@link result} declares a non-empty select.
227
+ */
228
+ readonly readback?: QuerySpec;
229
+ /**
230
+ * The op's full declarative {@link TransactionSpec}: `items[0]` is the base
231
+ * write, followed by every derived effect the mutation compiler resolved at
232
+ * build time. Templates bind `{<field>}` tokens — the op's key/input FIELD
233
+ * names — which the loader renders from the per-call bound field values.
234
+ */
235
+ readonly transaction: TransactionSpec;
236
+ /** Per-item derived-effect categories, index-aligned to `transaction.items`. */
237
+ readonly categories: readonly PreparedWriteItemCategory[];
238
+ }
239
+ /** One compiled prepared plan (all routes of one `DDBModel.prepare` body). */
240
+ interface PreparedPlanSpec {
241
+ readonly kind: 'read' | 'write';
242
+ /**
243
+ * The `$` params the plan binds (union across routes), with kinds recovered
244
+ * from the bound entity fields where determinable.
245
+ */
246
+ readonly params: Readonly<Record<string, ParamSpec>>;
247
+ /**
248
+ * Entity name → fingerprint of its canonical manifest entry at build time.
249
+ * The loader recomputes these from the live registry and LOUDLY rejects a
250
+ * mismatch (stale plan / model drift).
251
+ */
252
+ readonly entities: Readonly<Record<string, string>>;
253
+ /** Read routes, in body declaration order (read plans only). */
254
+ readonly reads?: readonly PreparedReadRouteSpec[];
255
+ /** Write ops, in body declaration order (write plans only). */
256
+ readonly writes?: readonly PreparedWriteOpSpec[];
257
+ }
258
+ /** The full static prepared-plan artifact. */
259
+ interface PreparedPlanDocument {
260
+ readonly formatVersion: typeof PREPARED_FORMAT_VERSION;
261
+ /** The shared operation-IR version the plans were compiled against. */
262
+ readonly specVersion: typeof SPEC_VERSION;
263
+ /** Plan id (the transform's stable call-site id) → compiled plan. */
264
+ readonly plans: Readonly<Record<string, PreparedPlanSpec>>;
265
+ }
266
+ /** Deterministic JSON: object keys sorted at every level (arrays keep order). */
267
+ declare function canonicalJson(value: unknown): string;
268
+ /**
269
+ * The fingerprint of one entity's canonical manifest entry — every plan-relevant
270
+ * declaration fact (table, physical name, prefix, fields + formats, key / GSI
271
+ * templates, relations incl. `refs` bindings, TTL). Computed identically at
272
+ * build (emit) and at load (live registry), so any drift is caught.
273
+ */
274
+ declare function entityFingerprint(metadata: EntityMetadata): string;
275
+ /** Stable content hash of a compiled plan (drift-check convenience). */
276
+ declare function planFingerprint(plan: PreparedPlanSpec): string;
277
+ /**
278
+ * Compile ONE `DDBModel.prepare` body into its static {@link PreparedPlanSpec}
279
+ * (build-time). The body is evaluated once with the recording `$` proxy — the
280
+ * #206 no-capture lint has already proven this is side-effect-free and
281
+ * params-independent — then each route is analyzed and serialized.
282
+ *
283
+ * @param body The prepare body function (as extracted by the transform).
284
+ * @param planLabel A human-readable label woven into build errors (the plan id).
285
+ */
286
+ declare function compilePreparedPlan(body: PreparedBody, planLabel?: string): PreparedPlanSpec;
287
+ /** Assemble the full artifact document from compiled plans. */
288
+ declare function buildPreparedPlanDocument(plans: Readonly<Record<string, PreparedPlanSpec>>): PreparedPlanDocument;
3
289
 
4
290
  /**
5
291
  * Declarative transaction definition DSL (issue #46, Python-bridge Phase 4).
@@ -218,107 +504,6 @@ declare function defineTransaction<const P extends TransactionParamShape>(params
218
504
  */
219
505
  declare function defineTransactions<const D extends Record<string, TransactionDefinition>>(definitions: D): D;
220
506
 
221
- /**
222
- * Contract-layer serialization (issue #59, CQRS Contract layer, Epic #57;
223
- * spec `docs/cqrs-contract.md`, "SSoT Schema").
224
- *
225
- * The Contract IR (#58, `src/define/contract.ts`) holds, per contract method, a
226
- * resolved declarative {@link ContractMethodOp} plus the **decided facts** the
227
- * planner derived (`resolution` / `inputArity` / `result`). This module
228
- * **serializes** those facts into the JSON SSoT — it does **not** re-derive them:
229
- *
230
- * - The `contracts` map (contract name → {@link ContractSpec}) is layered **on
231
- * top of** the existing `queries` / `commands` / `transactions`. Each method
232
- * references one of them by name (`ContractName__methodName`), so the existing
233
- * operation-spec shapes are unchanged and the current runtime keeps working.
234
- * - The referenced operation spec is produced by **reusing** the proven
235
- * {@link buildQuerySpec} / {@link buildCommandSpec} planners: a
236
- * {@link ContractMethodOp} is translated back into the {@link AnyOperationDefinition}
237
- * shape those planners consume (the contract's sentinel references become the
238
- * `Param` placeholders the planner already understands), so the symbolic key
239
- * evaluation, projection, relation chaining, and condition handling are shared
240
- * — never re-implemented, never drifting.
241
- *
242
- * Everything emitted is **JSON-serializable** by construction (only strings /
243
- * numbers / booleans / arrays / plain objects). A contract-free input emits no
244
- * `contracts` / `contexts` keys, so the pre-#59 operations document is reproduced
245
- * byte-for-byte (backward compatibility).
246
- *
247
- * ## What this issue serializes vs. defers
248
- *
249
- * The #58 IR captures a single declarative op per method with a boolean `select`
250
- * projection; it does **not** model External Query / Query Composition (no
251
- * `query(Contract.method, { from(...) })` primitive exists yet). So no #58
252
- * contract produces a `compose`. The serializer nonetheless **supports** it: when
253
- * a method op carries composition (a forward-compatible {@link ContractMethodOp}
254
- * extension), it is emitted per the proposal's `compose` shape. The N+1 checker
255
- * (#60), boundary lint (#61), and runtime execution (#62) are out of scope here —
256
- * this is serialization + generator only.
257
- */
258
-
259
- /**
260
- * A contract as accepted by the serializer: either a resolved
261
- * {@link QueryModelContract} or a {@link CommandModelContract} (the #58 factory
262
- * output). The Key type is erased — the serializer reads the key **fields** off
263
- * the resolved op / model metadata, not the phantom type.
264
- */
265
- type AnyModelContract = QueryModelContract<unknown, Record<string, QueryMethodSpec<unknown, unknown, unknown>>> | CommandModelContract<unknown, Record<string, CommandMethodSpec<unknown, unknown, unknown>>>;
266
- /** A map of contract name → resolved contract IR (as passed to the generator). */
267
- type ContractMap = Record<string, AnyModelContract>;
268
- /**
269
- * A context-ownership declaration as authored by the producer: context name →
270
- * the Model (entity) and Contract names that belong to it. The serializer sorts
271
- * the member lists deterministically; see {@link ContextSpec}.
272
- */
273
- interface ContextOwnership {
274
- readonly models?: readonly string[];
275
- readonly contracts?: readonly string[];
276
- }
277
- /** A map of context name → its membership (as passed to the generator). */
278
- type ContextOwnershipMap = Record<string, ContextOwnership>;
279
- /**
280
- * The output of {@link buildContracts}: the `contracts` map and the
281
- * **synthesized** operation specs each method references. The caller merges the
282
- * synthesized `queries` / `commands` / `transactions` into the document's
283
- * existing maps (a contract method's referenced op lives alongside hand-written
284
- * definitions, addressed by name).
285
- */
286
- interface BuiltContracts {
287
- readonly contracts: Record<string, ContractSpec>;
288
- /** Synthesized read ops referenced by query contract methods. */
289
- readonly queries: Record<string, QuerySpec>;
290
- /** Synthesized write ops referenced by command contract methods (single form). */
291
- readonly commands: Record<string, CommandSpec>;
292
- /**
293
- * Synthesized transactions referenced by command contract methods whose array
294
- * form resolves to a `'transact'` batched write (issue #64). One transaction per
295
- * such method, named `<Contract>__<method>__batch`: a single `forEach`-over-keys
296
- * write item that the runtime expands once per key (≤25, atomic), reusing the
297
- * proven declarative-transaction machinery (#46). Empty when no command method
298
- * declares a `'transact'` batch.
299
- */
300
- readonly transactions: Record<string, TransactionSpec>;
301
- }
302
- /**
303
- * Serialize a map of resolved contracts into the `contracts` SSoT map plus the
304
- * synthesized operation specs each method references. Deterministic: contracts
305
- * and methods are emitted in sorted-key order.
306
- *
307
- * @param contracts Contract name → resolved {@link QueryModelContract} /
308
- * {@link CommandModelContract} (the #58 factory output). Empty → empty output.
309
- * @throws if a contract method op cannot be serialized (a non-boolean projection
310
- * slot, an unsupported write condition); or if a contract violates an N+1
311
- * safety rule (#60, {@link assertContractN1Safe}) — an array into a `range`
312
- * method, a "list under a list", or a `range` composed child.
313
- */
314
- declare function buildContracts(contracts?: ContractMap): BuiltContracts;
315
- /**
316
- * Serialize the context-ownership declarations into the SSoT `contexts` map.
317
- * Member lists are sorted for determinism. An empty input yields an empty map
318
- * (the caller then omits the key for backward compatibility).
319
- */
320
- declare function buildContexts(contexts?: ContextOwnershipMap): Record<string, ContextSpec>;
321
-
322
507
  /**
323
508
  * Static parameterized operation-spec generation (issue #42, Phase 0b).
324
509
  *
@@ -687,4 +872,4 @@ declare function assertBundleSerializable(bundle: BridgeBundle): void;
687
872
  */
688
873
  declare function buildBridgeBundle(queries?: DefinitionMap, commands?: DefinitionMap, registry?: typeof MetadataRegistry, transactions?: Record<string, TransactionDefinition>, contractInputs?: ContractInputs): BridgeBundle;
689
874
 
690
- export { type AnyModelContract as A, type BuiltContracts as B, type ContextOwnership as C, buildTransactions as D, collectContractBoundaryViolations as E, collectContractN1Violations as F, defineTransaction as G, defineTransactions as H, isTransactionRef as I, when as J, type TransactionDefinition as T, type WhenComparison as W, type ContextOwnershipMap as a, type ContractBoundaryViolation as b, type ContractInputs as c, type ContractMap as d, type ContractN1Violation as e, type TransactionParamShape as f, type TransactionRef as g, type TxConditionCheckOptions as h, type TxForEachInstruction as i, type TxForEachOptions as j, type TxInstruction as k, type TxRecorder as l, type TxWriteInstruction as m, type TxWriteOptions as n, assertBundleSerializable as o, assertContractBoundaries as p, assertContractN1Safe as q, assertJsonSerializable as r, assertSupportedCondition as s, buildBridgeBundle as t, buildContexts as u, buildContracts as v, buildManifest as w, buildOperations as x, buildQuerySpec as y, buildTransactionSpec as z };
875
+ export { type AnyModelContract as A, type BuiltContracts as B, type ContextOwnership as C, buildManifest as D, buildOperations as E, buildQuerySpec as F, buildTransactionSpec as G, buildTransactions as H, collectContractBoundaryViolations as I, collectContractN1Violations as J, defineTransaction as K, defineTransactions as L, isTransactionRef as M, when as N, PREPARED_FORMAT_VERSION as O, type PreparedWriteOpSpec as P, type PreparedBindMap as Q, buildPreparedPlanDocument as R, canonicalJson as S, type TransactionDefinition as T, compilePreparedPlan as U, entityFingerprint as V, type WhenComparison as W, planFingerprint as X, type PreparedPlanDocument as a, type ContextOwnershipMap as b, type ContractBoundaryViolation as c, type ContractInputs as d, type ContractMap as e, type ContractN1Violation as f, type PreparedBindSpec as g, type PreparedPlanSpec as h, type PreparedReadRouteSpec as i, type TransactionParamShape as j, type TransactionRef as k, type TxConditionCheckOptions as l, type TxForEachInstruction as m, type TxForEachOptions as n, type TxInstruction as o, type TxRecorder as p, type TxWriteInstruction as q, type TxWriteOptions as r, assertBundleSerializable as s, assertContractBoundaries as t, assertContractN1Safe as u, assertJsonSerializable as v, assertSupportedCondition as w, buildBridgeBundle as x, buildContexts as y, buildContracts as z };
package/dist/index.d.ts CHANGED
@@ -1,11 +1,12 @@
1
- export { a as LintResult, L as LintRule, b as Linter, M as MetadataRegistry } from './registry-Cv9nl_3i.js';
2
- import { aN as SelectableOf, aO as PrimaryKeyOf, aP as RequestContext, aQ as Middleware, aR as ReadRequestKind, aS as CtxModel, aT as ReadParams, aU as ReadRequestCtx, D as DynamoDBOperation, aV as Item, n as Executor, aW as RetryPolicy, am as ExecutionPlanSpec, aX as KeyDefinition, aY as GsiDefinition, aZ as ModelKind, a_ as FieldOptions, a$ as DynamoType, b0 as ProjectionTransform, b1 as MaintainEvent, b2 as MembershipPredicate, b3 as MaintainConsistency, b4 as MaintainUpdateMode, b5 as MembershipPredicateOp, b6 as RelationOptions, b7 as AggregateOptions, b8 as AggregateValue, b9 as SelectBuilderSpec, ba as RawCondition, m as EntityMetadata, N as TransactionSpec, _ as Manifest, bb as RetryOverride, bc as ExecutionPlan, bd as FieldMetadata, be as ResolvedKey, o as ReadExecOptions, p as ExecutorResult, q as BatchGetExecInput, P as PutInput, W as WriteExecOptions, r as WriteResult, s as UpdateInput, t as DeleteInput, u as BatchWriteExecItem, v as BatchExecOptions, T as TransactWriteExecItem, bf as RelationMetadata, aC as TransactionItemSpec, bg as MaintainEffect, M as ModelStatic, w as DDBModel, V as ViewDefinition, A as Param, x as ParamDescriptor, X as DefinitionMap, bh as OperationDefinition, bi as WriteDefinitionOptions, bj as PartialQueryKeyOf, bk as StrictSelectSpec, bl as ReadDefinitionOptions, bm as EntityInput, bn as UniqueQueryKeyOf } from './maintenance-view-adapter-BP2CJDdz.js';
3
- export { bo as AggregateMetadata, Z as AnyOperationDefinition, bp as BatchDeleteRequest, bq as BatchGetOptions, br as BatchGetRequest, bs as BatchGetResult, bt as BatchPutRequest, B as BatchResult, bu as BatchWriteRequest, $ as BridgeBundle, bv as CONTRACT_RANGE_FANOUT_CONCURRENCY, C as CdcEmulatorOptions, a as CdcMode, bw as CdcModelRegistry, bx as CdcSubscribeHandlers, by as Change, b as ChangeBatch, c as ChangeEvent, d as ChangeEventName, e as ChangeHandler, f as ClockMode, bz as CollectionEffect, bA as CollectionOptions, bB as Column, bC as ColumnMap, a1 as CommandContractMethodSpec, bD as CommandInputShape, bE as CommandMethod, I as CommandMethodSpec, H as CommandModelContract, bF as CommandPlan, a2 as CommandResolutionTarget, bG as CommandResultKind, bH as CommandSelectShape, L as CommandSpec, a3 as CompiledFragment, a5 as ComposeSpec, g as ConcurrentRecomputeRef, bI as CondSlot, bJ as ConditionCheckInput, z as ConditionInput, a0 as ConditionSpec, bK as Connection, O as ContextSpec, bL as ContractCallSignature, a7 as ContractCardinality, bM as ContractCommandParams, a8 as ContractCommandResult, bN as ContractComposeNode, bO as ContractFromRef, a9 as ContractInputArity, bP as ContractItem, bQ as ContractKeyFieldRef, bR as ContractKeyInput, bS as ContractKeyRef, aa as ContractKeySpec, ab as ContractKind, bT as ContractMethodOp, bU as ContractParamRef, bV as ContractQueryParams, ac as ContractResolution, J as ContractSpec, bW as CounterAggregate, bX as CounterEffect, bY as CtxBase, bZ as DEFAULT_MAX_ATTEMPTS, b_ as DEFAULT_RETRY_POLICY, b$ as DeleteOptions, c0 as DeriveEffect, ae as DerivedEdgeWrite, ak as DerivedUpdate, c1 as DescriptorBinding, c2 as ENTITY_WRITES_MARKER, c3 as EdgeEffect, c4 as EffectPath, c5 as EmbeddedMetadata, c6 as EmitEffect, y as EntityRef, c7 as EntityWritesDefinition, c8 as EntityWritesShape, E as EventLog, c9 as ExecutableCommandContract, ca as ExecutableQueryContract, F as FaultSpec, cb as FilterInput, an as FilterSpec, cc as FragmentInput, cd as GsiDefinitionMarker, ce as GsiOptions, cf as IdempotencyEffect, cg as InProcessWriteDescriptor, ch as InlineSnapshotSpec, ci as InputArity, cj as KeyDefinitionMarker, ck as KeySegment, cl as KeySlot, cm as KeyStructure, cn as KeyedResult, co as LIFECYCLE_CONTRACT_MARKER, cp as LifecycleContract, cq as LifecycleEffects, cr as LiteralParam, cs as MaintainItem, ct as MaintainTrigger, cu as MaintenanceGraph, ap as ManifestEntity, aq as ManifestField, ar as ManifestFieldType, as as ManifestGsi, at as ManifestKey, au as ManifestRelation, av as ManifestTable, cv as MembershipEffect, cw as ModelRef, cx as MutateMode, cy as MutateOptions, cz as MutateParallelResult, cA as MutateTransactionResult, cB as MutationBody, cC as MutationDescriptorMap, cD as MutationFragment, cE as MutationInputProxy, cF as MutationInputRef, cG as MutationIntent, cH as NumberParam, cI as OperationKind, aw as OperationSpec, Y as OperationsDocument, cJ as PREPARE_CACHE_MAX, cK as ParallelOpResult, cL as ParamKind, ax as ParamSpec, cM as ParamStructure, cN as PersistCtx, cO as PersistOrigin, cP as PlannedCommandMethod, cQ as PreparedBody, cR as PreparedInputProxy, cS as PreparedParamRef, cT as PreparedReadExecOptions, cU as PreparedReadRoute, cV as PreparedReadStatement, cW as PreparedStatement, cX as PreparedWriteExecOptions, cY as PreparedWriteRoute, cZ as PreparedWriteStatement, c_ as ProjectionMap, c$ as ProjectionTransformOp, d0 as PutOptions, ay as QueryContractMethodSpec, d1 as QueryEnvelopeResult, d2 as QueryKeyOf, d3 as QueryMethod, G as QueryMethodSpec, Q as QueryModelContract, d4 as QueryResult, K as QuerySpec, az as RangeConditionSpec, d5 as ReadEnvelope, d6 as ReadOpCtx, d7 as ReadOpKind, aA as ReadOperationType, d8 as ReadRouteDescriptor, d9 as ReadRouteOptions, da as ReadRouteResult, db as RecordedCompose, dc as RelationBuilder, dd as RelationConsistency, de as RelationLimitOptions, df as RelationPattern, dg as RelationProjection, dh as RelationReadOptions, di as RelationSelect, dj as RelationSpec, dk as RelationUpdateMode, dl as RelationWriteOptions, R as ReplayOptions, dm as RequiresEffect, dn as Resolution, dp as RetryInfo, dq as RetryOperationKind, aB as SPEC_VERSION, dr as SegmentSpec, ds as SegmentedKey, dt as SelectBuilder, du as SelectOf, S as ShardId, dv as SnapshotEffect, h as StartingPosition, i as StreamViewType, dw as StringParam, j as SubscribeHandler, k as SubscribeHandlers, dx as TransactionContext, aD as TransactionItemType, dy as UniqueEffect, dz as Updatable, dA as UpdateOptions, dB as ViewSourceSlice, aE as WhenSpec, dC as WriteCtx, dD as WriteDescriptor, dE as WriteEnvelope, dF as WriteInput, dG as WriteKind, dH as WriteLifecyclePhase, dI as WriteMiddleware, aF as WriteOperationType, dJ as WriteRecorder, dK as WriteResultProjection, dL as attachModelClass, dM as buildDeleteInput, dN as buildMaintenanceGraph, dO as buildPutInput, l as buildSubscribeHandler, dP as buildUpdateInput, dQ as collectViewDefinitions, aH as compileFragment, aI as compileMutationPlan, aJ as compileSingleFragmentPlan, dR as cond, dS as contractOfMethodSpec, dT as definePlan, dU as entityWrites, dV as executeBatchGet, dW as executeBatchWrite, dX as executeCommandMethod, dY as executeDelete, dZ as executeKeyedBatchGet, d_ as executePut, d$ as executeQueryMethod, e0 as executeRangeFanout, e1 as executeTransaction, e2 as executeUpdate, e3 as from, e4 as getEntityWrites, e5 as gsi, e6 as identity, e7 as isColumn, e8 as isCommandModelContract, e9 as isCommandPlan, ea as isContractComposeNode, eb as isContractFromRef, ec as isContractKeyFieldRef, ed as isContractKeyRef, ee as isContractParamRef, ef as isEntityWritesDefinition, eg as isKeySegment, eh as isLifecycleContract, ei as isMaintainTrigger, ej as isMutationFragment, ek as isMutationInputRef, el as isParam, em as isPlannedCommandMethod, en as isPreparedParamRef, eo as isQueryModelContract, ep as isRetryableError, eq as isRetryableTransactionCancellation, er as k, es as key, et as lifecyclePhaseForIntent, eu as maintainTrigger, ev as mintContractKeyFieldRef, ew as mintContractParamRef, ex as mutation, ey as param, ez as prepare, eA as preview, eB as publicCommandModel, eC as publicQueryModel, eD as query, aL as resolveLifecycle, eE as wholeKeysSentinel } from './maintenance-view-adapter-BP2CJDdz.js';
1
+ export { a as LintResult, L as LintRule, b as Linter, M as MetadataRegistry } from './registry-BndKbZbg.js';
2
+ import { aO as SelectableOf, aP as PrimaryKeyOf, aQ as RequestContext, aR as Middleware, aS as ReadRequestKind, aT as CtxModel, aU as ReadParams, aV as ReadRequestCtx, D as DynamoDBOperation, aW as Item, n as Executor, aX as RetryPolicy, ap as ExecutionPlanSpec, aY as KeyDefinition, aZ as GsiDefinition, a_ as ModelKind, a$ as FieldOptions, b0 as DynamoType, b1 as ProjectionTransform, b2 as MaintainEvent, b3 as MembershipPredicate, b4 as MaintainConsistency, b5 as MaintainUpdateMode, b6 as MembershipPredicateOp, b7 as RelationOptions, b8 as AggregateOptions, b9 as AggregateValue, ba as SelectBuilderSpec, bb as RawCondition, m as EntityMetadata, I as TransactionSpec, a1 as Manifest, bc as RetryOverride, bd as ExecutionPlan, be as FieldMetadata, bf as ResolvedKey, o as ReadExecOptions, p as ExecutorResult, q as BatchGetExecInput, P as PutInput, W as WriteExecOptions, r as WriteResult, s as UpdateInput, t as DeleteInput, u as BatchWriteExecItem, v as BatchExecOptions, T as TransactWriteExecItem, M as ModelStatic, w as DDBModel, bg as Slot, bh as PreparedWriteExecOptions, bi as CommandReturn, bj as ParallelOpResult, N as PreparedBody, bk as PreparedStatement, bl as RelationMetadata, aD as TransactionItemSpec, bm as MaintainEffect, V as ViewDefinition, Z as Param, O as ParamDescriptor, _ as DefinitionMap, bn as OperationDefinition, bo as WriteDefinitionOptions, bp as PartialQueryKeyOf, bq as StrictSelectSpec, br as ReadDefinitionOptions, bs as EntityInput, bt as UniqueQueryKeyOf } from './maintenance-view-adapter-NBTZbE8-.js';
3
+ export { bu as AggregateMetadata, a0 as AnyOperationDefinition, bv as BatchDeleteRequest, bw as BatchGetOptions, bx as BatchGetRequest, by as BatchGetResult, bz as BatchPutRequest, B as BatchResult, bA as BatchWriteRequest, a2 as BridgeBundle, bB as CONTRACT_RANGE_FANOUT_CONCURRENCY, C as CdcEmulatorOptions, a as CdcMode, bC as CdcModelRegistry, bD as CdcSubscribeHandlers, bE as Change, b as ChangeBatch, c as ChangeEvent, d as ChangeEventName, e as ChangeHandler, f as ClockMode, bF as CollectionEffect, bG as CollectionOptions, bH as Column, bI as ColumnMap, a4 as CommandContractMethodSpec, bJ as CommandInputShape, bK as CommandMethod, z as CommandMethodSpec, y as CommandModelContract, bL as CommandPlan, a5 as CommandResolutionTarget, bM as CommandResultKind, bN as CommandSelectShape, H as CommandSpec, a6 as CompiledFragment, a8 as ComposeSpec, g as ConcurrentRecomputeRef, bO as CondSlot, bP as ConditionCheckInput, Y as ConditionInput, a3 as ConditionSpec, bQ as Connection, J as ContextSpec, bR as ContractCallSignature, aa as ContractCardinality, bS as ContractCommandParams, ab as ContractCommandResult, bT as ContractComposeNode, bU as ContractFromRef, ac as ContractInputArity, bV as ContractItem, bW as ContractKeyFieldRef, bX as ContractKeyInput, bY as ContractKeyRef, ad as ContractKeySpec, ae as ContractKind, bZ as ContractMethodOp, b_ as ContractParamRef, b$ as ContractQueryParams, af as ContractResolution, A as ContractSpec, c0 as CounterAggregate, c1 as CounterEffect, c2 as CtxBase, c3 as DEFAULT_MAX_ATTEMPTS, c4 as DEFAULT_RETRY_POLICY, c5 as DeleteOptions, c6 as DeriveEffect, ah as DerivedEdgeWrite, an as DerivedUpdate, c7 as DescriptorBinding, c8 as ENTITY_WRITES_MARKER, c9 as EdgeEffect, ca as EffectPath, cb as EmbeddedMetadata, cc as EmitEffect, X as EntityRef, cd as EntityWritesDefinition, ce as EntityWritesShape, E as EventLog, cf as ExecutableCommandContract, cg as ExecutableQueryContract, F as FaultSpec, ch as FilterInput, aq as FilterSpec, ci as FragmentInput, cj as GsiDefinitionMarker, ck as GsiOptions, cl as IdempotencyEffect, cm as InProcessWriteDescriptor, cn as InlineSnapshotSpec, co as InputArity, cp as KeyDefinitionMarker, cq as KeySegment, cr as KeySlot, cs as KeyStructure, ct as KeyedResult, cu as LIFECYCLE_CONTRACT_MARKER, cv as LifecycleContract, cw as LifecycleEffects, cx as LiteralParam, cy as MaintainItem, cz as MaintainTrigger, cA as MaintenanceGraph, as as ManifestEntity, at as ManifestField, au as ManifestFieldType, av as ManifestGsi, aw as ManifestKey, ax as ManifestRelation, ay as ManifestTable, cB as MembershipEffect, cC as ModelRef, cD as MutateMode, cE as MutateOptions, cF as MutateParallelResult, cG as MutateTransactionResult, cH as MutationBody, cI as MutationDescriptorMap, cJ as MutationFragment, cK as MutationInputProxy, cL as MutationInputRef, cM as MutationIntent, cN as NumberParam, cO as OperationKind, az as OperationSpec, $ as OperationsDocument, cP as PREPARE_CACHE_MAX, cQ as ParamKind, L as ParamSpec, cR as ParamStructure, cS as PersistCtx, cT as PersistOrigin, cU as PlannedCommandMethod, cV as PreparedInputProxy, cW as PreparedParamRef, cX as PreparedReadExecOptions, cY as PreparedReadRoute, cZ as PreparedReadStatement, c_ as PreparedWriteRoute, c$ as PreparedWriteStatement, d0 as ProjectionMap, d1 as ProjectionTransformOp, d2 as PutOptions, aA as QueryContractMethodSpec, d3 as QueryEnvelopeResult, d4 as QueryKeyOf, d5 as QueryMethod, x as QueryMethodSpec, Q as QueryModelContract, d6 as QueryResult, G as QuerySpec, aB as RangeConditionSpec, d7 as ReadEnvelope, d8 as ReadOpCtx, d9 as ReadOpKind, aC as ReadOperationType, da as ReadRouteDescriptor, db as ReadRouteOptions, dc as ReadRouteResult, dd as RecordedCompose, de as RelationBuilder, df as RelationConsistency, dg as RelationLimitOptions, dh as RelationPattern, di as RelationProjection, dj as RelationReadOptions, dk as RelationSelect, dl as RelationSpec, dm as RelationUpdateMode, dn as RelationWriteOptions, R as ReplayOptions, dp as RequiresEffect, dq as Resolution, dr as RetryInfo, ds as RetryOperationKind, K as SPEC_VERSION, dt as SegmentSpec, du as SegmentedKey, dv as SelectBuilder, dw as SelectOf, S as ShardId, dx as SnapshotEffect, h as StartingPosition, i as StreamViewType, dy as StringParam, j as SubscribeHandler, k as SubscribeHandlers, dz as TransactionContext, aE as TransactionItemType, dA as UniqueEffect, dB as Updatable, dC as UpdateOptions, dD as ViewSourceSlice, aF as WhenSpec, dE as WriteCtx, dF as WriteDescriptor, dG as WriteEnvelope, dH as WriteInput, dI as WriteKind, dJ as WriteLifecyclePhase, dK as WriteMiddleware, aG as WriteOperationType, dL as WriteRecorder, dM as WriteResultProjection, dN as attachModelClass, dO as buildDeleteInput, dP as buildMaintenanceGraph, dQ as buildPutInput, l as buildSubscribeHandler, dR as buildUpdateInput, dS as collectViewDefinitions, aI as compileFragment, aJ as compileMutationPlan, aK as compileSingleFragmentPlan, dT as cond, dU as contractOfMethodSpec, dV as definePlan, dW as entityWrites, dX as executeBatchGet, dY as executeBatchWrite, dZ as executeCommandMethod, d_ as executeDelete, d$ as executeKeyedBatchGet, e0 as executePut, e1 as executeQueryMethod, e2 as executeRangeFanout, e3 as executeTransaction, e4 as executeUpdate, e5 as from, e6 as getEntityWrites, e7 as gsi, e8 as identity, e9 as isColumn, ea as isCommandModelContract, eb as isCommandPlan, ec as isContractComposeNode, ed as isContractFromRef, ee as isContractKeyFieldRef, ef as isContractKeyRef, eg as isContractParamRef, eh as isEntityWritesDefinition, ei as isKeySegment, ej as isLifecycleContract, ek as isMaintainTrigger, el as isMutationFragment, em as isMutationInputRef, en as isParam, eo as isPlannedCommandMethod, ep as isPreparedParamRef, eq as isQueryModelContract, er as isRetryableError, es as isRetryableTransactionCancellation, et as k, eu as key, ev as lifecyclePhaseForIntent, ew as maintainTrigger, ex as mintContractKeyFieldRef, ey as mintContractParamRef, ez as mutation, eA as param, eB as prepare, eC as preview, eD as publicCommandModel, eE as publicQueryModel, eF as query, aM as resolveLifecycle, eG as wholeKeysSentinel } from './maintenance-view-adapter-NBTZbE8-.js';
4
4
  import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
5
5
  import { DynamoDBDocumentClient } from '@aws-sdk/lib-dynamodb';
6
- export { C as CdcEmulator, M as MAINT_OUTBOX_PK_PREFIX, a as MaintenanceDrain, b as MaintenanceDrainOptions, c as createCdcEmulator, d as createMaintenanceDrain, e as createMaintenanceDrainHandler, p as parseChange } from './from-change-pnURY-cV.js';
7
- export { c as createDefaultLinter, g as gsiAmbiguityRule, m as missingGsiRule, n as noScanRule, q as queryBoundaryRule, r as relationDepthRule, a as requireLimitRule } from './relation-depth-BR0y7Q1i.js';
8
- export { A as AnyModelContract, B as BuiltContracts, C as ContextOwnership, a as ContextOwnershipMap, b as ContractBoundaryViolation, c as ContractInputs, d as ContractMap, e as ContractN1Violation, T as TransactionDefinition, f as TransactionParamShape, g as TransactionRef, h as TxConditionCheckOptions, i as TxForEachInstruction, j as TxForEachOptions, k as TxInstruction, l as TxRecorder, m as TxWriteInstruction, n as TxWriteOptions, W as WhenComparison, o as assertBundleSerializable, p as assertContractBoundaries, q as assertContractN1Safe, r as assertJsonSerializable, s as assertSupportedCondition, t as buildBridgeBundle, u as buildContexts, v as buildContracts, w as buildManifest, x as buildOperations, y as buildQuerySpec, z as buildTransactionSpec, D as buildTransactions, E as collectContractBoundaryViolations, F as collectContractN1Violations, G as defineTransaction, H as defineTransactions, I as isTransactionRef, J as when } from './index-Eg94ChE1.js';
6
+ export { C as CdcEmulator, M as MAINT_OUTBOX_PK_PREFIX, a as MaintenanceDrain, b as MaintenanceDrainOptions, c as createCdcEmulator, d as createMaintenanceDrain, e as createMaintenanceDrainHandler, p as parseChange } from './from-change-CWiXBcgi.js';
7
+ import { P as PreparedWriteOpSpec, a as PreparedPlanDocument } from './index-CvS9ATKB.js';
8
+ export { A as AnyModelContract, B as BuiltContracts, C as ContextOwnership, b as ContextOwnershipMap, c as ContractBoundaryViolation, d as ContractInputs, e as ContractMap, f as ContractN1Violation, g as PreparedBindSpec, h as PreparedPlanSpec, i as PreparedReadRouteSpec, T as TransactionDefinition, j as TransactionParamShape, k as TransactionRef, l as TxConditionCheckOptions, m as TxForEachInstruction, n as TxForEachOptions, o as TxInstruction, p as TxRecorder, q as TxWriteInstruction, r as TxWriteOptions, W as WhenComparison, s as assertBundleSerializable, t as assertContractBoundaries, u as assertContractN1Safe, v as assertJsonSerializable, w as assertSupportedCondition, x as buildBridgeBundle, y as buildContexts, z as buildContracts, D as buildManifest, E as buildOperations, F as buildQuerySpec, G as buildTransactionSpec, H as buildTransactions, I as collectContractBoundaryViolations, J as collectContractN1Violations, K as defineTransaction, L as defineTransactions, M as isTransactionRef, N as when } from './index-CvS9ATKB.js';
9
+ export { c as createDefaultLinter, g as gsiAmbiguityRule, m as missingGsiRule, n as noScanRule, q as queryBoundaryRule, r as relationDepthRule, a as requireLimitRule } from './relation-depth-CCGHLTOv.js';
9
10
 
10
11
  /**
11
12
  * Query options with conditional `consistentRead` availability.
@@ -1406,6 +1407,83 @@ declare function encodePerKeyCursor(key: Record<string, unknown>, inner: string
1406
1407
  */
1407
1408
  declare function decodePerKeyCursor(cursor: string, expectedKey: Record<string, unknown>): string;
1408
1409
 
1410
+ /**
1411
+ * Static prepared-plan LOADER (issue #208) — the runtime half of the AOT
1412
+ * pipeline. `graphddb transform prepared --aot` compiles every verified
1413
+ * `DDBModel.prepare` body at BUILD time into a {@link PreparedPlanDocument}
1414
+ * (`src/spec/prepared.ts`) and rewrites the call site to
1415
+ *
1416
+ * ```ts
1417
+ * (__gddbPrepared1 ??= loadPreparedPlan(__gddbPreparedPlans, '<id>', ($) => ({…})))
1418
+ * ```
1419
+ *
1420
+ * This module loads that artifact: it re-binds each plan's entity NAMES against
1421
+ * the live {@link MetadataRegistry}, verifies the plan is not stale, and returns
1422
+ * a handle whose `execute` runs the very same execution cores the runtime
1423
+ * `prepare` uses — with **zero plan construction / compilation per op, including
1424
+ * the first call**:
1425
+ *
1426
+ * - a **read** plan binds into the SAME {@link PreparedReadStatement} the
1427
+ * runtime `prepare` returns (identical semantics by construction — reads never
1428
+ * had an expensive compile; what `prepare` computes once, the artifact
1429
+ * carries);
1430
+ * - a **write** plan's mutation compile (lifecycle resolution + derived-effect
1431
+ * derivation — the expensive half) happened at BUILD time; `execute` renders
1432
+ * the serialized templates and runs {@link executeLogicalWriteOps} /
1433
+ * {@link executeLogicalParallelWrites} — the same W1–W5 / fast-path / atomic
1434
+ * commit / read-back pipeline as the compiled core, so effects are identical.
1435
+ *
1436
+ * ## Stale plans are a LOUD reject
1437
+ *
1438
+ * Each plan records a fingerprint of every entity's canonical manifest entry at
1439
+ * build time. On first use the loader recomputes the fingerprints from the live
1440
+ * registry: a mismatch (the model declarations — key/GSI templates, fields,
1441
+ * relations, table mapping — changed since the artifact was generated) throws
1442
+ * with a regeneration hint. A stale static plan NEVER executes. Version-skewed
1443
+ * artifacts (format / spec IR version) reject the same way.
1444
+ *
1445
+ * ## Laziness
1446
+ *
1447
+ * Binding is deferred to the FIRST `execute` (not the `loadPreparedPlan` call):
1448
+ * a module-scope `const p = loadPreparedPlan(…)` must not touch the registry at
1449
+ * module-init time (the target models may be declared later in the same module —
1450
+ * the same TDZ hazard the #206 lazy slot solves). Binding is memoized per
1451
+ * `(document, planId)`; it performs registry lookups + fingerprint hashing only,
1452
+ * never plan compilation.
1453
+ */
1454
+
1455
+ interface BoundWriteOp {
1456
+ readonly alias: string;
1457
+ readonly spec: PreparedWriteOpSpec;
1458
+ readonly modelClass: Function;
1459
+ readonly modelStatic: ModelStatic<DDBModel>;
1460
+ readonly keySlots: Readonly<Record<string, Slot>>;
1461
+ readonly inputSlots: Readonly<Record<string, Slot>>;
1462
+ readonly conditionSlots?: Readonly<Record<string, Slot>>;
1463
+ readonly manifest: Manifest;
1464
+ }
1465
+ /** A prepared WRITE handle bound from a static plan (#208). `execute(params)`
1466
+ * mirrors {@link import('./prepared.js').PreparedWriteStatement.execute}. */
1467
+ declare class AotPreparedWriteStatement {
1468
+ private readonly ops;
1469
+ /** @internal */
1470
+ constructor(ops: readonly BoundWriteOp[]);
1471
+ execute(params?: Record<string, unknown>, options?: PreparedWriteExecOptions): Promise<Record<string, CommandReturn | undefined> | Record<string, ParallelOpResult | ParallelOpResult[]>>;
1472
+ }
1473
+ /**
1474
+ * Load one statically-compiled prepared plan (issue #208). The rewritten call
1475
+ * site passes the artifact document, the stable plan id, and the ORIGINAL
1476
+ * prepare body — the body is retained in source as the plan's compile source
1477
+ * (drift regeneration + type inference + the untransformed-build fallback) and
1478
+ * is NEVER evaluated here: execution consumes the static artifact only.
1479
+ *
1480
+ * Per-op plan construction / compilation is ZERO, including the first call —
1481
+ * the first `execute` performs registry binding + stale-fingerprint
1482
+ * verification only (memoized per `(document, planId)`), then every call binds
1483
+ * params into the frozen plan and runs the shared execution cores.
1484
+ */
1485
+ declare function loadPreparedPlan(doc: PreparedPlanDocument, planId: string, body?: PreparedBody): PreparedStatement;
1486
+
1409
1487
  declare function detectRelationFields(select: Record<string, unknown>, metadata: EntityMetadata): RelationMetadata[];
1410
1488
  declare function getImplicitKeyFields(select: Record<string, unknown>, metadata: EntityMetadata): string[];
1411
1489
 
@@ -2100,4 +2178,4 @@ type WriteOnlyDefinitions<D extends DefinitionMap> = {
2100
2178
  [K in keyof D]: D[K] extends OperationDefinition<infer _T, infer Op, infer _K, infer _S, infer _Ch, infer _P> ? Op extends 'put' | 'update' | 'delete' ? D[K] : OperationDefinition<DDBModel, 'put' | 'update' | 'delete', unknown, unknown, unknown, Record<string, ParamDescriptor>> : never;
2101
2179
  };
2102
2180
 
2103
- export { AggregateOptions, AggregateValue, BATCH_GET_MAX_KEYS, BATCH_WRITE_MAX_ITEMS, BatchExecOptions, BatchGetExecInput, BatchWriteExecItem, ClientManager, type CollectParams, type ConditionExpressionResult, CtxModel, DDBModel, DefinitionMap, DeleteInput, type DriftReport, DynamoDBOperation, DynamoExecutor, DynamoType, EDGE_WRITES_MARKER, type EdgeLifecycle, type EdgeWriteDeclaration, type EdgeWriteRecorder, type EdgeWritesDefinition, EntityMetadata, ExecutionPlan, Executor, ExecutorResult, type ExplainInput, FieldMetadata, FieldOptions, type FilterExpressionResult, GsiDefinition, type HasManyVersionedCallback, type HasManyVersionedOptions, type HasOneVersionedCallback, type HasOneVersionedOptions, Item, KeyDefinition, type ListInput, type ListOptions, MAX_TRANSACT_ITEMS, MaintainConsistency, MaintainEffect, MaintainEvent, MaintainUpdateMode, type MaintainedFromCallback, type MaintainedFromOptions, type MaintenanceRebuildOptions, MaintenanceRebuilder, Manifest, MembershipPredicate, MembershipPredicateOp, Middleware, type ModelOptions, ModelStatic, OLD_VALUE_NAMESPACE, OperationDefinition, Param, ParamDescriptor, type Parameterize, PartialQueryKeyOf, type PerKeyCursorEnvelope, type PlanInput, PrimaryKeyOf, type ProjectionResult, ProjectionTransform, type ProjectionValue, PutInput, type QueryOptions$1 as QueryOptions, RawCondition, ReadExecOptions, ReadParams, ReadRequestCtx, ReadRequestKind, type RebuildResult, type RefsOptions, RelationMetadata, RelationOptions, type RelationTraversalOptions, RequestContext, ResolvedKey, RetryOverride, RetryPolicy, RetryingExecutor, SelectableOf, type SelfProxy, type SelfRef, type SourceProxy, type SourceRef, TableMapping, TransactWriteExecItem, TransactionItemSpec, TransactionSpec, UniqueQueryKeyOf, type UpdateExpressionResult, UpdateInput, type VersionedHistoryOptions, type VersionedLatestOptions, ViewDefinition, WriteDefinitionOptions, WriteExecOptions, WriteResult, aggregate, belongsTo, binary, boolean, buildConditionExpression, buildProjection, buildUpdateExpression, cdcProjected, compileFilterExpression, count, createMaintenanceRebuilder, datetime, decodeCursor, decodePerKeyCursor, defineCommands, defineDelete, defineList, definePut, defineQueries, defineQuery, defineUpdate, deriveEdgeWriteItems, deriveEdgeWriteItemsFor, deriveModelEdgeWriteItems, derivePrefix, detectRelationFields, edgeWrites, embedded, encodeCursor, encodePerKeyCursor, evaluateFilter, execute, executeDeclarativeTransaction, executeExplain, executeList, executeQuery, expandTransaction, field, getEdgeWrites, getImplicitKeyFields, hasMany, hasOne, hydrate, isEdgeWritesDefinition, isSelectBuilder, list, literal, maintainedFrom, map, max, model, number, numberSet, plan, refs, resolveKey, resolveRelations, serializeContractKey, serializeFieldValue, string, stringSet, ttl, validateDepth, validateGsiAmbiguity, whenMember };
2181
+ export { AggregateOptions, AggregateValue, AotPreparedWriteStatement, BATCH_GET_MAX_KEYS, BATCH_WRITE_MAX_ITEMS, BatchExecOptions, BatchGetExecInput, BatchWriteExecItem, ClientManager, type CollectParams, type ConditionExpressionResult, CtxModel, DDBModel, DefinitionMap, DeleteInput, type DriftReport, DynamoDBOperation, DynamoExecutor, DynamoType, EDGE_WRITES_MARKER, type EdgeLifecycle, type EdgeWriteDeclaration, type EdgeWriteRecorder, type EdgeWritesDefinition, EntityMetadata, ExecutionPlan, Executor, ExecutorResult, type ExplainInput, FieldMetadata, FieldOptions, type FilterExpressionResult, GsiDefinition, type HasManyVersionedCallback, type HasManyVersionedOptions, type HasOneVersionedCallback, type HasOneVersionedOptions, Item, KeyDefinition, type ListInput, type ListOptions, MAX_TRANSACT_ITEMS, MaintainConsistency, MaintainEffect, MaintainEvent, MaintainUpdateMode, type MaintainedFromCallback, type MaintainedFromOptions, type MaintenanceRebuildOptions, MaintenanceRebuilder, Manifest, MembershipPredicate, MembershipPredicateOp, Middleware, type ModelOptions, ModelStatic, OLD_VALUE_NAMESPACE, OperationDefinition, ParallelOpResult, Param, ParamDescriptor, type Parameterize, PartialQueryKeyOf, type PerKeyCursorEnvelope, type PlanInput, PreparedBody, PreparedPlanDocument, PreparedStatement, PreparedWriteExecOptions, PreparedWriteOpSpec, PrimaryKeyOf, type ProjectionResult, ProjectionTransform, type ProjectionValue, PutInput, type QueryOptions$1 as QueryOptions, RawCondition, ReadExecOptions, ReadParams, ReadRequestCtx, ReadRequestKind, type RebuildResult, type RefsOptions, RelationMetadata, RelationOptions, type RelationTraversalOptions, RequestContext, ResolvedKey, RetryOverride, RetryPolicy, RetryingExecutor, SelectableOf, type SelfProxy, type SelfRef, type SourceProxy, type SourceRef, TableMapping, TransactWriteExecItem, TransactionItemSpec, TransactionSpec, UniqueQueryKeyOf, type UpdateExpressionResult, UpdateInput, type VersionedHistoryOptions, type VersionedLatestOptions, ViewDefinition, WriteDefinitionOptions, WriteExecOptions, WriteResult, aggregate, belongsTo, binary, boolean, buildConditionExpression, buildProjection, buildUpdateExpression, cdcProjected, compileFilterExpression, count, createMaintenanceRebuilder, datetime, decodeCursor, decodePerKeyCursor, defineCommands, defineDelete, defineList, definePut, defineQueries, defineQuery, defineUpdate, deriveEdgeWriteItems, deriveEdgeWriteItemsFor, deriveModelEdgeWriteItems, derivePrefix, detectRelationFields, edgeWrites, embedded, encodeCursor, encodePerKeyCursor, evaluateFilter, execute, executeDeclarativeTransaction, executeExplain, executeList, executeQuery, expandTransaction, field, getEdgeWrites, getImplicitKeyFields, hasMany, hasOne, hydrate, isEdgeWritesDefinition, isSelectBuilder, list, literal, loadPreparedPlan, maintainedFrom, map, max, model, number, numberSet, plan, refs, resolveKey, resolveRelations, serializeContractKey, serializeFieldValue, string, stringSet, ttl, validateDepth, validateGsiAmbiguity, whenMember };