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