@secondlayer/shared 18.0.2 → 19.0.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/dist/src/archive/range-digest.d.ts +10 -0
- package/dist/src/archive/semantic-digest-builder.d.ts +10 -0
- package/dist/src/coverage/index.d.ts +11 -341
- package/dist/src/coverage/index.js +2 -751
- package/dist/src/coverage/index.js.map +4 -13
- package/dist/src/db/index.d.ts +12 -1
- package/dist/src/db/index.js +2 -1
- package/dist/src/db/index.js.map +4 -4
- package/dist/src/db/queries/api-keys.d.ts +38 -0
- package/dist/src/db/queries/api-keys.js +89 -0
- package/dist/src/db/queries/api-keys.js.map +11 -0
- package/dist/src/db/queries/chain-reorgs.d.ts +10 -0
- package/dist/src/db/queries/chain-reorgs.js +2 -1
- package/dist/src/db/queries/chain-reorgs.js.map +4 -4
- package/dist/src/db/queries/contracts.d.ts +10 -0
- package/dist/src/db/queries/contracts.js.map +1 -1
- package/dist/src/db/queries/instance.d.ts +10 -0
- package/dist/src/db/queries/integrity.d.ts +10 -0
- package/dist/src/db/queries/subgraph-gaps.d.ts +10 -0
- package/dist/src/db/queries/subgraph-operations.d.ts +10 -0
- package/dist/src/db/queries/subgraphs.d.ts +10 -0
- package/dist/src/db/queries/sync-scope.d.ts +10 -0
- package/dist/src/db/queries/webhook-replays.d.ts +10 -0
- package/dist/src/db/queries/webhooks.d.ts +10 -0
- package/dist/src/db/schema.d.ts +11 -1
- package/dist/src/db/schema.js.map +1 -1
- package/dist/src/index.d.ts +12 -1
- package/dist/src/index.js +2 -1
- package/dist/src/index.js.map +4 -4
- package/dist/src/insights/index.d.ts +10 -0
- package/dist/src/leader.js +2 -1
- package/dist/src/leader.js.map +4 -4
- package/dist/src/node/local-client.d.ts +10 -0
- package/dist/src/queue/listener.js +2 -1
- package/dist/src/queue/listener.js.map +4 -4
- package/dist/src/runtime/index.d.ts +1 -120
- package/dist/src/runtime/index.js +1 -310
- package/dist/src/runtime/index.js.map +3 -7
- package/dist/src/streams-rows/index.d.ts +0 -12
- package/dist/src/streams-rows/index.js +2 -3
- package/dist/src/streams-rows/index.js.map +8 -8
- package/migrations/0217_usage_monthly_totals.ts +41 -0
- package/package.json +6 -2
|
@@ -873,6 +873,7 @@ interface Database {
|
|
|
873
873
|
stage_failures: StageFailuresTable;
|
|
874
874
|
archive_fetches: ArchiveFetchesTable;
|
|
875
875
|
usage_ledger: UsageLedgerTable;
|
|
876
|
+
usage_monthly_totals: UsageMonthlyTotalsTable;
|
|
876
877
|
account_balance_alerts: AccountBalanceAlertsTable;
|
|
877
878
|
hosted_stack_state: HostedStackStateTable;
|
|
878
879
|
webhook_incident_alerts: WebhookIncidentAlertsTable;
|
|
@@ -939,6 +940,15 @@ interface ArchiveFetchesTable {
|
|
|
939
940
|
via_allowance: Generated<boolean>;
|
|
940
941
|
charged_at: Generated<Date>;
|
|
941
942
|
}
|
|
943
|
+
/** Running `usage_ledger` quantity per account, unit and UTC month of
|
|
944
|
+
* `occurred_at` — kept in step by `claimLedgerEntry`. */
|
|
945
|
+
interface UsageMonthlyTotalsTable {
|
|
946
|
+
account_id: string;
|
|
947
|
+
unit: string;
|
|
948
|
+
/** `YYYY-MM`, UTC. */
|
|
949
|
+
month: string;
|
|
950
|
+
quantity: Generated<string | number | bigint>;
|
|
951
|
+
}
|
|
942
952
|
/**
|
|
943
953
|
* One metered ledger for every billable unit (archive partitions, hosted
|
|
944
954
|
* Index/Streams rows, and future hosted-stack meters). Append-only, written
|
|
@@ -873,6 +873,7 @@ interface Database {
|
|
|
873
873
|
stage_failures: StageFailuresTable;
|
|
874
874
|
archive_fetches: ArchiveFetchesTable;
|
|
875
875
|
usage_ledger: UsageLedgerTable;
|
|
876
|
+
usage_monthly_totals: UsageMonthlyTotalsTable;
|
|
876
877
|
account_balance_alerts: AccountBalanceAlertsTable;
|
|
877
878
|
hosted_stack_state: HostedStackStateTable;
|
|
878
879
|
webhook_incident_alerts: WebhookIncidentAlertsTable;
|
|
@@ -939,6 +940,15 @@ interface ArchiveFetchesTable {
|
|
|
939
940
|
via_allowance: Generated<boolean>;
|
|
940
941
|
charged_at: Generated<Date>;
|
|
941
942
|
}
|
|
943
|
+
/** Running `usage_ledger` quantity per account, unit and UTC month of
|
|
944
|
+
* `occurred_at` — kept in step by `claimLedgerEntry`. */
|
|
945
|
+
interface UsageMonthlyTotalsTable {
|
|
946
|
+
account_id: string;
|
|
947
|
+
unit: string;
|
|
948
|
+
/** `YYYY-MM`, UTC. */
|
|
949
|
+
month: string;
|
|
950
|
+
quantity: Generated<string | number | bigint>;
|
|
951
|
+
}
|
|
942
952
|
/**
|
|
943
953
|
* One metered ledger for every billable unit (archive partitions, hosted
|
|
944
954
|
* Index/Streams rows, and future hosted-stack meters). Append-only, written
|
|
@@ -22,12 +22,6 @@ type CoverageRange = {
|
|
|
22
22
|
from_height: number
|
|
23
23
|
to_height: number
|
|
24
24
|
};
|
|
25
|
-
type ReceiptRow = {
|
|
26
|
-
block_height: number
|
|
27
|
-
input_count: number
|
|
28
|
-
finalized: boolean
|
|
29
|
-
compacted_at: Date | null
|
|
30
|
-
};
|
|
31
25
|
type FailureRow = {
|
|
32
26
|
from_height: number | null
|
|
33
27
|
to_height: number | null
|
|
@@ -46,13 +40,9 @@ declare function isFailureClass(value: string): value is FailureClass;
|
|
|
46
40
|
declare function isRetryState(value: string): value is RetryState;
|
|
47
41
|
declare function isNonNegativeInt(value: number): boolean;
|
|
48
42
|
declare function rangeIsOrdered(from: number, to: number): boolean;
|
|
49
|
-
/** Compacted receipts must already be finalized. */
|
|
50
|
-
declare function receiptRetentionHolds(row: ReceiptRow): boolean;
|
|
51
43
|
declare function failureRangeHolds(row: FailureRow): boolean;
|
|
52
44
|
/** Resolved rows need `resolved_at`; open rows keep `retain_until` ≥ created. */
|
|
53
45
|
declare function failureRetentionHolds(row: FailureRow): boolean;
|
|
54
|
-
/** Two closed ranges on the same stage must not overlap. */
|
|
55
|
-
declare function segmentsOverlap(a: CoverageRange, b: CoverageRange): boolean;
|
|
56
46
|
declare function defaultRetainUntil(createdAt: Date): Date;
|
|
57
47
|
declare const COVERAGE_REPORT_SCHEMA_VERSION: 1;
|
|
58
48
|
declare const COVERAGE_STATES: readonly ["complete", "syncing", "lagging", "gap", "stale", "failed", "unverified_import", "unanchored", "source_unavailable", "out_of_scope", "disabled"];
|
|
@@ -170,170 +160,6 @@ declare function topoSort(stages: readonly StageDeclaration[]): {
|
|
|
170
160
|
cycles: string[][]
|
|
171
161
|
};
|
|
172
162
|
declare function evaluateCoverage(input: EvaluatorInput): CoverageReport;
|
|
173
|
-
declare const RUNNER_STATUSES: readonly ["pending", "running", "complete", "failed", "halted"];
|
|
174
|
-
type RunnerStatus = (typeof RUNNER_STATUSES)[number];
|
|
175
|
-
declare const RUNNER_EVENT_TYPES: readonly ["start", "ack", "fail", "retry", "halt", "resume", "reorg", "version", "finish"];
|
|
176
|
-
type RunnerEventType = (typeof RUNNER_EVENT_TYPES)[number];
|
|
177
|
-
declare const DEFAULT_MAX_RETRIES = 3;
|
|
178
|
-
type RunnerVersion = {
|
|
179
|
-
code_hash: string
|
|
180
|
-
config_hash: string
|
|
181
|
-
handler_hash: string | null
|
|
182
|
-
};
|
|
183
|
-
type RunnerFailure = {
|
|
184
|
-
unit_kind: FailureUnit
|
|
185
|
-
class: FailureClass
|
|
186
|
-
retry_state: Exclude<RetryState, "resolved">
|
|
187
|
-
from_height: number | null
|
|
188
|
-
to_height: number | null
|
|
189
|
-
error: string | null
|
|
190
|
-
};
|
|
191
|
-
type RunnerState = {
|
|
192
|
-
stage_id: string
|
|
193
|
-
status: RunnerStatus
|
|
194
|
-
version: RunnerVersion
|
|
195
|
-
start_height: number
|
|
196
|
-
target_height: number | null
|
|
197
|
-
complete_through: number | null
|
|
198
|
-
last_acked_hash: string | null
|
|
199
|
-
retry_count: number
|
|
200
|
-
open_failure: RunnerFailure | null
|
|
201
|
-
};
|
|
202
|
-
type RunnerEvent = {
|
|
203
|
-
type: "start"
|
|
204
|
-
} | {
|
|
205
|
-
type: "ack"
|
|
206
|
-
height: number
|
|
207
|
-
hash: string
|
|
208
|
-
input_count: number
|
|
209
|
-
input_digest: string
|
|
210
|
-
effect_digest: string
|
|
211
|
-
} | {
|
|
212
|
-
type: "fail"
|
|
213
|
-
unit_kind: FailureUnit
|
|
214
|
-
class: FailureClass
|
|
215
|
-
from_height: number | null
|
|
216
|
-
to_height: number | null
|
|
217
|
-
error: string | null
|
|
218
|
-
} | {
|
|
219
|
-
type: "retry"
|
|
220
|
-
} | {
|
|
221
|
-
type: "halt"
|
|
222
|
-
} | {
|
|
223
|
-
type: "resume"
|
|
224
|
-
} | {
|
|
225
|
-
type: "reorg"
|
|
226
|
-
fork_point: number
|
|
227
|
-
} | {
|
|
228
|
-
type: "version"
|
|
229
|
-
version: RunnerVersion
|
|
230
|
-
} | {
|
|
231
|
-
type: "finish"
|
|
232
|
-
};
|
|
233
|
-
type RunnerEffect = {
|
|
234
|
-
type: "invalidate_receipts"
|
|
235
|
-
range: CoverageRange
|
|
236
|
-
} | {
|
|
237
|
-
type: "spawn_run"
|
|
238
|
-
version: RunnerVersion
|
|
239
|
-
} | {
|
|
240
|
-
type: "open_failure"
|
|
241
|
-
failure: RunnerFailure
|
|
242
|
-
} | {
|
|
243
|
-
type: "resolve_failure"
|
|
244
|
-
};
|
|
245
|
-
type RunnerResult = {
|
|
246
|
-
ok: true
|
|
247
|
-
state: RunnerState
|
|
248
|
-
effects: RunnerEffect[]
|
|
249
|
-
} | {
|
|
250
|
-
ok: false
|
|
251
|
-
reason: string
|
|
252
|
-
state: RunnerState
|
|
253
|
-
};
|
|
254
|
-
type TransitionRule = {
|
|
255
|
-
from: RunnerStatus
|
|
256
|
-
event: RunnerEventType
|
|
257
|
-
to: RunnerStatus | "reject"
|
|
258
|
-
};
|
|
259
|
-
/**
|
|
260
|
-
* Structural transition table. Guards (order, retry budget, version
|
|
261
|
-
* equality, reorg overlap) are applied on top in `applyRunnerEvent`.
|
|
262
|
-
*/
|
|
263
|
-
declare const RUNNER_TRANSITION_TABLE: readonly TransitionRule[];
|
|
264
|
-
declare function lookupTransition(from: RunnerStatus, event: RunnerEventType): TransitionRule;
|
|
265
|
-
declare function versionsEqual(a: RunnerVersion, b: RunnerVersion): boolean;
|
|
266
|
-
/** Next height this run must acknowledge. */
|
|
267
|
-
declare function expectedAckHeight(state: RunnerState): number;
|
|
268
|
-
declare function createRunnerState(init: {
|
|
269
|
-
stage_id: string
|
|
270
|
-
start_height: number
|
|
271
|
-
target_height?: number | null
|
|
272
|
-
version: RunnerVersion
|
|
273
|
-
}): RunnerState;
|
|
274
|
-
declare function applyRunnerEvent(state: RunnerState, event: RunnerEvent, opts?: {
|
|
275
|
-
maxRetries?: number
|
|
276
|
-
}): RunnerResult;
|
|
277
|
-
/**
|
|
278
|
-
* Canonical Streams cursor codec, shared by every product (Streams, Index,
|
|
279
|
-
* Datasets, bulk). A cursor is `"<block_height>:<event_index>"` — an opaque,
|
|
280
|
-
* monotonic resume token. One implementation so encode/decode and the
|
|
281
|
-
* empty-range sentinel can never drift between products.
|
|
282
|
-
*
|
|
283
|
-
* NOTE: this codec IS the shared piece worth centralizing. A broader "shared
|
|
284
|
-
* canonical reader" across the ~10 raw-event query sites (streams-events,
|
|
285
|
-
* streams-bulk/query, l2/storage) was deliberately NOT built: those sites split
|
|
286
|
-
* into distinct query patterns and share only the row_number ordering *pattern*,
|
|
287
|
-
* not an identical reader. The reorg-archive design (migration 0084) keeps the
|
|
288
|
-
* main tables canonical-only, so each reader's `WHERE canonical` filter already
|
|
289
|
-
* needs no dedup logic. Forcing one mega-reader was the wrong abstraction; this
|
|
290
|
-
* codec captures the only part that actually drifts.
|
|
291
|
-
*/
|
|
292
|
-
type StreamsCursor = {
|
|
293
|
-
block_height: number
|
|
294
|
-
event_index: number
|
|
295
|
-
};
|
|
296
|
-
type CanonicalBlock = {
|
|
297
|
-
height: number
|
|
298
|
-
hash: string
|
|
299
|
-
};
|
|
300
|
-
type DecoderClockEvent = {
|
|
301
|
-
cursor: string
|
|
302
|
-
block_hash: string
|
|
303
|
-
matched: boolean
|
|
304
|
-
};
|
|
305
|
-
type DecoderClockInput = {
|
|
306
|
-
start_height: number
|
|
307
|
-
/** Exclusive. Null = before `start_height`. */
|
|
308
|
-
from_cursor: string | null
|
|
309
|
-
/** Exclusive high-water after this batch. */
|
|
310
|
-
to_cursor: string
|
|
311
|
-
blocks: readonly CanonicalBlock[]
|
|
312
|
-
events: readonly DecoderClockEvent[]
|
|
313
|
-
};
|
|
314
|
-
type DecoderClockReceipt = {
|
|
315
|
-
height: number
|
|
316
|
-
hash: string
|
|
317
|
-
input_count: number
|
|
318
|
-
input_cursors: string[]
|
|
319
|
-
input_digest: string
|
|
320
|
-
through_cursor: string
|
|
321
|
-
no_match: boolean
|
|
322
|
-
};
|
|
323
|
-
type DecoderClockResult = {
|
|
324
|
-
ok: true
|
|
325
|
-
receipts: DecoderClockReceipt[]
|
|
326
|
-
through_cursor: string
|
|
327
|
-
} | {
|
|
328
|
-
ok: false
|
|
329
|
-
reason: string
|
|
330
|
-
receipts: DecoderClockReceipt[]
|
|
331
|
-
};
|
|
332
|
-
declare function inputDigest(cursors: readonly string[]): string;
|
|
333
|
-
declare function cursorIsAfterBlock(cursor: StreamsCursor, height: number): boolean;
|
|
334
|
-
/** True when `from` is strictly before the first event that can live in `height`. */
|
|
335
|
-
declare function cursorIsBeforeBlock(cursor: StreamsCursor, height: number): boolean;
|
|
336
|
-
declare function planDecoderReceipts(input: DecoderClockInput): DecoderClockResult;
|
|
337
163
|
import { Kysely } from "kysely";
|
|
338
164
|
import { ColumnType, Generated } from "kysely";
|
|
339
165
|
/**
|
|
@@ -1192,6 +1018,7 @@ interface Database {
|
|
|
1192
1018
|
stage_failures: StageFailuresTable;
|
|
1193
1019
|
archive_fetches: ArchiveFetchesTable;
|
|
1194
1020
|
usage_ledger: UsageLedgerTable;
|
|
1021
|
+
usage_monthly_totals: UsageMonthlyTotalsTable;
|
|
1195
1022
|
account_balance_alerts: AccountBalanceAlertsTable;
|
|
1196
1023
|
hosted_stack_state: HostedStackStateTable;
|
|
1197
1024
|
webhook_incident_alerts: WebhookIncidentAlertsTable;
|
|
@@ -1258,6 +1085,15 @@ interface ArchiveFetchesTable {
|
|
|
1258
1085
|
via_allowance: Generated<boolean>;
|
|
1259
1086
|
charged_at: Generated<Date>;
|
|
1260
1087
|
}
|
|
1088
|
+
/** Running `usage_ledger` quantity per account, unit and UTC month of
|
|
1089
|
+
* `occurred_at` — kept in step by `claimLedgerEntry`. */
|
|
1090
|
+
interface UsageMonthlyTotalsTable {
|
|
1091
|
+
account_id: string;
|
|
1092
|
+
unit: string;
|
|
1093
|
+
/** `YYYY-MM`, UTC. */
|
|
1094
|
+
month: string;
|
|
1095
|
+
quantity: Generated<string | number | bigint>;
|
|
1096
|
+
}
|
|
1261
1097
|
/**
|
|
1262
1098
|
* One metered ledger for every billable unit (archive partitions, hosted
|
|
1263
1099
|
* Index/Streams rows, and future hosted-stack meters). Append-only, written
|
|
@@ -1772,172 +1608,6 @@ declare function commitDecoderAdapter(db: Kysely<Database>, input: DecoderAdapte
|
|
|
1772
1608
|
* stays on the single-entry path.
|
|
1773
1609
|
*/
|
|
1774
1610
|
declare function commitDecoderAdapterBatch(db: Kysely<Database>, inputs: readonly Omit<DecoderAdapterCommit, "crashAfter">[]): Promise<void>;
|
|
1775
|
-
type SealableReceipt = {
|
|
1776
|
-
height: number
|
|
1777
|
-
hash: string
|
|
1778
|
-
input_digest: string
|
|
1779
|
-
effect_digest: string
|
|
1780
|
-
finalized: boolean
|
|
1781
|
-
};
|
|
1782
|
-
type SealedSegment = {
|
|
1783
|
-
from_height: number
|
|
1784
|
-
to_height: number
|
|
1785
|
-
chain_digest: string
|
|
1786
|
-
input_digest: string
|
|
1787
|
-
output_digest: string
|
|
1788
|
-
};
|
|
1789
|
-
type SealResult = {
|
|
1790
|
-
ok: true
|
|
1791
|
-
segment: SealedSegment
|
|
1792
|
-
compacted: number
|
|
1793
|
-
} | {
|
|
1794
|
-
ok: false
|
|
1795
|
-
reason: string
|
|
1796
|
-
};
|
|
1797
|
-
declare function rangeDigestOf(parts: readonly string[]): string;
|
|
1798
|
-
declare function sealFinalizedRange(receipts: readonly SealableReceipt[], range: CoverageRange): SealResult;
|
|
1799
|
-
/** After a reorg at `fork`, any sealed segment that overlaps cannot stay green. */
|
|
1800
|
-
declare function segmentsSurviveReorg(segments: readonly SealedSegment[], fork: number): SealedSegment[];
|
|
1801
|
-
declare function receiptsAfterReorg(receipts: readonly SealableReceipt[], fork: number): SealableReceipt[];
|
|
1802
|
-
type EffectOp = "insert" | "update" | "delete" | "increment";
|
|
1803
|
-
type EffectMutation = {
|
|
1804
|
-
op: EffectOp
|
|
1805
|
-
table: string
|
|
1806
|
-
key: Record<string, string | number | boolean | null>
|
|
1807
|
-
value?: Record<string, string | number | boolean | null>
|
|
1808
|
-
};
|
|
1809
|
-
declare function canonicalizeMutations(ops: readonly EffectMutation[]): EffectMutation[];
|
|
1810
|
-
declare function hashEffectManifest(ops: readonly EffectMutation[]): string;
|
|
1811
|
-
declare function manifestsEqual(a: readonly EffectMutation[], b: readonly EffectMutation[]): boolean;
|
|
1812
|
-
declare const SUBGRAPH_COMMIT_STEPS: readonly ["effects", "rows", "journal", "cursor", "receipt", "failure"];
|
|
1813
|
-
type SubgraphCommitStep = (typeof SUBGRAPH_COMMIT_STEPS)[number];
|
|
1814
|
-
declare class SubgraphAdapterCrash extends Error {
|
|
1815
|
-
readonly step: SubgraphCommitStep;
|
|
1816
|
-
readonly name = "SubgraphAdapterCrash";
|
|
1817
|
-
constructor(step: SubgraphCommitStep);
|
|
1818
|
-
}
|
|
1819
|
-
type SubgraphCommitInput = {
|
|
1820
|
-
stage_id: string
|
|
1821
|
-
effects: readonly EffectMutation[]
|
|
1822
|
-
receipts: readonly (DecoderClockReceipt & {
|
|
1823
|
-
effect_digest: string
|
|
1824
|
-
})[]
|
|
1825
|
-
failure?: DecoderAdapterFailure | null
|
|
1826
|
-
writeEffects: () => Promise<void>
|
|
1827
|
-
writeRows: () => Promise<void>
|
|
1828
|
-
writeJournal: () => Promise<void>
|
|
1829
|
-
writeCursor: () => Promise<void>
|
|
1830
|
-
writeReceipts: () => Promise<void>
|
|
1831
|
-
writeFailure: () => Promise<void>
|
|
1832
|
-
crashAfter?: SubgraphCommitStep
|
|
1833
|
-
};
|
|
1834
|
-
declare function runSubgraphCommitSteps(steps: Record<SubgraphCommitStep, () => Promise<void>>, crashAfter?: SubgraphCommitStep): Promise<void>;
|
|
1835
|
-
declare function commitSubgraphAdapter(input: SubgraphCommitInput, wrap?: (fn: () => Promise<void>) => Promise<void>): Promise<void>;
|
|
1836
|
-
type SparseSkip = CoverageRange & {
|
|
1837
|
-
reason: "no-match" | "filtered"
|
|
1838
|
-
};
|
|
1839
|
-
type HeightDigest = {
|
|
1840
|
-
height: number
|
|
1841
|
-
hash: string
|
|
1842
|
-
effect_digest: string
|
|
1843
|
-
row_digest: string
|
|
1844
|
-
};
|
|
1845
|
-
declare function sequentialDigests(heights: readonly HeightDigest[]): {
|
|
1846
|
-
chain: string
|
|
1847
|
-
effect: string
|
|
1848
|
-
row: string
|
|
1849
|
-
};
|
|
1850
|
-
declare function sparseDigests(executed: readonly HeightDigest[], skips: readonly {
|
|
1851
|
-
skip: SparseSkip
|
|
1852
|
-
hash: string
|
|
1853
|
-
}[]): {
|
|
1854
|
-
chain: string
|
|
1855
|
-
effect: string
|
|
1856
|
-
row: string
|
|
1857
|
-
};
|
|
1858
|
-
declare function proofsAgree(sequential: {
|
|
1859
|
-
chain: string
|
|
1860
|
-
effect: string
|
|
1861
|
-
row: string
|
|
1862
|
-
}, sparse: {
|
|
1863
|
-
chain: string
|
|
1864
|
-
effect: string
|
|
1865
|
-
row: string
|
|
1866
|
-
}): boolean;
|
|
1867
|
-
type RowSnapshot = {
|
|
1868
|
-
table: string
|
|
1869
|
-
key: string
|
|
1870
|
-
value: string
|
|
1871
|
-
};
|
|
1872
|
-
declare function finalRowDigest(rows: readonly RowSnapshot[]): string;
|
|
1873
|
-
declare function applyMutations(rows: readonly RowSnapshot[], ops: readonly EffectMutation[]): RowSnapshot[];
|
|
1874
|
-
type DeepVerifyResult = {
|
|
1875
|
-
ok: boolean
|
|
1876
|
-
live_digest: string
|
|
1877
|
-
scratch_digest: string
|
|
1878
|
-
found_mutation: boolean
|
|
1879
|
-
};
|
|
1880
|
-
declare function deepVerify(opts: {
|
|
1881
|
-
live: readonly RowSnapshot[]
|
|
1882
|
-
replay: readonly EffectMutation[]
|
|
1883
|
-
seed?: EffectMutation
|
|
1884
|
-
}): DeepVerifyResult;
|
|
1885
|
-
declare const QUEUE_STAGES: readonly ["decision", "outbox", "delivery", "rollback", "dlq", "replay"];
|
|
1886
|
-
type QueueStage = (typeof QUEUE_STAGES)[number];
|
|
1887
|
-
type QueueEvent = {
|
|
1888
|
-
type: "accept"
|
|
1889
|
-
} | {
|
|
1890
|
-
type: "decide"
|
|
1891
|
-
matched: boolean
|
|
1892
|
-
} | {
|
|
1893
|
-
type: "enqueue"
|
|
1894
|
-
} | {
|
|
1895
|
-
type: "deliver"
|
|
1896
|
-
} | {
|
|
1897
|
-
type: "fail"
|
|
1898
|
-
} | {
|
|
1899
|
-
type: "dead"
|
|
1900
|
-
} | {
|
|
1901
|
-
type: "requeue"
|
|
1902
|
-
} | {
|
|
1903
|
-
type: "rollback"
|
|
1904
|
-
} | {
|
|
1905
|
-
type: "replay"
|
|
1906
|
-
cursor: string
|
|
1907
|
-
};
|
|
1908
|
-
type QueueState = QueueCounters & {
|
|
1909
|
-
stage: QueueStage
|
|
1910
|
-
last_cursor: string | null
|
|
1911
|
-
dedupe: Set<string>
|
|
1912
|
-
};
|
|
1913
|
-
declare function emptyQueueState(): QueueState;
|
|
1914
|
-
type QueueApply = {
|
|
1915
|
-
ok: true
|
|
1916
|
-
state: QueueState
|
|
1917
|
-
} | {
|
|
1918
|
-
ok: false
|
|
1919
|
-
reason: string
|
|
1920
|
-
state: QueueState
|
|
1921
|
-
};
|
|
1922
|
-
declare function applyQueueEvent(state: QueueState, event: QueueEvent, dedupeKey?: string): QueueApply;
|
|
1923
|
-
declare function queueCaughtUp(state: QueueState): boolean;
|
|
1924
|
-
declare const SAFE_REPAIR_MODES: readonly RepairMode[];
|
|
1925
|
-
type RepairDefect = "gap" | "digest_mismatch" | "omission" | "version" | "reorg" | "source_gap";
|
|
1926
|
-
type RepairPlan = {
|
|
1927
|
-
stage_id: string
|
|
1928
|
-
range: CoverageRange
|
|
1929
|
-
mode: RepairMode
|
|
1930
|
-
defect: RepairDefect
|
|
1931
|
-
safe: boolean
|
|
1932
|
-
reason: string
|
|
1933
|
-
};
|
|
1934
|
-
declare function planRepair(input: {
|
|
1935
|
-
stage_id: string
|
|
1936
|
-
range: CoverageRange
|
|
1937
|
-
mode: RepairMode
|
|
1938
|
-
defect: RepairDefect
|
|
1939
|
-
range_safe_proven?: boolean
|
|
1940
|
-
}): RepairPlan;
|
|
1941
1611
|
declare const VERIFY_EXIT: {
|
|
1942
1612
|
readonly CLEAN: 0
|
|
1943
1613
|
readonly DIVERGED: 1
|
|
@@ -1973,4 +1643,4 @@ declare function reportVerify(opts: {
|
|
|
1973
1643
|
diverged?: boolean
|
|
1974
1644
|
detail?: string
|
|
1975
1645
|
}): VerifyReport;
|
|
1976
|
-
export { BootstrapSource, COVERAGE_REPORT_SCHEMA_VERSION, COVERAGE_STATES,
|
|
1646
|
+
export { BootstrapSource, COVERAGE_REPORT_SCHEMA_VERSION, COVERAGE_STATES, CoverageRange, CoverageReport, CoverageState, DECODER_COMMIT_STEPS, DecoderAdapterCommit, DecoderAdapterCrash, DecoderAdapterFailure, DecoderCommitStep, EvaluatorInput, EvaluatorOptions, FAILURE_CLASSES, FAILURE_RETENTION_DAYS, FAILURE_UNITS, FailureClass, FailureRow, FailureUnit, NATIVE_CLOCKS, NativeClock, OpenFailure, QueueCounters, REPAIR_MODES, RETRY_STATES, RUN_STATUSES, RepairMode, RetryState, RunStatus, STAGE_KINDS, SourceClock, StageCoverage, StageDeclaration, StageEvidence, StageKind, StageRunView, SyncScope, VERIFY_EXIT, VerifyExit, VerifyMode, VerifyReport, VerifyTarget, commitDecoderAdapter, commitDecoderAdapterBatch, contiguousThrough, cursorHeight, datasetMatchesTarget, defaultRetainUntil, evaluateCoverage, failureRangeHolds, failureRetentionHolds, findRangeGaps, isFailureClass, isFailureUnit, isNativeClock, isNonNegativeInt, isRepairMode, isRetryState, isRunStatus, isStageKind, mergeRanges, parseVerifyTarget, rangeIsOrdered, reportVerify, rewindDecoderCheckpoint, runDecoderCommitSteps, topoSort };
|