graphddb 0.5.2 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/dist/cdc/index.d.ts +37 -0
- package/dist/cdc/index.js +29 -0
- package/dist/{chunk-QBXLQNXY.js → chunk-5NXNEW43.js} +4 -1
- package/dist/{chunk-W3GEJPPV.js → chunk-F2DI3GTI.js} +154 -1024
- package/dist/chunk-MMVHOUM4.js +24 -0
- package/dist/{chunk-H5TUW2WR.js → chunk-N5NQM3SO.js} +3749 -3606
- package/dist/chunk-PDUVTYC5.js +992 -0
- package/dist/cli.js +922 -19
- package/dist/from-change-CFzBy7aU.d.ts +327 -0
- package/dist/index-CtJbTrfB.d.ts +690 -0
- package/dist/index.d.ts +53 -1113
- package/dist/index.js +48 -41
- package/dist/linter/index.d.ts +126 -0
- package/dist/linter/index.js +36 -0
- package/dist/{types-m1Ect6hG.d.ts → maintenance-view-adapter-CFeasCKo.d.ts} +380 -187
- package/dist/registry-DbqmFyab.d.ts +76 -0
- package/dist/relation-depth-0TiWr5OW.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/design-patterns.md +150 -27
- package/docs/doc-sample.md +263 -0
- package/docs/docs-generation.md +183 -0
- package/package.json +55 -4
- package/dist/chunk-MCKGQKYU.js +0 -15
- package/dist/typescript-ZUQEBJRV.js +0 -210764
package/README.md
CHANGED
|
@@ -22,6 +22,7 @@ TypeScript types.
|
|
|
22
22
|
- ✅ **CDC projection** —— `@cdcProjected()` + `fromChange` / `subscribe` parse CDC change events into typed records (sink delivery / idempotency stay with the consumer).
|
|
23
23
|
- ✅ **Maintained access paths** —— keep embedded snapshots / aggregate counters synchronized atomically.
|
|
24
24
|
- ✅ **CloudFormation generation** —— emit a CloudFormation template for the DynamoDB table(s) a model set maps onto (GSI union / Streams / TTL / PITR / TableClass / SSE / PROVISIONED / Auto Scaling).
|
|
25
|
+
- ✅ **Docs generation** —— generate a model specification (Markdown + Mermaid) from the TS models; templates are Handlebars and user-overridable.
|
|
25
26
|
|
|
26
27
|
## 🤔 Philosophy
|
|
27
28
|
|
|
@@ -214,6 +215,11 @@ Each capability is summarized here only. For details, operator lists, and proced
|
|
|
214
215
|
- **CloudFormation generation** —— `graphddb generate cloudformation` emits a CloudFormation template for
|
|
215
216
|
the DynamoDB table(s) a model set maps onto (GSI union / Streams / TTL / PITR / PROVISIONED / Auto
|
|
216
217
|
Scaling). [`docs/cloudformation.md`](./docs/cloudformation.md).
|
|
218
|
+
- **Docs generation** —— `graphddb generate docs` renders a human-facing model specification (Table
|
|
219
|
+
Overview / ER diagram / Key Schema / Property Matrix / Entity Details / Access Patterns / Mutation
|
|
220
|
+
Contracts / Maintained Access Paths / CDC / CloudFormation) as Markdown + Mermaid. The layout is
|
|
221
|
+
defined by bundled Handlebars templates that users can customize with `--template-dir` (per-partial
|
|
222
|
+
override) and `--helpers` (extra helpers). [`docs/docs-generation.md`](./docs/docs-generation.md).
|
|
217
223
|
|
|
218
224
|
## 📚 Documentation
|
|
219
225
|
|
|
@@ -234,6 +240,7 @@ documentation available offline at hand. On GitHub, follow the links in the tabl
|
|
|
234
240
|
| [CDC emulator](./docs/cdc-emulator.md) | A change-event emulator for differential aggregation patterns (dev/test). |
|
|
235
241
|
| [CDC projection](./docs/cdc-projection.md) | The `@cdcProjected()` + `fromChange` / `subscribe` typed-consumer-IF: a contract that parses CDC change events into typed records. Boundary (parse→typed is graphddb; subscription, sink delivery, idempotency are the consumer's). |
|
|
236
242
|
| [CloudFormation generation](./docs/cloudformation.md) | The `generate cloudformation` command: emit a CloudFormation template for the DynamoDB table(s) a model set maps onto (GSI union / Streams / TTL / PITR / TableClass / SSE / PROVISIONED / Auto Scaling). All options, derivation rules, and scope boundary. |
|
|
243
|
+
| [Docs generation](./docs/docs-generation.md) | The `generate docs` command: generate a model specification (Markdown + Mermaid) from the TS models. All options, output sections, and customizing the Handlebars templates with `--template-dir` / `--helpers`. |
|
|
237
244
|
| [Benchmark](./benchmark/RESULTS.md) | Library comparison against hand-written AWS SDK, ElectroDB, DynamoDB Toolbox, and OneTable. |
|
|
238
245
|
|
|
239
246
|
## 💡 Examples
|
|
@@ -264,6 +271,7 @@ flowchart LR
|
|
|
264
271
|
M --> PY["Python client + runtime"]
|
|
265
272
|
M --> CQ["CQRS Contract"]
|
|
266
273
|
M --> CFN["CloudFormation template"]
|
|
274
|
+
M --> DOC["Model docs (Markdown + Mermaid)"]
|
|
267
275
|
```
|
|
268
276
|
|
|
269
277
|
## 📄 License
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
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-CFzBy7aU.js';
|
|
2
|
+
export { B as BatchResult, C as CdcEmulatorOptions, a as CdcMode, b as ChangeBatch, c as ChangeEvent, d as ChangeEventName, e as ChangeHandler, f as ClockMode, g as ConcurrentRecomputeRef, E as EventLog, F as FaultSpec, R as ReplayOptions, S as ShardId, h as StartingPosition, i as StreamViewType, j as SubscribeHandler, k as SubscribeHandlers, U as Unsubscribe, l as buildSubscribeHandler } from '../maintenance-view-adapter-CFeasCKo.js';
|
|
3
|
+
import '@aws-sdk/client-dynamodb';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Deterministic primitives for the CDC emulator (issue #72). All fault
|
|
7
|
+
* injection and shard assignment route through these so a given `seed`
|
|
8
|
+
* reproduces the exact same event ordering, duplicates, delays, and failures
|
|
9
|
+
* (spec §8, AC3).
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* mulberry32 — a small, fast, fully deterministic 32-bit PRNG. Given the same
|
|
13
|
+
* seed it produces the same sequence on every platform, which is what AC3
|
|
14
|
+
* ("…deterministically reproducible with a seed") requires.
|
|
15
|
+
*/
|
|
16
|
+
declare class SeededRandom {
|
|
17
|
+
private state;
|
|
18
|
+
constructor(seed: number);
|
|
19
|
+
/** Next float in [0, 1). */
|
|
20
|
+
next(): number;
|
|
21
|
+
/** Integer in [min, max] inclusive. */
|
|
22
|
+
int(min: number, max: number): number;
|
|
23
|
+
/** Bernoulli trial: true with probability `p`. */
|
|
24
|
+
chance(p: number): boolean;
|
|
25
|
+
/** In-place Fisher–Yates shuffle, deterministic for the seed state. */
|
|
26
|
+
shuffle<T>(items: T[]): T[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Stable 32-bit string hash (FNV-1a). Used for `shardId = hash(pk)` so the same
|
|
30
|
+
* partition key always lands in the same shard (spec §6), independent of the
|
|
31
|
+
* fault PRNG.
|
|
32
|
+
*/
|
|
33
|
+
declare function hashString(value: string): number;
|
|
34
|
+
/** Compute the shard id for a partition key over `shardCount` shards. */
|
|
35
|
+
declare function shardIdFor(pk: string, shardCount: number): string;
|
|
36
|
+
|
|
37
|
+
export { SeededRandom, hashString, shardIdFor };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CdcEmulator,
|
|
3
|
+
MAINT_OUTBOX_PK_PREFIX,
|
|
4
|
+
MaintenanceDrain,
|
|
5
|
+
SeededRandom,
|
|
6
|
+
createCdcEmulator,
|
|
7
|
+
createMaintenanceDrain,
|
|
8
|
+
createMaintenanceDrainHandler,
|
|
9
|
+
hashString,
|
|
10
|
+
shardIdFor
|
|
11
|
+
} from "../chunk-5NXNEW43.js";
|
|
12
|
+
import {
|
|
13
|
+
buildSubscribeHandler,
|
|
14
|
+
parseChange
|
|
15
|
+
} from "../chunk-F2DI3GTI.js";
|
|
16
|
+
import "../chunk-PDUVTYC5.js";
|
|
17
|
+
export {
|
|
18
|
+
CdcEmulator,
|
|
19
|
+
MAINT_OUTBOX_PK_PREFIX,
|
|
20
|
+
MaintenanceDrain,
|
|
21
|
+
SeededRandom,
|
|
22
|
+
buildSubscribeHandler,
|
|
23
|
+
createCdcEmulator,
|
|
24
|
+
createMaintenanceDrain,
|
|
25
|
+
createMaintenanceDrainHandler,
|
|
26
|
+
hashString,
|
|
27
|
+
parseChange,
|
|
28
|
+
shardIdFor
|
|
29
|
+
};
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
buildMaintenanceGraph,
|
|
8
8
|
buildPutInput,
|
|
9
9
|
resolveModelClass
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-F2DI3GTI.js";
|
|
11
11
|
|
|
12
12
|
// src/cdc/prng.ts
|
|
13
13
|
var SeededRandom = class {
|
|
@@ -793,6 +793,9 @@ function createMaintenanceDrainHandler(opts = {}) {
|
|
|
793
793
|
}
|
|
794
794
|
|
|
795
795
|
export {
|
|
796
|
+
SeededRandom,
|
|
797
|
+
hashString,
|
|
798
|
+
shardIdFor,
|
|
796
799
|
CdcEmulator,
|
|
797
800
|
createCdcEmulator,
|
|
798
801
|
pathField,
|