graphddb 0.5.2 → 0.5.3
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 +8 -0
- package/dist/cdc/index.d.ts +37 -0
- package/dist/cdc/index.js +29 -0
- package/dist/{chunk-W3GEJPPV.js → chunk-CCIVET5K.js} +66 -1024
- package/dist/{chunk-QBXLQNXY.js → chunk-M6URQOAW.js} +4 -1
- package/dist/chunk-MMVHOUM4.js +24 -0
- package/dist/chunk-PDUVTYC5.js +992 -0
- package/dist/{chunk-H5TUW2WR.js → chunk-Y7XV5QL2.js} +3556 -3547
- package/dist/cli.js +917 -19
- package/dist/from-change-DQK2Jm9R.d.ts +327 -0
- package/dist/index-CtDBo8Se.d.ts +690 -0
- package/dist/index.d.ts +7 -1112
- package/dist/index.js +22 -39
- package/dist/linter/index.d.ts +126 -0
- package/dist/linter/index.js +36 -0
- package/dist/{types-m1Ect6hG.d.ts → maintenance-view-adapter-D5t9taTE.d.ts} +234 -182
- package/dist/registry-BD_5Rm5C.d.ts +76 -0
- package/dist/relation-depth-DLkhG0xX.d.ts +36 -0
- package/dist/spec/index.d.ts +4 -0
- package/dist/spec/index.js +54 -0
- package/dist/testing/index.d.ts +1 -1
- package/dist/testing/index.js +5 -4
- package/docs/doc-sample.md +263 -0
- package/docs/docs-generation.md +183 -0
- package/package.json +46 -3
- package/dist/chunk-MCKGQKYU.js +0 -15
- package/dist/typescript-ZUQEBJRV.js +0 -210764
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export { a as LintResult, L as LintRule, b as Linter, M as MetadataRegistry } from './registry-BD_5Rm5C.js';
|
|
2
|
+
import { aN as SelectableOf, aO as PrimaryKeyOf, aP as RequestContext, aQ as Middleware, aR as ReadRequestKind, aS as CtxModel, aT as ReadParams, aU as ReadRequestCtx, D as DynamoDBOperation, aV as Item, n as Executor, aW as RetryPolicy, am as ExecutionPlanSpec, aX as KeyDefinition, aY as GsiDefinition, aZ as ModelKind, a_ as FieldOptions, a$ as DynamoType, b0 as ProjectionTransform, b1 as MaintainEvent, b2 as MembershipPredicate, b3 as MaintainConsistency, b4 as MaintainUpdateMode, b5 as MembershipPredicateOp, b6 as RelationOptions, b7 as AggregateOptions, b8 as AggregateValue, b9 as SelectBuilderSpec, ba as RawCondition, m as EntityMetadata, N as TransactionSpec, _ as Manifest, bb as RetryOverride, bc as ExecutionPlan, bd as FieldMetadata, be 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, bf as RelationMetadata, aC as TransactionItemSpec, bg as MaintainEffect, M as ModelStatic, w as DDBModel, V as ViewDefinition, A as Param, x as ParamDescriptor, X as DefinitionMap, bh as OperationDefinition, bi as WriteDefinitionOptions, bj as PartialQueryKeyOf, bk as StrictSelectSpec, bl as ReadDefinitionOptions, bm as EntityInput, bn as UniqueQueryKeyOf } from './maintenance-view-adapter-D5t9taTE.js';
|
|
3
|
+
export { bo as AggregateMetadata, Z as AnyOperationDefinition, bp as BatchDeleteRequest, bq as BatchGetOptions, br as BatchGetRequest, bs as BatchGetResult, bt as BatchPutRequest, B as BatchResult, bu as BatchWriteRequest, $ as BridgeBundle, bv as CONTRACT_RANGE_FANOUT_CONCURRENCY, C as CdcEmulatorOptions, a as CdcMode, bw as CdcModelRegistry, bx as CdcSubscribeHandlers, by as Change, b as ChangeBatch, c as ChangeEvent, d as ChangeEventName, e as ChangeHandler, f as ClockMode, bz as CollectionEffect, bA as CollectionOptions, bB as Column, bC as ColumnMap, a1 as CommandContractMethodSpec, bD as CommandInputShape, bE as CommandMethod, I as CommandMethodSpec, H as CommandModelContract, bF as CommandPlan, a2 as CommandResolutionTarget, bG as CommandResultKind, bH as CommandSelectShape, L as CommandSpec, a3 as CompiledFragment, a5 as ComposeSpec, g as ConcurrentRecomputeRef, bI as CondSlot, bJ as ConditionCheckInput, z as ConditionInput, a0 as ConditionSpec, bK as Connection, O as ContextSpec, bL as ContractCallSignature, a7 as ContractCardinality, bM as ContractCommandParams, a8 as ContractCommandResult, bN as ContractComposeNode, bO as ContractFromRef, a9 as ContractInputArity, bP as ContractItem, bQ as ContractKeyFieldRef, bR as ContractKeyInput, bS as ContractKeyRef, aa as ContractKeySpec, ab as ContractKind, bT as ContractMethodOp, bU as ContractParamRef, bV as ContractQueryParams, ac as ContractResolution, J as ContractSpec, bW as CounterAggregate, bX as CounterEffect, bY as CtxBase, bZ as DEFAULT_MAX_ATTEMPTS, b_ as DEFAULT_RETRY_POLICY, b$ as DeleteOptions, c0 as DeriveEffect, ae as DerivedEdgeWrite, ak as DerivedUpdate, c1 as DescriptorBinding, c2 as ENTITY_WRITES_MARKER, c3 as EdgeEffect, c4 as EffectPath, c5 as EmbeddedMetadata, c6 as EmitEffect, y as EntityRef, c7 as EntityWritesDefinition, c8 as EntityWritesShape, E as EventLog, c9 as ExecutableCommandContract, ca as ExecutableQueryContract, F as FaultSpec, cb as FilterInput, an as FilterSpec, cc as FragmentInput, cd as GsiDefinitionMarker, ce as GsiOptions, cf as IdempotencyEffect, cg as InProcessWriteDescriptor, ch as InputArity, ci as KeyDefinitionMarker, cj as KeySegment, ck as KeySlot, cl as KeyStructure, cm as KeyedResult, cn as LIFECYCLE_CONTRACT_MARKER, co as LifecycleContract, cp as LifecycleEffects, cq as LiteralParam, cr as MaintainItem, cs as MaintainTrigger, ct as MaintenanceGraph, ap as ManifestEntity, aq as ManifestField, ar as ManifestFieldType, as as ManifestGsi, at as ManifestKey, au as ManifestRelation, av as ManifestTable, cu as MembershipEffect, cv as ModelRef, cw as MutateMode, cx as MutateOptions, cy as MutateParallelResult, cz as MutateTransactionResult, cA as MutationBody, cB as MutationDescriptorMap, cC as MutationFragment, cD as MutationInputProxy, cE as MutationInputRef, cF as MutationIntent, cG as NumberParam, cH as OperationKind, aw as OperationSpec, Y as OperationsDocument, cI as ParallelOpResult, cJ as ParamKind, ax as ParamSpec, cK as ParamStructure, cL as PersistCtx, cM as PersistOrigin, cN as PlannedCommandMethod, cO as ProjectionMap, cP as ProjectionTransformOp, cQ as PutOptions, ay as QueryContractMethodSpec, cR as QueryEnvelopeResult, cS as QueryKeyOf, cT as QueryMethod, G as QueryMethodSpec, Q as QueryModelContract, cU as QueryResult, K as QuerySpec, az as RangeConditionSpec, cV as ReadEnvelope, cW as ReadOpCtx, cX as ReadOpKind, aA as ReadOperationType, cY as ReadRouteDescriptor, cZ as ReadRouteOptions, c_ as ReadRouteResult, c$ as RecordedCompose, d0 as RelationBuilder, d1 as RelationConsistency, d2 as RelationLimitOptions, d3 as RelationPattern, d4 as RelationProjection, d5 as RelationReadOptions, d6 as RelationSelect, d7 as RelationSpec, d8 as RelationUpdateMode, d9 as RelationWriteOptions, R as ReplayOptions, da as RequiresEffect, db as Resolution, dc as RetryInfo, dd as RetryOperationKind, aB as SPEC_VERSION, de as SegmentSpec, df as SegmentedKey, dg as SelectBuilder, dh as SelectOf, S as ShardId, di as SnapshotEffect, h as StartingPosition, i as StreamViewType, dj as StringParam, j as SubscribeHandler, k as SubscribeHandlers, dk as TransactionContext, aD as TransactionItemType, dl as UniqueEffect, dm as Updatable, dn as UpdateOptions, dp as ViewSourceSlice, aE as WhenSpec, dq as WriteCtx, dr as WriteDescriptor, ds as WriteEnvelope, dt as WriteInput, du as WriteKind, dv as WriteLifecyclePhase, dw as WriteMiddleware, aF as WriteOperationType, dx as WriteRecorder, dy as WriteResultProjection, dz as attachModelClass, dA as buildDeleteInput, dB as buildMaintenanceGraph, dC as buildPutInput, l as buildSubscribeHandler, dD as buildUpdateInput, dE as collectViewDefinitions, aH as compileFragment, aI as compileMutationPlan, aJ as compileSingleFragmentPlan, dF as cond, dG as contractOfMethodSpec, dH as definePlan, dI as entityWrites, dJ as executeBatchGet, dK as executeBatchWrite, dL as executeCommandMethod, dM as executeDelete, dN as executeKeyedBatchGet, dO as executePut, dP as executeQueryMethod, dQ as executeRangeFanout, dR as executeTransaction, dS as executeUpdate, dT as from, dU as getEntityWrites, dV as gsi, dW as identity, dX as isColumn, dY as isCommandModelContract, dZ as isCommandPlan, d_ as isContractComposeNode, d$ as isContractFromRef, e0 as isContractKeyFieldRef, e1 as isContractKeyRef, e2 as isContractParamRef, e3 as isEntityWritesDefinition, e4 as isKeySegment, e5 as isLifecycleContract, e6 as isMaintainTrigger, e7 as isMutationFragment, e8 as isMutationInputRef, e9 as isParam, ea as isPlannedCommandMethod, eb as isQueryModelContract, ec as isRetryableError, ed as isRetryableTransactionCancellation, ee as k, ef as key, eg as lifecyclePhaseForIntent, eh as maintainTrigger, ei as mintContractKeyFieldRef, ej as mintContractParamRef, ek as mutation, el as param, em as preview, en as publicCommandModel, eo as publicQueryModel, ep as query, aL as resolveLifecycle, eq as wholeKeysSentinel } from './maintenance-view-adapter-D5t9taTE.js';
|
|
3
4
|
import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
|
|
4
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-DQK2Jm9R.js';
|
|
7
|
+
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-DLkhG0xX.js';
|
|
8
|
+
export { A as AnyModelContract, B as BuiltContracts, C as ContextOwnership, a as ContextOwnershipMap, b as ContractBoundaryViolation, c as ContractInputs, d as ContractMap, e as ContractN1Violation, T as TransactionDefinition, f as TransactionParamShape, g as TransactionRef, h as TxConditionCheckOptions, i as TxForEachInstruction, j as TxForEachOptions, k as TxInstruction, l as TxRecorder, m as TxWriteInstruction, n as TxWriteOptions, W as WhenComparison, o as assertBundleSerializable, p as assertContractBoundaries, q as assertContractN1Safe, r as assertJsonSerializable, s as assertSupportedCondition, t as buildBridgeBundle, u as buildContexts, v as buildContracts, w as buildManifest, x as buildOperations, y as buildQuerySpec, z as buildTransactionSpec, D as buildTransactions, E as collectContractBoundaryViolations, F as collectContractN1Violations, G as defineTransaction, H as defineTransactions, I as isTransactionRef, J as when } from './index-CtDBo8Se.js';
|
|
5
9
|
|
|
6
10
|
/**
|
|
7
11
|
* Query options with conditional `consistentRead` availability.
|
|
@@ -313,72 +317,6 @@ interface RelationExecutionPlan {
|
|
|
313
317
|
readonly resultPaths: readonly string[];
|
|
314
318
|
}
|
|
315
319
|
|
|
316
|
-
interface LintRule {
|
|
317
|
-
id: string;
|
|
318
|
-
severity: 'error' | 'warning';
|
|
319
|
-
check(metadata: EntityMetadata, registry: typeof MetadataRegistry): LintResult[];
|
|
320
|
-
}
|
|
321
|
-
interface LintResult {
|
|
322
|
-
ruleId: string;
|
|
323
|
-
severity: 'error' | 'warning';
|
|
324
|
-
message: string;
|
|
325
|
-
entity: string;
|
|
326
|
-
field?: string;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
declare class Linter {
|
|
330
|
-
private rules;
|
|
331
|
-
addRule(rule: LintRule): void;
|
|
332
|
-
run(metadata: EntityMetadata, registry: typeof MetadataRegistry): LintResult[];
|
|
333
|
-
runAll(registry: typeof MetadataRegistry): LintResult[];
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
declare class MetadataRegistry {
|
|
337
|
-
private static store;
|
|
338
|
-
private static _linter;
|
|
339
|
-
/**
|
|
340
|
-
* A monotonically-increasing counter bumped on every change to the set of
|
|
341
|
-
* registered models ({@link register} / {@link clear}). It lets a consumer that
|
|
342
|
-
* caches a structure derived from the whole registry (e.g. the maintenance graph
|
|
343
|
-
* in `src/spec/mutation-command.ts`) detect that the registry has changed since
|
|
344
|
-
* the cache was built and rebuild — closing the silent-drop window where a model
|
|
345
|
-
* registered after a cache build would be invisible to it. Only the membership
|
|
346
|
-
* of {@link store} changes here; per-model lazy finalize ({@link finalize}) does
|
|
347
|
-
* not bump it (it adds no relations/triggers, so it cannot change the graph).
|
|
348
|
-
*/
|
|
349
|
-
private static _generation;
|
|
350
|
-
/**
|
|
351
|
-
* The current registry generation (see {@link _generation}). A consumer caches
|
|
352
|
-
* the value it built against and rebuilds when it no longer matches.
|
|
353
|
-
*/
|
|
354
|
-
static get generation(): number;
|
|
355
|
-
static register(target: Function, metadata: EntityMetadata): void;
|
|
356
|
-
static get(target: Function): EntityMetadata;
|
|
357
|
-
static has(target: Function): boolean;
|
|
358
|
-
static getAll(): Map<Function, EntityMetadata>;
|
|
359
|
-
/**
|
|
360
|
-
* Snapshot of the entities that are **already finalized**, WITHOUT triggering
|
|
361
|
-
* finalize on any pending entity (unlike {@link getAll}). This is the safe view
|
|
362
|
-
* for a cross-entity lint rule that runs *inside* `finalize`: eagerly
|
|
363
|
-
* finalizing the rest of the registry from within a finalize pass would
|
|
364
|
-
* re-enter (and duplicate) the in-progress entity's finalize. A whole-registry
|
|
365
|
-
* rule instead reasons over the already-finalized peers plus the entity
|
|
366
|
-
* currently being checked; any conflicting pair is caught when the later of the
|
|
367
|
-
* two finalizes (both are present by then).
|
|
368
|
-
*
|
|
369
|
-
* @internal — for cross-entity linter rules.
|
|
370
|
-
*/
|
|
371
|
-
static getFinalized(): Map<Function, EntityMetadata>;
|
|
372
|
-
static get linter(): Linter;
|
|
373
|
-
static set linter(linter: Linter);
|
|
374
|
-
/** Resets linter to the default built-in rule set. */
|
|
375
|
-
static resetLinter(): void;
|
|
376
|
-
/** @internal — for testing only */
|
|
377
|
-
static clear(): void;
|
|
378
|
-
private static finalize;
|
|
379
|
-
private static handleLintResults;
|
|
380
|
-
}
|
|
381
|
-
|
|
382
320
|
declare function derivePrefix(customPrefix: string | undefined, className: string | undefined): string;
|
|
383
321
|
|
|
384
322
|
/**
|
|
@@ -1342,330 +1280,6 @@ declare function encodeCursor(lastEvaluatedKey: Record<string, unknown>): string
|
|
|
1342
1280
|
*/
|
|
1343
1281
|
declare function decodeCursor(cursor: string): Record<string, unknown>;
|
|
1344
1282
|
|
|
1345
|
-
/**
|
|
1346
|
-
* CDC emulator (issue #72). Subscribes to the core write-capture seam
|
|
1347
|
-
* ({@link ChangeCaptureRegistry}) and turns each {@link RawWriteRecord} into a
|
|
1348
|
-
* DynamoDB-Streams-equivalent {@link ChangeEvent}, then delivers events to a
|
|
1349
|
-
* consumer under a deterministic delivery contract (spec §6): per-shard ordered,
|
|
1350
|
-
* batched, at-least-once, with checkpoint/resume, partial-batch failure, and a
|
|
1351
|
-
* dead-letter queue. Faults (duplicate / reorder / delay / dropThenRedeliver /
|
|
1352
|
-
* partialBatchFailure) and a concurrent-recompute race are injectable and
|
|
1353
|
-
* seeded for deterministic reproduction (spec §8).
|
|
1354
|
-
*
|
|
1355
|
-
* The emulator is dev/test only. The {@link ChangeEvent} type and delivery
|
|
1356
|
-
* contract match real Streams so a consumer is portable to production (spec §1).
|
|
1357
|
-
*/
|
|
1358
|
-
|
|
1359
|
-
/**
|
|
1360
|
-
* The CDC emulator (spec §10 API). Construct via {@link createCdcEmulator}.
|
|
1361
|
-
*/
|
|
1362
|
-
declare class CdcEmulator {
|
|
1363
|
-
private readonly mode;
|
|
1364
|
-
private readonly clockMode;
|
|
1365
|
-
private readonly batchSize;
|
|
1366
|
-
private readonly maxRetries;
|
|
1367
|
-
private readonly startingPosition;
|
|
1368
|
-
private readonly shardCount;
|
|
1369
|
-
private readonly seed;
|
|
1370
|
-
private rng;
|
|
1371
|
-
private faultSpec;
|
|
1372
|
-
private concurrentRecompute;
|
|
1373
|
-
private concurrentRecomputeHook;
|
|
1374
|
-
/** Per-shard monotonic sequence counter. */
|
|
1375
|
-
private seqCounters;
|
|
1376
|
-
/** Per-shard delivery queue (queued/replay modes). */
|
|
1377
|
-
private queues;
|
|
1378
|
-
/** Per-shard last successfully checkpointed sequence number. */
|
|
1379
|
-
private checkpointMap;
|
|
1380
|
-
/**
|
|
1381
|
-
* Per-shard set of acked sequence numbers (as ints) not yet folded into the
|
|
1382
|
-
* checkpoint. The checkpoint advances over the contiguous prefix of acked
|
|
1383
|
-
* sequences (ReportBatchItemFailures semantics): a sequence is checkpointed
|
|
1384
|
-
* only once every sequence at or before it has been acked.
|
|
1385
|
-
*/
|
|
1386
|
-
private ackedSeqs;
|
|
1387
|
-
/** Per-shard count of sequences ever assigned, to bound the prefix scan. */
|
|
1388
|
-
private maxSeqSeen;
|
|
1389
|
-
/** Recorded event log (record mode and always, for replay()). */
|
|
1390
|
-
private log;
|
|
1391
|
-
/** Dead-letter buffer. */
|
|
1392
|
-
private dlq;
|
|
1393
|
-
private handler;
|
|
1394
|
-
/** Virtual clock (ms since EPOCH). */
|
|
1395
|
-
private clockMs;
|
|
1396
|
-
/** Pending async work from inline-mode captures, awaited by callers. */
|
|
1397
|
-
private inflight;
|
|
1398
|
-
private detachCapture;
|
|
1399
|
-
private readonly models;
|
|
1400
|
-
constructor(opts?: CdcEmulatorOptions);
|
|
1401
|
-
private onRawWrite;
|
|
1402
|
-
private toChangeEvent;
|
|
1403
|
-
/** Parse a zero-padded sequence string back to its integer value. */
|
|
1404
|
-
private seqToInt;
|
|
1405
|
-
/** Render an integer sequence as the zero-padded string form. */
|
|
1406
|
-
private intToSeq;
|
|
1407
|
-
/**
|
|
1408
|
-
* Advance a shard's checkpoint over the contiguous prefix of acked sequence
|
|
1409
|
-
* numbers. Starting just past the current checkpoint, consume every
|
|
1410
|
-
* consecutive acked sequence; stop at the first gap (an un-acked sequence
|
|
1411
|
-
* still pending redelivery). Consumed sequences are removed from the acked
|
|
1412
|
-
* set to bound its size.
|
|
1413
|
-
*/
|
|
1414
|
-
private advanceCheckpoint;
|
|
1415
|
-
private deriveEventName;
|
|
1416
|
-
private nowIso;
|
|
1417
|
-
private enqueue;
|
|
1418
|
-
/**
|
|
1419
|
-
* Deliver buffered, due records to the consumer, advancing per-shard
|
|
1420
|
-
* checkpoints on success and redelivering failures. In `queued`/`replay`
|
|
1421
|
-
* modes call this (or {@link advanceClock}) to drive delivery; `inline` calls
|
|
1422
|
-
* it automatically after each capture.
|
|
1423
|
-
*/
|
|
1424
|
-
pump(maxBatches?: number): Promise<void>;
|
|
1425
|
-
/**
|
|
1426
|
-
* Pull up to `batchSize` due records from a shard, preserving ascending
|
|
1427
|
-
* sequence order (spec §6). When the `reorder` fault is on, the within-shard
|
|
1428
|
-
* order is deliberately shuffled to exercise invariant detection.
|
|
1429
|
-
*/
|
|
1430
|
-
private collectBatch;
|
|
1431
|
-
private deliverBatch;
|
|
1432
|
-
/** Register the consumer. Returns an unsubscribe handle. */
|
|
1433
|
-
subscribe(handler: ChangeHandler): Unsubscribe;
|
|
1434
|
-
/** Await any inline-mode async deliveries triggered by writes. */
|
|
1435
|
-
flush(): Promise<void>;
|
|
1436
|
-
/**
|
|
1437
|
-
* Advance the virtual clock by `ms` and deliver records whose due-time has
|
|
1438
|
-
* arrived (spec §7). Reproduces throttle T / sweep period / staleness S time
|
|
1439
|
-
* behavior deterministically (AC4).
|
|
1440
|
-
*/
|
|
1441
|
-
advanceClock(ms: number): Promise<void>;
|
|
1442
|
-
/** Current virtual time (ms since the emulator epoch). */
|
|
1443
|
-
now(): number;
|
|
1444
|
-
/** Configure fault injection (spec §8). Merges into the current spec. */
|
|
1445
|
-
fault(spec: FaultSpec): void;
|
|
1446
|
-
/**
|
|
1447
|
-
* Force a recompute to race a mark for the given ref (spec §8, §7). The
|
|
1448
|
-
* harness supplies the actual recompute via {@link onConcurrentRecompute};
|
|
1449
|
-
* this records which ref to race and arms the hook.
|
|
1450
|
-
*/
|
|
1451
|
-
injectConcurrentRecompute(ref: ConcurrentRecomputeRef): void;
|
|
1452
|
-
/**
|
|
1453
|
-
* Register the callback the emulator invokes (before each record reaches the
|
|
1454
|
-
* consumer) when a concurrent recompute has been injected. This is how the
|
|
1455
|
-
* test harness wires its recompute into the delivery race.
|
|
1456
|
-
*/
|
|
1457
|
-
onConcurrentRecompute(hook: (ref: ConcurrentRecomputeRef, event: ChangeEvent) => void | Promise<void>): void;
|
|
1458
|
-
/** Snapshot the recorded event log (spec §10). */
|
|
1459
|
-
record(): EventLog;
|
|
1460
|
-
/**
|
|
1461
|
-
* Replay an event log through the delivery pipeline, optionally shuffled and
|
|
1462
|
-
* duplicated (spec §10, AC5). Used to prove **replay equivalence**: starting
|
|
1463
|
-
* from any global order plus duplicates, a consumer that respects the
|
|
1464
|
-
* per-shard ordering contract (spec §6) reaches a final aggregate equal to a
|
|
1465
|
-
* full recompute from source.
|
|
1466
|
-
*
|
|
1467
|
-
* The shuffle models cross-shard reordering and at-least-once chaos at the
|
|
1468
|
-
* delivery boundary. It must NOT, however, break the within-shard ordering
|
|
1469
|
-
* guarantee that real DynamoDB Streams provides and that incremental
|
|
1470
|
-
* aggregation depends on — so after shuffling/duplicating, each shard's queue
|
|
1471
|
-
* is re-sorted into ascending original `sequenceNumber` order before delivery.
|
|
1472
|
-
* The original `sequenceNumber` (assigned at record time) is preserved so it
|
|
1473
|
-
* remains the source-of-truth ordering the consumer can rely on.
|
|
1474
|
-
*/
|
|
1475
|
-
replay(log: EventLog, opts?: ReplayOptions): Promise<void>;
|
|
1476
|
-
/** Per-shard checkpoints (last acked sequence number). */
|
|
1477
|
-
checkpoints(): Record<ShardId, string>;
|
|
1478
|
-
/** Dead-lettered events (exceeded maxRetries). */
|
|
1479
|
-
deadLetters(): ChangeEvent[];
|
|
1480
|
-
/** Reset delivery state and re-seed (keeps the subscription + model opt-in). */
|
|
1481
|
-
reset(): void;
|
|
1482
|
-
/** Tear down: detach from the core seam and disable model streaming. */
|
|
1483
|
-
close(): void;
|
|
1484
|
-
}
|
|
1485
|
-
/** Create a CDC emulator (spec §10). */
|
|
1486
|
-
declare function createCdcEmulator(opts?: CdcEmulatorOptions): CdcEmulator;
|
|
1487
|
-
|
|
1488
|
-
/**
|
|
1489
|
-
* CDC **maintenance drain** (issue #130) — the asynchronous lower for
|
|
1490
|
-
* `updateMode: 'stream'` maintainers (Epic #118 §5.1).
|
|
1491
|
-
*
|
|
1492
|
-
* A synchronous (`updateMode: 'mutation'`) maintainer composes its owner-row write
|
|
1493
|
-
* into the SAME atomic `TransactWriteItems` as the source write (#127). A
|
|
1494
|
-
* `updateMode: 'stream'` maintainer instead emits a **maintenance-outbox** marker row
|
|
1495
|
-
* (`OUTBOX#MAINT#…`) ATOMICALLY with the source write (the #130 compile lowering in
|
|
1496
|
-
* `src/spec/mutation-command.ts`), and THIS consumer — driven by the {@link
|
|
1497
|
-
* import('./emulator.js').CdcEmulator} (or, in production, real DynamoDB Streams +
|
|
1498
|
-
* a Lambda built around {@link createMaintenanceDrainHandler}) — applies the owner-row
|
|
1499
|
-
* write asynchronously.
|
|
1500
|
-
*
|
|
1501
|
-
* ## Why a separate async path exists (not just "do it later synchronously")
|
|
1502
|
-
*
|
|
1503
|
-
* The async path realizes the maintenance operations a single synchronous
|
|
1504
|
-
* `UpdateExpression` cannot express against an unread item:
|
|
1505
|
-
*
|
|
1506
|
-
* - **collection `maxItems` trim** — keeping a bounded, ordered list requires reading
|
|
1507
|
-
* the current list, appending, sorting, and trimming (a read-modify-write); a
|
|
1508
|
-
* synchronous `list_append` can only append (Phase 1 was append-only, #127).
|
|
1509
|
-
* - **`removed`-driven splice** — removing an entry from a maintained collection on a
|
|
1510
|
-
* source `removed` event likewise needs the current list.
|
|
1511
|
-
* - **running `max(field)`** — a conditional `SET` (`#a = :v` guarded by
|
|
1512
|
-
* `attribute_not_exists(#a) OR #a < :v`) whose failed guard, if run synchronously,
|
|
1513
|
-
* would roll back the legitimate source write.
|
|
1514
|
-
*
|
|
1515
|
-
* ## Delivery guarantees (reused from the CDC substrate)
|
|
1516
|
-
*
|
|
1517
|
-
* The maintenance-outbox row is recorded ATOMICALLY with the source write, so the
|
|
1518
|
-
* intent can never be lost ("wrote the row, lost the maintenance" is impossible). The
|
|
1519
|
-
* CDC substrate then delivers it **at-least-once**, **per-shard ordered** (a shard is
|
|
1520
|
-
* `hash(pk)`, and the outbox row's `pk` is keyed off the SOURCE row's key, so all
|
|
1521
|
-
* maintenance events for one source entity land on one shard in source-write order),
|
|
1522
|
-
* with a **DLQ** for poison events. This consumer is therefore written to be
|
|
1523
|
-
* **idempotent / commutative** wherever at-least-once redelivery could double-apply:
|
|
1524
|
-
*
|
|
1525
|
-
* - a `snapshot` `SET` is naturally idempotent (re-applying the same projection is a
|
|
1526
|
-
* no-op);
|
|
1527
|
-
* - a `collection` rebuild de-duplicates by the projected item's identity key, so a
|
|
1528
|
-
* redelivered append does not grow the list twice;
|
|
1529
|
-
* - a `max` conditional `SET` is idempotent (the guard rejects a non-greater value);
|
|
1530
|
-
* - a `count` `ADD` is the ONE non-idempotent op — but the source-row create guard
|
|
1531
|
-
* (`attribute_not_exists`) means a given source `created` event is emitted at most
|
|
1532
|
-
* once into the outbox, and the per-shard checkpoint advances only over acked events,
|
|
1533
|
-
* so a `count` is applied once per genuine source lifecycle. (A duplicate DELIVERY of
|
|
1534
|
-
* the same event is folded by the consumer's per-event de-dup set within a drain.)
|
|
1535
|
-
*/
|
|
1536
|
-
|
|
1537
|
-
/**
|
|
1538
|
-
* The PK prefix a maintenance-outbox row keys on — the single source of truth shared
|
|
1539
|
-
* with the compiler ({@link import('../spec/mutation-command.js')}'s
|
|
1540
|
-
* `MAINT_OUTBOX_PK_PREFIX`). The drain selects its events by `keys.pk.startsWith` of
|
|
1541
|
-
* this. Kept as a local literal (rather than importing a non-exported compiler const)
|
|
1542
|
-
* so the cdc module does not depend on the spec module; the value is asserted equal by
|
|
1543
|
-
* the integration tests that round-trip a real stream maintainer through both.
|
|
1544
|
-
*/
|
|
1545
|
-
declare const MAINT_OUTBOX_PK_PREFIX = "OUTBOX#MAINT#";
|
|
1546
|
-
/** Options for {@link createMaintenanceDrain}. */
|
|
1547
|
-
interface MaintenanceDrainOptions {
|
|
1548
|
-
/**
|
|
1549
|
-
* The model classes (or `ModelStatic`s) whose stream maintainers this drain
|
|
1550
|
-
* applies. The drain builds a scoped {@link MaintenanceGraph} over them to resolve
|
|
1551
|
-
* each maintenance-outbox event back to its declared effect. Defaults to the GLOBAL
|
|
1552
|
-
* registry when omitted.
|
|
1553
|
-
*/
|
|
1554
|
-
readonly models?: readonly Function[];
|
|
1555
|
-
/**
|
|
1556
|
-
* The {@link ViewDefinition}s (`defineView`) whose maintainers this drain applies
|
|
1557
|
-
* (issue #132). A view's destination is its dedicated view model; its source
|
|
1558
|
-
* classes should also be in {@link models} so the drain can resolve their
|
|
1559
|
-
* maintenance-outbox events. Defaults to none.
|
|
1560
|
-
*/
|
|
1561
|
-
readonly views?: readonly ViewDefinition[];
|
|
1562
|
-
}
|
|
1563
|
-
/**
|
|
1564
|
-
* A maintenance drain: a CDC consumer ({@link ChangeHandler}) that applies the
|
|
1565
|
-
* owner-row writes for `updateMode: 'stream'` maintainers. Construct via
|
|
1566
|
-
* {@link createMaintenanceDrain}, then `subscribe` its {@link handler} to a
|
|
1567
|
-
* {@link import('./emulator.js').CdcEmulator} (dev/test) or wire it into a real
|
|
1568
|
-
* Streams Lambda (production).
|
|
1569
|
-
*/
|
|
1570
|
-
declare class MaintenanceDrain {
|
|
1571
|
-
private readonly graph;
|
|
1572
|
-
/** Owner entity name → its model class (for the owner-row key derivation). */
|
|
1573
|
-
private readonly ownerByName;
|
|
1574
|
-
/** Per-event-id de-dup within a single handler invocation (at-least-once). */
|
|
1575
|
-
private appliedSeq;
|
|
1576
|
-
/** Count of owner-row writes applied (test/diagnostic). */
|
|
1577
|
-
private applied;
|
|
1578
|
-
constructor(opts?: MaintenanceDrainOptions);
|
|
1579
|
-
/** The CDC {@link ChangeHandler} to subscribe to an emulator / Streams source. */
|
|
1580
|
-
readonly handler: ChangeHandler;
|
|
1581
|
-
/** Resolve one maintenance-outbox event to its effect and apply the owner-row write. */
|
|
1582
|
-
private applyOne;
|
|
1583
|
-
/** Resolve a maintenance-outbox event back to the declared {@link MaintainItem}. */
|
|
1584
|
-
private resolve;
|
|
1585
|
-
/** A `snapshot` SET of each projected attribute onto the owner row (idempotent). */
|
|
1586
|
-
private applySnapshot;
|
|
1587
|
-
/**
|
|
1588
|
-
* A sparse-view **membership** write (#133): evaluate the membership predicate against
|
|
1589
|
-
* the source image; PUT the view row (its projection + key fields) when the predicate
|
|
1590
|
-
* holds, DELETE it when it flips false. A source `removed` event always deletes (the
|
|
1591
|
-
* source no longer exists, so its view row must disappear regardless of the predicate).
|
|
1592
|
-
*
|
|
1593
|
-
* Both ops are idempotent under at-least-once redelivery: a repeated PUT writes the same
|
|
1594
|
-
* row, a repeated DELETE is a no-op. The view row is keyed by the source identity
|
|
1595
|
-
* (`effect.keys`), so the PUT/DELETE always targets the SAME physical row the predicate
|
|
1596
|
-
* gates.
|
|
1597
|
-
*/
|
|
1598
|
-
private applyMembership;
|
|
1599
|
-
/**
|
|
1600
|
-
* A running `max`: read the owner row, and `SET` the attribute to the source value
|
|
1601
|
-
* only when it is greater (or absent). Implemented as a conditional update so a
|
|
1602
|
-
* redelivered / out-of-order older value never regresses the stored max — idempotent
|
|
1603
|
-
* and commutative under at-least-once delivery.
|
|
1604
|
-
*/
|
|
1605
|
-
private applyMax;
|
|
1606
|
-
/**
|
|
1607
|
-
* A bounded `collection`: read the current list, apply the event (append for a
|
|
1608
|
-
* `created`/`updated` source, splice for a `removed`), de-duplicate by the projected
|
|
1609
|
-
* identity key, order by `orderBy` (in `orderDir`, default DESC), trim to `maxItems`, and write the whole
|
|
1610
|
-
* list back. The read-modify-write is exactly what a single synchronous
|
|
1611
|
-
* `UpdateExpression` cannot do — the reason a bounded/ordered collection is a stream
|
|
1612
|
-
* maintainer (Phase 1 sync was append-only).
|
|
1613
|
-
*/
|
|
1614
|
-
private applyCollection;
|
|
1615
|
-
/** Owner-row writes applied so far (test/diagnostic). */
|
|
1616
|
-
appliedCount(): number;
|
|
1617
|
-
/** Clear the per-delivery de-dup set + counters (test reset). */
|
|
1618
|
-
reset(): void;
|
|
1619
|
-
}
|
|
1620
|
-
/** Create a {@link MaintenanceDrain} (issue #130). */
|
|
1621
|
-
declare function createMaintenanceDrain(opts?: MaintenanceDrainOptions): MaintenanceDrain;
|
|
1622
|
-
/**
|
|
1623
|
-
* Create just the CDC {@link ChangeHandler} for a maintenance drain — the form to
|
|
1624
|
-
* subscribe to an emulator or wire into a production Streams Lambda. A thin wrapper
|
|
1625
|
-
* over {@link createMaintenanceDrain} for callers that only need the handler.
|
|
1626
|
-
*/
|
|
1627
|
-
declare function createMaintenanceDrainHandler(opts?: MaintenanceDrainOptions): ChangeHandler;
|
|
1628
|
-
|
|
1629
|
-
/**
|
|
1630
|
-
* `fromChange` — the pure `(event) => [old, new]` typed mapper (issue #153).
|
|
1631
|
-
*
|
|
1632
|
-
* This is graphddb's HALF of the CDC-projection boundary (see
|
|
1633
|
-
* `docs/cdc-projection.md`): it parses a raw {@link ChangeEvent}'s `oldImage` /
|
|
1634
|
-
* `newImage` into typed model instances and does nothing downstream of that (no
|
|
1635
|
-
* sink write, no dedup, no subscription). `Model.fromChange(event)` on `DDBModel`
|
|
1636
|
-
* delegates here.
|
|
1637
|
-
*
|
|
1638
|
-
* The two responsibilities packed into one call are **routing** and **parse**:
|
|
1639
|
-
*
|
|
1640
|
-
* - Routing — an event that is not for `modelClass` yields `[null, null]`. A valid
|
|
1641
|
-
* event for the class always has at least one non-null image, so `[null, null]`
|
|
1642
|
-
* is an unambiguous "not for this model" signal and no separate `owns()` guard is
|
|
1643
|
-
* needed. The match is by `event.model` (the resolved model name the write path /
|
|
1644
|
-
* emulator stamps) when present, falling back to the model's PK prefix
|
|
1645
|
-
* (`keys.pk` begins with `<prefix>`) when the event carries no `model`.
|
|
1646
|
-
* - Parse — each present image is hydrated via the existing {@link hydrate}
|
|
1647
|
-
* (raw item → typed value, INCLUDING ISO 8601 → `Date` for `@datetime` and
|
|
1648
|
-
* embedded reconstruction), returning ALL fields (no projection — narrowing does
|
|
1649
|
-
* not reduce network cost since the image is already on the stream). The hydrated
|
|
1650
|
-
* plain record is then loaded onto a fresh model instance so the result is a
|
|
1651
|
-
* genuine `InstanceType` (like the read path's `{ hydrate }` factory option).
|
|
1652
|
-
*
|
|
1653
|
-
* The image side present per event kind mirrors DynamoDB Streams:
|
|
1654
|
-
*
|
|
1655
|
-
* - INSERT → `[null, new ]`
|
|
1656
|
-
* - MODIFY → `[old, new ]`
|
|
1657
|
-
* - REMOVE → `[old, null]`
|
|
1658
|
-
*/
|
|
1659
|
-
|
|
1660
|
-
/**
|
|
1661
|
-
* Parse a {@link ChangeEvent} into the `[oldRecord, newRecord]` tuple for the given
|
|
1662
|
-
* model. Returns `[null, null]` when the event is not for this model (routing). The
|
|
1663
|
-
* caller (`DDBModel.fromChange`) supplies the resolved metadata + class; this
|
|
1664
|
-
* function is the runtime core and is deliberately model-name-string driven so
|
|
1665
|
-
* `DDBModel.subscribe` can reuse it when routing a batch.
|
|
1666
|
-
*/
|
|
1667
|
-
declare function parseChange<T extends object>(event: ChangeEvent, metadata: EntityMetadata, modelName: string, modelClass: new () => T): [T | null, T | null];
|
|
1668
|
-
|
|
1669
1283
|
/**
|
|
1670
1284
|
* Per-key cursor envelope for batched `range` (`list`) contract methods (issue
|
|
1671
1285
|
* #62, CQRS single-service runtime; spec `docs/cqrs-contract.md`,
|
|
@@ -1747,39 +1361,6 @@ declare function encodePerKeyCursor(key: Record<string, unknown>, inner: string
|
|
|
1747
1361
|
*/
|
|
1748
1362
|
declare function decodePerKeyCursor(cursor: string, expectedKey: Record<string, unknown>): string;
|
|
1749
1363
|
|
|
1750
|
-
/**
|
|
1751
|
-
* Creates a Linter pre-loaded with rules safe for Entity registration.
|
|
1752
|
-
*
|
|
1753
|
-
* Rules included: no-scan, require-limit, gsi-ambiguity, missing-gsi,
|
|
1754
|
-
* relation-depth, same-partition-preset, plus the Epic #118 Phase 1 maintenance
|
|
1755
|
-
* validators (issue #126): missing-context, 400kb, hot-partition, fan-out,
|
|
1756
|
-
* multi-maintainer-same-row. The maintenance validators are no-ops for any
|
|
1757
|
-
* relation that does not declare `write.maintainedOn`, so unannotated models are
|
|
1758
|
-
* unaffected. query-boundary is excluded because it flags non-unique GSIs which
|
|
1759
|
-
* are valid for list() operations; boundary enforcement is handled at runtime by
|
|
1760
|
-
* the planner's boundary-check.
|
|
1761
|
-
*
|
|
1762
|
-
* Also includes cfn-schema-consistency (issue #169): a whole-table validator
|
|
1763
|
-
* that rejects entities sharing a physical table with an ambiguous base
|
|
1764
|
-
* KeySchema, inconsistently-shared GSI index names, or more than 20 unioned
|
|
1765
|
-
* GSIs — the CFn deploy-consistency user-error class, caught statically at
|
|
1766
|
-
* finalize. It is additive: a single entity on its own table with ≤ 20 GSIs is
|
|
1767
|
-
* never affected.
|
|
1768
|
-
*/
|
|
1769
|
-
declare function createDefaultLinter(): Linter;
|
|
1770
|
-
|
|
1771
|
-
declare const noScanRule: LintRule;
|
|
1772
|
-
|
|
1773
|
-
declare const requireLimitRule: LintRule;
|
|
1774
|
-
|
|
1775
|
-
declare const queryBoundaryRule: LintRule;
|
|
1776
|
-
|
|
1777
|
-
declare const gsiAmbiguityRule: LintRule;
|
|
1778
|
-
|
|
1779
|
-
declare const missingGsiRule: LintRule;
|
|
1780
|
-
|
|
1781
|
-
declare const relationDepthRule: LintRule;
|
|
1782
|
-
|
|
1783
1364
|
declare function detectRelationFields(select: Record<string, unknown>, metadata: EntityMetadata): RelationMetadata[];
|
|
1784
1365
|
declare function getImplicitKeyFields(select: Record<string, unknown>, metadata: EntityMetadata): string[];
|
|
1785
1366
|
|
|
@@ -2474,690 +2055,4 @@ type WriteOnlyDefinitions<D extends DefinitionMap> = {
|
|
|
2474
2055
|
[K in keyof D]: D[K] extends OperationDefinition<infer _T, infer Op, infer _K, infer _S, infer _Ch, infer _P> ? Op extends 'put' | 'update' | 'delete' ? D[K] : OperationDefinition<DDBModel, 'put' | 'update' | 'delete', unknown, unknown, unknown, Record<string, ParamDescriptor>> : never;
|
|
2475
2056
|
};
|
|
2476
2057
|
|
|
2477
|
-
|
|
2478
|
-
* Declarative transaction definition DSL (issue #46, Python-bridge Phase 4).
|
|
2479
|
-
*
|
|
2480
|
-
* `defineTransaction(params, (tx, p) => { … })` captures a **single source of
|
|
2481
|
-
* truth** for a `TransactWriteItems` batch: a parameter map plus a declarative
|
|
2482
|
-
* instruction list (`tx.put` / `tx.update` / `tx.delete`, plus `tx.forEach` over
|
|
2483
|
-
* an array param). The callback is evaluated at definition time with sentinel
|
|
2484
|
-
* proxies in place of params / loop elements, so the recorded instructions carry
|
|
2485
|
-
* **field-reference templates** (`{groupId}`, `{item.userId}`) rather than
|
|
2486
|
-
* concrete values — exactly the shape the static planner (#42) turns into a
|
|
2487
|
-
* serializable `transaction` op the TS and Python runtimes expand identically.
|
|
2488
|
-
*
|
|
2489
|
-
* ## Declarativity boundary (enforced — same soundness as #42 keys)
|
|
2490
|
-
*
|
|
2491
|
-
* The callback body may only:
|
|
2492
|
-
* - call `tx.put/update/delete(Model, …)` with **field references** (from `p`
|
|
2493
|
-
* or a `forEach` element) or **concrete literals** at scalar leaves;
|
|
2494
|
-
* - call `tx.forEach(p.<arrayParam>, (el) => { … }, { when? })` whose body is
|
|
2495
|
-
* itself only `tx.*` writes;
|
|
2496
|
-
* - attach a declarative `when` (a small comparison over field refs) and/or a
|
|
2497
|
-
* `condition` (the `{ notExists } | equality` subset, as for single writes).
|
|
2498
|
-
*
|
|
2499
|
-
* The same hardening that protects **key** positions (#42 `src/spec/symbolic.ts`)
|
|
2500
|
-
* is applied to **value** positions (item / changes / condition values, `when`
|
|
2501
|
-
* right-hand side). Value positions are in fact held to a *stricter* boundary
|
|
2502
|
-
* than keys: a key may legitimately interpolate a field (`` `USER#${id}` ``), so
|
|
2503
|
-
* coercion is allowed there and the differential template check is the boundary;
|
|
2504
|
-
* a value leaf may **only** be a *direct* field reference or a concrete literal,
|
|
2505
|
-
* so at a value position a faithful reference is **never coerced**. That single
|
|
2506
|
-
* fact is the soundness boundary:
|
|
2507
|
-
*
|
|
2508
|
-
* 1. **Throwing sentinel Proxy.** Each param / element placeholder is a Proxy
|
|
2509
|
-
* whose `get` trap whitelists only primitive coercion
|
|
2510
|
-
* (`Symbol.toPrimitive` / `toString` / `valueOf`) and the brand / `token` /
|
|
2511
|
-
* `origin` reads the planner needs, and **throws on every other property or
|
|
2512
|
-
* method access**. So a *direct* transform on a value placeholder —
|
|
2513
|
-
* `p.role.length`, `p.role[0]`, `p.role.toUpperCase()` — fails at the access
|
|
2514
|
-
* site, exactly like a key sentinel. (Same first-line defense as #42.)
|
|
2515
|
-
* 2. **Per-access coercion ledger (primary boundary).** Every minted field ref
|
|
2516
|
-
* records each time it is coerced to a primitive (`Symbol.toPrimitive` /
|
|
2517
|
-
* `toString` / `valueOf`). Because a faithful value reference is stored as
|
|
2518
|
-
* the Proxy *object* and never coerced, **any** coercion of a value ref is
|
|
2519
|
-
* positive proof the callback consumed the parameter into a transform, a
|
|
2520
|
-
* branch, an interpolation, or a comparison — and the build is rejected. This
|
|
2521
|
-
* is *access-site* accurate: it fires even when the same field is *also*
|
|
2522
|
-
* referenced faithfully elsewhere in the item (so its token still surfaces),
|
|
2523
|
-
* and it catches transforms that **converge to a constant or a shared marker
|
|
2524
|
-
* fragment** — `String(p.role).slice(0,0)` → `''`, `.slice(0,3)` → a shared
|
|
2525
|
-
* prefix, `[0]` / `.charAt(0)`, `.includes('Tx')` → a constant boolean, any
|
|
2526
|
-
* `… + 'CONST'` built atop them — which a purely output-comparing check could
|
|
2527
|
-
* not (the dropped field is masked by its faithful sibling, and the converged
|
|
2528
|
-
* value is byte-identical across passes).
|
|
2529
|
-
* 3. **Differential evaluation (secondary).** The callback is evaluated **twice**,
|
|
2530
|
-
* each run delivering placeholders that coerce to a *different* per-field
|
|
2531
|
-
* marker (the two markers share no common prefix and no common substring of
|
|
2532
|
-
* length ≥ 2, and differ in length). Every recorded value leaf must be either
|
|
2533
|
-
* (a) a faithful field reference (the Proxy object survived intact in *both*
|
|
2534
|
-
* runs) or (b) a concrete literal byte-identical across both runs. This is a
|
|
2535
|
-
* defense-in-depth layer behind the coercion ledger.
|
|
2536
|
-
* 4. **Consumed-field check.** A placeholder field that the callback *accessed*
|
|
2537
|
-
* but that never reached the recorded output — e.g. `(p.role === 'admin') ?
|
|
2538
|
-
* 'A' : 'B'`, where `===` does **not** coerce (so the ledger does not fire),
|
|
2539
|
-
* the comparison is `false`, and only a literal is emitted — is rejected: the
|
|
2540
|
-
* param was silently dropped and a branch burned into the spec. (Same
|
|
2541
|
-
* consumed-field accounting #42 uses for `kind === 'admin' ? … : …`.)
|
|
2542
|
-
*
|
|
2543
|
-
* Arbitrary JS, reads, value branching, arithmetic, coercion, or string
|
|
2544
|
-
* transforms on a param / element placeholder are therefore rejected at build
|
|
2545
|
-
* time, in **both** key and value positions — **never silently emitted as a
|
|
2546
|
-
* wrong spec**. Unlike key positions, value positions have **no residual class**:
|
|
2547
|
-
* because a faithful value ref is never coerced, even an identity-shaped
|
|
2548
|
-
* transform (`String(p.x).slice(0)`, `.normalize()`, `.trim()`, `.replace('§',…)`
|
|
2549
|
-
* on an absent substring) is rejected (it coerced the ref). The only operations
|
|
2550
|
-
* that *do not* coerce a ref are (a) storing it directly and (b) the brand read;
|
|
2551
|
-
* (a) is the supported faithful reference and (b) is internal — so the ledger has
|
|
2552
|
-
* no false positives and no escape.
|
|
2553
|
-
*/
|
|
2554
|
-
|
|
2555
|
-
declare const TX_REF_BRAND: unique symbol;
|
|
2556
|
-
/**
|
|
2557
|
-
* A captured reference to a parameter (`{name}`) or a `forEach` element field
|
|
2558
|
-
* (`{item.<field>}`). Branded so the planner can distinguish a reference from a
|
|
2559
|
-
* concrete literal, and so a stray reference cannot be silently coerced.
|
|
2560
|
-
*/
|
|
2561
|
-
interface TransactionRef {
|
|
2562
|
-
readonly [TX_REF_BRAND]: true;
|
|
2563
|
-
/** The template token this reference renders to, e.g. `{groupId}`. */
|
|
2564
|
-
readonly token: string;
|
|
2565
|
-
/** Human-readable origin (for error messages), e.g. `param 'groupId'`. */
|
|
2566
|
-
readonly origin: string;
|
|
2567
|
-
}
|
|
2568
|
-
/** Runtime guard: is `value` a {@link TransactionRef}? */
|
|
2569
|
-
declare function isTransactionRef(value: unknown): value is TransactionRef;
|
|
2570
|
-
/** A declarative comparison used by `when` (the only branching allowed). */
|
|
2571
|
-
type WhenComparison = {
|
|
2572
|
-
readonly op: 'eq';
|
|
2573
|
-
readonly left: TransactionRef;
|
|
2574
|
-
readonly right: unknown;
|
|
2575
|
-
} | {
|
|
2576
|
-
readonly op: 'ne';
|
|
2577
|
-
readonly left: TransactionRef;
|
|
2578
|
-
readonly right: unknown;
|
|
2579
|
-
};
|
|
2580
|
-
/**
|
|
2581
|
-
* A single captured instruction inside a transaction. The three write operations
|
|
2582
|
-
* (`put` / `update` / `delete`) mutate an item; `conditionCheck` (issue #81) is a
|
|
2583
|
-
* **read-only assertion** on another keyed item — it carries a `key` and a
|
|
2584
|
-
* **required** `condition` and never mutates, but its failure rolls the whole
|
|
2585
|
-
* transaction back. It is the foundation for referential-integrity derivation
|
|
2586
|
-
* (`requires <Entity> exists` → a `conditionCheck` with `attributeExists`).
|
|
2587
|
-
*/
|
|
2588
|
-
interface TxWriteInstruction {
|
|
2589
|
-
readonly kind: 'write';
|
|
2590
|
-
readonly operation: 'put' | 'update' | 'delete' | 'conditionCheck';
|
|
2591
|
-
readonly entity: EntityRef;
|
|
2592
|
-
/** Put: the item structure (field → ref / literal). */
|
|
2593
|
-
readonly item?: Record<string, unknown>;
|
|
2594
|
-
/** Update / delete / conditionCheck: the key structure. */
|
|
2595
|
-
readonly key?: Record<string, unknown>;
|
|
2596
|
-
/** Update: the changes structure. */
|
|
2597
|
-
readonly changes?: Record<string, unknown>;
|
|
2598
|
-
/**
|
|
2599
|
-
* The write / assertion condition (subset). Optional on `put` / `update` /
|
|
2600
|
-
* `delete`; **required** on a `conditionCheck` (the assertion it makes).
|
|
2601
|
-
*/
|
|
2602
|
-
readonly condition?: ConditionInput;
|
|
2603
|
-
/** Optional declarative guard (skip this item when it does not hold). */
|
|
2604
|
-
readonly when?: WhenComparison;
|
|
2605
|
-
}
|
|
2606
|
-
/** A `forEach` block expanding `body` once per element of an array param. */
|
|
2607
|
-
interface TxForEachInstruction {
|
|
2608
|
-
readonly kind: 'forEach';
|
|
2609
|
-
/** The array-param name iterated. */
|
|
2610
|
-
readonly source: string;
|
|
2611
|
-
/** Optional per-element declarative guard. */
|
|
2612
|
-
readonly when?: WhenComparison;
|
|
2613
|
-
/** The (write-only) instructions emitted per element. */
|
|
2614
|
-
readonly body: TxWriteInstruction[];
|
|
2615
|
-
}
|
|
2616
|
-
type TxInstruction = TxWriteInstruction | TxForEachInstruction;
|
|
2617
|
-
/** Options accepted by `tx.put/update/delete`. */
|
|
2618
|
-
interface TxWriteOptions {
|
|
2619
|
-
readonly condition?: ConditionInput;
|
|
2620
|
-
readonly when?: WhenComparison;
|
|
2621
|
-
}
|
|
2622
|
-
/**
|
|
2623
|
-
* Options accepted by `tx.conditionCheck` (issue #81). The `condition` is the
|
|
2624
|
-
* read-only assertion the check makes against the keyed item and is **required**
|
|
2625
|
-
* — a ConditionCheck with no condition is meaningless. An optional `when` skips
|
|
2626
|
-
* the check entirely when the guard does not hold.
|
|
2627
|
-
*/
|
|
2628
|
-
interface TxConditionCheckOptions {
|
|
2629
|
-
readonly condition: ConditionInput;
|
|
2630
|
-
readonly when?: WhenComparison;
|
|
2631
|
-
}
|
|
2632
|
-
/** Options accepted by `tx.forEach`. */
|
|
2633
|
-
interface TxForEachOptions {
|
|
2634
|
-
readonly when?: WhenComparison;
|
|
2635
|
-
}
|
|
2636
|
-
/** A small comparison helper: `when.eq(ref, value)` / `when.ne(ref, value)`. */
|
|
2637
|
-
declare const when: {
|
|
2638
|
-
readonly eq: (left: TransactionRef, right: unknown) => WhenComparison;
|
|
2639
|
-
readonly ne: (left: TransactionRef, right: unknown) => WhenComparison;
|
|
2640
|
-
};
|
|
2641
|
-
/** The transaction recorder handed to the callback as `tx`. */
|
|
2642
|
-
interface TxRecorder {
|
|
2643
|
-
put(model: ModelStatic<DDBModel>, item: Record<string, unknown>, options?: TxWriteOptions): void;
|
|
2644
|
-
update(model: ModelStatic<DDBModel>, key: Record<string, unknown>, changes: Record<string, unknown>, options?: TxWriteOptions): void;
|
|
2645
|
-
delete(model: ModelStatic<DDBModel>, key: Record<string, unknown>, options?: TxWriteOptions): void;
|
|
2646
|
-
/**
|
|
2647
|
-
* Record a **read-only** `ConditionCheck` assertion on a keyed item (issue
|
|
2648
|
-
* #81): the item is not mutated, but `options.condition` must hold or the whole
|
|
2649
|
-
* transaction is cancelled atomically. The foundation for referential-integrity
|
|
2650
|
-
* derivation (`requires <Entity> exists` → `conditionCheck(Model, key, {
|
|
2651
|
-
* condition: { attributeExists: 'PK' } })`).
|
|
2652
|
-
*/
|
|
2653
|
-
conditionCheck(model: ModelStatic<DDBModel>, key: Record<string, unknown>, options: TxConditionCheckOptions): void;
|
|
2654
|
-
forEach<E>(source: E, body: (element: ElementProxy<E>) => void, options?: TxForEachOptions): void;
|
|
2655
|
-
}
|
|
2656
|
-
/** The element proxy type inside a `forEach` body (fields → refs). */
|
|
2657
|
-
type ElementProxy<E> = E extends Param<infer T> ? T extends (infer Item)[] ? {
|
|
2658
|
-
readonly [K in keyof Item]: TransactionRef;
|
|
2659
|
-
} : never : never;
|
|
2660
|
-
/** The typed IR node produced by {@link defineTransaction}. */
|
|
2661
|
-
interface TransactionDefinition {
|
|
2662
|
-
/** @internal Marks this object as a transaction definition IR node. */
|
|
2663
|
-
readonly __isTransactionDefinition: true;
|
|
2664
|
-
/** Collected parameters: name → descriptor (array params carry `element`). */
|
|
2665
|
-
readonly params: Readonly<Record<string, ParamDescriptor>>;
|
|
2666
|
-
/** The captured, declarative instruction list. */
|
|
2667
|
-
readonly instructions: readonly TxInstruction[];
|
|
2668
|
-
}
|
|
2669
|
-
/** A param map accepted by {@link defineTransaction}. */
|
|
2670
|
-
type TransactionParamShape = Record<string, Param<unknown>>;
|
|
2671
|
-
/** The `p` proxy type: each scalar param → ref; each array param → itself. */
|
|
2672
|
-
type ParamProxy<P extends TransactionParamShape> = {
|
|
2673
|
-
readonly [K in keyof P]: P[K] extends {
|
|
2674
|
-
readonly kind: 'array';
|
|
2675
|
-
} ? P[K] : TransactionRef;
|
|
2676
|
-
};
|
|
2677
|
-
/**
|
|
2678
|
-
* Define a declarative transaction. The callback is evaluated **twice** with
|
|
2679
|
-
* throwing value sentinels (one differential marker set per pass); its `tx.*`
|
|
2680
|
-
* calls are recorded and the two passes are checked against each other so any
|
|
2681
|
-
* non-declarative value (a transform, a value branch, a coercion escape) is
|
|
2682
|
-
* rejected at build time — the same soundness #42 enforces for key positions.
|
|
2683
|
-
*
|
|
2684
|
-
* @param params A record of `param.*` placeholders (scalars and/or `param.array`).
|
|
2685
|
-
* @param build `(tx, p) => void` — records the write instructions.
|
|
2686
|
-
*/
|
|
2687
|
-
declare function defineTransaction<const P extends TransactionParamShape>(params: P, build: (tx: TxRecorder, p: ParamProxy<P>) => void): TransactionDefinition;
|
|
2688
|
-
/**
|
|
2689
|
-
* Group a record of transaction definitions into the IR consumed by the static
|
|
2690
|
-
* planner (#42/#46). Validates each entry is a transaction definition.
|
|
2691
|
-
*/
|
|
2692
|
-
declare function defineTransactions<const D extends Record<string, TransactionDefinition>>(definitions: D): D;
|
|
2693
|
-
|
|
2694
|
-
/**
|
|
2695
|
-
* Contract-layer serialization (issue #59, CQRS Contract layer, Epic #57;
|
|
2696
|
-
* spec `docs/cqrs-contract.md`, "SSoT Schema").
|
|
2697
|
-
*
|
|
2698
|
-
* The Contract IR (#58, `src/define/contract.ts`) holds, per contract method, a
|
|
2699
|
-
* resolved declarative {@link ContractMethodOp} plus the **decided facts** the
|
|
2700
|
-
* planner derived (`resolution` / `inputArity` / `result`). This module
|
|
2701
|
-
* **serializes** those facts into the JSON SSoT — it does **not** re-derive them:
|
|
2702
|
-
*
|
|
2703
|
-
* - The `contracts` map (contract name → {@link ContractSpec}) is layered **on
|
|
2704
|
-
* top of** the existing `queries` / `commands` / `transactions`. Each method
|
|
2705
|
-
* references one of them by name (`ContractName__methodName`), so the existing
|
|
2706
|
-
* operation-spec shapes are unchanged and the current runtime keeps working.
|
|
2707
|
-
* - The referenced operation spec is produced by **reusing** the proven
|
|
2708
|
-
* {@link buildQuerySpec} / {@link buildCommandSpec} planners: a
|
|
2709
|
-
* {@link ContractMethodOp} is translated back into the {@link AnyOperationDefinition}
|
|
2710
|
-
* shape those planners consume (the contract's sentinel references become the
|
|
2711
|
-
* `Param` placeholders the planner already understands), so the symbolic key
|
|
2712
|
-
* evaluation, projection, relation chaining, and condition handling are shared
|
|
2713
|
-
* — never re-implemented, never drifting.
|
|
2714
|
-
*
|
|
2715
|
-
* Everything emitted is **JSON-serializable** by construction (only strings /
|
|
2716
|
-
* numbers / booleans / arrays / plain objects). A contract-free input emits no
|
|
2717
|
-
* `contracts` / `contexts` keys, so the pre-#59 operations document is reproduced
|
|
2718
|
-
* byte-for-byte (backward compatibility).
|
|
2719
|
-
*
|
|
2720
|
-
* ## What this issue serializes vs. defers
|
|
2721
|
-
*
|
|
2722
|
-
* The #58 IR captures a single declarative op per method with a boolean `select`
|
|
2723
|
-
* projection; it does **not** model External Query / Query Composition (no
|
|
2724
|
-
* `query(Contract.method, { from(...) })` primitive exists yet). So no #58
|
|
2725
|
-
* contract produces a `compose`. The serializer nonetheless **supports** it: when
|
|
2726
|
-
* a method op carries composition (a forward-compatible {@link ContractMethodOp}
|
|
2727
|
-
* extension), it is emitted per the proposal's `compose` shape. The N+1 checker
|
|
2728
|
-
* (#60), boundary lint (#61), and runtime execution (#62) are out of scope here —
|
|
2729
|
-
* this is serialization + generator only.
|
|
2730
|
-
*/
|
|
2731
|
-
|
|
2732
|
-
/**
|
|
2733
|
-
* A contract as accepted by the serializer: either a resolved
|
|
2734
|
-
* {@link QueryModelContract} or a {@link CommandModelContract} (the #58 factory
|
|
2735
|
-
* output). The Key type is erased — the serializer reads the key **fields** off
|
|
2736
|
-
* the resolved op / model metadata, not the phantom type.
|
|
2737
|
-
*/
|
|
2738
|
-
type AnyModelContract = QueryModelContract<unknown, Record<string, QueryMethodSpec<unknown, unknown, unknown>>> | CommandModelContract<unknown, Record<string, CommandMethodSpec<unknown, unknown, unknown>>>;
|
|
2739
|
-
/** A map of contract name → resolved contract IR (as passed to the generator). */
|
|
2740
|
-
type ContractMap = Record<string, AnyModelContract>;
|
|
2741
|
-
/**
|
|
2742
|
-
* A context-ownership declaration as authored by the producer: context name →
|
|
2743
|
-
* the Model (entity) and Contract names that belong to it. The serializer sorts
|
|
2744
|
-
* the member lists deterministically; see {@link ContextSpec}.
|
|
2745
|
-
*/
|
|
2746
|
-
interface ContextOwnership {
|
|
2747
|
-
readonly models?: readonly string[];
|
|
2748
|
-
readonly contracts?: readonly string[];
|
|
2749
|
-
}
|
|
2750
|
-
/** A map of context name → its membership (as passed to the generator). */
|
|
2751
|
-
type ContextOwnershipMap = Record<string, ContextOwnership>;
|
|
2752
|
-
/**
|
|
2753
|
-
* The output of {@link buildContracts}: the `contracts` map and the
|
|
2754
|
-
* **synthesized** operation specs each method references. The caller merges the
|
|
2755
|
-
* synthesized `queries` / `commands` / `transactions` into the document's
|
|
2756
|
-
* existing maps (a contract method's referenced op lives alongside hand-written
|
|
2757
|
-
* definitions, addressed by name).
|
|
2758
|
-
*/
|
|
2759
|
-
interface BuiltContracts {
|
|
2760
|
-
readonly contracts: Record<string, ContractSpec>;
|
|
2761
|
-
/** Synthesized read ops referenced by query contract methods. */
|
|
2762
|
-
readonly queries: Record<string, QuerySpec>;
|
|
2763
|
-
/** Synthesized write ops referenced by command contract methods (single form). */
|
|
2764
|
-
readonly commands: Record<string, CommandSpec>;
|
|
2765
|
-
/**
|
|
2766
|
-
* Synthesized transactions referenced by command contract methods whose array
|
|
2767
|
-
* form resolves to a `'transact'` batched write (issue #64). One transaction per
|
|
2768
|
-
* such method, named `<Contract>__<method>__batch`: a single `forEach`-over-keys
|
|
2769
|
-
* write item that the runtime expands once per key (≤25, atomic), reusing the
|
|
2770
|
-
* proven declarative-transaction machinery (#46). Empty when no command method
|
|
2771
|
-
* declares a `'transact'` batch.
|
|
2772
|
-
*/
|
|
2773
|
-
readonly transactions: Record<string, TransactionSpec>;
|
|
2774
|
-
}
|
|
2775
|
-
/**
|
|
2776
|
-
* Serialize a map of resolved contracts into the `contracts` SSoT map plus the
|
|
2777
|
-
* synthesized operation specs each method references. Deterministic: contracts
|
|
2778
|
-
* and methods are emitted in sorted-key order.
|
|
2779
|
-
*
|
|
2780
|
-
* @param contracts Contract name → resolved {@link QueryModelContract} /
|
|
2781
|
-
* {@link CommandModelContract} (the #58 factory output). Empty → empty output.
|
|
2782
|
-
* @throws if a contract method op cannot be serialized (a non-boolean projection
|
|
2783
|
-
* slot, an unsupported write condition); or if a contract violates an N+1
|
|
2784
|
-
* safety rule (#60, {@link assertContractN1Safe}) — an array into a `range`
|
|
2785
|
-
* method, a "list under a list", or a `range` composed child.
|
|
2786
|
-
*/
|
|
2787
|
-
declare function buildContracts(contracts?: ContractMap): BuiltContracts;
|
|
2788
|
-
/**
|
|
2789
|
-
* Serialize the context-ownership declarations into the SSoT `contexts` map.
|
|
2790
|
-
* Member lists are sorted for determinism. An empty input yields an empty map
|
|
2791
|
-
* (the caller then omits the key for backward compatibility).
|
|
2792
|
-
*/
|
|
2793
|
-
declare function buildContexts(contexts?: ContextOwnershipMap): Record<string, ContextSpec>;
|
|
2794
|
-
|
|
2795
|
-
/**
|
|
2796
|
-
* Static parameterized operation-spec generation (issue #42, Phase 0b).
|
|
2797
|
-
*
|
|
2798
|
-
* Turns the parameterized definition IR (#41) into JSON-serializable
|
|
2799
|
-
* {@link OperationSpec} / {@link CommandSpec} via **symbolic evaluation** of the
|
|
2800
|
-
* key / GSI mapping functions. The result is deterministic and contains only
|
|
2801
|
-
* `{param}` / `{result.field}` template placeholders, never concrete values.
|
|
2802
|
-
*
|
|
2803
|
-
* Relation chains in a read `select` become **multiple operations** wired with
|
|
2804
|
-
* `resultPath` and `{result.*}` key templates, mirroring the runtime
|
|
2805
|
-
* `relation-planner` policy: `hasMany` → `Query` + `begins_with`, `belongsTo` /
|
|
2806
|
-
* `hasOne` → `BatchGetItem`.
|
|
2807
|
-
*/
|
|
2808
|
-
|
|
2809
|
-
/** Build the {@link QuerySpec} for a single read definition. */
|
|
2810
|
-
declare function buildQuerySpec(def: AnyOperationDefinition): QuerySpec;
|
|
2811
|
-
/**
|
|
2812
|
-
* Optional contract-layer inputs to {@link buildOperations} (issue #59). Both are
|
|
2813
|
-
* absent on a pre-#59 (contract-free) build, in which case the produced document
|
|
2814
|
-
* is byte-identical to the pre-#59 shape (no `contracts` / `contexts` keys).
|
|
2815
|
-
*/
|
|
2816
|
-
interface ContractInputs {
|
|
2817
|
-
/** Resolved contracts (publicQueryModel / publicCommandModel output). */
|
|
2818
|
-
readonly contracts?: ContractMap;
|
|
2819
|
-
/** Context-ownership declarations (context → member models / contracts). */
|
|
2820
|
-
readonly contexts?: ContextOwnershipMap;
|
|
2821
|
-
}
|
|
2822
|
-
/**
|
|
2823
|
-
* Build the operations document from grouped read (`queries`) and write
|
|
2824
|
-
* (`commands`) definition maps, plus the optional CQRS contract layer (#59).
|
|
2825
|
-
* All inputs are optional. Output is deterministic (definitions emitted in
|
|
2826
|
-
* sorted-key order; the runtime resolves by name).
|
|
2827
|
-
*
|
|
2828
|
-
* The contract layer (#59) is layered **on top of** the existing specs: each
|
|
2829
|
-
* contract method's underlying op is synthesized into `queries` / `commands` and
|
|
2830
|
-
* referenced by name, and the `contracts` / `contexts` maps are emitted. A
|
|
2831
|
-
* contract-free input (`contractInputs` empty / absent) reproduces the pre-#59
|
|
2832
|
-
* document byte-for-byte — no `contracts` / `contexts` keys appear.
|
|
2833
|
-
*
|
|
2834
|
-
* @throws if a command carries a write condition outside the supported subset
|
|
2835
|
-
* (`{ notExists }` or pure equality) — the bridge guard; or if a contract op
|
|
2836
|
-
* name collides with a hand-written definition.
|
|
2837
|
-
*/
|
|
2838
|
-
declare function buildOperations(queries?: DefinitionMap, commands?: DefinitionMap, transactions?: Record<string, TransactionDefinition>, contractInputs?: ContractInputs): OperationsDocument;
|
|
2839
|
-
|
|
2840
|
-
/**
|
|
2841
|
-
* Manifest generation (issue #42, Python-bridge Phase 0b).
|
|
2842
|
-
*
|
|
2843
|
-
* Produces the JSON-serializable {@link Manifest} from a {@link MetadataRegistry}
|
|
2844
|
-
* snapshot: entity → table / physicalName / prefix / field types / key & GSI
|
|
2845
|
-
* templates / relation metadata. Generation is **deterministic** — entities,
|
|
2846
|
-
* fields, GSIs, and relations are emitted in a stable (sorted) order so the same
|
|
2847
|
-
* registry always yields byte-identical JSON.
|
|
2848
|
-
*/
|
|
2849
|
-
|
|
2850
|
-
/**
|
|
2851
|
-
* Build the full {@link Manifest} from the {@link MetadataRegistry}.
|
|
2852
|
-
*
|
|
2853
|
-
* Every registered entity is included. Output ordering is deterministic
|
|
2854
|
-
* (entities / fields / relations sorted by name, GSIs by index name).
|
|
2855
|
-
*/
|
|
2856
|
-
declare function buildManifest(registry?: typeof MetadataRegistry): Manifest;
|
|
2857
|
-
|
|
2858
|
-
/**
|
|
2859
|
-
* N+1 static checker for the CQRS Contract layer (issue #60, Epic #57; proposal
|
|
2860
|
-
* `docs/cqrs-contract.md`, "N+1 Safety (Static Restriction)").
|
|
2861
|
-
*
|
|
2862
|
-
* Whether a resolution is N+1-safe depends on **two** facts the planner already
|
|
2863
|
-
* decided in #58 and #59 serialized into the SSoT — the checker **honors** them,
|
|
2864
|
-
* it does **not** re-derive policy ("decide once, declare in the SSoT"):
|
|
2865
|
-
*
|
|
2866
|
-
* - `resolution` — `'point'` (target keys known → `BatchGetItem` / another
|
|
2867
|
-
* contract's `get(keys[])`; coalesces) or `'range'` (target key set unknown →
|
|
2868
|
-
* partition `Query`; one request per partition key).
|
|
2869
|
-
* - `inputArity` / parent `cardinality` — how many keys are fed in. A `range`
|
|
2870
|
-
* method is one query for one key but N queries for N keys.
|
|
2871
|
-
*
|
|
2872
|
-
* The rule (absolute, no opt-in escape hatch): **a `range` resolution is allowed
|
|
2873
|
-
* only with single-key input.** Three forms are build-time errors:
|
|
2874
|
-
*
|
|
2875
|
-
* (a) **array into a `range` method** — a `range` method whose `inputArity` is
|
|
2876
|
-
* not `'single'` (`'array'` / `'either'`). A `range` method must be
|
|
2877
|
-
* `'single'`; anything else is an N partition-`Query` fan-out.
|
|
2878
|
-
* (a′) **array into a unique-GSI `point` method** (issue #71) — a `point` method
|
|
2879
|
-
* whose Key resolves via a **unique GSI** (a per-key `Query`, since
|
|
2880
|
-
* `BatchGetItem` cannot read a GSI) but whose `inputArity` is not `'single'`.
|
|
2881
|
-
* A base-table `point` coalesces a key array into one `BatchGetItem`, but a
|
|
2882
|
-
* unique-GSI `point` would issue N `Query`s — an N+1 fan-out, the same shape
|
|
2883
|
-
* as (a). graphddb's official spec does not include N+1-producing queries, so
|
|
2884
|
-
* it is rejected at build time; the application-side loop is the escape (same
|
|
2885
|
-
* philosophy as `range`).
|
|
2886
|
-
* (b) **"list under a list"** — a `range` child nested under a parent step whose
|
|
2887
|
-
* output cardinality is `'many'`. The composition's parent yields N records,
|
|
2888
|
-
* so a `range` child fans out to N partition `Query`s.
|
|
2889
|
-
* (c) **`compose` child that is `range`** — the cross-contract / composition form
|
|
2890
|
-
* of (b): a composed (External Query) child declared `range` under a parent
|
|
2891
|
-
* that can yield many. (Rule (b) and (c) are the same axis — a `range` child
|
|
2892
|
-
* under a many-yielding parent — surfaced through nested model relations vs.
|
|
2893
|
-
* cross-contract composition respectively.)
|
|
2894
|
-
*
|
|
2895
|
-
* `point` resolutions are always allowed (they coalesce). If a caller genuinely
|
|
2896
|
-
* needs "just these few", it loops in its own application code (the proposal's
|
|
2897
|
-
* `Promise.all(ids.map(...))`), keeping the N visible at the call site —
|
|
2898
|
-
* the contract surface never hides a fan-out.
|
|
2899
|
-
*
|
|
2900
|
-
* ## Placement — build path, not the model `LintRule` framework
|
|
2901
|
-
*
|
|
2902
|
-
* This checker runs on the **contract build path** ({@link buildContracts} in
|
|
2903
|
-
* `src/spec/contracts.ts`), where every other contract validation surfaces
|
|
2904
|
-
* (#59's projection audit, write-condition guard, and the original inline
|
|
2905
|
-
* `compose` rule all `throw` there). It operates on the serialized
|
|
2906
|
-
* {@link ContractSpec} facts, not on {@link EntityMetadata}: the existing
|
|
2907
|
-
* `src/linter/` `LintRule` framework is keyed on a single model's `EntityMetadata`
|
|
2908
|
-
* (model relations / GSIs), which carries none of the contract `resolution` /
|
|
2909
|
-
* `inputArity` / `compose` facts the N+1 rule needs. Surfacing the violation as a
|
|
2910
|
-
* thrown build error — exactly as `relation/traversal.ts` `validateDepth` and the
|
|
2911
|
-
* #59 contract validations do — fails the build the same way `inputArity`
|
|
2912
|
-
* mismatches and `range` composed children already failed it.
|
|
2913
|
-
*
|
|
2914
|
-
* The cross-contract `range`-child form (c) and the nested-relation form (b) are
|
|
2915
|
-
* only fully reachable once the composition DSL primitive
|
|
2916
|
-
* (`query(Contract.method, { from() })`, owned by #63) lands; until then no #58
|
|
2917
|
-
* DSL produces a `compose` node. The checker implements the full logic now so it
|
|
2918
|
-
* is ready, and the forward forms are exercised by feeding synthesized SSoT nodes
|
|
2919
|
-
* (exactly as #59's serializer tests do).
|
|
2920
|
-
*/
|
|
2921
|
-
|
|
2922
|
-
/** A single N+1 rule violation, carrying the rule label and a clear message. */
|
|
2923
|
-
interface ContractN1Violation {
|
|
2924
|
-
/** Which of the N+1 forms was violated. */
|
|
2925
|
-
readonly rule: 'array-into-range' | 'array-into-gsi-point' | 'list-under-list' | 'compose-range-under-many';
|
|
2926
|
-
/** The offending contract name. */
|
|
2927
|
-
readonly contract: string;
|
|
2928
|
-
/** The offending method name. */
|
|
2929
|
-
readonly method: string;
|
|
2930
|
-
/** A clear, actionable error message (the same text the thrown error carries). */
|
|
2931
|
-
readonly message: string;
|
|
2932
|
-
}
|
|
2933
|
-
/**
|
|
2934
|
-
* Tells, for a query contract method name, whether its `point` read resolves via
|
|
2935
|
-
* a **unique GSI** (a per-key `Query`) rather than the base-table primary key (a
|
|
2936
|
-
* coalescible `GetItem` / `BatchGetItem`). Supplied by the serializer (issue #71),
|
|
2937
|
-
* which recovers the fact from the method's synthesized read op (a root `Query`
|
|
2938
|
-
* carrying an `indexName`). Absent → no method is treated as a GSI point (the
|
|
2939
|
-
* pre-#71 default; e.g. synthesized-SSoT checker tests that exercise only the
|
|
2940
|
-
* `range` / `compose` rules).
|
|
2941
|
-
*/
|
|
2942
|
-
type IsGsiPointMethod = (methodName: string) => boolean;
|
|
2943
|
-
/**
|
|
2944
|
-
* Collect every N+1 violation in a single serialized {@link ContractSpec}.
|
|
2945
|
-
* Command contracts carry no `resolution` / `compose` and are always N+1-safe
|
|
2946
|
-
* (writes resolve to known keys), so only query contracts are inspected.
|
|
2947
|
-
*
|
|
2948
|
-
* @param isGsiPoint Optional predicate (issue #71): does the named method's
|
|
2949
|
-
* `point` read resolve via a unique GSI? Used to reject array-into-GSI-point
|
|
2950
|
-
* (rule a′). Defaults to "never" when not supplied.
|
|
2951
|
-
*/
|
|
2952
|
-
declare function collectContractN1Violations(contractName: string, spec: ContractSpec, isGsiPoint?: IsGsiPointMethod): ContractN1Violation[];
|
|
2953
|
-
/**
|
|
2954
|
-
* Assert a single serialized contract is N+1-safe, throwing the first violation
|
|
2955
|
-
* as a build error (mirroring `relation/traversal.ts` `validateDepth` and the
|
|
2956
|
-
* #59 contract validations, which `throw` on the build path). Multiple violations
|
|
2957
|
-
* are summarized in the thrown message so the build surfaces them all at once.
|
|
2958
|
-
*
|
|
2959
|
-
* @throws if any of the N+1 forms is present.
|
|
2960
|
-
*
|
|
2961
|
-
* @param isGsiPoint Optional predicate (issue #71) identifying unique-GSI `point`
|
|
2962
|
-
* methods, so rule (a′) (array into a GSI point) can be enforced.
|
|
2963
|
-
*/
|
|
2964
|
-
declare function assertContractN1Safe(contractName: string, spec: ContractSpec, isGsiPoint?: IsGsiPointMethod): void;
|
|
2965
|
-
|
|
2966
|
-
/**
|
|
2967
|
-
* Bounded-context boundary checker for the CQRS Contract layer (issue #61, Epic
|
|
2968
|
-
* #57; spec `docs/cqrs-contract.md`, External Query section "Why it
|
|
2969
|
-
* exists: boundary enforcement").
|
|
2970
|
-
*
|
|
2971
|
-
* The rule, stated in the proposal and the issue: a **Model is a private
|
|
2972
|
-
* implementation detail of its bounded context; a Contract is the published
|
|
2973
|
-
* interface**. Within its own context a contract resolves its own Models directly
|
|
2974
|
-
* (internal `query` / `list` / `put` / `update` / `delete`). Across a context
|
|
2975
|
-
* boundary it may depend on another context **only through that context's
|
|
2976
|
-
* published Contract** (an External Query / Command). Reaching directly into a
|
|
2977
|
-
* **foreign** Model is a **build-time error** — it couples one context to
|
|
2978
|
-
* another's private storage shape and silently defeats the boundary the contexts
|
|
2979
|
-
* declaration is meant to enforce.
|
|
2980
|
-
*
|
|
2981
|
-
* ## What "own" vs. "foreign" means here
|
|
2982
|
-
*
|
|
2983
|
-
* The decision is made entirely from the **context-ownership declaration** (#59,
|
|
2984
|
-
* the `contexts` map: context name → `{ models, contracts }`). For each contract:
|
|
2985
|
-
*
|
|
2986
|
-
* - its **owning context** is the (unique) context whose `contracts` list names
|
|
2987
|
-
* it; and
|
|
2988
|
-
* - for every Model its method ops touch (the recorded {@link ContractMethodOp}
|
|
2989
|
-
* `entity` refs, #58), that Model's **owning context** is the context whose
|
|
2990
|
-
* `models` list names it.
|
|
2991
|
-
*
|
|
2992
|
-
* A method op against a Model owned by a **different** context than the contract's
|
|
2993
|
-
* own is the violation. Three cases are deliberately **allowed**, never flagged:
|
|
2994
|
-
*
|
|
2995
|
-
* - the Model and the contract are in the **same** context (the normal internal
|
|
2996
|
-
* case);
|
|
2997
|
-
* - the **contract is in no declared context** — there is no boundary to enforce
|
|
2998
|
-
* *from*, so the contract is unconstrained (a partial / incremental adoption of
|
|
2999
|
-
* the contexts declaration must not turn unrelated contracts into errors);
|
|
3000
|
-
* - the touched **Model is in no declared context** — an undeclared Model has no
|
|
3001
|
-
* owner to protect, so it is not "foreign" to anyone. (Declaring the Model into
|
|
3002
|
-
* a context is what opts it into boundary protection.)
|
|
3003
|
-
*
|
|
3004
|
-
* In short: the check fires **only** when both the contract *and* the foreign
|
|
3005
|
-
* Model have declared, *different* owners. This is the least-surprising reading of
|
|
3006
|
-
* a *partial* contexts declaration and keeps the rule purely additive — declaring
|
|
3007
|
-
* more ownership can only ever surface *more* violations, never fewer.
|
|
3008
|
-
*
|
|
3009
|
-
* ## Placement — build path, not the model `LintRule` framework (decision B)
|
|
3010
|
-
*
|
|
3011
|
-
* This checker runs in **{@link buildOperations}** (`src/spec/operations.ts`),
|
|
3012
|
-
* immediately before the {@link buildContracts} call — the seam where both the
|
|
3013
|
-
* raw contract IR (the recorded op `entity` refs) and the `contexts` map are
|
|
3014
|
-
* still available, alongside #59's projection audit, the write-condition guard,
|
|
3015
|
-
* and #60's N+1 checker — every contract validation surfaces there as a thrown
|
|
3016
|
-
* build error. It is **not** added to the `src/linter/` `LintRule`
|
|
3017
|
-
* framework, even though the issue text suggests a `context-boundary` rule there,
|
|
3018
|
-
* because that framework's contract — `check(metadata: EntityMetadata, registry)`
|
|
3019
|
-
* — is keyed on a **single model's** {@link EntityMetadata} and carries **none** of
|
|
3020
|
-
* the facts this rule needs:
|
|
3021
|
-
*
|
|
3022
|
-
* - which context a *contract* belongs to (a contract is not an `EntityMetadata`);
|
|
3023
|
-
* - which Models a contract's *methods* touch (these live on the unserialized
|
|
3024
|
-
* {@link ContractMethodOp} `entity` refs, not on any model's metadata);
|
|
3025
|
-
* - the cross-cutting `contexts` map relating the two.
|
|
3026
|
-
*
|
|
3027
|
-
* A `LintRule` sees one model at a time and no contract facts at all, so a naive
|
|
3028
|
-
* rule physically cannot observe a contract→foreign-Model reference. Bending the
|
|
3029
|
-
* framework to carry contracts + contexts would be an invasive, parallel
|
|
3030
|
-
* "rule kind" that no other rule uses — exactly the ugly refactor the brief warns
|
|
3031
|
-
* against. Placing the check here is consistent with how #60 already resolved the
|
|
3032
|
-
* identical tension (`src/spec/contract-n1-check.ts`, "Placement"), and it reads
|
|
3033
|
-
* the **same facts the rule actually depends on** at the one point where contracts
|
|
3034
|
-
* and contexts are both in hand. The boundary violation fails the build the same
|
|
3035
|
-
* way an `inputArity` mismatch or a `range` composed child already does.
|
|
3036
|
-
*/
|
|
3037
|
-
|
|
3038
|
-
/** A single context-boundary violation, carrying the offending facts + message. */
|
|
3039
|
-
interface ContractBoundaryViolation {
|
|
3040
|
-
/** The offending contract name. */
|
|
3041
|
-
readonly contract: string;
|
|
3042
|
-
/** The context that owns the offending contract. */
|
|
3043
|
-
readonly contractContext: string;
|
|
3044
|
-
/** The contract method whose op touched the foreign Model. */
|
|
3045
|
-
readonly method: string;
|
|
3046
|
-
/** The foreign Model (entity / model-class name) referenced directly. */
|
|
3047
|
-
readonly foreignModel: string;
|
|
3048
|
-
/** The context that owns the foreign Model. */
|
|
3049
|
-
readonly foreignContext: string;
|
|
3050
|
-
/** A clear, actionable error message (the same text the thrown error carries). */
|
|
3051
|
-
readonly message: string;
|
|
3052
|
-
}
|
|
3053
|
-
/**
|
|
3054
|
-
* Collect every context-boundary violation across a map of resolved contracts,
|
|
3055
|
-
* given the context-ownership declaration. A violation is a contract method whose
|
|
3056
|
-
* recorded op touches a Model owned by a **different** context than the contract's
|
|
3057
|
-
* own (see the module doc for the precise own / foreign / undeclared rule).
|
|
3058
|
-
*
|
|
3059
|
-
* @param contracts Contract name → resolved {@link QueryModelContract} /
|
|
3060
|
-
* {@link CommandModelContract} (the #58 factory output).
|
|
3061
|
-
* @param contexts The context-ownership declaration (#59). When empty, no
|
|
3062
|
-
* contract has a declared owner, so there are no boundaries to enforce → no
|
|
3063
|
-
* violations.
|
|
3064
|
-
* @throws if the contexts declaration claims a Model / Contract in two contexts
|
|
3065
|
-
* (an ambiguous, self-contradictory declaration).
|
|
3066
|
-
*/
|
|
3067
|
-
declare function collectContractBoundaryViolations(contracts: ContractMap, contexts: ContextOwnershipMap): ContractBoundaryViolation[];
|
|
3068
|
-
/**
|
|
3069
|
-
* Assert a map of resolved contracts respects bounded-context boundaries, throwing
|
|
3070
|
-
* the first violation as a build error (mirroring #60's {@link assertContractN1Safe}
|
|
3071
|
-
* and the other #59 contract validations, which `throw` on the build path).
|
|
3072
|
-
* Multiple violations are summarized in the thrown message so the build surfaces
|
|
3073
|
-
* them all at once.
|
|
3074
|
-
*
|
|
3075
|
-
* @param contracts Contract name → resolved contract IR.
|
|
3076
|
-
* @param contexts The context-ownership declaration (#59).
|
|
3077
|
-
* @throws if any contract directly references a foreign context's Model, or if the
|
|
3078
|
-
* contexts declaration is ambiguous (a Model / Contract claimed twice).
|
|
3079
|
-
*/
|
|
3080
|
-
declare function assertContractBoundaries(contracts: ContractMap, contexts: ContextOwnershipMap): void;
|
|
3081
|
-
|
|
3082
|
-
/**
|
|
3083
|
-
* Static planning for declarative transactions (issue #46, Phase 4).
|
|
3084
|
-
*
|
|
3085
|
-
* Turns a {@link TransactionDefinition} (captured by `defineTransaction`) into a
|
|
3086
|
-
* serializable {@link TransactionSpec}. Each `tx.put/update/delete` becomes a
|
|
3087
|
-
* templated {@link TransactionItemSpec}; a `tx.forEach` block marks its items
|
|
3088
|
-
* with a `forEach` binding so the runtime expands them once per array-param
|
|
3089
|
-
* element. Key templates are derived with the **same** symbolic key-mapping
|
|
3090
|
-
* evaluator (#42 `evaluateKey`) the single-write planner uses — the
|
|
3091
|
-
* declarativity of the field references is what lets that reuse work: every
|
|
3092
|
-
* key / item / changes leaf is either a field reference (whose token the planner
|
|
3093
|
-
* substitutes) or a concrete literal.
|
|
3094
|
-
*/
|
|
3095
|
-
|
|
3096
|
-
/** Build the {@link TransactionSpec} for one transaction definition. */
|
|
3097
|
-
declare function buildTransactionSpec(txName: string, def: TransactionDefinition): TransactionSpec;
|
|
3098
|
-
/** Build the transactions map from a record of transaction definitions. */
|
|
3099
|
-
declare function buildTransactions(transactions?: Record<string, TransactionDefinition>): Record<string, TransactionSpec>;
|
|
3100
|
-
|
|
3101
|
-
/**
|
|
3102
|
-
* Bridge guard (issue #42, Phase 0b).
|
|
3103
|
-
*
|
|
3104
|
-
* The Python bridge can only carry a **declarative, serializable subset** of
|
|
3105
|
-
* graphddb. This module enforces that subset at build time:
|
|
3106
|
-
*
|
|
3107
|
-
* 1. **Write conditions** must be `{ notExists }`, an existence primitive
|
|
3108
|
-
* (`{ attributeExists }` / `{ attributeNotExists }` on any field, issue #81),
|
|
3109
|
-
* *or* pure field equality (mirroring `expression/condition-expression.ts`,
|
|
3110
|
-
* which only emits `attribute_(not_)exists(...)` or `#f = :v` clauses). Any
|
|
3111
|
-
* other condition shape is rejected — there is no serializable representation
|
|
3112
|
-
* for it. {@link conditionInputToSpec} is the single place the IR-shaped input
|
|
3113
|
-
* is mapped to the {@link ConditionSpec} subset.
|
|
3114
|
-
* 2. The produced bundle must be **JSON-serializable** — no functions, classes,
|
|
3115
|
-
* `Date`, `Set`, `Map`, `Symbol`, or non-finite numbers may leak into the
|
|
3116
|
-
* spec. {@link assertJsonSerializable} walks the value and throws on any.
|
|
3117
|
-
*
|
|
3118
|
-
* (Note: the post-load TS predicate `refine` was removed in #49, so no guard for
|
|
3119
|
-
* it is needed; see `docs/python-bridge.md`.)
|
|
3120
|
-
*/
|
|
3121
|
-
|
|
3122
|
-
/**
|
|
3123
|
-
* Assert a write {@link ConditionSpec} is within the supported subset. The spec
|
|
3124
|
-
* type already constrains it to `notExists` | `attributeExists` |
|
|
3125
|
-
* `attributeNotExists` | `equals`, so this defends against a malformed `equals`
|
|
3126
|
-
* (empty / non-template values) or a blank existence field and gives a clear,
|
|
3127
|
-
* single-source build-time error message for any future widening.
|
|
3128
|
-
*/
|
|
3129
|
-
declare function assertSupportedCondition(commandName: string, condition: ConditionSpec): void;
|
|
3130
|
-
/**
|
|
3131
|
-
* Walk an arbitrary value and throw if it contains anything that does not
|
|
3132
|
-
* survive `JSON.stringify` round-tripping as itself (functions, symbols,
|
|
3133
|
-
* `undefined`, `Date`, `Map`, `Set`, class instances, non-finite numbers).
|
|
3134
|
-
*/
|
|
3135
|
-
declare function assertJsonSerializable(value: unknown, path?: string): void;
|
|
3136
|
-
/** Convenience: assert an entire {@link BridgeBundle} is JSON-serializable. */
|
|
3137
|
-
declare function assertBundleSerializable(bundle: BridgeBundle): void;
|
|
3138
|
-
|
|
3139
|
-
/**
|
|
3140
|
-
* Static parameterized planner: serializable OperationSpec + manifest + bridge
|
|
3141
|
-
* guard (issue #42, Python-bridge Phase 0b). Public surface.
|
|
3142
|
-
*
|
|
3143
|
-
* The CLI / file output is #43's responsibility; this module stops at the
|
|
3144
|
-
* **generation functions** producing the typed, JSON-serializable
|
|
3145
|
-
* `{ manifest, operations }` bundle.
|
|
3146
|
-
*/
|
|
3147
|
-
|
|
3148
|
-
/**
|
|
3149
|
-
* Build the full `{ manifest, operations }` bridge bundle from grouped query /
|
|
3150
|
-
* command definition maps. The bundle is typed and JSON-serializable; the bridge
|
|
3151
|
-
* guard runs (unsupported write conditions throw during `buildOperations`, and
|
|
3152
|
-
* the whole bundle is asserted JSON-serializable here).
|
|
3153
|
-
*
|
|
3154
|
-
* @param queries Read definitions (`defineQueries(...)` output). Optional.
|
|
3155
|
-
* @param commands Write definitions (`defineCommands(...)` output). Optional.
|
|
3156
|
-
* @param registry Metadata source (defaults to the global registry).
|
|
3157
|
-
* @param transactions Declarative transactions (`defineTransactions(...)`). Optional.
|
|
3158
|
-
* @param contractInputs The CQRS contract layer (#59): resolved contracts +
|
|
3159
|
-
* context-ownership. Optional — absent reproduces the pre-#59 document.
|
|
3160
|
-
*/
|
|
3161
|
-
declare function buildBridgeBundle(queries?: DefinitionMap, commands?: DefinitionMap, registry?: typeof MetadataRegistry, transactions?: Record<string, TransactionDefinition>, contractInputs?: ContractInputs): BridgeBundle;
|
|
3162
|
-
|
|
3163
|
-
export { AggregateOptions, AggregateValue, 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, type DriftReport, DynamoDBOperation, DynamoExecutor, DynamoType, EDGE_WRITES_MARKER, type EdgeLifecycle, type EdgeWriteDeclaration, type EdgeWriteRecorder, type EdgeWritesDefinition, EntityMetadata, EntityRef, EventLog, ExecutionPlan, Executor, ExecutorResult, type ExplainInput, FaultSpec, FieldMetadata, FieldOptions, type FilterExpressionResult, GsiDefinition, type HasManyVersionedCallback, type HasManyVersionedOptions, type HasOneVersionedCallback, type HasOneVersionedOptions, Item, KeyDefinition, type LintResult, type LintRule, Linter, type ListInput, type ListOptions, MAINT_OUTBOX_PK_PREFIX, MAX_TRANSACT_ITEMS, MaintainConsistency, MaintainEffect, MaintainEvent, MaintainUpdateMode, type MaintainedFromCallback, type MaintainedFromOptions, MaintenanceDrain, type MaintenanceDrainOptions, type MaintenanceRebuildOptions, MaintenanceRebuilder, Manifest, MembershipPredicate, MembershipPredicateOp, MetadataRegistry, Middleware, type ModelOptions, ModelStatic, OLD_VALUE_NAMESPACE, OperationDefinition, OperationsDocument, Param, ParamDescriptor, type Parameterize, PartialQueryKeyOf, type PerKeyCursorEnvelope, type PlanInput, PrimaryKeyOf, type ProjectionResult, ProjectionTransform, type ProjectionValue, PutInput, QueryMethodSpec, QueryModelContract, type QueryOptions$1 as QueryOptions, QuerySpec, RawCondition, ReadExecOptions, ReadParams, ReadRequestCtx, ReadRequestKind, type RebuildResult, RelationMetadata, RelationOptions, type RelationTraversalOptions, ReplayOptions, RequestContext, ResolvedKey, RetryOverride, RetryPolicy, RetryingExecutor, SelectableOf, type SelfProxy, type SelfRef, ShardId, type SourceProxy, type SourceRef, 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 VersionedHistoryOptions, type VersionedLatestOptions, ViewDefinition, type WhenComparison, WriteDefinitionOptions, WriteExecOptions, WriteResult, aggregate, assertBundleSerializable, assertContractBoundaries, assertContractN1Safe, assertJsonSerializable, assertSupportedCondition, belongsTo, binary, boolean, buildBridgeBundle, buildConditionExpression, buildContexts, buildContracts, buildManifest, buildOperations, buildProjection, buildQuerySpec, buildTransactionSpec, buildTransactions, buildUpdateExpression, cdcProjected, collectContractBoundaryViolations, collectContractN1Violations, compileFilterExpression, count, createCdcEmulator, createDefaultLinter, createMaintenanceDrain, createMaintenanceDrainHandler, createMaintenanceRebuilder, 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, maintainedFrom, map, max, missingGsiRule, model, noScanRule, number, numberSet, parseChange, plan, queryBoundaryRule, relationDepthRule, requireLimitRule, resolveKey, resolveRelations, serializeContractKey, serializeFieldValue, string, stringSet, ttl, validateDepth, validateGsiAmbiguity, when, whenMember };
|
|
2058
|
+
export { AggregateOptions, AggregateValue, BATCH_GET_MAX_KEYS, BATCH_WRITE_MAX_ITEMS, BatchExecOptions, BatchGetExecInput, BatchWriteExecItem, ClientManager, type CollectParams, type ConditionExpressionResult, CtxModel, DDBModel, DefinitionMap, DeleteInput, type DriftReport, DynamoDBOperation, DynamoExecutor, DynamoType, EDGE_WRITES_MARKER, type EdgeLifecycle, type EdgeWriteDeclaration, type EdgeWriteRecorder, type EdgeWritesDefinition, EntityMetadata, ExecutionPlan, Executor, ExecutorResult, type ExplainInput, FieldMetadata, FieldOptions, type FilterExpressionResult, GsiDefinition, type HasManyVersionedCallback, type HasManyVersionedOptions, type HasOneVersionedCallback, type HasOneVersionedOptions, Item, KeyDefinition, type ListInput, type ListOptions, MAX_TRANSACT_ITEMS, MaintainConsistency, MaintainEffect, MaintainEvent, MaintainUpdateMode, type MaintainedFromCallback, type MaintainedFromOptions, type MaintenanceRebuildOptions, MaintenanceRebuilder, Manifest, MembershipPredicate, MembershipPredicateOp, Middleware, type ModelOptions, ModelStatic, OLD_VALUE_NAMESPACE, OperationDefinition, Param, ParamDescriptor, type Parameterize, PartialQueryKeyOf, type PerKeyCursorEnvelope, type PlanInput, PrimaryKeyOf, type ProjectionResult, ProjectionTransform, type ProjectionValue, PutInput, type QueryOptions$1 as QueryOptions, RawCondition, ReadExecOptions, ReadParams, ReadRequestCtx, ReadRequestKind, type RebuildResult, RelationMetadata, RelationOptions, type RelationTraversalOptions, RequestContext, ResolvedKey, RetryOverride, RetryPolicy, RetryingExecutor, SelectableOf, type SelfProxy, type SelfRef, type SourceProxy, type SourceRef, TableMapping, TransactWriteExecItem, TransactionItemSpec, TransactionSpec, UniqueQueryKeyOf, type UpdateExpressionResult, UpdateInput, type VersionedHistoryOptions, type VersionedLatestOptions, ViewDefinition, WriteDefinitionOptions, WriteExecOptions, WriteResult, aggregate, belongsTo, binary, boolean, buildConditionExpression, buildProjection, buildUpdateExpression, cdcProjected, compileFilterExpression, count, createMaintenanceRebuilder, datetime, decodeCursor, decodePerKeyCursor, defineCommands, defineDelete, defineList, definePut, defineQueries, defineQuery, defineUpdate, deriveEdgeWriteItems, deriveEdgeWriteItemsFor, deriveModelEdgeWriteItems, derivePrefix, detectRelationFields, edgeWrites, embedded, encodeCursor, encodePerKeyCursor, evaluateFilter, execute, executeDeclarativeTransaction, executeExplain, executeList, executeQuery, expandTransaction, field, getEdgeWrites, getImplicitKeyFields, hasMany, hasOne, hydrate, isEdgeWritesDefinition, isSelectBuilder, list, literal, maintainedFrom, map, max, model, number, numberSet, plan, resolveKey, resolveRelations, serializeContractKey, serializeFieldValue, string, stringSet, ttl, validateDepth, validateGsiAmbiguity, whenMember };
|