graphddb 0.6.0 → 0.7.1
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/cdc/index.d.ts +2 -2
- package/dist/{chunk-N5NQM3SO.js → chunk-C5Q2NMRW.js} +1072 -25
- package/dist/cli.js +336 -12
- package/dist/{from-change-CFzBy7aU.d.ts → from-change-CWiXBcgi.d.ts} +1 -1
- package/dist/{index-CtJbTrfB.d.ts → index-CvS9ATKB.d.ts} +289 -104
- package/dist/index.d.ts +85 -7
- package/dist/index.js +269 -1
- package/dist/linter/index.d.ts +4 -4
- package/dist/{maintenance-view-adapter-CFeasCKo.d.ts → maintenance-view-adapter-NBTZbE8-.d.ts} +2539 -2242
- package/dist/{registry-DbqmFyab.d.ts → registry-BndKbZbg.d.ts} +1 -1
- package/dist/{relation-depth-0TiWr5OW.d.ts → relation-depth-CCGHLTOv.d.ts} +1 -1
- package/dist/spec/index.d.ts +3 -3
- package/dist/spec/index.js +13 -1
- package/dist/testing/index.d.ts +1 -1
- package/dist/transform/index.d.ts +216 -0
- package/dist/transform/index.js +982 -0
- package/docs/cqrs-contract.md +1 -1
- package/docs/design-patterns.md +9 -7
- package/docs/prepared-statements.md +232 -0
- package/docs/python-bridge.md +24 -4
- package/package.json +5 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as CdcEmulatorOptions, e as ChangeHandler, U as Unsubscribe, F as FaultSpec, g as ConcurrentRecomputeRef, c as ChangeEvent, E as EventLog, R as ReplayOptions, S as ShardId, V as ViewDefinition, m as EntityMetadata } from './maintenance-view-adapter-
|
|
1
|
+
import { C as CdcEmulatorOptions, e as ChangeHandler, U as Unsubscribe, F as FaultSpec, g as ConcurrentRecomputeRef, c as ChangeEvent, E as EventLog, R as ReplayOptions, S as ShardId, V as ViewDefinition, m as EntityMetadata } from './maintenance-view-adapter-NBTZbE8-.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* CDC emulator (issue #72). Subscribes to the core write-capture seam
|
|
@@ -1,5 +1,291 @@
|
|
|
1
|
-
import { x as
|
|
2
|
-
import { M as MetadataRegistry } from './registry-
|
|
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,
|
|
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-
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
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-
|
|
7
|
-
|
|
8
|
-
export { A as AnyModelContract, B as BuiltContracts, C as ContextOwnership,
|
|
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 };
|