@voltro/plugin-cdc-out 0.55.0 → 0.57.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/CHANGELOG.md +691 -0
- package/dist/index.d.ts +0 -61
- package/dist/index.js +180 -238
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -6,14 +6,6 @@ import { Schema } from 'effect';
|
|
|
6
6
|
import { TableLike } from '@voltro/database';
|
|
7
7
|
import { VoltroPlugin } from '@voltro/protocol';
|
|
8
8
|
|
|
9
|
-
/**
|
|
10
|
-
* Deterministic JSON — object keys sorted at every depth, so two replicas
|
|
11
|
-
* that decoded the same row into differently-ordered objects still digest
|
|
12
|
-
* identically. `Date`s normalise to ISO (a binlog reader hands back `Date`s
|
|
13
|
-
* where a NOTIFY payload hands back strings), `undefined` to null.
|
|
14
|
-
*/
|
|
15
|
-
export declare const canonicalJson: (value: unknown) => string;
|
|
16
|
-
|
|
17
9
|
/**
|
|
18
10
|
* Thrown at plugin-construction time (= `app.config.ts` load = boot) when the
|
|
19
11
|
* cdc-out config is malformed: no sinks, a sink without `deliver`, a duplicate
|
|
@@ -216,20 +208,6 @@ export declare interface CdcSink {
|
|
|
216
208
|
readonly outboundHost?: string;
|
|
217
209
|
}
|
|
218
210
|
|
|
219
|
-
/** The content half of a change identity — equal iff two replicas are looking
|
|
220
|
-
* at the same change (or at two changes with byte-identical images, which the
|
|
221
|
-
* occurrence counter then separates). */
|
|
222
|
-
export declare const changeDigest: (input: {
|
|
223
|
-
readonly pipe: string;
|
|
224
|
-
readonly op: "insert" | "update" | "delete";
|
|
225
|
-
readonly key: string;
|
|
226
|
-
readonly next: Record<string, unknown> | null;
|
|
227
|
-
readonly prev: Record<string, unknown> | null;
|
|
228
|
-
}) => string;
|
|
229
|
-
|
|
230
|
-
/** Compose the durable identity written to `_voltro_cdcout_claims.changeKey`. */
|
|
231
|
-
export declare const composeChangeKey: (digest: string, occurrence: number) => string;
|
|
232
|
-
|
|
233
211
|
/** Passed to `deliver` — abort fires when the attempt times out
|
|
234
212
|
* (`deliveryTimeoutMs`) so an HTTP sink can cancel its request. */
|
|
235
213
|
export declare interface DeliverContext {
|
|
@@ -330,39 +308,6 @@ export declare const nextClaimId: () => string;
|
|
|
330
308
|
* change tap, so ids carry commit order (uuidv7 is monotonic per process). */
|
|
331
309
|
export declare const nextOutboxId: () => string;
|
|
332
310
|
|
|
333
|
-
/**
|
|
334
|
-
* How many times this replica has already seen each digest inside the dedup
|
|
335
|
-
* window. Bounded on BOTH axes — a per-change map with no ceiling is an
|
|
336
|
-
* unbounded table in memory:
|
|
337
|
-
* * by time — entries untouched for `windowMs` are pruned, and
|
|
338
|
-
* * by size — `maxEntries` oldest-first, so a burst of unique changes can't
|
|
339
|
-
* grow it without limit.
|
|
340
|
-
*
|
|
341
|
-
* `windowMs` MUST be longer than the lifetime of a claim row in the database.
|
|
342
|
-
* That ordering is the invariant: if a claim outlived the counter that
|
|
343
|
-
* produced it, the next sighting of that digest would restart at occurrence 0,
|
|
344
|
-
* collide with the retained claim, and be dropped as a duplicate it is not.
|
|
345
|
-
*/
|
|
346
|
-
export declare class OccurrenceCounter {
|
|
347
|
-
#private;
|
|
348
|
-
constructor(opts: {
|
|
349
|
-
readonly windowMs: number;
|
|
350
|
-
readonly maxEntries: number;
|
|
351
|
-
});
|
|
352
|
-
get size(): number;
|
|
353
|
-
/** Record a sighting and return its occurrence index (0 for the first). */
|
|
354
|
-
next(digest: string, nowMs: number): number;
|
|
355
|
-
/**
|
|
356
|
-
* Align this replica with the fleet from the claims already recorded in the
|
|
357
|
-
* database — the counters of a process that booted mid-window would
|
|
358
|
-
* otherwise restart at 0 and re-key changes the incumbents have already
|
|
359
|
-
* keyed. Call ONCE, before the first observed change is keyed.
|
|
360
|
-
*/
|
|
361
|
-
seedFromChangeKeys(changeKeys: Iterable<string>, nowMs: number): void;
|
|
362
|
-
/** Drop entries whose last sighting is older than the window. */
|
|
363
|
-
prune(nowMs: number): void;
|
|
364
|
-
}
|
|
365
|
-
|
|
366
311
|
export declare interface OutboxRow {
|
|
367
312
|
readonly id: string;
|
|
368
313
|
readonly pipe: string;
|
|
@@ -386,12 +331,6 @@ export declare const outboxRowFor: (mapped: MappedChange, pipe: string, nowMs: n
|
|
|
386
331
|
|
|
387
332
|
export declare type OutboxStatus = 'pending' | 'delivering' | 'delivered' | 'dead';
|
|
388
333
|
|
|
389
|
-
/** Split a stored `changeKey` back into its two halves (`null` when malformed). */
|
|
390
|
-
export declare const parseChangeKey: (changeKey: string) => {
|
|
391
|
-
digest: string;
|
|
392
|
-
occurrence: number;
|
|
393
|
-
} | null;
|
|
394
|
-
|
|
395
334
|
/** Pipe identity — `<instance>:<table>:<sink name>` (the outbox `pipe` column). */
|
|
396
335
|
export declare const pipeKey: (instanceName: string, config: SinkConfig) => string;
|
|
397
336
|
|