rivetkit 2.3.0 → 2.3.1
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 +19 -6
- package/dist/browser/client.js +4 -4
- package/dist/browser/client.js.map +1 -1
- package/dist/browser/inspector/client.js +4 -4
- package/dist/browser/inspector/client.js.map +1 -1
- package/dist/tsup/actor/errors.cjs +4 -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 +3 -1
- package/dist/tsup/agent-os/index.cjs +4 -4
- package/dist/tsup/agent-os/index.cjs.map +1 -1
- package/dist/tsup/agent-os/index.d.cts +18 -5
- package/dist/tsup/agent-os/index.d.ts +18 -5
- package/dist/tsup/agent-os/index.js +4 -4
- package/dist/tsup/agent-os/index.js.map +1 -1
- package/dist/tsup/{chunk-NIY3RSPX.cjs → chunk-3MHDOUD7.cjs} +11 -2
- package/dist/tsup/chunk-3MHDOUD7.cjs.map +1 -0
- package/dist/tsup/{chunk-KORQB2IR.cjs → chunk-4FC7TVS6.cjs} +6 -2
- package/dist/tsup/chunk-4FC7TVS6.cjs.map +1 -0
- package/dist/tsup/{chunk-47HHIEXH.cjs → chunk-4UUEB43Y.cjs} +4 -4
- package/dist/tsup/{chunk-47HHIEXH.cjs.map → chunk-4UUEB43Y.cjs.map} +1 -1
- package/dist/tsup/{chunk-7QKCIVAY.cjs → chunk-5IWLUJ6W.cjs} +167 -167
- package/dist/tsup/{chunk-7QKCIVAY.cjs.map → chunk-5IWLUJ6W.cjs.map} +1 -1
- package/dist/tsup/{chunk-P2GNQ4RN.js → chunk-H6VVZMWN.js} +4 -4
- package/dist/tsup/{chunk-MEHBWPLJ.js → chunk-I35VSLEM.js} +3 -3
- package/dist/tsup/{chunk-BEI24WTI.js → chunk-JBUZRPY5.js} +2 -2
- package/dist/tsup/{chunk-B6VUNZUD.cjs → chunk-JLJJZYCJ.cjs} +10 -10
- package/dist/tsup/{chunk-B6VUNZUD.cjs.map → chunk-JLJJZYCJ.cjs.map} +1 -1
- package/dist/tsup/{chunk-VTTFNQQI.js → chunk-L2X3YFER.js} +31 -6
- package/dist/tsup/chunk-L2X3YFER.js.map +1 -0
- package/dist/tsup/{chunk-DXXJPH55.cjs → chunk-MNHKOS6L.cjs} +39 -14
- package/dist/tsup/chunk-MNHKOS6L.cjs.map +1 -0
- package/dist/tsup/{chunk-UMZVD6DQ.js → chunk-NERUIBOT.js} +2 -2
- package/dist/tsup/{chunk-I4LN3FNT.cjs → chunk-OST76LRW.cjs} +7 -7
- package/dist/tsup/{chunk-I4LN3FNT.cjs.map → chunk-OST76LRW.cjs.map} +1 -1
- package/dist/tsup/{chunk-LVTBW2RE.cjs → chunk-OZBCXBVP.cjs} +3 -3
- package/dist/tsup/{chunk-LVTBW2RE.cjs.map → chunk-OZBCXBVP.cjs.map} +1 -1
- package/dist/tsup/{chunk-4JDSFJS5.js → chunk-PT6OIW5E.js} +5 -5
- package/dist/tsup/{chunk-2OTRTA3J.js → chunk-R6KPN5EW.js} +2 -2
- package/dist/tsup/{chunk-3677IIOV.cjs → chunk-V5KMAMX3.cjs} +5 -5
- package/dist/tsup/{chunk-3677IIOV.cjs.map → chunk-V5KMAMX3.cjs.map} +1 -1
- package/dist/tsup/{chunk-DPIMKYNB.js → chunk-XIX5DOZN.js} +10 -1
- package/dist/tsup/chunk-XIX5DOZN.js.map +1 -0
- package/dist/tsup/{chunk-BRP62GZC.js → chunk-ZZ3WBRPD.js} +5 -1
- package/dist/tsup/chunk-ZZ3WBRPD.js.map +1 -0
- package/dist/tsup/client/mod.cjs +7 -7
- package/dist/tsup/client/mod.d.cts +3 -3
- package/dist/tsup/client/mod.d.ts +3 -3
- package/dist/tsup/client/mod.js +6 -6
- 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-CZQQ-mso.d.cts → config-CzvopP5m.d.cts} +22 -7
- package/dist/tsup/{config-BxWAw3iH.d.ts → config-DZuT7tcp.d.ts} +22 -7
- package/dist/tsup/context-CyAdY-aA.d.ts +128 -0
- package/dist/tsup/context-sNB28g0N.d.cts +128 -0
- package/dist/tsup/dynamic/mod.cjs +2 -2
- package/dist/tsup/dynamic/mod.d.cts +2 -2
- package/dist/tsup/dynamic/mod.d.ts +2 -2
- 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-tab/mod.cjs +2 -2
- package/dist/tsup/inspector-tab/mod.cjs.map +1 -1
- package/dist/tsup/inspector-tab/mod.d.cts +3 -3
- package/dist/tsup/inspector-tab/mod.d.ts +3 -3
- package/dist/tsup/inspector-tab/mod.js +1 -1
- package/dist/tsup/inspector-tab/mod.js.map +1 -1
- package/dist/tsup/mod.cjs +292 -276
- package/dist/tsup/mod.cjs.map +1 -1
- package/dist/tsup/mod.d.cts +4 -4
- package/dist/tsup/mod.d.ts +4 -4
- package/dist/tsup/mod.js +202 -186
- package/dist/tsup/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +10 -10
- package/dist/tsup/test/mod.d.cts +2 -2
- package/dist/tsup/test/mod.d.ts +2 -2
- package/dist/tsup/test/mod.js +6 -6
- package/dist/tsup/{utils-DQosb24I.d.ts → utils-CqDnC_PS.d.cts} +2 -1
- package/dist/tsup/{utils-DQosb24I.d.cts → utils-CqDnC_PS.d.ts} +2 -1
- package/dist/tsup/utils.cjs +3 -3
- package/dist/tsup/utils.d.cts +1 -1
- package/dist/tsup/utils.d.ts +1 -1
- package/dist/tsup/utils.js +2 -2
- package/dist/tsup/workflow/mod.cjs +184 -148
- package/dist/tsup/workflow/mod.cjs.map +1 -1
- package/dist/tsup/workflow/mod.d.cts +6 -6
- package/dist/tsup/workflow/mod.d.ts +6 -6
- package/dist/tsup/workflow/mod.js +177 -141
- package/dist/tsup/workflow/mod.js.map +1 -1
- package/package.json +11 -11
- package/src/actor/config.ts +14 -0
- package/src/actor/errors.ts +11 -0
- package/src/inspector-tab/mod.ts +1 -1
- package/src/registry/index.ts +74 -18
- package/src/registry/napi-runtime.ts +16 -0
- package/src/registry/native.ts +79 -30
- package/src/registry/runtime.ts +11 -0
- package/src/registry/wasm-runtime.ts +11 -0
- package/src/utils/env-vars.ts +31 -0
- package/src/workflow/context.ts +675 -244
- package/src/workflow/driver.ts +20 -7
- package/src/workflow/mod.ts +25 -9
- package/dist/tsup/chunk-BRP62GZC.js.map +0 -1
- package/dist/tsup/chunk-DPIMKYNB.js.map +0 -1
- package/dist/tsup/chunk-DXXJPH55.cjs.map +0 -1
- package/dist/tsup/chunk-KORQB2IR.cjs.map +0 -1
- package/dist/tsup/chunk-NIY3RSPX.cjs.map +0 -1
- package/dist/tsup/chunk-VTTFNQQI.js.map +0 -1
- package/dist/tsup/context-Bw7xq8w3.d.cts +0 -92
- package/dist/tsup/context-D8QA76sV.d.ts +0 -92
- package/src/utils/serve.ts +0 -216
- /package/dist/tsup/{chunk-P2GNQ4RN.js.map → chunk-H6VVZMWN.js.map} +0 -0
- /package/dist/tsup/{chunk-MEHBWPLJ.js.map → chunk-I35VSLEM.js.map} +0 -0
- /package/dist/tsup/{chunk-BEI24WTI.js.map → chunk-JBUZRPY5.js.map} +0 -0
- /package/dist/tsup/{chunk-UMZVD6DQ.js.map → chunk-NERUIBOT.js.map} +0 -0
- /package/dist/tsup/{chunk-4JDSFJS5.js.map → chunk-PT6OIW5E.js.map} +0 -0
- /package/dist/tsup/{chunk-2OTRTA3J.js.map → chunk-R6KPN5EW.js.map} +0 -0
package/dist/tsup/mod.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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
|
|
3
|
+
var _chunk4UUEB43Ycjs = require('./chunk-4UUEB43Y.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -9,8 +9,8 @@ var _chunk47HHIEXHcjs = require('./chunk-47HHIEXH.cjs');
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var _chunkNIY3RSPXcjs = require('./chunk-NIY3RSPX.cjs');
|
|
13
12
|
|
|
13
|
+
var _chunk3MHDOUD7cjs = require('./chunk-3MHDOUD7.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
@@ -19,7 +19,8 @@ var _chunkNIY3RSPXcjs = require('./chunk-NIY3RSPX.cjs');
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
|
|
23
|
+
var _chunk5IWLUJ6Wcjs = require('./chunk-5IWLUJ6W.cjs');
|
|
23
24
|
|
|
24
25
|
|
|
25
26
|
|
|
@@ -32,9 +33,12 @@ var _chunkVE2X4KMGcjs = require('./chunk-VE2X4KMG.cjs');
|
|
|
32
33
|
|
|
33
34
|
|
|
34
35
|
|
|
35
|
-
var
|
|
36
|
+
var _chunkV5KMAMX3cjs = require('./chunk-V5KMAMX3.cjs');
|
|
36
37
|
require('./chunk-ZA7FLHKH.cjs');
|
|
37
|
-
require('./chunk-
|
|
38
|
+
require('./chunk-OZBCXBVP.cjs');
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
38
42
|
|
|
39
43
|
|
|
40
44
|
|
|
@@ -60,8 +64,8 @@ require('./chunk-LVTBW2RE.cjs');
|
|
|
60
64
|
|
|
61
65
|
|
|
62
66
|
|
|
67
|
+
var _chunkMNHKOS6Lcjs = require('./chunk-MNHKOS6L.cjs');
|
|
63
68
|
|
|
64
|
-
var _chunkDXXJPH55cjs = require('./chunk-DXXJPH55.cjs');
|
|
65
69
|
|
|
66
70
|
|
|
67
71
|
|
|
@@ -72,11 +76,11 @@ var _chunkDXXJPH55cjs = require('./chunk-DXXJPH55.cjs');
|
|
|
72
76
|
|
|
73
77
|
|
|
74
78
|
|
|
75
|
-
var
|
|
79
|
+
var _chunk4FC7TVS6cjs = require('./chunk-4FC7TVS6.cjs');
|
|
76
80
|
|
|
77
81
|
// src/actor/log.ts
|
|
78
82
|
function loggerWithoutContext() {
|
|
79
|
-
return
|
|
83
|
+
return _chunkMNHKOS6Lcjs.getLogger.call(void 0, "actor-runtime");
|
|
80
84
|
}
|
|
81
85
|
|
|
82
86
|
// src/actor/definition.ts
|
|
@@ -109,7 +113,7 @@ function actor(input) {
|
|
|
109
113
|
warnDeprecatedShutdownTimeoutKeys(
|
|
110
114
|
input == null ? void 0 : input.options
|
|
111
115
|
);
|
|
112
|
-
const config =
|
|
116
|
+
const config = _chunk3MHDOUD7cjs.ActorConfigSchema.parse(input);
|
|
113
117
|
return new ActorDefinition(config);
|
|
114
118
|
}
|
|
115
119
|
function isStaticActorDefinition(definition) {
|
|
@@ -191,7 +195,7 @@ function validateSchemaSync(schemas, key, data) {
|
|
|
191
195
|
if (isStandardSchema(schema)) {
|
|
192
196
|
const result = schema["~standard"].validate(data);
|
|
193
197
|
if (isPromiseLike(result)) {
|
|
194
|
-
throw
|
|
198
|
+
throw _chunk4FC7TVS6cjs.unsupportedFeature.call(void 0, "async schema validation");
|
|
195
199
|
}
|
|
196
200
|
if (result.issues) {
|
|
197
201
|
return { success: false, issues: [...result.issues] };
|
|
@@ -208,7 +212,7 @@ function validateSchemaSync(schemas, key, data) {
|
|
|
208
212
|
var _virtualwebsocket = require('@rivetkit/virtual-websocket');
|
|
209
213
|
var _ws = require('hono/ws');
|
|
210
214
|
function logger() {
|
|
211
|
-
return
|
|
215
|
+
return _chunkMNHKOS6Lcjs.getLogger.call(void 0, "inline-websocket-adapter");
|
|
212
216
|
}
|
|
213
217
|
var InlineWebSocketAdapter = class {
|
|
214
218
|
#handler;
|
|
@@ -358,9 +362,6 @@ var InlineWebSocketAdapter = class {
|
|
|
358
362
|
}
|
|
359
363
|
};
|
|
360
364
|
|
|
361
|
-
// src/registry/index.ts
|
|
362
|
-
var _hono = require('hono');
|
|
363
|
-
|
|
364
365
|
// src/common/engine.ts
|
|
365
366
|
var ENGINE_HOST = "127.0.0.1";
|
|
366
367
|
var ENGINE_PORT = 6420;
|
|
@@ -382,7 +383,7 @@ function isLocalEngineEndpoint(endpoint) {
|
|
|
382
383
|
|
|
383
384
|
// src/registry/log.ts
|
|
384
385
|
function logger2() {
|
|
385
|
-
return
|
|
386
|
+
return _chunkMNHKOS6Lcjs.getLogger.call(void 0, "registry");
|
|
386
387
|
}
|
|
387
388
|
|
|
388
389
|
// src/serverless/configure.ts
|
|
@@ -428,8 +429,8 @@ async function configureServerlessPool(config) {
|
|
|
428
429
|
);
|
|
429
430
|
}
|
|
430
431
|
const customConfig = config.configurePool;
|
|
431
|
-
const clientConfig =
|
|
432
|
-
const dcsRes = await
|
|
432
|
+
const clientConfig = _chunk5IWLUJ6Wcjs.convertRegistryConfigToClientConfig.call(void 0, config);
|
|
433
|
+
const dcsRes = await _chunk5IWLUJ6Wcjs.getDatacenters.call(void 0, clientConfig);
|
|
433
434
|
const poolName = _nullishCoalesce(customConfig.name, () => ( "default"));
|
|
434
435
|
const serverlessToken = _nullishCoalesce(config.token, () => ( config.publicToken));
|
|
435
436
|
const headers = {
|
|
@@ -451,7 +452,7 @@ async function configureServerlessPool(config) {
|
|
|
451
452
|
metadata: _nullishCoalesce(customConfig.metadata, () => ( {})),
|
|
452
453
|
drain_on_version_upgrade: _nullishCoalesce(customConfig.drainOnVersionUpgrade, () => ( true))
|
|
453
454
|
};
|
|
454
|
-
await
|
|
455
|
+
await _chunk5IWLUJ6Wcjs.updateRunnerConfig.call(void 0, clientConfig, poolName, {
|
|
455
456
|
datacenters: Object.fromEntries(
|
|
456
457
|
dcsRes.datacenters.map((dc) => [dc.name, serverlessConfig])
|
|
457
458
|
)
|
|
@@ -468,7 +469,7 @@ async function configureServerlessPool(config) {
|
|
|
468
469
|
logger2().warn({
|
|
469
470
|
msg: "serverless pool configuration attempt failed",
|
|
470
471
|
attempts,
|
|
471
|
-
error:
|
|
472
|
+
error: _chunkMNHKOS6Lcjs.stringifyError.call(void 0, error)
|
|
472
473
|
});
|
|
473
474
|
await sleep(CONFIGURE_RETRY_DELAY_MS);
|
|
474
475
|
}
|
|
@@ -476,150 +477,11 @@ async function configureServerlessPool(config) {
|
|
|
476
477
|
logger2().error({
|
|
477
478
|
msg: "failed to configure serverless pool, validate endpoint is configured correctly then restart this process",
|
|
478
479
|
attempts,
|
|
479
|
-
error:
|
|
480
|
+
error: _chunkMNHKOS6Lcjs.stringifyError.call(void 0, lastError)
|
|
480
481
|
});
|
|
481
482
|
throw lastError;
|
|
482
483
|
}
|
|
483
484
|
|
|
484
|
-
// src/utils/serve.ts
|
|
485
|
-
var _getport = require('get-port'); var _getport2 = _interopRequireDefault(_getport);
|
|
486
|
-
var serveStaticLoaderPromises = {};
|
|
487
|
-
async function crossPlatformServe(config, httpPort, app, runtime = _chunkDXXJPH55cjs.detectRuntime.call(void 0, )) {
|
|
488
|
-
logger2().debug({ msg: "detected runtime for serve", runtime });
|
|
489
|
-
switch (runtime) {
|
|
490
|
-
case "deno":
|
|
491
|
-
return serveDeno(config, httpPort, app);
|
|
492
|
-
case "bun":
|
|
493
|
-
return serveBun(config, httpPort, app);
|
|
494
|
-
case "node":
|
|
495
|
-
return serveNode(config, httpPort, app);
|
|
496
|
-
default:
|
|
497
|
-
return serveNode(config, httpPort, app);
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
async function loadRuntimeServeStatic(runtime) {
|
|
501
|
-
if (!serveStaticLoaderPromises[runtime]) {
|
|
502
|
-
if (runtime === "node") {
|
|
503
|
-
const nodeServeStaticModule = "@hono/node-server/serve-static";
|
|
504
|
-
serveStaticLoaderPromises[runtime] = Promise.resolve().then(() => _interopRequireWildcard(require(
|
|
505
|
-
/* webpackIgnore: true */
|
|
506
|
-
nodeServeStaticModule
|
|
507
|
-
))).then((x) => x.serveStatic);
|
|
508
|
-
} else if (runtime === "bun") {
|
|
509
|
-
const bunModule = "hono/bun";
|
|
510
|
-
serveStaticLoaderPromises[runtime] = Promise.resolve().then(() => _interopRequireWildcard(require(
|
|
511
|
-
/* webpackIgnore: true */
|
|
512
|
-
bunModule
|
|
513
|
-
))).then((x) => x.serveStatic);
|
|
514
|
-
} else if (runtime === "deno") {
|
|
515
|
-
const denoModule = "hono/deno";
|
|
516
|
-
serveStaticLoaderPromises[runtime] = Promise.resolve().then(() => _interopRequireWildcard(require(
|
|
517
|
-
/* webpackIgnore: true */
|
|
518
|
-
denoModule
|
|
519
|
-
))).then((x) => x.serveStatic);
|
|
520
|
-
} else {
|
|
521
|
-
throw new Error(`unsupported runtime: ${runtime}`);
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
return await serveStaticLoaderPromises[runtime];
|
|
525
|
-
}
|
|
526
|
-
async function serveNode(config, httpPort, app) {
|
|
527
|
-
const nodeServerModule = "@hono/node-server";
|
|
528
|
-
let serve;
|
|
529
|
-
try {
|
|
530
|
-
const dep = await Promise.resolve().then(() => _interopRequireWildcard(require(
|
|
531
|
-
/* webpackIgnore: true */
|
|
532
|
-
nodeServerModule
|
|
533
|
-
)));
|
|
534
|
-
serve = dep.serve;
|
|
535
|
-
} catch (err) {
|
|
536
|
-
logger2().error({
|
|
537
|
-
msg: "failed to import @hono/node-server. please run 'npm install @hono/node-server @hono/node-ws'",
|
|
538
|
-
error: _chunkDXXJPH55cjs.stringifyError.call(void 0, err)
|
|
539
|
-
});
|
|
540
|
-
process.exit(1);
|
|
541
|
-
}
|
|
542
|
-
const nodeWsModule = "@hono/node-ws";
|
|
543
|
-
let createNodeWebSocket;
|
|
544
|
-
try {
|
|
545
|
-
const dep = await Promise.resolve().then(() => _interopRequireWildcard(require(
|
|
546
|
-
/* webpackIgnore: true */
|
|
547
|
-
nodeWsModule
|
|
548
|
-
)));
|
|
549
|
-
createNodeWebSocket = dep.createNodeWebSocket;
|
|
550
|
-
} catch (err) {
|
|
551
|
-
logger2().error({
|
|
552
|
-
msg: "failed to import @hono/node-ws. please run 'npm install @hono/node-server @hono/node-ws'",
|
|
553
|
-
error: _chunkDXXJPH55cjs.stringifyError.call(void 0, err)
|
|
554
|
-
});
|
|
555
|
-
process.exit(1);
|
|
556
|
-
}
|
|
557
|
-
const { injectWebSocket, upgradeWebSocket } = createNodeWebSocket({
|
|
558
|
-
app
|
|
559
|
-
});
|
|
560
|
-
const port = httpPort;
|
|
561
|
-
const hostname = config.httpHost;
|
|
562
|
-
const server = serve(
|
|
563
|
-
{ fetch: app.fetch, port, hostname },
|
|
564
|
-
() => logger2().info({ msg: "server listening", port, hostname })
|
|
565
|
-
);
|
|
566
|
-
injectWebSocket(server);
|
|
567
|
-
const closeServer = () => {
|
|
568
|
-
server.close();
|
|
569
|
-
};
|
|
570
|
-
return { upgradeWebSocket, closeServer };
|
|
571
|
-
}
|
|
572
|
-
async function serveDeno(config, httpPort, app) {
|
|
573
|
-
const honoDenoModule = "hono/deno";
|
|
574
|
-
let upgradeWebSocket;
|
|
575
|
-
try {
|
|
576
|
-
const dep = await Promise.resolve().then(() => _interopRequireWildcard(require(
|
|
577
|
-
/* webpackIgnore: true */
|
|
578
|
-
honoDenoModule
|
|
579
|
-
)));
|
|
580
|
-
upgradeWebSocket = dep.upgradeWebSocket;
|
|
581
|
-
} catch (err) {
|
|
582
|
-
logger2().error({
|
|
583
|
-
msg: "failed to import hono/deno",
|
|
584
|
-
error: _chunkDXXJPH55cjs.stringifyError.call(void 0, err)
|
|
585
|
-
});
|
|
586
|
-
process.exit(1);
|
|
587
|
-
}
|
|
588
|
-
const port = httpPort;
|
|
589
|
-
const hostname = config.httpHost;
|
|
590
|
-
Deno.serve({ port, hostname }, app.fetch);
|
|
591
|
-
logger2().info({ msg: "server listening", port, hostname });
|
|
592
|
-
return { upgradeWebSocket };
|
|
593
|
-
}
|
|
594
|
-
async function serveBun(config, httpPort, app) {
|
|
595
|
-
const honoBunModule = "hono/bun";
|
|
596
|
-
let createBunWebSocket;
|
|
597
|
-
try {
|
|
598
|
-
const dep = await Promise.resolve().then(() => _interopRequireWildcard(require(
|
|
599
|
-
/* webpackIgnore: true */
|
|
600
|
-
honoBunModule
|
|
601
|
-
)));
|
|
602
|
-
createBunWebSocket = dep.createBunWebSocket;
|
|
603
|
-
} catch (err) {
|
|
604
|
-
logger2().error({
|
|
605
|
-
msg: "failed to import hono/bun",
|
|
606
|
-
error: _chunkDXXJPH55cjs.stringifyError.call(void 0, err)
|
|
607
|
-
});
|
|
608
|
-
process.exit(1);
|
|
609
|
-
}
|
|
610
|
-
const { websocket, upgradeWebSocket } = createBunWebSocket();
|
|
611
|
-
const port = httpPort;
|
|
612
|
-
const hostname = config.httpHost;
|
|
613
|
-
Bun.serve({
|
|
614
|
-
fetch: app.fetch,
|
|
615
|
-
port,
|
|
616
|
-
hostname,
|
|
617
|
-
websocket
|
|
618
|
-
});
|
|
619
|
-
logger2().info({ msg: "server listening", port, hostname });
|
|
620
|
-
return { upgradeWebSocket };
|
|
621
|
-
}
|
|
622
|
-
|
|
623
485
|
// src/registry/config/index.ts
|
|
624
486
|
var _zod = require('zod');
|
|
625
487
|
|
|
@@ -627,20 +489,20 @@ var _zod = require('zod');
|
|
|
627
489
|
var _v4 = require('zod/v4');
|
|
628
490
|
var warnedMissingVersion = false;
|
|
629
491
|
var EnvoyConfigSchema = _v4.z.object({
|
|
630
|
-
poolName: _v4.z.string().default(() => _nullishCoalesce(
|
|
492
|
+
poolName: _v4.z.string().default(() => _nullishCoalesce(_chunkMNHKOS6Lcjs.getRivetPool.call(void 0, ), () => ( "default"))),
|
|
631
493
|
version: _v4.z.number().default(() => {
|
|
632
|
-
const version =
|
|
494
|
+
const version = _chunkMNHKOS6Lcjs.getRivetEnvoyVersion.call(void 0, );
|
|
633
495
|
if (version !== void 0) return version;
|
|
634
|
-
if (
|
|
496
|
+
if (_chunkMNHKOS6Lcjs.getNodeEnv.call(void 0, ) === "production" && !warnedMissingVersion) {
|
|
635
497
|
warnedMissingVersion = true;
|
|
636
|
-
|
|
498
|
+
_chunkMNHKOS6Lcjs.getLogger.call(void 0, "rivetkit").error(
|
|
637
499
|
"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"
|
|
638
500
|
);
|
|
639
501
|
}
|
|
640
502
|
return 1;
|
|
641
503
|
}),
|
|
642
504
|
// Deprecated.
|
|
643
|
-
totalSlots: _v4.z.number().default(() => _nullishCoalesce(
|
|
505
|
+
totalSlots: _v4.z.number().default(() => _nullishCoalesce(_chunkMNHKOS6Lcjs.getRivetTotalSlots.call(void 0, ), () => ( 1e5))),
|
|
644
506
|
envoyKey: _v4.z.string().optional()
|
|
645
507
|
});
|
|
646
508
|
|
|
@@ -678,7 +540,7 @@ var ServerlessConfigSchema = _v4.z.object({
|
|
|
678
540
|
*
|
|
679
541
|
* Can also be set via RIVET_PUBLIC_ENDPOINT environment variable.
|
|
680
542
|
*/
|
|
681
|
-
publicEndpoint: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => (
|
|
543
|
+
publicEndpoint: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkMNHKOS6Lcjs.getRivetPublicEndpoint.call(void 0, )))),
|
|
682
544
|
/**
|
|
683
545
|
* Token that clients should use when connecting via the public endpoint.
|
|
684
546
|
*
|
|
@@ -686,7 +548,7 @@ var ServerlessConfigSchema = _v4.z.object({
|
|
|
686
548
|
*
|
|
687
549
|
* Can also be specified in the publicEndpoint URL as `https://namespace:token@host`.
|
|
688
550
|
*/
|
|
689
|
-
publicToken: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => (
|
|
551
|
+
publicToken: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkMNHKOS6Lcjs.getRivetPublicToken.call(void 0, ))))
|
|
690
552
|
// There is no publicNamespace config option because the frontend and backend
|
|
691
553
|
// cannot use different namespaces. The namespace is extracted from the
|
|
692
554
|
// publicEndpoint URL auth syntax if provided.
|
|
@@ -740,7 +602,7 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
740
602
|
* Runtime binding to use for RivetKit core.
|
|
741
603
|
* */
|
|
742
604
|
runtime: RuntimeKindSchema.optional().transform((val, ctx) => {
|
|
743
|
-
const rawRuntime = _nullishCoalesce(val, () => (
|
|
605
|
+
const rawRuntime = _nullishCoalesce(val, () => ( _chunkMNHKOS6Lcjs.getRivetkitRuntime.call(void 0, )));
|
|
744
606
|
if (rawRuntime === void 0) {
|
|
745
607
|
return "auto";
|
|
746
608
|
}
|
|
@@ -777,7 +639,7 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
777
639
|
* */
|
|
778
640
|
logging: _zod.z.object({
|
|
779
641
|
baseLogger: _zod.z.custom().optional(),
|
|
780
|
-
level:
|
|
642
|
+
level: _chunkMNHKOS6Lcjs.LogLevelSchema.optional()
|
|
781
643
|
}).optional().default(() => ({})),
|
|
782
644
|
// MARK: Routing
|
|
783
645
|
// // This is a function to allow for lazy configuration of upgradeWebSocket on the
|
|
@@ -795,9 +657,9 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
795
657
|
*
|
|
796
658
|
* Can also be set via RIVET_ENDPOINT environment variables.
|
|
797
659
|
*/
|
|
798
|
-
endpoint: _zod.z.string().optional().transform((val) => _nullishCoalesce(_nullishCoalesce(val, () => (
|
|
799
|
-
token: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => (
|
|
800
|
-
namespace: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => (
|
|
660
|
+
endpoint: _zod.z.string().optional().transform((val) => _nullishCoalesce(_nullishCoalesce(val, () => ( _chunkMNHKOS6Lcjs.getRivetEngine.call(void 0, ))), () => ( _chunkMNHKOS6Lcjs.getRivetEndpoint.call(void 0, )))),
|
|
661
|
+
token: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkMNHKOS6Lcjs.getRivetToken.call(void 0, )))),
|
|
662
|
+
namespace: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkMNHKOS6Lcjs.getRivetNamespace.call(void 0, )))),
|
|
801
663
|
headers: _zod.z.record(_zod.z.string(), _zod.z.string()).optional().default({}),
|
|
802
664
|
// MARK: Client
|
|
803
665
|
// TODO:
|
|
@@ -837,21 +699,21 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
837
699
|
*
|
|
838
700
|
* Starts the full Rust engine process locally.
|
|
839
701
|
*/
|
|
840
|
-
startEngine: _zod.z.boolean().default(() =>
|
|
702
|
+
startEngine: _zod.z.boolean().default(() => _chunkMNHKOS6Lcjs.getRivetRunEngine.call(void 0, )),
|
|
841
703
|
/**
|
|
842
704
|
* @experimental
|
|
843
705
|
*
|
|
844
706
|
* Host to bind the spawned local engine process to.
|
|
845
707
|
*/
|
|
846
|
-
engineHost: _zod.z.string().optional().default(() => _nullishCoalesce(
|
|
708
|
+
engineHost: _zod.z.string().optional().default(() => _nullishCoalesce(_chunkMNHKOS6Lcjs.getRivetRunEngineHost.call(void 0, ), () => ( ENGINE_HOST))),
|
|
847
709
|
/**
|
|
848
710
|
* @experimental
|
|
849
711
|
*
|
|
850
712
|
* Port to bind the spawned local engine process to.
|
|
851
713
|
*/
|
|
852
|
-
enginePort: _zod.z.number().int().min(1).max(65535).optional().default(() => _nullishCoalesce(
|
|
714
|
+
enginePort: _zod.z.number().int().min(1).max(65535).optional().default(() => _nullishCoalesce(_chunkMNHKOS6Lcjs.getRivetRunEnginePort.call(void 0, ), () => ( ENGINE_PORT))),
|
|
853
715
|
/** @experimental */
|
|
854
|
-
engineVersion: _zod.z.string().optional().default(() => _nullishCoalesce(
|
|
716
|
+
engineVersion: _zod.z.string().optional().default(() => _nullishCoalesce(_chunkMNHKOS6Lcjs.getRivetRunEngineVersion.call(void 0, ), () => ( _chunkMNHKOS6Lcjs.VERSION))),
|
|
855
717
|
/**
|
|
856
718
|
* @experimental
|
|
857
719
|
*
|
|
@@ -899,7 +761,7 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
899
761
|
}))
|
|
900
762
|
}).transform((config, ctx) => {
|
|
901
763
|
var _a, _b, _c;
|
|
902
|
-
const isDevEnv =
|
|
764
|
+
const isDevEnv = _chunkMNHKOS6Lcjs.isDev.call(void 0, );
|
|
903
765
|
const sqliteBackend = _nullishCoalesce(((_a = config.sqlite) == null ? void 0 : _a.backend), () => ( ((_b = config.test) == null ? void 0 : _b.sqliteBackend)));
|
|
904
766
|
if (config.runtime === "wasm" && sqliteBackend === "local") {
|
|
905
767
|
ctx.addIssue({
|
|
@@ -909,7 +771,7 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
909
771
|
});
|
|
910
772
|
}
|
|
911
773
|
const sqlite = config.runtime === "wasm" && config.sqlite === void 0 ? { backend: "remote" } : config.sqlite;
|
|
912
|
-
const parsedEndpoint = config.endpoint ?
|
|
774
|
+
const parsedEndpoint = config.endpoint ? _chunk5IWLUJ6Wcjs.tryParseEndpoint.call(void 0, ctx, {
|
|
913
775
|
endpoint: config.endpoint,
|
|
914
776
|
path: ["endpoint"],
|
|
915
777
|
namespace: config.namespace,
|
|
@@ -937,7 +799,7 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
937
799
|
);
|
|
938
800
|
const namespace = _nullishCoalesce(_nullishCoalesce((parsedEndpoint == null ? void 0 : parsedEndpoint.namespace), () => ( config.namespace)), () => ( "default"));
|
|
939
801
|
const token = _nullishCoalesce((parsedEndpoint == null ? void 0 : parsedEndpoint.token), () => ( config.token));
|
|
940
|
-
const parsedPublicEndpoint = config.serverless.publicEndpoint ?
|
|
802
|
+
const parsedPublicEndpoint = config.serverless.publicEndpoint ? _chunk5IWLUJ6Wcjs.tryParseEndpoint.call(void 0, ctx, {
|
|
941
803
|
endpoint: config.serverless.publicEndpoint,
|
|
942
804
|
path: ["serverless", "publicEndpoint"]
|
|
943
805
|
}) : void 0;
|
|
@@ -972,7 +834,7 @@ function buildActorNames(config) {
|
|
|
972
834
|
Object.keys(config.use).map((actorName) => {
|
|
973
835
|
const definition = config.use[actorName];
|
|
974
836
|
const options = _nullishCoalesce(definition.config.options, () => ( {}));
|
|
975
|
-
const runMeta =
|
|
837
|
+
const runMeta = _chunk3MHDOUD7cjs.getRunMetadata.call(void 0, definition.config.run);
|
|
976
838
|
const metadata = {};
|
|
977
839
|
metadata.icon = _nullishCoalesce(options.icon, () => ( runMeta.icon));
|
|
978
840
|
metadata.name = _nullishCoalesce(options.name, () => ( runMeta.name));
|
|
@@ -1065,7 +927,7 @@ var DocRegistryConfigSchema = _zod.z.object({
|
|
|
1065
927
|
noWelcome: _zod.z.boolean().optional().describe("Disable the welcome message on startup. Default: false"),
|
|
1066
928
|
sqlite: DocSqliteConfigSchema,
|
|
1067
929
|
logging: _zod.z.object({
|
|
1068
|
-
level:
|
|
930
|
+
level: _chunkMNHKOS6Lcjs.LogLevelSchema.optional().describe(
|
|
1069
931
|
"Log level for RivetKit. Default: 'warn'"
|
|
1070
932
|
)
|
|
1071
933
|
}).optional().describe("Logging configuration."),
|
|
@@ -1110,7 +972,7 @@ function shouldAttachNativeKvError(message) {
|
|
|
1110
972
|
function enrichNativeDatabaseError(database, error) {
|
|
1111
973
|
var _a;
|
|
1112
974
|
const bridgeReason = typeof error === "string" ? error : error instanceof Error ? error.message : void 0;
|
|
1113
|
-
const bridged = bridgeReason === void 0 ? void 0 :
|
|
975
|
+
const bridged = bridgeReason === void 0 ? void 0 : _chunk4FC7TVS6cjs.decodeBridgeRivetError.call(void 0, bridgeReason);
|
|
1114
976
|
if (bridged) {
|
|
1115
977
|
throw bridged;
|
|
1116
978
|
}
|
|
@@ -1340,6 +1202,82 @@ function lastInsertRowIdColumnName(sql) {
|
|
|
1340
1202
|
return alias;
|
|
1341
1203
|
}
|
|
1342
1204
|
|
|
1205
|
+
// src/utils/node.ts
|
|
1206
|
+
var _module = require('module');
|
|
1207
|
+
var nodeCrypto;
|
|
1208
|
+
var nodeFsSync;
|
|
1209
|
+
var nodeFs;
|
|
1210
|
+
var nodePath;
|
|
1211
|
+
var nodeOs;
|
|
1212
|
+
var nodeChildProcess;
|
|
1213
|
+
var nodeStream;
|
|
1214
|
+
var nodeUrl;
|
|
1215
|
+
var hasImportedDependencies = false;
|
|
1216
|
+
function getRequireFn() {
|
|
1217
|
+
return _module.createRequire.call(void 0, import.meta.url);
|
|
1218
|
+
}
|
|
1219
|
+
function importNodeDependencies() {
|
|
1220
|
+
if (hasImportedDependencies) return;
|
|
1221
|
+
try {
|
|
1222
|
+
const requireFn = getRequireFn();
|
|
1223
|
+
nodeCrypto = requireFn(
|
|
1224
|
+
/* webpackIgnore: true */
|
|
1225
|
+
"node:crypto"
|
|
1226
|
+
);
|
|
1227
|
+
nodeFsSync = requireFn(
|
|
1228
|
+
/* webpackIgnore: true */
|
|
1229
|
+
"node:fs"
|
|
1230
|
+
);
|
|
1231
|
+
nodeFs = requireFn(
|
|
1232
|
+
/* webpackIgnore: true */
|
|
1233
|
+
"node:fs/promises"
|
|
1234
|
+
);
|
|
1235
|
+
nodePath = requireFn(
|
|
1236
|
+
/* webpackIgnore: true */
|
|
1237
|
+
"node:path"
|
|
1238
|
+
);
|
|
1239
|
+
nodeOs = requireFn(
|
|
1240
|
+
/* webpackIgnore: true */
|
|
1241
|
+
"node:os"
|
|
1242
|
+
);
|
|
1243
|
+
nodeChildProcess = requireFn(
|
|
1244
|
+
/* webpackIgnore: true */
|
|
1245
|
+
"node:child_process"
|
|
1246
|
+
);
|
|
1247
|
+
nodeStream = requireFn(
|
|
1248
|
+
/* webpackIgnore: true */
|
|
1249
|
+
"node:stream/promises"
|
|
1250
|
+
);
|
|
1251
|
+
nodeUrl = requireFn(
|
|
1252
|
+
/* webpackIgnore: true */
|
|
1253
|
+
"node:url"
|
|
1254
|
+
);
|
|
1255
|
+
hasImportedDependencies = true;
|
|
1256
|
+
} catch (err) {
|
|
1257
|
+
console.warn(
|
|
1258
|
+
"Node.js modules not available, file system driver will not work",
|
|
1259
|
+
err
|
|
1260
|
+
);
|
|
1261
|
+
throw err;
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
function getNodeFsSync() {
|
|
1265
|
+
if (!nodeFsSync) {
|
|
1266
|
+
throw new Error(
|
|
1267
|
+
"Node fs module not loaded. Ensure importNodeDependencies() has been called."
|
|
1268
|
+
);
|
|
1269
|
+
}
|
|
1270
|
+
return nodeFsSync;
|
|
1271
|
+
}
|
|
1272
|
+
function getNodePath() {
|
|
1273
|
+
if (!nodePath) {
|
|
1274
|
+
throw new Error(
|
|
1275
|
+
"Node path module not loaded. Ensure importNodeDependencies() has been called."
|
|
1276
|
+
);
|
|
1277
|
+
}
|
|
1278
|
+
return nodePath;
|
|
1279
|
+
}
|
|
1280
|
+
|
|
1343
1281
|
// src/registry/runtime.ts
|
|
1344
1282
|
function normalizeRuntimeSqlExecuteResult(result) {
|
|
1345
1283
|
return result;
|
|
@@ -1495,6 +1433,16 @@ var NapiCoreRuntime = (_class = class {
|
|
|
1495
1433
|
config
|
|
1496
1434
|
);
|
|
1497
1435
|
}
|
|
1436
|
+
async serveListener(registry, listener, config) {
|
|
1437
|
+
await asNativeRegistry(registry).serveListener(
|
|
1438
|
+
{
|
|
1439
|
+
port: listener.port,
|
|
1440
|
+
host: listener.host,
|
|
1441
|
+
publicDir: listener.publicDir
|
|
1442
|
+
},
|
|
1443
|
+
config
|
|
1444
|
+
);
|
|
1445
|
+
}
|
|
1498
1446
|
createActorFactory(callbacks, config) {
|
|
1499
1447
|
return asActorFactoryHandle(
|
|
1500
1448
|
new this.#bindings.NapiActorFactory(callbacks, config)
|
|
@@ -1871,7 +1819,7 @@ function validateQueueComplete(schemas, name, response) {
|
|
|
1871
1819
|
return result.data;
|
|
1872
1820
|
}
|
|
1873
1821
|
function validationError(target, issues) {
|
|
1874
|
-
return new (0,
|
|
1822
|
+
return new (0, _chunk4FC7TVS6cjs.RivetError)("actor", "validation_error", `Invalid ${target}`, {
|
|
1875
1823
|
public: true,
|
|
1876
1824
|
metadata: { issues }
|
|
1877
1825
|
});
|
|
@@ -1940,16 +1888,16 @@ function normalizeQueueMessage(message) {
|
|
|
1940
1888
|
}
|
|
1941
1889
|
function normalizeWasmBridgeError(error) {
|
|
1942
1890
|
if (typeof error === "string") {
|
|
1943
|
-
return _nullishCoalesce(
|
|
1891
|
+
return _nullishCoalesce(_chunk4FC7TVS6cjs.decodeBridgeRivetError.call(void 0, error), () => ( error));
|
|
1944
1892
|
}
|
|
1945
1893
|
if (error instanceof Error) {
|
|
1946
|
-
const bridged =
|
|
1894
|
+
const bridged = _chunk4FC7TVS6cjs.decodeBridgeRivetError.call(void 0, error.message);
|
|
1947
1895
|
if (bridged) {
|
|
1948
1896
|
return bridged;
|
|
1949
1897
|
}
|
|
1950
1898
|
}
|
|
1951
1899
|
if (typeof error === "object" && error !== null && "reason" in error && typeof error.reason === "string") {
|
|
1952
|
-
const bridged =
|
|
1900
|
+
const bridged = _chunk4FC7TVS6cjs.decodeBridgeRivetError.call(void 0, error.reason);
|
|
1953
1901
|
if (bridged) {
|
|
1954
1902
|
return bridged;
|
|
1955
1903
|
}
|
|
@@ -1971,7 +1919,7 @@ function callWasmSync(invoke) {
|
|
|
1971
1919
|
}
|
|
1972
1920
|
}
|
|
1973
1921
|
function unsupportedWasmMethod(method2) {
|
|
1974
|
-
throw new (0,
|
|
1922
|
+
throw new (0, _chunk4FC7TVS6cjs.RivetError)(
|
|
1975
1923
|
"runtime",
|
|
1976
1924
|
"unsupported",
|
|
1977
1925
|
`Unsupported wasm runtime method: ${method2}`,
|
|
@@ -2055,6 +2003,11 @@ var WasmCoreRuntime = (_class2 = class {
|
|
|
2055
2003
|
config
|
|
2056
2004
|
);
|
|
2057
2005
|
}
|
|
2006
|
+
async serveListener(_registry, _listener, _config) {
|
|
2007
|
+
throw new Error(
|
|
2008
|
+
"registry.listen() is not supported on the wasm runtime; use registry.serve() and mount the handler in your platform's HTTP server instead"
|
|
2009
|
+
);
|
|
2010
|
+
}
|
|
2058
2011
|
createActorFactory(callbacks, config) {
|
|
2059
2012
|
return callWasmSync(
|
|
2060
2013
|
() => asActorFactoryHandle2(
|
|
@@ -2451,10 +2404,6 @@ async function loadWasmRuntime(config) {
|
|
|
2451
2404
|
};
|
|
2452
2405
|
}
|
|
2453
2406
|
|
|
2454
|
-
// src/registry/native.ts
|
|
2455
|
-
var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
|
|
2456
|
-
var _path2 = require('path'); var _path3 = _interopRequireDefault(_path2);
|
|
2457
|
-
|
|
2458
2407
|
// src/registry/write-through-proxy.ts
|
|
2459
2408
|
var _onchange = require('@rivetkit/on-change'); var _onchange2 = _interopRequireDefault(_onchange);
|
|
2460
2409
|
function createWriteThroughProxy(value, commit, beforeChange) {
|
|
@@ -2511,7 +2460,7 @@ function loadedRuntimeKind(runtime) {
|
|
|
2511
2460
|
case "wasm":
|
|
2512
2461
|
return "wasm";
|
|
2513
2462
|
}
|
|
2514
|
-
throw new (0,
|
|
2463
|
+
throw new (0, _chunk4FC7TVS6cjs.RivetError)(
|
|
2515
2464
|
"config",
|
|
2516
2465
|
"unknown_runtime",
|
|
2517
2466
|
"RivetKit runtime must be NAPI or wasm.",
|
|
@@ -2551,7 +2500,7 @@ function normalizeRuntimeConfigForKind(config, runtimeKind) {
|
|
|
2551
2500
|
return config;
|
|
2552
2501
|
}
|
|
2553
2502
|
if (sqliteBackendForConfig(config) === "local") {
|
|
2554
|
-
throw new (0,
|
|
2503
|
+
throw new (0, _chunk4FC7TVS6cjs.RivetError)(
|
|
2555
2504
|
"config",
|
|
2556
2505
|
"wasm_local_sqlite",
|
|
2557
2506
|
"WebAssembly runtime cannot use local SQLite. Use remote SQLite instead.",
|
|
@@ -2617,14 +2566,14 @@ function getNativeConnPersistState(runtime, ctx, conn) {
|
|
|
2617
2566
|
return connState;
|
|
2618
2567
|
}
|
|
2619
2568
|
function stateMutationReentrantError() {
|
|
2620
|
-
return new (0,
|
|
2569
|
+
return new (0, _chunk4FC7TVS6cjs.RivetError)(
|
|
2621
2570
|
"actor",
|
|
2622
2571
|
"state_mutation_reentrant",
|
|
2623
2572
|
"State mutations are not allowed inside onStateChange."
|
|
2624
2573
|
);
|
|
2625
2574
|
}
|
|
2626
2575
|
function databaseNotConfiguredError() {
|
|
2627
|
-
return new (0,
|
|
2576
|
+
return new (0, _chunk4FC7TVS6cjs.RivetError)(
|
|
2628
2577
|
"actor",
|
|
2629
2578
|
"database_not_configured",
|
|
2630
2579
|
"database is not configured for this actor",
|
|
@@ -2632,7 +2581,7 @@ function databaseNotConfiguredError() {
|
|
|
2632
2581
|
);
|
|
2633
2582
|
}
|
|
2634
2583
|
function databaseClientNotReadyError() {
|
|
2635
|
-
return new (0,
|
|
2584
|
+
return new (0, _chunk4FC7TVS6cjs.RivetError)(
|
|
2636
2585
|
"actor",
|
|
2637
2586
|
"database_client_not_ready",
|
|
2638
2587
|
"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.",
|
|
@@ -2640,7 +2589,7 @@ function databaseClientNotReadyError() {
|
|
|
2640
2589
|
);
|
|
2641
2590
|
}
|
|
2642
2591
|
function stateNotEnabledError() {
|
|
2643
|
-
return new (0,
|
|
2592
|
+
return new (0, _chunk4FC7TVS6cjs.RivetError)(
|
|
2644
2593
|
"actor",
|
|
2645
2594
|
"state_not_enabled",
|
|
2646
2595
|
"State not enabled. Must implement `createState` or `state` to use state. (https://www.rivet.dev/docs/actors/state/#initializing-state)",
|
|
@@ -2648,7 +2597,7 @@ function stateNotEnabledError() {
|
|
|
2648
2597
|
);
|
|
2649
2598
|
}
|
|
2650
2599
|
function nativeClientNotConfiguredError() {
|
|
2651
|
-
return new (0,
|
|
2600
|
+
return new (0, _chunk4FC7TVS6cjs.RivetError)(
|
|
2652
2601
|
"native",
|
|
2653
2602
|
"client_not_configured",
|
|
2654
2603
|
"native actor client is not configured",
|
|
@@ -2656,7 +2605,7 @@ function nativeClientNotConfiguredError() {
|
|
|
2656
2605
|
);
|
|
2657
2606
|
}
|
|
2658
2607
|
function nativeEndpointNotConfiguredError() {
|
|
2659
|
-
return new (0,
|
|
2608
|
+
return new (0, _chunk4FC7TVS6cjs.RivetError)(
|
|
2660
2609
|
"native",
|
|
2661
2610
|
"endpoint_not_configured",
|
|
2662
2611
|
"registry endpoint is required for native envoy startup",
|
|
@@ -2701,7 +2650,7 @@ async function cleanupNativeSleepRuntimeState(runtime, ctx, afterTrackedWorkDrai
|
|
|
2701
2650
|
}).catch((error) => {
|
|
2702
2651
|
logger2().warn({
|
|
2703
2652
|
msg: "deferred native sleep cleanup failed",
|
|
2704
|
-
error:
|
|
2653
|
+
error: _chunkMNHKOS6Lcjs.stringifyError.call(void 0, error)
|
|
2705
2654
|
});
|
|
2706
2655
|
});
|
|
2707
2656
|
return;
|
|
@@ -2811,10 +2760,10 @@ function decodeValue(value) {
|
|
|
2811
2760
|
if (!value || value.length === 0) {
|
|
2812
2761
|
return void 0;
|
|
2813
2762
|
}
|
|
2814
|
-
return
|
|
2763
|
+
return _chunkV5KMAMX3cjs.decodeCborCompat.call(void 0, value);
|
|
2815
2764
|
}
|
|
2816
2765
|
function encodeValue(value) {
|
|
2817
|
-
return
|
|
2766
|
+
return _chunkV5KMAMX3cjs.encodeCborCompat.call(void 0, value);
|
|
2818
2767
|
}
|
|
2819
2768
|
function normalizeArgs(value) {
|
|
2820
2769
|
return Array.isArray(value) ? value : value === void 0 || value === null ? [] : [value];
|
|
@@ -2827,16 +2776,16 @@ function unwrapTsfnPayload(error, payload) {
|
|
|
2827
2776
|
}
|
|
2828
2777
|
function normalizeNativeBridgeError(error) {
|
|
2829
2778
|
if (typeof error === "string") {
|
|
2830
|
-
return _nullishCoalesce(
|
|
2779
|
+
return _nullishCoalesce(_chunk4FC7TVS6cjs.decodeBridgeRivetError.call(void 0, error), () => ( error));
|
|
2831
2780
|
}
|
|
2832
2781
|
if (error instanceof Error) {
|
|
2833
|
-
const bridged =
|
|
2782
|
+
const bridged = _chunk4FC7TVS6cjs.decodeBridgeRivetError.call(void 0, error.message);
|
|
2834
2783
|
if (bridged) {
|
|
2835
2784
|
return bridged;
|
|
2836
2785
|
}
|
|
2837
2786
|
}
|
|
2838
2787
|
if (typeof error === "object" && error !== null && "reason" in error && typeof error.reason === "string") {
|
|
2839
|
-
const bridged =
|
|
2788
|
+
const bridged = _chunk4FC7TVS6cjs.decodeBridgeRivetError.call(void 0, error.reason);
|
|
2840
2789
|
if (bridged) {
|
|
2841
2790
|
return bridged;
|
|
2842
2791
|
}
|
|
@@ -2844,14 +2793,14 @@ function normalizeNativeBridgeError(error) {
|
|
|
2844
2793
|
return error;
|
|
2845
2794
|
}
|
|
2846
2795
|
function isStructuredBridgeError(error) {
|
|
2847
|
-
if (error instanceof
|
|
2796
|
+
if (error instanceof _chunk4FC7TVS6cjs.RivetError) {
|
|
2848
2797
|
return true;
|
|
2849
2798
|
}
|
|
2850
|
-
return
|
|
2799
|
+
return _chunk4FC7TVS6cjs.isRivetErrorLike.call(void 0, error) && "__type" in error && (error.__type === "RivetError" || error.__type === "ActorError");
|
|
2851
2800
|
}
|
|
2852
2801
|
function encodeNativeCallbackError(error) {
|
|
2853
|
-
const structuredError = isStructuredBridgeError(error) ? error :
|
|
2854
|
-
const bridgeError = new Error(
|
|
2802
|
+
const structuredError = isStructuredBridgeError(error) ? error : _chunkMNHKOS6Lcjs.deconstructError.call(void 0, error, true);
|
|
2803
|
+
const bridgeError = new Error(_chunk4FC7TVS6cjs.encodeBridgeRivetError.call(void 0, structuredError), {
|
|
2855
2804
|
cause: error instanceof Error ? error : void 0
|
|
2856
2805
|
});
|
|
2857
2806
|
return Object.assign(bridgeError, {
|
|
@@ -2875,9 +2824,9 @@ function callNativeSync(invoke) {
|
|
|
2875
2824
|
}
|
|
2876
2825
|
}
|
|
2877
2826
|
function isClosedTaskRegistrationError(error) {
|
|
2878
|
-
const metadata = error instanceof
|
|
2827
|
+
const metadata = error instanceof _chunk4FC7TVS6cjs.RivetError ? error.metadata : void 0;
|
|
2879
2828
|
const metadataError = metadata && typeof metadata === "object" && "error" in metadata ? metadata.error : void 0;
|
|
2880
|
-
return error instanceof
|
|
2829
|
+
return error instanceof _chunk4FC7TVS6cjs.RivetError && error.group === "core" && error.code === _chunk4FC7TVS6cjs.INTERNAL_ERROR_CODE && typeof metadataError === "string" && /actor task registration is (closed|not configured)/.test(metadataError);
|
|
2881
2830
|
}
|
|
2882
2831
|
async function createCancellationTokenHandle(runtime, signal) {
|
|
2883
2832
|
if (!signal) {
|
|
@@ -2900,7 +2849,7 @@ function decodeWorkflowCbor(data) {
|
|
|
2900
2849
|
return null;
|
|
2901
2850
|
}
|
|
2902
2851
|
try {
|
|
2903
|
-
return
|
|
2852
|
+
return _chunkV5KMAMX3cjs.decodeCborCompat.call(void 0, new Uint8Array(data));
|
|
2904
2853
|
} catch (e4) {
|
|
2905
2854
|
return null;
|
|
2906
2855
|
}
|
|
@@ -3005,7 +2954,7 @@ function serializeWorkflowHistoryForJson(data) {
|
|
|
3005
2954
|
if (data === null) {
|
|
3006
2955
|
return null;
|
|
3007
2956
|
}
|
|
3008
|
-
const history =
|
|
2957
|
+
const history = _chunk4UUEB43Ycjs.decodeWorkflowHistoryTransport.call(void 0, data);
|
|
3009
2958
|
return jsonSafe({
|
|
3010
2959
|
nameRegistry: [...history.nameRegistry],
|
|
3011
2960
|
entries: history.entries.map((entry) => ({
|
|
@@ -3118,7 +3067,7 @@ var NativeConnAdapter = class {
|
|
|
3118
3067
|
this.#schemas = schemas;
|
|
3119
3068
|
this.#ctx = ctx;
|
|
3120
3069
|
this.#queueHibernationRemoval = queueHibernationRemoval;
|
|
3121
|
-
this[
|
|
3070
|
+
this[_chunk3MHDOUD7cjs.CONN_STATE_MANAGER_SYMBOL] = {
|
|
3122
3071
|
stateEnabled: true,
|
|
3123
3072
|
get state() {
|
|
3124
3073
|
return thisConn.state;
|
|
@@ -3135,7 +3084,7 @@ var NativeConnAdapter = class {
|
|
|
3135
3084
|
decodeValue(this.#runtime.connParams(this.#conn))
|
|
3136
3085
|
);
|
|
3137
3086
|
}
|
|
3138
|
-
[
|
|
3087
|
+
[_chunk3MHDOUD7cjs.RAW_STATE_SYMBOL]() {
|
|
3139
3088
|
return this.#readState();
|
|
3140
3089
|
}
|
|
3141
3090
|
get state() {
|
|
@@ -3146,12 +3095,12 @@ var NativeConnAdapter = class {
|
|
|
3146
3095
|
this.#writeState(nextValue, { writeNative: true });
|
|
3147
3096
|
},
|
|
3148
3097
|
(newValue) => {
|
|
3149
|
-
|
|
3098
|
+
_chunkV5KMAMX3cjs.assertJsonCompatValue.call(void 0, newValue);
|
|
3150
3099
|
}
|
|
3151
3100
|
);
|
|
3152
3101
|
}
|
|
3153
3102
|
set state(value) {
|
|
3154
|
-
|
|
3103
|
+
_chunkV5KMAMX3cjs.assertJsonCompatValue.call(void 0, value);
|
|
3155
3104
|
this.#writeState(value, { writeNative: true });
|
|
3156
3105
|
}
|
|
3157
3106
|
initializeState(value) {
|
|
@@ -3441,7 +3390,7 @@ var NativeQueueAdapter = class {
|
|
|
3441
3390
|
async nextBatch(options) {
|
|
3442
3391
|
const completable = (options == null ? void 0 : options.completable) === true;
|
|
3443
3392
|
if (this.#pendingCompletableMessageIds.size > 0) {
|
|
3444
|
-
throw new (0,
|
|
3393
|
+
throw new (0, _chunk4FC7TVS6cjs.RivetError)(
|
|
3445
3394
|
"queue",
|
|
3446
3395
|
"previous_message_not_completed",
|
|
3447
3396
|
"Previous completable queue message is not completed. Call `message.complete(...)` before receiving the next message.",
|
|
@@ -3589,7 +3538,7 @@ var NativeQueueAdapter = class {
|
|
|
3589
3538
|
}
|
|
3590
3539
|
yield message;
|
|
3591
3540
|
} catch (error) {
|
|
3592
|
-
if (
|
|
3541
|
+
if (_chunk4FC7TVS6cjs.isActorAbortedError.call(void 0, error)) {
|
|
3593
3542
|
return;
|
|
3594
3543
|
}
|
|
3595
3544
|
throw error;
|
|
@@ -3610,7 +3559,7 @@ var NativeQueueAdapter = class {
|
|
|
3610
3559
|
...message,
|
|
3611
3560
|
complete: async (response) => {
|
|
3612
3561
|
if (typeof message.complete !== "function") {
|
|
3613
|
-
throw new (0,
|
|
3562
|
+
throw new (0, _chunk4FC7TVS6cjs.RivetError)(
|
|
3614
3563
|
"queue",
|
|
3615
3564
|
"complete_not_configured",
|
|
3616
3565
|
`Queue '${message.name}' does not support completion responses.`,
|
|
@@ -3622,7 +3571,7 @@ var NativeQueueAdapter = class {
|
|
|
3622
3571
|
);
|
|
3623
3572
|
}
|
|
3624
3573
|
if (completed) {
|
|
3625
|
-
throw new (0,
|
|
3574
|
+
throw new (0, _chunk4FC7TVS6cjs.RivetError)(
|
|
3626
3575
|
"queue",
|
|
3627
3576
|
"already_completed",
|
|
3628
3577
|
"Queue message was already completed.",
|
|
@@ -4049,7 +3998,7 @@ var ActorContextHandleAdapter = class {
|
|
|
4049
3998
|
this.#databaseProvider = databaseProvider;
|
|
4050
3999
|
}
|
|
4051
4000
|
this.#request = request;
|
|
4052
|
-
this[
|
|
4001
|
+
this[_chunk3MHDOUD7cjs.ACTOR_CONTEXT_INTERNAL_SYMBOL] = new NativeWorkflowRuntimeAdapter(
|
|
4053
4002
|
this
|
|
4054
4003
|
);
|
|
4055
4004
|
}
|
|
@@ -4080,7 +4029,7 @@ var ActorContextHandleAdapter = class {
|
|
|
4080
4029
|
}
|
|
4081
4030
|
throw databaseClientNotReadyError();
|
|
4082
4031
|
}
|
|
4083
|
-
[
|
|
4032
|
+
[_chunk3MHDOUD7cjs.RAW_STATE_SYMBOL]() {
|
|
4084
4033
|
if (!this.#stateEnabled) {
|
|
4085
4034
|
throw stateNotEnabledError();
|
|
4086
4035
|
}
|
|
@@ -4101,7 +4050,7 @@ var ActorContextHandleAdapter = class {
|
|
|
4101
4050
|
},
|
|
4102
4051
|
(newValue) => {
|
|
4103
4052
|
this.#assertCanMutateState();
|
|
4104
|
-
|
|
4053
|
+
_chunkV5KMAMX3cjs.assertJsonCompatValue.call(void 0, newValue);
|
|
4105
4054
|
}
|
|
4106
4055
|
);
|
|
4107
4056
|
}
|
|
@@ -4112,7 +4061,7 @@ var ActorContextHandleAdapter = class {
|
|
|
4112
4061
|
throw stateNotEnabledError();
|
|
4113
4062
|
}
|
|
4114
4063
|
this.#assertCanMutateState();
|
|
4115
|
-
|
|
4064
|
+
_chunkV5KMAMX3cjs.assertJsonCompatValue.call(void 0, value);
|
|
4116
4065
|
this.#writeState(value, { scheduleSave: true });
|
|
4117
4066
|
}
|
|
4118
4067
|
initializeState(value) {
|
|
@@ -4377,7 +4326,7 @@ var ActorContextHandleAdapter = class {
|
|
|
4377
4326
|
const trackedPromise = Promise.resolve(promise).catch((error) => {
|
|
4378
4327
|
logger2().warn({
|
|
4379
4328
|
msg: "keepAwake promise rejected",
|
|
4380
|
-
error:
|
|
4329
|
+
error: _chunkMNHKOS6Lcjs.stringifyError.call(void 0, error)
|
|
4381
4330
|
});
|
|
4382
4331
|
}).then(() => null);
|
|
4383
4332
|
try {
|
|
@@ -4397,7 +4346,10 @@ var ActorContextHandleAdapter = class {
|
|
|
4397
4346
|
}
|
|
4398
4347
|
internalKeepAwake(run) {
|
|
4399
4348
|
const promise = typeof run === "function" ? run() : run;
|
|
4400
|
-
const trackedPromise = promise.then(
|
|
4349
|
+
const trackedPromise = promise.then(
|
|
4350
|
+
() => null,
|
|
4351
|
+
() => null
|
|
4352
|
+
);
|
|
4401
4353
|
try {
|
|
4402
4354
|
callNativeSync(
|
|
4403
4355
|
() => this.#runtime.actorRegisterTask(this.#ctx, trackedPromise)
|
|
@@ -4714,7 +4666,7 @@ function withConnContext(runtime, ctx, conn, clientFactory, schemas = {}, databa
|
|
|
4714
4666
|
}
|
|
4715
4667
|
);
|
|
4716
4668
|
}
|
|
4717
|
-
function buildActorConfig(definition, registryConfig) {
|
|
4669
|
+
function buildActorConfig(definition, registryConfig, runtimeKind) {
|
|
4718
4670
|
const config = definition.config;
|
|
4719
4671
|
const options = _nullishCoalesce(config.options, () => ( {}));
|
|
4720
4672
|
const canHibernate = options.canHibernateWebSocket;
|
|
@@ -4744,10 +4696,10 @@ function buildActorConfig(definition, registryConfig) {
|
|
|
4744
4696
|
preloadMaxWorkflowBytes: options.preloadMaxWorkflowBytes,
|
|
4745
4697
|
preloadMaxConnectionsBytes: options.preloadMaxConnectionsBytes,
|
|
4746
4698
|
actions: Object.keys(_nullishCoalesce(config.actions, () => ( {}))).sort().map((name) => ({ name })),
|
|
4747
|
-
inspectorTabs: buildInspectorTabs(config.inspector)
|
|
4699
|
+
inspectorTabs: buildInspectorTabs(config.inspector, runtimeKind)
|
|
4748
4700
|
};
|
|
4749
4701
|
}
|
|
4750
|
-
function buildInspectorTabs(inspector) {
|
|
4702
|
+
function buildInspectorTabs(inspector, runtimeKind) {
|
|
4751
4703
|
if (!inspector || typeof inspector !== "object") return void 0;
|
|
4752
4704
|
const tabs = inspector.tabs;
|
|
4753
4705
|
if (!Array.isArray(tabs) || tabs.length === 0) return void 0;
|
|
@@ -4756,7 +4708,24 @@ function buildInspectorTabs(inspector) {
|
|
|
4756
4708
|
if (entry.hidden === true) {
|
|
4757
4709
|
return { id: entry.id, hidden: true };
|
|
4758
4710
|
}
|
|
4759
|
-
|
|
4711
|
+
if (runtimeKind === "wasm") {
|
|
4712
|
+
if (entry.source !== void 0) {
|
|
4713
|
+
logger2().warn(
|
|
4714
|
+
{
|
|
4715
|
+
tabId: entry.id,
|
|
4716
|
+
runtimeKind
|
|
4717
|
+
},
|
|
4718
|
+
"inspector.tabs[].source is not supported on wasm runners (current host: wasm). Tab descriptors will still appear in the dashboard strip but the tab body will render a not-available placeholder."
|
|
4719
|
+
);
|
|
4720
|
+
}
|
|
4721
|
+
return {
|
|
4722
|
+
id: entry.id,
|
|
4723
|
+
label: entry.label,
|
|
4724
|
+
icon: entry.icon,
|
|
4725
|
+
source: void 0
|
|
4726
|
+
};
|
|
4727
|
+
}
|
|
4728
|
+
const resolved = entry.source !== void 0 ? getNodePath().resolve(entry.source) : void 0;
|
|
4760
4729
|
if (resolved !== void 0) {
|
|
4761
4730
|
validateInspectorTabSource(entry.id, resolved);
|
|
4762
4731
|
}
|
|
@@ -4769,14 +4738,14 @@ function buildInspectorTabs(inspector) {
|
|
|
4769
4738
|
});
|
|
4770
4739
|
}
|
|
4771
4740
|
function validateInspectorTabSource(tabId, resolved) {
|
|
4772
|
-
if (resolved ===
|
|
4741
|
+
if (resolved === getNodePath().parse(resolved).root) {
|
|
4773
4742
|
throw new Error(
|
|
4774
4743
|
`inspector.tabs[id="${tabId}"].source resolves to the filesystem root (${resolved}). Point it at the tab's own static-asset directory instead.`
|
|
4775
4744
|
);
|
|
4776
4745
|
}
|
|
4777
4746
|
let stat;
|
|
4778
4747
|
try {
|
|
4779
|
-
stat =
|
|
4748
|
+
stat = getNodeFsSync().statSync(resolved);
|
|
4780
4749
|
} catch (err) {
|
|
4781
4750
|
const code = err == null ? void 0 : err.code;
|
|
4782
4751
|
if (code === "ENOENT") {
|
|
@@ -4812,9 +4781,9 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
4812
4781
|
const actionHandlers = Object.fromEntries(
|
|
4813
4782
|
Object.entries(_nullishCoalesce(config.actions, () => ( {}))).map(([name, handler]) => [name, handler])
|
|
4814
4783
|
);
|
|
4815
|
-
const createClient = () =>
|
|
4816
|
-
new (0,
|
|
4817
|
-
|
|
4784
|
+
const createClient = () => _chunk5IWLUJ6Wcjs.createClientWithDriver.call(void 0,
|
|
4785
|
+
new (0, _chunk5IWLUJ6Wcjs.RemoteEngineControlClient)(
|
|
4786
|
+
_chunk5IWLUJ6Wcjs.convertRegistryConfigToClientConfig.call(void 0, registryConfig)
|
|
4818
4787
|
),
|
|
4819
4788
|
{ encoding: "bare" }
|
|
4820
4789
|
);
|
|
@@ -4824,7 +4793,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
4824
4793
|
), () => ( false));
|
|
4825
4794
|
const getNativeWorkflowInspector = (ctx) => {
|
|
4826
4795
|
var _a2;
|
|
4827
|
-
return (_a2 =
|
|
4796
|
+
return (_a2 = _chunk3MHDOUD7cjs.getRunInspectorConfig.call(void 0,
|
|
4828
4797
|
config.run,
|
|
4829
4798
|
callNativeSync(() => runtime.actorId(ctx))
|
|
4830
4799
|
)) == null ? void 0 : _a2.workflow;
|
|
@@ -4877,7 +4846,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
4877
4846
|
}
|
|
4878
4847
|
});
|
|
4879
4848
|
const errorResponse = (error, status) => {
|
|
4880
|
-
const rivetError =
|
|
4849
|
+
const rivetError = _chunk4FC7TVS6cjs.toRivetError.call(void 0, error);
|
|
4881
4850
|
return jsonResponse(
|
|
4882
4851
|
{
|
|
4883
4852
|
group: rivetError.group,
|
|
@@ -4890,13 +4859,16 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
4890
4859
|
}
|
|
4891
4860
|
);
|
|
4892
4861
|
};
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4862
|
+
const isPublicPerActorPath = jsRequest.method === "GET" && (url.pathname === "/inspector/tab-config" || url.pathname.startsWith("/inspector/custom-tabs/"));
|
|
4863
|
+
if (!isPublicPerActorPath) {
|
|
4864
|
+
try {
|
|
4865
|
+
await runtime.actorVerifyInspectorAuth(
|
|
4866
|
+
ctx,
|
|
4867
|
+
_nullishCoalesce(((_a2 = jsRequest.headers.get("authorization")) == null ? void 0 : _a2.replace(/^Bearer\s+/i, "")), () => ( null))
|
|
4868
|
+
);
|
|
4869
|
+
} catch (error) {
|
|
4870
|
+
return errorResponse(error, 401);
|
|
4871
|
+
}
|
|
4900
4872
|
}
|
|
4901
4873
|
const workflowHistory = () => {
|
|
4902
4874
|
var _a3;
|
|
@@ -5122,7 +5094,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
5122
5094
|
const action = actionHandlers[actionName];
|
|
5123
5095
|
if (!action) {
|
|
5124
5096
|
return errorResponse(
|
|
5125
|
-
new (0,
|
|
5097
|
+
new (0, _chunk4FC7TVS6cjs.RivetError)(
|
|
5126
5098
|
"action",
|
|
5127
5099
|
"action_not_found",
|
|
5128
5100
|
`Action ${actionName} not found`
|
|
@@ -5337,6 +5309,9 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
5337
5309
|
await config.onDestroy(actorCtx);
|
|
5338
5310
|
}
|
|
5339
5311
|
} finally {
|
|
5312
|
+
const actorId = callNativeSync(() => runtime.actorId(ctx));
|
|
5313
|
+
nativeRunHandlerActiveByActorId.delete(actorId);
|
|
5314
|
+
_chunk3MHDOUD7cjs.disposeRunInspector.call(void 0, config.run, actorId);
|
|
5340
5315
|
resolveNativeDestroy(runtime, ctx);
|
|
5341
5316
|
await actorCtx.closeDatabase();
|
|
5342
5317
|
clearNativeRuntimeState(runtime, ctx);
|
|
@@ -5486,7 +5461,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
5486
5461
|
);
|
|
5487
5462
|
}
|
|
5488
5463
|
if (!result) {
|
|
5489
|
-
throw
|
|
5464
|
+
throw _chunk4FC7TVS6cjs.forbiddenError.call(void 0, );
|
|
5490
5465
|
}
|
|
5491
5466
|
} finally {
|
|
5492
5467
|
await actorCtx.dispose();
|
|
@@ -5532,7 +5507,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
5532
5507
|
new Response(null, { status: 404 })
|
|
5533
5508
|
);
|
|
5534
5509
|
}
|
|
5535
|
-
const rawConnParams = jsRequest.headers.get(
|
|
5510
|
+
const rawConnParams = jsRequest.headers.get(_chunk5IWLUJ6Wcjs.HEADER_CONN_PARAMS);
|
|
5536
5511
|
let requestCtx;
|
|
5537
5512
|
let conn;
|
|
5538
5513
|
try {
|
|
@@ -5597,7 +5572,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
5597
5572
|
}
|
|
5598
5573
|
) : void 0,
|
|
5599
5574
|
run: (() => {
|
|
5600
|
-
const run =
|
|
5575
|
+
const run = _chunk3MHDOUD7cjs.getRunFunction.call(void 0, config.run);
|
|
5601
5576
|
if (!run) {
|
|
5602
5577
|
return void 0;
|
|
5603
5578
|
}
|
|
@@ -5610,13 +5585,13 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
5610
5585
|
try {
|
|
5611
5586
|
await run(actorCtx);
|
|
5612
5587
|
} finally {
|
|
5613
|
-
nativeRunHandlerActiveByActorId.
|
|
5588
|
+
nativeRunHandlerActiveByActorId.delete(actorId);
|
|
5614
5589
|
await actorCtx.dispose();
|
|
5615
5590
|
}
|
|
5616
5591
|
}
|
|
5617
5592
|
);
|
|
5618
5593
|
})(),
|
|
5619
|
-
getWorkflowHistory:
|
|
5594
|
+
getWorkflowHistory: _chunk3MHDOUD7cjs.getRunInspectorConfig.call(void 0, config.run) !== void 0 ? wrapNativeCallback(
|
|
5620
5595
|
async (error, payload) => {
|
|
5621
5596
|
var _a2;
|
|
5622
5597
|
const { ctx } = unwrapTsfnPayload(error, payload);
|
|
@@ -5624,7 +5599,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
5624
5599
|
return history == null ? void 0 : encodeValue(history);
|
|
5625
5600
|
}
|
|
5626
5601
|
) : void 0,
|
|
5627
|
-
replayWorkflow:
|
|
5602
|
+
replayWorkflow: _chunk3MHDOUD7cjs.getRunInspectorConfig.call(void 0, config.run) !== void 0 ? wrapNativeCallback(
|
|
5628
5603
|
async (error, payload) => {
|
|
5629
5604
|
const { ctx, entryId } = unwrapTsfnPayload(
|
|
5630
5605
|
error,
|
|
@@ -5699,7 +5674,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
5699
5674
|
name
|
|
5700
5675
|
);
|
|
5701
5676
|
if (canPublish && !await canPublish(actorCtx)) {
|
|
5702
|
-
throw
|
|
5677
|
+
throw _chunk4FC7TVS6cjs.forbiddenError.call(void 0, );
|
|
5703
5678
|
}
|
|
5704
5679
|
const decodedBody = decodeValue(body);
|
|
5705
5680
|
if (wait) {
|
|
@@ -5743,7 +5718,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
5743
5718
|
};
|
|
5744
5719
|
return runtime.createActorFactory(
|
|
5745
5720
|
callbacks,
|
|
5746
|
-
buildActorConfig(definition, registryConfig)
|
|
5721
|
+
buildActorConfig(definition, registryConfig, runtime.kind)
|
|
5747
5722
|
);
|
|
5748
5723
|
}
|
|
5749
5724
|
async function buildServeConfig(config) {
|
|
@@ -5759,7 +5734,7 @@ async function buildServeConfig(config) {
|
|
|
5759
5734
|
poolName: config.envoy.poolName,
|
|
5760
5735
|
handleInspectorHttpInRuntime: true,
|
|
5761
5736
|
serverlessBasePath: config.serverless.basePath,
|
|
5762
|
-
serverlessPackageVersion:
|
|
5737
|
+
serverlessPackageVersion: _chunkMNHKOS6Lcjs.VERSION,
|
|
5763
5738
|
serverlessClientEndpoint: config.publicEndpoint,
|
|
5764
5739
|
serverlessClientNamespace: config.publicNamespace,
|
|
5765
5740
|
serverlessClientToken: config.publicToken,
|
|
@@ -5772,21 +5747,24 @@ async function buildServeConfig(config) {
|
|
|
5772
5747
|
} catch (error) {
|
|
5773
5748
|
logger2().warn({
|
|
5774
5749
|
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",
|
|
5775
|
-
error:
|
|
5750
|
+
error: _chunkMNHKOS6Lcjs.stringifyError.call(void 0, error)
|
|
5776
5751
|
});
|
|
5777
5752
|
}
|
|
5778
5753
|
serveConfig.engineHost = config.engineHost;
|
|
5779
5754
|
serveConfig.enginePort = config.enginePort;
|
|
5780
5755
|
if ((_a = config.test) == null ? void 0 : _a.enabled) {
|
|
5781
|
-
serveConfig.inspectorTestToken = _nullishCoalesce(
|
|
5756
|
+
serveConfig.inspectorTestToken = _nullishCoalesce(_chunkMNHKOS6Lcjs.getEnvUniversal.call(void 0, "_RIVET_TEST_INSPECTOR_TOKEN"), () => ( "token"));
|
|
5782
5757
|
}
|
|
5783
5758
|
return serveConfig;
|
|
5784
5759
|
}
|
|
5785
5760
|
async function buildRegistryWithRuntime(config, runtime) {
|
|
5786
5761
|
var _a;
|
|
5787
|
-
if (((_a = config.test) == null ? void 0 : _a.enabled) &&
|
|
5762
|
+
if (((_a = config.test) == null ? void 0 : _a.enabled) && _chunkMNHKOS6Lcjs.getEnvUniversal.call(void 0, "_RIVET_TEST_INSPECTOR_TOKEN") === void 0) {
|
|
5788
5763
|
trySetProcessEnv("_RIVET_TEST_INSPECTOR_TOKEN", "token");
|
|
5789
5764
|
}
|
|
5765
|
+
if (runtime.kind === "napi") {
|
|
5766
|
+
importNodeDependencies();
|
|
5767
|
+
}
|
|
5790
5768
|
const registry = runtime.createRegistry();
|
|
5791
5769
|
for (const [name, definition] of Object.entries(config.use)) {
|
|
5792
5770
|
runtime.registerActor(
|
|
@@ -5851,6 +5829,12 @@ var Registry = class {
|
|
|
5851
5829
|
prometheusMetrics: (request) => this.#prometheusMetricsRoute(request)
|
|
5852
5830
|
};
|
|
5853
5831
|
}
|
|
5832
|
+
/**
|
|
5833
|
+
* Fires `configureServerlessPool` once per process when the registry
|
|
5834
|
+
* config opts into it. Cached on the instance so repeated calls (from
|
|
5835
|
+
* `handler()` and `listen()`) only run the upsert once. The retry loop
|
|
5836
|
+
* inside `configureServerlessPool` tolerates the engine still warming up.
|
|
5837
|
+
*/
|
|
5854
5838
|
#ensureServerlessPoolConfigured(config) {
|
|
5855
5839
|
if (!config.configurePool) return void 0;
|
|
5856
5840
|
if (!this.#configureServerlessPoolPromise) {
|
|
@@ -6043,13 +6027,15 @@ var Registry = class {
|
|
|
6043
6027
|
};
|
|
6044
6028
|
}
|
|
6045
6029
|
/**
|
|
6046
|
-
*
|
|
6047
|
-
* serverless
|
|
6048
|
-
*
|
|
6030
|
+
* Bind an HTTP listener provided by the native (Rust) runtime and serve
|
|
6031
|
+
* the registry's serverless endpoints over it. Resolves only after the
|
|
6032
|
+
* registry is shut down (SIGINT/SIGTERM or `nativeRegistry.shutdown()`).
|
|
6049
6033
|
*
|
|
6050
|
-
* @param opts.port Port to listen on. Defaults to
|
|
6034
|
+
* @param opts.port Port to listen on. Defaults to `process.env.RIVET_PORT`
|
|
6035
|
+
* if set, otherwise 3000.
|
|
6036
|
+
* @param opts.host Address to bind. Defaults to `0.0.0.0`.
|
|
6051
6037
|
* @param opts.publicDir If set, serves static files from this directory
|
|
6052
|
-
*
|
|
6038
|
+
* as a fallback below the framework routes.
|
|
6053
6039
|
*
|
|
6054
6040
|
* @example
|
|
6055
6041
|
* ```ts
|
|
@@ -6058,16 +6044,25 @@ var Registry = class {
|
|
|
6058
6044
|
* ```
|
|
6059
6045
|
*/
|
|
6060
6046
|
async listen(opts = {}) {
|
|
6061
|
-
const port = _nullishCoalesce(opts.port, () => ( 3e3));
|
|
6047
|
+
const port = _nullishCoalesce(_nullishCoalesce(opts.port, () => ( _chunkMNHKOS6Lcjs.parsePortEnv.call(void 0, process.env.RIVET_PORT))), () => ( 3e3));
|
|
6048
|
+
const publicDir = _nullishCoalesce(opts.publicDir, () => ( _chunkMNHKOS6Lcjs.getRivetkitPublicDir.call(void 0, )));
|
|
6062
6049
|
const config = this.parseConfig();
|
|
6063
|
-
const
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
|
|
6068
|
-
|
|
6069
|
-
|
|
6070
|
-
|
|
6050
|
+
const configuredRegistryPromise = buildConfiguredRegistry(config);
|
|
6051
|
+
this.#runtimeServeConfiguredPromise = configuredRegistryPromise;
|
|
6052
|
+
this.#runtimeServerlessPromise = configuredRegistryPromise;
|
|
6053
|
+
this.#installSignalHandlers(config);
|
|
6054
|
+
this.#printWelcome(config, "serverless", {
|
|
6055
|
+
port,
|
|
6056
|
+
host: opts.host,
|
|
6057
|
+
publicDir
|
|
6058
|
+
});
|
|
6059
|
+
this.#ensureServerlessPoolConfigured(config);
|
|
6060
|
+
const { runtime, registry, serveConfig } = await configuredRegistryPromise;
|
|
6061
|
+
await runtime.serveListener(
|
|
6062
|
+
registry,
|
|
6063
|
+
{ port, host: opts.host, publicDir },
|
|
6064
|
+
serveConfig
|
|
6065
|
+
);
|
|
6071
6066
|
}
|
|
6072
6067
|
/**
|
|
6073
6068
|
* Returns a health response suitable for mounting in a user-owned router.
|
|
@@ -6078,7 +6073,7 @@ var Registry = class {
|
|
|
6078
6073
|
return jsonRouteResponse(503, {
|
|
6079
6074
|
status: "not_started",
|
|
6080
6075
|
runtime: "rivetkit",
|
|
6081
|
-
version:
|
|
6076
|
+
version: _chunkMNHKOS6Lcjs.VERSION
|
|
6082
6077
|
});
|
|
6083
6078
|
}
|
|
6084
6079
|
const { runtime, registry } = configured;
|
|
@@ -6086,7 +6081,7 @@ var Registry = class {
|
|
|
6086
6081
|
return jsonRouteResponse(501, {
|
|
6087
6082
|
status: "unsupported",
|
|
6088
6083
|
runtime: "rivetkit",
|
|
6089
|
-
version:
|
|
6084
|
+
version: _chunkMNHKOS6Lcjs.VERSION
|
|
6090
6085
|
});
|
|
6091
6086
|
}
|
|
6092
6087
|
const response = await runtime.registryHealth(registry);
|
|
@@ -6313,6 +6308,10 @@ var Registry = class {
|
|
|
6313
6308
|
/**
|
|
6314
6309
|
* Starts the actor envoy for standalone server deployments.
|
|
6315
6310
|
*
|
|
6311
|
+
* Set `RIVETKIT_RUNTIME_MODE=serverless` to instead bind an HTTP listener
|
|
6312
|
+
* via `listen()` (Mode B). Mode A (envoy) and Mode B (listener) are
|
|
6313
|
+
* mutually exclusive per registry instance.
|
|
6314
|
+
*
|
|
6316
6315
|
* @example
|
|
6317
6316
|
* ```ts
|
|
6318
6317
|
* const registry = setup({ use: { counter } });
|
|
@@ -6320,10 +6319,20 @@ var Registry = class {
|
|
|
6320
6319
|
* ```
|
|
6321
6320
|
*/
|
|
6322
6321
|
start() {
|
|
6322
|
+
if (_chunkMNHKOS6Lcjs.getRivetkitRuntimeMode.call(void 0, ) === "serverless") {
|
|
6323
|
+
const publicDir = _nullishCoalesce(_chunkMNHKOS6Lcjs.getRivetkitPublicDir.call(void 0, ), () => ( "/public"));
|
|
6324
|
+
this.listen({ publicDir }).catch((error) => {
|
|
6325
|
+
logger2().error({ error }, "auto-listen failed; exiting");
|
|
6326
|
+
if (typeof process !== "undefined" && typeof process.exit === "function") {
|
|
6327
|
+
process.exit(1);
|
|
6328
|
+
}
|
|
6329
|
+
});
|
|
6330
|
+
return;
|
|
6331
|
+
}
|
|
6323
6332
|
const config = this.parseConfig();
|
|
6324
6333
|
this.#startEnvoy(config, true);
|
|
6325
6334
|
}
|
|
6326
|
-
#printWelcome(config, kind) {
|
|
6335
|
+
#printWelcome(config, kind, listener) {
|
|
6327
6336
|
if (config.noWelcome || this.#welcomePrinted) return;
|
|
6328
6337
|
this.#welcomePrinted = true;
|
|
6329
6338
|
const logLine = (label, value) => {
|
|
@@ -6332,7 +6341,7 @@ var Registry = class {
|
|
|
6332
6341
|
};
|
|
6333
6342
|
console.log();
|
|
6334
6343
|
console.log(
|
|
6335
|
-
` RivetKit ${
|
|
6344
|
+
` RivetKit ${_chunkMNHKOS6Lcjs.VERSION} (Engine - ${kind === "serverless" ? "Serverless" : "Serverful"})`
|
|
6336
6345
|
);
|
|
6337
6346
|
if (config.namespace !== "default") {
|
|
6338
6347
|
logLine("Namespace", config.namespace);
|
|
@@ -6345,6 +6354,13 @@ var Registry = class {
|
|
|
6345
6354
|
logLine("Client", config.publicEndpoint);
|
|
6346
6355
|
}
|
|
6347
6356
|
logLine("Actors", Object.keys(config.use).length.toString());
|
|
6357
|
+
if (listener) {
|
|
6358
|
+
const host = _nullishCoalesce(listener.host, () => ( "0.0.0.0"));
|
|
6359
|
+
logLine("Listening", `http://${host}:${listener.port}`);
|
|
6360
|
+
if (listener.publicDir) {
|
|
6361
|
+
logLine("Public Dir", listener.publicDir);
|
|
6362
|
+
}
|
|
6363
|
+
}
|
|
6348
6364
|
console.log();
|
|
6349
6365
|
}
|
|
6350
6366
|
};
|
|
@@ -6400,5 +6416,5 @@ function setup(input) {
|
|
|
6400
6416
|
|
|
6401
6417
|
|
|
6402
6418
|
|
|
6403
|
-
exports.ALLOWED_PUBLIC_HEADERS =
|
|
6419
|
+
exports.ALLOWED_PUBLIC_HEADERS = _chunk5IWLUJ6Wcjs.ALLOWED_PUBLIC_HEADERS; exports.ActorDefinition = ActorDefinition; exports.ActorError = _chunk4FC7TVS6cjs.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 = _chunk4FC7TVS6cjs.RivetError; exports.RuntimeKindSchema = RuntimeKindSchema; exports.SqliteBackendSchema = SqliteBackendSchema; exports.SqliteConfigSchema = SqliteConfigSchema; exports.TestConfigSchema = TestConfigSchema; exports.UserError = _chunk4FC7TVS6cjs.UserError; exports.WasmRuntimeConfigSchema = WasmRuntimeConfigSchema; exports.actor = actor; exports.buildActorNames = buildActorNames; exports.createClientWithDriver = _chunk5IWLUJ6Wcjs.createClientWithDriver; exports.event = event; exports.isStaticActorDefinition = isStaticActorDefinition; exports.isStaticActorInstance = isStaticActorInstance; exports.lookupInRegistry = lookupInRegistry; exports.noopNext = _chunkMNHKOS6Lcjs.noopNext; exports.queue = queue; exports.setup = setup; exports.toUint8Array = _chunkMNHKOS6Lcjs.toUint8Array;
|
|
6404
6420
|
//# sourceMappingURL=mod.cjs.map
|