rivetkit 2.3.8 → 2.3.10
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 +6 -34
- package/dist/browser/client.js +14 -33
- package/dist/browser/client.js.map +1 -1
- package/dist/browser/inspector/client.js +1 -1
- package/dist/browser/inspector/client.js.map +1 -1
- package/dist/tsup/agent-os/index.cjs +1 -1
- package/dist/tsup/agent-os/index.cjs.map +1 -1
- package/dist/tsup/agent-os/index.d.cts +6 -34
- package/dist/tsup/agent-os/index.d.ts +6 -34
- package/dist/tsup/agent-os/index.js +1 -1
- package/dist/tsup/agent-os/index.js.map +1 -1
- package/dist/tsup/{chunk-YFXQ7DBH.js → chunk-6UHZLL6S.js} +3 -3
- package/dist/tsup/{chunk-BL6ERZQO.js → chunk-DPM73GAL.js} +18 -39
- package/dist/tsup/chunk-DPM73GAL.js.map +1 -0
- package/dist/tsup/{chunk-MY6BRV3S.js → chunk-E6IEX6AP.js} +3 -3
- package/dist/tsup/{chunk-IJMVVULS.cjs → chunk-G6XA2OSW.cjs} +4 -4
- package/dist/tsup/{chunk-IJMVVULS.cjs.map → chunk-G6XA2OSW.cjs.map} +1 -1
- package/dist/tsup/{chunk-F6GCLL5Z.cjs → chunk-INXPYXN6.cjs} +7 -7
- package/dist/tsup/{chunk-F6GCLL5Z.cjs.map → chunk-INXPYXN6.cjs.map} +1 -1
- package/dist/tsup/{chunk-5MJPN3QU.cjs → chunk-LCWHS6K7.cjs} +152 -173
- package/dist/tsup/chunk-LCWHS6K7.cjs.map +1 -0
- package/dist/tsup/{chunk-7TNEDX3Y.cjs → chunk-PCJSDS7N.cjs} +3 -3
- package/dist/tsup/{chunk-7TNEDX3Y.cjs.map → chunk-PCJSDS7N.cjs.map} +1 -1
- package/dist/tsup/{chunk-V7PJYBA5.js → chunk-Q5H37KNQ.js} +2 -2
- package/dist/tsup/{chunk-TMTJPSHQ.cjs → chunk-U2A3Y7OK.cjs} +9 -9
- package/dist/tsup/{chunk-TMTJPSHQ.cjs.map → chunk-U2A3Y7OK.cjs.map} +1 -1
- package/dist/tsup/{chunk-ZKDZW5DQ.js → chunk-X7XY6NCU.js} +3 -6
- package/dist/tsup/chunk-X7XY6NCU.js.map +1 -0
- package/dist/tsup/{chunk-HWBISPRP.js → chunk-XSPAARQ5.js} +2 -2
- package/dist/tsup/{chunk-NUMGL52R.cjs → chunk-Z2ESFE5Z.cjs} +3 -6
- package/dist/tsup/chunk-Z2ESFE5Z.cjs.map +1 -0
- package/dist/tsup/client/mod.cjs +5 -5
- package/dist/tsup/client/mod.d.cts +2 -2
- package/dist/tsup/client/mod.d.ts +2 -2
- package/dist/tsup/client/mod.js +4 -4
- package/dist/tsup/common/log.cjs +2 -2
- package/dist/tsup/common/log.js +1 -1
- package/dist/tsup/common/websocket.cjs +3 -3
- package/dist/tsup/common/websocket.js +2 -2
- package/dist/tsup/{config-CUymbyM6.d.ts → config-BRpVbJCD.d.ts} +7 -35
- package/dist/tsup/{config-CpB-e4I9.d.cts → config-BobvQpex.d.cts} +7 -35
- package/dist/tsup/{context-YBUBTwTS.d.ts → context-Cj-DFyiy.d.ts} +1 -1
- package/dist/tsup/{context-c-6G4mjk.d.cts → context-YEBNJrws.d.cts} +1 -1
- package/dist/tsup/db/drizzle.cjs +2 -2
- package/dist/tsup/db/drizzle.js +1 -1
- package/dist/tsup/db/mod.cjs +2 -2
- package/dist/tsup/db/mod.js +1 -1
- package/dist/tsup/dynamic/mod.d.cts +1 -1
- package/dist/tsup/dynamic/mod.d.ts +1 -1
- package/dist/tsup/inspector/mod.cjs +4 -4
- package/dist/tsup/inspector/mod.js +3 -3
- package/dist/tsup/inspector-tab/mod.d.cts +2 -2
- package/dist/tsup/inspector-tab/mod.d.ts +2 -2
- package/dist/tsup/mod.cjs +124 -449
- package/dist/tsup/mod.cjs.map +1 -1
- package/dist/tsup/mod.d.cts +3 -3
- package/dist/tsup/mod.d.ts +3 -3
- package/dist/tsup/mod.js +63 -388
- package/dist/tsup/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +6 -6
- package/dist/tsup/test/mod.d.cts +1 -1
- package/dist/tsup/test/mod.d.ts +1 -1
- package/dist/tsup/test/mod.js +4 -4
- package/dist/tsup/utils.cjs +2 -2
- package/dist/tsup/utils.js +1 -1
- package/dist/tsup/workflow/mod.cjs +6 -6
- package/dist/tsup/workflow/mod.d.cts +3 -3
- package/dist/tsup/workflow/mod.d.ts +3 -3
- package/dist/tsup/workflow/mod.js +3 -3
- package/package.json +8 -8
- package/src/client/actor-handle.ts +1 -3
- package/src/client/raw-utils.ts +2 -11
- package/src/common/actor-router-consts.ts +0 -1
- package/src/common/encoding.ts +1 -4
- package/src/engine-client/actor-http-client.ts +22 -6
- package/src/registry/index.ts +14 -159
- package/src/registry/napi-runtime.ts +0 -74
- package/src/registry/native.ts +63 -111
- package/src/registry/runtime.ts +0 -35
- package/src/registry/wasm-runtime.ts +0 -11
- package/dist/tsup/chunk-5MJPN3QU.cjs.map +0 -1
- package/dist/tsup/chunk-BL6ERZQO.js.map +0 -1
- package/dist/tsup/chunk-NUMGL52R.cjs.map +0 -1
- package/dist/tsup/chunk-ZKDZW5DQ.js.map +0 -1
- package/src/common/fetch-like.ts +0 -49
- package/src/registry/native-http.ts +0 -208
- /package/dist/tsup/{chunk-YFXQ7DBH.js.map → chunk-6UHZLL6S.js.map} +0 -0
- /package/dist/tsup/{chunk-MY6BRV3S.js.map → chunk-E6IEX6AP.js.map} +0 -0
- /package/dist/tsup/{chunk-V7PJYBA5.js.map → chunk-Q5H37KNQ.js.map} +0 -0
- /package/dist/tsup/{chunk-HWBISPRP.js.map → chunk-XSPAARQ5.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 _chunkG6XA2OSWcjs = require('./chunk-G6XA2OSW.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -22,15 +22,13 @@ var _chunkHNHLBM3Ycjs = require('./chunk-HNHLBM3Y.cjs');
|
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
var _chunk5MJPN3QUcjs = require('./chunk-5MJPN3QU.cjs');
|
|
25
|
+
var _chunkLCWHS6K7cjs = require('./chunk-LCWHS6K7.cjs');
|
|
28
26
|
|
|
29
27
|
|
|
30
28
|
|
|
31
29
|
var _chunkMYWZCDMLcjs = require('./chunk-MYWZCDML.cjs');
|
|
32
|
-
require('./chunk-7TNEDX3Y.cjs');
|
|
33
30
|
require('./chunk-UEULFXUI.cjs');
|
|
31
|
+
require('./chunk-PCJSDS7N.cjs');
|
|
34
32
|
|
|
35
33
|
|
|
36
34
|
|
|
@@ -63,7 +61,7 @@ require('./chunk-UEULFXUI.cjs');
|
|
|
63
61
|
|
|
64
62
|
|
|
65
63
|
|
|
66
|
-
var
|
|
64
|
+
var _chunkZ2ESFE5Zcjs = require('./chunk-Z2ESFE5Z.cjs');
|
|
67
65
|
|
|
68
66
|
|
|
69
67
|
|
|
@@ -79,7 +77,7 @@ var _chunk4FC7TVS6cjs = require('./chunk-4FC7TVS6.cjs');
|
|
|
79
77
|
|
|
80
78
|
// src/actor/log.ts
|
|
81
79
|
function loggerWithoutContext() {
|
|
82
|
-
return
|
|
80
|
+
return _chunkZ2ESFE5Zcjs.getLogger.call(void 0, "actor-runtime");
|
|
83
81
|
}
|
|
84
82
|
|
|
85
83
|
// src/actor/definition.ts
|
|
@@ -219,7 +217,7 @@ function validateSchemaSync(schemas, key, data) {
|
|
|
219
217
|
var _virtualwebsocket = require('@rivetkit/virtual-websocket');
|
|
220
218
|
var _ws = require('hono/ws');
|
|
221
219
|
function logger() {
|
|
222
|
-
return
|
|
220
|
+
return _chunkZ2ESFE5Zcjs.getLogger.call(void 0, "inline-websocket-adapter");
|
|
223
221
|
}
|
|
224
222
|
var InlineWebSocketAdapter = class {
|
|
225
223
|
#handler;
|
|
@@ -390,7 +388,7 @@ function isLocalEngineEndpoint(endpoint) {
|
|
|
390
388
|
|
|
391
389
|
// src/registry/log.ts
|
|
392
390
|
function logger2() {
|
|
393
|
-
return
|
|
391
|
+
return _chunkZ2ESFE5Zcjs.getLogger.call(void 0, "registry");
|
|
394
392
|
}
|
|
395
393
|
|
|
396
394
|
// src/serverless/configure.ts
|
|
@@ -436,8 +434,8 @@ async function configureServerlessPool(config) {
|
|
|
436
434
|
);
|
|
437
435
|
}
|
|
438
436
|
const customConfig = config.configurePool;
|
|
439
|
-
const clientConfig =
|
|
440
|
-
const dcsRes = await
|
|
437
|
+
const clientConfig = _chunkLCWHS6K7cjs.convertRegistryConfigToClientConfig.call(void 0, config);
|
|
438
|
+
const dcsRes = await _chunkLCWHS6K7cjs.getDatacenters.call(void 0, clientConfig);
|
|
441
439
|
const poolName = _nullishCoalesce(customConfig.name, () => ( "default"));
|
|
442
440
|
const serverlessToken = _nullishCoalesce(config.token, () => ( config.publicToken));
|
|
443
441
|
const headers = {
|
|
@@ -459,7 +457,7 @@ async function configureServerlessPool(config) {
|
|
|
459
457
|
metadata: _nullishCoalesce(customConfig.metadata, () => ( {})),
|
|
460
458
|
drain_on_version_upgrade: _nullishCoalesce(customConfig.drainOnVersionUpgrade, () => ( true))
|
|
461
459
|
};
|
|
462
|
-
await
|
|
460
|
+
await _chunkLCWHS6K7cjs.updateRunnerConfig.call(void 0, clientConfig, poolName, {
|
|
463
461
|
datacenters: Object.fromEntries(
|
|
464
462
|
dcsRes.datacenters.map((dc) => [dc.name, serverlessConfig])
|
|
465
463
|
)
|
|
@@ -476,7 +474,7 @@ async function configureServerlessPool(config) {
|
|
|
476
474
|
logger2().warn({
|
|
477
475
|
msg: "serverless pool configuration attempt failed",
|
|
478
476
|
attempts,
|
|
479
|
-
error:
|
|
477
|
+
error: _chunkZ2ESFE5Zcjs.stringifyError.call(void 0, error)
|
|
480
478
|
});
|
|
481
479
|
await sleep(CONFIGURE_RETRY_DELAY_MS);
|
|
482
480
|
}
|
|
@@ -484,7 +482,7 @@ async function configureServerlessPool(config) {
|
|
|
484
482
|
logger2().error({
|
|
485
483
|
msg: "failed to configure serverless pool, validate endpoint is configured correctly then restart this process",
|
|
486
484
|
attempts,
|
|
487
|
-
error:
|
|
485
|
+
error: _chunkZ2ESFE5Zcjs.stringifyError.call(void 0, lastError)
|
|
488
486
|
});
|
|
489
487
|
throw lastError;
|
|
490
488
|
}
|
|
@@ -496,20 +494,20 @@ var _zod = require('zod');
|
|
|
496
494
|
var _v4 = require('zod/v4');
|
|
497
495
|
var warnedMissingVersion = false;
|
|
498
496
|
var EnvoyConfigSchema = _v4.z.object({
|
|
499
|
-
poolName: _v4.z.string().default(() => _nullishCoalesce(
|
|
497
|
+
poolName: _v4.z.string().default(() => _nullishCoalesce(_chunkZ2ESFE5Zcjs.getRivetPool.call(void 0, ), () => ( "default"))),
|
|
500
498
|
version: _v4.z.number().default(() => {
|
|
501
|
-
const version =
|
|
499
|
+
const version = _chunkZ2ESFE5Zcjs.getRivetEnvoyVersion.call(void 0, );
|
|
502
500
|
if (version !== void 0) return version;
|
|
503
|
-
if (
|
|
501
|
+
if (_chunkZ2ESFE5Zcjs.getNodeEnv.call(void 0, ) === "production" && !warnedMissingVersion) {
|
|
504
502
|
warnedMissingVersion = true;
|
|
505
|
-
|
|
503
|
+
_chunkZ2ESFE5Zcjs.getLogger.call(void 0, "rivetkit").error(
|
|
506
504
|
"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"
|
|
507
505
|
);
|
|
508
506
|
}
|
|
509
507
|
return 1;
|
|
510
508
|
}),
|
|
511
509
|
// Deprecated.
|
|
512
|
-
totalSlots: _v4.z.number().default(() => _nullishCoalesce(
|
|
510
|
+
totalSlots: _v4.z.number().default(() => _nullishCoalesce(_chunkZ2ESFE5Zcjs.getRivetTotalSlots.call(void 0, ), () => ( 1e5))),
|
|
513
511
|
envoyKey: _v4.z.string().optional()
|
|
514
512
|
});
|
|
515
513
|
|
|
@@ -547,7 +545,7 @@ var ServerlessConfigSchema = _v4.z.object({
|
|
|
547
545
|
*
|
|
548
546
|
* Can also be set via RIVET_PUBLIC_ENDPOINT environment variable.
|
|
549
547
|
*/
|
|
550
|
-
publicEndpoint: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => (
|
|
548
|
+
publicEndpoint: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkZ2ESFE5Zcjs.getRivetPublicEndpoint.call(void 0, )))),
|
|
551
549
|
/**
|
|
552
550
|
* Token that clients should use when connecting via the public endpoint.
|
|
553
551
|
*
|
|
@@ -555,7 +553,7 @@ var ServerlessConfigSchema = _v4.z.object({
|
|
|
555
553
|
*
|
|
556
554
|
* Can also be specified in the publicEndpoint URL as `https://namespace:token@host`.
|
|
557
555
|
*/
|
|
558
|
-
publicToken: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => (
|
|
556
|
+
publicToken: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkZ2ESFE5Zcjs.getRivetPublicToken.call(void 0, ))))
|
|
559
557
|
// There is no publicNamespace config option because the frontend and backend
|
|
560
558
|
// cannot use different namespaces. The namespace is extracted from the
|
|
561
559
|
// publicEndpoint URL auth syntax if provided.
|
|
@@ -609,7 +607,7 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
609
607
|
* Runtime binding to use for RivetKit core.
|
|
610
608
|
* */
|
|
611
609
|
runtime: RuntimeKindSchema.optional().transform((val, ctx) => {
|
|
612
|
-
const rawRuntime = _nullishCoalesce(val, () => (
|
|
610
|
+
const rawRuntime = _nullishCoalesce(val, () => ( _chunkZ2ESFE5Zcjs.getRivetkitRuntime.call(void 0, )));
|
|
613
611
|
if (rawRuntime === void 0) {
|
|
614
612
|
return "auto";
|
|
615
613
|
}
|
|
@@ -646,7 +644,7 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
646
644
|
* */
|
|
647
645
|
logging: _zod.z.object({
|
|
648
646
|
baseLogger: _zod.z.custom().optional(),
|
|
649
|
-
level:
|
|
647
|
+
level: _chunkZ2ESFE5Zcjs.LogLevelSchema.optional()
|
|
650
648
|
}).optional().default(() => ({})),
|
|
651
649
|
// MARK: Routing
|
|
652
650
|
// // This is a function to allow for lazy configuration of upgradeWebSocket on the
|
|
@@ -664,9 +662,9 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
664
662
|
*
|
|
665
663
|
* Can also be set via RIVET_ENDPOINT environment variables.
|
|
666
664
|
*/
|
|
667
|
-
endpoint: _zod.z.string().optional().transform((val) => _nullishCoalesce(_nullishCoalesce(val, () => (
|
|
668
|
-
token: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => (
|
|
669
|
-
namespace: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => (
|
|
665
|
+
endpoint: _zod.z.string().optional().transform((val) => _nullishCoalesce(_nullishCoalesce(val, () => ( _chunkZ2ESFE5Zcjs.getRivetEngine.call(void 0, ))), () => ( _chunkZ2ESFE5Zcjs.getRivetEndpoint.call(void 0, )))),
|
|
666
|
+
token: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkZ2ESFE5Zcjs.getRivetToken.call(void 0, )))),
|
|
667
|
+
namespace: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkZ2ESFE5Zcjs.getRivetNamespace.call(void 0, )))),
|
|
670
668
|
headers: _zod.z.record(_zod.z.string(), _zod.z.string()).optional().default({}),
|
|
671
669
|
// MARK: Client
|
|
672
670
|
// TODO:
|
|
@@ -706,21 +704,21 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
706
704
|
*
|
|
707
705
|
* Starts the full Rust engine process locally.
|
|
708
706
|
*/
|
|
709
|
-
startEngine: _zod.z.boolean().default(() =>
|
|
707
|
+
startEngine: _zod.z.boolean().default(() => _chunkZ2ESFE5Zcjs.getRivetRunEngine.call(void 0, )),
|
|
710
708
|
/**
|
|
711
709
|
* @experimental
|
|
712
710
|
*
|
|
713
711
|
* Host to bind the spawned local engine process to.
|
|
714
712
|
*/
|
|
715
|
-
engineHost: _zod.z.string().optional().default(() => _nullishCoalesce(
|
|
713
|
+
engineHost: _zod.z.string().optional().default(() => _nullishCoalesce(_chunkZ2ESFE5Zcjs.getRivetRunEngineHost.call(void 0, ), () => ( ENGINE_HOST))),
|
|
716
714
|
/**
|
|
717
715
|
* @experimental
|
|
718
716
|
*
|
|
719
717
|
* Port to bind the spawned local engine process to.
|
|
720
718
|
*/
|
|
721
|
-
enginePort: _zod.z.number().int().min(1).max(65535).optional().default(() => _nullishCoalesce(
|
|
719
|
+
enginePort: _zod.z.number().int().min(1).max(65535).optional().default(() => _nullishCoalesce(_chunkZ2ESFE5Zcjs.getRivetRunEnginePort.call(void 0, ), () => ( ENGINE_PORT))),
|
|
722
720
|
/** @experimental */
|
|
723
|
-
engineVersion: _zod.z.string().optional().default(() => _nullishCoalesce(
|
|
721
|
+
engineVersion: _zod.z.string().optional().default(() => _nullishCoalesce(_chunkZ2ESFE5Zcjs.getRivetRunEngineVersion.call(void 0, ), () => ( _chunkZ2ESFE5Zcjs.VERSION))),
|
|
724
722
|
/**
|
|
725
723
|
* @experimental
|
|
726
724
|
*
|
|
@@ -768,7 +766,7 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
768
766
|
}))
|
|
769
767
|
}).transform((config, ctx) => {
|
|
770
768
|
var _a, _b, _c;
|
|
771
|
-
const isDevEnv =
|
|
769
|
+
const isDevEnv = _chunkZ2ESFE5Zcjs.isDev.call(void 0, );
|
|
772
770
|
const sqliteBackend = _nullishCoalesce(((_a = config.sqlite) == null ? void 0 : _a.backend), () => ( ((_b = config.test) == null ? void 0 : _b.sqliteBackend)));
|
|
773
771
|
if (config.runtime === "wasm" && sqliteBackend === "local") {
|
|
774
772
|
ctx.addIssue({
|
|
@@ -778,7 +776,7 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
778
776
|
});
|
|
779
777
|
}
|
|
780
778
|
const sqlite = config.runtime === "wasm" && config.sqlite === void 0 ? { backend: "remote" } : config.sqlite;
|
|
781
|
-
const parsedEndpoint = config.endpoint ?
|
|
779
|
+
const parsedEndpoint = config.endpoint ? _chunkLCWHS6K7cjs.tryParseEndpoint.call(void 0, ctx, {
|
|
782
780
|
endpoint: config.endpoint,
|
|
783
781
|
path: ["endpoint"],
|
|
784
782
|
namespace: config.namespace,
|
|
@@ -806,7 +804,7 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
806
804
|
);
|
|
807
805
|
const namespace = _nullishCoalesce(_nullishCoalesce((parsedEndpoint == null ? void 0 : parsedEndpoint.namespace), () => ( config.namespace)), () => ( "default"));
|
|
808
806
|
const token = _nullishCoalesce((parsedEndpoint == null ? void 0 : parsedEndpoint.token), () => ( config.token));
|
|
809
|
-
const parsedPublicEndpoint = config.serverless.publicEndpoint ?
|
|
807
|
+
const parsedPublicEndpoint = config.serverless.publicEndpoint ? _chunkLCWHS6K7cjs.tryParseEndpoint.call(void 0, ctx, {
|
|
810
808
|
endpoint: config.serverless.publicEndpoint,
|
|
811
809
|
path: ["serverless", "publicEndpoint"]
|
|
812
810
|
}) : void 0;
|
|
@@ -909,7 +907,7 @@ var DocRegistryConfigSchema = _zod.z.object({
|
|
|
909
907
|
noWelcome: _zod.z.boolean().optional().describe("Disable the welcome message on startup. Default: false"),
|
|
910
908
|
sqlite: DocSqliteConfigSchema,
|
|
911
909
|
logging: _zod.z.object({
|
|
912
|
-
level:
|
|
910
|
+
level: _chunkZ2ESFE5Zcjs.LogLevelSchema.optional().describe(
|
|
913
911
|
"Log level for RivetKit. Default: 'warn'"
|
|
914
912
|
)
|
|
915
913
|
}).optional().describe("Logging configuration."),
|
|
@@ -1435,36 +1433,6 @@ function toNapiSqlBatchStatement(statement) {
|
|
|
1435
1433
|
function toNapiBuffer(value) {
|
|
1436
1434
|
return Buffer.from(value);
|
|
1437
1435
|
}
|
|
1438
|
-
function toNapiApplication(application) {
|
|
1439
|
-
return async (error, request) => {
|
|
1440
|
-
if (error) throw error;
|
|
1441
|
-
if (!request) {
|
|
1442
|
-
throw new Error("application fetch callback received no request");
|
|
1443
|
-
}
|
|
1444
|
-
const response = await application(
|
|
1445
|
-
{
|
|
1446
|
-
...request,
|
|
1447
|
-
body: new Uint8Array(request.body),
|
|
1448
|
-
cancelToken: request.cancelToken
|
|
1449
|
-
},
|
|
1450
|
-
request.responseBodyStream ? fromNapiHttpResponseBodyStream(
|
|
1451
|
-
request.responseBodyStream
|
|
1452
|
-
) : void 0
|
|
1453
|
-
);
|
|
1454
|
-
return {
|
|
1455
|
-
...response,
|
|
1456
|
-
body: response.body === void 0 ? void 0 : toNapiBuffer(response.body)
|
|
1457
|
-
};
|
|
1458
|
-
};
|
|
1459
|
-
}
|
|
1460
|
-
function fromNapiHttpResponseBodyStream(stream) {
|
|
1461
|
-
return {
|
|
1462
|
-
cancelled: () => stream.cancelled(),
|
|
1463
|
-
write: (chunk) => stream.write(Buffer.from(chunk)),
|
|
1464
|
-
end: () => stream.end(),
|
|
1465
|
-
error: (message) => stream.error(message)
|
|
1466
|
-
};
|
|
1467
|
-
}
|
|
1468
1436
|
function toNapiHttpRequest(request) {
|
|
1469
1437
|
if (!request) {
|
|
1470
1438
|
return request;
|
|
@@ -1571,25 +1539,12 @@ var NapiCoreRuntime = (_class = class {
|
|
|
1571
1539
|
);
|
|
1572
1540
|
}
|
|
1573
1541
|
async serveListener(registry, listener, config) {
|
|
1574
|
-
const application = listener.application ? toNapiApplication(listener.application) : void 0;
|
|
1575
1542
|
await asNativeRegistry(registry).serveListener(
|
|
1576
1543
|
{
|
|
1577
1544
|
port: listener.port,
|
|
1578
1545
|
host: listener.host,
|
|
1579
1546
|
publicDir: listener.publicDir
|
|
1580
1547
|
},
|
|
1581
|
-
config,
|
|
1582
|
-
application
|
|
1583
|
-
);
|
|
1584
|
-
}
|
|
1585
|
-
async serveApplicationListener(registry, listener, config) {
|
|
1586
|
-
await asNativeRegistry(registry).serveApplicationListener(
|
|
1587
|
-
{
|
|
1588
|
-
port: listener.port,
|
|
1589
|
-
host: listener.host,
|
|
1590
|
-
publicDir: listener.publicDir
|
|
1591
|
-
},
|
|
1592
|
-
toNapiApplication(listener.application),
|
|
1593
1548
|
config
|
|
1594
1549
|
);
|
|
1595
1550
|
}
|
|
@@ -1977,137 +1932,6 @@ async function loadNapiRuntime() {
|
|
|
1977
1932
|
};
|
|
1978
1933
|
}
|
|
1979
1934
|
|
|
1980
|
-
// src/registry/native-http.ts
|
|
1981
|
-
var HTTP_BODY_CHUNK_SIZE = 64 * 1024;
|
|
1982
|
-
function runtimeBytesToArrayBuffer(value) {
|
|
1983
|
-
return value.buffer.slice(
|
|
1984
|
-
value.byteOffset,
|
|
1985
|
-
value.byteOffset + value.byteLength
|
|
1986
|
-
);
|
|
1987
|
-
}
|
|
1988
|
-
function buildNativeHttpRequest(init) {
|
|
1989
|
-
var _a;
|
|
1990
|
-
const headers = new Headers(init.headers);
|
|
1991
|
-
const originalUrl = headers.get(_chunk5MJPN3QUcjs.HEADER_ORIGINAL_REQUEST_URL);
|
|
1992
|
-
headers.delete(_chunk5MJPN3QUcjs.HEADER_ORIGINAL_REQUEST_URL);
|
|
1993
|
-
const url = _nullishCoalesce(originalUrl, () => ( (init.uri.startsWith("http") ? init.uri : new URL(init.uri, "http://127.0.0.1").toString())));
|
|
1994
|
-
const method2 = init.method.toUpperCase();
|
|
1995
|
-
const bodyForbidden = method2 === "GET" || method2 === "HEAD";
|
|
1996
|
-
const body = bodyForbidden ? void 0 : init.bodyStream ? new ReadableStream({
|
|
1997
|
-
async pull(controller) {
|
|
1998
|
-
var _a2, _b;
|
|
1999
|
-
try {
|
|
2000
|
-
if (init.body && init.body.length > 0) {
|
|
2001
|
-
controller.enqueue(new Uint8Array(init.body));
|
|
2002
|
-
init.body = void 0;
|
|
2003
|
-
return;
|
|
2004
|
-
}
|
|
2005
|
-
const chunk = await ((_a2 = init.bodyStream) == null ? void 0 : _a2.read());
|
|
2006
|
-
if (!chunk) {
|
|
2007
|
-
controller.close();
|
|
2008
|
-
} else {
|
|
2009
|
-
controller.enqueue(new Uint8Array(chunk));
|
|
2010
|
-
}
|
|
2011
|
-
} catch (error) {
|
|
2012
|
-
(_b = init.abortController) == null ? void 0 : _b.abort(error);
|
|
2013
|
-
controller.error(error);
|
|
2014
|
-
}
|
|
2015
|
-
},
|
|
2016
|
-
async cancel() {
|
|
2017
|
-
var _a2;
|
|
2018
|
-
await ((_a2 = init.bodyStream) == null ? void 0 : _a2.cancel());
|
|
2019
|
-
}
|
|
2020
|
-
}) : init.body && init.body.length > 0 ? runtimeBytesToArrayBuffer(init.body) : void 0;
|
|
2021
|
-
const streamInit = init.bodyStream && !bodyForbidden ? { duplex: "half" } : {};
|
|
2022
|
-
return new Request(url, {
|
|
2023
|
-
method: method2,
|
|
2024
|
-
headers,
|
|
2025
|
-
body,
|
|
2026
|
-
signal: _nullishCoalesce(((_a = init.abortController) == null ? void 0 : _a.signal), () => ( init.signal)),
|
|
2027
|
-
...streamInit
|
|
2028
|
-
});
|
|
2029
|
-
}
|
|
2030
|
-
async function cancelNativeHttpRequestBody(bodyStream) {
|
|
2031
|
-
await (bodyStream == null ? void 0 : bodyStream.cancel());
|
|
2032
|
-
}
|
|
2033
|
-
async function writeResponseChunk(stream, chunk) {
|
|
2034
|
-
for (let offset = 0; offset < chunk.byteLength; offset += HTTP_BODY_CHUNK_SIZE) {
|
|
2035
|
-
await stream.write(
|
|
2036
|
-
chunk.subarray(offset, offset + HTTP_BODY_CHUNK_SIZE)
|
|
2037
|
-
);
|
|
2038
|
-
}
|
|
2039
|
-
}
|
|
2040
|
-
async function pumpResponseBody(reader, stream) {
|
|
2041
|
-
var _a;
|
|
2042
|
-
const cancelled = stream.cancelled().then(() => ({ cancelled: true }));
|
|
2043
|
-
try {
|
|
2044
|
-
for (; ; ) {
|
|
2045
|
-
const read = reader.read().then((next2) => ({ cancelled: false, next: next2 }));
|
|
2046
|
-
const result = await Promise.race([read, cancelled]);
|
|
2047
|
-
if (result.cancelled) {
|
|
2048
|
-
await reader.cancel(
|
|
2049
|
-
new Error("native http response stream receiver dropped")
|
|
2050
|
-
);
|
|
2051
|
-
return;
|
|
2052
|
-
}
|
|
2053
|
-
const { next } = result;
|
|
2054
|
-
if (next.done) {
|
|
2055
|
-
await stream.end();
|
|
2056
|
-
return;
|
|
2057
|
-
}
|
|
2058
|
-
if ((_a = next.value) == null ? void 0 : _a.byteLength) {
|
|
2059
|
-
await writeResponseChunk(stream, next.value);
|
|
2060
|
-
}
|
|
2061
|
-
}
|
|
2062
|
-
} catch (error) {
|
|
2063
|
-
try {
|
|
2064
|
-
await stream.error(_chunkNUMGL52Rcjs.stringifyError.call(void 0, error));
|
|
2065
|
-
} catch (streamError) {
|
|
2066
|
-
logger2().debug({
|
|
2067
|
-
msg: "failed to report native http response stream error",
|
|
2068
|
-
error: streamError
|
|
2069
|
-
});
|
|
2070
|
-
}
|
|
2071
|
-
try {
|
|
2072
|
-
await reader.cancel(error);
|
|
2073
|
-
} catch (e3) {
|
|
2074
|
-
}
|
|
2075
|
-
} finally {
|
|
2076
|
-
reader.releaseLock();
|
|
2077
|
-
}
|
|
2078
|
-
}
|
|
2079
|
-
async function convertNativeHttpResponse(response, responseBodyStream) {
|
|
2080
|
-
const headers = Object.fromEntries(response.headers.entries());
|
|
2081
|
-
if (!response.body) {
|
|
2082
|
-
return {
|
|
2083
|
-
response: {
|
|
2084
|
-
status: response.status,
|
|
2085
|
-
headers,
|
|
2086
|
-
body: new Uint8Array()
|
|
2087
|
-
}
|
|
2088
|
-
};
|
|
2089
|
-
}
|
|
2090
|
-
if (responseBodyStream) {
|
|
2091
|
-
const reader = response.body.getReader();
|
|
2092
|
-
const bodyCompletion = pumpResponseBody(reader, responseBodyStream);
|
|
2093
|
-
return {
|
|
2094
|
-
response: {
|
|
2095
|
-
status: response.status,
|
|
2096
|
-
headers,
|
|
2097
|
-
stream: true
|
|
2098
|
-
},
|
|
2099
|
-
bodyCompletion
|
|
2100
|
-
};
|
|
2101
|
-
}
|
|
2102
|
-
return {
|
|
2103
|
-
response: {
|
|
2104
|
-
status: response.status,
|
|
2105
|
-
headers,
|
|
2106
|
-
body: new Uint8Array(await response.arrayBuffer())
|
|
2107
|
-
}
|
|
2108
|
-
};
|
|
2109
|
-
}
|
|
2110
|
-
|
|
2111
1935
|
// src/registry/native-validation.ts
|
|
2112
1936
|
var CONN_PARAMS_KEY = "__conn_params__";
|
|
2113
1937
|
function validateActionArgs(schemas, name, args) {
|
|
@@ -2380,11 +2204,6 @@ var WasmCoreRuntime = (_class2 = class {
|
|
|
2380
2204
|
"registry.listen() is not supported on the wasm runtime; use registry.serve() and mount the handler in your platform's HTTP server instead"
|
|
2381
2205
|
);
|
|
2382
2206
|
}
|
|
2383
|
-
async serveApplicationListener(_registry, _listener, _config) {
|
|
2384
|
-
throw new Error(
|
|
2385
|
-
"registry.listen() is not supported on the wasm runtime; use an application-owned HTTP server instead"
|
|
2386
|
-
);
|
|
2387
|
-
}
|
|
2388
2207
|
createActorFactory(callbacks, config) {
|
|
2389
2208
|
return callWasmSync(
|
|
2390
2209
|
() => asActorFactoryHandle2(
|
|
@@ -2954,7 +2773,7 @@ function trySetProcessEnv(key, value) {
|
|
|
2954
2773
|
if (typeof process === "undefined") return;
|
|
2955
2774
|
try {
|
|
2956
2775
|
process.env[key] = value;
|
|
2957
|
-
} catch (
|
|
2776
|
+
} catch (e3) {
|
|
2958
2777
|
}
|
|
2959
2778
|
}
|
|
2960
2779
|
function detectRuntimeHost() {
|
|
@@ -2991,7 +2810,7 @@ async function loadAutoRuntime(config, loaders = defaultRuntimeLoaders) {
|
|
|
2991
2810
|
}
|
|
2992
2811
|
try {
|
|
2993
2812
|
return (await loaders.loadNative()).runtime;
|
|
2994
|
-
} catch (
|
|
2813
|
+
} catch (e4) {
|
|
2995
2814
|
return (await loaders.loadWasm(config.wasm)).runtime;
|
|
2996
2815
|
}
|
|
2997
2816
|
}
|
|
@@ -3165,7 +2984,7 @@ async function cleanupNativeSleepRuntimeState(runtime, ctx, afterTrackedWorkDrai
|
|
|
3165
2984
|
}).catch((error) => {
|
|
3166
2985
|
logger2().warn({
|
|
3167
2986
|
msg: "deferred native sleep cleanup failed",
|
|
3168
|
-
error:
|
|
2987
|
+
error: _chunkZ2ESFE5Zcjs.stringifyError.call(void 0, error)
|
|
3169
2988
|
});
|
|
3170
2989
|
});
|
|
3171
2990
|
return;
|
|
@@ -3242,7 +3061,7 @@ function toRuntimeBytes(value) {
|
|
|
3242
3061
|
function arrayBufferViewToRuntimeBytes(value) {
|
|
3243
3062
|
return new Uint8Array(value.buffer, value.byteOffset, value.byteLength);
|
|
3244
3063
|
}
|
|
3245
|
-
function
|
|
3064
|
+
function runtimeBytesToArrayBuffer(value) {
|
|
3246
3065
|
return value.buffer.slice(
|
|
3247
3066
|
value.byteOffset,
|
|
3248
3067
|
value.byteOffset + value.byteLength
|
|
@@ -3292,10 +3111,10 @@ function decodeValue(value) {
|
|
|
3292
3111
|
if (!value || value.length === 0) {
|
|
3293
3112
|
return void 0;
|
|
3294
3113
|
}
|
|
3295
|
-
return
|
|
3114
|
+
return _chunkZ2ESFE5Zcjs.decodeCborCompat.call(void 0, value);
|
|
3296
3115
|
}
|
|
3297
3116
|
function encodeValue(value) {
|
|
3298
|
-
return
|
|
3117
|
+
return _chunkZ2ESFE5Zcjs.encodeCborCompat.call(void 0, value);
|
|
3299
3118
|
}
|
|
3300
3119
|
function normalizeArgs(value) {
|
|
3301
3120
|
return Array.isArray(value) ? value : value === void 0 || value === null ? [] : [value];
|
|
@@ -3331,7 +3150,7 @@ function isStructuredBridgeError(error) {
|
|
|
3331
3150
|
return _chunk4FC7TVS6cjs.isRivetErrorLike.call(void 0, error) && "__type" in error && (error.__type === "RivetError" || error.__type === "ActorError");
|
|
3332
3151
|
}
|
|
3333
3152
|
function encodeNativeCallbackError(error) {
|
|
3334
|
-
const structuredError = isStructuredBridgeError(error) ? error :
|
|
3153
|
+
const structuredError = isStructuredBridgeError(error) ? error : _chunkZ2ESFE5Zcjs.deconstructError.call(void 0, error, true);
|
|
3335
3154
|
const bridgeError = new Error(_chunk4FC7TVS6cjs.encodeBridgeRivetError.call(void 0, structuredError), {
|
|
3336
3155
|
cause: error instanceof Error ? error : void 0
|
|
3337
3156
|
});
|
|
@@ -3381,8 +3200,8 @@ function decodeWorkflowCbor(data) {
|
|
|
3381
3200
|
return null;
|
|
3382
3201
|
}
|
|
3383
3202
|
try {
|
|
3384
|
-
return
|
|
3385
|
-
} catch (
|
|
3203
|
+
return _chunkZ2ESFE5Zcjs.decodeCborCompat.call(void 0, new Uint8Array(data));
|
|
3204
|
+
} catch (e5) {
|
|
3386
3205
|
return null;
|
|
3387
3206
|
}
|
|
3388
3207
|
}
|
|
@@ -3494,7 +3313,7 @@ function serializeWorkflowHistoryForJson(data) {
|
|
|
3494
3313
|
if (data === null) {
|
|
3495
3314
|
return null;
|
|
3496
3315
|
}
|
|
3497
|
-
const history =
|
|
3316
|
+
const history = _chunkG6XA2OSWcjs.decodeWorkflowHistoryTransport.call(void 0, data);
|
|
3498
3317
|
return jsonSafe({
|
|
3499
3318
|
nameRegistry: [...history.nameRegistry],
|
|
3500
3319
|
entries: history.entries.map((entry) => ({
|
|
@@ -3572,6 +3391,24 @@ function decodeArgs(value) {
|
|
|
3572
3391
|
const decoded = decodeValue(value);
|
|
3573
3392
|
return normalizeArgs(decoded);
|
|
3574
3393
|
}
|
|
3394
|
+
function buildRequest(init) {
|
|
3395
|
+
const url = init.uri.startsWith("http") ? init.uri : new URL(init.uri, "http://127.0.0.1").toString();
|
|
3396
|
+
const body = init.body && init.body.length > 0 ? runtimeBytesToArrayBuffer(init.body) : void 0;
|
|
3397
|
+
return new Request(url, {
|
|
3398
|
+
method: init.method,
|
|
3399
|
+
headers: init.headers,
|
|
3400
|
+
body
|
|
3401
|
+
});
|
|
3402
|
+
}
|
|
3403
|
+
async function toRuntimeHttpResponse(response) {
|
|
3404
|
+
const headers = Object.fromEntries(response.headers.entries());
|
|
3405
|
+
const body = new Uint8Array(await response.arrayBuffer());
|
|
3406
|
+
return {
|
|
3407
|
+
status: response.status,
|
|
3408
|
+
headers,
|
|
3409
|
+
body
|
|
3410
|
+
};
|
|
3411
|
+
}
|
|
3575
3412
|
function toActorKey(segments) {
|
|
3576
3413
|
return segments.map(
|
|
3577
3414
|
(segment) => segment.kind === "number" ? String(_nullishCoalesce(segment.numberValue, () => ( 0))) : _nullishCoalesce(segment.stringValue, () => ( ""))
|
|
@@ -3617,12 +3454,12 @@ var NativeConnAdapter = class {
|
|
|
3617
3454
|
this.#writeState(nextValue, { writeNative: true });
|
|
3618
3455
|
},
|
|
3619
3456
|
(newValue) => {
|
|
3620
|
-
|
|
3457
|
+
_chunkZ2ESFE5Zcjs.assertJsonCompatValue.call(void 0, newValue);
|
|
3621
3458
|
}
|
|
3622
3459
|
);
|
|
3623
3460
|
}
|
|
3624
3461
|
set state(value) {
|
|
3625
|
-
|
|
3462
|
+
_chunkZ2ESFE5Zcjs.assertJsonCompatValue.call(void 0, value);
|
|
3626
3463
|
this.#writeState(value, { writeNative: true });
|
|
3627
3464
|
}
|
|
3628
3465
|
initializeState(value) {
|
|
@@ -4236,7 +4073,7 @@ var NativeWebSocketAdapter = class {
|
|
|
4236
4073
|
this.#runtime.webSocketSetEventCallback(this.#ws, (event2) => {
|
|
4237
4074
|
if (event2.kind === "message") {
|
|
4238
4075
|
this.#virtual.triggerMessage(
|
|
4239
|
-
event2.binary ?
|
|
4076
|
+
event2.binary ? runtimeBytesToArrayBuffer(event2.data) : event2.data,
|
|
4240
4077
|
event2.messageIndex
|
|
4241
4078
|
);
|
|
4242
4079
|
return;
|
|
@@ -4668,7 +4505,7 @@ var ActorContextHandleAdapter = class {
|
|
|
4668
4505
|
},
|
|
4669
4506
|
(newValue) => {
|
|
4670
4507
|
this.#assertCanMutateState();
|
|
4671
|
-
|
|
4508
|
+
_chunkZ2ESFE5Zcjs.assertJsonCompatValue.call(void 0, newValue);
|
|
4672
4509
|
}
|
|
4673
4510
|
);
|
|
4674
4511
|
}
|
|
@@ -4679,7 +4516,7 @@ var ActorContextHandleAdapter = class {
|
|
|
4679
4516
|
throw stateNotEnabledError();
|
|
4680
4517
|
}
|
|
4681
4518
|
this.#assertCanMutateState();
|
|
4682
|
-
|
|
4519
|
+
_chunkZ2ESFE5Zcjs.assertJsonCompatValue.call(void 0, value);
|
|
4683
4520
|
this.#writeState(value, { scheduleSave: true });
|
|
4684
4521
|
}
|
|
4685
4522
|
initializeState(value) {
|
|
@@ -4955,7 +4792,7 @@ var ActorContextHandleAdapter = class {
|
|
|
4955
4792
|
const trackedPromise = Promise.resolve(promise).catch((error) => {
|
|
4956
4793
|
logger2().warn({
|
|
4957
4794
|
msg: "keepAwake promise rejected",
|
|
4958
|
-
error:
|
|
4795
|
+
error: _chunkZ2ESFE5Zcjs.stringifyError.call(void 0, error)
|
|
4959
4796
|
});
|
|
4960
4797
|
}).then(() => null);
|
|
4961
4798
|
try {
|
|
@@ -5417,9 +5254,9 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
5417
5254
|
events: config.events,
|
|
5418
5255
|
queues: config.queues
|
|
5419
5256
|
};
|
|
5420
|
-
const createClient = () =>
|
|
5421
|
-
new (0,
|
|
5422
|
-
|
|
5257
|
+
const createClient = () => _chunkLCWHS6K7cjs.createClientWithDriver.call(void 0,
|
|
5258
|
+
new (0, _chunkLCWHS6K7cjs.RemoteEngineControlClient)(
|
|
5259
|
+
_chunkLCWHS6K7cjs.convertRegistryConfigToClientConfig.call(void 0, registryConfig)
|
|
5423
5260
|
),
|
|
5424
5261
|
{ encoding: "bare" }
|
|
5425
5262
|
);
|
|
@@ -5468,14 +5305,12 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
5468
5305
|
onStateChange,
|
|
5469
5306
|
cancelToken
|
|
5470
5307
|
);
|
|
5471
|
-
const maybeHandleNativeInspectorRequest = async (ctx,
|
|
5308
|
+
const maybeHandleNativeInspectorRequest = async (ctx, _rawRequest, jsRequest) => {
|
|
5472
5309
|
var _a2, _b, _c, _d;
|
|
5473
|
-
const
|
|
5474
|
-
const url = new URL(rawUrl);
|
|
5310
|
+
const url = new URL(jsRequest.url);
|
|
5475
5311
|
if (!url.pathname.startsWith("/inspector/")) {
|
|
5476
5312
|
return void 0;
|
|
5477
5313
|
}
|
|
5478
|
-
const jsRequest = buildNativeHttpRequest(rawRequest);
|
|
5479
5314
|
const jsonResponse = (body, init) => new Response(JSON.stringify(body), {
|
|
5480
5315
|
status: _nullishCoalesce((init == null ? void 0 : init.status), () => ( 200)),
|
|
5481
5316
|
headers: {
|
|
@@ -5581,7 +5416,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
5581
5416
|
let body;
|
|
5582
5417
|
try {
|
|
5583
5418
|
body = await jsRequest.json();
|
|
5584
|
-
} catch (
|
|
5419
|
+
} catch (e6) {
|
|
5585
5420
|
return errorResponse(
|
|
5586
5421
|
new (0, _chunk4FC7TVS6cjs.RivetError)(
|
|
5587
5422
|
"actor",
|
|
@@ -5604,7 +5439,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
5604
5439
|
400
|
|
5605
5440
|
);
|
|
5606
5441
|
}
|
|
5607
|
-
const cbor =
|
|
5442
|
+
const cbor = _chunkZ2ESFE5Zcjs.encodeCborCompat.call(void 0,
|
|
5608
5443
|
_nullishCoalesce(body.body, () => ( null))
|
|
5609
5444
|
);
|
|
5610
5445
|
const message = await runtime.actorQueueSend(ctx, name, cbor);
|
|
@@ -6006,7 +5841,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
6006
5841
|
);
|
|
6007
5842
|
const actorCtx = makeActorCtx(
|
|
6008
5843
|
ctx,
|
|
6009
|
-
request ?
|
|
5844
|
+
request ? buildRequest(request) : void 0
|
|
6010
5845
|
);
|
|
6011
5846
|
try {
|
|
6012
5847
|
await config.onBeforeConnect(
|
|
@@ -6026,7 +5861,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
6026
5861
|
const { ctx, conn, params, request } = unwrapTsfnPayload(error, payload);
|
|
6027
5862
|
const actorCtx = makeActorCtx(
|
|
6028
5863
|
ctx,
|
|
6029
|
-
request ?
|
|
5864
|
+
request ? buildRequest(request) : void 0
|
|
6030
5865
|
);
|
|
6031
5866
|
const connAdapter = new NativeConnAdapter(
|
|
6032
5867
|
runtime,
|
|
@@ -6063,7 +5898,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
6063
5898
|
);
|
|
6064
5899
|
const actorCtx = makeActorCtx(
|
|
6065
5900
|
ctx,
|
|
6066
|
-
request ?
|
|
5901
|
+
request ? buildRequest(request) : void 0
|
|
6067
5902
|
);
|
|
6068
5903
|
const connAdapter = new NativeConnAdapter(
|
|
6069
5904
|
runtime,
|
|
@@ -6168,45 +6003,27 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
6168
6003
|
onRequest: wrapNativeCallback(
|
|
6169
6004
|
async (error, payload) => {
|
|
6170
6005
|
try {
|
|
6171
|
-
const { ctx, request, cancelToken
|
|
6172
|
-
|
|
6006
|
+
const { ctx, request, cancelToken } = unwrapTsfnPayload(
|
|
6007
|
+
error,
|
|
6008
|
+
payload
|
|
6009
|
+
);
|
|
6010
|
+
const jsRequest = buildRequest(request);
|
|
6011
|
+
const inspectorResponse = await maybeHandleNativeInspectorRequest(
|
|
6012
|
+
ctx,
|
|
6013
|
+
request,
|
|
6014
|
+
jsRequest
|
|
6015
|
+
);
|
|
6173
6016
|
if (inspectorResponse) {
|
|
6174
|
-
await
|
|
6175
|
-
return (await convertNativeHttpResponse(
|
|
6176
|
-
inspectorResponse,
|
|
6177
|
-
responseBodyStream
|
|
6178
|
-
)).response;
|
|
6017
|
+
return await toRuntimeHttpResponse(inspectorResponse);
|
|
6179
6018
|
}
|
|
6180
6019
|
if (typeof config.onRequest !== "function") {
|
|
6181
|
-
await
|
|
6182
|
-
|
|
6183
|
-
|
|
6184
|
-
responseBodyStream
|
|
6185
|
-
)).response;
|
|
6020
|
+
return await toRuntimeHttpResponse(
|
|
6021
|
+
new Response(null, { status: 404 })
|
|
6022
|
+
);
|
|
6186
6023
|
}
|
|
6187
|
-
const
|
|
6188
|
-
const handlerRequest = buildNativeHttpRequest({
|
|
6189
|
-
...request,
|
|
6190
|
-
abortController: requestAbortController
|
|
6191
|
-
});
|
|
6192
|
-
const rawConnParams = handlerRequest.headers.get(_chunk5MJPN3QUcjs.HEADER_CONN_PARAMS);
|
|
6024
|
+
const rawConnParams = jsRequest.headers.get(_chunkLCWHS6K7cjs.HEADER_CONN_PARAMS);
|
|
6193
6025
|
let requestCtx;
|
|
6194
6026
|
let conn;
|
|
6195
|
-
let removeRequestAbortListener;
|
|
6196
|
-
let cleanupDeferredToBody = false;
|
|
6197
|
-
let cleanedUp = false;
|
|
6198
|
-
const cleanupRequest = async () => {
|
|
6199
|
-
if (cleanedUp) return;
|
|
6200
|
-
cleanedUp = true;
|
|
6201
|
-
removeRequestAbortListener == null ? void 0 : removeRequestAbortListener();
|
|
6202
|
-
try {
|
|
6203
|
-
await (requestCtx == null ? void 0 : requestCtx.dispose());
|
|
6204
|
-
} finally {
|
|
6205
|
-
if (conn) {
|
|
6206
|
-
await runtime.connDisconnect(conn);
|
|
6207
|
-
}
|
|
6208
|
-
}
|
|
6209
|
-
};
|
|
6210
6027
|
try {
|
|
6211
6028
|
const connParams = validateConnParams(
|
|
6212
6029
|
schemaConfig.connParamsSchema,
|
|
@@ -6222,56 +6039,23 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
6222
6039
|
requestCtx = makeConnCtx(
|
|
6223
6040
|
ctx,
|
|
6224
6041
|
conn,
|
|
6225
|
-
|
|
6042
|
+
jsRequest,
|
|
6226
6043
|
cancelToken
|
|
6227
6044
|
);
|
|
6228
|
-
const ctxAbortSignal = requestCtx.abortSignal;
|
|
6229
|
-
const abortRequest = () => requestAbortController.abort(ctxAbortSignal.reason);
|
|
6230
|
-
if (ctxAbortSignal.aborted) {
|
|
6231
|
-
abortRequest();
|
|
6232
|
-
} else {
|
|
6233
|
-
ctxAbortSignal.addEventListener(
|
|
6234
|
-
"abort",
|
|
6235
|
-
abortRequest,
|
|
6236
|
-
{ once: true }
|
|
6237
|
-
);
|
|
6238
|
-
removeRequestAbortListener = () => ctxAbortSignal.removeEventListener(
|
|
6239
|
-
"abort",
|
|
6240
|
-
abortRequest
|
|
6241
|
-
);
|
|
6242
|
-
}
|
|
6243
6045
|
const response = await config.onRequest(
|
|
6244
6046
|
requestCtx,
|
|
6245
|
-
|
|
6047
|
+
jsRequest
|
|
6246
6048
|
);
|
|
6247
|
-
if (!
|
|
6049
|
+
if (!(response instanceof Response)) {
|
|
6248
6050
|
throw new Error(
|
|
6249
6051
|
"onRequest handler must return a Response"
|
|
6250
6052
|
);
|
|
6251
6053
|
}
|
|
6252
|
-
|
|
6253
|
-
response,
|
|
6254
|
-
responseBodyStream
|
|
6255
|
-
);
|
|
6256
|
-
if (conversion.bodyCompletion) {
|
|
6257
|
-
cleanupDeferredToBody = true;
|
|
6258
|
-
void conversion.bodyCompletion.then(cleanupRequest).catch((cleanupError) => {
|
|
6259
|
-
logger2().error({
|
|
6260
|
-
msg: "failed to clean up native streaming http request",
|
|
6261
|
-
error: cleanupError
|
|
6262
|
-
});
|
|
6263
|
-
});
|
|
6264
|
-
}
|
|
6265
|
-
return conversion.response;
|
|
6054
|
+
return await toRuntimeHttpResponse(response);
|
|
6266
6055
|
} finally {
|
|
6267
|
-
|
|
6268
|
-
|
|
6269
|
-
|
|
6270
|
-
);
|
|
6271
|
-
} finally {
|
|
6272
|
-
if (!cleanupDeferredToBody) {
|
|
6273
|
-
await cleanupRequest();
|
|
6274
|
-
}
|
|
6056
|
+
await (requestCtx == null ? void 0 : requestCtx.dispose());
|
|
6057
|
+
if (conn) {
|
|
6058
|
+
await runtime.connDisconnect(conn);
|
|
6275
6059
|
}
|
|
6276
6060
|
}
|
|
6277
6061
|
} catch (error2) {
|
|
@@ -6286,7 +6070,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
6286
6070
|
onWebSocket: typeof config.onWebSocket === "function" ? wrapNativeCallback(
|
|
6287
6071
|
async (error, payload) => {
|
|
6288
6072
|
const { ctx, conn, ws, request } = unwrapTsfnPayload(error, payload);
|
|
6289
|
-
const jsRequest = request ?
|
|
6073
|
+
const jsRequest = request ? buildRequest(request) : void 0;
|
|
6290
6074
|
const actorCtx = makeConnCtx(ctx, conn, jsRequest);
|
|
6291
6075
|
try {
|
|
6292
6076
|
await config.onWebSocket(
|
|
@@ -6383,7 +6167,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
6383
6167
|
timeoutMs,
|
|
6384
6168
|
cancelToken
|
|
6385
6169
|
} = unwrapTsfnPayload(error, payload);
|
|
6386
|
-
const jsRequest =
|
|
6170
|
+
const jsRequest = buildRequest(request);
|
|
6387
6171
|
const actorCtx = withConnContext(
|
|
6388
6172
|
runtime,
|
|
6389
6173
|
ctx,
|
|
@@ -6465,7 +6249,7 @@ async function buildServeConfig(config) {
|
|
|
6465
6249
|
poolName: config.envoy.poolName,
|
|
6466
6250
|
handleInspectorHttpInRuntime: true,
|
|
6467
6251
|
serverlessBasePath: config.serverless.basePath,
|
|
6468
|
-
serverlessPackageVersion:
|
|
6252
|
+
serverlessPackageVersion: _chunkZ2ESFE5Zcjs.VERSION,
|
|
6469
6253
|
serverlessClientEndpoint: config.publicEndpoint,
|
|
6470
6254
|
serverlessClientNamespace: config.publicNamespace,
|
|
6471
6255
|
serverlessClientToken: config.publicToken,
|
|
@@ -6478,19 +6262,19 @@ async function buildServeConfig(config) {
|
|
|
6478
6262
|
} catch (error) {
|
|
6479
6263
|
logger2().warn({
|
|
6480
6264
|
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",
|
|
6481
|
-
error:
|
|
6265
|
+
error: _chunkZ2ESFE5Zcjs.stringifyError.call(void 0, error)
|
|
6482
6266
|
});
|
|
6483
6267
|
}
|
|
6484
6268
|
serveConfig.engineHost = config.engineHost;
|
|
6485
6269
|
serveConfig.enginePort = config.enginePort;
|
|
6486
6270
|
if ((_a = config.test) == null ? void 0 : _a.enabled) {
|
|
6487
|
-
serveConfig.inspectorTestToken = _nullishCoalesce(
|
|
6271
|
+
serveConfig.inspectorTestToken = _nullishCoalesce(_chunkZ2ESFE5Zcjs.getEnvUniversal.call(void 0, "_RIVET_TEST_INSPECTOR_TOKEN"), () => ( "token"));
|
|
6488
6272
|
}
|
|
6489
6273
|
return serveConfig;
|
|
6490
6274
|
}
|
|
6491
6275
|
async function buildRegistryWithRuntime(config, runtime) {
|
|
6492
6276
|
var _a;
|
|
6493
|
-
if (((_a = config.test) == null ? void 0 : _a.enabled) &&
|
|
6277
|
+
if (((_a = config.test) == null ? void 0 : _a.enabled) && _chunkZ2ESFE5Zcjs.getEnvUniversal.call(void 0, "_RIVET_TEST_INSPECTOR_TOKEN") === void 0) {
|
|
6494
6278
|
trySetProcessEnv("_RIVET_TEST_INSPECTOR_TOKEN", "token");
|
|
6495
6279
|
}
|
|
6496
6280
|
if (runtime.kind === "napi") {
|
|
@@ -6534,54 +6318,6 @@ function finishShutdownSignal(signal) {
|
|
|
6534
6318
|
}
|
|
6535
6319
|
process.kill(process.pid, signal);
|
|
6536
6320
|
}
|
|
6537
|
-
function createApplicationFetch(application, runtime) {
|
|
6538
|
-
return async (request, responseBodyStream) => {
|
|
6539
|
-
const method2 = request.method.toUpperCase();
|
|
6540
|
-
const body = method2 === "GET" || method2 === "HEAD" || request.body.length === 0 ? void 0 : Uint8Array.from(request.body).buffer;
|
|
6541
|
-
const abortController = new AbortController();
|
|
6542
|
-
if (request.cancelToken) {
|
|
6543
|
-
if (runtime.cancellationTokenAborted(request.cancelToken)) {
|
|
6544
|
-
abortController.abort();
|
|
6545
|
-
} else {
|
|
6546
|
-
runtime.onCancellationTokenCancelled(
|
|
6547
|
-
request.cancelToken,
|
|
6548
|
-
() => abortController.abort()
|
|
6549
|
-
);
|
|
6550
|
-
}
|
|
6551
|
-
}
|
|
6552
|
-
const response = await application.fetch(
|
|
6553
|
-
new Request(request.url, {
|
|
6554
|
-
method: method2,
|
|
6555
|
-
headers: request.headers,
|
|
6556
|
-
body,
|
|
6557
|
-
signal: abortController.signal
|
|
6558
|
-
})
|
|
6559
|
-
);
|
|
6560
|
-
if (!_chunk5MJPN3QUcjs.isResponseLike.call(void 0, response)) {
|
|
6561
|
-
throw new TypeError(
|
|
6562
|
-
"registry.listen() application fetch must return a Response"
|
|
6563
|
-
);
|
|
6564
|
-
}
|
|
6565
|
-
const conversion = await convertNativeHttpResponse(
|
|
6566
|
-
response,
|
|
6567
|
-
responseBodyStream
|
|
6568
|
-
);
|
|
6569
|
-
if (conversion.bodyCompletion) {
|
|
6570
|
-
void conversion.bodyCompletion.catch((error) => {
|
|
6571
|
-
logger2().error({
|
|
6572
|
-
msg: "application response stream failed",
|
|
6573
|
-
error
|
|
6574
|
-
});
|
|
6575
|
-
});
|
|
6576
|
-
}
|
|
6577
|
-
return {
|
|
6578
|
-
status: _nullishCoalesce(conversion.response.status, () => ( response.status)),
|
|
6579
|
-
headers: _nullishCoalesce(conversion.response.headers, () => ( Object.fromEntries(response.headers.entries()))),
|
|
6580
|
-
body: conversion.response.body,
|
|
6581
|
-
stream: conversion.response.stream
|
|
6582
|
-
};
|
|
6583
|
-
};
|
|
6584
|
-
}
|
|
6585
6321
|
var Registry = class {
|
|
6586
6322
|
#config;
|
|
6587
6323
|
#buildConfiguredRegistry;
|
|
@@ -6597,7 +6333,6 @@ var Registry = class {
|
|
|
6597
6333
|
#runtimeReadyPromise;
|
|
6598
6334
|
#runtimeServeConfiguredPromise;
|
|
6599
6335
|
#runtimeServerlessPromise;
|
|
6600
|
-
#applicationListenerPromise;
|
|
6601
6336
|
#configureServerlessPoolPromise;
|
|
6602
6337
|
#welcomePrinted = false;
|
|
6603
6338
|
#shutdownInstalled = false;
|
|
@@ -6607,7 +6342,7 @@ var Registry = class {
|
|
|
6607
6342
|
var _a;
|
|
6608
6343
|
this.#config = config;
|
|
6609
6344
|
if ((_a = config.logging) == null ? void 0 : _a.baseLogger) {
|
|
6610
|
-
|
|
6345
|
+
_chunkZ2ESFE5Zcjs.configureBaseLogger.call(void 0, config.logging.baseLogger);
|
|
6611
6346
|
}
|
|
6612
6347
|
this.#buildConfiguredRegistry = _nullishCoalesce((deps == null ? void 0 : deps.buildConfiguredRegistry), () => ( buildConfiguredRegistry));
|
|
6613
6348
|
this.routes = {
|
|
@@ -6823,67 +6558,18 @@ var Registry = class {
|
|
|
6823
6558
|
* @param opts.host Address to bind. Defaults to `0.0.0.0`.
|
|
6824
6559
|
* @param opts.publicDir If set, serves static files from this directory
|
|
6825
6560
|
* as a fallback below the framework routes.
|
|
6826
|
-
* @param opts.application If set, handles requests that do not match a
|
|
6827
|
-
* framework route.
|
|
6828
6561
|
*
|
|
6829
6562
|
* @example
|
|
6830
6563
|
* ```ts
|
|
6831
6564
|
* await registry.listen();
|
|
6832
|
-
* await registry.listen({
|
|
6565
|
+
* await registry.listen({ port: 8080, publicDir: "./public" });
|
|
6833
6566
|
* ```
|
|
6834
6567
|
*/
|
|
6835
6568
|
async listen(opts = {}) {
|
|
6836
|
-
const port = _nullishCoalesce(_nullishCoalesce(opts.port, () => (
|
|
6837
|
-
const publicDir = _nullishCoalesce(opts.publicDir, () => (
|
|
6569
|
+
const port = _nullishCoalesce(_nullishCoalesce(opts.port, () => ( _chunkZ2ESFE5Zcjs.parsePortEnv.call(void 0, process.env.RIVET_PORT))), () => ( 3e3));
|
|
6570
|
+
const publicDir = _nullishCoalesce(opts.publicDir, () => ( _chunkZ2ESFE5Zcjs.getRivetkitPublicDir.call(void 0, )));
|
|
6838
6571
|
const config = this.parseConfig();
|
|
6839
|
-
|
|
6840
|
-
if (config.runtime === "wasm") {
|
|
6841
|
-
throw new Error(
|
|
6842
|
-
"registry.listen() requires the native runtime; use an application-owned HTTP server with WebAssembly"
|
|
6843
|
-
);
|
|
6844
|
-
}
|
|
6845
|
-
this.#installSignalHandlers(config);
|
|
6846
|
-
this.#printWelcome(config, "serverful", {
|
|
6847
|
-
port,
|
|
6848
|
-
host: opts.host,
|
|
6849
|
-
publicDir
|
|
6850
|
-
});
|
|
6851
|
-
this.#startEnvoy(config, true);
|
|
6852
|
-
const readyPromise = this.startAndWait();
|
|
6853
|
-
const configuredRegistryPromise2 = this.#runtimeServeConfiguredPromise;
|
|
6854
|
-
if (!configuredRegistryPromise2) {
|
|
6855
|
-
throw new Error("registry envoy startup did not initialize");
|
|
6856
|
-
}
|
|
6857
|
-
const { runtime: runtime2, registry: registry2, serveConfig: serveConfig2 } = await configuredRegistryPromise2;
|
|
6858
|
-
const application2 = createApplicationFetch(
|
|
6859
|
-
opts.application,
|
|
6860
|
-
runtime2
|
|
6861
|
-
);
|
|
6862
|
-
await readyPromise;
|
|
6863
|
-
const listenerPromise = runtime2.serveApplicationListener(
|
|
6864
|
-
registry2,
|
|
6865
|
-
{
|
|
6866
|
-
port,
|
|
6867
|
-
host: opts.host,
|
|
6868
|
-
publicDir,
|
|
6869
|
-
application: application2
|
|
6870
|
-
},
|
|
6871
|
-
serveConfig2
|
|
6872
|
-
);
|
|
6873
|
-
this.#applicationListenerPromise = listenerPromise;
|
|
6874
|
-
const serveLifecyclePromise = this.#runtimeServeLifecyclePromise;
|
|
6875
|
-
if (!serveLifecyclePromise) {
|
|
6876
|
-
throw new Error(
|
|
6877
|
-
"registry envoy serve lifecycle did not initialize"
|
|
6878
|
-
);
|
|
6879
|
-
}
|
|
6880
|
-
await Promise.all([
|
|
6881
|
-
listenerPromise,
|
|
6882
|
-
serveLifecyclePromise
|
|
6883
|
-
]);
|
|
6884
|
-
return;
|
|
6885
|
-
}
|
|
6886
|
-
const configuredRegistryPromise = this.#buildConfiguredRegistry(config);
|
|
6572
|
+
const configuredRegistryPromise = buildConfiguredRegistry(config);
|
|
6887
6573
|
this.#runtimeServeConfiguredPromise = configuredRegistryPromise;
|
|
6888
6574
|
this.#runtimeServerlessPromise = configuredRegistryPromise;
|
|
6889
6575
|
this.#installSignalHandlers(config);
|
|
@@ -6894,15 +6580,9 @@ var Registry = class {
|
|
|
6894
6580
|
});
|
|
6895
6581
|
this.#ensureServerlessPoolConfigured(config);
|
|
6896
6582
|
const { runtime, registry, serveConfig } = await configuredRegistryPromise;
|
|
6897
|
-
const application = opts.application ? createApplicationFetch(opts.application, runtime) : void 0;
|
|
6898
6583
|
await runtime.serveListener(
|
|
6899
6584
|
registry,
|
|
6900
|
-
{
|
|
6901
|
-
port,
|
|
6902
|
-
host: opts.host,
|
|
6903
|
-
publicDir,
|
|
6904
|
-
application
|
|
6905
|
-
},
|
|
6585
|
+
{ port, host: opts.host, publicDir },
|
|
6906
6586
|
serveConfig
|
|
6907
6587
|
);
|
|
6908
6588
|
}
|
|
@@ -6915,7 +6595,7 @@ var Registry = class {
|
|
|
6915
6595
|
return jsonRouteResponse(503, {
|
|
6916
6596
|
status: "not_started",
|
|
6917
6597
|
runtime: "rivetkit",
|
|
6918
|
-
version:
|
|
6598
|
+
version: _chunkZ2ESFE5Zcjs.VERSION
|
|
6919
6599
|
});
|
|
6920
6600
|
}
|
|
6921
6601
|
const { runtime, registry } = configured;
|
|
@@ -6923,7 +6603,7 @@ var Registry = class {
|
|
|
6923
6603
|
return jsonRouteResponse(501, {
|
|
6924
6604
|
status: "unsupported",
|
|
6925
6605
|
runtime: "rivetkit",
|
|
6926
|
-
version:
|
|
6606
|
+
version: _chunkZ2ESFE5Zcjs.VERSION
|
|
6927
6607
|
});
|
|
6928
6608
|
}
|
|
6929
6609
|
const response = await runtime.registryHealth(registry);
|
|
@@ -7002,9 +6682,11 @@ var Registry = class {
|
|
|
7002
6682
|
await runtime.serveRegistry(registry, serveConfig);
|
|
7003
6683
|
}
|
|
7004
6684
|
);
|
|
7005
|
-
this.#runtimeServePromise = this.#runtimeServeLifecyclePromise.catch(
|
|
7006
|
-
|
|
7007
|
-
|
|
6685
|
+
this.#runtimeServePromise = this.#runtimeServeLifecyclePromise.catch(
|
|
6686
|
+
(error) => {
|
|
6687
|
+
logger2().warn({ error }, "runtime registry serve errored");
|
|
6688
|
+
}
|
|
6689
|
+
);
|
|
7008
6690
|
this.#installSignalHandlers(config);
|
|
7009
6691
|
}
|
|
7010
6692
|
if (printWelcome) {
|
|
@@ -7111,9 +6793,6 @@ var Registry = class {
|
|
|
7111
6793
|
if (runtimeServePromise !== void 0) {
|
|
7112
6794
|
await runtimeServePromise.catch(() => void 0);
|
|
7113
6795
|
}
|
|
7114
|
-
if (this.#applicationListenerPromise !== void 0) {
|
|
7115
|
-
await this.#applicationListenerPromise.catch(() => void 0);
|
|
7116
|
-
}
|
|
7117
6796
|
};
|
|
7118
6797
|
await Promise.race([
|
|
7119
6798
|
drain(),
|
|
@@ -7164,13 +6843,11 @@ var Registry = class {
|
|
|
7164
6843
|
startAndWait() {
|
|
7165
6844
|
if (this.#shutdownInFlight !== null) {
|
|
7166
6845
|
return Promise.reject(
|
|
7167
|
-
new Error(
|
|
7168
|
-
"registry.startAndWait() cannot run after shutdown has begun"
|
|
7169
|
-
)
|
|
6846
|
+
new Error("registry.startAndWait() cannot run after shutdown has begun")
|
|
7170
6847
|
);
|
|
7171
6848
|
}
|
|
7172
6849
|
if (this.#runtimeReadyPromise) return this.#runtimeReadyPromise;
|
|
7173
|
-
if (
|
|
6850
|
+
if (_chunkZ2ESFE5Zcjs.getRivetkitRuntimeMode.call(void 0, ) === "serverless") {
|
|
7174
6851
|
return Promise.reject(
|
|
7175
6852
|
new Error(
|
|
7176
6853
|
"registry.startAndWait() requires envoy runtime mode; serverless registries become ready per request"
|
|
@@ -7207,9 +6884,7 @@ var Registry = class {
|
|
|
7207
6884
|
const readinessPromise = (async () => {
|
|
7208
6885
|
const { runtime, registry } = await configuredRegistryPromise;
|
|
7209
6886
|
const stoppedBeforeReady = serveLifecyclePromise.then(() => {
|
|
7210
|
-
throw new Error(
|
|
7211
|
-
"RivetKit registry stopped before becoming ready"
|
|
7212
|
-
);
|
|
6887
|
+
throw new Error("RivetKit registry stopped before becoming ready");
|
|
7213
6888
|
});
|
|
7214
6889
|
await Promise.race([
|
|
7215
6890
|
runtime.waitRegistryReady(registry),
|
|
@@ -7240,8 +6915,8 @@ var Registry = class {
|
|
|
7240
6915
|
* ```
|
|
7241
6916
|
*/
|
|
7242
6917
|
start() {
|
|
7243
|
-
if (
|
|
7244
|
-
const publicDir = _nullishCoalesce(
|
|
6918
|
+
if (_chunkZ2ESFE5Zcjs.getRivetkitRuntimeMode.call(void 0, ) === "serverless") {
|
|
6919
|
+
const publicDir = _nullishCoalesce(_chunkZ2ESFE5Zcjs.getRivetkitPublicDir.call(void 0, ), () => ( "/public"));
|
|
7245
6920
|
this.listen({ publicDir }).catch((error) => {
|
|
7246
6921
|
logger2().error({ error }, "auto-listen failed; exiting");
|
|
7247
6922
|
if (typeof process !== "undefined" && typeof process.exit === "function") {
|
|
@@ -7262,7 +6937,7 @@ var Registry = class {
|
|
|
7262
6937
|
};
|
|
7263
6938
|
console.log();
|
|
7264
6939
|
console.log(
|
|
7265
|
-
` RivetKit ${
|
|
6940
|
+
` RivetKit ${_chunkZ2ESFE5Zcjs.VERSION} (Engine - ${kind === "serverless" ? "Serverless" : "Serverful"})`
|
|
7266
6941
|
);
|
|
7267
6942
|
if (config.namespace !== "default") {
|
|
7268
6943
|
logLine("Namespace", config.namespace);
|
|
@@ -7337,5 +7012,5 @@ function setup(input) {
|
|
|
7337
7012
|
|
|
7338
7013
|
|
|
7339
7014
|
|
|
7340
|
-
exports.ALLOWED_PUBLIC_HEADERS =
|
|
7015
|
+
exports.ALLOWED_PUBLIC_HEADERS = _chunkLCWHS6K7cjs.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 = _chunkLCWHS6K7cjs.createClientWithDriver; exports.event = event; exports.isStaticActorDefinition = isStaticActorDefinition; exports.isStaticActorInstance = isStaticActorInstance; exports.lookupInRegistry = lookupInRegistry; exports.noopNext = _chunkZ2ESFE5Zcjs.noopNext; exports.queue = queue; exports.setup = setup; exports.toUint8Array = _chunkZ2ESFE5Zcjs.toUint8Array;
|
|
7341
7016
|
//# sourceMappingURL=mod.cjs.map
|