rivetkit 2.1.3 → 2.1.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.d.ts +11 -0
- package/dist/browser/client.js +1 -1
- 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/inspector.tar.gz +0 -0
- package/dist/tsup/{chunk-OAOF23ZY.js → chunk-2OK7S6QF.js} +2 -2
- package/dist/tsup/{chunk-5AZ6UPEF.cjs → chunk-7WF2QSIC.cjs} +24 -20
- package/dist/tsup/chunk-7WF2QSIC.cjs.map +1 -0
- package/dist/tsup/{chunk-IJAGZS57.cjs → chunk-D2SPAJVT.cjs} +30 -30
- package/dist/tsup/{chunk-IJAGZS57.cjs.map → chunk-D2SPAJVT.cjs.map} +1 -1
- package/dist/tsup/{chunk-YET3IZD6.js → chunk-EIATSBYZ.js} +2 -2
- package/dist/tsup/{chunk-YET3IZD6.js.map → chunk-EIATSBYZ.js.map} +1 -1
- package/dist/tsup/{chunk-DADGS67O.cjs → chunk-GQGRQDRL.cjs} +4 -4
- package/dist/tsup/{chunk-DADGS67O.cjs.map → chunk-GQGRQDRL.cjs.map} +1 -1
- package/dist/tsup/{chunk-ZSJ2OTY4.cjs → chunk-HYPIHCDT.cjs} +2 -2
- package/dist/tsup/{chunk-ZSJ2OTY4.cjs.map → chunk-HYPIHCDT.cjs.map} +1 -1
- package/dist/tsup/{chunk-HPAX7L72.cjs → chunk-IIJNPVPQ.cjs} +152 -152
- package/dist/tsup/{chunk-HPAX7L72.cjs.map → chunk-IIJNPVPQ.cjs.map} +1 -1
- package/dist/tsup/{chunk-U6VWVHVW.cjs → chunk-JC6BEPE7.cjs} +3 -3
- package/dist/tsup/{chunk-U6VWVHVW.cjs.map → chunk-JC6BEPE7.cjs.map} +1 -1
- package/dist/tsup/{chunk-N7ASEZ2Y.js → chunk-JPXO2H55.js} +5 -5
- package/dist/tsup/{chunk-QUDLEWGD.js → chunk-MIX2KB6U.js} +212 -47
- package/dist/tsup/chunk-MIX2KB6U.js.map +1 -0
- package/dist/tsup/{chunk-BMNB6YRQ.cjs → chunk-OAXJWGMU.cjs} +212 -305
- package/dist/tsup/chunk-OAXJWGMU.cjs.map +1 -0
- package/dist/tsup/{chunk-KSZZRTOD.cjs → chunk-PB5AEMKQ.cjs} +3 -5
- package/dist/tsup/chunk-PB5AEMKQ.cjs.map +1 -0
- package/dist/tsup/{chunk-6T3WSP5M.js → chunk-R5OQUSLN.js} +4 -4
- package/dist/tsup/{chunk-POUBQA6Z.js → chunk-S662Y6ZU.js} +2 -2
- package/dist/tsup/{chunk-GNGRMP5E.js → chunk-SRIM3GHD.js} +18 -11
- package/dist/tsup/chunk-SRIM3GHD.js.map +1 -0
- package/dist/tsup/{chunk-MAXIXG56.js → chunk-TADUYCHF.js} +2 -4
- package/dist/tsup/chunk-TADUYCHF.js.map +1 -0
- package/dist/tsup/{chunk-R64EFI6F.cjs → chunk-TI5PXQGG.cjs} +280 -115
- package/dist/tsup/chunk-TI5PXQGG.cjs.map +1 -0
- package/dist/tsup/{chunk-T6MM5RTW.cjs → chunk-U5SMSA27.cjs} +250 -243
- package/dist/tsup/chunk-U5SMSA27.cjs.map +1 -0
- package/dist/tsup/{chunk-6LHZQSWJ.js → chunk-WY2SHWXQ.js} +8 -4
- package/dist/tsup/chunk-WY2SHWXQ.js.map +1 -0
- package/dist/tsup/{chunk-YLDDENCZ.js → chunk-ZPWOYQHN.js} +126 -219
- package/dist/tsup/chunk-ZPWOYQHN.js.map +1 -0
- package/dist/tsup/client/mod.cjs +6 -6
- package/dist/tsup/client/mod.d.cts +2 -2
- package/dist/tsup/client/mod.d.ts +2 -2
- package/dist/tsup/client/mod.js +5 -5
- 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-P3XujgRr.d.ts → config-Qj-zLJPc.d.ts} +11 -0
- package/dist/tsup/{config-_gfywqqI.d.cts → config-iPj5l1bL.d.cts} +11 -0
- package/dist/tsup/{context-uNA4TRn3.d.ts → context-CQCMuHND.d.ts} +1 -1
- package/dist/tsup/{context-Bxd8Cx4H.d.cts → context-DzvH1PBK.d.cts} +1 -1
- package/dist/tsup/{driver-CPGHKXyh.d.ts → driver-Jo8v-kbU.d.ts} +1 -1
- package/dist/tsup/driver-helpers/mod.cjs +4 -4
- package/dist/tsup/driver-helpers/mod.d.cts +4 -4
- package/dist/tsup/driver-helpers/mod.d.ts +4 -4
- package/dist/tsup/driver-helpers/mod.js +3 -3
- package/dist/tsup/{driver-BcLvZcKl.d.cts → driver-iV8J-WMv.d.cts} +1 -1
- package/dist/tsup/driver-test-suite/mod.cjs +196 -60
- package/dist/tsup/driver-test-suite/mod.cjs.map +1 -1
- package/dist/tsup/driver-test-suite/mod.d.cts +2 -2
- package/dist/tsup/driver-test-suite/mod.d.ts +2 -2
- package/dist/tsup/driver-test-suite/mod.js +971 -835
- package/dist/tsup/driver-test-suite/mod.js.map +1 -1
- package/dist/tsup/inspector/mod.cjs +3 -3
- package/dist/tsup/inspector/mod.js +2 -2
- package/dist/tsup/mod.cjs +8 -8
- package/dist/tsup/mod.d.cts +5 -5
- package/dist/tsup/mod.d.ts +5 -5
- package/dist/tsup/mod.js +7 -7
- package/dist/tsup/serve-test-suite/mod.cjs +182 -100
- package/dist/tsup/serve-test-suite/mod.cjs.map +1 -1
- package/dist/tsup/serve-test-suite/mod.js +93 -11
- package/dist/tsup/serve-test-suite/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +10 -10
- package/dist/tsup/test/mod.d.cts +1 -1
- package/dist/tsup/test/mod.d.ts +1 -1
- package/dist/tsup/test/mod.js +6 -6
- package/dist/tsup/utils.cjs +2 -2
- package/dist/tsup/utils.js +1 -1
- package/dist/tsup/workflow/mod.cjs +5 -5
- package/dist/tsup/workflow/mod.d.cts +3 -3
- package/dist/tsup/workflow/mod.d.ts +3 -3
- package/dist/tsup/workflow/mod.js +4 -4
- package/package.json +6 -6
- package/src/actor/config.ts +0 -2
- package/src/actor/instance/mod.ts +17 -4
- package/src/actor/router.ts +9 -6
- package/src/driver-test-suite/mod.ts +3 -0
- package/src/driver-test-suite/tests/actor-driver.ts +4 -0
- package/src/driver-test-suite/tests/actor-lifecycle.ts +157 -0
- package/src/driver-test-suite/tests/conn-error-serialization.ts +64 -0
- package/src/drivers/engine/actor-driver.ts +47 -15
- package/src/manager/router.ts +20 -6
- package/src/{registry → utils}/serve.ts +38 -4
- package/src/workflow/context.ts +4 -0
- package/dist/tsup/chunk-5AZ6UPEF.cjs.map +0 -1
- package/dist/tsup/chunk-6LHZQSWJ.js.map +0 -1
- package/dist/tsup/chunk-BMNB6YRQ.cjs.map +0 -1
- package/dist/tsup/chunk-GNGRMP5E.js.map +0 -1
- package/dist/tsup/chunk-KSZZRTOD.cjs.map +0 -1
- package/dist/tsup/chunk-MAXIXG56.js.map +0 -1
- package/dist/tsup/chunk-QUDLEWGD.js.map +0 -1
- package/dist/tsup/chunk-R64EFI6F.cjs.map +0 -1
- package/dist/tsup/chunk-T6MM5RTW.cjs.map +0 -1
- package/dist/tsup/chunk-YLDDENCZ.js.map +0 -1
- /package/dist/tsup/{chunk-OAOF23ZY.js.map → chunk-2OK7S6QF.js.map} +0 -0
- /package/dist/tsup/{chunk-N7ASEZ2Y.js.map → chunk-JPXO2H55.js.map} +0 -0
- /package/dist/tsup/{chunk-6T3WSP5M.js.map → chunk-R5OQUSLN.js.map} +0 -0
- /package/dist/tsup/{chunk-POUBQA6Z.js.map → chunk-S662Y6ZU.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } var _class;
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } var _class; var _class2;
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkIIJNPVPQcjs = require('./chunk-IIJNPVPQ.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -48,7 +48,7 @@ var _chunkHPAX7L72cjs = require('./chunk-HPAX7L72.cjs');
|
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
|
|
51
|
-
var
|
|
51
|
+
var _chunkTI5PXQGGcjs = require('./chunk-TI5PXQGG.cjs');
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
|
|
@@ -69,7 +69,7 @@ var _chunkR64EFI6Fcjs = require('./chunk-R64EFI6F.cjs');
|
|
|
69
69
|
|
|
70
70
|
|
|
71
71
|
|
|
72
|
-
var
|
|
72
|
+
var _chunkPB5AEMKQcjs = require('./chunk-PB5AEMKQ.cjs');
|
|
73
73
|
|
|
74
74
|
|
|
75
75
|
|
|
@@ -86,7 +86,7 @@ var _chunkKSZZRTODcjs = require('./chunk-KSZZRTOD.cjs');
|
|
|
86
86
|
|
|
87
87
|
|
|
88
88
|
|
|
89
|
-
var
|
|
89
|
+
var _chunkHYPIHCDTcjs = require('./chunk-HYPIHCDT.cjs');
|
|
90
90
|
|
|
91
91
|
|
|
92
92
|
|
|
@@ -124,7 +124,7 @@ var ActorInspector = (_class = class {
|
|
|
124
124
|
this.actor = actor;
|
|
125
125
|
var _a, _b;
|
|
126
126
|
this.#lastQueueSize = _nullishCoalesce(((_a = actor.queueManager) == null ? void 0 : _a.size), () => ( 0));
|
|
127
|
-
const runInspector =
|
|
127
|
+
const runInspector = _chunkPB5AEMKQcjs.getRunInspectorConfig.call(void 0, actor.config.run);
|
|
128
128
|
this.#workflowInspector = runInspector == null ? void 0 : runInspector.workflow;
|
|
129
129
|
if ((_b = this.#workflowInspector) == null ? void 0 : _b.onHistoryUpdated) {
|
|
130
130
|
this.#workflowInspector.onHistoryUpdated((history) => {
|
|
@@ -218,7 +218,7 @@ var ActorInspector = (_class = class {
|
|
|
218
218
|
records: _nullishCoalesce(((_a = countResult == null ? void 0 : countResult[0]) == null ? void 0 : _a.count), () => ( 0))
|
|
219
219
|
});
|
|
220
220
|
}
|
|
221
|
-
return
|
|
221
|
+
return _chunkHYPIHCDTcjs.bufferToArrayBuffer.call(void 0, cbor.encode({ tables: tableInfos }));
|
|
222
222
|
}
|
|
223
223
|
async getDatabaseTableRows(table, limit, offset) {
|
|
224
224
|
if (!this.isDatabaseEnabled()) {
|
|
@@ -233,7 +233,7 @@ var ActorInspector = (_class = class {
|
|
|
233
233
|
safeLimit,
|
|
234
234
|
safeOffset
|
|
235
235
|
);
|
|
236
|
-
return
|
|
236
|
+
return _chunkHYPIHCDTcjs.bufferToArrayBuffer.call(void 0, cbor.encode(result));
|
|
237
237
|
}
|
|
238
238
|
isStateEnabled() {
|
|
239
239
|
return this.actor.stateEnabled;
|
|
@@ -242,7 +242,7 @@ var ActorInspector = (_class = class {
|
|
|
242
242
|
if (!this.actor.stateEnabled) {
|
|
243
243
|
throw new (0, _chunkL47L3ZWJcjs.StateNotEnabled)();
|
|
244
244
|
}
|
|
245
|
-
return
|
|
245
|
+
return _chunkHYPIHCDTcjs.bufferToArrayBuffer.call(void 0,
|
|
246
246
|
cbor.encode(this.actor.stateManager.persistRaw.state)
|
|
247
247
|
);
|
|
248
248
|
}
|
|
@@ -254,13 +254,13 @@ var ActorInspector = (_class = class {
|
|
|
254
254
|
this.actor.connectionManager.connections.entries()
|
|
255
255
|
).map(([id, conn]) => {
|
|
256
256
|
var _a, _b;
|
|
257
|
-
const connStateManager = conn[
|
|
257
|
+
const connStateManager = conn[_chunkTI5PXQGGcjs.CONN_STATE_MANAGER_SYMBOL];
|
|
258
258
|
return {
|
|
259
|
-
type: (_a = conn[
|
|
259
|
+
type: (_a = conn[_chunkTI5PXQGGcjs.CONN_DRIVER_SYMBOL]) == null ? void 0 : _a.type,
|
|
260
260
|
id,
|
|
261
|
-
details:
|
|
261
|
+
details: _chunkHYPIHCDTcjs.bufferToArrayBuffer.call(void 0,
|
|
262
262
|
cbor.encode({
|
|
263
|
-
type: (_b = conn[
|
|
263
|
+
type: (_b = conn[_chunkTI5PXQGGcjs.CONN_DRIVER_SYMBOL]) == null ? void 0 : _b.type,
|
|
264
264
|
params: conn.params,
|
|
265
265
|
stateEnabled: connStateManager.stateEnabled,
|
|
266
266
|
state: connStateManager.stateEnabled ? connStateManager.state : void 0,
|
|
@@ -282,7 +282,7 @@ var ActorInspector = (_class = class {
|
|
|
282
282
|
}
|
|
283
283
|
async executeAction(name, params) {
|
|
284
284
|
const conn = await this.actor.connectionManager.prepareAndConnectConn(
|
|
285
|
-
|
|
285
|
+
_chunkTI5PXQGGcjs.createHttpDriver.call(void 0, ),
|
|
286
286
|
// TODO: This may cause issues
|
|
287
287
|
void 0,
|
|
288
288
|
void 0,
|
|
@@ -290,10 +290,10 @@ var ActorInspector = (_class = class {
|
|
|
290
290
|
void 0
|
|
291
291
|
);
|
|
292
292
|
try {
|
|
293
|
-
return
|
|
293
|
+
return _chunkHYPIHCDTcjs.bufferToArrayBuffer.call(void 0,
|
|
294
294
|
cbor.encode(
|
|
295
295
|
await this.actor.executeAction(
|
|
296
|
-
new (0,
|
|
296
|
+
new (0, _chunkTI5PXQGGcjs.ActionContext)(this.actor, conn),
|
|
297
297
|
name,
|
|
298
298
|
cbor.decode(Buffer.from(params))
|
|
299
299
|
)
|
|
@@ -323,12 +323,12 @@ var ActorInspector = (_class = class {
|
|
|
323
323
|
this.actor.connectionManager.connections.entries()
|
|
324
324
|
).map(([id, conn]) => {
|
|
325
325
|
var _a, _b;
|
|
326
|
-
const connStateManager = conn[
|
|
326
|
+
const connStateManager = conn[_chunkTI5PXQGGcjs.CONN_STATE_MANAGER_SYMBOL];
|
|
327
327
|
return {
|
|
328
|
-
type: (_a = conn[
|
|
328
|
+
type: (_a = conn[_chunkTI5PXQGGcjs.CONN_DRIVER_SYMBOL]) == null ? void 0 : _a.type,
|
|
329
329
|
id,
|
|
330
330
|
details: {
|
|
331
|
-
type: (_b = conn[
|
|
331
|
+
type: (_b = conn[_chunkTI5PXQGGcjs.CONN_DRIVER_SYMBOL]) == null ? void 0 : _b.type,
|
|
332
332
|
params: conn.params,
|
|
333
333
|
stateEnabled: connStateManager.stateEnabled,
|
|
334
334
|
state: connStateManager.stateEnabled ? connStateManager.state : void 0,
|
|
@@ -340,7 +340,7 @@ var ActorInspector = (_class = class {
|
|
|
340
340
|
}
|
|
341
341
|
async executeActionJson(name, args) {
|
|
342
342
|
const conn = await this.actor.connectionManager.prepareAndConnectConn(
|
|
343
|
-
|
|
343
|
+
_chunkTI5PXQGGcjs.createHttpDriver.call(void 0, ),
|
|
344
344
|
void 0,
|
|
345
345
|
void 0,
|
|
346
346
|
void 0,
|
|
@@ -348,7 +348,7 @@ var ActorInspector = (_class = class {
|
|
|
348
348
|
);
|
|
349
349
|
try {
|
|
350
350
|
return await this.actor.executeAction(
|
|
351
|
-
new (0,
|
|
351
|
+
new (0, _chunkTI5PXQGGcjs.ActionContext)(this.actor, conn),
|
|
352
352
|
name,
|
|
353
353
|
args
|
|
354
354
|
);
|
|
@@ -391,8 +391,8 @@ function escapeDoubleQuotes(value) {
|
|
|
391
391
|
function convertConnToBarePersistedConn(persist) {
|
|
392
392
|
return {
|
|
393
393
|
id: persist.id,
|
|
394
|
-
parameters:
|
|
395
|
-
state:
|
|
394
|
+
parameters: _chunkHYPIHCDTcjs.bufferToArrayBuffer.call(void 0, cbor2.encode(persist.parameters)),
|
|
395
|
+
state: _chunkHYPIHCDTcjs.bufferToArrayBuffer.call(void 0, cbor2.encode(persist.state)),
|
|
396
396
|
subscriptions: persist.subscriptions.map((sub) => ({
|
|
397
397
|
eventName: sub.eventName
|
|
398
398
|
})),
|
|
@@ -484,7 +484,7 @@ var ConnectionManager = class {
|
|
|
484
484
|
return this.#reconnectHibernatableConn(driver);
|
|
485
485
|
}
|
|
486
486
|
if (this.#actor.config.onBeforeConnect) {
|
|
487
|
-
const ctx = new (0,
|
|
487
|
+
const ctx = new (0, _chunkTI5PXQGGcjs.BeforeConnectContext)(this.#actor, request);
|
|
488
488
|
await this.#actor.runInTraceSpan(
|
|
489
489
|
"actor.onBeforeConnect",
|
|
490
490
|
{
|
|
@@ -530,8 +530,8 @@ var ConnectionManager = class {
|
|
|
530
530
|
}
|
|
531
531
|
};
|
|
532
532
|
}
|
|
533
|
-
const conn = new (0,
|
|
534
|
-
conn[
|
|
533
|
+
const conn = new (0, _chunkTI5PXQGGcjs.Conn)(this.#actor, connData);
|
|
534
|
+
conn[_chunkTI5PXQGGcjs.CONN_DRIVER_SYMBOL] = driver;
|
|
535
535
|
return conn;
|
|
536
536
|
}
|
|
537
537
|
/**
|
|
@@ -554,15 +554,15 @@ var ConnectionManager = class {
|
|
|
554
554
|
this.#callOnConnect(conn);
|
|
555
555
|
this.#actor.inspector.emitter.emit("connectionsUpdated");
|
|
556
556
|
this.#actor.resetSleepTimer();
|
|
557
|
-
conn[
|
|
558
|
-
if (conn[
|
|
557
|
+
conn[_chunkTI5PXQGGcjs.CONN_CONNECTED_SYMBOL] = true;
|
|
558
|
+
if (conn[_chunkTI5PXQGGcjs.CONN_SPEAKS_RIVETKIT_SYMBOL]) {
|
|
559
559
|
const initData = { actorId: this.#actor.id, connectionId: conn.id };
|
|
560
|
-
conn[
|
|
561
|
-
new (0,
|
|
560
|
+
conn[_chunkTI5PXQGGcjs.CONN_SEND_MESSAGE_SYMBOL](
|
|
561
|
+
new (0, _chunkTI5PXQGGcjs.CachedSerializer)(
|
|
562
562
|
initData,
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
563
|
+
_chunkTI5PXQGGcjs.TO_CLIENT_VERSIONED,
|
|
564
|
+
_chunkTI5PXQGGcjs.CURRENT_VERSION,
|
|
565
|
+
_chunkTI5PXQGGcjs.ToClientSchema,
|
|
566
566
|
// JSON: identity conversion (no nested data to encode)
|
|
567
567
|
(value) => ({
|
|
568
568
|
body: {
|
|
@@ -595,17 +595,17 @@ var ConnectionManager = class {
|
|
|
595
595
|
msg: "reconnecting hibernatable websocket connection",
|
|
596
596
|
connectionId: existingConn.id
|
|
597
597
|
});
|
|
598
|
-
if (existingConn[
|
|
598
|
+
if (existingConn[_chunkTI5PXQGGcjs.CONN_DRIVER_SYMBOL]) {
|
|
599
599
|
this.#disconnectExistingDriver(existingConn);
|
|
600
600
|
}
|
|
601
|
-
existingConn[
|
|
601
|
+
existingConn[_chunkTI5PXQGGcjs.CONN_DRIVER_SYMBOL] = driver;
|
|
602
602
|
this.#actor.resetSleepTimer();
|
|
603
|
-
existingConn[
|
|
603
|
+
existingConn[_chunkTI5PXQGGcjs.CONN_CONNECTED_SYMBOL] = true;
|
|
604
604
|
this.#actor.inspector.emitter.emit("connectionsUpdated");
|
|
605
605
|
return existingConn;
|
|
606
606
|
}
|
|
607
607
|
#disconnectExistingDriver(conn) {
|
|
608
|
-
const driver = conn[
|
|
608
|
+
const driver = conn[_chunkTI5PXQGGcjs.CONN_DRIVER_SYMBOL];
|
|
609
609
|
if (driver == null ? void 0 : driver.disconnect) {
|
|
610
610
|
driver.disconnect(
|
|
611
611
|
this.#actor,
|
|
@@ -633,7 +633,7 @@ var ConnectionManager = class {
|
|
|
633
633
|
this.#pendingDisconnectCount += 1;
|
|
634
634
|
const attributes = {
|
|
635
635
|
"rivet.conn.id": conn.id,
|
|
636
|
-
"rivet.conn.type": (_a = conn[
|
|
636
|
+
"rivet.conn.type": (_a = conn[_chunkTI5PXQGGcjs.CONN_DRIVER_SYMBOL]) == null ? void 0 : _a.type,
|
|
637
637
|
"rivet.conn.hibernatable": conn.isHibernatable
|
|
638
638
|
};
|
|
639
639
|
const span = this.#actor.startTraceSpan(
|
|
@@ -669,16 +669,16 @@ var ConnectionManager = class {
|
|
|
669
669
|
} catch (error) {
|
|
670
670
|
this.#actor.endTraceSpan(span, {
|
|
671
671
|
code: "ERROR",
|
|
672
|
-
message:
|
|
672
|
+
message: _chunkHYPIHCDTcjs.stringifyError.call(void 0, error)
|
|
673
673
|
});
|
|
674
674
|
this.#actor.rLog.error({
|
|
675
675
|
msg: "error in `onDisconnect`",
|
|
676
|
-
error:
|
|
676
|
+
error: _chunkHYPIHCDTcjs.stringifyError.call(void 0, error)
|
|
677
677
|
});
|
|
678
678
|
} finally {
|
|
679
679
|
this.#connsWithPersistChanged.delete(conn.id);
|
|
680
680
|
if (conn.isHibernatable) {
|
|
681
|
-
const key =
|
|
681
|
+
const key = _chunkPB5AEMKQcjs.makeConnKey.call(void 0, conn.id);
|
|
682
682
|
try {
|
|
683
683
|
await this.#actor.driver.kvBatchDelete(this.#actor.id, [key]);
|
|
684
684
|
this.#actor.rLog.debug({
|
|
@@ -688,7 +688,7 @@ var ConnectionManager = class {
|
|
|
688
688
|
} catch (err) {
|
|
689
689
|
this.#actor.rLog.error({
|
|
690
690
|
msg: "kvBatchDelete failed for conn",
|
|
691
|
-
err:
|
|
691
|
+
err: _chunkHYPIHCDTcjs.stringifyError.call(void 0, err)
|
|
692
692
|
});
|
|
693
693
|
}
|
|
694
694
|
}
|
|
@@ -701,7 +701,7 @@ var ConnectionManager = class {
|
|
|
701
701
|
}
|
|
702
702
|
async cleanupPersistedHibernatableConnections(reason) {
|
|
703
703
|
const staleConnections = Array.from(this.#connections.values()).filter(
|
|
704
|
-
(conn) => conn.isHibernatable && conn[
|
|
704
|
+
(conn) => conn.isHibernatable && conn[_chunkTI5PXQGGcjs.CONN_DRIVER_SYMBOL] === void 0
|
|
705
705
|
);
|
|
706
706
|
if (staleConnections.length === 0) {
|
|
707
707
|
return 0;
|
|
@@ -738,7 +738,7 @@ var ConnectionManager = class {
|
|
|
738
738
|
*/
|
|
739
739
|
restoreConnections(connections) {
|
|
740
740
|
for (const connPersist of connections) {
|
|
741
|
-
const conn = new (0,
|
|
741
|
+
const conn = new (0, _chunkTI5PXQGGcjs.Conn)(this.#actor, {
|
|
742
742
|
hibernatable: connPersist
|
|
743
743
|
});
|
|
744
744
|
this.#connections.set(conn.id, conn);
|
|
@@ -757,22 +757,22 @@ var ConnectionManager = class {
|
|
|
757
757
|
// MARK: - Private Helpers
|
|
758
758
|
findHibernatableConn(gatewayIdBuf, requestIdBuf) {
|
|
759
759
|
return Array.from(this.#connections.values()).find((conn) => {
|
|
760
|
-
const connStateManager = conn[
|
|
760
|
+
const connStateManager = conn[_chunkTI5PXQGGcjs.CONN_STATE_MANAGER_SYMBOL];
|
|
761
761
|
const h = connStateManager.hibernatableDataRaw;
|
|
762
|
-
return h &&
|
|
762
|
+
return h && _chunkHYPIHCDTcjs.arrayBuffersEqual.call(void 0, h.gatewayId, gatewayIdBuf) && _chunkHYPIHCDTcjs.arrayBuffersEqual.call(void 0, h.requestId, requestIdBuf);
|
|
763
763
|
});
|
|
764
764
|
}
|
|
765
765
|
async #createConnState(params, request) {
|
|
766
766
|
if ("createConnState" in this.#actor.config) {
|
|
767
767
|
const createConnState = this.#actor.config.createConnState;
|
|
768
|
-
const ctx = new (0,
|
|
768
|
+
const ctx = new (0, _chunkTI5PXQGGcjs.CreateConnStateContext)(this.#actor, request);
|
|
769
769
|
return await this.#actor.runInTraceSpan(
|
|
770
770
|
"actor.createConnState",
|
|
771
771
|
void 0,
|
|
772
772
|
() => {
|
|
773
773
|
const dataOrPromise = createConnState(ctx, params);
|
|
774
774
|
if (dataOrPromise instanceof Promise) {
|
|
775
|
-
return
|
|
775
|
+
return _chunkPB5AEMKQcjs.deadline.call(void 0,
|
|
776
776
|
dataOrPromise,
|
|
777
777
|
this.#actor.config.options.createConnStateTimeout
|
|
778
778
|
);
|
|
@@ -791,13 +791,13 @@ var ConnectionManager = class {
|
|
|
791
791
|
var _a;
|
|
792
792
|
const attributes = {
|
|
793
793
|
"rivet.conn.id": conn.id,
|
|
794
|
-
"rivet.conn.type": (_a = conn[
|
|
794
|
+
"rivet.conn.type": (_a = conn[_chunkTI5PXQGGcjs.CONN_DRIVER_SYMBOL]) == null ? void 0 : _a.type,
|
|
795
795
|
"rivet.conn.hibernatable": conn.isHibernatable
|
|
796
796
|
};
|
|
797
797
|
const span = this.#actor.startTraceSpan("actor.onConnect", attributes);
|
|
798
798
|
try {
|
|
799
799
|
if (this.#actor.config.onConnect) {
|
|
800
|
-
const ctx = new (0,
|
|
800
|
+
const ctx = new (0, _chunkTI5PXQGGcjs.ConnectContext)(this.#actor, conn);
|
|
801
801
|
const result = this.#actor.traces.withSpan(
|
|
802
802
|
span,
|
|
803
803
|
() => this.#actor.config.onConnect(ctx, conn)
|
|
@@ -808,7 +808,7 @@ var ConnectionManager = class {
|
|
|
808
808
|
span
|
|
809
809
|
);
|
|
810
810
|
if (result instanceof Promise) {
|
|
811
|
-
|
|
811
|
+
_chunkPB5AEMKQcjs.deadline.call(void 0,
|
|
812
812
|
result,
|
|
813
813
|
this.#actor.config.options.onConnectTimeout
|
|
814
814
|
).then(() => {
|
|
@@ -816,7 +816,7 @@ var ConnectionManager = class {
|
|
|
816
816
|
}).catch((error) => {
|
|
817
817
|
this.#actor.endTraceSpan(span, {
|
|
818
818
|
code: "ERROR",
|
|
819
|
-
message:
|
|
819
|
+
message: _chunkHYPIHCDTcjs.stringifyError.call(void 0, error)
|
|
820
820
|
});
|
|
821
821
|
this.#actor.rLog.error({
|
|
822
822
|
msg: "error in `onConnect`, closing socket",
|
|
@@ -832,11 +832,11 @@ var ConnectionManager = class {
|
|
|
832
832
|
} catch (error) {
|
|
833
833
|
this.#actor.endTraceSpan(span, {
|
|
834
834
|
code: "ERROR",
|
|
835
|
-
message:
|
|
835
|
+
message: _chunkHYPIHCDTcjs.stringifyError.call(void 0, error)
|
|
836
836
|
});
|
|
837
837
|
this.#actor.rLog.error({
|
|
838
838
|
msg: "error in `onConnect`",
|
|
839
|
-
error:
|
|
839
|
+
error: _chunkHYPIHCDTcjs.stringifyError.call(void 0, error)
|
|
840
840
|
});
|
|
841
841
|
conn == null ? void 0 : conn.disconnect("`onConnect` failed");
|
|
842
842
|
}
|
|
@@ -876,7 +876,7 @@ var EventManager = class {
|
|
|
876
876
|
}
|
|
877
877
|
subscribers.add(connection);
|
|
878
878
|
if (!fromPersist) {
|
|
879
|
-
connection[
|
|
879
|
+
connection[_chunkTI5PXQGGcjs.CONN_STATE_MANAGER_SYMBOL].addSubscription({
|
|
880
880
|
eventName
|
|
881
881
|
});
|
|
882
882
|
this.#actor.stateManager.saveState({ immediate: true });
|
|
@@ -913,7 +913,7 @@ var EventManager = class {
|
|
|
913
913
|
}
|
|
914
914
|
}
|
|
915
915
|
if (!fromRemoveConn) {
|
|
916
|
-
const removed = connection[
|
|
916
|
+
const removed = connection[_chunkTI5PXQGGcjs.CONN_STATE_MANAGER_SYMBOL].removeSubscription({ eventName });
|
|
917
917
|
if (!removed) {
|
|
918
918
|
this.#actor.rLog.warn({
|
|
919
919
|
msg: "subscription does not exist in persist",
|
|
@@ -951,11 +951,11 @@ var EventManager = class {
|
|
|
951
951
|
"rivet.broadcast.subscribers": subscribers.size
|
|
952
952
|
});
|
|
953
953
|
const eventData = { name, args };
|
|
954
|
-
const toClientSerializer = new (0,
|
|
954
|
+
const toClientSerializer = new (0, _chunkTI5PXQGGcjs.CachedSerializer)(
|
|
955
955
|
eventData,
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
956
|
+
_chunkTI5PXQGGcjs.TO_CLIENT_VERSIONED,
|
|
957
|
+
_chunkTI5PXQGGcjs.CURRENT_VERSION,
|
|
958
|
+
_chunkTI5PXQGGcjs.ToClientSchema,
|
|
959
959
|
// JSON: args is the raw value (array of arguments)
|
|
960
960
|
(value) => ({
|
|
961
961
|
body: {
|
|
@@ -972,16 +972,16 @@ var EventManager = class {
|
|
|
972
972
|
tag: "Event",
|
|
973
973
|
val: {
|
|
974
974
|
name: value.name,
|
|
975
|
-
args:
|
|
975
|
+
args: _chunkHYPIHCDTcjs.bufferToArrayBuffer.call(void 0, cbor3.encode(value.args))
|
|
976
976
|
}
|
|
977
977
|
}
|
|
978
978
|
})
|
|
979
979
|
);
|
|
980
980
|
let sentCount = 0;
|
|
981
981
|
for (const connection of subscribers) {
|
|
982
|
-
if (connection[
|
|
982
|
+
if (connection[_chunkTI5PXQGGcjs.CONN_SPEAKS_RIVETKIT_SYMBOL]) {
|
|
983
983
|
try {
|
|
984
|
-
connection[
|
|
984
|
+
connection[_chunkTI5PXQGGcjs.CONN_SEND_MESSAGE_SYMBOL](toClientSerializer);
|
|
985
985
|
sentCount++;
|
|
986
986
|
} catch (error) {
|
|
987
987
|
if (error instanceof _chunkL47L3ZWJcjs.OutgoingMessageTooLong) {
|
|
@@ -1067,9 +1067,9 @@ var EventManager = class {
|
|
|
1067
1067
|
|
|
1068
1068
|
function convertActorToBarePersisted(persist) {
|
|
1069
1069
|
return {
|
|
1070
|
-
input: persist.input !== void 0 ?
|
|
1070
|
+
input: persist.input !== void 0 ? _chunkHYPIHCDTcjs.bufferToArrayBuffer.call(void 0, cbor4.encode(persist.input)) : null,
|
|
1071
1071
|
hasInitialized: persist.hasInitialized,
|
|
1072
|
-
state:
|
|
1072
|
+
state: _chunkHYPIHCDTcjs.bufferToArrayBuffer.call(void 0, cbor4.encode(persist.state)),
|
|
1073
1073
|
scheduledEvents: persist.scheduledEvents.map((event) => ({
|
|
1074
1074
|
eventId: event.eventId,
|
|
1075
1075
|
timestamp: BigInt(event.timestamp),
|
|
@@ -1098,8 +1098,8 @@ var DEFAULT_METADATA = {
|
|
|
1098
1098
|
nextId: 1n,
|
|
1099
1099
|
size: 0
|
|
1100
1100
|
};
|
|
1101
|
-
var QUEUE_METADATA_KEY =
|
|
1102
|
-
var QUEUE_MESSAGES_PREFIX =
|
|
1101
|
+
var QUEUE_METADATA_KEY = _chunkPB5AEMKQcjs.queueMetadataKey.call(void 0, );
|
|
1102
|
+
var QUEUE_MESSAGES_PREFIX = _chunkPB5AEMKQcjs.queueMessagesPrefix.call(void 0, );
|
|
1103
1103
|
var QueueManager = class {
|
|
1104
1104
|
#actor;
|
|
1105
1105
|
#driver;
|
|
@@ -1128,7 +1128,7 @@ var QueueManager = class {
|
|
|
1128
1128
|
return;
|
|
1129
1129
|
}
|
|
1130
1130
|
try {
|
|
1131
|
-
const decoded =
|
|
1131
|
+
const decoded = _chunkTI5PXQGGcjs.QUEUE_METADATA_VERSIONED.deserializeWithEmbeddedVersion(
|
|
1132
1132
|
metadataBuffer
|
|
1133
1133
|
);
|
|
1134
1134
|
this.#metadata.nextId = decoded.nextId;
|
|
@@ -1150,14 +1150,14 @@ var QueueManager = class {
|
|
|
1150
1150
|
throw new (0, _chunkL47L3ZWJcjs.QueueFull)(sizeLimit);
|
|
1151
1151
|
}
|
|
1152
1152
|
let invalidPath = "";
|
|
1153
|
-
if (!
|
|
1153
|
+
if (!_chunkHYPIHCDTcjs.isCborSerializable.call(void 0, body, (path) => {
|
|
1154
1154
|
invalidPath = path;
|
|
1155
1155
|
})) {
|
|
1156
1156
|
throw new (0, _chunkL47L3ZWJcjs.QueueMessageInvalid)(invalidPath);
|
|
1157
1157
|
}
|
|
1158
1158
|
const createdAt = Date.now();
|
|
1159
1159
|
const bodyCborBuffer = cbor5.encode(body);
|
|
1160
|
-
const encodedMessage =
|
|
1160
|
+
const encodedMessage = _chunkTI5PXQGGcjs.QUEUE_MESSAGE_VERSIONED.serializeWithEmbeddedVersion(
|
|
1161
1161
|
{
|
|
1162
1162
|
name,
|
|
1163
1163
|
body: new Uint8Array(bodyCborBuffer).buffer,
|
|
@@ -1167,7 +1167,7 @@ var QueueManager = class {
|
|
|
1167
1167
|
inFlight: null,
|
|
1168
1168
|
inFlightAt: null
|
|
1169
1169
|
},
|
|
1170
|
-
|
|
1170
|
+
_chunkTI5PXQGGcjs.CURRENT_VERSION2
|
|
1171
1171
|
);
|
|
1172
1172
|
const encodedSize = encodedMessage.byteLength;
|
|
1173
1173
|
if (encodedSize > this.#actor.config.options.maxQueueMessageSize) {
|
|
@@ -1177,7 +1177,7 @@ var QueueManager = class {
|
|
|
1177
1177
|
);
|
|
1178
1178
|
}
|
|
1179
1179
|
const id = this.#metadata.nextId;
|
|
1180
|
-
const messageKey =
|
|
1180
|
+
const messageKey = _chunkPB5AEMKQcjs.makeQueueMessageKey.call(void 0, id);
|
|
1181
1181
|
this.#metadata.nextId = id + 1n;
|
|
1182
1182
|
this.#metadata.size += 1;
|
|
1183
1183
|
const encodedMetadata = this.#serializeMetadata();
|
|
@@ -1206,7 +1206,7 @@ var QueueManager = class {
|
|
|
1206
1206
|
}
|
|
1207
1207
|
const message = await this.enqueue(name, body);
|
|
1208
1208
|
const messageId = message.id.toString();
|
|
1209
|
-
const { promise, resolve } =
|
|
1209
|
+
const { promise, resolve } = _chunkHYPIHCDTcjs.promiseWithResolvers.call(void 0, () => {
|
|
1210
1210
|
});
|
|
1211
1211
|
const pending = { resolve };
|
|
1212
1212
|
if (timeout !== void 0) {
|
|
@@ -1249,7 +1249,7 @@ var QueueManager = class {
|
|
|
1249
1249
|
if (timeout === 0) {
|
|
1250
1250
|
return [];
|
|
1251
1251
|
}
|
|
1252
|
-
const { promise, resolve, reject } =
|
|
1252
|
+
const { promise, resolve, reject } = _chunkHYPIHCDTcjs.promiseWithResolvers.call(void 0, () => {
|
|
1253
1253
|
});
|
|
1254
1254
|
const waiterId = crypto.randomUUID();
|
|
1255
1255
|
let timeoutHandle;
|
|
@@ -1415,8 +1415,8 @@ var QueueManager = class {
|
|
|
1415
1415
|
const decoded = [];
|
|
1416
1416
|
for (const [key, value] of entries) {
|
|
1417
1417
|
try {
|
|
1418
|
-
const messageId =
|
|
1419
|
-
const decodedPayload =
|
|
1418
|
+
const messageId = _chunkPB5AEMKQcjs.decodeQueueMessageKey.call(void 0, key);
|
|
1419
|
+
const decodedPayload = _chunkTI5PXQGGcjs.QUEUE_MESSAGE_VERSIONED.deserializeWithEmbeddedVersion(
|
|
1420
1420
|
value
|
|
1421
1421
|
);
|
|
1422
1422
|
const body = cbor5.decode(new Uint8Array(decodedPayload.body));
|
|
@@ -1463,7 +1463,7 @@ var QueueManager = class {
|
|
|
1463
1463
|
if (messages.length === 0) {
|
|
1464
1464
|
return;
|
|
1465
1465
|
}
|
|
1466
|
-
const keys = messages.map((message) =>
|
|
1466
|
+
const keys = messages.map((message) => _chunkPB5AEMKQcjs.makeQueueMessageKey.call(void 0, message.id));
|
|
1467
1467
|
this.#metadata.size = Math.max(
|
|
1468
1468
|
0,
|
|
1469
1469
|
this.#metadata.size - messages.length
|
|
@@ -1501,7 +1501,7 @@ var QueueManager = class {
|
|
|
1501
1501
|
let maxId = 0n;
|
|
1502
1502
|
for (const [key] of entries) {
|
|
1503
1503
|
try {
|
|
1504
|
-
const messageId =
|
|
1504
|
+
const messageId = _chunkPB5AEMKQcjs.decodeQueueMessageKey.call(void 0, key);
|
|
1505
1505
|
if (messageId > maxId) {
|
|
1506
1506
|
maxId = messageId;
|
|
1507
1507
|
}
|
|
@@ -1516,12 +1516,12 @@ var QueueManager = class {
|
|
|
1516
1516
|
this.#actor.inspector.updateQueueSize(this.#metadata.size);
|
|
1517
1517
|
}
|
|
1518
1518
|
#serializeMetadata() {
|
|
1519
|
-
return
|
|
1519
|
+
return _chunkTI5PXQGGcjs.QUEUE_METADATA_VERSIONED.serializeWithEmbeddedVersion(
|
|
1520
1520
|
{
|
|
1521
1521
|
nextId: this.#metadata.nextId,
|
|
1522
1522
|
size: this.#metadata.size
|
|
1523
1523
|
},
|
|
1524
|
-
|
|
1524
|
+
_chunkTI5PXQGGcjs.CURRENT_VERSION2
|
|
1525
1525
|
);
|
|
1526
1526
|
}
|
|
1527
1527
|
};
|
|
@@ -1531,7 +1531,7 @@ var QueueManager = class {
|
|
|
1531
1531
|
var ScheduleManager = class {
|
|
1532
1532
|
#actor;
|
|
1533
1533
|
#actorDriver;
|
|
1534
|
-
#alarmWriteQueue = new (0,
|
|
1534
|
+
#alarmWriteQueue = new (0, _chunkHYPIHCDTcjs.SinglePromiseQueue)();
|
|
1535
1535
|
#config;
|
|
1536
1536
|
// ActorConfig type
|
|
1537
1537
|
#persist;
|
|
@@ -1561,7 +1561,7 @@ var ScheduleManager = class {
|
|
|
1561
1561
|
eventId: crypto.randomUUID(),
|
|
1562
1562
|
timestamp,
|
|
1563
1563
|
action,
|
|
1564
|
-
args:
|
|
1564
|
+
args: _chunkHYPIHCDTcjs.bufferToArrayBuffer.call(void 0, cbor6.encode(args))
|
|
1565
1565
|
};
|
|
1566
1566
|
this.#actor.emitTraceEvent("schedule.created", {
|
|
1567
1567
|
"rivet.schedule.event_id": newEvent.eventId,
|
|
@@ -1776,16 +1776,16 @@ var ScheduleManager = class {
|
|
|
1776
1776
|
});
|
|
1777
1777
|
} catch (error) {
|
|
1778
1778
|
this.#actor.traces.setAttributes(span, {
|
|
1779
|
-
"error.message":
|
|
1779
|
+
"error.message": _chunkHYPIHCDTcjs.stringifyError.call(void 0, error),
|
|
1780
1780
|
"error.type": error instanceof Error ? error.name : typeof error
|
|
1781
1781
|
});
|
|
1782
1782
|
this.#actor.endTraceSpan(span, {
|
|
1783
1783
|
code: "ERROR",
|
|
1784
|
-
message:
|
|
1784
|
+
message: _chunkHYPIHCDTcjs.stringifyError.call(void 0, error)
|
|
1785
1785
|
});
|
|
1786
1786
|
this.#actor.log.error({
|
|
1787
1787
|
msg: "error executing scheduled event",
|
|
1788
|
-
error:
|
|
1788
|
+
error: _chunkHYPIHCDTcjs.stringifyError.call(void 0, error),
|
|
1789
1789
|
eventId: event.eventId,
|
|
1790
1790
|
timestamp: event.timestamp,
|
|
1791
1791
|
action: event.action
|
|
@@ -1840,7 +1840,7 @@ var StateManager = class {
|
|
|
1840
1840
|
#persistChanged = false;
|
|
1841
1841
|
#isInOnStateChange = false;
|
|
1842
1842
|
// Save management
|
|
1843
|
-
#persistWriteQueue = new (0,
|
|
1843
|
+
#persistWriteQueue = new (0, _chunkHYPIHCDTcjs.SinglePromiseQueue)();
|
|
1844
1844
|
#lastSaveTime = 0;
|
|
1845
1845
|
#pendingSaveTimeout;
|
|
1846
1846
|
#pendingSaveScheduledTimestamp;
|
|
@@ -1909,10 +1909,10 @@ var StateManager = class {
|
|
|
1909
1909
|
const bareData = convertActorToBarePersisted(persistData);
|
|
1910
1910
|
await this.#actorDriver.kvBatchPut(this.#actor.id, [
|
|
1911
1911
|
[
|
|
1912
|
-
|
|
1913
|
-
|
|
1912
|
+
_chunkPB5AEMKQcjs.KEYS.PERSIST_DATA,
|
|
1913
|
+
_chunkTI5PXQGGcjs.ACTOR_VERSIONED.serializeWithEmbeddedVersion(
|
|
1914
1914
|
bareData,
|
|
1915
|
-
|
|
1915
|
+
_chunkTI5PXQGGcjs.CURRENT_VERSION2
|
|
1916
1916
|
)
|
|
1917
1917
|
]
|
|
1918
1918
|
]);
|
|
@@ -1926,7 +1926,7 @@ var StateManager = class {
|
|
|
1926
1926
|
this.#persistRaw = target;
|
|
1927
1927
|
if (target === null || typeof target !== "object") {
|
|
1928
1928
|
let invalidPath = "";
|
|
1929
|
-
if (!
|
|
1929
|
+
if (!_chunkHYPIHCDTcjs.isCborSerializable.call(void 0,
|
|
1930
1930
|
target,
|
|
1931
1931
|
(path) => {
|
|
1932
1932
|
invalidPath = path;
|
|
@@ -1960,7 +1960,7 @@ var StateManager = class {
|
|
|
1960
1960
|
await this.#savePersistInner();
|
|
1961
1961
|
} else {
|
|
1962
1962
|
if (!this.#onPersistSavedPromise) {
|
|
1963
|
-
this.#onPersistSavedPromise =
|
|
1963
|
+
this.#onPersistSavedPromise = _chunkHYPIHCDTcjs.promiseWithResolvers.call(void 0, (reason) => _chunkPB5AEMKQcjs.loggerWithoutContext.call(void 0, ).warn({ msg: "unhandled persist saved promise rejection", reason }));
|
|
1964
1964
|
}
|
|
1965
1965
|
this.savePersistThrottled(opts.maxWait);
|
|
1966
1966
|
await ((_a = this.#onPersistSavedPromise) == null ? void 0 : _a.promise);
|
|
@@ -2001,7 +2001,7 @@ var StateManager = class {
|
|
|
2001
2001
|
this.#savePersistInner().catch((error) => {
|
|
2002
2002
|
this.#actor.rLog.error({
|
|
2003
2003
|
msg: "error saving persist data in scheduled save",
|
|
2004
|
-
error:
|
|
2004
|
+
error: _chunkHYPIHCDTcjs.stringifyError.call(void 0, error)
|
|
2005
2005
|
});
|
|
2006
2006
|
});
|
|
2007
2007
|
}, saveDelay);
|
|
@@ -2009,7 +2009,7 @@ var StateManager = class {
|
|
|
2009
2009
|
this.#savePersistInner().catch((error) => {
|
|
2010
2010
|
this.#actor.rLog.error({
|
|
2011
2011
|
msg: "error saving persist data immediately",
|
|
2012
|
-
error:
|
|
2012
|
+
error: _chunkHYPIHCDTcjs.stringifyError.call(void 0, error)
|
|
2013
2013
|
});
|
|
2014
2014
|
});
|
|
2015
2015
|
}
|
|
@@ -2039,11 +2039,11 @@ var StateManager = class {
|
|
|
2039
2039
|
}
|
|
2040
2040
|
}
|
|
2041
2041
|
#handleStateChange(path, value) {
|
|
2042
|
-
const actorStatePath =
|
|
2043
|
-
const connStatePath =
|
|
2042
|
+
const actorStatePath = _chunkPB5AEMKQcjs.isStatePath.call(void 0, path);
|
|
2043
|
+
const connStatePath = _chunkPB5AEMKQcjs.isConnStatePath.call(void 0, path);
|
|
2044
2044
|
if (actorStatePath || connStatePath) {
|
|
2045
2045
|
let invalidPath = "";
|
|
2046
|
-
if (!
|
|
2046
|
+
if (!_chunkHYPIHCDTcjs.isCborSerializable.call(void 0,
|
|
2047
2047
|
value,
|
|
2048
2048
|
(invalidPathPart) => {
|
|
2049
2049
|
invalidPath = invalidPathPart;
|
|
@@ -2083,11 +2083,11 @@ var StateManager = class {
|
|
|
2083
2083
|
} catch (error) {
|
|
2084
2084
|
this.#actor.endTraceSpan(span, {
|
|
2085
2085
|
code: "ERROR",
|
|
2086
|
-
message:
|
|
2086
|
+
message: _chunkHYPIHCDTcjs.stringifyError.call(void 0, error)
|
|
2087
2087
|
});
|
|
2088
2088
|
this.#actor.rLog.error({
|
|
2089
2089
|
msg: "error in `_onStateChange`",
|
|
2090
|
-
error:
|
|
2090
|
+
error: _chunkHYPIHCDTcjs.stringifyError.call(void 0, error)
|
|
2091
2091
|
});
|
|
2092
2092
|
} finally {
|
|
2093
2093
|
this.#isInOnStateChange = false;
|
|
@@ -2121,10 +2121,10 @@ var StateManager = class {
|
|
|
2121
2121
|
this.#persistRaw
|
|
2122
2122
|
);
|
|
2123
2123
|
entries.push([
|
|
2124
|
-
|
|
2125
|
-
|
|
2124
|
+
_chunkPB5AEMKQcjs.KEYS.PERSIST_DATA,
|
|
2125
|
+
_chunkTI5PXQGGcjs.ACTOR_VERSIONED.serializeWithEmbeddedVersion(
|
|
2126
2126
|
bareData,
|
|
2127
|
-
|
|
2127
|
+
_chunkTI5PXQGGcjs.CURRENT_VERSION2
|
|
2128
2128
|
)
|
|
2129
2129
|
]);
|
|
2130
2130
|
}
|
|
@@ -2138,7 +2138,7 @@ var StateManager = class {
|
|
|
2138
2138
|
});
|
|
2139
2139
|
continue;
|
|
2140
2140
|
}
|
|
2141
|
-
const connStateManager = conn[
|
|
2141
|
+
const connStateManager = conn[_chunkTI5PXQGGcjs.CONN_STATE_MANAGER_SYMBOL];
|
|
2142
2142
|
const hibernatableDataRaw = connStateManager.hibernatableDataRaw;
|
|
2143
2143
|
if (!hibernatableDataRaw) {
|
|
2144
2144
|
this.#actor.log.warn({
|
|
@@ -2159,11 +2159,11 @@ var StateManager = class {
|
|
|
2159
2159
|
const bareData = convertConnToBarePersistedConn(
|
|
2160
2160
|
hibernatableDataRaw
|
|
2161
2161
|
);
|
|
2162
|
-
const connData =
|
|
2162
|
+
const connData = _chunkTI5PXQGGcjs.CONN_VERSIONED.serializeWithEmbeddedVersion(
|
|
2163
2163
|
bareData,
|
|
2164
|
-
|
|
2164
|
+
_chunkTI5PXQGGcjs.CURRENT_VERSION2
|
|
2165
2165
|
);
|
|
2166
|
-
entries.push([
|
|
2166
|
+
entries.push([_chunkPB5AEMKQcjs.makeConnKey.call(void 0, connId), connData]);
|
|
2167
2167
|
connections.push(conn);
|
|
2168
2168
|
}
|
|
2169
2169
|
this.#actor.rLog.info({
|
|
@@ -2203,7 +2203,7 @@ var StateManager = class {
|
|
|
2203
2203
|
} catch (error) {
|
|
2204
2204
|
this.#actor.rLog.error({
|
|
2205
2205
|
msg: "error saving persist",
|
|
2206
|
-
error:
|
|
2206
|
+
error: _chunkHYPIHCDTcjs.stringifyError.call(void 0, error)
|
|
2207
2207
|
});
|
|
2208
2208
|
(_b = this.#onPersistSavedPromise) == null ? void 0 : _b.reject(error);
|
|
2209
2209
|
throw error;
|
|
@@ -2237,7 +2237,7 @@ var ActorTracesDriver = class {
|
|
|
2237
2237
|
constructor(driver, actorId) {
|
|
2238
2238
|
this.#driver = driver;
|
|
2239
2239
|
this.#actorId = actorId;
|
|
2240
|
-
this.#prefix =
|
|
2240
|
+
this.#prefix = _chunkPB5AEMKQcjs.tracesStoragePrefix.call(void 0, );
|
|
2241
2241
|
}
|
|
2242
2242
|
async get(key) {
|
|
2243
2243
|
const [value] = await this.#driver.kvBatchGet(this.#actorId, [
|
|
@@ -2325,7 +2325,7 @@ var CanSleep = /* @__PURE__ */ ((CanSleep2) => {
|
|
|
2325
2325
|
CanSleep2[CanSleep2["ActiveRun"] = 7] = "ActiveRun";
|
|
2326
2326
|
return CanSleep2;
|
|
2327
2327
|
})(CanSleep || {});
|
|
2328
|
-
var ActorInstance = class {
|
|
2328
|
+
var ActorInstance = (_class2 = class {
|
|
2329
2329
|
// MARK: - Core Properties
|
|
2330
2330
|
|
|
2331
2331
|
#config;
|
|
@@ -2382,10 +2382,17 @@ var ActorInstance = class {
|
|
|
2382
2382
|
#inspector;
|
|
2383
2383
|
// MARK: - Tracing
|
|
2384
2384
|
#traces;
|
|
2385
|
+
// MARK: - Driver Overrides
|
|
2386
|
+
/**
|
|
2387
|
+
* Per-instance config option overrides applied by the driver after creation.
|
|
2388
|
+
* When set, the effective option value is the minimum of the base config
|
|
2389
|
+
* value and the override value.
|
|
2390
|
+
*/
|
|
2391
|
+
__init2() {this.overrides = {}}
|
|
2385
2392
|
// MARK: - Constructor
|
|
2386
|
-
constructor(config4) {
|
|
2393
|
+
constructor(config4) {;_class2.prototype.__init2.call(this);
|
|
2387
2394
|
this.#config = config4;
|
|
2388
|
-
this.actorContext = new (0,
|
|
2395
|
+
this.actorContext = new (0, _chunkPB5AEMKQcjs.ActorContext)(this);
|
|
2389
2396
|
this.#inspector = new ActorInspector(this);
|
|
2390
2397
|
}
|
|
2391
2398
|
// MARK: - Public Getters
|
|
@@ -2450,7 +2457,7 @@ var ActorInstance = class {
|
|
|
2450
2457
|
this.#traces.endSpan(span, {
|
|
2451
2458
|
status: {
|
|
2452
2459
|
code: "ERROR",
|
|
2453
|
-
message:
|
|
2460
|
+
message: _chunkHYPIHCDTcjs.stringifyError.call(void 0, error)
|
|
2454
2461
|
}
|
|
2455
2462
|
});
|
|
2456
2463
|
throw error;
|
|
@@ -2517,7 +2524,7 @@ var ActorInstance = class {
|
|
|
2517
2524
|
this.#actorId = actorId;
|
|
2518
2525
|
this.#name = name;
|
|
2519
2526
|
this.#key = key;
|
|
2520
|
-
this.#actorKeyString =
|
|
2527
|
+
this.#actorKeyString = _chunkTI5PXQGGcjs.serializeActorKey.call(void 0, this.#key);
|
|
2521
2528
|
this.#region = region;
|
|
2522
2529
|
this.#initializeTraces();
|
|
2523
2530
|
this.#initializeLogging();
|
|
@@ -2583,17 +2590,17 @@ var ActorInstance = class {
|
|
|
2583
2590
|
this.#abortController.abort();
|
|
2584
2591
|
} catch (e4) {
|
|
2585
2592
|
}
|
|
2586
|
-
await this.#waitForRunHandler(this.#config.options.runStopTimeout);
|
|
2593
|
+
await this.#waitForRunHandler(this.overrides.runStopTimeout !== void 0 ? Math.min(this.#config.options.runStopTimeout, this.overrides.runStopTimeout) : this.#config.options.runStopTimeout);
|
|
2587
2594
|
if (mode === "sleep") {
|
|
2588
2595
|
await this.#callOnSleep();
|
|
2589
2596
|
} else if (mode === "destroy") {
|
|
2590
2597
|
await this.#callOnDestroy();
|
|
2591
2598
|
} else {
|
|
2592
|
-
|
|
2599
|
+
_chunkPB5AEMKQcjs.assertUnreachable.call(void 0, mode);
|
|
2593
2600
|
}
|
|
2594
2601
|
await this.#disconnectConnections();
|
|
2595
2602
|
await this.#waitBackgroundPromises(
|
|
2596
|
-
this.#config.options.waitUntilTimeout
|
|
2603
|
+
this.overrides.waitUntilTimeout !== void 0 ? Math.min(this.#config.options.waitUntilTimeout, this.overrides.waitUntilTimeout) : this.#config.options.waitUntilTimeout
|
|
2597
2604
|
);
|
|
2598
2605
|
this.#rLog.info({ msg: "clearing pending save timeouts" });
|
|
2599
2606
|
this.stateManager.clearPendingSaveTimeout();
|
|
@@ -2671,14 +2678,14 @@ var ActorInstance = class {
|
|
|
2671
2678
|
this.#activeHonoHttpRequests = 0;
|
|
2672
2679
|
this.#rLog.warn({
|
|
2673
2680
|
msg: "active hono requests went below 0, this is a RivetKit bug",
|
|
2674
|
-
...
|
|
2681
|
+
..._chunkHYPIHCDTcjs.EXTRA_ERROR_LOG
|
|
2675
2682
|
});
|
|
2676
2683
|
}
|
|
2677
2684
|
this.resetSleepTimer();
|
|
2678
2685
|
}
|
|
2679
2686
|
// MARK: - Message Processing
|
|
2680
2687
|
async processMessage(message, conn) {
|
|
2681
|
-
await
|
|
2688
|
+
await _chunkTI5PXQGGcjs.processMessage.call(void 0, message, this, conn, {
|
|
2682
2689
|
onExecuteAction: async (ctx, name, args) => {
|
|
2683
2690
|
return await this.executeAction(ctx, name, args);
|
|
2684
2691
|
},
|
|
@@ -2691,7 +2698,7 @@ var ActorInstance = class {
|
|
|
2691
2698
|
});
|
|
2692
2699
|
}
|
|
2693
2700
|
async assertCanSubscribe(ctx, eventName) {
|
|
2694
|
-
const canSubscribe =
|
|
2701
|
+
const canSubscribe = _chunkPB5AEMKQcjs.getEventCanSubscribe.call(void 0, this.#config.events, eventName);
|
|
2695
2702
|
if (!canSubscribe) {
|
|
2696
2703
|
return;
|
|
2697
2704
|
}
|
|
@@ -2704,7 +2711,7 @@ var ActorInstance = class {
|
|
|
2704
2711
|
}
|
|
2705
2712
|
}
|
|
2706
2713
|
async assertCanPublish(ctx, queueName) {
|
|
2707
|
-
const canPublish =
|
|
2714
|
+
const canPublish = _chunkPB5AEMKQcjs.getQueueCanPublish.call(void 0, this.#config.queues, queueName);
|
|
2708
2715
|
if (!canPublish) {
|
|
2709
2716
|
return;
|
|
2710
2717
|
}
|
|
@@ -2754,7 +2761,7 @@ var ActorInstance = class {
|
|
|
2754
2761
|
let output;
|
|
2755
2762
|
const maybeThenable = outputOrPromise;
|
|
2756
2763
|
if (maybeThenable && typeof maybeThenable.then === "function") {
|
|
2757
|
-
output = await
|
|
2764
|
+
output = await _chunkPB5AEMKQcjs.deadline.call(void 0,
|
|
2758
2765
|
Promise.resolve(outputOrPromise),
|
|
2759
2766
|
this.#config.options.actionTimeout
|
|
2760
2767
|
);
|
|
@@ -2776,15 +2783,15 @@ var ActorInstance = class {
|
|
|
2776
2783
|
} catch (error) {
|
|
2777
2784
|
this.#rLog.error({
|
|
2778
2785
|
msg: "error in `onBeforeActionResponse`",
|
|
2779
|
-
error:
|
|
2786
|
+
error: _chunkHYPIHCDTcjs.stringifyError.call(void 0, error)
|
|
2780
2787
|
});
|
|
2781
2788
|
}
|
|
2782
2789
|
}
|
|
2783
2790
|
return output;
|
|
2784
2791
|
});
|
|
2785
2792
|
} catch (error) {
|
|
2786
|
-
const isTimeout = error instanceof
|
|
2787
|
-
const message = isTimeout ? "ActionTimedOut" :
|
|
2793
|
+
const isTimeout = error instanceof _chunkPB5AEMKQcjs.DeadlineError;
|
|
2794
|
+
const message = isTimeout ? "ActionTimedOut" : _chunkHYPIHCDTcjs.stringifyError.call(void 0, error);
|
|
2788
2795
|
this.#traces.setAttributes(actionSpan, {
|
|
2789
2796
|
"error.message": message,
|
|
2790
2797
|
"error.type": error instanceof Error ? error.name : typeof error
|
|
@@ -2799,7 +2806,7 @@ var ActorInstance = class {
|
|
|
2799
2806
|
this.#rLog.error({
|
|
2800
2807
|
msg: "action error",
|
|
2801
2808
|
actionName,
|
|
2802
|
-
error:
|
|
2809
|
+
error: _chunkHYPIHCDTcjs.stringifyError.call(void 0, error)
|
|
2803
2810
|
});
|
|
2804
2811
|
throw error;
|
|
2805
2812
|
} finally {
|
|
@@ -2813,7 +2820,7 @@ var ActorInstance = class {
|
|
|
2813
2820
|
this.#activeKeepAwakeCount = 0;
|
|
2814
2821
|
this.#rLog.warn({
|
|
2815
2822
|
msg: "active keep awake count went below 0, this is a RivetKit bug",
|
|
2816
|
-
...
|
|
2823
|
+
..._chunkHYPIHCDTcjs.EXTRA_ERROR_LOG
|
|
2817
2824
|
});
|
|
2818
2825
|
}
|
|
2819
2826
|
this.resetSleepTimer();
|
|
@@ -2835,7 +2842,7 @@ var ActorInstance = class {
|
|
|
2835
2842
|
"rivet.conn.id": conn.id
|
|
2836
2843
|
},
|
|
2837
2844
|
async () => {
|
|
2838
|
-
const ctx = new (0,
|
|
2845
|
+
const ctx = new (0, _chunkTI5PXQGGcjs.RequestContext)(this, conn, request);
|
|
2839
2846
|
try {
|
|
2840
2847
|
const response = await onRequest(ctx, request);
|
|
2841
2848
|
if (!response) {
|
|
@@ -2845,7 +2852,7 @@ var ActorInstance = class {
|
|
|
2845
2852
|
} catch (error) {
|
|
2846
2853
|
this.#rLog.error({
|
|
2847
2854
|
msg: "onRequest error",
|
|
2848
|
-
error:
|
|
2855
|
+
error: _chunkHYPIHCDTcjs.stringifyError.call(void 0, error)
|
|
2849
2856
|
});
|
|
2850
2857
|
throw error;
|
|
2851
2858
|
} finally {
|
|
@@ -2866,7 +2873,7 @@ var ActorInstance = class {
|
|
|
2866
2873
|
let spanEnded = false;
|
|
2867
2874
|
try {
|
|
2868
2875
|
this.resetSleepTimer();
|
|
2869
|
-
const ctx = new (0,
|
|
2876
|
+
const ctx = new (0, _chunkTI5PXQGGcjs.WebSocketContext)(this, conn, request);
|
|
2870
2877
|
const voidOrPromise = this.#traces.withSpan(
|
|
2871
2878
|
span,
|
|
2872
2879
|
() => this.#config.onWebSocket(ctx, websocket)
|
|
@@ -2881,13 +2888,13 @@ var ActorInstance = class {
|
|
|
2881
2888
|
if (!spanEnded) {
|
|
2882
2889
|
this.endTraceSpan(span, {
|
|
2883
2890
|
code: "ERROR",
|
|
2884
|
-
message:
|
|
2891
|
+
message: _chunkHYPIHCDTcjs.stringifyError.call(void 0, error)
|
|
2885
2892
|
});
|
|
2886
2893
|
spanEnded = true;
|
|
2887
2894
|
}
|
|
2888
2895
|
this.#rLog.error({
|
|
2889
2896
|
msg: "onWebSocket error",
|
|
2890
|
-
error:
|
|
2897
|
+
error: _chunkHYPIHCDTcjs.stringifyError.call(void 0, error)
|
|
2891
2898
|
});
|
|
2892
2899
|
}).finally(() => {
|
|
2893
2900
|
this.stateManager.savePersistThrottled();
|
|
@@ -2903,13 +2910,13 @@ var ActorInstance = class {
|
|
|
2903
2910
|
if (!spanEnded) {
|
|
2904
2911
|
this.endTraceSpan(span, {
|
|
2905
2912
|
code: "ERROR",
|
|
2906
|
-
message:
|
|
2913
|
+
message: _chunkHYPIHCDTcjs.stringifyError.call(void 0, error)
|
|
2907
2914
|
});
|
|
2908
2915
|
spanEnded = true;
|
|
2909
2916
|
}
|
|
2910
2917
|
this.#rLog.error({
|
|
2911
2918
|
msg: "onWebSocket error",
|
|
2912
|
-
error:
|
|
2919
|
+
error: _chunkHYPIHCDTcjs.stringifyError.call(void 0, error)
|
|
2913
2920
|
});
|
|
2914
2921
|
throw error;
|
|
2915
2922
|
}
|
|
@@ -2930,7 +2937,7 @@ var ActorInstance = class {
|
|
|
2930
2937
|
}).catch((error) => {
|
|
2931
2938
|
this.#rLog.error({
|
|
2932
2939
|
msg: "wait until promise failed",
|
|
2933
|
-
error:
|
|
2940
|
+
error: _chunkHYPIHCDTcjs.stringifyError.call(void 0, error)
|
|
2934
2941
|
});
|
|
2935
2942
|
});
|
|
2936
2943
|
this.#backgroundPromises.push(nonfailablePromise);
|
|
@@ -2956,7 +2963,7 @@ var ActorInstance = class {
|
|
|
2956
2963
|
this.#activeKeepAwakeCount = 0;
|
|
2957
2964
|
this.#rLog.warn({
|
|
2958
2965
|
msg: "active keep awake count went below 0, this is a RivetKit bug",
|
|
2959
|
-
...
|
|
2966
|
+
..._chunkHYPIHCDTcjs.EXTRA_ERROR_LOG
|
|
2960
2967
|
});
|
|
2961
2968
|
}
|
|
2962
2969
|
this.resetSleepTimer();
|
|
@@ -2973,14 +2980,14 @@ var ActorInstance = class {
|
|
|
2973
2980
|
this.#activeQueueWaitCount = 0;
|
|
2974
2981
|
this.#rLog.warn({
|
|
2975
2982
|
msg: "active queue wait count went below 0, this is a RivetKit bug",
|
|
2976
|
-
...
|
|
2983
|
+
..._chunkHYPIHCDTcjs.EXTRA_ERROR_LOG
|
|
2977
2984
|
});
|
|
2978
2985
|
}
|
|
2979
2986
|
this.resetSleepTimer();
|
|
2980
2987
|
}
|
|
2981
2988
|
// MARK: - Private Helper Methods
|
|
2982
2989
|
#initializeTraces() {
|
|
2983
|
-
if (
|
|
2990
|
+
if (_chunkHYPIHCDTcjs.getRivetExperimentalOtel.call(void 0, )) {
|
|
2984
2991
|
this.#traces = _traces.createTraces.call(void 0, {
|
|
2985
2992
|
driver: new ActorTracesDriver(this.driver, this.#actorId)
|
|
2986
2993
|
});
|
|
@@ -3045,15 +3052,15 @@ var ActorInstance = class {
|
|
|
3045
3052
|
};
|
|
3046
3053
|
const extraLogParams = (_b = (_a = this.driver).getExtraActorLogParams) == null ? void 0 : _b.call(_a);
|
|
3047
3054
|
if (extraLogParams) Object.assign(logParams, extraLogParams);
|
|
3048
|
-
this.#log =
|
|
3055
|
+
this.#log = _chunkHYPIHCDTcjs.getBaseLogger.call(void 0, ).child(
|
|
3049
3056
|
Object.assign(
|
|
3050
|
-
|
|
3057
|
+
_chunkHYPIHCDTcjs.getIncludeTarget.call(void 0, ) ? { target: "actor" } : {},
|
|
3051
3058
|
logParams
|
|
3052
3059
|
)
|
|
3053
3060
|
);
|
|
3054
|
-
this.#rLog =
|
|
3061
|
+
this.#rLog = _chunkHYPIHCDTcjs.getBaseLogger.call(void 0, ).child(
|
|
3055
3062
|
Object.assign(
|
|
3056
|
-
|
|
3063
|
+
_chunkHYPIHCDTcjs.getIncludeTarget.call(void 0, ) ? { target: "actor-runtime" } : {},
|
|
3057
3064
|
logParams
|
|
3058
3065
|
)
|
|
3059
3066
|
);
|
|
@@ -3063,13 +3070,13 @@ var ActorInstance = class {
|
|
|
3063
3070
|
async #loadState() {
|
|
3064
3071
|
const [persistDataBuffer] = await this.driver.kvBatchGet(
|
|
3065
3072
|
this.#actorId,
|
|
3066
|
-
[
|
|
3073
|
+
[_chunkPB5AEMKQcjs.KEYS.PERSIST_DATA]
|
|
3067
3074
|
);
|
|
3068
3075
|
_invariant2.default.call(void 0,
|
|
3069
3076
|
persistDataBuffer !== null,
|
|
3070
3077
|
"persist data has not been set, it should be set when initialized"
|
|
3071
3078
|
);
|
|
3072
|
-
const bareData =
|
|
3079
|
+
const bareData = _chunkTI5PXQGGcjs.ACTOR_VERSIONED.deserializeWithEmbeddedVersion(persistDataBuffer);
|
|
3073
3080
|
const persistData = convertActorFromBarePersisted(bareData);
|
|
3074
3081
|
if (persistData.hasInitialized) {
|
|
3075
3082
|
await this.#restoreExistingActor(persistData);
|
|
@@ -3093,12 +3100,12 @@ var ActorInstance = class {
|
|
|
3093
3100
|
async #restoreExistingActor(persistData) {
|
|
3094
3101
|
const connEntries = await this.driver.kvListPrefix(
|
|
3095
3102
|
this.#actorId,
|
|
3096
|
-
|
|
3103
|
+
_chunkPB5AEMKQcjs.KEYS.CONN_PREFIX
|
|
3097
3104
|
);
|
|
3098
3105
|
const connections = [];
|
|
3099
3106
|
for (const [_key, value] of connEntries) {
|
|
3100
3107
|
try {
|
|
3101
|
-
const bareData =
|
|
3108
|
+
const bareData = _chunkTI5PXQGGcjs.CONN_VERSIONED.deserializeWithEmbeddedVersion(
|
|
3102
3109
|
new Uint8Array(value)
|
|
3103
3110
|
);
|
|
3104
3111
|
const conn = convertConnFromBarePersistedConn(bareData);
|
|
@@ -3106,7 +3113,7 @@ var ActorInstance = class {
|
|
|
3106
3113
|
} catch (error) {
|
|
3107
3114
|
this.#rLog.error({
|
|
3108
3115
|
msg: "failed to decode connection",
|
|
3109
|
-
error:
|
|
3116
|
+
error: _chunkHYPIHCDTcjs.stringifyError.call(void 0, error)
|
|
3110
3117
|
});
|
|
3111
3118
|
}
|
|
3112
3119
|
}
|
|
@@ -3119,17 +3126,17 @@ var ActorInstance = class {
|
|
|
3119
3126
|
}
|
|
3120
3127
|
async #initializeInspectorToken() {
|
|
3121
3128
|
const [tokenBuffer] = await this.driver.kvBatchGet(this.#actorId, [
|
|
3122
|
-
|
|
3129
|
+
_chunkPB5AEMKQcjs.KEYS.INSPECTOR_TOKEN
|
|
3123
3130
|
]);
|
|
3124
3131
|
if (tokenBuffer !== null) {
|
|
3125
3132
|
const decoder = new TextDecoder();
|
|
3126
3133
|
this.#inspectorToken = decoder.decode(tokenBuffer);
|
|
3127
3134
|
this.#rLog.debug({ msg: "loaded existing inspector token" });
|
|
3128
3135
|
} else {
|
|
3129
|
-
this.#inspectorToken =
|
|
3136
|
+
this.#inspectorToken = _chunkPB5AEMKQcjs.generateSecureToken.call(void 0, );
|
|
3130
3137
|
const tokenBytes = new TextEncoder().encode(this.#inspectorToken);
|
|
3131
3138
|
await this.driver.kvBatchPut(this.#actorId, [
|
|
3132
|
-
[
|
|
3139
|
+
[_chunkPB5AEMKQcjs.KEYS.INSPECTOR_TOKEN, tokenBytes]
|
|
3133
3140
|
]);
|
|
3134
3141
|
this.#rLog.debug({ msg: "generated new inspector token" });
|
|
3135
3142
|
}
|
|
@@ -3147,7 +3154,7 @@ var ActorInstance = class {
|
|
|
3147
3154
|
this.driver.getContext(this.#actorId)
|
|
3148
3155
|
);
|
|
3149
3156
|
if (dataOrPromise instanceof Promise) {
|
|
3150
|
-
return
|
|
3157
|
+
return _chunkPB5AEMKQcjs.deadline.call(void 0,
|
|
3151
3158
|
dataOrPromise,
|
|
3152
3159
|
this.#config.options.createVarsTimeout
|
|
3153
3160
|
);
|
|
@@ -3186,21 +3193,21 @@ var ActorInstance = class {
|
|
|
3186
3193
|
async () => {
|
|
3187
3194
|
const result = onSleep(this.actorContext);
|
|
3188
3195
|
if (result instanceof Promise) {
|
|
3189
|
-
await
|
|
3196
|
+
await _chunkPB5AEMKQcjs.deadline.call(void 0,
|
|
3190
3197
|
result,
|
|
3191
|
-
this.#config.options.onSleepTimeout
|
|
3198
|
+
this.overrides.onSleepTimeout !== void 0 ? Math.min(this.#config.options.onSleepTimeout, this.overrides.onSleepTimeout) : this.#config.options.onSleepTimeout
|
|
3192
3199
|
);
|
|
3193
3200
|
}
|
|
3194
3201
|
}
|
|
3195
3202
|
);
|
|
3196
3203
|
this.#rLog.debug({ msg: "onSleep completed" });
|
|
3197
3204
|
} catch (error) {
|
|
3198
|
-
if (error instanceof
|
|
3205
|
+
if (error instanceof _chunkPB5AEMKQcjs.DeadlineError) {
|
|
3199
3206
|
this.#rLog.error({ msg: "onSleep timed out" });
|
|
3200
3207
|
} else {
|
|
3201
3208
|
this.#rLog.error({
|
|
3202
3209
|
msg: "error in onSleep",
|
|
3203
|
-
error:
|
|
3210
|
+
error: _chunkHYPIHCDTcjs.stringifyError.call(void 0, error)
|
|
3204
3211
|
});
|
|
3205
3212
|
}
|
|
3206
3213
|
}
|
|
@@ -3217,28 +3224,28 @@ var ActorInstance = class {
|
|
|
3217
3224
|
async () => {
|
|
3218
3225
|
const result = onDestroy(this.actorContext);
|
|
3219
3226
|
if (result instanceof Promise) {
|
|
3220
|
-
await
|
|
3227
|
+
await _chunkPB5AEMKQcjs.deadline.call(void 0,
|
|
3221
3228
|
result,
|
|
3222
|
-
this.#config.options.onDestroyTimeout
|
|
3229
|
+
this.overrides.onDestroyTimeout !== void 0 ? Math.min(this.#config.options.onDestroyTimeout, this.overrides.onDestroyTimeout) : this.#config.options.onDestroyTimeout
|
|
3223
3230
|
);
|
|
3224
3231
|
}
|
|
3225
3232
|
}
|
|
3226
3233
|
);
|
|
3227
3234
|
this.#rLog.debug({ msg: "onDestroy completed" });
|
|
3228
3235
|
} catch (error) {
|
|
3229
|
-
if (error instanceof
|
|
3236
|
+
if (error instanceof _chunkPB5AEMKQcjs.DeadlineError) {
|
|
3230
3237
|
this.#rLog.error({ msg: "onDestroy timed out" });
|
|
3231
3238
|
} else {
|
|
3232
3239
|
this.#rLog.error({
|
|
3233
3240
|
msg: "error in onDestroy",
|
|
3234
|
-
error:
|
|
3241
|
+
error: _chunkHYPIHCDTcjs.stringifyError.call(void 0, error)
|
|
3235
3242
|
});
|
|
3236
3243
|
}
|
|
3237
3244
|
}
|
|
3238
3245
|
}
|
|
3239
3246
|
}
|
|
3240
3247
|
#startRunHandler() {
|
|
3241
|
-
const runFn =
|
|
3248
|
+
const runFn = _chunkPB5AEMKQcjs.getRunFunction.call(void 0, this.#config.run);
|
|
3242
3249
|
if (!runFn) return;
|
|
3243
3250
|
this.#rLog.debug({ msg: "starting run handler" });
|
|
3244
3251
|
this.#runHandlerActive = true;
|
|
@@ -3279,7 +3286,7 @@ var ActorInstance = class {
|
|
|
3279
3286
|
}
|
|
3280
3287
|
this.#rLog.debug({
|
|
3281
3288
|
msg: "run handler threw during actor stop",
|
|
3282
|
-
error:
|
|
3289
|
+
error: _chunkHYPIHCDTcjs.stringifyError.call(void 0, error)
|
|
3283
3290
|
});
|
|
3284
3291
|
return;
|
|
3285
3292
|
}
|
|
@@ -3287,17 +3294,17 @@ var ActorInstance = class {
|
|
|
3287
3294
|
"actor.crash",
|
|
3288
3295
|
{
|
|
3289
3296
|
"rivet.actor.reason": "run_error",
|
|
3290
|
-
"error.message":
|
|
3297
|
+
"error.message": _chunkHYPIHCDTcjs.stringifyError.call(void 0, error)
|
|
3291
3298
|
},
|
|
3292
3299
|
runSpan
|
|
3293
3300
|
);
|
|
3294
3301
|
this.endTraceSpan(runSpan, {
|
|
3295
3302
|
code: "ERROR",
|
|
3296
|
-
message:
|
|
3303
|
+
message: _chunkHYPIHCDTcjs.stringifyError.call(void 0, error)
|
|
3297
3304
|
});
|
|
3298
3305
|
this.#rLog.error({
|
|
3299
3306
|
msg: "run handler threw error, crashing actor to reschedule",
|
|
3300
|
-
error:
|
|
3307
|
+
error: _chunkHYPIHCDTcjs.stringifyError.call(void 0, error)
|
|
3301
3308
|
});
|
|
3302
3309
|
this.startDestroy();
|
|
3303
3310
|
}).finally(() => {
|
|
@@ -3362,7 +3369,7 @@ var ActorInstance = class {
|
|
|
3362
3369
|
} catch (cleanupError) {
|
|
3363
3370
|
this.#rLog.error({
|
|
3364
3371
|
msg: "database setup cleanup failed",
|
|
3365
|
-
error:
|
|
3372
|
+
error: _chunkHYPIHCDTcjs.stringifyError.call(void 0, cleanupError)
|
|
3366
3373
|
});
|
|
3367
3374
|
}
|
|
3368
3375
|
}
|
|
@@ -3372,7 +3379,7 @@ var ActorInstance = class {
|
|
|
3372
3379
|
} catch (cleanupError) {
|
|
3373
3380
|
this.#rLog.error({
|
|
3374
3381
|
msg: "sqlite vfs teardown after setup failure failed",
|
|
3375
|
-
error:
|
|
3382
|
+
error: _chunkHYPIHCDTcjs.stringifyError.call(void 0, cleanupError)
|
|
3376
3383
|
});
|
|
3377
3384
|
}
|
|
3378
3385
|
}
|
|
@@ -3380,7 +3387,7 @@ var ActorInstance = class {
|
|
|
3380
3387
|
if (error instanceof Error) {
|
|
3381
3388
|
this.#rLog.error({
|
|
3382
3389
|
msg: "database setup failed",
|
|
3383
|
-
error:
|
|
3390
|
+
error: _chunkHYPIHCDTcjs.stringifyError.call(void 0, error)
|
|
3384
3391
|
});
|
|
3385
3392
|
throw error;
|
|
3386
3393
|
}
|
|
@@ -3406,7 +3413,7 @@ var ActorInstance = class {
|
|
|
3406
3413
|
} catch (error) {
|
|
3407
3414
|
this.#rLog.error({
|
|
3408
3415
|
msg: "database cleanup failed",
|
|
3409
|
-
error:
|
|
3416
|
+
error: _chunkHYPIHCDTcjs.stringifyError.call(void 0, error)
|
|
3410
3417
|
});
|
|
3411
3418
|
}
|
|
3412
3419
|
}
|
|
@@ -3416,7 +3423,7 @@ var ActorInstance = class {
|
|
|
3416
3423
|
} catch (error) {
|
|
3417
3424
|
this.#rLog.error({
|
|
3418
3425
|
msg: "sqlite vfs cleanup failed",
|
|
3419
|
-
error:
|
|
3426
|
+
error: _chunkHYPIHCDTcjs.stringifyError.call(void 0, error)
|
|
3420
3427
|
});
|
|
3421
3428
|
}
|
|
3422
3429
|
}
|
|
@@ -3529,7 +3536,7 @@ var ActorInstance = class {
|
|
|
3529
3536
|
throw new (0, _chunkL47L3ZWJcjs.VarsNotEnabled)();
|
|
3530
3537
|
}
|
|
3531
3538
|
}
|
|
3532
|
-
};
|
|
3539
|
+
}, _class2);
|
|
3533
3540
|
|
|
3534
3541
|
// src/actor/definition.ts
|
|
3535
3542
|
var ActorDefinition = class {
|
|
@@ -3556,7 +3563,7 @@ function createActorRouter(config4, actorDriver, getUpgradeWebSocket, isTest) {
|
|
|
3556
3563
|
const router = new (0, _hono.Hono)({
|
|
3557
3564
|
strict: false
|
|
3558
3565
|
});
|
|
3559
|
-
router.use("*",
|
|
3566
|
+
router.use("*", _chunkTI5PXQGGcjs.loggerMiddleware.call(void 0, _chunkPB5AEMKQcjs.loggerWithoutContext.call(void 0, )));
|
|
3560
3567
|
router.use("*", async (c, next) => {
|
|
3561
3568
|
const actor = await actorDriver.loadActor(c.env.actorId);
|
|
3562
3569
|
actor.beginHonoHttpRequest();
|
|
@@ -3577,7 +3584,7 @@ function createActorRouter(config4, actorDriver, getUpgradeWebSocket, isTest) {
|
|
|
3577
3584
|
router.get("/metadata", async (c) => {
|
|
3578
3585
|
return c.json({
|
|
3579
3586
|
runtime: "rivetkit",
|
|
3580
|
-
version:
|
|
3587
|
+
version: _chunkHYPIHCDTcjs.VERSION
|
|
3581
3588
|
});
|
|
3582
3589
|
});
|
|
3583
3590
|
if (isTest) {
|
|
@@ -3592,8 +3599,8 @@ function createActorRouter(config4, actorDriver, getUpgradeWebSocket, isTest) {
|
|
|
3592
3599
|
if (!conn) {
|
|
3593
3600
|
return c.text(`Connection not found: ${connId}`, 404);
|
|
3594
3601
|
}
|
|
3595
|
-
if ((_a = conn[
|
|
3596
|
-
conn[
|
|
3602
|
+
if ((_a = conn[_chunkTI5PXQGGcjs.CONN_DRIVER_SYMBOL]) == null ? void 0 : _a.terminate) {
|
|
3603
|
+
conn[_chunkTI5PXQGGcjs.CONN_DRIVER_SYMBOL].terminate(actor, conn);
|
|
3597
3604
|
}
|
|
3598
3605
|
return c.json({ success: true });
|
|
3599
3606
|
});
|
|
@@ -3601,7 +3608,7 @@ function createActorRouter(config4, actorDriver, getUpgradeWebSocket, isTest) {
|
|
|
3601
3608
|
if (getUpgradeWebSocket) {
|
|
3602
3609
|
router.on(
|
|
3603
3610
|
"GET",
|
|
3604
|
-
[
|
|
3611
|
+
[_chunkTI5PXQGGcjs.PATH_CONNECT, `${_chunkTI5PXQGGcjs.PATH_WEBSOCKET_PREFIX}*`, _chunkTI5PXQGGcjs.PATH_INSPECTOR_CONNECT],
|
|
3605
3612
|
async (c) => {
|
|
3606
3613
|
const upgradeWebSocket = getUpgradeWebSocket();
|
|
3607
3614
|
if (upgradeWebSocket) {
|
|
@@ -3609,8 +3616,8 @@ function createActorRouter(config4, actorDriver, getUpgradeWebSocket, isTest) {
|
|
|
3609
3616
|
const protocols = c2.req.header(
|
|
3610
3617
|
"sec-websocket-protocol"
|
|
3611
3618
|
);
|
|
3612
|
-
const { encoding, connParams } =
|
|
3613
|
-
return await
|
|
3619
|
+
const { encoding, connParams } = _chunkTI5PXQGGcjs.parseWebSocketProtocols.call(void 0, protocols);
|
|
3620
|
+
return await _chunkTI5PXQGGcjs.routeWebSocket.call(void 0,
|
|
3614
3621
|
c2.req.raw,
|
|
3615
3622
|
c2.req.path,
|
|
3616
3623
|
c2.req.header(),
|
|
@@ -3624,7 +3631,7 @@ function createActorRouter(config4, actorDriver, getUpgradeWebSocket, isTest) {
|
|
|
3624
3631
|
false,
|
|
3625
3632
|
false
|
|
3626
3633
|
);
|
|
3627
|
-
})(c,
|
|
3634
|
+
})(c, _chunkHYPIHCDTcjs.noopNext.call(void 0, ));
|
|
3628
3635
|
} else {
|
|
3629
3636
|
return c.text(
|
|
3630
3637
|
"WebSockets are not enabled for this driver.",
|
|
@@ -3637,8 +3644,8 @@ function createActorRouter(config4, actorDriver, getUpgradeWebSocket, isTest) {
|
|
|
3637
3644
|
if (config4.inspector.enabled) {
|
|
3638
3645
|
const inspectorAuth = async (c) => {
|
|
3639
3646
|
var _a;
|
|
3640
|
-
if (
|
|
3641
|
-
|
|
3647
|
+
if (_chunkHYPIHCDTcjs.isDev.call(void 0, ) && !config4.inspector.token()) {
|
|
3648
|
+
_chunkTI5PXQGGcjs.inspectorLogger.call(void 0, ).warn({
|
|
3642
3649
|
msg: "RIVET_INSPECTOR_TOKEN is not set, skipping inspector auth in development mode"
|
|
3643
3650
|
});
|
|
3644
3651
|
return void 0;
|
|
@@ -3651,7 +3658,7 @@ function createActorRouter(config4, actorDriver, getUpgradeWebSocket, isTest) {
|
|
|
3651
3658
|
if (!inspectorToken) {
|
|
3652
3659
|
return c.text("Unauthorized", 401);
|
|
3653
3660
|
}
|
|
3654
|
-
if (!
|
|
3661
|
+
if (!_chunkTI5PXQGGcjs.timingSafeEqual.call(void 0, userToken, inspectorToken)) {
|
|
3655
3662
|
return c.text("Unauthorized", 401);
|
|
3656
3663
|
}
|
|
3657
3664
|
return void 0;
|
|
@@ -3759,13 +3766,13 @@ function createActorRouter(config4, actorDriver, getUpgradeWebSocket, isTest) {
|
|
|
3759
3766
|
}
|
|
3760
3767
|
router.post("/action/:action", async (c) => {
|
|
3761
3768
|
const actionName = c.req.param("action");
|
|
3762
|
-
return
|
|
3769
|
+
return _chunkTI5PXQGGcjs.handleAction.call(void 0, c, config4, actorDriver, actionName, c.env.actorId);
|
|
3763
3770
|
});
|
|
3764
3771
|
router.post("/queue", async (c) => {
|
|
3765
|
-
return
|
|
3772
|
+
return _chunkTI5PXQGGcjs.handleQueueSend.call(void 0, c, config4, actorDriver, c.env.actorId);
|
|
3766
3773
|
});
|
|
3767
3774
|
router.post("/queue/:name", async (c) => {
|
|
3768
|
-
return
|
|
3775
|
+
return _chunkTI5PXQGGcjs.handleQueueSend.call(void 0,
|
|
3769
3776
|
c,
|
|
3770
3777
|
config4,
|
|
3771
3778
|
actorDriver,
|
|
@@ -3783,20 +3790,20 @@ function createActorRouter(config4, actorDriver, getUpgradeWebSocket, isTest) {
|
|
|
3783
3790
|
body: c.req.raw.body,
|
|
3784
3791
|
duplex: "half"
|
|
3785
3792
|
});
|
|
3786
|
-
|
|
3793
|
+
_chunkPB5AEMKQcjs.loggerWithoutContext.call(void 0, ).debug({
|
|
3787
3794
|
msg: "rewriting http url",
|
|
3788
3795
|
from: c.req.url,
|
|
3789
3796
|
to: correctedRequest.url
|
|
3790
3797
|
});
|
|
3791
|
-
return await
|
|
3798
|
+
return await _chunkTI5PXQGGcjs.handleRawRequest.call(void 0,
|
|
3792
3799
|
c,
|
|
3793
3800
|
correctedRequest,
|
|
3794
3801
|
actorDriver,
|
|
3795
3802
|
c.env.actorId
|
|
3796
3803
|
);
|
|
3797
3804
|
});
|
|
3798
|
-
router.notFound(
|
|
3799
|
-
router.onError(
|
|
3805
|
+
router.notFound(_chunkTI5PXQGGcjs.handleRouteNotFound);
|
|
3806
|
+
router.onError(_chunkTI5PXQGGcjs.handleRouteError);
|
|
3800
3807
|
return router;
|
|
3801
3808
|
}
|
|
3802
3809
|
|
|
@@ -3804,7 +3811,7 @@ function createActorRouter(config4, actorDriver, getUpgradeWebSocket, isTest) {
|
|
|
3804
3811
|
var _ws = require('hono/ws');
|
|
3805
3812
|
var _virtualwebsocket = require('@rivetkit/virtual-websocket');
|
|
3806
3813
|
function logger() {
|
|
3807
|
-
return
|
|
3814
|
+
return _chunkHYPIHCDTcjs.getLogger.call(void 0, "inline-websocket-adapter");
|
|
3808
3815
|
}
|
|
3809
3816
|
var InlineWebSocketAdapter = class {
|
|
3810
3817
|
#handler;
|
|
@@ -3955,7 +3962,7 @@ var FileSystemActorDriver = class {
|
|
|
3955
3962
|
}
|
|
3956
3963
|
/** Creates a SQLite VFS instance for creating KV-backed databases */
|
|
3957
3964
|
async createSqliteVfs() {
|
|
3958
|
-
return await
|
|
3965
|
+
return await _chunkTI5PXQGGcjs.importSqliteVfs.call(void 0, );
|
|
3959
3966
|
}
|
|
3960
3967
|
startSleep(actorId) {
|
|
3961
3968
|
this.#state.sleepActor(actorId);
|
|
@@ -4289,7 +4296,7 @@ var v1ToV2 = (v1State) => {
|
|
|
4289
4296
|
if (v1State.persistedData) {
|
|
4290
4297
|
const key = new Uint8Array([1]);
|
|
4291
4298
|
kvStorage.push({
|
|
4292
|
-
key:
|
|
4299
|
+
key: _chunkHYPIHCDTcjs.bufferToArrayBuffer.call(void 0, key),
|
|
4293
4300
|
value: v1State.persistedData
|
|
4294
4301
|
});
|
|
4295
4302
|
}
|
|
@@ -4395,33 +4402,33 @@ var ACTOR_ALARM_VERSIONED = _vbare.createVersionedDataHandler.call(void 0, {
|
|
|
4395
4402
|
|
|
4396
4403
|
// src/drivers/file-system/log.ts
|
|
4397
4404
|
function logger2() {
|
|
4398
|
-
return
|
|
4405
|
+
return _chunkHYPIHCDTcjs.getLogger.call(void 0, "driver-fs");
|
|
4399
4406
|
}
|
|
4400
4407
|
|
|
4401
4408
|
// src/drivers/file-system/utils.ts
|
|
4402
4409
|
function generateActorId(name, key) {
|
|
4403
4410
|
const jsonString = JSON.stringify([name, key]);
|
|
4404
|
-
const crypto2 =
|
|
4411
|
+
const crypto2 = _chunkTI5PXQGGcjs.getNodeCrypto.call(void 0, );
|
|
4405
4412
|
const hash = crypto2.createHash("sha256").update(jsonString).digest("hex").substring(0, 16);
|
|
4406
4413
|
return hash;
|
|
4407
4414
|
}
|
|
4408
4415
|
function createHashForPath(dirPath) {
|
|
4409
|
-
const path =
|
|
4416
|
+
const path = _chunkTI5PXQGGcjs.getNodePath.call(void 0, );
|
|
4410
4417
|
const normalizedPath = path.normalize(dirPath);
|
|
4411
4418
|
const lastComponent = path.basename(normalizedPath);
|
|
4412
|
-
const crypto2 =
|
|
4419
|
+
const crypto2 = _chunkTI5PXQGGcjs.getNodeCrypto.call(void 0, );
|
|
4413
4420
|
const hash = crypto2.createHash("sha256").update(normalizedPath).digest("hex").substring(0, 8);
|
|
4414
4421
|
return `${lastComponent}-${hash}`;
|
|
4415
4422
|
}
|
|
4416
4423
|
function getStoragePath() {
|
|
4417
4424
|
const dataPath = getDataPath("rivetkit");
|
|
4418
4425
|
const dirHash = createHashForPath(process.cwd());
|
|
4419
|
-
const path =
|
|
4426
|
+
const path = _chunkTI5PXQGGcjs.getNodePath.call(void 0, );
|
|
4420
4427
|
return path.join(dataPath, dirHash);
|
|
4421
4428
|
}
|
|
4422
4429
|
async function pathExists(path) {
|
|
4423
4430
|
try {
|
|
4424
|
-
const fs =
|
|
4431
|
+
const fs = _chunkTI5PXQGGcjs.getNodeFs.call(void 0, );
|
|
4425
4432
|
await fs.access(path);
|
|
4426
4433
|
return true;
|
|
4427
4434
|
} catch (e6) {
|
|
@@ -4430,21 +4437,21 @@ async function pathExists(path) {
|
|
|
4430
4437
|
}
|
|
4431
4438
|
async function ensureDirectoryExists(directoryPath) {
|
|
4432
4439
|
if (!await pathExists(directoryPath)) {
|
|
4433
|
-
const fs =
|
|
4440
|
+
const fs = _chunkTI5PXQGGcjs.getNodeFs.call(void 0, );
|
|
4434
4441
|
await fs.mkdir(directoryPath, { recursive: true });
|
|
4435
4442
|
}
|
|
4436
4443
|
}
|
|
4437
4444
|
function ensureDirectoryExistsSync(directoryPath) {
|
|
4438
|
-
const fsSync =
|
|
4445
|
+
const fsSync = _chunkTI5PXQGGcjs.getNodeFsSync.call(void 0, );
|
|
4439
4446
|
if (!fsSync.existsSync(directoryPath)) {
|
|
4440
4447
|
fsSync.mkdirSync(directoryPath, { recursive: true });
|
|
4441
4448
|
}
|
|
4442
4449
|
}
|
|
4443
4450
|
function getDataPath(appName) {
|
|
4444
4451
|
const platform = process.platform;
|
|
4445
|
-
const os =
|
|
4452
|
+
const os = _chunkTI5PXQGGcjs.getNodeOs.call(void 0, );
|
|
4446
4453
|
const homeDir = os.homedir();
|
|
4447
|
-
const path =
|
|
4454
|
+
const path = _chunkTI5PXQGGcjs.getNodePath.call(void 0, );
|
|
4448
4455
|
switch (platform) {
|
|
4449
4456
|
case "win32":
|
|
4450
4457
|
return path.join(
|
|
@@ -4507,7 +4514,7 @@ function configureSqliteRuntimeDatabase(rawDb, path) {
|
|
|
4507
4514
|
}
|
|
4508
4515
|
}
|
|
4509
4516
|
function loadSqliteRuntime() {
|
|
4510
|
-
const requireFn =
|
|
4517
|
+
const requireFn = _chunkTI5PXQGGcjs.getRequireFn.call(void 0, );
|
|
4511
4518
|
const loadErrors = [];
|
|
4512
4519
|
try {
|
|
4513
4520
|
const bunSqlite = requireFn(
|
|
@@ -4701,7 +4708,7 @@ var FileSystemGlobalState = class {
|
|
|
4701
4708
|
this.#persist = persist;
|
|
4702
4709
|
this.#sqliteRuntime = loadSqliteRuntime();
|
|
4703
4710
|
this.#storagePath = persist ? _nullishCoalesce(customPath, () => ( getStoragePath())) : "/tmp";
|
|
4704
|
-
const path =
|
|
4711
|
+
const path = _chunkTI5PXQGGcjs.getNodePath.call(void 0, );
|
|
4705
4712
|
this.#stateDir = path.join(this.#storagePath, "state");
|
|
4706
4713
|
this.#dbsDir = path.join(this.#storagePath, "databases");
|
|
4707
4714
|
this.#alarmsDir = path.join(this.#storagePath, "alarms");
|
|
@@ -4710,7 +4717,7 @@ var FileSystemGlobalState = class {
|
|
|
4710
4717
|
ensureDirectoryExistsSync(this.#dbsDir);
|
|
4711
4718
|
ensureDirectoryExistsSync(this.#alarmsDir);
|
|
4712
4719
|
try {
|
|
4713
|
-
const fsSync =
|
|
4720
|
+
const fsSync = _chunkTI5PXQGGcjs.getNodeFsSync.call(void 0, );
|
|
4714
4721
|
const actorIds = fsSync.readdirSync(this.#stateDir);
|
|
4715
4722
|
this.#actorCountOnStartup = actorIds.length;
|
|
4716
4723
|
} catch (error) {
|
|
@@ -4747,13 +4754,13 @@ var FileSystemGlobalState = class {
|
|
|
4747
4754
|
}
|
|
4748
4755
|
}
|
|
4749
4756
|
getActorStatePath(actorId) {
|
|
4750
|
-
return
|
|
4757
|
+
return _chunkTI5PXQGGcjs.getNodePath.call(void 0, ).join(this.#stateDir, actorId);
|
|
4751
4758
|
}
|
|
4752
4759
|
getActorDbPath(actorId) {
|
|
4753
|
-
return
|
|
4760
|
+
return _chunkTI5PXQGGcjs.getNodePath.call(void 0, ).join(this.#dbsDir, `${actorId}.db`);
|
|
4754
4761
|
}
|
|
4755
4762
|
getActorAlarmPath(actorId) {
|
|
4756
|
-
return
|
|
4763
|
+
return _chunkTI5PXQGGcjs.getNodePath.call(void 0, ).join(this.#alarmsDir, actorId);
|
|
4757
4764
|
}
|
|
4758
4765
|
#getActorKvDatabasePath(actorId) {
|
|
4759
4766
|
if (this.#persist) {
|
|
@@ -4776,7 +4783,7 @@ var FileSystemGlobalState = class {
|
|
|
4776
4783
|
}
|
|
4777
4784
|
const dbPath = this.#getActorKvDatabasePath(actorId);
|
|
4778
4785
|
if (this.#persist) {
|
|
4779
|
-
const path =
|
|
4786
|
+
const path = _chunkTI5PXQGGcjs.getNodePath.call(void 0, );
|
|
4780
4787
|
ensureDirectoryExistsSync(path.dirname(dbPath));
|
|
4781
4788
|
}
|
|
4782
4789
|
let db;
|
|
@@ -4831,7 +4838,7 @@ var FileSystemGlobalState = class {
|
|
|
4831
4838
|
return count > 0;
|
|
4832
4839
|
}
|
|
4833
4840
|
#migrateLegacyKvToSqliteOnStartupSync() {
|
|
4834
|
-
const fsSync =
|
|
4841
|
+
const fsSync = _chunkTI5PXQGGcjs.getNodeFsSync.call(void 0, );
|
|
4835
4842
|
if (!fsSync.existsSync(this.#stateDir)) {
|
|
4836
4843
|
return;
|
|
4837
4844
|
}
|
|
@@ -4856,7 +4863,7 @@ var FileSystemGlobalState = class {
|
|
|
4856
4863
|
continue;
|
|
4857
4864
|
}
|
|
4858
4865
|
const dbPath = this.getActorDbPath(actorId);
|
|
4859
|
-
const path =
|
|
4866
|
+
const path = _chunkTI5PXQGGcjs.getNodePath.call(void 0, );
|
|
4860
4867
|
ensureDirectoryExistsSync(path.dirname(dbPath));
|
|
4861
4868
|
const db = this.#sqliteRuntime.open(dbPath);
|
|
4862
4869
|
try {
|
|
@@ -4881,7 +4888,7 @@ var FileSystemGlobalState = class {
|
|
|
4881
4888
|
}
|
|
4882
4889
|
async *getActorsIterator(params) {
|
|
4883
4890
|
let actorIds = Array.from(this.#actors.keys()).sort();
|
|
4884
|
-
const fsSync =
|
|
4891
|
+
const fsSync = _chunkTI5PXQGGcjs.getNodeFsSync.call(void 0, );
|
|
4885
4892
|
if (fsSync.existsSync(this.#stateDir)) {
|
|
4886
4893
|
actorIds = fsSync.readdirSync(this.#stateDir).filter((id) => !id.includes(".tmp")).sort();
|
|
4887
4894
|
}
|
|
@@ -4938,7 +4945,7 @@ var FileSystemGlobalState = class {
|
|
|
4938
4945
|
entry.lifecycleState = 0 /* NONEXISTENT */;
|
|
4939
4946
|
entry.generation = crypto.randomUUID();
|
|
4940
4947
|
}
|
|
4941
|
-
const initialKvState =
|
|
4948
|
+
const initialKvState = _chunkTI5PXQGGcjs.getInitialActorKvState.call(void 0, input);
|
|
4942
4949
|
await this.#withActorWrite(actorId, async (lockedEntry) => {
|
|
4943
4950
|
lockedEntry.state = {
|
|
4944
4951
|
actorId,
|
|
@@ -4990,7 +4997,7 @@ var FileSystemGlobalState = class {
|
|
|
4990
4997
|
async loadActorState(entry) {
|
|
4991
4998
|
const stateFilePath = this.getActorStatePath(entry.id);
|
|
4992
4999
|
try {
|
|
4993
|
-
const fs =
|
|
5000
|
+
const fs = _chunkTI5PXQGGcjs.getNodeFs.call(void 0, );
|
|
4994
5001
|
const stateData = await fs.readFile(stateFilePath);
|
|
4995
5002
|
const loadedState = ACTOR_STATE_VERSIONED.deserializeWithEmbeddedVersion(
|
|
4996
5003
|
new Uint8Array(stateData)
|
|
@@ -5023,7 +5030,7 @@ var FileSystemGlobalState = class {
|
|
|
5023
5030
|
entry.lifecycleState = 0 /* NONEXISTENT */;
|
|
5024
5031
|
entry.generation = crypto.randomUUID();
|
|
5025
5032
|
}
|
|
5026
|
-
const initialKvState =
|
|
5033
|
+
const initialKvState = _chunkTI5PXQGGcjs.getInitialActorKvState.call(void 0, input);
|
|
5027
5034
|
await this.#withActorWrite(actorId, async (lockedEntry) => {
|
|
5028
5035
|
lockedEntry.state = {
|
|
5029
5036
|
actorId,
|
|
@@ -5063,7 +5070,7 @@ var FileSystemGlobalState = class {
|
|
|
5063
5070
|
return;
|
|
5064
5071
|
}
|
|
5065
5072
|
actor.lifecycleState = 2 /* STARTING_SLEEP */;
|
|
5066
|
-
actor.stopPromise =
|
|
5073
|
+
actor.stopPromise = _chunkHYPIHCDTcjs.promiseWithResolvers.call(void 0, (reason) => logger2().warn({ msg: "unhandled actor sleep stop promise rejection", reason }));
|
|
5067
5074
|
if (actor.loadPromise) await actor.loadPromise.catch();
|
|
5068
5075
|
if ((_a = actor.startPromise) == null ? void 0 : _a.promise)
|
|
5069
5076
|
await actor.startPromise.promise.catch();
|
|
@@ -5104,7 +5111,7 @@ var FileSystemGlobalState = class {
|
|
|
5104
5111
|
return;
|
|
5105
5112
|
}
|
|
5106
5113
|
actor.lifecycleState = 3 /* STARTING_DESTROY */;
|
|
5107
|
-
actor.stopPromise =
|
|
5114
|
+
actor.stopPromise = _chunkHYPIHCDTcjs.promiseWithResolvers.call(void 0, (reason) => logger2().warn({ msg: "unhandled actor destroy stop promise rejection", reason }));
|
|
5108
5115
|
if (actor.loadPromise) await actor.loadPromise.catch();
|
|
5109
5116
|
if ((_a = actor.startPromise) == null ? void 0 : _a.promise)
|
|
5110
5117
|
await actor.startPromise.promise.catch();
|
|
@@ -5137,7 +5144,7 @@ var FileSystemGlobalState = class {
|
|
|
5137
5144
|
actor.alarmTimeout.abort();
|
|
5138
5145
|
}
|
|
5139
5146
|
if (this.#persist) {
|
|
5140
|
-
const fs =
|
|
5147
|
+
const fs = _chunkTI5PXQGGcjs.getNodeFs.call(void 0, );
|
|
5141
5148
|
await Promise.all([
|
|
5142
5149
|
// Delete actor state file
|
|
5143
5150
|
(async () => {
|
|
@@ -5148,7 +5155,7 @@ var FileSystemGlobalState = class {
|
|
|
5148
5155
|
logger2().error({
|
|
5149
5156
|
msg: "failed to delete actor state file",
|
|
5150
5157
|
actorId,
|
|
5151
|
-
error:
|
|
5158
|
+
error: _chunkHYPIHCDTcjs.stringifyError.call(void 0, err)
|
|
5152
5159
|
});
|
|
5153
5160
|
}
|
|
5154
5161
|
}
|
|
@@ -5162,7 +5169,7 @@ var FileSystemGlobalState = class {
|
|
|
5162
5169
|
logger2().error({
|
|
5163
5170
|
msg: "failed to delete actor database file",
|
|
5164
5171
|
actorId,
|
|
5165
|
-
error:
|
|
5172
|
+
error: _chunkHYPIHCDTcjs.stringifyError.call(void 0, err)
|
|
5166
5173
|
});
|
|
5167
5174
|
}
|
|
5168
5175
|
}
|
|
@@ -5176,7 +5183,7 @@ var FileSystemGlobalState = class {
|
|
|
5176
5183
|
logger2().error({
|
|
5177
5184
|
msg: "failed to delete actor alarm file",
|
|
5178
5185
|
actorId,
|
|
5179
|
-
error:
|
|
5186
|
+
error: _chunkHYPIHCDTcjs.stringifyError.call(void 0, err)
|
|
5180
5187
|
});
|
|
5181
5188
|
}
|
|
5182
5189
|
}
|
|
@@ -5236,7 +5243,7 @@ var FileSystemGlobalState = class {
|
|
|
5236
5243
|
const entry = this.#actors.get(actorId);
|
|
5237
5244
|
_invariant2.default.call(void 0, entry, "actor entry does not exist");
|
|
5238
5245
|
const previousWrite = entry.pendingWriteResolver;
|
|
5239
|
-
const currentWrite =
|
|
5246
|
+
const currentWrite = _chunkHYPIHCDTcjs.promiseWithResolvers.call(void 0, (reason) => logger2().warn({ msg: "unhandled kv write promise rejection", reason }));
|
|
5240
5247
|
entry.pendingWriteResolver = currentWrite;
|
|
5241
5248
|
if (previousWrite) {
|
|
5242
5249
|
try {
|
|
@@ -5276,10 +5283,10 @@ var FileSystemGlobalState = class {
|
|
|
5276
5283
|
}
|
|
5277
5284
|
if (this.#persist) {
|
|
5278
5285
|
const alarmPath = this.getActorAlarmPath(actorId);
|
|
5279
|
-
const crypto2 =
|
|
5286
|
+
const crypto2 = _chunkTI5PXQGGcjs.getNodeCrypto.call(void 0, );
|
|
5280
5287
|
const tempPath = `${alarmPath}.tmp.${crypto2.randomUUID()}`;
|
|
5281
5288
|
try {
|
|
5282
|
-
const path =
|
|
5289
|
+
const path = _chunkTI5PXQGGcjs.getNodePath.call(void 0, );
|
|
5283
5290
|
await ensureDirectoryExists(path.dirname(alarmPath));
|
|
5284
5291
|
const alarmData = {
|
|
5285
5292
|
actorId,
|
|
@@ -5289,7 +5296,7 @@ var FileSystemGlobalState = class {
|
|
|
5289
5296
|
alarmData,
|
|
5290
5297
|
CURRENT_VERSION3
|
|
5291
5298
|
);
|
|
5292
|
-
const fs =
|
|
5299
|
+
const fs = _chunkTI5PXQGGcjs.getNodeFs.call(void 0, );
|
|
5293
5300
|
await fs.writeFile(tempPath, data);
|
|
5294
5301
|
if (!this.isGenerationCurrentAndNotDestroyed(
|
|
5295
5302
|
actorId,
|
|
@@ -5303,7 +5310,7 @@ var FileSystemGlobalState = class {
|
|
|
5303
5310
|
await fs.rename(tempPath, alarmPath);
|
|
5304
5311
|
} catch (error) {
|
|
5305
5312
|
try {
|
|
5306
|
-
const fs =
|
|
5313
|
+
const fs = _chunkTI5PXQGGcjs.getNodeFs.call(void 0, );
|
|
5307
5314
|
await fs.unlink(tempPath);
|
|
5308
5315
|
} catch (e11) {
|
|
5309
5316
|
}
|
|
@@ -5322,10 +5329,10 @@ var FileSystemGlobalState = class {
|
|
|
5322
5329
|
*/
|
|
5323
5330
|
async #performWrite(actorId, generation, state) {
|
|
5324
5331
|
const dataPath = this.getActorStatePath(actorId);
|
|
5325
|
-
const crypto2 =
|
|
5332
|
+
const crypto2 = _chunkTI5PXQGGcjs.getNodeCrypto.call(void 0, );
|
|
5326
5333
|
const tempPath = `${dataPath}.tmp.${crypto2.randomUUID()}`;
|
|
5327
5334
|
try {
|
|
5328
|
-
const path =
|
|
5335
|
+
const path = _chunkTI5PXQGGcjs.getNodePath.call(void 0, );
|
|
5329
5336
|
await ensureDirectoryExists(path.dirname(dataPath));
|
|
5330
5337
|
const bareState = {
|
|
5331
5338
|
actorId: state.actorId,
|
|
@@ -5342,7 +5349,7 @@ var FileSystemGlobalState = class {
|
|
|
5342
5349
|
bareState,
|
|
5343
5350
|
CURRENT_VERSION3
|
|
5344
5351
|
);
|
|
5345
|
-
const fs =
|
|
5352
|
+
const fs = _chunkTI5PXQGGcjs.getNodeFs.call(void 0, );
|
|
5346
5353
|
await fs.writeFile(tempPath, serializedState);
|
|
5347
5354
|
if (!this.isGenerationCurrentAndNotDestroyed(actorId, generation)) {
|
|
5348
5355
|
logger2().debug(
|
|
@@ -5353,7 +5360,7 @@ var FileSystemGlobalState = class {
|
|
|
5353
5360
|
await fs.rename(tempPath, dataPath);
|
|
5354
5361
|
} catch (error) {
|
|
5355
5362
|
try {
|
|
5356
|
-
const fs =
|
|
5363
|
+
const fs = _chunkTI5PXQGGcjs.getNodeFs.call(void 0, );
|
|
5357
5364
|
await fs.unlink(tempPath);
|
|
5358
5365
|
} catch (e12) {
|
|
5359
5366
|
}
|
|
@@ -5417,7 +5424,7 @@ var FileSystemGlobalState = class {
|
|
|
5417
5424
|
return entry.actor;
|
|
5418
5425
|
}
|
|
5419
5426
|
}
|
|
5420
|
-
entry.startPromise =
|
|
5427
|
+
entry.startPromise = _chunkHYPIHCDTcjs.promiseWithResolvers.call(void 0, (reason) => logger2().warn({ msg: "unhandled actor start promise rejection", reason }));
|
|
5421
5428
|
try {
|
|
5422
5429
|
const definition = lookupInRegistry(config4, entry.state.name);
|
|
5423
5430
|
entry.actor = await definition.instantiate();
|
|
@@ -5483,11 +5490,11 @@ var FileSystemGlobalState = class {
|
|
|
5483
5490
|
*/
|
|
5484
5491
|
#loadAlarmsSync() {
|
|
5485
5492
|
try {
|
|
5486
|
-
const fsSync =
|
|
5493
|
+
const fsSync = _chunkTI5PXQGGcjs.getNodeFsSync.call(void 0, );
|
|
5487
5494
|
const files = fsSync.existsSync(this.#alarmsDir) ? fsSync.readdirSync(this.#alarmsDir) : [];
|
|
5488
5495
|
for (const file of files) {
|
|
5489
5496
|
if (file.includes(".tmp.")) continue;
|
|
5490
|
-
const path =
|
|
5497
|
+
const path = _chunkTI5PXQGGcjs.getNodePath.call(void 0, );
|
|
5491
5498
|
const fullPath = path.join(this.#alarmsDir, file);
|
|
5492
5499
|
try {
|
|
5493
5500
|
const buf = fsSync.readFileSync(fullPath);
|
|
@@ -5510,7 +5517,7 @@ var FileSystemGlobalState = class {
|
|
|
5510
5517
|
logger2().error({
|
|
5511
5518
|
msg: "failed to read alarm file",
|
|
5512
5519
|
file,
|
|
5513
|
-
error:
|
|
5520
|
+
error: _chunkHYPIHCDTcjs.stringifyError.call(void 0, err)
|
|
5514
5521
|
});
|
|
5515
5522
|
}
|
|
5516
5523
|
}
|
|
@@ -5540,18 +5547,18 @@ var FileSystemGlobalState = class {
|
|
|
5540
5547
|
(_a = entry.alarmTimeout) == null ? void 0 : _a.abort();
|
|
5541
5548
|
entry.alarmTimestamp = timestamp;
|
|
5542
5549
|
const delay = Math.max(0, timestamp - Date.now());
|
|
5543
|
-
entry.alarmTimeout =
|
|
5550
|
+
entry.alarmTimeout = _chunkHYPIHCDTcjs.setLongTimeout.call(void 0, async () => {
|
|
5544
5551
|
entry.alarmTimestamp = void 0;
|
|
5545
5552
|
if (this.#persist) {
|
|
5546
5553
|
try {
|
|
5547
|
-
const fs =
|
|
5554
|
+
const fs = _chunkTI5PXQGGcjs.getNodeFs.call(void 0, );
|
|
5548
5555
|
await fs.unlink(this.getActorAlarmPath(actorId));
|
|
5549
5556
|
} catch (err) {
|
|
5550
5557
|
if ((err == null ? void 0 : err.code) !== "ENOENT") {
|
|
5551
5558
|
logger2().debug({
|
|
5552
5559
|
msg: "failed to remove alarm file",
|
|
5553
5560
|
actorId,
|
|
5554
|
-
error:
|
|
5561
|
+
error: _chunkHYPIHCDTcjs.stringifyError.call(void 0, err)
|
|
5555
5562
|
});
|
|
5556
5563
|
}
|
|
5557
5564
|
}
|
|
@@ -5577,7 +5584,7 @@ var FileSystemGlobalState = class {
|
|
|
5577
5584
|
logger2().error({
|
|
5578
5585
|
msg: "failed to handle alarm",
|
|
5579
5586
|
actorId,
|
|
5580
|
-
error:
|
|
5587
|
+
error: _chunkHYPIHCDTcjs.stringifyError.call(void 0, err)
|
|
5581
5588
|
});
|
|
5582
5589
|
}
|
|
5583
5590
|
}, delay);
|
|
@@ -5587,13 +5594,13 @@ var FileSystemGlobalState = class {
|
|
|
5587
5594
|
*/
|
|
5588
5595
|
#cleanupTempFilesSync() {
|
|
5589
5596
|
try {
|
|
5590
|
-
const fsSync =
|
|
5597
|
+
const fsSync = _chunkTI5PXQGGcjs.getNodeFsSync.call(void 0, );
|
|
5591
5598
|
const files = fsSync.readdirSync(this.#stateDir);
|
|
5592
5599
|
const tempFiles = files.filter((f) => f.includes(".tmp."));
|
|
5593
5600
|
const oneHourAgo = Date.now() - 36e5;
|
|
5594
5601
|
for (const tempFile of tempFiles) {
|
|
5595
5602
|
try {
|
|
5596
|
-
const path =
|
|
5603
|
+
const path = _chunkTI5PXQGGcjs.getNodePath.call(void 0, );
|
|
5597
5604
|
const fullPath = path.join(this.#stateDir, tempFile);
|
|
5598
5605
|
const stat = fsSync.statSync(fullPath);
|
|
5599
5606
|
if (stat.mtimeMs < oneHourAgo) {
|
|
@@ -5740,7 +5747,7 @@ var FileSystemManagerDriver = class {
|
|
|
5740
5747
|
this.#config = config4;
|
|
5741
5748
|
this.#state = state;
|
|
5742
5749
|
this.#driverConfig = driverConfig;
|
|
5743
|
-
const inlineClient =
|
|
5750
|
+
const inlineClient = _chunkIIJNPVPQcjs.createClientWithDriver.call(void 0, this);
|
|
5744
5751
|
this.#actorDriver = this.#driverConfig.actor(
|
|
5745
5752
|
config4,
|
|
5746
5753
|
this,
|
|
@@ -5766,7 +5773,7 @@ var FileSystemManagerDriver = class {
|
|
|
5766
5773
|
});
|
|
5767
5774
|
const pathOnly = normalizedPath.split("?")[0];
|
|
5768
5775
|
const { gatewayId, requestId } = createHibernatableRequestMetadata();
|
|
5769
|
-
const wsHandler = await
|
|
5776
|
+
const wsHandler = await _chunkTI5PXQGGcjs.routeWebSocket.call(void 0,
|
|
5770
5777
|
fakeRequest,
|
|
5771
5778
|
pathOnly,
|
|
5772
5779
|
{},
|
|
@@ -5794,7 +5801,7 @@ var FileSystemManagerDriver = class {
|
|
|
5794
5801
|
const pathOnly = path.split("?")[0];
|
|
5795
5802
|
const normalizedPath = pathOnly.startsWith("/") ? pathOnly : `/${pathOnly}`;
|
|
5796
5803
|
const { gatewayId, requestId } = createHibernatableRequestMetadata();
|
|
5797
|
-
const wsHandler = await
|
|
5804
|
+
const wsHandler = await _chunkTI5PXQGGcjs.routeWebSocket.call(void 0,
|
|
5798
5805
|
// TODO: Create new request with new path
|
|
5799
5806
|
c.req.raw,
|
|
5800
5807
|
normalizedPath,
|
|
@@ -5809,7 +5816,7 @@ var FileSystemManagerDriver = class {
|
|
|
5809
5816
|
true,
|
|
5810
5817
|
false
|
|
5811
5818
|
);
|
|
5812
|
-
return upgradeWebSocket(() => wsHandler)(c,
|
|
5819
|
+
return upgradeWebSocket(() => wsHandler)(c, _chunkHYPIHCDTcjs.noopNext.call(void 0, ));
|
|
5813
5820
|
}
|
|
5814
5821
|
async buildGatewayUrl(actorId) {
|
|
5815
5822
|
const port = _nullishCoalesce(this.#config.managerPort, () => ( 6420));
|
|
@@ -5925,7 +5932,7 @@ var CreateFileSystemDriverOptionsSchema = _zod.z.object({
|
|
|
5925
5932
|
useNativeSqlite: _zod.z.boolean().optional()
|
|
5926
5933
|
});
|
|
5927
5934
|
function createFileSystemOrMemoryDriver(persist = true, options) {
|
|
5928
|
-
|
|
5935
|
+
_chunkTI5PXQGGcjs.importNodeDependencies.call(void 0, );
|
|
5929
5936
|
if ((options == null ? void 0 : options.useNativeSqlite) === false) {
|
|
5930
5937
|
throw new Error(
|
|
5931
5938
|
"File-system driver no longer supports non-SQLite KV storage. Remove useNativeSqlite: false."
|
|
@@ -5974,4 +5981,4 @@ function createMemoryDriver() {
|
|
|
5974
5981
|
|
|
5975
5982
|
|
|
5976
5983
|
exports.ActorDefinition = ActorDefinition; exports.lookupInRegistry = lookupInRegistry; exports.createActorRouter = createActorRouter; exports.InlineWebSocketAdapter = InlineWebSocketAdapter; exports.getStoragePath = getStoragePath; exports.ensureDirectoryExists = ensureDirectoryExists; exports.createFileSystemOrMemoryDriver = createFileSystemOrMemoryDriver; exports.createFileSystemDriver = createFileSystemDriver; exports.createMemoryDriver = createMemoryDriver;
|
|
5977
|
-
//# sourceMappingURL=chunk-
|
|
5984
|
+
//# sourceMappingURL=chunk-U5SMSA27.cjs.map
|