@econ-v1/domain 7.6.173 → 7.6.175
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.
|
@@ -63,6 +63,19 @@ export class TransportManager {
|
|
|
63
63
|
markReconnecting(attempt: number, nextRetryAt: string): void;
|
|
64
64
|
/** @param {TransportOfflineReason} [reason] @returns {void} */
|
|
65
65
|
markOffline(reason?: TransportOfflineReason): void;
|
|
66
|
+
/**
|
|
67
|
+
* Lets an adapter force every offline/reconnecting verdict this manager publishes to
|
|
68
|
+
* carry a specific reason, without patching `markOffline`/`markReconnecting` on this
|
|
69
|
+
* object. While `overrideFn` is set and returns a reason: `markOffline(undefined)` and
|
|
70
|
+
* `markOffline("node-unreachable")` publish that reason instead, `markOffline` with any
|
|
71
|
+
* other explicit reason (e.g. `"session-required"`) passes through unchanged, and
|
|
72
|
+
* `markReconnecting(...)` publishes offline with that reason instead of a reconnecting
|
|
73
|
+
* state. `overrideFn` returning `undefined` (or no override set) leaves both methods
|
|
74
|
+
* unchanged. Pass `undefined` to clear the override.
|
|
75
|
+
* @param {(() => TransportOfflineReason | undefined) | undefined} overrideFn
|
|
76
|
+
* @returns {void}
|
|
77
|
+
*/
|
|
78
|
+
setOfflineOverride(overrideFn: (() => TransportOfflineReason | undefined) | undefined): void;
|
|
66
79
|
/**
|
|
67
80
|
* Stops everything in flight. This is a global teardown primitive — `close()` and
|
|
68
81
|
* `disconnect()` on the seam above call it — never a per-caller cancel, so it stays
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport-manager.d.ts","sourceRoot":"","sources":["../../src/services/transport-manager.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transport-manager.d.ts","sourceRoot":"","sources":["../../src/services/transport-manager.js"],"names":[],"mappings":"AA4cA,sFAAsF;AACtF,+CADY,cAAc,QAAkB,cAAc,GAAiB,OAAO,CAqBjF;AA6ED;;;GAGG;AACH,oDAHW,MAAM,GACJ,MAAM,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,CAAC,OAAO,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;CAAE;wBACpI;IAAE,QAAQ,CAAC,KAAK,EAAE,mBAAmB,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;CAAE;0BAClF;IAAE,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAA;CAAE;0BAC1F;IAAE,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAA;CAAE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@econ-v1/domain",
|
|
3
|
-
"version": "7.6.
|
|
3
|
+
"version": "7.6.175",
|
|
4
4
|
"description": "Platform-neutral domain contracts and errors for Node clients",
|
|
5
5
|
"license": "MIT OR Apache-2.0",
|
|
6
6
|
"author": "Node contributors",
|
|
@@ -57,6 +57,6 @@
|
|
|
57
57
|
"access": "public"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@econ-v1/ports": "7.6.
|
|
60
|
+
"@econ-v1/ports": "7.6.175"
|
|
61
61
|
}
|
|
62
62
|
}
|
|
@@ -71,6 +71,14 @@ export class TransportManager {
|
|
|
71
71
|
path: "offline",
|
|
72
72
|
status: "offline",
|
|
73
73
|
};
|
|
74
|
+
/** Set by `setOfflineOverride`. Consulted by `markOffline`/`markReconnecting` so that an
|
|
75
|
+
* adapter-owned latch (e.g. the browser-offline state in `HttpTransportSupervisor`) can
|
|
76
|
+
* force every offline/reconnecting verdict this manager publishes — including the ones it
|
|
77
|
+
* raises internally (a failed dial round, `abort()`) and the ones the managed client
|
|
78
|
+
* raises on a carrier retire — to carry a specific reason, without patching methods on
|
|
79
|
+
* this object.
|
|
80
|
+
* @type {(() => TransportOfflineReason | undefined) | undefined} */
|
|
81
|
+
#offlineOverride;
|
|
74
82
|
|
|
75
83
|
/** @param {TransportManagerOptions} options */
|
|
76
84
|
constructor(options) {
|
|
@@ -190,6 +198,11 @@ export class TransportManager {
|
|
|
190
198
|
|
|
191
199
|
/** @param {number} attempt @param {string} nextRetryAt @returns {void} */
|
|
192
200
|
markReconnecting(attempt, nextRetryAt) {
|
|
201
|
+
const forced = this.#offlineOverride?.();
|
|
202
|
+
if (forced !== undefined) {
|
|
203
|
+
this.#publishOffline(forced);
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
193
206
|
this.#setState({
|
|
194
207
|
attempt: wholeAttempt(attempt),
|
|
195
208
|
changedAt: this.#now(),
|
|
@@ -201,6 +214,31 @@ export class TransportManager {
|
|
|
201
214
|
|
|
202
215
|
/** @param {TransportOfflineReason} [reason] @returns {void} */
|
|
203
216
|
markOffline(reason) {
|
|
217
|
+
const forced = this.#offlineOverride?.();
|
|
218
|
+
const effectiveReason = forced !== undefined && (reason === undefined || reason === "node-unreachable")
|
|
219
|
+
? forced
|
|
220
|
+
: reason;
|
|
221
|
+
this.#publishOffline(effectiveReason);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Lets an adapter force every offline/reconnecting verdict this manager publishes to
|
|
226
|
+
* carry a specific reason, without patching `markOffline`/`markReconnecting` on this
|
|
227
|
+
* object. While `overrideFn` is set and returns a reason: `markOffline(undefined)` and
|
|
228
|
+
* `markOffline("node-unreachable")` publish that reason instead, `markOffline` with any
|
|
229
|
+
* other explicit reason (e.g. `"session-required"`) passes through unchanged, and
|
|
230
|
+
* `markReconnecting(...)` publishes offline with that reason instead of a reconnecting
|
|
231
|
+
* state. `overrideFn` returning `undefined` (or no override set) leaves both methods
|
|
232
|
+
* unchanged. Pass `undefined` to clear the override.
|
|
233
|
+
* @param {(() => TransportOfflineReason | undefined) | undefined} overrideFn
|
|
234
|
+
* @returns {void}
|
|
235
|
+
*/
|
|
236
|
+
setOfflineOverride(overrideFn) {
|
|
237
|
+
this.#offlineOverride = overrideFn;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/** @param {TransportOfflineReason} [reason] @returns {void} */
|
|
241
|
+
#publishOffline(reason) {
|
|
204
242
|
this.#setState({
|
|
205
243
|
changedAt: this.#now(),
|
|
206
244
|
path: "offline",
|