graphddb 0.3.1 → 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.
@@ -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
@@ -2752,446 +2762,72 @@ declare function mutation(name: string, body: MutationBody): CommandPlan;
2752
2762
  declare const definePlan: typeof mutation;
2753
2763
 
2754
2764
  /**
2755
- * `defineView` / `defineProjection` the maintained **view** and **external
2756
- * projection** definition DSL (Epic #118 Phase 2, issue #132 child M).
2757
- *
2758
- * ## Where this sits in the `define*` family
2759
- *
2760
- * This module extends the record-of-definitions pattern of
2761
- * `src/define/define.ts` (`defineQuery`/`defineList`/… grouped by
2762
- * `defineQueries`/`defineCommands`) with two new families that declare a single
2763
- * **view** node → IR:
2764
- *
2765
- * - {@link defineView} (`materializedView`) — declares an INDEPENDENT view row
2766
- * maintained from the lifecycle events of one or more **source** entities. The
2767
- * view row is its OWN modelled row (a `DDBModel` with its own `keys`), NOT a
2768
- * field of any source entity — the "特定エンティティのフィールドでない単体行" of
2769
- * RFC §5.3. RFC §5.3:
2770
- * ```ts
2771
- * defineView(UserThreadListModel, {
2772
- * pattern: 'materializedView',
2773
- * source: [{ entity: () => PostModel, maintainedOn: ['Post.created'], … }, …],
2774
- * keys: { userId: '$.entity.userId' },
2775
- * fields: { … }, // per-source projection of the view row
2776
- * write: { updateMode: 'stream' },
2777
- * })
2778
- * ```
2779
- * - {@link defineProjection} (`externalProjection`) — declares a stream + idempotency
2780
- * projection of a source entity into an EXTERNAL sink (BigQuery / S3 / OpenSearch
2781
- * in production; the CDC emulator in dev/test). RFC §5.3:
2782
- * ```ts
2783
- * defineProjection('TestCaseResultBQ', {
2784
- * pattern: 'externalProjection',
2785
- * source: () => TestCaseResultModel,
2786
- * via: 'stream',
2787
- * idempotencyKey: 'resultId',
2788
- * })
2789
- * ```
2790
- *
2791
- * `defineViews({...})` / `defineProjections({...})` take a record of these
2792
- * definition nodes and return the same record (typed), forming the IR the
2793
- * maintenance graph (#124, extended here as the third maintenance source after
2794
- * relations and aggregates) and the projection sink consume — exactly the
2795
- * `defineQueries`/`defineCommands`样式.
2796
- *
2797
- * ## Why a view is its own definition (not a relation `@hasMany`)
2798
- *
2799
- * A relation/aggregate maintainer (#124) hangs off a MODELLED entity row — its
2800
- * destination is a `DDBModel` class resolved by the relation owner, and its
2801
- * single source is the relation's `to`. A **materialized view** is the
2802
- * complementary case the RFC §5.3 calls out: an independent row fed by SEVERAL
2803
- * foreign sources (none of which is the view itself). So it cannot be a relation
2804
- * decorator on a source; it is its own top-level declaration whose destination is
2805
- * the dedicated **view model** row. That view model is a normal `DDBModel` (so the
2806
- * maintenance graph / drain / rebuild resolve its key with the SAME machinery they
2807
- * use for a relation owner — no parallel key system), but it is the owner of NO
2808
- * relation: the sources point INTO it, declared here rather than on the sources.
2809
- *
2810
- * ## Scope boundary (payload-同梱; multi-source as per-source slices)
2811
- *
2812
- * Each `source` projects ONLY from its own payload (the same payload-同梱 rule
2813
- * the relation maintenance graph enforces — RFC §4.A.6 `requiredContext` /
2814
- * write-time-fetch is a deferred follow-up). A multi-source view is therefore
2815
- * maintained as a UNION of per-source slices on one view row: `Post.created`
2816
- * updates the Post-projected `fields`, `Thread.read` updates the Thread-projected
2817
- * `fields`, each converging the shared view row through the K (#130) stream →
2818
- * outbox → drain path. A field whose value must combine attributes from more than
2819
- * one source in a single write (a cross-source join at maintenance time) is the
2820
- * `requiredContext` case and is out of scope — see the module-level note and the
2821
- * issue report.
2822
- */
2823
-
2824
- type AnyModelClass = abstract new (...args: any[]) => DDBModel;
2825
- /** A source-entity factory: a model class or a `ModelStatic` wrapper. */
2826
- type SourceFactory = () => AnyModelClass | ModelStatic<DDBModel>;
2827
- /** A bare-string identity shorthand or an explicit `w.transform(...)` IR node. */
2828
- type ProjectionEntry = ProjectionTransform | string;
2829
- /**
2830
- * Build a {@link MembershipPredicate} for a sparse view (Epic #118 pattern 6 / #133).
2831
- * The view row is PUT when the predicate holds and DELETED when it flips false. The
2832
- * `path` is normalized to a payload-rooted source value (a bare field name becomes
2833
- * `$.entity.<field>`).
2765
+ * Decorator-metadata maintenance-graph `ViewDefinition` adapter (issue #152).
2834
2766
  *
2835
- * Named `whenMember` (not `when`) to avoid colliding with the transaction-condition
2836
- * `when` helper (`src/define/transaction.ts`).
2767
+ * ## What this replaces
2837
2768
  *
2838
- * @example `whenMember('status', 'eq', 'active')` the view row exists only while
2839
- * `status === 'active'`.
2840
- * @example `whenMember('archived', 'falsy')` the view row exists only while
2841
- * `archived` is falsy.
2842
- */
2843
- declare function whenMember(field: string, op: MembershipPredicateOp, value?: unknown): MembershipPredicate;
2844
- /**
2845
- * One source contributing to a maintained view (issue #132). The source entity's
2846
- * lifecycle events ({@link maintainedOn}) drive the maintenance; its payload is
2847
- * projected into the view row's {@link fields} (payload-同梱). When the source
2848
- * maintains an ordered/bounded slice (a collection-shaped view) it declares
2849
- * {@link collection}; otherwise it maintains a single snapshot slice.
2850
- */
2851
- interface ViewSource {
2852
- /** Resolves the source entity whose lifecycle drives this slice of the view. */
2853
- readonly entity: SourceFactory;
2854
- /**
2855
- * The cross-entity triggers this source fires on (`'<Entity>.<event>'`, the
2856
- * shared `created`/`updated`/`removed` vocabulary). The entity segment must be
2857
- * the source entity's logical name (the maintenance graph validates it).
2858
- */
2859
- readonly maintainedOn: readonly string[];
2860
- /**
2861
- * The view-row key binding for THIS source: view-row key field → a path-rooted
2862
- * source value (`$.entity.<field>` / `$.input.<field>`). Resolves which view
2863
- * row this source event maintains. When omitted, the view-level {@link
2864
- * ViewDefinitionInput.keys} is used (the common case every source keys the
2865
- * view row the same way).
2866
- */
2867
- readonly keys?: Readonly<Record<string, EffectPath>>;
2868
- /**
2869
- * The projection of THIS source's payload into the view row (target attribute →
2870
- * identity shorthand string / `w.transform(...)`). When omitted, the view-level
2871
- * {@link ViewDefinitionInput.fields} is used.
2872
- */
2873
- readonly fields?: Readonly<Record<string, ProjectionEntry>>;
2874
- /**
2875
- * Declares this source maintains a bounded, ordered COLLECTION slice of the view
2876
- * row (e.g. "latest N posts") rather than a single snapshot. The `field` names
2877
- * the view-row attribute holding the list; `maxItems` / `order` shape it.
2878
- */
2879
- readonly collection?: {
2880
- readonly field: string;
2881
- readonly maxItems?: number;
2882
- readonly order?: 'ASC' | 'DESC';
2883
- /** The source path the collection orders by + trims on (e.g. `$.entity.createdAt`). */
2884
- readonly orderBy?: EffectPath;
2885
- };
2886
- /**
2887
- * Sparse-view predicate (Epic #118 pattern 6 / #133): when present, this source
2888
- * maintains a MEMBERSHIP slice — the view row is PUT (projected) while the predicate
2889
- * holds and DELETED when it flips false (and always deleted on a source `removed`).
2890
- * Build it with {@link whenMember} (e.g. `whenMember('status', 'eq', 'active')`). Mutually
2891
- * exclusive with {@link collection} (a row either appears/disappears or holds a list).
2892
- */
2893
- readonly when?: MembershipPredicate;
2894
- }
2895
- /** The author-facing input to {@link defineView}. */
2896
- interface ViewDefinitionInput {
2897
- /** The maintenance preset — `'materializedView'` (snapshot/collection) or `'sparseView'` (membership). */
2898
- readonly pattern?: 'materializedView' | 'sparseView';
2899
- /** One or more sources whose lifecycle events maintain the view row. */
2900
- readonly source: ViewSource | readonly ViewSource[];
2901
- /**
2902
- * The default view-row key binding (view-row key field → path-rooted source
2903
- * value). A source may override it with its own `keys`. At least one of the
2904
- * view-level `keys` or every source's `keys` must be present.
2905
- */
2906
- readonly keys?: Readonly<Record<string, EffectPath>>;
2907
- /** The default per-source projection of the view row (source may override). */
2908
- readonly fields?: Readonly<Record<string, ProjectionEntry>>;
2909
- /** Maintenance-write declaration shared by the sources (`updateMode` / `consistency`). */
2910
- readonly write?: {
2911
- readonly updateMode?: MaintainUpdateMode;
2912
- readonly consistency?: MaintainConsistency;
2913
- };
2914
- }
2915
- /** Marks an object as a {@link ViewDefinition} IR node. */
2916
- declare const VIEW_DEFINITION_MARKER: unique symbol;
2917
- /**
2918
- * The global registry of declared {@link ViewDefinition}s (issue #132). A
2919
- * `defineView(...)` registers itself here so the compile-side global maintenance
2920
- * graph (and the linter) discovers view maintainers WITHOUT the caller threading
2921
- * the definitions through — the same way `@model` auto-registers an entity in
2922
- * `MetadataRegistry`. A {@link generation} counter (bumped on every register /
2923
- * clear) lets a cache keyed off it invalidate when a view is added, so a
2924
- * newly-declared view is never silently dropped from the compile path.
2925
- */
2926
- declare class ViewRegistry {
2927
- private static readonly views;
2928
- private static gen;
2929
- /** Register (or replace, by view class) a declared view. Bumps the generation. */
2930
- static register(def: ViewDefinition): void;
2931
- /** Every registered view, in declaration order. */
2932
- static getAll(): readonly ViewDefinition[];
2933
- /** The monotonic generation counter (changes whenever the set of views changes). */
2934
- static get generation(): number;
2935
- /** Forget every registered view (test reset). Bumps the generation. */
2936
- static clear(): void;
2937
- }
2938
- /**
2939
- * The lowered per-source maintenance slice of a view — one entry per (source ×
2940
- * trigger), carrying the resolved source class, the validated triggers, the view
2941
- * row key binding, and the projection. Consumed by the maintenance graph (#124)
2942
- * which synthesizes the A-defined `SnapshotEffect` / `CollectionEffect` from it.
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.
2943
2797
  */
2798
+
2799
+ type AnyModelClass = abstract new (...args: any[]) => any;
2800
+ /** The view source slice IR the maintenance graph consumes (one per source × view). */
2944
2801
  interface ViewSourceSlice {
2945
- /** The resolved source model class (the lifecycle origin / projected payload). */
2946
2802
  readonly sourceClass: AnyModelClass;
2947
- /** The validated triggers this slice fires on. */
2948
2803
  readonly maintainedOn: readonly MaintainTrigger[];
2949
- /** The view-row key binding (view-row key field → path-rooted source value). */
2950
2804
  readonly keys: Readonly<Record<string, EffectPath>>;
2951
- /** The projection map (target attribute → `w.transform(...)` IR). */
2952
2805
  readonly project: ProjectionMap;
2953
- /** Bounded/ordered collection options when this slice maintains a list. */
2954
2806
  readonly collection?: {
2955
2807
  readonly field: string;
2956
2808
  readonly maxItems?: number;
2957
2809
  readonly orderBy?: EffectPath;
2958
2810
  readonly orderDir?: 'ASC' | 'DESC';
2959
2811
  };
2960
- /**
2961
- * Sparse-view membership predicate (Epic #118 pattern 6 / #133) when this slice
2962
- * maintains a put/delete membership row. The maintenance graph synthesizes a
2963
- * `MembershipEffect` (not a snapshot) from it.
2964
- */
2965
2812
  readonly predicate?: MembershipPredicate;
2966
2813
  }
2967
- /**
2968
- * The IR for one `defineView` node — an independent materialized-view row
2969
- * maintained from one or more source entities. The `name` is the view's logical
2970
- * identity; `viewClass` is the dedicated view model the row lives on (the
2971
- * maintenance destination); `slices` are the lowered per-source maintenance
2972
- * contributions the maintenance graph turns into effects.
2973
- */
2814
+ /** The view definition IR — an independent view row maintained from one or more sources. */
2974
2815
  interface ViewDefinition {
2975
- readonly [VIEW_DEFINITION_MARKER]: true;
2976
- /** The view's logical name (e.g. `'UserThreadList'`). */
2977
2816
  readonly name: string;
2978
- /** The dedicated view model class the maintained row lives on (the destination). */
2979
2817
  readonly viewClass: AnyModelClass;
2980
- /** The maintenance preset (`'materializedView'` or `'sparseView'`). */
2981
2818
  readonly pattern: 'materializedView' | 'sparseView';
2982
- /** The lowered per-source maintenance slices. */
2983
2819
  readonly slices: readonly ViewSourceSlice[];
2984
- /** The path the maintenance writes travel (`mutation` / `stream`). */
2985
- readonly updateMode?: MaintainUpdateMode;
2986
- /** The consistency the maintenance writes land under. */
2987
- readonly consistency?: MaintainConsistency;
2988
- }
2989
- /** Runtime guard: is `value` a {@link ViewDefinition}? */
2990
- declare function isViewDefinition(value: unknown): value is ViewDefinition;
2991
- /**
2992
- * Define a single maintained **view** (`materializedView`, issue #132): an
2993
- * independent view row (on the dedicated `view` model) maintained from one or more
2994
- * source entities' lifecycle events, projecting each source's payload (payload-同梱)
2995
- * into the view row. The returned {@link ViewDefinition} is the IR the maintenance
2996
- * graph (#124) consumes as a third maintenance source (after relations /
2997
- * aggregates), so a view row converges through the SAME stream → outbox → drain
2998
- * path (K, #130).
2999
- *
3000
- * @param view The dedicated view model class the maintained row lives on (a normal
3001
- * `DDBModel` with its own `keys`). Its logical name is the view's `name`.
3002
- * @param input The view's sources / key binding / projection / write declaration.
3003
- *
3004
- * @example
3005
- * ```ts
3006
- * const UserThreadList = defineView(UserThreadListModel, {
3007
- * pattern: 'materializedView',
3008
- * keys: { userId: '$.entity.userId' },
3009
- * source: [
3010
- * { entity: () => PostModel, maintainedOn: ['Post.created'],
3011
- * fields: { lastPostId: 'postId', lastPostAt: 'createdAt' } },
3012
- * { entity: () => ThreadModel, maintainedOn: ['Thread.updated'],
3013
- * fields: { threadTitle: 'title' } },
3014
- * ],
3015
- * write: { updateMode: 'stream' },
3016
- * });
3017
- * ```
3018
- */
3019
- declare function defineView(view: AnyModelClass | ModelStatic<DDBModel>, input: ViewDefinitionInput): ViewDefinition;
3020
- /** A record of view-name → {@link ViewDefinition}. */
3021
- type ViewDefinitionMap = Record<string, ViewDefinition>;
3022
- /**
3023
- * Group a record of {@link defineView} nodes into the view IR consumed by the
3024
- * maintenance graph (#124). Validates that every entry is a `defineView` node —
3025
- * the `defineQueries`/`defineCommands` 様式.
3026
- */
3027
- declare function defineViews<const D extends ViewDefinitionMap>(definitions: D): D;
3028
- /** The author-facing input to {@link defineVersioned}. */
3029
- interface VersionedDefinitionInput {
3030
- /** The maintenance preset — `'versioned'`. */
3031
- readonly pattern?: 'versioned';
3032
- /** Resolves the source entity whose lifecycle events maintain both rows. */
3033
- readonly source: SourceFactory;
3034
- /**
3035
- * The triggers that maintain a new version (`'<Entity>.<event>'`). Typically
3036
- * `['Doc.created', 'Doc.updated']` — every persisted revision advances the latest
3037
- * pointer and appends a history row.
3038
- */
3039
- readonly maintainedOn: readonly string[];
3040
- /**
3041
- * The LATEST-pointer row's key binding (latest-model key field → path-rooted source
3042
- * value). It must NOT include the version discriminator — the latest row is
3043
- * OVERWRITTEN on each revision (one row per source identity, e.g. `{ docId:
3044
- * '$.entity.docId' }`).
3045
- */
3046
- readonly latestKeys: Readonly<Record<string, EffectPath>>;
3047
- /**
3048
- * The HISTORY row's key binding (history-model key field → path-rooted source value).
3049
- * It MUST include the version discriminator so each revision is a NEW row (append-only
3050
- * history, e.g. `{ docId: '$.entity.docId', version: '$.entity.version' }`).
3051
- */
3052
- readonly historyKeys: Readonly<Record<string, EffectPath>>;
3053
- /** The projection of the source payload into BOTH rows (target attribute → source). */
3054
- readonly fields: Readonly<Record<string, ProjectionEntry>>;
3055
- /** Maintenance-write declaration shared by both rows (`updateMode` / `consistency`). */
3056
- readonly write?: {
3057
- readonly updateMode?: MaintainUpdateMode;
3058
- readonly consistency?: MaintainConsistency;
3059
- };
3060
- }
3061
- /**
3062
- * The pair of {@link ViewDefinition}s a {@link defineVersioned} lowers to — the
3063
- * latest-pointer snapshot row and the append-only history snapshot row.
3064
- */
3065
- interface VersionedDefinition {
3066
- /** The LATEST-pointer row (a snapshot, overwritten on each revision). */
3067
- readonly latest: ViewDefinition;
3068
- /** The append-only HISTORY row (one snapshot row per version). */
3069
- readonly history: ViewDefinition;
2820
+ readonly updateMode?: 'mutation' | 'stream';
2821
+ readonly consistency?: 'transactional' | 'eventual';
3070
2822
  }
3071
2823
  /**
3072
- * Define a **versioned / latest-pointer** maintained access path (Epic #118 pattern 8,
3073
- * issue #133): from one source revision, maintain a LATEST-pointer row (overwritten in
3074
- * place) AND append a HISTORY row (one per version) in a single composed write.
3075
- *
3076
- * ## Lowering = composition of two snapshot effects (no new effect)
3077
- *
3078
- * Per the design hint "既存の snapshot(latest)+ 別行追記(history)の合成で表現できるか",
3079
- * `versioned` is **pure composition** of the existing {@link SnapshotEffect}:
3080
- *
3081
- * - the LATEST row is a snapshot keyed by the source identity WITHOUT the version
3082
- * (`latestKeys`) → re-projecting the same key OVERWRITES the pointer in place;
3083
- * - the HISTORY row is a snapshot keyed by the source identity PLUS the version
3084
- * (`historyKeys`) → each revision resolves a NEW row, so history is append-only.
3085
- *
3086
- * Both are lowered as {@link defineView} (`materializedView`) nodes — the maintenance
3087
- * graph synthesizes a `SnapshotEffect` per source trigger, and because the two rows
3088
- * resolve to DIFFERENT destination rows (distinct models / keys) the same-row collision
3089
- * guard is satisfied and BOTH fire from the one source mutation: the latest pointer and
3090
- * the history row land together (in one atomic tx for `updateMode: 'mutation'`, or
3091
- * converge through the stream → drain path for `'stream'`). There is NO new maintenance
3092
- * primitive — the existing snapshot pipeline (sync #127 / stream #130 / rebuild #131)
3093
- * carries both.
3094
- *
3095
- * @param latest The dedicated LATEST-pointer view model (one row per source identity).
3096
- * @param history The dedicated HISTORY view model (one row per version).
3097
- * @param input The source / triggers / key bindings / projection / write declaration.
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()`.
3098
2827
  *
3099
- * @example
3100
- * ```ts
3101
- * const DocVersioned = defineVersioned(DocLatestModel, DocVersionModel, {
3102
- * pattern: 'versioned',
3103
- * source: () => DocModel,
3104
- * maintainedOn: ['Doc.created', 'Doc.updated'],
3105
- * latestKeys: { docId: '$.entity.docId' },
3106
- * historyKeys: { docId: '$.entity.docId', version: '$.entity.version' },
3107
- * fields: { docId: 'docId', version: 'version', title: 'title' },
3108
- * write: { updateMode: 'mutation' },
3109
- * });
3110
- * ```
3111
- */
3112
- declare function defineVersioned(latest: AnyModelClass | ModelStatic<DDBModel>, history: AnyModelClass | ModelStatic<DDBModel>, input: VersionedDefinitionInput): VersionedDefinition;
3113
- /** Marks an object as a {@link ProjectionDefinition} IR node. */
3114
- declare const PROJECTION_DEFINITION_MARKER: unique symbol;
3115
- /** The transport a projection travels — only `stream` (async) in this phase. */
3116
- type ProjectionVia = 'stream';
3117
- /** The author-facing input to {@link defineProjection}. */
3118
- interface ProjectionDefinitionInput {
3119
- /** The maintenance preset — `'externalProjection'`. */
3120
- readonly pattern?: 'externalProjection';
3121
- /** Resolves the source entity whose lifecycle events are projected to the sink. */
3122
- readonly source: SourceFactory;
3123
- /** The transport (`'stream'` — async CDC; the only supported value this phase). */
3124
- readonly via?: ProjectionVia;
3125
- /**
3126
- * The source attribute whose value is the **idempotency key** for at-least-once
3127
- * de-duplication at the sink (e.g. `'resultId'`). A redelivered source event
3128
- * with the same key is folded to one sink upsert.
3129
- */
3130
- readonly idempotencyKey: string;
3131
- /**
3132
- * The lifecycle events projected. Defaults to every event of the source
3133
- * (`created` / `updated` / `removed`) when omitted.
3134
- */
3135
- readonly on?: readonly ('created' | 'updated' | 'removed')[];
3136
- /**
3137
- * Optional projection of the source payload into the sink record (target
3138
- * attribute → identity shorthand / transform). When omitted the whole source
3139
- * `newImage` is projected.
3140
- */
3141
- readonly fields?: Readonly<Record<string, ProjectionEntry>>;
3142
- }
3143
- /**
3144
- * The IR for one `defineProjection` node — a stream + idempotency projection of a
3145
- * source entity into an external sink. Consumed by the projection sink runtime
3146
- * ({@link import('../cdc/projection-sink.js')}), which subscribes to
3147
- * the CDC stream and upserts the projected record into the sink, folding
3148
- * at-least-once delivery by {@link idempotencyKey}.
2828
+ * @param registry The models to scan. Defaults to `MetadataRegistry.getAll()`.
3149
2829
  */
3150
- interface ProjectionDefinition {
3151
- readonly [PROJECTION_DEFINITION_MARKER]: true;
3152
- /** The projection's logical name (e.g. `'TestCaseResultBQ'`). */
3153
- readonly name: string;
3154
- /** The maintenance preset (always `'externalProjection'`). */
3155
- readonly pattern: 'externalProjection';
3156
- /** The resolved source model class whose events are projected. */
3157
- readonly sourceClass: AnyModelClass;
3158
- /** The transport (`'stream'`). */
3159
- readonly via: ProjectionVia;
3160
- /** The source attribute used as the idempotency key at the sink. */
3161
- readonly idempotencyKey: string;
3162
- /** The lifecycle events projected (defaults to all three). */
3163
- readonly on: readonly ('created' | 'updated' | 'removed')[];
3164
- /** The optional projection map (target attribute → transform IR); empty = whole image. */
3165
- readonly project: ProjectionMap;
3166
- }
3167
- /** Runtime guard: is `value` a {@link ProjectionDefinition}? */
3168
- declare function isProjectionDefinition(value: unknown): value is ProjectionDefinition;
3169
- /**
3170
- * Define a single **external projection** (`externalProjection`, issue #132): a
3171
- * stream + idempotency projection of a source entity into an external sink
3172
- * (BigQuery / S3 / OpenSearch in production; the CDC emulator + an in-process sink
3173
- * in dev/test). At-least-once delivery is folded to one sink upsert per genuine
3174
- * source event by the {@link ProjectionDefinitionInput.idempotencyKey}.
3175
- *
3176
- * @example
3177
- * ```ts
3178
- * const TestCaseResultBQ = defineProjection('TestCaseResultBQ', {
3179
- * pattern: 'externalProjection',
3180
- * source: () => TestCaseResultModel,
3181
- * via: 'stream',
3182
- * idempotencyKey: 'resultId',
3183
- * });
3184
- * ```
3185
- */
3186
- declare function defineProjection(name: string, input: ProjectionDefinitionInput): ProjectionDefinition;
3187
- /** A record of projection-name → {@link ProjectionDefinition}. */
3188
- type ProjectionDefinitionMap = Record<string, ProjectionDefinition>;
3189
- /**
3190
- * Group a record of {@link defineProjection} nodes into the projection IR consumed
3191
- * by the projection sink runtime. Validates every entry is a `defineProjection`
3192
- * node — the `defineQueries`/`defineCommands` 様式.
3193
- */
3194
- declare function defineProjections<const D extends ProjectionDefinitionMap>(definitions: D): D;
2830
+ declare function collectViewDefinitions(registry?: ReadonlyMap<Function, EntityMetadata>): ViewDefinition[];
3195
2831
 
3196
2832
  /**
3197
2833
  * Maintenance graph builder (Epic #118 issue #124 — the RFC B-案 core).
@@ -6442,6 +6078,49 @@ interface FieldMetadata {
6442
6078
  literals?: readonly string[];
6443
6079
  }
6444
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
+ }
6445
6124
  interface KeyDefinition {
6446
6125
  /** The canonical structured key (PK/SK segment lists). */
6447
6126
  segmented: SegmentedKey;
@@ -6471,8 +6150,18 @@ interface RelationLimitOptions {
6471
6150
  * Typed as a `string` union of the known presets but kept open-ended via the
6472
6151
  * `(string & {})` tail so a future preset can be authored before this union is
6473
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.
6474
6163
  */
6475
- type RelationPattern = 'samePartition' | 'edge' | 'dualEdge' | 'counter' | 'embeddedSnapshot' | 'materializedView' | 'sparseView' | 'versioned' | 'externalProjection' | (string & {});
6164
+ type RelationPattern = 'samePartition' | 'counter' | 'embeddedSnapshot' | 'versionedLatest' | 'versionedHistory' | (string & {});
6476
6165
  /**
6477
6166
  * Consistency boundary a maintained write is declared against (Epic #118 §4.A.7):
6478
6167
  * `transactional` = same `TransactWriteItems`; `eventual` = asynchronous catch-up.
@@ -6549,6 +6238,23 @@ interface RelationOptions {
6549
6238
  read?: RelationReadOptions;
6550
6239
  write?: RelationWriteOptions;
6551
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
+ };
6552
6258
  }
6553
6259
  interface RelationMetadata {
6554
6260
  type: 'hasMany' | 'hasOne' | 'belongsTo';
@@ -6646,6 +6352,21 @@ interface EntityMetadata {
6646
6352
  /** Scalar `@aggregate` fields (Epic #118 §5.2 counter / latest; issue #122). */
6647
6353
  aggregates: AggregateMetadata[];
6648
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[];
6649
6370
  }
6650
6371
 
6651
6372
  /**
@@ -6761,4 +6482,4 @@ interface CdcEmulatorOptions {
6761
6482
  }
6762
6483
  type ShardId = string;
6763
6484
 
6764
- export { type RelationMetadata 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 ViewDefinition as Z, type ProjectionDefinition as _, type ExecutorResult as a, type ContractKeyFieldRef as a$, type TransactionItemSpec as a0, type MaintainEffect as a1, type Param as a2, type ParamDescriptor as a3, type DefinitionMap as a4, type OperationDefinition as a5, type WriteDefinitionOptions as a6, type PartialQueryKeyOf as a7, type StrictSelectSpec as a8, type EntityInput as a9, type ChangeBatch as aA, type ChangeEventName as aB, type ClockMode as aC, type CollectionEffect as aD, type CollectionOptions as aE, type Column as aF, type ColumnMap as aG, type CommandContractMethodSpec as aH, type CommandInputShape as aI, type CommandMethod as aJ, type CommandPlan as aK, type CommandResolutionTarget as aL, type CommandResultKind as aM, type CommandSelectShape as aN, type CompiledFragment as aO, type ComposeSpec as aP, type CondSlot as aQ, type ConditionCheckInput as aR, type Connection as aS, type ContractCallSignature as aT, type ContractCardinality as aU, type ContractCommandParams as aV, type ContractCommandResult as aW, type ContractComposeNode as aX, type ContractFromRef as aY, type ContractInputArity as aZ, type ContractItem as a_, type UniqueQueryKeyOf as aa, type EntityRef as ab, type ConditionInput as ac, type QueryModelContract as ad, type QueryMethodSpec as ae, type CommandModelContract as af, type CommandMethodSpec as ag, type ContractSpec as ah, type QuerySpec as ai, type CommandSpec as aj, type ContextSpec as ak, type OperationsDocument as al, type AnyOperationDefinition as am, type BridgeBundle as an, type ConditionSpec as ao, type AggregateMetadata as ap, type BatchDeleteRequest as aq, type BatchGetOptions as ar, type BatchGetRequest as as, BatchGetResult as at, type BatchPutRequest as au, type BatchResult as av, type BatchWriteRequest as aw, CONTRACT_RANGE_FANOUT_CONCURRENCY as ax, type CdcMode as ay, type Change as az, type WriteResult as b, type MutateParallelResult as b$, type ContractKeyInput as b0, type ContractKeyRef as b1, type ContractKeySpec as b2, type ContractKind as b3, type ContractMethodOp as b4, type ContractParamRef as b5, type ContractQueryParams as b6, type ContractResolution as b7, type CounterAggregate as b8, type CounterEffect as b9, type KeySegment as bA, type KeySlot as bB, type KeyStructure as bC, type KeyedResult as bD, LIFECYCLE_CONTRACT_MARKER as bE, type LifecycleContract as bF, type LifecycleEffects as bG, type LiteralParam as bH, type MaintainConsistency as bI, type MaintainEvent as bJ, type MaintainItem as bK, type MaintainTrigger as bL, type MaintainUpdateMode as bM, type MaintenanceGraph as bN, type ManifestEntity as bO, type ManifestField as bP, type ManifestFieldType as bQ, type ManifestGsi as bR, type ManifestKey as bS, type ManifestRelation as bT, type ManifestTable as bU, type MembershipEffect as bV, type MembershipPredicate as bW, type MembershipPredicateOp as bX, type ModelRef as bY, type MutateMode as bZ, type MutateOptions as b_, type CtxBase as ba, DEFAULT_MAX_ATTEMPTS as bb, DEFAULT_RETRY_POLICY as bc, type DeleteOptions as bd, type DeriveEffect as be, type DerivedEdgeWrite as bf, type DerivedUpdate as bg, type DescriptorBinding as bh, ENTITY_WRITES_MARKER as bi, type EdgeEffect as bj, type EffectPath as bk, type EmbeddedMetadata as bl, type EmitEffect as bm, type EntityWritesDefinition as bn, type EntityWritesShape as bo, type ExecutableCommandContract as bp, type ExecutableQueryContract as bq, type FilterInput as br, type FilterSpec as bs, type FragmentInput as bt, type GsiDefinitionMarker as bu, type GsiOptions as bv, type IdempotencyEffect as bw, type InProcessWriteDescriptor as bx, type InputArity as by, type KeyDefinitionMarker as bz, type DeleteInput as c, type UniqueEffect as c$, type MutateTransactionResult as c0, type MutationBody as c1, type MutationDescriptorMap as c2, type MutationFragment as c3, type MutationInputProxy as c4, type MutationInputRef as c5, type MutationIntent as c6, type NumberParam as c7, type OperationKind as c8, type OperationSpec 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, SPEC_VERSION as cQ, type SegmentSpec as cR, type SegmentedKey as cS, type SelectBuilder as cT, type SelectOf as cU, type SnapshotEffect as cV, type StartingPosition as cW, type StreamViewType as cX, type StringParam as cY, TransactionContext as cZ, type TransactionItemType as c_, type ParallelOpResult as ca, type ParamKind as cb, type ParamSpec as cc, type ParamStructure as cd, type PersistCtx as ce, type PersistOrigin as cf, type PlannedCommandMethod as cg, type ProjectionDefinitionInput as ch, type ProjectionDefinitionMap as ci, type ProjectionMap as cj, type ProjectionTransform as ck, type ProjectionTransformOp as cl, type ProjectionVia as cm, type PutOptions as cn, type QueryContractMethodSpec as co, type QueryEnvelopeResult as cp, type QueryKeyOf as cq, type QueryMethod as cr, type QueryResult as cs, type RangeConditionSpec as ct, type ReadEnvelope as cu, type ReadOpCtx as cv, type ReadOpKind as cw, type ReadOperationType as cx, type ReadRouteDescriptor as cy, type ReadRouteOptions as cz, type BatchWriteExecItem as d, isMaintainTrigger as d$, type Updatable as d0, type UpdateOptions as d1, type VersionedDefinition as d2, type VersionedDefinitionInput as d3, type ViewDefinitionInput as d4, type ViewDefinitionMap as d5, ViewRegistry as d6, type ViewSource as d7, type ViewSourceSlice as d8, type WhenSpec as d9, defineViews as dA, entityWrites as dB, executeBatchGet as dC, executeBatchWrite as dD, executeCommandMethod as dE, executeDelete as dF, executeKeyedBatchGet as dG, executePut as dH, executeQueryMethod as dI, executeRangeFanout as dJ, executeTransaction as dK, executeUpdate as dL, from as dM, getEntityWrites as dN, gsi as dO, identity as dP, isColumn as dQ, isCommandModelContract as dR, isCommandPlan as dS, isContractComposeNode as dT, isContractFromRef as dU, isContractKeyFieldRef as dV, isContractKeyRef as dW, isContractParamRef as dX, isEntityWritesDefinition as dY, isKeySegment as dZ, isLifecycleContract as d_, type WriteCtx as da, type WriteDescriptor as db, type WriteEnvelope as dc, type WriteInput as dd, type WriteKind as de, type WriteLifecyclePhase as df, type WriteMiddleware as dg, type WriteOperationType as dh, type WriteRecorder as di, type WriteResultProjection as dj, attachModelClass as dk, buildDeleteInput as dl, buildMaintenanceGraph as dm, buildPutInput as dn, buildUpdateInput as dp, compileFragment as dq, compileMutationPlan as dr, compileSingleFragmentPlan as ds, cond as dt, contractOfMethodSpec as du, definePlan as dv, defineProjection as dw, defineProjections as dx, defineVersioned as dy, defineView as dz, type BatchExecOptions as e, isMutationFragment as e0, isMutationInputRef as e1, isParam as e2, isPlannedCommandMethod as e3, isProjectionDefinition as e4, isQueryModelContract as e5, isRetryableError as e6, isRetryableTransactionCancellation as e7, isViewDefinition as e8, k as e9, key as ea, lifecyclePhaseForIntent as eb, maintainTrigger as ec, mintContractKeyFieldRef as ed, mintContractParamRef as ee, mutation as ef, param as eg, preview as eh, publicCommandModel as ei, publicQueryModel as ej, query as ek, resolveLifecycle as el, whenMember as em, wholeKeysSentinel as en, 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 };