@voltro/plugin-cdc-out 0.70.0 → 0.71.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/CHANGELOG.md +1341 -111
- package/dist/index.js +111 -70
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -429,6 +429,7 @@ var x = class extends i.TaggedError()("CdcConfigError", { message: i.String }) {
|
|
|
429
429
|
"store:changes:read",
|
|
430
430
|
"store:write",
|
|
431
431
|
"inspect:read",
|
|
432
|
+
"inspect:write",
|
|
432
433
|
...[...ve].map((e) => `network:outbound:${e}`)
|
|
433
434
|
], be = [
|
|
434
435
|
"pending",
|
|
@@ -547,78 +548,118 @@ var x = class extends i.TaggedError()("CdcConfigError", { message: i.String }) {
|
|
|
547
548
|
bindDataStore: (e) => {
|
|
548
549
|
D.current = e, $();
|
|
549
550
|
},
|
|
550
|
-
inspectEndpoints: [
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
551
|
+
inspectEndpoints: [
|
|
552
|
+
{
|
|
553
|
+
method: "GET",
|
|
554
|
+
path: "/sinks",
|
|
555
|
+
description: "Configured sinks + per-pipe outbox counts and delivery stats.",
|
|
556
|
+
handler: () => t.tryPromise(async () => {
|
|
557
|
+
let e = D.current;
|
|
558
|
+
return {
|
|
559
|
+
kind: "json",
|
|
560
|
+
data: {
|
|
561
|
+
sinks: await Promise.all([...S.values()].map(async ({ config: t, enginePipe: n }) => {
|
|
562
|
+
let r = e === null ? {
|
|
563
|
+
pending: 0,
|
|
564
|
+
delivering: 0,
|
|
565
|
+
delivered: 0,
|
|
566
|
+
dead: 0
|
|
567
|
+
} : await xe(e, n.key);
|
|
568
|
+
return {
|
|
569
|
+
table: t.table,
|
|
570
|
+
sink: t.sink.name,
|
|
571
|
+
pipe: n.key,
|
|
572
|
+
...r,
|
|
573
|
+
failed: r.dead,
|
|
574
|
+
lastDeliveryAtMs: n.stats.lastDeliveryAtMs
|
|
575
|
+
};
|
|
576
|
+
})),
|
|
577
|
+
handoff: {
|
|
578
|
+
leader: w.isLeader,
|
|
579
|
+
seeded: K,
|
|
580
|
+
awaitingSeed: X.length,
|
|
581
|
+
buffered: R.size,
|
|
582
|
+
pending: R.pendingCount(),
|
|
583
|
+
dropped: R.droppedPending + Z,
|
|
584
|
+
windowMs: b,
|
|
585
|
+
dedupWindowMs: y
|
|
586
|
+
}
|
|
584
587
|
}
|
|
588
|
+
};
|
|
589
|
+
})
|
|
590
|
+
},
|
|
591
|
+
{
|
|
592
|
+
method: "GET",
|
|
593
|
+
path: "/dead-letter",
|
|
594
|
+
description: "Outbox rows that exhausted maxAttempts (newest first, capped at 100).",
|
|
595
|
+
handler: () => t.tryPromise(async () => {
|
|
596
|
+
let e = D.current;
|
|
597
|
+
return e === null ? {
|
|
598
|
+
kind: "json",
|
|
599
|
+
data: { rows: [] }
|
|
600
|
+
} : {
|
|
601
|
+
kind: "json",
|
|
602
|
+
data: { rows: (await e.query({
|
|
603
|
+
table: C,
|
|
604
|
+
predicate: c(d("status", "dead"), m("pipe", [...S.values()].map((e) => e.enginePipe.key))),
|
|
605
|
+
order: [{
|
|
606
|
+
column: "id",
|
|
607
|
+
direction: "desc"
|
|
608
|
+
}],
|
|
609
|
+
take: 100,
|
|
610
|
+
skip: void 0,
|
|
611
|
+
projection: void 0
|
|
612
|
+
})).map((e) => ({
|
|
613
|
+
deliveryKey: e.id,
|
|
614
|
+
pipe: e.pipe,
|
|
615
|
+
table: e.sourceTable,
|
|
616
|
+
op: e.op,
|
|
617
|
+
key: e.key,
|
|
618
|
+
attempts: e.attempts,
|
|
619
|
+
lastError: e.lastError,
|
|
620
|
+
createdAt: e.createdAt
|
|
621
|
+
})) }
|
|
622
|
+
};
|
|
623
|
+
})
|
|
624
|
+
},
|
|
625
|
+
{
|
|
626
|
+
method: "POST",
|
|
627
|
+
path: "/dead-letter/retry",
|
|
628
|
+
description: "Re-enqueue one confirmed dead delivery in this plugin instance with its original delivery key.",
|
|
629
|
+
handler: (e) => t.tryPromise(async () => {
|
|
630
|
+
let t;
|
|
631
|
+
try {
|
|
632
|
+
t = JSON.parse(e.body ?? "");
|
|
633
|
+
} catch {
|
|
634
|
+
return {
|
|
635
|
+
kind: "json",
|
|
636
|
+
status: 400,
|
|
637
|
+
data: { error: "Invalid JSON." }
|
|
638
|
+
};
|
|
585
639
|
}
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
})).map((e) => ({
|
|
610
|
-
deliveryKey: e.id,
|
|
611
|
-
pipe: e.pipe,
|
|
612
|
-
table: e.sourceTable,
|
|
613
|
-
op: e.op,
|
|
614
|
-
key: e.key,
|
|
615
|
-
attempts: e.attempts,
|
|
616
|
-
lastError: e.lastError,
|
|
617
|
-
createdAt: e.createdAt
|
|
618
|
-
})) }
|
|
619
|
-
};
|
|
620
|
-
})
|
|
621
|
-
}],
|
|
640
|
+
if (typeof t != "object" || !t || !("deliveryKey" in t) || typeof t.deliveryKey != "string" || t.deliveryKey.length === 0 || !("confirm" in t) || t.confirm !== !0) return {
|
|
641
|
+
kind: "json",
|
|
642
|
+
status: 400,
|
|
643
|
+
data: { error: "A delivery key and explicit confirmation are required." }
|
|
644
|
+
};
|
|
645
|
+
let n = D.current;
|
|
646
|
+
return n === null ? {
|
|
647
|
+
kind: "json",
|
|
648
|
+
status: 503,
|
|
649
|
+
data: { error: "Store unavailable." }
|
|
650
|
+
} : {
|
|
651
|
+
kind: "json",
|
|
652
|
+
data: { accepted: await n.updateMany(C, {
|
|
653
|
+
status: "pending",
|
|
654
|
+
attempts: 0,
|
|
655
|
+
nextAttemptAt: /* @__PURE__ */ new Date(),
|
|
656
|
+
claimedBy: null,
|
|
657
|
+
claimedAt: null
|
|
658
|
+
}, { where: c(d("id", t.deliveryKey), d("status", "dead"), m("pipe", [...S.values()].map((e) => e.enginePipe.key))) }) === 1 }
|
|
659
|
+
};
|
|
660
|
+
})
|
|
661
|
+
}
|
|
662
|
+
],
|
|
622
663
|
onChangeEvent: (e) => {
|
|
623
664
|
let n = S.get(e.table);
|
|
624
665
|
if (n === void 0) return t.void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voltro/plugin-cdc-out",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.71.1",
|
|
4
4
|
"description": "Declarative reverse-ETL: mirror framework table changes outward to external sinks (webhook, Kafka via @voltro/plugin-queue's kafkaSink, plus a CdcSink interface for custom sinks) through a durable outbox — ordered per pipe, at-least-once from enqueue, retried with backoff, dead-lettered.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"voltro",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"node": ">=24.0.0"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@voltro/database": "0.
|
|
37
|
-
"@voltro/protocol": "0.
|
|
36
|
+
"@voltro/database": "0.71.1",
|
|
37
|
+
"@voltro/protocol": "0.71.1"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"effect": "^3.22.1"
|