@smthrs/journal 0.0.0-stage → 1.0.0-rc.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/CHANGELOG.md +149 -0
- package/LICENSE +21 -0
- package/README.md +206 -2
- package/dist/cjs/CallFact.d.ts +129 -0
- package/dist/cjs/CallFact.d.ts.map +1 -0
- package/dist/cjs/CallFact.js +106 -0
- package/dist/cjs/CallFact.js.map +7 -0
- package/dist/cjs/Consensus.d.ts +440 -0
- package/dist/cjs/Consensus.d.ts.map +1 -0
- package/dist/cjs/Consensus.js +251 -0
- package/dist/cjs/Consensus.js.map +7 -0
- package/dist/cjs/EngineEvent.d.ts +890 -0
- package/dist/cjs/EngineEvent.d.ts.map +1 -0
- package/dist/cjs/EngineEvent.js +383 -0
- package/dist/cjs/EngineEvent.js.map +7 -0
- package/dist/cjs/ExecutionFact.d.ts +216 -0
- package/dist/cjs/ExecutionFact.d.ts.map +1 -0
- package/dist/cjs/ExecutionFact.js +303 -0
- package/dist/cjs/ExecutionFact.js.map +7 -0
- package/dist/cjs/Journal.d.ts +617 -0
- package/dist/cjs/Journal.d.ts.map +1 -0
- package/dist/cjs/Journal.js +190 -0
- package/dist/cjs/Journal.js.map +7 -0
- package/dist/cjs/JournalEvent.d.ts +421 -0
- package/dist/cjs/JournalEvent.d.ts.map +1 -0
- package/dist/cjs/JournalEvent.js +281 -0
- package/dist/cjs/JournalEvent.js.map +7 -0
- package/dist/cjs/JournalGeneration.d.ts +34 -0
- package/dist/cjs/JournalGeneration.d.ts.map +1 -0
- package/dist/cjs/JournalGeneration.js +72 -0
- package/dist/cjs/JournalGeneration.js.map +7 -0
- package/dist/cjs/JournalMetrics.d.ts +72 -0
- package/dist/cjs/JournalMetrics.d.ts.map +1 -0
- package/dist/cjs/JournalMetrics.js +55 -0
- package/dist/cjs/JournalMetrics.js.map +7 -0
- package/dist/cjs/Migrations.d.ts +42 -0
- package/dist/cjs/Migrations.d.ts.map +1 -0
- package/dist/cjs/Migrations.js +58 -0
- package/dist/cjs/Migrations.js.map +7 -0
- package/dist/cjs/OwnerId.d.ts +40 -0
- package/dist/cjs/OwnerId.d.ts.map +1 -0
- package/dist/cjs/OwnerId.js +40 -0
- package/dist/cjs/OwnerId.js.map +7 -0
- package/dist/cjs/Projection.d.ts +29 -0
- package/dist/cjs/Projection.d.ts.map +1 -0
- package/dist/cjs/Projection.js +25 -0
- package/dist/cjs/Projection.js.map +7 -0
- package/dist/cjs/RedactedLogger.d.ts +121 -0
- package/dist/cjs/RedactedLogger.d.ts.map +1 -0
- package/dist/cjs/RedactedLogger.js +235 -0
- package/dist/cjs/RedactedLogger.js.map +7 -0
- package/dist/cjs/Redaction.d.ts +350 -0
- package/dist/cjs/Redaction.d.ts.map +1 -0
- package/dist/cjs/Redaction.js +928 -0
- package/dist/cjs/Redaction.js.map +7 -0
- package/dist/cjs/SqlConsensus.d.ts +44 -0
- package/dist/cjs/SqlConsensus.d.ts.map +1 -0
- package/dist/cjs/SqlConsensus.js +243 -0
- package/dist/cjs/SqlConsensus.js.map +7 -0
- package/dist/cjs/SqlJournal.d.ts +173 -0
- package/dist/cjs/SqlJournal.d.ts.map +1 -0
- package/dist/cjs/SqlJournal.js +1568 -0
- package/dist/cjs/SqlJournal.js.map +7 -0
- package/dist/cjs/StepFact.d.ts +66 -0
- package/dist/cjs/StepFact.d.ts.map +1 -0
- package/dist/cjs/StepFact.js +68 -0
- package/dist/cjs/StepFact.js.map +7 -0
- package/dist/cjs/index.d.ts +95 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +63 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/internal/JournalInternalFault.d.ts +37 -0
- package/dist/cjs/internal/JournalInternalFault.d.ts.map +1 -0
- package/dist/cjs/internal/JournalInternalFault.js +43 -0
- package/dist/cjs/internal/JournalInternalFault.js.map +7 -0
- package/dist/cjs/migrations/0001_initial.d.ts +15 -0
- package/dist/cjs/migrations/0001_initial.d.ts.map +1 -0
- package/dist/cjs/migrations/0001_initial.js +54 -0
- package/dist/cjs/migrations/0001_initial.js.map +7 -0
- package/dist/cjs/migrations/0002_checkpoints.d.ts +27 -0
- package/dist/cjs/migrations/0002_checkpoints.d.ts.map +1 -0
- package/dist/cjs/migrations/0002_checkpoints.js +48 -0
- package/dist/cjs/migrations/0002_checkpoints.js.map +7 -0
- package/dist/cjs/migrations/0003_startup_index.d.ts +15 -0
- package/dist/cjs/migrations/0003_startup_index.d.ts.map +1 -0
- package/dist/cjs/migrations/0003_startup_index.js +40 -0
- package/dist/cjs/migrations/0003_startup_index.js.map +7 -0
- package/dist/cjs/migrations/0004_dedup.d.ts +15 -0
- package/dist/cjs/migrations/0004_dedup.d.ts.map +1 -0
- package/dist/cjs/migrations/0004_dedup.js +57 -0
- package/dist/cjs/migrations/0004_dedup.js.map +7 -0
- package/dist/cjs/migrations/0005_run_event_type.d.ts +15 -0
- package/dist/cjs/migrations/0005_run_event_type.d.ts.map +1 -0
- package/dist/cjs/migrations/0005_run_event_type.js +40 -0
- package/dist/cjs/migrations/0005_run_event_type.js.map +7 -0
- package/dist/cjs/migrations/0006_consensus.d.ts +22 -0
- package/dist/cjs/migrations/0006_consensus.d.ts.map +1 -0
- package/dist/cjs/migrations/0006_consensus.js +84 -0
- package/dist/cjs/migrations/0006_consensus.js.map +7 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/test/Notifying.d.ts +65 -0
- package/dist/cjs/test/Notifying.d.ts.map +1 -0
- package/dist/cjs/test/Notifying.js +62 -0
- package/dist/cjs/test/Notifying.js.map +7 -0
- package/dist/cjs/test/TestJournal.d.ts +43 -0
- package/dist/cjs/test/TestJournal.d.ts.map +1 -0
- package/dist/cjs/test/TestJournal.js +43 -0
- package/dist/cjs/test/TestJournal.js.map +7 -0
- package/dist/esm/CallFact.d.ts +129 -0
- package/dist/esm/CallFact.d.ts.map +1 -0
- package/dist/esm/CallFact.js +96 -0
- package/dist/esm/CallFact.js.map +1 -0
- package/dist/esm/Consensus.d.ts +440 -0
- package/dist/esm/Consensus.d.ts.map +1 -0
- package/dist/esm/Consensus.js +454 -0
- package/dist/esm/Consensus.js.map +1 -0
- package/dist/esm/EngineEvent.d.ts +890 -0
- package/dist/esm/EngineEvent.d.ts.map +1 -0
- package/dist/esm/EngineEvent.js +614 -0
- package/dist/esm/EngineEvent.js.map +1 -0
- package/dist/esm/ExecutionFact.d.ts +216 -0
- package/dist/esm/ExecutionFact.d.ts.map +1 -0
- package/dist/esm/ExecutionFact.js +374 -0
- package/dist/esm/ExecutionFact.js.map +1 -0
- package/dist/esm/Journal.d.ts +617 -0
- package/dist/esm/Journal.d.ts.map +1 -0
- package/dist/esm/Journal.js +323 -0
- package/dist/esm/Journal.js.map +1 -0
- package/dist/esm/JournalEvent.d.ts +421 -0
- package/dist/esm/JournalEvent.d.ts.map +1 -0
- package/dist/esm/JournalEvent.js +517 -0
- package/dist/esm/JournalEvent.js.map +1 -0
- package/dist/esm/JournalGeneration.d.ts +34 -0
- package/dist/esm/JournalGeneration.d.ts.map +1 -0
- package/dist/esm/JournalGeneration.js +65 -0
- package/dist/esm/JournalGeneration.js.map +1 -0
- package/dist/esm/JournalMetrics.d.ts +72 -0
- package/dist/esm/JournalMetrics.d.ts.map +1 -0
- package/dist/esm/JournalMetrics.js +79 -0
- package/dist/esm/JournalMetrics.js.map +1 -0
- package/dist/esm/Migrations.d.ts +42 -0
- package/dist/esm/Migrations.d.ts.map +1 -0
- package/dist/esm/Migrations.js +59 -0
- package/dist/esm/Migrations.js.map +1 -0
- package/dist/esm/OwnerId.d.ts +40 -0
- package/dist/esm/OwnerId.d.ts.map +1 -0
- package/dist/esm/OwnerId.js +33 -0
- package/dist/esm/OwnerId.js.map +1 -0
- package/dist/esm/Projection.d.ts +29 -0
- package/dist/esm/Projection.d.ts.map +1 -0
- package/dist/esm/Projection.js +13 -0
- package/dist/esm/Projection.js.map +1 -0
- package/dist/esm/RedactedLogger.d.ts +121 -0
- package/dist/esm/RedactedLogger.d.ts.map +1 -0
- package/dist/esm/RedactedLogger.js +445 -0
- package/dist/esm/RedactedLogger.js.map +1 -0
- package/dist/esm/Redaction.d.ts +350 -0
- package/dist/esm/Redaction.d.ts.map +1 -0
- package/dist/esm/Redaction.js +1584 -0
- package/dist/esm/Redaction.js.map +1 -0
- package/dist/esm/SqlConsensus.d.ts +44 -0
- package/dist/esm/SqlConsensus.d.ts.map +1 -0
- package/dist/esm/SqlConsensus.js +252 -0
- package/dist/esm/SqlConsensus.js.map +1 -0
- package/dist/esm/SqlJournal.d.ts +173 -0
- package/dist/esm/SqlJournal.d.ts.map +1 -0
- package/dist/esm/SqlJournal.js +1858 -0
- package/dist/esm/SqlJournal.js.map +1 -0
- package/dist/esm/StepFact.d.ts +66 -0
- package/dist/esm/StepFact.d.ts.map +1 -0
- package/dist/esm/StepFact.js +50 -0
- package/dist/esm/StepFact.js.map +1 -0
- package/dist/esm/index.d.ts +95 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +95 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/internal/JournalInternalFault.d.ts +37 -0
- package/dist/esm/internal/JournalInternalFault.d.ts.map +1 -0
- package/dist/esm/internal/JournalInternalFault.js +28 -0
- package/dist/esm/internal/JournalInternalFault.js.map +1 -0
- package/dist/esm/migrations/0001_initial.d.ts +15 -0
- package/dist/esm/migrations/0001_initial.d.ts.map +1 -0
- package/dist/esm/migrations/0001_initial.js +32 -0
- package/dist/esm/migrations/0001_initial.js.map +1 -0
- package/dist/esm/migrations/0002_checkpoints.d.ts +27 -0
- package/dist/esm/migrations/0002_checkpoints.d.ts.map +1 -0
- package/dist/esm/migrations/0002_checkpoints.js +38 -0
- package/dist/esm/migrations/0002_checkpoints.js.map +1 -0
- package/dist/esm/migrations/0003_startup_index.d.ts +15 -0
- package/dist/esm/migrations/0003_startup_index.d.ts.map +1 -0
- package/dist/esm/migrations/0003_startup_index.js +18 -0
- package/dist/esm/migrations/0003_startup_index.js.map +1 -0
- package/dist/esm/migrations/0004_dedup.d.ts +15 -0
- package/dist/esm/migrations/0004_dedup.d.ts.map +1 -0
- package/dist/esm/migrations/0004_dedup.js +38 -0
- package/dist/esm/migrations/0004_dedup.js.map +1 -0
- package/dist/esm/migrations/0005_run_event_type.d.ts +15 -0
- package/dist/esm/migrations/0005_run_event_type.d.ts.map +1 -0
- package/dist/esm/migrations/0005_run_event_type.js +18 -0
- package/dist/esm/migrations/0005_run_event_type.js.map +1 -0
- package/dist/esm/migrations/0006_consensus.d.ts +22 -0
- package/dist/esm/migrations/0006_consensus.d.ts.map +1 -0
- package/dist/esm/migrations/0006_consensus.js +69 -0
- package/dist/esm/migrations/0006_consensus.js.map +1 -0
- package/dist/esm/test/Notifying.d.ts +65 -0
- package/dist/esm/test/Notifying.d.ts.map +1 -0
- package/dist/esm/test/Notifying.js +62 -0
- package/dist/esm/test/Notifying.js.map +1 -0
- package/dist/esm/test/TestJournal.d.ts +43 -0
- package/dist/esm/test/TestJournal.d.ts.map +1 -0
- package/dist/esm/test/TestJournal.js +27 -0
- package/dist/esm/test/TestJournal.js.map +1 -0
- package/docs/README.md +164 -0
- package/docs/api.md +639 -0
- package/docs/concepts/compaction.md +157 -0
- package/docs/concepts/idempotency.md +127 -0
- package/docs/concepts/owner-fence.md +124 -0
- package/docs/concepts/redaction.md +218 -0
- package/docs/concepts/state-event-authority.md +159 -0
- package/docs/concepts/two-channels.md +167 -0
- package/docs/guides/commit-state-and-entry.md +114 -0
- package/docs/guides/compact-a-run.md +134 -0
- package/docs/guides/fold-a-projection.md +106 -0
- package/docs/guides/read-a-run.md +139 -0
- package/docs/guides/redact-log-output.md +94 -0
- package/docs/guides/testing.md +124 -0
- package/docs/guides/write-lifecycle-events.md +110 -0
- package/docs/installation.md +133 -0
- package/docs/quickstart.md +143 -0
- package/docs/troubleshooting.md +214 -0
- package/package.json +263 -3
- package/src/CallFact.ts +117 -0
- package/src/Consensus.ts +683 -0
- package/src/EngineEvent.ts +823 -0
- package/src/ExecutionFact.ts +433 -0
- package/src/Journal.ts +688 -0
- package/src/JournalEvent.ts +654 -0
- package/src/JournalGeneration.ts +77 -0
- package/src/JournalMetrics.ts +89 -0
- package/src/Migrations.ts +62 -0
- package/src/OwnerId.ts +42 -0
- package/src/Projection.ts +31 -0
- package/src/RedactedLogger.ts +483 -0
- package/src/Redaction.ts +1784 -0
- package/src/SqlConsensus.ts +344 -0
- package/src/SqlJournal.ts +2732 -0
- package/src/StepFact.ts +69 -0
- package/src/index.ts +109 -0
- package/src/internal/JournalInternalFault.ts +40 -0
- package/src/migrations/0001_initial.ts +41 -0
- package/src/migrations/0002_checkpoints.ts +46 -0
- package/src/migrations/0003_startup_index.ts +19 -0
- package/src/migrations/0004_dedup.ts +43 -0
- package/src/migrations/0005_run_event_type.ts +19 -0
- package/src/migrations/0006_consensus.ts +83 -0
- package/src/test/Notifying.ts +101 -0
- package/src/test/TestJournal.ts +52 -0
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Durable event-envelope schemas for the journal.
|
|
3
|
+
*
|
|
4
|
+
* @since 0.1.0
|
|
5
|
+
*/
|
|
6
|
+
import * as Schema from "effect/Schema";
|
|
7
|
+
/**
|
|
8
|
+
* Longest identifier the journal persists.
|
|
9
|
+
*
|
|
10
|
+
* A run id, a source id and an event type are index columns of a permanent
|
|
11
|
+
* table and are held in per-run maps for the layer's lifetime, so an
|
|
12
|
+
* unbounded one costs durable index space and heap that nothing ever
|
|
13
|
+
* reclaims. Every identifier this repository mints is a uuid or a short
|
|
14
|
+
* dotted name, two orders of magnitude below this bound, so the ceiling
|
|
15
|
+
* refuses only the shapes that were never identifiers.
|
|
16
|
+
*
|
|
17
|
+
* @since 1.0.0
|
|
18
|
+
* @category constants
|
|
19
|
+
*/
|
|
20
|
+
export declare const maxIdentifierLength = 1024;
|
|
21
|
+
/**
|
|
22
|
+
* Schema for an identifier of one durable run.
|
|
23
|
+
*
|
|
24
|
+
* Between 1 and 1,024 UTF-16 code units, free of unpaired UTF-16 surrogates
|
|
25
|
+
* because the store cannot tell two ill-formed identifiers apart, and free of
|
|
26
|
+
* NUL because the store's own length check cannot see past one.
|
|
27
|
+
*
|
|
28
|
+
* @category schemas
|
|
29
|
+
* @since 0.1.0
|
|
30
|
+
*/
|
|
31
|
+
export declare const RunId: Schema.brand<Schema.String, "@smthrs/journal/JournalEvent/RunId">;
|
|
32
|
+
/**
|
|
33
|
+
* Branded identifier of one durable run.
|
|
34
|
+
*
|
|
35
|
+
* @category models
|
|
36
|
+
* @since 0.1.0
|
|
37
|
+
*/
|
|
38
|
+
export type RunId = typeof RunId.Type;
|
|
39
|
+
/**
|
|
40
|
+
* Schema for the canonical, durable sequence number within a run.
|
|
41
|
+
*
|
|
42
|
+
* `Number.MAX_SAFE_INTEGER` is excluded because the journal must always be
|
|
43
|
+
* able to allocate the next sequence. `Number.MAX_SAFE_INTEGER + 1` is not a
|
|
44
|
+
* distinct integer, so the maximum is not an allocatable sequence.
|
|
45
|
+
*
|
|
46
|
+
* @category schemas
|
|
47
|
+
* @since 0.1.0
|
|
48
|
+
*/
|
|
49
|
+
export declare const Seq: Schema.brand<Schema.Int, "@smthrs/journal/JournalEvent/Seq">;
|
|
50
|
+
/**
|
|
51
|
+
* Canonical durable per-run sequence number.
|
|
52
|
+
*
|
|
53
|
+
* @category models
|
|
54
|
+
* @since 0.1.0
|
|
55
|
+
*/
|
|
56
|
+
export type Seq = typeof Seq.Type;
|
|
57
|
+
/**
|
|
58
|
+
* Schema for an event producer identifier.
|
|
59
|
+
*
|
|
60
|
+
* The same shape `RunId` accepts, on the same terms: the pair identifies a
|
|
61
|
+
* producer's retries in the database.
|
|
62
|
+
*
|
|
63
|
+
* @category schemas
|
|
64
|
+
* @since 0.1.0
|
|
65
|
+
*/
|
|
66
|
+
export declare const SourceId: Schema.brand<Schema.String, "@smthrs/journal/JournalEvent/SourceId">;
|
|
67
|
+
/**
|
|
68
|
+
* Identifier of an event producer.
|
|
69
|
+
*
|
|
70
|
+
* @category models
|
|
71
|
+
* @since 0.1.0
|
|
72
|
+
*/
|
|
73
|
+
export type SourceId = typeof SourceId.Type;
|
|
74
|
+
/**
|
|
75
|
+
* Schema for a producer-local event sequence number.
|
|
76
|
+
*
|
|
77
|
+
* `Number.MAX_SAFE_INTEGER` is excluded because the journal must always be
|
|
78
|
+
* able to allocate the next sequence. `Number.MAX_SAFE_INTEGER + 1` is not a
|
|
79
|
+
* distinct integer, so the maximum is not an allocatable sequence.
|
|
80
|
+
*
|
|
81
|
+
* @category schemas
|
|
82
|
+
* @since 0.1.0
|
|
83
|
+
*/
|
|
84
|
+
export declare const SourceSeq: Schema.brand<Schema.Int, "@smthrs/journal/JournalEvent/SourceSeq">;
|
|
85
|
+
/**
|
|
86
|
+
* Producer-local event sequence number.
|
|
87
|
+
*
|
|
88
|
+
* @category models
|
|
89
|
+
* @since 0.1.0
|
|
90
|
+
*/
|
|
91
|
+
export type SourceSeq = typeof SourceSeq.Type;
|
|
92
|
+
/**
|
|
93
|
+
* Schema for what a re-emitted `(runId, sourceId, sourceSeq)` identity means.
|
|
94
|
+
*
|
|
95
|
+
* `content` is the default and the strict reading: the identity names one set
|
|
96
|
+
* of bytes, so a producer that re-emits it with different bytes has a bug and
|
|
97
|
+
* the journal says so with `idempotency_conflict`.
|
|
98
|
+
*
|
|
99
|
+
* `identity` is for a producer that derives the sequence from the event
|
|
100
|
+
* itself. There a collision IS the same event observed twice, and the bytes
|
|
101
|
+
* that differ between the two observations are metadata ABOUT the observation
|
|
102
|
+
* rather than the event: when a replayed frame was re-recorded, how long a
|
|
103
|
+
* step took the second time a durable engine served it from its record. The
|
|
104
|
+
* first admitted row stands and the re-emission settles as `Duplicate`. Only
|
|
105
|
+
* declare it with a sequence derived from the event's own content, because
|
|
106
|
+
* the journal then has nothing else with which to notice two different events
|
|
107
|
+
* wearing one identity.
|
|
108
|
+
*
|
|
109
|
+
* @category schemas
|
|
110
|
+
* @since 0.1.0
|
|
111
|
+
*/
|
|
112
|
+
export declare const Dedupe: Schema.Literals<readonly ["content", "identity"]>;
|
|
113
|
+
/**
|
|
114
|
+
* What a re-emitted producer identity means.
|
|
115
|
+
*
|
|
116
|
+
* @category models
|
|
117
|
+
* @since 0.1.0
|
|
118
|
+
*/
|
|
119
|
+
export type Dedupe = typeof Dedupe.Type;
|
|
120
|
+
declare const Input_base: Schema.Class<Input, Schema.Struct<{
|
|
121
|
+
readonly runId: Schema.brand<Schema.String, "@smthrs/journal/JournalEvent/RunId">;
|
|
122
|
+
readonly sourceId: Schema.brand<Schema.String, "@smthrs/journal/JournalEvent/SourceId">;
|
|
123
|
+
readonly sourceSeq: Schema.optional<Schema.brand<Schema.Int, "@smthrs/journal/JournalEvent/SourceSeq">>;
|
|
124
|
+
/** How a collision on this event's identity is settled. Defaults to `content`. */
|
|
125
|
+
readonly dedupe: Schema.optional<Schema.Literals<readonly ["content", "identity"]>>;
|
|
126
|
+
/** Non-empty, NUL-free, well-formed UTF-16 of at most 1,024 code units. */
|
|
127
|
+
readonly eventType: Schema.String;
|
|
128
|
+
readonly payload: Schema.Unknown;
|
|
129
|
+
readonly meta: Schema.optional<Schema.Unknown>;
|
|
130
|
+
}>, {}>;
|
|
131
|
+
/**
|
|
132
|
+
* Schema for an event submitted to the journal.
|
|
133
|
+
*
|
|
134
|
+
* Event types and values intentionally remain an open envelope. The durable
|
|
135
|
+
* core never closes this into an interpreter-specific union.
|
|
136
|
+
*
|
|
137
|
+
* @category schemas
|
|
138
|
+
* @since 0.1.0
|
|
139
|
+
*/
|
|
140
|
+
export declare class Input extends Input_base {
|
|
141
|
+
}
|
|
142
|
+
declare const Entry_base: Schema.Class<Entry, Schema.Struct<{
|
|
143
|
+
readonly runId: Schema.brand<Schema.String, "@smthrs/journal/JournalEvent/RunId">;
|
|
144
|
+
readonly seq: Schema.brand<Schema.Int, "@smthrs/journal/JournalEvent/Seq">;
|
|
145
|
+
/**
|
|
146
|
+
* Derived by {@link makeEventId} from the other three identity members, never
|
|
147
|
+
* supplied by a caller, so it carries no check of its own.
|
|
148
|
+
*/
|
|
149
|
+
readonly eventId: Schema.String;
|
|
150
|
+
readonly sourceId: Schema.brand<Schema.String, "@smthrs/journal/JournalEvent/SourceId">;
|
|
151
|
+
readonly sourceSeq: Schema.brand<Schema.Int, "@smthrs/journal/JournalEvent/SourceSeq">;
|
|
152
|
+
readonly emittedAtMs: Schema.Int;
|
|
153
|
+
/**
|
|
154
|
+
* The same bounded identifier `Input.eventType` accepts. It used to be a bare
|
|
155
|
+
* `Schema.String` here, so a consumer decoding an `Entry` accepted an empty,
|
|
156
|
+
* over-long, NUL-bearing, or ill-formed-UTF-16 event type that no emit could
|
|
157
|
+
* ever have produced.
|
|
158
|
+
*/
|
|
159
|
+
readonly eventType: Schema.String;
|
|
160
|
+
readonly payload: Schema.Unknown;
|
|
161
|
+
readonly meta: Schema.Unknown;
|
|
162
|
+
}>, {}>;
|
|
163
|
+
/**
|
|
164
|
+
* Schema for a committed durable journal row.
|
|
165
|
+
*
|
|
166
|
+
* `seq` is allocated synchronously at journal admission and is the only
|
|
167
|
+
* sequence used for replay and durable provenance. `sourceSeq` identifies
|
|
168
|
+
* retries from one producer.
|
|
169
|
+
*
|
|
170
|
+
* @category schemas
|
|
171
|
+
* @since 0.1.0
|
|
172
|
+
*/
|
|
173
|
+
export declare class Entry extends Entry_base {
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Makes a collision-free deterministic event identifier from the idempotency
|
|
177
|
+
* key `(runId, sourceId, sourceSeq)`.
|
|
178
|
+
*
|
|
179
|
+
* Length prefixes preserve tuple boundaries even when identifiers contain the
|
|
180
|
+
* separator. The value is deliberately not random: retrying the same source
|
|
181
|
+
* event must produce the same durable id.
|
|
182
|
+
*
|
|
183
|
+
* @category constructors
|
|
184
|
+
* @since 0.1.0
|
|
185
|
+
*/
|
|
186
|
+
export declare const makeEventId: (runId: RunId, sourceId: SourceId, sourceSeq: SourceSeq) => string;
|
|
187
|
+
/**
|
|
188
|
+
* The reserved prefix of every companion stream id.
|
|
189
|
+
*
|
|
190
|
+
* A run id that begins with it names a companion stream, never a run: stores
|
|
191
|
+
* that admit run ids (`@smthrs/run-store`'s `RunStore.create`) refuse it.
|
|
192
|
+
*
|
|
193
|
+
* @category constants
|
|
194
|
+
* @since 1.0.0
|
|
195
|
+
*/
|
|
196
|
+
export declare const companionPrefix = "flows.companion/";
|
|
197
|
+
/**
|
|
198
|
+
* The digest a journal fact uses to reference bytes kept outside the journal:
|
|
199
|
+
* the SHA-256 of the UTF-8 encoding of `text`, as 64 lowercase hex digits.
|
|
200
|
+
*
|
|
201
|
+
* The journal redacts every payload, so a fact never carries executable
|
|
202
|
+
* values. A store that folds state from its facts keeps the bytes in its own
|
|
203
|
+
* rows and records only their digest, which a rebuild checks the row against.
|
|
204
|
+
*
|
|
205
|
+
* @category constructors
|
|
206
|
+
* @since 1.0.0
|
|
207
|
+
*/
|
|
208
|
+
export declare const contentDigest: (text: string) => string;
|
|
209
|
+
/**
|
|
210
|
+
* The id of the companion stream that carries one store's facts about a run.
|
|
211
|
+
*
|
|
212
|
+
* A companion stream is an ordinary journal stream with its own sequence
|
|
213
|
+
* clock, kept beside the run's own stream rather than inside it. A consumer
|
|
214
|
+
* that reads the run's stream by position never sees a companion fact, and a
|
|
215
|
+
* rewind or compaction of the run's stream never truncates one. The id is
|
|
216
|
+
* `flows.companion/<stream>/<sha-256 of the run id>`, so it stays within
|
|
217
|
+
* {@link maxIdentifierLength} for every run id; each fact carries its run id
|
|
218
|
+
* in its payload.
|
|
219
|
+
*
|
|
220
|
+
* @category constructors
|
|
221
|
+
* @since 1.0.0
|
|
222
|
+
*/
|
|
223
|
+
export declare const companionRunId: (stream: string, runId: string) => RunId;
|
|
224
|
+
/**
|
|
225
|
+
* Whether a run id names a companion stream.
|
|
226
|
+
*
|
|
227
|
+
* @category predicates
|
|
228
|
+
* @since 1.0.0
|
|
229
|
+
*/
|
|
230
|
+
export declare const isCompanionRunId: (runId: string) => boolean;
|
|
231
|
+
/**
|
|
232
|
+
* Bounded durable text shared by namespace contracts.
|
|
233
|
+
*
|
|
234
|
+
* @category schemas
|
|
235
|
+
* @since 1.0.0
|
|
236
|
+
*/
|
|
237
|
+
export declare const Identifier: Schema.String;
|
|
238
|
+
/**
|
|
239
|
+
* A lineage coordinate, distinct from the run that currently hosts it.
|
|
240
|
+
*
|
|
241
|
+
* @category schemas
|
|
242
|
+
* @since 1.0.0
|
|
243
|
+
*/
|
|
244
|
+
export declare const LineageId: Schema.brand<Schema.String, "@smthrs/journal/LineageId">;
|
|
245
|
+
/**
|
|
246
|
+
* A lineage coordinate.
|
|
247
|
+
*
|
|
248
|
+
* @category models
|
|
249
|
+
* @since 1.0.0
|
|
250
|
+
*/
|
|
251
|
+
export type LineageId = typeof LineageId.Type;
|
|
252
|
+
/**
|
|
253
|
+
* A concrete wait identity.
|
|
254
|
+
*
|
|
255
|
+
* @category schemas
|
|
256
|
+
* @since 1.0.0
|
|
257
|
+
*/
|
|
258
|
+
export declare const WaitId: Schema.brand<Schema.String, "@smthrs/journal/WaitId">;
|
|
259
|
+
/**
|
|
260
|
+
* A concrete wait identity.
|
|
261
|
+
*
|
|
262
|
+
* @category models
|
|
263
|
+
* @since 1.0.0
|
|
264
|
+
*/
|
|
265
|
+
export type WaitId = typeof WaitId.Type;
|
|
266
|
+
/**
|
|
267
|
+
* An admitted command identity.
|
|
268
|
+
*
|
|
269
|
+
* @category schemas
|
|
270
|
+
* @since 1.0.0
|
|
271
|
+
*/
|
|
272
|
+
export declare const CommandId: Schema.brand<Schema.String, "@smthrs/journal/CommandId">;
|
|
273
|
+
/**
|
|
274
|
+
* An admitted command identity.
|
|
275
|
+
*
|
|
276
|
+
* @category models
|
|
277
|
+
* @since 1.0.0
|
|
278
|
+
*/
|
|
279
|
+
export type CommandId = typeof CommandId.Type;
|
|
280
|
+
/**
|
|
281
|
+
* A plan identity, never interchangeable with a dispatch or artifact.
|
|
282
|
+
*
|
|
283
|
+
* @category schemas
|
|
284
|
+
* @since 1.0.0
|
|
285
|
+
*/
|
|
286
|
+
export declare const PlanId: Schema.brand<Schema.String, "@smthrs/journal/PlanId">;
|
|
287
|
+
/**
|
|
288
|
+
* A plan identity.
|
|
289
|
+
*
|
|
290
|
+
* @category models
|
|
291
|
+
* @since 1.0.0
|
|
292
|
+
*/
|
|
293
|
+
export type PlanId = typeof PlanId.Type;
|
|
294
|
+
/**
|
|
295
|
+
* A dispatch identity. Branding does not verify its digest.
|
|
296
|
+
*
|
|
297
|
+
* @category schemas
|
|
298
|
+
* @since 1.0.0
|
|
299
|
+
*/
|
|
300
|
+
export declare const DispatchId: Schema.brand<Schema.String, "@smthrs/journal/DispatchId">;
|
|
301
|
+
/**
|
|
302
|
+
* A dispatch identity.
|
|
303
|
+
*
|
|
304
|
+
* @category models
|
|
305
|
+
* @since 1.0.0
|
|
306
|
+
*/
|
|
307
|
+
export type DispatchId = typeof DispatchId.Type;
|
|
308
|
+
/**
|
|
309
|
+
* An artifact identity. Branding does not verify content.
|
|
310
|
+
*
|
|
311
|
+
* @category schemas
|
|
312
|
+
* @since 1.0.0
|
|
313
|
+
*/
|
|
314
|
+
export declare const ArtifactId: Schema.brand<Schema.String, "@smthrs/journal/ArtifactId">;
|
|
315
|
+
/**
|
|
316
|
+
* An artifact identity.
|
|
317
|
+
*
|
|
318
|
+
* @category models
|
|
319
|
+
* @since 1.0.0
|
|
320
|
+
*/
|
|
321
|
+
export type ArtifactId = typeof ArtifactId.Type;
|
|
322
|
+
/**
|
|
323
|
+
* Integer quantities in the inclusive safe range, including zero.
|
|
324
|
+
*
|
|
325
|
+
* @category schemas
|
|
326
|
+
* @since 1.0.0
|
|
327
|
+
*/
|
|
328
|
+
export declare const NonNegativeQuantity: Schema.Int;
|
|
329
|
+
/**
|
|
330
|
+
* Integer quantities in the inclusive safe range, excluding zero.
|
|
331
|
+
*
|
|
332
|
+
* @category schemas
|
|
333
|
+
* @since 1.0.0
|
|
334
|
+
*/
|
|
335
|
+
export declare const PositiveQuantity: Schema.Int;
|
|
336
|
+
/**
|
|
337
|
+
* Non-negative integral milliseconds since the Unix epoch.
|
|
338
|
+
*
|
|
339
|
+
* @category schemas
|
|
340
|
+
* @since 1.0.0
|
|
341
|
+
*/
|
|
342
|
+
export declare const TimestampMs: Schema.brand<Schema.Int, "@smthrs/journal/TimestampMs">;
|
|
343
|
+
/**
|
|
344
|
+
* Non-negative integral milliseconds since the Unix epoch.
|
|
345
|
+
*
|
|
346
|
+
* @category models
|
|
347
|
+
* @since 1.0.0
|
|
348
|
+
*/
|
|
349
|
+
export type TimestampMs = typeof TimestampMs.Type;
|
|
350
|
+
/**
|
|
351
|
+
* Decode a run id without a cast; schema failures retain their issue.
|
|
352
|
+
*
|
|
353
|
+
* @category decoders
|
|
354
|
+
* @since 1.0.0
|
|
355
|
+
*/
|
|
356
|
+
export declare const decodeRunId: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => import("effect/Effect").Effect<string & import("effect/Brand").Brand<"@smthrs/journal/JournalEvent/RunId">, Schema.SchemaError, never>;
|
|
357
|
+
/**
|
|
358
|
+
* Decode a lineage id without a cast.
|
|
359
|
+
*
|
|
360
|
+
* @category decoders
|
|
361
|
+
* @since 1.0.0
|
|
362
|
+
*/
|
|
363
|
+
export declare const decodeLineageId: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => import("effect/Effect").Effect<string & import("effect/Brand").Brand<"@smthrs/journal/LineageId">, Schema.SchemaError, never>;
|
|
364
|
+
/**
|
|
365
|
+
* Decode a wait id without a cast.
|
|
366
|
+
*
|
|
367
|
+
* @category decoders
|
|
368
|
+
* @since 1.0.0
|
|
369
|
+
*/
|
|
370
|
+
export declare const decodeWaitId: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => import("effect/Effect").Effect<string & import("effect/Brand").Brand<"@smthrs/journal/WaitId">, Schema.SchemaError, never>;
|
|
371
|
+
/**
|
|
372
|
+
* Decode a command id without a cast.
|
|
373
|
+
*
|
|
374
|
+
* @category decoders
|
|
375
|
+
* @since 1.0.0
|
|
376
|
+
*/
|
|
377
|
+
export declare const decodeCommandId: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => import("effect/Effect").Effect<string & import("effect/Brand").Brand<"@smthrs/journal/CommandId">, Schema.SchemaError, never>;
|
|
378
|
+
/**
|
|
379
|
+
* Decode a plan id without a cast.
|
|
380
|
+
*
|
|
381
|
+
* @category decoders
|
|
382
|
+
* @since 1.0.0
|
|
383
|
+
*/
|
|
384
|
+
export declare const decodePlanId: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => import("effect/Effect").Effect<string & import("effect/Brand").Brand<"@smthrs/journal/PlanId">, Schema.SchemaError, never>;
|
|
385
|
+
/**
|
|
386
|
+
* Decode a dispatch id without a cast.
|
|
387
|
+
*
|
|
388
|
+
* @category decoders
|
|
389
|
+
* @since 1.0.0
|
|
390
|
+
*/
|
|
391
|
+
export declare const decodeDispatchId: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => import("effect/Effect").Effect<string & import("effect/Brand").Brand<"@smthrs/journal/DispatchId">, Schema.SchemaError, never>;
|
|
392
|
+
/**
|
|
393
|
+
* Decode an artifact id without a cast.
|
|
394
|
+
*
|
|
395
|
+
* @category decoders
|
|
396
|
+
* @since 1.0.0
|
|
397
|
+
*/
|
|
398
|
+
export declare const decodeArtifactId: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => import("effect/Effect").Effect<string & import("effect/Brand").Brand<"@smthrs/journal/ArtifactId">, Schema.SchemaError, never>;
|
|
399
|
+
/**
|
|
400
|
+
* Decode an absolute timestamp without coercion.
|
|
401
|
+
*
|
|
402
|
+
* @category decoders
|
|
403
|
+
* @since 1.0.0
|
|
404
|
+
*/
|
|
405
|
+
export declare const decodeTimestampMs: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => import("effect/Effect").Effect<number & import("effect/Brand").Brand<"@smthrs/journal/TimestampMs">, Schema.SchemaError, never>;
|
|
406
|
+
/**
|
|
407
|
+
* Decode a budget that permits zero. Units belong to the field.
|
|
408
|
+
*
|
|
409
|
+
* @category decoders
|
|
410
|
+
* @since 1.0.0
|
|
411
|
+
*/
|
|
412
|
+
export declare const decodeNonNegativeQuantity: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => import("effect/Effect").Effect<number, Schema.SchemaError, never>;
|
|
413
|
+
/**
|
|
414
|
+
* Decode a budget that requires positive capacity.
|
|
415
|
+
*
|
|
416
|
+
* @category decoders
|
|
417
|
+
* @since 1.0.0
|
|
418
|
+
*/
|
|
419
|
+
export declare const decodePositiveQuantity: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => import("effect/Effect").Effect<number, Schema.SchemaError, never>;
|
|
420
|
+
export {};
|
|
421
|
+
//# sourceMappingURL=JournalEvent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JournalEvent.d.ts","sourceRoot":"","sources":["../../src/JournalEvent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AA4BvC;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,mBAAmB,OAAO,CAAA;AA8BvC;;;;;;;;;GASG;AACH,eAAO,MAAM,KAAK,mEAAsE,CAAA;AAExF;;;;;GAKG;AACH,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAErC;;;;;;;;;GASG;AACH,eAAO,MAAM,GAAG,8DAKf,CAAA;AAED;;;;;GAKG;AACH,MAAM,MAAM,GAAG,GAAG,OAAO,GAAG,CAAC,IAAI,CAAA;AAEjC;;;;;;;;GAQG;AACH,eAAO,MAAM,QAAQ,sEAAyE,CAAA;AAE9F;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAC,IAAI,CAAA;AAE3C;;;;;;;;;GASG;AACH,eAAO,MAAM,SAAS,oEAKrB,CAAA;AAED;;;;;GAKG;AACH,MAAM,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