@sekiban/dcb-runtime 0.2.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/LICENSE +86 -0
- package/README.md +13 -0
- package/dist/allocator/AllocatorDurableObject.d.ts +36 -0
- package/dist/allocator/AllocatorDurableObject.js +658 -0
- package/dist/allocator/IssuanceLedger.d.ts +188 -0
- package/dist/allocator/IssuanceLedger.js +608 -0
- package/dist/allocator/IssuanceReconciler.d.ts +41 -0
- package/dist/allocator/IssuanceReconciler.js +191 -0
- package/dist/allocator/OrderClock.d.ts +41 -0
- package/dist/allocator/OrderClock.js +92 -0
- package/dist/allocator/SortableUniqueId.d.ts +46 -0
- package/dist/allocator/SortableUniqueId.js +156 -0
- package/dist/allocator/types.d.ts +52 -0
- package/dist/allocator/types.js +1 -0
- package/dist/bootstrap/BootstrapCoordinatorDurableObject.d.ts +28 -0
- package/dist/bootstrap/BootstrapCoordinatorDurableObject.js +357 -0
- package/dist/bootstrap/BootstrapStoreAdapter.d.ts +51 -0
- package/dist/bootstrap/BootstrapStoreAdapter.js +162 -0
- package/dist/bootstrap/OperatorBootstrap.d.ts +20 -0
- package/dist/bootstrap/OperatorBootstrap.js +104 -0
- package/dist/bootstrap/manifest.d.ts +9 -0
- package/dist/bootstrap/manifest.js +115 -0
- package/dist/bootstrap/types.d.ts +75 -0
- package/dist/bootstrap/types.js +1 -0
- package/dist/cli/OperatorRepairCli.d.ts +11 -0
- package/dist/cli/OperatorRepairCli.js +108 -0
- package/dist/cloudflare.d.ts +164 -0
- package/dist/cloudflare.js +19487 -0
- package/dist/commit/CommitWorker.d.ts +101 -0
- package/dist/commit/CommitWorker.js +921 -0
- package/dist/commit/types.d.ts +25 -0
- package/dist/commit/types.js +13 -0
- package/dist/completeness/GlobalCompletenessReconciler.d.ts +77 -0
- package/dist/completeness/GlobalCompletenessReconciler.js +572 -0
- package/dist/completeness/types.d.ts +85 -0
- package/dist/completeness/types.js +6 -0
- package/dist/composition.d.ts +123 -0
- package/dist/composition.js +237 -0
- package/dist/cosmos.d.ts +11 -0
- package/dist/cosmos.js +1411 -0
- package/dist/d1-mv.d.ts +8 -0
- package/dist/d1-mv.js +2001 -0
- package/dist/d1.d.ts +16 -0
- package/dist/d1.js +3418 -0
- package/dist/diagnostics/G60DurableHop.d.ts +99 -0
- package/dist/diagnostics/G60DurableHop.js +248 -0
- package/dist/diagnostics/G65Admission.d.ts +23 -0
- package/dist/diagnostics/G65Admission.js +43 -0
- package/dist/diagnostics/G65DirectRing.d.ts +33 -0
- package/dist/diagnostics/G65DirectRing.js +85 -0
- package/dist/diagnostics/G69AdmissionAttempt.d.ts +43 -0
- package/dist/diagnostics/G69AdmissionAttempt.js +22 -0
- package/dist/downstream/DeliveryCore.d.ts +127 -0
- package/dist/downstream/DeliveryCore.js +304 -0
- package/dist/downstream/Doorbell.d.ts +43 -0
- package/dist/downstream/Doorbell.js +137 -0
- package/dist/downstream/DownstreamAdapter.d.ts +52 -0
- package/dist/downstream/DownstreamAdapter.js +299 -0
- package/dist/downstream/ExclusionLookup.d.ts +36 -0
- package/dist/downstream/ExclusionLookup.js +50 -0
- package/dist/downstream/InconsistencyDetector.d.ts +27 -0
- package/dist/downstream/InconsistencyDetector.js +82 -0
- package/dist/downstream/OutboxDrain.d.ts +35 -0
- package/dist/downstream/OutboxDrain.js +126 -0
- package/dist/downstream/types.d.ts +77 -0
- package/dist/downstream/types.js +64 -0
- package/dist/eventIdentity.d.ts +30 -0
- package/dist/eventIdentity.js +49 -0
- package/dist/eventRecord.d.ts +26 -0
- package/dist/eventRecord.js +53 -0
- package/dist/g42-probe.d.ts +9 -0
- package/dist/g42-probe.js +9 -0
- package/dist/http/SerializedQueryWorker.d.ts +58 -0
- package/dist/http/SerializedQueryWorker.js +497 -0
- package/dist/http/commitResponse.d.ts +46 -0
- package/dist/http/commitResponse.js +80 -0
- package/dist/http/testServiceId.d.ts +17 -0
- package/dist/http/testServiceId.js +14 -0
- package/dist/index.d.ts +112 -0
- package/dist/index.js +19926 -0
- package/dist/journal/JournalDurableObject.d.ts +30 -0
- package/dist/journal/JournalDurableObject.js +481 -0
- package/dist/journal/JournalFirstTouchProbe.d.ts +190 -0
- package/dist/journal/JournalFirstTouchProbe.js +375 -0
- package/dist/journal/types.d.ts +116 -0
- package/dist/journal/types.js +52 -0
- package/dist/mv/MaterializedViewCatchUp.d.ts +60 -0
- package/dist/mv/MaterializedViewCatchUp.js +353 -0
- package/dist/mv/MaterializedViewRuntime.d.ts +80 -0
- package/dist/mv/MaterializedViewRuntime.js +328 -0
- package/dist/mv/MaterializedViewStore.d.ts +257 -0
- package/dist/mv/MaterializedViewStore.js +875 -0
- package/dist/mv/UnsafeWindowMaterializedView.d.ts +112 -0
- package/dist/mv/UnsafeWindowMaterializedView.js +495 -0
- package/dist/mv/index.d.ts +8 -0
- package/dist/mv/index.js +2357 -0
- package/dist/projection/LiveProjectionWorker.d.ts +86 -0
- package/dist/projection/LiveProjectionWorker.js +240 -0
- package/dist/projection/ProjectionRuntime.d.ts +113 -0
- package/dist/projection/ProjectionRuntime.js +346 -0
- package/dist/projection/ProjectorRegistry.d.ts +51 -0
- package/dist/projection/ProjectorRegistry.js +116 -0
- package/dist/query/ProjectionQueryStore.d.ts +102 -0
- package/dist/query/ProjectionQueryStore.js +185 -0
- package/dist/query/QueryRegistry.d.ts +22 -0
- package/dist/query/QueryRegistry.js +36 -0
- package/dist/read/SerializedReadWorker.d.ts +36 -0
- package/dist/read/SerializedReadWorker.js +225 -0
- package/dist/repair/RepairWorker.d.ts +72 -0
- package/dist/repair/RepairWorker.js +461 -0
- package/dist/safeWindow.d.ts +20 -0
- package/dist/safeWindow.js +36 -0
- package/dist/scope/ControlRouteScope.d.ts +22 -0
- package/dist/scope/ControlRouteScope.js +36 -0
- package/dist/scope/ScopeName.d.ts +34 -0
- package/dist/scope/ScopeName.js +67 -0
- package/dist/service/ServiceIdentityProvider.d.ts +35 -0
- package/dist/service/ServiceIdentityProvider.js +56 -0
- package/dist/store/CosmosEventStore.d.ts +126 -0
- package/dist/store/CosmosEventStore.js +950 -0
- package/dist/store/D1EventStore.d.ts +111 -0
- package/dist/store/D1EventStore.js +1111 -0
- package/dist/store/PostgresEventStore.d.ts +35 -0
- package/dist/store/PostgresEventStore.js +811 -0
- package/dist/store/provider.d.ts +25 -0
- package/dist/store/provider.js +32 -0
- package/dist/store/types.d.ts +205 -0
- package/dist/store/types.js +18 -0
- package/dist/tag/EventDigest.d.ts +40 -0
- package/dist/tag/EventDigest.js +158 -0
- package/dist/tag/TagDurableObject.d.ts +286 -0
- package/dist/tag/TagDurableObject.js +4071 -0
- package/dist/tag/TagSqlMeasurement.d.ts +26 -0
- package/dist/tag/TagSqlMeasurement.js +44 -0
- package/dist/tag/TagSqlSchema.d.ts +29 -0
- package/dist/tag/TagSqlSchema.js +211 -0
- package/dist/tag/types.d.ts +173 -0
- package/dist/tag/types.js +3 -0
- package/dist/tagstate/TagStateDurableObject.d.ts +57 -0
- package/dist/tagstate/TagStateDurableObject.js +499 -0
- package/dist/trace/AttributionRatio.d.ts +12 -0
- package/dist/trace/AttributionRatio.js +68 -0
- package/dist/trace/CloudflareTracing.d.ts +7 -0
- package/dist/trace/CloudflareTracing.js +9 -0
- package/dist/trace/CommitTrace.d.ts +405 -0
- package/dist/trace/CommitTrace.js +1008 -0
- package/dist/trace/CommitTraceConsoleSink.d.ts +68 -0
- package/dist/trace/CommitTraceConsoleSink.js +114 -0
- package/dist/trace/CommitTraceVerifier.d.ts +22 -0
- package/dist/trace/CommitTraceVerifier.js +295 -0
- package/dist/trace/ObservationStream.d.ts +118 -0
- package/dist/trace/ObservationStream.js +148 -0
- package/package.json +71 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import type { WaitForTargetLookup, WaitForTargetSourcePort } from "../query/ProjectionQueryStore";
|
|
2
|
+
import type { DeliverySource, DownstreamOutboxMessage } from "../downstream/types";
|
|
3
|
+
import { CanonicalEventIdentityConflictError, type DeliveryIncident, type DeliveryAttemptContext, type DeliveryOutcome, type DetectorStore, type EventStore, type GlobalReceiptJoin, type InconsistencyClassification, type InconsistencyFinding, type PendingArrivalRecord, type ProjectionCheckpoint, type ProjectionCheckpointAdvance, type ProjectionLag, type ProjectionStore, type StoredEvent } from "./types";
|
|
4
|
+
/** Write batches exposed only as a test fault-injection seam. */
|
|
5
|
+
export type D1BatchOperation = "recordDelivery" | "upsertPending";
|
|
6
|
+
/** Single-statement write boundaries exposed only to fault tests. */
|
|
7
|
+
export type D1WriteOperation = "advanceProjectionCheckpoint" | "appendFinding" | "appendDeliveryIncident";
|
|
8
|
+
export interface D1StoreOptions {
|
|
9
|
+
/**
|
|
10
|
+
* Test-only hook. It may append a failing prepared statement to prove that
|
|
11
|
+
* D1 rolls the predeclared batch back atomically. Production composition
|
|
12
|
+
* leaves this unset.
|
|
13
|
+
*/
|
|
14
|
+
readonly beforeBatch?: (operation: D1BatchOperation, statements: readonly D1PreparedStatement[], database: D1Database) => readonly D1PreparedStatement[] | Promise<readonly D1PreparedStatement[]>;
|
|
15
|
+
/**
|
|
16
|
+
* Test-only replacement for a single durable statement. Production leaves
|
|
17
|
+
* this unset; each such statement is already atomic in D1.
|
|
18
|
+
*/
|
|
19
|
+
readonly beforeWrite?: (operation: D1WriteOperation, statement: D1PreparedStatement, database: D1Database) => D1PreparedStatement;
|
|
20
|
+
/**
|
|
21
|
+
* Test-only delay seam for proving G69 evidence never gates core admission.
|
|
22
|
+
* Production composition leaves this unset.
|
|
23
|
+
*/
|
|
24
|
+
readonly beforeG69AdmissionAttempt?: () => void | Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
/** A contradictory EventId identity is a typed fail-closed outcome. */
|
|
27
|
+
export declare class D1IdentityConflictError extends CanonicalEventIdentityConflictError {
|
|
28
|
+
readonly beforeMutation: boolean;
|
|
29
|
+
constructor(message: string, beforeMutation?: boolean);
|
|
30
|
+
}
|
|
31
|
+
/** V1 SUIDs and path names are opaque bytewise ordinals, never locale/numeric values. */
|
|
32
|
+
export declare function binaryCompare(left: string, right: string): number;
|
|
33
|
+
/**
|
|
34
|
+
* Cloudflare D1 PipelineStore implementation.
|
|
35
|
+
*
|
|
36
|
+
* All schema changes live in migrations/d1. Writes that span several tables
|
|
37
|
+
* are one predeclared D1 batch; there is no interactive transaction or
|
|
38
|
+
* TypeScript read/branch between statements in the durable mutation.
|
|
39
|
+
*/
|
|
40
|
+
export declare class D1EventStore implements EventStore, DetectorStore, ProjectionStore, WaitForTargetSourcePort {
|
|
41
|
+
private readonly database;
|
|
42
|
+
private readonly options;
|
|
43
|
+
private initialized;
|
|
44
|
+
constructor(database: D1Database, options?: D1StoreOptions);
|
|
45
|
+
initialize(): Promise<void>;
|
|
46
|
+
recordDelivery(message: DownstreamOutboxMessage, arrivedAt: number, deliverySource?: DeliverySource, attemptContext?: DeliveryAttemptContext): Promise<DeliveryOutcome>;
|
|
47
|
+
private recordDeliveryCore;
|
|
48
|
+
readGlobalReceiptJoin(message: DownstreamOutboxMessage): Promise<GlobalReceiptJoin | undefined>;
|
|
49
|
+
readAllEvents(serviceId: string, since: string): Promise<StoredEvent[]>;
|
|
50
|
+
/**
|
|
51
|
+
* G69 strict-order detector: find an event admitted after a projection
|
|
52
|
+
* checkpoint whose opaque SUID is lower than that checkpoint. A replay of
|
|
53
|
+
* an event already known before the checkpoint is deliberately excluded by
|
|
54
|
+
* FirstArrivedAt, so the detector reports new lower-SUID admission rather
|
|
55
|
+
* than ordinary Queue redelivery.
|
|
56
|
+
*/
|
|
57
|
+
findLateLowerSuid(serviceId: string, checkpointSuid: string, checkpointUpdatedAt: number): Promise<StoredEvent | undefined>;
|
|
58
|
+
findLateLowerSuidEvidence(serviceId: string, checkpointSuid: string, checkpointUpdatedAt: number, generation?: number): Promise<{
|
|
59
|
+
readonly kind: "late-lower-suid" | "replay" | "miss" | "unknown";
|
|
60
|
+
readonly event?: StoredEvent;
|
|
61
|
+
readonly reason?: string;
|
|
62
|
+
readonly durationMs?: number;
|
|
63
|
+
}>;
|
|
64
|
+
/**
|
|
65
|
+
* G31 source proof: one indexed target-SUID lookup distinguishes pending,
|
|
66
|
+
* unique stored, and contradictory/incident states. It intentionally never
|
|
67
|
+
* delegates to readAllEvents, which would make waitFor history-size bound.
|
|
68
|
+
*/
|
|
69
|
+
readWaitForTarget(serviceId: string, suid: string): Promise<WaitForTargetLookup>;
|
|
70
|
+
currentLagBound(serviceId: string, nowMs?: number): Promise<number>;
|
|
71
|
+
lagBoundDiagnostics(serviceId: string, nowMs: number): Promise<{
|
|
72
|
+
serviceIdUsed: string;
|
|
73
|
+
dynamicLagBoundMs: number;
|
|
74
|
+
rowFound: boolean;
|
|
75
|
+
rawEstimateMs: null;
|
|
76
|
+
rawObservedAt: null;
|
|
77
|
+
nowMs: number;
|
|
78
|
+
} | {
|
|
79
|
+
serviceIdUsed: string;
|
|
80
|
+
dynamicLagBoundMs: number;
|
|
81
|
+
rowFound: boolean;
|
|
82
|
+
rawEstimateMs: number;
|
|
83
|
+
rawObservedAt: number;
|
|
84
|
+
nowMs: number;
|
|
85
|
+
}>;
|
|
86
|
+
listProjectionTags(serviceId: string): Promise<string[]>;
|
|
87
|
+
readProjectionCheckpoint(serviceId: string, projectionId: string): Promise<ProjectionCheckpoint | undefined>;
|
|
88
|
+
advanceProjectionCheckpoint(input: ProjectionCheckpointAdvance): Promise<boolean>;
|
|
89
|
+
projectionLag(serviceId: string, projectionId: string, tag: string): Promise<ProjectionLag>;
|
|
90
|
+
upsertPending(message: DownstreamOutboxMessage, firstObservedAt: number, lagBoundMs: number): Promise<PendingArrivalRecord>;
|
|
91
|
+
listPending(serviceId?: string): Promise<PendingArrivalRecord[]>;
|
|
92
|
+
appendFinding(finding: InconsistencyFinding): Promise<void>;
|
|
93
|
+
hasFinding(serviceId: string, eventId: string, path: string, classification: InconsistencyClassification): Promise<boolean>;
|
|
94
|
+
listFindings(serviceId?: string, eventId?: string): Promise<InconsistencyFinding[]>;
|
|
95
|
+
appendDeliveryIncident(incident: DeliveryIncident): Promise<void>;
|
|
96
|
+
hasDeliveryIncident(serviceId: string, identityKey: string): Promise<boolean>;
|
|
97
|
+
listDeliveryIncidents(serviceId?: string): Promise<DeliveryIncident[]>;
|
|
98
|
+
private batch;
|
|
99
|
+
private write;
|
|
100
|
+
private rows;
|
|
101
|
+
private eventById;
|
|
102
|
+
private eventFromRow;
|
|
103
|
+
private pendingById;
|
|
104
|
+
private lineageBinding;
|
|
105
|
+
private collisionEvent;
|
|
106
|
+
private incidentByIdentity;
|
|
107
|
+
private eventArrivalOps;
|
|
108
|
+
private admissionMutationEvidence;
|
|
109
|
+
private bestEffortG69AdmissionAttempt;
|
|
110
|
+
private ready;
|
|
111
|
+
}
|