rivetkit 3.0.0-preview.2 → 3.0.0-preview.4
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 +25 -10
- 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-25MUHNWE.cjs → chunk-5IZ36V3N.cjs} +168 -153
- package/dist/tsup/chunk-5IZ36V3N.cjs.map +1 -0
- package/dist/tsup/{chunk-6IGGYL2C.js → chunk-C45DIKGB.js} +30 -15
- package/dist/tsup/chunk-C45DIKGB.js.map +1 -0
- package/dist/tsup/{chunk-WGQHG26S.js → chunk-DCUTYXIX.js} +2 -2
- package/dist/tsup/{chunk-WGKL7HMH.js → chunk-IPDSE33U.js} +2 -2
- package/dist/tsup/{chunk-442XBCAF.js → chunk-KM34T23X.js} +3 -3
- package/dist/tsup/{chunk-YZVVID47.cjs → chunk-KSQ3VVZX.cjs} +3 -3
- package/dist/tsup/{chunk-YZVVID47.cjs.map → chunk-KSQ3VVZX.cjs.map} +1 -1
- package/dist/tsup/{chunk-EPPV7WB2.cjs → chunk-LTMP7OMQ.cjs} +3 -3
- package/dist/tsup/{chunk-EPPV7WB2.cjs.map → chunk-LTMP7OMQ.cjs.map} +1 -1
- package/dist/tsup/{chunk-5F7FWAJI.js → chunk-MAUVZIXL.js} +2 -2
- package/dist/tsup/{chunk-5F7FWAJI.js.map → chunk-MAUVZIXL.js.map} +1 -1
- package/dist/tsup/{chunk-ANNVZW6B.js → chunk-OR3LWJGW.js} +2 -2
- package/dist/tsup/{chunk-3SPYZMME.cjs → chunk-S5QNPQ6K.cjs} +3 -3
- package/dist/tsup/{chunk-3SPYZMME.cjs.map → chunk-S5QNPQ6K.cjs.map} +1 -1
- package/dist/tsup/{chunk-BCG7PTBS.cjs → chunk-SLIGV2T4.cjs} +4 -4
- package/dist/tsup/{chunk-BCG7PTBS.cjs.map → chunk-SLIGV2T4.cjs.map} +1 -1
- package/dist/tsup/{chunk-XSOHGU4G.cjs → chunk-SR362FVR.cjs} +2 -2
- package/dist/tsup/{chunk-XSOHGU4G.cjs.map → chunk-SR362FVR.cjs.map} +1 -1
- package/dist/tsup/{chunk-QDRZMCX5.cjs → chunk-U2QBZJTL.cjs} +10 -10
- package/dist/tsup/{chunk-QDRZMCX5.cjs.map → chunk-U2QBZJTL.cjs.map} +1 -1
- package/dist/tsup/{chunk-CJ3MX5MI.cjs → chunk-WE5DMJFV.cjs} +7 -7
- package/dist/tsup/{chunk-CJ3MX5MI.cjs.map → chunk-WE5DMJFV.cjs.map} +1 -1
- package/dist/tsup/{chunk-OLZ4KAFL.js → chunk-WQFXPN6S.js} +4 -4
- package/dist/tsup/{chunk-3URL73AV.js → chunk-ZWBTTPP3.js} +2 -2
- 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 +93 -89
- package/dist/tsup/mod.cjs.map +1 -1
- package/dist/tsup/mod.js +13 -9
- 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.js +4 -4
- package/package.json +9 -9
- package/src/client/actor-conn.ts +38 -9
- package/src/registry/config/index.ts +2 -1
- package/src/registry/index.ts +16 -3
- package/dist/tsup/chunk-25MUHNWE.cjs.map +0 -1
- package/dist/tsup/chunk-6IGGYL2C.js.map +0 -1
- /package/dist/tsup/{chunk-WGQHG26S.js.map → chunk-DCUTYXIX.js.map} +0 -0
- /package/dist/tsup/{chunk-WGKL7HMH.js.map → chunk-IPDSE33U.js.map} +0 -0
- /package/dist/tsup/{chunk-442XBCAF.js.map → chunk-KM34T23X.js.map} +0 -0
- /package/dist/tsup/{chunk-ANNVZW6B.js.map → chunk-OR3LWJGW.js.map} +0 -0
- /package/dist/tsup/{chunk-OLZ4KAFL.js.map → chunk-WQFXPN6S.js.map} +0 -0
- /package/dist/tsup/{chunk-3URL73AV.js.map → chunk-ZWBTTPP3.js.map} +0 -0
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
deserializeActorKey,
|
|
4
4
|
serializeActorKey
|
|
5
5
|
} from "./chunk-A2CF6PFH.js";
|
|
6
|
-
import {
|
|
7
|
-
AsyncMutex
|
|
8
|
-
} from "./chunk-JTHHCZCZ.js";
|
|
9
6
|
import {
|
|
10
7
|
importWebSocket,
|
|
11
8
|
logger
|
|
12
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-IPDSE33U.js";
|
|
10
|
+
import {
|
|
11
|
+
AsyncMutex
|
|
12
|
+
} from "./chunk-JTHHCZCZ.js";
|
|
13
13
|
import {
|
|
14
14
|
EncodingSchema,
|
|
15
15
|
assertUnreachable,
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
serializeWithEncoding,
|
|
37
37
|
stringifyError,
|
|
38
38
|
uint8ArrayToBase64
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-MAUVZIXL.js";
|
|
40
40
|
import {
|
|
41
41
|
INTERNAL_ERROR_CODE,
|
|
42
42
|
RivetError,
|
|
@@ -4347,6 +4347,9 @@ var ActorConnRaw = class {
|
|
|
4347
4347
|
if (isConnectionOpenTimeout(error)) {
|
|
4348
4348
|
return true;
|
|
4349
4349
|
}
|
|
4350
|
+
if (error instanceof RivetError && error.group === "client" && error.code === "connection_open_interrupted") {
|
|
4351
|
+
return true;
|
|
4352
|
+
}
|
|
4350
4353
|
if (error instanceof RivetError && isInvalidToken(error.group, error.code) && this.#driver.refreshAuthToken && this.#authRetryAvailable) {
|
|
4351
4354
|
this.#authRetryAvailable = false;
|
|
4352
4355
|
return true;
|
|
@@ -4406,16 +4409,18 @@ var ActorConnRaw = class {
|
|
|
4406
4409
|
});
|
|
4407
4410
|
this.#websocket = ws;
|
|
4408
4411
|
ws.addEventListener("open", () => {
|
|
4409
|
-
if (this.#abandonedSockets.has(ws))
|
|
4412
|
+
if (this.#websocket !== ws || this.#abandonedSockets.has(ws))
|
|
4413
|
+
return;
|
|
4410
4414
|
logger().debug({
|
|
4411
4415
|
msg: "client websocket open",
|
|
4412
4416
|
connId: this.#connId
|
|
4413
4417
|
});
|
|
4414
4418
|
});
|
|
4415
4419
|
ws.addEventListener("message", async (ev) => {
|
|
4416
|
-
if (this.#abandonedSockets.has(ws))
|
|
4420
|
+
if (this.#websocket !== ws || this.#abandonedSockets.has(ws))
|
|
4421
|
+
return;
|
|
4417
4422
|
try {
|
|
4418
|
-
await this.#handleOnMessage(ev.data);
|
|
4423
|
+
await this.#handleOnMessage(ev.data, ws);
|
|
4419
4424
|
} catch (err) {
|
|
4420
4425
|
logger().error({
|
|
4421
4426
|
msg: "error in websocket message handler",
|
|
@@ -4424,7 +4429,8 @@ var ActorConnRaw = class {
|
|
|
4424
4429
|
}
|
|
4425
4430
|
});
|
|
4426
4431
|
ws.addEventListener("close", async (ev) => {
|
|
4427
|
-
if (this.#abandonedSockets.has(ws))
|
|
4432
|
+
if (this.#websocket !== ws || this.#abandonedSockets.has(ws))
|
|
4433
|
+
return;
|
|
4428
4434
|
try {
|
|
4429
4435
|
await this.#handleOnClose(ev);
|
|
4430
4436
|
} catch (err) {
|
|
@@ -4435,7 +4441,8 @@ var ActorConnRaw = class {
|
|
|
4435
4441
|
}
|
|
4436
4442
|
});
|
|
4437
4443
|
ws.addEventListener("error", () => {
|
|
4438
|
-
if (this.#abandonedSockets.has(ws))
|
|
4444
|
+
if (this.#websocket !== ws || this.#abandonedSockets.has(ws))
|
|
4445
|
+
return;
|
|
4439
4446
|
try {
|
|
4440
4447
|
this.#handleOnError();
|
|
4441
4448
|
} catch (err) {
|
|
@@ -4501,7 +4508,7 @@ var ActorConnRaw = class {
|
|
|
4501
4508
|
});
|
|
4502
4509
|
}
|
|
4503
4510
|
/** Called by the onmessage event from drivers. */
|
|
4504
|
-
async #handleOnMessage(data) {
|
|
4511
|
+
async #handleOnMessage(data, socket) {
|
|
4505
4512
|
var _a;
|
|
4506
4513
|
logger().trace({
|
|
4507
4514
|
msg: "received message",
|
|
@@ -4510,6 +4517,8 @@ var ActorConnRaw = class {
|
|
|
4510
4517
|
isArrayBuffer: data instanceof ArrayBuffer
|
|
4511
4518
|
});
|
|
4512
4519
|
const response = await this.#parseMessage(data);
|
|
4520
|
+
if (this.#websocket !== socket || this.#abandonedSockets.has(socket))
|
|
4521
|
+
return;
|
|
4513
4522
|
logger().trace(
|
|
4514
4523
|
getLogMessage() ? {
|
|
4515
4524
|
msg: "parsed message",
|
|
@@ -4581,6 +4590,9 @@ var ActorConnRaw = class {
|
|
|
4581
4590
|
this.#actorResolutionState,
|
|
4582
4591
|
this.#driver
|
|
4583
4592
|
);
|
|
4593
|
+
if (this.#websocket !== socket || this.#abandonedSockets.has(socket)) {
|
|
4594
|
+
return;
|
|
4595
|
+
}
|
|
4584
4596
|
if (schedulingError) {
|
|
4585
4597
|
errorToThrow = schedulingError;
|
|
4586
4598
|
}
|
|
@@ -4702,9 +4714,12 @@ var ActorConnRaw = class {
|
|
|
4702
4714
|
}
|
|
4703
4715
|
this.#invalidateActorIfStale(group, code);
|
|
4704
4716
|
} else {
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4717
|
+
const message = `${wasClean ? "Connection closed" : "Connection lost"} (code: ${closeEvent.code}, reason: ${reason})`;
|
|
4718
|
+
error = !wasConnected && closeEvent.code === 1006 ? new RivetError(
|
|
4719
|
+
"client",
|
|
4720
|
+
"connection_open_interrupted",
|
|
4721
|
+
message
|
|
4722
|
+
) : new Error(message);
|
|
4708
4723
|
}
|
|
4709
4724
|
this.#rejectPendingPromises(error, false);
|
|
4710
4725
|
if (error instanceof RivetError) {
|
|
@@ -6529,4 +6544,4 @@ export {
|
|
|
6529
6544
|
updateRunnerConfig,
|
|
6530
6545
|
RemoteEngineControlClient
|
|
6531
6546
|
};
|
|
6532
|
-
//# sourceMappingURL=chunk-
|
|
6547
|
+
//# sourceMappingURL=chunk-C45DIKGB.js.map
|