graphddb 0.3.0 → 0.4.0

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.
@@ -1343,7 +1343,7 @@ type ProjectionOf<T, Sel> = Sel extends SelectableOf<T> ? Sel : SelectOf<Sel>;
1343
1343
  * usages keep compiling, while the precise inference is available when the
1344
1344
  * constructor type is supplied (as it is from `DDBModel.asModel()`).
1345
1345
  */
1346
- type AnyModelClass = abstract new (...args: any[]) => DDBModel;
1346
+ type AnyModelClass$1 = abstract new (...args: any[]) => DDBModel;
1347
1347
  /**
1348
1348
  * The accepted PK / GSI key type for `list()` / `explain()`.
1349
1349
  *
@@ -1353,24 +1353,24 @@ type AnyModelClass = abstract new (...args: any[]) => DDBModel;
1353
1353
  * {@link QueryKey}. Derived from the model class when available, otherwise
1354
1354
  * permissive.
1355
1355
  */
1356
- type ListKey<C> = [C] extends [AnyModelClass] ? PartialQueryKeyOf<C> : Record<string, unknown>;
1356
+ type ListKey<C> = [C] extends [AnyModelClass$1] ? PartialQueryKeyOf<C> : Record<string, unknown>;
1357
1357
  /**
1358
1358
  * The accepted key type for `query()` — only keys guaranteed to return a
1359
1359
  * single item (PK + unique GSIs). Derived from the model class when available.
1360
1360
  */
1361
- type QueryKey<C> = [C] extends [AnyModelClass] ? UniqueQueryKeyOf<C> : Record<string, unknown>;
1361
+ type QueryKey<C> = [C] extends [AnyModelClass$1] ? UniqueQueryKeyOf<C> : Record<string, unknown>;
1362
1362
  /**
1363
1363
  * The accepted key type for `delete()` (PK only). Derived from the model
1364
1364
  * class when available.
1365
1365
  */
1366
- type DeleteKey<C> = [C] extends [AnyModelClass] ? PrimaryKeyOf<C> : Record<string, unknown>;
1366
+ type DeleteKey<C> = [C] extends [AnyModelClass$1] ? PrimaryKeyOf<C> : Record<string, unknown>;
1367
1367
  /**
1368
1368
  * The accepted *explicit* key type for `update()` — the base-table primary key
1369
1369
  * only. DynamoDB `UpdateItem` can target an item solely by its base-table PK
1370
1370
  * (GSI-based updates are impossible), so this is `PrimaryKeyOf<C>`, not
1371
1371
  * `UniqueQueryKeyOf<C>`. Derived from the model class when available.
1372
1372
  */
1373
- type UpdateExplicitKey<C> = [C] extends [AnyModelClass] ? PrimaryKeyOf<C> : Record<string, unknown>;
1373
+ type UpdateExplicitKey<C> = [C] extends [AnyModelClass$1] ? PrimaryKeyOf<C> : Record<string, unknown>;
1374
1374
  /**
1375
1375
  * Options accepted by `list()` (third argument). The projection is supplied as
1376
1376
  * the separate second `select` argument, symmetric with `query()`.
@@ -2057,7 +2057,17 @@ type ProjectionMap = Readonly<Record<string, ProjectionTransform>>;
2057
2057
  * @param n The preview length bound (a positive integer).
2058
2058
  * @throws if `n` is not a positive integer.
2059
2059
  */
2060
- declare function preview(path: EffectPath, n: number): ProjectionTransform;
2060
+ /**
2061
+ * A value position the projection helpers accept: either a literal path string or
2062
+ * a symbolic `source.<field>` reference (a `{ path }` carrier — the `SourceRef` the
2063
+ * `@maintainedFrom` / versioned `(self, source) =>` callbacks mint, issue #152).
2064
+ * Typed structurally (no import) so `entity-writes` stays free of a back-edge to
2065
+ * the decorator layer; the symbolic ref's branded type still flows through.
2066
+ */
2067
+ type PathLike = EffectPath | {
2068
+ readonly path: EffectPath;
2069
+ };
2070
+ declare function preview(path: PathLike, n: number): ProjectionTransform;
2061
2071
  /**
2062
2072
  * Standalone authoring helper for an `identity` {@link ProjectionTransform}: copy
2063
2073
  * the source `path` through unchanged. The recorder-free counterpart to
@@ -2069,7 +2079,7 @@ declare function preview(path: EffectPath, n: number): ProjectionTransform;
2069
2079
  *
2070
2080
  * @param path The source value copied through unchanged.
2071
2081
  */
2072
- declare function identity(path: EffectPath): ProjectionTransform;
2082
+ declare function identity(path: PathLike): ProjectionTransform;
2073
2083
  /**
2074
2084
  * The **path** a maintenance write travels (shared vocabulary, epic #118 A/B
2075
2085
  * reconciliation — RFC §5.1 / issue #121 are the authority). `mutation` lands the
@@ -2115,19 +2125,33 @@ interface SnapshotEffect {
2115
2125
  /** The consistency the write lands under (default `eventual`). */
2116
2126
  readonly consistency?: MaintainConsistency;
2117
2127
  }
2128
+ /** The sort direction a maintained collection orders by (mirrors the read-side `read.order`). */
2129
+ type CollectionOrderDirection = 'ASC' | 'DESC';
2118
2130
  /**
2119
2131
  * Options for the bounded collection a {@link CollectionEffect} maintains: the
2120
2132
  * target {@link field} that holds the collection, an optional {@link maxItems}
2121
2133
  * cap (oldest items are evicted past it), and an optional {@link orderBy} source
2122
- * path the items are ordered by.
2134
+ * path the items are ordered by (with an {@link orderDir} direction).
2123
2135
  */
2124
2136
  interface CollectionOptions {
2125
2137
  /** The target attribute that holds the maintained collection. */
2126
2138
  readonly field: string;
2127
2139
  /** Cap on the collection size; items past it are evicted (unbounded if omitted). */
2128
2140
  readonly maxItems?: number;
2129
- /** A path-rooted source value the collection is ordered by (e.g. `$.entity.createdAt`). */
2141
+ /**
2142
+ * A path-rooted source value the collection is ordered by (e.g. `$.entity.createdAt`).
2143
+ * Wired from the relation's `read.order` (#130 是正2): the field is the source
2144
+ * entity's sort-key leaf (the field the live `hasMany` read orders by via
2145
+ * `ScanIndexForward`), so the materialized collection sorts the SAME way as the
2146
+ * live query. The async drain ({@link import('../cdc/maintenance-drain.js')})
2147
+ * applies the sort + trim; a single synchronous `UpdateExpression` cannot.
2148
+ */
2130
2149
  readonly orderBy?: EffectPath;
2150
+ /**
2151
+ * The direction {@link orderBy} sorts by — `'DESC'` (newest first, the default a
2152
+ * bare `order: 'DESC'` declares) or `'ASC'`. Present only when {@link orderBy} is.
2153
+ */
2154
+ readonly orderDir?: CollectionOrderDirection;
2131
2155
  }
2132
2156
  /**
2133
2157
  * A **collection** maintenance effect (issue #120): on a {@link MaintainTrigger}
@@ -2216,12 +2240,81 @@ interface CounterEffect {
2216
2240
  /** The consistency the write lands under (default `eventual`). */
2217
2241
  readonly consistency?: MaintainConsistency;
2218
2242
  }
2243
+ /**
2244
+ * The comparison op a {@link MembershipPredicate} applies to the source value
2245
+ * (Epic #118 pattern 6 / sparse view, issue #133). The host-side drain evaluates
2246
+ * the predicate against the source payload to decide PUT (true) vs DELETE (false):
2247
+ *
2248
+ * - `truthy` / `falsy` — the source value is/ isn't truthy (no `value`);
2249
+ * - `exists` / `notExists` — the source attribute is present / absent (no `value`);
2250
+ * - `eq` / `ne` — the source value equals / does not equal {@link MembershipPredicate.value}.
2251
+ */
2252
+ type MembershipPredicateOp = 'truthy' | 'falsy' | 'exists' | 'notExists' | 'eq' | 'ne';
2253
+ /**
2254
+ * A membership predicate over the source payload (Epic #118 pattern 6 / sparse view,
2255
+ * issue #133). When the predicate holds, the view item is PUT (projected); when it
2256
+ * flips false the view item is DELETED. This is the "述語が flip したら view item を
2257
+ * put/delete" maintenance — distinct from a GSI sparse index (an explicit view row,
2258
+ * conditionally present). The `path` is a payload-rooted source value (`$.entity.*` /
2259
+ * `$.input.*`); `value` is the comparand for `eq` / `ne` (absent for the unary ops).
2260
+ */
2261
+ interface MembershipPredicate {
2262
+ /** The payload-rooted source value the predicate tests (`$.entity.<field>`). */
2263
+ readonly path: EffectPath;
2264
+ /** The comparison op applied to the source value. */
2265
+ readonly op: MembershipPredicateOp;
2266
+ /** The comparand for `eq` / `ne`; absent for the unary ops. */
2267
+ readonly value?: unknown;
2268
+ }
2269
+ /**
2270
+ * A **membership** maintenance effect (Epic #118 pattern 6 / sparse view, issue #133):
2271
+ * on a {@link MaintainTrigger} a {@link predicate} is evaluated over the source
2272
+ * payload, and the view row resolved by {@link targetFactory} + {@link keys} is PUT
2273
+ * (its {@link project}ion) when the predicate holds OR DELETED when it does not. A
2274
+ * source `removed` event always deletes the view row (the source no longer exists).
2275
+ *
2276
+ * ## Why this is a NEW effect (not a snapshot/collection)
2277
+ *
2278
+ * A {@link SnapshotEffect} only ever `SET`s (it cannot remove a row when a predicate
2279
+ * flips false) and a {@link CollectionEffect} only appends/splices a list field —
2280
+ * neither expresses "the WHOLE view row appears/disappears as a predicate flips". So
2281
+ * sparse view is a distinct effect carrying a {@link predicate} and a put-or-delete
2282
+ * realization.
2283
+ *
2284
+ * ## Scope (issue #133): the asynchronous (`stream`) path
2285
+ *
2286
+ * The put-vs-delete branch is decided by evaluating the predicate against the source
2287
+ * image, which the host-side CDC drain ({@link import('../cdc/maintenance-drain.js')})
2288
+ * does naturally (it already branches snapshot SET vs collection read-modify-write). A
2289
+ * SYNCHRONOUS membership write would need the atomic transaction to choose Put-vs-Delete
2290
+ * from a runtime predicate (DynamoDB cannot branch an item kind on a value), which is a
2291
+ * larger runtime change deferred as a follow-up; the compile injection rejects a
2292
+ * `mutation`-path membership effect so it is never silently mis-realized.
2293
+ */
2294
+ interface MembershipEffect {
2295
+ readonly kind: 'membership';
2296
+ /** The lifecycle event of the source entity that drives the membership write. */
2297
+ readonly trigger: MaintainTrigger;
2298
+ /** Resolves the target (view) entity whose row appears / disappears. */
2299
+ readonly targetFactory: () => new (...args: unknown[]) => unknown;
2300
+ /** The key binding of the view row (path-rooted values). */
2301
+ readonly keys: Readonly<Record<string, EffectPath>>;
2302
+ /** The projection PUT onto the view row when the predicate holds. */
2303
+ readonly project: ProjectionMap;
2304
+ /** The membership predicate (PUT when it holds, DELETE when it flips false). */
2305
+ readonly predicate: MembershipPredicate;
2306
+ /** The path the write travels — `stream` only for issue #133 (see header). */
2307
+ readonly updateMode?: MaintainUpdateMode;
2308
+ /** The consistency the write lands under (default `eventual`). */
2309
+ readonly consistency?: MaintainConsistency;
2310
+ }
2219
2311
  /**
2220
2312
  * The union of maintenance effects a {@link SnapshotEffect}, {@link CollectionEffect},
2221
- * or {@link CounterEffect} can be. The shared IR the maintenance graph (#124) and
2222
- * compile injection (#125 snapshot/collection, #141 counter) consume.
2313
+ * {@link CounterEffect}, or {@link MembershipEffect} can be. The shared IR the
2314
+ * maintenance graph (#124) and compile injection (#125 snapshot/collection, #141
2315
+ * counter, #133 membership) consume.
2223
2316
  */
2224
- type MaintainEffect = SnapshotEffect | CollectionEffect | CounterEffect;
2317
+ type MaintainEffect = SnapshotEffect | CollectionEffect | CounterEffect | MembershipEffect;
2225
2318
  /**
2226
2319
  * A domain event (proposal §2 `emits`): an outbox `Put` drained to Streams /
2227
2320
  * `src/cdc/`. Derived by #87 — stored opaquely here.
@@ -2668,6 +2761,74 @@ declare function mutation(name: string, body: MutationBody): CommandPlan;
2668
2761
  */
2669
2762
  declare const definePlan: typeof mutation;
2670
2763
 
2764
+ /**
2765
+ * Decorator-metadata → maintenance-graph `ViewDefinition` adapter (issue #152).
2766
+ *
2767
+ * ## What this replaces
2768
+ *
2769
+ * The old `defineView` / `defineVersioned` builders (deleted) registered
2770
+ * `ViewDefinition`s into a side `ViewRegistry`, which the maintenance graph read.
2771
+ * That builder carried a registration side-effect + a `generation` counter (a
2772
+ * silent-drop guard). This adapter removes that whole path: it derives the SAME
2773
+ * `ViewDefinition` IR purely from the declarative `MetadataRegistry` — the
2774
+ * Contract-layer SSoT, whose own `generation` counter is the single
2775
+ * invalidation source — so a view declared via `@model({ kind })` + `@maintainedFrom`
2776
+ * (and a versioned relation declared via `@hasOne/@hasMany` `pattern`) is discovered
2777
+ * with no separate registry.
2778
+ *
2779
+ * ## IR invariance
2780
+ *
2781
+ * The `ViewDefinition` / `ViewSourceSlice` shapes are UNCHANGED. The maintenance
2782
+ * graph, the K (#130) stream/drain, and the L (#131) rebuild consume the adapter's
2783
+ * output exactly as they consumed `ViewRegistry.getAll()`. Only the SOURCE of the
2784
+ * definitions moved from a builder side-effect to declarative metadata.
2785
+ *
2786
+ * ## Order independence (issue #152 hardening)
2787
+ *
2788
+ * Stacked `@maintainedFrom` declarations carry no order meaning. The adapter rejects
2789
+ * — symmetrically, so the error is identical whichever order the decorators are
2790
+ * stacked — any two declarations on the same view that:
2791
+ * 1. write the SAME projection target attribute (ambiguous duplicate projection);
2792
+ * 2. maintain the SAME `collection.field`;
2793
+ * 3. bind the SAME view-key field to a DIFFERENT source path (the view-row identity
2794
+ * would be inconsistent across sources).
2795
+ * A legitimate multi-source view (different sources filling DIFFERENT fields, all
2796
+ * binding the SAME key the SAME way) is fine.
2797
+ */
2798
+
2799
+ type AnyModelClass = abstract new (...args: any[]) => any;
2800
+ /** The view source slice IR the maintenance graph consumes (one per source × view). */
2801
+ interface ViewSourceSlice {
2802
+ readonly sourceClass: AnyModelClass;
2803
+ readonly maintainedOn: readonly MaintainTrigger[];
2804
+ readonly keys: Readonly<Record<string, EffectPath>>;
2805
+ readonly project: ProjectionMap;
2806
+ readonly collection?: {
2807
+ readonly field: string;
2808
+ readonly maxItems?: number;
2809
+ readonly orderBy?: EffectPath;
2810
+ readonly orderDir?: 'ASC' | 'DESC';
2811
+ };
2812
+ readonly predicate?: MembershipPredicate;
2813
+ }
2814
+ /** The view definition IR — an independent view row maintained from one or more sources. */
2815
+ interface ViewDefinition {
2816
+ readonly name: string;
2817
+ readonly viewClass: AnyModelClass;
2818
+ readonly pattern: 'materializedView' | 'sparseView';
2819
+ readonly slices: readonly ViewSourceSlice[];
2820
+ readonly updateMode?: 'mutation' | 'stream';
2821
+ readonly consistency?: 'transactional' | 'eventual';
2822
+ }
2823
+ /**
2824
+ * Build every {@link ViewDefinition} for a registry — from `@model({ kind })` +
2825
+ * `@maintainedFrom` view models AND from versioned-pattern relations. This is the
2826
+ * adapter the maintenance graph calls in place of the deleted `ViewRegistry.getAll()`.
2827
+ *
2828
+ * @param registry The models to scan. Defaults to `MetadataRegistry.getAll()`.
2829
+ */
2830
+ declare function collectViewDefinitions(registry?: ReadonlyMap<Function, EntityMetadata>): ViewDefinition[];
2831
+
2671
2832
  /**
2672
2833
  * Maintenance graph builder (Epic #118 issue #124 — the RFC B-案 core).
2673
2834
  *
@@ -2823,7 +2984,7 @@ interface MaintenanceGraph {
2823
2984
  * @param registry The models to scan. Defaults to `MetadataRegistry.getAll()`;
2824
2985
  * an explicit map is accepted for tests / scoped builds.
2825
2986
  */
2826
- declare function buildMaintenanceGraph(registry?: ReadonlyMap<Function, EntityMetadata>): MaintenanceGraph;
2987
+ declare function buildMaintenanceGraph(registry?: ReadonlyMap<Function, EntityMetadata>, views?: readonly ViewDefinition[]): MaintenanceGraph;
2827
2988
 
2828
2989
  /**
2829
2990
  * Serializable static operation specs and manifest (issue #42, Python-bridge
@@ -3240,6 +3401,8 @@ interface MaintainCollectionSpec {
3240
3401
  readonly maxItems?: number;
3241
3402
  /** The mutation-input field the items are ordered by (recorded for #130). */
3242
3403
  readonly orderBy?: string;
3404
+ /** The direction `orderBy` sorts by, from the relation's `read.order` (recorded for #130). */
3405
+ readonly orderDir?: 'ASC' | 'DESC';
3243
3406
  }
3244
3407
  /**
3245
3408
  * The maintenance payload an `Update` {@link TransactionItemSpec} carries when it
@@ -3576,48 +3739,6 @@ interface BridgeBundle {
3576
3739
  readonly operations: OperationsDocument;
3577
3740
  }
3578
3741
 
3579
- /**
3580
- * Single-fragment mutation → command-op compiler (issue #83, Epic #80; proposal
3581
- * `docs/mutation-command-derivation.md` §3).
3582
- *
3583
- * A {@link CommandPlan} (a `mutation(...)` result) is the internal IR: a **list**
3584
- * of write fragments to compose atomically. This module compiles the
3585
- * **single-fragment** case end-to-end into the **same** {@link ContractMethodOp}
3586
- * the #58 contract recorder produces, so the existing serializer
3587
- * (`opToDefinition` → `buildCommandSpec`, `src/spec/contracts.ts` /
3588
- * `src/spec/operations.ts`) and the existing runtimes consume it with no new
3589
- * write substrate. The IR is already a list, so the **N-fragment atomic merge is
3590
- * #90** — this module rejects N>1 with a clear pointer rather than half-merging.
3591
- *
3592
- * ## Intent → base op (proposal §3, "single fragment compile")
3593
- *
3594
- * | intent | base op |
3595
- * |----------|-------------------------------------------|
3596
- * | `create` | `PutItem` (`attribute_not_exists(PK)`) |
3597
- * | `update` | `UpdateItem` (key + changed fields) |
3598
- * | `remove` | `DeleteItem` (key) |
3599
- *
3600
- * ## `use:` resolution (the resolved fork — proposal §3, pinned spec correction)
3601
- *
3602
- * The fragment's **intent** selects the lifecycle; `use:` is **optional**:
3603
- *
3604
- * - `use:` present → adopt that {@link EntityWritesDefinition} (the **whole**
3605
- * `writes` set; never a single lifecycle).
3606
- * - `use:` omitted → default to the **target model's own** `entityWrites` save
3607
- * contract ({@link getEntityWrites}).
3608
- * - the resolved save contract (custom or default) has **no** entry for the
3609
- * intent's lifecycle, **or the target declares no `writes` at all** → the
3610
- * **trivial base op** for the intent (create → `Put` `attribute_not_exists(PK)`,
3611
- * update → `Update`, remove → `Delete`) against the plain model. So
3612
- * `{ create: () => PostModel, key, input }` works on a bare model.
3613
- *
3614
- * Either way #83 emits the **same** base op — the resolved
3615
- * {@link LifecycleContract} only matters as the **per-fragment hook** the
3616
- * effect-derivation issues (#84–#87) read: the resolved lifecycle's
3617
- * {@link LifecycleContract.effects} are exposed on {@link CompiledFragment} and
3618
- * consumed by NONE of #83 (the empty hook).
3619
- */
3620
-
3621
3742
  /**
3622
3743
  * A **referential-integrity assertion** derived from a `requires`
3623
3744
  * ({@link RequiresEffect}) effect (issue #84; proposal §2/§3). It is the
@@ -3734,11 +3855,32 @@ interface DerivedMaintainWrite {
3734
3855
  readonly relationProperty: string;
3735
3856
  /** The trigger (`<sourceLogicalName>.<event>`) that fired this maintenance. */
3736
3857
  readonly trigger: MaintainTrigger;
3858
+ /**
3859
+ * The maintenance delivery mode (Epic #118 §5.1 `updateMode`):
3860
+ *
3861
+ * - `'mutation'` (synchronous, the default) — the write composes into the SAME
3862
+ * atomic `TransactWriteItems` as the source write (#127); a snapshot `SET`,
3863
+ * a bounded-collection `list_append` (Phase 1 append-only), or a counter `ADD`.
3864
+ * - `'stream'` (asynchronous, #130) — the write is NOT placed in the source tx.
3865
+ * Instead a **maintenance-outbox** row is emitted atomically with the source
3866
+ * write ({@link DerivedMaintainOutbox}) and a CDC drain
3867
+ * ({@link import('../cdc/maintenance-drain.js')}) applies the owner-row write
3868
+ * asynchronously (at-least-once, per-shard ordered). The async path realizes
3869
+ * the operations a single synchronous `UpdateExpression` cannot —
3870
+ * collection `maxItems` trim / `removed`-driven splice and a running `max`.
3871
+ *
3872
+ * A `stream` write is NOT composed into the synchronous maintain items; the
3873
+ * compiler diverts it to a {@link DerivedMaintainOutbox} instead (see
3874
+ * {@link splitMaintainByMode}). The field is carried here so a single resolved
3875
+ * structure describes both modes (the outbox derivation reads it back).
3876
+ */
3877
+ readonly updateMode: 'mutation' | 'stream';
3737
3878
  /**
3738
3879
  * Whether the write mirrors a single row (`snapshot`), appends a collection item
3739
- * (`collection`), or applies a scalar `ADD` counter (`counter`, #141).
3880
+ * (`collection`), applies a scalar `ADD` counter (`counter`, #141), or puts/deletes a
3881
+ * predicate-gated view row (`membership`, #133 sparse view — stream-only).
3740
3882
  */
3741
- readonly kind: 'snapshot' | 'collection' | 'counter';
3883
+ readonly kind: 'snapshot' | 'collection' | 'counter' | 'membership';
3742
3884
  /**
3743
3885
  * The destination row's key binding: target key field → the mutation-input param
3744
3886
  * that supplies it (resolved from the effect's `$.entity.<sourceField>` paths —
@@ -3766,18 +3908,44 @@ interface DerivedMaintainWrite {
3766
3908
  readonly field: string;
3767
3909
  readonly maxItems?: number;
3768
3910
  readonly orderBy?: string;
3911
+ readonly orderDir?: 'ASC' | 'DESC';
3769
3912
  };
3770
3913
  /**
3771
- * For a `counter` write (#141 `@aggregate(..., { pattern: 'counter', value:
3772
- * count() })`), the scalar `ADD`: the target {@link counter.attribute} and the
3773
- * signed {@link counter.delta} the trigger applies (`+1` created / `-1` removed).
3774
- * A counter `ADD` is commutative, so two counter writes on the SAME row MERGE (the
3775
- * #92 symmetric-counter collapse) rather than reject — unlike snapshot/collection.
3914
+ * For a `counter` write, the scalar aggregate applied to the owner attribute:
3915
+ *
3916
+ * - `op: 'count'` (#141) a synchronous-capable atomic `ADD #attr :delta` (the
3917
+ * signed `delta` is `+1` created / `-1` removed). Commutative, so two count
3918
+ * writes on the SAME row MERGE (the #92 symmetric-counter collapse).
3919
+ * - `op: 'max'` (#130 — `value: max(field)`) — a running maximum of the source
3920
+ * `field`. This needs a conditional `SET` (`#a = :v` guarded by
3921
+ * `attribute_not_exists(#a) OR #a < :v`); a failed guard would roll the SOURCE
3922
+ * write back if done synchronously, so a `max` counter is **stream-only** —
3923
+ * applied by the CDC drain ({@link import('../cdc/maintenance-drain.js')}).
3924
+ *
3776
3925
  * Absent for a `snapshot` / `collection`.
3777
3926
  */
3778
3927
  readonly counter?: {
3779
3928
  readonly attribute: string;
3929
+ readonly op: 'count';
3780
3930
  readonly delta: number;
3931
+ } | {
3932
+ readonly attribute: string;
3933
+ readonly op: 'max';
3934
+ readonly field: string;
3935
+ };
3936
+ /**
3937
+ * For a `membership` write (#133 sparse view), the predicate that gates the view row:
3938
+ * PUT (its projection) when it holds, DELETE when it flips false. `inputField` is the
3939
+ * mutation-input param the predicate reads the source value from (payload 同梱);
3940
+ * `op` / `value` are the {@link import('../define/entity-writes.js').MembershipPredicate}
3941
+ * realization. Membership is **stream-only** (the put-vs-delete branch is decided by
3942
+ * the host-side drain), so this is only ever carried on a `stream` write. Absent for
3943
+ * a `snapshot` / `collection` / `counter`.
3944
+ */
3945
+ readonly membership?: {
3946
+ readonly op: MembershipPredicateOp;
3947
+ readonly inputField: string;
3948
+ readonly value?: unknown;
3781
3949
  };
3782
3950
  }
3783
3951
  /**
@@ -3891,6 +4059,43 @@ interface DerivedIdempotencyGuard {
3891
4059
  /** The guard marker-row `Put` (one item; `attribute_not_exists`, `literalKey`). */
3892
4060
  readonly items: readonly TransactionItemSpec[];
3893
4061
  }
4062
+ /**
4063
+ * A **derived maintenance-outbox event** (issue #130) — the transactional-outbox
4064
+ * `Put` ({@link TransactionItemSpec}) that records a `updateMode: 'stream'`
4065
+ * maintainer's intent ATOMICALLY with the source write, so the `src/cdc/` drain can
4066
+ * apply the owner-row write asynchronously (at-least-once, per-shard ordered).
4067
+ *
4068
+ * ## What the row carries (dynamic values only; the drain re-derives the projection)
4069
+ *
4070
+ * The row's `PK`/`SK` are the deterministic `OUTBOX#MAINT#…` marker (keyed by owner
4071
+ * entity + relation property + the SOURCE row's primary-key input fields). Its
4072
+ * stored item carries:
4073
+ *
4074
+ * - the routing metadata literals — {@link MAINT_OUTBOX_OWNER_ATTR} (owner entity
4075
+ * name), {@link MAINT_OUTBOX_RELATION_ATTR} (the relation property), and
4076
+ * {@link MAINT_OUTBOX_TRIGGER_ATTR} (the `<source>.<event>` trigger) — so the drain
4077
+ * can look the resolved maintainer up in its own maintenance graph;
4078
+ * - one `{inputField}` token per source value the drain needs (every projection
4079
+ * `inputField`, the `orderBy` field, the `max` field, and every owner-key field),
4080
+ * rendered from the shared method params exactly as the #87 outbox payload — so the
4081
+ * row's `newImage` carries the just-written SOURCE row values the drain reprojects.
4082
+ *
4083
+ * The projection transform IR (`identity` / `preview`) is NOT stored in the row (it
4084
+ * would need braces the template renderer reserves for `{token}`s); the drain
4085
+ * recovers it from its maintenance graph by `(owner, relationProperty, trigger)`.
4086
+ * Because the row is a normal table item, real DynamoDB Streams captures it and a
4087
+ * production consumer drains it identically — the emulator is dev/test only.
4088
+ */
4089
+ interface DerivedMaintainOutbox {
4090
+ /** The maintained (owner) entity whose row the drain will write (documentary). */
4091
+ readonly ownerEntity: string;
4092
+ /** The relation property / `@aggregate` field that declared this maintenance. */
4093
+ readonly relationProperty: string;
4094
+ /** The trigger (`<sourceLogicalName>.<event>`) that fired this maintenance. */
4095
+ readonly trigger: MaintainTrigger;
4096
+ /** The maintenance-outbox marker-row `Put` (one item; `literalKey`, `MARKER_ROW_ENTITY`). */
4097
+ readonly items: readonly TransactionItemSpec[];
4098
+ }
3894
4099
  /**
3895
4100
  * The result of compiling one fragment: the {@link ContractMethodOp} the existing
3896
4101
  * serializer / runtime consume, the resolved contract Key fields (the model's
@@ -3984,8 +4189,26 @@ interface CompiledFragment {
3984
4189
  * realizes into the atomic `TransactWriteItems`; #125 derives it and rejects a
3985
4190
  * same-target collision (論点2 = b). The cross-fragment AGGREGATION and the
3986
4191
  * one-atomic-tx execution wiring are #127 — not done here.
4192
+ *
4193
+ * SCOPE (#130): this carries ONLY the synchronous (`updateMode: 'mutation'`)
4194
+ * maintainers. A `updateMode: 'stream'` maintainer is diverted to
4195
+ * {@link maintainOutbox} instead (it is applied asynchronously by the CDC drain),
4196
+ * so it never appears here.
3987
4197
  */
3988
4198
  readonly maintainWrites?: readonly DerivedMaintainWrite[];
4199
+ /**
4200
+ * The maintenance-outbox events for this fragment's `updateMode: 'stream'`
4201
+ * maintainers (issue #130): one {@link DerivedMaintainOutbox} per stream maintainer
4202
+ * the fragment's trigger fires. Each is a transactional-outbox `Put` composed into
4203
+ * the source write's atomic `TransactWriteItems` — recording the maintenance intent
4204
+ * ATOMICALLY with the source row — which the `src/cdc/` drain
4205
+ * ({@link import('../cdc/maintenance-drain.js')}) selects (`PK begins_with
4206
+ * 'OUTBOX#MAINT#'`) and applies asynchronously (at-least-once, per-shard ordered).
4207
+ * Present (non-empty) only when the fragment fires at least one stream maintainer;
4208
+ * absent otherwise (no regression — a fragment with no stream maintainer compiles
4209
+ * exactly as before).
4210
+ */
4211
+ readonly maintainOutbox?: readonly DerivedMaintainOutbox[];
3989
4212
  }
3990
4213
  /**
3991
4214
  * Resolve the {@link LifecycleContract} a fragment adopts for its intent:
@@ -4716,10 +4939,22 @@ interface CommandMethodSpec<TKey, TParams, TResult> {
4716
4939
  * otherwise single-op method to a transaction: the runtime (#127) realizes each
4717
4940
  * into the method's atomic `TransactWriteItems`, so the maintained row moves
4718
4941
  * atomically with the source write (a failure rolls the WHOLE set back). #127 is
4719
- * the synchronous (`updateMode: 'mutation'`) path only; the async stream path is
4720
- * #130 (loud-rejected at compile time, never silently dropped).
4942
+ * the synchronous (`updateMode: 'mutation'`) path only; a `updateMode: 'stream'`
4943
+ * maintainer is carried in {@link maintainOutbox} instead (it is applied
4944
+ * asynchronously by the CDC drain), never in this synchronous slot.
4721
4945
  */
4722
4946
  readonly maintainWrites?: readonly DerivedMaintainWrite[];
4947
+ /**
4948
+ * The maintenance-outbox events for `updateMode: 'stream'` maintainers (issue
4949
+ * #130): one {@link DerivedMaintainOutbox} per stream maintainer fired across the
4950
+ * method's fragments. Each is a transactional-outbox `Put` the runtime composes
4951
+ * into the method's atomic `TransactWriteItems` — recording the maintenance intent
4952
+ * ATOMICALLY with the source write — which the `src/cdc/` drain
4953
+ * ({@link import('../cdc/maintenance-drain.js')}) applies asynchronously
4954
+ * (at-least-once, per-shard ordered). Present (non-empty) only when the method fires
4955
+ * at least one stream maintainer; absent otherwise (no regression).
4956
+ */
4957
+ readonly maintainOutbox?: readonly DerivedMaintainOutbox[];
4723
4958
  /** @internal Phantom carrier retaining the formal `CommandMethod` type. */
4724
4959
  readonly __signature?: CommandMethod<TKey, TParams, TResult>;
4725
4960
  }
@@ -5336,6 +5571,18 @@ interface ExecutableCommandContract {
5336
5571
  * maintainer / a #64 hand-written method.
5337
5572
  */
5338
5573
  readonly maintainWrites?: readonly DerivedMaintainWrite[];
5574
+ /**
5575
+ * The maintenance-outbox events for `updateMode: 'stream'` maintainers (issue
5576
+ * #130). Each is a transactional-outbox `Put` (the same `literalKey` marker
5577
+ * mechanism as #87's outbox) composed into the method's atomic
5578
+ * `TransactWriteItems` — recording the maintenance intent ATOMICALLY with the
5579
+ * source write. The `src/cdc/` drain selects these (`PK begins_with
5580
+ * 'OUTBOX#MAINT#'`) and applies the owner-row write asynchronously (so a
5581
+ * snapshot SET / collection append+trim / counter ADD / running-max conditional
5582
+ * SET happens off the write path, at-least-once, per-shard ordered). Absent on a
5583
+ * mutation with no stream maintainer.
5584
+ */
5585
+ readonly maintainOutbox?: readonly DerivedMaintainOutbox[];
5339
5586
  /**
5340
5587
  * The return projection of a `mutation`-derived method (issue #83). When
5341
5588
  * present, a **single-key** call performs the write then issues a
@@ -5831,6 +6078,49 @@ interface FieldMetadata {
5831
6078
  literals?: readonly string[];
5832
6079
  }
5833
6080
 
6081
+ /**
6082
+ * The maintenance kind of a model (issue #152). `'entity'` (the default) is a plain
6083
+ * stored entity. `'materializedView'` / `'sparseView'` mark a model as a maintained
6084
+ * **view** row whose `@maintainedFrom` declarations feed the maintenance graph (the
6085
+ * adapter that replaces the old `defineView` / `ViewRegistry` path). A `sparseView`
6086
+ * requires every `@maintainedFrom` to carry a `when` membership predicate.
6087
+ */
6088
+ type ModelKind = 'entity' | 'materializedView' | 'sparseView';
6089
+ /**
6090
+ * One lowered `@maintainedFrom(source, (self, source) => options)` declaration on a
6091
+ * view model (issue #152). It is the decorator-declarative replacement for one
6092
+ * `defineView` source slice: the symbolic `(self, source) =>` callback has already
6093
+ * been evaluated into the SAME payload-rooted IR (`keyBind` → `$.entity.*` key
6094
+ * binding, `project` → {@link ProjectionMap}), so the adapter
6095
+ * (`src/relation/maintenance-view-adapter.ts`) reconstructs a byte-identical
6096
+ * `ViewSourceSlice` from it.
6097
+ *
6098
+ * `collection` and `when` are mutually exclusive (a row either holds a maintained
6099
+ * list or appears/disappears as a whole — the same rule the old builder enforced).
6100
+ */
6101
+ interface MaintainedFromMetadata {
6102
+ /** Resolves the source entity whose lifecycle events maintain the view row. */
6103
+ sourceFactory: () => new (...args: unknown[]) => unknown;
6104
+ /** The lifecycle events that maintain the view row (`created`/`updated`/`removed`). */
6105
+ on: readonly MaintainEvent[];
6106
+ /** The view-row key binding (view-row key field → payload-rooted source value). */
6107
+ keyBind: Readonly<Record<string, EffectPath>>;
6108
+ /** The projection of the source payload into the view row (target attr → transform). */
6109
+ project: ProjectionMap;
6110
+ /** Bounded/ordered collection options when this declaration maintains a list. */
6111
+ collection?: {
6112
+ /** The view-row attribute that holds the maintained list (a `self.<field>`). */
6113
+ field: string;
6114
+ maxItems?: number;
6115
+ order?: 'ASC' | 'DESC';
6116
+ /** The source value the collection orders by / trims on (`$.entity.<field>`). */
6117
+ orderBy?: EffectPath;
6118
+ };
6119
+ /** Sparse-view membership predicate (mutually exclusive with `collection`). */
6120
+ when?: MembershipPredicate;
6121
+ consistency?: MaintainConsistency;
6122
+ updateMode?: MaintainUpdateMode;
6123
+ }
5834
6124
  interface KeyDefinition {
5835
6125
  /** The canonical structured key (PK/SK segment lists). */
5836
6126
  segmented: SegmentedKey;
@@ -5860,8 +6150,18 @@ interface RelationLimitOptions {
5860
6150
  * Typed as a `string` union of the known presets but kept open-ended via the
5861
6151
  * `(string & {})` tail so a future preset can be authored before this union is
5862
6152
  * widened, without a breaking change to callers.
6153
+ *
6154
+ * The union lists only the presets that are actually *reachable* as a recorded
6155
+ * `RelationOptions.pattern` / `AggregateOptions.pattern` value: `samePartition`,
6156
+ * `counter`, `embeddedSnapshot`, and the two versioned discriminators
6157
+ * `versionedLatest` / `versionedHistory` (issue #152). `materializedView` /
6158
+ * `sparseView` migrated to the model-level `@model({ kind })` selector (they are
6159
+ * a {@link ModelKind}, not a relation preset); the placeholder `edge` /
6160
+ * `dualEdge` / `versioned` / `externalProjection` names are not authored anywhere
6161
+ * and were removed. A future preset can still be written against the `(string & {})`
6162
+ * tail before it is added to this union.
5863
6163
  */
5864
- type RelationPattern = 'samePartition' | 'edge' | 'counter' | 'embeddedSnapshot' | 'materializedView' | 'sparseView' | 'externalProjection' | (string & {});
6164
+ type RelationPattern = 'samePartition' | 'counter' | 'embeddedSnapshot' | 'versionedLatest' | 'versionedHistory' | (string & {});
5865
6165
  /**
5866
6166
  * Consistency boundary a maintained write is declared against (Epic #118 §4.A.7):
5867
6167
  * `transactional` = same `TransactWriteItems`; `eventual` = asynchronous catch-up.
@@ -5938,6 +6238,23 @@ interface RelationOptions {
5938
6238
  read?: RelationReadOptions;
5939
6239
  write?: RelationWriteOptions;
5940
6240
  projection?: RelationProjection;
6241
+ /**
6242
+ * Lowered versioned-pattern declaration (issue #152, section B). Present only when
6243
+ * the relation declares `pattern: 'versionedLatest' | 'versionedHistory'` via the
6244
+ * `@hasOne/@hasMany(() => Target, (self, source) => ({...}))` callback form. The
6245
+ * declaring model is the SOURCE (a revision); the relation target is the
6246
+ * DESTINATION view row. The adapter
6247
+ * (`src/relation/maintenance-view-adapter.ts`) lowers this to the SAME `defineView`
6248
+ * snapshot IR the old `defineVersioned` produced (latest = overwrite, history =
6249
+ * append). `on` are the lifecycle events; `project` is the lowered projection map.
6250
+ */
6251
+ versioned?: {
6252
+ readonly mode: 'latest' | 'history';
6253
+ readonly on: readonly MaintainEvent[];
6254
+ readonly project: ProjectionMap;
6255
+ readonly consistency?: MaintainConsistency;
6256
+ readonly updateMode?: MaintainUpdateMode;
6257
+ };
5941
6258
  }
5942
6259
  interface RelationMetadata {
5943
6260
  type: 'hasMany' | 'hasOne' | 'belongsTo';
@@ -6035,6 +6352,21 @@ interface EntityMetadata {
6035
6352
  /** Scalar `@aggregate` fields (Epic #118 §5.2 counter / latest; issue #122). */
6036
6353
  aggregates: AggregateMetadata[];
6037
6354
  embeddedFields: EmbeddedMetadata[];
6355
+ /**
6356
+ * The model's maintenance kind (issue #152). `'entity'` (default; also assumed
6357
+ * when absent, for hand-built metadata in tests) is a plain stored entity;
6358
+ * `'materializedView'` / `'sparseView'` mark it a maintained view row fed by
6359
+ * {@link maintainedFrom}.
6360
+ */
6361
+ kind?: ModelKind;
6362
+ /**
6363
+ * Class-level `@maintainedFrom(...)` declarations (issue #152). Non-empty only on
6364
+ * a `materializedView` / `sparseView` model; each is one source slice the view
6365
+ * row is maintained from. The adapter lowers these to the maintenance graph's
6366
+ * `ViewDefinition` IR (replacing the old `defineView` / `ViewRegistry` path).
6367
+ * Absent / empty for a plain entity.
6368
+ */
6369
+ maintainedFrom?: MaintainedFromMetadata[];
6038
6370
  }
6039
6371
 
6040
6372
  /**
@@ -6150,4 +6482,4 @@ interface CdcEmulatorOptions {
6150
6482
  }
6151
6483
  type ShardId = string;
6152
6484
 
6153
- export { type Param as $, type AggregateOptions as A, type BatchGetExecInput as B, type ChangeEvent as C, type DynamoDBOperation as D, type Executor as E, type FieldOptions as F, type GsiDefinition as G, type ResolvedKey as H, type Item as I, type CdcEmulatorOptions as J, type KeyDefinition as K, type ChangeHandler as L, type ModelStatic as M, type Unsubscribe as N, type FaultSpec as O, type PutInput as P, type ConcurrentRecomputeRef as Q, type ReadExecOptions as R, type SelectableOf as S, type TransactWriteExecItem as T, type UpdateInput as U, type EventLog as V, type WriteExecOptions as W, type ReplayOptions as X, type ShardId as Y, type RelationMetadata as Z, type TransactionItemSpec as _, type ExecutorResult as a, type ContractKeySpec as a$, type ParamDescriptor as a0, type DefinitionMap as a1, type OperationDefinition as a2, type WriteDefinitionOptions as a3, type PartialQueryKeyOf as a4, type StrictSelectSpec as a5, type EntityInput as a6, type UniqueQueryKeyOf as a7, type EntityRef as a8, type ConditionInput as a9, type CollectionEffect as aA, type CollectionOptions as aB, type Column as aC, type ColumnMap as aD, type CommandContractMethodSpec as aE, type CommandInputShape as aF, type CommandMethod as aG, type CommandPlan as aH, type CommandResolutionTarget as aI, type CommandResultKind as aJ, type CommandSelectShape as aK, type CompiledFragment as aL, type ComposeSpec as aM, type CondSlot as aN, type ConditionCheckInput as aO, type Connection as aP, type ContractCallSignature as aQ, type ContractCardinality as aR, type ContractCommandParams as aS, type ContractCommandResult as aT, type ContractComposeNode as aU, type ContractFromRef as aV, type ContractInputArity as aW, type ContractItem as aX, type ContractKeyFieldRef as aY, type ContractKeyInput as aZ, type ContractKeyRef as a_, type QueryModelContract as aa, type QueryMethodSpec as ab, type CommandModelContract as ac, type CommandMethodSpec as ad, type ContractSpec as ae, type QuerySpec as af, type CommandSpec as ag, type ContextSpec as ah, type OperationsDocument as ai, type AnyOperationDefinition as aj, type BridgeBundle as ak, type ConditionSpec as al, type AggregateMetadata as am, type BatchDeleteRequest as an, type BatchGetOptions as ao, type BatchGetRequest as ap, BatchGetResult as aq, type BatchPutRequest as ar, type BatchResult as as, type BatchWriteRequest as at, CONTRACT_RANGE_FANOUT_CONCURRENCY as au, type CdcMode as av, type Change as aw, type ChangeBatch as ax, type ChangeEventName as ay, type ClockMode as az, type WriteResult as b, type MutationInputProxy as b$, type ContractKind as b0, type ContractMethodOp as b1, type ContractParamRef as b2, type ContractQueryParams as b3, type ContractResolution as b4, type CounterAggregate as b5, type CounterEffect as b6, type CtxBase as b7, DEFAULT_MAX_ATTEMPTS as b8, DEFAULT_RETRY_POLICY as b9, type KeyedResult as bA, LIFECYCLE_CONTRACT_MARKER as bB, type LifecycleContract as bC, type LifecycleEffects as bD, type LiteralParam as bE, type MaintainConsistency as bF, type MaintainEffect as bG, type MaintainEvent as bH, type MaintainItem as bI, type MaintainTrigger as bJ, type MaintainUpdateMode as bK, type MaintenanceGraph as bL, type ManifestEntity as bM, type ManifestField as bN, type ManifestFieldType as bO, type ManifestGsi as bP, type ManifestKey as bQ, type ManifestRelation as bR, type ManifestTable as bS, type ModelRef as bT, type MutateMode as bU, type MutateOptions as bV, type MutateParallelResult as bW, type MutateTransactionResult as bX, type MutationBody as bY, type MutationDescriptorMap as bZ, type MutationFragment as b_, type DeleteOptions as ba, type DeriveEffect as bb, type DerivedEdgeWrite as bc, type DerivedUpdate as bd, type DescriptorBinding as be, ENTITY_WRITES_MARKER as bf, type EdgeEffect as bg, type EffectPath as bh, type EmbeddedMetadata as bi, type EmitEffect as bj, type EntityWritesDefinition as bk, type EntityWritesShape as bl, type ExecutableCommandContract as bm, type ExecutableQueryContract as bn, type FilterInput as bo, type FilterSpec as bp, type FragmentInput as bq, type GsiDefinitionMarker as br, type GsiOptions as bs, type IdempotencyEffect as bt, type InProcessWriteDescriptor as bu, type InputArity as bv, type KeyDefinitionMarker as bw, type KeySegment as bx, type KeySlot as by, type KeyStructure as bz, type DeleteInput as c, type WriteKind as c$, type MutationInputRef as c0, type MutationIntent as c1, type NumberParam as c2, type OperationKind as c3, type OperationSpec as c4, type ParallelOpResult as c5, type ParamKind as c6, type ParamSpec as c7, type ParamStructure as c8, type PersistCtx as c9, type RelationSelect as cA, type RelationSpec as cB, type RelationUpdateMode as cC, type RelationWriteOptions as cD, type RequiresEffect as cE, type Resolution as cF, type RetryInfo as cG, type RetryOperationKind as cH, SPEC_VERSION as cI, type SegmentSpec as cJ, type SegmentedKey as cK, type SelectBuilder as cL, type SelectOf as cM, type SnapshotEffect as cN, type StartingPosition as cO, type StreamViewType as cP, type StringParam as cQ, TransactionContext as cR, type TransactionItemType as cS, type UniqueEffect as cT, type Updatable as cU, type UpdateOptions as cV, type WhenSpec as cW, type WriteCtx as cX, type WriteDescriptor as cY, type WriteEnvelope as cZ, type WriteInput as c_, type PersistOrigin as ca, type PlannedCommandMethod as cb, type ProjectionMap as cc, type ProjectionTransform as cd, type ProjectionTransformOp as ce, type PutOptions as cf, type QueryContractMethodSpec as cg, type QueryEnvelopeResult as ch, type QueryKeyOf as ci, type QueryMethod as cj, type QueryResult as ck, type RangeConditionSpec as cl, type ReadEnvelope as cm, type ReadOpCtx as cn, type ReadOpKind as co, type ReadOperationType as cp, type ReadRouteDescriptor as cq, type ReadRouteOptions as cr, type ReadRouteResult as cs, type RecordedCompose as ct, type RelationBuilder as cu, type RelationConsistency as cv, type RelationLimitOptions as cw, type RelationPattern as cx, type RelationProjection as cy, type RelationReadOptions as cz, type BatchWriteExecItem as d, resolveLifecycle as d$, type WriteLifecyclePhase as d0, type WriteMiddleware as d1, type WriteOperationType as d2, type WriteRecorder as d3, type WriteResultProjection as d4, attachModelClass as d5, buildDeleteInput as d6, buildMaintenanceGraph as d7, buildPutInput as d8, buildUpdateInput 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, isParam as dK, isPlannedCommandMethod 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, param as dW, preview as dX, publicCommandModel as dY, publicQueryModel as dZ, query as d_, compileFragment as da, compileMutationPlan as db, compileSingleFragmentPlan 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 BatchExecOptions as e, wholeKeysSentinel as e0, DDBModel as f, type PrimaryKeyOf as g, type RequestContext as h, type Middleware as i, type ReadRequestKind as j, type CtxModel as k, type ReadParams as l, type ReadRequestCtx as m, type RetryPolicy as n, type ExecutionPlanSpec as o, type EntityMetadata as p, type DynamoType as q, type RelationOptions as r, type AggregateValue as s, type SelectBuilderSpec as t, type RawCondition as u, type TransactionSpec as v, type Manifest as w, type RetryOverride as x, type ExecutionPlan as y, type FieldMetadata as z };
6485
+ export { type FaultSpec as $, type AggregateOptions as A, type BatchGetExecInput as B, type ChangeEvent as C, type DynamoDBOperation as D, type Executor as E, type FieldOptions as F, type GsiDefinition as G, type SelectBuilderSpec as H, type Item as I, type RawCondition as J, type KeyDefinition as K, type TransactionSpec as L, type ModelStatic as M, type Manifest as N, type RetryOverride as O, type PutInput as P, type ExecutionPlan as Q, type ReadExecOptions as R, type SelectableOf as S, type TransactWriteExecItem as T, type UpdateInput as U, type FieldMetadata as V, type WriteExecOptions as W, type ResolvedKey as X, type CdcEmulatorOptions as Y, type ChangeHandler as Z, type Unsubscribe as _, type ExecutorResult as a, type ContractCommandParams as a$, type ConcurrentRecomputeRef as a0, type EventLog as a1, type ReplayOptions as a2, type ShardId as a3, type ViewDefinition as a4, type RelationMetadata as a5, type TransactionItemSpec as a6, type MaintainEffect as a7, type Param as a8, type ParamDescriptor as a9, type BatchPutRequest as aA, type BatchResult as aB, type BatchWriteRequest as aC, CONTRACT_RANGE_FANOUT_CONCURRENCY as aD, type CdcMode as aE, type Change as aF, type ChangeBatch as aG, type ChangeEventName as aH, type ClockMode as aI, type CollectionEffect as aJ, type CollectionOptions as aK, type Column as aL, type ColumnMap as aM, type CommandContractMethodSpec as aN, type CommandInputShape as aO, type CommandMethod as aP, type CommandPlan as aQ, type CommandResolutionTarget as aR, type CommandResultKind as aS, type CommandSelectShape as aT, type CompiledFragment as aU, type ComposeSpec as aV, type CondSlot as aW, type ConditionCheckInput as aX, type Connection as aY, type ContractCallSignature as aZ, type ContractCardinality as a_, type DefinitionMap as aa, type OperationDefinition as ab, type WriteDefinitionOptions as ac, type PartialQueryKeyOf as ad, type StrictSelectSpec as ae, type EntityInput as af, type UniqueQueryKeyOf as ag, type EntityRef as ah, type ConditionInput as ai, type QueryModelContract as aj, type QueryMethodSpec as ak, type CommandModelContract as al, type CommandMethodSpec as am, type ContractSpec as an, type QuerySpec as ao, type CommandSpec as ap, type ContextSpec as aq, type OperationsDocument as ar, type AnyOperationDefinition as as, type BridgeBundle as at, type ConditionSpec as au, type AggregateMetadata as av, type BatchDeleteRequest as aw, type BatchGetOptions as ax, type BatchGetRequest as ay, BatchGetResult as az, type WriteResult as b, type MutateOptions as b$, type ContractCommandResult as b0, type ContractComposeNode as b1, type ContractFromRef as b2, type ContractInputArity as b3, type ContractItem as b4, type ContractKeyFieldRef as b5, type ContractKeyInput as b6, type ContractKeyRef as b7, type ContractKeySpec as b8, type ContractKind as b9, type GsiDefinitionMarker as bA, type GsiOptions as bB, type IdempotencyEffect as bC, type InProcessWriteDescriptor as bD, type InputArity as bE, type KeyDefinitionMarker as bF, type KeySegment as bG, type KeySlot as bH, type KeyStructure as bI, type KeyedResult as bJ, LIFECYCLE_CONTRACT_MARKER as bK, type LifecycleContract as bL, type LifecycleEffects as bM, type LiteralParam as bN, type MaintainItem as bO, type MaintainTrigger as bP, type MaintenanceGraph as bQ, type ManifestEntity as bR, type ManifestField as bS, type ManifestFieldType as bT, type ManifestGsi as bU, type ManifestKey as bV, type ManifestRelation as bW, type ManifestTable as bX, type MembershipEffect as bY, type ModelRef as bZ, type MutateMode as b_, type ContractMethodOp as ba, type ContractParamRef as bb, type ContractQueryParams as bc, type ContractResolution as bd, type CounterAggregate as be, type CounterEffect as bf, type CtxBase as bg, DEFAULT_MAX_ATTEMPTS as bh, DEFAULT_RETRY_POLICY as bi, type DeleteOptions as bj, type DeriveEffect as bk, type DerivedEdgeWrite as bl, type DerivedUpdate as bm, type DescriptorBinding as bn, ENTITY_WRITES_MARKER as bo, type EdgeEffect as bp, type EffectPath as bq, type EmbeddedMetadata as br, type EmitEffect as bs, type EntityWritesDefinition as bt, type EntityWritesShape as bu, type ExecutableCommandContract as bv, type ExecutableQueryContract as bw, type FilterInput as bx, type FilterSpec as by, type FragmentInput as bz, type DeleteInput as c, type ViewSourceSlice as c$, type MutateParallelResult as c0, type MutateTransactionResult as c1, type MutationBody as c2, type MutationDescriptorMap as c3, type MutationFragment as c4, type MutationInputProxy as c5, type MutationInputRef as c6, type MutationIntent as c7, type NumberParam as c8, type OperationKind as c9, type RelationConsistency as cA, type RelationLimitOptions as cB, type RelationPattern as cC, type RelationProjection as cD, type RelationReadOptions as cE, type RelationSelect as cF, type RelationSpec as cG, type RelationUpdateMode as cH, type RelationWriteOptions as cI, type RequiresEffect as cJ, type Resolution as cK, type RetryInfo as cL, type RetryOperationKind as cM, SPEC_VERSION as cN, type SegmentSpec as cO, type SegmentedKey as cP, type SelectBuilder as cQ, type SelectOf as cR, type SnapshotEffect as cS, type StartingPosition as cT, type StreamViewType as cU, type StringParam as cV, TransactionContext as cW, type TransactionItemType as cX, type UniqueEffect as cY, type Updatable as cZ, type UpdateOptions as c_, type OperationSpec as ca, type ParallelOpResult as cb, type ParamKind as cc, type ParamSpec as cd, type ParamStructure as ce, type PersistCtx as cf, type PersistOrigin as cg, type PlannedCommandMethod as ch, type ProjectionMap as ci, type ProjectionTransformOp as cj, type PutOptions as ck, type QueryContractMethodSpec as cl, type QueryEnvelopeResult as cm, type QueryKeyOf as cn, type QueryMethod as co, type QueryResult as cp, type RangeConditionSpec as cq, type ReadEnvelope as cr, type ReadOpCtx as cs, type ReadOpKind as ct, type ReadOperationType as cu, type ReadRouteDescriptor as cv, type ReadRouteOptions as cw, type ReadRouteResult as cx, type RecordedCompose as cy, type RelationBuilder as cz, type BatchWriteExecItem as d, mintContractParamRef as d$, type WhenSpec as d0, type WriteCtx as d1, type WriteDescriptor as d2, type WriteEnvelope as d3, type WriteInput as d4, type WriteKind as d5, type WriteLifecyclePhase as d6, type WriteMiddleware as d7, type WriteOperationType as d8, type WriteRecorder as d9, getEntityWrites as dA, gsi as dB, identity as dC, isColumn as dD, isCommandModelContract as dE, isCommandPlan as dF, isContractComposeNode as dG, isContractFromRef as dH, isContractKeyFieldRef as dI, isContractKeyRef as dJ, isContractParamRef as dK, isEntityWritesDefinition as dL, isKeySegment as dM, isLifecycleContract as dN, isMaintainTrigger as dO, isMutationFragment as dP, isMutationInputRef as dQ, isParam as dR, isPlannedCommandMethod as dS, isQueryModelContract as dT, isRetryableError as dU, isRetryableTransactionCancellation as dV, k as dW, key as dX, lifecyclePhaseForIntent as dY, maintainTrigger as dZ, mintContractKeyFieldRef as d_, type WriteResultProjection as da, attachModelClass as db, buildDeleteInput as dc, buildMaintenanceGraph as dd, buildPutInput as de, buildUpdateInput as df, collectViewDefinitions as dg, compileFragment as dh, compileMutationPlan as di, compileSingleFragmentPlan as dj, cond as dk, contractOfMethodSpec as dl, definePlan as dm, entityWrites as dn, executeBatchGet as dp, executeBatchWrite as dq, executeCommandMethod as dr, executeDelete as ds, executeKeyedBatchGet as dt, executePut as du, executeQueryMethod as dv, executeRangeFanout as dw, executeTransaction as dx, executeUpdate as dy, from as dz, type BatchExecOptions as e, mutation as e0, param as e1, preview as e2, publicCommandModel as e3, publicQueryModel as e4, query as e5, resolveLifecycle as e6, wholeKeysSentinel as e7, DDBModel as f, type PrimaryKeyOf as g, type RequestContext as h, type Middleware as i, type ReadRequestKind as j, type CtxModel as k, type ReadParams as l, type ReadRequestCtx as m, type RetryPolicy as n, type ExecutionPlanSpec as o, type EntityMetadata as p, type ModelKind as q, type DynamoType as r, type ProjectionTransform as s, type MaintainEvent as t, type MembershipPredicate as u, type MaintainConsistency as v, type MaintainUpdateMode as w, type MembershipPredicateOp as x, type RelationOptions as y, type AggregateValue as z };