arkgate 2.8.0 → 2.8.1
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/CHANGELOG.md +18 -0
- package/README.md +8 -0
- package/dist/index.cjs +417 -338
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -9
- package/dist/index.d.ts +29 -9
- package/dist/index.js +417 -338
- package/dist/index.js.map +1 -1
- package/dist/nestjs/index.cjs +452 -373
- package/dist/nestjs/index.cjs.map +1 -1
- package/dist/nestjs/index.d.cts +1 -1
- package/dist/nestjs/index.d.ts +1 -1
- package/dist/nestjs/index.js +452 -373
- package/dist/nestjs/index.js.map +1 -1
- package/dist/runtime/index.cjs +417 -338
- package/dist/runtime/index.cjs.map +1 -1
- package/dist/runtime/index.d.cts +1 -1
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.js +417 -338
- package/dist/runtime/index.js.map +1 -1
- package/dist/{types-CP3KkwZt.d.cts → types-CSJhEOk2.d.cts} +34 -0
- package/dist/{types-CP3KkwZt.d.ts → types-CSJhEOk2.d.ts} +34 -0
- package/docs/package-surface.md +1 -1
- package/docs/production-hardening.md +11 -4
- package/package.json +1 -1
- package/server.json +2 -2
|
@@ -412,17 +412,29 @@ interface AuditQuery {
|
|
|
412
412
|
until?: string;
|
|
413
413
|
limit?: number;
|
|
414
414
|
}
|
|
415
|
+
/**
|
|
416
|
+
* Pluggable persistence for audit records.
|
|
417
|
+
*
|
|
418
|
+
* **Durability stance (R9):** Default is `InMemoryAuditStore` — reference only, not
|
|
419
|
+
* production durability (lost on restart). Implement this interface for durable audit.
|
|
420
|
+
* See `docs/production-hardening.md`.
|
|
421
|
+
*/
|
|
415
422
|
interface AuditStore {
|
|
416
423
|
append(record: AuditRecord): MaybePromise<void>;
|
|
417
424
|
query(query?: AuditQuery): MaybePromise<AuditRecord[]>;
|
|
418
425
|
clear(): MaybePromise<void>;
|
|
419
426
|
}
|
|
427
|
+
/**
|
|
428
|
+
* High-level audit API used by the event bus / kernel.
|
|
429
|
+
* Durability is that of the injected `AuditStore` (default in-memory).
|
|
430
|
+
*/
|
|
420
431
|
interface AuditTrail {
|
|
421
432
|
record(input: AuditRecordInput): Promise<AuditRecord>;
|
|
422
433
|
query(query?: AuditQuery): Promise<AuditRecord[]>;
|
|
423
434
|
clear(): Promise<void>;
|
|
424
435
|
}
|
|
425
436
|
interface CreateAuditTrailOptions {
|
|
437
|
+
/** Durable store when provided; otherwise `InMemoryAuditStore` (not production durability). */
|
|
426
438
|
store?: AuditStore;
|
|
427
439
|
maxRecords?: number;
|
|
428
440
|
}
|
|
@@ -512,6 +524,14 @@ interface OutboxRecord {
|
|
|
512
524
|
updatedAt: string;
|
|
513
525
|
error?: string;
|
|
514
526
|
}
|
|
527
|
+
/**
|
|
528
|
+
* Pluggable outbox for publish handoff.
|
|
529
|
+
*
|
|
530
|
+
* **Durability stance (R9):** ArkGate ships only a reference in-process store
|
|
531
|
+
* (`InMemoryOutboxStore`) for tests, demos, and single-process development — it does
|
|
532
|
+
* not survive process restarts and is **not production durability**. Inject your own
|
|
533
|
+
* `OutboxStore` (DB, queue, etc.) for real systems. See `docs/production-hardening.md`.
|
|
534
|
+
*/
|
|
515
535
|
interface OutboxStore {
|
|
516
536
|
enqueue(event: DomainEvent): Promise<OutboxRecord>;
|
|
517
537
|
markDispatched(id: string): Promise<void>;
|
|
@@ -807,6 +827,13 @@ interface ProjectionCheckpoint {
|
|
|
807
827
|
lastCorrelationId?: string;
|
|
808
828
|
updatedAt?: string;
|
|
809
829
|
}
|
|
830
|
+
/**
|
|
831
|
+
* Pluggable projection/read-model state.
|
|
832
|
+
*
|
|
833
|
+
* **Durability stance (R9):** Default `InMemoryReadModelStore` is reference-only (not
|
|
834
|
+
* production durability). Inject a durable store for production. See
|
|
835
|
+
* `docs/production-hardening.md`.
|
|
836
|
+
*/
|
|
810
837
|
interface ReadModelStore {
|
|
811
838
|
load<State = unknown>(name: string): MaybePromise<State | undefined>;
|
|
812
839
|
save<State = unknown>(name: string, state: State): MaybePromise<void>;
|
|
@@ -933,6 +960,13 @@ interface WorkflowSnapshot<P extends SagaContext = SagaContext> {
|
|
|
933
960
|
completedAt?: string;
|
|
934
961
|
error?: string;
|
|
935
962
|
}
|
|
963
|
+
/**
|
|
964
|
+
* Pluggable saga/workflow snapshot store.
|
|
965
|
+
*
|
|
966
|
+
* **Durability stance (R9):** Default `InMemoryWorkflowStore` is reference-only (not
|
|
967
|
+
* production durability). Inject a durable store for production. See
|
|
968
|
+
* `docs/production-hardening.md`.
|
|
969
|
+
*/
|
|
936
970
|
interface WorkflowStore {
|
|
937
971
|
save<P extends SagaContext>(snapshot: WorkflowSnapshot<P>): MaybePromise<void>;
|
|
938
972
|
get<P extends SagaContext = SagaContext>(id: string): MaybePromise<WorkflowSnapshot<P> | undefined>;
|
|
@@ -412,17 +412,29 @@ interface AuditQuery {
|
|
|
412
412
|
until?: string;
|
|
413
413
|
limit?: number;
|
|
414
414
|
}
|
|
415
|
+
/**
|
|
416
|
+
* Pluggable persistence for audit records.
|
|
417
|
+
*
|
|
418
|
+
* **Durability stance (R9):** Default is `InMemoryAuditStore` — reference only, not
|
|
419
|
+
* production durability (lost on restart). Implement this interface for durable audit.
|
|
420
|
+
* See `docs/production-hardening.md`.
|
|
421
|
+
*/
|
|
415
422
|
interface AuditStore {
|
|
416
423
|
append(record: AuditRecord): MaybePromise<void>;
|
|
417
424
|
query(query?: AuditQuery): MaybePromise<AuditRecord[]>;
|
|
418
425
|
clear(): MaybePromise<void>;
|
|
419
426
|
}
|
|
427
|
+
/**
|
|
428
|
+
* High-level audit API used by the event bus / kernel.
|
|
429
|
+
* Durability is that of the injected `AuditStore` (default in-memory).
|
|
430
|
+
*/
|
|
420
431
|
interface AuditTrail {
|
|
421
432
|
record(input: AuditRecordInput): Promise<AuditRecord>;
|
|
422
433
|
query(query?: AuditQuery): Promise<AuditRecord[]>;
|
|
423
434
|
clear(): Promise<void>;
|
|
424
435
|
}
|
|
425
436
|
interface CreateAuditTrailOptions {
|
|
437
|
+
/** Durable store when provided; otherwise `InMemoryAuditStore` (not production durability). */
|
|
426
438
|
store?: AuditStore;
|
|
427
439
|
maxRecords?: number;
|
|
428
440
|
}
|
|
@@ -512,6 +524,14 @@ interface OutboxRecord {
|
|
|
512
524
|
updatedAt: string;
|
|
513
525
|
error?: string;
|
|
514
526
|
}
|
|
527
|
+
/**
|
|
528
|
+
* Pluggable outbox for publish handoff.
|
|
529
|
+
*
|
|
530
|
+
* **Durability stance (R9):** ArkGate ships only a reference in-process store
|
|
531
|
+
* (`InMemoryOutboxStore`) for tests, demos, and single-process development — it does
|
|
532
|
+
* not survive process restarts and is **not production durability**. Inject your own
|
|
533
|
+
* `OutboxStore` (DB, queue, etc.) for real systems. See `docs/production-hardening.md`.
|
|
534
|
+
*/
|
|
515
535
|
interface OutboxStore {
|
|
516
536
|
enqueue(event: DomainEvent): Promise<OutboxRecord>;
|
|
517
537
|
markDispatched(id: string): Promise<void>;
|
|
@@ -807,6 +827,13 @@ interface ProjectionCheckpoint {
|
|
|
807
827
|
lastCorrelationId?: string;
|
|
808
828
|
updatedAt?: string;
|
|
809
829
|
}
|
|
830
|
+
/**
|
|
831
|
+
* Pluggable projection/read-model state.
|
|
832
|
+
*
|
|
833
|
+
* **Durability stance (R9):** Default `InMemoryReadModelStore` is reference-only (not
|
|
834
|
+
* production durability). Inject a durable store for production. See
|
|
835
|
+
* `docs/production-hardening.md`.
|
|
836
|
+
*/
|
|
810
837
|
interface ReadModelStore {
|
|
811
838
|
load<State = unknown>(name: string): MaybePromise<State | undefined>;
|
|
812
839
|
save<State = unknown>(name: string, state: State): MaybePromise<void>;
|
|
@@ -933,6 +960,13 @@ interface WorkflowSnapshot<P extends SagaContext = SagaContext> {
|
|
|
933
960
|
completedAt?: string;
|
|
934
961
|
error?: string;
|
|
935
962
|
}
|
|
963
|
+
/**
|
|
964
|
+
* Pluggable saga/workflow snapshot store.
|
|
965
|
+
*
|
|
966
|
+
* **Durability stance (R9):** Default `InMemoryWorkflowStore` is reference-only (not
|
|
967
|
+
* production durability). Inject a durable store for production. See
|
|
968
|
+
* `docs/production-hardening.md`.
|
|
969
|
+
*/
|
|
936
970
|
interface WorkflowStore {
|
|
937
971
|
save<P extends SagaContext>(snapshot: WorkflowSnapshot<P>): MaybePromise<void>;
|
|
938
972
|
get<P extends SagaContext = SagaContext>(id: string): MaybePromise<WorkflowSnapshot<P> | undefined>;
|
package/docs/package-surface.md
CHANGED
|
@@ -26,7 +26,7 @@ Gates need **no application code imports**. Most projects only use the CLI + MCP
|
|
|
26
26
|
|
|
27
27
|
| Surface | Import path | Notes |
|
|
28
28
|
|---------|-------------|--------|
|
|
29
|
-
| **Runtime kernel** | **`arkgate/runtime`** (preferred) | Event bus, intents, policies, sagas, outbox, projections, `createArkKernel` / strict helpers. Optional. Not required for architecture enforcement. |
|
|
29
|
+
| **Runtime kernel** | **`arkgate/runtime`** (preferred) | Event bus, intents, policies, sagas, outbox, projections, `createArkKernel` / strict helpers. Optional. Not required for architecture enforcement. Built-in stores are **InMemory reference only** (not production durability) — see [production-hardening.md](./production-hardening.md). |
|
|
30
30
|
| **Root package barrel** | `arkgate` | Still re-exports the runtime kernel for **compatibility**. Prefer `arkgate/runtime` for new code. Root may be thinned in a future **major**. |
|
|
31
31
|
| **NestJS adapter** | `arkgate/nestjs` | Optional peer `@nestjs/common`. Wires a kernel into Nest DI. |
|
|
32
32
|
|
|
@@ -3,11 +3,17 @@
|
|
|
3
3
|
The optional runtime kernel is imported from **`arkgate/runtime`** (preferred). See
|
|
4
4
|
[package-surface.md](package-surface.md).
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
## Durability stance (R9)
|
|
7
|
+
|
|
8
|
+
**ArkGate does not ship production-durable adapters.** Built-in stores are **reference
|
|
9
|
+
InMemory-only** — appropriate for tests, local development, examples, and single-process
|
|
10
|
+
demos. They lose all state on process restart. Production systems **must** inject their
|
|
11
|
+
own implementations of the store interfaces (or accept that data is ephemeral).
|
|
12
|
+
|
|
13
|
+
Ark's built-in stores are intentionally in-memory defaults. Production systems should provide
|
|
8
14
|
stores that match their durability, ordering, retention, and operational requirements.
|
|
9
15
|
|
|
10
|
-
## In-Memory Defaults
|
|
16
|
+
## In-Memory Defaults (reference only — not production durability)
|
|
11
17
|
|
|
12
18
|
These defaults do not survive process restarts:
|
|
13
19
|
|
|
@@ -16,7 +22,8 @@ These defaults do not survive process restarts:
|
|
|
16
22
|
- `InMemoryReadModelStore`
|
|
17
23
|
- `InMemoryWorkflowStore`
|
|
18
24
|
|
|
19
|
-
Use them only when losing state is acceptable.
|
|
25
|
+
Use them only when losing state is acceptable. JSDoc on `OutboxStore`, `AuditStore`,
|
|
26
|
+
`ReadModelStore`, and `WorkflowStore` restates this stance at the type level.
|
|
20
27
|
|
|
21
28
|
## Production Store Checklist
|
|
22
29
|
|
package/package.json
CHANGED
package/server.json
CHANGED
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
"url": "https://github.com/pedroknigge/arkgate",
|
|
7
7
|
"source": "github"
|
|
8
8
|
},
|
|
9
|
-
"version": "2.8.
|
|
9
|
+
"version": "2.8.1",
|
|
10
10
|
"packages": [
|
|
11
11
|
{
|
|
12
12
|
"registryType": "npm",
|
|
13
13
|
"identifier": "arkgate",
|
|
14
|
-
"version": "2.8.
|
|
14
|
+
"version": "2.8.1",
|
|
15
15
|
"runtimeHint": "npx",
|
|
16
16
|
"transport": {
|
|
17
17
|
"type": "stdio"
|