rivetkit 2.0.30 → 2.0.31
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/tsup/{chunk-OI6FEIRD.js → chunk-276OQY5C.js} +13 -2
- package/dist/tsup/{chunk-OI6FEIRD.js.map → chunk-276OQY5C.js.map} +1 -1
- package/dist/tsup/{chunk-F4CRQFYG.cjs → chunk-3KQGFKFW.cjs} +27 -29
- package/dist/tsup/chunk-3KQGFKFW.cjs.map +1 -0
- package/dist/tsup/{chunk-3WG6PXWE.cjs → chunk-3WHB4MCA.cjs} +3 -3
- package/dist/tsup/{chunk-3WG6PXWE.cjs.map → chunk-3WHB4MCA.cjs.map} +1 -1
- package/dist/tsup/{chunk-VROCBPWT.cjs → chunk-4RIFZGLW.cjs} +10 -10
- package/dist/tsup/{chunk-VROCBPWT.cjs.map → chunk-4RIFZGLW.cjs.map} +1 -1
- package/dist/tsup/{chunk-DI7LJEYL.cjs → chunk-7HLVDMIL.cjs} +6 -6
- package/dist/tsup/{chunk-DI7LJEYL.cjs.map → chunk-7HLVDMIL.cjs.map} +1 -1
- package/dist/tsup/{chunk-NYQJHQHK.cjs → chunk-ERWP3EZZ.cjs} +247 -179
- package/dist/tsup/chunk-ERWP3EZZ.cjs.map +1 -0
- package/dist/tsup/{chunk-Z33UBLLH.js → chunk-FA7X2CV7.js} +7 -7
- package/dist/tsup/{chunk-Z33UBLLH.js.map → chunk-FA7X2CV7.js.map} +1 -1
- package/dist/tsup/{chunk-SLAUR4QB.js → chunk-FOF7U7VC.js} +2 -2
- package/dist/tsup/{chunk-K2UD42XA.js → chunk-GOS2BQ7R.js} +2 -2
- package/dist/tsup/{chunk-FVSTM7QK.cjs → chunk-IUAVLHIR.cjs} +3 -3
- package/dist/tsup/{chunk-FVSTM7QK.cjs.map → chunk-IUAVLHIR.cjs.map} +1 -1
- package/dist/tsup/{chunk-23EJLAOV.cjs → chunk-JAYBUDHK.cjs} +6 -6
- package/dist/tsup/{chunk-23EJLAOV.cjs.map → chunk-JAYBUDHK.cjs.map} +1 -1
- package/dist/tsup/{chunk-YBOQOQZB.js → chunk-JCZW5OB3.js} +158 -105
- package/dist/tsup/chunk-JCZW5OB3.js.map +1 -0
- package/dist/tsup/{chunk-GOC4GSPT.js → chunk-JHYGSL2L.js} +85 -17
- package/dist/tsup/chunk-JHYGSL2L.js.map +1 -0
- package/dist/tsup/{chunk-DQH5K5TL.js → chunk-NWFGFXKD.js} +3 -3
- package/dist/tsup/{chunk-DQH5K5TL.js.map → chunk-NWFGFXKD.js.map} +1 -1
- package/dist/tsup/{chunk-ZUJRXXQC.cjs → chunk-PDX7CZSQ.cjs} +341 -288
- package/dist/tsup/chunk-PDX7CZSQ.cjs.map +1 -0
- package/dist/tsup/{chunk-46DWBVYE.cjs → chunk-Q3Z6D52H.cjs} +15 -15
- package/dist/tsup/{chunk-46DWBVYE.cjs.map → chunk-Q3Z6D52H.cjs.map} +1 -1
- package/dist/tsup/{chunk-DGSYEC34.js → chunk-QMYZYUFA.js} +13 -15
- package/dist/tsup/chunk-QMYZYUFA.js.map +1 -0
- package/dist/tsup/{chunk-HPIRVETT.js → chunk-TQ5TQ3EA.js} +2 -2
- package/dist/tsup/{chunk-HPIRVETT.js.map → chunk-TQ5TQ3EA.js.map} +1 -1
- package/dist/tsup/{chunk-REMOXAIW.cjs → chunk-TVEQLM3Z.cjs} +14 -3
- package/dist/tsup/chunk-TVEQLM3Z.cjs.map +1 -0
- package/dist/tsup/{chunk-EOXUA7SX.js → chunk-ZPEEPCYI.js} +2 -2
- package/dist/tsup/client/mod.cjs +10 -8
- package/dist/tsup/client/mod.cjs.map +1 -1
- package/dist/tsup/client/mod.d.cts +2 -2
- package/dist/tsup/client/mod.d.ts +2 -2
- package/dist/tsup/client/mod.js +9 -7
- 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-Cs3B9xN9.d.ts → config-DcR9pByT.d.ts} +35 -1
- package/dist/tsup/{config-Dj5nTCrh.d.cts → config-n3v1z7TT.d.cts} +35 -1
- package/dist/tsup/driver-helpers/mod.cjs +4 -4
- package/dist/tsup/driver-helpers/mod.d.cts +1 -1
- package/dist/tsup/driver-helpers/mod.d.ts +1 -1
- package/dist/tsup/driver-helpers/mod.js +3 -3
- package/dist/tsup/driver-test-suite/mod.cjs +71 -71
- package/dist/tsup/driver-test-suite/mod.d.cts +1 -1
- package/dist/tsup/driver-test-suite/mod.d.ts +1 -1
- package/dist/tsup/driver-test-suite/mod.js +10 -10
- package/dist/tsup/inspector/mod.cjs +5 -5
- package/dist/tsup/inspector/mod.d.cts +2 -2
- package/dist/tsup/inspector/mod.d.ts +2 -2
- package/dist/tsup/inspector/mod.js +4 -4
- package/dist/tsup/mod.cjs +9 -9
- package/dist/tsup/mod.d.cts +2 -2
- package/dist/tsup/mod.d.ts +2 -2
- package/dist/tsup/mod.js +8 -8
- package/dist/tsup/test/mod.cjs +11 -11
- package/dist/tsup/test/mod.d.cts +1 -1
- package/dist/tsup/test/mod.d.ts +1 -1
- package/dist/tsup/test/mod.js +10 -10
- package/dist/tsup/utils.cjs +4 -2
- package/dist/tsup/utils.cjs.map +1 -1
- package/dist/tsup/utils.d.cts +3 -1
- package/dist/tsup/utils.d.ts +3 -1
- package/dist/tsup/utils.js +3 -1
- package/package.json +2 -2
- package/src/actor/config.ts +3 -2
- package/src/actor/instance/state-manager.ts +1 -1
- package/src/actor/protocol/serde.ts +1 -1
- package/src/client/actor-conn.ts +196 -133
- package/src/client/config.ts +4 -1
- package/src/client/mod.ts +3 -1
- package/src/client/utils.ts +1 -1
- package/src/drivers/file-system/global-state.ts +4 -5
- package/src/drivers/file-system/manager.ts +12 -4
- package/src/engine-process/mod.ts +16 -10
- package/src/registry/serve.ts +96 -7
- package/src/schemas/actor-persist/versioned.ts +3 -4
- package/src/serde.ts +1 -1
- package/src/test/mod.ts +1 -1
- package/src/utils.ts +14 -0
- package/dist/tsup/chunk-DGSYEC34.js.map +0 -1
- package/dist/tsup/chunk-F4CRQFYG.cjs.map +0 -1
- package/dist/tsup/chunk-GOC4GSPT.js.map +0 -1
- package/dist/tsup/chunk-NYQJHQHK.cjs.map +0 -1
- package/dist/tsup/chunk-REMOXAIW.cjs.map +0 -1
- package/dist/tsup/chunk-YBOQOQZB.js.map +0 -1
- package/dist/tsup/chunk-ZUJRXXQC.cjs.map +0 -1
- /package/dist/tsup/{chunk-SLAUR4QB.js.map → chunk-FOF7U7VC.js.map} +0 -0
- /package/dist/tsup/{chunk-K2UD42XA.js.map → chunk-GOS2BQ7R.js.map} +0 -0
- /package/dist/tsup/{chunk-EOXUA7SX.js.map → chunk-ZPEEPCYI.js.map} +0 -0
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunk3WHB4MCAcjs = require('./chunk-3WHB4MCA.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
@@ -29,16 +29,16 @@ var _chunk3WG6PXWEcjs = require('./chunk-3WG6PXWE.cjs');
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
var
|
|
32
|
+
var _chunkPDX7CZSQcjs = require('./chunk-PDX7CZSQ.cjs');
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
var
|
|
35
|
+
var _chunk4RIFZGLWcjs = require('./chunk-4RIFZGLW.cjs');
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
var
|
|
41
|
+
var _chunk3KQGFKFWcjs = require('./chunk-3KQGFKFW.cjs');
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
|
|
@@ -60,7 +60,7 @@ var _chunkF4CRQFYGcjs = require('./chunk-F4CRQFYG.cjs');
|
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
|
|
63
|
-
var
|
|
63
|
+
var _chunkJAYBUDHKcjs = require('./chunk-JAYBUDHK.cjs');
|
|
64
64
|
|
|
65
65
|
|
|
66
66
|
|
|
@@ -76,7 +76,8 @@ var _chunk23EJLAOVcjs = require('./chunk-23EJLAOV.cjs');
|
|
|
76
76
|
|
|
77
77
|
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
|
|
80
|
+
var _chunkTVEQLM3Zcjs = require('./chunk-TVEQLM3Z.cjs');
|
|
80
81
|
|
|
81
82
|
|
|
82
83
|
|
|
@@ -184,11 +185,11 @@ async function handleAction(c, _runConfig, actorDriver, actionName, actorId) {
|
|
|
184
185
|
const encoding = getRequestEncoding(c.req);
|
|
185
186
|
const parameters = getRequestConnParams(c.req);
|
|
186
187
|
const arrayBuffer = await c.req.arrayBuffer();
|
|
187
|
-
const request =
|
|
188
|
+
const request = _chunkJAYBUDHKcjs.deserializeWithEncoding.call(void 0,
|
|
188
189
|
encoding,
|
|
189
190
|
new Uint8Array(arrayBuffer),
|
|
190
|
-
|
|
191
|
-
|
|
191
|
+
_chunkPDX7CZSQcjs.HTTP_ACTION_REQUEST_VERSIONED,
|
|
192
|
+
_chunkPDX7CZSQcjs.HttpActionRequestSchema,
|
|
192
193
|
// JSON: args is already the decoded value (raw object/array)
|
|
193
194
|
(json) => json.args,
|
|
194
195
|
// BARE/CBOR: args is ArrayBuffer that needs CBOR-decoding
|
|
@@ -202,34 +203,34 @@ async function handleAction(c, _runConfig, actorDriver, actionName, actorId) {
|
|
|
202
203
|
actor2 = await actorDriver.loadActor(actorId);
|
|
203
204
|
actor2.rLog.debug({ msg: "handling action", actionName, encoding });
|
|
204
205
|
conn = await actor2.connectionManager.prepareAndConnectConn(
|
|
205
|
-
|
|
206
|
+
_chunkPDX7CZSQcjs.createHttpDriver.call(void 0, ),
|
|
206
207
|
parameters,
|
|
207
208
|
c.req.raw,
|
|
208
209
|
c.req.path,
|
|
209
210
|
c.req.header()
|
|
210
211
|
);
|
|
211
|
-
const ctx = new (0,
|
|
212
|
+
const ctx = new (0, _chunkPDX7CZSQcjs.ActionContext)(actor2, conn);
|
|
212
213
|
output = await actor2.executeAction(ctx, actionName, actionArgs);
|
|
213
214
|
} finally {
|
|
214
215
|
if (conn) {
|
|
215
216
|
conn.disconnect();
|
|
216
217
|
}
|
|
217
218
|
}
|
|
218
|
-
const serialized =
|
|
219
|
+
const serialized = _chunkJAYBUDHKcjs.serializeWithEncoding.call(void 0,
|
|
219
220
|
encoding,
|
|
220
221
|
output,
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
222
|
+
_chunkPDX7CZSQcjs.HTTP_ACTION_RESPONSE_VERSIONED,
|
|
223
|
+
_chunkPDX7CZSQcjs.CURRENT_VERSION,
|
|
224
|
+
_chunkPDX7CZSQcjs.HttpActionResponseSchema,
|
|
224
225
|
// JSON: output is the raw value (will be serialized by jsonStringifyCompat)
|
|
225
226
|
(value) => ({ output: value }),
|
|
226
227
|
// BARE/CBOR: output needs to be CBOR-encoded to ArrayBuffer
|
|
227
228
|
(value) => ({
|
|
228
|
-
output:
|
|
229
|
+
output: _chunkTVEQLM3Zcjs.bufferToArrayBuffer.call(void 0, cbor.encode(value))
|
|
229
230
|
})
|
|
230
231
|
);
|
|
231
232
|
return c.body(serialized, 200, {
|
|
232
|
-
"Content-Type":
|
|
233
|
+
"Content-Type": _chunkJAYBUDHKcjs.contentTypeForEncoding.call(void 0, encoding)
|
|
233
234
|
});
|
|
234
235
|
}
|
|
235
236
|
async function handleRawRequest(c, req, actorDriver, actorId) {
|
|
@@ -253,11 +254,11 @@ async function handleRawRequest(c, req, actorDriver, actorId) {
|
|
|
253
254
|
}
|
|
254
255
|
}
|
|
255
256
|
function getRequestEncoding(req) {
|
|
256
|
-
const encodingParam = req.header(
|
|
257
|
+
const encodingParam = req.header(_chunkJAYBUDHKcjs.HEADER_ENCODING);
|
|
257
258
|
if (!encodingParam) {
|
|
258
259
|
return "json";
|
|
259
260
|
}
|
|
260
|
-
const result =
|
|
261
|
+
const result = _chunkJAYBUDHKcjs.EncodingSchema.safeParse(encodingParam);
|
|
261
262
|
if (!result.success) {
|
|
262
263
|
throw new (0, _chunkMAQSR26Xcjs.InvalidEncoding)(encodingParam);
|
|
263
264
|
}
|
|
@@ -267,7 +268,7 @@ function getRequestExposeInternalError(_req) {
|
|
|
267
268
|
return false;
|
|
268
269
|
}
|
|
269
270
|
function getRequestConnParams(req) {
|
|
270
|
-
const paramsParam = req.header(
|
|
271
|
+
const paramsParam = req.header(_chunkJAYBUDHKcjs.HEADER_CONN_PARAMS);
|
|
271
272
|
if (!paramsParam) {
|
|
272
273
|
return null;
|
|
273
274
|
}
|
|
@@ -275,7 +276,7 @@ function getRequestConnParams(req) {
|
|
|
275
276
|
return JSON.parse(paramsParam);
|
|
276
277
|
} catch (err) {
|
|
277
278
|
throw new (0, _chunkMAQSR26Xcjs.InvalidParams)(
|
|
278
|
-
`Invalid params JSON: ${
|
|
279
|
+
`Invalid params JSON: ${_chunkTVEQLM3Zcjs.stringifyError.call(void 0, err)}`
|
|
279
280
|
);
|
|
280
281
|
}
|
|
281
282
|
}
|
|
@@ -309,7 +310,7 @@ function buildActorNames(registryConfig) {
|
|
|
309
310
|
|
|
310
311
|
// src/common/router.ts
|
|
311
312
|
function logger() {
|
|
312
|
-
return
|
|
313
|
+
return _chunkTVEQLM3Zcjs.getLogger.call(void 0, "router");
|
|
313
314
|
}
|
|
314
315
|
function loggerMiddleware(logger8) {
|
|
315
316
|
return async (c, next) => {
|
|
@@ -327,7 +328,7 @@ function loggerMiddleware(logger8) {
|
|
|
327
328
|
reqSize: c.req.header("content-length"),
|
|
328
329
|
resSize: c.res.headers.get("content-length"),
|
|
329
330
|
userAgent: c.req.header("user-agent"),
|
|
330
|
-
...
|
|
331
|
+
..._chunkTVEQLM3Zcjs.getEnvUniversal.call(void 0, "_RIVET_LOG_HEADERS") ? { allHeaders: JSON.stringify(c.req.header()) } : {}
|
|
331
332
|
});
|
|
332
333
|
};
|
|
333
334
|
}
|
|
@@ -336,7 +337,7 @@ function handleRouteNotFound(c) {
|
|
|
336
337
|
}
|
|
337
338
|
function handleRouteError(error, c) {
|
|
338
339
|
const exposeInternalError = getRequestExposeInternalError(c.req.raw);
|
|
339
|
-
const { statusCode, group, code, message, metadata } =
|
|
340
|
+
const { statusCode, group, code, message, metadata } = _chunkTVEQLM3Zcjs.deconstructError.call(void 0,
|
|
340
341
|
error,
|
|
341
342
|
logger(),
|
|
342
343
|
{
|
|
@@ -352,12 +353,12 @@ function handleRouteError(error, c) {
|
|
|
352
353
|
encoding = "json";
|
|
353
354
|
}
|
|
354
355
|
const errorData = { group, code, message, metadata };
|
|
355
|
-
const output =
|
|
356
|
+
const output = _chunkJAYBUDHKcjs.serializeWithEncoding.call(void 0,
|
|
356
357
|
encoding,
|
|
357
358
|
errorData,
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
359
|
+
_chunkPDX7CZSQcjs.HTTP_RESPONSE_ERROR_VERSIONED,
|
|
360
|
+
_chunkPDX7CZSQcjs.CURRENT_VERSION,
|
|
361
|
+
_chunkPDX7CZSQcjs.HttpResponseErrorSchema,
|
|
361
362
|
// JSON: metadata is the raw value (will be serialized by jsonStringifyCompat)
|
|
362
363
|
(value) => ({
|
|
363
364
|
group: value.group,
|
|
@@ -370,7 +371,7 @@ function handleRouteError(error, c) {
|
|
|
370
371
|
group: value.group,
|
|
371
372
|
code: value.code,
|
|
372
373
|
message: value.message,
|
|
373
|
-
metadata: value.metadata ?
|
|
374
|
+
metadata: value.metadata ? _chunkTVEQLM3Zcjs.bufferToArrayBuffer.call(void 0, cbor2.encode(value.metadata)) : null
|
|
374
375
|
})
|
|
375
376
|
);
|
|
376
377
|
return c.body(output, { status: statusCode });
|
|
@@ -378,7 +379,7 @@ function handleRouteError(error, c) {
|
|
|
378
379
|
function handleMetadataRequest(c, registryConfig, runConfig) {
|
|
379
380
|
const response = {
|
|
380
381
|
runtime: "rivetkit",
|
|
381
|
-
version:
|
|
382
|
+
version: _chunkTVEQLM3Zcjs.VERSION,
|
|
382
383
|
runner: {
|
|
383
384
|
kind: runConfig.runnerKind === "serverless" ? { serverless: {} } : { normal: {} }
|
|
384
385
|
},
|
|
@@ -394,7 +395,7 @@ function handleHealthRequest(c) {
|
|
|
394
395
|
return c.json({
|
|
395
396
|
status: "ok",
|
|
396
397
|
runtime: "rivetkit",
|
|
397
|
-
version:
|
|
398
|
+
version: _chunkTVEQLM3Zcjs.VERSION
|
|
398
399
|
});
|
|
399
400
|
}
|
|
400
401
|
|
|
@@ -411,7 +412,7 @@ function createRawWebSocketDriver(hibernatable, closePromise) {
|
|
|
411
412
|
// handle messages from the RivetKit protocol
|
|
412
413
|
disconnect: async (_actor, _conn, reason) => {
|
|
413
414
|
if (!websocket) {
|
|
414
|
-
|
|
415
|
+
_chunkJAYBUDHKcjs.loggerWithoutContext.call(void 0, ).warn(
|
|
415
416
|
"disconnecting raw ws without websocket"
|
|
416
417
|
);
|
|
417
418
|
return;
|
|
@@ -437,7 +438,7 @@ function createRawWebSocketDriver(hibernatable, closePromise) {
|
|
|
437
438
|
|
|
438
439
|
// src/actor/conn/drivers/websocket.ts
|
|
439
440
|
function createWebSocketDriver(hibernatable, encoding, closePromise) {
|
|
440
|
-
|
|
441
|
+
_chunkJAYBUDHKcjs.loggerWithoutContext.call(void 0, ).debug({
|
|
441
442
|
msg: "createWebSocketDriver creating driver",
|
|
442
443
|
hibernatable
|
|
443
444
|
});
|
|
@@ -502,7 +503,7 @@ function createWebSocketDriver(hibernatable, encoding, closePromise) {
|
|
|
502
503
|
},
|
|
503
504
|
disconnect: async (_actor, _conn, reason) => {
|
|
504
505
|
if (!websocket) {
|
|
505
|
-
|
|
506
|
+
_chunkJAYBUDHKcjs.loggerWithoutContext.call(void 0, ).warn(
|
|
506
507
|
"disconnecting ws without websocket"
|
|
507
508
|
);
|
|
508
509
|
return;
|
|
@@ -537,10 +538,10 @@ async function routeWebSocket(request, requestPath, requestHeaders, runConfig, a
|
|
|
537
538
|
requestPath,
|
|
538
539
|
isHibernatable
|
|
539
540
|
});
|
|
540
|
-
const closePromiseResolvers =
|
|
541
|
+
const closePromiseResolvers = _chunkTVEQLM3Zcjs.promiseWithResolvers.call(void 0, );
|
|
541
542
|
let handler;
|
|
542
543
|
let connDriver;
|
|
543
|
-
if (requestPath ===
|
|
544
|
+
if (requestPath === _chunkJAYBUDHKcjs.PATH_CONNECT) {
|
|
544
545
|
const { driver, setWebSocket } = createWebSocketDriver(
|
|
545
546
|
isHibernatable ? { gatewayId, requestId } : void 0,
|
|
546
547
|
encoding,
|
|
@@ -548,14 +549,14 @@ async function routeWebSocket(request, requestPath, requestHeaders, runConfig, a
|
|
|
548
549
|
);
|
|
549
550
|
handler = handleWebSocketConnect.bind(void 0, setWebSocket);
|
|
550
551
|
connDriver = driver;
|
|
551
|
-
} else if (requestPath ===
|
|
552
|
+
} else if (requestPath === _chunkJAYBUDHKcjs.PATH_WEBSOCKET_BASE || requestPath.startsWith(_chunkJAYBUDHKcjs.PATH_WEBSOCKET_PREFIX)) {
|
|
552
553
|
const { driver, setWebSocket } = createRawWebSocketDriver(
|
|
553
554
|
isHibernatable ? { gatewayId, requestId } : void 0,
|
|
554
555
|
closePromiseResolvers.promise
|
|
555
556
|
);
|
|
556
557
|
handler = handleRawWebSocket.bind(void 0, setWebSocket);
|
|
557
558
|
connDriver = driver;
|
|
558
|
-
} else if (requestPath ===
|
|
559
|
+
} else if (requestPath === _chunkJAYBUDHKcjs.PATH_INSPECTOR_CONNECT) {
|
|
559
560
|
return await handleWebSocketInspectorConnect();
|
|
560
561
|
} else {
|
|
561
562
|
throw `WebSocket Path Not Found: ${requestPath}`;
|
|
@@ -580,9 +581,9 @@ async function routeWebSocket(request, requestPath, requestHeaders, runConfig, a
|
|
|
580
581
|
exposeInternalError
|
|
581
582
|
});
|
|
582
583
|
} catch (error) {
|
|
583
|
-
const { group, code } =
|
|
584
|
+
const { group, code } = _chunkTVEQLM3Zcjs.deconstructError.call(void 0,
|
|
584
585
|
error,
|
|
585
|
-
|
|
586
|
+
_chunkJAYBUDHKcjs.loggerWithoutContext.call(void 0, ),
|
|
586
587
|
{},
|
|
587
588
|
exposeInternalError
|
|
588
589
|
);
|
|
@@ -627,12 +628,12 @@ async function handleWebSocketConnect(setWebSocket, {
|
|
|
627
628
|
onMessage: (evt, ws) => {
|
|
628
629
|
actor2.rLog.debug({ msg: "received message" });
|
|
629
630
|
const value = evt.data.valueOf();
|
|
630
|
-
|
|
631
|
+
_chunkPDX7CZSQcjs.parseMessage.call(void 0, value, {
|
|
631
632
|
encoding,
|
|
632
633
|
maxIncomingMessageSize: runConfig.maxIncomingMessageSize
|
|
633
634
|
}).then((message) => {
|
|
634
635
|
actor2.processMessage(message, conn).catch((error) => {
|
|
635
|
-
const { code } =
|
|
636
|
+
const { code } = _chunkTVEQLM3Zcjs.deconstructError.call(void 0,
|
|
636
637
|
error,
|
|
637
638
|
actor2.rLog,
|
|
638
639
|
{
|
|
@@ -643,7 +644,7 @@ async function handleWebSocketConnect(setWebSocket, {
|
|
|
643
644
|
ws.close(1011, code);
|
|
644
645
|
});
|
|
645
646
|
}).catch((error) => {
|
|
646
|
-
const { code } =
|
|
647
|
+
const { code } = _chunkTVEQLM3Zcjs.deconstructError.call(void 0,
|
|
647
648
|
error,
|
|
648
649
|
actor2.rLog,
|
|
649
650
|
{
|
|
@@ -678,7 +679,7 @@ async function handleWebSocketConnect(setWebSocket, {
|
|
|
678
679
|
try {
|
|
679
680
|
actor2.rLog.warn({ msg: "websocket error" });
|
|
680
681
|
} catch (error) {
|
|
681
|
-
|
|
682
|
+
_chunkTVEQLM3Zcjs.deconstructError.call(void 0,
|
|
682
683
|
error,
|
|
683
684
|
actor2.rLog,
|
|
684
685
|
{ wsEvent: "error" },
|
|
@@ -742,16 +743,16 @@ function parseWebSocketProtocols(protocols) {
|
|
|
742
743
|
if (protocols) {
|
|
743
744
|
const protocolList = protocols.split(",").map((p) => p.trim());
|
|
744
745
|
for (const protocol of protocolList) {
|
|
745
|
-
if (protocol.startsWith(
|
|
746
|
-
encodingRaw = protocol.substring(
|
|
747
|
-
} else if (protocol.startsWith(
|
|
746
|
+
if (protocol.startsWith(_chunkJAYBUDHKcjs.WS_PROTOCOL_ENCODING)) {
|
|
747
|
+
encodingRaw = protocol.substring(_chunkJAYBUDHKcjs.WS_PROTOCOL_ENCODING.length);
|
|
748
|
+
} else if (protocol.startsWith(_chunkJAYBUDHKcjs.WS_PROTOCOL_CONN_PARAMS)) {
|
|
748
749
|
connParamsRaw = decodeURIComponent(
|
|
749
|
-
protocol.substring(
|
|
750
|
+
protocol.substring(_chunkJAYBUDHKcjs.WS_PROTOCOL_CONN_PARAMS.length)
|
|
750
751
|
);
|
|
751
752
|
}
|
|
752
753
|
}
|
|
753
754
|
}
|
|
754
|
-
const encoding =
|
|
755
|
+
const encoding = _chunkJAYBUDHKcjs.EncodingSchema.parse(encodingRaw);
|
|
755
756
|
const connParams = connParamsRaw ? JSON.parse(connParamsRaw) : void 0;
|
|
756
757
|
return { encoding, connParams };
|
|
757
758
|
}
|
|
@@ -767,7 +768,7 @@ function createActorRouter(runConfig, actorDriver, isTest) {
|
|
|
767
768
|
const router = new (0, _hono.Hono)({
|
|
768
769
|
strict: false
|
|
769
770
|
});
|
|
770
|
-
router.use("*", loggerMiddleware(
|
|
771
|
+
router.use("*", loggerMiddleware(_chunkJAYBUDHKcjs.loggerWithoutContext.call(void 0, )));
|
|
771
772
|
router.use("*", async (c, next) => {
|
|
772
773
|
const actor2 = await actorDriver.loadActor(c.env.actorId);
|
|
773
774
|
actor2.beginHonoHttpRequest();
|
|
@@ -797,15 +798,15 @@ function createActorRouter(runConfig, actorDriver, isTest) {
|
|
|
797
798
|
if (!conn) {
|
|
798
799
|
return c.text(`Connection not found: ${connId}`, 404);
|
|
799
800
|
}
|
|
800
|
-
if ((_a = conn[
|
|
801
|
-
conn[
|
|
801
|
+
if ((_a = conn[_chunkPDX7CZSQcjs.CONN_DRIVER_SYMBOL]) == null ? void 0 : _a.terminate) {
|
|
802
|
+
conn[_chunkPDX7CZSQcjs.CONN_DRIVER_SYMBOL].terminate(actor2, conn);
|
|
802
803
|
}
|
|
803
804
|
return c.json({ success: true });
|
|
804
805
|
});
|
|
805
806
|
}
|
|
806
807
|
router.on(
|
|
807
808
|
"GET",
|
|
808
|
-
[
|
|
809
|
+
[_chunkJAYBUDHKcjs.PATH_CONNECT, `${_chunkJAYBUDHKcjs.PATH_WEBSOCKET_PREFIX}*`, _chunkJAYBUDHKcjs.PATH_INSPECTOR_CONNECT],
|
|
809
810
|
async (c) => {
|
|
810
811
|
var _a;
|
|
811
812
|
const upgradeWebSocket = (_a = runConfig.getUpgradeWebSocket) == null ? void 0 : _a.call(runConfig);
|
|
@@ -827,7 +828,7 @@ function createActorRouter(runConfig, actorDriver, isTest) {
|
|
|
827
828
|
false,
|
|
828
829
|
false
|
|
829
830
|
);
|
|
830
|
-
})(c,
|
|
831
|
+
})(c, _chunkTVEQLM3Zcjs.noopNext.call(void 0, ));
|
|
831
832
|
} else {
|
|
832
833
|
return c.text(
|
|
833
834
|
"WebSockets are not enabled for this driver.",
|
|
@@ -856,7 +857,7 @@ function createActorRouter(runConfig, actorDriver, isTest) {
|
|
|
856
857
|
body: c.req.raw.body,
|
|
857
858
|
duplex: "half"
|
|
858
859
|
});
|
|
859
|
-
|
|
860
|
+
_chunkJAYBUDHKcjs.loggerWithoutContext.call(void 0, ).debug({
|
|
860
861
|
msg: "rewriting http url",
|
|
861
862
|
from: c.req.url,
|
|
862
863
|
to: correctedRequest.url
|
|
@@ -868,10 +869,10 @@ function createActorRouter(runConfig, actorDriver, isTest) {
|
|
|
868
869
|
c.env.actorId
|
|
869
870
|
);
|
|
870
871
|
});
|
|
871
|
-
if (
|
|
872
|
+
if (_chunk3WHB4MCAcjs.isInspectorEnabled.call(void 0, runConfig, "actor")) {
|
|
872
873
|
router.route(
|
|
873
874
|
"/inspect",
|
|
874
|
-
new (0, _hono.Hono)().use(
|
|
875
|
+
new (0, _hono.Hono)().use(_chunk3WHB4MCAcjs.secureInspector.call(void 0, runConfig), async (c, next) => {
|
|
875
876
|
const inspector = (await actorDriver.loadActor(c.env.actorId)).inspector;
|
|
876
877
|
_invariant2.default.call(void 0,
|
|
877
878
|
inspector,
|
|
@@ -879,7 +880,7 @@ function createActorRouter(runConfig, actorDriver, isTest) {
|
|
|
879
880
|
);
|
|
880
881
|
c.set("inspector", inspector);
|
|
881
882
|
return next();
|
|
882
|
-
}).route("/",
|
|
883
|
+
}).route("/", _chunkPDX7CZSQcjs.createActorInspectorRouter.call(void 0, ))
|
|
883
884
|
);
|
|
884
885
|
}
|
|
885
886
|
router.notFound(handleRouteNotFound);
|
|
@@ -890,13 +891,13 @@ function createActorRouter(runConfig, actorDriver, isTest) {
|
|
|
890
891
|
// src/actor/mod.ts
|
|
891
892
|
function actor(input) {
|
|
892
893
|
const config4 = ActorConfigSchema.parse(input);
|
|
893
|
-
return new (0,
|
|
894
|
+
return new (0, _chunkPDX7CZSQcjs.ActorDefinition)(config4);
|
|
894
895
|
}
|
|
895
896
|
|
|
896
897
|
// src/common/inline-websocket-adapter.ts
|
|
897
898
|
var _ws2 = require('hono/ws');
|
|
898
899
|
function logger2() {
|
|
899
|
-
return
|
|
900
|
+
return _chunkTVEQLM3Zcjs.getLogger.call(void 0, "fake-event-source2");
|
|
900
901
|
}
|
|
901
902
|
var InlineWebSocketAdapter = (_class = class {
|
|
902
903
|
// WebSocket readyState values
|
|
@@ -1237,7 +1238,7 @@ var _streaming = require('hono/streaming');
|
|
|
1237
1238
|
|
|
1238
1239
|
// src/drivers/engine/log.ts
|
|
1239
1240
|
function logger3() {
|
|
1240
|
-
return
|
|
1241
|
+
return _chunkTVEQLM3Zcjs.getLogger.call(void 0, "driver-engine");
|
|
1241
1242
|
}
|
|
1242
1243
|
|
|
1243
1244
|
// src/drivers/engine/actor-driver.ts
|
|
@@ -1255,8 +1256,8 @@ var EngineActorDriver = class {
|
|
|
1255
1256
|
#version = 1;
|
|
1256
1257
|
// Version for the runner protocol
|
|
1257
1258
|
#alarmTimeout;
|
|
1258
|
-
#runnerStarted =
|
|
1259
|
-
#runnerStopped =
|
|
1259
|
+
#runnerStarted = _chunkTVEQLM3Zcjs.promiseWithResolvers.call(void 0, );
|
|
1260
|
+
#runnerStopped = _chunkTVEQLM3Zcjs.promiseWithResolvers.call(void 0, );
|
|
1260
1261
|
#isRunnerStopped = false;
|
|
1261
1262
|
// HACK: Track actor stop intent locally since the runner protocol doesn't
|
|
1262
1263
|
// pass the stop reason to onActorStop. This will be fixed when the runner
|
|
@@ -1291,7 +1292,7 @@ var EngineActorDriver = class {
|
|
|
1291
1292
|
);
|
|
1292
1293
|
const engineRunnerConfig = {
|
|
1293
1294
|
version: this.#version,
|
|
1294
|
-
endpoint:
|
|
1295
|
+
endpoint: _chunkPDX7CZSQcjs.getEndpoint.call(void 0, runConfig),
|
|
1295
1296
|
token,
|
|
1296
1297
|
namespace: runConfig.namespace,
|
|
1297
1298
|
totalSlots: runConfig.totalSlots,
|
|
@@ -1317,7 +1318,7 @@ var EngineActorDriver = class {
|
|
|
1317
1318
|
},
|
|
1318
1319
|
onActorStart: this.#runnerOnActorStart.bind(this),
|
|
1319
1320
|
onActorStop: this.#runnerOnActorStop.bind(this),
|
|
1320
|
-
logger:
|
|
1321
|
+
logger: _chunkTVEQLM3Zcjs.getLogger.call(void 0, "engine-runner")
|
|
1321
1322
|
};
|
|
1322
1323
|
this.#runner = new (0, _enginerunner.Runner)(engineRunnerConfig);
|
|
1323
1324
|
this.#runner.start();
|
|
@@ -1348,7 +1349,7 @@ var EngineActorDriver = class {
|
|
|
1348
1349
|
this.#alarmTimeout = void 0;
|
|
1349
1350
|
}
|
|
1350
1351
|
const delay = Math.max(0, timestamp - Date.now());
|
|
1351
|
-
this.#alarmTimeout =
|
|
1352
|
+
this.#alarmTimeout = _chunkTVEQLM3Zcjs.setLongTimeout.call(void 0, () => {
|
|
1352
1353
|
actor2.onAlarm();
|
|
1353
1354
|
this.#alarmTimeout = void 0;
|
|
1354
1355
|
}, delay);
|
|
@@ -1420,7 +1421,7 @@ var EngineActorDriver = class {
|
|
|
1420
1421
|
var _a;
|
|
1421
1422
|
(_a = handler.actor) == null ? void 0 : _a.rLog.error({
|
|
1422
1423
|
msg: "onStop errored",
|
|
1423
|
-
error:
|
|
1424
|
+
error: _chunkTVEQLM3Zcjs.stringifyError.call(void 0, err)
|
|
1424
1425
|
});
|
|
1425
1426
|
})
|
|
1426
1427
|
);
|
|
@@ -1478,18 +1479,18 @@ var EngineActorDriver = class {
|
|
|
1478
1479
|
let handler = this.#actors.get(actorId);
|
|
1479
1480
|
if (!handler) {
|
|
1480
1481
|
handler = {
|
|
1481
|
-
actorStartPromise:
|
|
1482
|
+
actorStartPromise: _chunkTVEQLM3Zcjs.promiseWithResolvers.call(void 0, )
|
|
1482
1483
|
};
|
|
1483
1484
|
this.#actors.set(actorId, handler);
|
|
1484
1485
|
}
|
|
1485
1486
|
const name = actorConfig.name;
|
|
1486
1487
|
_invariant2.default.call(void 0, actorConfig.key, "actor should have a key");
|
|
1487
|
-
const key =
|
|
1488
|
+
const key = _chunkPDX7CZSQcjs.deserializeActorKey.call(void 0, actorConfig.key);
|
|
1488
1489
|
const [persistDataBuffer] = await this.#runner.kvGet(actorId, [
|
|
1489
|
-
|
|
1490
|
+
_chunk3KQGFKFWcjs.KEYS.PERSIST_DATA
|
|
1490
1491
|
]);
|
|
1491
1492
|
if (persistDataBuffer === null) {
|
|
1492
|
-
const initialKvState =
|
|
1493
|
+
const initialKvState = _chunk3KQGFKFWcjs.getInitialActorKvState.call(void 0, input);
|
|
1493
1494
|
await this.#runner.kvPut(actorId, initialKvState);
|
|
1494
1495
|
logger3().debug({
|
|
1495
1496
|
msg: "initialized persist data for new actor",
|
|
@@ -1502,7 +1503,7 @@ var EngineActorDriver = class {
|
|
|
1502
1503
|
dataSize: persistDataBuffer.byteLength
|
|
1503
1504
|
});
|
|
1504
1505
|
}
|
|
1505
|
-
const definition =
|
|
1506
|
+
const definition = _chunkPDX7CZSQcjs.lookupInRegistry.call(void 0,
|
|
1506
1507
|
this.#registryConfig,
|
|
1507
1508
|
actorConfig.name
|
|
1508
1509
|
);
|
|
@@ -1529,7 +1530,7 @@ var EngineActorDriver = class {
|
|
|
1529
1530
|
} catch (err) {
|
|
1530
1531
|
logger3().error({
|
|
1531
1532
|
msg: "error in onStop, proceeding with removing actor",
|
|
1532
|
-
err:
|
|
1533
|
+
err: _chunkTVEQLM3Zcjs.stringifyError.call(void 0, err)
|
|
1533
1534
|
});
|
|
1534
1535
|
}
|
|
1535
1536
|
this.#actors.delete(actorId);
|
|
@@ -1588,7 +1589,7 @@ var EngineActorDriver = class {
|
|
|
1588
1589
|
const wsContext = new (0, _ws2.WSContext)(websocket);
|
|
1589
1590
|
const conn = wsHandler.conn;
|
|
1590
1591
|
const actor2 = wsHandler.actor;
|
|
1591
|
-
const connStateManager = conn == null ? void 0 : conn[
|
|
1592
|
+
const connStateManager = conn == null ? void 0 : conn[_chunkPDX7CZSQcjs.CONN_STATE_MANAGER_SYMBOL];
|
|
1592
1593
|
logger3().debug({
|
|
1593
1594
|
msg: "attaching websocket event listeners",
|
|
1594
1595
|
actorId,
|
|
@@ -1648,7 +1649,7 @@ var EngineActorDriver = class {
|
|
|
1648
1649
|
});
|
|
1649
1650
|
const entry = this.#hwsMessageIndex.get(conn.id);
|
|
1650
1651
|
if (entry) {
|
|
1651
|
-
const messageLength =
|
|
1652
|
+
const messageLength = _chunkPDX7CZSQcjs.getValueLength.call(void 0, event.data);
|
|
1652
1653
|
entry.bufferedMessageSize += messageLength;
|
|
1653
1654
|
if (entry.bufferedMessageSize >= CONN_BUFFERED_MESSAGE_SIZE_THRESHOLD) {
|
|
1654
1655
|
entry.bufferedMessageSize = 0;
|
|
@@ -1719,10 +1720,10 @@ var EngineActorDriver = class {
|
|
|
1719
1720
|
gatewayId: _enginerunner.idToStr.call(void 0, gatewayId),
|
|
1720
1721
|
requestId: _enginerunner.idToStr.call(void 0, requestId)
|
|
1721
1722
|
});
|
|
1722
|
-
if (path ===
|
|
1723
|
+
if (path === _chunkJAYBUDHKcjs.PATH_CONNECT) {
|
|
1723
1724
|
return true;
|
|
1724
|
-
} else if (path ===
|
|
1725
|
-
const definition =
|
|
1725
|
+
} else if (path === _chunkJAYBUDHKcjs.PATH_WEBSOCKET_BASE || path.startsWith(_chunkJAYBUDHKcjs.PATH_WEBSOCKET_PREFIX)) {
|
|
1726
|
+
const definition = _chunkPDX7CZSQcjs.lookupInRegistry.call(void 0,
|
|
1726
1727
|
this.#registryConfig,
|
|
1727
1728
|
actorInstance.config.name
|
|
1728
1729
|
);
|
|
@@ -1750,7 +1751,7 @@ var EngineActorDriver = class {
|
|
|
1750
1751
|
} else {
|
|
1751
1752
|
return false;
|
|
1752
1753
|
}
|
|
1753
|
-
} else if (path ===
|
|
1754
|
+
} else if (path === _chunkJAYBUDHKcjs.PATH_INSPECTOR_CONNECT) {
|
|
1754
1755
|
return false;
|
|
1755
1756
|
} else {
|
|
1756
1757
|
logger3().warn({
|
|
@@ -1763,7 +1764,7 @@ var EngineActorDriver = class {
|
|
|
1763
1764
|
async #hwsLoadAll(actorId) {
|
|
1764
1765
|
const actor2 = await this.loadActor(actorId);
|
|
1765
1766
|
return actor2.conns.values().map((conn) => {
|
|
1766
|
-
const connStateManager = conn[
|
|
1767
|
+
const connStateManager = conn[_chunkPDX7CZSQcjs.CONN_STATE_MANAGER_SYMBOL];
|
|
1767
1768
|
const hibernatable = connStateManager.hibernatableData;
|
|
1768
1769
|
if (!hibernatable) return void 0;
|
|
1769
1770
|
return {
|
|
@@ -1786,7 +1787,7 @@ var EngineActorDriver = class {
|
|
|
1786
1787
|
await this.#runner.restoreHibernatingRequests(actor2.id, metaEntries);
|
|
1787
1788
|
}
|
|
1788
1789
|
onCreateConn(conn) {
|
|
1789
|
-
const hibernatable = conn[
|
|
1790
|
+
const hibernatable = conn[_chunkPDX7CZSQcjs.CONN_STATE_MANAGER_SYMBOL].hibernatableData;
|
|
1790
1791
|
if (!hibernatable) return;
|
|
1791
1792
|
this.#hwsMessageIndex.set(conn.id, {
|
|
1792
1793
|
serverMessageIndex: hibernatable.serverMessageIndex,
|
|
@@ -1808,7 +1809,7 @@ var EngineActorDriver = class {
|
|
|
1808
1809
|
});
|
|
1809
1810
|
}
|
|
1810
1811
|
onBeforePersistConn(conn) {
|
|
1811
|
-
const stateManager = conn[
|
|
1812
|
+
const stateManager = conn[_chunkPDX7CZSQcjs.CONN_STATE_MANAGER_SYMBOL];
|
|
1812
1813
|
const hibernatable = stateManager.hibernatableDataOrError();
|
|
1813
1814
|
const entry = this.#hwsMessageIndex.get(conn.id);
|
|
1814
1815
|
if (!entry) {
|
|
@@ -1822,7 +1823,7 @@ var EngineActorDriver = class {
|
|
|
1822
1823
|
entry.serverMessageIndex = hibernatable.serverMessageIndex;
|
|
1823
1824
|
}
|
|
1824
1825
|
onAfterPersistConn(conn) {
|
|
1825
|
-
const stateManager = conn[
|
|
1826
|
+
const stateManager = conn[_chunkPDX7CZSQcjs.CONN_STATE_MANAGER_SYMBOL];
|
|
1826
1827
|
const hibernatable = stateManager.hibernatableDataOrError();
|
|
1827
1828
|
const entry = this.#hwsMessageIndex.get(conn.id);
|
|
1828
1829
|
if (!entry) {
|
|
@@ -1850,7 +1851,7 @@ function createEngineDriver() {
|
|
|
1850
1851
|
return {
|
|
1851
1852
|
name: "engine",
|
|
1852
1853
|
manager: (_registryConfig, runConfig) => {
|
|
1853
|
-
return new (0,
|
|
1854
|
+
return new (0, _chunkPDX7CZSQcjs.RemoteManagerDriver)(runConfig);
|
|
1854
1855
|
},
|
|
1855
1856
|
actor: (registryConfig, runConfig, managerDriver, inlineClient) => {
|
|
1856
1857
|
return new EngineActorDriver(
|
|
@@ -2353,7 +2354,7 @@ var v1ToV2 = (v1State) => {
|
|
|
2353
2354
|
if (v1State.persistedData) {
|
|
2354
2355
|
const key = new Uint8Array([1]);
|
|
2355
2356
|
kvStorage.push({
|
|
2356
|
-
key:
|
|
2357
|
+
key: _chunkTVEQLM3Zcjs.bufferToArrayBuffer.call(void 0, key),
|
|
2357
2358
|
value: v1State.persistedData
|
|
2358
2359
|
});
|
|
2359
2360
|
}
|
|
@@ -2459,7 +2460,7 @@ var ACTOR_ALARM_VERSIONED = _vbare.createVersionedDataHandler.call(void 0, {
|
|
|
2459
2460
|
|
|
2460
2461
|
// src/drivers/file-system/log.ts
|
|
2461
2462
|
function logger4() {
|
|
2462
|
-
return
|
|
2463
|
+
return _chunkTVEQLM3Zcjs.getLogger.call(void 0, "driver-fs");
|
|
2463
2464
|
}
|
|
2464
2465
|
|
|
2465
2466
|
// src/drivers/file-system/utils.ts
|
|
@@ -2654,11 +2655,11 @@ var FileSystemGlobalState = class {
|
|
|
2654
2655
|
entry.generation = crypto.randomUUID();
|
|
2655
2656
|
}
|
|
2656
2657
|
const kvStorage = [];
|
|
2657
|
-
const initialKvState =
|
|
2658
|
+
const initialKvState = _chunk3KQGFKFWcjs.getInitialActorKvState.call(void 0, input);
|
|
2658
2659
|
for (const [key2, value] of initialKvState) {
|
|
2659
2660
|
kvStorage.push({
|
|
2660
|
-
key:
|
|
2661
|
-
value:
|
|
2661
|
+
key: _chunkTVEQLM3Zcjs.bufferToArrayBuffer.call(void 0, key2),
|
|
2662
|
+
value: _chunkTVEQLM3Zcjs.bufferToArrayBuffer.call(void 0, value)
|
|
2662
2663
|
});
|
|
2663
2664
|
}
|
|
2664
2665
|
entry.state = {
|
|
@@ -2728,11 +2729,11 @@ var FileSystemGlobalState = class {
|
|
|
2728
2729
|
entry.generation = crypto.randomUUID();
|
|
2729
2730
|
}
|
|
2730
2731
|
const kvStorage = [];
|
|
2731
|
-
const initialKvState =
|
|
2732
|
+
const initialKvState = _chunk3KQGFKFWcjs.getInitialActorKvState.call(void 0, input);
|
|
2732
2733
|
for (const [key2, value] of initialKvState) {
|
|
2733
2734
|
kvStorage.push({
|
|
2734
|
-
key:
|
|
2735
|
-
value:
|
|
2735
|
+
key: _chunkTVEQLM3Zcjs.bufferToArrayBuffer.call(void 0, key2),
|
|
2736
|
+
value: _chunkTVEQLM3Zcjs.bufferToArrayBuffer.call(void 0, value)
|
|
2736
2737
|
});
|
|
2737
2738
|
}
|
|
2738
2739
|
entry.state = {
|
|
@@ -2811,7 +2812,7 @@ var FileSystemGlobalState = class {
|
|
|
2811
2812
|
logger4().error({
|
|
2812
2813
|
msg: "failed to delete actor state file",
|
|
2813
2814
|
actorId,
|
|
2814
|
-
error:
|
|
2815
|
+
error: _chunkTVEQLM3Zcjs.stringifyError.call(void 0, err)
|
|
2815
2816
|
});
|
|
2816
2817
|
}
|
|
2817
2818
|
}
|
|
@@ -2825,7 +2826,7 @@ var FileSystemGlobalState = class {
|
|
|
2825
2826
|
logger4().error({
|
|
2826
2827
|
msg: "failed to delete actor database file",
|
|
2827
2828
|
actorId,
|
|
2828
|
-
error:
|
|
2829
|
+
error: _chunkTVEQLM3Zcjs.stringifyError.call(void 0, err)
|
|
2829
2830
|
});
|
|
2830
2831
|
}
|
|
2831
2832
|
}
|
|
@@ -2839,7 +2840,7 @@ var FileSystemGlobalState = class {
|
|
|
2839
2840
|
logger4().error({
|
|
2840
2841
|
msg: "failed to delete actor alarm file",
|
|
2841
2842
|
actorId,
|
|
2842
|
-
error:
|
|
2843
|
+
error: _chunkTVEQLM3Zcjs.stringifyError.call(void 0, err)
|
|
2843
2844
|
});
|
|
2844
2845
|
}
|
|
2845
2846
|
}
|
|
@@ -3017,9 +3018,9 @@ var FileSystemGlobalState = class {
|
|
|
3017
3018
|
if (entry.actor) {
|
|
3018
3019
|
return entry.actor;
|
|
3019
3020
|
}
|
|
3020
|
-
entry.startPromise =
|
|
3021
|
+
entry.startPromise = _chunkTVEQLM3Zcjs.promiseWithResolvers.call(void 0, );
|
|
3021
3022
|
try {
|
|
3022
|
-
const definition =
|
|
3023
|
+
const definition = _chunkPDX7CZSQcjs.lookupInRegistry.call(void 0,
|
|
3023
3024
|
registryConfig,
|
|
3024
3025
|
entry.state.name
|
|
3025
3026
|
);
|
|
@@ -3097,7 +3098,7 @@ var FileSystemGlobalState = class {
|
|
|
3097
3098
|
logger4().error({
|
|
3098
3099
|
msg: "failed to read alarm file",
|
|
3099
3100
|
file,
|
|
3100
|
-
error:
|
|
3101
|
+
error: _chunkTVEQLM3Zcjs.stringifyError.call(void 0, err)
|
|
3101
3102
|
});
|
|
3102
3103
|
}
|
|
3103
3104
|
}
|
|
@@ -3127,7 +3128,7 @@ var FileSystemGlobalState = class {
|
|
|
3127
3128
|
(_a = entry.alarmTimeout) == null ? void 0 : _a.abort();
|
|
3128
3129
|
entry.alarmTimestamp = timestamp;
|
|
3129
3130
|
const delay = Math.max(0, timestamp - Date.now());
|
|
3130
|
-
entry.alarmTimeout =
|
|
3131
|
+
entry.alarmTimeout = _chunkTVEQLM3Zcjs.setLongTimeout.call(void 0, async () => {
|
|
3131
3132
|
entry.alarmTimestamp = void 0;
|
|
3132
3133
|
if (this.#persist) {
|
|
3133
3134
|
try {
|
|
@@ -3138,7 +3139,7 @@ var FileSystemGlobalState = class {
|
|
|
3138
3139
|
logger4().debug({
|
|
3139
3140
|
msg: "failed to remove alarm file",
|
|
3140
3141
|
actorId,
|
|
3141
|
-
error:
|
|
3142
|
+
error: _chunkTVEQLM3Zcjs.stringifyError.call(void 0, err)
|
|
3142
3143
|
});
|
|
3143
3144
|
}
|
|
3144
3145
|
}
|
|
@@ -3165,7 +3166,7 @@ var FileSystemGlobalState = class {
|
|
|
3165
3166
|
logger4().error({
|
|
3166
3167
|
msg: "failed to handle alarm",
|
|
3167
3168
|
actorId,
|
|
3168
|
-
error:
|
|
3169
|
+
error: _chunkTVEQLM3Zcjs.stringifyError.call(void 0, err)
|
|
3169
3170
|
});
|
|
3170
3171
|
}
|
|
3171
3172
|
}, delay);
|
|
@@ -3177,7 +3178,7 @@ var FileSystemGlobalState = class {
|
|
|
3177
3178
|
if (fsSync.existsSync(tokenPath)) {
|
|
3178
3179
|
return fsSync.readFileSync(tokenPath, "utf-8");
|
|
3179
3180
|
}
|
|
3180
|
-
const newToken =
|
|
3181
|
+
const newToken = _chunkJAYBUDHKcjs.generateRandomString.call(void 0, );
|
|
3181
3182
|
fsSync.writeFileSync(tokenPath, newToken);
|
|
3182
3183
|
return newToken;
|
|
3183
3184
|
}
|
|
@@ -3232,17 +3233,17 @@ var FileSystemGlobalState = class {
|
|
|
3232
3233
|
const newKvStorage = [...entry.state.kvStorage];
|
|
3233
3234
|
for (const [key, value] of entries) {
|
|
3234
3235
|
const existingIndex = newKvStorage.findIndex(
|
|
3235
|
-
(e) =>
|
|
3236
|
+
(e) => _chunkTVEQLM3Zcjs.arrayBuffersEqual.call(void 0, e.key, _chunkTVEQLM3Zcjs.bufferToArrayBuffer.call(void 0, key))
|
|
3236
3237
|
);
|
|
3237
3238
|
if (existingIndex >= 0) {
|
|
3238
3239
|
newKvStorage[existingIndex] = {
|
|
3239
|
-
key:
|
|
3240
|
-
value:
|
|
3240
|
+
key: _chunkTVEQLM3Zcjs.bufferToArrayBuffer.call(void 0, key),
|
|
3241
|
+
value: _chunkTVEQLM3Zcjs.bufferToArrayBuffer.call(void 0, value)
|
|
3241
3242
|
};
|
|
3242
3243
|
} else {
|
|
3243
3244
|
newKvStorage.push({
|
|
3244
|
-
key:
|
|
3245
|
-
value:
|
|
3245
|
+
key: _chunkTVEQLM3Zcjs.bufferToArrayBuffer.call(void 0, key),
|
|
3246
|
+
value: _chunkTVEQLM3Zcjs.bufferToArrayBuffer.call(void 0, value)
|
|
3246
3247
|
});
|
|
3247
3248
|
}
|
|
3248
3249
|
}
|
|
@@ -3267,7 +3268,7 @@ var FileSystemGlobalState = class {
|
|
|
3267
3268
|
const results = [];
|
|
3268
3269
|
for (const key of keys) {
|
|
3269
3270
|
const foundEntry = entry.state.kvStorage.find(
|
|
3270
|
-
(e) =>
|
|
3271
|
+
(e) => _chunkTVEQLM3Zcjs.arrayBuffersEqual.call(void 0, e.key, _chunkTVEQLM3Zcjs.bufferToArrayBuffer.call(void 0, key))
|
|
3271
3272
|
);
|
|
3272
3273
|
if (foundEntry) {
|
|
3273
3274
|
results.push(new Uint8Array(foundEntry.value));
|
|
@@ -3292,7 +3293,7 @@ var FileSystemGlobalState = class {
|
|
|
3292
3293
|
const newKvStorage = [...entry.state.kvStorage];
|
|
3293
3294
|
for (const key of keys) {
|
|
3294
3295
|
const indexToDelete = newKvStorage.findIndex(
|
|
3295
|
-
(e) =>
|
|
3296
|
+
(e) => _chunkTVEQLM3Zcjs.arrayBuffersEqual.call(void 0, e.key, _chunkTVEQLM3Zcjs.bufferToArrayBuffer.call(void 0, key))
|
|
3296
3297
|
);
|
|
3297
3298
|
if (indexToDelete >= 0) {
|
|
3298
3299
|
newKvStorage.splice(indexToDelete, 1);
|
|
@@ -3358,13 +3359,13 @@ function createManagerInspectorRouter() {
|
|
|
3358
3359
|
});
|
|
3359
3360
|
return c.json(actors, 200);
|
|
3360
3361
|
} catch (error) {
|
|
3361
|
-
|
|
3362
|
+
_chunk3WHB4MCAcjs.inspectorLogger.call(void 0, ).error({
|
|
3362
3363
|
msg: "Failed to fetch actors",
|
|
3363
3364
|
error
|
|
3364
3365
|
});
|
|
3365
3366
|
return c.json("Failed to fetch actors", 500);
|
|
3366
3367
|
}
|
|
3367
|
-
}).post("/actors", _standardvalidator.sValidator.call(void 0, "json",
|
|
3368
|
+
}).post("/actors", _standardvalidator.sValidator.call(void 0, "json", _chunk4RIFZGLWcjs.CreateActorSchema), async (c) => {
|
|
3368
3369
|
const actor2 = await c.var.inspector.accessors.createActor(
|
|
3369
3370
|
c.req.valid("json")
|
|
3370
3371
|
);
|
|
@@ -3390,7 +3391,7 @@ var ManagerInspector = class {
|
|
|
3390
3391
|
|
|
3391
3392
|
constructor(accessors) {
|
|
3392
3393
|
this.accessors = accessors();
|
|
3393
|
-
|
|
3394
|
+
_chunk3WHB4MCAcjs.inspectorLogger.call(void 0, ).debug({ msg: "Manager Inspector enabled and ready" });
|
|
3394
3395
|
}
|
|
3395
3396
|
};
|
|
3396
3397
|
|
|
@@ -3471,9 +3472,9 @@ var FileSystemManagerDriver = class {
|
|
|
3471
3472
|
};
|
|
3472
3473
|
});
|
|
3473
3474
|
}
|
|
3474
|
-
const inlineClient =
|
|
3475
|
+
const inlineClient = _chunkPDX7CZSQcjs.createClientWithDriver.call(void 0,
|
|
3475
3476
|
this,
|
|
3476
|
-
|
|
3477
|
+
_chunk3KQGFKFWcjs.ClientConfigSchema.parse({})
|
|
3477
3478
|
);
|
|
3478
3479
|
this.#actorDriver = this.#driverConfig.actor(
|
|
3479
3480
|
registryConfig,
|
|
@@ -3538,7 +3539,7 @@ var FileSystemManagerDriver = class {
|
|
|
3538
3539
|
false,
|
|
3539
3540
|
false
|
|
3540
3541
|
);
|
|
3541
|
-
return upgradeWebSocket(() => wsHandler)(c,
|
|
3542
|
+
return upgradeWebSocket(() => wsHandler)(c, _chunkTVEQLM3Zcjs.noopNext.call(void 0, ));
|
|
3542
3543
|
}
|
|
3543
3544
|
async getForId({
|
|
3544
3545
|
actorId
|
|
@@ -3700,19 +3701,19 @@ function chooseDefaultDriver(runConfig) {
|
|
|
3700
3701
|
return runConfig.driver;
|
|
3701
3702
|
}
|
|
3702
3703
|
if (runConfig.endpoint || runConfig.token || runConfig.runnerKind === "serverless") {
|
|
3703
|
-
|
|
3704
|
+
_chunkJAYBUDHKcjs.loggerWithoutContext.call(void 0, ).debug({
|
|
3704
3705
|
msg: "using rivet engine driver",
|
|
3705
3706
|
endpoint: runConfig.endpoint
|
|
3706
3707
|
});
|
|
3707
3708
|
return createEngineDriver();
|
|
3708
3709
|
}
|
|
3709
|
-
|
|
3710
|
+
_chunkJAYBUDHKcjs.loggerWithoutContext.call(void 0, ).debug({ msg: "using default file system driver" });
|
|
3710
3711
|
return createFileSystemOrMemoryDriver(true);
|
|
3711
3712
|
}
|
|
3712
3713
|
|
|
3713
3714
|
// src/engine-process/log.ts
|
|
3714
3715
|
function logger5() {
|
|
3715
|
-
return
|
|
3716
|
+
return _chunkTVEQLM3Zcjs.getLogger.call(void 0, "engine-process");
|
|
3716
3717
|
}
|
|
3717
3718
|
|
|
3718
3719
|
// src/engine-process/mod.ts
|
|
@@ -3739,10 +3740,10 @@ async function ensureEngineProcess(options) {
|
|
|
3739
3740
|
await downloadEngineBinaryIfNeeded(binaryPath, options.version, varDir);
|
|
3740
3741
|
if (await isEngineRunning()) {
|
|
3741
3742
|
try {
|
|
3742
|
-
await waitForEngineHealth();
|
|
3743
|
+
const health = await waitForEngineHealth();
|
|
3743
3744
|
logger5().debug({
|
|
3744
3745
|
msg: "engine already running and healthy",
|
|
3745
|
-
version:
|
|
3746
|
+
version: health.version
|
|
3746
3747
|
});
|
|
3747
3748
|
return;
|
|
3748
3749
|
} catch (error) {
|
|
@@ -3989,12 +3990,16 @@ async function waitForEngineHealth() {
|
|
|
3989
3990
|
logger5().debug({ msg: "waiting for engine health check" });
|
|
3990
3991
|
for (let i = 0; i < maxRetries; i++) {
|
|
3991
3992
|
try {
|
|
3992
|
-
const response = await fetch(`${ENGINE_ENDPOINT}/health
|
|
3993
|
+
const response = await fetch(`${ENGINE_ENDPOINT}/health`, {
|
|
3994
|
+
signal: AbortSignal.timeout(1e3)
|
|
3995
|
+
});
|
|
3993
3996
|
if (response.ok) {
|
|
3997
|
+
const health = await response.json();
|
|
3994
3998
|
logger5().debug({ msg: "engine health check passed" });
|
|
3995
|
-
return;
|
|
3999
|
+
return health;
|
|
3996
4000
|
}
|
|
3997
4001
|
} catch (error) {
|
|
4002
|
+
logger5().debug({ msg: "engine health check failed", error });
|
|
3998
4003
|
if (i === maxRetries - 1) {
|
|
3999
4004
|
throw new Error(
|
|
4000
4005
|
`engine health check failed after ${maxRetries} retries: ${error}`
|
|
@@ -4113,7 +4118,7 @@ var ActorsListNamesResponseSchema = _zod.z.object({
|
|
|
4113
4118
|
|
|
4114
4119
|
// src/manager/log.ts
|
|
4115
4120
|
function logger6() {
|
|
4116
|
-
return
|
|
4121
|
+
return _chunkTVEQLM3Zcjs.getLogger.call(void 0, "actor-manager");
|
|
4117
4122
|
}
|
|
4118
4123
|
|
|
4119
4124
|
// src/manager/gateway.ts
|
|
@@ -4129,11 +4134,11 @@ async function handleWebSocketGatewayPathBased(runConfig, managerDriver, c, acto
|
|
|
4129
4134
|
if (protocols) {
|
|
4130
4135
|
const protocolList = protocols.split(",").map((p) => p.trim());
|
|
4131
4136
|
for (const protocol of protocolList) {
|
|
4132
|
-
if (protocol.startsWith(
|
|
4133
|
-
encodingRaw = protocol.substring(
|
|
4134
|
-
} else if (protocol.startsWith(
|
|
4137
|
+
if (protocol.startsWith(_chunkJAYBUDHKcjs.WS_PROTOCOL_ENCODING)) {
|
|
4138
|
+
encodingRaw = protocol.substring(_chunkJAYBUDHKcjs.WS_PROTOCOL_ENCODING.length);
|
|
4139
|
+
} else if (protocol.startsWith(_chunkJAYBUDHKcjs.WS_PROTOCOL_CONN_PARAMS)) {
|
|
4135
4140
|
connParamsRaw = decodeURIComponent(
|
|
4136
|
-
protocol.substring(
|
|
4141
|
+
protocol.substring(_chunkJAYBUDHKcjs.WS_PROTOCOL_CONN_PARAMS.length)
|
|
4137
4142
|
);
|
|
4138
4143
|
}
|
|
4139
4144
|
}
|
|
@@ -4234,17 +4239,17 @@ async function handleWebSocketGateway(runConfig, managerDriver, c, strippedPath)
|
|
|
4234
4239
|
if (protocols) {
|
|
4235
4240
|
const protocolList = protocols.split(",").map((p) => p.trim());
|
|
4236
4241
|
for (const protocol of protocolList) {
|
|
4237
|
-
if (protocol.startsWith(
|
|
4238
|
-
target = protocol.substring(
|
|
4239
|
-
} else if (protocol.startsWith(
|
|
4242
|
+
if (protocol.startsWith(_chunkJAYBUDHKcjs.WS_PROTOCOL_TARGET)) {
|
|
4243
|
+
target = protocol.substring(_chunkJAYBUDHKcjs.WS_PROTOCOL_TARGET.length);
|
|
4244
|
+
} else if (protocol.startsWith(_chunkJAYBUDHKcjs.WS_PROTOCOL_ACTOR)) {
|
|
4240
4245
|
actorId = decodeURIComponent(
|
|
4241
|
-
protocol.substring(
|
|
4246
|
+
protocol.substring(_chunkJAYBUDHKcjs.WS_PROTOCOL_ACTOR.length)
|
|
4242
4247
|
);
|
|
4243
|
-
} else if (protocol.startsWith(
|
|
4244
|
-
encodingRaw = protocol.substring(
|
|
4245
|
-
} else if (protocol.startsWith(
|
|
4248
|
+
} else if (protocol.startsWith(_chunkJAYBUDHKcjs.WS_PROTOCOL_ENCODING)) {
|
|
4249
|
+
encodingRaw = protocol.substring(_chunkJAYBUDHKcjs.WS_PROTOCOL_ENCODING.length);
|
|
4250
|
+
} else if (protocol.startsWith(_chunkJAYBUDHKcjs.WS_PROTOCOL_CONN_PARAMS)) {
|
|
4246
4251
|
connParamsRaw = decodeURIComponent(
|
|
4247
|
-
protocol.substring(
|
|
4252
|
+
protocol.substring(_chunkJAYBUDHKcjs.WS_PROTOCOL_CONN_PARAMS.length)
|
|
4248
4253
|
);
|
|
4249
4254
|
}
|
|
4250
4255
|
}
|
|
@@ -4274,8 +4279,8 @@ async function handleWebSocketGateway(runConfig, managerDriver, c, strippedPath)
|
|
|
4274
4279
|
);
|
|
4275
4280
|
}
|
|
4276
4281
|
async function handleHttpGateway(managerDriver, c, next, strippedPath) {
|
|
4277
|
-
const target = c.req.header(
|
|
4278
|
-
const actorId = c.req.header(
|
|
4282
|
+
const target = c.req.header(_chunkJAYBUDHKcjs.HEADER_RIVET_TARGET);
|
|
4283
|
+
const actorId = c.req.header(_chunkJAYBUDHKcjs.HEADER_RIVET_ACTOR);
|
|
4279
4284
|
if (target !== "actor") {
|
|
4280
4285
|
return next();
|
|
4281
4286
|
}
|
|
@@ -4289,8 +4294,8 @@ async function handleHttpGateway(managerDriver, c, next, strippedPath) {
|
|
|
4289
4294
|
method: c.req.method
|
|
4290
4295
|
});
|
|
4291
4296
|
const proxyHeaders = new Headers(c.req.raw.headers);
|
|
4292
|
-
proxyHeaders.delete(
|
|
4293
|
-
proxyHeaders.delete(
|
|
4297
|
+
proxyHeaders.delete(_chunkJAYBUDHKcjs.HEADER_RIVET_TARGET);
|
|
4298
|
+
proxyHeaders.delete(_chunkJAYBUDHKcjs.HEADER_RIVET_ACTOR);
|
|
4294
4299
|
const url = new URL(c.req.url);
|
|
4295
4300
|
const proxyUrl = new URL(`http://actor${strippedPath}${url.search}`);
|
|
4296
4301
|
const proxyRequest = new Request(proxyUrl, {
|
|
@@ -4384,7 +4389,7 @@ async function createTestWebSocketProxy(clientWsPromise) {
|
|
|
4384
4389
|
promise: serverWsPromise,
|
|
4385
4390
|
resolve: serverWsResolve,
|
|
4386
4391
|
reject: serverWsReject
|
|
4387
|
-
} =
|
|
4392
|
+
} = _chunkTVEQLM3Zcjs.promiseWithResolvers.call(void 0, );
|
|
4388
4393
|
try {
|
|
4389
4394
|
logger6().debug({ msg: "awaiting client websocket promise" });
|
|
4390
4395
|
const ws = await clientWsPromise;
|
|
@@ -4633,7 +4638,7 @@ function createManagerRouter(registryConfig, runConfig, managerDriver, driverCon
|
|
|
4633
4638
|
} else if (runConfig.runnerKind === "normal") {
|
|
4634
4639
|
addManagerRoutes(registryConfig, runConfig, managerDriver, router);
|
|
4635
4640
|
} else {
|
|
4636
|
-
|
|
4641
|
+
_chunkTVEQLM3Zcjs.assertUnreachable.call(void 0, runConfig.runnerKind);
|
|
4637
4642
|
}
|
|
4638
4643
|
router.notFound(handleRouteNotFound);
|
|
4639
4644
|
router.onError(handleRouteError);
|
|
@@ -4700,13 +4705,13 @@ function addServerlessRoutes(driverConfig, registryConfig, runConfig, managerDri
|
|
|
4700
4705
|
}
|
|
4701
4706
|
function addManagerRoutes(registryConfig, runConfig, managerDriver, router) {
|
|
4702
4707
|
var _a;
|
|
4703
|
-
if (
|
|
4708
|
+
if (_chunk3WHB4MCAcjs.isInspectorEnabled.call(void 0, runConfig, "manager")) {
|
|
4704
4709
|
if (!managerDriver.inspector) {
|
|
4705
4710
|
throw new (0, _chunkMAQSR26Xcjs.Unsupported)("inspector");
|
|
4706
4711
|
}
|
|
4707
4712
|
router.route(
|
|
4708
4713
|
"/inspect",
|
|
4709
|
-
new (0, _hono.Hono)().use(
|
|
4714
|
+
new (0, _hono.Hono)().use(_chunk3WHB4MCAcjs.secureInspector.call(void 0, runConfig)).use((c, next) => {
|
|
4710
4715
|
c.set("inspector", managerDriver.inspector);
|
|
4711
4716
|
return next();
|
|
4712
4717
|
}).route("/", createManagerInspectorRouter())
|
|
@@ -4922,7 +4927,7 @@ function addManagerRoutes(registryConfig, runConfig, managerDriver, router) {
|
|
|
4922
4927
|
);
|
|
4923
4928
|
response = { ok: output };
|
|
4924
4929
|
} catch (rawErr) {
|
|
4925
|
-
const err =
|
|
4930
|
+
const err = _chunkTVEQLM3Zcjs.deconstructError.call(void 0, rawErr, logger6(), {}, true);
|
|
4926
4931
|
response = { err };
|
|
4927
4932
|
}
|
|
4928
4933
|
return c.body(cbor4.encode(response));
|
|
@@ -4942,21 +4947,21 @@ function addManagerRoutes(registryConfig, runConfig, managerDriver, router) {
|
|
|
4942
4947
|
let path = "";
|
|
4943
4948
|
let params;
|
|
4944
4949
|
for (const protocol of protocols) {
|
|
4945
|
-
if (protocol.startsWith(
|
|
4950
|
+
if (protocol.startsWith(_chunkJAYBUDHKcjs.WS_PROTOCOL_ACTOR)) {
|
|
4946
4951
|
actorId = decodeURIComponent(
|
|
4947
|
-
protocol.substring(
|
|
4952
|
+
protocol.substring(_chunkJAYBUDHKcjs.WS_PROTOCOL_ACTOR.length)
|
|
4948
4953
|
);
|
|
4949
|
-
} else if (protocol.startsWith(
|
|
4954
|
+
} else if (protocol.startsWith(_chunkJAYBUDHKcjs.WS_PROTOCOL_ENCODING)) {
|
|
4950
4955
|
encoding = protocol.substring(
|
|
4951
|
-
|
|
4956
|
+
_chunkJAYBUDHKcjs.WS_PROTOCOL_ENCODING.length
|
|
4952
4957
|
);
|
|
4953
|
-
} else if (protocol.startsWith(
|
|
4958
|
+
} else if (protocol.startsWith(_chunkJAYBUDHKcjs.WS_TEST_PROTOCOL_PATH)) {
|
|
4954
4959
|
path = decodeURIComponent(
|
|
4955
|
-
protocol.substring(
|
|
4960
|
+
protocol.substring(_chunkJAYBUDHKcjs.WS_TEST_PROTOCOL_PATH.length)
|
|
4956
4961
|
);
|
|
4957
|
-
} else if (protocol.startsWith(
|
|
4962
|
+
} else if (protocol.startsWith(_chunkJAYBUDHKcjs.WS_PROTOCOL_CONN_PARAMS)) {
|
|
4958
4963
|
const paramsRaw = decodeURIComponent(
|
|
4959
|
-
protocol.substring(
|
|
4964
|
+
protocol.substring(_chunkJAYBUDHKcjs.WS_PROTOCOL_CONN_PARAMS.length)
|
|
4960
4965
|
);
|
|
4961
4966
|
params = JSON.parse(paramsRaw);
|
|
4962
4967
|
}
|
|
@@ -4975,10 +4980,10 @@ function addManagerRoutes(registryConfig, runConfig, managerDriver, router) {
|
|
|
4975
4980
|
params
|
|
4976
4981
|
);
|
|
4977
4982
|
return await createTestWebSocketProxy(clientWsPromise);
|
|
4978
|
-
})(c,
|
|
4983
|
+
})(c, _chunkTVEQLM3Zcjs.noopNext.call(void 0, ));
|
|
4979
4984
|
});
|
|
4980
4985
|
router.all(".test/inline-driver/send-request/*", async (c) => {
|
|
4981
|
-
const actorId = c.req.header(
|
|
4986
|
+
const actorId = c.req.header(_chunkJAYBUDHKcjs.HEADER_ACTOR_ID);
|
|
4982
4987
|
if (!actorId) {
|
|
4983
4988
|
return c.text("Missing required headers", 400);
|
|
4984
4989
|
}
|
|
@@ -5005,9 +5010,9 @@ function addManagerRoutes(registryConfig, runConfig, managerDriver, router) {
|
|
|
5005
5010
|
} catch (error) {
|
|
5006
5011
|
logger6().error({
|
|
5007
5012
|
msg: "error in test inline raw http",
|
|
5008
|
-
error:
|
|
5013
|
+
error: _chunkTVEQLM3Zcjs.stringifyError.call(void 0, error)
|
|
5009
5014
|
});
|
|
5010
|
-
const err =
|
|
5015
|
+
const err = _chunkTVEQLM3Zcjs.deconstructError.call(void 0, error, logger6(), {}, true);
|
|
5011
5016
|
return c.json(
|
|
5012
5017
|
{
|
|
5013
5018
|
error: {
|
|
@@ -5052,7 +5057,7 @@ function addManagerRoutes(registryConfig, runConfig, managerDriver, router) {
|
|
|
5052
5057
|
} catch (error) {
|
|
5053
5058
|
logger6().error({
|
|
5054
5059
|
msg: "error forcing disconnect",
|
|
5055
|
-
error:
|
|
5060
|
+
error: _chunkTVEQLM3Zcjs.stringifyError.call(void 0, error)
|
|
5056
5061
|
});
|
|
5057
5062
|
return c.text(`Error: ${error}`, 500);
|
|
5058
5063
|
}
|
|
@@ -5073,7 +5078,7 @@ function createApiActor(actor2, runnerName = "default") {
|
|
|
5073
5078
|
return {
|
|
5074
5079
|
actor_id: actor2.actorId,
|
|
5075
5080
|
name: actor2.name,
|
|
5076
|
-
key:
|
|
5081
|
+
key: _chunkPDX7CZSQcjs.serializeActorKey.call(void 0, actor2.key),
|
|
5077
5082
|
namespace_id: "default",
|
|
5078
5083
|
// Assert default namespace
|
|
5079
5084
|
runner_name_selector: runnerName,
|
|
@@ -5087,11 +5092,25 @@ function createApiActor(actor2, runnerName = "default") {
|
|
|
5087
5092
|
|
|
5088
5093
|
// src/registry/log.ts
|
|
5089
5094
|
function logger7() {
|
|
5090
|
-
return
|
|
5095
|
+
return _chunkTVEQLM3Zcjs.getLogger.call(void 0, "registry");
|
|
5091
5096
|
}
|
|
5092
5097
|
|
|
5093
5098
|
// src/registry/serve.ts
|
|
5094
5099
|
async function crossPlatformServe(runConfig, app) {
|
|
5100
|
+
const runtime = _chunkTVEQLM3Zcjs.detectRuntime.call(void 0, );
|
|
5101
|
+
logger7().debug({ msg: "detected runtime for serve", runtime });
|
|
5102
|
+
switch (runtime) {
|
|
5103
|
+
case "deno":
|
|
5104
|
+
return serveDeno(runConfig, app);
|
|
5105
|
+
case "bun":
|
|
5106
|
+
return serveBun(runConfig, app);
|
|
5107
|
+
case "node":
|
|
5108
|
+
return serveNode(runConfig, app);
|
|
5109
|
+
default:
|
|
5110
|
+
return serveNode(runConfig, app);
|
|
5111
|
+
}
|
|
5112
|
+
}
|
|
5113
|
+
async function serveNode(runConfig, app) {
|
|
5095
5114
|
const nodeServerModule = "@hono/node-server";
|
|
5096
5115
|
let serve;
|
|
5097
5116
|
try {
|
|
@@ -5101,9 +5120,10 @@ async function crossPlatformServe(runConfig, app) {
|
|
|
5101
5120
|
)));
|
|
5102
5121
|
serve = dep.serve;
|
|
5103
5122
|
} catch (err) {
|
|
5104
|
-
logger7().error(
|
|
5105
|
-
"failed to import @hono/node-server. please run 'npm install @hono/node-server @hono/node-ws'"
|
|
5106
|
-
|
|
5123
|
+
logger7().error({
|
|
5124
|
+
msg: "failed to import @hono/node-server. please run 'npm install @hono/node-server @hono/node-ws'",
|
|
5125
|
+
error: _chunkTVEQLM3Zcjs.stringifyError.call(void 0, err)
|
|
5126
|
+
});
|
|
5107
5127
|
process.exit(1);
|
|
5108
5128
|
}
|
|
5109
5129
|
const nodeWsModule = "@hono/node-ws";
|
|
@@ -5115,9 +5135,10 @@ async function crossPlatformServe(runConfig, app) {
|
|
|
5115
5135
|
)));
|
|
5116
5136
|
createNodeWebSocket = dep.createNodeWebSocket;
|
|
5117
5137
|
} catch (err) {
|
|
5118
|
-
logger7().error(
|
|
5119
|
-
"failed to import @hono/node-ws. please run 'npm install @hono/node-server @hono/node-ws'"
|
|
5120
|
-
|
|
5138
|
+
logger7().error({
|
|
5139
|
+
msg: "failed to import @hono/node-ws. please run 'npm install @hono/node-server @hono/node-ws'",
|
|
5140
|
+
error: _chunkTVEQLM3Zcjs.stringifyError.call(void 0, err)
|
|
5141
|
+
});
|
|
5121
5142
|
process.exit(1);
|
|
5122
5143
|
}
|
|
5123
5144
|
const { injectWebSocket, upgradeWebSocket } = createNodeWebSocket({
|
|
@@ -5131,6 +5152,53 @@ async function crossPlatformServe(runConfig, app) {
|
|
|
5131
5152
|
injectWebSocket(server);
|
|
5132
5153
|
return { upgradeWebSocket };
|
|
5133
5154
|
}
|
|
5155
|
+
async function serveDeno(runConfig, app) {
|
|
5156
|
+
const honoDenoModule = "hono/deno";
|
|
5157
|
+
let upgradeWebSocket;
|
|
5158
|
+
try {
|
|
5159
|
+
const dep = await Promise.resolve().then(() => _interopRequireWildcard(require(
|
|
5160
|
+
/* webpackIgnore: true */
|
|
5161
|
+
honoDenoModule
|
|
5162
|
+
)));
|
|
5163
|
+
upgradeWebSocket = dep.upgradeWebSocket;
|
|
5164
|
+
} catch (err) {
|
|
5165
|
+
logger7().error({
|
|
5166
|
+
msg: "failed to import hono/deno",
|
|
5167
|
+
error: _chunkTVEQLM3Zcjs.stringifyError.call(void 0, err)
|
|
5168
|
+
});
|
|
5169
|
+
process.exit(1);
|
|
5170
|
+
}
|
|
5171
|
+
const port = runConfig.defaultServerPort;
|
|
5172
|
+
Deno.serve({ port }, app.fetch);
|
|
5173
|
+
logger7().info({ msg: "server listening", port });
|
|
5174
|
+
return { upgradeWebSocket };
|
|
5175
|
+
}
|
|
5176
|
+
async function serveBun(runConfig, app) {
|
|
5177
|
+
const honoBunModule = "hono/bun";
|
|
5178
|
+
let createBunWebSocket;
|
|
5179
|
+
try {
|
|
5180
|
+
const dep = await Promise.resolve().then(() => _interopRequireWildcard(require(
|
|
5181
|
+
/* webpackIgnore: true */
|
|
5182
|
+
honoBunModule
|
|
5183
|
+
)));
|
|
5184
|
+
createBunWebSocket = dep.createBunWebSocket;
|
|
5185
|
+
} catch (err) {
|
|
5186
|
+
logger7().error({
|
|
5187
|
+
msg: "failed to import hono/bun",
|
|
5188
|
+
error: _chunkTVEQLM3Zcjs.stringifyError.call(void 0, err)
|
|
5189
|
+
});
|
|
5190
|
+
process.exit(1);
|
|
5191
|
+
}
|
|
5192
|
+
const { websocket, upgradeWebSocket } = createBunWebSocket();
|
|
5193
|
+
const port = runConfig.defaultServerPort;
|
|
5194
|
+
Bun.serve({
|
|
5195
|
+
fetch: app.fetch,
|
|
5196
|
+
port,
|
|
5197
|
+
websocket
|
|
5198
|
+
});
|
|
5199
|
+
logger7().info({ msg: "server listening", port });
|
|
5200
|
+
return { upgradeWebSocket };
|
|
5201
|
+
}
|
|
5134
5202
|
|
|
5135
5203
|
// src/registry/mod.ts
|
|
5136
5204
|
var Registry = class {
|
|
@@ -5146,7 +5214,7 @@ var Registry = class {
|
|
|
5146
5214
|
*/
|
|
5147
5215
|
start(inputConfig) {
|
|
5148
5216
|
var _a, _b, _c;
|
|
5149
|
-
const config4 =
|
|
5217
|
+
const config4 = _chunk3KQGFKFWcjs.RunnerConfigSchema.parse(inputConfig);
|
|
5150
5218
|
if (config4.autoConfigureServerless && config4.runnerKind !== "serverless") {
|
|
5151
5219
|
throw new Error(
|
|
5152
5220
|
"autoConfigureServerless can only be configured when runnerKind is 'serverless'"
|
|
@@ -5184,9 +5252,9 @@ var Registry = class {
|
|
|
5184
5252
|
config4.disableActorDriver = true;
|
|
5185
5253
|
}
|
|
5186
5254
|
if ((_a = config4.logging) == null ? void 0 : _a.baseLogger) {
|
|
5187
|
-
|
|
5255
|
+
_chunkTVEQLM3Zcjs.configureBaseLogger.call(void 0, config4.logging.baseLogger);
|
|
5188
5256
|
} else {
|
|
5189
|
-
|
|
5257
|
+
_chunkTVEQLM3Zcjs.configureDefaultLogger.call(void 0, (_b = config4.logging) == null ? void 0 : _b.level);
|
|
5190
5258
|
}
|
|
5191
5259
|
const driver = chooseDefaultDriver(config4);
|
|
5192
5260
|
if (driver.name === "engine") {
|
|
@@ -5206,8 +5274,8 @@ var Registry = class {
|
|
|
5206
5274
|
config4.getUpgradeWebSocket = () => upgradeWebSocket;
|
|
5207
5275
|
}
|
|
5208
5276
|
const managerDriver = driver.manager(this.#config, config4);
|
|
5209
|
-
|
|
5210
|
-
const client =
|
|
5277
|
+
_chunk3WHB4MCAcjs.configureInspectorAccessToken.call(void 0, config4, managerDriver);
|
|
5278
|
+
const client = _chunkPDX7CZSQcjs.createClientWithDriver.call(void 0, managerDriver, config4);
|
|
5211
5279
|
const driverLog = _nullishCoalesce(((_c = managerDriver.extraStartupLog) == null ? void 0 : _c.call(managerDriver)), () => ( {}));
|
|
5212
5280
|
logger7().info({
|
|
5213
5281
|
msg: "rivetkit ready",
|
|
@@ -5215,18 +5283,18 @@ var Registry = class {
|
|
|
5215
5283
|
definitions: Object.keys(this.#config.use).length,
|
|
5216
5284
|
...driverLog
|
|
5217
5285
|
});
|
|
5218
|
-
if (
|
|
5286
|
+
if (_chunk3WHB4MCAcjs.isInspectorEnabled.call(void 0, config4, "manager") && managerDriver.inspector) {
|
|
5219
5287
|
logger7().info({
|
|
5220
5288
|
msg: "inspector ready",
|
|
5221
|
-
url:
|
|
5289
|
+
url: _chunk3WHB4MCAcjs.getInspectorUrl.call(void 0, config4)
|
|
5222
5290
|
});
|
|
5223
5291
|
}
|
|
5224
5292
|
if (!config4.noWelcome) {
|
|
5225
5293
|
const displayInfo = managerDriver.displayInformation();
|
|
5226
5294
|
console.log();
|
|
5227
|
-
console.log(` RivetKit ${
|
|
5295
|
+
console.log(` RivetKit ${_chunkTVEQLM3Zcjs.package_default.version} (${displayInfo.name})`);
|
|
5228
5296
|
if (!config4.disableDefaultServer) {
|
|
5229
|
-
console.log(` - Endpoint: ${
|
|
5297
|
+
console.log(` - Endpoint: ${_chunkPDX7CZSQcjs.getEndpoint.call(void 0, config4)}`);
|
|
5230
5298
|
} else if (config4.overrideServerAddress) {
|
|
5231
5299
|
console.log(
|
|
5232
5300
|
` - Endpoint: ${config4.overrideServerAddress}`
|
|
@@ -5240,8 +5308,8 @@ var Registry = class {
|
|
|
5240
5308
|
const padding = " ".repeat(Math.max(0, 13 - k.length));
|
|
5241
5309
|
console.log(` - ${k}:${padding}${v}`);
|
|
5242
5310
|
}
|
|
5243
|
-
if (
|
|
5244
|
-
console.log(` - Inspector: ${
|
|
5311
|
+
if (_chunk3WHB4MCAcjs.isInspectorEnabled.call(void 0, config4, "manager") && managerDriver.inspector) {
|
|
5312
|
+
console.log(` - Inspector: ${_chunk3WHB4MCAcjs.getInspectorUrl.call(void 0, config4)}`);
|
|
5245
5313
|
}
|
|
5246
5314
|
console.log();
|
|
5247
5315
|
}
|
|
@@ -5310,7 +5378,7 @@ async function configureServerlessRunner(config4) {
|
|
|
5310
5378
|
msg: "fetching datacenters",
|
|
5311
5379
|
endpoint: config4.endpoint
|
|
5312
5380
|
});
|
|
5313
|
-
const dcsRes = await
|
|
5381
|
+
const dcsRes = await _chunkPDX7CZSQcjs.getDatacenters.call(void 0, clientConfig);
|
|
5314
5382
|
logger7().debug({
|
|
5315
5383
|
msg: "configuring serverless runner",
|
|
5316
5384
|
runnerName: config4.runnerName,
|
|
@@ -5328,7 +5396,7 @@ async function configureServerlessRunner(config4) {
|
|
|
5328
5396
|
},
|
|
5329
5397
|
metadata: _nullishCoalesce(customConfig.metadata, () => ( {}))
|
|
5330
5398
|
};
|
|
5331
|
-
await
|
|
5399
|
+
await _chunkPDX7CZSQcjs.updateRunnerConfig.call(void 0, clientConfig, config4.runnerName, {
|
|
5332
5400
|
datacenters: Object.fromEntries(
|
|
5333
5401
|
dcsRes.datacenters.map((dc) => [dc.name, serverlessConfig])
|
|
5334
5402
|
)
|
|
@@ -5365,4 +5433,4 @@ function setup(input) {
|
|
|
5365
5433
|
|
|
5366
5434
|
exports.RegistryConfigSchema = RegistryConfigSchema; exports.routeWebSocket = routeWebSocket; exports.createActorRouter = createActorRouter; exports.actor = actor; exports.InlineWebSocketAdapter = InlineWebSocketAdapter; exports.createEngineDriver = createEngineDriver; exports.createFileSystemOrMemoryDriver = createFileSystemOrMemoryDriver; exports.createFileSystemDriver = createFileSystemDriver; exports.createMemoryDriver = createMemoryDriver; exports.createManagerRouter = createManagerRouter; exports.Registry = Registry; exports.setup = setup;
|
|
5367
5435
|
//! These configs configs hold anything that's not platform-specific about running actors.
|
|
5368
|
-
//# sourceMappingURL=chunk-
|
|
5436
|
+
//# sourceMappingURL=chunk-ERWP3EZZ.cjs.map
|