rivetkit 2.3.18 → 2.3.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/client.d.ts +754 -608
- package/dist/browser/client.js +184 -28
- package/dist/browser/client.js.map +1 -1
- package/dist/browser/inspector/client.js +3 -1
- package/dist/browser/inspector/client.js.map +1 -1
- package/dist/tsup/actor/errors.cjs +6 -2
- package/dist/tsup/actor/errors.cjs.map +1 -1
- package/dist/tsup/actor/errors.d.cts +1 -1
- package/dist/tsup/actor/errors.d.ts +1 -1
- package/dist/tsup/actor/errors.js +5 -1
- package/dist/tsup/agent-os/index.cjs +36 -1
- package/dist/tsup/agent-os/index.cjs.map +1 -1
- package/dist/tsup/agent-os/index.d.cts +149 -3
- package/dist/tsup/agent-os/index.d.ts +149 -3
- package/dist/tsup/agent-os/index.js +36 -1
- package/dist/tsup/agent-os/index.js.map +1 -1
- package/dist/tsup/{chunk-2IDK6NX3.cjs → chunk-2CE5UNWK.cjs} +13 -13
- package/dist/tsup/chunk-2CE5UNWK.cjs.map +1 -0
- package/dist/tsup/{chunk-IPXIZSE7.js → chunk-2NXLTFWI.js} +3 -3
- package/dist/tsup/{chunk-OKVVWOC3.cjs → chunk-3WS7Z64U.cjs} +3 -3
- package/dist/tsup/{chunk-OKVVWOC3.cjs.map → chunk-3WS7Z64U.cjs.map} +1 -1
- package/dist/tsup/{chunk-LAITPJRA.js → chunk-553CIQJY.js} +2 -2
- package/dist/tsup/{chunk-PXKNBNVU.js → chunk-5G2J26VM.js} +188 -31
- package/dist/tsup/chunk-5G2J26VM.js.map +1 -0
- package/dist/tsup/{chunk-IKZ6DJMP.cjs → chunk-76YTS32R.cjs} +4 -4
- package/dist/tsup/{chunk-IKZ6DJMP.cjs.map → chunk-76YTS32R.cjs.map} +1 -1
- package/dist/tsup/{chunk-NRIRV3Z2.cjs → chunk-A36FMKOV.cjs} +352 -195
- package/dist/tsup/chunk-A36FMKOV.cjs.map +1 -0
- package/dist/tsup/{chunk-6W5VGLFT.js → chunk-CSOHAAZK.js} +33 -1
- package/dist/tsup/chunk-CSOHAAZK.js.map +1 -0
- package/dist/tsup/{chunk-T6JUXRNI.cjs → chunk-CVLNRT7O.cjs} +3 -3
- package/dist/tsup/{chunk-T6JUXRNI.cjs.map → chunk-CVLNRT7O.cjs.map} +1 -1
- package/dist/tsup/{chunk-7EPLADKM.js → chunk-DHWZTUKA.js} +7 -7
- package/dist/tsup/chunk-DHWZTUKA.js.map +1 -0
- package/dist/tsup/{chunk-4XECVATQ.js → chunk-DMQUERRN.js} +2 -2
- package/dist/tsup/{chunk-25Z2RK7C.cjs → chunk-IHKDFKM4.cjs} +3 -3
- package/dist/tsup/{chunk-25Z2RK7C.cjs.map → chunk-IHKDFKM4.cjs.map} +1 -1
- package/dist/tsup/{chunk-2JSYYH6P.cjs → chunk-JX2ITWAV.cjs} +13 -2
- package/dist/tsup/chunk-JX2ITWAV.cjs.map +1 -0
- package/dist/tsup/{chunk-4KGXFC6M.cjs → chunk-NWCAIWHL.cjs} +34 -2
- package/dist/tsup/chunk-NWCAIWHL.cjs.map +1 -0
- package/dist/tsup/{chunk-OUQUIBVW.js → chunk-P2OFXH4G.js} +12 -1
- package/dist/tsup/chunk-P2OFXH4G.js.map +1 -0
- package/dist/tsup/{chunk-ZRTESY7V.cjs → chunk-RSIOGT2U.cjs} +7 -7
- package/dist/tsup/{chunk-ZRTESY7V.cjs.map → chunk-RSIOGT2U.cjs.map} +1 -1
- package/dist/tsup/{chunk-QIFZELUQ.js → chunk-SNNVRHLX.js} +2 -2
- package/dist/tsup/{chunk-2MK75JFR.js → chunk-TZVAVPGJ.js} +4 -4
- package/dist/tsup/{chunk-TNSLNSQH.js → chunk-W2PXGWMR.js} +2 -2
- package/dist/tsup/{chunk-O7RSU3UC.cjs → chunk-WAISW7KR.cjs} +10 -10
- package/dist/tsup/{chunk-O7RSU3UC.cjs.map → chunk-WAISW7KR.cjs.map} +1 -1
- package/dist/tsup/client/mod.cjs +6 -6
- package/dist/tsup/client/mod.d.cts +5 -5
- package/dist/tsup/client/mod.d.ts +5 -5
- package/dist/tsup/client/mod.js +5 -5
- package/dist/tsup/common/log.cjs +3 -3
- package/dist/tsup/common/log.js +2 -2
- package/dist/tsup/common/websocket.cjs +4 -4
- package/dist/tsup/common/websocket.js +3 -3
- package/dist/tsup/{config-Ug5M2MOr.d.ts → config-Be-VOHaX.d.ts} +155 -11
- package/dist/tsup/{config-gvHwMas-.d.cts → config-Ct5uXxXk.d.cts} +155 -11
- package/dist/tsup/{context-DererUCI.d.ts → context-CXLa0BIM.d.ts} +1 -1
- package/dist/tsup/{context-BSCBvbfM.d.cts → context-Cw-11Q-B.d.cts} +1 -1
- package/dist/tsup/db/drizzle.cjs +3 -3
- package/dist/tsup/db/drizzle.js +2 -2
- package/dist/tsup/db/mod.cjs +4 -4
- package/dist/tsup/db/mod.js +3 -3
- package/dist/tsup/dynamic/mod.cjs +2 -2
- package/dist/tsup/dynamic/mod.d.cts +3 -3
- package/dist/tsup/dynamic/mod.d.ts +3 -3
- package/dist/tsup/dynamic/mod.js +1 -1
- package/dist/tsup/inspector/mod.cjs +6 -6
- package/dist/tsup/inspector/mod.js +5 -5
- package/dist/tsup/inspector/workflow.cjs +5 -5
- package/dist/tsup/inspector/workflow.js +4 -4
- package/dist/tsup/inspector-tab/mod.cjs +2 -2
- package/dist/tsup/inspector-tab/mod.d.cts +4 -4
- package/dist/tsup/inspector-tab/mod.d.ts +4 -4
- package/dist/tsup/inspector-tab/mod.js +1 -1
- package/dist/tsup/mod.cjs +506 -319
- package/dist/tsup/mod.cjs.map +1 -1
- package/dist/tsup/mod.d.cts +5 -5
- package/dist/tsup/mod.d.ts +5 -5
- package/dist/tsup/mod.js +381 -194
- package/dist/tsup/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +7 -7
- package/dist/tsup/test/mod.d.cts +3 -3
- package/dist/tsup/test/mod.d.ts +3 -3
- package/dist/tsup/test/mod.js +5 -5
- package/dist/tsup/{utils-Bbz-3411.d.cts → utils-CNFeS-Dk.d.cts} +1 -1
- package/dist/tsup/{utils-vvJQyygr.d.ts → utils-DsoDinPz.d.cts} +9 -1
- package/dist/tsup/{utils-vvJQyygr.d.cts → utils-DsoDinPz.d.ts} +9 -1
- package/dist/tsup/{utils-BqdWVlzm.d.ts → utils-OQHBjfcM.d.ts} +1 -1
- package/dist/tsup/utils.cjs +3 -3
- package/dist/tsup/utils.d.cts +2 -2
- package/dist/tsup/utils.d.ts +2 -2
- package/dist/tsup/utils.js +2 -2
- package/dist/tsup/workflow/mod.cjs +33 -27
- package/dist/tsup/workflow/mod.cjs.map +1 -1
- package/dist/tsup/workflow/mod.d.cts +5 -5
- package/dist/tsup/workflow/mod.d.ts +5 -5
- package/dist/tsup/workflow/mod.js +25 -19
- package/dist/tsup/workflow/mod.js.map +1 -1
- package/package.json +10 -8
- package/src/actor/actions.ts +36 -0
- package/src/actor/config.ts +65 -0
- package/src/actor/definition.ts +6 -1
- package/src/actor/errors.ts +31 -0
- package/src/actor/mod.ts +5 -0
- package/src/actor/tracing.ts +28 -0
- package/src/client/actor-conn.ts +7 -0
- package/src/client/actor-handle.ts +57 -17
- package/src/client/client.ts +26 -6
- package/src/client/outbound-telemetry.ts +66 -0
- package/src/client/queue.ts +3 -0
- package/src/client/raw-utils.ts +3 -0
- package/src/common/actor-router-consts.ts +3 -0
- package/src/common/actor-telemetry-context.ts +19 -0
- package/src/common/otel-context.ts +99 -0
- package/src/common/utils.ts +1 -19
- package/src/engine-client/actor-http-client.ts +15 -0
- package/src/registry/index.ts +6 -0
- package/src/registry/napi-runtime.ts +155 -35
- package/src/registry/native.ts +295 -191
- package/src/registry/runtime.ts +74 -0
- package/src/registry/wasm-runtime.ts +40 -0
- package/src/workflow/driver.ts +20 -12
- package/dist/tsup/chunk-2IDK6NX3.cjs.map +0 -1
- package/dist/tsup/chunk-2JSYYH6P.cjs.map +0 -1
- package/dist/tsup/chunk-4KGXFC6M.cjs.map +0 -1
- package/dist/tsup/chunk-6W5VGLFT.js.map +0 -1
- package/dist/tsup/chunk-7EPLADKM.js.map +0 -1
- package/dist/tsup/chunk-NRIRV3Z2.cjs.map +0 -1
- package/dist/tsup/chunk-OUQUIBVW.js.map +0 -1
- package/dist/tsup/chunk-PXKNBNVU.js.map +0 -1
- /package/dist/tsup/{chunk-IPXIZSE7.js.map → chunk-2NXLTFWI.js.map} +0 -0
- /package/dist/tsup/{chunk-LAITPJRA.js.map → chunk-553CIQJY.js.map} +0 -0
- /package/dist/tsup/{chunk-4XECVATQ.js.map → chunk-DMQUERRN.js.map} +0 -0
- /package/dist/tsup/{chunk-QIFZELUQ.js.map → chunk-SNNVRHLX.js.map} +0 -0
- /package/dist/tsup/{chunk-2MK75JFR.js.map → chunk-TZVAVPGJ.js.map} +0 -0
- /package/dist/tsup/{chunk-TNSLNSQH.js.map → chunk-W2PXGWMR.js.map} +0 -0
package/dist/tsup/mod.cjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } var _class; var _class2; var _class3;
|
|
2
2
|
|
|
3
|
-
var _chunkIKZ6DJMPcjs = require('./chunk-IKZ6DJMP.cjs');
|
|
4
3
|
|
|
5
4
|
|
|
6
5
|
|
|
@@ -15,9 +14,10 @@ var _chunkIKZ6DJMPcjs = require('./chunk-IKZ6DJMP.cjs');
|
|
|
15
14
|
|
|
16
15
|
|
|
17
16
|
|
|
17
|
+
var _chunkNWCAIWHLcjs = require('./chunk-NWCAIWHL.cjs');
|
|
18
18
|
|
|
19
|
-
var _chunk4KGXFC6Mcjs = require('./chunk-4KGXFC6M.cjs');
|
|
20
19
|
|
|
20
|
+
var _chunk76YTS32Rcjs = require('./chunk-76YTS32R.cjs');
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
|
|
@@ -28,18 +28,21 @@ var _chunk4KGXFC6Mcjs = require('./chunk-4KGXFC6M.cjs');
|
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
var _chunkA36FMKOVcjs = require('./chunk-A36FMKOV.cjs');
|
|
32
35
|
|
|
33
36
|
|
|
34
37
|
|
|
35
38
|
var _chunkMYWZCDMLcjs = require('./chunk-MYWZCDML.cjs');
|
|
39
|
+
require('./chunk-3WS7Z64U.cjs');
|
|
36
40
|
|
|
37
41
|
|
|
38
42
|
|
|
39
43
|
|
|
40
|
-
var
|
|
44
|
+
var _chunkCVLNRT7Ocjs = require('./chunk-CVLNRT7O.cjs');
|
|
41
45
|
require('./chunk-KVFIONKQ.cjs');
|
|
42
|
-
require('./chunk-OKVVWOC3.cjs');
|
|
43
46
|
|
|
44
47
|
|
|
45
48
|
|
|
@@ -73,7 +76,7 @@ require('./chunk-OKVVWOC3.cjs');
|
|
|
73
76
|
|
|
74
77
|
|
|
75
78
|
|
|
76
|
-
var
|
|
79
|
+
var _chunk2CE5UNWKcjs = require('./chunk-2CE5UNWK.cjs');
|
|
77
80
|
|
|
78
81
|
|
|
79
82
|
|
|
@@ -85,11 +88,12 @@ var _chunk2IDK6NX3cjs = require('./chunk-2IDK6NX3.cjs');
|
|
|
85
88
|
|
|
86
89
|
|
|
87
90
|
|
|
88
|
-
|
|
91
|
+
|
|
92
|
+
var _chunkJX2ITWAVcjs = require('./chunk-JX2ITWAV.cjs');
|
|
89
93
|
|
|
90
94
|
// src/actor/log.ts
|
|
91
95
|
function loggerWithoutContext() {
|
|
92
|
-
return
|
|
96
|
+
return _chunk2CE5UNWKcjs.getLogger.call(void 0, "actor-runtime");
|
|
93
97
|
}
|
|
94
98
|
|
|
95
99
|
// src/actor/definition.ts
|
|
@@ -125,12 +129,14 @@ function isStaticActorInstance(_actor) {
|
|
|
125
129
|
return true;
|
|
126
130
|
}
|
|
127
131
|
function actor(input) {
|
|
132
|
+
var _a;
|
|
128
133
|
warnDeprecatedOptionKeys(
|
|
129
134
|
input == null ? void 0 : input.options
|
|
130
135
|
);
|
|
131
|
-
const config =
|
|
132
|
-
|
|
133
|
-
|
|
136
|
+
const config = _chunkNWCAIWHLcjs.ActorConfigSchema.parse(input);
|
|
137
|
+
_chunkNWCAIWHLcjs.flattenActionHandlers.call(void 0, config.actions);
|
|
138
|
+
_chunkNWCAIWHLcjs.flattenActionInputSchemas.call(void 0, config.actions, config.actionInputSchemas);
|
|
139
|
+
_chunkNWCAIWHLcjs.flattenActionTraceSamplers.call(void 0, config.actions, (_a = config.tracing) == null ? void 0 : _a.actions);
|
|
134
140
|
return new ActorDefinition(config);
|
|
135
141
|
}
|
|
136
142
|
function isStaticActorDefinition(definition) {
|
|
@@ -212,7 +218,7 @@ function validateSchemaSync(schemas, key, data) {
|
|
|
212
218
|
if (isStandardSchema(schema)) {
|
|
213
219
|
const result = schema["~standard"].validate(data);
|
|
214
220
|
if (isPromiseLike(result)) {
|
|
215
|
-
throw
|
|
221
|
+
throw _chunkJX2ITWAVcjs.unsupportedFeature.call(void 0, "async schema validation");
|
|
216
222
|
}
|
|
217
223
|
if (result.issues) {
|
|
218
224
|
return { success: false, issues: [...result.issues] };
|
|
@@ -229,7 +235,7 @@ function validateSchemaSync(schemas, key, data) {
|
|
|
229
235
|
var _virtualwebsocket = require('@rivetkit/virtual-websocket');
|
|
230
236
|
var _ws = require('hono/ws');
|
|
231
237
|
function logger() {
|
|
232
|
-
return
|
|
238
|
+
return _chunk2CE5UNWKcjs.getLogger.call(void 0, "inline-websocket-adapter");
|
|
233
239
|
}
|
|
234
240
|
var InlineWebSocketAdapter = class {
|
|
235
241
|
#handler;
|
|
@@ -400,7 +406,7 @@ function isLocalEngineEndpoint(endpoint) {
|
|
|
400
406
|
|
|
401
407
|
// src/registry/log.ts
|
|
402
408
|
function logger2() {
|
|
403
|
-
return
|
|
409
|
+
return _chunk2CE5UNWKcjs.getLogger.call(void 0, "registry");
|
|
404
410
|
}
|
|
405
411
|
|
|
406
412
|
// src/serverless/configure.ts
|
|
@@ -446,8 +452,8 @@ async function configureServerlessPool(config) {
|
|
|
446
452
|
);
|
|
447
453
|
}
|
|
448
454
|
const customConfig = config.configurePool;
|
|
449
|
-
const clientConfig =
|
|
450
|
-
const dcsRes = await
|
|
455
|
+
const clientConfig = _chunkA36FMKOVcjs.convertRegistryConfigToClientConfig.call(void 0, config);
|
|
456
|
+
const dcsRes = await _chunkA36FMKOVcjs.getDatacenters.call(void 0, clientConfig);
|
|
451
457
|
const poolName = _nullishCoalesce(customConfig.name, () => ( "default"));
|
|
452
458
|
const serverlessToken = _nullishCoalesce(config.token, () => ( config.publicToken));
|
|
453
459
|
const headers = {
|
|
@@ -469,7 +475,7 @@ async function configureServerlessPool(config) {
|
|
|
469
475
|
metadata: _nullishCoalesce(customConfig.metadata, () => ( {})),
|
|
470
476
|
drain_on_version_upgrade: _nullishCoalesce(customConfig.drainOnVersionUpgrade, () => ( true))
|
|
471
477
|
};
|
|
472
|
-
await
|
|
478
|
+
await _chunkA36FMKOVcjs.updateRunnerConfig.call(void 0, clientConfig, poolName, {
|
|
473
479
|
datacenters: Object.fromEntries(
|
|
474
480
|
dcsRes.datacenters.map((dc) => [dc.name, serverlessConfig])
|
|
475
481
|
)
|
|
@@ -486,7 +492,7 @@ async function configureServerlessPool(config) {
|
|
|
486
492
|
logger2().warn({
|
|
487
493
|
msg: "serverless pool configuration attempt failed",
|
|
488
494
|
attempts,
|
|
489
|
-
error:
|
|
495
|
+
error: _chunk2CE5UNWKcjs.stringifyError.call(void 0, error)
|
|
490
496
|
});
|
|
491
497
|
await sleep(CONFIGURE_RETRY_DELAY_MS);
|
|
492
498
|
}
|
|
@@ -494,7 +500,7 @@ async function configureServerlessPool(config) {
|
|
|
494
500
|
logger2().error({
|
|
495
501
|
msg: "failed to configure serverless pool, validate endpoint is configured correctly then restart this process",
|
|
496
502
|
attempts,
|
|
497
|
-
error:
|
|
503
|
+
error: _chunk2CE5UNWKcjs.stringifyError.call(void 0, lastError)
|
|
498
504
|
});
|
|
499
505
|
throw lastError;
|
|
500
506
|
}
|
|
@@ -506,20 +512,20 @@ var _zod = require('zod');
|
|
|
506
512
|
var _v4 = require('zod/v4');
|
|
507
513
|
var warnedMissingVersion = false;
|
|
508
514
|
var EnvoyConfigSchema = _v4.z.object({
|
|
509
|
-
poolName: _v4.z.string().default(() => _nullishCoalesce(
|
|
515
|
+
poolName: _v4.z.string().default(() => _nullishCoalesce(_chunk2CE5UNWKcjs.getRivetPool.call(void 0, ), () => ( "default"))),
|
|
510
516
|
version: _v4.z.number().default(() => {
|
|
511
|
-
const version =
|
|
517
|
+
const version = _chunk2CE5UNWKcjs.getRivetEnvoyVersion.call(void 0, );
|
|
512
518
|
if (version !== void 0) return version;
|
|
513
|
-
if (
|
|
519
|
+
if (_chunk2CE5UNWKcjs.getNodeEnv.call(void 0, ) === "production" && !warnedMissingVersion) {
|
|
514
520
|
warnedMissingVersion = true;
|
|
515
|
-
|
|
521
|
+
_chunk2CE5UNWKcjs.getLogger.call(void 0, "rivetkit").error(
|
|
516
522
|
"RIVET_ENVOY_VERSION is not set. Actors will not be versioned, which means they won't be drained on deploy. This is only needed when self-hosting or using a custom envoy (not needed for Rivet Compute). Set this as a build arg in your Dockerfile. See https://rivet.dev/docs/actors/versions"
|
|
517
523
|
);
|
|
518
524
|
}
|
|
519
525
|
return 1;
|
|
520
526
|
}),
|
|
521
527
|
// Deprecated.
|
|
522
|
-
totalSlots: _v4.z.number().default(() => _nullishCoalesce(
|
|
528
|
+
totalSlots: _v4.z.number().default(() => _nullishCoalesce(_chunk2CE5UNWKcjs.getRivetTotalSlots.call(void 0, ), () => ( 1e5))),
|
|
523
529
|
envoyKey: _v4.z.string().optional()
|
|
524
530
|
});
|
|
525
531
|
|
|
@@ -557,7 +563,7 @@ var ServerlessConfigSchema = _v4.z.object({
|
|
|
557
563
|
*
|
|
558
564
|
* Can also be set via RIVET_PUBLIC_ENDPOINT environment variable.
|
|
559
565
|
*/
|
|
560
|
-
publicEndpoint: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => (
|
|
566
|
+
publicEndpoint: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunk2CE5UNWKcjs.getRivetPublicEndpoint.call(void 0, )))),
|
|
561
567
|
/**
|
|
562
568
|
* Token that clients should use when connecting via the public endpoint.
|
|
563
569
|
*
|
|
@@ -565,7 +571,7 @@ var ServerlessConfigSchema = _v4.z.object({
|
|
|
565
571
|
*
|
|
566
572
|
* Can also be specified in the publicEndpoint URL as `https://namespace:token@host`.
|
|
567
573
|
*/
|
|
568
|
-
publicToken: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => (
|
|
574
|
+
publicToken: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunk2CE5UNWKcjs.getRivetPublicToken.call(void 0, ))))
|
|
569
575
|
// There is no publicNamespace config option because the frontend and backend
|
|
570
576
|
// cannot use different namespaces. The namespace is extracted from the
|
|
571
577
|
// publicEndpoint URL auth syntax if provided.
|
|
@@ -619,7 +625,7 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
619
625
|
* Runtime binding to use for RivetKit core.
|
|
620
626
|
* */
|
|
621
627
|
runtime: RuntimeKindSchema.optional().transform((val, ctx) => {
|
|
622
|
-
const rawRuntime = _nullishCoalesce(val, () => (
|
|
628
|
+
const rawRuntime = _nullishCoalesce(val, () => ( _chunk2CE5UNWKcjs.getRivetkitRuntime.call(void 0, )));
|
|
623
629
|
if (rawRuntime === void 0) {
|
|
624
630
|
return "auto";
|
|
625
631
|
}
|
|
@@ -656,7 +662,7 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
656
662
|
* */
|
|
657
663
|
logging: _zod.z.object({
|
|
658
664
|
baseLogger: _zod.z.custom().optional(),
|
|
659
|
-
level:
|
|
665
|
+
level: _chunk2CE5UNWKcjs.LogLevelSchema.optional()
|
|
660
666
|
}).optional().default(() => ({})),
|
|
661
667
|
// MARK: Routing
|
|
662
668
|
// // This is a function to allow for lazy configuration of upgradeWebSocket on the
|
|
@@ -674,9 +680,9 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
674
680
|
*
|
|
675
681
|
* Can also be set via RIVET_ENDPOINT environment variables.
|
|
676
682
|
*/
|
|
677
|
-
endpoint: _zod.z.string().optional().transform((val) => _nullishCoalesce(_nullishCoalesce(val, () => (
|
|
678
|
-
token: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => (
|
|
679
|
-
namespace: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => (
|
|
683
|
+
endpoint: _zod.z.string().optional().transform((val) => _nullishCoalesce(_nullishCoalesce(val, () => ( _chunk2CE5UNWKcjs.getRivetEngine.call(void 0, ))), () => ( _chunk2CE5UNWKcjs.getRivetEndpoint.call(void 0, )))),
|
|
684
|
+
token: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunk2CE5UNWKcjs.getRivetToken.call(void 0, )))),
|
|
685
|
+
namespace: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunk2CE5UNWKcjs.getRivetNamespace.call(void 0, )))),
|
|
680
686
|
headers: _zod.z.record(_zod.z.string(), _zod.z.string()).optional().default({}),
|
|
681
687
|
// MARK: Client
|
|
682
688
|
// TODO:
|
|
@@ -716,21 +722,21 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
716
722
|
*
|
|
717
723
|
* Starts the full Rust engine process locally.
|
|
718
724
|
*/
|
|
719
|
-
startEngine: _zod.z.boolean().default(() =>
|
|
725
|
+
startEngine: _zod.z.boolean().default(() => _chunk2CE5UNWKcjs.getRivetRunEngine.call(void 0, )),
|
|
720
726
|
/**
|
|
721
727
|
* @experimental
|
|
722
728
|
*
|
|
723
729
|
* Host to bind the spawned local engine process to.
|
|
724
730
|
*/
|
|
725
|
-
engineHost: _zod.z.string().optional().default(() => _nullishCoalesce(
|
|
731
|
+
engineHost: _zod.z.string().optional().default(() => _nullishCoalesce(_chunk2CE5UNWKcjs.getRivetRunEngineHost.call(void 0, ), () => ( ENGINE_HOST))),
|
|
726
732
|
/**
|
|
727
733
|
* @experimental
|
|
728
734
|
*
|
|
729
735
|
* Port to bind the spawned local engine process to.
|
|
730
736
|
*/
|
|
731
|
-
enginePort: _zod.z.number().int().min(1).max(65535).optional().default(() => _nullishCoalesce(
|
|
737
|
+
enginePort: _zod.z.number().int().min(1).max(65535).optional().default(() => _nullishCoalesce(_chunk2CE5UNWKcjs.getRivetRunEnginePort.call(void 0, ), () => ( ENGINE_PORT))),
|
|
732
738
|
/** @experimental */
|
|
733
|
-
engineVersion: _zod.z.string().optional().default(() => _nullishCoalesce(
|
|
739
|
+
engineVersion: _zod.z.string().optional().default(() => _nullishCoalesce(_chunk2CE5UNWKcjs.getRivetRunEngineVersion.call(void 0, ), () => ( _chunk2CE5UNWKcjs.VERSION))),
|
|
734
740
|
/**
|
|
735
741
|
* Starts the first-party Services actor host when RivetKit manages
|
|
736
742
|
* a local engine. Defaults to the local-engine decision. Set
|
|
@@ -784,7 +790,7 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
784
790
|
}))
|
|
785
791
|
}).transform((config, ctx) => {
|
|
786
792
|
var _a, _b, _c;
|
|
787
|
-
const isDevEnv =
|
|
793
|
+
const isDevEnv = _chunk2CE5UNWKcjs.isDev.call(void 0, );
|
|
788
794
|
const sqliteBackend = _nullishCoalesce(((_a = config.sqlite) == null ? void 0 : _a.backend), () => ( ((_b = config.test) == null ? void 0 : _b.sqliteBackend)));
|
|
789
795
|
if (config.runtime === "wasm" && sqliteBackend === "local") {
|
|
790
796
|
ctx.addIssue({
|
|
@@ -794,7 +800,7 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
794
800
|
});
|
|
795
801
|
}
|
|
796
802
|
const sqlite = config.runtime === "wasm" && config.sqlite === void 0 ? { backend: "remote" } : config.sqlite;
|
|
797
|
-
const parsedEndpoint = config.endpoint ?
|
|
803
|
+
const parsedEndpoint = config.endpoint ? _chunkA36FMKOVcjs.tryParseEndpoint.call(void 0, ctx, {
|
|
798
804
|
endpoint: config.endpoint,
|
|
799
805
|
path: ["endpoint"],
|
|
800
806
|
namespace: config.namespace,
|
|
@@ -817,13 +823,13 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
817
823
|
config.enginePort
|
|
818
824
|
);
|
|
819
825
|
const endpoint = config.startEngine ? localEngineEndpoint : _nullishCoalesce((parsedEndpoint == null ? void 0 : parsedEndpoint.endpoint), () => ( (isDevEnv ? localEngineEndpoint : void 0)));
|
|
820
|
-
const startServices = _nullishCoalesce(_nullishCoalesce(config.startServices, () => (
|
|
826
|
+
const startServices = _nullishCoalesce(_nullishCoalesce(config.startServices, () => ( _chunk2CE5UNWKcjs.getRivetRunServices.call(void 0, ))), () => ( Boolean(endpoint && isLocalEngineEndpoint(endpoint))));
|
|
821
827
|
const validateServerlessEndpoint = Boolean(
|
|
822
828
|
config.startEngine || parsedEndpoint
|
|
823
829
|
);
|
|
824
830
|
const namespace = _nullishCoalesce(_nullishCoalesce((parsedEndpoint == null ? void 0 : parsedEndpoint.namespace), () => ( config.namespace)), () => ( "default"));
|
|
825
831
|
const token = _nullishCoalesce(_nullishCoalesce((parsedEndpoint == null ? void 0 : parsedEndpoint.token), () => ( config.token)), () => ( "dev"));
|
|
826
|
-
const parsedPublicEndpoint = config.serverless.publicEndpoint ?
|
|
832
|
+
const parsedPublicEndpoint = config.serverless.publicEndpoint ? _chunkA36FMKOVcjs.tryParseEndpoint.call(void 0, ctx, {
|
|
827
833
|
endpoint: config.serverless.publicEndpoint,
|
|
828
834
|
path: ["serverless", "publicEndpoint"]
|
|
829
835
|
}) : void 0;
|
|
@@ -859,7 +865,7 @@ function buildActorNames(config) {
|
|
|
859
865
|
Object.keys(config.use).map((actorName) => {
|
|
860
866
|
const definition = config.use[actorName];
|
|
861
867
|
const options = _nullishCoalesce(definition.config.options, () => ( {}));
|
|
862
|
-
const runMeta =
|
|
868
|
+
const runMeta = _chunkNWCAIWHLcjs.getRunMetadata.call(void 0, definition.config.run);
|
|
863
869
|
const metadata = {};
|
|
864
870
|
metadata.icon = _nullishCoalesce(options.icon, () => ( runMeta.icon));
|
|
865
871
|
metadata.name = _nullishCoalesce(options.name, () => ( runMeta.name));
|
|
@@ -927,7 +933,7 @@ var DocRegistryConfigSchema = _zod.z.object({
|
|
|
927
933
|
noWelcome: _zod.z.boolean().optional().describe("Disable the welcome message on startup. Default: false"),
|
|
928
934
|
sqlite: DocSqliteConfigSchema,
|
|
929
935
|
logging: _zod.z.object({
|
|
930
|
-
level:
|
|
936
|
+
level: _chunk2CE5UNWKcjs.LogLevelSchema.optional().describe(
|
|
931
937
|
"Log level for RivetKit. Default: 'warn'"
|
|
932
938
|
)
|
|
933
939
|
}).optional().describe("Logging configuration."),
|
|
@@ -975,7 +981,7 @@ function shouldAttachNativeKvError(message) {
|
|
|
975
981
|
function enrichNativeDatabaseError(database, error) {
|
|
976
982
|
var _a;
|
|
977
983
|
const bridgeReason = typeof error === "string" ? error : error instanceof Error ? error.message : void 0;
|
|
978
|
-
const bridged = bridgeReason === void 0 ? void 0 :
|
|
984
|
+
const bridged = bridgeReason === void 0 ? void 0 : _chunkJX2ITWAVcjs.decodeBridgeRivetError.call(void 0, bridgeReason);
|
|
979
985
|
if (bridged) {
|
|
980
986
|
throw bridged;
|
|
981
987
|
}
|
|
@@ -1545,20 +1551,43 @@ function toNapiQueueMessage(message) {
|
|
|
1545
1551
|
var NapiCoreRuntime = (_class = class {
|
|
1546
1552
|
__init() {this.kind = "napi"}
|
|
1547
1553
|
#bindings;
|
|
1548
|
-
#
|
|
1549
|
-
|
|
1554
|
+
#sqlOpened = /* @__PURE__ */ new WeakSet();
|
|
1555
|
+
#invocationContext;
|
|
1556
|
+
constructor(bindings, invocationContext) {;_class.prototype.__init.call(this);
|
|
1550
1557
|
this.#bindings = bindings;
|
|
1558
|
+
this.#invocationContext = invocationContext;
|
|
1551
1559
|
}
|
|
1552
|
-
#
|
|
1553
|
-
const
|
|
1554
|
-
|
|
1555
|
-
if (!
|
|
1556
|
-
|
|
1557
|
-
this.#sql.set(nativeCtx, database);
|
|
1560
|
+
#actorContextForOperation(owner) {
|
|
1561
|
+
const ownerCtx = asNativeActorContext(owner);
|
|
1562
|
+
const active = this.#invocationContext.getStore();
|
|
1563
|
+
if (!(active == null ? void 0 : active.sameActorInstance(ownerCtx))) {
|
|
1564
|
+
return ownerCtx;
|
|
1558
1565
|
}
|
|
1559
|
-
|
|
1566
|
+
const applicationSpan = _chunkA36FMKOVcjs.readActiveTraceHeaders.call(void 0, );
|
|
1567
|
+
if (!applicationSpan) {
|
|
1568
|
+
return active;
|
|
1569
|
+
}
|
|
1570
|
+
return active.withApplicationSpan(
|
|
1571
|
+
applicationSpan.traceparent,
|
|
1572
|
+
_nullishCoalesce(applicationSpan.tracestate, () => ( null))
|
|
1573
|
+
);
|
|
1574
|
+
}
|
|
1575
|
+
#actorSql(ctx) {
|
|
1576
|
+
this.#sqlOpened.add(asNativeActorContext(ctx));
|
|
1577
|
+
return this.#actorContextForOperation(ctx).sql();
|
|
1560
1578
|
}
|
|
1561
1579
|
createRegistry() {
|
|
1580
|
+
this.#bindings.setTelemetryLogSink(
|
|
1581
|
+
(event2) => {
|
|
1582
|
+
const fields = { otelEvent: event2.name };
|
|
1583
|
+
const message = event2.message || event2.name;
|
|
1584
|
+
if (event2.level === "error") {
|
|
1585
|
+
logger2().error(fields, message);
|
|
1586
|
+
} else {
|
|
1587
|
+
logger2().warn(fields, message);
|
|
1588
|
+
}
|
|
1589
|
+
}
|
|
1590
|
+
);
|
|
1562
1591
|
return asRegistryHandle(new this.#bindings.CoreRegistry());
|
|
1563
1592
|
}
|
|
1564
1593
|
registerActor(registry, name, factory) {
|
|
@@ -1573,6 +1602,9 @@ var NapiCoreRuntime = (_class = class {
|
|
|
1573
1602
|
async shutdownRegistry(registry) {
|
|
1574
1603
|
await asNativeRegistry(registry).shutdown();
|
|
1575
1604
|
}
|
|
1605
|
+
async shutdownTelemetry() {
|
|
1606
|
+
await this.#bindings.shutdownTelemetry();
|
|
1607
|
+
}
|
|
1576
1608
|
async registryActorStopThresholdMs(registry) {
|
|
1577
1609
|
return await _asyncNullishCoalesce(await asNativeRegistry(registry).actorStopThresholdMs(), async () => ( void 0));
|
|
1578
1610
|
}
|
|
@@ -1726,6 +1758,57 @@ var NapiCoreRuntime = (_class = class {
|
|
|
1726
1758
|
actorId(ctx) {
|
|
1727
1759
|
return asNativeActorContext(ctx).actorId();
|
|
1728
1760
|
}
|
|
1761
|
+
runWithActorInvocationContext(ctx, run) {
|
|
1762
|
+
return this.#runAs(asNativeActorContext(ctx), run);
|
|
1763
|
+
}
|
|
1764
|
+
#runAs(nativeCtx, run) {
|
|
1765
|
+
var _a;
|
|
1766
|
+
const span = (_a = nativeCtx.invocationTraceContext()) == null ? void 0 : _a.span;
|
|
1767
|
+
return this.#invocationContext.run(
|
|
1768
|
+
nativeCtx,
|
|
1769
|
+
() => _chunkA36FMKOVcjs.runWithActorInvocationSpan.call(void 0, span, run)
|
|
1770
|
+
);
|
|
1771
|
+
}
|
|
1772
|
+
actorInvocationTraceContext(ctx) {
|
|
1773
|
+
return _nullishCoalesce(this.#actorContextForOperation(ctx).invocationTraceContext(), () => ( void 0));
|
|
1774
|
+
}
|
|
1775
|
+
startCallSpan(ctx, actorName, actionName) {
|
|
1776
|
+
const call = this.#actorContextForOperation(ctx).startCallSpan(
|
|
1777
|
+
actorName,
|
|
1778
|
+
actionName
|
|
1779
|
+
);
|
|
1780
|
+
if (!call) return void 0;
|
|
1781
|
+
return {
|
|
1782
|
+
span: _nullishCoalesce(call.spanContext(), () => ( void 0)),
|
|
1783
|
+
finish: (error) => call.finish(error)
|
|
1784
|
+
};
|
|
1785
|
+
}
|
|
1786
|
+
async startWorkflowSpan(ctx) {
|
|
1787
|
+
const span = await asNativeActorContext(ctx).startWorkflowSpan();
|
|
1788
|
+
const spanCtx = span.ctx();
|
|
1789
|
+
return {
|
|
1790
|
+
run: (body) => this.#runAs(spanCtx, body),
|
|
1791
|
+
startStep: (name, attempt) => {
|
|
1792
|
+
const step = spanCtx.startWorkflowStepSpan(name, attempt);
|
|
1793
|
+
if (!step) return void 0;
|
|
1794
|
+
const stepCtx = step.ctx();
|
|
1795
|
+
return {
|
|
1796
|
+
run: (body) => this.#runAs(stepCtx, body),
|
|
1797
|
+
finish: (outcome, error) => step.finish(
|
|
1798
|
+
outcome,
|
|
1799
|
+
error === void 0 ? void 0 : _chunkJX2ITWAVcjs.encodeErrorForBridge.call(void 0, error)
|
|
1800
|
+
)
|
|
1801
|
+
};
|
|
1802
|
+
},
|
|
1803
|
+
finish: (outcome) => span.finish(outcome)
|
|
1804
|
+
};
|
|
1805
|
+
}
|
|
1806
|
+
runOutsideActorInvocationContext(run) {
|
|
1807
|
+
return this.#invocationContext.exit(run);
|
|
1808
|
+
}
|
|
1809
|
+
currentInvocationScope() {
|
|
1810
|
+
return this.#invocationContext.getStore();
|
|
1811
|
+
}
|
|
1729
1812
|
actorName(ctx) {
|
|
1730
1813
|
return asNativeActorContext(ctx).name();
|
|
1731
1814
|
}
|
|
@@ -1757,7 +1840,7 @@ var NapiCoreRuntime = (_class = class {
|
|
|
1757
1840
|
asNativeActorContext(ctx).broadcast(name, toNapiBuffer(args));
|
|
1758
1841
|
}
|
|
1759
1842
|
actorWaitUntil(ctx, promise) {
|
|
1760
|
-
|
|
1843
|
+
this.#actorContextForOperation(ctx).waitUntil(promise);
|
|
1761
1844
|
}
|
|
1762
1845
|
async actorWaitForTrackedShutdownWork(ctx) {
|
|
1763
1846
|
return await asNativeActorContext(ctx).waitForTrackedShutdownWork();
|
|
@@ -1858,7 +1941,7 @@ var NapiCoreRuntime = (_class = class {
|
|
|
1858
1941
|
await asNativeSqlTransaction(transaction).rollback();
|
|
1859
1942
|
}
|
|
1860
1943
|
async actorBeginStateTransaction(ctx, timeoutMs) {
|
|
1861
|
-
return await
|
|
1944
|
+
return await this.#actorContextForOperation(ctx).beginStateTransaction(
|
|
1862
1945
|
timeoutMs
|
|
1863
1946
|
);
|
|
1864
1947
|
}
|
|
@@ -1896,23 +1979,21 @@ var NapiCoreRuntime = (_class = class {
|
|
|
1896
1979
|
}
|
|
1897
1980
|
async actorSqlClose(ctx) {
|
|
1898
1981
|
const nativeCtx = asNativeActorContext(ctx);
|
|
1899
|
-
|
|
1900
|
-
if (!database) {
|
|
1982
|
+
if (!this.#sqlOpened.delete(nativeCtx)) {
|
|
1901
1983
|
return;
|
|
1902
1984
|
}
|
|
1903
|
-
|
|
1904
|
-
await database.close();
|
|
1985
|
+
await nativeCtx.sql().close();
|
|
1905
1986
|
}
|
|
1906
1987
|
async actorRuntimeSocketProvision(ctx) {
|
|
1907
1988
|
return await asNativeActorContext(ctx).provisionActorRuntimeSocket();
|
|
1908
1989
|
}
|
|
1909
1990
|
async actorQueueSend(ctx, name, body) {
|
|
1910
1991
|
return toNapiQueueMessage(
|
|
1911
|
-
await
|
|
1992
|
+
await this.#actorContextForOperation(ctx).queue().send(name, toNapiBuffer(body))
|
|
1912
1993
|
);
|
|
1913
1994
|
}
|
|
1914
1995
|
async actorQueueNextBatch(ctx, options, signal) {
|
|
1915
|
-
const messages = await
|
|
1996
|
+
const messages = await this.#actorContextForOperation(ctx).queue().nextBatch(
|
|
1916
1997
|
options,
|
|
1917
1998
|
signal ? asNativeCancellationToken(signal) : signal
|
|
1918
1999
|
);
|
|
@@ -1920,7 +2001,7 @@ var NapiCoreRuntime = (_class = class {
|
|
|
1920
2001
|
}
|
|
1921
2002
|
async actorQueueWaitForNames(ctx, names, options, signal) {
|
|
1922
2003
|
return toNapiQueueMessage(
|
|
1923
|
-
await
|
|
2004
|
+
await this.#actorContextForOperation(ctx).queue().waitForNames(
|
|
1924
2005
|
names,
|
|
1925
2006
|
options,
|
|
1926
2007
|
signal ? asNativeCancellationToken(signal) : signal
|
|
@@ -1942,7 +2023,7 @@ var NapiCoreRuntime = (_class = class {
|
|
|
1942
2023
|
);
|
|
1943
2024
|
}
|
|
1944
2025
|
async actorQueueEnqueueAndWait(ctx, name, body, options, signal) {
|
|
1945
|
-
return await
|
|
2026
|
+
return await this.#actorContextForOperation(ctx).queue().enqueueAndWait(
|
|
1946
2027
|
name,
|
|
1947
2028
|
toNapiBuffer(body),
|
|
1948
2029
|
options,
|
|
@@ -1962,22 +2043,22 @@ var NapiCoreRuntime = (_class = class {
|
|
|
1962
2043
|
await asNativeActorContext(ctx).queue().reset();
|
|
1963
2044
|
}
|
|
1964
2045
|
async actorScheduleAfter(ctx, durationMs, actionName, args) {
|
|
1965
|
-
return await
|
|
2046
|
+
return await this.#actorContextForOperation(ctx).schedule().after(durationMs, actionName, toNapiBuffer(args));
|
|
1966
2047
|
}
|
|
1967
2048
|
async actorScheduleAt(ctx, timestampMs, actionName, args) {
|
|
1968
|
-
return await
|
|
2049
|
+
return await this.#actorContextForOperation(ctx).schedule().at(timestampMs, actionName, toNapiBuffer(args));
|
|
1969
2050
|
}
|
|
1970
2051
|
async actorScheduleCancel(ctx, id) {
|
|
1971
|
-
return await
|
|
2052
|
+
return await this.#actorContextForOperation(ctx).schedule().cancel(id);
|
|
1972
2053
|
}
|
|
1973
2054
|
async actorScheduleGet(ctx, id) {
|
|
1974
|
-
return await _asyncNullishCoalesce(await
|
|
2055
|
+
return await _asyncNullishCoalesce(await this.#actorContextForOperation(ctx).schedule().get(id), async () => ( void 0));
|
|
1975
2056
|
}
|
|
1976
2057
|
async actorScheduleList(ctx) {
|
|
1977
|
-
return await
|
|
2058
|
+
return await this.#actorContextForOperation(ctx).schedule().list();
|
|
1978
2059
|
}
|
|
1979
2060
|
async actorCronSet(ctx, name, expression, timezone, actionName, args, maxHistory) {
|
|
1980
|
-
await
|
|
2061
|
+
await this.#actorContextForOperation(ctx).schedule().cronSet(
|
|
1981
2062
|
name,
|
|
1982
2063
|
expression,
|
|
1983
2064
|
timezone,
|
|
@@ -1987,7 +2068,7 @@ var NapiCoreRuntime = (_class = class {
|
|
|
1987
2068
|
);
|
|
1988
2069
|
}
|
|
1989
2070
|
async actorCronEvery(ctx, name, intervalMs, actionName, args, maxHistory) {
|
|
1990
|
-
await
|
|
2071
|
+
await this.#actorContextForOperation(ctx).schedule().cronEvery(
|
|
1991
2072
|
name,
|
|
1992
2073
|
intervalMs,
|
|
1993
2074
|
actionName,
|
|
@@ -1996,16 +2077,16 @@ var NapiCoreRuntime = (_class = class {
|
|
|
1996
2077
|
);
|
|
1997
2078
|
}
|
|
1998
2079
|
async actorCronGet(ctx, name) {
|
|
1999
|
-
return await _asyncNullishCoalesce(await
|
|
2080
|
+
return await _asyncNullishCoalesce(await this.#actorContextForOperation(ctx).schedule().cronGet(name), async () => ( void 0));
|
|
2000
2081
|
}
|
|
2001
2082
|
async actorCronList(ctx) {
|
|
2002
|
-
return await
|
|
2083
|
+
return await this.#actorContextForOperation(ctx).schedule().cronList();
|
|
2003
2084
|
}
|
|
2004
2085
|
async actorCronDelete(ctx, name) {
|
|
2005
|
-
return await
|
|
2086
|
+
return await this.#actorContextForOperation(ctx).schedule().cronDelete(name);
|
|
2006
2087
|
}
|
|
2007
2088
|
async actorCronHistory(ctx, name, limit) {
|
|
2008
|
-
return await
|
|
2089
|
+
return await this.#actorContextForOperation(ctx).schedule().cronHistory(name, limit);
|
|
2009
2090
|
}
|
|
2010
2091
|
connId(conn) {
|
|
2011
2092
|
return asNativeConn(conn).id();
|
|
@@ -2039,10 +2120,13 @@ var NapiCoreRuntime = (_class = class {
|
|
|
2039
2120
|
}
|
|
2040
2121
|
}, _class);
|
|
2041
2122
|
async function loadNapiRuntime() {
|
|
2042
|
-
const bindings = await Promise.
|
|
2123
|
+
const [{ AsyncLocalStorage }, bindings] = await Promise.all([
|
|
2124
|
+
Promise.resolve().then(() => _interopRequireWildcard(require("async_hooks"))),
|
|
2125
|
+
Promise.resolve().then(() => _interopRequireWildcard(require(["@rivetkit", "rivetkit-napi"].join("/"))))
|
|
2126
|
+
]);
|
|
2043
2127
|
return {
|
|
2044
2128
|
bindings,
|
|
2045
|
-
runtime: new NapiCoreRuntime(bindings)
|
|
2129
|
+
runtime: new NapiCoreRuntime(bindings, new AsyncLocalStorage())
|
|
2046
2130
|
};
|
|
2047
2131
|
}
|
|
2048
2132
|
|
|
@@ -2057,8 +2141,8 @@ function runtimeBytesToArrayBuffer(value) {
|
|
|
2057
2141
|
function buildNativeHttpRequest(init) {
|
|
2058
2142
|
var _a;
|
|
2059
2143
|
const headers = new Headers(init.headers);
|
|
2060
|
-
const originalUrl = headers.get(
|
|
2061
|
-
headers.delete(
|
|
2144
|
+
const originalUrl = headers.get(_chunkA36FMKOVcjs.HEADER_ORIGINAL_REQUEST_URL);
|
|
2145
|
+
headers.delete(_chunkA36FMKOVcjs.HEADER_ORIGINAL_REQUEST_URL);
|
|
2062
2146
|
const url = _nullishCoalesce(originalUrl, () => ( (init.uri.startsWith("http") ? init.uri : new URL(init.uri, "http://127.0.0.1").toString())));
|
|
2063
2147
|
const method2 = init.method.toUpperCase();
|
|
2064
2148
|
const bodyForbidden = method2 === "GET" || method2 === "HEAD";
|
|
@@ -2137,7 +2221,7 @@ async function pumpResponseBody(reader, stream) {
|
|
|
2137
2221
|
}
|
|
2138
2222
|
} catch (error) {
|
|
2139
2223
|
try {
|
|
2140
|
-
await stream.error(
|
|
2224
|
+
await stream.error(_chunk2CE5UNWKcjs.stringifyError.call(void 0, error));
|
|
2141
2225
|
} catch (streamError) {
|
|
2142
2226
|
logger2().debug({
|
|
2143
2227
|
msg: "failed to report native http response stream error",
|
|
@@ -2267,7 +2351,7 @@ function validateQueueComplete(schemas, name, response) {
|
|
|
2267
2351
|
return result.data;
|
|
2268
2352
|
}
|
|
2269
2353
|
function validationError(target, issues) {
|
|
2270
|
-
return new (0,
|
|
2354
|
+
return new (0, _chunkJX2ITWAVcjs.RivetError)("actor", "validation_error", `Invalid ${target}`, {
|
|
2271
2355
|
public: true,
|
|
2272
2356
|
metadata: { issues }
|
|
2273
2357
|
});
|
|
@@ -2275,7 +2359,7 @@ function validationError(target, issues) {
|
|
|
2275
2359
|
|
|
2276
2360
|
// src/registry/run-handler-coordinator.ts
|
|
2277
2361
|
function runUnavailable(actorId, reason) {
|
|
2278
|
-
return new (0,
|
|
2362
|
+
return new (0, _chunkJX2ITWAVcjs.RivetError)(
|
|
2279
2363
|
"actor",
|
|
2280
2364
|
"run_handler_unavailable",
|
|
2281
2365
|
`Run handler control is unavailable for actor ${actorId}: ${reason}.`,
|
|
@@ -2305,7 +2389,7 @@ var RunHandlerCoordinator = class {
|
|
|
2305
2389
|
this.#run = run;
|
|
2306
2390
|
}
|
|
2307
2391
|
get inspectorKind() {
|
|
2308
|
-
return
|
|
2392
|
+
return _chunkNWCAIWHLcjs.getRunInspectorKind.call(void 0, this.#run);
|
|
2309
2393
|
}
|
|
2310
2394
|
async run(actorId, restart, callback) {
|
|
2311
2395
|
const state = this.#getOrCreate(actorId);
|
|
@@ -2413,7 +2497,7 @@ var RunHandlerCoordinator = class {
|
|
|
2413
2497
|
}
|
|
2414
2498
|
#initializeInspector(actorId, state) {
|
|
2415
2499
|
if (state.inspectorInitialized) return;
|
|
2416
|
-
const inspector =
|
|
2500
|
+
const inspector = _chunkNWCAIWHLcjs.createRunInspector.call(void 0, this.#run, {
|
|
2417
2501
|
actorId,
|
|
2418
2502
|
control: this.#control(actorId, state)
|
|
2419
2503
|
});
|
|
@@ -2496,16 +2580,16 @@ function normalizeQueueMessage(message) {
|
|
|
2496
2580
|
}
|
|
2497
2581
|
function normalizeWasmBridgeError(error) {
|
|
2498
2582
|
if (typeof error === "string") {
|
|
2499
|
-
return _nullishCoalesce(
|
|
2583
|
+
return _nullishCoalesce(_chunkJX2ITWAVcjs.decodeBridgeRivetError.call(void 0, error), () => ( error));
|
|
2500
2584
|
}
|
|
2501
2585
|
if (error instanceof Error) {
|
|
2502
|
-
const bridged =
|
|
2586
|
+
const bridged = _chunkJX2ITWAVcjs.decodeBridgeRivetError.call(void 0, error.message);
|
|
2503
2587
|
if (bridged) {
|
|
2504
2588
|
return bridged;
|
|
2505
2589
|
}
|
|
2506
2590
|
}
|
|
2507
2591
|
if (typeof error === "object" && error !== null && "reason" in error && typeof error.reason === "string") {
|
|
2508
|
-
const bridged =
|
|
2592
|
+
const bridged = _chunkJX2ITWAVcjs.decodeBridgeRivetError.call(void 0, error.reason);
|
|
2509
2593
|
if (bridged) {
|
|
2510
2594
|
return bridged;
|
|
2511
2595
|
}
|
|
@@ -2527,7 +2611,7 @@ function callWasmSync(invoke) {
|
|
|
2527
2611
|
}
|
|
2528
2612
|
}
|
|
2529
2613
|
function unsupportedWasmMethod(method2) {
|
|
2530
|
-
throw new (0,
|
|
2614
|
+
throw new (0, _chunkJX2ITWAVcjs.RivetError)(
|
|
2531
2615
|
"runtime",
|
|
2532
2616
|
"unsupported",
|
|
2533
2617
|
`Unsupported wasm runtime method: ${method2}`,
|
|
@@ -2742,6 +2826,29 @@ var WasmCoreRuntime = (_class2 = class {
|
|
|
2742
2826
|
actorId(ctx) {
|
|
2743
2827
|
return callHandle(asWasmActorContext(ctx), "actorId");
|
|
2744
2828
|
}
|
|
2829
|
+
runWithActorInvocationContext(_ctx, run) {
|
|
2830
|
+
return run();
|
|
2831
|
+
}
|
|
2832
|
+
actorInvocationTraceContext(_ctx) {
|
|
2833
|
+
return void 0;
|
|
2834
|
+
}
|
|
2835
|
+
startCallSpan(_ctx, _actorName, _actionName) {
|
|
2836
|
+
return void 0;
|
|
2837
|
+
}
|
|
2838
|
+
async startWorkflowSpan(_ctx) {
|
|
2839
|
+
return {
|
|
2840
|
+
run: (body) => body(),
|
|
2841
|
+
startStep: () => void 0,
|
|
2842
|
+
finish: async () => {
|
|
2843
|
+
}
|
|
2844
|
+
};
|
|
2845
|
+
}
|
|
2846
|
+
runOutsideActorInvocationContext(run) {
|
|
2847
|
+
return run();
|
|
2848
|
+
}
|
|
2849
|
+
currentInvocationScope() {
|
|
2850
|
+
return void 0;
|
|
2851
|
+
}
|
|
2745
2852
|
actorName(ctx) {
|
|
2746
2853
|
return callHandle(asWasmActorContext(ctx), "name");
|
|
2747
2854
|
}
|
|
@@ -2962,7 +3069,7 @@ var WasmCoreRuntime = (_class2 = class {
|
|
|
2962
3069
|
await callWasm(() => database.close());
|
|
2963
3070
|
}
|
|
2964
3071
|
async actorRuntimeSocketProvision(_ctx) {
|
|
2965
|
-
throw new (0,
|
|
3072
|
+
throw new (0, _chunkJX2ITWAVcjs.RivetError)(
|
|
2966
3073
|
"actor_runtime_socket",
|
|
2967
3074
|
"unsupported",
|
|
2968
3075
|
"Actor Runtime Socket is only available on Unix native runtimes.",
|
|
@@ -3331,7 +3438,7 @@ function loadedRuntimeKind(runtime) {
|
|
|
3331
3438
|
case "wasm":
|
|
3332
3439
|
return "wasm";
|
|
3333
3440
|
}
|
|
3334
|
-
throw new (0,
|
|
3441
|
+
throw new (0, _chunkJX2ITWAVcjs.RivetError)(
|
|
3335
3442
|
"config",
|
|
3336
3443
|
"unknown_runtime",
|
|
3337
3444
|
"RivetKit runtime must be NAPI or wasm.",
|
|
@@ -3352,16 +3459,16 @@ async function loadAutoRuntime(config, loaders = defaultRuntimeLoaders) {
|
|
|
3352
3459
|
nativeError = error;
|
|
3353
3460
|
logger2().warn({
|
|
3354
3461
|
msg: "native runtime failed to load; falling back to wasm",
|
|
3355
|
-
error:
|
|
3462
|
+
error: _chunk2CE5UNWKcjs.stringifyError.call(void 0, error)
|
|
3356
3463
|
});
|
|
3357
3464
|
}
|
|
3358
3465
|
try {
|
|
3359
3466
|
return (await loaders.loadWasm(config.wasm)).runtime;
|
|
3360
3467
|
} catch (wasmError) {
|
|
3361
|
-
throw new (0,
|
|
3468
|
+
throw new (0, _chunkJX2ITWAVcjs.RivetError)(
|
|
3362
3469
|
"config",
|
|
3363
3470
|
"runtime_unavailable",
|
|
3364
|
-
`RivetKit could not load a core runtime. Native runtime: ${
|
|
3471
|
+
`RivetKit could not load a core runtime. Native runtime: ${_chunk2CE5UNWKcjs.stringifyError.call(void 0, nativeError)} Wasm runtime: ${_chunk2CE5UNWKcjs.stringifyError.call(void 0, wasmError)}`,
|
|
3365
3472
|
{
|
|
3366
3473
|
public: true,
|
|
3367
3474
|
statusCode: 500
|
|
@@ -3389,7 +3496,7 @@ function normalizeRuntimeConfigForKind(config, runtimeKind) {
|
|
|
3389
3496
|
return config;
|
|
3390
3497
|
}
|
|
3391
3498
|
if (sqliteBackendForConfig(config) === "local") {
|
|
3392
|
-
throw new (0,
|
|
3499
|
+
throw new (0, _chunkJX2ITWAVcjs.RivetError)(
|
|
3393
3500
|
"config",
|
|
3394
3501
|
"wasm_local_sqlite",
|
|
3395
3502
|
"WebAssembly runtime cannot use local SQLite. Use remote SQLite instead.",
|
|
@@ -3455,14 +3562,14 @@ function getNativeConnPersistState(runtime, ctx, conn) {
|
|
|
3455
3562
|
return connState;
|
|
3456
3563
|
}
|
|
3457
3564
|
function stateMutationReentrantError() {
|
|
3458
|
-
return new (0,
|
|
3565
|
+
return new (0, _chunkJX2ITWAVcjs.RivetError)(
|
|
3459
3566
|
"actor",
|
|
3460
3567
|
"state_mutation_reentrant",
|
|
3461
3568
|
"State mutations are not allowed inside onStateChange."
|
|
3462
3569
|
);
|
|
3463
3570
|
}
|
|
3464
3571
|
function stateTransactionConflictError() {
|
|
3465
|
-
return new (0,
|
|
3572
|
+
return new (0, _chunkJX2ITWAVcjs.RivetError)(
|
|
3466
3573
|
"actor",
|
|
3467
3574
|
"state_transaction_conflict",
|
|
3468
3575
|
"State cannot be mutated by another action while an experimental state-aware database transaction is active.",
|
|
@@ -3470,7 +3577,7 @@ function stateTransactionConflictError() {
|
|
|
3470
3577
|
);
|
|
3471
3578
|
}
|
|
3472
3579
|
function databaseNotConfiguredError() {
|
|
3473
|
-
return new (0,
|
|
3580
|
+
return new (0, _chunkJX2ITWAVcjs.RivetError)(
|
|
3474
3581
|
"actor",
|
|
3475
3582
|
"database_not_configured",
|
|
3476
3583
|
"database is not configured for this actor",
|
|
@@ -3478,7 +3585,7 @@ function databaseNotConfiguredError() {
|
|
|
3478
3585
|
);
|
|
3479
3586
|
}
|
|
3480
3587
|
function databaseClientNotReadyError() {
|
|
3481
|
-
return new (0,
|
|
3588
|
+
return new (0, _chunkJX2ITWAVcjs.RivetError)(
|
|
3482
3589
|
"actor",
|
|
3483
3590
|
"database_client_not_ready",
|
|
3484
3591
|
"actor database client was not initialized before user code ran. this is an internal lifecycle error; the migration callback should have pre-warmed the client. file an issue if you can reproduce.",
|
|
@@ -3486,7 +3593,7 @@ function databaseClientNotReadyError() {
|
|
|
3486
3593
|
);
|
|
3487
3594
|
}
|
|
3488
3595
|
function runHandlerNotConfiguredError() {
|
|
3489
|
-
return new (0,
|
|
3596
|
+
return new (0, _chunkJX2ITWAVcjs.RivetError)(
|
|
3490
3597
|
"actor",
|
|
3491
3598
|
"run_handler_unavailable",
|
|
3492
3599
|
"Cannot schedule a run wake because this actor does not define a run handler.",
|
|
@@ -3494,7 +3601,7 @@ function runHandlerNotConfiguredError() {
|
|
|
3494
3601
|
);
|
|
3495
3602
|
}
|
|
3496
3603
|
function stateNotEnabledError() {
|
|
3497
|
-
return new (0,
|
|
3604
|
+
return new (0, _chunkJX2ITWAVcjs.RivetError)(
|
|
3498
3605
|
"actor",
|
|
3499
3606
|
"state_not_enabled",
|
|
3500
3607
|
"State not enabled. Must implement `createState` or `state` to use state. (https://www.rivet.dev/docs/actors/state/#initializing-state)",
|
|
@@ -3502,7 +3609,7 @@ function stateNotEnabledError() {
|
|
|
3502
3609
|
);
|
|
3503
3610
|
}
|
|
3504
3611
|
function nativeClientNotConfiguredError() {
|
|
3505
|
-
return new (0,
|
|
3612
|
+
return new (0, _chunkJX2ITWAVcjs.RivetError)(
|
|
3506
3613
|
"native",
|
|
3507
3614
|
"client_not_configured",
|
|
3508
3615
|
"native actor client is not configured",
|
|
@@ -3510,7 +3617,7 @@ function nativeClientNotConfiguredError() {
|
|
|
3510
3617
|
);
|
|
3511
3618
|
}
|
|
3512
3619
|
function nativeEndpointNotConfiguredError() {
|
|
3513
|
-
return new (0,
|
|
3620
|
+
return new (0, _chunkJX2ITWAVcjs.RivetError)(
|
|
3514
3621
|
"native",
|
|
3515
3622
|
"endpoint_not_configured",
|
|
3516
3623
|
"registry endpoint is required for native envoy startup",
|
|
@@ -3555,7 +3662,7 @@ async function cleanupNativeSleepRuntimeState(runtime, ctx, afterTrackedWorkDrai
|
|
|
3555
3662
|
}).catch((error) => {
|
|
3556
3663
|
logger2().warn({
|
|
3557
3664
|
msg: "deferred native sleep cleanup failed",
|
|
3558
|
-
error:
|
|
3665
|
+
error: _chunk2CE5UNWKcjs.stringifyError.call(void 0, error)
|
|
3559
3666
|
});
|
|
3560
3667
|
});
|
|
3561
3668
|
return;
|
|
@@ -3718,10 +3825,10 @@ function decodeValue(value) {
|
|
|
3718
3825
|
if (!value || value.length === 0) {
|
|
3719
3826
|
return void 0;
|
|
3720
3827
|
}
|
|
3721
|
-
return
|
|
3828
|
+
return _chunk2CE5UNWKcjs.decodeCborCompat.call(void 0, value);
|
|
3722
3829
|
}
|
|
3723
3830
|
function encodeValue(value) {
|
|
3724
|
-
return
|
|
3831
|
+
return _chunk2CE5UNWKcjs.encodeCborCompat.call(void 0, value);
|
|
3725
3832
|
}
|
|
3726
3833
|
function normalizeArgs(value) {
|
|
3727
3834
|
return Array.isArray(value) ? value : value === void 0 || value === null ? [] : [value];
|
|
@@ -3734,16 +3841,16 @@ function unwrapTsfnPayload(error, payload) {
|
|
|
3734
3841
|
}
|
|
3735
3842
|
function normalizeNativeBridgeError(error) {
|
|
3736
3843
|
if (typeof error === "string") {
|
|
3737
|
-
return _nullishCoalesce(
|
|
3844
|
+
return _nullishCoalesce(_chunkJX2ITWAVcjs.decodeBridgeRivetError.call(void 0, error), () => ( error));
|
|
3738
3845
|
}
|
|
3739
3846
|
if (error instanceof Error) {
|
|
3740
|
-
const bridged =
|
|
3847
|
+
const bridged = _chunkJX2ITWAVcjs.decodeBridgeRivetError.call(void 0, error.message);
|
|
3741
3848
|
if (bridged) {
|
|
3742
3849
|
return bridged;
|
|
3743
3850
|
}
|
|
3744
3851
|
}
|
|
3745
3852
|
if (typeof error === "object" && error !== null && "reason" in error && typeof error.reason === "string") {
|
|
3746
|
-
const bridged =
|
|
3853
|
+
const bridged = _chunkJX2ITWAVcjs.decodeBridgeRivetError.call(void 0, error.reason);
|
|
3747
3854
|
if (bridged) {
|
|
3748
3855
|
return bridged;
|
|
3749
3856
|
}
|
|
@@ -3751,14 +3858,14 @@ function normalizeNativeBridgeError(error) {
|
|
|
3751
3858
|
return error;
|
|
3752
3859
|
}
|
|
3753
3860
|
function isStructuredBridgeError(error) {
|
|
3754
|
-
if (error instanceof
|
|
3861
|
+
if (error instanceof _chunkJX2ITWAVcjs.RivetError) {
|
|
3755
3862
|
return true;
|
|
3756
3863
|
}
|
|
3757
|
-
return
|
|
3864
|
+
return _chunkJX2ITWAVcjs.isRivetErrorLike.call(void 0, error) && "__type" in error && (error.__type === "RivetError" || error.__type === "ActorError");
|
|
3758
3865
|
}
|
|
3759
3866
|
function encodeNativeCallbackError(error) {
|
|
3760
|
-
const structuredError = isStructuredBridgeError(error) ? error :
|
|
3761
|
-
const bridgeError = new Error(
|
|
3867
|
+
const structuredError = isStructuredBridgeError(error) ? error : _chunk2CE5UNWKcjs.deconstructError.call(void 0, error, true);
|
|
3868
|
+
const bridgeError = new Error(_chunkJX2ITWAVcjs.encodeBridgeRivetError.call(void 0, structuredError), {
|
|
3762
3869
|
cause: error instanceof Error ? error : void 0
|
|
3763
3870
|
});
|
|
3764
3871
|
return Object.assign(bridgeError, {
|
|
@@ -3783,9 +3890,9 @@ function callNativeSync(invoke) {
|
|
|
3783
3890
|
}
|
|
3784
3891
|
}
|
|
3785
3892
|
function isClosedTaskRegistrationError(error) {
|
|
3786
|
-
const metadata = error instanceof
|
|
3893
|
+
const metadata = error instanceof _chunkJX2ITWAVcjs.RivetError ? error.metadata : void 0;
|
|
3787
3894
|
const metadataError = metadata && typeof metadata === "object" && "error" in metadata ? metadata.error : void 0;
|
|
3788
|
-
return error instanceof
|
|
3895
|
+
return error instanceof _chunkJX2ITWAVcjs.RivetError && error.group === "core" && error.code === _chunkJX2ITWAVcjs.INTERNAL_ERROR_CODE && typeof metadataError === "string" && /actor task registration is (closed|not configured)/.test(metadataError);
|
|
3789
3896
|
}
|
|
3790
3897
|
async function createCancellationTokenHandle(runtime, signal) {
|
|
3791
3898
|
if (!signal) {
|
|
@@ -3808,7 +3915,7 @@ function decodeWorkflowCbor(data) {
|
|
|
3808
3915
|
return null;
|
|
3809
3916
|
}
|
|
3810
3917
|
try {
|
|
3811
|
-
return
|
|
3918
|
+
return _chunk2CE5UNWKcjs.decodeCborCompat.call(void 0, new Uint8Array(data));
|
|
3812
3919
|
} catch (e4) {
|
|
3813
3920
|
return null;
|
|
3814
3921
|
}
|
|
@@ -3921,7 +4028,7 @@ function serializeWorkflowHistoryForJson(data) {
|
|
|
3921
4028
|
if (data === null) {
|
|
3922
4029
|
return null;
|
|
3923
4030
|
}
|
|
3924
|
-
const history =
|
|
4031
|
+
const history = _chunk76YTS32Rcjs.decodeWorkflowHistoryTransport.call(void 0, data);
|
|
3925
4032
|
return jsonSafe({
|
|
3926
4033
|
nameRegistry: [...history.nameRegistry],
|
|
3927
4034
|
entries: history.entries.map((entry) => ({
|
|
@@ -4020,7 +4127,7 @@ var NativeConnAdapter = class {
|
|
|
4020
4127
|
this.#ctx = ctx;
|
|
4021
4128
|
this.#queueHibernationRemoval = queueHibernationRemoval;
|
|
4022
4129
|
this.#assertCanMutateState = assertCanMutateState;
|
|
4023
|
-
this[
|
|
4130
|
+
this[_chunkNWCAIWHLcjs.CONN_STATE_MANAGER_SYMBOL] = {
|
|
4024
4131
|
stateEnabled: true,
|
|
4025
4132
|
get state() {
|
|
4026
4133
|
return thisConn.state;
|
|
@@ -4037,7 +4144,7 @@ var NativeConnAdapter = class {
|
|
|
4037
4144
|
decodeValue(this.#runtime.connParams(this.#conn))
|
|
4038
4145
|
);
|
|
4039
4146
|
}
|
|
4040
|
-
[
|
|
4147
|
+
[_chunkNWCAIWHLcjs.RAW_STATE_SYMBOL]() {
|
|
4041
4148
|
return this.#readState();
|
|
4042
4149
|
}
|
|
4043
4150
|
get state() {
|
|
@@ -4067,7 +4174,7 @@ var NativeConnAdapter = class {
|
|
|
4067
4174
|
},
|
|
4068
4175
|
(newValue) => {
|
|
4069
4176
|
assertCurrentState();
|
|
4070
|
-
|
|
4177
|
+
_chunk2CE5UNWKcjs.assertJsonCompatValue.call(void 0, newValue);
|
|
4071
4178
|
}
|
|
4072
4179
|
);
|
|
4073
4180
|
}
|
|
@@ -4075,7 +4182,7 @@ var NativeConnAdapter = class {
|
|
|
4075
4182
|
var _a;
|
|
4076
4183
|
(_a = this.#assertCanMutateState) == null ? void 0 : _a.call(this);
|
|
4077
4184
|
const nextValue = unwrapWriteThroughProxy(value);
|
|
4078
|
-
|
|
4185
|
+
_chunk2CE5UNWKcjs.assertJsonCompatValue.call(void 0, nextValue);
|
|
4079
4186
|
this.#writeState(nextValue, { writeNative: true });
|
|
4080
4187
|
}
|
|
4081
4188
|
initializeState(value) {
|
|
@@ -4458,7 +4565,7 @@ var NativeQueueAdapter = class {
|
|
|
4458
4565
|
async nextBatch(options) {
|
|
4459
4566
|
const completable = (options == null ? void 0 : options.completable) === true;
|
|
4460
4567
|
if (this.#pendingCompletableMessageIds.size > 0) {
|
|
4461
|
-
throw new (0,
|
|
4568
|
+
throw new (0, _chunkJX2ITWAVcjs.RivetError)(
|
|
4462
4569
|
"queue",
|
|
4463
4570
|
"previous_message_not_completed",
|
|
4464
4571
|
"Previous completable queue message is not completed. Call `message.complete(...)` before receiving the next message.",
|
|
@@ -4625,7 +4732,7 @@ var NativeQueueAdapter = class {
|
|
|
4625
4732
|
}
|
|
4626
4733
|
yield message;
|
|
4627
4734
|
} catch (error) {
|
|
4628
|
-
if (
|
|
4735
|
+
if (_chunkJX2ITWAVcjs.isActorAbortedError.call(void 0, error)) {
|
|
4629
4736
|
return;
|
|
4630
4737
|
}
|
|
4631
4738
|
throw error;
|
|
@@ -4646,7 +4753,7 @@ var NativeQueueAdapter = class {
|
|
|
4646
4753
|
...message,
|
|
4647
4754
|
complete: async (response) => {
|
|
4648
4755
|
if (typeof message.complete !== "function") {
|
|
4649
|
-
throw new (0,
|
|
4756
|
+
throw new (0, _chunkJX2ITWAVcjs.RivetError)(
|
|
4650
4757
|
"queue",
|
|
4651
4758
|
"complete_not_configured",
|
|
4652
4759
|
`Queue '${message.name}' does not support completion responses.`,
|
|
@@ -4658,7 +4765,7 @@ var NativeQueueAdapter = class {
|
|
|
4658
4765
|
);
|
|
4659
4766
|
}
|
|
4660
4767
|
if (completed) {
|
|
4661
|
-
throw new (0,
|
|
4768
|
+
throw new (0, _chunkJX2ITWAVcjs.RivetError)(
|
|
4662
4769
|
"queue",
|
|
4663
4770
|
"already_completed",
|
|
4664
4771
|
"Queue message was already completed.",
|
|
@@ -5055,6 +5162,7 @@ var NativeConnectionMap = (_class3 = class {
|
|
|
5055
5162
|
}
|
|
5056
5163
|
__init3() {this[Symbol.toStringTag] = "NativeConnectionMap"}
|
|
5057
5164
|
}, _class3);
|
|
5165
|
+
var NO_INVOCATION_SCOPE = {};
|
|
5058
5166
|
var ActorContextHandleAdapter = class {
|
|
5059
5167
|
#runtime;
|
|
5060
5168
|
#ctx;
|
|
@@ -5069,6 +5177,7 @@ var ActorContextHandleAdapter = class {
|
|
|
5069
5177
|
#db;
|
|
5070
5178
|
#dispatchCancelToken;
|
|
5071
5179
|
#kv;
|
|
5180
|
+
#logByInvocationScope = /* @__PURE__ */ new WeakMap();
|
|
5072
5181
|
#queue;
|
|
5073
5182
|
#request;
|
|
5074
5183
|
#schedule;
|
|
@@ -5092,7 +5201,7 @@ var ActorContextHandleAdapter = class {
|
|
|
5092
5201
|
this.#databaseProvider = databaseProvider;
|
|
5093
5202
|
}
|
|
5094
5203
|
this.#request = request;
|
|
5095
|
-
this[
|
|
5204
|
+
this[_chunkNWCAIWHLcjs.ACTOR_CONTEXT_INTERNAL_SYMBOL] = new NativeWorkflowRuntimeAdapter(
|
|
5096
5205
|
this
|
|
5097
5206
|
);
|
|
5098
5207
|
}
|
|
@@ -5122,7 +5231,7 @@ var ActorContextHandleAdapter = class {
|
|
|
5122
5231
|
}
|
|
5123
5232
|
throw databaseClientNotReadyError();
|
|
5124
5233
|
}
|
|
5125
|
-
[
|
|
5234
|
+
[_chunkNWCAIWHLcjs.RAW_STATE_SYMBOL]() {
|
|
5126
5235
|
if (!this.#stateEnabled) {
|
|
5127
5236
|
throw stateNotEnabledError();
|
|
5128
5237
|
}
|
|
@@ -5149,7 +5258,7 @@ var ActorContextHandleAdapter = class {
|
|
|
5149
5258
|
},
|
|
5150
5259
|
(newValue) => {
|
|
5151
5260
|
assertCurrentState();
|
|
5152
|
-
|
|
5261
|
+
_chunk2CE5UNWKcjs.assertJsonCompatValue.call(void 0, newValue);
|
|
5153
5262
|
}
|
|
5154
5263
|
);
|
|
5155
5264
|
}
|
|
@@ -5161,7 +5270,7 @@ var ActorContextHandleAdapter = class {
|
|
|
5161
5270
|
}
|
|
5162
5271
|
this.#assertCanMutateState();
|
|
5163
5272
|
const nextValue = unwrapWriteThroughProxy(value);
|
|
5164
|
-
|
|
5273
|
+
_chunk2CE5UNWKcjs.assertJsonCompatValue.call(void 0, nextValue);
|
|
5165
5274
|
this.#writeState(nextValue, { scheduleSave: true });
|
|
5166
5275
|
}
|
|
5167
5276
|
initializeState(value) {
|
|
@@ -5211,7 +5320,11 @@ var ActorContextHandleAdapter = class {
|
|
|
5211
5320
|
await callNative(
|
|
5212
5321
|
() => this.#runtime.actorSetRunWakeAt(this.#ctx, timestamp)
|
|
5213
5322
|
);
|
|
5214
|
-
}
|
|
5323
|
+
},
|
|
5324
|
+
startWorkflowSpan: () => callNative(
|
|
5325
|
+
() => this.#runtime.startWorkflowSpan(this.#ctx)
|
|
5326
|
+
),
|
|
5327
|
+
runOutsideWorkflowSpan: (body) => this.#runtime.runOutsideActorInvocationContext(body)
|
|
5215
5328
|
};
|
|
5216
5329
|
}
|
|
5217
5330
|
return this.#run;
|
|
@@ -5256,8 +5369,29 @@ var ActorContextHandleAdapter = class {
|
|
|
5256
5369
|
}
|
|
5257
5370
|
return this.#connMap;
|
|
5258
5371
|
}
|
|
5372
|
+
#invocationTraceContext() {
|
|
5373
|
+
return callNativeSync(
|
|
5374
|
+
() => this.#runtime.actorInvocationTraceContext(this.#ctx)
|
|
5375
|
+
);
|
|
5376
|
+
}
|
|
5377
|
+
/** Cached per invocation, because the `run` context outlives workflow runs and steps. */
|
|
5259
5378
|
get log() {
|
|
5260
|
-
|
|
5379
|
+
const scope = _nullishCoalesce(this.#runtime.currentInvocationScope(), () => ( NO_INVOCATION_SCOPE));
|
|
5380
|
+
const cached = this.#logByInvocationScope.get(scope);
|
|
5381
|
+
if (cached) return cached;
|
|
5382
|
+
const invocation = this.#invocationTraceContext();
|
|
5383
|
+
const log = logger2().child({
|
|
5384
|
+
actorId: this.actorId,
|
|
5385
|
+
actorName: this.name,
|
|
5386
|
+
actorKey: this.key,
|
|
5387
|
+
...(invocation == null ? void 0 : invocation.rayId) && { rayId: invocation.rayId },
|
|
5388
|
+
...(invocation == null ? void 0 : invocation.span) && {
|
|
5389
|
+
traceId: invocation.span.traceId,
|
|
5390
|
+
spanId: invocation.span.spanId
|
|
5391
|
+
}
|
|
5392
|
+
});
|
|
5393
|
+
this.#logByInvocationScope.set(scope, log);
|
|
5394
|
+
return log;
|
|
5261
5395
|
}
|
|
5262
5396
|
get abortSignal() {
|
|
5263
5397
|
if (!this.#abortSignal) {
|
|
@@ -5345,7 +5479,7 @@ var ActorContextHandleAdapter = class {
|
|
|
5345
5479
|
log: {
|
|
5346
5480
|
debug: (obj) => logger2().debug(obj)
|
|
5347
5481
|
},
|
|
5348
|
-
nativeDatabaseProvider:
|
|
5482
|
+
nativeDatabaseProvider: _chunkCVLNRT7Ocjs.registerNativeStateTransactionOpener.call(void 0,
|
|
5349
5483
|
{
|
|
5350
5484
|
open: async (requestedActorId) => {
|
|
5351
5485
|
void requestedActorId;
|
|
@@ -5368,7 +5502,7 @@ var ActorContextHandleAdapter = class {
|
|
|
5368
5502
|
return this.#db;
|
|
5369
5503
|
}
|
|
5370
5504
|
#bindDatabaseClient(client) {
|
|
5371
|
-
return
|
|
5505
|
+
return _chunkCVLNRT7Ocjs.bindNativeStateTransactionContext.call(void 0, client, {
|
|
5372
5506
|
enter: async () => await this.#enterStateTransaction(),
|
|
5373
5507
|
exit: (scope) => this.#exitStateTransaction(
|
|
5374
5508
|
scope
|
|
@@ -5572,7 +5706,7 @@ var ActorContextHandleAdapter = class {
|
|
|
5572
5706
|
const trackedPromise = Promise.resolve(promise).catch((error) => {
|
|
5573
5707
|
logger2().warn({
|
|
5574
5708
|
msg: "keepAwake promise rejected",
|
|
5575
|
-
error:
|
|
5709
|
+
error: _chunk2CE5UNWKcjs.stringifyError.call(void 0, error)
|
|
5576
5710
|
});
|
|
5577
5711
|
}).then(() => null);
|
|
5578
5712
|
try {
|
|
@@ -5923,6 +6057,13 @@ function withConnContext(runtime, ctx, conn, clientFactory, schemas = {}, databa
|
|
|
5923
6057
|
)
|
|
5924
6058
|
});
|
|
5925
6059
|
}
|
|
6060
|
+
function buildActorTracingConfig(actions, tracing) {
|
|
6061
|
+
if (tracing === void 0) return void 0;
|
|
6062
|
+
return {
|
|
6063
|
+
sampler: tracing.sampler,
|
|
6064
|
+
actions: _chunkNWCAIWHLcjs.flattenActionTraceSamplers.call(void 0, actions, tracing.actions)
|
|
6065
|
+
};
|
|
6066
|
+
}
|
|
5926
6067
|
function buildActorConfig(definition, registryConfig, runtimeKind) {
|
|
5927
6068
|
var _a;
|
|
5928
6069
|
const config = definition.config;
|
|
@@ -5936,6 +6077,10 @@ function buildActorConfig(definition, registryConfig, runtimeKind) {
|
|
|
5936
6077
|
hasDatabase: true,
|
|
5937
6078
|
remoteSqlite: usesRemoteSqlite,
|
|
5938
6079
|
sqliteProfiling,
|
|
6080
|
+
tracing: buildActorTracingConfig(
|
|
6081
|
+
definition.config.actions,
|
|
6082
|
+
definition.config.tracing
|
|
6083
|
+
),
|
|
5939
6084
|
enableActorRuntimeSocket: options.enableActorRuntimeSocket === true,
|
|
5940
6085
|
hasState: config.state !== void 0 || typeof config.createState === "function",
|
|
5941
6086
|
canHibernateWebsocket: typeof canHibernate === "boolean" ? canHibernate : void 0,
|
|
@@ -5958,7 +6103,7 @@ function buildActorConfig(definition, registryConfig, runtimeKind) {
|
|
|
5958
6103
|
maxOutgoingMessageSize: registryConfig.maxOutgoingMessageSize,
|
|
5959
6104
|
preloadMaxWorkflowBytes: options.preloadMaxWorkflowBytes,
|
|
5960
6105
|
preloadMaxConnectionsBytes: options.preloadMaxConnectionsBytes,
|
|
5961
|
-
actions: Object.keys(
|
|
6106
|
+
actions: Object.keys(_chunkNWCAIWHLcjs.flattenActionHandlers.call(void 0, config.actions)).sort().map((name) => ({ name })),
|
|
5962
6107
|
inspectorTabs: buildInspectorTabs(config.inspector, runtimeKind)
|
|
5963
6108
|
};
|
|
5964
6109
|
}
|
|
@@ -6034,10 +6179,10 @@ function validateInspectorTabSource(tabId, resolved) {
|
|
|
6034
6179
|
function buildNativeFactory(runtime, registryConfig, definition) {
|
|
6035
6180
|
var _a;
|
|
6036
6181
|
const config = definition.config;
|
|
6037
|
-
const databaseProvider = _nullishCoalesce(config.db, () => (
|
|
6038
|
-
const actionHandlers =
|
|
6182
|
+
const databaseProvider = _nullishCoalesce(config.db, () => ( _chunkCVLNRT7Ocjs.db.call(void 0, )));
|
|
6183
|
+
const actionHandlers = _chunkNWCAIWHLcjs.flattenActionHandlers.call(void 0, config.actions);
|
|
6039
6184
|
const schemaConfig = {
|
|
6040
|
-
actionInputSchemas:
|
|
6185
|
+
actionInputSchemas: _chunkNWCAIWHLcjs.flattenActionInputSchemas.call(void 0,
|
|
6041
6186
|
config.actions,
|
|
6042
6187
|
config.actionInputSchemas
|
|
6043
6188
|
),
|
|
@@ -6045,19 +6190,27 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
6045
6190
|
events: config.events,
|
|
6046
6191
|
queues: config.queues
|
|
6047
6192
|
};
|
|
6048
|
-
const createClient = () =>
|
|
6049
|
-
new (0,
|
|
6050
|
-
|
|
6193
|
+
const createClient = (ctx) => _chunkA36FMKOVcjs.createClientWithDriver.call(void 0,
|
|
6194
|
+
new (0, _chunkA36FMKOVcjs.RemoteEngineControlClient)(
|
|
6195
|
+
_chunkA36FMKOVcjs.convertRegistryConfigToClientConfig.call(void 0, registryConfig)
|
|
6051
6196
|
),
|
|
6052
|
-
{
|
|
6197
|
+
{
|
|
6198
|
+
encoding: "bare",
|
|
6199
|
+
currentActorInvocation: () => callNativeSync(
|
|
6200
|
+
() => runtime.actorInvocationTraceContext(ctx)
|
|
6201
|
+
),
|
|
6202
|
+
startCallSpan: (actorName, actionName) => callNativeSync(
|
|
6203
|
+
() => runtime.startCallSpan(ctx, actorName, actionName)
|
|
6204
|
+
)
|
|
6205
|
+
}
|
|
6053
6206
|
);
|
|
6054
|
-
const run =
|
|
6055
|
-
const runHandlerCoordinator =
|
|
6207
|
+
const run = _chunkNWCAIWHLcjs.getRunFunction.call(void 0, config.run);
|
|
6208
|
+
const runHandlerCoordinator = _chunkNWCAIWHLcjs.getRunInspectorKind.call(void 0, config.run) === "workflow" ? new RunHandlerCoordinator(config.run) : void 0;
|
|
6056
6209
|
const getNativeWorkflowInspector = (ctx) => {
|
|
6057
6210
|
var _a2, _b;
|
|
6058
6211
|
const actorId = callNativeSync(() => runtime.actorId(ctx));
|
|
6059
6212
|
const restart = () => callNativeSync(() => runtime.actorRestartRunHandler(ctx));
|
|
6060
|
-
return _nullishCoalesce(((_a2 = runHandlerCoordinator == null ? void 0 : runHandlerCoordinator.getInspector(actorId, restart)) == null ? void 0 : _a2.workflow), () => ( ((_b =
|
|
6213
|
+
return _nullishCoalesce(((_a2 = runHandlerCoordinator == null ? void 0 : runHandlerCoordinator.getInspector(actorId, restart)) == null ? void 0 : _a2.workflow), () => ( ((_b = _chunkNWCAIWHLcjs.getRunInspectorConfig.call(void 0, config.run, actorId)) == null ? void 0 : _b.workflow)));
|
|
6061
6214
|
};
|
|
6062
6215
|
const onStateChange = typeof config.onStateChange === "function" ? (actorCtx, nextState) => {
|
|
6063
6216
|
config.onStateChange(actorCtx, nextState);
|
|
@@ -6072,7 +6225,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
6072
6225
|
const makeActorCtx = (ctx, request, cancelToken) => new ActorContextHandleAdapter(
|
|
6073
6226
|
runtime,
|
|
6074
6227
|
ctx,
|
|
6075
|
-
createClient,
|
|
6228
|
+
() => createClient(ctx),
|
|
6076
6229
|
schemaConfig,
|
|
6077
6230
|
databaseProvider,
|
|
6078
6231
|
request,
|
|
@@ -6085,7 +6238,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
6085
6238
|
runtime,
|
|
6086
6239
|
ctx,
|
|
6087
6240
|
conn,
|
|
6088
|
-
createClient,
|
|
6241
|
+
() => createClient(ctx),
|
|
6089
6242
|
schemaConfig,
|
|
6090
6243
|
databaseProvider,
|
|
6091
6244
|
request,
|
|
@@ -6110,7 +6263,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
6110
6263
|
}
|
|
6111
6264
|
});
|
|
6112
6265
|
const errorResponse = (error, status) => {
|
|
6113
|
-
const rivetError =
|
|
6266
|
+
const rivetError = _chunkJX2ITWAVcjs.toRivetError.call(void 0, error);
|
|
6114
6267
|
return jsonResponse(
|
|
6115
6268
|
{
|
|
6116
6269
|
group: rivetError.group,
|
|
@@ -6210,7 +6363,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
6210
6363
|
body = await jsRequest.json();
|
|
6211
6364
|
} catch (e5) {
|
|
6212
6365
|
return errorResponse(
|
|
6213
|
-
new (0,
|
|
6366
|
+
new (0, _chunkJX2ITWAVcjs.RivetError)(
|
|
6214
6367
|
"actor",
|
|
6215
6368
|
"invalid_request",
|
|
6216
6369
|
"Invalid inspector JSON body",
|
|
@@ -6222,7 +6375,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
6222
6375
|
const name = _nullishCoalesce(body.name, () => ( ""));
|
|
6223
6376
|
if (name === "") {
|
|
6224
6377
|
return errorResponse(
|
|
6225
|
-
new (0,
|
|
6378
|
+
new (0, _chunkJX2ITWAVcjs.RivetError)(
|
|
6226
6379
|
"actor",
|
|
6227
6380
|
"invalid_request",
|
|
6228
6381
|
"Queue message name must not be empty",
|
|
@@ -6231,7 +6384,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
6231
6384
|
400
|
|
6232
6385
|
);
|
|
6233
6386
|
}
|
|
6234
|
-
const cbor =
|
|
6387
|
+
const cbor = _chunk2CE5UNWKcjs.encodeCborCompat.call(void 0,
|
|
6235
6388
|
_nullishCoalesce(body.body, () => ( null))
|
|
6236
6389
|
);
|
|
6237
6390
|
const message = await runtime.actorQueueSend(ctx, name, cbor);
|
|
@@ -6396,7 +6549,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
6396
6549
|
const action = actionHandlers[actionName];
|
|
6397
6550
|
if (!action) {
|
|
6398
6551
|
return errorResponse(
|
|
6399
|
-
new (0,
|
|
6552
|
+
new (0, _chunkJX2ITWAVcjs.RivetError)(
|
|
6400
6553
|
"action",
|
|
6401
6554
|
"action_not_found",
|
|
6402
6555
|
`Action ${actionName} not found`
|
|
@@ -6599,7 +6752,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
6599
6752
|
);
|
|
6600
6753
|
} finally {
|
|
6601
6754
|
runHandlerCoordinator == null ? void 0 : runHandlerCoordinator.destroy(actorId);
|
|
6602
|
-
|
|
6755
|
+
_chunkNWCAIWHLcjs.disposeRunInspector.call(void 0, config.run, actorId);
|
|
6603
6756
|
await actorCtx.dispose();
|
|
6604
6757
|
}
|
|
6605
6758
|
}
|
|
@@ -6611,7 +6764,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
6611
6764
|
const actorCtx = makeActorCtx(ctx);
|
|
6612
6765
|
const actorId = callNativeSync(() => runtime.actorId(ctx));
|
|
6613
6766
|
runHandlerCoordinator == null ? void 0 : runHandlerCoordinator.destroy(actorId);
|
|
6614
|
-
|
|
6767
|
+
_chunkNWCAIWHLcjs.disposeRunInspector.call(void 0, config.run, actorId);
|
|
6615
6768
|
try {
|
|
6616
6769
|
if (typeof config.onDestroy === "function") {
|
|
6617
6770
|
await config.onDestroy(actorCtx);
|
|
@@ -6769,7 +6922,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
6769
6922
|
);
|
|
6770
6923
|
}
|
|
6771
6924
|
if (!result) {
|
|
6772
|
-
throw
|
|
6925
|
+
throw _chunkJX2ITWAVcjs.forbiddenError.call(void 0, );
|
|
6773
6926
|
}
|
|
6774
6927
|
} finally {
|
|
6775
6928
|
await actorCtx.dispose();
|
|
@@ -6798,111 +6951,125 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
6798
6951
|
async (error, payload) => {
|
|
6799
6952
|
try {
|
|
6800
6953
|
const { ctx, request, cancelToken, responseBodyStream } = unwrapTsfnPayload(error, payload);
|
|
6801
|
-
|
|
6802
|
-
|
|
6803
|
-
|
|
6804
|
-
|
|
6805
|
-
inspectorResponse,
|
|
6806
|
-
responseBodyStream
|
|
6807
|
-
)).response;
|
|
6808
|
-
}
|
|
6809
|
-
if (typeof config.onRequest !== "function") {
|
|
6810
|
-
await cancelNativeHttpRequestBody(request.bodyStream);
|
|
6811
|
-
return (await convertNativeHttpResponse(
|
|
6812
|
-
new Response(null, { status: 404 }),
|
|
6813
|
-
responseBodyStream
|
|
6814
|
-
)).response;
|
|
6815
|
-
}
|
|
6816
|
-
const requestAbortController = new AbortController();
|
|
6817
|
-
const handlerRequest = buildNativeHttpRequest({
|
|
6818
|
-
...request,
|
|
6819
|
-
abortController: requestAbortController
|
|
6820
|
-
});
|
|
6821
|
-
const rawConnParams = handlerRequest.headers.get(_chunkNRIRV3Z2cjs.HEADER_CONN_PARAMS);
|
|
6822
|
-
let requestCtx;
|
|
6823
|
-
let conn;
|
|
6824
|
-
let removeRequestAbortListener;
|
|
6825
|
-
let cleanupDeferredToBody = false;
|
|
6826
|
-
let cleanedUp = false;
|
|
6827
|
-
const cleanupRequest = async () => {
|
|
6828
|
-
if (cleanedUp) return;
|
|
6829
|
-
cleanedUp = true;
|
|
6830
|
-
removeRequestAbortListener == null ? void 0 : removeRequestAbortListener();
|
|
6831
|
-
try {
|
|
6832
|
-
await (requestCtx == null ? void 0 : requestCtx.dispose());
|
|
6833
|
-
} finally {
|
|
6834
|
-
if (conn) {
|
|
6835
|
-
await runtime.connDisconnect(conn);
|
|
6836
|
-
}
|
|
6837
|
-
}
|
|
6838
|
-
};
|
|
6839
|
-
try {
|
|
6840
|
-
const connParams = validateConnParams(
|
|
6841
|
-
schemaConfig.connParamsSchema,
|
|
6842
|
-
rawConnParams ? JSON.parse(rawConnParams) : void 0
|
|
6843
|
-
);
|
|
6844
|
-
conn = await callNative(
|
|
6845
|
-
() => runtime.actorConnectConn(
|
|
6954
|
+
return await runtime.runWithActorInvocationContext(
|
|
6955
|
+
ctx,
|
|
6956
|
+
async () => {
|
|
6957
|
+
const inspectorResponse = await maybeHandleNativeInspectorRequest(
|
|
6846
6958
|
ctx,
|
|
6847
|
-
encodeValue(connParams),
|
|
6848
6959
|
request
|
|
6849
|
-
)
|
|
6850
|
-
);
|
|
6851
|
-
requestCtx = makeConnCtx(
|
|
6852
|
-
ctx,
|
|
6853
|
-
conn,
|
|
6854
|
-
handlerRequest,
|
|
6855
|
-
cancelToken
|
|
6856
|
-
);
|
|
6857
|
-
const ctxAbortSignal = requestCtx.abortSignal;
|
|
6858
|
-
const abortRequest = () => requestAbortController.abort(ctxAbortSignal.reason);
|
|
6859
|
-
if (ctxAbortSignal.aborted) {
|
|
6860
|
-
abortRequest();
|
|
6861
|
-
} else {
|
|
6862
|
-
ctxAbortSignal.addEventListener(
|
|
6863
|
-
"abort",
|
|
6864
|
-
abortRequest,
|
|
6865
|
-
{ once: true }
|
|
6866
|
-
);
|
|
6867
|
-
removeRequestAbortListener = () => ctxAbortSignal.removeEventListener(
|
|
6868
|
-
"abort",
|
|
6869
|
-
abortRequest
|
|
6870
|
-
);
|
|
6871
|
-
}
|
|
6872
|
-
const response = await config.onRequest(
|
|
6873
|
-
requestCtx,
|
|
6874
|
-
handlerRequest
|
|
6875
|
-
);
|
|
6876
|
-
if (!_chunkNRIRV3Z2cjs.isResponseLike.call(void 0, response)) {
|
|
6877
|
-
throw new Error(
|
|
6878
|
-
"onRequest handler must return a Response"
|
|
6879
6960
|
);
|
|
6880
|
-
|
|
6881
|
-
|
|
6882
|
-
|
|
6883
|
-
|
|
6884
|
-
|
|
6885
|
-
|
|
6886
|
-
|
|
6887
|
-
|
|
6888
|
-
|
|
6889
|
-
|
|
6890
|
-
|
|
6891
|
-
|
|
6961
|
+
if (inspectorResponse) {
|
|
6962
|
+
await cancelNativeHttpRequestBody(
|
|
6963
|
+
request.bodyStream
|
|
6964
|
+
);
|
|
6965
|
+
return (await convertNativeHttpResponse(
|
|
6966
|
+
inspectorResponse,
|
|
6967
|
+
responseBodyStream
|
|
6968
|
+
)).response;
|
|
6969
|
+
}
|
|
6970
|
+
if (typeof config.onRequest !== "function") {
|
|
6971
|
+
await cancelNativeHttpRequestBody(
|
|
6972
|
+
request.bodyStream
|
|
6973
|
+
);
|
|
6974
|
+
return (await convertNativeHttpResponse(
|
|
6975
|
+
new Response(null, { status: 404 }),
|
|
6976
|
+
responseBodyStream
|
|
6977
|
+
)).response;
|
|
6978
|
+
}
|
|
6979
|
+
const requestAbortController = new AbortController();
|
|
6980
|
+
const handlerRequest = buildNativeHttpRequest({
|
|
6981
|
+
...request,
|
|
6982
|
+
abortController: requestAbortController
|
|
6892
6983
|
});
|
|
6893
|
-
|
|
6894
|
-
|
|
6895
|
-
|
|
6896
|
-
|
|
6897
|
-
|
|
6898
|
-
|
|
6899
|
-
)
|
|
6900
|
-
|
|
6901
|
-
|
|
6902
|
-
|
|
6984
|
+
const rawConnParams = handlerRequest.headers.get(_chunkA36FMKOVcjs.HEADER_CONN_PARAMS);
|
|
6985
|
+
let requestCtx;
|
|
6986
|
+
let conn;
|
|
6987
|
+
let removeRequestAbortListener;
|
|
6988
|
+
let cleanupDeferredToBody = false;
|
|
6989
|
+
let cleanedUp = false;
|
|
6990
|
+
const cleanupRequest = async () => {
|
|
6991
|
+
if (cleanedUp) return;
|
|
6992
|
+
cleanedUp = true;
|
|
6993
|
+
removeRequestAbortListener == null ? void 0 : removeRequestAbortListener();
|
|
6994
|
+
try {
|
|
6995
|
+
await (requestCtx == null ? void 0 : requestCtx.dispose());
|
|
6996
|
+
} finally {
|
|
6997
|
+
if (conn) {
|
|
6998
|
+
await runtime.connDisconnect(conn);
|
|
6999
|
+
}
|
|
7000
|
+
}
|
|
7001
|
+
};
|
|
7002
|
+
try {
|
|
7003
|
+
const connParams = validateConnParams(
|
|
7004
|
+
schemaConfig.connParamsSchema,
|
|
7005
|
+
rawConnParams ? JSON.parse(rawConnParams) : void 0
|
|
7006
|
+
);
|
|
7007
|
+
conn = await callNative(
|
|
7008
|
+
() => runtime.actorConnectConn(
|
|
7009
|
+
ctx,
|
|
7010
|
+
encodeValue(connParams),
|
|
7011
|
+
request
|
|
7012
|
+
)
|
|
7013
|
+
);
|
|
7014
|
+
requestCtx = makeConnCtx(
|
|
7015
|
+
ctx,
|
|
7016
|
+
conn,
|
|
7017
|
+
handlerRequest,
|
|
7018
|
+
cancelToken
|
|
7019
|
+
);
|
|
7020
|
+
const ctxAbortSignal = requestCtx.abortSignal;
|
|
7021
|
+
const abortRequest = () => requestAbortController.abort(
|
|
7022
|
+
ctxAbortSignal.reason
|
|
7023
|
+
);
|
|
7024
|
+
if (ctxAbortSignal.aborted) {
|
|
7025
|
+
abortRequest();
|
|
7026
|
+
} else {
|
|
7027
|
+
ctxAbortSignal.addEventListener(
|
|
7028
|
+
"abort",
|
|
7029
|
+
abortRequest,
|
|
7030
|
+
{ once: true }
|
|
7031
|
+
);
|
|
7032
|
+
removeRequestAbortListener = () => ctxAbortSignal.removeEventListener(
|
|
7033
|
+
"abort",
|
|
7034
|
+
abortRequest
|
|
7035
|
+
);
|
|
7036
|
+
}
|
|
7037
|
+
const response = await config.onRequest(
|
|
7038
|
+
requestCtx,
|
|
7039
|
+
handlerRequest
|
|
7040
|
+
);
|
|
7041
|
+
if (!_chunkA36FMKOVcjs.isResponseLike.call(void 0, response)) {
|
|
7042
|
+
throw new Error(
|
|
7043
|
+
"onRequest handler must return a Response"
|
|
7044
|
+
);
|
|
7045
|
+
}
|
|
7046
|
+
const conversion = await convertNativeHttpResponse(
|
|
7047
|
+
response,
|
|
7048
|
+
responseBodyStream
|
|
7049
|
+
);
|
|
7050
|
+
if (conversion.bodyCompletion) {
|
|
7051
|
+
cleanupDeferredToBody = true;
|
|
7052
|
+
void conversion.bodyCompletion.then(cleanupRequest).catch((cleanupError) => {
|
|
7053
|
+
logger2().error({
|
|
7054
|
+
msg: "failed to clean up native streaming http request",
|
|
7055
|
+
error: cleanupError
|
|
7056
|
+
});
|
|
7057
|
+
});
|
|
7058
|
+
}
|
|
7059
|
+
return conversion.response;
|
|
7060
|
+
} finally {
|
|
7061
|
+
try {
|
|
7062
|
+
await cancelNativeHttpRequestBody(
|
|
7063
|
+
request.bodyStream
|
|
7064
|
+
);
|
|
7065
|
+
} finally {
|
|
7066
|
+
if (!cleanupDeferredToBody) {
|
|
7067
|
+
await cleanupRequest();
|
|
7068
|
+
}
|
|
7069
|
+
}
|
|
6903
7070
|
}
|
|
6904
7071
|
}
|
|
6905
|
-
|
|
7072
|
+
);
|
|
6906
7073
|
} catch (error2) {
|
|
6907
7074
|
logger2().error({
|
|
6908
7075
|
msg: "native onRequest failed",
|
|
@@ -6961,15 +7128,15 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
6961
7128
|
}
|
|
6962
7129
|
);
|
|
6963
7130
|
})(),
|
|
6964
|
-
getWorkflowHistory:
|
|
7131
|
+
getWorkflowHistory: _chunkNWCAIWHLcjs.hasRunInspectorConfig.call(void 0, config.run) ? wrapNativeCallback(
|
|
6965
7132
|
async (error, payload) => {
|
|
6966
7133
|
var _a2;
|
|
6967
7134
|
const { ctx } = unwrapTsfnPayload(error, payload);
|
|
6968
7135
|
const history = (_a2 = getNativeWorkflowInspector(ctx)) == null ? void 0 : _a2.getHistory();
|
|
6969
|
-
return history == null ? void 0 :
|
|
7136
|
+
return history == null ? void 0 : _chunk2CE5UNWKcjs.toUint8Array.call(void 0, history);
|
|
6970
7137
|
}
|
|
6971
7138
|
) : void 0,
|
|
6972
|
-
replayWorkflow:
|
|
7139
|
+
replayWorkflow: _chunkNWCAIWHLcjs.hasRunInspectorConfig.call(void 0, config.run) ? wrapNativeCallback(
|
|
6973
7140
|
async (error, payload) => {
|
|
6974
7141
|
const { ctx, entryId } = unwrapTsfnPayload(
|
|
6975
7142
|
error,
|
|
@@ -6980,7 +7147,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
6980
7147
|
return void 0;
|
|
6981
7148
|
}
|
|
6982
7149
|
const history = await _asyncNullishCoalesce(await workflowInspector.replayFromStep(entryId), async () => ( null));
|
|
6983
|
-
return history == null ? void 0 :
|
|
7150
|
+
return history == null ? void 0 : _chunk2CE5UNWKcjs.toUint8Array.call(void 0, history);
|
|
6984
7151
|
}
|
|
6985
7152
|
) : void 0,
|
|
6986
7153
|
actions: Object.fromEntries(
|
|
@@ -6990,21 +7157,27 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
6990
7157
|
async (error, payload) => {
|
|
6991
7158
|
const { ctx, conn, args, scheduledFire, cancelToken } = unwrapTsfnPayload(error, payload);
|
|
6992
7159
|
const actorCtx = conn != null ? makeConnCtx(ctx, conn, void 0, cancelToken) : makeActorCtx(ctx, void 0, cancelToken);
|
|
6993
|
-
|
|
6994
|
-
|
|
6995
|
-
|
|
6996
|
-
|
|
6997
|
-
|
|
6998
|
-
|
|
6999
|
-
|
|
7000
|
-
|
|
7001
|
-
|
|
7002
|
-
|
|
7003
|
-
|
|
7004
|
-
|
|
7005
|
-
|
|
7006
|
-
|
|
7007
|
-
|
|
7160
|
+
const runAction = async () => {
|
|
7161
|
+
try {
|
|
7162
|
+
return encodeValue(
|
|
7163
|
+
await handler(
|
|
7164
|
+
actorCtx,
|
|
7165
|
+
...validateActionArgs(
|
|
7166
|
+
schemaConfig.actionInputSchemas,
|
|
7167
|
+
name,
|
|
7168
|
+
decodeArgs(args)
|
|
7169
|
+
),
|
|
7170
|
+
...scheduledFire ? [scheduledFire] : []
|
|
7171
|
+
)
|
|
7172
|
+
);
|
|
7173
|
+
} finally {
|
|
7174
|
+
await actorCtx.dispose();
|
|
7175
|
+
}
|
|
7176
|
+
};
|
|
7177
|
+
return await runtime.runWithActorInvocationContext(
|
|
7178
|
+
ctx,
|
|
7179
|
+
runAction
|
|
7180
|
+
);
|
|
7008
7181
|
}
|
|
7009
7182
|
)
|
|
7010
7183
|
])
|
|
@@ -7026,7 +7199,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
7026
7199
|
runtime,
|
|
7027
7200
|
ctx,
|
|
7028
7201
|
conn,
|
|
7029
|
-
createClient,
|
|
7202
|
+
() => createClient(ctx),
|
|
7030
7203
|
schemaConfig,
|
|
7031
7204
|
databaseProvider,
|
|
7032
7205
|
jsRequest,
|
|
@@ -7035,43 +7208,48 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
7035
7208
|
cancelToken,
|
|
7036
7209
|
run !== void 0
|
|
7037
7210
|
);
|
|
7038
|
-
|
|
7039
|
-
|
|
7040
|
-
|
|
7041
|
-
}
|
|
7042
|
-
const canPublish = getQueueCanPublish(
|
|
7043
|
-
schemaConfig.queues,
|
|
7044
|
-
name
|
|
7045
|
-
);
|
|
7046
|
-
if (canPublish && !await canPublish(actorCtx)) {
|
|
7047
|
-
throw _chunk2JSYYH6Pcjs.forbiddenError.call(void 0, );
|
|
7048
|
-
}
|
|
7049
|
-
const decodedBody = decodeValue(body);
|
|
7050
|
-
if (wait) {
|
|
7211
|
+
return await runtime.runWithActorInvocationContext(
|
|
7212
|
+
ctx,
|
|
7213
|
+
async () => {
|
|
7051
7214
|
try {
|
|
7052
|
-
|
|
7053
|
-
|
|
7054
|
-
|
|
7055
|
-
|
|
7056
|
-
|
|
7057
|
-
|
|
7215
|
+
if (!schemaConfig.queues || !hasSchemaConfigKey(schemaConfig.queues, name)) {
|
|
7216
|
+
return { status: "completed" };
|
|
7217
|
+
}
|
|
7218
|
+
const canPublish = getQueueCanPublish(
|
|
7219
|
+
schemaConfig.queues,
|
|
7220
|
+
name
|
|
7058
7221
|
);
|
|
7059
|
-
|
|
7060
|
-
|
|
7061
|
-
|
|
7062
|
-
|
|
7063
|
-
|
|
7064
|
-
|
|
7065
|
-
|
|
7222
|
+
if (canPublish && !await canPublish(actorCtx)) {
|
|
7223
|
+
throw _chunkJX2ITWAVcjs.forbiddenError.call(void 0, );
|
|
7224
|
+
}
|
|
7225
|
+
const decodedBody = decodeValue(body);
|
|
7226
|
+
if (wait) {
|
|
7227
|
+
try {
|
|
7228
|
+
const response = await actorCtx.queue.enqueueAndWait(
|
|
7229
|
+
name,
|
|
7230
|
+
decodedBody,
|
|
7231
|
+
{
|
|
7232
|
+
timeout: timeoutMs === void 0 || timeoutMs === null ? void 0 : Number(timeoutMs)
|
|
7233
|
+
}
|
|
7234
|
+
);
|
|
7235
|
+
return {
|
|
7236
|
+
status: "completed",
|
|
7237
|
+
response: response === void 0 ? void 0 : encodeValue(response)
|
|
7238
|
+
};
|
|
7239
|
+
} catch (error2) {
|
|
7240
|
+
if (error2.group === "queue" && error2.code === "timed_out") {
|
|
7241
|
+
return { status: "timedOut" };
|
|
7242
|
+
}
|
|
7243
|
+
throw error2;
|
|
7244
|
+
}
|
|
7066
7245
|
}
|
|
7067
|
-
|
|
7246
|
+
await actorCtx.queue.send(name, decodedBody);
|
|
7247
|
+
return { status: "completed" };
|
|
7248
|
+
} finally {
|
|
7249
|
+
await actorCtx.dispose();
|
|
7068
7250
|
}
|
|
7069
7251
|
}
|
|
7070
|
-
|
|
7071
|
-
return { status: "completed" };
|
|
7072
|
-
} finally {
|
|
7073
|
-
await actorCtx.dispose();
|
|
7074
|
-
}
|
|
7252
|
+
);
|
|
7075
7253
|
}
|
|
7076
7254
|
),
|
|
7077
7255
|
serializeState: wrapNativeCallback(
|
|
@@ -7105,7 +7283,7 @@ async function buildServeConfig(config, resolveServicesBinary = true) {
|
|
|
7105
7283
|
startServices: resolveServicesBinary && config.startServices,
|
|
7106
7284
|
handleInspectorHttpInRuntime: true,
|
|
7107
7285
|
serverlessBasePath: config.serverless.basePath,
|
|
7108
|
-
serverlessPackageVersion:
|
|
7286
|
+
serverlessPackageVersion: _chunk2CE5UNWKcjs.VERSION,
|
|
7109
7287
|
serverlessClientEndpoint: config.publicEndpoint,
|
|
7110
7288
|
serverlessClientNamespace: config.publicNamespace,
|
|
7111
7289
|
serverlessClientToken: config.publicToken,
|
|
@@ -7118,7 +7296,7 @@ async function buildServeConfig(config, resolveServicesBinary = true) {
|
|
|
7118
7296
|
} catch (error) {
|
|
7119
7297
|
logger2().warn({
|
|
7120
7298
|
msg: "could not resolve a local engine binary; if a local engine must be spawned it will fail with engine.binary_unavailable \u2014 set RIVET_ENGINE_BINARY_PATH or install the @rivetkit/engine-cli platform package",
|
|
7121
|
-
error:
|
|
7299
|
+
error: _chunk2CE5UNWKcjs.stringifyError.call(void 0, error)
|
|
7122
7300
|
});
|
|
7123
7301
|
}
|
|
7124
7302
|
if (resolveServicesBinary && config.startServices) {
|
|
@@ -7128,20 +7306,20 @@ async function buildServeConfig(config, resolveServicesBinary = true) {
|
|
|
7128
7306
|
} catch (error) {
|
|
7129
7307
|
logger2().warn({
|
|
7130
7308
|
msg: "could not resolve the Services binary; a local engine will fail with services.binary_unavailable \u2014 set RIVET_RUN_SERVICES=0 to disable Services or RIVET_SERVICES_BINARY to a local rivet-services binary",
|
|
7131
|
-
error:
|
|
7309
|
+
error: _chunk2CE5UNWKcjs.stringifyError.call(void 0, error)
|
|
7132
7310
|
});
|
|
7133
7311
|
}
|
|
7134
7312
|
}
|
|
7135
7313
|
serveConfig.engineHost = config.engineHost;
|
|
7136
7314
|
serveConfig.enginePort = config.enginePort;
|
|
7137
7315
|
if ((_a = config.test) == null ? void 0 : _a.enabled) {
|
|
7138
|
-
serveConfig.inspectorTestToken = _nullishCoalesce(
|
|
7316
|
+
serveConfig.inspectorTestToken = _nullishCoalesce(_chunk2CE5UNWKcjs.getEnvUniversal.call(void 0, "_RIVET_TEST_INSPECTOR_TOKEN"), () => ( "token"));
|
|
7139
7317
|
}
|
|
7140
7318
|
return serveConfig;
|
|
7141
7319
|
}
|
|
7142
7320
|
async function buildRegistryWithRuntime(config, runtime) {
|
|
7143
7321
|
var _a;
|
|
7144
|
-
if (((_a = config.test) == null ? void 0 : _a.enabled) &&
|
|
7322
|
+
if (((_a = config.test) == null ? void 0 : _a.enabled) && _chunk2CE5UNWKcjs.getEnvUniversal.call(void 0, "_RIVET_TEST_INSPECTOR_TOKEN") === void 0) {
|
|
7145
7323
|
trySetProcessEnv("_RIVET_TEST_INSPECTOR_TOKEN", "token");
|
|
7146
7324
|
}
|
|
7147
7325
|
if (runtime.kind === "napi") {
|
|
@@ -7208,7 +7386,7 @@ function createApplicationFetch(application, runtime) {
|
|
|
7208
7386
|
signal: abortController.signal
|
|
7209
7387
|
})
|
|
7210
7388
|
);
|
|
7211
|
-
if (!
|
|
7389
|
+
if (!_chunkA36FMKOVcjs.isResponseLike.call(void 0, response)) {
|
|
7212
7390
|
throw new TypeError(
|
|
7213
7391
|
"registry.listen() application fetch must return a Response"
|
|
7214
7392
|
);
|
|
@@ -7258,7 +7436,7 @@ var Registry = class {
|
|
|
7258
7436
|
var _a;
|
|
7259
7437
|
this.#config = config;
|
|
7260
7438
|
if ((_a = config.logging) == null ? void 0 : _a.baseLogger) {
|
|
7261
|
-
|
|
7439
|
+
_chunk2CE5UNWKcjs.configureBaseLogger.call(void 0, config.logging.baseLogger);
|
|
7262
7440
|
}
|
|
7263
7441
|
this.#buildConfiguredRegistry = _nullishCoalesce((deps == null ? void 0 : deps.buildConfiguredRegistry), () => ( buildConfiguredRegistry));
|
|
7264
7442
|
this.routes = {
|
|
@@ -7484,10 +7662,10 @@ var Registry = class {
|
|
|
7484
7662
|
* ```
|
|
7485
7663
|
*/
|
|
7486
7664
|
async listen(opts = {}) {
|
|
7487
|
-
const port = _nullishCoalesce(_nullishCoalesce(opts.port, () => (
|
|
7488
|
-
const publicDir = _nullishCoalesce(opts.publicDir, () => (
|
|
7665
|
+
const port = _nullishCoalesce(_nullishCoalesce(opts.port, () => ( _chunk2CE5UNWKcjs.parsePortEnv.call(void 0, process.env.RIVET_PORT))), () => ( 3e3));
|
|
7666
|
+
const publicDir = _nullishCoalesce(opts.publicDir, () => ( _chunk2CE5UNWKcjs.getRivetkitPublicDir.call(void 0, )));
|
|
7489
7667
|
const config = this.parseConfig();
|
|
7490
|
-
if (opts.application &&
|
|
7668
|
+
if (opts.application && _chunk2CE5UNWKcjs.getRivetkitRuntimeMode.call(void 0, ) !== "serverless") {
|
|
7491
7669
|
if (config.runtime === "wasm") {
|
|
7492
7670
|
throw new Error(
|
|
7493
7671
|
"registry.listen() requires the native runtime; use an application-owned HTTP server with WebAssembly"
|
|
@@ -7563,7 +7741,7 @@ var Registry = class {
|
|
|
7563
7741
|
return jsonRouteResponse(503, {
|
|
7564
7742
|
status: "not_started",
|
|
7565
7743
|
runtime: "rivetkit",
|
|
7566
|
-
version:
|
|
7744
|
+
version: _chunk2CE5UNWKcjs.VERSION
|
|
7567
7745
|
});
|
|
7568
7746
|
}
|
|
7569
7747
|
const { runtime, registry } = configured;
|
|
@@ -7571,7 +7749,7 @@ var Registry = class {
|
|
|
7571
7749
|
return jsonRouteResponse(501, {
|
|
7572
7750
|
status: "unsupported",
|
|
7573
7751
|
runtime: "rivetkit",
|
|
7574
|
-
version:
|
|
7752
|
+
version: _chunk2CE5UNWKcjs.VERSION
|
|
7575
7753
|
});
|
|
7576
7754
|
}
|
|
7577
7755
|
const response = await runtime.registryHealth(registry);
|
|
@@ -7721,6 +7899,7 @@ var Registry = class {
|
|
|
7721
7899
|
var _a;
|
|
7722
7900
|
const modeAPromise = this.#runtimeServeConfiguredPromise;
|
|
7723
7901
|
const modeBPromise = this.#runtimeServerlessPromise;
|
|
7902
|
+
const runtimes = /* @__PURE__ */ new Set();
|
|
7724
7903
|
const gracePeriodMs = await _asyncNullishCoalesce(await _asyncNullishCoalesce(((_a = config.shutdown) == null ? void 0 : _a.gracePeriodMs), async () => ( await this.#actorStopThresholdMs(_nullishCoalesce(modeAPromise, () => ( modeBPromise))))), async () => ( 30 * 60 * 1e3));
|
|
7725
7904
|
const drain = async () => {
|
|
7726
7905
|
const registries = [];
|
|
@@ -7729,6 +7908,7 @@ var Registry = class {
|
|
|
7729
7908
|
(async () => {
|
|
7730
7909
|
try {
|
|
7731
7910
|
const { runtime, registry } = await modeAPromise;
|
|
7911
|
+
runtimes.add(runtime);
|
|
7732
7912
|
await runtime.shutdownRegistry(registry);
|
|
7733
7913
|
} catch (err) {
|
|
7734
7914
|
logger2().warn(
|
|
@@ -7744,6 +7924,7 @@ var Registry = class {
|
|
|
7744
7924
|
(async () => {
|
|
7745
7925
|
try {
|
|
7746
7926
|
const { runtime, registry } = await modeBPromise;
|
|
7927
|
+
runtimes.add(runtime);
|
|
7747
7928
|
await runtime.shutdownRegistry(registry);
|
|
7748
7929
|
} catch (err) {
|
|
7749
7930
|
logger2().warn(
|
|
@@ -7772,6 +7953,12 @@ var Registry = class {
|
|
|
7772
7953
|
}
|
|
7773
7954
|
)
|
|
7774
7955
|
]);
|
|
7956
|
+
await Promise.all(
|
|
7957
|
+
[...runtimes].map((runtime) => {
|
|
7958
|
+
var _a2;
|
|
7959
|
+
return (_a2 = runtime.shutdownTelemetry) == null ? void 0 : _a2.call(runtime);
|
|
7960
|
+
})
|
|
7961
|
+
);
|
|
7775
7962
|
}
|
|
7776
7963
|
async #actorStopThresholdMs(configuredRegistryPromise) {
|
|
7777
7964
|
var _a;
|
|
@@ -7818,7 +8005,7 @@ var Registry = class {
|
|
|
7818
8005
|
);
|
|
7819
8006
|
}
|
|
7820
8007
|
if (this.#runtimeReadyPromise) return this.#runtimeReadyPromise;
|
|
7821
|
-
if (
|
|
8008
|
+
if (_chunk2CE5UNWKcjs.getRivetkitRuntimeMode.call(void 0, ) === "serverless") {
|
|
7822
8009
|
return Promise.reject(
|
|
7823
8010
|
new Error(
|
|
7824
8011
|
"registry.startAndWait() requires envoy runtime mode; serverless registries become ready per request"
|
|
@@ -7888,8 +8075,8 @@ var Registry = class {
|
|
|
7888
8075
|
* ```
|
|
7889
8076
|
*/
|
|
7890
8077
|
start() {
|
|
7891
|
-
if (
|
|
7892
|
-
const publicDir = _nullishCoalesce(
|
|
8078
|
+
if (_chunk2CE5UNWKcjs.getRivetkitRuntimeMode.call(void 0, ) === "serverless") {
|
|
8079
|
+
const publicDir = _nullishCoalesce(_chunk2CE5UNWKcjs.getRivetkitPublicDir.call(void 0, ), () => ( "/public"));
|
|
7893
8080
|
this.listen({ publicDir }).catch((error) => {
|
|
7894
8081
|
logger2().error({ error }, "auto-listen failed; exiting");
|
|
7895
8082
|
if (typeof process !== "undefined" && typeof process.exit === "function") {
|
|
@@ -7910,7 +8097,7 @@ var Registry = class {
|
|
|
7910
8097
|
};
|
|
7911
8098
|
console.log();
|
|
7912
8099
|
console.log(
|
|
7913
|
-
` RivetKit ${
|
|
8100
|
+
` RivetKit ${_chunk2CE5UNWKcjs.VERSION} (Engine - ${kind === "serverless" ? "Serverless" : "Serverful"})`
|
|
7914
8101
|
);
|
|
7915
8102
|
if (config.namespace !== "default") {
|
|
7916
8103
|
logLine("Namespace", config.namespace);
|
|
@@ -7986,5 +8173,5 @@ function setup(input) {
|
|
|
7986
8173
|
|
|
7987
8174
|
|
|
7988
8175
|
|
|
7989
|
-
exports.ALLOWED_PUBLIC_HEADERS =
|
|
8176
|
+
exports.ALLOWED_PUBLIC_HEADERS = _chunkA36FMKOVcjs.ALLOWED_PUBLIC_HEADERS; exports.ActorDefinition = ActorDefinition; exports.ActorError = _chunkJX2ITWAVcjs.RivetError; exports.ActorsSchema = ActorsSchema; exports.DocConfigurePoolSchema = DocConfigurePoolSchema; exports.DocEnvoyConfigSchema = DocEnvoyConfigSchema; exports.DocRegistryConfigSchema = DocRegistryConfigSchema; exports.DocServerlessConfigSchema = DocServerlessConfigSchema; exports.DocSqliteConfigSchema = DocSqliteConfigSchema; exports.InlineWebSocketAdapter = InlineWebSocketAdapter; exports.Registry = Registry; exports.RegistryConfigSchema = RegistryConfigSchema; exports.RivetError = _chunkJX2ITWAVcjs.RivetError; exports.RuntimeKindSchema = RuntimeKindSchema; exports.SqliteBackendSchema = SqliteBackendSchema; exports.SqliteConfigSchema = SqliteConfigSchema; exports.TestConfigSchema = TestConfigSchema; exports.UserError = _chunkJX2ITWAVcjs.UserError; exports.WasmRuntimeConfigSchema = WasmRuntimeConfigSchema; exports.actor = actor; exports.buildActorNames = buildActorNames; exports.createClientWithDriver = _chunkA36FMKOVcjs.createClientWithDriver; exports.defineRunHandler = _chunkNWCAIWHLcjs.defineRunHandler; exports.event = event; exports.isStaticActorDefinition = isStaticActorDefinition; exports.isStaticActorInstance = isStaticActorInstance; exports.lookupInRegistry = lookupInRegistry; exports.noopNext = _chunk2CE5UNWKcjs.noopNext; exports.queue = queue; exports.setup = setup; exports.toUint8Array = _chunk2CE5UNWKcjs.toUint8Array;
|
|
7990
8177
|
//# sourceMappingURL=mod.cjs.map
|