graphddb 0.5.1 → 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 +10 -0
- package/dist/cdc/index.d.ts +37 -0
- package/dist/cdc/index.js +29 -0
- package/dist/{chunk-B3GWIWT6.js → chunk-CCIVET5K.js} +74 -1026
- package/dist/{chunk-EMJHTUA4.js → chunk-M6URQOAW.js} +4 -1
- package/dist/chunk-MMVHOUM4.js +24 -0
- package/dist/chunk-PDUVTYC5.js +992 -0
- package/dist/{chunk-FI63YKK5.js → chunk-Y7XV5QL2.js} +3564 -3549
- package/dist/cli.js +1174 -21
- package/dist/from-change-DQK2Jm9R.d.ts +327 -0
- package/dist/index-CtDBo8Se.d.ts +690 -0
- package/dist/index.d.ts +18 -1113
- package/dist/index.js +33 -41
- package/dist/linter/index.d.ts +126 -0
- package/dist/linter/index.js +36 -0
- package/dist/{types-B9rJ1z3H.d.ts → maintenance-view-adapter-D5t9taTE.d.ts} +304 -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 -3
- package/docs/doc-sample.md +263 -0
- package/docs/docs-generation.md +183 -0
- package/package.json +49 -3
package/README.md
CHANGED
|
@@ -21,6 +21,8 @@ TypeScript types.
|
|
|
21
21
|
- ✅ **CDC emulator** —— drive and test change events equivalent to DynamoDB Streams locally.
|
|
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
|
+
- ✅ **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.
|
|
24
26
|
|
|
25
27
|
## 🤔 Philosophy
|
|
26
28
|
|
|
@@ -213,6 +215,11 @@ Each capability is summarized here only. For details, operator lists, and proced
|
|
|
213
215
|
- **CloudFormation generation** —— `graphddb generate cloudformation` emits a CloudFormation template for
|
|
214
216
|
the DynamoDB table(s) a model set maps onto (GSI union / Streams / TTL / PITR / PROVISIONED / Auto
|
|
215
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).
|
|
216
223
|
|
|
217
224
|
## 📚 Documentation
|
|
218
225
|
|
|
@@ -233,6 +240,7 @@ documentation available offline at hand. On GitHub, follow the links in the tabl
|
|
|
233
240
|
| [CDC emulator](./docs/cdc-emulator.md) | A change-event emulator for differential aggregation patterns (dev/test). |
|
|
234
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). |
|
|
235
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`. |
|
|
236
244
|
| [Benchmark](./benchmark/RESULTS.md) | Library comparison against hand-written AWS SDK, ElectroDB, DynamoDB Toolbox, and OneTable. |
|
|
237
245
|
|
|
238
246
|
## 💡 Examples
|
|
@@ -262,6 +270,8 @@ flowchart LR
|
|
|
262
270
|
M["TS Model (SSoT)"] --> RT["Runtime (TS)"]
|
|
263
271
|
M --> PY["Python client + runtime"]
|
|
264
272
|
M --> CQ["CQRS Contract"]
|
|
273
|
+
M --> CFN["CloudFormation template"]
|
|
274
|
+
M --> DOC["Model docs (Markdown + Mermaid)"]
|
|
265
275
|
```
|
|
266
276
|
|
|
267
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-DQK2Jm9R.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-D5t9taTE.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-M6URQOAW.js";
|
|
12
|
+
import {
|
|
13
|
+
buildSubscribeHandler,
|
|
14
|
+
parseChange
|
|
15
|
+
} from "../chunk-CCIVET5K.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
|
+
};
|