rivetkit 2.3.7 → 2.3.8
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/browser/client.d.ts +34 -6
- package/dist/browser/client.js +33 -14
- package/dist/browser/client.js.map +1 -1
- package/dist/browser/inspector/client.js +1 -1
- package/dist/browser/inspector/client.js.map +1 -1
- package/dist/tsup/agent-os/index.cjs +1 -1
- package/dist/tsup/agent-os/index.cjs.map +1 -1
- package/dist/tsup/agent-os/index.d.cts +34 -6
- package/dist/tsup/agent-os/index.d.ts +34 -6
- package/dist/tsup/agent-os/index.js +1 -1
- package/dist/tsup/agent-os/index.js.map +1 -1
- package/dist/tsup/{chunk-46AE7JOI.cjs → chunk-5MJPN3QU.cjs} +172 -151
- package/dist/tsup/chunk-5MJPN3QU.cjs.map +1 -0
- package/dist/tsup/{chunk-MNZFNIVI.cjs → chunk-7TNEDX3Y.cjs} +3 -3
- package/dist/tsup/{chunk-MNZFNIVI.cjs.map → chunk-7TNEDX3Y.cjs.map} +1 -1
- package/dist/tsup/{chunk-YU3C5OCU.js → chunk-BL6ERZQO.js} +36 -15
- package/dist/tsup/chunk-BL6ERZQO.js.map +1 -0
- package/dist/tsup/{chunk-DOPH7DT2.cjs → chunk-F6GCLL5Z.cjs} +7 -7
- package/dist/tsup/{chunk-DOPH7DT2.cjs.map → chunk-F6GCLL5Z.cjs.map} +1 -1
- package/dist/tsup/{chunk-6D2WRHJV.js → chunk-HWBISPRP.js} +2 -2
- package/dist/tsup/{chunk-UIZZCJ5W.cjs → chunk-IJMVVULS.cjs} +4 -4
- package/dist/tsup/{chunk-UIZZCJ5W.cjs.map → chunk-IJMVVULS.cjs.map} +1 -1
- package/dist/tsup/{chunk-7YQJXWBW.js → chunk-MY6BRV3S.js} +3 -3
- package/dist/tsup/{chunk-2SGPZEAJ.cjs → chunk-NUMGL52R.cjs} +6 -3
- package/dist/tsup/chunk-NUMGL52R.cjs.map +1 -0
- package/dist/tsup/{chunk-TQHMPWL6.cjs → chunk-TMTJPSHQ.cjs} +9 -9
- package/dist/tsup/{chunk-TQHMPWL6.cjs.map → chunk-TMTJPSHQ.cjs.map} +1 -1
- package/dist/tsup/{chunk-YHPFCYL3.js → chunk-V7PJYBA5.js} +2 -2
- package/dist/tsup/{chunk-CH25U5NO.js → chunk-YFXQ7DBH.js} +3 -3
- package/dist/tsup/{chunk-OG4OR2CM.js → chunk-ZKDZW5DQ.js} +6 -3
- package/dist/tsup/chunk-ZKDZW5DQ.js.map +1 -0
- package/dist/tsup/client/mod.cjs +5 -5
- package/dist/tsup/client/mod.d.cts +2 -2
- package/dist/tsup/client/mod.d.ts +2 -2
- package/dist/tsup/client/mod.js +4 -4
- package/dist/tsup/common/log.cjs +2 -2
- package/dist/tsup/common/log.js +1 -1
- package/dist/tsup/common/websocket.cjs +3 -3
- package/dist/tsup/common/websocket.js +2 -2
- package/dist/tsup/{config-BRpVbJCD.d.ts → config-CUymbyM6.d.ts} +35 -7
- package/dist/tsup/{config-BobvQpex.d.cts → config-CpB-e4I9.d.cts} +35 -7
- package/dist/tsup/{context-Cj-DFyiy.d.ts → context-YBUBTwTS.d.ts} +1 -1
- package/dist/tsup/{context-YEBNJrws.d.cts → context-c-6G4mjk.d.cts} +1 -1
- package/dist/tsup/db/drizzle.cjs +2 -2
- package/dist/tsup/db/drizzle.js +1 -1
- package/dist/tsup/db/mod.cjs +2 -2
- package/dist/tsup/db/mod.js +1 -1
- package/dist/tsup/dynamic/mod.d.cts +1 -1
- package/dist/tsup/dynamic/mod.d.ts +1 -1
- package/dist/tsup/inspector/mod.cjs +4 -4
- package/dist/tsup/inspector/mod.js +3 -3
- package/dist/tsup/inspector-tab/mod.d.cts +2 -2
- package/dist/tsup/inspector-tab/mod.d.ts +2 -2
- package/dist/tsup/mod.cjs +449 -124
- package/dist/tsup/mod.cjs.map +1 -1
- package/dist/tsup/mod.d.cts +3 -3
- package/dist/tsup/mod.d.ts +3 -3
- package/dist/tsup/mod.js +388 -63
- package/dist/tsup/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +6 -6
- package/dist/tsup/test/mod.d.cts +1 -1
- package/dist/tsup/test/mod.d.ts +1 -1
- package/dist/tsup/test/mod.js +4 -4
- package/dist/tsup/utils.cjs +2 -2
- package/dist/tsup/utils.js +1 -1
- package/dist/tsup/workflow/mod.cjs +6 -6
- package/dist/tsup/workflow/mod.d.cts +3 -3
- package/dist/tsup/workflow/mod.d.ts +3 -3
- package/dist/tsup/workflow/mod.js +3 -3
- package/package.json +8 -8
- package/src/client/actor-handle.ts +3 -1
- package/src/client/raw-utils.ts +11 -2
- package/src/common/actor-router-consts.ts +1 -0
- package/src/common/encoding.ts +4 -1
- package/src/common/fetch-like.ts +49 -0
- package/src/engine-client/actor-http-client.ts +6 -22
- package/src/registry/index.ts +159 -14
- package/src/registry/napi-runtime.ts +74 -0
- package/src/registry/native-http.ts +208 -0
- package/src/registry/native.ts +111 -63
- package/src/registry/runtime.ts +35 -0
- package/src/registry/wasm-runtime.ts +11 -0
- package/dist/tsup/chunk-2SGPZEAJ.cjs.map +0 -1
- package/dist/tsup/chunk-46AE7JOI.cjs.map +0 -1
- package/dist/tsup/chunk-OG4OR2CM.js.map +0 -1
- package/dist/tsup/chunk-YU3C5OCU.js.map +0 -1
- /package/dist/tsup/{chunk-6D2WRHJV.js.map → chunk-HWBISPRP.js.map} +0 -0
- /package/dist/tsup/{chunk-7YQJXWBW.js.map → chunk-MY6BRV3S.js.map} +0 -0
- /package/dist/tsup/{chunk-YHPFCYL3.js.map → chunk-V7PJYBA5.js.map} +0 -0
- /package/dist/tsup/{chunk-CH25U5NO.js.map → chunk-YFXQ7DBH.js.map} +0 -0
|
@@ -5,7 +5,7 @@ var _chunkMYWZCDMLcjs = require('./chunk-MYWZCDML.cjs');
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunk7TNEDX3Ycjs = require('./chunk-7TNEDX3Y.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
var _chunkUEULFXUIcjs = require('./chunk-UEULFXUI.cjs');
|
|
@@ -35,7 +35,7 @@ var _chunkUEULFXUIcjs = require('./chunk-UEULFXUI.cjs');
|
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
|
|
38
|
-
var
|
|
38
|
+
var _chunkNUMGL52Rcjs = require('./chunk-NUMGL52R.cjs');
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
|
|
@@ -50,6 +50,7 @@ var PATH_WEBSOCKET_PREFIX = "/websocket/";
|
|
|
50
50
|
var HEADER_ACTOR_QUERY = "x-rivet-query";
|
|
51
51
|
var HEADER_ENCODING = "x-rivet-encoding";
|
|
52
52
|
var HEADER_CONN_PARAMS = "x-rivet-conn-params";
|
|
53
|
+
var HEADER_ORIGINAL_REQUEST_URL = "x-rivet-internal-original-request-url";
|
|
53
54
|
var HEADER_ACTOR_ID = "x-rivet-actor";
|
|
54
55
|
var HEADER_ACTOR_GENERATION = "x-rivet-actor-generation";
|
|
55
56
|
var HEADER_ACTOR_KEY = "x-rivet-actor-key";
|
|
@@ -2126,7 +2127,7 @@ async function checkForSchedulingError(group, code, actorId, query, driver) {
|
|
|
2126
2127
|
try {
|
|
2127
2128
|
const actor = await driver.getForId({ name, actorId });
|
|
2128
2129
|
if (actor == null ? void 0 : actor.error) {
|
|
2129
|
-
|
|
2130
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).info({
|
|
2130
2131
|
msg: "found actor scheduling error",
|
|
2131
2132
|
actorId,
|
|
2132
2133
|
error: actor.error
|
|
@@ -2134,15 +2135,29 @@ async function checkForSchedulingError(group, code, actorId, query, driver) {
|
|
|
2134
2135
|
return actorSchedulingError(group, code, actorId, actor.error);
|
|
2135
2136
|
}
|
|
2136
2137
|
} catch (err) {
|
|
2137
|
-
|
|
2138
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).warn({
|
|
2138
2139
|
msg: "failed to fetch actor details for scheduling error check",
|
|
2139
2140
|
actorId,
|
|
2140
|
-
error:
|
|
2141
|
+
error: _chunkNUMGL52Rcjs.stringifyError.call(void 0, err)
|
|
2141
2142
|
});
|
|
2142
2143
|
}
|
|
2143
2144
|
return null;
|
|
2144
2145
|
}
|
|
2145
2146
|
|
|
2147
|
+
// src/common/fetch-like.ts
|
|
2148
|
+
function isUrlLike(value) {
|
|
2149
|
+
return typeof value === "object" && value !== null && typeof value.href === "string" && typeof value.pathname === "string" && typeof value.search === "string";
|
|
2150
|
+
}
|
|
2151
|
+
function isRequestLike(value) {
|
|
2152
|
+
return typeof value === "object" && value !== null && typeof value.url === "string" && typeof value.method === "string" && isHeadersLike(value.headers);
|
|
2153
|
+
}
|
|
2154
|
+
function isResponseLike(value) {
|
|
2155
|
+
return typeof value === "object" && value !== null && typeof value.status === "number" && isHeadersLike(value.headers) && typeof value.arrayBuffer === "function";
|
|
2156
|
+
}
|
|
2157
|
+
function isHeadersLike(value) {
|
|
2158
|
+
return typeof value === "object" && value !== null && typeof value.entries === "function";
|
|
2159
|
+
}
|
|
2160
|
+
|
|
2146
2161
|
// src/client/lifecycle-errors.ts
|
|
2147
2162
|
function* walkErrorChain(error, maxDepth = 8) {
|
|
2148
2163
|
let current = error;
|
|
@@ -2347,7 +2362,7 @@ function parseWebSocketCloseReason(reason) {
|
|
|
2347
2362
|
const [mainPart, rayId] = reason.split("#");
|
|
2348
2363
|
const [group, code] = mainPart.split(".");
|
|
2349
2364
|
if (!group || !code) {
|
|
2350
|
-
|
|
2365
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).warn({ msg: "failed to parse close reason", reason });
|
|
2351
2366
|
return void 0;
|
|
2352
2367
|
}
|
|
2353
2368
|
return {
|
|
@@ -2369,11 +2384,11 @@ function messageLength(message) {
|
|
|
2369
2384
|
if (typeof message === "string") {
|
|
2370
2385
|
return message.length;
|
|
2371
2386
|
}
|
|
2372
|
-
|
|
2387
|
+
_chunkNUMGL52Rcjs.assertUnreachable.call(void 0, message);
|
|
2373
2388
|
}
|
|
2374
2389
|
async function sendHttpRequest(opts) {
|
|
2375
2390
|
var _a, _b, _c;
|
|
2376
|
-
|
|
2391
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).debug({
|
|
2377
2392
|
msg: "sending http request",
|
|
2378
2393
|
url: opts.url,
|
|
2379
2394
|
encoding: opts.encoding
|
|
@@ -2382,8 +2397,8 @@ async function sendHttpRequest(opts) {
|
|
|
2382
2397
|
let bodyData;
|
|
2383
2398
|
if (opts.method === "POST" || opts.method === "PUT") {
|
|
2384
2399
|
_invariant2.default.call(void 0, opts.body !== void 0, "missing body");
|
|
2385
|
-
contentType =
|
|
2386
|
-
bodyData =
|
|
2400
|
+
contentType = _chunkNUMGL52Rcjs.contentTypeForEncoding.call(void 0, opts.encoding);
|
|
2401
|
+
bodyData = _chunkNUMGL52Rcjs.serializeWithEncoding.call(void 0,
|
|
2387
2402
|
opts.encoding,
|
|
2388
2403
|
opts.body,
|
|
2389
2404
|
opts.requestVersionedDataHandler,
|
|
@@ -2403,7 +2418,7 @@ async function sendHttpRequest(opts) {
|
|
|
2403
2418
|
...contentType ? {
|
|
2404
2419
|
"Content-Type": contentType
|
|
2405
2420
|
} : {},
|
|
2406
|
-
"User-Agent":
|
|
2421
|
+
"User-Agent": _chunkNUMGL52Rcjs.httpUserAgent.call(void 0, )
|
|
2407
2422
|
},
|
|
2408
2423
|
body: bodyData,
|
|
2409
2424
|
credentials: "include",
|
|
@@ -2421,7 +2436,7 @@ async function sendHttpRequest(opts) {
|
|
|
2421
2436
|
const rayId = response.headers.get("x-rivet-ray-id");
|
|
2422
2437
|
const encoding = (contentType2 == null ? void 0 : contentType2.includes("application/json")) ? "json" : opts.encoding;
|
|
2423
2438
|
try {
|
|
2424
|
-
const responseData =
|
|
2439
|
+
const responseData = _chunkNUMGL52Rcjs.deserializeWithEncoding.call(void 0,
|
|
2425
2440
|
encoding,
|
|
2426
2441
|
new Uint8Array(bufferResponse),
|
|
2427
2442
|
HTTP_RESPONSE_ERROR_VERSIONED,
|
|
@@ -2439,7 +2454,7 @@ async function sendHttpRequest(opts) {
|
|
|
2439
2454
|
group: bare5.group,
|
|
2440
2455
|
code: bare5.code,
|
|
2441
2456
|
message: bare5.message,
|
|
2442
|
-
metadata: bare5.metadata ?
|
|
2457
|
+
metadata: bare5.metadata ? _chunkNUMGL52Rcjs.decodeCborCompat.call(void 0, new Uint8Array(bare5.metadata)) : void 0,
|
|
2443
2458
|
actor: bare5.actor ? {
|
|
2444
2459
|
actorId: bare5.actor.actorId,
|
|
2445
2460
|
generation: Number(bare5.actor.generation),
|
|
@@ -2447,7 +2462,7 @@ async function sendHttpRequest(opts) {
|
|
|
2447
2462
|
} : void 0
|
|
2448
2463
|
})
|
|
2449
2464
|
);
|
|
2450
|
-
|
|
2465
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).warn({
|
|
2451
2466
|
msg: "http error response",
|
|
2452
2467
|
group: responseData.group,
|
|
2453
2468
|
code: responseData.code,
|
|
@@ -2491,7 +2506,7 @@ ${textResponse}`
|
|
|
2491
2506
|
}
|
|
2492
2507
|
try {
|
|
2493
2508
|
const buffer = new Uint8Array(await response.arrayBuffer());
|
|
2494
|
-
return
|
|
2509
|
+
return _chunkNUMGL52Rcjs.deserializeWithEncoding.call(void 0,
|
|
2495
2510
|
opts.encoding,
|
|
2496
2511
|
buffer,
|
|
2497
2512
|
opts.responseVersionedDataHandler,
|
|
@@ -2538,8 +2553,8 @@ function createQueueSender(senderOptions) {
|
|
|
2538
2553
|
}),
|
|
2539
2554
|
requestToBare: (value) => ({
|
|
2540
2555
|
name: _nullishCoalesce(value.name, () => ( name)),
|
|
2541
|
-
body:
|
|
2542
|
-
|
|
2556
|
+
body: _chunkNUMGL52Rcjs.bufferToArrayBuffer.call(void 0,
|
|
2557
|
+
_chunkNUMGL52Rcjs.encodeCborCompat.call(void 0, value.body)
|
|
2543
2558
|
),
|
|
2544
2559
|
wait: _nullishCoalesce(value.wait, () => ( false)),
|
|
2545
2560
|
timeout: value.timeout !== void 0 ? BigInt(value.timeout) : null
|
|
@@ -2559,7 +2574,7 @@ function createQueueSender(senderOptions) {
|
|
|
2559
2574
|
}
|
|
2560
2575
|
return {
|
|
2561
2576
|
status: bare5.status,
|
|
2562
|
-
response:
|
|
2577
|
+
response: _chunkNUMGL52Rcjs.decodeCborCompat.call(void 0, new Uint8Array(bare5.response))
|
|
2563
2578
|
};
|
|
2564
2579
|
}
|
|
2565
2580
|
});
|
|
@@ -2576,14 +2591,17 @@ function createQueueSender(senderOptions) {
|
|
|
2576
2591
|
// src/client/raw-utils.ts
|
|
2577
2592
|
async function rawHttpFetch(driver, target, params, input, init, options = {}) {
|
|
2578
2593
|
let path;
|
|
2594
|
+
let originalUrl;
|
|
2579
2595
|
let mergedInit = init || {};
|
|
2580
2596
|
if (typeof input === "string") {
|
|
2581
2597
|
path = input;
|
|
2582
|
-
} else if (input
|
|
2598
|
+
} else if (isUrlLike(input)) {
|
|
2583
2599
|
path = input.pathname + input.search;
|
|
2584
|
-
|
|
2600
|
+
originalUrl = input.toString();
|
|
2601
|
+
} else if (isRequestLike(input)) {
|
|
2585
2602
|
const url = new URL(input.url);
|
|
2586
2603
|
path = url.pathname + url.search;
|
|
2604
|
+
originalUrl = url.toString();
|
|
2587
2605
|
const requestHeaders = new Headers(input.headers);
|
|
2588
2606
|
const initHeaders = new Headers((init == null ? void 0 : init.headers) || {});
|
|
2589
2607
|
const mergedHeaders = new Headers(requestHeaders);
|
|
@@ -2613,7 +2631,7 @@ async function rawHttpFetch(driver, target, params, input, init, options = {}) {
|
|
|
2613
2631
|
throw new TypeError("Invalid input type for fetch");
|
|
2614
2632
|
}
|
|
2615
2633
|
try {
|
|
2616
|
-
|
|
2634
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).debug(
|
|
2617
2635
|
"directId" in target ? {
|
|
2618
2636
|
msg: "sending raw http request to actor",
|
|
2619
2637
|
actorId: target.directId
|
|
@@ -2625,6 +2643,10 @@ async function rawHttpFetch(driver, target, params, input, init, options = {}) {
|
|
|
2625
2643
|
const normalizedPath = path.startsWith("/") ? path.slice(1) : path;
|
|
2626
2644
|
const url = new URL(`http://actor/request/${normalizedPath}`);
|
|
2627
2645
|
const proxyRequestHeaders = new Headers(mergedInit.headers);
|
|
2646
|
+
proxyRequestHeaders.delete(HEADER_ORIGINAL_REQUEST_URL);
|
|
2647
|
+
if (originalUrl) {
|
|
2648
|
+
proxyRequestHeaders.set(HEADER_ORIGINAL_REQUEST_URL, originalUrl);
|
|
2649
|
+
}
|
|
2628
2650
|
if (params) {
|
|
2629
2651
|
proxyRequestHeaders.set(HEADER_CONN_PARAMS, JSON.stringify(params));
|
|
2630
2652
|
}
|
|
@@ -2634,7 +2656,7 @@ async function rawHttpFetch(driver, target, params, input, init, options = {}) {
|
|
|
2634
2656
|
});
|
|
2635
2657
|
return driver.sendRequest(target, proxyRequest, options);
|
|
2636
2658
|
} catch (err) {
|
|
2637
|
-
const { group, code, message, metadata, actor } =
|
|
2659
|
+
const { group, code, message, metadata, actor } = _chunkNUMGL52Rcjs.deconstructError.call(void 0,
|
|
2638
2660
|
err,
|
|
2639
2661
|
true
|
|
2640
2662
|
);
|
|
@@ -2658,7 +2680,7 @@ async function rawWebSocket(driver, target, params, path, _protocols, options =
|
|
|
2658
2680
|
}
|
|
2659
2681
|
}
|
|
2660
2682
|
const fullPath = `${PATH_WEBSOCKET_PREFIX}${pathPortion}${queryPortion}`;
|
|
2661
|
-
|
|
2683
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).debug({
|
|
2662
2684
|
msg: "opening websocket",
|
|
2663
2685
|
target,
|
|
2664
2686
|
encoding,
|
|
@@ -2779,7 +2801,7 @@ var ActorHandleRaw = class {
|
|
|
2779
2801
|
}
|
|
2780
2802
|
}).send(name, body, options);
|
|
2781
2803
|
} catch (err) {
|
|
2782
|
-
const { group, code, message, metadata, actor } =
|
|
2804
|
+
const { group, code, message, metadata, actor } = _chunkNUMGL52Rcjs.deconstructError.call(void 0, err, true);
|
|
2783
2805
|
if (this.#shouldRetryQueueDispatchOverload(
|
|
2784
2806
|
group,
|
|
2785
2807
|
code,
|
|
@@ -2866,13 +2888,13 @@ var ActorHandleRaw = class {
|
|
|
2866
2888
|
gatewayOptions
|
|
2867
2889
|
);
|
|
2868
2890
|
actorId = "directId" in target ? target.directId : void 0;
|
|
2869
|
-
|
|
2891
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).debug(
|
|
2870
2892
|
actorId ? { msg: "using direct actor gateway target", actorId } : {
|
|
2871
2893
|
msg: "using query gateway target for action",
|
|
2872
2894
|
query: this.#actorResolutionState
|
|
2873
2895
|
}
|
|
2874
2896
|
);
|
|
2875
|
-
|
|
2897
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).debug({
|
|
2876
2898
|
msg: "handling action",
|
|
2877
2899
|
name: opts.name,
|
|
2878
2900
|
encoding: this.#encoding
|
|
@@ -2906,19 +2928,19 @@ var ActorHandleRaw = class {
|
|
|
2906
2928
|
args
|
|
2907
2929
|
}),
|
|
2908
2930
|
requestToBare: (args) => ({
|
|
2909
|
-
args:
|
|
2910
|
-
|
|
2931
|
+
args: _chunkNUMGL52Rcjs.bufferToArrayBuffer.call(void 0,
|
|
2932
|
+
_chunkNUMGL52Rcjs.encodeCborCompat.call(void 0, args)
|
|
2911
2933
|
)
|
|
2912
2934
|
}),
|
|
2913
2935
|
responseFromJson: (json) => json.output,
|
|
2914
|
-
responseFromBare: (bare5) =>
|
|
2936
|
+
responseFromBare: (bare5) => _chunkNUMGL52Rcjs.decodeCborCompat.call(void 0, new Uint8Array(bare5.output))
|
|
2915
2937
|
});
|
|
2916
2938
|
if (opts.name === "destroy" && actorId) {
|
|
2917
2939
|
await this.#waitForDestroyActionToSettle(actorId);
|
|
2918
2940
|
}
|
|
2919
2941
|
return output;
|
|
2920
2942
|
} catch (err) {
|
|
2921
|
-
const { group, code, message, metadata, actor } =
|
|
2943
|
+
const { group, code, message, metadata, actor } = _chunkNUMGL52Rcjs.deconstructError.call(void 0, err, true);
|
|
2922
2944
|
if (await this.#shouldRetrySchedulingError(
|
|
2923
2945
|
group,
|
|
2924
2946
|
code,
|
|
@@ -3068,7 +3090,7 @@ var ActorHandleRaw = class {
|
|
|
3068
3090
|
* @returns {ActorConn<AD>} A connection to the actor.
|
|
3069
3091
|
*/
|
|
3070
3092
|
connect(params, options = {}) {
|
|
3071
|
-
|
|
3093
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).debug({
|
|
3072
3094
|
msg: "establishing connection from handle",
|
|
3073
3095
|
query: this.#actorResolutionState
|
|
3074
3096
|
});
|
|
@@ -3097,6 +3119,7 @@ var ActorHandleRaw = class {
|
|
|
3097
3119
|
async #fetchWithResolvedActor(input, init) {
|
|
3098
3120
|
const maxAttempts = this.#getDynamicQueryMaxAttempts();
|
|
3099
3121
|
let useQueryTarget = false;
|
|
3122
|
+
const retryableRequest = isRequestLike(input) ? input.clone() : void 0;
|
|
3100
3123
|
const { skipReadyWait, ...requestInit } = _nullishCoalesce(init, () => ( {}));
|
|
3101
3124
|
const gatewayOptions = resolveActorGatewayOptions(
|
|
3102
3125
|
this.#gatewayOptions,
|
|
@@ -3116,7 +3139,7 @@ var ActorHandleRaw = class {
|
|
|
3116
3139
|
this.#driver,
|
|
3117
3140
|
target,
|
|
3118
3141
|
this.#params,
|
|
3119
|
-
input,
|
|
3142
|
+
retryableRequest ? retryableRequest.clone() : input,
|
|
3120
3143
|
requestInit,
|
|
3121
3144
|
gatewayOptions
|
|
3122
3145
|
);
|
|
@@ -3135,7 +3158,7 @@ var ActorHandleRaw = class {
|
|
|
3135
3158
|
}
|
|
3136
3159
|
return response;
|
|
3137
3160
|
} catch (err) {
|
|
3138
|
-
const { group, code, message, metadata, actor } =
|
|
3161
|
+
const { group, code, message, metadata, actor } = _chunkNUMGL52Rcjs.deconstructError.call(void 0, err, true);
|
|
3139
3162
|
if (await this.#shouldRetrySchedulingError(
|
|
3140
3163
|
group,
|
|
3141
3164
|
code,
|
|
@@ -3224,7 +3247,7 @@ var ActorHandleRaw = class {
|
|
|
3224
3247
|
const contentType = response.headers.get("content-type");
|
|
3225
3248
|
const encoding = (contentType == null ? void 0 : contentType.includes("application/json")) ? "json" : this.#encoding;
|
|
3226
3249
|
try {
|
|
3227
|
-
return
|
|
3250
|
+
return _chunkNUMGL52Rcjs.deserializeWithEncoding.call(void 0,
|
|
3228
3251
|
encoding,
|
|
3229
3252
|
new Uint8Array(await response.clone().arrayBuffer()),
|
|
3230
3253
|
HTTP_RESPONSE_ERROR_VERSIONED,
|
|
@@ -3240,7 +3263,7 @@ var ActorHandleRaw = class {
|
|
|
3240
3263
|
group: bare5.group,
|
|
3241
3264
|
code: bare5.code,
|
|
3242
3265
|
message: bare5.message,
|
|
3243
|
-
metadata: bare5.metadata ?
|
|
3266
|
+
metadata: bare5.metadata ? _chunkNUMGL52Rcjs.decodeCborCompat.call(void 0, new Uint8Array(bare5.metadata)) : void 0,
|
|
3244
3267
|
actor: bare5.actor ? {
|
|
3245
3268
|
actorId: bare5.actor.actorId,
|
|
3246
3269
|
generation: Number(bare5.actor.generation),
|
|
@@ -3344,7 +3367,7 @@ var ClientRaw = (_class = class {
|
|
|
3344
3367
|
* @returns {ActorHandle<AD>} - A handle to the actor.
|
|
3345
3368
|
*/
|
|
3346
3369
|
getForId(name, actorId, opts) {
|
|
3347
|
-
|
|
3370
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).debug({
|
|
3348
3371
|
msg: "get handle to actor with id",
|
|
3349
3372
|
name,
|
|
3350
3373
|
actorId,
|
|
@@ -3374,7 +3397,7 @@ var ClientRaw = (_class = class {
|
|
|
3374
3397
|
*/
|
|
3375
3398
|
get(name, key, opts) {
|
|
3376
3399
|
const keyArray = typeof key === "string" ? [key] : key || [];
|
|
3377
|
-
|
|
3400
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).debug({
|
|
3378
3401
|
msg: "get handle to actor",
|
|
3379
3402
|
name,
|
|
3380
3403
|
key: keyArray,
|
|
@@ -3404,7 +3427,7 @@ var ClientRaw = (_class = class {
|
|
|
3404
3427
|
*/
|
|
3405
3428
|
getOrCreate(name, key, opts) {
|
|
3406
3429
|
const keyArray = typeof key === "string" ? [key] : key || [];
|
|
3407
|
-
|
|
3430
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).debug({
|
|
3408
3431
|
msg: "get or create handle to actor",
|
|
3409
3432
|
name,
|
|
3410
3433
|
key: keyArray,
|
|
@@ -3446,7 +3469,7 @@ var ClientRaw = (_class = class {
|
|
|
3446
3469
|
key: keyArray
|
|
3447
3470
|
}
|
|
3448
3471
|
};
|
|
3449
|
-
|
|
3472
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).debug({
|
|
3450
3473
|
msg: "create actor handle",
|
|
3451
3474
|
name,
|
|
3452
3475
|
key: keyArray,
|
|
@@ -3454,7 +3477,7 @@ var ClientRaw = (_class = class {
|
|
|
3454
3477
|
create: createQuery.create
|
|
3455
3478
|
});
|
|
3456
3479
|
const actorId = await resolveGatewayTarget(this.#driver, createQuery);
|
|
3457
|
-
|
|
3480
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).debug({
|
|
3458
3481
|
msg: "created actor with ID",
|
|
3459
3482
|
name,
|
|
3460
3483
|
key: keyArray,
|
|
@@ -3497,11 +3520,11 @@ var ClientRaw = (_class = class {
|
|
|
3497
3520
|
*/
|
|
3498
3521
|
async dispose() {
|
|
3499
3522
|
if (this.#disposed) {
|
|
3500
|
-
|
|
3523
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).warn({ msg: "client already disconnected" });
|
|
3501
3524
|
return;
|
|
3502
3525
|
}
|
|
3503
3526
|
this.#disposed = true;
|
|
3504
|
-
|
|
3527
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).debug({ msg: "disposing client" });
|
|
3505
3528
|
const disposePromises = [];
|
|
3506
3529
|
for (const conn of this[ACTOR_CONNS_SYMBOL].values()) {
|
|
3507
3530
|
disposePromises.push(conn.dispose());
|
|
@@ -3668,8 +3691,8 @@ var ActorConnRaw = class {
|
|
|
3668
3691
|
if ("getForId" in actorResolutionState) {
|
|
3669
3692
|
this.#actorId = actorResolutionState.getForId.actorId;
|
|
3670
3693
|
}
|
|
3671
|
-
this.#readyPromise =
|
|
3672
|
-
(reason) =>
|
|
3694
|
+
this.#readyPromise = _chunkNUMGL52Rcjs.promiseWithResolvers.call(void 0,
|
|
3695
|
+
(reason) => _chunk7TNEDX3Ycjs.logger.call(void 0, ).warn({
|
|
3673
3696
|
msg: "unhandled ready promise rejection",
|
|
3674
3697
|
reason
|
|
3675
3698
|
})
|
|
@@ -3731,11 +3754,11 @@ var ActorConnRaw = class {
|
|
|
3731
3754
|
`Invalid action call: expected an options object { name, args }, got ${typeof opts}. Use conn.actionName(...args) for the shorthand API.`
|
|
3732
3755
|
);
|
|
3733
3756
|
}
|
|
3734
|
-
|
|
3757
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).debug({ msg: "action", name: opts.name, args: opts.args });
|
|
3735
3758
|
const actionId = this.#actionIdCounter;
|
|
3736
3759
|
this.#actionIdCounter += 1;
|
|
3737
|
-
const { promise, resolve, reject } =
|
|
3738
|
-
(reason) =>
|
|
3760
|
+
const { promise, resolve, reject } = _chunkNUMGL52Rcjs.promiseWithResolvers.call(void 0,
|
|
3761
|
+
(reason) => _chunk7TNEDX3Ycjs.logger.call(void 0, ).warn({
|
|
3739
3762
|
msg: "unhandled action promise rejection",
|
|
3740
3763
|
reason
|
|
3741
3764
|
})
|
|
@@ -3745,7 +3768,7 @@ var ActorConnRaw = class {
|
|
|
3745
3768
|
resolve,
|
|
3746
3769
|
reject
|
|
3747
3770
|
});
|
|
3748
|
-
|
|
3771
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).debug({
|
|
3749
3772
|
msg: "added action to in-flight map",
|
|
3750
3773
|
actionId,
|
|
3751
3774
|
actionName: opts.name,
|
|
@@ -3785,9 +3808,9 @@ var ActorConnRaw = class {
|
|
|
3785
3808
|
try {
|
|
3786
3809
|
handler(status);
|
|
3787
3810
|
} catch (err) {
|
|
3788
|
-
|
|
3811
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).error({
|
|
3789
3812
|
msg: "error in status change handler",
|
|
3790
|
-
error:
|
|
3813
|
+
error: _chunkNUMGL52Rcjs.stringifyError.call(void 0, err)
|
|
3791
3814
|
});
|
|
3792
3815
|
}
|
|
3793
3816
|
}
|
|
@@ -3797,9 +3820,9 @@ var ActorConnRaw = class {
|
|
|
3797
3820
|
try {
|
|
3798
3821
|
handler();
|
|
3799
3822
|
} catch (err) {
|
|
3800
|
-
|
|
3823
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).error({
|
|
3801
3824
|
msg: "error in open handler",
|
|
3802
|
-
error:
|
|
3825
|
+
error: _chunkNUMGL52Rcjs.stringifyError.call(void 0, err)
|
|
3803
3826
|
});
|
|
3804
3827
|
}
|
|
3805
3828
|
}
|
|
@@ -3809,9 +3832,9 @@ var ActorConnRaw = class {
|
|
|
3809
3832
|
try {
|
|
3810
3833
|
handler();
|
|
3811
3834
|
} catch (err) {
|
|
3812
|
-
|
|
3835
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).error({
|
|
3813
3836
|
msg: "error in close handler",
|
|
3814
|
-
error:
|
|
3837
|
+
error: _chunkNUMGL52Rcjs.stringifyError.call(void 0, err)
|
|
3815
3838
|
});
|
|
3816
3839
|
}
|
|
3817
3840
|
}
|
|
@@ -3824,21 +3847,21 @@ var ActorConnRaw = class {
|
|
|
3824
3847
|
minTimeout: 250,
|
|
3825
3848
|
maxTimeout: 3e4,
|
|
3826
3849
|
onFailedAttempt: (error) => {
|
|
3827
|
-
|
|
3850
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).warn({
|
|
3828
3851
|
msg: "failed to reconnect",
|
|
3829
3852
|
attempt: error.attemptNumber,
|
|
3830
|
-
error:
|
|
3853
|
+
error: _chunkNUMGL52Rcjs.stringifyError.call(void 0, error)
|
|
3831
3854
|
});
|
|
3832
3855
|
},
|
|
3833
3856
|
// Cancel retry if aborted
|
|
3834
3857
|
signal: this.#abortController.signal
|
|
3835
3858
|
}).catch((err) => {
|
|
3836
3859
|
if (err instanceof _pretry.AbortError || err.name === "AbortError" || !this.#shouldRetryConnectionOpenError(err)) {
|
|
3837
|
-
|
|
3860
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).info({ msg: "connection retry aborted" });
|
|
3838
3861
|
} else {
|
|
3839
|
-
|
|
3862
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).error({
|
|
3840
3863
|
msg: "unexpected error in connection retry",
|
|
3841
|
-
error:
|
|
3864
|
+
error: _chunkNUMGL52Rcjs.stringifyError.call(void 0, err)
|
|
3842
3865
|
});
|
|
3843
3866
|
}
|
|
3844
3867
|
});
|
|
@@ -3847,8 +3870,8 @@ var ActorConnRaw = class {
|
|
|
3847
3870
|
try {
|
|
3848
3871
|
if (this.#onOpenPromise)
|
|
3849
3872
|
throw new Error("#onOpenPromise already defined");
|
|
3850
|
-
this.#onOpenPromise =
|
|
3851
|
-
(reason) =>
|
|
3873
|
+
this.#onOpenPromise = _chunkNUMGL52Rcjs.promiseWithResolvers.call(void 0,
|
|
3874
|
+
(reason) => _chunk7TNEDX3Ycjs.logger.call(void 0, ).warn({
|
|
3852
3875
|
msg: "unhandled open promise rejection",
|
|
3853
3876
|
reason
|
|
3854
3877
|
})
|
|
@@ -3862,15 +3885,15 @@ var ActorConnRaw = class {
|
|
|
3862
3885
|
const actorError = error instanceof _chunk4FC7TVS6cjs.RivetError ? error : new (0, _chunk4FC7TVS6cjs.RivetError)(
|
|
3863
3886
|
"client",
|
|
3864
3887
|
"connection_open_failed",
|
|
3865
|
-
`Failed to open connection: ${
|
|
3866
|
-
{ error:
|
|
3888
|
+
`Failed to open connection: ${_chunkNUMGL52Rcjs.stringifyError.call(void 0, error)}`,
|
|
3889
|
+
{ error: _chunkNUMGL52Rcjs.stringifyError.call(void 0, error) }
|
|
3867
3890
|
);
|
|
3868
3891
|
this.#clearQueuedMessages();
|
|
3869
3892
|
this.#rejectPendingPromises(actorError, false);
|
|
3870
3893
|
this.#dispatchActorError(actorError);
|
|
3871
3894
|
this.#setConnStatus("idle");
|
|
3872
3895
|
throw new (0, _pretry.AbortError)(
|
|
3873
|
-
error instanceof Error ? error : new Error(
|
|
3896
|
+
error instanceof Error ? error : new Error(_chunkNUMGL52Rcjs.stringifyError.call(void 0, error))
|
|
3874
3897
|
);
|
|
3875
3898
|
} finally {
|
|
3876
3899
|
this.#onOpenPromise = void 0;
|
|
@@ -3890,7 +3913,7 @@ var ActorConnRaw = class {
|
|
|
3890
3913
|
}
|
|
3891
3914
|
#clearQueuedMessages() {
|
|
3892
3915
|
if (this.#messageQueue.length === 0) return;
|
|
3893
|
-
|
|
3916
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).debug({
|
|
3894
3917
|
msg: "clearing queued connection messages",
|
|
3895
3918
|
queueLength: this.#messageQueue.length
|
|
3896
3919
|
});
|
|
@@ -3903,7 +3926,7 @@ var ActorConnRaw = class {
|
|
|
3903
3926
|
try {
|
|
3904
3927
|
return await this.#getParams();
|
|
3905
3928
|
} catch (err) {
|
|
3906
|
-
const errorMessage =
|
|
3929
|
+
const errorMessage = _chunkNUMGL52Rcjs.stringifyError.call(void 0, err);
|
|
3907
3930
|
const error = new (0, _chunk4FC7TVS6cjs.RivetError)(
|
|
3908
3931
|
"client",
|
|
3909
3932
|
"get_params_failed",
|
|
@@ -3927,7 +3950,7 @@ var ActorConnRaw = class {
|
|
|
3927
3950
|
this.#gatewayOptions
|
|
3928
3951
|
);
|
|
3929
3952
|
_invariant2.default.call(void 0, ws, "websocket should have been created");
|
|
3930
|
-
|
|
3953
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).debug({
|
|
3931
3954
|
msg: "opened websocket",
|
|
3932
3955
|
connId: this.#connId,
|
|
3933
3956
|
readyState: ws.readyState,
|
|
@@ -3935,7 +3958,7 @@ var ActorConnRaw = class {
|
|
|
3935
3958
|
});
|
|
3936
3959
|
this.#websocket = ws;
|
|
3937
3960
|
ws.addEventListener("open", () => {
|
|
3938
|
-
|
|
3961
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).debug({
|
|
3939
3962
|
msg: "client websocket open",
|
|
3940
3963
|
connId: this.#connId
|
|
3941
3964
|
});
|
|
@@ -3944,9 +3967,9 @@ var ActorConnRaw = class {
|
|
|
3944
3967
|
try {
|
|
3945
3968
|
await this.#handleOnMessage(ev.data);
|
|
3946
3969
|
} catch (err) {
|
|
3947
|
-
|
|
3970
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).error({
|
|
3948
3971
|
msg: "error in websocket message handler",
|
|
3949
|
-
error:
|
|
3972
|
+
error: _chunkNUMGL52Rcjs.stringifyError.call(void 0, err)
|
|
3950
3973
|
});
|
|
3951
3974
|
}
|
|
3952
3975
|
});
|
|
@@ -3954,9 +3977,9 @@ var ActorConnRaw = class {
|
|
|
3954
3977
|
try {
|
|
3955
3978
|
await this.#handleOnClose(ev);
|
|
3956
3979
|
} catch (err) {
|
|
3957
|
-
|
|
3980
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).error({
|
|
3958
3981
|
msg: "error in websocket close handler",
|
|
3959
|
-
error:
|
|
3982
|
+
error: _chunkNUMGL52Rcjs.stringifyError.call(void 0, err)
|
|
3960
3983
|
});
|
|
3961
3984
|
}
|
|
3962
3985
|
});
|
|
@@ -3964,9 +3987,9 @@ var ActorConnRaw = class {
|
|
|
3964
3987
|
try {
|
|
3965
3988
|
this.#handleOnError();
|
|
3966
3989
|
} catch (err) {
|
|
3967
|
-
|
|
3990
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).error({
|
|
3968
3991
|
msg: "error in websocket error handler",
|
|
3969
|
-
error:
|
|
3992
|
+
error: _chunkNUMGL52Rcjs.stringifyError.call(void 0, err)
|
|
3970
3993
|
});
|
|
3971
3994
|
}
|
|
3972
3995
|
});
|
|
@@ -3974,7 +3997,7 @@ var ActorConnRaw = class {
|
|
|
3974
3997
|
/** Called by the onopen event from drivers. */
|
|
3975
3998
|
#handleOnOpen() {
|
|
3976
3999
|
if (this.#disposed) {
|
|
3977
|
-
|
|
4000
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).debug({
|
|
3978
4001
|
msg: "handleOnOpen called after dispose, closing websocket"
|
|
3979
4002
|
});
|
|
3980
4003
|
if (this.#websocket) {
|
|
@@ -3990,7 +4013,7 @@ var ActorConnRaw = class {
|
|
|
3990
4013
|
queueMicrotask(() => {
|
|
3991
4014
|
this.#openScheduled = false;
|
|
3992
4015
|
if (this.#disposed) {
|
|
3993
|
-
|
|
4016
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).debug({
|
|
3994
4017
|
msg: "handleOnOpen scheduled after dispose, closing websocket"
|
|
3995
4018
|
});
|
|
3996
4019
|
if (this.#websocket) {
|
|
@@ -3999,7 +4022,7 @@ var ActorConnRaw = class {
|
|
|
3999
4022
|
}
|
|
4000
4023
|
return;
|
|
4001
4024
|
}
|
|
4002
|
-
|
|
4025
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).debug({
|
|
4003
4026
|
msg: "socket open",
|
|
4004
4027
|
messageQueueLength: this.#messageQueue.length,
|
|
4005
4028
|
connId: this.#connId
|
|
@@ -4008,14 +4031,14 @@ var ActorConnRaw = class {
|
|
|
4008
4031
|
if (this.#onOpenPromise) {
|
|
4009
4032
|
this.#onOpenPromise.resolve(void 0);
|
|
4010
4033
|
} else {
|
|
4011
|
-
|
|
4034
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).warn({ msg: "#onOpenPromise is undefined" });
|
|
4012
4035
|
}
|
|
4013
4036
|
for (const eventName of this.#eventSubscriptions.keys()) {
|
|
4014
4037
|
this.#sendSubscription(eventName, true);
|
|
4015
4038
|
}
|
|
4016
4039
|
const queue = this.#messageQueue;
|
|
4017
4040
|
this.#messageQueue = [];
|
|
4018
|
-
|
|
4041
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).debug({
|
|
4019
4042
|
msg: "flushing message queue",
|
|
4020
4043
|
queueLength: queue.length
|
|
4021
4044
|
});
|
|
@@ -4027,23 +4050,23 @@ var ActorConnRaw = class {
|
|
|
4027
4050
|
/** Called by the onmessage event from drivers. */
|
|
4028
4051
|
async #handleOnMessage(data) {
|
|
4029
4052
|
var _a;
|
|
4030
|
-
|
|
4053
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).trace({
|
|
4031
4054
|
msg: "received message",
|
|
4032
4055
|
dataType: typeof data,
|
|
4033
4056
|
isBlob: data instanceof Blob,
|
|
4034
4057
|
isArrayBuffer: data instanceof ArrayBuffer
|
|
4035
4058
|
});
|
|
4036
4059
|
const response = await this.#parseMessage(data);
|
|
4037
|
-
|
|
4038
|
-
|
|
4060
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).trace(
|
|
4061
|
+
_chunkNUMGL52Rcjs.getLogMessage.call(void 0, ) ? {
|
|
4039
4062
|
msg: "parsed message",
|
|
4040
|
-
message:
|
|
4063
|
+
message: _chunkNUMGL52Rcjs.jsonStringifyCompat.call(void 0, response).substring(0, 100) + "..."
|
|
4041
4064
|
} : { msg: "parsed message" }
|
|
4042
4065
|
);
|
|
4043
4066
|
if (response.body.tag === "Init") {
|
|
4044
4067
|
this.#actorId = response.body.val.actorId;
|
|
4045
4068
|
this.#connId = response.body.val.connectionId;
|
|
4046
|
-
|
|
4069
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).trace({
|
|
4047
4070
|
msg: "received init message",
|
|
4048
4071
|
actorId: this.#actorId,
|
|
4049
4072
|
connId: this.#connId
|
|
@@ -4054,7 +4077,7 @@ var ActorConnRaw = class {
|
|
|
4054
4077
|
if (actionId !== null) {
|
|
4055
4078
|
const inFlight = this.#takeActionInFlight(Number(actionId));
|
|
4056
4079
|
this.#invalidateActorIfStale(group, code);
|
|
4057
|
-
|
|
4080
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).warn({
|
|
4058
4081
|
msg: "action error",
|
|
4059
4082
|
actionId,
|
|
4060
4083
|
actionName: inFlight == null ? void 0 : inFlight.name,
|
|
@@ -4073,7 +4096,7 @@ var ActorConnRaw = class {
|
|
|
4073
4096
|
})
|
|
4074
4097
|
);
|
|
4075
4098
|
} else {
|
|
4076
|
-
|
|
4099
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).warn({
|
|
4077
4100
|
msg: "connection error",
|
|
4078
4101
|
group,
|
|
4079
4102
|
code,
|
|
@@ -4121,27 +4144,27 @@ var ActorConnRaw = class {
|
|
|
4121
4144
|
}
|
|
4122
4145
|
} else if (response.body.tag === "ActionResponse") {
|
|
4123
4146
|
const { id: actionId } = response.body.val;
|
|
4124
|
-
|
|
4147
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).debug({
|
|
4125
4148
|
msg: "received action response",
|
|
4126
4149
|
actionId: Number(actionId),
|
|
4127
4150
|
inFlightCount: this.#actionsInFlight.size,
|
|
4128
4151
|
inFlightIds: Array.from(this.#actionsInFlight.keys())
|
|
4129
4152
|
});
|
|
4130
4153
|
const inFlight = this.#takeActionInFlight(Number(actionId));
|
|
4131
|
-
|
|
4154
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).trace({
|
|
4132
4155
|
msg: "resolving action promise",
|
|
4133
4156
|
actionId,
|
|
4134
4157
|
actionName: inFlight == null ? void 0 : inFlight.name
|
|
4135
4158
|
});
|
|
4136
4159
|
inFlight.resolve(response.body.val);
|
|
4137
4160
|
} else if (response.body.tag === "Event") {
|
|
4138
|
-
|
|
4161
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).trace({
|
|
4139
4162
|
msg: "received event",
|
|
4140
4163
|
name: response.body.val.name
|
|
4141
4164
|
});
|
|
4142
4165
|
this.#dispatchEvent(response.body.val);
|
|
4143
4166
|
} else {
|
|
4144
|
-
|
|
4167
|
+
_chunkNUMGL52Rcjs.assertUnreachable.call(void 0, response.body);
|
|
4145
4168
|
}
|
|
4146
4169
|
}
|
|
4147
4170
|
/** Called by the onclose event from drivers. */
|
|
@@ -4150,7 +4173,7 @@ var ActorConnRaw = class {
|
|
|
4150
4173
|
const closeEvent = event;
|
|
4151
4174
|
const wasClean = closeEvent.wasClean;
|
|
4152
4175
|
const wasConnected = this.#connStatus === "connected";
|
|
4153
|
-
|
|
4176
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).info({
|
|
4154
4177
|
msg: "socket closed",
|
|
4155
4178
|
code: closeEvent.code,
|
|
4156
4179
|
reason: closeEvent.reason,
|
|
@@ -4217,7 +4240,7 @@ var ActorConnRaw = class {
|
|
|
4217
4240
|
this.#dispatchActorError(error);
|
|
4218
4241
|
}
|
|
4219
4242
|
if (wasConnected) {
|
|
4220
|
-
|
|
4243
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).debug({
|
|
4221
4244
|
msg: "triggering reconnect",
|
|
4222
4245
|
connId: this.#connId
|
|
4223
4246
|
});
|
|
@@ -4241,12 +4264,12 @@ var ActorConnRaw = class {
|
|
|
4241
4264
|
/** Called by the onerror event from drivers. */
|
|
4242
4265
|
#handleOnError() {
|
|
4243
4266
|
if (this.#disposed) return;
|
|
4244
|
-
|
|
4267
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).warn("socket error");
|
|
4245
4268
|
}
|
|
4246
4269
|
#takeActionInFlight(id) {
|
|
4247
4270
|
const inFlight = this.#actionsInFlight.get(id);
|
|
4248
4271
|
if (!inFlight) {
|
|
4249
|
-
|
|
4272
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).error({
|
|
4250
4273
|
msg: "action not found in in-flight map",
|
|
4251
4274
|
lookupId: id,
|
|
4252
4275
|
inFlightCount: this.#actionsInFlight.size,
|
|
@@ -4261,7 +4284,7 @@ var ActorConnRaw = class {
|
|
|
4261
4284
|
throw internalClientError(`No in flight response for ${id}`);
|
|
4262
4285
|
}
|
|
4263
4286
|
this.#actionsInFlight.delete(id);
|
|
4264
|
-
|
|
4287
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).debug({
|
|
4265
4288
|
msg: "removed action from in-flight map",
|
|
4266
4289
|
actionId: id,
|
|
4267
4290
|
actionName: inFlight.name,
|
|
@@ -4288,9 +4311,9 @@ var ActorConnRaw = class {
|
|
|
4288
4311
|
try {
|
|
4289
4312
|
handler(error);
|
|
4290
4313
|
} catch (err) {
|
|
4291
|
-
|
|
4314
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).error({
|
|
4292
4315
|
msg: "error in connection error handler",
|
|
4293
|
-
error:
|
|
4316
|
+
error: _chunkNUMGL52Rcjs.stringifyError.call(void 0, err)
|
|
4294
4317
|
});
|
|
4295
4318
|
}
|
|
4296
4319
|
}
|
|
@@ -4395,9 +4418,9 @@ var ActorConnRaw = class {
|
|
|
4395
4418
|
try {
|
|
4396
4419
|
callback();
|
|
4397
4420
|
} catch (err) {
|
|
4398
|
-
|
|
4421
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).error({
|
|
4399
4422
|
msg: "error in open handler",
|
|
4400
|
-
error:
|
|
4423
|
+
error: _chunkNUMGL52Rcjs.stringifyError.call(void 0, err)
|
|
4401
4424
|
});
|
|
4402
4425
|
}
|
|
4403
4426
|
});
|
|
@@ -4447,7 +4470,7 @@ var ActorConnRaw = class {
|
|
|
4447
4470
|
let queueMessage = false;
|
|
4448
4471
|
if (this.#websocket) {
|
|
4449
4472
|
const readyState = this.#websocket.readyState;
|
|
4450
|
-
|
|
4473
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).debug({
|
|
4451
4474
|
msg: "websocket send attempt",
|
|
4452
4475
|
readyState,
|
|
4453
4476
|
readyStateString: readyState === 0 ? "CONNECTING" : readyState === 1 ? "OPEN" : readyState === 2 ? "CLOSING" : "CLOSED",
|
|
@@ -4456,7 +4479,7 @@ var ActorConnRaw = class {
|
|
|
4456
4479
|
actionName: (_a = message.body.val) == null ? void 0 : _a.name
|
|
4457
4480
|
});
|
|
4458
4481
|
if (this.#connStatus !== "connected") {
|
|
4459
|
-
|
|
4482
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).debug({
|
|
4460
4483
|
msg: "websocket init pending, queueing message",
|
|
4461
4484
|
connStatus: this.#connStatus,
|
|
4462
4485
|
messageType: message.body.tag
|
|
@@ -4464,7 +4487,7 @@ var ActorConnRaw = class {
|
|
|
4464
4487
|
queueMessage = true;
|
|
4465
4488
|
} else if (readyState === 1) {
|
|
4466
4489
|
try {
|
|
4467
|
-
const messageSerialized =
|
|
4490
|
+
const messageSerialized = _chunkNUMGL52Rcjs.serializeWithEncoding.call(void 0,
|
|
4468
4491
|
this.#encoding,
|
|
4469
4492
|
message,
|
|
4470
4493
|
CLIENT_PROTOCOL_TO_SERVER,
|
|
@@ -4481,8 +4504,8 @@ var ActorConnRaw = class {
|
|
|
4481
4504
|
val: {
|
|
4482
4505
|
id: msg.body.val.id,
|
|
4483
4506
|
name: msg.body.val.name,
|
|
4484
|
-
args:
|
|
4485
|
-
|
|
4507
|
+
args: _chunkNUMGL52Rcjs.bufferToArrayBuffer.call(void 0,
|
|
4508
|
+
_chunkNUMGL52Rcjs.encodeCborCompat.call(void 0,
|
|
4486
4509
|
msg.body.val.args
|
|
4487
4510
|
)
|
|
4488
4511
|
)
|
|
@@ -4496,12 +4519,12 @@ var ActorConnRaw = class {
|
|
|
4496
4519
|
);
|
|
4497
4520
|
this.#websocket.send(messageSerialized);
|
|
4498
4521
|
const serializedLength = messageLength(messageSerialized);
|
|
4499
|
-
|
|
4522
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).trace({
|
|
4500
4523
|
msg: "sent websocket message",
|
|
4501
4524
|
len: serializedLength
|
|
4502
4525
|
});
|
|
4503
4526
|
} catch (error) {
|
|
4504
|
-
|
|
4527
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).warn({
|
|
4505
4528
|
msg: "failed to send message, added to queue",
|
|
4506
4529
|
error,
|
|
4507
4530
|
connId: this.#connId
|
|
@@ -4509,19 +4532,19 @@ var ActorConnRaw = class {
|
|
|
4509
4532
|
queueMessage = true;
|
|
4510
4533
|
}
|
|
4511
4534
|
} else {
|
|
4512
|
-
|
|
4535
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).debug({
|
|
4513
4536
|
msg: "websocket not open, queueing message",
|
|
4514
4537
|
readyState
|
|
4515
4538
|
});
|
|
4516
4539
|
queueMessage = true;
|
|
4517
4540
|
}
|
|
4518
4541
|
} else {
|
|
4519
|
-
|
|
4542
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).debug({ msg: "no websocket, queueing message" });
|
|
4520
4543
|
queueMessage = true;
|
|
4521
4544
|
}
|
|
4522
4545
|
if (!(opts == null ? void 0 : opts.ephemeral) && queueMessage) {
|
|
4523
4546
|
this.#messageQueue.push(message);
|
|
4524
|
-
|
|
4547
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).debug({
|
|
4525
4548
|
msg: "queued connection message",
|
|
4526
4549
|
queueLength: this.#messageQueue.length,
|
|
4527
4550
|
connId: this.#connId,
|
|
@@ -4532,8 +4555,8 @@ var ActorConnRaw = class {
|
|
|
4532
4555
|
}
|
|
4533
4556
|
async #parseMessage(data) {
|
|
4534
4557
|
_invariant2.default.call(void 0, this.#websocket, "websocket must be defined");
|
|
4535
|
-
const buffer = await
|
|
4536
|
-
return
|
|
4558
|
+
const buffer = await _chunkNUMGL52Rcjs.inputDataToBuffer.call(void 0, data);
|
|
4559
|
+
return _chunkNUMGL52Rcjs.deserializeWithEncoding.call(void 0,
|
|
4537
4560
|
this.#encoding,
|
|
4538
4561
|
buffer,
|
|
4539
4562
|
CLIENT_PROTOCOL_TO_CLIENT,
|
|
@@ -4568,7 +4591,7 @@ var ActorConnRaw = class {
|
|
|
4568
4591
|
group: msg.body.val.group,
|
|
4569
4592
|
code: msg.body.val.code,
|
|
4570
4593
|
message: msg.body.val.message,
|
|
4571
|
-
metadata: msg.body.val.metadata ?
|
|
4594
|
+
metadata: msg.body.val.metadata ? _chunkNUMGL52Rcjs.decodeCborCompat.call(void 0,
|
|
4572
4595
|
new Uint8Array(
|
|
4573
4596
|
msg.body.val.metadata
|
|
4574
4597
|
)
|
|
@@ -4590,7 +4613,7 @@ var ActorConnRaw = class {
|
|
|
4590
4613
|
tag: "ActionResponse",
|
|
4591
4614
|
val: {
|
|
4592
4615
|
id: msg.body.val.id,
|
|
4593
|
-
output:
|
|
4616
|
+
output: _chunkNUMGL52Rcjs.decodeCborCompat.call(void 0,
|
|
4594
4617
|
new Uint8Array(msg.body.val.output)
|
|
4595
4618
|
)
|
|
4596
4619
|
}
|
|
@@ -4602,7 +4625,7 @@ var ActorConnRaw = class {
|
|
|
4602
4625
|
tag: "Event",
|
|
4603
4626
|
val: {
|
|
4604
4627
|
name: msg.body.val.name,
|
|
4605
|
-
args:
|
|
4628
|
+
args: _chunkNUMGL52Rcjs.decodeCborCompat.call(void 0,
|
|
4606
4629
|
new Uint8Array(msg.body.val.args)
|
|
4607
4630
|
)
|
|
4608
4631
|
}
|
|
@@ -4643,11 +4666,11 @@ var ActorConnRaw = class {
|
|
|
4643
4666
|
*/
|
|
4644
4667
|
async dispose() {
|
|
4645
4668
|
if (this.#disposed) {
|
|
4646
|
-
|
|
4669
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).warn({ msg: "connection already disconnected" });
|
|
4647
4670
|
return;
|
|
4648
4671
|
}
|
|
4649
4672
|
this.#disposed = true;
|
|
4650
|
-
|
|
4673
|
+
_chunk7TNEDX3Ycjs.logger.call(void 0, ).debug({ msg: "disposing actor conn" });
|
|
4651
4674
|
this.#setConnStatus("idle");
|
|
4652
4675
|
clearInterval(this.#keepNodeAliveInterval);
|
|
4653
4676
|
this.#abortController.abort();
|
|
@@ -4655,8 +4678,8 @@ var ActorConnRaw = class {
|
|
|
4655
4678
|
if (this.#websocket) {
|
|
4656
4679
|
const ws = this.#websocket;
|
|
4657
4680
|
if (ws.readyState !== 2 && ws.readyState !== 3) {
|
|
4658
|
-
const { promise, resolve } =
|
|
4659
|
-
(reason) =>
|
|
4681
|
+
const { promise, resolve } = _chunkNUMGL52Rcjs.promiseWithResolvers.call(void 0,
|
|
4682
|
+
(reason) => _chunk7TNEDX3Ycjs.logger.call(void 0, ).warn({
|
|
4660
4683
|
msg: "unhandled websocket close promise rejection",
|
|
4661
4684
|
reason
|
|
4662
4685
|
})
|
|
@@ -4775,7 +4798,7 @@ var ClientConfigSchemaBase = _v42.default.object({
|
|
|
4775
4798
|
* Defaults to http://localhost:6420.
|
|
4776
4799
|
*/
|
|
4777
4800
|
endpoint: _v42.default.string().optional().transform((val) => {
|
|
4778
|
-
const resolved = _nullishCoalesce(_nullishCoalesce(val, () => (
|
|
4801
|
+
const resolved = _nullishCoalesce(_nullishCoalesce(val, () => ( _chunkNUMGL52Rcjs.getRivetEngine.call(void 0, ))), () => ( _chunkNUMGL52Rcjs.getRivetEndpoint.call(void 0, )));
|
|
4779
4802
|
if (!resolved && !hasWarnedMissingEndpoint) {
|
|
4780
4803
|
hasWarnedMissingEndpoint = true;
|
|
4781
4804
|
console.warn(
|
|
@@ -4785,12 +4808,12 @@ var ClientConfigSchemaBase = _v42.default.object({
|
|
|
4785
4808
|
return _nullishCoalesce(resolved, () => ( DEFAULT_ENDPOINT));
|
|
4786
4809
|
}),
|
|
4787
4810
|
/** Token to use to authenticate with the API. */
|
|
4788
|
-
token: _v42.default.string().optional().transform((val) => _nullishCoalesce(val, () => (
|
|
4811
|
+
token: _v42.default.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkNUMGL52Rcjs.getRivetToken.call(void 0, )))),
|
|
4789
4812
|
/** Namespace to connect to. */
|
|
4790
|
-
namespace: _v42.default.string().optional().transform((val) => _nullishCoalesce(val, () => (
|
|
4813
|
+
namespace: _v42.default.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkNUMGL52Rcjs.getRivetNamespace.call(void 0, )))),
|
|
4791
4814
|
/** Name of the envoy pool. This is used to group together envoys in to different pools. */
|
|
4792
|
-
poolName: _v42.default.string().default(() => _nullishCoalesce(
|
|
4793
|
-
encoding:
|
|
4815
|
+
poolName: _v42.default.string().default(() => _nullishCoalesce(_chunkNUMGL52Rcjs.getRivetPool.call(void 0, ), () => ( "default"))),
|
|
4816
|
+
encoding: _chunkNUMGL52Rcjs.EncodingSchema.default("bare"),
|
|
4794
4817
|
headers: _v42.default.record(_v42.default.string(), _v42.default.string()).optional().default(() => ({})),
|
|
4795
4818
|
gateway: _v42.default.object({
|
|
4796
4819
|
skipReadyWait: _v42.default.boolean().optional().default(false)
|
|
@@ -4867,23 +4890,19 @@ async function sendHttpRequestToGateway(runConfig, gatewayUrl, actorRequest, opt
|
|
|
4867
4890
|
if (actorRequest.bodyUsed) {
|
|
4868
4891
|
throw new Error("Request body has already been consumed");
|
|
4869
4892
|
}
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
bodyToSend = reqBody;
|
|
4893
|
+
if (actorRequest.body) {
|
|
4894
|
+
bodyToSend = actorRequest.body;
|
|
4873
4895
|
guardHeaders.delete("transfer-encoding");
|
|
4874
4896
|
guardHeaders.delete("content-length");
|
|
4875
4897
|
}
|
|
4876
4898
|
}
|
|
4877
|
-
|
|
4899
|
+
return fetch(gatewayUrl, {
|
|
4878
4900
|
method: actorRequest.method,
|
|
4879
4901
|
headers: guardHeaders,
|
|
4880
4902
|
body: bodyToSend,
|
|
4881
|
-
signal: actorRequest.signal
|
|
4903
|
+
signal: actorRequest.signal,
|
|
4904
|
+
...bodyToSend ? { duplex: "half" } : {}
|
|
4882
4905
|
});
|
|
4883
|
-
return mutableResponse(await fetch(guardRequest));
|
|
4884
|
-
}
|
|
4885
|
-
function mutableResponse(fetchRes) {
|
|
4886
|
-
return new Response(fetchRes.body, fetchRes);
|
|
4887
4906
|
}
|
|
4888
4907
|
function buildGuardHeaders(runConfig, actorRequest, options) {
|
|
4889
4908
|
const headers = new Headers();
|
|
@@ -4949,7 +4968,7 @@ function setRemoteHibernatableWebSocketAckTestHooks(websocket, token, enabled) {
|
|
|
4949
4968
|
|
|
4950
4969
|
// src/engine-client/log.ts
|
|
4951
4970
|
function logger2() {
|
|
4952
|
-
return
|
|
4971
|
+
return _chunkNUMGL52Rcjs.getLogger.call(void 0, "engine-client");
|
|
4953
4972
|
}
|
|
4954
4973
|
|
|
4955
4974
|
// src/engine-client/actor-websocket-client.ts
|
|
@@ -5082,7 +5101,7 @@ var BufferedRemoteWebSocket = (_class2 = class {
|
|
|
5082
5101
|
function buildActorGatewayUrl(endpoint, actorId, token, path = "") {
|
|
5083
5102
|
const tokenSegment = token !== void 0 ? `@${encodeURIComponent(token)}` : "";
|
|
5084
5103
|
const gatewayPath = `/gateway/${encodeURIComponent(actorId)}${tokenSegment}${path}`;
|
|
5085
|
-
return
|
|
5104
|
+
return _chunkNUMGL52Rcjs.combineUrlPath.call(void 0, endpoint, gatewayPath);
|
|
5086
5105
|
}
|
|
5087
5106
|
function buildActorQueryGatewayUrl(endpoint, namespace, query, token, path = "", maxInputSize = DEFAULT_MAX_QUERY_INPUT_SIZE, crashPolicy = void 0, runnerName, options = {}) {
|
|
5088
5107
|
if (namespace.length === 0) {
|
|
@@ -5148,7 +5167,7 @@ function buildActorQueryGatewayUrl(endpoint, namespace, query, token, path = "",
|
|
|
5148
5167
|
separator = "?";
|
|
5149
5168
|
}
|
|
5150
5169
|
const gatewayPath = `/gateway/${encodeURIComponent(name)}${path}${separator}${queryString}`;
|
|
5151
|
-
return
|
|
5170
|
+
return _chunkNUMGL52Rcjs.combineUrlPath.call(void 0, endpoint, gatewayPath);
|
|
5152
5171
|
}
|
|
5153
5172
|
function pushKeyQueryParams(params, key) {
|
|
5154
5173
|
if (key.length > 0) {
|
|
@@ -5159,7 +5178,7 @@ function pushInputQueryParam(params, input, maxInputSize) {
|
|
|
5159
5178
|
if (input === void 0) {
|
|
5160
5179
|
return;
|
|
5161
5180
|
}
|
|
5162
|
-
const encodedInput =
|
|
5181
|
+
const encodedInput = _chunkNUMGL52Rcjs.encodeCborCompat.call(void 0, input);
|
|
5163
5182
|
if (encodedInput.byteLength > maxInputSize) {
|
|
5164
5183
|
throw new Error(
|
|
5165
5184
|
`Actor query input exceeds maxInputSize (${encodedInput.byteLength} > ${maxInputSize} bytes). Increase client maxInputSize to allow larger query payloads.`
|
|
@@ -5168,10 +5187,10 @@ function pushInputQueryParam(params, input, maxInputSize) {
|
|
|
5168
5187
|
params.append("rvt-input", uint8ArrayToBase64Url(encodedInput));
|
|
5169
5188
|
}
|
|
5170
5189
|
function uint8ArrayToBase64Url(value) {
|
|
5171
|
-
return
|
|
5190
|
+
return _chunkNUMGL52Rcjs.uint8ArrayToBase64.call(void 0, value).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/g, "");
|
|
5172
5191
|
}
|
|
5173
5192
|
async function openWebSocketToGateway(runConfig, gatewayUrl, encoding, params, options = {}) {
|
|
5174
|
-
const WebSocket2 = await
|
|
5193
|
+
const WebSocket2 = await _chunk7TNEDX3Ycjs.importWebSocket.call(void 0, );
|
|
5175
5194
|
const ackHookToken = typeof process !== "undefined" && process.env.VITEST ? crypto.randomUUID() : void 0;
|
|
5176
5195
|
logger2().debug({
|
|
5177
5196
|
msg: "opening websocket to actor via guard",
|
|
@@ -5238,7 +5257,7 @@ function getEndpoint(config) {
|
|
|
5238
5257
|
}
|
|
5239
5258
|
async function apiCall(config, method, path, body) {
|
|
5240
5259
|
const endpoint = getEndpoint(config);
|
|
5241
|
-
const url =
|
|
5260
|
+
const url = _chunkNUMGL52Rcjs.combineUrlPath.call(void 0, endpoint, path, {
|
|
5242
5261
|
namespace: config.namespace
|
|
5243
5262
|
});
|
|
5244
5263
|
logger2().debug({ msg: "making api call", method, url });
|
|
@@ -5363,7 +5382,7 @@ async function lookupMetadataCached(config) {
|
|
|
5363
5382
|
msg: "failed to fetch metadata, retrying",
|
|
5364
5383
|
endpoint,
|
|
5365
5384
|
attempt: error.attemptNumber,
|
|
5366
|
-
error:
|
|
5385
|
+
error: _chunkNUMGL52Rcjs.stringifyError.call(void 0, error)
|
|
5367
5386
|
});
|
|
5368
5387
|
}
|
|
5369
5388
|
}
|
|
@@ -5375,7 +5394,7 @@ async function lookupMetadataCached(config) {
|
|
|
5375
5394
|
|
|
5376
5395
|
// src/engine-client/ws-proxy.ts
|
|
5377
5396
|
async function createWebSocketProxy(_c, targetUrl, protocols) {
|
|
5378
|
-
const WebSocket2 = await
|
|
5397
|
+
const WebSocket2 = await _chunk7TNEDX3Ycjs.importWebSocket.call(void 0, );
|
|
5379
5398
|
const state = {};
|
|
5380
5399
|
return {
|
|
5381
5400
|
onOpen: async (_event, clientWs) => {
|
|
@@ -5440,7 +5459,7 @@ async function createWebSocketProxy(_c, targetUrl, protocols) {
|
|
|
5440
5459
|
logger2().error({
|
|
5441
5460
|
msg: "target websocket error",
|
|
5442
5461
|
targetUrl,
|
|
5443
|
-
error:
|
|
5462
|
+
error: _chunkNUMGL52Rcjs.stringifyError.call(void 0, error)
|
|
5444
5463
|
});
|
|
5445
5464
|
closeWebSocketIfOpen(clientWs, 1011, "Target WebSocket error");
|
|
5446
5465
|
});
|
|
@@ -5519,7 +5538,7 @@ var RemoteEngineControlClient = class {
|
|
|
5519
5538
|
#config;
|
|
5520
5539
|
#metadataPromise;
|
|
5521
5540
|
constructor(runConfig) {
|
|
5522
|
-
if (
|
|
5541
|
+
if (_chunkNUMGL52Rcjs.getNextPhase.call(void 0, ) === "phase-production-build") {
|
|
5523
5542
|
logger2().info(
|
|
5524
5543
|
"detected next.js build phase, disabling health check"
|
|
5525
5544
|
);
|
|
@@ -5610,8 +5629,8 @@ var RemoteEngineControlClient = class {
|
|
|
5610
5629
|
name,
|
|
5611
5630
|
key: _chunkMYWZCDMLcjs.serializeActorKey.call(void 0, key),
|
|
5612
5631
|
runner_name_selector: this.#config.poolName,
|
|
5613
|
-
input: actorInput ?
|
|
5614
|
-
|
|
5632
|
+
input: actorInput ? _chunkNUMGL52Rcjs.uint8ArrayToBase64.call(void 0,
|
|
5633
|
+
_chunkNUMGL52Rcjs.encodeCborCompat.call(void 0, actorInput)
|
|
5615
5634
|
) : void 0,
|
|
5616
5635
|
crash_policy: _nullishCoalesce(crashPolicy, () => ( "sleep"))
|
|
5617
5636
|
});
|
|
@@ -5638,7 +5657,7 @@ var RemoteEngineControlClient = class {
|
|
|
5638
5657
|
name,
|
|
5639
5658
|
runner_name_selector: this.#config.poolName,
|
|
5640
5659
|
key: _chunkMYWZCDMLcjs.serializeActorKey.call(void 0, key),
|
|
5641
|
-
input: input ?
|
|
5660
|
+
input: input ? _chunkNUMGL52Rcjs.uint8ArrayToBase64.call(void 0, _chunkNUMGL52Rcjs.encodeCborCompat.call(void 0, input)) : void 0,
|
|
5642
5661
|
crash_policy: _nullishCoalesce(crashPolicy, () => ( "sleep"))
|
|
5643
5662
|
});
|
|
5644
5663
|
logger2().info({
|
|
@@ -5716,7 +5735,7 @@ var RemoteEngineControlClient = class {
|
|
|
5716
5735
|
const upgradeWebSocket = (_b = (_a = this.#config).getUpgradeWebSocket) == null ? void 0 : _b.call(_a);
|
|
5717
5736
|
_invariant2.default.call(void 0, upgradeWebSocket, "missing getUpgradeWebSocket");
|
|
5718
5737
|
const endpoint = getEndpoint(this.#config);
|
|
5719
|
-
const guardUrl =
|
|
5738
|
+
const guardUrl = _chunkNUMGL52Rcjs.combineUrlPath.call(void 0, endpoint, path);
|
|
5720
5739
|
const wsGuardUrl = guardUrl.replace("http://", "ws://");
|
|
5721
5740
|
logger2().debug({
|
|
5722
5741
|
msg: "forwarding websocket to actor via guard",
|
|
@@ -5735,7 +5754,7 @@ var RemoteEngineControlClient = class {
|
|
|
5735
5754
|
}
|
|
5736
5755
|
);
|
|
5737
5756
|
const args = await createWebSocketProxy(c, wsGuardUrl, protocols);
|
|
5738
|
-
return await upgradeWebSocket(() => args)(c,
|
|
5757
|
+
return await upgradeWebSocket(() => args)(c, _chunkNUMGL52Rcjs.noopNext.call(void 0, ));
|
|
5739
5758
|
}
|
|
5740
5759
|
displayInformation() {
|
|
5741
5760
|
return { properties: {} };
|
|
@@ -5746,7 +5765,7 @@ var RemoteEngineControlClient = class {
|
|
|
5746
5765
|
#buildGatewayUrlForTarget(target, path, options = {}) {
|
|
5747
5766
|
const endpoint = getEndpoint(this.#config);
|
|
5748
5767
|
if (shouldSkipReadyWait(options) && directActorIdFromTarget(target) && canUseDirectSkipReadyWaitPath(path)) {
|
|
5749
|
-
return
|
|
5768
|
+
return _chunkNUMGL52Rcjs.combineUrlPath.call(void 0, endpoint, path);
|
|
5750
5769
|
}
|
|
5751
5770
|
if ("directId" in target) {
|
|
5752
5771
|
return buildActorGatewayUrl(
|
|
@@ -5838,5 +5857,7 @@ function apiActorToOutput(actor) {
|
|
|
5838
5857
|
|
|
5839
5858
|
|
|
5840
5859
|
|
|
5841
|
-
|
|
5842
|
-
|
|
5860
|
+
|
|
5861
|
+
|
|
5862
|
+
exports.HEADER_CONN_PARAMS = HEADER_CONN_PARAMS; exports.HEADER_ORIGINAL_REQUEST_URL = HEADER_ORIGINAL_REQUEST_URL; exports.ALLOWED_PUBLIC_HEADERS = ALLOWED_PUBLIC_HEADERS; exports.ActorClientError = ActorClientError; exports.ManagerError = ManagerError; exports.MalformedResponseMessage = MalformedResponseMessage; exports.ActorConnDisposed = ActorConnDisposed; exports.ActorConnRaw = ActorConnRaw; exports.isResponseLike = isResponseLike; exports.ActorHandleRaw = ActorHandleRaw; exports.createClientWithDriver = createClientWithDriver; exports.tryParseEndpoint = tryParseEndpoint; exports.ClientConfigSchema = ClientConfigSchema; exports.convertRegistryConfigToClientConfig = convertRegistryConfigToClientConfig; exports.getDatacenters = getDatacenters; exports.updateRunnerConfig = updateRunnerConfig; exports.RemoteEngineControlClient = RemoteEngineControlClient;
|
|
5863
|
+
//# sourceMappingURL=chunk-5MJPN3QU.cjs.map
|