@camstack/sdk 1.2.122 → 1.2.123
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/dist/index.cjs +11 -8
- package/dist/index.js +11 -8
- package/dist/system.d.ts +10 -7
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -878,8 +878,9 @@ var System = class {
|
|
|
878
878
|
* 1. Query `localNetwork.getConnectionEndpoints({ port })` over the
|
|
879
879
|
* already-authenticated tRPC channel — the cap is auth-gated,
|
|
880
880
|
* so the LAN IPs never leak to anonymous callers.
|
|
881
|
-
* 2. For each candidate, fire a
|
|
882
|
-
* with a short timeout (default 1500ms).
|
|
881
|
+
* 2. For each candidate, fire a GET on `{baseUrl}/health` (the
|
|
882
|
+
* auth-free liveness route) with a short timeout (default 1500ms).
|
|
883
|
+
* The first 2xx wins.
|
|
883
884
|
* 3. If the winner differs from `this.serverUrl`, call
|
|
884
885
|
* `switchServerUrl(winner)` and return it. Otherwise return
|
|
885
886
|
* the current URL unchanged.
|
|
@@ -1357,7 +1358,7 @@ function createSystem(config) {
|
|
|
1357
1358
|
}
|
|
1358
1359
|
/**
|
|
1359
1360
|
* Race a list of candidate base URLs and return the first one that
|
|
1360
|
-
* responds to `GET {baseUrl}/
|
|
1361
|
+
* responds to `GET {baseUrl}/health` with a 2xx within
|
|
1361
1362
|
* `timeoutMs`. Returns `null` if every candidate fails / times out.
|
|
1362
1363
|
*
|
|
1363
1364
|
* Implementation notes:
|
|
@@ -1365,10 +1366,12 @@ function createSystem(config) {
|
|
|
1365
1366
|
* stalled candidate doesn't pin the wallclock for the whole race.
|
|
1366
1367
|
* - Cancels every still-pending probe as soon as the first one
|
|
1367
1368
|
* succeeds — no wasted bandwidth on the loser candidates.
|
|
1368
|
-
* - `/
|
|
1369
|
-
*
|
|
1370
|
-
*
|
|
1371
|
-
*
|
|
1369
|
+
* - `/health` is the hub's auth-free liveness route (`{"ok":true}`),
|
|
1370
|
+
* the one load balancers and uptime probes already watch. NOT
|
|
1371
|
+
* `/trpc/health`: under `/trpc/*` the tRPC plugin resolves `health` as
|
|
1372
|
+
* a procedure name and answers 404 on a HEALTHY hub (the fastify route
|
|
1373
|
+
* of that name exists only on the degraded branch taken when tRPC fails
|
|
1374
|
+
* to register), so every race over it rejected and fell back.
|
|
1372
1375
|
* - HEAD would be nicer but Cloudflare Tunnel + some browsers
|
|
1373
1376
|
* mishandle HEAD on the ingress path; GET is safer.
|
|
1374
1377
|
*
|
|
@@ -1385,7 +1388,7 @@ async function raceFastestEndpoint(candidates, timeoutMs) {
|
|
|
1385
1388
|
const ctrl = controllers[i];
|
|
1386
1389
|
const timer = setTimeout(() => ctrl.abort(), timeoutMs);
|
|
1387
1390
|
try {
|
|
1388
|
-
const res = await fetch(`${baseUrl.replace(/\/+$/, "")}/
|
|
1391
|
+
const res = await fetch(`${baseUrl.replace(/\/+$/, "")}/health`, {
|
|
1389
1392
|
method: "GET",
|
|
1390
1393
|
signal: ctrl.signal,
|
|
1391
1394
|
credentials: "omit"
|
package/dist/index.js
CHANGED
|
@@ -877,8 +877,9 @@ var System = class {
|
|
|
877
877
|
* 1. Query `localNetwork.getConnectionEndpoints({ port })` over the
|
|
878
878
|
* already-authenticated tRPC channel — the cap is auth-gated,
|
|
879
879
|
* so the LAN IPs never leak to anonymous callers.
|
|
880
|
-
* 2. For each candidate, fire a
|
|
881
|
-
* with a short timeout (default 1500ms).
|
|
880
|
+
* 2. For each candidate, fire a GET on `{baseUrl}/health` (the
|
|
881
|
+
* auth-free liveness route) with a short timeout (default 1500ms).
|
|
882
|
+
* The first 2xx wins.
|
|
882
883
|
* 3. If the winner differs from `this.serverUrl`, call
|
|
883
884
|
* `switchServerUrl(winner)` and return it. Otherwise return
|
|
884
885
|
* the current URL unchanged.
|
|
@@ -1356,7 +1357,7 @@ function createSystem(config) {
|
|
|
1356
1357
|
}
|
|
1357
1358
|
/**
|
|
1358
1359
|
* Race a list of candidate base URLs and return the first one that
|
|
1359
|
-
* responds to `GET {baseUrl}/
|
|
1360
|
+
* responds to `GET {baseUrl}/health` with a 2xx within
|
|
1360
1361
|
* `timeoutMs`. Returns `null` if every candidate fails / times out.
|
|
1361
1362
|
*
|
|
1362
1363
|
* Implementation notes:
|
|
@@ -1364,10 +1365,12 @@ function createSystem(config) {
|
|
|
1364
1365
|
* stalled candidate doesn't pin the wallclock for the whole race.
|
|
1365
1366
|
* - Cancels every still-pending probe as soon as the first one
|
|
1366
1367
|
* succeeds — no wasted bandwidth on the loser candidates.
|
|
1367
|
-
* - `/
|
|
1368
|
-
*
|
|
1369
|
-
*
|
|
1370
|
-
*
|
|
1368
|
+
* - `/health` is the hub's auth-free liveness route (`{"ok":true}`),
|
|
1369
|
+
* the one load balancers and uptime probes already watch. NOT
|
|
1370
|
+
* `/trpc/health`: under `/trpc/*` the tRPC plugin resolves `health` as
|
|
1371
|
+
* a procedure name and answers 404 on a HEALTHY hub (the fastify route
|
|
1372
|
+
* of that name exists only on the degraded branch taken when tRPC fails
|
|
1373
|
+
* to register), so every race over it rejected and fell back.
|
|
1371
1374
|
* - HEAD would be nicer but Cloudflare Tunnel + some browsers
|
|
1372
1375
|
* mishandle HEAD on the ingress path; GET is safer.
|
|
1373
1376
|
*
|
|
@@ -1384,7 +1387,7 @@ async function raceFastestEndpoint(candidates, timeoutMs) {
|
|
|
1384
1387
|
const ctrl = controllers[i];
|
|
1385
1388
|
const timer = setTimeout(() => ctrl.abort(), timeoutMs);
|
|
1386
1389
|
try {
|
|
1387
|
-
const res = await fetch(`${baseUrl.replace(/\/+$/, "")}/
|
|
1390
|
+
const res = await fetch(`${baseUrl.replace(/\/+$/, "")}/health`, {
|
|
1388
1391
|
method: "GET",
|
|
1389
1392
|
signal: ctrl.signal,
|
|
1390
1393
|
credentials: "omit"
|
package/dist/system.d.ts
CHANGED
|
@@ -184,8 +184,9 @@ export declare class System {
|
|
|
184
184
|
* 1. Query `localNetwork.getConnectionEndpoints({ port })` over the
|
|
185
185
|
* already-authenticated tRPC channel — the cap is auth-gated,
|
|
186
186
|
* so the LAN IPs never leak to anonymous callers.
|
|
187
|
-
* 2. For each candidate, fire a
|
|
188
|
-
* with a short timeout (default 1500ms).
|
|
187
|
+
* 2. For each candidate, fire a GET on `{baseUrl}/health` (the
|
|
188
|
+
* auth-free liveness route) with a short timeout (default 1500ms).
|
|
189
|
+
* The first 2xx wins.
|
|
189
190
|
* 3. If the winner differs from `this.serverUrl`, call
|
|
190
191
|
* `switchServerUrl(winner)` and return it. Otherwise return
|
|
191
192
|
* the current URL unchanged.
|
|
@@ -431,7 +432,7 @@ export declare class System {
|
|
|
431
432
|
export declare function createSystem(config: SystemConfig): System;
|
|
432
433
|
/**
|
|
433
434
|
* Race a list of candidate base URLs and return the first one that
|
|
434
|
-
* responds to `GET {baseUrl}/
|
|
435
|
+
* responds to `GET {baseUrl}/health` with a 2xx within
|
|
435
436
|
* `timeoutMs`. Returns `null` if every candidate fails / times out.
|
|
436
437
|
*
|
|
437
438
|
* Implementation notes:
|
|
@@ -439,10 +440,12 @@ export declare function createSystem(config: SystemConfig): System;
|
|
|
439
440
|
* stalled candidate doesn't pin the wallclock for the whole race.
|
|
440
441
|
* - Cancels every still-pending probe as soon as the first one
|
|
441
442
|
* succeeds — no wasted bandwidth on the loser candidates.
|
|
442
|
-
* - `/
|
|
443
|
-
*
|
|
444
|
-
*
|
|
445
|
-
*
|
|
443
|
+
* - `/health` is the hub's auth-free liveness route (`{"ok":true}`),
|
|
444
|
+
* the one load balancers and uptime probes already watch. NOT
|
|
445
|
+
* `/trpc/health`: under `/trpc/*` the tRPC plugin resolves `health` as
|
|
446
|
+
* a procedure name and answers 404 on a HEALTHY hub (the fastify route
|
|
447
|
+
* of that name exists only on the degraded branch taken when tRPC fails
|
|
448
|
+
* to register), so every race over it rejected and fell back.
|
|
446
449
|
* - HEAD would be nicer but Cloudflare Tunnel + some browsers
|
|
447
450
|
* mishandle HEAD on the ingress path; GET is safer.
|
|
448
451
|
*
|