rivetkit 2.0.28 → 2.0.29
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/actor/errors.cjs +2 -2
- package/dist/tsup/actor/errors.js +1 -1
- package/dist/tsup/{chunk-EJXISR3H.js → chunk-2LOXTB3G.js} +3 -3
- package/dist/tsup/{chunk-Y2AKEZRY.cjs → chunk-3RJG3PC3.cjs} +3 -3
- package/dist/tsup/{chunk-Y2AKEZRY.cjs.map → chunk-3RJG3PC3.cjs.map} +1 -1
- package/dist/tsup/{chunk-DATRTJVZ.js → chunk-5IE76QRF.js} +3 -3
- package/dist/tsup/{chunk-NR2N4UA2.cjs → chunk-72P7NQS4.cjs} +10 -10
- package/dist/tsup/{chunk-NR2N4UA2.cjs.map → chunk-72P7NQS4.cjs.map} +1 -1
- package/dist/tsup/{chunk-3ZC6SBX6.cjs → chunk-7DSWCOGX.cjs} +183 -182
- package/dist/tsup/chunk-7DSWCOGX.cjs.map +1 -0
- package/dist/tsup/{chunk-M54KFQQP.cjs → chunk-7XZX3T4D.cjs} +8 -8
- package/dist/tsup/{chunk-M54KFQQP.cjs.map → chunk-7XZX3T4D.cjs.map} +1 -1
- package/dist/tsup/{chunk-AE7BB3M2.js → chunk-EWQE7L3V.js} +2 -2
- package/dist/tsup/{chunk-KXSSOVFA.js → chunk-FBPZAU3N.js} +80 -15
- package/dist/tsup/chunk-FBPZAU3N.js.map +1 -0
- package/dist/tsup/{chunk-ZL3SUOIM.js → chunk-H27UUFLD.js} +9 -9
- package/dist/tsup/{chunk-Y5LN2XRH.cjs → chunk-HK6QNZX3.cjs} +8 -8
- package/dist/tsup/{chunk-Y5LN2XRH.cjs.map → chunk-HK6QNZX3.cjs.map} +1 -1
- package/dist/tsup/{chunk-ILK4JEMF.js → chunk-KMOA3GQ2.js} +2 -2
- package/dist/tsup/{chunk-XJMYGATE.cjs → chunk-MAQSR26X.cjs} +8 -3
- package/dist/tsup/chunk-MAQSR26X.cjs.map +1 -0
- package/dist/tsup/{chunk-CJLXW36F.cjs → chunk-MZ3SRIPM.cjs} +286 -221
- package/dist/tsup/chunk-MZ3SRIPM.cjs.map +1 -0
- package/dist/tsup/{chunk-NQZ643FB.cjs → chunk-MZCRC64W.cjs} +17 -17
- package/dist/tsup/{chunk-NQZ643FB.cjs.map → chunk-MZCRC64W.cjs.map} +1 -1
- package/dist/tsup/{chunk-LQOCWGP6.js → chunk-P2RZJPYI.js} +1 -1
- package/dist/tsup/{chunk-IDYDUETM.js → chunk-POJ4HHIO.js} +3 -3
- package/dist/tsup/chunk-POJ4HHIO.js.map +1 -0
- package/dist/tsup/{chunk-JALGQWHW.cjs → chunk-QB7FJ2OK.cjs} +15 -15
- package/dist/tsup/{chunk-JALGQWHW.cjs.map → chunk-QB7FJ2OK.cjs.map} +1 -1
- package/dist/tsup/{chunk-VQRYS6VW.cjs → chunk-UBBTSSAP.cjs} +3 -3
- package/dist/tsup/{chunk-VQRYS6VW.cjs.map → chunk-UBBTSSAP.cjs.map} +1 -1
- package/dist/tsup/{chunk-YW2E3UPH.cjs → chunk-UENID7AK.cjs} +6 -6
- package/dist/tsup/chunk-UENID7AK.cjs.map +1 -0
- package/dist/tsup/{chunk-7IAEY5UZ.js → chunk-UJ6ETM45.js} +2 -2
- package/dist/tsup/{chunk-S5URQ3CI.js → chunk-WXLDDJCI.js} +3 -3
- package/dist/tsup/{chunk-S5URQ3CI.js.map → chunk-WXLDDJCI.js.map} +1 -1
- package/dist/tsup/{chunk-AHPMXTSB.js → chunk-YPHTAWZP.js} +16 -16
- package/dist/tsup/chunk-YPHTAWZP.js.map +1 -0
- package/dist/tsup/client/mod.cjs +9 -9
- package/dist/tsup/client/mod.d.cts +2 -2
- package/dist/tsup/client/mod.d.ts +2 -2
- package/dist/tsup/client/mod.js +8 -8
- package/dist/tsup/common/log.cjs +3 -3
- package/dist/tsup/common/log.js +2 -2
- package/dist/tsup/common/websocket.cjs +4 -4
- package/dist/tsup/common/websocket.js +3 -3
- package/dist/tsup/{config-DxlmiJS1.d.cts → config-BEu-kmmR.d.cts} +32 -1
- package/dist/tsup/{config-CcMdKDv9.d.ts → config-DELCUYts.d.ts} +32 -1
- package/dist/tsup/driver-helpers/mod.cjs +5 -5
- 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 +4 -4
- package/dist/tsup/driver-test-suite/mod.cjs +192 -74
- package/dist/tsup/driver-test-suite/mod.cjs.map +1 -1
- 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 +135 -17
- package/dist/tsup/driver-test-suite/mod.js.map +1 -1
- package/dist/tsup/inspector/mod.cjs +6 -6
- package/dist/tsup/inspector/mod.d.cts +2 -2
- package/dist/tsup/inspector/mod.d.ts +2 -2
- package/dist/tsup/inspector/mod.js +5 -5
- package/dist/tsup/mod.cjs +10 -10
- package/dist/tsup/mod.cjs.map +1 -1
- package/dist/tsup/mod.d.cts +2 -2
- package/dist/tsup/mod.d.ts +2 -2
- package/dist/tsup/mod.js +9 -9
- package/dist/tsup/test/mod.cjs +12 -12
- package/dist/tsup/test/mod.d.cts +1 -1
- package/dist/tsup/test/mod.d.ts +1 -1
- package/dist/tsup/test/mod.js +11 -11
- package/dist/tsup/utils.cjs +3 -3
- package/dist/tsup/utils.js +2 -2
- package/package.json +2 -2
- package/src/actor/mod.ts +2 -0
- package/src/client/actor-conn.ts +87 -0
- package/src/client/mod.ts +5 -1
- package/src/driver-test-suite/tests/actor-conn.ts +199 -0
- package/dist/tsup/chunk-3ZC6SBX6.cjs.map +0 -1
- package/dist/tsup/chunk-AHPMXTSB.js.map +0 -1
- package/dist/tsup/chunk-CJLXW36F.cjs.map +0 -1
- package/dist/tsup/chunk-IDYDUETM.js.map +0 -1
- package/dist/tsup/chunk-KXSSOVFA.js.map +0 -1
- package/dist/tsup/chunk-XJMYGATE.cjs.map +0 -1
- package/dist/tsup/chunk-YW2E3UPH.cjs.map +0 -1
- /package/dist/tsup/{chunk-EJXISR3H.js.map → chunk-2LOXTB3G.js.map} +0 -0
- /package/dist/tsup/{chunk-DATRTJVZ.js.map → chunk-5IE76QRF.js.map} +0 -0
- /package/dist/tsup/{chunk-AE7BB3M2.js.map → chunk-EWQE7L3V.js.map} +0 -0
- /package/dist/tsup/{chunk-ZL3SUOIM.js.map → chunk-H27UUFLD.js.map} +0 -0
- /package/dist/tsup/{chunk-ILK4JEMF.js.map → chunk-KMOA3GQ2.js.map} +0 -0
- /package/dist/tsup/{chunk-LQOCWGP6.js.map → chunk-P2RZJPYI.js.map} +0 -0
- /package/dist/tsup/{chunk-7IAEY5UZ.js.map → chunk-UJ6ETM45.js.map} +0 -0
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var _chunkVQRYS6VWcjs = require('./chunk-VQRYS6VW.cjs');
|
|
8
7
|
|
|
9
8
|
|
|
10
9
|
|
|
@@ -23,22 +22,23 @@ var _chunkVQRYS6VWcjs = require('./chunk-VQRYS6VW.cjs');
|
|
|
23
22
|
|
|
24
23
|
|
|
25
24
|
|
|
25
|
+
var _chunkMZ3SRIPMcjs = require('./chunk-MZ3SRIPM.cjs');
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
31
|
+
var _chunkMZCRC64Wcjs = require('./chunk-MZCRC64W.cjs');
|
|
31
32
|
|
|
32
|
-
var _chunkCJLXW36Fcjs = require('./chunk-CJLXW36F.cjs');
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
var _chunkNR2N4UA2cjs = require('./chunk-NR2N4UA2.cjs');
|
|
36
35
|
|
|
37
36
|
|
|
38
37
|
|
|
38
|
+
var _chunkUBBTSSAPcjs = require('./chunk-UBBTSSAP.cjs');
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
var
|
|
41
|
+
var _chunk72P7NQS4cjs = require('./chunk-72P7NQS4.cjs');
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
|
|
@@ -60,7 +60,7 @@ var _chunkNQZ643FBcjs = require('./chunk-NQZ643FB.cjs');
|
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
|
|
63
|
-
var
|
|
63
|
+
var _chunk7XZX3T4Dcjs = require('./chunk-7XZX3T4D.cjs');
|
|
64
64
|
|
|
65
65
|
|
|
66
66
|
|
|
@@ -76,7 +76,7 @@ var _chunkM54KFQQPcjs = require('./chunk-M54KFQQP.cjs');
|
|
|
76
76
|
|
|
77
77
|
|
|
78
78
|
|
|
79
|
-
var
|
|
79
|
+
var _chunkHK6QNZX3cjs = require('./chunk-HK6QNZX3.cjs');
|
|
80
80
|
|
|
81
81
|
|
|
82
82
|
|
|
@@ -87,7 +87,8 @@ var _chunkY5LN2XRHcjs = require('./chunk-Y5LN2XRH.cjs');
|
|
|
87
87
|
|
|
88
88
|
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
|
|
91
|
+
var _chunkMAQSR26Xcjs = require('./chunk-MAQSR26X.cjs');
|
|
91
92
|
|
|
92
93
|
// src/actor/config.ts
|
|
93
94
|
var _zod = require('zod');
|
|
@@ -183,11 +184,11 @@ async function handleAction(c, _runConfig, actorDriver, actionName, actorId) {
|
|
|
183
184
|
const encoding = getRequestEncoding(c.req);
|
|
184
185
|
const parameters = getRequestConnParams(c.req);
|
|
185
186
|
const arrayBuffer = await c.req.arrayBuffer();
|
|
186
|
-
const request =
|
|
187
|
+
const request = _chunk7XZX3T4Dcjs.deserializeWithEncoding.call(void 0,
|
|
187
188
|
encoding,
|
|
188
189
|
new Uint8Array(arrayBuffer),
|
|
189
|
-
|
|
190
|
-
|
|
190
|
+
_chunkMZ3SRIPMcjs.HTTP_ACTION_REQUEST_VERSIONED,
|
|
191
|
+
_chunkMZ3SRIPMcjs.HttpActionRequestSchema,
|
|
191
192
|
// JSON: args is already the decoded value (raw object/array)
|
|
192
193
|
(json) => json.args,
|
|
193
194
|
// BARE/CBOR: args is ArrayBuffer that needs CBOR-decoding
|
|
@@ -201,34 +202,34 @@ async function handleAction(c, _runConfig, actorDriver, actionName, actorId) {
|
|
|
201
202
|
actor2 = await actorDriver.loadActor(actorId);
|
|
202
203
|
actor2.rLog.debug({ msg: "handling action", actionName, encoding });
|
|
203
204
|
conn = await actor2.connectionManager.prepareAndConnectConn(
|
|
204
|
-
|
|
205
|
+
_chunkMZ3SRIPMcjs.createHttpDriver.call(void 0, ),
|
|
205
206
|
parameters,
|
|
206
207
|
c.req.raw,
|
|
207
208
|
c.req.path,
|
|
208
209
|
c.req.header()
|
|
209
210
|
);
|
|
210
|
-
const ctx = new (0,
|
|
211
|
+
const ctx = new (0, _chunkMZ3SRIPMcjs.ActionContext)(actor2, conn);
|
|
211
212
|
output = await actor2.executeAction(ctx, actionName, actionArgs);
|
|
212
213
|
} finally {
|
|
213
214
|
if (conn) {
|
|
214
215
|
conn.disconnect();
|
|
215
216
|
}
|
|
216
217
|
}
|
|
217
|
-
const serialized =
|
|
218
|
+
const serialized = _chunk7XZX3T4Dcjs.serializeWithEncoding.call(void 0,
|
|
218
219
|
encoding,
|
|
219
220
|
output,
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
221
|
+
_chunkMZ3SRIPMcjs.HTTP_ACTION_RESPONSE_VERSIONED,
|
|
222
|
+
_chunkMZ3SRIPMcjs.CURRENT_VERSION,
|
|
223
|
+
_chunkMZ3SRIPMcjs.HttpActionResponseSchema,
|
|
223
224
|
// JSON: output is the raw value (will be serialized by jsonStringifyCompat)
|
|
224
225
|
(value) => ({ output: value }),
|
|
225
226
|
// BARE/CBOR: output needs to be CBOR-encoded to ArrayBuffer
|
|
226
227
|
(value) => ({
|
|
227
|
-
output:
|
|
228
|
+
output: _chunkHK6QNZX3cjs.bufferToArrayBuffer.call(void 0, cbor.encode(value))
|
|
228
229
|
})
|
|
229
230
|
);
|
|
230
231
|
return c.body(serialized, 200, {
|
|
231
|
-
"Content-Type":
|
|
232
|
+
"Content-Type": _chunk7XZX3T4Dcjs.contentTypeForEncoding.call(void 0, encoding)
|
|
232
233
|
});
|
|
233
234
|
}
|
|
234
235
|
async function handleRawRequest(c, req, actorDriver, actorId) {
|
|
@@ -252,13 +253,13 @@ async function handleRawRequest(c, req, actorDriver, actorId) {
|
|
|
252
253
|
}
|
|
253
254
|
}
|
|
254
255
|
function getRequestEncoding(req) {
|
|
255
|
-
const encodingParam = req.header(
|
|
256
|
+
const encodingParam = req.header(_chunk7XZX3T4Dcjs.HEADER_ENCODING);
|
|
256
257
|
if (!encodingParam) {
|
|
257
258
|
return "json";
|
|
258
259
|
}
|
|
259
|
-
const result =
|
|
260
|
+
const result = _chunk7XZX3T4Dcjs.EncodingSchema.safeParse(encodingParam);
|
|
260
261
|
if (!result.success) {
|
|
261
|
-
throw new (0,
|
|
262
|
+
throw new (0, _chunkMAQSR26Xcjs.InvalidEncoding)(encodingParam);
|
|
262
263
|
}
|
|
263
264
|
return result.data;
|
|
264
265
|
}
|
|
@@ -266,15 +267,15 @@ function getRequestExposeInternalError(_req) {
|
|
|
266
267
|
return false;
|
|
267
268
|
}
|
|
268
269
|
function getRequestConnParams(req) {
|
|
269
|
-
const paramsParam = req.header(
|
|
270
|
+
const paramsParam = req.header(_chunk7XZX3T4Dcjs.HEADER_CONN_PARAMS);
|
|
270
271
|
if (!paramsParam) {
|
|
271
272
|
return null;
|
|
272
273
|
}
|
|
273
274
|
try {
|
|
274
275
|
return JSON.parse(paramsParam);
|
|
275
276
|
} catch (err) {
|
|
276
|
-
throw new (0,
|
|
277
|
-
`Invalid params JSON: ${
|
|
277
|
+
throw new (0, _chunkMAQSR26Xcjs.InvalidParams)(
|
|
278
|
+
`Invalid params JSON: ${_chunkHK6QNZX3cjs.stringifyError.call(void 0, err)}`
|
|
278
279
|
);
|
|
279
280
|
}
|
|
280
281
|
}
|
|
@@ -308,7 +309,7 @@ function buildActorNames(registryConfig) {
|
|
|
308
309
|
|
|
309
310
|
// src/common/router.ts
|
|
310
311
|
function logger() {
|
|
311
|
-
return
|
|
312
|
+
return _chunkHK6QNZX3cjs.getLogger.call(void 0, "router");
|
|
312
313
|
}
|
|
313
314
|
function loggerMiddleware(logger8) {
|
|
314
315
|
return async (c, next) => {
|
|
@@ -326,7 +327,7 @@ function loggerMiddleware(logger8) {
|
|
|
326
327
|
reqSize: c.req.header("content-length"),
|
|
327
328
|
resSize: c.res.headers.get("content-length"),
|
|
328
329
|
userAgent: c.req.header("user-agent"),
|
|
329
|
-
...
|
|
330
|
+
..._chunkHK6QNZX3cjs.getEnvUniversal.call(void 0, "_RIVET_LOG_HEADERS") ? { allHeaders: JSON.stringify(c.req.header()) } : {}
|
|
330
331
|
});
|
|
331
332
|
};
|
|
332
333
|
}
|
|
@@ -335,7 +336,7 @@ function handleRouteNotFound(c) {
|
|
|
335
336
|
}
|
|
336
337
|
function handleRouteError(error, c) {
|
|
337
338
|
const exposeInternalError = getRequestExposeInternalError(c.req.raw);
|
|
338
|
-
const { statusCode, group, code, message, metadata } =
|
|
339
|
+
const { statusCode, group, code, message, metadata } = _chunkHK6QNZX3cjs.deconstructError.call(void 0,
|
|
339
340
|
error,
|
|
340
341
|
logger(),
|
|
341
342
|
{
|
|
@@ -351,12 +352,12 @@ function handleRouteError(error, c) {
|
|
|
351
352
|
encoding = "json";
|
|
352
353
|
}
|
|
353
354
|
const errorData = { group, code, message, metadata };
|
|
354
|
-
const output =
|
|
355
|
+
const output = _chunk7XZX3T4Dcjs.serializeWithEncoding.call(void 0,
|
|
355
356
|
encoding,
|
|
356
357
|
errorData,
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
358
|
+
_chunkMZ3SRIPMcjs.HTTP_RESPONSE_ERROR_VERSIONED,
|
|
359
|
+
_chunkMZ3SRIPMcjs.CURRENT_VERSION,
|
|
360
|
+
_chunkMZ3SRIPMcjs.HttpResponseErrorSchema,
|
|
360
361
|
// JSON: metadata is the raw value (will be serialized by jsonStringifyCompat)
|
|
361
362
|
(value) => ({
|
|
362
363
|
group: value.group,
|
|
@@ -369,7 +370,7 @@ function handleRouteError(error, c) {
|
|
|
369
370
|
group: value.group,
|
|
370
371
|
code: value.code,
|
|
371
372
|
message: value.message,
|
|
372
|
-
metadata: value.metadata ?
|
|
373
|
+
metadata: value.metadata ? _chunkHK6QNZX3cjs.bufferToArrayBuffer.call(void 0, cbor2.encode(value.metadata)) : null
|
|
373
374
|
})
|
|
374
375
|
);
|
|
375
376
|
return c.body(output, { status: statusCode });
|
|
@@ -377,7 +378,7 @@ function handleRouteError(error, c) {
|
|
|
377
378
|
function handleMetadataRequest(c, registryConfig, runConfig) {
|
|
378
379
|
const response = {
|
|
379
380
|
runtime: "rivetkit",
|
|
380
|
-
version:
|
|
381
|
+
version: _chunkHK6QNZX3cjs.VERSION,
|
|
381
382
|
runner: {
|
|
382
383
|
kind: runConfig.runnerKind === "serverless" ? { serverless: {} } : { normal: {} }
|
|
383
384
|
},
|
|
@@ -393,7 +394,7 @@ function handleHealthRequest(c) {
|
|
|
393
394
|
return c.json({
|
|
394
395
|
status: "ok",
|
|
395
396
|
runtime: "rivetkit",
|
|
396
|
-
version:
|
|
397
|
+
version: _chunkHK6QNZX3cjs.VERSION
|
|
397
398
|
});
|
|
398
399
|
}
|
|
399
400
|
|
|
@@ -410,7 +411,7 @@ function createRawWebSocketDriver(hibernatable, closePromise) {
|
|
|
410
411
|
// handle messages from the RivetKit protocol
|
|
411
412
|
disconnect: async (_actor, _conn, reason) => {
|
|
412
413
|
if (!websocket) {
|
|
413
|
-
|
|
414
|
+
_chunk7XZX3T4Dcjs.loggerWithoutContext.call(void 0, ).warn(
|
|
414
415
|
"disconnecting raw ws without websocket"
|
|
415
416
|
);
|
|
416
417
|
return;
|
|
@@ -436,7 +437,7 @@ function createRawWebSocketDriver(hibernatable, closePromise) {
|
|
|
436
437
|
|
|
437
438
|
// src/actor/conn/drivers/websocket.ts
|
|
438
439
|
function createWebSocketDriver(hibernatable, encoding, closePromise) {
|
|
439
|
-
|
|
440
|
+
_chunk7XZX3T4Dcjs.loggerWithoutContext.call(void 0, ).debug({
|
|
440
441
|
msg: "createWebSocketDriver creating driver",
|
|
441
442
|
hibernatable
|
|
442
443
|
});
|
|
@@ -501,7 +502,7 @@ function createWebSocketDriver(hibernatable, encoding, closePromise) {
|
|
|
501
502
|
},
|
|
502
503
|
disconnect: async (_actor, _conn, reason) => {
|
|
503
504
|
if (!websocket) {
|
|
504
|
-
|
|
505
|
+
_chunk7XZX3T4Dcjs.loggerWithoutContext.call(void 0, ).warn(
|
|
505
506
|
"disconnecting ws without websocket"
|
|
506
507
|
);
|
|
507
508
|
return;
|
|
@@ -536,10 +537,10 @@ async function routeWebSocket(request, requestPath, requestHeaders, runConfig, a
|
|
|
536
537
|
requestPath,
|
|
537
538
|
isHibernatable
|
|
538
539
|
});
|
|
539
|
-
const closePromiseResolvers =
|
|
540
|
+
const closePromiseResolvers = _chunkHK6QNZX3cjs.promiseWithResolvers.call(void 0, );
|
|
540
541
|
let handler;
|
|
541
542
|
let connDriver;
|
|
542
|
-
if (requestPath ===
|
|
543
|
+
if (requestPath === _chunk7XZX3T4Dcjs.PATH_CONNECT) {
|
|
543
544
|
const { driver, setWebSocket } = createWebSocketDriver(
|
|
544
545
|
isHibernatable ? { gatewayId, requestId } : void 0,
|
|
545
546
|
encoding,
|
|
@@ -547,14 +548,14 @@ async function routeWebSocket(request, requestPath, requestHeaders, runConfig, a
|
|
|
547
548
|
);
|
|
548
549
|
handler = handleWebSocketConnect.bind(void 0, setWebSocket);
|
|
549
550
|
connDriver = driver;
|
|
550
|
-
} else if (requestPath ===
|
|
551
|
+
} else if (requestPath === _chunk7XZX3T4Dcjs.PATH_WEBSOCKET_BASE || requestPath.startsWith(_chunk7XZX3T4Dcjs.PATH_WEBSOCKET_PREFIX)) {
|
|
551
552
|
const { driver, setWebSocket } = createRawWebSocketDriver(
|
|
552
553
|
isHibernatable ? { gatewayId, requestId } : void 0,
|
|
553
554
|
closePromiseResolvers.promise
|
|
554
555
|
);
|
|
555
556
|
handler = handleRawWebSocket.bind(void 0, setWebSocket);
|
|
556
557
|
connDriver = driver;
|
|
557
|
-
} else if (requestPath ===
|
|
558
|
+
} else if (requestPath === _chunk7XZX3T4Dcjs.PATH_INSPECTOR_CONNECT) {
|
|
558
559
|
return await handleWebSocketInspectorConnect();
|
|
559
560
|
} else {
|
|
560
561
|
throw `WebSocket Path Not Found: ${requestPath}`;
|
|
@@ -579,9 +580,9 @@ async function routeWebSocket(request, requestPath, requestHeaders, runConfig, a
|
|
|
579
580
|
exposeInternalError
|
|
580
581
|
});
|
|
581
582
|
} catch (error) {
|
|
582
|
-
const { group, code } =
|
|
583
|
+
const { group, code } = _chunkHK6QNZX3cjs.deconstructError.call(void 0,
|
|
583
584
|
error,
|
|
584
|
-
|
|
585
|
+
_chunk7XZX3T4Dcjs.loggerWithoutContext.call(void 0, ),
|
|
585
586
|
{},
|
|
586
587
|
exposeInternalError
|
|
587
588
|
);
|
|
@@ -626,12 +627,12 @@ async function handleWebSocketConnect(setWebSocket, {
|
|
|
626
627
|
onMessage: (evt, ws) => {
|
|
627
628
|
actor2.rLog.debug({ msg: "received message" });
|
|
628
629
|
const value = evt.data.valueOf();
|
|
629
|
-
|
|
630
|
+
_chunkMZ3SRIPMcjs.parseMessage.call(void 0, value, {
|
|
630
631
|
encoding,
|
|
631
632
|
maxIncomingMessageSize: runConfig.maxIncomingMessageSize
|
|
632
633
|
}).then((message) => {
|
|
633
634
|
actor2.processMessage(message, conn).catch((error) => {
|
|
634
|
-
const { code } =
|
|
635
|
+
const { code } = _chunkHK6QNZX3cjs.deconstructError.call(void 0,
|
|
635
636
|
error,
|
|
636
637
|
actor2.rLog,
|
|
637
638
|
{
|
|
@@ -642,7 +643,7 @@ async function handleWebSocketConnect(setWebSocket, {
|
|
|
642
643
|
ws.close(1011, code);
|
|
643
644
|
});
|
|
644
645
|
}).catch((error) => {
|
|
645
|
-
const { code } =
|
|
646
|
+
const { code } = _chunkHK6QNZX3cjs.deconstructError.call(void 0,
|
|
646
647
|
error,
|
|
647
648
|
actor2.rLog,
|
|
648
649
|
{
|
|
@@ -677,7 +678,7 @@ async function handleWebSocketConnect(setWebSocket, {
|
|
|
677
678
|
try {
|
|
678
679
|
actor2.rLog.warn({ msg: "websocket error" });
|
|
679
680
|
} catch (error) {
|
|
680
|
-
|
|
681
|
+
_chunkHK6QNZX3cjs.deconstructError.call(void 0,
|
|
681
682
|
error,
|
|
682
683
|
actor2.rLog,
|
|
683
684
|
{ wsEvent: "error" },
|
|
@@ -741,16 +742,16 @@ function parseWebSocketProtocols(protocols) {
|
|
|
741
742
|
if (protocols) {
|
|
742
743
|
const protocolList = protocols.split(",").map((p) => p.trim());
|
|
743
744
|
for (const protocol of protocolList) {
|
|
744
|
-
if (protocol.startsWith(
|
|
745
|
-
encodingRaw = protocol.substring(
|
|
746
|
-
} else if (protocol.startsWith(
|
|
745
|
+
if (protocol.startsWith(_chunk7XZX3T4Dcjs.WS_PROTOCOL_ENCODING)) {
|
|
746
|
+
encodingRaw = protocol.substring(_chunk7XZX3T4Dcjs.WS_PROTOCOL_ENCODING.length);
|
|
747
|
+
} else if (protocol.startsWith(_chunk7XZX3T4Dcjs.WS_PROTOCOL_CONN_PARAMS)) {
|
|
747
748
|
connParamsRaw = decodeURIComponent(
|
|
748
|
-
protocol.substring(
|
|
749
|
+
protocol.substring(_chunk7XZX3T4Dcjs.WS_PROTOCOL_CONN_PARAMS.length)
|
|
749
750
|
);
|
|
750
751
|
}
|
|
751
752
|
}
|
|
752
753
|
}
|
|
753
|
-
const encoding =
|
|
754
|
+
const encoding = _chunk7XZX3T4Dcjs.EncodingSchema.parse(encodingRaw);
|
|
754
755
|
const connParams = connParamsRaw ? JSON.parse(connParamsRaw) : void 0;
|
|
755
756
|
return { encoding, connParams };
|
|
756
757
|
}
|
|
@@ -766,7 +767,7 @@ function createActorRouter(runConfig, actorDriver, isTest) {
|
|
|
766
767
|
const router = new (0, _hono.Hono)({
|
|
767
768
|
strict: false
|
|
768
769
|
});
|
|
769
|
-
router.use("*", loggerMiddleware(
|
|
770
|
+
router.use("*", loggerMiddleware(_chunk7XZX3T4Dcjs.loggerWithoutContext.call(void 0, )));
|
|
770
771
|
router.use("*", async (c, next) => {
|
|
771
772
|
const actor2 = await actorDriver.loadActor(c.env.actorId);
|
|
772
773
|
actor2.beginHonoHttpRequest();
|
|
@@ -796,15 +797,15 @@ function createActorRouter(runConfig, actorDriver, isTest) {
|
|
|
796
797
|
if (!conn) {
|
|
797
798
|
return c.text(`Connection not found: ${connId}`, 404);
|
|
798
799
|
}
|
|
799
|
-
if ((_a = conn[
|
|
800
|
-
conn[
|
|
800
|
+
if ((_a = conn[_chunkMZ3SRIPMcjs.CONN_DRIVER_SYMBOL]) == null ? void 0 : _a.terminate) {
|
|
801
|
+
conn[_chunkMZ3SRIPMcjs.CONN_DRIVER_SYMBOL].terminate(actor2, conn);
|
|
801
802
|
}
|
|
802
803
|
return c.json({ success: true });
|
|
803
804
|
});
|
|
804
805
|
}
|
|
805
806
|
router.on(
|
|
806
807
|
"GET",
|
|
807
|
-
[
|
|
808
|
+
[_chunk7XZX3T4Dcjs.PATH_CONNECT, `${_chunk7XZX3T4Dcjs.PATH_WEBSOCKET_PREFIX}*`, _chunk7XZX3T4Dcjs.PATH_INSPECTOR_CONNECT],
|
|
808
809
|
async (c) => {
|
|
809
810
|
var _a;
|
|
810
811
|
const upgradeWebSocket = (_a = runConfig.getUpgradeWebSocket) == null ? void 0 : _a.call(runConfig);
|
|
@@ -826,7 +827,7 @@ function createActorRouter(runConfig, actorDriver, isTest) {
|
|
|
826
827
|
false,
|
|
827
828
|
false
|
|
828
829
|
);
|
|
829
|
-
})(c,
|
|
830
|
+
})(c, _chunkHK6QNZX3cjs.noopNext.call(void 0, ));
|
|
830
831
|
} else {
|
|
831
832
|
return c.text(
|
|
832
833
|
"WebSockets are not enabled for this driver.",
|
|
@@ -855,7 +856,7 @@ function createActorRouter(runConfig, actorDriver, isTest) {
|
|
|
855
856
|
body: c.req.raw.body,
|
|
856
857
|
duplex: "half"
|
|
857
858
|
});
|
|
858
|
-
|
|
859
|
+
_chunk7XZX3T4Dcjs.loggerWithoutContext.call(void 0, ).debug({
|
|
859
860
|
msg: "rewriting http url",
|
|
860
861
|
from: c.req.url,
|
|
861
862
|
to: correctedRequest.url
|
|
@@ -867,10 +868,10 @@ function createActorRouter(runConfig, actorDriver, isTest) {
|
|
|
867
868
|
c.env.actorId
|
|
868
869
|
);
|
|
869
870
|
});
|
|
870
|
-
if (
|
|
871
|
+
if (_chunkUBBTSSAPcjs.isInspectorEnabled.call(void 0, runConfig, "actor")) {
|
|
871
872
|
router.route(
|
|
872
873
|
"/inspect",
|
|
873
|
-
new (0, _hono.Hono)().use(
|
|
874
|
+
new (0, _hono.Hono)().use(_chunkUBBTSSAPcjs.secureInspector.call(void 0, runConfig), async (c, next) => {
|
|
874
875
|
const inspector = (await actorDriver.loadActor(c.env.actorId)).inspector;
|
|
875
876
|
_invariant2.default.call(void 0,
|
|
876
877
|
inspector,
|
|
@@ -878,7 +879,7 @@ function createActorRouter(runConfig, actorDriver, isTest) {
|
|
|
878
879
|
);
|
|
879
880
|
c.set("inspector", inspector);
|
|
880
881
|
return next();
|
|
881
|
-
}).route("/",
|
|
882
|
+
}).route("/", _chunkMZ3SRIPMcjs.createActorInspectorRouter.call(void 0, ))
|
|
882
883
|
);
|
|
883
884
|
}
|
|
884
885
|
router.notFound(handleRouteNotFound);
|
|
@@ -889,13 +890,13 @@ function createActorRouter(runConfig, actorDriver, isTest) {
|
|
|
889
890
|
// src/actor/mod.ts
|
|
890
891
|
function actor(input) {
|
|
891
892
|
const config4 = ActorConfigSchema.parse(input);
|
|
892
|
-
return new (0,
|
|
893
|
+
return new (0, _chunkMZ3SRIPMcjs.ActorDefinition)(config4);
|
|
893
894
|
}
|
|
894
895
|
|
|
895
896
|
// src/common/inline-websocket-adapter.ts
|
|
896
897
|
var _ws2 = require('hono/ws');
|
|
897
898
|
function logger2() {
|
|
898
|
-
return
|
|
899
|
+
return _chunkHK6QNZX3cjs.getLogger.call(void 0, "fake-event-source2");
|
|
899
900
|
}
|
|
900
901
|
var InlineWebSocketAdapter = (_class = class {
|
|
901
902
|
// WebSocket readyState values
|
|
@@ -1236,7 +1237,7 @@ var _streaming = require('hono/streaming');
|
|
|
1236
1237
|
|
|
1237
1238
|
// src/drivers/engine/log.ts
|
|
1238
1239
|
function logger3() {
|
|
1239
|
-
return
|
|
1240
|
+
return _chunkHK6QNZX3cjs.getLogger.call(void 0, "driver-engine");
|
|
1240
1241
|
}
|
|
1241
1242
|
|
|
1242
1243
|
// src/drivers/engine/actor-driver.ts
|
|
@@ -1254,8 +1255,8 @@ var EngineActorDriver = class {
|
|
|
1254
1255
|
#version = 1;
|
|
1255
1256
|
// Version for the runner protocol
|
|
1256
1257
|
#alarmTimeout;
|
|
1257
|
-
#runnerStarted =
|
|
1258
|
-
#runnerStopped =
|
|
1258
|
+
#runnerStarted = _chunkHK6QNZX3cjs.promiseWithResolvers.call(void 0, );
|
|
1259
|
+
#runnerStopped = _chunkHK6QNZX3cjs.promiseWithResolvers.call(void 0, );
|
|
1259
1260
|
#isRunnerStopped = false;
|
|
1260
1261
|
// HACK: Track actor stop intent locally since the runner protocol doesn't
|
|
1261
1262
|
// pass the stop reason to onActorStop. This will be fixed when the runner
|
|
@@ -1290,7 +1291,7 @@ var EngineActorDriver = class {
|
|
|
1290
1291
|
);
|
|
1291
1292
|
const engineRunnerConfig = {
|
|
1292
1293
|
version: this.#version,
|
|
1293
|
-
endpoint:
|
|
1294
|
+
endpoint: _chunkMZ3SRIPMcjs.getEndpoint.call(void 0, runConfig),
|
|
1294
1295
|
token,
|
|
1295
1296
|
namespace: runConfig.namespace,
|
|
1296
1297
|
totalSlots: runConfig.totalSlots,
|
|
@@ -1316,7 +1317,7 @@ var EngineActorDriver = class {
|
|
|
1316
1317
|
},
|
|
1317
1318
|
onActorStart: this.#runnerOnActorStart.bind(this),
|
|
1318
1319
|
onActorStop: this.#runnerOnActorStop.bind(this),
|
|
1319
|
-
logger:
|
|
1320
|
+
logger: _chunkHK6QNZX3cjs.getLogger.call(void 0, "engine-runner")
|
|
1320
1321
|
};
|
|
1321
1322
|
this.#runner = new (0, _enginerunner.Runner)(engineRunnerConfig);
|
|
1322
1323
|
this.#runner.start();
|
|
@@ -1347,7 +1348,7 @@ var EngineActorDriver = class {
|
|
|
1347
1348
|
this.#alarmTimeout = void 0;
|
|
1348
1349
|
}
|
|
1349
1350
|
const delay = Math.max(0, timestamp - Date.now());
|
|
1350
|
-
this.#alarmTimeout =
|
|
1351
|
+
this.#alarmTimeout = _chunkHK6QNZX3cjs.setLongTimeout.call(void 0, () => {
|
|
1351
1352
|
actor2.onAlarm();
|
|
1352
1353
|
this.#alarmTimeout = void 0;
|
|
1353
1354
|
}, delay);
|
|
@@ -1419,7 +1420,7 @@ var EngineActorDriver = class {
|
|
|
1419
1420
|
var _a;
|
|
1420
1421
|
(_a = handler.actor) == null ? void 0 : _a.rLog.error({
|
|
1421
1422
|
msg: "onStop errored",
|
|
1422
|
-
error:
|
|
1423
|
+
error: _chunkHK6QNZX3cjs.stringifyError.call(void 0, err)
|
|
1423
1424
|
});
|
|
1424
1425
|
})
|
|
1425
1426
|
);
|
|
@@ -1477,18 +1478,18 @@ var EngineActorDriver = class {
|
|
|
1477
1478
|
let handler = this.#actors.get(actorId);
|
|
1478
1479
|
if (!handler) {
|
|
1479
1480
|
handler = {
|
|
1480
|
-
actorStartPromise:
|
|
1481
|
+
actorStartPromise: _chunkHK6QNZX3cjs.promiseWithResolvers.call(void 0, )
|
|
1481
1482
|
};
|
|
1482
1483
|
this.#actors.set(actorId, handler);
|
|
1483
1484
|
}
|
|
1484
1485
|
const name = actorConfig.name;
|
|
1485
1486
|
_invariant2.default.call(void 0, actorConfig.key, "actor should have a key");
|
|
1486
|
-
const key =
|
|
1487
|
+
const key = _chunkMZ3SRIPMcjs.deserializeActorKey.call(void 0, actorConfig.key);
|
|
1487
1488
|
const [persistDataBuffer] = await this.#runner.kvGet(actorId, [
|
|
1488
|
-
|
|
1489
|
+
_chunkMZCRC64Wcjs.KEYS.PERSIST_DATA
|
|
1489
1490
|
]);
|
|
1490
1491
|
if (persistDataBuffer === null) {
|
|
1491
|
-
const initialKvState =
|
|
1492
|
+
const initialKvState = _chunkMZCRC64Wcjs.getInitialActorKvState.call(void 0, input);
|
|
1492
1493
|
await this.#runner.kvPut(actorId, initialKvState);
|
|
1493
1494
|
logger3().debug({
|
|
1494
1495
|
msg: "initialized persist data for new actor",
|
|
@@ -1501,7 +1502,7 @@ var EngineActorDriver = class {
|
|
|
1501
1502
|
dataSize: persistDataBuffer.byteLength
|
|
1502
1503
|
});
|
|
1503
1504
|
}
|
|
1504
|
-
const definition =
|
|
1505
|
+
const definition = _chunkMZ3SRIPMcjs.lookupInRegistry.call(void 0,
|
|
1505
1506
|
this.#registryConfig,
|
|
1506
1507
|
actorConfig.name
|
|
1507
1508
|
);
|
|
@@ -1528,7 +1529,7 @@ var EngineActorDriver = class {
|
|
|
1528
1529
|
} catch (err) {
|
|
1529
1530
|
logger3().error({
|
|
1530
1531
|
msg: "error in onStop, proceeding with removing actor",
|
|
1531
|
-
err:
|
|
1532
|
+
err: _chunkHK6QNZX3cjs.stringifyError.call(void 0, err)
|
|
1532
1533
|
});
|
|
1533
1534
|
}
|
|
1534
1535
|
this.#actors.delete(actorId);
|
|
@@ -1587,7 +1588,7 @@ var EngineActorDriver = class {
|
|
|
1587
1588
|
const wsContext = new (0, _ws2.WSContext)(websocket);
|
|
1588
1589
|
const conn = wsHandler.conn;
|
|
1589
1590
|
const actor2 = wsHandler.actor;
|
|
1590
|
-
const connStateManager = conn == null ? void 0 : conn[
|
|
1591
|
+
const connStateManager = conn == null ? void 0 : conn[_chunkMZ3SRIPMcjs.CONN_STATE_MANAGER_SYMBOL];
|
|
1591
1592
|
logger3().debug({
|
|
1592
1593
|
msg: "attaching websocket event listeners",
|
|
1593
1594
|
actorId,
|
|
@@ -1647,7 +1648,7 @@ var EngineActorDriver = class {
|
|
|
1647
1648
|
});
|
|
1648
1649
|
const entry = this.#hwsMessageIndex.get(conn.id);
|
|
1649
1650
|
if (entry) {
|
|
1650
|
-
const messageLength =
|
|
1651
|
+
const messageLength = _chunkMZ3SRIPMcjs.getValueLength.call(void 0, event.data);
|
|
1651
1652
|
entry.bufferedMessageSize += messageLength;
|
|
1652
1653
|
if (entry.bufferedMessageSize >= CONN_BUFFERED_MESSAGE_SIZE_THRESHOLD) {
|
|
1653
1654
|
entry.bufferedMessageSize = 0;
|
|
@@ -1718,10 +1719,10 @@ var EngineActorDriver = class {
|
|
|
1718
1719
|
gatewayId: _enginerunner.idToStr.call(void 0, gatewayId),
|
|
1719
1720
|
requestId: _enginerunner.idToStr.call(void 0, requestId)
|
|
1720
1721
|
});
|
|
1721
|
-
if (path ===
|
|
1722
|
+
if (path === _chunk7XZX3T4Dcjs.PATH_CONNECT) {
|
|
1722
1723
|
return true;
|
|
1723
|
-
} else if (path ===
|
|
1724
|
-
const definition =
|
|
1724
|
+
} else if (path === _chunk7XZX3T4Dcjs.PATH_WEBSOCKET_BASE || path.startsWith(_chunk7XZX3T4Dcjs.PATH_WEBSOCKET_PREFIX)) {
|
|
1725
|
+
const definition = _chunkMZ3SRIPMcjs.lookupInRegistry.call(void 0,
|
|
1725
1726
|
this.#registryConfig,
|
|
1726
1727
|
actorInstance.config.name
|
|
1727
1728
|
);
|
|
@@ -1749,7 +1750,7 @@ var EngineActorDriver = class {
|
|
|
1749
1750
|
} else {
|
|
1750
1751
|
return false;
|
|
1751
1752
|
}
|
|
1752
|
-
} else if (path ===
|
|
1753
|
+
} else if (path === _chunk7XZX3T4Dcjs.PATH_INSPECTOR_CONNECT) {
|
|
1753
1754
|
return false;
|
|
1754
1755
|
} else {
|
|
1755
1756
|
logger3().warn({
|
|
@@ -1762,7 +1763,7 @@ var EngineActorDriver = class {
|
|
|
1762
1763
|
async #hwsLoadAll(actorId) {
|
|
1763
1764
|
const actor2 = await this.loadActor(actorId);
|
|
1764
1765
|
return actor2.conns.values().map((conn) => {
|
|
1765
|
-
const connStateManager = conn[
|
|
1766
|
+
const connStateManager = conn[_chunkMZ3SRIPMcjs.CONN_STATE_MANAGER_SYMBOL];
|
|
1766
1767
|
const hibernatable = connStateManager.hibernatableData;
|
|
1767
1768
|
if (!hibernatable) return void 0;
|
|
1768
1769
|
return {
|
|
@@ -1785,7 +1786,7 @@ var EngineActorDriver = class {
|
|
|
1785
1786
|
await this.#runner.restoreHibernatingRequests(actor2.id, metaEntries);
|
|
1786
1787
|
}
|
|
1787
1788
|
onCreateConn(conn) {
|
|
1788
|
-
const hibernatable = conn[
|
|
1789
|
+
const hibernatable = conn[_chunkMZ3SRIPMcjs.CONN_STATE_MANAGER_SYMBOL].hibernatableData;
|
|
1789
1790
|
if (!hibernatable) return;
|
|
1790
1791
|
this.#hwsMessageIndex.set(conn.id, {
|
|
1791
1792
|
serverMessageIndex: hibernatable.serverMessageIndex,
|
|
@@ -1807,7 +1808,7 @@ var EngineActorDriver = class {
|
|
|
1807
1808
|
});
|
|
1808
1809
|
}
|
|
1809
1810
|
onBeforePersistConn(conn) {
|
|
1810
|
-
const stateManager = conn[
|
|
1811
|
+
const stateManager = conn[_chunkMZ3SRIPMcjs.CONN_STATE_MANAGER_SYMBOL];
|
|
1811
1812
|
const hibernatable = stateManager.hibernatableDataOrError();
|
|
1812
1813
|
const entry = this.#hwsMessageIndex.get(conn.id);
|
|
1813
1814
|
if (!entry) {
|
|
@@ -1821,7 +1822,7 @@ var EngineActorDriver = class {
|
|
|
1821
1822
|
entry.serverMessageIndex = hibernatable.serverMessageIndex;
|
|
1822
1823
|
}
|
|
1823
1824
|
onAfterPersistConn(conn) {
|
|
1824
|
-
const stateManager = conn[
|
|
1825
|
+
const stateManager = conn[_chunkMZ3SRIPMcjs.CONN_STATE_MANAGER_SYMBOL];
|
|
1825
1826
|
const hibernatable = stateManager.hibernatableDataOrError();
|
|
1826
1827
|
const entry = this.#hwsMessageIndex.get(conn.id);
|
|
1827
1828
|
if (!entry) {
|
|
@@ -1849,7 +1850,7 @@ function createEngineDriver() {
|
|
|
1849
1850
|
return {
|
|
1850
1851
|
name: "engine",
|
|
1851
1852
|
manager: (_registryConfig, runConfig) => {
|
|
1852
|
-
return new (0,
|
|
1853
|
+
return new (0, _chunkMZ3SRIPMcjs.RemoteManagerDriver)(runConfig);
|
|
1853
1854
|
},
|
|
1854
1855
|
actor: (registryConfig, runConfig, managerDriver, inlineClient) => {
|
|
1855
1856
|
return new EngineActorDriver(
|
|
@@ -1873,7 +1874,7 @@ var nodeChildProcess;
|
|
|
1873
1874
|
var nodeStream;
|
|
1874
1875
|
var hasImportedDependencies = false;
|
|
1875
1876
|
function getRequireFn() {
|
|
1876
|
-
return _module.createRequire.call(void 0,
|
|
1877
|
+
return _module.createRequire.call(void 0, _chunkMAQSR26Xcjs.importMetaUrl);
|
|
1877
1878
|
}
|
|
1878
1879
|
function importNodeDependencies() {
|
|
1879
1880
|
if (hasImportedDependencies) return;
|
|
@@ -2352,7 +2353,7 @@ var v1ToV2 = (v1State) => {
|
|
|
2352
2353
|
if (v1State.persistedData) {
|
|
2353
2354
|
const key = new Uint8Array([1]);
|
|
2354
2355
|
kvStorage.push({
|
|
2355
|
-
key:
|
|
2356
|
+
key: _chunkHK6QNZX3cjs.bufferToArrayBuffer.call(void 0, key),
|
|
2356
2357
|
value: v1State.persistedData
|
|
2357
2358
|
});
|
|
2358
2359
|
}
|
|
@@ -2458,7 +2459,7 @@ var ACTOR_ALARM_VERSIONED = _vbare.createVersionedDataHandler.call(void 0, {
|
|
|
2458
2459
|
|
|
2459
2460
|
// src/drivers/file-system/log.ts
|
|
2460
2461
|
function logger4() {
|
|
2461
|
-
return
|
|
2462
|
+
return _chunkHK6QNZX3cjs.getLogger.call(void 0, "driver-fs");
|
|
2462
2463
|
}
|
|
2463
2464
|
|
|
2464
2465
|
// src/drivers/file-system/utils.ts
|
|
@@ -2643,7 +2644,7 @@ var FileSystemGlobalState = class {
|
|
|
2643
2644
|
async createActor(actorId, name, key, input) {
|
|
2644
2645
|
const entry = this.#upsertEntry(actorId);
|
|
2645
2646
|
if (entry.state) {
|
|
2646
|
-
throw new (0,
|
|
2647
|
+
throw new (0, _chunkMAQSR26Xcjs.ActorDuplicateKey)(name, key);
|
|
2647
2648
|
}
|
|
2648
2649
|
if (this.isActorStopping(actorId)) {
|
|
2649
2650
|
throw new Error(`Actor ${actorId} is stopping`);
|
|
@@ -2653,11 +2654,11 @@ var FileSystemGlobalState = class {
|
|
|
2653
2654
|
entry.generation = crypto.randomUUID();
|
|
2654
2655
|
}
|
|
2655
2656
|
const kvStorage = [];
|
|
2656
|
-
const initialKvState =
|
|
2657
|
+
const initialKvState = _chunkMZCRC64Wcjs.getInitialActorKvState.call(void 0, input);
|
|
2657
2658
|
for (const [key2, value] of initialKvState) {
|
|
2658
2659
|
kvStorage.push({
|
|
2659
|
-
key:
|
|
2660
|
-
value:
|
|
2660
|
+
key: _chunkHK6QNZX3cjs.bufferToArrayBuffer.call(void 0, key2),
|
|
2661
|
+
value: _chunkHK6QNZX3cjs.bufferToArrayBuffer.call(void 0, value)
|
|
2661
2662
|
});
|
|
2662
2663
|
}
|
|
2663
2664
|
entry.state = {
|
|
@@ -2727,11 +2728,11 @@ var FileSystemGlobalState = class {
|
|
|
2727
2728
|
entry.generation = crypto.randomUUID();
|
|
2728
2729
|
}
|
|
2729
2730
|
const kvStorage = [];
|
|
2730
|
-
const initialKvState =
|
|
2731
|
+
const initialKvState = _chunkMZCRC64Wcjs.getInitialActorKvState.call(void 0, input);
|
|
2731
2732
|
for (const [key2, value] of initialKvState) {
|
|
2732
2733
|
kvStorage.push({
|
|
2733
|
-
key:
|
|
2734
|
-
value:
|
|
2734
|
+
key: _chunkHK6QNZX3cjs.bufferToArrayBuffer.call(void 0, key2),
|
|
2735
|
+
value: _chunkHK6QNZX3cjs.bufferToArrayBuffer.call(void 0, value)
|
|
2735
2736
|
});
|
|
2736
2737
|
}
|
|
2737
2738
|
entry.state = {
|
|
@@ -2810,7 +2811,7 @@ var FileSystemGlobalState = class {
|
|
|
2810
2811
|
logger4().error({
|
|
2811
2812
|
msg: "failed to delete actor state file",
|
|
2812
2813
|
actorId,
|
|
2813
|
-
error:
|
|
2814
|
+
error: _chunkHK6QNZX3cjs.stringifyError.call(void 0, err)
|
|
2814
2815
|
});
|
|
2815
2816
|
}
|
|
2816
2817
|
}
|
|
@@ -2824,7 +2825,7 @@ var FileSystemGlobalState = class {
|
|
|
2824
2825
|
logger4().error({
|
|
2825
2826
|
msg: "failed to delete actor database file",
|
|
2826
2827
|
actorId,
|
|
2827
|
-
error:
|
|
2828
|
+
error: _chunkHK6QNZX3cjs.stringifyError.call(void 0, err)
|
|
2828
2829
|
});
|
|
2829
2830
|
}
|
|
2830
2831
|
}
|
|
@@ -2838,7 +2839,7 @@ var FileSystemGlobalState = class {
|
|
|
2838
2839
|
logger4().error({
|
|
2839
2840
|
msg: "failed to delete actor alarm file",
|
|
2840
2841
|
actorId,
|
|
2841
|
-
error:
|
|
2842
|
+
error: _chunkHK6QNZX3cjs.stringifyError.call(void 0, err)
|
|
2842
2843
|
});
|
|
2843
2844
|
}
|
|
2844
2845
|
}
|
|
@@ -3016,9 +3017,9 @@ var FileSystemGlobalState = class {
|
|
|
3016
3017
|
if (entry.actor) {
|
|
3017
3018
|
return entry.actor;
|
|
3018
3019
|
}
|
|
3019
|
-
entry.startPromise =
|
|
3020
|
+
entry.startPromise = _chunkHK6QNZX3cjs.promiseWithResolvers.call(void 0, );
|
|
3020
3021
|
try {
|
|
3021
|
-
const definition =
|
|
3022
|
+
const definition = _chunkMZ3SRIPMcjs.lookupInRegistry.call(void 0,
|
|
3022
3023
|
registryConfig,
|
|
3023
3024
|
entry.state.name
|
|
3024
3025
|
);
|
|
@@ -3096,7 +3097,7 @@ var FileSystemGlobalState = class {
|
|
|
3096
3097
|
logger4().error({
|
|
3097
3098
|
msg: "failed to read alarm file",
|
|
3098
3099
|
file,
|
|
3099
|
-
error:
|
|
3100
|
+
error: _chunkHK6QNZX3cjs.stringifyError.call(void 0, err)
|
|
3100
3101
|
});
|
|
3101
3102
|
}
|
|
3102
3103
|
}
|
|
@@ -3126,7 +3127,7 @@ var FileSystemGlobalState = class {
|
|
|
3126
3127
|
(_a = entry.alarmTimeout) == null ? void 0 : _a.abort();
|
|
3127
3128
|
entry.alarmTimestamp = timestamp;
|
|
3128
3129
|
const delay = Math.max(0, timestamp - Date.now());
|
|
3129
|
-
entry.alarmTimeout =
|
|
3130
|
+
entry.alarmTimeout = _chunkHK6QNZX3cjs.setLongTimeout.call(void 0, async () => {
|
|
3130
3131
|
entry.alarmTimestamp = void 0;
|
|
3131
3132
|
if (this.#persist) {
|
|
3132
3133
|
try {
|
|
@@ -3137,7 +3138,7 @@ var FileSystemGlobalState = class {
|
|
|
3137
3138
|
logger4().debug({
|
|
3138
3139
|
msg: "failed to remove alarm file",
|
|
3139
3140
|
actorId,
|
|
3140
|
-
error:
|
|
3141
|
+
error: _chunkHK6QNZX3cjs.stringifyError.call(void 0, err)
|
|
3141
3142
|
});
|
|
3142
3143
|
}
|
|
3143
3144
|
}
|
|
@@ -3164,7 +3165,7 @@ var FileSystemGlobalState = class {
|
|
|
3164
3165
|
logger4().error({
|
|
3165
3166
|
msg: "failed to handle alarm",
|
|
3166
3167
|
actorId,
|
|
3167
|
-
error:
|
|
3168
|
+
error: _chunkHK6QNZX3cjs.stringifyError.call(void 0, err)
|
|
3168
3169
|
});
|
|
3169
3170
|
}
|
|
3170
3171
|
}, delay);
|
|
@@ -3176,7 +3177,7 @@ var FileSystemGlobalState = class {
|
|
|
3176
3177
|
if (fsSync.existsSync(tokenPath)) {
|
|
3177
3178
|
return fsSync.readFileSync(tokenPath, "utf-8");
|
|
3178
3179
|
}
|
|
3179
|
-
const newToken =
|
|
3180
|
+
const newToken = _chunk7XZX3T4Dcjs.generateRandomString.call(void 0, );
|
|
3180
3181
|
fsSync.writeFileSync(tokenPath, newToken);
|
|
3181
3182
|
return newToken;
|
|
3182
3183
|
}
|
|
@@ -3231,17 +3232,17 @@ var FileSystemGlobalState = class {
|
|
|
3231
3232
|
const newKvStorage = [...entry.state.kvStorage];
|
|
3232
3233
|
for (const [key, value] of entries) {
|
|
3233
3234
|
const existingIndex = newKvStorage.findIndex(
|
|
3234
|
-
(e) =>
|
|
3235
|
+
(e) => _chunkHK6QNZX3cjs.arrayBuffersEqual.call(void 0, e.key, _chunkHK6QNZX3cjs.bufferToArrayBuffer.call(void 0, key))
|
|
3235
3236
|
);
|
|
3236
3237
|
if (existingIndex >= 0) {
|
|
3237
3238
|
newKvStorage[existingIndex] = {
|
|
3238
|
-
key:
|
|
3239
|
-
value:
|
|
3239
|
+
key: _chunkHK6QNZX3cjs.bufferToArrayBuffer.call(void 0, key),
|
|
3240
|
+
value: _chunkHK6QNZX3cjs.bufferToArrayBuffer.call(void 0, value)
|
|
3240
3241
|
};
|
|
3241
3242
|
} else {
|
|
3242
3243
|
newKvStorage.push({
|
|
3243
|
-
key:
|
|
3244
|
-
value:
|
|
3244
|
+
key: _chunkHK6QNZX3cjs.bufferToArrayBuffer.call(void 0, key),
|
|
3245
|
+
value: _chunkHK6QNZX3cjs.bufferToArrayBuffer.call(void 0, value)
|
|
3245
3246
|
});
|
|
3246
3247
|
}
|
|
3247
3248
|
}
|
|
@@ -3266,7 +3267,7 @@ var FileSystemGlobalState = class {
|
|
|
3266
3267
|
const results = [];
|
|
3267
3268
|
for (const key of keys) {
|
|
3268
3269
|
const foundEntry = entry.state.kvStorage.find(
|
|
3269
|
-
(e) =>
|
|
3270
|
+
(e) => _chunkHK6QNZX3cjs.arrayBuffersEqual.call(void 0, e.key, _chunkHK6QNZX3cjs.bufferToArrayBuffer.call(void 0, key))
|
|
3270
3271
|
);
|
|
3271
3272
|
if (foundEntry) {
|
|
3272
3273
|
results.push(new Uint8Array(foundEntry.value));
|
|
@@ -3291,7 +3292,7 @@ var FileSystemGlobalState = class {
|
|
|
3291
3292
|
const newKvStorage = [...entry.state.kvStorage];
|
|
3292
3293
|
for (const key of keys) {
|
|
3293
3294
|
const indexToDelete = newKvStorage.findIndex(
|
|
3294
|
-
(e) =>
|
|
3295
|
+
(e) => _chunkHK6QNZX3cjs.arrayBuffersEqual.call(void 0, e.key, _chunkHK6QNZX3cjs.bufferToArrayBuffer.call(void 0, key))
|
|
3295
3296
|
);
|
|
3296
3297
|
if (indexToDelete >= 0) {
|
|
3297
3298
|
newKvStorage.splice(indexToDelete, 1);
|
|
@@ -3357,13 +3358,13 @@ function createManagerInspectorRouter() {
|
|
|
3357
3358
|
});
|
|
3358
3359
|
return c.json(actors, 200);
|
|
3359
3360
|
} catch (error) {
|
|
3360
|
-
|
|
3361
|
+
_chunkUBBTSSAPcjs.inspectorLogger.call(void 0, ).error({
|
|
3361
3362
|
msg: "Failed to fetch actors",
|
|
3362
3363
|
error
|
|
3363
3364
|
});
|
|
3364
3365
|
return c.json("Failed to fetch actors", 500);
|
|
3365
3366
|
}
|
|
3366
|
-
}).post("/actors", _standardvalidator.sValidator.call(void 0, "json",
|
|
3367
|
+
}).post("/actors", _standardvalidator.sValidator.call(void 0, "json", _chunk72P7NQS4cjs.CreateActorSchema), async (c) => {
|
|
3367
3368
|
const actor2 = await c.var.inspector.accessors.createActor(
|
|
3368
3369
|
c.req.valid("json")
|
|
3369
3370
|
);
|
|
@@ -3389,7 +3390,7 @@ var ManagerInspector = class {
|
|
|
3389
3390
|
|
|
3390
3391
|
constructor(accessors) {
|
|
3391
3392
|
this.accessors = accessors();
|
|
3392
|
-
|
|
3393
|
+
_chunkUBBTSSAPcjs.inspectorLogger.call(void 0, ).debug({ msg: "Manager Inspector enabled and ready" });
|
|
3393
3394
|
}
|
|
3394
3395
|
};
|
|
3395
3396
|
|
|
@@ -3470,9 +3471,9 @@ var FileSystemManagerDriver = class {
|
|
|
3470
3471
|
};
|
|
3471
3472
|
});
|
|
3472
3473
|
}
|
|
3473
|
-
const inlineClient =
|
|
3474
|
+
const inlineClient = _chunkMZ3SRIPMcjs.createClientWithDriver.call(void 0,
|
|
3474
3475
|
this,
|
|
3475
|
-
|
|
3476
|
+
_chunkMZCRC64Wcjs.ClientConfigSchema.parse({})
|
|
3476
3477
|
);
|
|
3477
3478
|
this.#actorDriver = this.#driverConfig.actor(
|
|
3478
3479
|
registryConfig,
|
|
@@ -3537,7 +3538,7 @@ var FileSystemManagerDriver = class {
|
|
|
3537
3538
|
false,
|
|
3538
3539
|
false
|
|
3539
3540
|
);
|
|
3540
|
-
return upgradeWebSocket(() => wsHandler)(c,
|
|
3541
|
+
return upgradeWebSocket(() => wsHandler)(c, _chunkHK6QNZX3cjs.noopNext.call(void 0, ));
|
|
3541
3542
|
}
|
|
3542
3543
|
async getForId({
|
|
3543
3544
|
actorId
|
|
@@ -3547,7 +3548,7 @@ var FileSystemManagerDriver = class {
|
|
|
3547
3548
|
return void 0;
|
|
3548
3549
|
}
|
|
3549
3550
|
if (this.#state.isActorStopping(actorId)) {
|
|
3550
|
-
throw new (0,
|
|
3551
|
+
throw new (0, _chunkMAQSR26Xcjs.ActorStopping)(actorId);
|
|
3551
3552
|
}
|
|
3552
3553
|
try {
|
|
3553
3554
|
return {
|
|
@@ -3691,7 +3692,7 @@ function createMemoryDriver() {
|
|
|
3691
3692
|
// src/drivers/default.ts
|
|
3692
3693
|
function chooseDefaultDriver(runConfig) {
|
|
3693
3694
|
if (runConfig.endpoint && runConfig.driver) {
|
|
3694
|
-
throw new (0,
|
|
3695
|
+
throw new (0, _chunkMAQSR26Xcjs.UserError)(
|
|
3695
3696
|
"Cannot specify both 'endpoint' and 'driver' in configuration"
|
|
3696
3697
|
);
|
|
3697
3698
|
}
|
|
@@ -3699,19 +3700,19 @@ function chooseDefaultDriver(runConfig) {
|
|
|
3699
3700
|
return runConfig.driver;
|
|
3700
3701
|
}
|
|
3701
3702
|
if (runConfig.endpoint || runConfig.token || runConfig.runnerKind === "serverless") {
|
|
3702
|
-
|
|
3703
|
+
_chunk7XZX3T4Dcjs.loggerWithoutContext.call(void 0, ).debug({
|
|
3703
3704
|
msg: "using rivet engine driver",
|
|
3704
3705
|
endpoint: runConfig.endpoint
|
|
3705
3706
|
});
|
|
3706
3707
|
return createEngineDriver();
|
|
3707
3708
|
}
|
|
3708
|
-
|
|
3709
|
+
_chunk7XZX3T4Dcjs.loggerWithoutContext.call(void 0, ).debug({ msg: "using default file system driver" });
|
|
3709
3710
|
return createFileSystemOrMemoryDriver(true);
|
|
3710
3711
|
}
|
|
3711
3712
|
|
|
3712
3713
|
// src/engine-process/log.ts
|
|
3713
3714
|
function logger5() {
|
|
3714
|
-
return
|
|
3715
|
+
return _chunkHK6QNZX3cjs.getLogger.call(void 0, "engine-process");
|
|
3715
3716
|
}
|
|
3716
3717
|
|
|
3717
3718
|
// src/engine-process/mod.ts
|
|
@@ -4112,7 +4113,7 @@ var ActorsListNamesResponseSchema = _zod.z.object({
|
|
|
4112
4113
|
|
|
4113
4114
|
// src/manager/log.ts
|
|
4114
4115
|
function logger6() {
|
|
4115
|
-
return
|
|
4116
|
+
return _chunkHK6QNZX3cjs.getLogger.call(void 0, "actor-manager");
|
|
4116
4117
|
}
|
|
4117
4118
|
|
|
4118
4119
|
// src/manager/gateway.ts
|
|
@@ -4120,7 +4121,7 @@ async function handleWebSocketGatewayPathBased(runConfig, managerDriver, c, acto
|
|
|
4120
4121
|
var _a;
|
|
4121
4122
|
const upgradeWebSocket = (_a = runConfig.getUpgradeWebSocket) == null ? void 0 : _a.call(runConfig);
|
|
4122
4123
|
if (!upgradeWebSocket) {
|
|
4123
|
-
throw new (0,
|
|
4124
|
+
throw new (0, _chunkMAQSR26Xcjs.WebSocketsNotEnabled)();
|
|
4124
4125
|
}
|
|
4125
4126
|
const protocols = c.req.header("sec-websocket-protocol");
|
|
4126
4127
|
let encodingRaw;
|
|
@@ -4128,11 +4129,11 @@ async function handleWebSocketGatewayPathBased(runConfig, managerDriver, c, acto
|
|
|
4128
4129
|
if (protocols) {
|
|
4129
4130
|
const protocolList = protocols.split(",").map((p) => p.trim());
|
|
4130
4131
|
for (const protocol of protocolList) {
|
|
4131
|
-
if (protocol.startsWith(
|
|
4132
|
-
encodingRaw = protocol.substring(
|
|
4133
|
-
} else if (protocol.startsWith(
|
|
4132
|
+
if (protocol.startsWith(_chunk7XZX3T4Dcjs.WS_PROTOCOL_ENCODING)) {
|
|
4133
|
+
encodingRaw = protocol.substring(_chunk7XZX3T4Dcjs.WS_PROTOCOL_ENCODING.length);
|
|
4134
|
+
} else if (protocol.startsWith(_chunk7XZX3T4Dcjs.WS_PROTOCOL_CONN_PARAMS)) {
|
|
4134
4135
|
connParamsRaw = decodeURIComponent(
|
|
4135
|
-
protocol.substring(
|
|
4136
|
+
protocol.substring(_chunk7XZX3T4Dcjs.WS_PROTOCOL_CONN_PARAMS.length)
|
|
4136
4137
|
);
|
|
4137
4138
|
}
|
|
4138
4139
|
}
|
|
@@ -4223,7 +4224,7 @@ async function handleWebSocketGateway(runConfig, managerDriver, c, strippedPath)
|
|
|
4223
4224
|
var _a;
|
|
4224
4225
|
const upgradeWebSocket = (_a = runConfig.getUpgradeWebSocket) == null ? void 0 : _a.call(runConfig);
|
|
4225
4226
|
if (!upgradeWebSocket) {
|
|
4226
|
-
throw new (0,
|
|
4227
|
+
throw new (0, _chunkMAQSR26Xcjs.WebSocketsNotEnabled)();
|
|
4227
4228
|
}
|
|
4228
4229
|
const protocols = c.req.header("sec-websocket-protocol");
|
|
4229
4230
|
let target;
|
|
@@ -4233,17 +4234,17 @@ async function handleWebSocketGateway(runConfig, managerDriver, c, strippedPath)
|
|
|
4233
4234
|
if (protocols) {
|
|
4234
4235
|
const protocolList = protocols.split(",").map((p) => p.trim());
|
|
4235
4236
|
for (const protocol of protocolList) {
|
|
4236
|
-
if (protocol.startsWith(
|
|
4237
|
-
target = protocol.substring(
|
|
4238
|
-
} else if (protocol.startsWith(
|
|
4237
|
+
if (protocol.startsWith(_chunk7XZX3T4Dcjs.WS_PROTOCOL_TARGET)) {
|
|
4238
|
+
target = protocol.substring(_chunk7XZX3T4Dcjs.WS_PROTOCOL_TARGET.length);
|
|
4239
|
+
} else if (protocol.startsWith(_chunk7XZX3T4Dcjs.WS_PROTOCOL_ACTOR)) {
|
|
4239
4240
|
actorId = decodeURIComponent(
|
|
4240
|
-
protocol.substring(
|
|
4241
|
+
protocol.substring(_chunk7XZX3T4Dcjs.WS_PROTOCOL_ACTOR.length)
|
|
4241
4242
|
);
|
|
4242
|
-
} else if (protocol.startsWith(
|
|
4243
|
-
encodingRaw = protocol.substring(
|
|
4244
|
-
} else if (protocol.startsWith(
|
|
4243
|
+
} else if (protocol.startsWith(_chunk7XZX3T4Dcjs.WS_PROTOCOL_ENCODING)) {
|
|
4244
|
+
encodingRaw = protocol.substring(_chunk7XZX3T4Dcjs.WS_PROTOCOL_ENCODING.length);
|
|
4245
|
+
} else if (protocol.startsWith(_chunk7XZX3T4Dcjs.WS_PROTOCOL_CONN_PARAMS)) {
|
|
4245
4246
|
connParamsRaw = decodeURIComponent(
|
|
4246
|
-
protocol.substring(
|
|
4247
|
+
protocol.substring(_chunk7XZX3T4Dcjs.WS_PROTOCOL_CONN_PARAMS.length)
|
|
4247
4248
|
);
|
|
4248
4249
|
}
|
|
4249
4250
|
}
|
|
@@ -4252,7 +4253,7 @@ async function handleWebSocketGateway(runConfig, managerDriver, c, strippedPath)
|
|
|
4252
4253
|
return c.text("WebSocket upgrade requires target.actor protocol", 400);
|
|
4253
4254
|
}
|
|
4254
4255
|
if (!actorId) {
|
|
4255
|
-
throw new (0,
|
|
4256
|
+
throw new (0, _chunkMAQSR26Xcjs.MissingActorHeader)();
|
|
4256
4257
|
}
|
|
4257
4258
|
logger6().debug({
|
|
4258
4259
|
msg: "proxying websocket to actor",
|
|
@@ -4273,13 +4274,13 @@ async function handleWebSocketGateway(runConfig, managerDriver, c, strippedPath)
|
|
|
4273
4274
|
);
|
|
4274
4275
|
}
|
|
4275
4276
|
async function handleHttpGateway(managerDriver, c, next, strippedPath) {
|
|
4276
|
-
const target = c.req.header(
|
|
4277
|
-
const actorId = c.req.header(
|
|
4277
|
+
const target = c.req.header(_chunk7XZX3T4Dcjs.HEADER_RIVET_TARGET);
|
|
4278
|
+
const actorId = c.req.header(_chunk7XZX3T4Dcjs.HEADER_RIVET_ACTOR);
|
|
4278
4279
|
if (target !== "actor") {
|
|
4279
4280
|
return next();
|
|
4280
4281
|
}
|
|
4281
4282
|
if (!actorId) {
|
|
4282
|
-
throw new (0,
|
|
4283
|
+
throw new (0, _chunkMAQSR26Xcjs.MissingActorHeader)();
|
|
4283
4284
|
}
|
|
4284
4285
|
logger6().debug({
|
|
4285
4286
|
msg: "proxying request to actor",
|
|
@@ -4288,8 +4289,8 @@ async function handleHttpGateway(managerDriver, c, next, strippedPath) {
|
|
|
4288
4289
|
method: c.req.method
|
|
4289
4290
|
});
|
|
4290
4291
|
const proxyHeaders = new Headers(c.req.raw.headers);
|
|
4291
|
-
proxyHeaders.delete(
|
|
4292
|
-
proxyHeaders.delete(
|
|
4292
|
+
proxyHeaders.delete(_chunk7XZX3T4Dcjs.HEADER_RIVET_TARGET);
|
|
4293
|
+
proxyHeaders.delete(_chunk7XZX3T4Dcjs.HEADER_RIVET_ACTOR);
|
|
4293
4294
|
const url = new URL(c.req.url);
|
|
4294
4295
|
const proxyUrl = new URL(`http://actor${strippedPath}${url.search}`);
|
|
4295
4296
|
const proxyRequest = new Request(proxyUrl, {
|
|
@@ -4383,7 +4384,7 @@ async function createTestWebSocketProxy(clientWsPromise) {
|
|
|
4383
4384
|
promise: serverWsPromise,
|
|
4384
4385
|
resolve: serverWsResolve,
|
|
4385
4386
|
reject: serverWsReject
|
|
4386
|
-
} =
|
|
4387
|
+
} = _chunkHK6QNZX3cjs.promiseWithResolvers.call(void 0, );
|
|
4387
4388
|
try {
|
|
4388
4389
|
logger6().debug({ msg: "awaiting client websocket promise" });
|
|
4389
4390
|
const ws = await clientWsPromise;
|
|
@@ -4632,7 +4633,7 @@ function createManagerRouter(registryConfig, runConfig, managerDriver, driverCon
|
|
|
4632
4633
|
} else if (runConfig.runnerKind === "normal") {
|
|
4633
4634
|
addManagerRoutes(registryConfig, runConfig, managerDriver, router);
|
|
4634
4635
|
} else {
|
|
4635
|
-
|
|
4636
|
+
_chunkHK6QNZX3cjs.assertUnreachable.call(void 0, runConfig.runnerKind);
|
|
4636
4637
|
}
|
|
4637
4638
|
router.notFound(handleRouteNotFound);
|
|
4638
4639
|
router.onError(handleRouteError);
|
|
@@ -4654,7 +4655,7 @@ function addServerlessRoutes(driverConfig, registryConfig, runConfig, managerDri
|
|
|
4654
4655
|
namespace: c.req.header("x-rivet-namespace-name")
|
|
4655
4656
|
});
|
|
4656
4657
|
if (!parseResult.success) {
|
|
4657
|
-
throw new (0,
|
|
4658
|
+
throw new (0, _chunkMAQSR26Xcjs.InvalidRequest)(
|
|
4658
4659
|
_nullishCoalesce(((_a = parseResult.error.issues[0]) == null ? void 0 : _a.message), () => ( "invalid serverless start headers"))
|
|
4659
4660
|
);
|
|
4660
4661
|
}
|
|
@@ -4699,13 +4700,13 @@ function addServerlessRoutes(driverConfig, registryConfig, runConfig, managerDri
|
|
|
4699
4700
|
}
|
|
4700
4701
|
function addManagerRoutes(registryConfig, runConfig, managerDriver, router) {
|
|
4701
4702
|
var _a;
|
|
4702
|
-
if (
|
|
4703
|
+
if (_chunkUBBTSSAPcjs.isInspectorEnabled.call(void 0, runConfig, "manager")) {
|
|
4703
4704
|
if (!managerDriver.inspector) {
|
|
4704
|
-
throw new (0,
|
|
4705
|
+
throw new (0, _chunkMAQSR26Xcjs.Unsupported)("inspector");
|
|
4705
4706
|
}
|
|
4706
4707
|
router.route(
|
|
4707
4708
|
"/inspect",
|
|
4708
|
-
new (0, _hono.Hono)().use(
|
|
4709
|
+
new (0, _hono.Hono)().use(_chunkUBBTSSAPcjs.secureInspector.call(void 0, runConfig)).use((c, next) => {
|
|
4709
4710
|
c.set("inspector", managerDriver.inspector);
|
|
4710
4711
|
return next();
|
|
4711
4712
|
}).route("/", createManagerInspectorRouter())
|
|
@@ -4921,7 +4922,7 @@ function addManagerRoutes(registryConfig, runConfig, managerDriver, router) {
|
|
|
4921
4922
|
);
|
|
4922
4923
|
response = { ok: output };
|
|
4923
4924
|
} catch (rawErr) {
|
|
4924
|
-
const err =
|
|
4925
|
+
const err = _chunkHK6QNZX3cjs.deconstructError.call(void 0, rawErr, logger6(), {}, true);
|
|
4925
4926
|
response = { err };
|
|
4926
4927
|
}
|
|
4927
4928
|
return c.body(cbor4.encode(response));
|
|
@@ -4941,21 +4942,21 @@ function addManagerRoutes(registryConfig, runConfig, managerDriver, router) {
|
|
|
4941
4942
|
let path = "";
|
|
4942
4943
|
let params;
|
|
4943
4944
|
for (const protocol of protocols) {
|
|
4944
|
-
if (protocol.startsWith(
|
|
4945
|
+
if (protocol.startsWith(_chunk7XZX3T4Dcjs.WS_PROTOCOL_ACTOR)) {
|
|
4945
4946
|
actorId = decodeURIComponent(
|
|
4946
|
-
protocol.substring(
|
|
4947
|
+
protocol.substring(_chunk7XZX3T4Dcjs.WS_PROTOCOL_ACTOR.length)
|
|
4947
4948
|
);
|
|
4948
|
-
} else if (protocol.startsWith(
|
|
4949
|
+
} else if (protocol.startsWith(_chunk7XZX3T4Dcjs.WS_PROTOCOL_ENCODING)) {
|
|
4949
4950
|
encoding = protocol.substring(
|
|
4950
|
-
|
|
4951
|
+
_chunk7XZX3T4Dcjs.WS_PROTOCOL_ENCODING.length
|
|
4951
4952
|
);
|
|
4952
|
-
} else if (protocol.startsWith(
|
|
4953
|
+
} else if (protocol.startsWith(_chunk7XZX3T4Dcjs.WS_TEST_PROTOCOL_PATH)) {
|
|
4953
4954
|
path = decodeURIComponent(
|
|
4954
|
-
protocol.substring(
|
|
4955
|
+
protocol.substring(_chunk7XZX3T4Dcjs.WS_TEST_PROTOCOL_PATH.length)
|
|
4955
4956
|
);
|
|
4956
|
-
} else if (protocol.startsWith(
|
|
4957
|
+
} else if (protocol.startsWith(_chunk7XZX3T4Dcjs.WS_PROTOCOL_CONN_PARAMS)) {
|
|
4957
4958
|
const paramsRaw = decodeURIComponent(
|
|
4958
|
-
protocol.substring(
|
|
4959
|
+
protocol.substring(_chunk7XZX3T4Dcjs.WS_PROTOCOL_CONN_PARAMS.length)
|
|
4959
4960
|
);
|
|
4960
4961
|
params = JSON.parse(paramsRaw);
|
|
4961
4962
|
}
|
|
@@ -4974,10 +4975,10 @@ function addManagerRoutes(registryConfig, runConfig, managerDriver, router) {
|
|
|
4974
4975
|
params
|
|
4975
4976
|
);
|
|
4976
4977
|
return await createTestWebSocketProxy(clientWsPromise);
|
|
4977
|
-
})(c,
|
|
4978
|
+
})(c, _chunkHK6QNZX3cjs.noopNext.call(void 0, ));
|
|
4978
4979
|
});
|
|
4979
4980
|
router.all(".test/inline-driver/send-request/*", async (c) => {
|
|
4980
|
-
const actorId = c.req.header(
|
|
4981
|
+
const actorId = c.req.header(_chunk7XZX3T4Dcjs.HEADER_ACTOR_ID);
|
|
4981
4982
|
if (!actorId) {
|
|
4982
4983
|
return c.text("Missing required headers", 400);
|
|
4983
4984
|
}
|
|
@@ -5004,9 +5005,9 @@ function addManagerRoutes(registryConfig, runConfig, managerDriver, router) {
|
|
|
5004
5005
|
} catch (error) {
|
|
5005
5006
|
logger6().error({
|
|
5006
5007
|
msg: "error in test inline raw http",
|
|
5007
|
-
error:
|
|
5008
|
+
error: _chunkHK6QNZX3cjs.stringifyError.call(void 0, error)
|
|
5008
5009
|
});
|
|
5009
|
-
const err =
|
|
5010
|
+
const err = _chunkHK6QNZX3cjs.deconstructError.call(void 0, error, logger6(), {}, true);
|
|
5010
5011
|
return c.json(
|
|
5011
5012
|
{
|
|
5012
5013
|
error: {
|
|
@@ -5051,7 +5052,7 @@ function addManagerRoutes(registryConfig, runConfig, managerDriver, router) {
|
|
|
5051
5052
|
} catch (error) {
|
|
5052
5053
|
logger6().error({
|
|
5053
5054
|
msg: "error forcing disconnect",
|
|
5054
|
-
error:
|
|
5055
|
+
error: _chunkHK6QNZX3cjs.stringifyError.call(void 0, error)
|
|
5055
5056
|
});
|
|
5056
5057
|
return c.text(`Error: ${error}`, 500);
|
|
5057
5058
|
}
|
|
@@ -5072,7 +5073,7 @@ function createApiActor(actor2, runnerName = "default") {
|
|
|
5072
5073
|
return {
|
|
5073
5074
|
actor_id: actor2.actorId,
|
|
5074
5075
|
name: actor2.name,
|
|
5075
|
-
key:
|
|
5076
|
+
key: _chunkMZ3SRIPMcjs.serializeActorKey.call(void 0, actor2.key),
|
|
5076
5077
|
namespace_id: "default",
|
|
5077
5078
|
// Assert default namespace
|
|
5078
5079
|
runner_name_selector: runnerName,
|
|
@@ -5086,7 +5087,7 @@ function createApiActor(actor2, runnerName = "default") {
|
|
|
5086
5087
|
|
|
5087
5088
|
// src/registry/log.ts
|
|
5088
5089
|
function logger7() {
|
|
5089
|
-
return
|
|
5090
|
+
return _chunkHK6QNZX3cjs.getLogger.call(void 0, "registry");
|
|
5090
5091
|
}
|
|
5091
5092
|
|
|
5092
5093
|
// src/registry/serve.ts
|
|
@@ -5145,7 +5146,7 @@ var Registry = class {
|
|
|
5145
5146
|
*/
|
|
5146
5147
|
start(inputConfig) {
|
|
5147
5148
|
var _a, _b, _c;
|
|
5148
|
-
const config4 =
|
|
5149
|
+
const config4 = _chunkMZCRC64Wcjs.RunnerConfigSchema.parse(inputConfig);
|
|
5149
5150
|
if (config4.autoConfigureServerless && config4.runnerKind !== "serverless") {
|
|
5150
5151
|
throw new Error(
|
|
5151
5152
|
"autoConfigureServerless can only be configured when runnerKind is 'serverless'"
|
|
@@ -5183,9 +5184,9 @@ var Registry = class {
|
|
|
5183
5184
|
config4.disableActorDriver = true;
|
|
5184
5185
|
}
|
|
5185
5186
|
if ((_a = config4.logging) == null ? void 0 : _a.baseLogger) {
|
|
5186
|
-
|
|
5187
|
+
_chunkHK6QNZX3cjs.configureBaseLogger.call(void 0, config4.logging.baseLogger);
|
|
5187
5188
|
} else {
|
|
5188
|
-
|
|
5189
|
+
_chunkHK6QNZX3cjs.configureDefaultLogger.call(void 0, (_b = config4.logging) == null ? void 0 : _b.level);
|
|
5189
5190
|
}
|
|
5190
5191
|
const driver = chooseDefaultDriver(config4);
|
|
5191
5192
|
if (driver.name === "engine") {
|
|
@@ -5205,8 +5206,8 @@ var Registry = class {
|
|
|
5205
5206
|
config4.getUpgradeWebSocket = () => upgradeWebSocket;
|
|
5206
5207
|
}
|
|
5207
5208
|
const managerDriver = driver.manager(this.#config, config4);
|
|
5208
|
-
|
|
5209
|
-
const client =
|
|
5209
|
+
_chunkUBBTSSAPcjs.configureInspectorAccessToken.call(void 0, config4, managerDriver);
|
|
5210
|
+
const client = _chunkMZ3SRIPMcjs.createClientWithDriver.call(void 0, managerDriver, config4);
|
|
5210
5211
|
const driverLog = _nullishCoalesce(((_c = managerDriver.extraStartupLog) == null ? void 0 : _c.call(managerDriver)), () => ( {}));
|
|
5211
5212
|
logger7().info({
|
|
5212
5213
|
msg: "rivetkit ready",
|
|
@@ -5214,18 +5215,18 @@ var Registry = class {
|
|
|
5214
5215
|
definitions: Object.keys(this.#config.use).length,
|
|
5215
5216
|
...driverLog
|
|
5216
5217
|
});
|
|
5217
|
-
if (
|
|
5218
|
+
if (_chunkUBBTSSAPcjs.isInspectorEnabled.call(void 0, config4, "manager") && managerDriver.inspector) {
|
|
5218
5219
|
logger7().info({
|
|
5219
5220
|
msg: "inspector ready",
|
|
5220
|
-
url:
|
|
5221
|
+
url: _chunkUBBTSSAPcjs.getInspectorUrl.call(void 0, config4)
|
|
5221
5222
|
});
|
|
5222
5223
|
}
|
|
5223
5224
|
if (!config4.noWelcome) {
|
|
5224
5225
|
const displayInfo = managerDriver.displayInformation();
|
|
5225
5226
|
console.log();
|
|
5226
|
-
console.log(` RivetKit ${
|
|
5227
|
+
console.log(` RivetKit ${_chunkHK6QNZX3cjs.package_default.version} (${displayInfo.name})`);
|
|
5227
5228
|
if (!config4.disableDefaultServer) {
|
|
5228
|
-
console.log(` - Endpoint: ${
|
|
5229
|
+
console.log(` - Endpoint: ${_chunkMZ3SRIPMcjs.getEndpoint.call(void 0, config4)}`);
|
|
5229
5230
|
} else if (config4.overrideServerAddress) {
|
|
5230
5231
|
console.log(
|
|
5231
5232
|
` - Endpoint: ${config4.overrideServerAddress}`
|
|
@@ -5239,8 +5240,8 @@ var Registry = class {
|
|
|
5239
5240
|
const padding = " ".repeat(Math.max(0, 13 - k.length));
|
|
5240
5241
|
console.log(` - ${k}:${padding}${v}`);
|
|
5241
5242
|
}
|
|
5242
|
-
if (
|
|
5243
|
-
console.log(` - Inspector: ${
|
|
5243
|
+
if (_chunkUBBTSSAPcjs.isInspectorEnabled.call(void 0, config4, "manager") && managerDriver.inspector) {
|
|
5244
|
+
console.log(` - Inspector: ${_chunkUBBTSSAPcjs.getInspectorUrl.call(void 0, config4)}`);
|
|
5244
5245
|
}
|
|
5245
5246
|
console.log();
|
|
5246
5247
|
}
|
|
@@ -5309,7 +5310,7 @@ async function configureServerlessRunner(config4) {
|
|
|
5309
5310
|
msg: "fetching datacenters",
|
|
5310
5311
|
endpoint: config4.endpoint
|
|
5311
5312
|
});
|
|
5312
|
-
const dcsRes = await
|
|
5313
|
+
const dcsRes = await _chunkMZ3SRIPMcjs.getDatacenters.call(void 0, clientConfig);
|
|
5313
5314
|
logger7().debug({
|
|
5314
5315
|
msg: "configuring serverless runner",
|
|
5315
5316
|
runnerName: config4.runnerName,
|
|
@@ -5327,7 +5328,7 @@ async function configureServerlessRunner(config4) {
|
|
|
5327
5328
|
},
|
|
5328
5329
|
metadata: _nullishCoalesce(customConfig.metadata, () => ( {}))
|
|
5329
5330
|
};
|
|
5330
|
-
await
|
|
5331
|
+
await _chunkMZ3SRIPMcjs.updateRunnerConfig.call(void 0, clientConfig, config4.runnerName, {
|
|
5331
5332
|
datacenters: Object.fromEntries(
|
|
5332
5333
|
dcsRes.datacenters.map((dc) => [dc.name, serverlessConfig])
|
|
5333
5334
|
)
|
|
@@ -5364,4 +5365,4 @@ function setup(input) {
|
|
|
5364
5365
|
|
|
5365
5366
|
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;
|
|
5366
5367
|
//! These configs configs hold anything that's not platform-specific about running actors.
|
|
5367
|
-
//# sourceMappingURL=chunk-
|
|
5368
|
+
//# sourceMappingURL=chunk-7DSWCOGX.cjs.map
|