rivetkit 2.0.25 → 2.0.26
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-HK2X2UOP.js → chunk-3ZTRZIA5.js} +5 -5
- package/dist/tsup/chunk-3ZTRZIA5.js.map +1 -0
- package/dist/tsup/{chunk-RI4XXOSM.js → chunk-6ZAGP4Y3.js} +11 -8
- package/dist/tsup/{chunk-RI4XXOSM.js.map → chunk-6ZAGP4Y3.js.map} +1 -1
- package/dist/tsup/{chunk-5WBIOFZH.cjs → chunk-77UIPJTD.cjs} +5 -5
- package/dist/tsup/{chunk-5WBIOFZH.cjs.map → chunk-77UIPJTD.cjs.map} +1 -1
- package/dist/tsup/{chunk-QGOLWFPJ.js → chunk-AYDCXNX6.js} +2 -2
- package/dist/tsup/{chunk-RPI5AI2C.cjs → chunk-CFMLY3P6.cjs} +32 -25
- package/dist/tsup/chunk-CFMLY3P6.cjs.map +1 -0
- package/dist/tsup/{chunk-FXGOD53M.js → chunk-E6MTJS4R.js} +3 -3
- package/dist/tsup/{chunk-7MNVTI4Q.js → chunk-EX6XY7A4.js} +2 -2
- package/dist/tsup/{chunk-CZOVXLGY.js → chunk-GMQ44WPZ.js} +2 -2
- package/dist/tsup/{chunk-UTU3KZQ7.js → chunk-K5JMIH4N.js} +18 -8
- package/dist/tsup/chunk-K5JMIH4N.js.map +1 -0
- package/dist/tsup/{chunk-4JW72PP6.cjs → chunk-N6VIFATJ.cjs} +10 -10
- package/dist/tsup/{chunk-4JW72PP6.cjs.map → chunk-N6VIFATJ.cjs.map} +1 -1
- package/dist/tsup/{chunk-RI7O6GWM.cjs → chunk-NEM3XQSZ.cjs} +209 -199
- package/dist/tsup/chunk-NEM3XQSZ.cjs.map +1 -0
- package/dist/tsup/{chunk-RDUHRPFX.js → chunk-NFQAYLE5.js} +18 -11
- package/dist/tsup/chunk-NFQAYLE5.js.map +1 -0
- package/dist/tsup/{chunk-DXDH4HIP.cjs → chunk-SWFPKHMT.cjs} +193 -192
- package/dist/tsup/chunk-SWFPKHMT.cjs.map +1 -0
- package/dist/tsup/{chunk-HBSVF6Y2.cjs → chunk-UORP3ABY.cjs} +6 -6
- package/dist/tsup/{chunk-HBSVF6Y2.cjs.map → chunk-UORP3ABY.cjs.map} +1 -1
- package/dist/tsup/{chunk-Q4FKZ7DP.js → chunk-WIFZEE5R.js} +31 -30
- package/dist/tsup/chunk-WIFZEE5R.js.map +1 -0
- package/dist/tsup/{chunk-BTGTFZMA.cjs → chunk-WJKKE5CN.cjs} +3 -3
- package/dist/tsup/{chunk-BTGTFZMA.cjs.map → chunk-WJKKE5CN.cjs.map} +1 -1
- package/dist/tsup/{chunk-AGFBQ4NP.cjs → chunk-X4OVVIPR.cjs} +3 -3
- package/dist/tsup/{chunk-AGFBQ4NP.cjs.map → chunk-X4OVVIPR.cjs.map} +1 -1
- package/dist/tsup/{chunk-UXV42P7I.cjs → chunk-Z2YB6STQ.cjs} +18 -15
- package/dist/tsup/chunk-Z2YB6STQ.cjs.map +1 -0
- package/dist/tsup/{chunk-2G2VNBLZ.cjs → chunk-ZIAFEFUK.cjs} +6 -6
- package/dist/tsup/{chunk-2G2VNBLZ.cjs.map → chunk-ZIAFEFUK.cjs.map} +1 -1
- package/dist/tsup/{chunk-EDCGRWSB.js → chunk-ZX3AUO3B.js} +2 -2
- package/dist/tsup/client/mod.cjs +8 -8
- package/dist/tsup/client/mod.d.cts +2 -2
- package/dist/tsup/client/mod.d.ts +2 -2
- package/dist/tsup/client/mod.js +7 -7
- package/dist/tsup/common/log.cjs +2 -2
- package/dist/tsup/common/log.d.cts +9 -1
- package/dist/tsup/common/log.d.ts +9 -1
- 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-Bo-blHpJ.d.ts → config-B7x9hjVu.d.ts} +295 -880
- package/dist/tsup/{config-BRDYDraU.d.cts → config-DdCBN35E.d.cts} +295 -880
- 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 +4 -4
- package/dist/tsup/inspector/mod.d.ts +4 -4
- 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 +10 -10
- package/dist/tsup/test/mod.d.cts +1 -1
- package/dist/tsup/test/mod.d.ts +1 -1
- package/dist/tsup/test/mod.js +9 -9
- package/dist/tsup/utils.cjs +2 -2
- package/dist/tsup/utils.js +1 -1
- package/package.json +5 -5
- package/src/actor/config.ts +21 -20
- package/src/actor/instance/state-manager.ts +12 -2
- package/src/client/config.ts +1 -1
- package/src/drivers/engine/config.ts +6 -3
- package/src/inspector/config.ts +1 -2
- package/src/manager/router-schema.ts +7 -7
- package/src/registry/run-config.ts +9 -5
- package/src/remote-manager-driver/actor-http-client.ts +1 -1
- package/src/test/config.ts +13 -12
- package/dist/tsup/chunk-DXDH4HIP.cjs.map +0 -1
- package/dist/tsup/chunk-HK2X2UOP.js.map +0 -1
- package/dist/tsup/chunk-Q4FKZ7DP.js.map +0 -1
- package/dist/tsup/chunk-RDUHRPFX.js.map +0 -1
- package/dist/tsup/chunk-RI7O6GWM.cjs.map +0 -1
- package/dist/tsup/chunk-RPI5AI2C.cjs.map +0 -1
- package/dist/tsup/chunk-UTU3KZQ7.js.map +0 -1
- package/dist/tsup/chunk-UXV42P7I.cjs.map +0 -1
- /package/dist/tsup/{chunk-QGOLWFPJ.js.map → chunk-AYDCXNX6.js.map} +0 -0
- /package/dist/tsup/{chunk-FXGOD53M.js.map → chunk-E6MTJS4R.js.map} +0 -0
- /package/dist/tsup/{chunk-7MNVTI4Q.js.map → chunk-EX6XY7A4.js.map} +0 -0
- /package/dist/tsup/{chunk-CZOVXLGY.js.map → chunk-GMQ44WPZ.js.map} +0 -0
- /package/dist/tsup/{chunk-EDCGRWSB.js.map → chunk-ZX3AUO3B.js.map} +0 -0
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkX4OVVIPRcjs = require('./chunk-X4OVVIPR.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
@@ -28,17 +28,17 @@ var _chunkAGFBQ4NPcjs = require('./chunk-AGFBQ4NP.cjs');
|
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
var
|
|
31
|
+
var _chunkNEM3XQSZcjs = require('./chunk-NEM3XQSZ.cjs');
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
var
|
|
34
|
+
var _chunkN6VIFATJcjs = require('./chunk-N6VIFATJ.cjs');
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
var
|
|
41
|
+
var _chunkCFMLY3P6cjs = require('./chunk-CFMLY3P6.cjs');
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
|
|
@@ -60,7 +60,7 @@ var _chunkRPI5AI2Ccjs = require('./chunk-RPI5AI2C.cjs');
|
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
|
|
63
|
-
var
|
|
63
|
+
var _chunkZIAFEFUKcjs = require('./chunk-ZIAFEFUK.cjs');
|
|
64
64
|
|
|
65
65
|
|
|
66
66
|
|
|
@@ -76,7 +76,7 @@ var _chunk2G2VNBLZcjs = require('./chunk-2G2VNBLZ.cjs');
|
|
|
76
76
|
|
|
77
77
|
|
|
78
78
|
|
|
79
|
-
var
|
|
79
|
+
var _chunk77UIPJTDcjs = require('./chunk-77UIPJTD.cjs');
|
|
80
80
|
|
|
81
81
|
|
|
82
82
|
|
|
@@ -91,26 +91,27 @@ var _chunkXJMYGATEcjs = require('./chunk-XJMYGATE.cjs');
|
|
|
91
91
|
|
|
92
92
|
// src/actor/config.ts
|
|
93
93
|
var _zod = require('zod');
|
|
94
|
+
var zFunction = () => _zod.z.custom((val) => typeof val === "function");
|
|
94
95
|
var ActorConfigSchema = _zod.z.object({
|
|
95
|
-
onCreate:
|
|
96
|
-
onDestroy:
|
|
97
|
-
onWake:
|
|
98
|
-
onSleep:
|
|
99
|
-
onStateChange:
|
|
100
|
-
onBeforeConnect:
|
|
101
|
-
onConnect:
|
|
102
|
-
onDisconnect:
|
|
103
|
-
onBeforeActionResponse:
|
|
104
|
-
onRequest:
|
|
105
|
-
onWebSocket:
|
|
106
|
-
actions: _zod.z.record(_zod.z.
|
|
96
|
+
onCreate: zFunction().optional(),
|
|
97
|
+
onDestroy: zFunction().optional(),
|
|
98
|
+
onWake: zFunction().optional(),
|
|
99
|
+
onSleep: zFunction().optional(),
|
|
100
|
+
onStateChange: zFunction().optional(),
|
|
101
|
+
onBeforeConnect: zFunction().optional(),
|
|
102
|
+
onConnect: zFunction().optional(),
|
|
103
|
+
onDisconnect: zFunction().optional(),
|
|
104
|
+
onBeforeActionResponse: zFunction().optional(),
|
|
105
|
+
onRequest: zFunction().optional(),
|
|
106
|
+
onWebSocket: zFunction().optional(),
|
|
107
|
+
actions: _zod.z.record(_zod.z.string(), zFunction()).default(() => ({})),
|
|
107
108
|
state: _zod.z.any().optional(),
|
|
108
|
-
createState:
|
|
109
|
+
createState: zFunction().optional(),
|
|
109
110
|
connState: _zod.z.any().optional(),
|
|
110
|
-
createConnState:
|
|
111
|
+
createConnState: zFunction().optional(),
|
|
111
112
|
vars: _zod.z.any().optional(),
|
|
112
113
|
db: _zod.z.any().optional(),
|
|
113
|
-
createVars:
|
|
114
|
+
createVars: zFunction().optional(),
|
|
114
115
|
options: _zod.z.object({
|
|
115
116
|
createVarsTimeout: _zod.z.number().positive().default(5e3),
|
|
116
117
|
createConnStateTimeout: _zod.z.number().positive().default(5e3),
|
|
@@ -135,9 +136,9 @@ var ActorConfigSchema = _zod.z.object({
|
|
|
135
136
|
**/
|
|
136
137
|
canHibernateWebSocket: _zod.z.union([
|
|
137
138
|
_zod.z.boolean(),
|
|
138
|
-
|
|
139
|
+
zFunction()
|
|
139
140
|
]).default(false)
|
|
140
|
-
}).strict().
|
|
141
|
+
}).strict().prefault(() => ({}))
|
|
141
142
|
}).strict().refine(
|
|
142
143
|
(data) => !(data.state !== void 0 && data.createState !== void 0),
|
|
143
144
|
{
|
|
@@ -182,11 +183,11 @@ async function handleAction(c, _runConfig, actorDriver, actionName, actorId) {
|
|
|
182
183
|
const encoding = getRequestEncoding(c.req);
|
|
183
184
|
const parameters = getRequestConnParams(c.req);
|
|
184
185
|
const arrayBuffer = await c.req.arrayBuffer();
|
|
185
|
-
const request =
|
|
186
|
+
const request = _chunkZIAFEFUKcjs.deserializeWithEncoding.call(void 0,
|
|
186
187
|
encoding,
|
|
187
188
|
new Uint8Array(arrayBuffer),
|
|
188
|
-
|
|
189
|
-
|
|
189
|
+
_chunkNEM3XQSZcjs.HTTP_ACTION_REQUEST_VERSIONED,
|
|
190
|
+
_chunkNEM3XQSZcjs.HttpActionRequestSchema,
|
|
190
191
|
// JSON: args is already the decoded value (raw object/array)
|
|
191
192
|
(json) => json.args,
|
|
192
193
|
// BARE/CBOR: args is ArrayBuffer that needs CBOR-decoding
|
|
@@ -200,33 +201,33 @@ async function handleAction(c, _runConfig, actorDriver, actionName, actorId) {
|
|
|
200
201
|
actor2 = await actorDriver.loadActor(actorId);
|
|
201
202
|
actor2.rLog.debug({ msg: "handling action", actionName, encoding });
|
|
202
203
|
conn = await actor2.connectionManager.prepareAndConnectConn(
|
|
203
|
-
|
|
204
|
+
_chunkNEM3XQSZcjs.createHttpDriver.call(void 0, ),
|
|
204
205
|
parameters,
|
|
205
206
|
c.req.raw,
|
|
206
207
|
c.req.path,
|
|
207
208
|
c.req.header()
|
|
208
209
|
);
|
|
209
|
-
const ctx = new (0,
|
|
210
|
+
const ctx = new (0, _chunkNEM3XQSZcjs.ActionContext)(actor2, conn);
|
|
210
211
|
output = await actor2.executeAction(ctx, actionName, actionArgs);
|
|
211
212
|
} finally {
|
|
212
213
|
if (conn) {
|
|
213
214
|
conn.disconnect();
|
|
214
215
|
}
|
|
215
216
|
}
|
|
216
|
-
const serialized =
|
|
217
|
+
const serialized = _chunkZIAFEFUKcjs.serializeWithEncoding.call(void 0,
|
|
217
218
|
encoding,
|
|
218
219
|
output,
|
|
219
|
-
|
|
220
|
-
|
|
220
|
+
_chunkNEM3XQSZcjs.HTTP_ACTION_RESPONSE_VERSIONED,
|
|
221
|
+
_chunkNEM3XQSZcjs.HttpActionResponseSchema,
|
|
221
222
|
// JSON: output is the raw value (will be serialized by jsonStringifyCompat)
|
|
222
223
|
(value) => ({ output: value }),
|
|
223
224
|
// BARE/CBOR: output needs to be CBOR-encoded to ArrayBuffer
|
|
224
225
|
(value) => ({
|
|
225
|
-
output:
|
|
226
|
+
output: _chunk77UIPJTDcjs.bufferToArrayBuffer.call(void 0, cbor.encode(value))
|
|
226
227
|
})
|
|
227
228
|
);
|
|
228
229
|
return c.body(serialized, 200, {
|
|
229
|
-
"Content-Type":
|
|
230
|
+
"Content-Type": _chunkZIAFEFUKcjs.contentTypeForEncoding.call(void 0, encoding)
|
|
230
231
|
});
|
|
231
232
|
}
|
|
232
233
|
async function handleRawRequest(c, req, actorDriver, actorId) {
|
|
@@ -250,11 +251,11 @@ async function handleRawRequest(c, req, actorDriver, actorId) {
|
|
|
250
251
|
}
|
|
251
252
|
}
|
|
252
253
|
function getRequestEncoding(req) {
|
|
253
|
-
const encodingParam = req.header(
|
|
254
|
+
const encodingParam = req.header(_chunkZIAFEFUKcjs.HEADER_ENCODING);
|
|
254
255
|
if (!encodingParam) {
|
|
255
256
|
return "json";
|
|
256
257
|
}
|
|
257
|
-
const result =
|
|
258
|
+
const result = _chunkZIAFEFUKcjs.EncodingSchema.safeParse(encodingParam);
|
|
258
259
|
if (!result.success) {
|
|
259
260
|
throw new (0, _chunkXJMYGATEcjs.InvalidEncoding)(encodingParam);
|
|
260
261
|
}
|
|
@@ -264,7 +265,7 @@ function getRequestExposeInternalError(_req) {
|
|
|
264
265
|
return false;
|
|
265
266
|
}
|
|
266
267
|
function getRequestConnParams(req) {
|
|
267
|
-
const paramsParam = req.header(
|
|
268
|
+
const paramsParam = req.header(_chunkZIAFEFUKcjs.HEADER_CONN_PARAMS);
|
|
268
269
|
if (!paramsParam) {
|
|
269
270
|
return null;
|
|
270
271
|
}
|
|
@@ -272,7 +273,7 @@ function getRequestConnParams(req) {
|
|
|
272
273
|
return JSON.parse(paramsParam);
|
|
273
274
|
} catch (err) {
|
|
274
275
|
throw new (0, _chunkXJMYGATEcjs.InvalidParams)(
|
|
275
|
-
`Invalid params JSON: ${
|
|
276
|
+
`Invalid params JSON: ${_chunk77UIPJTDcjs.stringifyError.call(void 0, err)}`
|
|
276
277
|
);
|
|
277
278
|
}
|
|
278
279
|
}
|
|
@@ -306,7 +307,7 @@ function buildActorNames(registryConfig) {
|
|
|
306
307
|
|
|
307
308
|
// src/common/router.ts
|
|
308
309
|
function logger() {
|
|
309
|
-
return
|
|
310
|
+
return _chunk77UIPJTDcjs.getLogger.call(void 0, "router");
|
|
310
311
|
}
|
|
311
312
|
function loggerMiddleware(logger8) {
|
|
312
313
|
return async (c, next) => {
|
|
@@ -324,7 +325,7 @@ function loggerMiddleware(logger8) {
|
|
|
324
325
|
reqSize: c.req.header("content-length"),
|
|
325
326
|
resSize: c.res.headers.get("content-length"),
|
|
326
327
|
userAgent: c.req.header("user-agent"),
|
|
327
|
-
...
|
|
328
|
+
..._chunk77UIPJTDcjs.getEnvUniversal.call(void 0, "_RIVET_LOG_HEADERS") ? { allHeaders: JSON.stringify(c.req.header()) } : {}
|
|
328
329
|
});
|
|
329
330
|
};
|
|
330
331
|
}
|
|
@@ -333,7 +334,7 @@ function handleRouteNotFound(c) {
|
|
|
333
334
|
}
|
|
334
335
|
function handleRouteError(error, c) {
|
|
335
336
|
const exposeInternalError = getRequestExposeInternalError(c.req.raw);
|
|
336
|
-
const { statusCode, group, code, message, metadata } =
|
|
337
|
+
const { statusCode, group, code, message, metadata } = _chunk77UIPJTDcjs.deconstructError.call(void 0,
|
|
337
338
|
error,
|
|
338
339
|
logger(),
|
|
339
340
|
{
|
|
@@ -349,11 +350,11 @@ function handleRouteError(error, c) {
|
|
|
349
350
|
encoding = "json";
|
|
350
351
|
}
|
|
351
352
|
const errorData = { group, code, message, metadata };
|
|
352
|
-
const output =
|
|
353
|
+
const output = _chunkZIAFEFUKcjs.serializeWithEncoding.call(void 0,
|
|
353
354
|
encoding,
|
|
354
355
|
errorData,
|
|
355
|
-
|
|
356
|
-
|
|
356
|
+
_chunkNEM3XQSZcjs.HTTP_RESPONSE_ERROR_VERSIONED,
|
|
357
|
+
_chunkNEM3XQSZcjs.HttpResponseErrorSchema,
|
|
357
358
|
// JSON: metadata is the raw value (will be serialized by jsonStringifyCompat)
|
|
358
359
|
(value) => ({
|
|
359
360
|
group: value.group,
|
|
@@ -366,7 +367,7 @@ function handleRouteError(error, c) {
|
|
|
366
367
|
group: value.group,
|
|
367
368
|
code: value.code,
|
|
368
369
|
message: value.message,
|
|
369
|
-
metadata: value.metadata ?
|
|
370
|
+
metadata: value.metadata ? _chunk77UIPJTDcjs.bufferToArrayBuffer.call(void 0, cbor2.encode(value.metadata)) : null
|
|
370
371
|
})
|
|
371
372
|
);
|
|
372
373
|
return c.body(output, { status: statusCode });
|
|
@@ -374,7 +375,7 @@ function handleRouteError(error, c) {
|
|
|
374
375
|
function handleMetadataRequest(c, registryConfig, runConfig) {
|
|
375
376
|
const response = {
|
|
376
377
|
runtime: "rivetkit",
|
|
377
|
-
version:
|
|
378
|
+
version: _chunk77UIPJTDcjs.VERSION,
|
|
378
379
|
runner: {
|
|
379
380
|
kind: runConfig.runnerKind === "serverless" ? { serverless: {} } : { normal: {} }
|
|
380
381
|
},
|
|
@@ -390,7 +391,7 @@ function handleHealthRequest(c) {
|
|
|
390
391
|
return c.json({
|
|
391
392
|
status: "ok",
|
|
392
393
|
runtime: "rivetkit",
|
|
393
|
-
version:
|
|
394
|
+
version: _chunk77UIPJTDcjs.VERSION
|
|
394
395
|
});
|
|
395
396
|
}
|
|
396
397
|
|
|
@@ -407,7 +408,7 @@ function createRawWebSocketDriver(hibernatable, closePromise) {
|
|
|
407
408
|
// handle messages from the RivetKit protocol
|
|
408
409
|
disconnect: async (_actor, _conn, reason) => {
|
|
409
410
|
if (!websocket) {
|
|
410
|
-
|
|
411
|
+
_chunkZIAFEFUKcjs.loggerWithoutContext.call(void 0, ).warn(
|
|
411
412
|
"disconnecting raw ws without websocket"
|
|
412
413
|
);
|
|
413
414
|
return;
|
|
@@ -433,7 +434,7 @@ function createRawWebSocketDriver(hibernatable, closePromise) {
|
|
|
433
434
|
|
|
434
435
|
// src/actor/conn/drivers/websocket.ts
|
|
435
436
|
function createWebSocketDriver(hibernatable, encoding, closePromise) {
|
|
436
|
-
|
|
437
|
+
_chunkZIAFEFUKcjs.loggerWithoutContext.call(void 0, ).debug({
|
|
437
438
|
msg: "createWebSocketDriver creating driver",
|
|
438
439
|
hibernatable
|
|
439
440
|
});
|
|
@@ -498,7 +499,7 @@ function createWebSocketDriver(hibernatable, encoding, closePromise) {
|
|
|
498
499
|
},
|
|
499
500
|
disconnect: async (_actor, _conn, reason) => {
|
|
500
501
|
if (!websocket) {
|
|
501
|
-
|
|
502
|
+
_chunkZIAFEFUKcjs.loggerWithoutContext.call(void 0, ).warn(
|
|
502
503
|
"disconnecting ws without websocket"
|
|
503
504
|
);
|
|
504
505
|
return;
|
|
@@ -533,10 +534,10 @@ async function routeWebSocket(request, requestPath, requestHeaders, runConfig, a
|
|
|
533
534
|
requestPath,
|
|
534
535
|
isHibernatable
|
|
535
536
|
});
|
|
536
|
-
const closePromiseResolvers =
|
|
537
|
+
const closePromiseResolvers = _chunk77UIPJTDcjs.promiseWithResolvers.call(void 0, );
|
|
537
538
|
let handler;
|
|
538
539
|
let connDriver;
|
|
539
|
-
if (requestPath ===
|
|
540
|
+
if (requestPath === _chunkZIAFEFUKcjs.PATH_CONNECT) {
|
|
540
541
|
const { driver, setWebSocket } = createWebSocketDriver(
|
|
541
542
|
isHibernatable ? { gatewayId, requestId } : void 0,
|
|
542
543
|
encoding,
|
|
@@ -544,14 +545,14 @@ async function routeWebSocket(request, requestPath, requestHeaders, runConfig, a
|
|
|
544
545
|
);
|
|
545
546
|
handler = handleWebSocketConnect.bind(void 0, setWebSocket);
|
|
546
547
|
connDriver = driver;
|
|
547
|
-
} else if (requestPath ===
|
|
548
|
+
} else if (requestPath === _chunkZIAFEFUKcjs.PATH_WEBSOCKET_BASE || requestPath.startsWith(_chunkZIAFEFUKcjs.PATH_WEBSOCKET_PREFIX)) {
|
|
548
549
|
const { driver, setWebSocket } = createRawWebSocketDriver(
|
|
549
550
|
isHibernatable ? { gatewayId, requestId } : void 0,
|
|
550
551
|
closePromiseResolvers.promise
|
|
551
552
|
);
|
|
552
553
|
handler = handleRawWebSocket.bind(void 0, setWebSocket);
|
|
553
554
|
connDriver = driver;
|
|
554
|
-
} else if (requestPath ===
|
|
555
|
+
} else if (requestPath === _chunkZIAFEFUKcjs.PATH_INSPECTOR_CONNECT) {
|
|
555
556
|
return await handleWebSocketInspectorConnect();
|
|
556
557
|
} else {
|
|
557
558
|
throw `WebSocket Path Not Found: ${requestPath}`;
|
|
@@ -576,9 +577,9 @@ async function routeWebSocket(request, requestPath, requestHeaders, runConfig, a
|
|
|
576
577
|
exposeInternalError
|
|
577
578
|
});
|
|
578
579
|
} catch (error) {
|
|
579
|
-
const { group, code } =
|
|
580
|
+
const { group, code } = _chunk77UIPJTDcjs.deconstructError.call(void 0,
|
|
580
581
|
error,
|
|
581
|
-
|
|
582
|
+
_chunkZIAFEFUKcjs.loggerWithoutContext.call(void 0, ),
|
|
582
583
|
{},
|
|
583
584
|
exposeInternalError
|
|
584
585
|
);
|
|
@@ -623,12 +624,12 @@ async function handleWebSocketConnect(setWebSocket, {
|
|
|
623
624
|
onMessage: (evt, ws) => {
|
|
624
625
|
actor2.rLog.debug({ msg: "received message" });
|
|
625
626
|
const value = evt.data.valueOf();
|
|
626
|
-
|
|
627
|
+
_chunkNEM3XQSZcjs.parseMessage.call(void 0, value, {
|
|
627
628
|
encoding,
|
|
628
629
|
maxIncomingMessageSize: runConfig.maxIncomingMessageSize
|
|
629
630
|
}).then((message) => {
|
|
630
631
|
actor2.processMessage(message, conn).catch((error) => {
|
|
631
|
-
const { code } =
|
|
632
|
+
const { code } = _chunk77UIPJTDcjs.deconstructError.call(void 0,
|
|
632
633
|
error,
|
|
633
634
|
actor2.rLog,
|
|
634
635
|
{
|
|
@@ -639,7 +640,7 @@ async function handleWebSocketConnect(setWebSocket, {
|
|
|
639
640
|
ws.close(1011, code);
|
|
640
641
|
});
|
|
641
642
|
}).catch((error) => {
|
|
642
|
-
const { code } =
|
|
643
|
+
const { code } = _chunk77UIPJTDcjs.deconstructError.call(void 0,
|
|
643
644
|
error,
|
|
644
645
|
actor2.rLog,
|
|
645
646
|
{
|
|
@@ -674,7 +675,7 @@ async function handleWebSocketConnect(setWebSocket, {
|
|
|
674
675
|
try {
|
|
675
676
|
actor2.rLog.warn({ msg: "websocket error" });
|
|
676
677
|
} catch (error) {
|
|
677
|
-
|
|
678
|
+
_chunk77UIPJTDcjs.deconstructError.call(void 0,
|
|
678
679
|
error,
|
|
679
680
|
actor2.rLog,
|
|
680
681
|
{ wsEvent: "error" },
|
|
@@ -738,16 +739,16 @@ function parseWebSocketProtocols(protocols) {
|
|
|
738
739
|
if (protocols) {
|
|
739
740
|
const protocolList = protocols.split(",").map((p) => p.trim());
|
|
740
741
|
for (const protocol of protocolList) {
|
|
741
|
-
if (protocol.startsWith(
|
|
742
|
-
encodingRaw = protocol.substring(
|
|
743
|
-
} else if (protocol.startsWith(
|
|
742
|
+
if (protocol.startsWith(_chunkZIAFEFUKcjs.WS_PROTOCOL_ENCODING)) {
|
|
743
|
+
encodingRaw = protocol.substring(_chunkZIAFEFUKcjs.WS_PROTOCOL_ENCODING.length);
|
|
744
|
+
} else if (protocol.startsWith(_chunkZIAFEFUKcjs.WS_PROTOCOL_CONN_PARAMS)) {
|
|
744
745
|
connParamsRaw = decodeURIComponent(
|
|
745
|
-
protocol.substring(
|
|
746
|
+
protocol.substring(_chunkZIAFEFUKcjs.WS_PROTOCOL_CONN_PARAMS.length)
|
|
746
747
|
);
|
|
747
748
|
}
|
|
748
749
|
}
|
|
749
750
|
}
|
|
750
|
-
const encoding =
|
|
751
|
+
const encoding = _chunkZIAFEFUKcjs.EncodingSchema.parse(encodingRaw);
|
|
751
752
|
const connParams = connParamsRaw ? JSON.parse(connParamsRaw) : void 0;
|
|
752
753
|
return { encoding, connParams };
|
|
753
754
|
}
|
|
@@ -763,7 +764,7 @@ function createActorRouter(runConfig, actorDriver, isTest) {
|
|
|
763
764
|
const router = new (0, _hono.Hono)({
|
|
764
765
|
strict: false
|
|
765
766
|
});
|
|
766
|
-
router.use("*", loggerMiddleware(
|
|
767
|
+
router.use("*", loggerMiddleware(_chunkZIAFEFUKcjs.loggerWithoutContext.call(void 0, )));
|
|
767
768
|
router.use("*", async (c, next) => {
|
|
768
769
|
const actor2 = await actorDriver.loadActor(c.env.actorId);
|
|
769
770
|
actor2.beginHonoHttpRequest();
|
|
@@ -793,15 +794,15 @@ function createActorRouter(runConfig, actorDriver, isTest) {
|
|
|
793
794
|
if (!conn) {
|
|
794
795
|
return c.text(`Connection not found: ${connId}`, 404);
|
|
795
796
|
}
|
|
796
|
-
if ((_a = conn[
|
|
797
|
-
conn[
|
|
797
|
+
if ((_a = conn[_chunkNEM3XQSZcjs.CONN_DRIVER_SYMBOL]) == null ? void 0 : _a.terminate) {
|
|
798
|
+
conn[_chunkNEM3XQSZcjs.CONN_DRIVER_SYMBOL].terminate(actor2, conn);
|
|
798
799
|
}
|
|
799
800
|
return c.json({ success: true });
|
|
800
801
|
});
|
|
801
802
|
}
|
|
802
803
|
router.on(
|
|
803
804
|
"GET",
|
|
804
|
-
[
|
|
805
|
+
[_chunkZIAFEFUKcjs.PATH_CONNECT, `${_chunkZIAFEFUKcjs.PATH_WEBSOCKET_PREFIX}*`, _chunkZIAFEFUKcjs.PATH_INSPECTOR_CONNECT],
|
|
805
806
|
async (c) => {
|
|
806
807
|
var _a;
|
|
807
808
|
const upgradeWebSocket = (_a = runConfig.getUpgradeWebSocket) == null ? void 0 : _a.call(runConfig);
|
|
@@ -823,7 +824,7 @@ function createActorRouter(runConfig, actorDriver, isTest) {
|
|
|
823
824
|
false,
|
|
824
825
|
false
|
|
825
826
|
);
|
|
826
|
-
})(c,
|
|
827
|
+
})(c, _chunk77UIPJTDcjs.noopNext.call(void 0, ));
|
|
827
828
|
} else {
|
|
828
829
|
return c.text(
|
|
829
830
|
"WebSockets are not enabled for this driver.",
|
|
@@ -852,7 +853,7 @@ function createActorRouter(runConfig, actorDriver, isTest) {
|
|
|
852
853
|
body: c.req.raw.body,
|
|
853
854
|
duplex: "half"
|
|
854
855
|
});
|
|
855
|
-
|
|
856
|
+
_chunkZIAFEFUKcjs.loggerWithoutContext.call(void 0, ).debug({
|
|
856
857
|
msg: "rewriting http url",
|
|
857
858
|
from: c.req.url,
|
|
858
859
|
to: correctedRequest.url
|
|
@@ -864,10 +865,10 @@ function createActorRouter(runConfig, actorDriver, isTest) {
|
|
|
864
865
|
c.env.actorId
|
|
865
866
|
);
|
|
866
867
|
});
|
|
867
|
-
if (
|
|
868
|
+
if (_chunkX4OVVIPRcjs.isInspectorEnabled.call(void 0, runConfig, "actor")) {
|
|
868
869
|
router.route(
|
|
869
870
|
"/inspect",
|
|
870
|
-
new (0, _hono.Hono)().use(
|
|
871
|
+
new (0, _hono.Hono)().use(_chunkX4OVVIPRcjs.secureInspector.call(void 0, runConfig), async (c, next) => {
|
|
871
872
|
const inspector = (await actorDriver.loadActor(c.env.actorId)).inspector;
|
|
872
873
|
_invariant2.default.call(void 0,
|
|
873
874
|
inspector,
|
|
@@ -875,7 +876,7 @@ function createActorRouter(runConfig, actorDriver, isTest) {
|
|
|
875
876
|
);
|
|
876
877
|
c.set("inspector", inspector);
|
|
877
878
|
return next();
|
|
878
|
-
}).route("/",
|
|
879
|
+
}).route("/", _chunkNEM3XQSZcjs.createActorInspectorRouter.call(void 0, ))
|
|
879
880
|
);
|
|
880
881
|
}
|
|
881
882
|
router.notFound(handleRouteNotFound);
|
|
@@ -886,13 +887,13 @@ function createActorRouter(runConfig, actorDriver, isTest) {
|
|
|
886
887
|
// src/actor/mod.ts
|
|
887
888
|
function actor(input) {
|
|
888
889
|
const config2 = ActorConfigSchema.parse(input);
|
|
889
|
-
return new (0,
|
|
890
|
+
return new (0, _chunkNEM3XQSZcjs.ActorDefinition)(config2);
|
|
890
891
|
}
|
|
891
892
|
|
|
892
893
|
// src/common/inline-websocket-adapter.ts
|
|
893
894
|
var _ws2 = require('hono/ws');
|
|
894
895
|
function logger2() {
|
|
895
|
-
return
|
|
896
|
+
return _chunk77UIPJTDcjs.getLogger.call(void 0, "fake-event-source2");
|
|
896
897
|
}
|
|
897
898
|
var InlineWebSocketAdapter = (_class = class {
|
|
898
899
|
// WebSocket readyState values
|
|
@@ -1233,7 +1234,7 @@ var _streaming = require('hono/streaming');
|
|
|
1233
1234
|
|
|
1234
1235
|
// src/drivers/engine/log.ts
|
|
1235
1236
|
function logger3() {
|
|
1236
|
-
return
|
|
1237
|
+
return _chunk77UIPJTDcjs.getLogger.call(void 0, "driver-engine");
|
|
1237
1238
|
}
|
|
1238
1239
|
|
|
1239
1240
|
// src/drivers/engine/actor-driver.ts
|
|
@@ -1251,8 +1252,8 @@ var EngineActorDriver = class {
|
|
|
1251
1252
|
#version = 1;
|
|
1252
1253
|
// Version for the runner protocol
|
|
1253
1254
|
#alarmTimeout;
|
|
1254
|
-
#runnerStarted =
|
|
1255
|
-
#runnerStopped =
|
|
1255
|
+
#runnerStarted = _chunk77UIPJTDcjs.promiseWithResolvers.call(void 0, );
|
|
1256
|
+
#runnerStopped = _chunk77UIPJTDcjs.promiseWithResolvers.call(void 0, );
|
|
1256
1257
|
#isRunnerStopped = false;
|
|
1257
1258
|
// HACK: Track actor stop intent locally since the runner protocol doesn't
|
|
1258
1259
|
// pass the stop reason to onActorStop. This will be fixed when the runner
|
|
@@ -1287,7 +1288,7 @@ var EngineActorDriver = class {
|
|
|
1287
1288
|
);
|
|
1288
1289
|
const engineRunnerConfig = {
|
|
1289
1290
|
version: this.#version,
|
|
1290
|
-
endpoint:
|
|
1291
|
+
endpoint: _chunkNEM3XQSZcjs.getEndpoint.call(void 0, runConfig),
|
|
1291
1292
|
token,
|
|
1292
1293
|
namespace: runConfig.namespace,
|
|
1293
1294
|
totalSlots: runConfig.totalSlots,
|
|
@@ -1313,7 +1314,7 @@ var EngineActorDriver = class {
|
|
|
1313
1314
|
},
|
|
1314
1315
|
onActorStart: this.#runnerOnActorStart.bind(this),
|
|
1315
1316
|
onActorStop: this.#runnerOnActorStop.bind(this),
|
|
1316
|
-
logger:
|
|
1317
|
+
logger: _chunk77UIPJTDcjs.getLogger.call(void 0, "engine-runner")
|
|
1317
1318
|
};
|
|
1318
1319
|
this.#runner = new (0, _enginerunner.Runner)(engineRunnerConfig);
|
|
1319
1320
|
this.#runner.start();
|
|
@@ -1344,7 +1345,7 @@ var EngineActorDriver = class {
|
|
|
1344
1345
|
this.#alarmTimeout = void 0;
|
|
1345
1346
|
}
|
|
1346
1347
|
const delay = Math.max(0, timestamp - Date.now());
|
|
1347
|
-
this.#alarmTimeout =
|
|
1348
|
+
this.#alarmTimeout = _chunk77UIPJTDcjs.setLongTimeout.call(void 0, () => {
|
|
1348
1349
|
actor2.onAlarm();
|
|
1349
1350
|
this.#alarmTimeout = void 0;
|
|
1350
1351
|
}, delay);
|
|
@@ -1416,7 +1417,7 @@ var EngineActorDriver = class {
|
|
|
1416
1417
|
var _a;
|
|
1417
1418
|
(_a = handler.actor) == null ? void 0 : _a.rLog.error({
|
|
1418
1419
|
msg: "onStop errored",
|
|
1419
|
-
error:
|
|
1420
|
+
error: _chunk77UIPJTDcjs.stringifyError.call(void 0, err)
|
|
1420
1421
|
});
|
|
1421
1422
|
})
|
|
1422
1423
|
);
|
|
@@ -1474,18 +1475,18 @@ var EngineActorDriver = class {
|
|
|
1474
1475
|
let handler = this.#actors.get(actorId);
|
|
1475
1476
|
if (!handler) {
|
|
1476
1477
|
handler = {
|
|
1477
|
-
actorStartPromise:
|
|
1478
|
+
actorStartPromise: _chunk77UIPJTDcjs.promiseWithResolvers.call(void 0, )
|
|
1478
1479
|
};
|
|
1479
1480
|
this.#actors.set(actorId, handler);
|
|
1480
1481
|
}
|
|
1481
1482
|
const name = actorConfig.name;
|
|
1482
1483
|
_invariant2.default.call(void 0, actorConfig.key, "actor should have a key");
|
|
1483
|
-
const key =
|
|
1484
|
+
const key = _chunkNEM3XQSZcjs.deserializeActorKey.call(void 0, actorConfig.key);
|
|
1484
1485
|
const [persistDataBuffer] = await this.#runner.kvGet(actorId, [
|
|
1485
|
-
|
|
1486
|
+
_chunkCFMLY3P6cjs.KEYS.PERSIST_DATA
|
|
1486
1487
|
]);
|
|
1487
1488
|
if (persistDataBuffer === null) {
|
|
1488
|
-
const initialKvState =
|
|
1489
|
+
const initialKvState = _chunkCFMLY3P6cjs.getInitialActorKvState.call(void 0, input);
|
|
1489
1490
|
await this.#runner.kvPut(actorId, initialKvState);
|
|
1490
1491
|
logger3().debug({
|
|
1491
1492
|
msg: "initialized persist data for new actor",
|
|
@@ -1498,7 +1499,7 @@ var EngineActorDriver = class {
|
|
|
1498
1499
|
dataSize: persistDataBuffer.byteLength
|
|
1499
1500
|
});
|
|
1500
1501
|
}
|
|
1501
|
-
const definition =
|
|
1502
|
+
const definition = _chunkNEM3XQSZcjs.lookupInRegistry.call(void 0,
|
|
1502
1503
|
this.#registryConfig,
|
|
1503
1504
|
actorConfig.name
|
|
1504
1505
|
);
|
|
@@ -1525,7 +1526,7 @@ var EngineActorDriver = class {
|
|
|
1525
1526
|
} catch (err) {
|
|
1526
1527
|
logger3().error({
|
|
1527
1528
|
msg: "error in onStop, proceeding with removing actor",
|
|
1528
|
-
err:
|
|
1529
|
+
err: _chunk77UIPJTDcjs.stringifyError.call(void 0, err)
|
|
1529
1530
|
});
|
|
1530
1531
|
}
|
|
1531
1532
|
this.#actors.delete(actorId);
|
|
@@ -1584,7 +1585,7 @@ var EngineActorDriver = class {
|
|
|
1584
1585
|
const wsContext = new (0, _ws2.WSContext)(websocket);
|
|
1585
1586
|
const conn = wsHandler.conn;
|
|
1586
1587
|
const actor2 = wsHandler.actor;
|
|
1587
|
-
const connStateManager = conn == null ? void 0 : conn[
|
|
1588
|
+
const connStateManager = conn == null ? void 0 : conn[_chunkNEM3XQSZcjs.CONN_STATE_MANAGER_SYMBOL];
|
|
1588
1589
|
logger3().debug({
|
|
1589
1590
|
msg: "attaching websocket event listeners",
|
|
1590
1591
|
actorId,
|
|
@@ -1644,7 +1645,7 @@ var EngineActorDriver = class {
|
|
|
1644
1645
|
});
|
|
1645
1646
|
const entry = this.#hwsMessageIndex.get(conn.id);
|
|
1646
1647
|
if (entry) {
|
|
1647
|
-
const messageLength =
|
|
1648
|
+
const messageLength = _chunkNEM3XQSZcjs.getValueLength.call(void 0, event.data);
|
|
1648
1649
|
entry.bufferedMessageSize += messageLength;
|
|
1649
1650
|
if (entry.bufferedMessageSize >= CONN_BUFFERED_MESSAGE_SIZE_THRESHOLD) {
|
|
1650
1651
|
entry.bufferedMessageSize = 0;
|
|
@@ -1715,10 +1716,10 @@ var EngineActorDriver = class {
|
|
|
1715
1716
|
gatewayId: _enginerunner.idToStr.call(void 0, gatewayId),
|
|
1716
1717
|
requestId: _enginerunner.idToStr.call(void 0, requestId)
|
|
1717
1718
|
});
|
|
1718
|
-
if (path ===
|
|
1719
|
+
if (path === _chunkZIAFEFUKcjs.PATH_CONNECT) {
|
|
1719
1720
|
return true;
|
|
1720
|
-
} else if (path ===
|
|
1721
|
-
const definition =
|
|
1721
|
+
} else if (path === _chunkZIAFEFUKcjs.PATH_WEBSOCKET_BASE || path.startsWith(_chunkZIAFEFUKcjs.PATH_WEBSOCKET_PREFIX)) {
|
|
1722
|
+
const definition = _chunkNEM3XQSZcjs.lookupInRegistry.call(void 0,
|
|
1722
1723
|
this.#registryConfig,
|
|
1723
1724
|
actorInstance.config.name
|
|
1724
1725
|
);
|
|
@@ -1746,7 +1747,7 @@ var EngineActorDriver = class {
|
|
|
1746
1747
|
} else {
|
|
1747
1748
|
return false;
|
|
1748
1749
|
}
|
|
1749
|
-
} else if (path ===
|
|
1750
|
+
} else if (path === _chunkZIAFEFUKcjs.PATH_INSPECTOR_CONNECT) {
|
|
1750
1751
|
return false;
|
|
1751
1752
|
} else {
|
|
1752
1753
|
logger3().warn({
|
|
@@ -1759,7 +1760,7 @@ var EngineActorDriver = class {
|
|
|
1759
1760
|
async #hwsLoadAll(actorId) {
|
|
1760
1761
|
const actor2 = await this.loadActor(actorId);
|
|
1761
1762
|
return actor2.conns.values().map((conn) => {
|
|
1762
|
-
const connStateManager = conn[
|
|
1763
|
+
const connStateManager = conn[_chunkNEM3XQSZcjs.CONN_STATE_MANAGER_SYMBOL];
|
|
1763
1764
|
const hibernatable = connStateManager.hibernatableData;
|
|
1764
1765
|
if (!hibernatable) return void 0;
|
|
1765
1766
|
return {
|
|
@@ -1782,7 +1783,7 @@ var EngineActorDriver = class {
|
|
|
1782
1783
|
await this.#runner.restoreHibernatingRequests(actor2.id, metaEntries);
|
|
1783
1784
|
}
|
|
1784
1785
|
onCreateConn(conn) {
|
|
1785
|
-
const hibernatable = conn[
|
|
1786
|
+
const hibernatable = conn[_chunkNEM3XQSZcjs.CONN_STATE_MANAGER_SYMBOL].hibernatableData;
|
|
1786
1787
|
if (!hibernatable) return;
|
|
1787
1788
|
this.#hwsMessageIndex.set(conn.id, {
|
|
1788
1789
|
serverMessageIndex: hibernatable.serverMessageIndex,
|
|
@@ -1804,7 +1805,7 @@ var EngineActorDriver = class {
|
|
|
1804
1805
|
});
|
|
1805
1806
|
}
|
|
1806
1807
|
onBeforePersistConn(conn) {
|
|
1807
|
-
const stateManager = conn[
|
|
1808
|
+
const stateManager = conn[_chunkNEM3XQSZcjs.CONN_STATE_MANAGER_SYMBOL];
|
|
1808
1809
|
const hibernatable = stateManager.hibernatableDataOrError();
|
|
1809
1810
|
const entry = this.#hwsMessageIndex.get(conn.id);
|
|
1810
1811
|
if (!entry) {
|
|
@@ -1818,7 +1819,7 @@ var EngineActorDriver = class {
|
|
|
1818
1819
|
entry.serverMessageIndex = hibernatable.serverMessageIndex;
|
|
1819
1820
|
}
|
|
1820
1821
|
onAfterPersistConn(conn) {
|
|
1821
|
-
const stateManager = conn[
|
|
1822
|
+
const stateManager = conn[_chunkNEM3XQSZcjs.CONN_STATE_MANAGER_SYMBOL];
|
|
1822
1823
|
const hibernatable = stateManager.hibernatableDataOrError();
|
|
1823
1824
|
const entry = this.#hwsMessageIndex.get(conn.id);
|
|
1824
1825
|
if (!entry) {
|
|
@@ -1846,7 +1847,7 @@ function createEngineDriver() {
|
|
|
1846
1847
|
return {
|
|
1847
1848
|
name: "engine",
|
|
1848
1849
|
manager: (_registryConfig, runConfig) => {
|
|
1849
|
-
return new (0,
|
|
1850
|
+
return new (0, _chunkNEM3XQSZcjs.RemoteManagerDriver)(runConfig);
|
|
1850
1851
|
},
|
|
1851
1852
|
actor: (registryConfig, runConfig, managerDriver, inlineClient) => {
|
|
1852
1853
|
return new EngineActorDriver(
|
|
@@ -2147,7 +2148,7 @@ var migrations = /* @__PURE__ */ new Map([
|
|
|
2147
2148
|
if (v1State.persistedData) {
|
|
2148
2149
|
const key = new Uint8Array([1]);
|
|
2149
2150
|
kvStorage.push({
|
|
2150
|
-
key:
|
|
2151
|
+
key: _chunk77UIPJTDcjs.bufferToArrayBuffer.call(void 0, key),
|
|
2151
2152
|
value: v1State.persistedData
|
|
2152
2153
|
});
|
|
2153
2154
|
}
|
|
@@ -2161,13 +2162,13 @@ var migrations = /* @__PURE__ */ new Map([
|
|
|
2161
2162
|
}
|
|
2162
2163
|
]
|
|
2163
2164
|
]);
|
|
2164
|
-
var ACTOR_STATE_VERSIONED =
|
|
2165
|
+
var ACTOR_STATE_VERSIONED = _chunkCFMLY3P6cjs.createVersionedDataHandler.call(void 0, {
|
|
2165
2166
|
currentVersion: CURRENT_VERSION,
|
|
2166
2167
|
migrations,
|
|
2167
2168
|
serializeVersion: (data) => encodeActorState(data),
|
|
2168
2169
|
deserializeVersion: (bytes) => decodeActorState(bytes)
|
|
2169
2170
|
});
|
|
2170
|
-
var ACTOR_ALARM_VERSIONED =
|
|
2171
|
+
var ACTOR_ALARM_VERSIONED = _chunkCFMLY3P6cjs.createVersionedDataHandler.call(void 0, {
|
|
2171
2172
|
currentVersion: CURRENT_VERSION,
|
|
2172
2173
|
migrations,
|
|
2173
2174
|
serializeVersion: (data) => encodeActorAlarm(data),
|
|
@@ -2176,7 +2177,7 @@ var ACTOR_ALARM_VERSIONED = _chunkRPI5AI2Ccjs.createVersionedDataHandler.call(vo
|
|
|
2176
2177
|
|
|
2177
2178
|
// src/drivers/file-system/log.ts
|
|
2178
2179
|
function logger4() {
|
|
2179
|
-
return
|
|
2180
|
+
return _chunk77UIPJTDcjs.getLogger.call(void 0, "driver-fs");
|
|
2180
2181
|
}
|
|
2181
2182
|
|
|
2182
2183
|
// src/drivers/file-system/utils.ts
|
|
@@ -2371,11 +2372,11 @@ var FileSystemGlobalState = class {
|
|
|
2371
2372
|
entry.generation = crypto.randomUUID();
|
|
2372
2373
|
}
|
|
2373
2374
|
const kvStorage = [];
|
|
2374
|
-
const initialKvState =
|
|
2375
|
+
const initialKvState = _chunkCFMLY3P6cjs.getInitialActorKvState.call(void 0, input);
|
|
2375
2376
|
for (const [key2, value] of initialKvState) {
|
|
2376
2377
|
kvStorage.push({
|
|
2377
|
-
key:
|
|
2378
|
-
value:
|
|
2378
|
+
key: _chunk77UIPJTDcjs.bufferToArrayBuffer.call(void 0, key2),
|
|
2379
|
+
value: _chunk77UIPJTDcjs.bufferToArrayBuffer.call(void 0, value)
|
|
2379
2380
|
});
|
|
2380
2381
|
}
|
|
2381
2382
|
entry.state = {
|
|
@@ -2441,11 +2442,11 @@ var FileSystemGlobalState = class {
|
|
|
2441
2442
|
entry.generation = crypto.randomUUID();
|
|
2442
2443
|
}
|
|
2443
2444
|
const kvStorage = [];
|
|
2444
|
-
const initialKvState =
|
|
2445
|
+
const initialKvState = _chunkCFMLY3P6cjs.getInitialActorKvState.call(void 0, input);
|
|
2445
2446
|
for (const [key2, value] of initialKvState) {
|
|
2446
2447
|
kvStorage.push({
|
|
2447
|
-
key:
|
|
2448
|
-
value:
|
|
2448
|
+
key: _chunk77UIPJTDcjs.bufferToArrayBuffer.call(void 0, key2),
|
|
2449
|
+
value: _chunk77UIPJTDcjs.bufferToArrayBuffer.call(void 0, value)
|
|
2449
2450
|
});
|
|
2450
2451
|
}
|
|
2451
2452
|
entry.state = {
|
|
@@ -2506,7 +2507,7 @@ var FileSystemGlobalState = class {
|
|
|
2506
2507
|
logger4().error({
|
|
2507
2508
|
msg: "failed to delete actor state file",
|
|
2508
2509
|
actorId,
|
|
2509
|
-
error:
|
|
2510
|
+
error: _chunk77UIPJTDcjs.stringifyError.call(void 0, err)
|
|
2510
2511
|
});
|
|
2511
2512
|
}
|
|
2512
2513
|
}
|
|
@@ -2520,7 +2521,7 @@ var FileSystemGlobalState = class {
|
|
|
2520
2521
|
logger4().error({
|
|
2521
2522
|
msg: "failed to delete actor database file",
|
|
2522
2523
|
actorId,
|
|
2523
|
-
error:
|
|
2524
|
+
error: _chunk77UIPJTDcjs.stringifyError.call(void 0, err)
|
|
2524
2525
|
});
|
|
2525
2526
|
}
|
|
2526
2527
|
}
|
|
@@ -2534,7 +2535,7 @@ var FileSystemGlobalState = class {
|
|
|
2534
2535
|
logger4().error({
|
|
2535
2536
|
msg: "failed to delete actor alarm file",
|
|
2536
2537
|
actorId,
|
|
2537
|
-
error:
|
|
2538
|
+
error: _chunk77UIPJTDcjs.stringifyError.call(void 0, err)
|
|
2538
2539
|
});
|
|
2539
2540
|
}
|
|
2540
2541
|
}
|
|
@@ -2704,9 +2705,9 @@ var FileSystemGlobalState = class {
|
|
|
2704
2705
|
if (entry.actor) {
|
|
2705
2706
|
return entry.actor;
|
|
2706
2707
|
}
|
|
2707
|
-
entry.startPromise =
|
|
2708
|
+
entry.startPromise = _chunk77UIPJTDcjs.promiseWithResolvers.call(void 0, );
|
|
2708
2709
|
try {
|
|
2709
|
-
const definition =
|
|
2710
|
+
const definition = _chunkNEM3XQSZcjs.lookupInRegistry.call(void 0,
|
|
2710
2711
|
registryConfig,
|
|
2711
2712
|
entry.state.name
|
|
2712
2713
|
);
|
|
@@ -2777,7 +2778,7 @@ var FileSystemGlobalState = class {
|
|
|
2777
2778
|
logger4().error({
|
|
2778
2779
|
msg: "failed to read alarm file",
|
|
2779
2780
|
file,
|
|
2780
|
-
error:
|
|
2781
|
+
error: _chunk77UIPJTDcjs.stringifyError.call(void 0, err)
|
|
2781
2782
|
});
|
|
2782
2783
|
}
|
|
2783
2784
|
}
|
|
@@ -2807,7 +2808,7 @@ var FileSystemGlobalState = class {
|
|
|
2807
2808
|
(_a = entry.alarmTimeout) == null ? void 0 : _a.abort();
|
|
2808
2809
|
entry.alarmTimestamp = timestamp;
|
|
2809
2810
|
const delay = Math.max(0, timestamp - Date.now());
|
|
2810
|
-
entry.alarmTimeout =
|
|
2811
|
+
entry.alarmTimeout = _chunk77UIPJTDcjs.setLongTimeout.call(void 0, async () => {
|
|
2811
2812
|
entry.alarmTimestamp = void 0;
|
|
2812
2813
|
if (this.#persist) {
|
|
2813
2814
|
try {
|
|
@@ -2818,7 +2819,7 @@ var FileSystemGlobalState = class {
|
|
|
2818
2819
|
logger4().debug({
|
|
2819
2820
|
msg: "failed to remove alarm file",
|
|
2820
2821
|
actorId,
|
|
2821
|
-
error:
|
|
2822
|
+
error: _chunk77UIPJTDcjs.stringifyError.call(void 0, err)
|
|
2822
2823
|
});
|
|
2823
2824
|
}
|
|
2824
2825
|
}
|
|
@@ -2845,7 +2846,7 @@ var FileSystemGlobalState = class {
|
|
|
2845
2846
|
logger4().error({
|
|
2846
2847
|
msg: "failed to handle alarm",
|
|
2847
2848
|
actorId,
|
|
2848
|
-
error:
|
|
2849
|
+
error: _chunk77UIPJTDcjs.stringifyError.call(void 0, err)
|
|
2849
2850
|
});
|
|
2850
2851
|
}
|
|
2851
2852
|
}, delay);
|
|
@@ -2857,7 +2858,7 @@ var FileSystemGlobalState = class {
|
|
|
2857
2858
|
if (fsSync.existsSync(tokenPath)) {
|
|
2858
2859
|
return fsSync.readFileSync(tokenPath, "utf-8");
|
|
2859
2860
|
}
|
|
2860
|
-
const newToken =
|
|
2861
|
+
const newToken = _chunkZIAFEFUKcjs.generateRandomString.call(void 0, );
|
|
2861
2862
|
fsSync.writeFileSync(tokenPath, newToken);
|
|
2862
2863
|
return newToken;
|
|
2863
2864
|
}
|
|
@@ -2912,17 +2913,17 @@ var FileSystemGlobalState = class {
|
|
|
2912
2913
|
const newKvStorage = [...entry.state.kvStorage];
|
|
2913
2914
|
for (const [key, value] of entries) {
|
|
2914
2915
|
const existingIndex = newKvStorage.findIndex(
|
|
2915
|
-
(e) =>
|
|
2916
|
+
(e) => _chunk77UIPJTDcjs.arrayBuffersEqual.call(void 0, e.key, _chunk77UIPJTDcjs.bufferToArrayBuffer.call(void 0, key))
|
|
2916
2917
|
);
|
|
2917
2918
|
if (existingIndex >= 0) {
|
|
2918
2919
|
newKvStorage[existingIndex] = {
|
|
2919
|
-
key:
|
|
2920
|
-
value:
|
|
2920
|
+
key: _chunk77UIPJTDcjs.bufferToArrayBuffer.call(void 0, key),
|
|
2921
|
+
value: _chunk77UIPJTDcjs.bufferToArrayBuffer.call(void 0, value)
|
|
2921
2922
|
};
|
|
2922
2923
|
} else {
|
|
2923
2924
|
newKvStorage.push({
|
|
2924
|
-
key:
|
|
2925
|
-
value:
|
|
2925
|
+
key: _chunk77UIPJTDcjs.bufferToArrayBuffer.call(void 0, key),
|
|
2926
|
+
value: _chunk77UIPJTDcjs.bufferToArrayBuffer.call(void 0, value)
|
|
2926
2927
|
});
|
|
2927
2928
|
}
|
|
2928
2929
|
}
|
|
@@ -2947,7 +2948,7 @@ var FileSystemGlobalState = class {
|
|
|
2947
2948
|
const results = [];
|
|
2948
2949
|
for (const key of keys) {
|
|
2949
2950
|
const foundEntry = entry.state.kvStorage.find(
|
|
2950
|
-
(e) =>
|
|
2951
|
+
(e) => _chunk77UIPJTDcjs.arrayBuffersEqual.call(void 0, e.key, _chunk77UIPJTDcjs.bufferToArrayBuffer.call(void 0, key))
|
|
2951
2952
|
);
|
|
2952
2953
|
if (foundEntry) {
|
|
2953
2954
|
results.push(new Uint8Array(foundEntry.value));
|
|
@@ -2972,7 +2973,7 @@ var FileSystemGlobalState = class {
|
|
|
2972
2973
|
const newKvStorage = [...entry.state.kvStorage];
|
|
2973
2974
|
for (const key of keys) {
|
|
2974
2975
|
const indexToDelete = newKvStorage.findIndex(
|
|
2975
|
-
(e) =>
|
|
2976
|
+
(e) => _chunk77UIPJTDcjs.arrayBuffersEqual.call(void 0, e.key, _chunk77UIPJTDcjs.bufferToArrayBuffer.call(void 0, key))
|
|
2976
2977
|
);
|
|
2977
2978
|
if (indexToDelete >= 0) {
|
|
2978
2979
|
newKvStorage.splice(indexToDelete, 1);
|
|
@@ -3038,13 +3039,13 @@ function createManagerInspectorRouter() {
|
|
|
3038
3039
|
});
|
|
3039
3040
|
return c.json(actors, 200);
|
|
3040
3041
|
} catch (error) {
|
|
3041
|
-
|
|
3042
|
+
_chunkX4OVVIPRcjs.inspectorLogger.call(void 0, ).error({
|
|
3042
3043
|
msg: "Failed to fetch actors",
|
|
3043
3044
|
error
|
|
3044
3045
|
});
|
|
3045
3046
|
return c.json("Failed to fetch actors", 500);
|
|
3046
3047
|
}
|
|
3047
|
-
}).post("/actors", _standardvalidator.sValidator.call(void 0, "json",
|
|
3048
|
+
}).post("/actors", _standardvalidator.sValidator.call(void 0, "json", _chunkN6VIFATJcjs.CreateActorSchema), async (c) => {
|
|
3048
3049
|
const actor2 = await c.var.inspector.accessors.createActor(
|
|
3049
3050
|
c.req.valid("json")
|
|
3050
3051
|
);
|
|
@@ -3070,7 +3071,7 @@ var ManagerInspector = class {
|
|
|
3070
3071
|
|
|
3071
3072
|
constructor(accessors) {
|
|
3072
3073
|
this.accessors = accessors();
|
|
3073
|
-
|
|
3074
|
+
_chunkX4OVVIPRcjs.inspectorLogger.call(void 0, ).debug({ msg: "Manager Inspector enabled and ready" });
|
|
3074
3075
|
}
|
|
3075
3076
|
};
|
|
3076
3077
|
|
|
@@ -3151,9 +3152,9 @@ var FileSystemManagerDriver = class {
|
|
|
3151
3152
|
};
|
|
3152
3153
|
});
|
|
3153
3154
|
}
|
|
3154
|
-
const inlineClient =
|
|
3155
|
+
const inlineClient = _chunkNEM3XQSZcjs.createClientWithDriver.call(void 0,
|
|
3155
3156
|
this,
|
|
3156
|
-
|
|
3157
|
+
_chunkCFMLY3P6cjs.ClientConfigSchema.parse({})
|
|
3157
3158
|
);
|
|
3158
3159
|
this.#actorDriver = this.#driverConfig.actor(
|
|
3159
3160
|
registryConfig,
|
|
@@ -3218,7 +3219,7 @@ var FileSystemManagerDriver = class {
|
|
|
3218
3219
|
false,
|
|
3219
3220
|
false
|
|
3220
3221
|
);
|
|
3221
|
-
return upgradeWebSocket(() => wsHandler)(c,
|
|
3222
|
+
return upgradeWebSocket(() => wsHandler)(c, _chunk77UIPJTDcjs.noopNext.call(void 0, ));
|
|
3222
3223
|
}
|
|
3223
3224
|
async getForId({
|
|
3224
3225
|
actorId
|
|
@@ -3376,19 +3377,19 @@ function chooseDefaultDriver(runConfig) {
|
|
|
3376
3377
|
return runConfig.driver;
|
|
3377
3378
|
}
|
|
3378
3379
|
if (runConfig.endpoint || runConfig.token || runConfig.runnerKind === "serverless") {
|
|
3379
|
-
|
|
3380
|
+
_chunkZIAFEFUKcjs.loggerWithoutContext.call(void 0, ).debug({
|
|
3380
3381
|
msg: "using rivet engine driver",
|
|
3381
3382
|
endpoint: runConfig.endpoint
|
|
3382
3383
|
});
|
|
3383
3384
|
return createEngineDriver();
|
|
3384
3385
|
}
|
|
3385
|
-
|
|
3386
|
+
_chunkZIAFEFUKcjs.loggerWithoutContext.call(void 0, ).debug({ msg: "using default file system driver" });
|
|
3386
3387
|
return createFileSystemOrMemoryDriver(true);
|
|
3387
3388
|
}
|
|
3388
3389
|
|
|
3389
3390
|
// src/engine-process/log.ts
|
|
3390
3391
|
function logger5() {
|
|
3391
|
-
return
|
|
3392
|
+
return _chunk77UIPJTDcjs.getLogger.call(void 0, "engine-process");
|
|
3392
3393
|
}
|
|
3393
3394
|
|
|
3394
3395
|
// src/engine-process/mod.ts
|
|
@@ -3789,7 +3790,7 @@ var ActorsListNamesResponseSchema = _zod.z.object({
|
|
|
3789
3790
|
|
|
3790
3791
|
// src/manager/log.ts
|
|
3791
3792
|
function logger6() {
|
|
3792
|
-
return
|
|
3793
|
+
return _chunk77UIPJTDcjs.getLogger.call(void 0, "actor-manager");
|
|
3793
3794
|
}
|
|
3794
3795
|
|
|
3795
3796
|
// src/manager/gateway.ts
|
|
@@ -3805,11 +3806,11 @@ async function handleWebSocketGatewayPathBased(runConfig, managerDriver, c, acto
|
|
|
3805
3806
|
if (protocols) {
|
|
3806
3807
|
const protocolList = protocols.split(",").map((p) => p.trim());
|
|
3807
3808
|
for (const protocol of protocolList) {
|
|
3808
|
-
if (protocol.startsWith(
|
|
3809
|
-
encodingRaw = protocol.substring(
|
|
3810
|
-
} else if (protocol.startsWith(
|
|
3809
|
+
if (protocol.startsWith(_chunkZIAFEFUKcjs.WS_PROTOCOL_ENCODING)) {
|
|
3810
|
+
encodingRaw = protocol.substring(_chunkZIAFEFUKcjs.WS_PROTOCOL_ENCODING.length);
|
|
3811
|
+
} else if (protocol.startsWith(_chunkZIAFEFUKcjs.WS_PROTOCOL_CONN_PARAMS)) {
|
|
3811
3812
|
connParamsRaw = decodeURIComponent(
|
|
3812
|
-
protocol.substring(
|
|
3813
|
+
protocol.substring(_chunkZIAFEFUKcjs.WS_PROTOCOL_CONN_PARAMS.length)
|
|
3813
3814
|
);
|
|
3814
3815
|
}
|
|
3815
3816
|
}
|
|
@@ -3910,17 +3911,17 @@ async function handleWebSocketGateway(runConfig, managerDriver, c, strippedPath)
|
|
|
3910
3911
|
if (protocols) {
|
|
3911
3912
|
const protocolList = protocols.split(",").map((p) => p.trim());
|
|
3912
3913
|
for (const protocol of protocolList) {
|
|
3913
|
-
if (protocol.startsWith(
|
|
3914
|
-
target = protocol.substring(
|
|
3915
|
-
} else if (protocol.startsWith(
|
|
3914
|
+
if (protocol.startsWith(_chunkZIAFEFUKcjs.WS_PROTOCOL_TARGET)) {
|
|
3915
|
+
target = protocol.substring(_chunkZIAFEFUKcjs.WS_PROTOCOL_TARGET.length);
|
|
3916
|
+
} else if (protocol.startsWith(_chunkZIAFEFUKcjs.WS_PROTOCOL_ACTOR)) {
|
|
3916
3917
|
actorId = decodeURIComponent(
|
|
3917
|
-
protocol.substring(
|
|
3918
|
+
protocol.substring(_chunkZIAFEFUKcjs.WS_PROTOCOL_ACTOR.length)
|
|
3918
3919
|
);
|
|
3919
|
-
} else if (protocol.startsWith(
|
|
3920
|
-
encodingRaw = protocol.substring(
|
|
3921
|
-
} else if (protocol.startsWith(
|
|
3920
|
+
} else if (protocol.startsWith(_chunkZIAFEFUKcjs.WS_PROTOCOL_ENCODING)) {
|
|
3921
|
+
encodingRaw = protocol.substring(_chunkZIAFEFUKcjs.WS_PROTOCOL_ENCODING.length);
|
|
3922
|
+
} else if (protocol.startsWith(_chunkZIAFEFUKcjs.WS_PROTOCOL_CONN_PARAMS)) {
|
|
3922
3923
|
connParamsRaw = decodeURIComponent(
|
|
3923
|
-
protocol.substring(
|
|
3924
|
+
protocol.substring(_chunkZIAFEFUKcjs.WS_PROTOCOL_CONN_PARAMS.length)
|
|
3924
3925
|
);
|
|
3925
3926
|
}
|
|
3926
3927
|
}
|
|
@@ -3950,8 +3951,8 @@ async function handleWebSocketGateway(runConfig, managerDriver, c, strippedPath)
|
|
|
3950
3951
|
);
|
|
3951
3952
|
}
|
|
3952
3953
|
async function handleHttpGateway(managerDriver, c, next, strippedPath) {
|
|
3953
|
-
const target = c.req.header(
|
|
3954
|
-
const actorId = c.req.header(
|
|
3954
|
+
const target = c.req.header(_chunkZIAFEFUKcjs.HEADER_RIVET_TARGET);
|
|
3955
|
+
const actorId = c.req.header(_chunkZIAFEFUKcjs.HEADER_RIVET_ACTOR);
|
|
3955
3956
|
if (target !== "actor") {
|
|
3956
3957
|
return next();
|
|
3957
3958
|
}
|
|
@@ -3965,8 +3966,8 @@ async function handleHttpGateway(managerDriver, c, next, strippedPath) {
|
|
|
3965
3966
|
method: c.req.method
|
|
3966
3967
|
});
|
|
3967
3968
|
const proxyHeaders = new Headers(c.req.raw.headers);
|
|
3968
|
-
proxyHeaders.delete(
|
|
3969
|
-
proxyHeaders.delete(
|
|
3969
|
+
proxyHeaders.delete(_chunkZIAFEFUKcjs.HEADER_RIVET_TARGET);
|
|
3970
|
+
proxyHeaders.delete(_chunkZIAFEFUKcjs.HEADER_RIVET_ACTOR);
|
|
3970
3971
|
const url = new URL(c.req.url);
|
|
3971
3972
|
const proxyUrl = new URL(`http://actor${strippedPath}${url.search}`);
|
|
3972
3973
|
const proxyRequest = new Request(proxyUrl, {
|
|
@@ -4060,7 +4061,7 @@ async function createTestWebSocketProxy(clientWsPromise) {
|
|
|
4060
4061
|
promise: serverWsPromise,
|
|
4061
4062
|
resolve: serverWsResolve,
|
|
4062
4063
|
reject: serverWsReject
|
|
4063
|
-
} =
|
|
4064
|
+
} = _chunk77UIPJTDcjs.promiseWithResolvers.call(void 0, );
|
|
4064
4065
|
try {
|
|
4065
4066
|
logger6().debug({ msg: "awaiting client websocket promise" });
|
|
4066
4067
|
const ws = await clientWsPromise;
|
|
@@ -4237,17 +4238,17 @@ async function createTestWebSocketProxy(clientWsPromise) {
|
|
|
4237
4238
|
|
|
4238
4239
|
var ServerlessStartHeadersSchema = _zod.z.object({
|
|
4239
4240
|
endpoint: _zod.z.string({
|
|
4240
|
-
|
|
4241
|
+
error: "x-rivet-endpoint header is required"
|
|
4241
4242
|
}),
|
|
4242
|
-
token: _zod.z.string({
|
|
4243
|
+
token: _zod.z.string({ error: "x-rivet-token header must be a string" }).optional(),
|
|
4243
4244
|
totalSlots: _zod.z.coerce.number({
|
|
4244
|
-
|
|
4245
|
-
}).int("x-rivet-total-slots header must be an integer").gte(1, "x-rivet-total-slots header must be positive"),
|
|
4245
|
+
error: "x-rivet-total-slots header must be a number"
|
|
4246
|
+
}).int({ error: "x-rivet-total-slots header must be an integer" }).gte(1, { error: "x-rivet-total-slots header must be positive" }),
|
|
4246
4247
|
runnerName: _zod.z.string({
|
|
4247
|
-
|
|
4248
|
+
error: "x-rivet-runner-name header is required"
|
|
4248
4249
|
}),
|
|
4249
4250
|
namespace: _zod.z.string({
|
|
4250
|
-
|
|
4251
|
+
error: "x-rivet-namespace-name header is required"
|
|
4251
4252
|
})
|
|
4252
4253
|
});
|
|
4253
4254
|
|
|
@@ -4309,7 +4310,7 @@ function createManagerRouter(registryConfig, runConfig, managerDriver, driverCon
|
|
|
4309
4310
|
} else if (runConfig.runnerKind === "normal") {
|
|
4310
4311
|
addManagerRoutes(registryConfig, runConfig, managerDriver, router);
|
|
4311
4312
|
} else {
|
|
4312
|
-
|
|
4313
|
+
_chunk77UIPJTDcjs.assertUnreachable.call(void 0, runConfig.runnerKind);
|
|
4313
4314
|
}
|
|
4314
4315
|
router.notFound(handleRouteNotFound);
|
|
4315
4316
|
router.onError(handleRouteError);
|
|
@@ -4376,13 +4377,13 @@ function addServerlessRoutes(driverConfig, registryConfig, runConfig, managerDri
|
|
|
4376
4377
|
}
|
|
4377
4378
|
function addManagerRoutes(registryConfig, runConfig, managerDriver, router) {
|
|
4378
4379
|
var _a;
|
|
4379
|
-
if (
|
|
4380
|
+
if (_chunkX4OVVIPRcjs.isInspectorEnabled.call(void 0, runConfig, "manager")) {
|
|
4380
4381
|
if (!managerDriver.inspector) {
|
|
4381
4382
|
throw new (0, _chunkXJMYGATEcjs.Unsupported)("inspector");
|
|
4382
4383
|
}
|
|
4383
4384
|
router.route(
|
|
4384
4385
|
"/inspect",
|
|
4385
|
-
new (0, _hono.Hono)().use(
|
|
4386
|
+
new (0, _hono.Hono)().use(_chunkX4OVVIPRcjs.secureInspector.call(void 0, runConfig)).use((c, next) => {
|
|
4386
4387
|
c.set("inspector", managerDriver.inspector);
|
|
4387
4388
|
return next();
|
|
4388
4389
|
}).route("/", createManagerInspectorRouter())
|
|
@@ -4598,7 +4599,7 @@ function addManagerRoutes(registryConfig, runConfig, managerDriver, router) {
|
|
|
4598
4599
|
);
|
|
4599
4600
|
response = { ok: output };
|
|
4600
4601
|
} catch (rawErr) {
|
|
4601
|
-
const err =
|
|
4602
|
+
const err = _chunk77UIPJTDcjs.deconstructError.call(void 0, rawErr, logger6(), {}, true);
|
|
4602
4603
|
response = { err };
|
|
4603
4604
|
}
|
|
4604
4605
|
return c.body(cbor4.encode(response));
|
|
@@ -4618,21 +4619,21 @@ function addManagerRoutes(registryConfig, runConfig, managerDriver, router) {
|
|
|
4618
4619
|
let path = "";
|
|
4619
4620
|
let params;
|
|
4620
4621
|
for (const protocol of protocols) {
|
|
4621
|
-
if (protocol.startsWith(
|
|
4622
|
+
if (protocol.startsWith(_chunkZIAFEFUKcjs.WS_PROTOCOL_ACTOR)) {
|
|
4622
4623
|
actorId = decodeURIComponent(
|
|
4623
|
-
protocol.substring(
|
|
4624
|
+
protocol.substring(_chunkZIAFEFUKcjs.WS_PROTOCOL_ACTOR.length)
|
|
4624
4625
|
);
|
|
4625
|
-
} else if (protocol.startsWith(
|
|
4626
|
+
} else if (protocol.startsWith(_chunkZIAFEFUKcjs.WS_PROTOCOL_ENCODING)) {
|
|
4626
4627
|
encoding = protocol.substring(
|
|
4627
|
-
|
|
4628
|
+
_chunkZIAFEFUKcjs.WS_PROTOCOL_ENCODING.length
|
|
4628
4629
|
);
|
|
4629
|
-
} else if (protocol.startsWith(
|
|
4630
|
+
} else if (protocol.startsWith(_chunkZIAFEFUKcjs.WS_TEST_PROTOCOL_PATH)) {
|
|
4630
4631
|
path = decodeURIComponent(
|
|
4631
|
-
protocol.substring(
|
|
4632
|
+
protocol.substring(_chunkZIAFEFUKcjs.WS_TEST_PROTOCOL_PATH.length)
|
|
4632
4633
|
);
|
|
4633
|
-
} else if (protocol.startsWith(
|
|
4634
|
+
} else if (protocol.startsWith(_chunkZIAFEFUKcjs.WS_PROTOCOL_CONN_PARAMS)) {
|
|
4634
4635
|
const paramsRaw = decodeURIComponent(
|
|
4635
|
-
protocol.substring(
|
|
4636
|
+
protocol.substring(_chunkZIAFEFUKcjs.WS_PROTOCOL_CONN_PARAMS.length)
|
|
4636
4637
|
);
|
|
4637
4638
|
params = JSON.parse(paramsRaw);
|
|
4638
4639
|
}
|
|
@@ -4651,10 +4652,10 @@ function addManagerRoutes(registryConfig, runConfig, managerDriver, router) {
|
|
|
4651
4652
|
params
|
|
4652
4653
|
);
|
|
4653
4654
|
return await createTestWebSocketProxy(clientWsPromise);
|
|
4654
|
-
})(c,
|
|
4655
|
+
})(c, _chunk77UIPJTDcjs.noopNext.call(void 0, ));
|
|
4655
4656
|
});
|
|
4656
4657
|
router.all(".test/inline-driver/send-request/*", async (c) => {
|
|
4657
|
-
const actorId = c.req.header(
|
|
4658
|
+
const actorId = c.req.header(_chunkZIAFEFUKcjs.HEADER_ACTOR_ID);
|
|
4658
4659
|
if (!actorId) {
|
|
4659
4660
|
return c.text("Missing required headers", 400);
|
|
4660
4661
|
}
|
|
@@ -4681,9 +4682,9 @@ function addManagerRoutes(registryConfig, runConfig, managerDriver, router) {
|
|
|
4681
4682
|
} catch (error) {
|
|
4682
4683
|
logger6().error({
|
|
4683
4684
|
msg: "error in test inline raw http",
|
|
4684
|
-
error:
|
|
4685
|
+
error: _chunk77UIPJTDcjs.stringifyError.call(void 0, error)
|
|
4685
4686
|
});
|
|
4686
|
-
const err =
|
|
4687
|
+
const err = _chunk77UIPJTDcjs.deconstructError.call(void 0, error, logger6(), {}, true);
|
|
4687
4688
|
return c.json(
|
|
4688
4689
|
{
|
|
4689
4690
|
error: {
|
|
@@ -4728,7 +4729,7 @@ function addManagerRoutes(registryConfig, runConfig, managerDriver, router) {
|
|
|
4728
4729
|
} catch (error) {
|
|
4729
4730
|
logger6().error({
|
|
4730
4731
|
msg: "error forcing disconnect",
|
|
4731
|
-
error:
|
|
4732
|
+
error: _chunk77UIPJTDcjs.stringifyError.call(void 0, error)
|
|
4732
4733
|
});
|
|
4733
4734
|
return c.text(`Error: ${error}`, 500);
|
|
4734
4735
|
}
|
|
@@ -4749,7 +4750,7 @@ function createApiActor(actor2, runnerName = "default") {
|
|
|
4749
4750
|
return {
|
|
4750
4751
|
actor_id: actor2.actorId,
|
|
4751
4752
|
name: actor2.name,
|
|
4752
|
-
key:
|
|
4753
|
+
key: _chunkNEM3XQSZcjs.serializeActorKey.call(void 0, actor2.key),
|
|
4753
4754
|
namespace_id: "default",
|
|
4754
4755
|
// Assert default namespace
|
|
4755
4756
|
runner_name_selector: runnerName,
|
|
@@ -4763,7 +4764,7 @@ function createApiActor(actor2, runnerName = "default") {
|
|
|
4763
4764
|
|
|
4764
4765
|
// src/registry/log.ts
|
|
4765
4766
|
function logger7() {
|
|
4766
|
-
return
|
|
4767
|
+
return _chunk77UIPJTDcjs.getLogger.call(void 0, "registry");
|
|
4767
4768
|
}
|
|
4768
4769
|
|
|
4769
4770
|
// src/registry/serve.ts
|
|
@@ -4822,7 +4823,7 @@ var Registry = class {
|
|
|
4822
4823
|
*/
|
|
4823
4824
|
start(inputConfig) {
|
|
4824
4825
|
var _a, _b, _c;
|
|
4825
|
-
const config2 =
|
|
4826
|
+
const config2 = _chunkCFMLY3P6cjs.RunnerConfigSchema.parse(inputConfig);
|
|
4826
4827
|
if (config2.autoConfigureServerless && config2.runnerKind !== "serverless") {
|
|
4827
4828
|
throw new Error(
|
|
4828
4829
|
"autoConfigureServerless can only be configured when runnerKind is 'serverless'"
|
|
@@ -4860,9 +4861,9 @@ var Registry = class {
|
|
|
4860
4861
|
config2.disableActorDriver = true;
|
|
4861
4862
|
}
|
|
4862
4863
|
if ((_a = config2.logging) == null ? void 0 : _a.baseLogger) {
|
|
4863
|
-
|
|
4864
|
+
_chunk77UIPJTDcjs.configureBaseLogger.call(void 0, config2.logging.baseLogger);
|
|
4864
4865
|
} else {
|
|
4865
|
-
|
|
4866
|
+
_chunk77UIPJTDcjs.configureDefaultLogger.call(void 0, (_b = config2.logging) == null ? void 0 : _b.level);
|
|
4866
4867
|
}
|
|
4867
4868
|
const driver = chooseDefaultDriver(config2);
|
|
4868
4869
|
if (driver.name === "engine") {
|
|
@@ -4882,8 +4883,8 @@ var Registry = class {
|
|
|
4882
4883
|
config2.getUpgradeWebSocket = () => upgradeWebSocket;
|
|
4883
4884
|
}
|
|
4884
4885
|
const managerDriver = driver.manager(this.#config, config2);
|
|
4885
|
-
|
|
4886
|
-
const client =
|
|
4886
|
+
_chunkX4OVVIPRcjs.configureInspectorAccessToken.call(void 0, config2, managerDriver);
|
|
4887
|
+
const client = _chunkNEM3XQSZcjs.createClientWithDriver.call(void 0, managerDriver, config2);
|
|
4887
4888
|
const driverLog = _nullishCoalesce(((_c = managerDriver.extraStartupLog) == null ? void 0 : _c.call(managerDriver)), () => ( {}));
|
|
4888
4889
|
logger7().info({
|
|
4889
4890
|
msg: "rivetkit ready",
|
|
@@ -4891,18 +4892,18 @@ var Registry = class {
|
|
|
4891
4892
|
definitions: Object.keys(this.#config.use).length,
|
|
4892
4893
|
...driverLog
|
|
4893
4894
|
});
|
|
4894
|
-
if (
|
|
4895
|
+
if (_chunkX4OVVIPRcjs.isInspectorEnabled.call(void 0, config2, "manager") && managerDriver.inspector) {
|
|
4895
4896
|
logger7().info({
|
|
4896
4897
|
msg: "inspector ready",
|
|
4897
|
-
url:
|
|
4898
|
+
url: _chunkX4OVVIPRcjs.getInspectorUrl.call(void 0, config2)
|
|
4898
4899
|
});
|
|
4899
4900
|
}
|
|
4900
4901
|
if (!config2.noWelcome) {
|
|
4901
4902
|
const displayInfo = managerDriver.displayInformation();
|
|
4902
4903
|
console.log();
|
|
4903
|
-
console.log(` RivetKit ${
|
|
4904
|
+
console.log(` RivetKit ${_chunk77UIPJTDcjs.package_default.version} (${displayInfo.name})`);
|
|
4904
4905
|
if (!config2.disableDefaultServer) {
|
|
4905
|
-
console.log(` - Endpoint: ${
|
|
4906
|
+
console.log(` - Endpoint: ${_chunkNEM3XQSZcjs.getEndpoint.call(void 0, config2)}`);
|
|
4906
4907
|
} else if (config2.overrideServerAddress) {
|
|
4907
4908
|
console.log(
|
|
4908
4909
|
` - Endpoint: ${config2.overrideServerAddress}`
|
|
@@ -4916,8 +4917,8 @@ var Registry = class {
|
|
|
4916
4917
|
const padding = " ".repeat(Math.max(0, 13 - k.length));
|
|
4917
4918
|
console.log(` - ${k}:${padding}${v}`);
|
|
4918
4919
|
}
|
|
4919
|
-
if (
|
|
4920
|
-
console.log(` - Inspector: ${
|
|
4920
|
+
if (_chunkX4OVVIPRcjs.isInspectorEnabled.call(void 0, config2, "manager") && managerDriver.inspector) {
|
|
4921
|
+
console.log(` - Inspector: ${_chunkX4OVVIPRcjs.getInspectorUrl.call(void 0, config2)}`);
|
|
4921
4922
|
}
|
|
4922
4923
|
console.log();
|
|
4923
4924
|
}
|
|
@@ -4986,7 +4987,7 @@ async function configureServerlessRunner(config2) {
|
|
|
4986
4987
|
msg: "fetching datacenters",
|
|
4987
4988
|
endpoint: config2.endpoint
|
|
4988
4989
|
});
|
|
4989
|
-
const dcsRes = await
|
|
4990
|
+
const dcsRes = await _chunkNEM3XQSZcjs.getDatacenters.call(void 0, clientConfig);
|
|
4990
4991
|
logger7().debug({
|
|
4991
4992
|
msg: "configuring serverless runner",
|
|
4992
4993
|
runnerName: config2.runnerName,
|
|
@@ -5004,7 +5005,7 @@ async function configureServerlessRunner(config2) {
|
|
|
5004
5005
|
},
|
|
5005
5006
|
metadata: _nullishCoalesce(customConfig.metadata, () => ( {}))
|
|
5006
5007
|
};
|
|
5007
|
-
await
|
|
5008
|
+
await _chunkNEM3XQSZcjs.updateRunnerConfig.call(void 0, clientConfig, config2.runnerName, {
|
|
5008
5009
|
datacenters: Object.fromEntries(
|
|
5009
5010
|
dcsRes.datacenters.map((dc) => [dc.name, serverlessConfig])
|
|
5010
5011
|
)
|
|
@@ -5041,4 +5042,4 @@ function setup(input) {
|
|
|
5041
5042
|
|
|
5042
5043
|
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;
|
|
5043
5044
|
//! These configs configs hold anything that's not platform-specific about running actors.
|
|
5044
|
-
//# sourceMappingURL=chunk-
|
|
5045
|
+
//# sourceMappingURL=chunk-SWFPKHMT.cjs.map
|