rivetkit 3.0.0-preview.3 → 3.0.0-preview.5
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.js +49 -28
- 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/{chunk-KCWRKXTY.js → chunk-AW7C2XT5.js} +2 -2
- package/dist/tsup/{chunk-JWI6YJEA.js → chunk-BAXQGOBL.js} +2 -2
- package/dist/tsup/{chunk-4WDX5ZI7.cjs → chunk-CFGRIV62.cjs} +2 -2
- package/dist/tsup/{chunk-4WDX5ZI7.cjs.map → chunk-CFGRIV62.cjs.map} +1 -1
- package/dist/tsup/{chunk-7KES6QNE.cjs → chunk-CLY73DEM.cjs} +3 -3
- package/dist/tsup/{chunk-7KES6QNE.cjs.map → chunk-CLY73DEM.cjs.map} +1 -1
- package/dist/tsup/{chunk-KMYBA4P5.cjs → chunk-EON5X6B7.cjs} +3 -3
- package/dist/tsup/{chunk-KMYBA4P5.cjs.map → chunk-EON5X6B7.cjs.map} +1 -1
- package/dist/tsup/{chunk-2VXPVVNW.js → chunk-EOUH7MP7.js} +54 -33
- package/dist/tsup/chunk-EOUH7MP7.js.map +1 -0
- package/dist/tsup/{chunk-BCX5V7NI.cjs → chunk-GJUWI47D.cjs} +191 -170
- package/dist/tsup/chunk-GJUWI47D.cjs.map +1 -0
- package/dist/tsup/{chunk-PJ4PORWE.cjs → chunk-KEHBPXZE.cjs} +3 -3
- package/dist/tsup/{chunk-PJ4PORWE.cjs.map → chunk-KEHBPXZE.cjs.map} +1 -1
- package/dist/tsup/{chunk-HDQQVBOG.js → chunk-KJM23DKG.js} +2 -2
- package/dist/tsup/{chunk-JXO5QVDX.js → chunk-KKSIGBUN.js} +2 -2
- package/dist/tsup/{chunk-JXO5QVDX.js.map → chunk-KKSIGBUN.js.map} +1 -1
- package/dist/tsup/{chunk-HRBZ4VW5.cjs → chunk-MVDTFTCY.cjs} +7 -7
- package/dist/tsup/{chunk-HRBZ4VW5.cjs.map → chunk-MVDTFTCY.cjs.map} +1 -1
- package/dist/tsup/{chunk-B6U5V6WE.cjs → chunk-PHFXQQGE.cjs} +4 -4
- package/dist/tsup/{chunk-B6U5V6WE.cjs.map → chunk-PHFXQQGE.cjs.map} +1 -1
- package/dist/tsup/{chunk-A447S5YG.js → chunk-SJUGJ5DT.js} +2 -2
- package/dist/tsup/{chunk-AGQNNAZ2.js → chunk-W4CGRSYM.js} +3 -3
- package/dist/tsup/{chunk-IJGFSNGA.js → chunk-W5DDGJBO.js} +4 -4
- package/dist/tsup/{chunk-7Y4GHUAT.cjs → chunk-ZOFNA4SR.cjs} +10 -10
- package/dist/tsup/{chunk-7Y4GHUAT.cjs.map → chunk-ZOFNA4SR.cjs.map} +1 -1
- package/dist/tsup/client/mod.cjs +5 -5
- 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/db/drizzle.cjs +2 -2
- package/dist/tsup/db/drizzle.js +1 -1
- package/dist/tsup/db/mod.cjs +3 -3
- package/dist/tsup/db/mod.js +2 -2
- package/dist/tsup/inspector/mod.cjs +5 -5
- package/dist/tsup/inspector/mod.js +4 -4
- package/dist/tsup/inspector/workflow.cjs +4 -4
- package/dist/tsup/inspector/workflow.js +3 -3
- package/dist/tsup/mod.cjs +94 -90
- package/dist/tsup/mod.cjs.map +1 -1
- package/dist/tsup/mod.js +15 -11
- package/dist/tsup/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +6 -6
- 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 +7 -7
- package/dist/tsup/workflow/mod.cjs.map +1 -1
- package/dist/tsup/workflow/mod.js +4 -4
- package/package.json +9 -9
- package/src/client/actor-conn.ts +59 -33
- package/src/client/lifecycle-errors.ts +13 -0
- package/src/registry/config/index.ts +2 -1
- package/src/registry/index.ts +16 -3
- package/dist/tsup/chunk-2VXPVVNW.js.map +0 -1
- package/dist/tsup/chunk-BCX5V7NI.cjs.map +0 -1
- /package/dist/tsup/{chunk-KCWRKXTY.js.map → chunk-AW7C2XT5.js.map} +0 -0
- /package/dist/tsup/{chunk-JWI6YJEA.js.map → chunk-BAXQGOBL.js.map} +0 -0
- /package/dist/tsup/{chunk-HDQQVBOG.js.map → chunk-KJM23DKG.js.map} +0 -0
- /package/dist/tsup/{chunk-A447S5YG.js.map → chunk-SJUGJ5DT.js.map} +0 -0
- /package/dist/tsup/{chunk-AGQNNAZ2.js.map → chunk-W4CGRSYM.js.map} +0 -0
- /package/dist/tsup/{chunk-IJGFSNGA.js.map → chunk-W5DDGJBO.js.map} +0 -0
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
var _chunkRTWH3AX3cjs = require('./chunk-RTWH3AX3.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
var _chunkKVFIONKQcjs = require('./chunk-KVFIONKQ.cjs');
|
|
8
9
|
|
|
9
|
-
var _chunk7KES6QNEcjs = require('./chunk-7KES6QNE.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkCLY73DEMcjs = require('./chunk-CLY73DEM.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
@@ -36,7 +36,7 @@ var _chunkKVFIONKQcjs = require('./chunk-KVFIONKQ.cjs');
|
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
|
|
39
|
-
var
|
|
39
|
+
var _chunkCFGRIV62cjs = require('./chunk-CFGRIV62.cjs');
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
|
|
@@ -2132,7 +2132,7 @@ async function checkForSchedulingError(group, code, actorId, query, driver, rayI
|
|
|
2132
2132
|
try {
|
|
2133
2133
|
const actor = await driver.getForId({ name, actorId });
|
|
2134
2134
|
if (actor == null ? void 0 : actor.error) {
|
|
2135
|
-
|
|
2135
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).info({
|
|
2136
2136
|
msg: "found actor scheduling error",
|
|
2137
2137
|
actorId,
|
|
2138
2138
|
error: actor.error
|
|
@@ -2146,10 +2146,10 @@ async function checkForSchedulingError(group, code, actorId, query, driver, rayI
|
|
|
2146
2146
|
);
|
|
2147
2147
|
}
|
|
2148
2148
|
} catch (err) {
|
|
2149
|
-
|
|
2149
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).warn({
|
|
2150
2150
|
msg: "failed to fetch actor details for scheduling error check",
|
|
2151
2151
|
actorId,
|
|
2152
|
-
error:
|
|
2152
|
+
error: _chunkCFGRIV62cjs.stringifyError.call(void 0, err)
|
|
2153
2153
|
});
|
|
2154
2154
|
}
|
|
2155
2155
|
return null;
|
|
@@ -2266,6 +2266,14 @@ function classifyActorError(error) {
|
|
|
2266
2266
|
}
|
|
2267
2267
|
);
|
|
2268
2268
|
}
|
|
2269
|
+
if (error.group === "ups" && error.code === "consumer_closed" || error.group === "depot" && error.code === "request_deadline_exceeded") {
|
|
2270
|
+
return buildLifecycleBoundaryInfo(
|
|
2271
|
+
"reconnect_only",
|
|
2272
|
+
"actor_error",
|
|
2273
|
+
error.message,
|
|
2274
|
+
{ group: error.group, code: error.code }
|
|
2275
|
+
);
|
|
2276
|
+
}
|
|
2269
2277
|
if (error.group === "guard" && isRetryableGuardGatewayHttpError(error.code)) {
|
|
2270
2278
|
return buildLifecycleBoundaryInfo(
|
|
2271
2279
|
"request_retry",
|
|
@@ -2525,7 +2533,7 @@ function parseWebSocketCloseReason(reason) {
|
|
|
2525
2533
|
const [mainPart, suffix] = reason.split("#");
|
|
2526
2534
|
const [group, code] = mainPart.split(".");
|
|
2527
2535
|
if (!group || !code) {
|
|
2528
|
-
|
|
2536
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).warn({ msg: "failed to parse close reason", reason });
|
|
2529
2537
|
return void 0;
|
|
2530
2538
|
}
|
|
2531
2539
|
const retryAfter = suffix == null ? void 0 : suffix.match(RETRY_AFTER_SUFFIX);
|
|
@@ -2551,11 +2559,11 @@ function messageLength(message) {
|
|
|
2551
2559
|
if (typeof message === "string") {
|
|
2552
2560
|
return message.length;
|
|
2553
2561
|
}
|
|
2554
|
-
|
|
2562
|
+
_chunkCFGRIV62cjs.assertUnreachable.call(void 0, message);
|
|
2555
2563
|
}
|
|
2556
2564
|
async function sendHttpRequest(opts) {
|
|
2557
2565
|
var _a, _b, _c;
|
|
2558
|
-
|
|
2566
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).debug({
|
|
2559
2567
|
msg: "sending http request",
|
|
2560
2568
|
url: opts.url,
|
|
2561
2569
|
encoding: opts.encoding
|
|
@@ -2564,8 +2572,8 @@ async function sendHttpRequest(opts) {
|
|
|
2564
2572
|
let bodyData;
|
|
2565
2573
|
if (opts.method === "POST" || opts.method === "PUT") {
|
|
2566
2574
|
_invariant2.default.call(void 0, opts.body !== void 0, "missing body");
|
|
2567
|
-
contentType =
|
|
2568
|
-
bodyData =
|
|
2575
|
+
contentType = _chunkCFGRIV62cjs.contentTypeForEncoding.call(void 0, opts.encoding);
|
|
2576
|
+
bodyData = _chunkCFGRIV62cjs.serializeWithEncoding.call(void 0,
|
|
2569
2577
|
opts.encoding,
|
|
2570
2578
|
opts.body,
|
|
2571
2579
|
opts.requestVersionedDataHandler,
|
|
@@ -2585,7 +2593,7 @@ async function sendHttpRequest(opts) {
|
|
|
2585
2593
|
...contentType ? {
|
|
2586
2594
|
"Content-Type": contentType
|
|
2587
2595
|
} : {},
|
|
2588
|
-
"User-Agent":
|
|
2596
|
+
"User-Agent": _chunkCFGRIV62cjs.httpUserAgent.call(void 0, )
|
|
2589
2597
|
},
|
|
2590
2598
|
body: bodyData,
|
|
2591
2599
|
credentials: "include",
|
|
@@ -2603,7 +2611,7 @@ async function sendHttpRequest(opts) {
|
|
|
2603
2611
|
const rayId = response.headers.get("x-rivet-ray-id");
|
|
2604
2612
|
const encoding = (contentType2 == null ? void 0 : contentType2.includes("application/json")) ? "json" : opts.encoding;
|
|
2605
2613
|
try {
|
|
2606
|
-
const responseData =
|
|
2614
|
+
const responseData = _chunkCFGRIV62cjs.deserializeWithEncoding.call(void 0,
|
|
2607
2615
|
encoding,
|
|
2608
2616
|
new Uint8Array(bufferResponse),
|
|
2609
2617
|
HTTP_RESPONSE_ERROR_VERSIONED,
|
|
@@ -2621,7 +2629,7 @@ async function sendHttpRequest(opts) {
|
|
|
2621
2629
|
group: bare5.group,
|
|
2622
2630
|
code: bare5.code,
|
|
2623
2631
|
message: bare5.message,
|
|
2624
|
-
metadata: bare5.metadata ?
|
|
2632
|
+
metadata: bare5.metadata ? _chunkCFGRIV62cjs.decodeCborCompat.call(void 0, new Uint8Array(bare5.metadata)) : void 0,
|
|
2625
2633
|
actor: bare5.actor ? {
|
|
2626
2634
|
actorId: bare5.actor.actorId,
|
|
2627
2635
|
generation: Number(bare5.actor.generation),
|
|
@@ -2629,7 +2637,7 @@ async function sendHttpRequest(opts) {
|
|
|
2629
2637
|
} : void 0
|
|
2630
2638
|
})
|
|
2631
2639
|
);
|
|
2632
|
-
|
|
2640
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).warn({
|
|
2633
2641
|
msg: "http error response",
|
|
2634
2642
|
group: responseData.group,
|
|
2635
2643
|
code: responseData.code,
|
|
@@ -2676,7 +2684,7 @@ ${textResponse}`
|
|
|
2676
2684
|
}
|
|
2677
2685
|
try {
|
|
2678
2686
|
const buffer = new Uint8Array(await response.arrayBuffer());
|
|
2679
|
-
return
|
|
2687
|
+
return _chunkCFGRIV62cjs.deserializeWithEncoding.call(void 0,
|
|
2680
2688
|
opts.encoding,
|
|
2681
2689
|
buffer,
|
|
2682
2690
|
opts.responseVersionedDataHandler,
|
|
@@ -2724,8 +2732,8 @@ function createQueueSender(senderOptions) {
|
|
|
2724
2732
|
}),
|
|
2725
2733
|
requestToBare: (value) => ({
|
|
2726
2734
|
name: _nullishCoalesce(value.name, () => ( name)),
|
|
2727
|
-
body:
|
|
2728
|
-
|
|
2735
|
+
body: _chunkCFGRIV62cjs.bufferToArrayBuffer.call(void 0,
|
|
2736
|
+
_chunkCFGRIV62cjs.encodeCborCompat.call(void 0, value.body)
|
|
2729
2737
|
),
|
|
2730
2738
|
wait: _nullishCoalesce(value.wait, () => ( false)),
|
|
2731
2739
|
timeout: value.timeout !== void 0 ? BigInt(value.timeout) : null
|
|
@@ -2745,7 +2753,7 @@ function createQueueSender(senderOptions) {
|
|
|
2745
2753
|
}
|
|
2746
2754
|
return {
|
|
2747
2755
|
status: bare5.status,
|
|
2748
|
-
response:
|
|
2756
|
+
response: _chunkCFGRIV62cjs.decodeCborCompat.call(void 0, new Uint8Array(bare5.response))
|
|
2749
2757
|
};
|
|
2750
2758
|
}
|
|
2751
2759
|
});
|
|
@@ -2812,7 +2820,7 @@ async function rawHttpFetch(driver, target, params, input, init, options = {}, t
|
|
|
2812
2820
|
throw new TypeError("Invalid input type for fetch");
|
|
2813
2821
|
}
|
|
2814
2822
|
try {
|
|
2815
|
-
|
|
2823
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).debug(
|
|
2816
2824
|
"directId" in target ? {
|
|
2817
2825
|
msg: "sending raw http request to actor",
|
|
2818
2826
|
actorId: target.directId
|
|
@@ -2838,7 +2846,7 @@ async function rawHttpFetch(driver, target, params, input, init, options = {}, t
|
|
|
2838
2846
|
});
|
|
2839
2847
|
return driver.sendRequest(target, proxyRequest, options);
|
|
2840
2848
|
} catch (err) {
|
|
2841
|
-
const { group, code, message, metadata, rayId, actor } =
|
|
2849
|
+
const { group, code, message, metadata, rayId, actor } = _chunkCFGRIV62cjs.deconstructError.call(void 0, err, true);
|
|
2842
2850
|
throw new (0, _chunkMGI2VVF6cjs.RivetError)(group, code, message, { metadata, rayId, actor });
|
|
2843
2851
|
}
|
|
2844
2852
|
}
|
|
@@ -2859,7 +2867,7 @@ async function rawWebSocket(driver, target, params, path, _protocols, options =
|
|
|
2859
2867
|
}
|
|
2860
2868
|
}
|
|
2861
2869
|
const fullPath = `${PATH_WEBSOCKET_PREFIX}${pathPortion}${queryPortion}`;
|
|
2862
|
-
|
|
2870
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).debug({
|
|
2863
2871
|
msg: "opening websocket",
|
|
2864
2872
|
target,
|
|
2865
2873
|
encoding,
|
|
@@ -2999,7 +3007,7 @@ var ActorHandleRaw = class {
|
|
|
2999
3007
|
}
|
|
3000
3008
|
}).send(name, body, options);
|
|
3001
3009
|
} catch (err) {
|
|
3002
|
-
const { group, code, message, metadata, rayId, actor } =
|
|
3010
|
+
const { group, code, message, metadata, rayId, actor } = _chunkCFGRIV62cjs.deconstructError.call(void 0, err, true);
|
|
3003
3011
|
if (this.#shouldRetryQueueDispatchOverload(
|
|
3004
3012
|
group,
|
|
3005
3013
|
code,
|
|
@@ -3126,13 +3134,13 @@ var ActorHandleRaw = class {
|
|
|
3126
3134
|
gatewayOptions
|
|
3127
3135
|
);
|
|
3128
3136
|
actorId = "directId" in target ? target.directId : void 0;
|
|
3129
|
-
|
|
3137
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).debug(
|
|
3130
3138
|
actorId ? { msg: "using direct actor gateway target", actorId } : {
|
|
3131
3139
|
msg: "using query gateway target for action",
|
|
3132
3140
|
query: this.#actorResolutionState
|
|
3133
3141
|
}
|
|
3134
3142
|
);
|
|
3135
|
-
|
|
3143
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).debug({
|
|
3136
3144
|
msg: "handling action",
|
|
3137
3145
|
name: opts.name,
|
|
3138
3146
|
encoding: this.#encoding
|
|
@@ -3169,19 +3177,19 @@ var ActorHandleRaw = class {
|
|
|
3169
3177
|
args
|
|
3170
3178
|
}),
|
|
3171
3179
|
requestToBare: (args) => ({
|
|
3172
|
-
args:
|
|
3173
|
-
|
|
3180
|
+
args: _chunkCFGRIV62cjs.bufferToArrayBuffer.call(void 0,
|
|
3181
|
+
_chunkCFGRIV62cjs.encodeCborCompat.call(void 0, args)
|
|
3174
3182
|
)
|
|
3175
3183
|
}),
|
|
3176
3184
|
responseFromJson: (json) => json.output,
|
|
3177
|
-
responseFromBare: (bare5) =>
|
|
3185
|
+
responseFromBare: (bare5) => _chunkCFGRIV62cjs.decodeCborCompat.call(void 0, new Uint8Array(bare5.output))
|
|
3178
3186
|
});
|
|
3179
3187
|
if (opts.name === "destroy" && actorId) {
|
|
3180
3188
|
await this.#waitForDestroyActionToSettle(actorId);
|
|
3181
3189
|
}
|
|
3182
3190
|
return output;
|
|
3183
3191
|
} catch (err) {
|
|
3184
|
-
const { group, code, message, metadata, rayId, actor } =
|
|
3192
|
+
const { group, code, message, metadata, rayId, actor } = _chunkCFGRIV62cjs.deconstructError.call(void 0, err, true);
|
|
3185
3193
|
if (await this.#shouldRetrySchedulingError(
|
|
3186
3194
|
group,
|
|
3187
3195
|
code,
|
|
@@ -3337,7 +3345,7 @@ var ActorHandleRaw = class {
|
|
|
3337
3345
|
* @returns {ActorConn<AD>} A connection to the actor.
|
|
3338
3346
|
*/
|
|
3339
3347
|
connect(params, options = {}) {
|
|
3340
|
-
|
|
3348
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).debug({
|
|
3341
3349
|
msg: "establishing connection from handle",
|
|
3342
3350
|
query: this.#actorResolutionState
|
|
3343
3351
|
});
|
|
@@ -3414,7 +3422,7 @@ var ActorHandleRaw = class {
|
|
|
3414
3422
|
}
|
|
3415
3423
|
return response;
|
|
3416
3424
|
} catch (err) {
|
|
3417
|
-
const { group, code, message, metadata, rayId, actor } =
|
|
3425
|
+
const { group, code, message, metadata, rayId, actor } = _chunkCFGRIV62cjs.deconstructError.call(void 0, err, true);
|
|
3418
3426
|
if (await this.#shouldRetrySchedulingError(
|
|
3419
3427
|
group,
|
|
3420
3428
|
code,
|
|
@@ -3510,7 +3518,7 @@ var ActorHandleRaw = class {
|
|
|
3510
3518
|
const contentType = response.headers.get("content-type");
|
|
3511
3519
|
const encoding = (contentType == null ? void 0 : contentType.includes("application/json")) ? "json" : this.#encoding;
|
|
3512
3520
|
try {
|
|
3513
|
-
const error =
|
|
3521
|
+
const error = _chunkCFGRIV62cjs.deserializeWithEncoding.call(void 0,
|
|
3514
3522
|
encoding,
|
|
3515
3523
|
new Uint8Array(await response.clone().arrayBuffer()),
|
|
3516
3524
|
HTTP_RESPONSE_ERROR_VERSIONED,
|
|
@@ -3526,7 +3534,7 @@ var ActorHandleRaw = class {
|
|
|
3526
3534
|
group: bare5.group,
|
|
3527
3535
|
code: bare5.code,
|
|
3528
3536
|
message: bare5.message,
|
|
3529
|
-
metadata: bare5.metadata ?
|
|
3537
|
+
metadata: bare5.metadata ? _chunkCFGRIV62cjs.decodeCborCompat.call(void 0, new Uint8Array(bare5.metadata)) : void 0,
|
|
3530
3538
|
actor: bare5.actor ? {
|
|
3531
3539
|
actorId: bare5.actor.actorId,
|
|
3532
3540
|
generation: Number(bare5.actor.generation),
|
|
@@ -3663,7 +3671,7 @@ var ClientRaw = (_class = class {
|
|
|
3663
3671
|
* @returns {ActorHandle<AD>} - A handle to the actor.
|
|
3664
3672
|
*/
|
|
3665
3673
|
getForId(name, actorId, opts) {
|
|
3666
|
-
|
|
3674
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).debug({
|
|
3667
3675
|
msg: "get handle to actor with id",
|
|
3668
3676
|
name,
|
|
3669
3677
|
actorId,
|
|
@@ -3694,7 +3702,7 @@ var ClientRaw = (_class = class {
|
|
|
3694
3702
|
*/
|
|
3695
3703
|
get(name, key, opts) {
|
|
3696
3704
|
const keyArray = typeof key === "string" ? [key] : key || [];
|
|
3697
|
-
|
|
3705
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).debug({
|
|
3698
3706
|
msg: "get handle to actor",
|
|
3699
3707
|
name,
|
|
3700
3708
|
key: keyArray,
|
|
@@ -3725,7 +3733,7 @@ var ClientRaw = (_class = class {
|
|
|
3725
3733
|
*/
|
|
3726
3734
|
getOrCreate(name, key, opts) {
|
|
3727
3735
|
const keyArray = typeof key === "string" ? [key] : key || [];
|
|
3728
|
-
|
|
3736
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).debug({
|
|
3729
3737
|
msg: "get or create handle to actor",
|
|
3730
3738
|
name,
|
|
3731
3739
|
key: keyArray,
|
|
@@ -3769,7 +3777,7 @@ var ClientRaw = (_class = class {
|
|
|
3769
3777
|
key: keyArray
|
|
3770
3778
|
}
|
|
3771
3779
|
};
|
|
3772
|
-
|
|
3780
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).debug({
|
|
3773
3781
|
msg: "create actor handle",
|
|
3774
3782
|
name,
|
|
3775
3783
|
key: keyArray,
|
|
@@ -3777,7 +3785,7 @@ var ClientRaw = (_class = class {
|
|
|
3777
3785
|
create: createQuery.create
|
|
3778
3786
|
});
|
|
3779
3787
|
const actorId = await resolveGatewayTarget(this.#driver, createQuery);
|
|
3780
|
-
|
|
3788
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).debug({
|
|
3781
3789
|
msg: "created actor with ID",
|
|
3782
3790
|
name,
|
|
3783
3791
|
key: keyArray,
|
|
@@ -3825,11 +3833,11 @@ var ClientRaw = (_class = class {
|
|
|
3825
3833
|
*/
|
|
3826
3834
|
async dispose() {
|
|
3827
3835
|
if (this.#disposed) {
|
|
3828
|
-
|
|
3836
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).warn({ msg: "client already disconnected" });
|
|
3829
3837
|
return;
|
|
3830
3838
|
}
|
|
3831
3839
|
this.#disposed = true;
|
|
3832
|
-
|
|
3840
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).debug({ msg: "disposing client" });
|
|
3833
3841
|
const disposePromises = [];
|
|
3834
3842
|
for (const conn of this[ACTOR_CONNS_SYMBOL].values()) {
|
|
3835
3843
|
disposePromises.push(conn.dispose());
|
|
@@ -4020,6 +4028,8 @@ var ActorConnRaw = class {
|
|
|
4020
4028
|
/* Will be aborted on dispose. */
|
|
4021
4029
|
#abortController = new AbortController();
|
|
4022
4030
|
#connStatus = "idle";
|
|
4031
|
+
/** The opening failure that stopped retries. Later actions must fail instead of queueing. */
|
|
4032
|
+
#connectionOpenError;
|
|
4023
4033
|
#actorId;
|
|
4024
4034
|
#connId;
|
|
4025
4035
|
#messageQueue = [];
|
|
@@ -4073,8 +4083,8 @@ var ActorConnRaw = class {
|
|
|
4073
4083
|
if ("getForId" in actorResolutionState) {
|
|
4074
4084
|
this.#actorId = actorResolutionState.getForId.actorId;
|
|
4075
4085
|
}
|
|
4076
|
-
this.#readyPromise =
|
|
4077
|
-
(reason) =>
|
|
4086
|
+
this.#readyPromise = _chunkCFGRIV62cjs.promiseWithResolvers.call(void 0,
|
|
4087
|
+
(reason) => _chunkCLY73DEMcjs.logger.call(void 0, ).warn({
|
|
4078
4088
|
msg: "unhandled ready promise rejection",
|
|
4079
4089
|
reason
|
|
4080
4090
|
})
|
|
@@ -4141,11 +4151,13 @@ var ActorConnRaw = class {
|
|
|
4141
4151
|
`Invalid action call: expected an options object { name, args }, got ${typeof opts}. Use conn.actionName(...args) for the shorthand API.`
|
|
4142
4152
|
);
|
|
4143
4153
|
}
|
|
4144
|
-
|
|
4154
|
+
if (this.#disposed) throw new ActorConnDisposed();
|
|
4155
|
+
if (this.#connectionOpenError) throw this.#connectionOpenError;
|
|
4156
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).debug({ msg: "action", name: opts.name, args: opts.args });
|
|
4145
4157
|
const actionId = this.#actionIdCounter;
|
|
4146
4158
|
this.#actionIdCounter += 1;
|
|
4147
|
-
const { promise, resolve, reject } =
|
|
4148
|
-
(reason) =>
|
|
4159
|
+
const { promise, resolve, reject } = _chunkCFGRIV62cjs.promiseWithResolvers.call(void 0,
|
|
4160
|
+
(reason) => _chunkCLY73DEMcjs.logger.call(void 0, ).warn({
|
|
4149
4161
|
msg: "unhandled action promise rejection",
|
|
4150
4162
|
reason
|
|
4151
4163
|
})
|
|
@@ -4155,7 +4167,7 @@ var ActorConnRaw = class {
|
|
|
4155
4167
|
resolve,
|
|
4156
4168
|
reject
|
|
4157
4169
|
});
|
|
4158
|
-
|
|
4170
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).debug({
|
|
4159
4171
|
msg: "added action to in-flight map",
|
|
4160
4172
|
actionId,
|
|
4161
4173
|
actionName: opts.name,
|
|
@@ -4195,9 +4207,9 @@ var ActorConnRaw = class {
|
|
|
4195
4207
|
try {
|
|
4196
4208
|
handler(status);
|
|
4197
4209
|
} catch (err) {
|
|
4198
|
-
|
|
4210
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).error({
|
|
4199
4211
|
msg: "error in status change handler",
|
|
4200
|
-
error:
|
|
4212
|
+
error: _chunkCFGRIV62cjs.stringifyError.call(void 0, err)
|
|
4201
4213
|
});
|
|
4202
4214
|
}
|
|
4203
4215
|
}
|
|
@@ -4207,9 +4219,9 @@ var ActorConnRaw = class {
|
|
|
4207
4219
|
try {
|
|
4208
4220
|
handler();
|
|
4209
4221
|
} catch (err) {
|
|
4210
|
-
|
|
4222
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).error({
|
|
4211
4223
|
msg: "error in open handler",
|
|
4212
|
-
error:
|
|
4224
|
+
error: _chunkCFGRIV62cjs.stringifyError.call(void 0, err)
|
|
4213
4225
|
});
|
|
4214
4226
|
}
|
|
4215
4227
|
}
|
|
@@ -4219,25 +4231,26 @@ var ActorConnRaw = class {
|
|
|
4219
4231
|
try {
|
|
4220
4232
|
handler();
|
|
4221
4233
|
} catch (err) {
|
|
4222
|
-
|
|
4234
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).error({
|
|
4223
4235
|
msg: "error in close handler",
|
|
4224
|
-
error:
|
|
4236
|
+
error: _chunkCFGRIV62cjs.stringifyError.call(void 0, err)
|
|
4225
4237
|
});
|
|
4226
4238
|
}
|
|
4227
4239
|
}
|
|
4228
4240
|
}
|
|
4229
4241
|
}
|
|
4230
4242
|
#connectWithRetry() {
|
|
4243
|
+
this.#connectionOpenError = void 0;
|
|
4231
4244
|
this.#setConnStatus("connecting");
|
|
4232
4245
|
_pretry2.default.call(void 0, this.#connectAndWait.bind(this), {
|
|
4233
4246
|
forever: true,
|
|
4234
4247
|
minTimeout: 250,
|
|
4235
4248
|
maxTimeout: 3e4,
|
|
4236
4249
|
onFailedAttempt: async (error) => {
|
|
4237
|
-
|
|
4250
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).warn({
|
|
4238
4251
|
msg: "failed to reconnect",
|
|
4239
4252
|
attempt: error.attemptNumber,
|
|
4240
|
-
error:
|
|
4253
|
+
error: _chunkCFGRIV62cjs.stringifyError.call(void 0, error)
|
|
4241
4254
|
});
|
|
4242
4255
|
const hintMs = retryAfterMs(error);
|
|
4243
4256
|
if (hintMs !== void 0) {
|
|
@@ -4248,11 +4261,11 @@ var ActorConnRaw = class {
|
|
|
4248
4261
|
signal: this.#abortController.signal
|
|
4249
4262
|
}).catch((err) => {
|
|
4250
4263
|
if (err instanceof _pretry.AbortError || err.name === "AbortError" || !this.#shouldRetryConnectionOpenError(err)) {
|
|
4251
|
-
|
|
4264
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).info({ msg: "connection retry aborted" });
|
|
4252
4265
|
} else {
|
|
4253
|
-
|
|
4266
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).error({
|
|
4254
4267
|
msg: "unexpected error in connection retry",
|
|
4255
|
-
error:
|
|
4268
|
+
error: _chunkCFGRIV62cjs.stringifyError.call(void 0, err)
|
|
4256
4269
|
});
|
|
4257
4270
|
}
|
|
4258
4271
|
});
|
|
@@ -4261,8 +4274,8 @@ var ActorConnRaw = class {
|
|
|
4261
4274
|
try {
|
|
4262
4275
|
if (this.#onOpenPromise)
|
|
4263
4276
|
throw new Error("#onOpenPromise already defined");
|
|
4264
|
-
this.#onOpenPromise =
|
|
4265
|
-
(reason) =>
|
|
4277
|
+
this.#onOpenPromise = _chunkCFGRIV62cjs.promiseWithResolvers.call(void 0,
|
|
4278
|
+
(reason) => _chunkCLY73DEMcjs.logger.call(void 0, ).warn({
|
|
4266
4279
|
msg: "unhandled open promise rejection",
|
|
4267
4280
|
reason
|
|
4268
4281
|
})
|
|
@@ -4270,21 +4283,24 @@ var ActorConnRaw = class {
|
|
|
4270
4283
|
await this.#connectWebSocket();
|
|
4271
4284
|
await this.#waitForOpen(this.#onOpenPromise.promise);
|
|
4272
4285
|
} catch (error) {
|
|
4286
|
+
this.#abandonCurrentSocket(
|
|
4287
|
+
isConnectionOpenTimeout(error) ? "Connect timeout" : "Connection opening failed"
|
|
4288
|
+
);
|
|
4273
4289
|
if (this.#shouldRetryConnectionOpenError(error)) {
|
|
4274
4290
|
throw error;
|
|
4275
4291
|
}
|
|
4276
4292
|
const actorError = error instanceof _chunkMGI2VVF6cjs.RivetError ? error : new (0, _chunkMGI2VVF6cjs.RivetError)(
|
|
4277
4293
|
"client",
|
|
4278
4294
|
"connection_open_failed",
|
|
4279
|
-
`Failed to open connection: ${
|
|
4280
|
-
{ error:
|
|
4295
|
+
`Failed to open connection: ${_chunkCFGRIV62cjs.stringifyError.call(void 0, error)}`,
|
|
4296
|
+
{ error: _chunkCFGRIV62cjs.stringifyError.call(void 0, error) }
|
|
4281
4297
|
);
|
|
4282
|
-
this.#
|
|
4298
|
+
this.#connectionOpenError = actorError;
|
|
4283
4299
|
this.#rejectPendingPromises(actorError, false);
|
|
4284
4300
|
this.#dispatchActorError(actorError);
|
|
4285
4301
|
this.#setConnStatus("idle");
|
|
4286
4302
|
throw new (0, _pretry.AbortError)(
|
|
4287
|
-
error instanceof Error ? error : new Error(
|
|
4303
|
+
error instanceof Error ? error : new Error(_chunkCFGRIV62cjs.stringifyError.call(void 0, error))
|
|
4288
4304
|
);
|
|
4289
4305
|
} finally {
|
|
4290
4306
|
this.#onOpenPromise = void 0;
|
|
@@ -4311,32 +4327,27 @@ var ActorConnRaw = class {
|
|
|
4311
4327
|
});
|
|
4312
4328
|
try {
|
|
4313
4329
|
await Promise.race([open, timedOut]);
|
|
4314
|
-
} catch (error) {
|
|
4315
|
-
if (isConnectionOpenTimeout(error)) {
|
|
4316
|
-
this.#abandonCurrentSocket();
|
|
4317
|
-
}
|
|
4318
|
-
throw error;
|
|
4319
4330
|
} finally {
|
|
4320
4331
|
clearTimeout(timer);
|
|
4321
4332
|
}
|
|
4322
4333
|
}
|
|
4323
|
-
#abandonCurrentSocket() {
|
|
4334
|
+
#abandonCurrentSocket(reason) {
|
|
4324
4335
|
const ws = this.#websocket;
|
|
4325
4336
|
if (!ws) return;
|
|
4326
4337
|
this.#websocket = void 0;
|
|
4327
4338
|
this.#abandonedSockets.add(ws);
|
|
4328
|
-
|
|
4329
|
-
msg: "
|
|
4339
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).debug({
|
|
4340
|
+
msg: "closing failed connection attempt",
|
|
4330
4341
|
connId: this.#connId,
|
|
4331
4342
|
readyState: ws.readyState,
|
|
4332
|
-
|
|
4343
|
+
reason
|
|
4333
4344
|
});
|
|
4334
4345
|
try {
|
|
4335
|
-
ws.close(1e3,
|
|
4346
|
+
ws.close(1e3, reason);
|
|
4336
4347
|
} catch (err) {
|
|
4337
|
-
|
|
4348
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).debug({
|
|
4338
4349
|
msg: "failed to close abandoned websocket",
|
|
4339
|
-
error:
|
|
4350
|
+
error: _chunkCFGRIV62cjs.stringifyError.call(void 0, err)
|
|
4340
4351
|
});
|
|
4341
4352
|
}
|
|
4342
4353
|
}
|
|
@@ -4347,6 +4358,9 @@ var ActorConnRaw = class {
|
|
|
4347
4358
|
if (isConnectionOpenTimeout(error)) {
|
|
4348
4359
|
return true;
|
|
4349
4360
|
}
|
|
4361
|
+
if (error instanceof _chunkMGI2VVF6cjs.RivetError && error.group === "client" && error.code === "connection_open_interrupted") {
|
|
4362
|
+
return true;
|
|
4363
|
+
}
|
|
4350
4364
|
if (error instanceof _chunkMGI2VVF6cjs.RivetError && isInvalidToken(error.group, error.code) && this.#driver.refreshAuthToken && this.#authRetryAvailable) {
|
|
4351
4365
|
this.#authRetryAvailable = false;
|
|
4352
4366
|
return true;
|
|
@@ -4361,7 +4375,7 @@ var ActorConnRaw = class {
|
|
|
4361
4375
|
}
|
|
4362
4376
|
#clearQueuedMessages() {
|
|
4363
4377
|
if (this.#messageQueue.length === 0) return;
|
|
4364
|
-
|
|
4378
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).debug({
|
|
4365
4379
|
msg: "clearing queued connection messages",
|
|
4366
4380
|
queueLength: this.#messageQueue.length
|
|
4367
4381
|
});
|
|
@@ -4374,7 +4388,7 @@ var ActorConnRaw = class {
|
|
|
4374
4388
|
try {
|
|
4375
4389
|
return await this.#getParams();
|
|
4376
4390
|
} catch (err) {
|
|
4377
|
-
const errorMessage =
|
|
4391
|
+
const errorMessage = _chunkCFGRIV62cjs.stringifyError.call(void 0, err);
|
|
4378
4392
|
const error = new (0, _chunkMGI2VVF6cjs.RivetError)(
|
|
4379
4393
|
"client",
|
|
4380
4394
|
"get_params_failed",
|
|
@@ -4398,7 +4412,7 @@ var ActorConnRaw = class {
|
|
|
4398
4412
|
this.#gatewayOptions
|
|
4399
4413
|
);
|
|
4400
4414
|
_invariant2.default.call(void 0, ws, "websocket should have been created");
|
|
4401
|
-
|
|
4415
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).debug({
|
|
4402
4416
|
msg: "opened websocket",
|
|
4403
4417
|
connId: this.#connId,
|
|
4404
4418
|
readyState: ws.readyState,
|
|
@@ -4406,42 +4420,46 @@ var ActorConnRaw = class {
|
|
|
4406
4420
|
});
|
|
4407
4421
|
this.#websocket = ws;
|
|
4408
4422
|
ws.addEventListener("open", () => {
|
|
4409
|
-
if (this.#abandonedSockets.has(ws))
|
|
4410
|
-
|
|
4423
|
+
if (this.#websocket !== ws || this.#abandonedSockets.has(ws))
|
|
4424
|
+
return;
|
|
4425
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).debug({
|
|
4411
4426
|
msg: "client websocket open",
|
|
4412
4427
|
connId: this.#connId
|
|
4413
4428
|
});
|
|
4414
4429
|
});
|
|
4415
4430
|
ws.addEventListener("message", async (ev) => {
|
|
4416
|
-
if (this.#abandonedSockets.has(ws))
|
|
4431
|
+
if (this.#websocket !== ws || this.#abandonedSockets.has(ws))
|
|
4432
|
+
return;
|
|
4417
4433
|
try {
|
|
4418
|
-
await this.#handleOnMessage(ev.data);
|
|
4434
|
+
await this.#handleOnMessage(ev.data, ws);
|
|
4419
4435
|
} catch (err) {
|
|
4420
|
-
|
|
4436
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).error({
|
|
4421
4437
|
msg: "error in websocket message handler",
|
|
4422
|
-
error:
|
|
4438
|
+
error: _chunkCFGRIV62cjs.stringifyError.call(void 0, err)
|
|
4423
4439
|
});
|
|
4424
4440
|
}
|
|
4425
4441
|
});
|
|
4426
4442
|
ws.addEventListener("close", async (ev) => {
|
|
4427
|
-
if (this.#abandonedSockets.has(ws))
|
|
4443
|
+
if (this.#websocket !== ws || this.#abandonedSockets.has(ws))
|
|
4444
|
+
return;
|
|
4428
4445
|
try {
|
|
4429
4446
|
await this.#handleOnClose(ev);
|
|
4430
4447
|
} catch (err) {
|
|
4431
|
-
|
|
4448
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).error({
|
|
4432
4449
|
msg: "error in websocket close handler",
|
|
4433
|
-
error:
|
|
4450
|
+
error: _chunkCFGRIV62cjs.stringifyError.call(void 0, err)
|
|
4434
4451
|
});
|
|
4435
4452
|
}
|
|
4436
4453
|
});
|
|
4437
4454
|
ws.addEventListener("error", () => {
|
|
4438
|
-
if (this.#abandonedSockets.has(ws))
|
|
4455
|
+
if (this.#websocket !== ws || this.#abandonedSockets.has(ws))
|
|
4456
|
+
return;
|
|
4439
4457
|
try {
|
|
4440
4458
|
this.#handleOnError();
|
|
4441
4459
|
} catch (err) {
|
|
4442
|
-
|
|
4460
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).error({
|
|
4443
4461
|
msg: "error in websocket error handler",
|
|
4444
|
-
error:
|
|
4462
|
+
error: _chunkCFGRIV62cjs.stringifyError.call(void 0, err)
|
|
4445
4463
|
});
|
|
4446
4464
|
}
|
|
4447
4465
|
});
|
|
@@ -4449,7 +4467,7 @@ var ActorConnRaw = class {
|
|
|
4449
4467
|
/** Called by the onopen event from drivers. */
|
|
4450
4468
|
#handleOnOpen() {
|
|
4451
4469
|
if (this.#disposed) {
|
|
4452
|
-
|
|
4470
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).debug({
|
|
4453
4471
|
msg: "handleOnOpen called after dispose, closing websocket"
|
|
4454
4472
|
});
|
|
4455
4473
|
if (this.#websocket) {
|
|
@@ -4465,7 +4483,7 @@ var ActorConnRaw = class {
|
|
|
4465
4483
|
queueMicrotask(() => {
|
|
4466
4484
|
this.#openScheduled = false;
|
|
4467
4485
|
if (this.#disposed) {
|
|
4468
|
-
|
|
4486
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).debug({
|
|
4469
4487
|
msg: "handleOnOpen scheduled after dispose, closing websocket"
|
|
4470
4488
|
});
|
|
4471
4489
|
if (this.#websocket) {
|
|
@@ -4474,7 +4492,7 @@ var ActorConnRaw = class {
|
|
|
4474
4492
|
}
|
|
4475
4493
|
return;
|
|
4476
4494
|
}
|
|
4477
|
-
|
|
4495
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).debug({
|
|
4478
4496
|
msg: "socket open",
|
|
4479
4497
|
messageQueueLength: this.#messageQueue.length,
|
|
4480
4498
|
connId: this.#connId
|
|
@@ -4484,14 +4502,14 @@ var ActorConnRaw = class {
|
|
|
4484
4502
|
if (this.#onOpenPromise) {
|
|
4485
4503
|
this.#onOpenPromise.resolve(void 0);
|
|
4486
4504
|
} else {
|
|
4487
|
-
|
|
4505
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).warn({ msg: "#onOpenPromise is undefined" });
|
|
4488
4506
|
}
|
|
4489
4507
|
for (const eventName of this.#eventSubscriptions.keys()) {
|
|
4490
4508
|
this.#sendSubscription(eventName, true);
|
|
4491
4509
|
}
|
|
4492
4510
|
const queue = this.#messageQueue;
|
|
4493
4511
|
this.#messageQueue = [];
|
|
4494
|
-
|
|
4512
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).debug({
|
|
4495
4513
|
msg: "flushing message queue",
|
|
4496
4514
|
queueLength: queue.length
|
|
4497
4515
|
});
|
|
@@ -4501,25 +4519,27 @@ var ActorConnRaw = class {
|
|
|
4501
4519
|
});
|
|
4502
4520
|
}
|
|
4503
4521
|
/** Called by the onmessage event from drivers. */
|
|
4504
|
-
async #handleOnMessage(data) {
|
|
4522
|
+
async #handleOnMessage(data, socket) {
|
|
4505
4523
|
var _a;
|
|
4506
|
-
|
|
4524
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).trace({
|
|
4507
4525
|
msg: "received message",
|
|
4508
4526
|
dataType: typeof data,
|
|
4509
4527
|
isBlob: data instanceof Blob,
|
|
4510
4528
|
isArrayBuffer: data instanceof ArrayBuffer
|
|
4511
4529
|
});
|
|
4512
4530
|
const response = await this.#parseMessage(data);
|
|
4513
|
-
|
|
4514
|
-
|
|
4531
|
+
if (this.#websocket !== socket || this.#abandonedSockets.has(socket))
|
|
4532
|
+
return;
|
|
4533
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).trace(
|
|
4534
|
+
_chunkCFGRIV62cjs.getLogMessage.call(void 0, ) ? {
|
|
4515
4535
|
msg: "parsed message",
|
|
4516
|
-
message:
|
|
4536
|
+
message: _chunkCFGRIV62cjs.jsonStringifyCompat.call(void 0, response).substring(0, 100) + "..."
|
|
4517
4537
|
} : { msg: "parsed message" }
|
|
4518
4538
|
);
|
|
4519
4539
|
if (response.body.tag === "Init") {
|
|
4520
4540
|
this.#actorId = response.body.val.actorId;
|
|
4521
4541
|
this.#connId = response.body.val.connectionId;
|
|
4522
|
-
|
|
4542
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).trace({
|
|
4523
4543
|
msg: "received init message",
|
|
4524
4544
|
actorId: this.#actorId,
|
|
4525
4545
|
connId: this.#connId
|
|
@@ -4530,7 +4550,7 @@ var ActorConnRaw = class {
|
|
|
4530
4550
|
if (actionId !== null) {
|
|
4531
4551
|
const inFlight = this.#takeActionInFlight(Number(actionId));
|
|
4532
4552
|
this.#invalidateActorIfStale(group, code);
|
|
4533
|
-
|
|
4553
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).warn({
|
|
4534
4554
|
msg: "action error",
|
|
4535
4555
|
actionId,
|
|
4536
4556
|
actionName: inFlight == null ? void 0 : inFlight.name,
|
|
@@ -4549,7 +4569,7 @@ var ActorConnRaw = class {
|
|
|
4549
4569
|
})
|
|
4550
4570
|
);
|
|
4551
4571
|
} else {
|
|
4552
|
-
|
|
4572
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).warn({
|
|
4553
4573
|
msg: "connection error",
|
|
4554
4574
|
group,
|
|
4555
4575
|
code,
|
|
@@ -4581,43 +4601,40 @@ var ActorConnRaw = class {
|
|
|
4581
4601
|
this.#actorResolutionState,
|
|
4582
4602
|
this.#driver
|
|
4583
4603
|
);
|
|
4604
|
+
if (this.#websocket !== socket || this.#abandonedSockets.has(socket)) {
|
|
4605
|
+
return;
|
|
4606
|
+
}
|
|
4584
4607
|
if (schedulingError) {
|
|
4585
4608
|
errorToThrow = schedulingError;
|
|
4586
4609
|
}
|
|
4587
4610
|
}
|
|
4588
|
-
if (this.#onOpenPromise) {
|
|
4589
|
-
this.#onOpenPromise.reject(errorToThrow);
|
|
4590
|
-
}
|
|
4591
4611
|
this.#invalidateActorIfStale(group, code);
|
|
4592
|
-
|
|
4593
|
-
inFlight.reject(errorToThrow);
|
|
4594
|
-
this.#actionsInFlight.delete(id);
|
|
4595
|
-
}
|
|
4612
|
+
this.#rejectPendingPromises(errorToThrow, false);
|
|
4596
4613
|
this.#dispatchActorError(errorToThrow);
|
|
4597
4614
|
}
|
|
4598
4615
|
} else if (response.body.tag === "ActionResponse") {
|
|
4599
4616
|
const { id: actionId } = response.body.val;
|
|
4600
|
-
|
|
4617
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).debug({
|
|
4601
4618
|
msg: "received action response",
|
|
4602
4619
|
actionId: Number(actionId),
|
|
4603
4620
|
inFlightCount: this.#actionsInFlight.size,
|
|
4604
4621
|
inFlightIds: Array.from(this.#actionsInFlight.keys())
|
|
4605
4622
|
});
|
|
4606
4623
|
const inFlight = this.#takeActionInFlight(Number(actionId));
|
|
4607
|
-
|
|
4624
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).trace({
|
|
4608
4625
|
msg: "resolving action promise",
|
|
4609
4626
|
actionId,
|
|
4610
4627
|
actionName: inFlight == null ? void 0 : inFlight.name
|
|
4611
4628
|
});
|
|
4612
4629
|
inFlight.resolve(response.body.val);
|
|
4613
4630
|
} else if (response.body.tag === "Event") {
|
|
4614
|
-
|
|
4631
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).trace({
|
|
4615
4632
|
msg: "received event",
|
|
4616
4633
|
name: response.body.val.name
|
|
4617
4634
|
});
|
|
4618
4635
|
this.#dispatchEvent(response.body.val);
|
|
4619
4636
|
} else {
|
|
4620
|
-
|
|
4637
|
+
_chunkCFGRIV62cjs.assertUnreachable.call(void 0, response.body);
|
|
4621
4638
|
}
|
|
4622
4639
|
}
|
|
4623
4640
|
/** Called by the onclose event from drivers. */
|
|
@@ -4627,7 +4644,7 @@ var ActorConnRaw = class {
|
|
|
4627
4644
|
const closeEvent = event;
|
|
4628
4645
|
const wasClean = closeEvent.wasClean;
|
|
4629
4646
|
const wasConnected = this.#connStatus === "connected";
|
|
4630
|
-
|
|
4647
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).info({
|
|
4631
4648
|
msg: "socket closed",
|
|
4632
4649
|
code: closeEvent.code,
|
|
4633
4650
|
reason: closeEvent.reason,
|
|
@@ -4655,7 +4672,7 @@ var ActorConnRaw = class {
|
|
|
4655
4672
|
this.#authRetryAvailable = false;
|
|
4656
4673
|
}
|
|
4657
4674
|
} catch (e4) {
|
|
4658
|
-
|
|
4675
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).warn("token renewal failed");
|
|
4659
4676
|
this.#authRetryAvailable = false;
|
|
4660
4677
|
}
|
|
4661
4678
|
} else if (isInvalidToken(group, code)) {
|
|
@@ -4702,16 +4719,19 @@ var ActorConnRaw = class {
|
|
|
4702
4719
|
}
|
|
4703
4720
|
this.#invalidateActorIfStale(group, code);
|
|
4704
4721
|
} else {
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4722
|
+
const message = `${wasClean ? "Connection closed" : "Connection lost"} (code: ${closeEvent.code}, reason: ${reason})`;
|
|
4723
|
+
error = !wasConnected && closeEvent.code === 1006 ? new (0, _chunkMGI2VVF6cjs.RivetError)(
|
|
4724
|
+
"client",
|
|
4725
|
+
"connection_open_interrupted",
|
|
4726
|
+
message
|
|
4727
|
+
) : new Error(message);
|
|
4708
4728
|
}
|
|
4709
4729
|
this.#rejectPendingPromises(error, false);
|
|
4710
4730
|
if (error instanceof _chunkMGI2VVF6cjs.RivetError) {
|
|
4711
4731
|
this.#dispatchActorError(error);
|
|
4712
4732
|
}
|
|
4713
4733
|
if (wasConnected && this.#authRetryAvailable) {
|
|
4714
|
-
|
|
4734
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).debug({
|
|
4715
4735
|
msg: "triggering reconnect",
|
|
4716
4736
|
connId: this.#connId
|
|
4717
4737
|
});
|
|
@@ -4720,6 +4740,7 @@ var ActorConnRaw = class {
|
|
|
4720
4740
|
}
|
|
4721
4741
|
}
|
|
4722
4742
|
#rejectPendingPromises(error, suppressUnhandled) {
|
|
4743
|
+
this.#clearQueuedMessages();
|
|
4723
4744
|
if (this.#onOpenPromise) {
|
|
4724
4745
|
if (suppressUnhandled) {
|
|
4725
4746
|
this.#onOpenPromise.promise.catch(() => {
|
|
@@ -4735,12 +4756,12 @@ var ActorConnRaw = class {
|
|
|
4735
4756
|
/** Called by the onerror event from drivers. */
|
|
4736
4757
|
#handleOnError() {
|
|
4737
4758
|
if (this.#disposed) return;
|
|
4738
|
-
|
|
4759
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).warn("socket error");
|
|
4739
4760
|
}
|
|
4740
4761
|
#takeActionInFlight(id) {
|
|
4741
4762
|
const inFlight = this.#actionsInFlight.get(id);
|
|
4742
4763
|
if (!inFlight) {
|
|
4743
|
-
|
|
4764
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).error({
|
|
4744
4765
|
msg: "action not found in in-flight map",
|
|
4745
4766
|
lookupId: id,
|
|
4746
4767
|
inFlightCount: this.#actionsInFlight.size,
|
|
@@ -4755,7 +4776,7 @@ var ActorConnRaw = class {
|
|
|
4755
4776
|
throw internalClientError(`No in flight response for ${id}`);
|
|
4756
4777
|
}
|
|
4757
4778
|
this.#actionsInFlight.delete(id);
|
|
4758
|
-
|
|
4779
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).debug({
|
|
4759
4780
|
msg: "removed action from in-flight map",
|
|
4760
4781
|
actionId: id,
|
|
4761
4782
|
actionName: inFlight.name,
|
|
@@ -4782,9 +4803,9 @@ var ActorConnRaw = class {
|
|
|
4782
4803
|
try {
|
|
4783
4804
|
handler(error);
|
|
4784
4805
|
} catch (err) {
|
|
4785
|
-
|
|
4806
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).error({
|
|
4786
4807
|
msg: "error in connection error handler",
|
|
4787
|
-
error:
|
|
4808
|
+
error: _chunkCFGRIV62cjs.stringifyError.call(void 0, err)
|
|
4788
4809
|
});
|
|
4789
4810
|
}
|
|
4790
4811
|
}
|
|
@@ -4889,9 +4910,9 @@ var ActorConnRaw = class {
|
|
|
4889
4910
|
try {
|
|
4890
4911
|
callback();
|
|
4891
4912
|
} catch (err) {
|
|
4892
|
-
|
|
4913
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).error({
|
|
4893
4914
|
msg: "error in open handler",
|
|
4894
|
-
error:
|
|
4915
|
+
error: _chunkCFGRIV62cjs.stringifyError.call(void 0, err)
|
|
4895
4916
|
});
|
|
4896
4917
|
}
|
|
4897
4918
|
});
|
|
@@ -4941,7 +4962,7 @@ var ActorConnRaw = class {
|
|
|
4941
4962
|
let queueMessage = false;
|
|
4942
4963
|
if (this.#websocket) {
|
|
4943
4964
|
const readyState = this.#websocket.readyState;
|
|
4944
|
-
|
|
4965
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).debug({
|
|
4945
4966
|
msg: "websocket send attempt",
|
|
4946
4967
|
readyState,
|
|
4947
4968
|
readyStateString: readyState === 0 ? "CONNECTING" : readyState === 1 ? "OPEN" : readyState === 2 ? "CLOSING" : "CLOSED",
|
|
@@ -4950,7 +4971,7 @@ var ActorConnRaw = class {
|
|
|
4950
4971
|
actionName: (_a = message.body.val) == null ? void 0 : _a.name
|
|
4951
4972
|
});
|
|
4952
4973
|
if (this.#connStatus !== "connected") {
|
|
4953
|
-
|
|
4974
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).debug({
|
|
4954
4975
|
msg: "websocket init pending, queueing message",
|
|
4955
4976
|
connStatus: this.#connStatus,
|
|
4956
4977
|
messageType: message.body.tag
|
|
@@ -4958,7 +4979,7 @@ var ActorConnRaw = class {
|
|
|
4958
4979
|
queueMessage = true;
|
|
4959
4980
|
} else if (readyState === 1) {
|
|
4960
4981
|
try {
|
|
4961
|
-
const messageSerialized =
|
|
4982
|
+
const messageSerialized = _chunkCFGRIV62cjs.serializeWithEncoding.call(void 0,
|
|
4962
4983
|
this.#encoding,
|
|
4963
4984
|
message,
|
|
4964
4985
|
CLIENT_PROTOCOL_TO_SERVER,
|
|
@@ -4975,8 +4996,8 @@ var ActorConnRaw = class {
|
|
|
4975
4996
|
val: {
|
|
4976
4997
|
id: msg.body.val.id,
|
|
4977
4998
|
name: msg.body.val.name,
|
|
4978
|
-
args:
|
|
4979
|
-
|
|
4999
|
+
args: _chunkCFGRIV62cjs.bufferToArrayBuffer.call(void 0,
|
|
5000
|
+
_chunkCFGRIV62cjs.encodeCborCompat.call(void 0,
|
|
4980
5001
|
msg.body.val.args
|
|
4981
5002
|
)
|
|
4982
5003
|
)
|
|
@@ -4990,12 +5011,12 @@ var ActorConnRaw = class {
|
|
|
4990
5011
|
);
|
|
4991
5012
|
this.#websocket.send(messageSerialized);
|
|
4992
5013
|
const serializedLength = messageLength(messageSerialized);
|
|
4993
|
-
|
|
5014
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).trace({
|
|
4994
5015
|
msg: "sent websocket message",
|
|
4995
5016
|
len: serializedLength
|
|
4996
5017
|
});
|
|
4997
5018
|
} catch (error) {
|
|
4998
|
-
|
|
5019
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).warn({
|
|
4999
5020
|
msg: "failed to send message, added to queue",
|
|
5000
5021
|
error,
|
|
5001
5022
|
connId: this.#connId
|
|
@@ -5003,19 +5024,19 @@ var ActorConnRaw = class {
|
|
|
5003
5024
|
queueMessage = true;
|
|
5004
5025
|
}
|
|
5005
5026
|
} else {
|
|
5006
|
-
|
|
5027
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).debug({
|
|
5007
5028
|
msg: "websocket not open, queueing message",
|
|
5008
5029
|
readyState
|
|
5009
5030
|
});
|
|
5010
5031
|
queueMessage = true;
|
|
5011
5032
|
}
|
|
5012
5033
|
} else {
|
|
5013
|
-
|
|
5034
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).debug({ msg: "no websocket, queueing message" });
|
|
5014
5035
|
queueMessage = true;
|
|
5015
5036
|
}
|
|
5016
5037
|
if (!(opts == null ? void 0 : opts.ephemeral) && queueMessage) {
|
|
5017
5038
|
this.#messageQueue.push(message);
|
|
5018
|
-
|
|
5039
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).debug({
|
|
5019
5040
|
msg: "queued connection message",
|
|
5020
5041
|
queueLength: this.#messageQueue.length,
|
|
5021
5042
|
connId: this.#connId,
|
|
@@ -5026,8 +5047,8 @@ var ActorConnRaw = class {
|
|
|
5026
5047
|
}
|
|
5027
5048
|
async #parseMessage(data) {
|
|
5028
5049
|
_invariant2.default.call(void 0, this.#websocket, "websocket must be defined");
|
|
5029
|
-
const buffer = await
|
|
5030
|
-
return
|
|
5050
|
+
const buffer = await _chunkCFGRIV62cjs.inputDataToBuffer.call(void 0, data);
|
|
5051
|
+
return _chunkCFGRIV62cjs.deserializeWithEncoding.call(void 0,
|
|
5031
5052
|
this.#encoding,
|
|
5032
5053
|
buffer,
|
|
5033
5054
|
CLIENT_PROTOCOL_TO_CLIENT,
|
|
@@ -5062,7 +5083,7 @@ var ActorConnRaw = class {
|
|
|
5062
5083
|
group: msg.body.val.group,
|
|
5063
5084
|
code: msg.body.val.code,
|
|
5064
5085
|
message: msg.body.val.message,
|
|
5065
|
-
metadata: msg.body.val.metadata ?
|
|
5086
|
+
metadata: msg.body.val.metadata ? _chunkCFGRIV62cjs.decodeCborCompat.call(void 0,
|
|
5066
5087
|
new Uint8Array(
|
|
5067
5088
|
msg.body.val.metadata
|
|
5068
5089
|
)
|
|
@@ -5084,7 +5105,7 @@ var ActorConnRaw = class {
|
|
|
5084
5105
|
tag: "ActionResponse",
|
|
5085
5106
|
val: {
|
|
5086
5107
|
id: msg.body.val.id,
|
|
5087
|
-
output:
|
|
5108
|
+
output: _chunkCFGRIV62cjs.decodeCborCompat.call(void 0,
|
|
5088
5109
|
new Uint8Array(msg.body.val.output)
|
|
5089
5110
|
)
|
|
5090
5111
|
}
|
|
@@ -5096,7 +5117,7 @@ var ActorConnRaw = class {
|
|
|
5096
5117
|
tag: "Event",
|
|
5097
5118
|
val: {
|
|
5098
5119
|
name: msg.body.val.name,
|
|
5099
|
-
args:
|
|
5120
|
+
args: _chunkCFGRIV62cjs.decodeCborCompat.call(void 0,
|
|
5100
5121
|
new Uint8Array(msg.body.val.args)
|
|
5101
5122
|
)
|
|
5102
5123
|
}
|
|
@@ -5137,11 +5158,11 @@ var ActorConnRaw = class {
|
|
|
5137
5158
|
*/
|
|
5138
5159
|
async dispose() {
|
|
5139
5160
|
if (this.#disposed) {
|
|
5140
|
-
|
|
5161
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).warn({ msg: "connection already disconnected" });
|
|
5141
5162
|
return;
|
|
5142
5163
|
}
|
|
5143
5164
|
this.#disposed = true;
|
|
5144
|
-
|
|
5165
|
+
_chunkCLY73DEMcjs.logger.call(void 0, ).debug({ msg: "disposing actor conn" });
|
|
5145
5166
|
this.#setConnStatus("idle");
|
|
5146
5167
|
clearInterval(this.#keepNodeAliveInterval);
|
|
5147
5168
|
this.#abortController.abort();
|
|
@@ -5149,8 +5170,8 @@ var ActorConnRaw = class {
|
|
|
5149
5170
|
if (this.#websocket) {
|
|
5150
5171
|
const ws = this.#websocket;
|
|
5151
5172
|
if (ws.readyState !== 2 && ws.readyState !== 3) {
|
|
5152
|
-
const { promise, resolve } =
|
|
5153
|
-
(reason) =>
|
|
5173
|
+
const { promise, resolve } = _chunkCFGRIV62cjs.promiseWithResolvers.call(void 0,
|
|
5174
|
+
(reason) => _chunkCLY73DEMcjs.logger.call(void 0, ).warn({
|
|
5154
5175
|
msg: "unhandled websocket close promise rejection",
|
|
5155
5176
|
reason
|
|
5156
5177
|
})
|
|
@@ -5288,7 +5309,7 @@ var ClientConfigSchemaBase = _v42.default.object({
|
|
|
5288
5309
|
* Defaults to http://localhost:6420.
|
|
5289
5310
|
*/
|
|
5290
5311
|
endpoint: _v42.default.string().optional().transform((val) => {
|
|
5291
|
-
const resolved = _nullishCoalesce(_nullishCoalesce(val, () => (
|
|
5312
|
+
const resolved = _nullishCoalesce(_nullishCoalesce(val, () => ( _chunkCFGRIV62cjs.getRivetEngine.call(void 0, ))), () => ( _chunkCFGRIV62cjs.getRivetEndpoint.call(void 0, )));
|
|
5292
5313
|
if (!resolved && !hasWarnedMissingEndpoint) {
|
|
5293
5314
|
hasWarnedMissingEndpoint = true;
|
|
5294
5315
|
console.warn(
|
|
@@ -5298,14 +5319,14 @@ var ClientConfigSchemaBase = _v42.default.object({
|
|
|
5298
5319
|
return _nullishCoalesce(resolved, () => ( DEFAULT_ENDPOINT));
|
|
5299
5320
|
}),
|
|
5300
5321
|
/** Token to use to authenticate with the API. */
|
|
5301
|
-
token: _v42.default.string().optional().transform((val) => _nullishCoalesce(val, () => (
|
|
5322
|
+
token: _v42.default.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkCFGRIV62cjs.getRivetToken.call(void 0, )))),
|
|
5302
5323
|
/** Issue and renew a client token on demand. Overrides the static token when provided. */
|
|
5303
5324
|
getToken: _v42.default.custom().optional(),
|
|
5304
5325
|
/** Namespace to connect to. */
|
|
5305
|
-
namespace: _v42.default.string().optional().transform((val) => _nullishCoalesce(val, () => (
|
|
5326
|
+
namespace: _v42.default.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkCFGRIV62cjs.getRivetNamespace.call(void 0, )))),
|
|
5306
5327
|
/** Name of the envoy pool. This is used to group together envoys in to different pools. */
|
|
5307
|
-
poolName: _v42.default.string().default(() => _nullishCoalesce(
|
|
5308
|
-
encoding:
|
|
5328
|
+
poolName: _v42.default.string().default(() => _nullishCoalesce(_chunkCFGRIV62cjs.getRivetPool.call(void 0, ), () => ( "default"))),
|
|
5329
|
+
encoding: _chunkCFGRIV62cjs.EncodingSchema.default("bare"),
|
|
5309
5330
|
headers: _v42.default.record(_v42.default.string(), _v42.default.string()).optional().default(() => ({})),
|
|
5310
5331
|
gateway: _v42.default.object({
|
|
5311
5332
|
skipReadyWait: _v42.default.boolean().optional().default(false)
|
|
@@ -5490,7 +5511,7 @@ function setRemoteHibernatableWebSocketAckTestHooks(websocket, token, enabled) {
|
|
|
5490
5511
|
|
|
5491
5512
|
// src/engine-client/log.ts
|
|
5492
5513
|
function logger2() {
|
|
5493
|
-
return
|
|
5514
|
+
return _chunkCFGRIV62cjs.getLogger.call(void 0, "engine-client");
|
|
5494
5515
|
}
|
|
5495
5516
|
|
|
5496
5517
|
// src/engine-client/actor-websocket-client.ts
|
|
@@ -5623,7 +5644,7 @@ var BufferedRemoteWebSocket = (_class2 = class {
|
|
|
5623
5644
|
function buildActorGatewayUrl(endpoint, actorId, token, path = "") {
|
|
5624
5645
|
const tokenSegment = token !== void 0 ? `@${encodeURIComponent(token)}` : "";
|
|
5625
5646
|
const gatewayPath = `/gateway/${encodeURIComponent(actorId)}${tokenSegment}${path}`;
|
|
5626
|
-
return
|
|
5647
|
+
return _chunkCFGRIV62cjs.combineUrlPath.call(void 0, endpoint, gatewayPath);
|
|
5627
5648
|
}
|
|
5628
5649
|
function buildActorQueryGatewayUrl(endpoint, namespace, query, token, path = "", maxInputSize = DEFAULT_MAX_QUERY_INPUT_SIZE, crashPolicy = void 0, runnerName, options = {}) {
|
|
5629
5650
|
if (namespace.length === 0) {
|
|
@@ -5689,7 +5710,7 @@ function buildActorQueryGatewayUrl(endpoint, namespace, query, token, path = "",
|
|
|
5689
5710
|
separator = "?";
|
|
5690
5711
|
}
|
|
5691
5712
|
const gatewayPath = `/gateway/${encodeURIComponent(name)}${path}${separator}${queryString}`;
|
|
5692
|
-
return
|
|
5713
|
+
return _chunkCFGRIV62cjs.combineUrlPath.call(void 0, endpoint, gatewayPath);
|
|
5693
5714
|
}
|
|
5694
5715
|
function pushKeyQueryParams(params, key) {
|
|
5695
5716
|
const rvtKey = _chunkRTWH3AX3cjs.actorKeyToGatewayQuery.call(void 0, key);
|
|
@@ -5701,7 +5722,7 @@ function pushInputQueryParam(params, input, maxInputSize) {
|
|
|
5701
5722
|
if (input === void 0) {
|
|
5702
5723
|
return;
|
|
5703
5724
|
}
|
|
5704
|
-
const encodedInput =
|
|
5725
|
+
const encodedInput = _chunkCFGRIV62cjs.encodeCborCompat.call(void 0, input);
|
|
5705
5726
|
if (encodedInput.byteLength > maxInputSize) {
|
|
5706
5727
|
throw new Error(
|
|
5707
5728
|
`Actor query input exceeds maxInputSize (${encodedInput.byteLength} > ${maxInputSize} bytes). Increase client maxInputSize to allow larger query payloads.`
|
|
@@ -5710,10 +5731,10 @@ function pushInputQueryParam(params, input, maxInputSize) {
|
|
|
5710
5731
|
params.append("rvt-input", uint8ArrayToBase64Url(encodedInput));
|
|
5711
5732
|
}
|
|
5712
5733
|
function uint8ArrayToBase64Url(value) {
|
|
5713
|
-
return
|
|
5734
|
+
return _chunkCFGRIV62cjs.uint8ArrayToBase64.call(void 0, value).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/g, "");
|
|
5714
5735
|
}
|
|
5715
5736
|
async function openWebSocketToGateway(runConfig, gatewayUrl, encoding, params, options = {}) {
|
|
5716
|
-
const WebSocket2 = await
|
|
5737
|
+
const WebSocket2 = await _chunkCLY73DEMcjs.importWebSocket.call(void 0, );
|
|
5717
5738
|
const ackHookToken = typeof process !== "undefined" && process.env.VITEST ? crypto.randomUUID() : void 0;
|
|
5718
5739
|
logger2().debug({
|
|
5719
5740
|
msg: "opening websocket to actor via guard",
|
|
@@ -5781,7 +5802,7 @@ function getEndpoint(config) {
|
|
|
5781
5802
|
}
|
|
5782
5803
|
async function apiCall(config, method, path, body) {
|
|
5783
5804
|
const endpoint = getEndpoint(config);
|
|
5784
|
-
const url =
|
|
5805
|
+
const url = _chunkCFGRIV62cjs.combineUrlPath.call(void 0, endpoint, path, {
|
|
5785
5806
|
namespace: config.namespace
|
|
5786
5807
|
});
|
|
5787
5808
|
logger2().debug({ msg: "making api call", method, url });
|
|
@@ -5914,7 +5935,7 @@ async function lookupMetadataCached(config) {
|
|
|
5914
5935
|
msg: "failed to fetch metadata, retrying",
|
|
5915
5936
|
endpoint,
|
|
5916
5937
|
attempt: error.attemptNumber,
|
|
5917
|
-
error:
|
|
5938
|
+
error: _chunkCFGRIV62cjs.stringifyError.call(void 0, error)
|
|
5918
5939
|
});
|
|
5919
5940
|
}
|
|
5920
5941
|
}
|
|
@@ -5926,7 +5947,7 @@ async function lookupMetadataCached(config) {
|
|
|
5926
5947
|
|
|
5927
5948
|
// src/engine-client/ws-proxy.ts
|
|
5928
5949
|
async function createWebSocketProxy(_c, targetUrl, protocols) {
|
|
5929
|
-
const WebSocket2 = await
|
|
5950
|
+
const WebSocket2 = await _chunkCLY73DEMcjs.importWebSocket.call(void 0, );
|
|
5930
5951
|
const state = {};
|
|
5931
5952
|
return {
|
|
5932
5953
|
onOpen: async (_event, clientWs) => {
|
|
@@ -5991,7 +6012,7 @@ async function createWebSocketProxy(_c, targetUrl, protocols) {
|
|
|
5991
6012
|
logger2().error({
|
|
5992
6013
|
msg: "target websocket error",
|
|
5993
6014
|
targetUrl,
|
|
5994
|
-
error:
|
|
6015
|
+
error: _chunkCFGRIV62cjs.stringifyError.call(void 0, error)
|
|
5995
6016
|
});
|
|
5996
6017
|
closeWebSocketIfOpen(clientWs, 1011, "Target WebSocket error");
|
|
5997
6018
|
});
|
|
@@ -6072,7 +6093,7 @@ var RemoteEngineControlClient = class {
|
|
|
6072
6093
|
#tokenProvider;
|
|
6073
6094
|
#webSocketTokens = /* @__PURE__ */ new WeakMap();
|
|
6074
6095
|
constructor(runConfig) {
|
|
6075
|
-
if (
|
|
6096
|
+
if (_chunkCFGRIV62cjs.getNextPhase.call(void 0, ) === "phase-production-build") {
|
|
6076
6097
|
logger2().info(
|
|
6077
6098
|
"detected next.js build phase, disabling health check"
|
|
6078
6099
|
);
|
|
@@ -6211,8 +6232,8 @@ var RemoteEngineControlClient = class {
|
|
|
6211
6232
|
name,
|
|
6212
6233
|
key: _chunkRTWH3AX3cjs.serializeActorKey.call(void 0, key),
|
|
6213
6234
|
pool: _nullishCoalesce(poolName, () => ( this.#config.poolName)),
|
|
6214
|
-
input: actorInput ?
|
|
6215
|
-
|
|
6235
|
+
input: actorInput ? _chunkCFGRIV62cjs.uint8ArrayToBase64.call(void 0,
|
|
6236
|
+
_chunkCFGRIV62cjs.encodeCborCompat.call(void 0, actorInput)
|
|
6216
6237
|
) : void 0,
|
|
6217
6238
|
crash_policy: _nullishCoalesce(crashPolicy, () => ( "sleep"))
|
|
6218
6239
|
})
|
|
@@ -6265,8 +6286,8 @@ var RemoteEngineControlClient = class {
|
|
|
6265
6286
|
name,
|
|
6266
6287
|
pool: _nullishCoalesce(poolName, () => ( this.#config.poolName)),
|
|
6267
6288
|
key: _chunkRTWH3AX3cjs.serializeActorKey.call(void 0, key),
|
|
6268
|
-
input: input ?
|
|
6269
|
-
|
|
6289
|
+
input: input ? _chunkCFGRIV62cjs.uint8ArrayToBase64.call(void 0,
|
|
6290
|
+
_chunkCFGRIV62cjs.encodeCborCompat.call(void 0, input)
|
|
6270
6291
|
) : void 0,
|
|
6271
6292
|
crash_policy: _nullishCoalesce(crashPolicy, () => ( "sleep"))
|
|
6272
6293
|
})
|
|
@@ -6398,7 +6419,7 @@ var RemoteEngineControlClient = class {
|
|
|
6398
6419
|
const upgradeWebSocket = (_a = config.getUpgradeWebSocket) == null ? void 0 : _a.call(config);
|
|
6399
6420
|
_invariant2.default.call(void 0, upgradeWebSocket, "missing getUpgradeWebSocket");
|
|
6400
6421
|
const endpoint = getEndpoint(config);
|
|
6401
|
-
const guardUrl =
|
|
6422
|
+
const guardUrl = _chunkCFGRIV62cjs.combineUrlPath.call(void 0, endpoint, path);
|
|
6402
6423
|
const wsGuardUrl = guardUrl.replace("http://", "ws://");
|
|
6403
6424
|
logger2().debug({
|
|
6404
6425
|
msg: "forwarding websocket to actor via guard",
|
|
@@ -6417,7 +6438,7 @@ var RemoteEngineControlClient = class {
|
|
|
6417
6438
|
}
|
|
6418
6439
|
);
|
|
6419
6440
|
const args = await createWebSocketProxy(c, wsGuardUrl, protocols);
|
|
6420
|
-
return await upgradeWebSocket(() => args)(c,
|
|
6441
|
+
return await upgradeWebSocket(() => args)(c, _chunkCFGRIV62cjs.noopNext.call(void 0, ));
|
|
6421
6442
|
}
|
|
6422
6443
|
displayInformation() {
|
|
6423
6444
|
return { properties: {} };
|
|
@@ -6428,7 +6449,7 @@ var RemoteEngineControlClient = class {
|
|
|
6428
6449
|
#buildGatewayUrlForTarget(config, target, path, options = {}) {
|
|
6429
6450
|
const endpoint = getEndpoint(config);
|
|
6430
6451
|
if (shouldSkipReadyWait(options) && directActorIdFromTarget(target) && canUseDirectSkipReadyWaitPath(path)) {
|
|
6431
|
-
return
|
|
6452
|
+
return _chunkCFGRIV62cjs.combineUrlPath.call(void 0, endpoint, path);
|
|
6432
6453
|
}
|
|
6433
6454
|
if ("directId" in target) {
|
|
6434
6455
|
return buildActorGatewayUrl(
|
|
@@ -6529,4 +6550,4 @@ function apiActorToOutput(actor) {
|
|
|
6529
6550
|
|
|
6530
6551
|
|
|
6531
6552
|
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.readActiveTraceHeaders = readActiveTraceHeaders; exports.runWithActorInvocationSpan = runWithActorInvocationSpan; exports.ActorConnRaw = ActorConnRaw; exports.isResponseLike = isResponseLike; exports.ActorHandleRaw = ActorHandleRaw; exports.createClientWithDriver = createClientWithDriver; exports.ENGINE_HOST = ENGINE_HOST; exports.ENGINE_PORT = ENGINE_PORT; exports.buildEngineEndpoint = buildEngineEndpoint; exports.isLocalEngineEndpoint = isLocalEngineEndpoint; exports.tryParseEndpoint = tryParseEndpoint; exports.ClientConfigSchema = ClientConfigSchema; exports.convertRegistryConfigToClientConfig = convertRegistryConfigToClientConfig; exports.getDatacenters = getDatacenters; exports.updateRunnerConfig = updateRunnerConfig; exports.RemoteEngineControlClient = RemoteEngineControlClient;
|
|
6532
|
-
//# sourceMappingURL=chunk-
|
|
6553
|
+
//# sourceMappingURL=chunk-GJUWI47D.cjs.map
|