@voyant-travel/hono 0.118.3 → 0.118.4
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.
|
@@ -10,9 +10,10 @@ import type { EventBus, OutboxEventStore } from "@voyant-travel/core";
|
|
|
10
10
|
* With a `store` (transactional outbox), emits are also DURABLE: the
|
|
11
11
|
* envelope is persisted before any handler runs, and failed deliveries
|
|
12
12
|
* are retried by the drain. If the durable capture itself fails (DB
|
|
13
|
-
* unreachable), the emit falls back to direct (non-durable) delivery
|
|
14
|
-
*
|
|
15
|
-
* the
|
|
13
|
+
* unreachable), the emit falls back to direct (non-durable) delivery.
|
|
14
|
+
* Once capture has succeeded, the wrapper must not redeliver directly:
|
|
15
|
+
* the stored row owns completion/retry, and direct fallback would make
|
|
16
|
+
* subscriber side effects ambiguous.
|
|
16
17
|
*
|
|
17
18
|
* Buses that predate the {@link EmitOptions} parameter simply ignore it
|
|
18
19
|
* and keep awaiting all handlers — a safe degradation.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-event-bus.d.ts","sourceRoot":"","sources":["../../src/lib/request-event-bus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,QAAQ,EAAiB,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAEjG
|
|
1
|
+
{"version":3,"file":"request-event-bus.d.ts","sourceRoot":"","sources":["../../src/lib/request-event-bus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,QAAQ,EAAiB,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAEjG;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,QAAQ,EACb,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,GAAG,SAAS,EAC3D,KAAK,CAAC,EAAE,gBAAgB,GACvB,QAAQ,CAiDV"}
|
|
@@ -9,9 +9,10 @@
|
|
|
9
9
|
* With a `store` (transactional outbox), emits are also DURABLE: the
|
|
10
10
|
* envelope is persisted before any handler runs, and failed deliveries
|
|
11
11
|
* are retried by the drain. If the durable capture itself fails (DB
|
|
12
|
-
* unreachable), the emit falls back to direct (non-durable) delivery
|
|
13
|
-
*
|
|
14
|
-
* the
|
|
12
|
+
* unreachable), the emit falls back to direct (non-durable) delivery.
|
|
13
|
+
* Once capture has succeeded, the wrapper must not redeliver directly:
|
|
14
|
+
* the stored row owns completion/retry, and direct fallback would make
|
|
15
|
+
* subscriber side effects ambiguous.
|
|
15
16
|
*
|
|
16
17
|
* Buses that predate the {@link EmitOptions} parameter simply ignore it
|
|
17
18
|
* and keep awaiting all handlers — a safe degradation.
|
|
@@ -26,12 +27,28 @@ export function requestScopedEventBus(bus, schedule, store) {
|
|
|
26
27
|
if (!store) {
|
|
27
28
|
return bus.emit(event, data, metadata, { ...base, ...options });
|
|
28
29
|
}
|
|
30
|
+
let captureFailed = false;
|
|
31
|
+
const guardedStore = {
|
|
32
|
+
async insert(envelope) {
|
|
33
|
+
try {
|
|
34
|
+
return await store.insert(envelope);
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
captureFailed = true;
|
|
38
|
+
throw err;
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
complete: (id) => store.complete(id),
|
|
42
|
+
fail: (id, error) => store.fail(id, error),
|
|
43
|
+
};
|
|
29
44
|
try {
|
|
30
|
-
return await bus.emit(event, data, metadata, { ...base, store, ...options });
|
|
45
|
+
return await bus.emit(event, data, metadata, { ...base, store: guardedStore, ...options });
|
|
31
46
|
}
|
|
32
47
|
catch (err) {
|
|
33
|
-
|
|
34
|
-
|
|
48
|
+
if (!captureFailed) {
|
|
49
|
+
console.error(`[events] durable delivery failed for "${event}" after outbox capture:`, err);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
35
52
|
console.error(`[events] outbox capture failed for "${event}" — falling back to direct delivery:`, err);
|
|
36
53
|
return bus.emit(event, data, metadata, { ...base, ...options });
|
|
37
54
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voyant-travel/hono",
|
|
3
|
-
"version": "0.118.
|
|
3
|
+
"version": "0.118.4",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
"drizzle-orm": "^0.45.2",
|
|
136
136
|
"hono": "^4.12.25",
|
|
137
137
|
"zod": "^4.4.3",
|
|
138
|
-
"@voyant-travel/core": "^0.111.
|
|
138
|
+
"@voyant-travel/core": "^0.111.1",
|
|
139
139
|
"@voyant-travel/db": "^0.109.4",
|
|
140
140
|
"@voyant-travel/storage": "^0.106.0",
|
|
141
141
|
"@voyant-travel/types": "^0.106.1",
|