@voltro/plugin-cdc-out 0.54.0 → 0.56.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 +639 -2
- package/dist/index.d.ts +6 -65
- 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
|
|
@@ -150,10 +142,12 @@ export declare interface CdcOutOptions {
|
|
|
150
142
|
* `name` below: `alias` REPLACES the namespace, `name` distinguishes two
|
|
151
143
|
* installations within it.
|
|
152
144
|
*
|
|
153
|
-
* The
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
145
|
+
* The dashboard panel follows: the plugin's inspect endpoints keep a mount
|
|
146
|
+
* under its CANONICAL name alongside the aliased one, so aliasing does not
|
|
147
|
+
* take the panel away. The one case it cannot cover is two installs of this
|
|
148
|
+
* plugin — one canonical name, two panels — which get no shared mount at
|
|
149
|
+
* all, on purpose. Read `inspectSlug` from `/_voltro/inspect/plugins` to
|
|
150
|
+
* reach a specific install.
|
|
157
151
|
*/
|
|
158
152
|
readonly alias?: string;
|
|
159
153
|
/**
|
|
@@ -214,20 +208,6 @@ export declare interface CdcSink {
|
|
|
214
208
|
readonly outboundHost?: string;
|
|
215
209
|
}
|
|
216
210
|
|
|
217
|
-
/** The content half of a change identity — equal iff two replicas are looking
|
|
218
|
-
* at the same change (or at two changes with byte-identical images, which the
|
|
219
|
-
* occurrence counter then separates). */
|
|
220
|
-
export declare const changeDigest: (input: {
|
|
221
|
-
readonly pipe: string;
|
|
222
|
-
readonly op: "insert" | "update" | "delete";
|
|
223
|
-
readonly key: string;
|
|
224
|
-
readonly next: Record<string, unknown> | null;
|
|
225
|
-
readonly prev: Record<string, unknown> | null;
|
|
226
|
-
}) => string;
|
|
227
|
-
|
|
228
|
-
/** Compose the durable identity written to `_voltro_cdcout_claims.changeKey`. */
|
|
229
|
-
export declare const composeChangeKey: (digest: string, occurrence: number) => string;
|
|
230
|
-
|
|
231
211
|
/** Passed to `deliver` — abort fires when the attempt times out
|
|
232
212
|
* (`deliveryTimeoutMs`) so an HTTP sink can cancel its request. */
|
|
233
213
|
export declare interface DeliverContext {
|
|
@@ -328,39 +308,6 @@ export declare const nextClaimId: () => string;
|
|
|
328
308
|
* change tap, so ids carry commit order (uuidv7 is monotonic per process). */
|
|
329
309
|
export declare const nextOutboxId: () => string;
|
|
330
310
|
|
|
331
|
-
/**
|
|
332
|
-
* How many times this replica has already seen each digest inside the dedup
|
|
333
|
-
* window. Bounded on BOTH axes — a per-change map with no ceiling is an
|
|
334
|
-
* unbounded table in memory:
|
|
335
|
-
* * by time — entries untouched for `windowMs` are pruned, and
|
|
336
|
-
* * by size — `maxEntries` oldest-first, so a burst of unique changes can't
|
|
337
|
-
* grow it without limit.
|
|
338
|
-
*
|
|
339
|
-
* `windowMs` MUST be longer than the lifetime of a claim row in the database.
|
|
340
|
-
* That ordering is the invariant: if a claim outlived the counter that
|
|
341
|
-
* produced it, the next sighting of that digest would restart at occurrence 0,
|
|
342
|
-
* collide with the retained claim, and be dropped as a duplicate it is not.
|
|
343
|
-
*/
|
|
344
|
-
export declare class OccurrenceCounter {
|
|
345
|
-
#private;
|
|
346
|
-
constructor(opts: {
|
|
347
|
-
readonly windowMs: number;
|
|
348
|
-
readonly maxEntries: number;
|
|
349
|
-
});
|
|
350
|
-
get size(): number;
|
|
351
|
-
/** Record a sighting and return its occurrence index (0 for the first). */
|
|
352
|
-
next(digest: string, nowMs: number): number;
|
|
353
|
-
/**
|
|
354
|
-
* Align this replica with the fleet from the claims already recorded in the
|
|
355
|
-
* database — the counters of a process that booted mid-window would
|
|
356
|
-
* otherwise restart at 0 and re-key changes the incumbents have already
|
|
357
|
-
* keyed. Call ONCE, before the first observed change is keyed.
|
|
358
|
-
*/
|
|
359
|
-
seedFromChangeKeys(changeKeys: Iterable<string>, nowMs: number): void;
|
|
360
|
-
/** Drop entries whose last sighting is older than the window. */
|
|
361
|
-
prune(nowMs: number): void;
|
|
362
|
-
}
|
|
363
|
-
|
|
364
311
|
export declare interface OutboxRow {
|
|
365
312
|
readonly id: string;
|
|
366
313
|
readonly pipe: string;
|
|
@@ -384,12 +331,6 @@ export declare const outboxRowFor: (mapped: MappedChange, pipe: string, nowMs: n
|
|
|
384
331
|
|
|
385
332
|
export declare type OutboxStatus = 'pending' | 'delivering' | 'delivered' | 'dead';
|
|
386
333
|
|
|
387
|
-
/** Split a stored `changeKey` back into its two halves (`null` when malformed). */
|
|
388
|
-
export declare const parseChangeKey: (changeKey: string) => {
|
|
389
|
-
digest: string;
|
|
390
|
-
occurrence: number;
|
|
391
|
-
} | null;
|
|
392
|
-
|
|
393
334
|
/** Pipe identity — `<instance>:<table>:<sink name>` (the outbox `pipe` column). */
|
|
394
335
|
export declare const pipeKey: (instanceName: string, config: SinkConfig) => string;
|
|
395
336
|
|