graphddb 0.2.3 → 0.2.5
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/README.md +339 -284
- package/dist/{chunk-FWDJSGF3.js → chunk-4TYK3AV6.js} +911 -173
- package/dist/{chunk-CVUDLLRS.js → chunk-ITHQ2EDH.js} +1 -1
- package/dist/{chunk-NJEC76TX.js → chunk-SGYBE2OV.js} +417 -47
- package/dist/cli.js +2 -2
- package/dist/index.d.ts +269 -12
- package/dist/index.js +13 -3
- package/dist/testing/index.d.ts +5 -5
- package/dist/testing/index.js +9 -6
- package/dist/{types-SKxZQbQO.d.ts → types--tdHK3vi.d.ts} +828 -165
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import {
|
|
3
3
|
buildBridgeBundle,
|
|
4
4
|
normalizeSelectSpec
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-SGYBE2OV.js";
|
|
6
6
|
import {
|
|
7
7
|
MetadataRegistry
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-4TYK3AV6.js";
|
|
9
9
|
|
|
10
10
|
// src/cli.ts
|
|
11
11
|
import { createRequire } from "module";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as SelectableOf,
|
|
2
|
-
export {
|
|
1
|
+
import { S as SelectableOf, g as PrimaryKeyOf, h as RequestContext, i as Middleware, j as ReadRequestKind, k as CtxModel, l as ReadParams, m as ReadRequestCtx, D as DynamoDBOperation, I as Item, E as Executor, n as RetryPolicy, o as ExecutionPlanSpec, p as SegmentedKey, q as SelectBuilderSpec, r as RawCondition, s as TransactionSpec, t as Manifest, u as RetryOverride, v as ExecutionPlan, w as ResolvedKey, R as ReadExecOptions, a as ExecutorResult, B as BatchGetExecInput, P as PutInput, W as WriteExecOptions, b as WriteResult, U as UpdateInput, c as DeleteInput, d as BatchWriteExecItem, e as BatchExecOptions, T as TransactWriteExecItem, x as CdcEmulatorOptions, y as ChangeHandler, z as Unsubscribe, F as FaultSpec, A as ConcurrentRecomputeRef, C as ChangeEvent, G as EventLog, H as ReplayOptions, J as ShardId, K as TransactionItemSpec, L as Param, N as ParamDescriptor, O as DefinitionMap, Q as OperationDefinition, f as DDBModel, M as ModelStatic, V as WriteDefinitionOptions, X as PartialQueryKeyOf, Y as StrictSelectSpec, Z as EntityInput, _ as UniqueQueryKeyOf, $ as EntityRef, a0 as ConditionInput, a1 as QueryModelContract, a2 as QueryMethodSpec, a3 as CommandModelContract, a4 as CommandMethodSpec, a5 as ContractSpec, a6 as QuerySpec, a7 as CommandSpec, a8 as ContextSpec, a9 as OperationsDocument, aa as AnyOperationDefinition, ab as BridgeBundle, ac as ConditionSpec } from './types--tdHK3vi.js';
|
|
2
|
+
export { ad as BatchDeleteRequest, ae as BatchGetOptions, af as BatchGetRequest, ag as BatchGetResult, ah as BatchPutRequest, ai as BatchResult, aj as BatchWriteRequest, ak as CONTRACT_RANGE_FANOUT_CONCURRENCY, al as CdcMode, am as Change, an as ChangeBatch, ao as ChangeEventName, ap as ClockMode, aq as Column, ar as ColumnMap, as as CommandContractMethodSpec, at as CommandInputShape, au as CommandMethod, av as CommandPlan, aw as CommandResolutionTarget, ax as CommandResultKind, ay as CommandSelectShape, az as CompiledFragment, aA as ComposeSpec, aB as CondSlot, aC as ConditionCheckInput, aD as Connection, aE as ContractCallSignature, aF as ContractCardinality, aG as ContractCommandParams, aH as ContractCommandResult, aI as ContractComposeNode, aJ as ContractFromRef, aK as ContractInputArity, aL as ContractItem, aM as ContractKeyFieldRef, aN as ContractKeyInput, aO as ContractKeyRef, aP as ContractKeySpec, aQ as ContractKind, aR as ContractMethodOp, aS as ContractParamRef, aT as ContractQueryParams, aU as ContractResolution, aV as CtxBase, aW as DEFAULT_MAX_ATTEMPTS, aX as DEFAULT_RETRY_POLICY, aY as DeleteOptions, aZ as DeriveEffect, a_ as DerivedEdgeWrite, a$ as DerivedUpdate, b0 as DescriptorBinding, b1 as ENTITY_WRITES_MARKER, b2 as EdgeEffect, b3 as EffectPath, b4 as EmitEffect, b5 as EntityWritesDefinition, b6 as EntityWritesShape, b7 as ExecutableCommandContract, b8 as ExecutableQueryContract, b9 as FilterInput, ba as FilterSpec, bb as FragmentInput, bc as GsiDefinitionMarker, bd as GsiOptions, be as IdempotencyEffect, bf as InProcessWriteDescriptor, bg as InputArity, bh as KeyDefinitionMarker, bi as KeySegment, bj as KeySlot, bk as KeyStructure, bl as KeyedResult, bm as LIFECYCLE_CONTRACT_MARKER, bn as LifecycleContract, bo as LifecycleEffects, bp as LiteralParam, bq as ManifestEntity, br as ManifestField, bs as ManifestFieldType, bt as ManifestGsi, bu as ManifestKey, bv as ManifestRelation, bw as ManifestTable, bx as ModelRef, by as MutateMode, bz as MutateOptions, bA as MutateParallelResult, bB as MutateTransactionResult, bC as MutationBody, bD as MutationDescriptorMap, bE as MutationFragment, bF as MutationInputProxy, bG as MutationInputRef, bH as MutationIntent, bI as NumberParam, bJ as OperationKind, bK as OperationSpec, bL as ParallelOpResult, bM as ParamKind, bN as ParamSpec, bO as ParamStructure, bP as PersistCtx, bQ as PersistOrigin, bR as PlannedCommandMethod, bS as PutOptions, bT as QueryContractMethodSpec, bU as QueryEnvelopeResult, bV as QueryKeyOf, bW as QueryMethod, bX as QueryResult, bY as RangeConditionSpec, bZ as ReadEnvelope, b_ as ReadOpCtx, b$ as ReadOpKind, c0 as ReadOperationType, c1 as ReadRouteDescriptor, c2 as ReadRouteOptions, c3 as ReadRouteResult, c4 as RecordedCompose, c5 as RelationBuilder, c6 as RelationSelect, c7 as RelationSpec, c8 as RequiresEffect, c9 as Resolution, ca as RetryInfo, cb as RetryOperationKind, cc as SPEC_VERSION, cd as SegmentSpec, ce as SelectBuilder, cf as SelectOf, cg as StartingPosition, ch as StreamViewType, ci as StringParam, cj as TransactionContext, ck as TransactionItemType, cl as UniqueEffect, cm as Updatable, cn as UpdateOptions, co as WhenSpec, cp as WriteCtx, cq as WriteDescriptor, cr as WriteEnvelope, cs as WriteInput, ct as WriteKind, cu as WriteLifecyclePhase, cv as WriteMiddleware, cw as WriteOperationType, cx as WriteRecorder, cy as WriteResultProjection, cz as attachModelClass, cA as buildDeleteInput, cB as buildPutInput, cC as buildUpdateInput, cD as compileFragment, cE as compileMutationPlan, cF as compileSingleFragmentPlan, cG as cond, cH as contractOfMethodSpec, cI as definePlan, cJ as entityWrites, cK as executeBatchGet, cL as executeBatchWrite, cM as executeCommandMethod, cN as executeDelete, cO as executeKeyedBatchGet, cP as executePut, cQ as executeQueryMethod, cR as executeRangeFanout, cS as executeTransaction, cT as executeUpdate, cU as from, cV as getEntityWrites, cW as gsi, cX as isColumn, cY as isCommandModelContract, cZ as isCommandPlan, c_ as isContractComposeNode, c$ as isContractFromRef, d0 as isContractKeyFieldRef, d1 as isContractKeyRef, d2 as isContractParamRef, d3 as isEntityWritesDefinition, d4 as isKeySegment, d5 as isLifecycleContract, d6 as isMutationFragment, d7 as isMutationInputRef, d8 as isParam, d9 as isPlannedCommandMethod, da as isQueryModelContract, db as isRetryableError, dc as isRetryableTransactionCancellation, dd as k, de as key, df as lifecyclePhaseForIntent, dg as mintContractKeyFieldRef, dh as mintContractParamRef, di as mutation, dj as param, dk as publicCommandModel, dl as publicQueryModel, dm as query, dn as resolveLifecycle, dp as wholeKeysSentinel } from './types--tdHK3vi.js';
|
|
3
3
|
import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
|
|
4
4
|
import { DynamoDBDocumentClient } from '@aws-sdk/lib-dynamodb';
|
|
5
5
|
|
|
@@ -32,6 +32,99 @@ type ListOptions<T, S extends SelectableOf<T> = SelectableOf<T>> = {
|
|
|
32
32
|
order?: 'ASC' | 'DESC';
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
+
/**
|
|
36
|
+
* Read-middleware runtime (issue #138). Drives the registered {@link Middleware}
|
|
37
|
+
* list through the read hook points R1–R5 with the ordering the proposal
|
|
38
|
+
* specifies:
|
|
39
|
+
*
|
|
40
|
+
* - `before*` (R1 / R2) run **first-registered-first** (FIFO);
|
|
41
|
+
* - `afterFetch` (R3 / R4) and `onError` (R5) run **last-registered-first**
|
|
42
|
+
* (LIFO) — onion nesting without a `next()` callback.
|
|
43
|
+
*
|
|
44
|
+
* All hooks are async-first: each is always `await`ed, so a sync hook (returns
|
|
45
|
+
* `void` / a value) and an async hook (returns a `Promise`) compose uniformly.
|
|
46
|
+
*
|
|
47
|
+
* A {@link MiddlewareRuntime} is constructed ONCE per read at the request entry
|
|
48
|
+
* (R1) from the snapshot of registered middleware + the per-call `context`, then
|
|
49
|
+
* threaded — unchanged — through the root read and every relation fan-out op
|
|
50
|
+
* (the same way `retry` is threaded, see `RelationTraversalOptions`). Threading
|
|
51
|
+
* an immutable runtime (not re-reading the registry per op) keeps a read's hook
|
|
52
|
+
* set stable even if middleware is (un)registered mid-flight, and is
|
|
53
|
+
* concurrency-safe under parallel fan-out (#31).
|
|
54
|
+
*
|
|
55
|
+
* @see docs/proposals/read-middleware.md
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* The per-read middleware runtime. Immutable wrt the middleware list and the
|
|
60
|
+
* request `context`; threaded by reference into every fan-out op. A read with no
|
|
61
|
+
* registered middleware is represented by an EMPTY runtime whose `active` is
|
|
62
|
+
* `false`, so the hot read path can skip all hook plumbing with one check.
|
|
63
|
+
*/
|
|
64
|
+
declare class MiddlewareRuntime {
|
|
65
|
+
/** The frozen, registration-ordered middleware snapshot for this read. */
|
|
66
|
+
private readonly chain;
|
|
67
|
+
/** The host-injected per-call context (`{}` when the read passed none). */
|
|
68
|
+
readonly context: RequestContext;
|
|
69
|
+
constructor(chain: readonly Middleware[], context: RequestContext);
|
|
70
|
+
/** `true` when at least one middleware is registered for this read. */
|
|
71
|
+
get active(): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Build the request-level context (R1 / R4 / R5 share it). Pure — no hooks run
|
|
74
|
+
* — so a caller can create it up front and still reference it from R5 even if
|
|
75
|
+
* R1 throws mid-chain.
|
|
76
|
+
*/
|
|
77
|
+
requestCtx(kind: ReadRequestKind, model: CtxModel, params: ReadParams): ReadRequestCtx;
|
|
78
|
+
/**
|
|
79
|
+
* R1 — request entry, before key-resolution / plan. Builds the
|
|
80
|
+
* {@link ReadRequestCtx} then runs every `read.before` FIFO; a hook may mutate
|
|
81
|
+
* `ctx.params` and may `throw` to cancel the read. Returns the (possibly
|
|
82
|
+
* hook-mutated) ctx so the caller can re-read `params` and reuse the SAME ctx
|
|
83
|
+
* for R4 / R5 (shared `state`).
|
|
84
|
+
*/
|
|
85
|
+
runRequestBefore(kind: ReadRequestKind, model: CtxModel, params: ReadParams): Promise<ReadRequestCtx>;
|
|
86
|
+
/**
|
|
87
|
+
* R4 — final hydrated, relation-merged result. Runs every `read.afterFetch`
|
|
88
|
+
* LIFO, threading each hook's return value into the next (onion), and returns
|
|
89
|
+
* the final (possibly replaced) result. `ctx` is the SAME object R1 produced,
|
|
90
|
+
* so a `before`/`afterFetch` pair shares `ctx.state`.
|
|
91
|
+
*/
|
|
92
|
+
runRequestAfter<T>(ctx: ReadRequestCtx, result: T): Promise<T>;
|
|
93
|
+
/**
|
|
94
|
+
* R5 (request-level) — runs every `read.onError` LIFO. A hook may **recover**
|
|
95
|
+
* by RETURNING a non-`undefined` value: it becomes the read's resolved result
|
|
96
|
+
* in place of throwing, and the FIRST such hook (in LIFO order) wins and
|
|
97
|
+
* short-circuits the rest of the chain. If every hook declines (returns
|
|
98
|
+
* `undefined`/`void`), the original error rethrows — preserving the
|
|
99
|
+
* "failed read still rejects" default. (Proposal R5 + appendix A: onError may
|
|
100
|
+
* "rethrow / recover"; hooks are unrestricted.)
|
|
101
|
+
*
|
|
102
|
+
* The recovered value is returned as `T` (the read's result type); its shape
|
|
103
|
+
* is the host's responsibility — a hook recovering a `query` should return an
|
|
104
|
+
* item / `null`, one recovering a `list` a `{ items, cursor }`.
|
|
105
|
+
*/
|
|
106
|
+
runRequestError<T>(ctx: ReadRequestCtx, err: unknown): Promise<T>;
|
|
107
|
+
/**
|
|
108
|
+
* Drive ONE physical op (root read or any fan-out fetch) through R2 → send →
|
|
109
|
+
* R3, with R5 (op-level) on failure:
|
|
110
|
+
*
|
|
111
|
+
* 1. R2 (`read.op.before`, FIFO) — may mutate `ctx.operation`, may `throw`;
|
|
112
|
+
* 2. the caller's `send` runs against the (possibly mutated) operation;
|
|
113
|
+
* 3. R3 (`read.op.afterFetch`, LIFO) — transforms the raw items (onion);
|
|
114
|
+
* 4. on any throw from `send` (or R2 / R3), R5 (`read.op.onError`, LIFO) runs:
|
|
115
|
+
* a hook may **recover** by RETURNING an `Item[]` (those become this op's
|
|
116
|
+
* items and the pipeline continues); the FIRST hook that returns items wins
|
|
117
|
+
* and short-circuits the chain. If none recovers, the original error
|
|
118
|
+
* rethrows.
|
|
119
|
+
*
|
|
120
|
+
* Returns the (possibly R3-replaced, or R5-recovered) items. The `send` closure
|
|
121
|
+
* receives the final operation so a caller that built its operation from
|
|
122
|
+
* `ctx.operation` before this call still observes an R2 mutation (the caller
|
|
123
|
+
* MUST send `ctx.operation`, which this method passes through).
|
|
124
|
+
*/
|
|
125
|
+
runOp(operation: DynamoDBOperation, relationPath: readonly string[], model: CtxModel, send: (operation: DynamoDBOperation) => Promise<Item[]>): Promise<Item[]>;
|
|
126
|
+
}
|
|
127
|
+
|
|
35
128
|
/**
|
|
36
129
|
* The ONE shared `TransactWriteItems` commit orchestration (issue #97).
|
|
37
130
|
*
|
|
@@ -92,6 +185,22 @@ declare class ClientManager {
|
|
|
92
185
|
*/
|
|
93
186
|
private static executor;
|
|
94
187
|
private static defaultExecutor;
|
|
188
|
+
/**
|
|
189
|
+
* The globally-configured single-op retry policy (issue #111). `null` ⇒ the
|
|
190
|
+
* always-on built-in {@link DEFAULT_RETRY_POLICY} applies (retry is enabled out
|
|
191
|
+
* of the box). Set via {@link DDBModel.setRetryPolicy} / {@link setRetryPolicy};
|
|
192
|
+
* read at call time by the default {@link RetryingExecutor}.
|
|
193
|
+
*/
|
|
194
|
+
private static retryPolicy;
|
|
195
|
+
/**
|
|
196
|
+
* The host-runtime read-middleware registry (issue #50 / #138) — a process-wide
|
|
197
|
+
* ordered list of {@link Middleware}, the same global-config + injectable-seam
|
|
198
|
+
* pattern as {@link retryPolicy} / {@link executor}. Registered via
|
|
199
|
+
* {@link DDBModel.use} / {@link use}, snapshotted per read, and NEVER serialized
|
|
200
|
+
* (it never touches the planner / spec / `operations.json`, so the bridge #48 is
|
|
201
|
+
* unaffected). {@link reset} clears it.
|
|
202
|
+
*/
|
|
203
|
+
private static middleware;
|
|
95
204
|
static setClient(client: DynamoDBClient): void;
|
|
96
205
|
static getClient(): DynamoDBClient;
|
|
97
206
|
static getDocumentClient(): Promise<DynamoDBDocumentClient>;
|
|
@@ -105,10 +214,38 @@ declare class ClientManager {
|
|
|
105
214
|
* executor module graph.
|
|
106
215
|
*/
|
|
107
216
|
static getExecutor(): Executor;
|
|
108
|
-
/**
|
|
217
|
+
/**
|
|
218
|
+
* Inject a custom executor (test adapter / memory engine). It is used AS-IS —
|
|
219
|
+
* not wrapped in a {@link RetryingExecutor} — so the in-memory adapter (which
|
|
220
|
+
* never throttles) bypasses the retry layer entirely (issue #111).
|
|
221
|
+
*/
|
|
109
222
|
static setExecutor(executor: Executor): void;
|
|
110
|
-
/** Restore the default {@link DynamoExecutor}. */
|
|
223
|
+
/** Restore the default {@link RetryingExecutor}-wrapped {@link DynamoExecutor}. */
|
|
111
224
|
static resetExecutor(): void;
|
|
225
|
+
/**
|
|
226
|
+
* Configure the global single-op retry policy (issue #111). Mirrors
|
|
227
|
+
* {@link setClient} / {@link setTableMapping}: a process-wide setting the default
|
|
228
|
+
* {@link RetryingExecutor} reads. `null` restores the always-on built-in default.
|
|
229
|
+
* A per-call `retry?:` override on an operation option bag takes precedence.
|
|
230
|
+
*/
|
|
231
|
+
static setRetryPolicy(policy: RetryPolicy | null): void;
|
|
232
|
+
/** The globally-configured retry policy, or `null` for the built-in default. */
|
|
233
|
+
static getRetryPolicy(): RetryPolicy | null;
|
|
234
|
+
/**
|
|
235
|
+
* Register a read {@link Middleware} (issue #50 / #138). Appended last, so its
|
|
236
|
+
* `before*` hooks run last (FIFO) and its `afterFetch` / `onError` hooks run
|
|
237
|
+
* first (LIFO). Mirrors {@link setRetryPolicy}; backs {@link DDBModel.use}.
|
|
238
|
+
*/
|
|
239
|
+
static use(mw: Middleware): void;
|
|
240
|
+
/** Remove every registered read middleware (teardown / tests). Backs {@link DDBModel.clearMiddleware}. */
|
|
241
|
+
static clearMiddleware(): void;
|
|
242
|
+
/**
|
|
243
|
+
* A point-in-time, registration-ordered snapshot of the registered read
|
|
244
|
+
* middleware. A read takes this once at entry (R1) and threads it down, so the
|
|
245
|
+
* read's hook set stays stable even if middleware is registered / cleared
|
|
246
|
+
* mid-flight.
|
|
247
|
+
*/
|
|
248
|
+
static getMiddleware(): readonly Middleware[];
|
|
112
249
|
/** @internal — for testing only */
|
|
113
250
|
static reset(): void;
|
|
114
251
|
}
|
|
@@ -503,6 +640,13 @@ declare function executeDeclarativeTransaction(spec: TransactionSpec, manifest:
|
|
|
503
640
|
interface QueryOptions {
|
|
504
641
|
consistentRead?: boolean;
|
|
505
642
|
maxDepth?: number;
|
|
643
|
+
/**
|
|
644
|
+
* Per-call throttle / transient-error retry override (issue #111), applied to the
|
|
645
|
+
* parent read AND to every relation-fan-out send under it. A {@link RetryPolicy}
|
|
646
|
+
* replaces the global policy for this call; `false` disables retry. Omit to use
|
|
647
|
+
* the configured (or built-in default) policy.
|
|
648
|
+
*/
|
|
649
|
+
retry?: RetryOverride;
|
|
506
650
|
/**
|
|
507
651
|
* When `true`, the returned item carries its resolved base-table key as a
|
|
508
652
|
* non-enumerable Symbol property so it can be passed back to `update()`
|
|
@@ -531,6 +675,14 @@ interface QueryOptions {
|
|
|
531
675
|
* "What to fetch" stays declarative; "what object to load it onto" is host-side.
|
|
532
676
|
*/
|
|
533
677
|
hydrate?: (raw: Record<string, unknown> | null) => unknown;
|
|
678
|
+
/**
|
|
679
|
+
* Host-injected per-call read context (issue #50 / #138) — exposed to every
|
|
680
|
+
* read hook (R1–R5) as `ctx.context`, and threaded UNCHANGED to every relation
|
|
681
|
+
* fan-out op so a hook (e.g. a tenant-scope R2 filter) applies across the root
|
|
682
|
+
* read AND the fan-out fetches. A host-language value, NEVER serialized into the
|
|
683
|
+
* SSoT / `operations.json` (the bridge #48 is unaffected). Absent ⇒ `{}`.
|
|
684
|
+
*/
|
|
685
|
+
context?: RequestContext;
|
|
534
686
|
}
|
|
535
687
|
declare function executeQuery(modelClass: Function, key: Record<string, unknown>, selectSpec: Record<string, unknown>, options?: QueryOptions): Promise<Record<string, unknown> | null>;
|
|
536
688
|
|
|
@@ -547,6 +699,34 @@ interface ListInput {
|
|
|
547
699
|
* query.
|
|
548
700
|
*/
|
|
549
701
|
updatable?: boolean;
|
|
702
|
+
/**
|
|
703
|
+
* Per-call throttle / transient-error retry override (issue #111). A
|
|
704
|
+
* {@link RetryPolicy} replaces the global policy for this read; `false` disables
|
|
705
|
+
* retry. Omit to use the configured (or built-in default) policy.
|
|
706
|
+
*/
|
|
707
|
+
retry?: RetryOverride;
|
|
708
|
+
/**
|
|
709
|
+
* Host-injected per-call read context (issue #50 / #138) — exposed to every
|
|
710
|
+
* read hook as `ctx.context`. Used only when this `list` is the read ENTRY
|
|
711
|
+
* point (the public `DDBModel.list` / a `list` envelope route): a fresh
|
|
712
|
+
* {@link MiddlewareRuntime} is built from it. Ignored when a relation fan-out
|
|
713
|
+
* threads an already-built {@link mw} (the runtime then carries the root read's
|
|
714
|
+
* context). Absent ⇒ `{}`.
|
|
715
|
+
*/
|
|
716
|
+
context?: RequestContext;
|
|
717
|
+
/**
|
|
718
|
+
* @internal The per-read middleware runtime, threaded UNCHANGED from a relation
|
|
719
|
+
* fan-out (issue #138) so the hasMany Query's op-level hooks (R2/R3/R5) fire
|
|
720
|
+
* with the root read's context + the fan-out's {@link relationPath}. When absent
|
|
721
|
+
* at the entry point, one is built from {@link context}.
|
|
722
|
+
*/
|
|
723
|
+
mw?: MiddlewareRuntime;
|
|
724
|
+
/**
|
|
725
|
+
* @internal The relation path to THIS list read — `[]` (or absent) for a
|
|
726
|
+
* top-level `list`; the fan-out leg (e.g. `['orders']`) for a hasMany Query.
|
|
727
|
+
* Populates the op-level ctx's `relationPath` (issue #138).
|
|
728
|
+
*/
|
|
729
|
+
relationPath?: readonly string[];
|
|
550
730
|
}
|
|
551
731
|
/**
|
|
552
732
|
* Public list result returned by `DDBModel.list()`. Contains exactly the
|
|
@@ -618,10 +798,12 @@ declare function plan(metadata: EntityMetadata, input: PlanInput): ExecutionPlan
|
|
|
618
798
|
*
|
|
619
799
|
* This is the read entry point the planner-driven paths (`query` / `list`) call.
|
|
620
800
|
* It delegates to `ClientManager.getExecutor()`, which is the default
|
|
621
|
-
* {@link import('./
|
|
622
|
-
*
|
|
801
|
+
* {@link import('./retrying-executor.js').RetryingExecutor}-wrapped
|
|
802
|
+
* {@link import('./dynamo-executor.js').DynamoExecutor} unless a test has injected
|
|
803
|
+
* a `MemoryExecutor` via `ClientManager.setExecutor()`. The optional
|
|
804
|
+
* {@link ReadExecOptions} carries a per-call retry override (issue #111).
|
|
623
805
|
*/
|
|
624
|
-
declare function execute(operation: DynamoDBOperation): Promise<ExecutorResult>;
|
|
806
|
+
declare function execute(operation: DynamoDBOperation, options?: ReadExecOptions): Promise<ExecutorResult>;
|
|
625
807
|
|
|
626
808
|
/**
|
|
627
809
|
* The default {@link Executor}: a thin, behavior-preserving move of GraphDDB's
|
|
@@ -630,15 +812,65 @@ declare function execute(operation: DynamoDBOperation): Promise<ExecutorResult>;
|
|
|
630
812
|
* refactor and sends it through `ClientManager.getDocumentClient()`, so the
|
|
631
813
|
* command shapes (and therefore every existing mock-based / integration test)
|
|
632
814
|
* are unchanged.
|
|
815
|
+
*
|
|
816
|
+
* The optional per-call options (`ReadExecOptions` / `BatchExecOptions`) carry a
|
|
817
|
+
* retry override (issue #111) that is meaningful ONLY to {@link RetryingExecutor};
|
|
818
|
+
* here they are accepted to satisfy the {@link Executor} interface and otherwise
|
|
819
|
+
* ignored (this executor performs no app-level error retry of its own).
|
|
633
820
|
*/
|
|
634
821
|
declare class DynamoExecutor implements Executor {
|
|
635
|
-
execute(operation: DynamoDBOperation): Promise<ExecutorResult>;
|
|
636
|
-
batchGet(input: BatchGetExecInput): Promise<ExecutorResult>;
|
|
822
|
+
execute(operation: DynamoDBOperation, _options?: ReadExecOptions): Promise<ExecutorResult>;
|
|
823
|
+
batchGet(input: BatchGetExecInput, _options?: ReadExecOptions): Promise<ExecutorResult>;
|
|
637
824
|
put(input: PutInput, options?: WriteExecOptions): Promise<WriteResult>;
|
|
638
825
|
update(input: UpdateInput, options?: WriteExecOptions): Promise<WriteResult>;
|
|
639
826
|
delete(input: DeleteInput, options?: WriteExecOptions): Promise<WriteResult>;
|
|
640
|
-
batchWrite(tableName: string, items: BatchWriteExecItem[]): Promise<void>;
|
|
641
|
-
transactWrite(items: TransactWriteExecItem[]): Promise<void>;
|
|
827
|
+
batchWrite(tableName: string, items: BatchWriteExecItem[], _options?: BatchExecOptions): Promise<void>;
|
|
828
|
+
transactWrite(items: TransactWriteExecItem[], _options?: BatchExecOptions): Promise<void>;
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
/**
|
|
832
|
+
* {@link RetryingExecutor} — the single-op throttle / transient-error retry layer
|
|
833
|
+
* (issue #111). It DECORATES an inner {@link Executor} (the default
|
|
834
|
+
* {@link DynamoExecutor}), wrapping every single-op send — `execute` (Get/Query),
|
|
835
|
+
* `batchGet` (relation fan-out + planner reads), `put` / `update` / `delete`, and
|
|
836
|
+
* `transactWrite` — in {@link runWithRetry} so a throttle / transient error is
|
|
837
|
+
* retried with exponential backoff + jitter under a bounded attempt cap.
|
|
838
|
+
*
|
|
839
|
+
* This is the (B) ERROR-retry layer; the (A) partial-batch retry
|
|
840
|
+
* (`UnprocessedKeys` / `UnprocessedItems`) lives inside `batchGet` / `batchWrite`
|
|
841
|
+
* and is a SEPARATE concern (see `retry-policy.ts` header). The two share the
|
|
842
|
+
* backoff function but never merge:
|
|
843
|
+
* - `batchGet` here gets an OUTER error-retry wrap (the inner BatchGet still does
|
|
844
|
+
* its own UnprocessedKeys retry; the outer wrap catches a hard throttle REJECT
|
|
845
|
+
* of the whole send).
|
|
846
|
+
* - `batchWrite` is the in-flight bulk path that already owns UnprocessedItems
|
|
847
|
+
* retry per chunk; it is passed through UNWRAPPED here to avoid double-counting
|
|
848
|
+
* a throttle as both an unprocessed-item retry and an error retry. (Its chunks
|
|
849
|
+
* already back off on the shared ramp.)
|
|
850
|
+
*
|
|
851
|
+
* The policy precedence per call: an explicit per-call override (`retry:` on the
|
|
852
|
+
* option bag) wins; otherwise the globally-configured policy
|
|
853
|
+
* (`DDBModel.setRetryPolicy`); otherwise the always-on {@link DEFAULT_RETRY_POLICY}.
|
|
854
|
+
* `retry: false`, or a resolved `maxAttempts <= 1`, disables retry for that call.
|
|
855
|
+
*/
|
|
856
|
+
|
|
857
|
+
declare class RetryingExecutor implements Executor {
|
|
858
|
+
private readonly inner;
|
|
859
|
+
private readonly getGlobalPolicy;
|
|
860
|
+
/**
|
|
861
|
+
* @param inner the wrapped executor (the real {@link DynamoExecutor}).
|
|
862
|
+
* @param getGlobalPolicy reads the globally-configured policy (or `null` for the
|
|
863
|
+
* built-in default) at CALL time, so a `DDBModel.setRetryPolicy(...)` after the
|
|
864
|
+
* executor is constructed still takes effect.
|
|
865
|
+
*/
|
|
866
|
+
constructor(inner: Executor, getGlobalPolicy: () => RetryPolicy | null);
|
|
867
|
+
execute(operation: DynamoDBOperation, options?: ReadExecOptions): Promise<ExecutorResult>;
|
|
868
|
+
batchGet(input: BatchGetExecInput, options?: ReadExecOptions): Promise<ExecutorResult>;
|
|
869
|
+
put(input: PutInput, options?: WriteExecOptions): Promise<WriteResult>;
|
|
870
|
+
update(input: UpdateInput, options?: WriteExecOptions): Promise<WriteResult>;
|
|
871
|
+
delete(input: DeleteInput, options?: WriteExecOptions): Promise<WriteResult>;
|
|
872
|
+
batchWrite(tableName: string, items: BatchWriteExecItem[], options?: BatchExecOptions): Promise<void>;
|
|
873
|
+
transactWrite(items: TransactWriteExecItem[], options?: BatchExecOptions): Promise<void>;
|
|
642
874
|
}
|
|
643
875
|
|
|
644
876
|
/**
|
|
@@ -923,6 +1155,14 @@ interface RelationTraversalOptions {
|
|
|
923
1155
|
* non-enumerable Symbol property so it can be passed back to `update()`.
|
|
924
1156
|
*/
|
|
925
1157
|
updatable?: boolean;
|
|
1158
|
+
/**
|
|
1159
|
+
* Per-call throttle / transient-error retry override (issue #111), threaded from
|
|
1160
|
+
* the read's entry point into every relation-fan-out send (the `BatchGet` for
|
|
1161
|
+
* `belongsTo` / `hasOne`, the `Query` for `hasMany`). A {@link RetryPolicy}
|
|
1162
|
+
* replaces the global policy; `false` disables retry. Threaded unchanged through
|
|
1163
|
+
* every recursion level.
|
|
1164
|
+
*/
|
|
1165
|
+
retry?: RetryOverride;
|
|
926
1166
|
/**
|
|
927
1167
|
* The **declared execution plan** (issue #70c) the traversal HONORS to decide
|
|
928
1168
|
* which sibling relations are independent (a concurrency-eligible stage) and the
|
|
@@ -938,6 +1178,23 @@ interface RelationTraversalOptions {
|
|
|
938
1178
|
* grouping / bound and observe the traversal execute accordingly.
|
|
939
1179
|
*/
|
|
940
1180
|
plan?: RelationExecutionPlan;
|
|
1181
|
+
/**
|
|
1182
|
+
* The per-read middleware runtime (issue #50 / #138), threaded UNCHANGED from
|
|
1183
|
+
* the read's entry point into every relation fan-out fetch — exactly like
|
|
1184
|
+
* `retry`. Each fan-out send is wrapped so the op-level hooks R2 (before send) /
|
|
1185
|
+
* R3 (raw items) / R5 (op error) fire for that physical op too, with
|
|
1186
|
+
* `ctx.relationPath` identifying the fan-out leg (`['orders']`,
|
|
1187
|
+
* `['orders','product']`, …) and `ctx.model` the relation's target model.
|
|
1188
|
+
* Absent → {@link NO_MIDDLEWARE} (no hooks).
|
|
1189
|
+
*/
|
|
1190
|
+
mw?: MiddlewareRuntime;
|
|
1191
|
+
/**
|
|
1192
|
+
* The relation path from the root read to the CURRENT traversal level — `[]`
|
|
1193
|
+
* at the root, extended by each relation's property name as the traversal
|
|
1194
|
+
* recurses. Used only to populate `ctx.relationPath` for the op-level hooks
|
|
1195
|
+
* (R2/R3/R5). Threaded alongside {@link mw}.
|
|
1196
|
+
*/
|
|
1197
|
+
relationPath?: readonly string[];
|
|
941
1198
|
}
|
|
942
1199
|
/**
|
|
943
1200
|
* Validates that the select depth does not exceed maxDepth.
|
|
@@ -2033,4 +2290,4 @@ declare function assertBundleSerializable(bundle: BridgeBundle): void;
|
|
|
2033
2290
|
*/
|
|
2034
2291
|
declare function buildBridgeBundle(queries?: DefinitionMap, commands?: DefinitionMap, registry?: typeof MetadataRegistry, transactions?: Record<string, TransactionDefinition>, contractInputs?: ContractInputs): BridgeBundle;
|
|
2035
2292
|
|
|
2036
|
-
export { type AnyModelContract, AnyOperationDefinition, BATCH_GET_MAX_KEYS, BATCH_WRITE_MAX_ITEMS, BatchGetExecInput, BatchWriteExecItem, BridgeBundle, type BuiltContracts, CdcEmulator, CdcEmulatorOptions, ChangeEvent, ChangeHandler, ClientManager, type CollectParams, CommandMethodSpec, CommandModelContract, CommandSpec, ConcurrentRecomputeRef, type ConditionExpressionResult, ConditionInput, ConditionSpec, type ContextOwnership, type ContextOwnershipMap, ContextSpec, type ContractBoundaryViolation, type ContractInputs, type ContractMap, type ContractN1Violation, ContractSpec, DDBModel, DefinitionMap, DeleteInput, DynamoDBOperation, DynamoExecutor, type DynamoType, EDGE_WRITES_MARKER, type EdgeLifecycle, type EdgeWriteDeclaration, type EdgeWriteRecorder, type EdgeWritesDefinition, type EmbeddedMetadata, type EntityMetadata, EntityRef, EventLog, ExecutionPlan, Executor, ExecutorResult, type ExplainInput, FaultSpec, type FieldMetadata, type FieldOptions, type FilterExpressionResult, type GsiDefinition, type KeyDefinition, type LintResult, type LintRule, Linter, type ListInput, type ListOptions, MAX_TRANSACT_ITEMS, Manifest, MetadataRegistry, type ModelOptions, ModelStatic, OLD_VALUE_NAMESPACE, OperationDefinition, OperationsDocument, Param, ParamDescriptor, type Parameterize, PartialQueryKeyOf, type PerKeyCursorEnvelope, type PlanInput, PrimaryKeyOf, type ProjectionResult, PutInput, QueryMethodSpec, QueryModelContract, type QueryOptions$1 as QueryOptions, QuerySpec, RawCondition, type RelationLimitOptions, type RelationMetadata, type RelationOptions, type RelationTraversalOptions, ReplayOptions, ResolvedKey, SegmentedKey, SelectableOf, ShardId, TableMapping, TransactWriteExecItem, type TransactionDefinition, TransactionItemSpec, type TransactionParamShape, type TransactionRef, TransactionSpec, type TxConditionCheckOptions, type TxForEachInstruction, type TxForEachOptions, type TxInstruction, type TxRecorder, type TxWriteInstruction, type TxWriteOptions, UniqueQueryKeyOf, type UpdateExpressionResult, UpdateInput, type WhenComparison, WriteDefinitionOptions, WriteExecOptions, WriteResult, assertBundleSerializable, assertContractBoundaries, assertContractN1Safe, assertJsonSerializable, assertSupportedCondition, belongsTo, binary, boolean, buildBridgeBundle, buildConditionExpression, buildContexts, buildContracts, buildManifest, buildOperations, buildProjection, buildQuerySpec, buildTransactionSpec, buildTransactions, buildUpdateExpression, collectContractBoundaryViolations, collectContractN1Violations, compileFilterExpression, createCdcEmulator, createDefaultLinter, datetime, decodeCursor, decodePerKeyCursor, defineCommands, defineDelete, defineList, definePut, defineQueries, defineQuery, defineTransaction, defineTransactions, defineUpdate, deriveEdgeWriteItems, deriveEdgeWriteItemsFor, deriveModelEdgeWriteItems, derivePrefix, detectRelationFields, edgeWrites, embedded, encodeCursor, encodePerKeyCursor, evaluateFilter, execute, executeDeclarativeTransaction, executeExplain, executeList, executeQuery, expandTransaction, field, getEdgeWrites, getImplicitKeyFields, gsiAmbiguityRule, hasMany, hasOne, hydrate, isEdgeWritesDefinition, isSelectBuilder, isTransactionRef, list, literal, map, missingGsiRule, model, noScanRule, number, numberSet, plan, queryBoundaryRule, relationDepthRule, requireLimitRule, resolveKey, resolveRelations, serializeContractKey, serializeFieldValue, string, stringSet, validateDepth, validateGsiAmbiguity, when };
|
|
2293
|
+
export { type AnyModelContract, AnyOperationDefinition, BATCH_GET_MAX_KEYS, BATCH_WRITE_MAX_ITEMS, BatchExecOptions, BatchGetExecInput, BatchWriteExecItem, BridgeBundle, type BuiltContracts, CdcEmulator, CdcEmulatorOptions, ChangeEvent, ChangeHandler, ClientManager, type CollectParams, CommandMethodSpec, CommandModelContract, CommandSpec, ConcurrentRecomputeRef, type ConditionExpressionResult, ConditionInput, ConditionSpec, type ContextOwnership, type ContextOwnershipMap, ContextSpec, type ContractBoundaryViolation, type ContractInputs, type ContractMap, type ContractN1Violation, ContractSpec, CtxModel, DDBModel, DefinitionMap, DeleteInput, DynamoDBOperation, DynamoExecutor, type DynamoType, EDGE_WRITES_MARKER, type EdgeLifecycle, type EdgeWriteDeclaration, type EdgeWriteRecorder, type EdgeWritesDefinition, type EmbeddedMetadata, type EntityMetadata, EntityRef, EventLog, ExecutionPlan, Executor, ExecutorResult, type ExplainInput, FaultSpec, type FieldMetadata, type FieldOptions, type FilterExpressionResult, type GsiDefinition, Item, type KeyDefinition, type LintResult, type LintRule, Linter, type ListInput, type ListOptions, MAX_TRANSACT_ITEMS, Manifest, MetadataRegistry, Middleware, type ModelOptions, ModelStatic, OLD_VALUE_NAMESPACE, OperationDefinition, OperationsDocument, Param, ParamDescriptor, type Parameterize, PartialQueryKeyOf, type PerKeyCursorEnvelope, type PlanInput, PrimaryKeyOf, type ProjectionResult, PutInput, QueryMethodSpec, QueryModelContract, type QueryOptions$1 as QueryOptions, QuerySpec, RawCondition, ReadExecOptions, ReadParams, ReadRequestCtx, ReadRequestKind, type RelationLimitOptions, type RelationMetadata, type RelationOptions, type RelationTraversalOptions, ReplayOptions, RequestContext, ResolvedKey, RetryOverride, RetryPolicy, RetryingExecutor, SegmentedKey, SelectableOf, ShardId, TableMapping, TransactWriteExecItem, type TransactionDefinition, TransactionItemSpec, type TransactionParamShape, type TransactionRef, TransactionSpec, type TxConditionCheckOptions, type TxForEachInstruction, type TxForEachOptions, type TxInstruction, type TxRecorder, type TxWriteInstruction, type TxWriteOptions, UniqueQueryKeyOf, type UpdateExpressionResult, UpdateInput, type WhenComparison, WriteDefinitionOptions, WriteExecOptions, WriteResult, assertBundleSerializable, assertContractBoundaries, assertContractN1Safe, assertJsonSerializable, assertSupportedCondition, belongsTo, binary, boolean, buildBridgeBundle, buildConditionExpression, buildContexts, buildContracts, buildManifest, buildOperations, buildProjection, buildQuerySpec, buildTransactionSpec, buildTransactions, buildUpdateExpression, collectContractBoundaryViolations, collectContractN1Violations, compileFilterExpression, createCdcEmulator, createDefaultLinter, datetime, decodeCursor, decodePerKeyCursor, defineCommands, defineDelete, defineList, definePut, defineQueries, defineQuery, defineTransaction, defineTransactions, defineUpdate, deriveEdgeWriteItems, deriveEdgeWriteItemsFor, deriveModelEdgeWriteItems, derivePrefix, detectRelationFields, edgeWrites, embedded, encodeCursor, encodePerKeyCursor, evaluateFilter, execute, executeDeclarativeTransaction, executeExplain, executeList, executeQuery, expandTransaction, field, getEdgeWrites, getImplicitKeyFields, gsiAmbiguityRule, hasMany, hasOne, hydrate, isEdgeWritesDefinition, isSelectBuilder, isTransactionRef, list, literal, map, missingGsiRule, model, noScanRule, number, numberSet, plan, queryBoundaryRule, relationDepthRule, requireLimitRule, resolveKey, resolveRelations, serializeContractKey, serializeFieldValue, string, stringSet, validateDepth, validateGsiAmbiguity, when };
|
package/dist/index.js
CHANGED
|
@@ -86,19 +86,22 @@ import {
|
|
|
86
86
|
validateDepth,
|
|
87
87
|
when,
|
|
88
88
|
wholeKeysSentinel
|
|
89
|
-
} from "./chunk-
|
|
89
|
+
} from "./chunk-SGYBE2OV.js";
|
|
90
90
|
import {
|
|
91
91
|
CdcEmulator,
|
|
92
92
|
createCdcEmulator
|
|
93
|
-
} from "./chunk-
|
|
93
|
+
} from "./chunk-ITHQ2EDH.js";
|
|
94
94
|
import {
|
|
95
95
|
BATCH_GET_MAX_KEYS,
|
|
96
96
|
BATCH_WRITE_MAX_ITEMS,
|
|
97
97
|
ClientManager,
|
|
98
|
+
DEFAULT_MAX_ATTEMPTS,
|
|
99
|
+
DEFAULT_RETRY_POLICY,
|
|
98
100
|
DynamoExecutor,
|
|
99
101
|
Linter,
|
|
100
102
|
MAX_TRANSACT_ITEMS,
|
|
101
103
|
MetadataRegistry,
|
|
104
|
+
RetryingExecutor,
|
|
102
105
|
TableMapping,
|
|
103
106
|
TransactionContext,
|
|
104
107
|
attachModelClass,
|
|
@@ -123,6 +126,8 @@ import {
|
|
|
123
126
|
isKeySegment,
|
|
124
127
|
isParam,
|
|
125
128
|
isRawCondition,
|
|
129
|
+
isRetryableError,
|
|
130
|
+
isRetryableTransactionCancellation,
|
|
126
131
|
k,
|
|
127
132
|
key,
|
|
128
133
|
missingGsiRule,
|
|
@@ -134,7 +139,7 @@ import {
|
|
|
134
139
|
resolveKey,
|
|
135
140
|
resolveModelClass,
|
|
136
141
|
serializeFieldValue
|
|
137
|
-
} from "./chunk-
|
|
142
|
+
} from "./chunk-4TYK3AV6.js";
|
|
138
143
|
|
|
139
144
|
// src/metadata/prefix.ts
|
|
140
145
|
function derivePrefix(customPrefix, className) {
|
|
@@ -1044,6 +1049,8 @@ export {
|
|
|
1044
1049
|
CdcEmulator,
|
|
1045
1050
|
ClientManager,
|
|
1046
1051
|
DDBModel,
|
|
1052
|
+
DEFAULT_MAX_ATTEMPTS,
|
|
1053
|
+
DEFAULT_RETRY_POLICY,
|
|
1047
1054
|
DynamoExecutor,
|
|
1048
1055
|
EDGE_WRITES_MARKER,
|
|
1049
1056
|
ENTITY_WRITES_MARKER,
|
|
@@ -1052,6 +1059,7 @@ export {
|
|
|
1052
1059
|
MAX_TRANSACT_ITEMS,
|
|
1053
1060
|
MetadataRegistry,
|
|
1054
1061
|
OLD_VALUE_NAMESPACE,
|
|
1062
|
+
RetryingExecutor,
|
|
1055
1063
|
SPEC_VERSION,
|
|
1056
1064
|
TableMapping,
|
|
1057
1065
|
TransactionContext,
|
|
@@ -1155,6 +1163,8 @@ export {
|
|
|
1155
1163
|
isParam,
|
|
1156
1164
|
isPlannedCommandMethod,
|
|
1157
1165
|
isQueryModelContract,
|
|
1166
|
+
isRetryableError,
|
|
1167
|
+
isRetryableTransactionCancellation,
|
|
1158
1168
|
isSelectBuilder,
|
|
1159
1169
|
isTransactionRef,
|
|
1160
1170
|
k,
|
package/dist/testing/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as Executor, D as DynamoDBOperation, a as ExecutorResult, B as BatchGetExecInput, P as PutInput, W as WriteExecOptions, b as WriteResult, U as UpdateInput, c as DeleteInput, d as BatchWriteExecItem, T as TransactWriteExecItem, M as ModelStatic,
|
|
1
|
+
import { E as Executor, D as DynamoDBOperation, R as ReadExecOptions, a as ExecutorResult, B as BatchGetExecInput, P as PutInput, W as WriteExecOptions, b as WriteResult, U as UpdateInput, c as DeleteInput, d as BatchWriteExecItem, e as BatchExecOptions, T as TransactWriteExecItem, M as ModelStatic, f as DDBModel, C as ChangeEvent } from '../types--tdHK3vi.js';
|
|
2
2
|
import '@aws-sdk/client-dynamodb';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -71,15 +71,15 @@ declare class MemoryStore {
|
|
|
71
71
|
declare class MemoryExecutor implements Executor {
|
|
72
72
|
private readonly store;
|
|
73
73
|
constructor(store: MemoryStore);
|
|
74
|
-
execute(operation: DynamoDBOperation): Promise<ExecutorResult>;
|
|
75
|
-
batchGet(input: BatchGetExecInput): Promise<ExecutorResult>;
|
|
74
|
+
execute(operation: DynamoDBOperation, _options?: ReadExecOptions): Promise<ExecutorResult>;
|
|
75
|
+
batchGet(input: BatchGetExecInput, _options?: ReadExecOptions): Promise<ExecutorResult>;
|
|
76
76
|
private getItem;
|
|
77
77
|
private query;
|
|
78
78
|
put(input: PutInput, options?: WriteExecOptions): Promise<WriteResult>;
|
|
79
79
|
update(input: UpdateInput, options?: WriteExecOptions): Promise<WriteResult>;
|
|
80
80
|
delete(input: DeleteInput, options?: WriteExecOptions): Promise<WriteResult>;
|
|
81
|
-
batchWrite(tableName: string, items: BatchWriteExecItem[]): Promise<void>;
|
|
82
|
-
transactWrite(items: TransactWriteExecItem[]): Promise<void>;
|
|
81
|
+
batchWrite(tableName: string, items: BatchWriteExecItem[], _options?: BatchExecOptions): Promise<void>;
|
|
82
|
+
transactWrite(items: TransactWriteExecItem[], _options?: BatchExecOptions): Promise<void>;
|
|
83
83
|
private restoreTable;
|
|
84
84
|
/**
|
|
85
85
|
* Evaluate a transaction `ConditionCheck` (issue #81): read the keyed item and
|
package/dist/testing/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCdcEmulator
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-ITHQ2EDH.js";
|
|
4
4
|
import {
|
|
5
5
|
ClientManager,
|
|
6
6
|
MetadataRegistry,
|
|
7
7
|
TableMapping,
|
|
8
8
|
resolveModelClass
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-4TYK3AV6.js";
|
|
10
10
|
|
|
11
11
|
// src/memory/memory-store.ts
|
|
12
12
|
function deepClone(value) {
|
|
@@ -543,7 +543,10 @@ var MemoryExecutor = class {
|
|
|
543
543
|
}
|
|
544
544
|
store;
|
|
545
545
|
// ── reads ────────────────────────────────────────────────────────────────
|
|
546
|
-
|
|
546
|
+
// The optional per-call options (`ReadExecOptions` / `BatchExecOptions`) carry a
|
|
547
|
+
// retry override (issue #111) that only `RetryingExecutor` acts on; the in-memory
|
|
548
|
+
// adapter never throttles, so it accepts and ignores them.
|
|
549
|
+
async execute(operation, _options) {
|
|
547
550
|
if (operation.type === "GetItem") {
|
|
548
551
|
return this.getItem(operation);
|
|
549
552
|
}
|
|
@@ -552,7 +555,7 @@ var MemoryExecutor = class {
|
|
|
552
555
|
}
|
|
553
556
|
return this.query(operation);
|
|
554
557
|
}
|
|
555
|
-
async batchGet(input) {
|
|
558
|
+
async batchGet(input, _options) {
|
|
556
559
|
const items = [];
|
|
557
560
|
for (const key of input.keys) {
|
|
558
561
|
const found = this.store.getItem(
|
|
@@ -673,7 +676,7 @@ var MemoryExecutor = class {
|
|
|
673
676
|
this.store.deleteItem(input.TableName, pk, sk);
|
|
674
677
|
return options?.returnOldImage && prior ? { oldItem: prior } : {};
|
|
675
678
|
}
|
|
676
|
-
async batchWrite(tableName, items) {
|
|
679
|
+
async batchWrite(tableName, items, _options) {
|
|
677
680
|
for (const item of items) {
|
|
678
681
|
if (item.type === "put") {
|
|
679
682
|
this.store.putItem(tableName, item.item);
|
|
@@ -686,7 +689,7 @@ var MemoryExecutor = class {
|
|
|
686
689
|
}
|
|
687
690
|
}
|
|
688
691
|
}
|
|
689
|
-
async transactWrite(items) {
|
|
692
|
+
async transactWrite(items, _options) {
|
|
690
693
|
if (items.length === 0) return;
|
|
691
694
|
const touchedTables = /* @__PURE__ */ new Set();
|
|
692
695
|
for (const it of items) {
|