graphddb 0.7.8 → 0.7.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,5 @@
1
1
  import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
2
+ import { c as Param, E as ExpressionSpec, a0 as ParamKind, Y as TransactionItemSpec } from './types-BQLzTEqh.js';
2
3
 
3
4
  /**
4
5
  * CDC emulator types (issue #72). These types are **cdc-module-owned**; core
@@ -291,138 +292,6 @@ type ResolvedKey = {
291
292
  inputFieldNames: string[];
292
293
  };
293
294
 
294
- /**
295
- * Parameter placeholders for the parameterized query / command definition DSL
296
- * (issue #41, Python-bridge Phase 0a).
297
- *
298
- * A `Param<T>` is a **branded placeholder** standing in for a value that is not
299
- * known at definition time but is supplied later (at execution, e.g. from
300
- * Python). It carries:
301
- *
302
- * - the **TypeScript value type** `T` it represents (`string`, `number`, or a
303
- * string-literal union), preserved through the IR and the inferred return
304
- * types of `defineQueries` / `defineCommands`; and
305
- * - a **runtime descriptor** (`kind` + optional `literals`) that the static
306
- * planner (#42) and the code generator read to emit `operations.json`.
307
- *
308
- * Placeholders are created with `param.string()`, `param.number()`, and
309
- * `param.literal(...)`. They are *only* legal at value positions inside a
310
- * parameterized key / changes structure passed to the `define*` entry points —
311
- * never to the live `Model.query` / `Model.putItem` runtime API, whose types remain
312
- * uncontaminated by params.
313
- */
314
- /** Brand tag preventing a plain object from structurally matching a {@link Param}. */
315
- declare const PARAM_BRAND: unique symbol;
316
- /** Runtime discriminant for a parameter placeholder. */
317
- type ParamKind = 'string' | 'number' | 'literal' | 'array';
318
- /**
319
- * A branded parameter placeholder representing a value of TypeScript type `T`
320
- * that is bound at execution time rather than definition time.
321
- *
322
- * The brand (`[PARAM_BRAND]: T`) keeps `Param<string>` and `Param<number>`
323
- * distinct and prevents a bare value from being mistaken for a placeholder.
324
- *
325
- * @typeParam T - The value type this placeholder stands in for.
326
- */
327
- interface Param<out T> {
328
- /** @internal Type brand carrying the represented value type. */
329
- readonly [PARAM_BRAND]: T;
330
- /** Runtime discriminant: `'string'` | `'number'` | `'literal'` | `'array'`. */
331
- readonly kind: ParamKind;
332
- /**
333
- * For `param.literal(...)`, the allowed literal values (preserved at runtime
334
- * for the generator). `undefined` for `string` / `number`.
335
- */
336
- readonly literals?: readonly T[];
337
- /**
338
- * For `param.array({...})`, the descriptor of each element's fields. Lets the
339
- * transaction planner (#46) type `forEach` element references and emit the
340
- * `{item.<field>}` templates. `undefined` for scalar params.
341
- */
342
- readonly element?: Readonly<Record<string, Param<unknown>>>;
343
- /**
344
- * Optional human-readable description of the parameter (issue #154), supplied
345
- * via `param.string({ description })` etc. Pure documentation metadata — it does
346
- * NOT affect the runtime descriptor (`kind` / `literals`) the planner reads for
347
- * execution. When present it is propagated to the param's {@link
348
- * import('./ir.js').ParamDescriptor} and then to the serialized
349
- * {@link import('../spec/types.js').ParamSpec} in `operations.json`. Absent →
350
- * unchanged output (backward compatible).
351
- */
352
- readonly description?: string;
353
- }
354
- /** A `Param` whose represented value type is `string`. */
355
- type StringParam = Param<string>;
356
- /** A `Param` whose represented value type is `number`. */
357
- type NumberParam = Param<number>;
358
- /** A `Param` whose represented value type is the literal union `L`. */
359
- type LiteralParam<L extends string | number> = Param<L>;
360
- /** The element-field descriptor shape accepted by {@link param.array}. */
361
- type ArrayElementShape = Record<string, Param<unknown>>;
362
- /**
363
- * The TypeScript element type implied by an {@link ArrayElementShape} `E`: each
364
- * field carries the value type its placeholder represents.
365
- */
366
- type ElementOf<E extends ArrayElementShape> = {
367
- [K in keyof E]: E[K] extends Param<infer V> ? V : never;
368
- };
369
- /** A `Param` standing in for an **array** whose elements have shape `E`. */
370
- type ArrayParam<E extends ArrayElementShape> = Param<ElementOf<E>[]> & {
371
- readonly element: E;
372
- };
373
- /** Allowed scalar value types a placeholder may stand in for. */
374
- type ParamValue = string | number;
375
- /**
376
- * Options accepted by the placeholder factories (issue #154). Currently carries
377
- * only the optional human-readable {@link Param.description} — pure documentation
378
- * metadata that does not affect the runtime descriptor. The object form is
379
- * additive: `param.string()` (no options) is unchanged.
380
- */
381
- interface ParamOptions {
382
- /** Optional human-readable description, propagated to `operations.json`. */
383
- readonly description?: string;
384
- }
385
- /**
386
- * Placeholder factory. Each call returns a branded {@link Param} carrying both
387
- * the TypeScript value type and a runtime descriptor. Each scalar factory accepts
388
- * an optional {@link ParamOptions} (issue #154) carrying a `description` — pure
389
- * documentation propagated to `operations.json`; the no-argument call is unchanged.
390
- */
391
- declare const param: {
392
- /** A placeholder for a `string` value. */
393
- readonly string: (options?: ParamOptions) => StringParam;
394
- /** A placeholder for a `number` value. */
395
- readonly number: (options?: ParamOptions) => NumberParam;
396
- /**
397
- * A placeholder constrained to one of the given literal values. The value
398
- * type of the resulting {@link Param} is the **union of the literals**, so it
399
- * is preserved precisely in the IR and the inferred definition types. A final
400
- * plain-object argument is read as {@link ParamOptions} (a `description`),
401
- * distinguished from the `string` / `number` literal values.
402
- *
403
- * @example
404
- * ```ts
405
- * param.literal('active', 'disabled'); // Param<'active' | 'disabled'>
406
- * param.literal('active', 'disabled', { description: 'Account state.' });
407
- * ```
408
- */
409
- readonly literal: <const L extends readonly [ParamValue, ...ParamValue[]]>(...valuesAndOptions: [...L] | [...L, ParamOptions]) => LiteralParam<L[number]>;
410
- /**
411
- * A placeholder for an **array** parameter whose elements have the given field
412
- * shape. Used by `defineTransaction`'s `tx.forEach(p.<arrayParam>, …)` to bind
413
- * each element's fields to `{item.<field>}` templates.
414
- *
415
- * @example
416
- * ```ts
417
- * param.array({ userId: param.string(), role: param.string() });
418
- * // Param<{ userId: string; role: string }[]>
419
- * ```
420
- */
421
- readonly array: <const E extends ArrayElementShape>(element: E, options?: ParamOptions) => ArrayParam<E>;
422
- };
423
- /** Runtime type guard: is `value` a parameter placeholder? */
424
- declare function isParam(value: unknown): value is Param<unknown>;
425
-
426
295
  /**
427
296
  * Internal brand identifying a {@link RawCondition} produced by {@link cond}.
428
297
  */
@@ -1385,10 +1254,12 @@ interface CtxBase {
1385
1254
  /**
1386
1255
  * The logical read kinds an {@link ReadRequestCtx} may carry (R1 / R4 / R5).
1387
1256
  *
1388
- * Only the kinds the runtime actually emits are advertised. A `query` route in
1389
- * the read envelope delegates to {@link import('../operations/query.js').executeQuery}
1390
- * (kind `'query'`), a `list` route to {@link import('../operations/list.js').executeList}
1391
- * (kind `'list'`), so there is no distinct `'envelopeRoute'` kind. `batchGet`
1257
+ * Only the kinds the runtime actually emits are advertised. Every read surface
1258
+ * (the ad-hoc `Model.query` / `Model.list`, a read-envelope route, a prepared
1259
+ * read) lowers to the unified internal read plan and executes through
1260
+ * {@link import('../runtime/read-plan.js').executeCompiledReadRoute} (issue
1261
+ * #249), which runs the single-item core (kind `'query'`) or the partition core
1262
+ * (kind `'list'`) — so there is no distinct `'envelopeRoute'` kind. `batchGet`
1392
1263
  * (`DDBModel.batchGet`, the public multi-key read primitive) fires request-level
1393
1264
  * hooks since issue #142 — its R1/R4/R5 carry kind `'batchGet'`; each underlying
1394
1265
  * physical `BatchGetItem` op fires R2/R3/R5 with op kind `'BatchGetItem'`.
@@ -1950,6 +1821,8 @@ type ConditionInput<X = never> = {
1950
1821
  readonly attributeExists: string;
1951
1822
  } | {
1952
1823
  readonly attributeNotExists: string;
1824
+ } | {
1825
+ readonly scpExpr: ExpressionSpec;
1953
1826
  } | RawCondition | ConditionTree<X>;
1954
1827
  /** A recursive declarative condition tree (field clauses + logical groups). */
1955
1828
  interface ConditionTree<X = never> {
@@ -2903,6 +2776,13 @@ interface MutationEntityRef {
2903
2776
  * `.<field>` access (when used as an alias root). Any other access / coercion
2904
2777
  * throws — the binding stays declarative (only a direct `$.field` / `$.alias.field`
2905
2778
  * reference or a literal is representable, never a transform).
2779
+ *
2780
+ * **Input Port 統一 (issue #264)**: this proxy is one of the three authoring
2781
+ * spellings of the SAME Input Port reference model — see the unification note
2782
+ * on {@link import('./transaction.js').ParamProxy} (`defineTransaction`'s
2783
+ * `p.*` proxy is the model; `{<field>}` templates and `{ref:["input","<field>"]}`
2784
+ * expression refs are the two serialized mirrors of one declared-input
2785
+ * namespace). Behavior here is unchanged in 0.7.x (interop kept).
2906
2786
  */
2907
2787
  type MutationInputProxy = Record<string, MutationInputRef>;
2908
2788
  declare const FRAGMENT_BRAND: unique symbol;
@@ -4243,923 +4123,6 @@ interface MaintenanceGraph {
4243
4123
  */
4244
4124
  declare function buildMaintenanceGraph(registry?: ReadonlyMap<Function, EntityMetadata>, views?: readonly ViewDefinition[]): MaintenanceGraph;
4245
4125
 
4246
- /**
4247
- * Serializable static operation specs and manifest (issue #42, Python-bridge
4248
- * Phase 0b).
4249
- *
4250
- * Everything in this module is **JSON-serializable** by construction (only
4251
- * strings / numbers / booleans / arrays / plain objects — no functions, classes,
4252
- * `Date`, `Set`, or `undefined`-valued fields are emitted). These types mirror
4253
- * the `graphddb_manifest.json` / `graphddb_operations.json` shapes sketched in
4254
- * `docs/python-bridge.md`. The generator (#43) writes them to disk; the
4255
- * Python runtime (#44+) interprets them.
4256
- *
4257
- * ## Templates and placeholders
4258
- *
4259
- * Key-condition / range / item / change *values* are **template strings** with
4260
- * two placeholder forms:
4261
- *
4262
- * - `{paramName}` — bound from the caller-supplied params at execution time.
4263
- * - `{result.sourceField}` — bound from a field of the **prior** operation's
4264
- * result item(s), used to chain relation operations.
4265
- *
4266
- * A value with no `{...}` is a literal (e.g. a fixed sort-key discriminator
4267
- * `PROFILE`).
4268
- */
4269
-
4270
- /**
4271
- * The schema version emitted in every manifest / operations document.
4272
- *
4273
- * `1.1` (issue #208, B案): the operation IR gained the **list fan-out binding
4274
- * form** ({@link SourceListSpec} on a `BatchGetItem` relation op), lifting the
4275
- * #197 `refs` loud-reject. The op vocabulary (the physical DynamoDB API surface)
4276
- * is unchanged — only the dataflow (source→key) binding grammar grew. Purely
4277
- * additive: every `1.0` document is a valid `1.1` document, and a document that
4278
- * uses no `refs` relation serializes byte-identically apart from this version.
4279
- */
4280
- declare const SPEC_VERSION: "1.1";
4281
- /** Field type as carried in the manifest (derived from the DynamoDB type). */
4282
- type ManifestFieldType = 'string' | 'number' | 'boolean' | 'binary' | 'stringSet' | 'numberSet' | 'list' | 'map';
4283
- interface ManifestField {
4284
- readonly type: ManifestFieldType;
4285
- /**
4286
- * Semantic format for `string` fields that carry a serialized temporal value.
4287
- * `datetime` → ISO 8601 instant, `date` → `YYYY-MM-DD`. Absent for plain
4288
- * fields. The Python runtime uses this to restore `datetime` on hydration,
4289
- * mirroring the TS hydrator's `format`-driven `Date` reconstruction.
4290
- */
4291
- readonly format?: 'datetime' | 'date';
4292
- /**
4293
- * Optional human-readable description of the field (issue #154), from a field
4294
- * decorator option (`@string({ description })`). Pure documentation — absent
4295
- * unless declared, so a field with no description serializes byte-identically
4296
- * to the pre-#154 manifest. Surfaces as a field comment in the generated Python.
4297
- */
4298
- readonly description?: string;
4299
- }
4300
- /** A key (PK or GSI) template descriptor in the manifest. */
4301
- interface ManifestKey {
4302
- /** Input field names the key is composed from (in declaration order). */
4303
- readonly inputFields: readonly string[];
4304
- /** Template for the partition-key value, e.g. `EMAIL#{email}`. */
4305
- readonly pkTemplate: string;
4306
- /** Template for the sort-key value, or `null` when the key has no sort key. */
4307
- readonly skTemplate: string | null;
4308
- }
4309
- interface ManifestGsi extends ManifestKey {
4310
- readonly indexName: string;
4311
- readonly unique: boolean;
4312
- /**
4313
- * Optional human-readable description of the index (issue #166, follow-up of #154),
4314
- * from `gsi(name, key, { description })`. Pure documentation — absent unless declared,
4315
- * so a GSI with no description serializes byte-identically to the pre-#166 manifest.
4316
- * The Python codegen surfaces it as the docstring of a generated query method that
4317
- * reads through this index.
4318
- */
4319
- readonly description?: string;
4320
- }
4321
- interface ManifestRelation {
4322
- readonly type: 'hasMany' | 'hasOne' | 'belongsTo' | 'refs';
4323
- /** Target entity (model class) name. */
4324
- readonly target: string;
4325
- /** target field → source field (on this entity). */
4326
- readonly keyBinding: Readonly<Record<string, string>>;
4327
- /**
4328
- * List-valued source descriptor for a `refs` relation (issue #197). Present IFF
4329
- * `type === 'refs'`: `from` is the parent LIST attribute holding the inline
4330
- * reference elements (e.g. `'tagRefs'`), `key` the field read off each element
4331
- * (e.g. `'tagId'`). Absent for every scalar-keyed relation (byte-identical to
4332
- * the pre-#197 manifest). Carried so a manifest consumer can reconstruct where a
4333
- * `refs` relation's BatchGet keys come from.
4334
- */
4335
- readonly refs?: Readonly<{
4336
- from: string;
4337
- key: string;
4338
- }>;
4339
- /**
4340
- * Optional human-readable description of the relation (issue #166, follow-up of
4341
- * #154), from `@hasMany/@belongsTo/@hasOne(..., { description })`. Pure documentation
4342
- * — absent unless declared, so a relation with no description serializes
4343
- * byte-identically to the pre-#166 manifest. The Python codegen surfaces it as a
4344
- * trailing `# …` comment on the relation's field in the generated result type.
4345
- */
4346
- readonly description?: string;
4347
- }
4348
- interface ManifestEntity {
4349
- /** Declared (logical) table name. */
4350
- readonly table: string;
4351
- /** Physical table name (after `TableMapping` resolution). */
4352
- readonly physicalName: string;
4353
- /** PK prefix, e.g. `USER#`. */
4354
- readonly prefix: string;
4355
- readonly fields: Readonly<Record<string, ManifestField>>;
4356
- /** Primary key, or `null` when the entity has none. */
4357
- readonly key: ManifestKey | null;
4358
- readonly gsis: readonly ManifestGsi[];
4359
- readonly relations: Readonly<Record<string, ManifestRelation>>;
4360
- /**
4361
- * Optional human-readable description of the entity (issue #154), from
4362
- * `@model({ description })`. Pure documentation — absent unless declared, so an
4363
- * entity with no description serializes byte-identically to the pre-#154
4364
- * manifest. Surfaces as the generated Python class docstring.
4365
- */
4366
- readonly description?: string;
4367
- /**
4368
- * The physical attribute name of the model's DynamoDB **Time-To-Live** field,
4369
- * when one is declared via `@ttl` (issue #172, Epic #167 — CFn generator C4).
4370
- * Unlike the maintenance/stream signals (a maintenance-IR concern kept OFF the
4371
- * manifest), TTL is a **physical schema** fact, and the CloudFormation emitter
4372
- * consumes the manifest — so the TTL attribute name flows here and the emitter
4373
- * renders `TimeToLiveSpecification { AttributeName: <this>, Enabled: true }`. The
4374
- * attribute is deliberately NOT added to the table's key `AttributeDefinitions`
4375
- * (that list holds ONLY key/index attributes; `TimeToLiveSpecification` legitimately
4376
- * names a non-key attribute). **Absent** when the model declares no `@ttl`, so a
4377
- * TTL-free model serializes byte-identically to the pre-#172 manifest (backward
4378
- * compatible). DynamoDB permits exactly one TTL attribute per physical table; the
4379
- * single-per-table rule is enforced at manifest build.
4380
- */
4381
- readonly ttlAttribute?: string;
4382
- }
4383
- interface ManifestTable {
4384
- readonly physicalName: string;
4385
- }
4386
- interface Manifest {
4387
- readonly version: typeof SPEC_VERSION;
4388
- readonly tables: Readonly<Record<string, ManifestTable>>;
4389
- readonly entities: Readonly<Record<string, ManifestEntity>>;
4390
- }
4391
- interface ParamSpec {
4392
- readonly type: ParamKind;
4393
- readonly required: boolean;
4394
- /** Allowed literal values for `literal` params; omitted otherwise. */
4395
- readonly literals?: readonly (string | number)[];
4396
- /**
4397
- * For an `array` param (transaction `forEach` source), the per-element field
4398
- * descriptors (field name → element param spec). Omitted for scalar params.
4399
- */
4400
- readonly element?: Readonly<Record<string, ParamSpec>>;
4401
- /**
4402
- * Optional human-readable description of the parameter (issue #154), from a
4403
- * `param.*({ description })` placeholder. Pure documentation — absent unless
4404
- * declared, so a param with no description serializes byte-identically to the
4405
- * pre-#154 spec. The Python runtime never reads it for execution.
4406
- */
4407
- readonly description?: string;
4408
- }
4409
- /** A `begins_with` range condition on a sort key (templated value). */
4410
- interface RangeConditionSpec {
4411
- readonly operator: 'begins_with';
4412
- readonly key: string;
4413
- /** Template value, e.g. `GROUP#` or `GROUP#{result.groupId}`. */
4414
- readonly value: string;
4415
- }
4416
- /** Server-side declarative filter, carried verbatim for the runtime to compile. */
4417
- interface FilterSpec {
4418
- /** The declarative {@link FilterInput} tree (JSON-safe). */
4419
- readonly declarative: unknown;
4420
- }
4421
- type ReadOperationType = 'Query' | 'GetItem' | 'BatchGetItem';
4422
- /**
4423
- * A single static read operation. Relation chains are expressed as multiple
4424
- * operations whose `resultPath` / templated key conditions wire them together.
4425
- */
4426
- interface OperationSpec {
4427
- readonly type: ReadOperationType;
4428
- readonly tableName: string;
4429
- readonly indexName?: string;
4430
- /**
4431
- * Key condition: attribute name → template value. For a `BatchGetItem` this is
4432
- * the per-key shape (one key per resolved source item at runtime).
4433
- */
4434
- readonly keyCondition: Readonly<Record<string, string>>;
4435
- readonly rangeCondition?: RangeConditionSpec;
4436
- /** Projected fields (entity field names). */
4437
- readonly projection: readonly string[];
4438
- readonly limit?: number;
4439
- readonly filter?: FilterSpec;
4440
- /**
4441
- * Where the result of this operation is placed in the assembled result.
4442
- * `$` is the root; `$.groups.items` a relation connection's items, etc.
4443
- */
4444
- readonly resultPath: string;
4445
- /**
4446
- * For relation operations: the source field on the prior result whose value(s)
4447
- * drive this operation's `{result.*}` placeholders. Absent on the root op.
4448
- */
4449
- readonly sourceField?: string;
4450
- /**
4451
- * The **list fan-out binding form** (issue #208, B案 — the shared-IR
4452
- * generalization that lifted the #197 `refs` loud-reject). Present only on a
4453
- * `BatchGetItem` relation operation that resolves a `refs` relation: instead of
4454
- * reading ONE scalar `parent[sourceField]`, the runtime reads the parent **list
4455
- * attribute** {@link SourceListSpec.from} and binds `{result.<sourceField>}`
4456
- * once per element — `element[key]` for an object element, the element itself
4457
- * for a bare scalar — skipping null/undefined refs. All element keys across all
4458
- * parents fan into ONE deduped `BatchGetItem` (the existing chunk/retry
4459
- * machinery), and the operation's `resultPath` (`…<prop>.items`) receives a
4460
- * connection `{ items, cursor: null }` whose items are the resolved child
4461
- * bodies in **first-seen element order**, deduped, with missing bodies dropped
4462
- * — byte-matching the TS in-process `fetchRefsList` semantics. Absent on every
4463
- * scalar-bound relation op (a pre-#208 document is byte-identical).
4464
- */
4465
- readonly sourceList?: SourceListSpec;
4466
- }
4467
- /**
4468
- * The list-valued source descriptor of a fan-out `BatchGetItem` operation (issue
4469
- * #208 B案; the operation-IR mirror of the manifest's `ManifestRelation.refs`).
4470
- */
4471
- interface SourceListSpec {
4472
- /** The parent LIST attribute holding the inline reference elements (e.g. `tagRefs`). */
4473
- readonly from: string;
4474
- /**
4475
- * The field read off each element (e.g. `tagId`). Always equals the operation's
4476
- * `sourceField` (the `{result.<sourceField>}` token name); carried explicitly so
4477
- * the op is self-describing.
4478
- */
4479
- readonly key: string;
4480
- /**
4481
- * `true` when the parent list attribute was NOT selected by the query and was
4482
- * projected onto the parent operation **solely** to drive this fan-out. The
4483
- * runtime must then delete `from` from every parent node after ALL relation
4484
- * operations are applied — mirroring the TS hydrator, which projects implicit
4485
- * relation-source fields but strips them from the assembled result. Absent when
4486
- * the query's select projects the attribute itself (it stays in the result).
4487
- */
4488
- readonly implicit?: boolean;
4489
- }
4490
- /**
4491
- * The **execution plan** for a multi-operation read (issue #70a). It is the
4492
- * Single Source of Truth for *how* a query's {@link OperationSpec}[] is staged:
4493
- * which operations are independent (may run concurrently) and which must wait for
4494
- * a prior operation's result. Every runtime that honors it produces identical
4495
- * effects with identical concurrency discipline — the staging is **serialized,
4496
- * not re-derived** (cf. the contract decided-facts discipline).
4497
- *
4498
- * - `groups` is an ordered list of **stages**; each stage is a list of indices
4499
- * into the query's `operations[]`. Operations **within** a stage are mutually
4500
- * independent and may be issued concurrently; stages run **in order** because a
4501
- * later stage reads a `{result.*}` value produced by an earlier one. Stage 0 is
4502
- * always `[0]` (the root). Every operation index appears in exactly one stage,
4503
- * and the stages are a topological layering of the result-dependency graph.
4504
- * - `concurrency` is the declared in-flight bound a runtime applies **within**
4505
- * each stage (the shared {@link RELATION_TRAVERSAL_CONCURRENCY} = 16): at most
4506
- * this many operations of a stage are issued at once.
4507
- *
4508
- * ## Derivation (see `buildReadOperations` / `deriveExecutionPlan`)
4509
- *
4510
- * The planner emits `operations[]` in a deterministic pre-order: the root at
4511
- * index 0, then each relation child immediately followed by its own descendants.
4512
- * A child's key templates reference `{result.<sourceField>}` of the **operation
4513
- * whose `resultPath` is the child's parent path** — that producer is the child's
4514
- * sole dependency. The stage of an operation is therefore `1 + stage(parent)`:
4515
- * the root is stage 0; sibling relations that share a parent path land in the
4516
- * **same** stage (no inter-`{result.*}` dependency between siblings, so they are
4517
- * independent and concurrency-eligible); a grandchild that reads its parent's
4518
- * `{result.*}` lands one stage later. This mirrors exactly the level-by-level
4519
- * fan-out the TS relation runtime performs at runtime (`resolveRelations` issues
4520
- * sibling relations together under the same bound) — #70a only *records* it.
4521
- *
4522
- * Absent on a single-operation spec and on specs produced before #70a; a consumer
4523
- * without a plan falls back to one-operation-per-stage **sequential** execution
4524
- * (the pre-#70 behavior), so an absent plan never changes results.
4525
- */
4526
- interface ExecutionPlanSpec {
4527
- /** Ordered stages; each stage is indices into `operations[]` (stage 0 = `[0]`). */
4528
- readonly groups: readonly (readonly number[])[];
4529
- /** The declared in-flight bound applied within each stage (16). */
4530
- readonly concurrency: number;
4531
- }
4532
- /** A query (read) definition's full execution spec. */
4533
- interface QuerySpec {
4534
- readonly params: Readonly<Record<string, ParamSpec>>;
4535
- readonly operations: readonly OperationSpec[];
4536
- /**
4537
- * Result cardinality of the **root** (`$`) operation, derived from the
4538
- * definition kind: `'one'` for `defineQuery` (a single entity object, with any
4539
- * relations attached directly), `'many'` for `defineList` (a `{ items, cursor }`
4540
- * connection). The relation runtime (#45) uses this to shape the root result:
4541
- * a `'one'` Query root takes the first matched item rather than returning a
4542
- * connection. Absent in specs produced before #45; consumers should treat an
4543
- * absent value as `'many'` for a `Query`/`BatchGetItem` root and `'one'` for a
4544
- * `GetItem` root (the pre-#45 behavior).
4545
- */
4546
- readonly cardinality?: 'one' | 'many';
4547
- /**
4548
- * The staged execution plan (issue #70a): which {@link operations} are
4549
- * independent (concurrency-eligible) vs. result-dependent. Present only when the
4550
- * query has more than one operation (a relation chain); a single-operation read
4551
- * needs no plan. See {@link ExecutionPlanSpec} for the derivation and the
4552
- * backward-compatible (plan-absent → sequential) fallback.
4553
- */
4554
- readonly executionPlan?: ExecutionPlanSpec;
4555
- /**
4556
- * Optional human-readable description of the query (issue #154), from
4557
- * `defineQuery(..., { description })`. Pure documentation — absent unless
4558
- * declared, so a query with no description serializes byte-identically to the
4559
- * pre-#154 spec. Surfaces as the generated Python repository-method docstring.
4560
- */
4561
- readonly description?: string;
4562
- }
4563
- type WriteOperationType = 'PutItem' | 'UpdateItem' | 'DeleteItem';
4564
- /**
4565
- * A condition expression on a write, as a JSON-serializable spec (issues #46,
4566
- * #81). The supported subset:
4567
- *
4568
- * - `{ kind: 'notExists' }` → `attribute_not_exists(PK)` (legacy whole-row guard).
4569
- * - `{ kind: 'attributeExists'; field }` → `attribute_exists(<field>)` — the named
4570
- * attribute (any field, incl. PK/SK) must be present. The foundation for
4571
- * referential-integrity derivation.
4572
- * - `{ kind: 'attributeNotExists'; field }` → `attribute_not_exists(<field>)` — the
4573
- * named attribute must be absent (field-level uniqueness / first-write guard).
4574
- * - `{ kind: 'equals'; fields }` → `#f = :v AND …` field equality (each value a
4575
- * `{param}` / literal template).
4576
- * - `{ kind: 'expr'; declarative }` → the full declarative operator tree (issue
4577
- * #114-A): comparison (`gt`/`ge`/`lt`/`le`/`ne`), `between`, `in`,
4578
- * `begins_with`/`contains`/`notContains`, `attributeType`, and the logical
4579
- * `and`/`or`/`not` groups, mirroring the read-side {@link FilterSpec}. The tree
4580
- * is JSON-safe: each leaf value is either a native literal (string / number /
4581
- * boolean) or a {@link ConditionParamLeaf} (`{ $param }`) marking a caller
4582
- * param bound at execution time. The runtime resolves the param leaves against
4583
- * the caller params, then compiles the tree to a DynamoDB `ConditionExpression`
4584
- * with the SAME mechanics the filter compiler uses (so TS and Python emit an
4585
- * identical expression / semantics).
4586
- */
4587
- type ConditionSpec = {
4588
- readonly kind: 'notExists';
4589
- } | {
4590
- readonly kind: 'attributeExists';
4591
- readonly field: string;
4592
- } | {
4593
- readonly kind: 'attributeNotExists';
4594
- readonly field: string;
4595
- } | {
4596
- readonly kind: 'equals';
4597
- readonly fields: Readonly<Record<string, string>>;
4598
- } | {
4599
- readonly kind: 'expr';
4600
- readonly declarative: unknown;
4601
- } | {
4602
- /**
4603
- * A raw DynamoDB condition produced by the `cond` escape hatch (issue
4604
- * #114-B), for write conditions that the declarative operator subset
4605
- * cannot express. It is **pre-compiled and deterministic**: the
4606
- * `expression` is a finished DynamoDB `ConditionExpression` whose name
4607
- * placeholders are stable `#cr_<field>` aliases (reused per distinct
4608
- * column) and whose value placeholders are sequential `:cr0`, `:cr1`, …
4609
- * (assigned in template order), so the serialized golden is stable. The
4610
- * names map binds each `#cr_<field>` alias to its entity field; the values
4611
- * map binds each `:crN` alias to either a native literal (an embedded
4612
- * `cond` value — in-process the concrete value) or a {@link ConditionParamLeaf}
4613
- * (`{ $param }`) marker bound from a caller param at execution time (the
4614
- * public-contract slot). The runtime substitutes the param leaves, then
4615
- * attaches `expression` / `names` / serialized `values` to the write —
4616
- * TS and Python build the identical DynamoDB expression.
4617
- */
4618
- readonly kind: 'raw';
4619
- readonly expression: string;
4620
- readonly names: Readonly<Record<string, string>>;
4621
- readonly values: Readonly<Record<string, unknown>>;
4622
- };
4623
- interface CommandSpec {
4624
- readonly type: WriteOperationType;
4625
- readonly tableName: string;
4626
- readonly entity: string;
4627
- readonly params: Readonly<Record<string, ParamSpec>>;
4628
- /**
4629
- * Key condition for `UpdateItem` / `DeleteItem` (attribute name → template).
4630
- * Absent for `PutItem` (the whole item is built from `item`).
4631
- */
4632
- readonly keyCondition?: Readonly<Record<string, string>>;
4633
- /** The full item template for `PutItem` (field name → template / literal). */
4634
- readonly item?: Readonly<Record<string, string>>;
4635
- /** Field-level changes for `UpdateItem` (field name → template / literal). */
4636
- readonly changes?: Readonly<Record<string, string>>;
4637
- /** Optional write condition (subset). */
4638
- readonly condition?: ConditionSpec;
4639
- /**
4640
- * Optional human-readable description of the command (issue #154), from
4641
- * `definePut`/`defineUpdate`/`defineDelete(..., { description })`. Pure
4642
- * documentation — absent unless declared, so a command with no description
4643
- * serializes byte-identically to the pre-#154 spec. Surfaces as the generated
4644
- * Python repository-method docstring.
4645
- */
4646
- readonly description?: string;
4647
- }
4648
- /**
4649
- * A declarative `when` guard on a transaction item (issue #46). Compares a
4650
- * templated left-hand value against a templated right-hand value; the item is
4651
- * skipped when the comparison does not hold. Both values are template strings
4652
- * (`{param}` / `{item.<field>}` / literal), resolved by the runtime before the
4653
- * comparison. The runtime compares the resolved **string** values.
4654
- */
4655
- interface WhenSpec {
4656
- readonly op: 'eq' | 'ne';
4657
- /** Templated left-hand value (typically an `{item.<field>}` or `{param}`). */
4658
- readonly left: string;
4659
- /** Templated right-hand value (literal or another reference). */
4660
- readonly right: string;
4661
- }
4662
- /**
4663
- * The kind of a transaction item. The three write kinds (`Put` / `Update` /
4664
- * `Delete`) mutate an item; `ConditionCheck` (issue #81) is a **read-only
4665
- * assertion** on another item — it asserts a {@link ConditionSpec} holds for the
4666
- * keyed row without modifying it, and its failure cancels the **whole**
4667
- * `TransactWriteItems` atomically. It is the foundation for referential-integrity
4668
- * derivation (proposal: `requires <Entity> exists` → a `ConditionCheck` with
4669
- * `attribute_exists`).
4670
- */
4671
- type TransactionItemType = 'Put' | 'Update' | 'Delete' | 'ConditionCheck';
4672
- /**
4673
- * A value leaf of a transaction `item` / `changes` / `add` map (issue #245).
4674
- *
4675
- * - a **string** carries a template: a `{param}` / `{item.field}` placeholder, a
4676
- * composite (`PREFIX#{param}`), or a plain string literal — resolved by the
4677
- * runtimes' template machinery (a whole-placeholder string keeps the bound
4678
- * param's *type*, a composite / plain string resolves to a string);
4679
- * - a **number** / **boolean** carries a *typed literal* verbatim, so a numeric
4680
- * literal in a `put` item / `update` changes (`version: 0`) survives to DynamoDB
4681
- * as an `N` / `BOOL` instead of being stringified to an `S` (the pre-#245 bug).
4682
- *
4683
- * A `Date` literal is serialized to its ISO-8601 **string** at build time (a
4684
- * `@datetime` / `@date` field is stored as `S`), so it stays a string leaf.
4685
- */
4686
- type TransactionValueLeaf = string | number | boolean;
4687
- /**
4688
- * A single templated item in a transaction. When `forEach` is present, the item
4689
- * is expanded **once per element** of the named array param, with each element's
4690
- * fields bound to the item's `{item.<field>}` placeholders.
4691
- *
4692
- * Field presence by `type`:
4693
- *
4694
- * | type | item | keyCondition | changes | add | condition |
4695
- * |----------------|------|--------------|---------|-----|--------------------------|
4696
- * | `Put` | ✓ | — | — | — | optional |
4697
- * | `Update` | — | ✓ | ✓ / — | ✓ / — | optional |
4698
- * | `Delete` | — | ✓ | — | — | optional |
4699
- * | `ConditionCheck` | — | ✓ | — | — | **required** (the assert) |
4700
- *
4701
- * An `Update` carries `changes` (a `SET` of named fields) and/or `add` (an atomic
4702
- * `ADD` of named numeric fields, issue #85) — at least one of the two. The two are
4703
- * distinct DynamoDB update actions: `SET #f = :v` **overwrites**, while
4704
- * `ADD #f :delta` **atomically increments** without a read (concurrency-safe), so
4705
- * a derived counter (`User.postCount += 1`) MUST be an `add`, never a `changes`
4706
- * `SET` (which would clobber a concurrent increment).
4707
- */
4708
- interface TransactionItemSpec {
4709
- readonly type: TransactionItemType;
4710
- readonly tableName: string;
4711
- readonly entity: string;
4712
- /**
4713
- * Put: the full item template (field → template / typed literal). A string
4714
- * value is a template ({@link TransactionValueLeaf}); a `number` / `boolean` is
4715
- * a typed literal carried verbatim (issue #245).
4716
- */
4717
- readonly item?: Readonly<Record<string, TransactionValueLeaf>>;
4718
- /** Update / Delete / ConditionCheck: the key template (attribute → template). */
4719
- readonly keyCondition?: Readonly<Record<string, string>>;
4720
- /**
4721
- * Update: field-level `SET` change templates (overwrite). A string value is a
4722
- * template; a `number` / `boolean` is a typed literal carried verbatim (#245).
4723
- */
4724
- readonly changes?: Readonly<Record<string, TransactionValueLeaf>>;
4725
- /**
4726
- * Update: field-level atomic `ADD` deltas (issue #85, derived counters). Each
4727
- * value is a numeric template (`{param}` / a literal number string) or a typed
4728
- * numeric literal (issue #245); the runtime applies `ADD #field :delta`, an
4729
- * atomic increment that needs no prior read and is safe under concurrency. A
4730
- * negative delta decrements (e.g. `-1` on a remove).
4731
- */
4732
- readonly add?: Readonly<Record<string, TransactionValueLeaf>>;
4733
- /**
4734
- * The write / assertion condition (subset). Optional on `Put` / `Update` /
4735
- * `Delete`; **required** on a `ConditionCheck` (the assertion it makes).
4736
- */
4737
- readonly condition?: ConditionSpec;
4738
- /** Optional declarative guard; the item is skipped when it does not hold. */
4739
- readonly when?: WhenSpec;
4740
- /** When present, expand this item once per element of the named array param. */
4741
- readonly forEach?: {
4742
- readonly source: string;
4743
- };
4744
- /**
4745
- * Marks a **raw marker-row** write (issue #86 uniqueness guard): the row is NOT a
4746
- * modeled entity, so its primary key is carried **literally** rather than derived
4747
- * from manifest metadata. When `true`:
4748
- *
4749
- * - a `Put` writes its `item` record **verbatim** as the stored item — the `item`
4750
- * already carries the synthetic `PK` / `SK` templates (`UNIQUE#…`), so the
4751
- * runtimes do NOT prepend a model prefix or compute GSI attributes;
4752
- * - a `Delete` uses its `keyCondition` (the `PK` / `SK` templates) as the row Key
4753
- * verbatim.
4754
- *
4755
- * The companion {@link entity} is the {@link MARKER_ROW_ENTITY} sentinel (there is
4756
- * no manifest entity to resolve). Absent / `false` on every modeled write (a base
4757
- * entity / edge / counter / ConditionCheck item), so those paths are unchanged.
4758
- */
4759
- readonly literalKey?: boolean;
4760
- /**
4761
- * A **relation-side maintenance write** (Epic #118, issue #129 — the JSON-SSoT /
4762
- * Python mirror of the TS in-process `renderMaintainWriteItem`). Present ONLY on an
4763
- * `Update` item that materializes a maintained access path: a projected
4764
- * {@link DerivedMaintainWrite} of a just-written source row into a SEPARATE owner
4765
- * (destination) row, in the SAME atomic transaction as the source write.
4766
- *
4767
- * The item's {@link keyCondition} carries the owner row's key templates (bound from
4768
- * the source payload — `{sourceInputField}`), so the same key derivation / collapse
4769
- * signature the other `Update` items use applies unchanged. This `maintain` payload
4770
- * carries the projection transform IR (`identity` / `preview`) the runtimes apply
4771
- * IDENTICALLY when rendering the `SET … = :v` (snapshot) / `list_append(…)`
4772
- * (collection) `UpdateExpression`, so the maintained row is byte-consistent across
4773
- * TS and Python. The `changes` / `add` fields are NOT used when this is present.
4774
- */
4775
- readonly maintain?: MaintainItemSpec;
4776
- }
4777
- /**
4778
- * The transform op applied to one projected maintenance attribute (Epic #118).
4779
- * Mirrors `ProjectionTransformOp` from `src/define/entity-writes.ts`: `identity`
4780
- * copies the source value through unchanged; `preview` keeps the first `n`
4781
- * characters of (the string form of) the source value. The runtimes apply this
4782
- * IDENTICALLY so the maintained row is byte-consistent.
4783
- */
4784
- type MaintainProjectionOp = 'identity' | 'preview';
4785
- /**
4786
- * One projected maintenance attribute: the source value is read from the mutation
4787
- * input field {@link inputField} (payload 同梱 — the just-written source row image),
4788
- * then run through {@link op} with {@link args} (e.g. `preview`'s length bound).
4789
- */
4790
- interface MaintainProjectionEntry {
4791
- /** The transform op applied to the source value (`identity` / `preview`). */
4792
- readonly op: MaintainProjectionOp;
4793
- /** The op's positional arguments (`[n]` for `preview`; empty for `identity`). */
4794
- readonly args: readonly unknown[];
4795
- /** The mutation-input field the source value is read from (`{inputField}`). */
4796
- readonly inputField: string;
4797
- }
4798
- /**
4799
- * The bounded-collection options a `collection` maintenance write carries. Phase 1
4800
- * is **append-only**: `maxItems` / `orderBy` are recorded for the future async trim
4801
- * (#130) but NOT applied synchronously — a single `UpdateExpression` cannot
4802
- * read-modify-write a bounded/ordered list.
4803
- */
4804
- interface MaintainCollectionSpec {
4805
- /** The target attribute that holds the maintained collection. */
4806
- readonly field: string;
4807
- /** Cap on the collection size (recorded for #130; not trimmed in Phase 1). */
4808
- readonly maxItems?: number;
4809
- /** The mutation-input field the items are ordered by (recorded for #130). */
4810
- readonly orderBy?: string;
4811
- /** The direction `orderBy` sorts by, from the relation's `read.order` (recorded for #130). */
4812
- readonly orderDir?: 'ASC' | 'DESC';
4813
- }
4814
- /**
4815
- * The maintenance payload an `Update` {@link TransactionItemSpec} carries when it
4816
- * materializes a maintained access path (Epic #118 / #129). A `snapshot` mirrors
4817
- * the projection onto the owner row via `SET`; a `collection` appends the projection
4818
- * as an item into the bounded list named by {@link collection} via `list_append`.
4819
- */
4820
- interface MaintainItemSpec {
4821
- /**
4822
- * Whether the write mirrors a single row (`snapshot`), appends a collection item
4823
- * (`collection`), or applies a scalar `ADD` counter (`counter`, Epic #118 / #141).
4824
- */
4825
- readonly kind: 'snapshot' | 'collection' | 'counter';
4826
- /** The relation property / `@aggregate` field that declared this maintenance (documentary). */
4827
- readonly relationProperty: string;
4828
- /** The trigger (`<sourceLogicalName>.<event>`) that fired this maintenance. */
4829
- readonly trigger: string;
4830
- /** target attribute → its projection transform (source field + op + args). Empty for `counter`. */
4831
- readonly projection: Readonly<Record<string, MaintainProjectionEntry>>;
4832
- /** The bounded-collection options; present only for `kind: 'collection'`. */
4833
- readonly collection?: MaintainCollectionSpec;
4834
- /**
4835
- * The scalar counter `ADD`; present only for `kind: 'counter'` (#141). The runtimes
4836
- * render `ADD #attr :delta` — an atomic, concurrency-safe increment that MERGES with
4837
- * a same-row counter ADD (#92), the maintenance-pipeline analogue of the
4838
- * self-lifecycle derived counter's `add` slot. `delta` is a numeric template string
4839
- * (the compile-time constant `+1` created / `-1` removed).
4840
- */
4841
- readonly counter?: MaintainCounterSpec;
4842
- }
4843
- /**
4844
- * The scalar counter a `counter` maintenance write applies (Epic #118 / #141): an
4845
- * atomic `ADD #attribute :delta`. `delta` is a literal numeric template string (the
4846
- * compile-time constant the trigger fixed — `"1"` created / `"-1"` removed); the
4847
- * runtimes serialize it as a number. Only `count()` is realized synchronously
4848
- * (`max(field)` is rejected for the synchronous path — #130 / Phase 2).
4849
- */
4850
- interface MaintainCounterSpec {
4851
- /** The target attribute the counter increments (e.g. `postCount`). */
4852
- readonly attribute: string;
4853
- /** The signed `ADD` delta as a numeric template string (`"1"` / `"-1"`). */
4854
- readonly delta: string;
4855
- }
4856
- /** A declarative transaction definition's full execution spec. */
4857
- interface TransactionSpec {
4858
- readonly params: Readonly<Record<string, ParamSpec>>;
4859
- readonly items: readonly TransactionItemSpec[];
4860
- /**
4861
- * A static upper bound on the expanded item count when computable (no `forEach`
4862
- * present → the exact count; with `forEach` it is left absent because the
4863
- * element count is only known at execution — the runtime then enforces the
4864
- * DynamoDB ≤25 limit after expansion).
4865
- */
4866
- readonly maxItems?: number;
4867
- }
4868
- /**
4869
- * Whether a contract is a public **read** (`'query'`) or **write** (`'command'`)
4870
- * interface. Mirrors {@link QueryModelContract} / {@link CommandModelContract}'s
4871
- * `kind` discriminant from the Contract IR (#58).
4872
- */
4873
- type ContractKind = 'query' | 'command';
4874
- /**
4875
- * The resolution kind of a contract query method, **derived** by the planner from
4876
- * the internal op (never hand-written; see proposal "N+1 Safety"):
4877
- *
4878
- * - `'point'` — target keys are known (unique-key `query` / `GetItem`); a key
4879
- * array coalesces to one `BatchGetItem`.
4880
- * - `'range'` — target key set is unknown (partition `list` / `Query`); one
4881
- * request per partition key, so it is only ever safe for a single key.
4882
- */
4883
- type ContractResolution = 'point' | 'range';
4884
- /**
4885
- * What input arity a contract method accepts, **derived** from its resolution:
4886
- *
4887
- * - `'either'` — a single key **or** an array (a `point` read / a known-key
4888
- * write; the array form is one `BatchGetItem` / batched write).
4889
- * - `'single'` — a single key only (a `range` read; an array would be an N+1
4890
- * fan-out and is rejected by construction).
4891
- * - `'array'` — an array only (reserved; not produced by the current resolvers).
4892
- */
4893
- type ContractInputArity = 'single' | 'array' | 'either';
4894
- /**
4895
- * The per-key result cardinality of a contract query method, **derived** from the
4896
- * internal op kind (proposal "Cardinality matrix"):
4897
- *
4898
- * - `'one'` — at most one item per key (a `point` read).
4899
- * - `'many'` — a connection (`{ items, cursor }`) per key (a `range` read).
4900
- *
4901
- * This is the per-key shape; the input arity (single vs. array) then decides
4902
- * whether the overall result is bare or keyed.
4903
- */
4904
- type ContractCardinality = 'one' | 'many';
4905
- /**
4906
- * The category of a contract command method's declared result, part of the
4907
- * contract (it surfaces in OpenAPI and every binding; proposal "Return values"):
4908
- *
4909
- * - `'void'` — fire-and-forget write (no body).
4910
- * - `'result'` — an outcome / status object (e.g. `{ ok, version }`).
4911
- * - `'entity'` — the updated entity (the post-write projection).
4912
- */
4913
- type ContractCommandResult = 'void' | 'result' | 'entity';
4914
- /** The Key of a contract: the field names that compose its access / join key. */
4915
- interface ContractKeySpec {
4916
- /** The key field names, in declaration order (e.g. `["articleId"]`). */
4917
- readonly fields: readonly string[];
4918
- }
4919
- /**
4920
- * One External Query (Query Composition) binding on a contract query method
4921
- * (proposal "External Query"). It is a **build-time, in-process** read dependency
4922
- * on another contract referenced by name in the same SSoT — there is no protocol
4923
- * or transport. The runtime collects every parent key produced at this level and
4924
- * resolves the referenced contract **once, batched**, for all of them.
4925
- *
4926
- * A composed child MUST be `point` (proposal "N+1 Safety"): the parent step may
4927
- * yield N records, so a `range` child would be an N+1 fan-out.
4928
- */
4929
- interface ComposeSpec {
4930
- /** The result property the composed value is attached to (e.g. `billing`). */
4931
- readonly as: string;
4932
- /** The referenced contract name (a symbol in the same SSoT). */
4933
- readonly contract: string;
4934
- /** The referenced method on that contract (e.g. `get`). */
4935
- readonly method: string;
4936
- /**
4937
- * An optional **logical** owner label (the bounded context that owns the
4938
- * referenced contract) — not a network address. Omitted when unlabeled.
4939
- */
4940
- readonly context?: string;
4941
- /**
4942
- * The child-key binding: child key field → a `from` source path on the parent
4943
- * result, e.g. `{ accountId: "$.billingAccountId" }`.
4944
- */
4945
- readonly bind: Readonly<Record<string, string>>;
4946
- /**
4947
- * The composed child's resolution. It MUST be `'point'` in a valid contract — a
4948
- * composed child coalesces to one `BatchGetItem` across all parent keys, so a
4949
- * `range` child (a partition `Query` that cannot be batched across the parent's
4950
- * keys) is an N+1 fan-out. The N+1 static checker (#60,
4951
- * {@link assertContractN1Safe}) rejects a `'range'` value on the build path; the
4952
- * field is widened to {@link ContractResolution} so the offending node can be
4953
- * carried into the assembled {@link ContractSpec} for the checker to inspect and
4954
- * reject with a clear message, rather than being silently unrepresentable.
4955
- */
4956
- readonly resolution: ContractResolution;
4957
- /** The composed child's per-key cardinality (`'one'` for a valid `point`). */
4958
- readonly cardinality: ContractCardinality;
4959
- }
4960
- /**
4961
- * The **composition execution plan** for one query contract method (issue #70a),
4962
- * the contract-layer mirror of {@link ExecutionPlanSpec}. It records how a method's
4963
- * External Query compositions (`compose[]`) are staged relative to the parent read
4964
- * and to one another, and the batching discipline each composed child obeys:
4965
- *
4966
- * - `stages` is an ordered list whose entries are indices into the method's
4967
- * `compose[]`. The parent read (the referenced `operation`) is the implicit
4968
- * stage before all of these. Every compose child binds its child key purely from
4969
- * the **parent** result (`from('$.…')` paths), so sibling compositions are
4970
- * mutually independent: they form a single stage `[0, 1, …]` and may be resolved
4971
- * concurrently. (A composed child cannot, today, bind from another composed
4972
- * child — the #63 DSL only exposes parent `from` paths — so there is never a
4973
- * cross-composition dependency; the field is a list of stages so the shape can
4974
- * carry one if a future primitive introduces it.)
4975
- * - `concurrency` is the declared in-flight bound applied **within** a stage (the
4976
- * shared {@link RELATION_TRAVERSAL_CONCURRENCY} = 16).
4977
- * - `batchChunkSize` is the per-request key cap for a composed child read (100,
4978
- * the DynamoDB `BatchGetItem` limit): a composition resolves **one batched
4979
- * call** across all parent records (chunked at this size), never an N+1 fan-out
4980
- * (the composed child is `point`, enforced by the #60 N+1 checker).
4981
- *
4982
- * Emitted only when the method declares at least one composition. A method without
4983
- * compositions carries no plan, and a runtime without one resolves any
4984
- * compositions sequentially (the pre-#70 behavior) — so an absent plan never
4985
- * changes results.
4986
- */
4987
- interface CompositionPlanSpec {
4988
- /** Ordered stages of indices into `compose[]` (independent siblings share a stage). */
4989
- readonly stages: readonly (readonly number[])[];
4990
- /** The declared in-flight bound applied within each composition stage (16). */
4991
- readonly concurrency: number;
4992
- /** Per-request key cap for a composed child's batched read (100, BatchGetItem limit). */
4993
- readonly batchChunkSize: number;
4994
- }
4995
- /**
4996
- * The serialized spec of one **query** contract method. Carries the decided facts
4997
- * (`resolution` / `inputArity` / `cardinality`) the planner derived in #58, a
4998
- * reference into `queries` by name (the internal op), and any External Query
4999
- * compositions. The decided facts are **serialized, not re-derived** — every
5000
- * runtime honors them.
5001
- */
5002
- interface QueryContractMethodSpec {
5003
- /** Derived: `'point'` (unique-key query) or `'range'` (partition list). */
5004
- readonly resolution: ContractResolution;
5005
- /** Derived: `'either'` for `point`, `'single'` for `range`. */
5006
- readonly inputArity: ContractInputArity;
5007
- /** Derived per-key result shape: `'one'` (point) or `'many'` (range). */
5008
- readonly cardinality: ContractCardinality;
5009
- /** The referenced read op name in `queries` (e.g. `ArticleById__get`). */
5010
- readonly operation: string;
5011
- /** External Query compositions on this method; omitted when there are none. */
5012
- readonly compose?: readonly ComposeSpec[];
5013
- /**
5014
- * The composition staging + batch plan (issue #70a); present only when `compose`
5015
- * is. See {@link CompositionPlanSpec}: independent compositions form one
5016
- * concurrency-eligible stage after the parent read, each resolved as one batched
5017
- * call (chunk ≤100). Absent → resolve compositions sequentially (pre-#70).
5018
- */
5019
- readonly compositionPlan?: CompositionPlanSpec;
5020
- /**
5021
- * Optional human-readable description of the read use case (issue #154), from the
5022
- * descriptor's `description`. Pure documentation — absent unless declared, so a
5023
- * method with no description serializes byte-identically to the pre-#154 spec.
5024
- * The same string appears in the TS contract IR and (via the SSoT) in any
5025
- * generated binding, so TS↔Python carry an identical description.
5026
- */
5027
- readonly description?: string;
5028
- }
5029
- /**
5030
- * How a contract command method resolves a single key vs. an array of keys to the
5031
- * underlying write surface (proposal "Consistency with the existing write
5032
- * surface"). A single key → one write op (or one transaction); an array → a
5033
- * batched write — a `TransactWriteItems` when atomicity / per-item conditions are
5034
- * required, or a `BatchWriteItem` when neither is.
5035
- */
5036
- type CommandResolutionTarget =
5037
- /** One write op, referenced by name in `commands`. */
5038
- {
5039
- readonly mode: 'op';
5040
- readonly operation: string;
5041
- }
5042
- /** One transaction, referenced by name in `transactions`. */
5043
- | {
5044
- readonly mode: 'transaction';
5045
- readonly transaction: string;
5046
- }
5047
- /**
5048
- * A non-atomic **parallel** fan-out over the per-key write op (#101). The op
5049
- * MAY carry a condition (guarded create / conditioned update). Unconditioned
5050
- * `put`/`delete` ops coalesce into a `BatchWriteItem` (with `UnprocessedItems`
5051
- * retry); conditioned/update ops issue individual conditional writes
5052
- * concurrently. Per-op success/failure is reported (partial success); a
5053
- * per-op failure never aborts the others. References the per-key write op in
5054
- * `commands`.
5055
- */
5056
- | {
5057
- readonly mode: 'parallel';
5058
- readonly operation: string;
5059
- };
5060
- /**
5061
- * The serialized spec of one **command** contract method. Symmetric to
5062
- * {@link QueryContractMethodSpec}: it carries the declared `result` type and the
5063
- * `single` / `batch` resolution targets into the existing write specs.
5064
- */
5065
- interface CommandContractMethodSpec {
5066
- /** Derived input arity: writes accept `'either'` (single key or key array). */
5067
- readonly inputArity: ContractInputArity;
5068
- /** The declared result type (`void` | a `Result` | the updated entity). */
5069
- readonly result: ContractCommandResult;
5070
- /** How a single key resolves (one op / one transaction). */
5071
- readonly single: CommandResolutionTarget;
5072
- /**
5073
- * How an array of keys resolves (a transaction / `BatchWriteItem`); omitted
5074
- * when the contract does not declare a batched write form.
5075
- */
5076
- readonly batch?: CommandResolutionTarget;
5077
- /**
5078
- * The **return projection** of a `mutation`-derived command method (issue #83;
5079
- * proposal §3, "return selection as a read projection"). A JSON-safe boolean
5080
- * field map: after the write commits, the runtime issues a **`GetItem` with
5081
- * `ConsistentRead`** of the written entity's primary key and applies this
5082
- * projection via the existing read-projection machinery, returning the projected
5083
- * item. This is the **uniform** return mechanism for both a single-op command
5084
- * and a future transaction (a `TransactWriteItems` cannot return item images),
5085
- * so TS and Python return an **identical** projected item.
5086
- *
5087
- * The consistent read-back is issued against the read op named
5088
- * `<Contract>__<method>__readback` (a synthesized {@link QuerySpec}: a `GetItem`
5089
- * on the written entity's primary key projecting these fields). Present only on
5090
- * a `.plan(mutation)` method; a hand-written #64 command omits it (its
5091
- * {@link result} stays `'void'` / `'entity'` and it returns no projected item).
5092
- */
5093
- readonly returnSelection?: Readonly<Record<string, boolean>>;
5094
- /**
5095
- * Optional human-readable description of the write use case (issue #154), from
5096
- * the descriptor's `description`. Pure documentation — absent unless declared, so
5097
- * a method with no description serializes byte-identically to the pre-#154 spec.
5098
- */
5099
- readonly description?: string;
5100
- }
5101
- /**
5102
- * A serialized contract — a keyed public read (`'query'`) or write (`'command'`)
5103
- * interface holding one or more named methods. Each method references an existing
5104
- * operation spec by name and adds the decided contract facts. The existing
5105
- * operation-spec shapes are unchanged, so the current runtime keeps working.
5106
- */
5107
- interface ContractSpec {
5108
- /** Whether this is a read (`'query'`) or write (`'command'`) contract. */
5109
- readonly kind: ContractKind;
5110
- /** The contract Key (the access pattern / join / batch key). */
5111
- readonly key: ContractKeySpec;
5112
- /**
5113
- * The named methods (use cases over the same Key). A query contract's methods
5114
- * are {@link QueryContractMethodSpec}; a command contract's are
5115
- * {@link CommandContractMethodSpec}. The map is keyed by contract `kind`.
5116
- */
5117
- readonly methods: Readonly<Record<string, QueryContractMethodSpec>> | Readonly<Record<string, CommandContractMethodSpec>>;
5118
- }
5119
- /**
5120
- * One bounded context's membership (issue #59, "context ownership"). Lists the
5121
- * Models and Contracts that belong to the same context, so the future boundary
5122
- * lint (#61) can tell **own** from **foreign**: a contract may resolve its own
5123
- * context's Models directly, but may only reach another context through that
5124
- * context's published Contract (direct use of a foreign Model is a build error).
5125
- *
5126
- * This issue only **serializes / emits** this declaration; it does not enforce
5127
- * it. Both lists are entity / contract *names* (matching `manifest.entities` keys
5128
- * and `contracts` keys respectively).
5129
- */
5130
- interface ContextSpec {
5131
- /** Model (entity) names owned by this context (sorted; manifest entity keys). */
5132
- readonly models: readonly string[];
5133
- /** Contract names owned by this context (sorted; `contracts` map keys). */
5134
- readonly contracts: readonly string[];
5135
- }
5136
- interface OperationsDocument {
5137
- readonly version: typeof SPEC_VERSION;
5138
- readonly queries: Readonly<Record<string, QuerySpec>>;
5139
- readonly commands: Readonly<Record<string, CommandSpec>>;
5140
- /** Declarative transactions (issue #46). Absent in pre-#46 specs. */
5141
- readonly transactions?: Readonly<Record<string, TransactionSpec>>;
5142
- /**
5143
- * The CQRS Contract layer (issue #59): contract name → {@link ContractSpec}.
5144
- * Layered **on top of** the existing `queries` / `commands` / `transactions`
5145
- * (each method references one of them by name). **Absent** when the input
5146
- * defines no contracts — so a contract-free input produces a byte-identical
5147
- * pre-#59 operations document (backward compatibility).
5148
- */
5149
- readonly contracts?: Readonly<Record<string, ContractSpec>>;
5150
- /**
5151
- * Context-ownership declarations (issue #59): context name →
5152
- * {@link ContextSpec}. Used by the boundary lint (#61) to tell own from
5153
- * foreign. **Absent** when no contexts are declared (backward compatibility).
5154
- */
5155
- readonly contexts?: Readonly<Record<string, ContextSpec>>;
5156
- }
5157
- /** The full `{ manifest, operations }` bundle produced by the static planner. */
5158
- interface BridgeBundle {
5159
- readonly manifest: Manifest;
5160
- readonly operations: OperationsDocument;
5161
- }
5162
-
5163
4126
  /**
5164
4127
  * A **referential-integrity assertion** derived from a `requires`
5165
4128
  * ({@link RequiresEffect}) effect (issue #84; proposal §2/§3). It is the
@@ -6251,7 +5214,9 @@ declare function executeCommandMethod(contract: ExecutableCommandContract, metho
6251
5214
  *
6252
5215
  * - **READ** — `{ alias: { query | list: Model, key, select, options? } }`. Each
6253
5216
  * route runs **independently and in parallel** (`Promise.all`): a `query` route
6254
- * delegates to {@link executeQuery}, a `list` route to {@link executeList}. The
5217
+ * delegates to {@link executeAdHocQuery}, a `list` route to
5218
+ * {@link executeAdHocList} — the unified read-plan lowering (issue #249), the
5219
+ * same path `Model.query` / `Model.list` and `prepare` execute through. The
6255
5220
  * nested selection / relation resolution / optimisation under a route is the
6256
5221
  * existing read path, reused verbatim. Cross-route consistency is NOT guaranteed
6257
5222
  * (each route is its own read).
@@ -6431,6 +5396,96 @@ type MutateParallelResult<E extends WriteEnvelope> = {
6431
5396
  readonly [K in keyof E]: BulkWrap<E[K], ParallelResultOf<E[K]>>;
6432
5397
  };
6433
5398
 
5399
+ /**
5400
+ * The unified internal READ plan (issue #249) — every read surface lowers to ONE
5401
+ * internal route representation ({@link CompiledReadRoute}) and executes through
5402
+ * ONE executor ({@link executeCompiledReadRoute}).
5403
+ *
5404
+ * Before #249, reads had two paths: the prepared / AOT path lowered a declarative
5405
+ * route to a {@link CompiledReadRoute} (param-slot IR) and executed it, while the
5406
+ * ad-hoc surfaces (`Model.query` / `Model.list` / the `DDBModel.query` envelope)
5407
+ * called `executeQuery` / `executeList` DIRECTLY — the same surface-dependent
5408
+ * divergence that let #242/#243-class silent drops happen on the write side. This
5409
+ * module closes the read side:
5410
+ *
5411
+ * - {@link executeCompiledReadRoute} is the SINGLE funnel from a lowered route to
5412
+ * the physical read cores (`executeQuery` / `executeList`). The prepared
5413
+ * statement ({@link import('./prepared.js').PreparedReadStatement}), the AOT
5414
+ * loader, and the ad-hoc surfaces all execute through it — no read surface
5415
+ * calls the cores directly anymore.
5416
+ * - {@link executeAdHocQuery} / {@link executeAdHocList} lower an ad-hoc call to a
5417
+ * {@link CompiledReadRoute} first (each key FIELD becomes a same-named param
5418
+ * slot; the concrete values bind as params at execution — exactly the prepared
5419
+ * path's shape), then run the shared executor.
5420
+ *
5421
+ * ## Ad-hoc semantics are preserved EXACTLY
5422
+ *
5423
+ * The lowering adds a plan representation, never a behavior change: the caller's
5424
+ * option bag is threaded through verbatim (a shallow copy — including fields the
5425
+ * plan layer does not know about, so read middleware R1 hooks observe the same
5426
+ * bag), the select spec is passed through untouched (the physical cores own
5427
+ * `project(...)`-builder normalization / validation, as before), and per-call
5428
+ * host-side options (`updatable` / `hydrate` / `retry` / `context`) flow through
5429
+ * unchanged. A prepared route's slot-bound options take precedence over the
5430
+ * per-call bag — the prepared surface only ever passes `retry` / `context`
5431
+ * per-call, so both surfaces keep their existing semantics through the one
5432
+ * executor.
5433
+ *
5434
+ * ## Structural memoization (the #206-style hot-path guarantee)
5435
+ *
5436
+ * The ad-hoc lowering is memoized in a bounded LRU keyed by the query's
5437
+ * **structure** — model OBJECT identity (never a class name), route kind, key
5438
+ * field NAMES (values are params, not part of the key), and the select shape
5439
+ * (builder-aware; literal filter/option values inside a select are part of the
5440
+ * shape) — so the plan is compiled once per `(model, shape)`, not per call. A
5441
+ * select shape the serializer cannot prove stable (a function / symbol / class
5442
+ * instance at a leaf) is compiled fresh per call instead of risking a cache
5443
+ * collision — correctness over reuse.
5444
+ */
5445
+
5446
+ /**
5447
+ * A recorded binding: a value is either a param slot (bind from `params[name]`)
5448
+ * or a static literal (used verbatim). Discovered ONCE at lowering, replayed per
5449
+ * execution. Exported (@internal) for the prepared runtime
5450
+ * (`src/runtime/prepared.ts`), the #208 AOT emitter (`src/spec/prepared.ts`) and
5451
+ * loader (`src/runtime/prepared-loader.ts`), which serialize / rebind exactly
5452
+ * this structure.
5453
+ */
5454
+ type Slot = {
5455
+ readonly kind: 'param';
5456
+ readonly name: string;
5457
+ } | {
5458
+ readonly kind: 'literal';
5459
+ readonly value: unknown;
5460
+ };
5461
+ /**
5462
+ * The unified internal read plan — one `query` / `list` route lowered to its
5463
+ * params-independent products (resolved model class, select spec, key param
5464
+ * slots, static / slot-bound options). EVERY read surface produces one of these
5465
+ * before execution: the prepared runtime (`compileReadRoute`), the #208 AOT
5466
+ * loader (which reconstructs routes from the static plan artifact), and — since
5467
+ * #249 — the ad-hoc surfaces (`Model.query` / `Model.list` / the `DDBModel.query`
5468
+ * envelope) via {@link executeAdHocQuery} / {@link executeAdHocList}.
5469
+ * @internal
5470
+ */
5471
+ interface CompiledReadRoute {
5472
+ readonly alias: string;
5473
+ readonly kind: 'query' | 'list';
5474
+ readonly modelClass: Function;
5475
+ /** The static select spec (params-independent; may be a `project(...)` builder
5476
+ * on the ad-hoc surface — the physical cores own its normalization). */
5477
+ readonly select: Record<string, unknown>;
5478
+ readonly keySlots: Readonly<Record<string, Slot>>;
5479
+ /** Static option literals decided at lowering (maxDepth / order / filter). */
5480
+ readonly maxDepth?: number;
5481
+ readonly order?: 'ASC' | 'DESC';
5482
+ readonly filter?: Record<string, unknown>;
5483
+ /** Dynamic option slots (may bind a param or a literal). */
5484
+ readonly consistentReadSlot?: Slot;
5485
+ readonly limitSlot?: Slot;
5486
+ readonly afterSlot?: Slot;
5487
+ }
5488
+
6434
5489
  /**
6435
5490
  * Prepared statements — `DDBModel.prepare($ => ({...}))` → `.execute(params)`
6436
5491
  * (issue #205, design #203). The **runtime, fallback-B** implementation of the
@@ -6457,8 +5512,9 @@ type MutateParallelResult<E extends WriteEnvelope> = {
6457
5512
  * - **read** — the params-independent products (resolved model class, normalized
6458
5513
  * select + static filter, key-field NAMES, validated relation structure) are
6459
5514
  * computed once. `execute` binds the concrete key VALUES + per-call pagination /
6460
- * consistency and calls {@link executeQuery} / {@link executeListInternal} — the
6461
- * identical core `Model.query` / `Model.list` and `publicQueryModel` use. (The
5515
+ * consistency and runs the unified read-plan executor
5516
+ * (`executeCompiledReadRoute`, issue #249) — the identical core `Model.query` /
5517
+ * `Model.list` and `publicQueryModel` use. (The
6462
5518
  * `ExecutionPlan` bakes concrete key values into its `keyCondition`, so a single
6463
5519
  * compiled operation object is NOT reusable across param sets; the precompiled
6464
5520
  * product is the resolved model + normalized projection — exactly what the public
@@ -6511,7 +5567,15 @@ interface PreparedParamRef {
6511
5567
  declare function isPreparedParamRef(value: unknown): value is PreparedParamRef;
6512
5568
  /** The placeholder proxy handed to a `prepare` body as `$`. Every `$.<name>` read
6513
5569
  * mints a {@link PreparedParamRef}; any further access / coercion throws so the
6514
- * body stays a pure, params-independent template (no runtime capture). */
5570
+ * body stays a pure, params-independent template (no runtime capture).
5571
+ *
5572
+ * **Input Port 統一 (issue #264)**: this proxy is one of the three authoring
5573
+ * spellings of the SAME Input Port reference model — see the unification note
5574
+ * on {@link import('../define/transaction.js').ParamProxy} (`defineTransaction`'s
5575
+ * `p.*` proxy is the model; a `$.<name>` read here is the same "declared
5576
+ * input field, bound at execution" reference that serializes as `{<name>}`
5577
+ * templates / `{ref:["input","<name>"]}` expression refs elsewhere). Behavior
5578
+ * here is unchanged in 0.7.x (interop kept). */
6515
5579
  type PreparedInputProxy = Record<string, PreparedParamRef>;
6516
5580
  /** A `prepare` write route: `{ create|update|remove: () => Model, key, input?, condition?, result? }`. */
6517
5581
  interface PreparedWriteRoute {
@@ -6568,20 +5632,6 @@ interface PreparedReadExecOptions {
6568
5632
  readonly retry?: RetryOverride;
6569
5633
  readonly context?: RequestContext;
6570
5634
  }
6571
- /**
6572
- * A recorded binding: a value is either a param slot (bind from `params[name]`) or
6573
- * a static literal (used verbatim). Discovered ONCE at prepare from the recording
6574
- * `$` proxy, replayed per `execute`. Exported (@internal) for the #208 AOT
6575
- * emitter (`src/spec/prepared.ts`) and loader (`src/runtime/prepared-loader.ts`),
6576
- * which serialize / rebind exactly this structure.
6577
- */
6578
- type Slot = {
6579
- readonly kind: 'param';
6580
- readonly name: string;
6581
- } | {
6582
- readonly kind: 'literal';
6583
- readonly value: unknown;
6584
- };
6585
5635
  interface CompiledWriteOp {
6586
5636
  readonly alias: string;
6587
5637
  readonly intent: Intent;
@@ -6591,25 +5641,6 @@ interface CompiledWriteOp {
6591
5641
  readonly conditionSlots?: Readonly<Record<string, Slot>>;
6592
5642
  readonly result?: PreparedWriteRoute['result'];
6593
5643
  }
6594
- /** @internal — exported for the #208 AOT loader, which reconstructs these
6595
- * routes from the static plan artifact and executes them through the SAME
6596
- * {@link PreparedReadStatement}. */
6597
- interface CompiledReadRoute {
6598
- readonly alias: string;
6599
- readonly kind: 'query' | 'list';
6600
- readonly modelClass: Function;
6601
- /** The normalized static select spec (params-independent). */
6602
- readonly select: Record<string, unknown>;
6603
- readonly keySlots: Readonly<Record<string, Slot>>;
6604
- /** Static option literals decided at prepare (maxDepth / order / filter). */
6605
- readonly maxDepth?: number;
6606
- readonly order?: 'ASC' | 'DESC';
6607
- readonly filter?: Record<string, unknown>;
6608
- /** Dynamic option slots (may bind a param or a literal). */
6609
- readonly consistentReadSlot?: Slot;
6610
- readonly limitSlot?: Slot;
6611
- readonly afterSlot?: Slot;
6612
- }
6613
5644
  /** A prepared **write** handle. `execute(params)` binds + runs the shared write core. */
6614
5645
  declare class PreparedWriteStatement {
6615
5646
  private readonly ops;
@@ -7535,4 +6566,4 @@ interface ViewDefinition {
7535
6566
  */
7536
6567
  declare function collectViewDefinitions(registry?: ReadonlyMap<Function, EntityMetadata>): ViewDefinition[];
7537
6568
 
7538
- export { type AnyOperationDefinition as $, type ContractSpec as A, type BatchResult as B, type CdcEmulatorOptions as C, type DynamoDBOperation as D, type EventLog as E, type FaultSpec as F, type QuerySpec as G, type CommandSpec as H, type TransactionSpec as I, type ContextSpec as J, SPEC_VERSION as K, type ParamSpec as L, type ModelStatic as M, type ParamDescriptor as N, type EntityRef as O, type PutInput as P, type QueryModelContract as Q, type ReplayOptions as R, type ShardId as S, type TransactWriteExecItem as T, type Unsubscribe as U, type ViewDefinition as V, type WriteExecOptions as W, type ConditionInput as X, type Param as Y, type DefinitionMap as Z, type OperationsDocument as _, type CdcMode as a, type FieldOptions as a$, type Manifest as a0, type BridgeBundle as a1, type ConditionSpec as a2, type PreparedBody as a3, type CommandContractMethodSpec as a4, type CommandResolutionTarget as a5, type CompiledFragment as a6, type CompiledMutationPlan as a7, type ComposeSpec as a8, type CompositionPlanSpec as a9, type QueryContractMethodSpec as aA, type RangeConditionSpec as aB, type ReadOperationType as aC, type TransactionItemSpec as aD, type TransactionItemType as aE, type WhenSpec as aF, type WriteOperationType as aG, assertNoCrossFragmentMaintainCollision as aH, compileFragment as aI, compileMutationPlan as aJ, compileSingleFragmentPlan as aK, resetMaintenanceGraphCache as aL, resolveLifecycle as aM, resolveMaintainers as aN, type SelectableOf as aO, type PrimaryKeyOf as aP, type RequestContext as aQ, type Middleware as aR, type ReadRequestKind as aS, type CtxModel as aT, type ReadParams as aU, type ReadRequestCtx as aV, type Item as aW, type RetryPolicy as aX, type KeyDefinition as aY, type GsiDefinition as aZ, type ModelKind as a_, type ContractCardinality as aa, type ContractCommandResult as ab, type ContractInputArity as ac, type ContractKeySpec as ad, type ContractKind as ae, type ContractResolution as af, type DerivedConditionCheck as ag, type DerivedEdgeWrite as ah, type DerivedIdempotencyGuard as ai, type DerivedMaintainOutbox as aj, type DerivedMaintainWrite as ak, type DerivedOutboxEvent as al, type DerivedUniqueGuard as am, type DerivedUpdate as an, type EntityRefResolver as ao, type ExecutionPlanSpec as ap, type FilterSpec as aq, MAX_TRANSACT_COMPOSE_ITEMS as ar, type ManifestEntity as as, type ManifestField as at, type ManifestFieldType as au, type ManifestGsi as av, type ManifestKey as aw, type ManifestRelation as ax, type ManifestTable as ay, type OperationSpec as az, type ChangeBatch as b, type ContractQueryParams as b$, type DynamoType as b0, type ProjectionTransform as b1, type MaintainEvent as b2, type MembershipPredicate as b3, type MaintainConsistency as b4, type MaintainUpdateMode as b5, type MembershipPredicateOp as b6, type RelationOptions as b7, type AggregateOptions as b8, type AggregateValue as b9, type BatchWriteRequest as bA, CONTRACT_RANGE_FANOUT_CONCURRENCY as bB, type CdcModelRegistry as bC, type CdcSubscribeHandlers as bD, type Change as bE, type CollectionEffect as bF, type CollectionOptions as bG, type Column as bH, type ColumnMap as bI, type CommandInputShape as bJ, type CommandMethod as bK, type CommandPlan as bL, type CommandResultKind as bM, type CommandSelectShape as bN, type CondSlot as bO, type ConditionCheckInput as bP, type Connection as bQ, type ContractCallSignature as bR, type ContractCommandParams as bS, type ContractComposeNode as bT, type ContractFromRef as bU, type ContractItem as bV, type ContractKeyFieldRef as bW, type ContractKeyInput as bX, type ContractKeyRef as bY, type ContractMethodOp as bZ, type ContractParamRef as b_, type SelectBuilderSpec as ba, type RawCondition as bb, type RetryOverride as bc, type ExecutionPlan as bd, type FieldMetadata as be, type ResolvedKey as bf, type Slot as bg, type PreparedWriteExecOptions as bh, type CommandReturn as bi, type ParallelOpResult as bj, type PreparedStatement as bk, type RelationMetadata as bl, type MaintainEffect as bm, type OperationDefinition as bn, type WriteDefinitionOptions as bo, type PartialQueryKeyOf as bp, type StrictSelectSpec as bq, type ReadDefinitionOptions as br, type EntityInput as bs, type UniqueQueryKeyOf as bt, type AggregateMetadata as bu, type BatchDeleteRequest as bv, type BatchGetOptions as bw, type BatchGetRequest as bx, BatchGetResult as by, type BatchPutRequest as bz, type ChangeEvent as c, PreparedReadStatement as c$, type CounterAggregate as c0, type CounterEffect as c1, type CtxBase as c2, DEFAULT_MAX_ATTEMPTS as c3, DEFAULT_RETRY_POLICY as c4, type DeleteOptions as c5, type DeriveEffect as c6, type DescriptorBinding as c7, ENTITY_WRITES_MARKER as c8, type EdgeEffect as c9, type MaintainItem as cA, type MaintainTrigger as cB, type MaintenanceGraph as cC, type MembershipEffect as cD, type ModelRef as cE, type MutateMode as cF, type MutateOptions as cG, type MutateParallelResult as cH, type MutateTransactionResult as cI, type MutationBody as cJ, type MutationDescriptorMap as cK, type MutationFragment as cL, type MutationInputProxy as cM, type MutationInputRef as cN, type MutationIntent as cO, type NumberParam as cP, type OperationKind as cQ, PREPARE_CACHE_MAX as cR, type ParamKind as cS, type ParamStructure as cT, type PersistCtx as cU, type PersistOrigin as cV, type PlannedCommandMethod as cW, type PreparedInputProxy as cX, type PreparedParamRef as cY, type PreparedReadExecOptions as cZ, type PreparedReadRoute as c_, type EffectPath as ca, type EmbeddedMetadata as cb, type EmitEffect as cc, type EntityWritesDefinition as cd, type EntityWritesShape as ce, type ExecutableCommandContract as cf, type ExecutableQueryContract as cg, type FilterInput as ch, type FragmentCondition as ci, type FragmentConditionOperatorObject as cj, type FragmentInput as ck, type GsiDefinitionMarker as cl, type GsiOptions as cm, type IdempotencyEffect as cn, type InProcessWriteDescriptor as co, type InlineSnapshotSpec as cp, type InputArity as cq, type KeyDefinitionMarker as cr, type KeySegment as cs, type KeySlot as ct, type KeyStructure as cu, type KeyedResult as cv, LIFECYCLE_CONTRACT_MARKER as cw, type LifecycleContract as cx, type LifecycleEffects as cy, type LiteralParam as cz, type ChangeEventName as d, executeCommandMethod as d$, type PreparedWriteRoute as d0, PreparedWriteStatement as d1, type ProjectionMap as d2, type ProjectionTransformOp as d3, type PutOptions as d4, type QueryEnvelopeResult as d5, type QueryKeyOf as d6, type QueryMethod as d7, type QueryResult as d8, type ReadEnvelope as d9, type StringParam as dA, TransactionContext as dB, type UniqueEffect as dC, type Updatable as dD, type UpdateOptions as dE, type ViewSourceSlice as dF, type WriteCtx as dG, type WriteDescriptor as dH, type WriteEnvelope as dI, type WriteInput as dJ, type WriteKind as dK, type WriteLifecyclePhase as dL, type WriteMiddleware as dM, type WriteRecorder as dN, type WriteResultProjection as dO, attachModelClass as dP, buildDeleteInput as dQ, buildMaintenanceGraph as dR, buildPutInput as dS, buildUpdateInput as dT, collectViewDefinitions as dU, cond as dV, contractOfMethodSpec as dW, definePlan as dX, entityWrites as dY, executeBatchGet as dZ, executeBatchWrite as d_, type ReadOpCtx as da, type ReadOpKind as db, type ReadRouteDescriptor as dc, type ReadRouteOptions as dd, type ReadRouteResult as de, type RecordedCompose as df, type RelationBuilder as dg, type RelationConsistency as dh, type RelationLimitOptions as di, type RelationPattern as dj, type RelationProjection as dk, type RelationReadOptions as dl, type RelationSelect as dm, type RelationSpec as dn, type RelationUpdateMode as dp, type RelationWriteOptions as dq, type RequiresEffect as dr, type Resolution as ds, type RetryInfo as dt, type RetryOperationKind as du, type SegmentSpec as dv, type SegmentedKey as dw, type SelectBuilder as dx, type SelectOf as dy, type SnapshotEffect as dz, type ChangeHandler as e, executeDelete as e0, executeKeyedBatchGet as e1, executePut as e2, executeQueryMethod as e3, executeRangeFanout as e4, executeTransaction as e5, executeUpdate as e6, from as e7, getEntityWrites as e8, gsi as e9, mintContractParamRef as eA, mutation as eB, param as eC, prepare as eD, preview as eE, publicCommandModel as eF, publicQueryModel as eG, query as eH, wholeKeysSentinel as eI, identity as ea, isColumn as eb, isCommandModelContract as ec, isCommandPlan as ed, isContractComposeNode as ee, isContractFromRef as ef, isContractKeyFieldRef as eg, isContractKeyRef as eh, isContractParamRef as ei, isEntityWritesDefinition as ej, isKeySegment as ek, isLifecycleContract as el, isMaintainTrigger as em, isMutationFragment as en, isMutationInputRef as eo, isParam as ep, isPlannedCommandMethod as eq, isPreparedParamRef as er, isQueryModelContract as es, isRetryableError as et, isRetryableTransactionCancellation as eu, k as ev, key as ew, lifecyclePhaseForIntent as ex, maintainTrigger as ey, mintContractKeyFieldRef as ez, type ClockMode as f, type ConcurrentRecomputeRef as g, type StartingPosition as h, type StreamViewType as i, type SubscribeHandler as j, type SubscribeHandlers as k, buildSubscribeHandler as l, type EntityMetadata as m, type Executor as n, type ReadExecOptions as o, type ExecutorResult as p, type BatchGetExecInput as q, type WriteResult as r, type UpdateInput as s, type DeleteInput as t, type BatchWriteExecItem as u, type BatchExecOptions as v, DDBModel as w, type QueryMethodSpec as x, type CommandModelContract as y, type CommandMethodSpec as z };
6569
+ export { type DerivedOutboxEvent as $, type ParamDescriptor as A, type BatchResult as B, type CdcEmulatorOptions as C, type DynamoDBOperation as D, type EventLog as E, type FaultSpec as F, type EntityRef as G, type ConditionInput as H, type DefinitionMap as I, type AnyOperationDefinition as J, type PreparedBody as K, type CompiledFragment as L, type ModelStatic as M, type CompiledMutationPlan as N, type DerivedConditionCheck as O, type PutInput as P, type QueryModelContract as Q, type ReplayOptions as R, type ShardId as S, type TransactWriteExecItem as T, type Unsubscribe as U, type ViewDefinition as V, type WriteExecOptions as W, type DerivedEdgeWrite as X, type DerivedIdempotencyGuard as Y, type DerivedMaintainOutbox as Z, type DerivedMaintainWrite as _, type CdcMode as a, type CdcModelRegistry as a$, type DerivedUniqueGuard as a0, type DerivedUpdate as a1, type EntityRefResolver as a2, MAX_TRANSACT_COMPOSE_ITEMS as a3, assertNoCrossFragmentMaintainCollision as a4, compileFragment as a5, compileMutationPlan as a6, compileSingleFragmentPlan as a7, resetMaintenanceGraphCache as a8, resolveLifecycle as a9, type SelectBuilderSpec as aA, type RawCondition as aB, type ExecutionPlan as aC, type FieldMetadata as aD, type ResolvedKey as aE, type Slot as aF, type PreparedWriteExecOptions as aG, type CommandReturn as aH, type ParallelOpResult as aI, type PreparedStatement as aJ, type RelationMetadata as aK, type MaintainEffect as aL, type OperationDefinition as aM, type WriteDefinitionOptions as aN, type PartialQueryKeyOf as aO, type StrictSelectSpec as aP, type ReadDefinitionOptions as aQ, type EntityInput as aR, type UniqueQueryKeyOf as aS, type AggregateMetadata as aT, type BatchDeleteRequest as aU, type BatchGetOptions as aV, type BatchGetRequest as aW, BatchGetResult as aX, type BatchPutRequest as aY, type BatchWriteRequest as aZ, CONTRACT_RANGE_FANOUT_CONCURRENCY as a_, resolveMaintainers as aa, type SelectableOf as ab, type PrimaryKeyOf as ac, type RequestContext as ad, type Middleware as ae, type ReadRequestKind as af, type CtxModel as ag, type ReadParams as ah, type ReadRequestCtx as ai, type Item as aj, type RetryPolicy as ak, type RetryOverride as al, type KeyDefinition as am, type GsiDefinition as an, type ModelKind as ao, type FieldOptions as ap, type DynamoType as aq, type ProjectionTransform as ar, type MaintainEvent as as, type MembershipPredicate as at, type MaintainConsistency as au, type MaintainUpdateMode as av, type MembershipPredicateOp as aw, type RelationOptions as ax, type AggregateOptions as ay, type AggregateValue as az, type ChangeBatch as b, type MembershipEffect as b$, type CdcSubscribeHandlers as b0, type Change as b1, type CollectionEffect as b2, type CollectionOptions as b3, type Column as b4, type ColumnMap as b5, type CommandInputShape as b6, type CommandMethod as b7, type CommandPlan as b8, type CommandResultKind as b9, type EmbeddedMetadata as bA, type EmitEffect as bB, type EntityWritesDefinition as bC, type EntityWritesShape as bD, type ExecutableCommandContract as bE, type ExecutableQueryContract as bF, type FilterInput as bG, type FragmentCondition as bH, type FragmentConditionOperatorObject as bI, type FragmentInput as bJ, type GsiDefinitionMarker as bK, type GsiOptions as bL, type IdempotencyEffect as bM, type InProcessWriteDescriptor as bN, type InlineSnapshotSpec as bO, type InputArity as bP, type KeyDefinitionMarker as bQ, type KeySegment as bR, type KeySlot as bS, type KeyStructure as bT, type KeyedResult as bU, LIFECYCLE_CONTRACT_MARKER as bV, type LifecycleContract as bW, type LifecycleEffects as bX, type MaintainItem as bY, type MaintainTrigger as bZ, type MaintenanceGraph as b_, type CommandSelectShape as ba, type CondSlot as bb, type ConditionCheckInput as bc, type Connection as bd, type ContractCallSignature as be, type ContractCommandParams as bf, type ContractComposeNode as bg, type ContractFromRef as bh, type ContractItem as bi, type ContractKeyFieldRef as bj, type ContractKeyInput as bk, type ContractKeyRef as bl, type ContractMethodOp as bm, type ContractParamRef as bn, type ContractQueryParams as bo, type CounterAggregate as bp, type CounterEffect as bq, type CtxBase as br, DEFAULT_MAX_ATTEMPTS as bs, DEFAULT_RETRY_POLICY as bt, type DeleteOptions as bu, type DeriveEffect as bv, type DescriptorBinding as bw, ENTITY_WRITES_MARKER as bx, type EdgeEffect as by, type EffectPath as bz, type ChangeEvent as c, type WriteDescriptor as c$, type ModelRef as c0, type MutateMode as c1, type MutateOptions as c2, type MutateParallelResult as c3, type MutateTransactionResult as c4, type MutationBody as c5, type MutationDescriptorMap as c6, type MutationFragment as c7, type MutationInputProxy as c8, type MutationInputRef as c9, type ReadRouteResult as cA, type RecordedCompose as cB, type RelationBuilder as cC, type RelationConsistency as cD, type RelationLimitOptions as cE, type RelationPattern as cF, type RelationProjection as cG, type RelationReadOptions as cH, type RelationSelect as cI, type RelationSpec as cJ, type RelationUpdateMode as cK, type RelationWriteOptions as cL, type RequiresEffect as cM, type Resolution as cN, type RetryInfo as cO, type RetryOperationKind as cP, type SegmentSpec as cQ, type SegmentedKey as cR, type SelectBuilder as cS, type SelectOf as cT, type SnapshotEffect as cU, TransactionContext as cV, type UniqueEffect as cW, type Updatable as cX, type UpdateOptions as cY, type ViewSourceSlice as cZ, type WriteCtx as c_, type MutationIntent as ca, type OperationKind as cb, PREPARE_CACHE_MAX as cc, type ParamStructure as cd, type PersistCtx as ce, type PersistOrigin as cf, type PlannedCommandMethod as cg, type PreparedInputProxy as ch, type PreparedParamRef as ci, type PreparedReadExecOptions as cj, type PreparedReadRoute as ck, PreparedReadStatement as cl, type PreparedWriteRoute as cm, PreparedWriteStatement as cn, type ProjectionMap as co, type ProjectionTransformOp as cp, type PutOptions as cq, type QueryEnvelopeResult as cr, type QueryKeyOf as cs, type QueryMethod as ct, type QueryResult as cu, type ReadEnvelope as cv, type ReadOpCtx as cw, type ReadOpKind as cx, type ReadRouteDescriptor as cy, type ReadRouteOptions as cz, type ChangeEventName as d, wholeKeysSentinel as d$, type WriteEnvelope as d0, type WriteInput as d1, type WriteKind as d2, type WriteLifecyclePhase as d3, type WriteMiddleware as d4, type WriteRecorder as d5, type WriteResultProjection as d6, attachModelClass as d7, buildDeleteInput as d8, buildMaintenanceGraph as d9, isContractFromRef as dA, isContractKeyFieldRef as dB, isContractKeyRef as dC, isContractParamRef as dD, isEntityWritesDefinition as dE, isKeySegment as dF, isLifecycleContract as dG, isMaintainTrigger as dH, isMutationFragment as dI, isMutationInputRef as dJ, isPlannedCommandMethod as dK, isPreparedParamRef as dL, isQueryModelContract as dM, isRetryableError as dN, isRetryableTransactionCancellation as dO, k as dP, key as dQ, lifecyclePhaseForIntent as dR, maintainTrigger as dS, mintContractKeyFieldRef as dT, mintContractParamRef as dU, mutation as dV, prepare as dW, preview as dX, publicCommandModel as dY, publicQueryModel as dZ, query as d_, buildPutInput as da, buildUpdateInput as db, collectViewDefinitions as dc, cond as dd, contractOfMethodSpec as de, definePlan as df, entityWrites as dg, executeBatchGet as dh, executeBatchWrite as di, executeCommandMethod as dj, executeDelete as dk, executeKeyedBatchGet as dl, executePut as dm, executeQueryMethod as dn, executeRangeFanout as dp, executeTransaction as dq, executeUpdate as dr, from as ds, getEntityWrites as dt, gsi as du, identity as dv, isColumn as dw, isCommandModelContract as dx, isCommandPlan as dy, isContractComposeNode as dz, type ChangeHandler as e, type ClockMode as f, type ConcurrentRecomputeRef as g, type StartingPosition as h, type StreamViewType as i, type SubscribeHandler as j, type SubscribeHandlers as k, buildSubscribeHandler as l, type EntityMetadata as m, type Executor as n, type ReadExecOptions as o, type ExecutorResult as p, type BatchGetExecInput as q, type WriteResult as r, type UpdateInput as s, type DeleteInput as t, type BatchWriteExecItem as u, type BatchExecOptions as v, DDBModel as w, type QueryMethodSpec as x, type CommandModelContract as y, type CommandMethodSpec as z };