graphddb 0.7.9 → 0.7.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -3,10 +3,12 @@ import {
3
3
  buildBridgeBundle,
4
4
  buildManifest,
5
5
  buildOperations
6
- } from "./chunk-NYM7K2ST.js";
6
+ } from "./chunk-EOJDN3SA.js";
7
+ import "./chunk-DFUKGU2Q.js";
8
+ import "./chunk-3UD3XIF2.js";
7
9
  import {
8
10
  MetadataRegistry
9
- } from "./chunk-PFFPLD4B.js";
11
+ } from "./chunk-3ZU2VW3L.js";
10
12
  import {
11
13
  createDefaultLinter
12
14
  } from "./chunk-PDUVTYC5.js";
@@ -1,4 +1,4 @@
1
- import { C as CdcEmulatorOptions, e as ChangeHandler, U as Unsubscribe, F as FaultSpec, g as ConcurrentRecomputeRef, c as ChangeEvent, E as EventLog, R as ReplayOptions, S as ShardId, V as ViewDefinition, m as EntityMetadata } from './maintenance-view-adapter-BATUh_I8.js';
1
+ import { C as CdcEmulatorOptions, e as ChangeHandler, U as Unsubscribe, F as FaultSpec, g as ConcurrentRecomputeRef, c as ChangeEvent, E as EventLog, R as ReplayOptions, S as ShardId, V as ViewDefinition, m as EntityMetadata } from './maintenance-view-adapter-BAZ9uBGe.js';
2
2
 
3
3
  /**
4
4
  * CDC emulator (issue #72). Subscribes to the core write-capture seam
@@ -1,5 +1,6 @@
1
- import { Q as QueryModelContract, x as QueryMethodSpec, y as CommandModelContract, z as CommandMethodSpec, A as ContractSpec, G as QuerySpec, H as CommandSpec, I as TransactionSpec, J as ContextSpec, K as SPEC_VERSION, L as ParamSpec, m as EntityMetadata, N as ParamDescriptor, O as EntityRef, X as ConditionInput, Y as Param, M as ModelStatic, w as DDBModel, Z as DefinitionMap, _ as OperationsDocument, $ as AnyOperationDefinition, a0 as Manifest, a1 as BridgeBundle, a2 as ConditionSpec, a3 as PreparedBody } from './maintenance-view-adapter-BATUh_I8.js';
2
- import { M as MetadataRegistry } from './registry-CXhP4TaE.js';
1
+ import { Q as QueryModelContract, x as QueryMethodSpec, y as CommandModelContract, z as CommandMethodSpec, m as EntityMetadata, A as ParamDescriptor, G as EntityRef, H as ConditionInput, M as ModelStatic, w as DDBModel, I as DefinitionMap, J as AnyOperationDefinition, K as PreparedBody } from './maintenance-view-adapter-BAZ9uBGe.js';
2
+ import { C as ContractSpec, Q as QuerySpec, a as CommandSpec, T as TransactionSpec, b as ContextSpec, S as SPEC_VERSION, P as ParamSpec, c as Param, E as ExpressionSpec, O as OperationsDocument, M as Manifest, B as BridgeBundle, d as ConditionSpec, e as SpecVersion } from './types-BQLzTEqh.js';
3
+ import { M as MetadataRegistry } from './registry-LWE54Sdc.js';
3
4
 
4
5
  /**
5
6
  * Contract-layer serialization (issue #59, CQRS Contract layer, Epic #57;
@@ -410,6 +411,14 @@ interface TxWriteInstruction {
410
411
  readonly condition?: ConditionInput<TransactionRef>;
411
412
  /** Optional declarative guard (skip this item when it does not hold). */
412
413
  readonly when?: WhenComparison;
414
+ /**
415
+ * Optional SCP expression guard (issue #261, Phase 3 S1): a behavior-contracts
416
+ * Expression IR `{ exprVersion: 1, expr }` envelope, carried beside the legacy
417
+ * `when`. Validated + canonicalized by the spec serializer; a bundle carrying
418
+ * one is stamped spec version 1.2 and loud-rejected by runtimes whose
419
+ * expression evaluation has not landed yet (fail-closed).
420
+ */
421
+ readonly guard?: ExpressionSpec;
413
422
  }
414
423
  /** A `forEach` block expanding `body` once per element of an array param. */
415
424
  interface TxForEachInstruction {
@@ -426,6 +435,8 @@ type TxInstruction = TxWriteInstruction | TxForEachInstruction;
426
435
  interface TxWriteOptions {
427
436
  readonly condition?: ConditionInput<TransactionRef>;
428
437
  readonly when?: WhenComparison;
438
+ /** Optional SCP expression guard (issue #261); see {@link TxWriteInstruction.guard}. */
439
+ readonly guard?: ExpressionSpec;
429
440
  }
430
441
  /**
431
442
  * Options accepted by `tx.conditionCheck` (issue #81). The `condition` is the
@@ -436,6 +447,8 @@ interface TxWriteOptions {
436
447
  interface TxConditionCheckOptions {
437
448
  readonly condition: ConditionInput<TransactionRef>;
438
449
  readonly when?: WhenComparison;
450
+ /** Optional SCP expression guard (issue #261); see {@link TxWriteInstruction.guard}. */
451
+ readonly guard?: ExpressionSpec;
439
452
  }
440
453
  /** Options accepted by `tx.forEach`. */
441
454
  interface TxForEachOptions {
@@ -461,10 +474,16 @@ interface TxRecorder {
461
474
  conditionCheck(model: ModelStatic<DDBModel>, key: Record<string, unknown>, options: TxConditionCheckOptions): void;
462
475
  forEach<E>(source: E, body: (element: ElementProxy<E>) => void, options?: TxForEachOptions): void;
463
476
  }
464
- /** The element proxy type inside a `forEach` body (fields → refs). */
477
+ /** The element proxy type inside a `forEach` body (fields → refs). The second
478
+ * arm types a **value-typed** array source — the shape the SCP native-syntax
479
+ * form's `p` proxy carries (issue #263: `defineScpTransaction`'s transformed
480
+ * output calls `tx.forEach(p.<arrayParam>, …)` through the value-typed view);
481
+ * at runtime the source is always the array param placeholder either way. */
465
482
  type ElementProxy<E> = E extends Param<infer T> ? T extends (infer Item)[] ? {
466
483
  readonly [K in keyof Item]: TransactionRef;
467
- } : never : never;
484
+ } : never : E extends readonly (infer Item)[] ? {
485
+ readonly [K in keyof Item]: TransactionRef;
486
+ } : never;
468
487
  /** The typed IR node produced by {@link defineTransaction}. */
469
488
  interface TransactionDefinition {
470
489
  /** @internal Marks this object as a transaction definition IR node. */
@@ -476,7 +495,30 @@ interface TransactionDefinition {
476
495
  }
477
496
  /** A param map accepted by {@link defineTransaction}. */
478
497
  type TransactionParamShape = Record<string, Param<unknown>>;
479
- /** The `p` proxy type: each scalar param → ref; each array param → itself. */
498
+ /**
499
+ * The `p` proxy type: each scalar param → ref; each array param → itself.
500
+ *
501
+ * ## Input Port 統一 (issue #264, Phase 3 S4; the #252 note)
502
+ *
503
+ * This `p.*` proxy **IS the Input Port model**: the three existing authoring
504
+ * proxies — this one, `mutation`'s `$.*`
505
+ * ({@link import('./mutation.js').MutationInputProxy}) and `prepare`'s `$.*`
506
+ * ({@link import('../runtime/prepared.js').PreparedInputProxy}) — share one
507
+ * reference semantics: *a declared input field, referenced by name, bound at
508
+ * execution time*. The serialized spellings mirror each other 1:1:
509
+ *
510
+ * - template positions render `{<field>}` / `{item.<field>}` (the `{param}` /
511
+ * `{item.*}` scopes of behavior-contracts runtime-boundary.md §4.1);
512
+ * - lowered EXPRESSION positions (guards — issues #262/#263/#264) reference
513
+ * the same namespace as `{ref:["input","<field>"]}` /
514
+ * `{ref:["item","<field>"]}` with the FIXED scope names `input` / `item`.
515
+ *
516
+ * The namespace is single: expression refs must name declared `param.*`
517
+ * inputs (enforced at build by `spec/transaction.ts` and at lowering by the
518
+ * declared-field gate — the #243 no-unbound-leak rule). `param.*` authoring
519
+ * itself is UNCHANGED through 0.7.x (interop kept; bundles byte-identical) —
520
+ * its absorption into the unified surface is the #251/#252 0.8.0 work.
521
+ */
480
522
  type ParamProxy<P extends TransactionParamShape> = {
481
523
  readonly [K in keyof P]: P[K] extends {
482
524
  readonly kind: 'array';
@@ -493,6 +535,57 @@ type ParamProxy<P extends TransactionParamShape> = {
493
535
  * @param build `(tx, p) => void` — records the write instructions.
494
536
  */
495
537
  declare function defineTransaction<const P extends TransactionParamShape>(params: P, build: (tx: TxRecorder, p: ParamProxy<P>) => void): TransactionDefinition;
538
+ /**
539
+ * The **value-typed** params view of the SCP native-syntax body form: each
540
+ * scalar param surfaces as its represented value type (`p.qty: number`,
541
+ * `p.status: 'open' | 'closed'`) and each array param as its element-object
542
+ * array (`p.items: { qty: number }[]`), so native conditions
543
+ * (`p.qty > 0 && tx.put(…)`) and `.map` fan-out typecheck as ordinary TS.
544
+ */
545
+ type ScpParamValues<P extends TransactionParamShape> = {
546
+ readonly [K in keyof P]: P[K] extends Param<infer T> ? T : never;
547
+ };
548
+ /**
549
+ * The lowered-body marker `transformScpTransactionSource` stamps as the third
550
+ * argument of every `defineScpTransaction` call it compiles (issue #263).
551
+ *
552
+ * {@link defineScpTransaction} **throws at definition time when the marker is
553
+ * absent** — this is the mechanical no-silent-path closure. The recorder's
554
+ * own guards cannot close every untransformed native shape: `===` / `!==` do
555
+ * not coerce (the coercion ledger never fires), ToBoolean has no Proxy trap
556
+ * (bare truthiness is invisible), and the consumed-field check is
557
+ * token-level, so a param consumed by a native condition is masked whenever
558
+ * the same field ALSO surfaces faithfully in another item — an untransformed
559
+ * body could then silently record a wrong spec (a dropped or unguarded
560
+ * item). The marker check does not depend on any of those blind spots: an
561
+ * untransformed `defineScpTransaction` never records anything. The ledger /
562
+ * consumed-field / differential checks remain as defense-in-depth behind it.
563
+ * Hand-writing the marker is a deliberate, greppable opt-out, not a silent
564
+ * path.
565
+ */
566
+ declare const SCP_LOWERED_MARKER: "graphddb:scp-lowered/v1";
567
+ /**
568
+ * Define a declarative transaction in the **SCP native-syntax body form**
569
+ * (issue #263, Phase 3 S3): the body may additionally use TS native control
570
+ * syntax — `cond && tx.put(…)` (Guard), `cond ? tx.put(A,…) : tx.put(B,…)`
571
+ * (Conditional / Φ), and `p.<arrayParam>.map(($el) => tx.put(…))` (Map) —
572
+ * which the **opt-in build-time transform**
573
+ * (`transformScpTransactionSource`, `graphddb/transform`) lowers onto the
574
+ * untouched recorder vocabulary: `guard:` options (S2-lowered Expression IR
575
+ * conditions) and `tx.forEach`. The `p` proxy is value-typed
576
+ * ({@link ScpParamValues}) so the native form typechecks.
577
+ *
578
+ * The transform stamps every call it compiles with
579
+ * {@link SCP_LOWERED_MARKER}; an unstamped (= untransformed) call **throws
580
+ * here at definition time**, so a native-operator body can never record a
581
+ * spec without having been lowered (see the marker doc for why the
582
+ * recorder's own guards alone cannot close the masked `===` / `!==` /
583
+ * truthiness shapes). A stamped call **delegates directly to
584
+ * {@link defineTransaction}** — the transformed output is ordinary recorder
585
+ * authoring, still covered by the coercion ledger / differential passes as
586
+ * defense-in-depth.
587
+ */
588
+ declare function defineScpTransaction<const P extends TransactionParamShape>(params: P, build: (tx: TxRecorder, p: ScpParamValues<P>) => void, lowered?: typeof SCP_LOWERED_MARKER): TransactionDefinition;
496
589
  /**
497
590
  * Group a record of transaction definitions into the IR consumed by the static
498
591
  * planner (#42/#46). Validates each entry is a transaction definition.
@@ -843,6 +936,68 @@ declare function assertJsonSerializable(value: unknown, path?: string): void;
843
936
  /** Convenience: assert an entire {@link BridgeBundle} is JSON-serializable. */
844
937
  declare function assertBundleSerializable(bundle: BridgeBundle): void;
845
938
 
939
+ /**
940
+ * SCP Expression IR — build-time validation + canonicalization (issue #261,
941
+ * Phase 3 S1; behavior-contracts `expression-ir.md` §2).
942
+ *
943
+ * This module is the spec-side **vocabulary** gate: it validates an authored
944
+ * expression against the closed v1 node/operator set (fail-closed — anything
945
+ * outside the set is a build error, never a silently-carried unknown) and
946
+ * rewrites it into the **canonical serialization form** of §2.3/§2.4:
947
+ *
948
+ * - object keys sorted in **Unicode code-point order** at every level
949
+ * (canonical-serialization.md §2 — NOT JS default `.sort()`, which compares
950
+ * UTF-16 code units and diverges on astral-plane keys);
951
+ * - an integer-valued JSON number within the safe range stays a plain number
952
+ * (an int literal); beyond ±2^53−1 it must be `{int:"…"}` (raw is invalid);
953
+ * - `{int:"…"}` whose value fits the safe range canonicalizes to the plain
954
+ * number; outside it stays `{int:"…"}` (must fit i64);
955
+ * - `{float:n}` with an integer value stays wrapped; a fractional `{float:n}`
956
+ * canonicalizes to the plain number (JSON preserves its decimal part).
957
+ *
958
+ * Because the canonical form of the expression NODES is produced HERE (at
959
+ * build time), the documents flow through graphddb's ordinary JSON emitters
960
+ * unchanged — no special-cased serializer. Note the distinction: §2.3/§2.4
961
+ * key-sorting governs the expression nodes (`obj` construction keys; operator
962
+ * nodes are single-key by definition); the `{ exprVersion, expr }` ENVELOPE and
963
+ * the surrounding spec documents serialize in graphddb's usual emitter order
964
+ * like every other spec object (conformance value comparison is structural,
965
+ * expression-ir.md §2.4).
966
+ *
967
+ * Evaluation lives in the Phase 3 S5/S6/S7 sub-issues — this module never
968
+ * evaluates anything. It also hosts the conditional spec-version presence scan
969
+ * ({@link operationsSpecVersion}): a document that actually CONTAINS an SCP
970
+ * node is stamped `1.2`, everything else keeps `1.1` byte-identically.
971
+ */
972
+
973
+ /**
974
+ * Validate an authored `{ exprVersion: 1, expr: <node> }` envelope against the
975
+ * closed v1 vocabulary and return it in canonical form (§2.3/§2.4: key-sorted,
976
+ * normalized `{int:"…"}` / `{float:n}` literal wrapping). Fail-closed: an
977
+ * unknown `exprVersion`, an extra envelope key, or any node outside the closed
978
+ * set is a build error with the offending path.
979
+ */
980
+ declare function canonicalizeExpressionSpec(input: unknown, context: string): ExpressionSpec;
981
+ /**
982
+ * Does this operations-document content actually contain an SCP Expression IR
983
+ * node — a `{ kind: 'scpExpr' }` write condition or a `guard` (transaction
984
+ * item / contract command method)? This is the **presence scan** behind the
985
+ * conditional stamp (issue #261): the walk visits exactly the slots the spec
986
+ * vocabulary defines, so an SCP-free document is provably stamped `1.1` and
987
+ * stays byte-identical.
988
+ */
989
+ declare function operationsContainScpNodes(doc: {
990
+ readonly commands: Readonly<Record<string, CommandSpec>>;
991
+ readonly transactions?: Readonly<Record<string, TransactionSpec>>;
992
+ readonly contracts?: Readonly<Record<string, ContractSpec>>;
993
+ }): boolean;
994
+ /**
995
+ * The spec version to stamp on an operations document: `1.2` iff it actually
996
+ * contains an SCP node ({@link operationsContainScpNodes}), else the base
997
+ * `1.1` — so every pre-#261 bundle serializes byte-identically.
998
+ */
999
+ declare function operationsSpecVersion(doc: Parameters<typeof operationsContainScpNodes>[0]): SpecVersion;
1000
+
846
1001
  /**
847
1002
  * Static prepared-plan artifact — the **build-time** (AOT) compilation of
848
1003
  * `DDBModel.prepare` bodies (issue #208; design #203 phase 4, on top of the #205
@@ -931,4 +1086,4 @@ declare function buildPreparedPlanDocument(plans: Readonly<Record<string, Prepar
931
1086
  */
932
1087
  declare function buildBridgeBundle(queries?: DefinitionMap, commands?: DefinitionMap, registry?: typeof MetadataRegistry, transactions?: Record<string, TransactionDefinition>, contractInputs?: ContractInputs): BridgeBundle;
933
1088
 
934
- export { type AnyModelContract as A, type BuiltContracts as B, type ContextOwnership as C, buildManifest as D, buildOperations as E, buildQuerySpec as F, buildTransactionSpec as G, buildTransactions as H, collectContractBoundaryViolations as I, collectContractN1Violations as J, defineTransaction as K, defineTransactions as L, isTransactionRef as M, when as N, PREPARED_FORMAT_VERSION as O, type PreparedWriteOpSpec as P, type PreparedBindMap as Q, buildPreparedPlanDocument as R, canonicalJson as S, type TransactionDefinition as T, compilePreparedPlan as U, entityFingerprint as V, type WhenComparison as W, planFingerprint as X, type PreparedPlanDocument as a, type ContextOwnershipMap as b, type ContractBoundaryViolation as c, type ContractInputs as d, type ContractMap as e, type ContractN1Violation as f, type PreparedBindSpec as g, type PreparedPlanSpec as h, type PreparedReadRouteSpec as i, type TransactionParamShape as j, type TransactionRef as k, type TxConditionCheckOptions as l, type TxForEachInstruction as m, type TxForEachOptions as n, type TxInstruction as o, type TxRecorder as p, type TxWriteInstruction as q, type TxWriteOptions as r, assertBundleSerializable as s, assertContractBoundaries as t, assertContractN1Safe as u, assertJsonSerializable as v, assertSupportedCondition as w, buildBridgeBundle as x, buildContexts as y, buildContracts as z };
1089
+ export { compilePreparedPlan as $, type AnyModelContract as A, type BuiltContracts as B, type ContextOwnership as C, buildContracts as D, buildManifest as E, buildOperations as F, buildQuerySpec as G, buildTransactionSpec as H, buildTransactions as I, canonicalizeExpressionSpec as J, collectContractBoundaryViolations as K, collectContractN1Violations as L, defineScpTransaction as M, defineTransaction as N, defineTransactions as O, type PreparedWriteOpSpec as P, isTransactionRef as Q, operationsContainScpNodes as R, SCP_LOWERED_MARKER as S, type TransactionDefinition as T, operationsSpecVersion as U, when as V, type WhenComparison as W, PREPARED_FORMAT_VERSION as X, type PreparedBindMap as Y, buildPreparedPlanDocument as Z, canonicalJson as _, type PreparedPlanDocument as a, entityFingerprint as a0, planFingerprint as a1, type ContextOwnershipMap as b, type ContractBoundaryViolation as c, type ContractInputs as d, type ContractMap as e, type ContractN1Violation as f, type PreparedBindSpec as g, type PreparedPlanSpec as h, type PreparedReadRouteSpec as i, type ScpParamValues as j, type TransactionParamShape as k, type TransactionRef as l, type TxConditionCheckOptions as m, type TxForEachInstruction as n, type TxForEachOptions as o, type TxInstruction as p, type TxRecorder as q, type TxWriteInstruction as r, type TxWriteOptions as s, assertBundleSerializable as t, assertContractBoundaries as u, assertContractN1Safe as v, assertJsonSerializable as w, assertSupportedCondition as x, buildBridgeBundle as y, buildContexts as z };
package/dist/index.d.ts CHANGED
@@ -1,12 +1,14 @@
1
- export { a as LintResult, L as LintRule, b as Linter, M as MetadataRegistry } from './registry-CXhP4TaE.js';
2
- import { aO as SelectableOf, aP as PrimaryKeyOf, aQ as RequestContext, aR as Middleware, aS as ReadRequestKind, aT as CtxModel, aU as ReadParams, aV as ReadRequestCtx, D as DynamoDBOperation, aW as Item, n as Executor, aX as RetryPolicy, ap as ExecutionPlanSpec, aY as RetryOverride, aZ as KeyDefinition, a_ as GsiDefinition, a$ as ModelKind, b0 as FieldOptions, b1 as DynamoType, b2 as ProjectionTransform, b3 as MaintainEvent, b4 as MembershipPredicate, b5 as MaintainConsistency, b6 as MaintainUpdateMode, b7 as MembershipPredicateOp, b8 as RelationOptions, b9 as AggregateOptions, ba as AggregateValue, bb as SelectBuilderSpec, bc as RawCondition, m as EntityMetadata, I as TransactionSpec, a0 as Manifest, bd as ExecutionPlan, be as FieldMetadata, bf as ResolvedKey, o as ReadExecOptions, p as ExecutorResult, q as BatchGetExecInput, P as PutInput, W as WriteExecOptions, r as WriteResult, s as UpdateInput, t as DeleteInput, u as BatchWriteExecItem, v as BatchExecOptions, T as TransactWriteExecItem, M as ModelStatic, w as DDBModel, bg as Slot, bh as PreparedWriteExecOptions, bi as CommandReturn, bj as ParallelOpResult, a3 as PreparedBody, bk as PreparedStatement, bl as RelationMetadata, aD as TransactionItemSpec, bm as MaintainEffect, V as ViewDefinition, Y as Param, N as ParamDescriptor, Z as DefinitionMap, bn as OperationDefinition, bo as WriteDefinitionOptions, bp as PartialQueryKeyOf, bq as StrictSelectSpec, br as ReadDefinitionOptions, bs as EntityInput, bt as UniqueQueryKeyOf } from './maintenance-view-adapter-BATUh_I8.js';
3
- export { bu as AggregateMetadata, $ as AnyOperationDefinition, bv as BatchDeleteRequest, bw as BatchGetOptions, bx as BatchGetRequest, by as BatchGetResult, bz as BatchPutRequest, B as BatchResult, bA as BatchWriteRequest, a1 as BridgeBundle, bB as CONTRACT_RANGE_FANOUT_CONCURRENCY, C as CdcEmulatorOptions, a as CdcMode, bC as CdcModelRegistry, bD as CdcSubscribeHandlers, bE as Change, b as ChangeBatch, c as ChangeEvent, d as ChangeEventName, e as ChangeHandler, f as ClockMode, bF as CollectionEffect, bG as CollectionOptions, bH as Column, bI as ColumnMap, a4 as CommandContractMethodSpec, bJ as CommandInputShape, bK as CommandMethod, z as CommandMethodSpec, y as CommandModelContract, bL as CommandPlan, a5 as CommandResolutionTarget, bM as CommandResultKind, bN as CommandSelectShape, H as CommandSpec, a6 as CompiledFragment, a8 as ComposeSpec, g as ConcurrentRecomputeRef, bO as CondSlot, bP as ConditionCheckInput, X as ConditionInput, a2 as ConditionSpec, bQ as Connection, J as ContextSpec, bR as ContractCallSignature, aa as ContractCardinality, bS as ContractCommandParams, ab as ContractCommandResult, bT as ContractComposeNode, bU as ContractFromRef, ac as ContractInputArity, bV as ContractItem, bW as ContractKeyFieldRef, bX as ContractKeyInput, bY as ContractKeyRef, ad as ContractKeySpec, ae as ContractKind, bZ as ContractMethodOp, b_ as ContractParamRef, b$ as ContractQueryParams, af as ContractResolution, A as ContractSpec, c0 as CounterAggregate, c1 as CounterEffect, c2 as CtxBase, c3 as DEFAULT_MAX_ATTEMPTS, c4 as DEFAULT_RETRY_POLICY, c5 as DeleteOptions, c6 as DeriveEffect, ah as DerivedEdgeWrite, an as DerivedUpdate, c7 as DescriptorBinding, c8 as ENTITY_WRITES_MARKER, c9 as EdgeEffect, ca as EffectPath, cb as EmbeddedMetadata, cc as EmitEffect, O as EntityRef, cd as EntityWritesDefinition, ce as EntityWritesShape, E as EventLog, cf as ExecutableCommandContract, cg as ExecutableQueryContract, F as FaultSpec, ch as FilterInput, aq as FilterSpec, ci as FragmentCondition, cj as FragmentConditionOperatorObject, ck as FragmentInput, cl as GsiDefinitionMarker, cm as GsiOptions, cn as IdempotencyEffect, co as InProcessWriteDescriptor, cp as InlineSnapshotSpec, cq as InputArity, cr as KeyDefinitionMarker, cs as KeySegment, ct as KeySlot, cu as KeyStructure, cv as KeyedResult, cw as LIFECYCLE_CONTRACT_MARKER, cx as LifecycleContract, cy as LifecycleEffects, cz as LiteralParam, cA as MaintainItem, cB as MaintainTrigger, cC as MaintenanceGraph, as as ManifestEntity, at as ManifestField, au as ManifestFieldType, av as ManifestGsi, aw as ManifestKey, ax as ManifestRelation, ay as ManifestTable, cD as MembershipEffect, cE as ModelRef, cF as MutateMode, cG as MutateOptions, cH as MutateParallelResult, cI as MutateTransactionResult, cJ as MutationBody, cK as MutationDescriptorMap, cL as MutationFragment, cM as MutationInputProxy, cN as MutationInputRef, cO as MutationIntent, cP as NumberParam, cQ as OperationKind, az as OperationSpec, _ as OperationsDocument, cR as PREPARE_CACHE_MAX, cS as ParamKind, L as ParamSpec, cT as ParamStructure, cU as PersistCtx, cV as PersistOrigin, cW as PlannedCommandMethod, cX as PreparedInputProxy, cY as PreparedParamRef, cZ as PreparedReadExecOptions, c_ as PreparedReadRoute, c$ as PreparedReadStatement, d0 as PreparedWriteRoute, d1 as PreparedWriteStatement, d2 as ProjectionMap, d3 as ProjectionTransformOp, d4 as PutOptions, aA as QueryContractMethodSpec, d5 as QueryEnvelopeResult, d6 as QueryKeyOf, d7 as QueryMethod, x as QueryMethodSpec, Q as QueryModelContract, d8 as QueryResult, G as QuerySpec, aB as RangeConditionSpec, d9 as ReadEnvelope, da as ReadOpCtx, db as ReadOpKind, aC as ReadOperationType, dc as ReadRouteDescriptor, dd as ReadRouteOptions, de as ReadRouteResult, df as RecordedCompose, dg as RelationBuilder, dh as RelationConsistency, di as RelationLimitOptions, dj as RelationPattern, dk as RelationProjection, dl as RelationReadOptions, dm as RelationSelect, dn as RelationSpec, dp as RelationUpdateMode, dq as RelationWriteOptions, R as ReplayOptions, dr as RequiresEffect, ds as Resolution, dt as RetryInfo, du as RetryOperationKind, K as SPEC_VERSION, dv as SegmentSpec, dw as SegmentedKey, dx as SelectBuilder, dy as SelectOf, S as ShardId, dz as SnapshotEffect, h as StartingPosition, i as StreamViewType, dA as StringParam, j as SubscribeHandler, k as SubscribeHandlers, dB as TransactionContext, aE as TransactionItemType, dC as UniqueEffect, dD as Updatable, dE as UpdateOptions, dF as ViewSourceSlice, aF as WhenSpec, dG as WriteCtx, dH as WriteDescriptor, dI as WriteEnvelope, dJ as WriteInput, dK as WriteKind, dL as WriteLifecyclePhase, dM as WriteMiddleware, aG as WriteOperationType, dN as WriteRecorder, dO as WriteResultProjection, dP as attachModelClass, dQ as buildDeleteInput, dR as buildMaintenanceGraph, dS as buildPutInput, l as buildSubscribeHandler, dT as buildUpdateInput, dU as collectViewDefinitions, aI as compileFragment, aJ as compileMutationPlan, aK as compileSingleFragmentPlan, dV as cond, dW as contractOfMethodSpec, dX as definePlan, dY as entityWrites, dZ as executeBatchGet, d_ as executeBatchWrite, d$ as executeCommandMethod, e0 as executeDelete, e1 as executeKeyedBatchGet, e2 as executePut, e3 as executeQueryMethod, e4 as executeRangeFanout, e5 as executeTransaction, e6 as executeUpdate, e7 as from, e8 as getEntityWrites, e9 as gsi, ea as identity, eb as isColumn, ec as isCommandModelContract, ed as isCommandPlan, ee as isContractComposeNode, ef as isContractFromRef, eg as isContractKeyFieldRef, eh as isContractKeyRef, ei as isContractParamRef, ej as isEntityWritesDefinition, ek as isKeySegment, el as isLifecycleContract, em as isMaintainTrigger, en as isMutationFragment, eo as isMutationInputRef, ep as isParam, eq as isPlannedCommandMethod, er as isPreparedParamRef, es as isQueryModelContract, et as isRetryableError, eu as isRetryableTransactionCancellation, ev as k, ew as key, ex as lifecyclePhaseForIntent, ey as maintainTrigger, ez as mintContractKeyFieldRef, eA as mintContractParamRef, eB as mutation, eC as param, eD as prepare, eE as preview, eF as publicCommandModel, eG as publicQueryModel, eH as query, aM as resolveLifecycle, eI as wholeKeysSentinel } from './maintenance-view-adapter-BATUh_I8.js';
1
+ export { a as LintResult, L as LintRule, b as Linter, M as MetadataRegistry } from './registry-LWE54Sdc.js';
2
+ import { ab as SelectableOf, ac as PrimaryKeyOf, ad as RequestContext, ae as Middleware, af as ReadRequestKind, ag as CtxModel, ah as ReadParams, ai as ReadRequestCtx, D as DynamoDBOperation, aj as Item, n as Executor, ak as RetryPolicy, al as RetryOverride, am as KeyDefinition, an as GsiDefinition, ao as ModelKind, ap as FieldOptions, aq as DynamoType, ar as ProjectionTransform, as as MaintainEvent, at as MembershipPredicate, au as MaintainConsistency, av as MaintainUpdateMode, aw as MembershipPredicateOp, ax as RelationOptions, ay as AggregateOptions, az as AggregateValue, aA as SelectBuilderSpec, aB as RawCondition, m as EntityMetadata, aC as ExecutionPlan, aD as FieldMetadata, aE as ResolvedKey, o as ReadExecOptions, p as ExecutorResult, q as BatchGetExecInput, P as PutInput, W as WriteExecOptions, r as WriteResult, s as UpdateInput, t as DeleteInput, u as BatchWriteExecItem, v as BatchExecOptions, T as TransactWriteExecItem, M as ModelStatic, w as DDBModel, aF as Slot, aG as PreparedWriteExecOptions, aH as CommandReturn, aI as ParallelOpResult, K as PreparedBody, aJ as PreparedStatement, aK as RelationMetadata, aL as MaintainEffect, V as ViewDefinition, A as ParamDescriptor, I as DefinitionMap, aM as OperationDefinition, aN as WriteDefinitionOptions, aO as PartialQueryKeyOf, aP as StrictSelectSpec, aQ as ReadDefinitionOptions, aR as EntityInput, aS as UniqueQueryKeyOf } from './maintenance-view-adapter-BAZ9uBGe.js';
3
+ export { aT as AggregateMetadata, J as AnyOperationDefinition, aU as BatchDeleteRequest, aV as BatchGetOptions, aW as BatchGetRequest, aX as BatchGetResult, aY as BatchPutRequest, B as BatchResult, aZ as BatchWriteRequest, a_ as CONTRACT_RANGE_FANOUT_CONCURRENCY, C as CdcEmulatorOptions, a as CdcMode, a$ as CdcModelRegistry, b0 as CdcSubscribeHandlers, b1 as Change, b as ChangeBatch, c as ChangeEvent, d as ChangeEventName, e as ChangeHandler, f as ClockMode, b2 as CollectionEffect, b3 as CollectionOptions, b4 as Column, b5 as ColumnMap, b6 as CommandInputShape, b7 as CommandMethod, z as CommandMethodSpec, y as CommandModelContract, b8 as CommandPlan, b9 as CommandResultKind, ba as CommandSelectShape, L as CompiledFragment, g as ConcurrentRecomputeRef, bb as CondSlot, bc as ConditionCheckInput, H as ConditionInput, bd as Connection, be as ContractCallSignature, bf as ContractCommandParams, bg as ContractComposeNode, bh as ContractFromRef, bi as ContractItem, bj as ContractKeyFieldRef, bk as ContractKeyInput, bl as ContractKeyRef, bm as ContractMethodOp, bn as ContractParamRef, bo as ContractQueryParams, bp as CounterAggregate, bq as CounterEffect, br as CtxBase, bs as DEFAULT_MAX_ATTEMPTS, bt as DEFAULT_RETRY_POLICY, bu as DeleteOptions, bv as DeriveEffect, X as DerivedEdgeWrite, a1 as DerivedUpdate, bw as DescriptorBinding, bx as ENTITY_WRITES_MARKER, by as EdgeEffect, bz as EffectPath, bA as EmbeddedMetadata, bB as EmitEffect, G as EntityRef, bC as EntityWritesDefinition, bD as EntityWritesShape, E as EventLog, bE as ExecutableCommandContract, bF as ExecutableQueryContract, F as FaultSpec, bG as FilterInput, bH as FragmentCondition, bI as FragmentConditionOperatorObject, bJ as FragmentInput, bK as GsiDefinitionMarker, bL as GsiOptions, bM as IdempotencyEffect, bN as InProcessWriteDescriptor, bO as InlineSnapshotSpec, bP as InputArity, bQ as KeyDefinitionMarker, bR as KeySegment, bS as KeySlot, bT as KeyStructure, bU as KeyedResult, bV as LIFECYCLE_CONTRACT_MARKER, bW as LifecycleContract, bX as LifecycleEffects, bY as MaintainItem, bZ as MaintainTrigger, b_ as MaintenanceGraph, b$ as MembershipEffect, c0 as ModelRef, c1 as MutateMode, c2 as MutateOptions, c3 as MutateParallelResult, c4 as MutateTransactionResult, c5 as MutationBody, c6 as MutationDescriptorMap, c7 as MutationFragment, c8 as MutationInputProxy, c9 as MutationInputRef, ca as MutationIntent, cb as OperationKind, cc as PREPARE_CACHE_MAX, cd as ParamStructure, ce as PersistCtx, cf as PersistOrigin, cg as PlannedCommandMethod, ch as PreparedInputProxy, ci as PreparedParamRef, cj as PreparedReadExecOptions, ck as PreparedReadRoute, cl as PreparedReadStatement, cm as PreparedWriteRoute, cn as PreparedWriteStatement, co as ProjectionMap, cp as ProjectionTransformOp, cq as PutOptions, cr as QueryEnvelopeResult, cs as QueryKeyOf, ct as QueryMethod, x as QueryMethodSpec, Q as QueryModelContract, cu as QueryResult, cv as ReadEnvelope, cw as ReadOpCtx, cx as ReadOpKind, cy as ReadRouteDescriptor, cz as ReadRouteOptions, cA as ReadRouteResult, cB as RecordedCompose, cC as RelationBuilder, cD as RelationConsistency, cE as RelationLimitOptions, cF as RelationPattern, cG as RelationProjection, cH as RelationReadOptions, cI as RelationSelect, cJ as RelationSpec, cK as RelationUpdateMode, cL as RelationWriteOptions, R as ReplayOptions, cM as RequiresEffect, cN as Resolution, cO as RetryInfo, cP as RetryOperationKind, cQ as SegmentSpec, cR as SegmentedKey, cS as SelectBuilder, cT as SelectOf, S as ShardId, cU as SnapshotEffect, h as StartingPosition, i as StreamViewType, j as SubscribeHandler, k as SubscribeHandlers, cV as TransactionContext, cW as UniqueEffect, cX as Updatable, cY as UpdateOptions, cZ as ViewSourceSlice, c_ as WriteCtx, c$ as WriteDescriptor, d0 as WriteEnvelope, d1 as WriteInput, d2 as WriteKind, d3 as WriteLifecyclePhase, d4 as WriteMiddleware, d5 as WriteRecorder, d6 as WriteResultProjection, d7 as attachModelClass, d8 as buildDeleteInput, d9 as buildMaintenanceGraph, da as buildPutInput, l as buildSubscribeHandler, db as buildUpdateInput, dc as collectViewDefinitions, a5 as compileFragment, a6 as compileMutationPlan, a7 as compileSingleFragmentPlan, dd as cond, de as contractOfMethodSpec, df as definePlan, dg as entityWrites, dh as executeBatchGet, di as executeBatchWrite, dj as executeCommandMethod, dk as executeDelete, dl as executeKeyedBatchGet, dm as executePut, dn as executeQueryMethod, dp as executeRangeFanout, dq as executeTransaction, dr as executeUpdate, ds as from, dt as getEntityWrites, du as gsi, dv as identity, dw as isColumn, dx as isCommandModelContract, dy as isCommandPlan, dz as isContractComposeNode, dA as isContractFromRef, dB as isContractKeyFieldRef, dC as isContractKeyRef, dD as isContractParamRef, dE as isEntityWritesDefinition, dF as isKeySegment, dG as isLifecycleContract, dH as isMaintainTrigger, dI as isMutationFragment, dJ as isMutationInputRef, dK as isPlannedCommandMethod, dL as isPreparedParamRef, dM as isQueryModelContract, dN as isRetryableError, dO as isRetryableTransactionCancellation, dP as k, dQ as key, dR as lifecyclePhaseForIntent, dS as maintainTrigger, dT as mintContractKeyFieldRef, dU as mintContractParamRef, dV as mutation, dW as prepare, dX as preview, dY as publicCommandModel, dZ as publicQueryModel, d_ as query, a9 as resolveLifecycle, d$ as wholeKeysSentinel } from './maintenance-view-adapter-BAZ9uBGe.js';
4
4
  import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
5
5
  import { DynamoDBDocumentClient } from '@aws-sdk/lib-dynamodb';
6
- export { C as CdcEmulator, M as MAINT_OUTBOX_PK_PREFIX, a as MaintenanceDrain, b as MaintenanceDrainOptions, c as createCdcEmulator, d as createMaintenanceDrain, e as createMaintenanceDrainHandler, p as parseChange } from './from-change-DanwjE5b.js';
7
- import { P as PreparedWriteOpSpec, a as PreparedPlanDocument } from './index-CtPJSMrc.js';
8
- export { A as AnyModelContract, B as BuiltContracts, C as ContextOwnership, b as ContextOwnershipMap, c as ContractBoundaryViolation, d as ContractInputs, e as ContractMap, f as ContractN1Violation, g as PreparedBindSpec, h as PreparedPlanSpec, i as PreparedReadRouteSpec, T as TransactionDefinition, j as TransactionParamShape, k as TransactionRef, l as TxConditionCheckOptions, m as TxForEachInstruction, n as TxForEachOptions, o as TxInstruction, p as TxRecorder, q as TxWriteInstruction, r as TxWriteOptions, W as WhenComparison, s as assertBundleSerializable, t as assertContractBoundaries, u as assertContractN1Safe, v as assertJsonSerializable, w as assertSupportedCondition, x as buildBridgeBundle, y as buildContexts, z as buildContracts, D as buildManifest, E as buildOperations, F as buildQuerySpec, G as buildTransactionSpec, H as buildTransactions, I as collectContractBoundaryViolations, J as collectContractN1Violations, K as defineTransaction, L as defineTransactions, M as isTransactionRef, N as when } from './index-CtPJSMrc.js';
9
- export { c as createDefaultLinter, g as gsiAmbiguityRule, m as missingGsiRule, n as noScanRule, q as queryBoundaryRule, r as relationDepthRule, a as requireLimitRule } from './relation-depth-Dg3yhl7S.js';
6
+ import { q as ExecutionPlanSpec, T as TransactionSpec, M as Manifest, Y as TransactionItemSpec, c as Param } from './types-BQLzTEqh.js';
7
+ export { B as BridgeBundle, f as CommandContractMethodSpec, g as CommandResolutionTarget, a as CommandSpec, h as ComposeSpec, d as ConditionSpec, b as ContextSpec, j as ContractCardinality, k as ContractCommandResult, l as ContractInputArity, m as ContractKeySpec, n as ContractKind, o as ContractResolution, C as ContractSpec, p as EXPR_VERSION, u as ExpressionNode, x as ExpressionOperator, E as ExpressionSpec, F as FilterSpec, a1 as LiteralParam, D as ManifestEntity, G as ManifestField, H as ManifestFieldType, I as ManifestGsi, J as ManifestKey, K as ManifestRelation, L as ManifestTable, a2 as NumberParam, N as OperationSpec, O as OperationsDocument, a0 as ParamKind, P as ParamSpec, R as QueryContractMethodSpec, Q as QuerySpec, U as RangeConditionSpec, V as ReadOperationType, S as SPEC_VERSION, W as SPEC_VERSION_SCP, e as SpecVersion, a3 as StringParam, Z as TransactionItemType, _ as WhenSpec, $ as WriteOperationType, a4 as isParam, a5 as param } from './types-BQLzTEqh.js';
8
+ export { C as CdcEmulator, M as MAINT_OUTBOX_PK_PREFIX, a as MaintenanceDrain, b as MaintenanceDrainOptions, c as createCdcEmulator, d as createMaintenanceDrain, e as createMaintenanceDrainHandler, p as parseChange } from './from-change-Ty95KA8C.js';
9
+ import { P as PreparedWriteOpSpec, a as PreparedPlanDocument } from './index-Dc7d8mWI.js';
10
+ export { A as AnyModelContract, B as BuiltContracts, C as ContextOwnership, b as ContextOwnershipMap, c as ContractBoundaryViolation, d as ContractInputs, e as ContractMap, f as ContractN1Violation, g as PreparedBindSpec, h as PreparedPlanSpec, i as PreparedReadRouteSpec, S as SCP_LOWERED_MARKER, j as ScpParamValues, T as TransactionDefinition, k as TransactionParamShape, l as TransactionRef, m as TxConditionCheckOptions, n as TxForEachInstruction, o as TxForEachOptions, p as TxInstruction, q as TxRecorder, r as TxWriteInstruction, s as TxWriteOptions, W as WhenComparison, t as assertBundleSerializable, u as assertContractBoundaries, v as assertContractN1Safe, w as assertJsonSerializable, x as assertSupportedCondition, y as buildBridgeBundle, z as buildContexts, D as buildContracts, E as buildManifest, F as buildOperations, G as buildQuerySpec, H as buildTransactionSpec, I as buildTransactions, J as canonicalizeExpressionSpec, K as collectContractBoundaryViolations, L as collectContractN1Violations, M as defineScpTransaction, N as defineTransaction, O as defineTransactions, Q as isTransactionRef, R as operationsContainScpNodes, U as operationsSpecVersion, V as when } from './index-Dc7d8mWI.js';
11
+ export { c as createDefaultLinter, g as gsiAmbiguityRule, m as missingGsiRule, n as noScanRule, q as queryBoundaryRule, r as relationDepthRule, a as requireLimitRule } from './relation-depth-BRS513Tq.js';
10
12
 
11
13
  /**
12
14
  * Query options with conditional `consistentRead` availability.
package/dist/index.js CHANGED
@@ -6,14 +6,12 @@ import {
6
6
  DDBModel,
7
7
  EDGE_WRITES_MARKER,
8
8
  LOGICAL_EFFECT_CATEGORIES,
9
- MARKER_ROW_ENTITY,
10
9
  OLD_VALUE_NAMESPACE,
11
10
  PREPARED_FORMAT_VERSION,
12
11
  PREPARE_CACHE_MAX,
13
12
  PreparedReadStatement,
14
13
  PreparedWriteStatement,
15
14
  RELATION_TRAVERSAL_CONCURRENCY,
16
- SPEC_VERSION,
17
15
  assertBundleSerializable,
18
16
  assertContractBoundaries,
19
17
  assertContractN1Safe,
@@ -39,8 +37,6 @@ import {
39
37
  contractOfMethodSpec,
40
38
  decodeCursor,
41
39
  definePlan,
42
- defineTransaction,
43
- defineTransactions,
44
40
  deriveCompositionPlan,
45
41
  deriveEdgeWriteItems,
46
42
  deriveEdgeWriteItemsFor,
@@ -74,7 +70,6 @@ import {
74
70
  isPlannedCommandMethod,
75
71
  isPreparedParamRef,
76
72
  isQueryModelContract,
77
- isTransactionRef,
78
73
  mapWithConcurrency,
79
74
  mintContractKeyFieldRef,
80
75
  mintContractParamRef,
@@ -88,9 +83,8 @@ import {
88
83
  resolveRelations,
89
84
  serializeEffectParams,
90
85
  validateDepth,
91
- when,
92
86
  wholeKeysSentinel
93
- } from "./chunk-NYM7K2ST.js";
87
+ } from "./chunk-EOJDN3SA.js";
94
88
  import {
95
89
  CdcEmulator,
96
90
  MAINT_OUTBOX_PK_PREFIX,
@@ -102,7 +96,44 @@ import {
102
96
  orderAndTrimCollection,
103
97
  pathField,
104
98
  projectFrom
105
- } from "./chunk-ZPNRLOKA.js";
99
+ } from "./chunk-AD6ZQTTE.js";
100
+ import {
101
+ ENTITY_WRITES_MARKER,
102
+ LIFECYCLE_CONTRACT_MARKER,
103
+ buildMaintenanceGraph,
104
+ buildSubscribeHandler,
105
+ collectViewDefinitions,
106
+ detectRelationFields,
107
+ entityWrites,
108
+ getEntityWrites,
109
+ getImplicitKeyFields,
110
+ hydrate,
111
+ identity,
112
+ isEntityWritesDefinition,
113
+ isLifecycleContract,
114
+ isMaintainTrigger,
115
+ isSelectBuilder,
116
+ lifecyclePhaseForIntent,
117
+ maintainTrigger,
118
+ parseChange,
119
+ preview
120
+ } from "./chunk-DFUKGU2Q.js";
121
+ import {
122
+ EXPR_VERSION,
123
+ MARKER_ROW_ENTITY,
124
+ SCP_LOWERED_MARKER,
125
+ SPEC_VERSION,
126
+ SPEC_VERSION_SCP,
127
+ SPEC_VERSION_SUPPORTED,
128
+ canonicalizeExpressionSpec,
129
+ defineScpTransaction,
130
+ defineTransaction,
131
+ defineTransactions,
132
+ isTransactionRef,
133
+ operationsContainScpNodes,
134
+ operationsSpecVersion,
135
+ when
136
+ } from "./chunk-3UD3XIF2.js";
106
137
  import {
107
138
  BATCH_GET_MAX_KEYS,
108
139
  BATCH_WRITE_MAX_ITEMS,
@@ -110,8 +141,6 @@ import {
110
141
  DEFAULT_MAX_ATTEMPTS,
111
142
  DEFAULT_RETRY_POLICY,
112
143
  DynamoExecutor,
113
- ENTITY_WRITES_MARKER,
114
- LIFECYCLE_CONTRACT_MARKER,
115
144
  MAX_TRANSACT_ITEMS,
116
145
  MetadataRegistry,
117
146
  RetryingExecutor,
@@ -119,45 +148,28 @@ import {
119
148
  attachModelClass,
120
149
  buildConditionExpression,
121
150
  buildDeleteInput,
122
- buildMaintenanceGraph,
123
151
  buildPutInput,
124
- buildSubscribeHandler,
125
152
  buildUpdateExpression,
126
153
  buildUpdateInput,
127
154
  collapseSameKeyItems,
128
155
  collectRawConditionParams,
129
- collectViewDefinitions,
130
156
  commitTransaction,
131
157
  cond,
132
- detectRelationFields,
133
- entityWrites,
134
158
  execItemKeySignature,
135
159
  executeDelete,
136
160
  executePut,
137
161
  executeTransaction,
138
162
  executeUpdate,
139
- getEntityWrites,
140
- getImplicitKeyFields,
141
163
  gsi,
142
- hydrate,
143
- identity,
144
- isEntityWritesDefinition,
145
- isLifecycleContract,
146
- isMaintainTrigger,
147
164
  isParam,
148
165
  isRawCondition,
149
166
  isRetryableError,
150
167
  isRetryableTransactionCancellation,
151
- isSelectBuilder,
152
- lifecyclePhaseForIntent,
153
- maintainTrigger,
154
168
  param,
155
- parseChange,
156
- preview,
157
169
  resolveConditionTree,
158
170
  resolveModelClass,
159
171
  serializeFieldValue
160
- } from "./chunk-PFFPLD4B.js";
172
+ } from "./chunk-3ZU2VW3L.js";
161
173
  import {
162
174
  Linter,
163
175
  TableMapping,
@@ -779,6 +791,55 @@ function toSharedParams(params) {
779
791
  return out;
780
792
  }
781
793
 
794
+ // src/runtime/guard-eval.ts
795
+ import { evaluateExpression, ExprFailure } from "behavior-contracts";
796
+ var GUARD_SCOPE_ROOTS = /* @__PURE__ */ new Set(["input", "item"]);
797
+ function assertGuardScopes(node, context) {
798
+ if (node === null || typeof node !== "object") return;
799
+ const obj = node;
800
+ const ref = obj.ref ?? obj.refOpt;
801
+ if (Array.isArray(ref)) {
802
+ const root = ref[0];
803
+ if (typeof root === "string" && !GUARD_SCOPE_ROOTS.has(root)) {
804
+ throw new Error(
805
+ `${context}: this guard references '${root}', but a client-side guard may only reference the transaction 'input' / fan-out 'item' scopes. An expression that reads a DynamoDB attribute must lower to a ConditionExpression (write-condition class), not be evaluated client-side (issue #265). Refusing to evaluate a stale check.`
806
+ );
807
+ }
808
+ return;
809
+ }
810
+ for (const value of Object.values(obj)) {
811
+ if (Array.isArray(value)) {
812
+ for (const child of value) assertGuardScopes(child, context);
813
+ } else if (value !== null && typeof value === "object") {
814
+ for (const child of Object.values(value)) {
815
+ assertGuardScopes(child, context);
816
+ }
817
+ }
818
+ }
819
+ }
820
+ function evaluateGuard(guard, params, element, context) {
821
+ assertGuardScopes(guard.expr, context);
822
+ const scope = { input: toSharedParams(params) };
823
+ if (element !== void 0) {
824
+ scope.item = toSharedValue(element);
825
+ }
826
+ let result;
827
+ try {
828
+ result = evaluateExpression(guard.expr, scope);
829
+ } catch (exc) {
830
+ if (exc instanceof ExprFailure) {
831
+ throw new Error(`${context}: guard evaluation failed (${exc.code}): ${exc.message}`);
832
+ }
833
+ throw exc;
834
+ }
835
+ if (typeof result !== "boolean") {
836
+ throw new Error(
837
+ `${context}: a guard expression must evaluate to a boolean, got ${result === null ? "null" : typeof result} (issue #265).`
838
+ );
839
+ }
840
+ return result;
841
+ }
842
+
782
843
  // src/operations/declarative-transaction.ts
783
844
  var PLACEHOLDER_RE = /\{[^{}]+\}/g;
784
845
  function hasNonCoreScope(template) {
@@ -900,6 +961,11 @@ function applyCondition(condition, target, params, element) {
900
961
  target.ConditionExpression = condition.expression;
901
962
  return;
902
963
  }
964
+ if (condition.kind === "scpExpr") {
965
+ throw new Error(
966
+ "declarative transaction: this runtime does not evaluate scpExpr write conditions yet (spec 1.2 expression vocabulary, issue #261); evaluation lands with Phase 3 S5 (#265). Refusing to execute the write with its condition ignored."
967
+ );
968
+ }
903
969
  if (condition.kind === "expr") {
904
970
  const concrete = resolveConditionTree(
905
971
  condition.declarative,
@@ -1088,10 +1154,14 @@ function expandTransactionItems(spec, manifest, params) {
1088
1154
  }
1089
1155
  for (const element of source) {
1090
1156
  if (item.when && !whenHolds(item.when, params, element)) continue;
1157
+ if (item.guard !== void 0 && !evaluateGuard(item.guard, params, element, "declarative transaction guard"))
1158
+ continue;
1091
1159
  emit(item, element);
1092
1160
  }
1093
1161
  } else {
1094
1162
  if (item.when && !whenHolds(item.when, params, void 0)) continue;
1163
+ if (item.guard !== void 0 && !evaluateGuard(item.guard, params, void 0, "declarative transaction guard"))
1164
+ continue;
1095
1165
  emit(item, void 0);
1096
1166
  }
1097
1167
  }
@@ -1545,11 +1615,11 @@ function bindPlan(doc, planId) {
1545
1615
  );
1546
1616
  }
1547
1617
  try {
1548
- validateEnvelope(doc, SPEC_VERSION, { field: "specVersion", label: LOAD_LABEL });
1618
+ validateEnvelope(doc, SPEC_VERSION_SUPPORTED, { field: "specVersion", label: LOAD_LABEL });
1549
1619
  } catch (exc) {
1550
1620
  if (exc instanceof EnvelopeFailure) {
1551
1621
  throw new Error(
1552
- `${LOAD_LABEL}: the artifact was compiled against operation-IR version '${String(doc.specVersion)}' but this runtime speaks '${SPEC_VERSION}'. A version-skewed static plan never executes \u2014 regenerate the artifact.`
1622
+ `${LOAD_LABEL}: the artifact was compiled against operation-IR version '${String(doc.specVersion)}' but this runtime speaks '${SPEC_VERSION_SUPPORTED}'. A version-skewed static plan never executes \u2014 regenerate the artifact.`
1553
1623
  );
1554
1624
  }
1555
1625
  throw exc;
@@ -1997,6 +2067,7 @@ function collectConditionParams(condition, out) {
1997
2067
  }
1998
2068
  const obj = condition;
1999
2069
  if (obj.notExists === true) return;
2070
+ if ("scpExpr" in obj) return;
2000
2071
  if (typeof obj.attributeExists === "string") return;
2001
2072
  if (typeof obj.attributeNotExists === "string") return;
2002
2073
  collectConditionTreeParams(obj, out);
@@ -2186,6 +2257,7 @@ export {
2186
2257
  DynamoExecutor,
2187
2258
  EDGE_WRITES_MARKER,
2188
2259
  ENTITY_WRITES_MARKER,
2260
+ EXPR_VERSION,
2189
2261
  LIFECYCLE_CONTRACT_MARKER,
2190
2262
  Linter,
2191
2263
  MAINT_OUTBOX_PK_PREFIX,
@@ -2198,7 +2270,9 @@ export {
2198
2270
  PreparedReadStatement,
2199
2271
  PreparedWriteStatement,
2200
2272
  RetryingExecutor,
2273
+ SCP_LOWERED_MARKER,
2201
2274
  SPEC_VERSION,
2275
+ SPEC_VERSION_SCP,
2202
2276
  TableMapping,
2203
2277
  TransactionContext,
2204
2278
  aggregate,
@@ -2227,6 +2301,7 @@ export {
2227
2301
  buildTransactions,
2228
2302
  buildUpdateExpression,
2229
2303
  buildUpdateInput,
2304
+ canonicalizeExpressionSpec,
2230
2305
  cdcProjected,
2231
2306
  collectContractBoundaryViolations,
2232
2307
  collectContractN1Violations,
@@ -2253,6 +2328,7 @@ export {
2253
2328
  definePut,
2254
2329
  defineQueries,
2255
2330
  defineQuery,
2331
+ defineScpTransaction,
2256
2332
  defineTransaction,
2257
2333
  defineTransactions,
2258
2334
  defineUpdate,
@@ -2335,6 +2411,8 @@ export {
2335
2411
  noScanRule,
2336
2412
  number,
2337
2413
  numberSet,
2414
+ operationsContainScpNodes,
2415
+ operationsSpecVersion,
2338
2416
  param,
2339
2417
  parseChange,
2340
2418
  plan,
@@ -1,8 +1,9 @@
1
- import { L as LintRule } from '../registry-CXhP4TaE.js';
2
- export { a as LintResult, b as Linter } from '../registry-CXhP4TaE.js';
3
- export { c as createDefaultLinter, g as gsiAmbiguityRule, m as missingGsiRule, n as noScanRule, q as queryBoundaryRule, r as relationDepthRule, a as requireLimitRule } from '../relation-depth-Dg3yhl7S.js';
4
- import '../maintenance-view-adapter-BATUh_I8.js';
1
+ import { L as LintRule } from '../registry-LWE54Sdc.js';
2
+ export { a as LintResult, b as Linter } from '../registry-LWE54Sdc.js';
3
+ export { c as createDefaultLinter, g as gsiAmbiguityRule, m as missingGsiRule, n as noScanRule, q as queryBoundaryRule, r as relationDepthRule, a as requireLimitRule } from '../relation-depth-BRS513Tq.js';
4
+ import '../maintenance-view-adapter-BAZ9uBGe.js';
5
5
  import '@aws-sdk/client-dynamodb';
6
+ import '../types-BQLzTEqh.js';
6
7
 
7
8
  /**
8
9
  * `samePartition` preset validator (Epic #118 child issue H).