@camera.ui/transport 0.0.17 → 0.0.19
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.
|
@@ -3,6 +3,7 @@ export type Detach = () => void;
|
|
|
3
3
|
export interface BackoffOptions {
|
|
4
4
|
readonly kernel: Kernel;
|
|
5
5
|
readonly schedule?: readonly number[];
|
|
6
|
+
readonly firstAttemptDelayMs?: () => number | null | undefined;
|
|
6
7
|
readonly now?: () => number;
|
|
7
8
|
readonly setTimer?: (cb: () => void, ms: number) => unknown;
|
|
8
9
|
readonly clearTimer?: (handle: unknown) => void;
|
package/dist/index.js
CHANGED
|
@@ -291,7 +291,9 @@ function attachBackoff(options) {
|
|
|
291
291
|
}
|
|
292
292
|
function scheduleFromPhase(phase, isReschedule) {
|
|
293
293
|
cancelTimer(isReschedule ? "rescheduled" : void 0);
|
|
294
|
-
const
|
|
294
|
+
const baseDelay = schedule[Math.min(attempt, schedule.length - 1)];
|
|
295
|
+
const quick = attempt === 0 ? options.firstAttemptDelayMs?.() : void 0;
|
|
296
|
+
const scheduleDelay = typeof quick === "number" && quick >= 0 ? Math.min(quick, baseDelay) : baseDelay;
|
|
295
297
|
const phaseDelay = Math.max(0, phase.nextRetryAt - now());
|
|
296
298
|
const delay = Math.max(scheduleDelay, phaseDelay);
|
|
297
299
|
options.onScheduled?.(attempt + 1, delay);
|
|
@@ -12,6 +12,7 @@ export interface NatsTransportOptions {
|
|
|
12
12
|
readonly reconnectionDelayMax?: number;
|
|
13
13
|
readonly reconnectionRandomizationFactor?: number;
|
|
14
14
|
readonly timeout?: number;
|
|
15
|
+
readonly connectTimeout?: number;
|
|
15
16
|
readonly pingInterval?: number;
|
|
16
17
|
readonly pingTimeout?: number;
|
|
17
18
|
readonly maxPingOut?: number;
|
package/dist/transports/nats.js
CHANGED
|
@@ -30,6 +30,7 @@ function createNatsTransport(options = {}) {
|
|
|
30
30
|
const reconnectionDelayMax = options.reconnectionDelayMax ?? 5e3;
|
|
31
31
|
const reconnectionRandomizationFactor = options.reconnectionRandomizationFactor ?? .5;
|
|
32
32
|
const timeout = options.timeout ?? 1e4;
|
|
33
|
+
const connectTimeout = options.connectTimeout ?? 5e3;
|
|
33
34
|
const pingInterval = options.pingInterval ?? 25e3;
|
|
34
35
|
const pingTimeout = options.pingTimeout ?? 2e4;
|
|
35
36
|
const maxPingOut = options.maxPingOut ?? 1;
|
|
@@ -144,6 +145,7 @@ function createNatsTransport(options = {}) {
|
|
|
144
145
|
reconnectionDelayMax,
|
|
145
146
|
reconnectionRandomizationFactor,
|
|
146
147
|
timeout,
|
|
148
|
+
connectTimeout,
|
|
147
149
|
pingInterval,
|
|
148
150
|
pingTimeout,
|
|
149
151
|
maxPingOut,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camera.ui/transport",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.19",
|
|
4
4
|
"description": "camera.ui transport layer — framework-agnostic connection kernel, reducer state, pluggable transports (HTTP/WS/Socket.IO/NATS), lifecycle effects and worker bridge",
|
|
5
5
|
"author": "seydx (https://github.com/cameraui/clients)",
|
|
6
6
|
"type": "module",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"@camera.ui/logger": ">=0.0.3",
|
|
59
|
-
"@camera.ui/rpc": ">=1.0.
|
|
59
|
+
"@camera.ui/rpc": ">=1.0.9",
|
|
60
60
|
"axios": ">=1.18.1",
|
|
61
61
|
"socket.io-client": ">=4.8.3"
|
|
62
62
|
},
|