@canarygate/sdk 0.1.1 → 0.1.2
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/README.md +1 -1
- package/dist/{canary-gate-base-DzuUUPOC.d.mts → canary-gate-base-iXS3mVyK.d.mts} +1 -0
- package/dist/{canary-gate-base-DzuUUPOC.d.ts → canary-gate-base-iXS3mVyK.d.ts} +1 -0
- package/dist/{chunk-ECO47H4R.mjs → chunk-LMPIWD3Z.mjs} +7 -0
- package/dist/client.d.mts +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.js +7 -0
- package/dist/client.mjs +1 -1
- package/dist/server.d.mts +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +7 -0
- package/dist/server.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -69,7 +69,7 @@ Rollout evaluation hashes `userId` deterministically — the same user always ge
|
|
|
69
69
|
| -------------------- | --------- | ----------------------- | ------------------------------------------------ |
|
|
70
70
|
| `baseUrl` | `string` | `http://localhost:3001` | CanaryGate API base URL |
|
|
71
71
|
| `environment` | `string` | — | Environment to evaluate flags against |
|
|
72
|
-
| `pollIntervalMs` | `number` | `30000` | Browser polling interval in ms. Set `0` to disable |
|
|
72
|
+
| `pollIntervalMs` | `number` | `30000` | Browser polling interval in ms (clamped to a 3000ms minimum). Set `0` to disable |
|
|
73
73
|
| `reconnectDelay` | `number` | `5000` | Initial SSE reconnect delay (ms) |
|
|
74
74
|
| `maxReconnectDelay` | `number` | `30000` | Reconnect delay cap, exponential backoff (ms) |
|
|
75
75
|
| `heartbeatTimeoutMs` | `number` | `65000` | Silence window before treating the stream as dead |
|
|
@@ -16,6 +16,7 @@ type FlagEvaluationContext = {
|
|
|
16
16
|
type CanaryGateOptions = {
|
|
17
17
|
baseUrl?: string;
|
|
18
18
|
environment?: string;
|
|
19
|
+
/** Browser polling interval in ms. Default: 30000; minimum enforced: 3000. Set 0 to disable. Server always uses SSE instead. */
|
|
19
20
|
pollIntervalMs?: number;
|
|
20
21
|
reconnectDelay?: number;
|
|
21
22
|
maxReconnectDelay?: number;
|
|
@@ -16,6 +16,7 @@ type FlagEvaluationContext = {
|
|
|
16
16
|
type CanaryGateOptions = {
|
|
17
17
|
baseUrl?: string;
|
|
18
18
|
environment?: string;
|
|
19
|
+
/** Browser polling interval in ms. Default: 30000; minimum enforced: 3000. Set 0 to disable. Server always uses SSE instead. */
|
|
19
20
|
pollIntervalMs?: number;
|
|
20
21
|
reconnectDelay?: number;
|
|
21
22
|
maxReconnectDelay?: number;
|
|
@@ -43,6 +43,7 @@ function parseSseEventBlock(block) {
|
|
|
43
43
|
var DEFAULT_MAX_RECONNECT_DELAY_MS = 3e4;
|
|
44
44
|
var DEFAULT_HEARTBEAT_TIMEOUT_MS = 65e3;
|
|
45
45
|
var DEFAULT_POLL_INTERVAL_MS = 3e4;
|
|
46
|
+
var MIN_POLL_INTERVAL_MS = 3e3;
|
|
46
47
|
function isAbortError(error) {
|
|
47
48
|
return error instanceof DOMException && error.name === "AbortError" || error instanceof Error && error.name === "AbortError";
|
|
48
49
|
}
|
|
@@ -77,6 +78,12 @@ var CanaryGateBase = class {
|
|
|
77
78
|
);
|
|
78
79
|
this.heartbeatTimeoutMs = options.heartbeatTimeoutMs ?? DEFAULT_HEARTBEAT_TIMEOUT_MS;
|
|
79
80
|
this.pollIntervalMs = options.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;
|
|
81
|
+
if (options.pollIntervalMs !== void 0 && options.pollIntervalMs > 0 && options.pollIntervalMs < MIN_POLL_INTERVAL_MS) {
|
|
82
|
+
console.warn(
|
|
83
|
+
`[canarygate] pollIntervalMs must be at least ${MIN_POLL_INTERVAL_MS}ms; clamped to ${MIN_POLL_INTERVAL_MS}.`
|
|
84
|
+
);
|
|
85
|
+
this.pollIntervalMs = MIN_POLL_INTERVAL_MS;
|
|
86
|
+
}
|
|
80
87
|
this.streamRetryDelay = this.reconnectDelay;
|
|
81
88
|
this.anonId = anonIdFactory();
|
|
82
89
|
}
|
package/dist/client.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as CanaryGateBase, a as CanaryGateOptions } from './canary-gate-base-
|
|
1
|
+
import { C as CanaryGateBase, a as CanaryGateOptions } from './canary-gate-base-iXS3mVyK.mjs';
|
|
2
2
|
|
|
3
3
|
declare class CanaryGate extends CanaryGateBase {
|
|
4
4
|
constructor(apiKey: string, options?: CanaryGateOptions);
|
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as CanaryGateBase, a as CanaryGateOptions } from './canary-gate-base-
|
|
1
|
+
import { C as CanaryGateBase, a as CanaryGateOptions } from './canary-gate-base-iXS3mVyK.js';
|
|
2
2
|
|
|
3
3
|
declare class CanaryGate extends CanaryGateBase {
|
|
4
4
|
constructor(apiKey: string, options?: CanaryGateOptions);
|
package/dist/client.js
CHANGED
|
@@ -69,6 +69,7 @@ function parseSseEventBlock(block) {
|
|
|
69
69
|
var DEFAULT_MAX_RECONNECT_DELAY_MS = 3e4;
|
|
70
70
|
var DEFAULT_HEARTBEAT_TIMEOUT_MS = 65e3;
|
|
71
71
|
var DEFAULT_POLL_INTERVAL_MS = 3e4;
|
|
72
|
+
var MIN_POLL_INTERVAL_MS = 3e3;
|
|
72
73
|
function isAbortError(error) {
|
|
73
74
|
return error instanceof DOMException && error.name === "AbortError" || error instanceof Error && error.name === "AbortError";
|
|
74
75
|
}
|
|
@@ -103,6 +104,12 @@ var CanaryGateBase = class {
|
|
|
103
104
|
);
|
|
104
105
|
this.heartbeatTimeoutMs = options.heartbeatTimeoutMs ?? DEFAULT_HEARTBEAT_TIMEOUT_MS;
|
|
105
106
|
this.pollIntervalMs = options.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;
|
|
107
|
+
if (options.pollIntervalMs !== void 0 && options.pollIntervalMs > 0 && options.pollIntervalMs < MIN_POLL_INTERVAL_MS) {
|
|
108
|
+
console.warn(
|
|
109
|
+
`[canarygate] pollIntervalMs must be at least ${MIN_POLL_INTERVAL_MS}ms; clamped to ${MIN_POLL_INTERVAL_MS}.`
|
|
110
|
+
);
|
|
111
|
+
this.pollIntervalMs = MIN_POLL_INTERVAL_MS;
|
|
112
|
+
}
|
|
106
113
|
this.streamRetryDelay = this.reconnectDelay;
|
|
107
114
|
this.anonId = anonIdFactory();
|
|
108
115
|
}
|
package/dist/client.mjs
CHANGED
package/dist/server.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as CanaryGateBase, a as CanaryGateOptions } from './canary-gate-base-
|
|
1
|
+
import { C as CanaryGateBase, a as CanaryGateOptions } from './canary-gate-base-iXS3mVyK.mjs';
|
|
2
2
|
|
|
3
3
|
declare class CanaryGate extends CanaryGateBase {
|
|
4
4
|
constructor(apiKey: string, options?: CanaryGateOptions);
|
package/dist/server.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as CanaryGateBase, a as CanaryGateOptions } from './canary-gate-base-
|
|
1
|
+
import { C as CanaryGateBase, a as CanaryGateOptions } from './canary-gate-base-iXS3mVyK.js';
|
|
2
2
|
|
|
3
3
|
declare class CanaryGate extends CanaryGateBase {
|
|
4
4
|
constructor(apiKey: string, options?: CanaryGateOptions);
|
package/dist/server.js
CHANGED
|
@@ -69,6 +69,7 @@ function parseSseEventBlock(block) {
|
|
|
69
69
|
var DEFAULT_MAX_RECONNECT_DELAY_MS = 3e4;
|
|
70
70
|
var DEFAULT_HEARTBEAT_TIMEOUT_MS = 65e3;
|
|
71
71
|
var DEFAULT_POLL_INTERVAL_MS = 3e4;
|
|
72
|
+
var MIN_POLL_INTERVAL_MS = 3e3;
|
|
72
73
|
function isAbortError(error) {
|
|
73
74
|
return error instanceof DOMException && error.name === "AbortError" || error instanceof Error && error.name === "AbortError";
|
|
74
75
|
}
|
|
@@ -103,6 +104,12 @@ var CanaryGateBase = class {
|
|
|
103
104
|
);
|
|
104
105
|
this.heartbeatTimeoutMs = options.heartbeatTimeoutMs ?? DEFAULT_HEARTBEAT_TIMEOUT_MS;
|
|
105
106
|
this.pollIntervalMs = options.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;
|
|
107
|
+
if (options.pollIntervalMs !== void 0 && options.pollIntervalMs > 0 && options.pollIntervalMs < MIN_POLL_INTERVAL_MS) {
|
|
108
|
+
console.warn(
|
|
109
|
+
`[canarygate] pollIntervalMs must be at least ${MIN_POLL_INTERVAL_MS}ms; clamped to ${MIN_POLL_INTERVAL_MS}.`
|
|
110
|
+
);
|
|
111
|
+
this.pollIntervalMs = MIN_POLL_INTERVAL_MS;
|
|
112
|
+
}
|
|
106
113
|
this.streamRetryDelay = this.reconnectDelay;
|
|
107
114
|
this.anonId = anonIdFactory();
|
|
108
115
|
}
|
package/dist/server.mjs
CHANGED