rivetkit 2.3.10 → 2.3.11-rc.2
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 +24 -6
- package/dist/browser/client.js +20 -5
- 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 +24 -6
- package/dist/tsup/agent-os/index.d.ts +24 -6
- package/dist/tsup/agent-os/index.js +1 -1
- package/dist/tsup/agent-os/index.js.map +1 -1
- package/dist/tsup/{chunk-LCWHS6K7.cjs → chunk-3NPCXMJS.cjs} +158 -142
- package/dist/tsup/chunk-3NPCXMJS.cjs.map +1 -0
- package/dist/tsup/{chunk-Z2ESFE5Z.cjs → chunk-5SHK4JM5.cjs} +6 -3
- package/dist/tsup/chunk-5SHK4JM5.cjs.map +1 -0
- package/dist/tsup/{chunk-E6IEX6AP.js → chunk-75K5VACB.js} +3 -3
- package/dist/tsup/{chunk-G6XA2OSW.cjs → chunk-7TVKYMD3.cjs} +4 -4
- package/dist/tsup/{chunk-G6XA2OSW.cjs.map → chunk-7TVKYMD3.cjs.map} +1 -1
- package/dist/tsup/{chunk-U2A3Y7OK.cjs → chunk-J4RT6EFK.cjs} +9 -9
- package/dist/tsup/{chunk-U2A3Y7OK.cjs.map → chunk-J4RT6EFK.cjs.map} +1 -1
- package/dist/tsup/{chunk-6UHZLL6S.js → chunk-KHSNHG4G.js} +3 -3
- package/dist/tsup/{chunk-INXPYXN6.cjs → chunk-LPGJPAVY.cjs} +7 -7
- package/dist/tsup/{chunk-INXPYXN6.cjs.map → chunk-LPGJPAVY.cjs.map} +1 -1
- package/dist/tsup/{chunk-XSPAARQ5.js → chunk-NLAW2MIM.js} +2 -2
- package/dist/tsup/{chunk-PCJSDS7N.cjs → chunk-NRRWLN6D.cjs} +3 -3
- package/dist/tsup/{chunk-PCJSDS7N.cjs.map → chunk-NRRWLN6D.cjs.map} +1 -1
- package/dist/tsup/{chunk-Q5H37KNQ.js → chunk-RVJQMOAA.js} +2 -2
- package/dist/tsup/{chunk-DPM73GAL.js → chunk-XR2KF2ZA.js} +22 -6
- package/dist/tsup/chunk-XR2KF2ZA.js.map +1 -0
- package/dist/tsup/{chunk-X7XY6NCU.js → chunk-XWIXH7JF.js} +6 -3
- package/dist/tsup/chunk-XWIXH7JF.js.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-BRpVbJCD.d.ts → config-BKAMOHez.d.ts} +25 -7
- package/dist/tsup/{config-BobvQpex.d.cts → config-Caocy3Z9.d.cts} +25 -7
- package/dist/tsup/{context-Cj-DFyiy.d.ts → context-AfCExwbr.d.ts} +1 -1
- package/dist/tsup/{context-YEBNJrws.d.cts → context-D1_m5x1D.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 +187 -72
- 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 +129 -14
- 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-conn.ts +1 -1
- package/src/client/raw-utils.ts +3 -2
- package/src/common/encoding.ts +4 -1
- package/src/common/fetch-like.ts +49 -0
- package/src/registry/index.ts +117 -12
- package/src/registry/napi-runtime.ts +47 -0
- package/src/registry/native.ts +3 -2
- package/src/registry/runtime.ts +21 -0
- package/src/registry/wasm-runtime.ts +11 -0
- package/dist/tsup/chunk-DPM73GAL.js.map +0 -1
- package/dist/tsup/chunk-LCWHS6K7.cjs.map +0 -1
- package/dist/tsup/chunk-X7XY6NCU.js.map +0 -1
- package/dist/tsup/chunk-Z2ESFE5Z.cjs.map +0 -1
- /package/dist/tsup/{chunk-E6IEX6AP.js.map → chunk-75K5VACB.js.map} +0 -0
- /package/dist/tsup/{chunk-6UHZLL6S.js.map → chunk-KHSNHG4G.js.map} +0 -0
- /package/dist/tsup/{chunk-XSPAARQ5.js.map → chunk-NLAW2MIM.js.map} +0 -0
- /package/dist/tsup/{chunk-Q5H37KNQ.js.map → chunk-RVJQMOAA.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 _chunk7TVKYMD3cjs = require('./chunk-7TVKYMD3.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -22,13 +22,14 @@ var _chunkHNHLBM3Ycjs = require('./chunk-HNHLBM3Y.cjs');
|
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
|
|
26
|
+
var _chunk3NPCXMJScjs = require('./chunk-3NPCXMJS.cjs');
|
|
26
27
|
|
|
27
28
|
|
|
28
29
|
|
|
29
30
|
var _chunkMYWZCDMLcjs = require('./chunk-MYWZCDML.cjs');
|
|
30
31
|
require('./chunk-UEULFXUI.cjs');
|
|
31
|
-
require('./chunk-
|
|
32
|
+
require('./chunk-NRRWLN6D.cjs');
|
|
32
33
|
|
|
33
34
|
|
|
34
35
|
|
|
@@ -61,7 +62,7 @@ require('./chunk-PCJSDS7N.cjs');
|
|
|
61
62
|
|
|
62
63
|
|
|
63
64
|
|
|
64
|
-
var
|
|
65
|
+
var _chunk5SHK4JM5cjs = require('./chunk-5SHK4JM5.cjs');
|
|
65
66
|
|
|
66
67
|
|
|
67
68
|
|
|
@@ -77,7 +78,7 @@ var _chunk4FC7TVS6cjs = require('./chunk-4FC7TVS6.cjs');
|
|
|
77
78
|
|
|
78
79
|
// src/actor/log.ts
|
|
79
80
|
function loggerWithoutContext() {
|
|
80
|
-
return
|
|
81
|
+
return _chunk5SHK4JM5cjs.getLogger.call(void 0, "actor-runtime");
|
|
81
82
|
}
|
|
82
83
|
|
|
83
84
|
// src/actor/definition.ts
|
|
@@ -217,7 +218,7 @@ function validateSchemaSync(schemas, key, data) {
|
|
|
217
218
|
var _virtualwebsocket = require('@rivetkit/virtual-websocket');
|
|
218
219
|
var _ws = require('hono/ws');
|
|
219
220
|
function logger() {
|
|
220
|
-
return
|
|
221
|
+
return _chunk5SHK4JM5cjs.getLogger.call(void 0, "inline-websocket-adapter");
|
|
221
222
|
}
|
|
222
223
|
var InlineWebSocketAdapter = class {
|
|
223
224
|
#handler;
|
|
@@ -388,7 +389,7 @@ function isLocalEngineEndpoint(endpoint) {
|
|
|
388
389
|
|
|
389
390
|
// src/registry/log.ts
|
|
390
391
|
function logger2() {
|
|
391
|
-
return
|
|
392
|
+
return _chunk5SHK4JM5cjs.getLogger.call(void 0, "registry");
|
|
392
393
|
}
|
|
393
394
|
|
|
394
395
|
// src/serverless/configure.ts
|
|
@@ -434,8 +435,8 @@ async function configureServerlessPool(config) {
|
|
|
434
435
|
);
|
|
435
436
|
}
|
|
436
437
|
const customConfig = config.configurePool;
|
|
437
|
-
const clientConfig =
|
|
438
|
-
const dcsRes = await
|
|
438
|
+
const clientConfig = _chunk3NPCXMJScjs.convertRegistryConfigToClientConfig.call(void 0, config);
|
|
439
|
+
const dcsRes = await _chunk3NPCXMJScjs.getDatacenters.call(void 0, clientConfig);
|
|
439
440
|
const poolName = _nullishCoalesce(customConfig.name, () => ( "default"));
|
|
440
441
|
const serverlessToken = _nullishCoalesce(config.token, () => ( config.publicToken));
|
|
441
442
|
const headers = {
|
|
@@ -457,7 +458,7 @@ async function configureServerlessPool(config) {
|
|
|
457
458
|
metadata: _nullishCoalesce(customConfig.metadata, () => ( {})),
|
|
458
459
|
drain_on_version_upgrade: _nullishCoalesce(customConfig.drainOnVersionUpgrade, () => ( true))
|
|
459
460
|
};
|
|
460
|
-
await
|
|
461
|
+
await _chunk3NPCXMJScjs.updateRunnerConfig.call(void 0, clientConfig, poolName, {
|
|
461
462
|
datacenters: Object.fromEntries(
|
|
462
463
|
dcsRes.datacenters.map((dc) => [dc.name, serverlessConfig])
|
|
463
464
|
)
|
|
@@ -474,7 +475,7 @@ async function configureServerlessPool(config) {
|
|
|
474
475
|
logger2().warn({
|
|
475
476
|
msg: "serverless pool configuration attempt failed",
|
|
476
477
|
attempts,
|
|
477
|
-
error:
|
|
478
|
+
error: _chunk5SHK4JM5cjs.stringifyError.call(void 0, error)
|
|
478
479
|
});
|
|
479
480
|
await sleep(CONFIGURE_RETRY_DELAY_MS);
|
|
480
481
|
}
|
|
@@ -482,7 +483,7 @@ async function configureServerlessPool(config) {
|
|
|
482
483
|
logger2().error({
|
|
483
484
|
msg: "failed to configure serverless pool, validate endpoint is configured correctly then restart this process",
|
|
484
485
|
attempts,
|
|
485
|
-
error:
|
|
486
|
+
error: _chunk5SHK4JM5cjs.stringifyError.call(void 0, lastError)
|
|
486
487
|
});
|
|
487
488
|
throw lastError;
|
|
488
489
|
}
|
|
@@ -494,20 +495,20 @@ var _zod = require('zod');
|
|
|
494
495
|
var _v4 = require('zod/v4');
|
|
495
496
|
var warnedMissingVersion = false;
|
|
496
497
|
var EnvoyConfigSchema = _v4.z.object({
|
|
497
|
-
poolName: _v4.z.string().default(() => _nullishCoalesce(
|
|
498
|
+
poolName: _v4.z.string().default(() => _nullishCoalesce(_chunk5SHK4JM5cjs.getRivetPool.call(void 0, ), () => ( "default"))),
|
|
498
499
|
version: _v4.z.number().default(() => {
|
|
499
|
-
const version =
|
|
500
|
+
const version = _chunk5SHK4JM5cjs.getRivetEnvoyVersion.call(void 0, );
|
|
500
501
|
if (version !== void 0) return version;
|
|
501
|
-
if (
|
|
502
|
+
if (_chunk5SHK4JM5cjs.getNodeEnv.call(void 0, ) === "production" && !warnedMissingVersion) {
|
|
502
503
|
warnedMissingVersion = true;
|
|
503
|
-
|
|
504
|
+
_chunk5SHK4JM5cjs.getLogger.call(void 0, "rivetkit").error(
|
|
504
505
|
"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"
|
|
505
506
|
);
|
|
506
507
|
}
|
|
507
508
|
return 1;
|
|
508
509
|
}),
|
|
509
510
|
// Deprecated.
|
|
510
|
-
totalSlots: _v4.z.number().default(() => _nullishCoalesce(
|
|
511
|
+
totalSlots: _v4.z.number().default(() => _nullishCoalesce(_chunk5SHK4JM5cjs.getRivetTotalSlots.call(void 0, ), () => ( 1e5))),
|
|
511
512
|
envoyKey: _v4.z.string().optional()
|
|
512
513
|
});
|
|
513
514
|
|
|
@@ -545,7 +546,7 @@ var ServerlessConfigSchema = _v4.z.object({
|
|
|
545
546
|
*
|
|
546
547
|
* Can also be set via RIVET_PUBLIC_ENDPOINT environment variable.
|
|
547
548
|
*/
|
|
548
|
-
publicEndpoint: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => (
|
|
549
|
+
publicEndpoint: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunk5SHK4JM5cjs.getRivetPublicEndpoint.call(void 0, )))),
|
|
549
550
|
/**
|
|
550
551
|
* Token that clients should use when connecting via the public endpoint.
|
|
551
552
|
*
|
|
@@ -553,7 +554,7 @@ var ServerlessConfigSchema = _v4.z.object({
|
|
|
553
554
|
*
|
|
554
555
|
* Can also be specified in the publicEndpoint URL as `https://namespace:token@host`.
|
|
555
556
|
*/
|
|
556
|
-
publicToken: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => (
|
|
557
|
+
publicToken: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunk5SHK4JM5cjs.getRivetPublicToken.call(void 0, ))))
|
|
557
558
|
// There is no publicNamespace config option because the frontend and backend
|
|
558
559
|
// cannot use different namespaces. The namespace is extracted from the
|
|
559
560
|
// publicEndpoint URL auth syntax if provided.
|
|
@@ -607,7 +608,7 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
607
608
|
* Runtime binding to use for RivetKit core.
|
|
608
609
|
* */
|
|
609
610
|
runtime: RuntimeKindSchema.optional().transform((val, ctx) => {
|
|
610
|
-
const rawRuntime = _nullishCoalesce(val, () => (
|
|
611
|
+
const rawRuntime = _nullishCoalesce(val, () => ( _chunk5SHK4JM5cjs.getRivetkitRuntime.call(void 0, )));
|
|
611
612
|
if (rawRuntime === void 0) {
|
|
612
613
|
return "auto";
|
|
613
614
|
}
|
|
@@ -644,7 +645,7 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
644
645
|
* */
|
|
645
646
|
logging: _zod.z.object({
|
|
646
647
|
baseLogger: _zod.z.custom().optional(),
|
|
647
|
-
level:
|
|
648
|
+
level: _chunk5SHK4JM5cjs.LogLevelSchema.optional()
|
|
648
649
|
}).optional().default(() => ({})),
|
|
649
650
|
// MARK: Routing
|
|
650
651
|
// // This is a function to allow for lazy configuration of upgradeWebSocket on the
|
|
@@ -662,9 +663,9 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
662
663
|
*
|
|
663
664
|
* Can also be set via RIVET_ENDPOINT environment variables.
|
|
664
665
|
*/
|
|
665
|
-
endpoint: _zod.z.string().optional().transform((val) => _nullishCoalesce(_nullishCoalesce(val, () => (
|
|
666
|
-
token: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => (
|
|
667
|
-
namespace: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => (
|
|
666
|
+
endpoint: _zod.z.string().optional().transform((val) => _nullishCoalesce(_nullishCoalesce(val, () => ( _chunk5SHK4JM5cjs.getRivetEngine.call(void 0, ))), () => ( _chunk5SHK4JM5cjs.getRivetEndpoint.call(void 0, )))),
|
|
667
|
+
token: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunk5SHK4JM5cjs.getRivetToken.call(void 0, )))),
|
|
668
|
+
namespace: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunk5SHK4JM5cjs.getRivetNamespace.call(void 0, )))),
|
|
668
669
|
headers: _zod.z.record(_zod.z.string(), _zod.z.string()).optional().default({}),
|
|
669
670
|
// MARK: Client
|
|
670
671
|
// TODO:
|
|
@@ -704,21 +705,21 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
704
705
|
*
|
|
705
706
|
* Starts the full Rust engine process locally.
|
|
706
707
|
*/
|
|
707
|
-
startEngine: _zod.z.boolean().default(() =>
|
|
708
|
+
startEngine: _zod.z.boolean().default(() => _chunk5SHK4JM5cjs.getRivetRunEngine.call(void 0, )),
|
|
708
709
|
/**
|
|
709
710
|
* @experimental
|
|
710
711
|
*
|
|
711
712
|
* Host to bind the spawned local engine process to.
|
|
712
713
|
*/
|
|
713
|
-
engineHost: _zod.z.string().optional().default(() => _nullishCoalesce(
|
|
714
|
+
engineHost: _zod.z.string().optional().default(() => _nullishCoalesce(_chunk5SHK4JM5cjs.getRivetRunEngineHost.call(void 0, ), () => ( ENGINE_HOST))),
|
|
714
715
|
/**
|
|
715
716
|
* @experimental
|
|
716
717
|
*
|
|
717
718
|
* Port to bind the spawned local engine process to.
|
|
718
719
|
*/
|
|
719
|
-
enginePort: _zod.z.number().int().min(1).max(65535).optional().default(() => _nullishCoalesce(
|
|
720
|
+
enginePort: _zod.z.number().int().min(1).max(65535).optional().default(() => _nullishCoalesce(_chunk5SHK4JM5cjs.getRivetRunEnginePort.call(void 0, ), () => ( ENGINE_PORT))),
|
|
720
721
|
/** @experimental */
|
|
721
|
-
engineVersion: _zod.z.string().optional().default(() => _nullishCoalesce(
|
|
722
|
+
engineVersion: _zod.z.string().optional().default(() => _nullishCoalesce(_chunk5SHK4JM5cjs.getRivetRunEngineVersion.call(void 0, ), () => ( _chunk5SHK4JM5cjs.VERSION))),
|
|
722
723
|
/**
|
|
723
724
|
* @experimental
|
|
724
725
|
*
|
|
@@ -766,7 +767,7 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
766
767
|
}))
|
|
767
768
|
}).transform((config, ctx) => {
|
|
768
769
|
var _a, _b, _c;
|
|
769
|
-
const isDevEnv =
|
|
770
|
+
const isDevEnv = _chunk5SHK4JM5cjs.isDev.call(void 0, );
|
|
770
771
|
const sqliteBackend = _nullishCoalesce(((_a = config.sqlite) == null ? void 0 : _a.backend), () => ( ((_b = config.test) == null ? void 0 : _b.sqliteBackend)));
|
|
771
772
|
if (config.runtime === "wasm" && sqliteBackend === "local") {
|
|
772
773
|
ctx.addIssue({
|
|
@@ -776,7 +777,7 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
776
777
|
});
|
|
777
778
|
}
|
|
778
779
|
const sqlite = config.runtime === "wasm" && config.sqlite === void 0 ? { backend: "remote" } : config.sqlite;
|
|
779
|
-
const parsedEndpoint = config.endpoint ?
|
|
780
|
+
const parsedEndpoint = config.endpoint ? _chunk3NPCXMJScjs.tryParseEndpoint.call(void 0, ctx, {
|
|
780
781
|
endpoint: config.endpoint,
|
|
781
782
|
path: ["endpoint"],
|
|
782
783
|
namespace: config.namespace,
|
|
@@ -804,7 +805,7 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
804
805
|
);
|
|
805
806
|
const namespace = _nullishCoalesce(_nullishCoalesce((parsedEndpoint == null ? void 0 : parsedEndpoint.namespace), () => ( config.namespace)), () => ( "default"));
|
|
806
807
|
const token = _nullishCoalesce((parsedEndpoint == null ? void 0 : parsedEndpoint.token), () => ( config.token));
|
|
807
|
-
const parsedPublicEndpoint = config.serverless.publicEndpoint ?
|
|
808
|
+
const parsedPublicEndpoint = config.serverless.publicEndpoint ? _chunk3NPCXMJScjs.tryParseEndpoint.call(void 0, ctx, {
|
|
808
809
|
endpoint: config.serverless.publicEndpoint,
|
|
809
810
|
path: ["serverless", "publicEndpoint"]
|
|
810
811
|
}) : void 0;
|
|
@@ -907,7 +908,7 @@ var DocRegistryConfigSchema = _zod.z.object({
|
|
|
907
908
|
noWelcome: _zod.z.boolean().optional().describe("Disable the welcome message on startup. Default: false"),
|
|
908
909
|
sqlite: DocSqliteConfigSchema,
|
|
909
910
|
logging: _zod.z.object({
|
|
910
|
-
level:
|
|
911
|
+
level: _chunk5SHK4JM5cjs.LogLevelSchema.optional().describe(
|
|
911
912
|
"Log level for RivetKit. Default: 'warn'"
|
|
912
913
|
)
|
|
913
914
|
}).optional().describe("Logging configuration."),
|
|
@@ -1433,6 +1434,22 @@ function toNapiSqlBatchStatement(statement) {
|
|
|
1433
1434
|
function toNapiBuffer(value) {
|
|
1434
1435
|
return Buffer.from(value);
|
|
1435
1436
|
}
|
|
1437
|
+
function toNapiApplication(application) {
|
|
1438
|
+
return async (error, request) => {
|
|
1439
|
+
if (error) throw error;
|
|
1440
|
+
if (!request) {
|
|
1441
|
+
throw new Error("application fetch callback received no request");
|
|
1442
|
+
}
|
|
1443
|
+
const response = await application({
|
|
1444
|
+
...request,
|
|
1445
|
+
body: new Uint8Array(request.body)
|
|
1446
|
+
});
|
|
1447
|
+
return {
|
|
1448
|
+
...response,
|
|
1449
|
+
body: toNapiBuffer(response.body)
|
|
1450
|
+
};
|
|
1451
|
+
};
|
|
1452
|
+
}
|
|
1436
1453
|
function toNapiHttpRequest(request) {
|
|
1437
1454
|
if (!request) {
|
|
1438
1455
|
return request;
|
|
@@ -1539,12 +1556,25 @@ var NapiCoreRuntime = (_class = class {
|
|
|
1539
1556
|
);
|
|
1540
1557
|
}
|
|
1541
1558
|
async serveListener(registry, listener, config) {
|
|
1559
|
+
const application = listener.application ? toNapiApplication(listener.application) : void 0;
|
|
1542
1560
|
await asNativeRegistry(registry).serveListener(
|
|
1543
1561
|
{
|
|
1544
1562
|
port: listener.port,
|
|
1545
1563
|
host: listener.host,
|
|
1546
1564
|
publicDir: listener.publicDir
|
|
1547
1565
|
},
|
|
1566
|
+
config,
|
|
1567
|
+
application
|
|
1568
|
+
);
|
|
1569
|
+
}
|
|
1570
|
+
async serveApplicationListener(registry, listener, config) {
|
|
1571
|
+
await asNativeRegistry(registry).serveApplicationListener(
|
|
1572
|
+
{
|
|
1573
|
+
port: listener.port,
|
|
1574
|
+
host: listener.host,
|
|
1575
|
+
publicDir: listener.publicDir
|
|
1576
|
+
},
|
|
1577
|
+
toNapiApplication(listener.application),
|
|
1548
1578
|
config
|
|
1549
1579
|
);
|
|
1550
1580
|
}
|
|
@@ -2204,6 +2234,11 @@ var WasmCoreRuntime = (_class2 = class {
|
|
|
2204
2234
|
"registry.listen() is not supported on the wasm runtime; use registry.serve() and mount the handler in your platform's HTTP server instead"
|
|
2205
2235
|
);
|
|
2206
2236
|
}
|
|
2237
|
+
async serveApplicationListener(_registry, _listener, _config) {
|
|
2238
|
+
throw new Error(
|
|
2239
|
+
"registry.listen() is not supported on the wasm runtime; use an application-owned HTTP server instead"
|
|
2240
|
+
);
|
|
2241
|
+
}
|
|
2207
2242
|
createActorFactory(callbacks, config) {
|
|
2208
2243
|
return callWasmSync(
|
|
2209
2244
|
() => asActorFactoryHandle2(
|
|
@@ -2984,7 +3019,7 @@ async function cleanupNativeSleepRuntimeState(runtime, ctx, afterTrackedWorkDrai
|
|
|
2984
3019
|
}).catch((error) => {
|
|
2985
3020
|
logger2().warn({
|
|
2986
3021
|
msg: "deferred native sleep cleanup failed",
|
|
2987
|
-
error:
|
|
3022
|
+
error: _chunk5SHK4JM5cjs.stringifyError.call(void 0, error)
|
|
2988
3023
|
});
|
|
2989
3024
|
});
|
|
2990
3025
|
return;
|
|
@@ -3111,10 +3146,10 @@ function decodeValue(value) {
|
|
|
3111
3146
|
if (!value || value.length === 0) {
|
|
3112
3147
|
return void 0;
|
|
3113
3148
|
}
|
|
3114
|
-
return
|
|
3149
|
+
return _chunk5SHK4JM5cjs.decodeCborCompat.call(void 0, value);
|
|
3115
3150
|
}
|
|
3116
3151
|
function encodeValue(value) {
|
|
3117
|
-
return
|
|
3152
|
+
return _chunk5SHK4JM5cjs.encodeCborCompat.call(void 0, value);
|
|
3118
3153
|
}
|
|
3119
3154
|
function normalizeArgs(value) {
|
|
3120
3155
|
return Array.isArray(value) ? value : value === void 0 || value === null ? [] : [value];
|
|
@@ -3150,7 +3185,7 @@ function isStructuredBridgeError(error) {
|
|
|
3150
3185
|
return _chunk4FC7TVS6cjs.isRivetErrorLike.call(void 0, error) && "__type" in error && (error.__type === "RivetError" || error.__type === "ActorError");
|
|
3151
3186
|
}
|
|
3152
3187
|
function encodeNativeCallbackError(error) {
|
|
3153
|
-
const structuredError = isStructuredBridgeError(error) ? error :
|
|
3188
|
+
const structuredError = isStructuredBridgeError(error) ? error : _chunk5SHK4JM5cjs.deconstructError.call(void 0, error, true);
|
|
3154
3189
|
const bridgeError = new Error(_chunk4FC7TVS6cjs.encodeBridgeRivetError.call(void 0, structuredError), {
|
|
3155
3190
|
cause: error instanceof Error ? error : void 0
|
|
3156
3191
|
});
|
|
@@ -3200,7 +3235,7 @@ function decodeWorkflowCbor(data) {
|
|
|
3200
3235
|
return null;
|
|
3201
3236
|
}
|
|
3202
3237
|
try {
|
|
3203
|
-
return
|
|
3238
|
+
return _chunk5SHK4JM5cjs.decodeCborCompat.call(void 0, new Uint8Array(data));
|
|
3204
3239
|
} catch (e5) {
|
|
3205
3240
|
return null;
|
|
3206
3241
|
}
|
|
@@ -3313,7 +3348,7 @@ function serializeWorkflowHistoryForJson(data) {
|
|
|
3313
3348
|
if (data === null) {
|
|
3314
3349
|
return null;
|
|
3315
3350
|
}
|
|
3316
|
-
const history =
|
|
3351
|
+
const history = _chunk7TVKYMD3cjs.decodeWorkflowHistoryTransport.call(void 0, data);
|
|
3317
3352
|
return jsonSafe({
|
|
3318
3353
|
nameRegistry: [...history.nameRegistry],
|
|
3319
3354
|
entries: history.entries.map((entry) => ({
|
|
@@ -3454,12 +3489,12 @@ var NativeConnAdapter = class {
|
|
|
3454
3489
|
this.#writeState(nextValue, { writeNative: true });
|
|
3455
3490
|
},
|
|
3456
3491
|
(newValue) => {
|
|
3457
|
-
|
|
3492
|
+
_chunk5SHK4JM5cjs.assertJsonCompatValue.call(void 0, newValue);
|
|
3458
3493
|
}
|
|
3459
3494
|
);
|
|
3460
3495
|
}
|
|
3461
3496
|
set state(value) {
|
|
3462
|
-
|
|
3497
|
+
_chunk5SHK4JM5cjs.assertJsonCompatValue.call(void 0, value);
|
|
3463
3498
|
this.#writeState(value, { writeNative: true });
|
|
3464
3499
|
}
|
|
3465
3500
|
initializeState(value) {
|
|
@@ -4505,7 +4540,7 @@ var ActorContextHandleAdapter = class {
|
|
|
4505
4540
|
},
|
|
4506
4541
|
(newValue) => {
|
|
4507
4542
|
this.#assertCanMutateState();
|
|
4508
|
-
|
|
4543
|
+
_chunk5SHK4JM5cjs.assertJsonCompatValue.call(void 0, newValue);
|
|
4509
4544
|
}
|
|
4510
4545
|
);
|
|
4511
4546
|
}
|
|
@@ -4516,7 +4551,7 @@ var ActorContextHandleAdapter = class {
|
|
|
4516
4551
|
throw stateNotEnabledError();
|
|
4517
4552
|
}
|
|
4518
4553
|
this.#assertCanMutateState();
|
|
4519
|
-
|
|
4554
|
+
_chunk5SHK4JM5cjs.assertJsonCompatValue.call(void 0, value);
|
|
4520
4555
|
this.#writeState(value, { scheduleSave: true });
|
|
4521
4556
|
}
|
|
4522
4557
|
initializeState(value) {
|
|
@@ -4792,7 +4827,7 @@ var ActorContextHandleAdapter = class {
|
|
|
4792
4827
|
const trackedPromise = Promise.resolve(promise).catch((error) => {
|
|
4793
4828
|
logger2().warn({
|
|
4794
4829
|
msg: "keepAwake promise rejected",
|
|
4795
|
-
error:
|
|
4830
|
+
error: _chunk5SHK4JM5cjs.stringifyError.call(void 0, error)
|
|
4796
4831
|
});
|
|
4797
4832
|
}).then(() => null);
|
|
4798
4833
|
try {
|
|
@@ -5254,9 +5289,9 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
5254
5289
|
events: config.events,
|
|
5255
5290
|
queues: config.queues
|
|
5256
5291
|
};
|
|
5257
|
-
const createClient = () =>
|
|
5258
|
-
new (0,
|
|
5259
|
-
|
|
5292
|
+
const createClient = () => _chunk3NPCXMJScjs.createClientWithDriver.call(void 0,
|
|
5293
|
+
new (0, _chunk3NPCXMJScjs.RemoteEngineControlClient)(
|
|
5294
|
+
_chunk3NPCXMJScjs.convertRegistryConfigToClientConfig.call(void 0, registryConfig)
|
|
5260
5295
|
),
|
|
5261
5296
|
{ encoding: "bare" }
|
|
5262
5297
|
);
|
|
@@ -5439,7 +5474,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
5439
5474
|
400
|
|
5440
5475
|
);
|
|
5441
5476
|
}
|
|
5442
|
-
const cbor =
|
|
5477
|
+
const cbor = _chunk5SHK4JM5cjs.encodeCborCompat.call(void 0,
|
|
5443
5478
|
_nullishCoalesce(body.body, () => ( null))
|
|
5444
5479
|
);
|
|
5445
5480
|
const message = await runtime.actorQueueSend(ctx, name, cbor);
|
|
@@ -6021,7 +6056,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
6021
6056
|
new Response(null, { status: 404 })
|
|
6022
6057
|
);
|
|
6023
6058
|
}
|
|
6024
|
-
const rawConnParams = jsRequest.headers.get(
|
|
6059
|
+
const rawConnParams = jsRequest.headers.get(_chunk3NPCXMJScjs.HEADER_CONN_PARAMS);
|
|
6025
6060
|
let requestCtx;
|
|
6026
6061
|
let conn;
|
|
6027
6062
|
try {
|
|
@@ -6046,7 +6081,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
6046
6081
|
requestCtx,
|
|
6047
6082
|
jsRequest
|
|
6048
6083
|
);
|
|
6049
|
-
if (!(
|
|
6084
|
+
if (!_chunk3NPCXMJScjs.isResponseLike.call(void 0, response)) {
|
|
6050
6085
|
throw new Error(
|
|
6051
6086
|
"onRequest handler must return a Response"
|
|
6052
6087
|
);
|
|
@@ -6249,7 +6284,7 @@ async function buildServeConfig(config) {
|
|
|
6249
6284
|
poolName: config.envoy.poolName,
|
|
6250
6285
|
handleInspectorHttpInRuntime: true,
|
|
6251
6286
|
serverlessBasePath: config.serverless.basePath,
|
|
6252
|
-
serverlessPackageVersion:
|
|
6287
|
+
serverlessPackageVersion: _chunk5SHK4JM5cjs.VERSION,
|
|
6253
6288
|
serverlessClientEndpoint: config.publicEndpoint,
|
|
6254
6289
|
serverlessClientNamespace: config.publicNamespace,
|
|
6255
6290
|
serverlessClientToken: config.publicToken,
|
|
@@ -6262,19 +6297,19 @@ async function buildServeConfig(config) {
|
|
|
6262
6297
|
} catch (error) {
|
|
6263
6298
|
logger2().warn({
|
|
6264
6299
|
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",
|
|
6265
|
-
error:
|
|
6300
|
+
error: _chunk5SHK4JM5cjs.stringifyError.call(void 0, error)
|
|
6266
6301
|
});
|
|
6267
6302
|
}
|
|
6268
6303
|
serveConfig.engineHost = config.engineHost;
|
|
6269
6304
|
serveConfig.enginePort = config.enginePort;
|
|
6270
6305
|
if ((_a = config.test) == null ? void 0 : _a.enabled) {
|
|
6271
|
-
serveConfig.inspectorTestToken = _nullishCoalesce(
|
|
6306
|
+
serveConfig.inspectorTestToken = _nullishCoalesce(_chunk5SHK4JM5cjs.getEnvUniversal.call(void 0, "_RIVET_TEST_INSPECTOR_TOKEN"), () => ( "token"));
|
|
6272
6307
|
}
|
|
6273
6308
|
return serveConfig;
|
|
6274
6309
|
}
|
|
6275
6310
|
async function buildRegistryWithRuntime(config, runtime) {
|
|
6276
6311
|
var _a;
|
|
6277
|
-
if (((_a = config.test) == null ? void 0 : _a.enabled) &&
|
|
6312
|
+
if (((_a = config.test) == null ? void 0 : _a.enabled) && _chunk5SHK4JM5cjs.getEnvUniversal.call(void 0, "_RIVET_TEST_INSPECTOR_TOKEN") === void 0) {
|
|
6278
6313
|
trySetProcessEnv("_RIVET_TEST_INSPECTOR_TOKEN", "token");
|
|
6279
6314
|
}
|
|
6280
6315
|
if (runtime.kind === "napi") {
|
|
@@ -6318,6 +6353,29 @@ function finishShutdownSignal(signal) {
|
|
|
6318
6353
|
}
|
|
6319
6354
|
process.kill(process.pid, signal);
|
|
6320
6355
|
}
|
|
6356
|
+
function createApplicationFetch(application) {
|
|
6357
|
+
return async (request) => {
|
|
6358
|
+
const method2 = request.method.toUpperCase();
|
|
6359
|
+
const body = method2 === "GET" || method2 === "HEAD" || request.body.length === 0 ? void 0 : Uint8Array.from(request.body).buffer;
|
|
6360
|
+
const response = await application.fetch(
|
|
6361
|
+
new Request(request.url, {
|
|
6362
|
+
method: method2,
|
|
6363
|
+
headers: request.headers,
|
|
6364
|
+
body
|
|
6365
|
+
})
|
|
6366
|
+
);
|
|
6367
|
+
if (!_chunk3NPCXMJScjs.isResponseLike.call(void 0, response)) {
|
|
6368
|
+
throw new TypeError(
|
|
6369
|
+
"registry.listen() application fetch must return a Response"
|
|
6370
|
+
);
|
|
6371
|
+
}
|
|
6372
|
+
return {
|
|
6373
|
+
status: response.status,
|
|
6374
|
+
headers: Object.fromEntries(response.headers.entries()),
|
|
6375
|
+
body: new Uint8Array(await response.arrayBuffer())
|
|
6376
|
+
};
|
|
6377
|
+
};
|
|
6378
|
+
}
|
|
6321
6379
|
var Registry = class {
|
|
6322
6380
|
#config;
|
|
6323
6381
|
#buildConfiguredRegistry;
|
|
@@ -6333,6 +6391,7 @@ var Registry = class {
|
|
|
6333
6391
|
#runtimeReadyPromise;
|
|
6334
6392
|
#runtimeServeConfiguredPromise;
|
|
6335
6393
|
#runtimeServerlessPromise;
|
|
6394
|
+
#applicationListenerPromise;
|
|
6336
6395
|
#configureServerlessPoolPromise;
|
|
6337
6396
|
#welcomePrinted = false;
|
|
6338
6397
|
#shutdownInstalled = false;
|
|
@@ -6342,7 +6401,7 @@ var Registry = class {
|
|
|
6342
6401
|
var _a;
|
|
6343
6402
|
this.#config = config;
|
|
6344
6403
|
if ((_a = config.logging) == null ? void 0 : _a.baseLogger) {
|
|
6345
|
-
|
|
6404
|
+
_chunk5SHK4JM5cjs.configureBaseLogger.call(void 0, config.logging.baseLogger);
|
|
6346
6405
|
}
|
|
6347
6406
|
this.#buildConfiguredRegistry = _nullishCoalesce((deps == null ? void 0 : deps.buildConfiguredRegistry), () => ( buildConfiguredRegistry));
|
|
6348
6407
|
this.routes = {
|
|
@@ -6558,17 +6617,63 @@ var Registry = class {
|
|
|
6558
6617
|
* @param opts.host Address to bind. Defaults to `0.0.0.0`.
|
|
6559
6618
|
* @param opts.publicDir If set, serves static files from this directory
|
|
6560
6619
|
* as a fallback below the framework routes.
|
|
6620
|
+
* @param opts.application If set, handles requests that do not match a
|
|
6621
|
+
* framework route.
|
|
6561
6622
|
*
|
|
6562
6623
|
* @example
|
|
6563
6624
|
* ```ts
|
|
6564
6625
|
* await registry.listen();
|
|
6565
|
-
* await registry.listen({
|
|
6626
|
+
* await registry.listen({ application: app });
|
|
6566
6627
|
* ```
|
|
6567
6628
|
*/
|
|
6568
6629
|
async listen(opts = {}) {
|
|
6569
|
-
const port = _nullishCoalesce(_nullishCoalesce(opts.port, () => (
|
|
6570
|
-
const publicDir = _nullishCoalesce(opts.publicDir, () => (
|
|
6630
|
+
const port = _nullishCoalesce(_nullishCoalesce(opts.port, () => ( _chunk5SHK4JM5cjs.parsePortEnv.call(void 0, process.env.RIVET_PORT))), () => ( 3e3));
|
|
6631
|
+
const publicDir = _nullishCoalesce(opts.publicDir, () => ( _chunk5SHK4JM5cjs.getRivetkitPublicDir.call(void 0, )));
|
|
6571
6632
|
const config = this.parseConfig();
|
|
6633
|
+
const application = opts.application ? createApplicationFetch(opts.application) : void 0;
|
|
6634
|
+
if (application && _chunk5SHK4JM5cjs.getRivetkitRuntimeMode.call(void 0, ) !== "serverless") {
|
|
6635
|
+
if (config.runtime === "wasm") {
|
|
6636
|
+
throw new Error(
|
|
6637
|
+
"registry.listen() requires the native runtime; use an application-owned HTTP server with WebAssembly"
|
|
6638
|
+
);
|
|
6639
|
+
}
|
|
6640
|
+
this.#installSignalHandlers(config);
|
|
6641
|
+
this.#printWelcome(config, "serverful", {
|
|
6642
|
+
port,
|
|
6643
|
+
host: opts.host,
|
|
6644
|
+
publicDir
|
|
6645
|
+
});
|
|
6646
|
+
this.#startEnvoy(config, true);
|
|
6647
|
+
const readyPromise = this.startAndWait();
|
|
6648
|
+
const configuredRegistryPromise2 = this.#runtimeServeConfiguredPromise;
|
|
6649
|
+
if (!configuredRegistryPromise2) {
|
|
6650
|
+
throw new Error("registry envoy startup did not initialize");
|
|
6651
|
+
}
|
|
6652
|
+
const { runtime: runtime2, registry: registry2, serveConfig: serveConfig2 } = await configuredRegistryPromise2;
|
|
6653
|
+
const listenerPromise = runtime2.serveApplicationListener(
|
|
6654
|
+
registry2,
|
|
6655
|
+
{
|
|
6656
|
+
port,
|
|
6657
|
+
host: opts.host,
|
|
6658
|
+
publicDir,
|
|
6659
|
+
application
|
|
6660
|
+
},
|
|
6661
|
+
serveConfig2
|
|
6662
|
+
);
|
|
6663
|
+
this.#applicationListenerPromise = listenerPromise;
|
|
6664
|
+
const serveLifecyclePromise = this.#runtimeServeLifecyclePromise;
|
|
6665
|
+
if (!serveLifecyclePromise) {
|
|
6666
|
+
throw new Error(
|
|
6667
|
+
"registry envoy serve lifecycle did not initialize"
|
|
6668
|
+
);
|
|
6669
|
+
}
|
|
6670
|
+
await Promise.all([
|
|
6671
|
+
readyPromise,
|
|
6672
|
+
listenerPromise,
|
|
6673
|
+
serveLifecyclePromise
|
|
6674
|
+
]);
|
|
6675
|
+
return;
|
|
6676
|
+
}
|
|
6572
6677
|
const configuredRegistryPromise = buildConfiguredRegistry(config);
|
|
6573
6678
|
this.#runtimeServeConfiguredPromise = configuredRegistryPromise;
|
|
6574
6679
|
this.#runtimeServerlessPromise = configuredRegistryPromise;
|
|
@@ -6582,7 +6687,12 @@ var Registry = class {
|
|
|
6582
6687
|
const { runtime, registry, serveConfig } = await configuredRegistryPromise;
|
|
6583
6688
|
await runtime.serveListener(
|
|
6584
6689
|
registry,
|
|
6585
|
-
{
|
|
6690
|
+
{
|
|
6691
|
+
port,
|
|
6692
|
+
host: opts.host,
|
|
6693
|
+
publicDir,
|
|
6694
|
+
application
|
|
6695
|
+
},
|
|
6586
6696
|
serveConfig
|
|
6587
6697
|
);
|
|
6588
6698
|
}
|
|
@@ -6595,7 +6705,7 @@ var Registry = class {
|
|
|
6595
6705
|
return jsonRouteResponse(503, {
|
|
6596
6706
|
status: "not_started",
|
|
6597
6707
|
runtime: "rivetkit",
|
|
6598
|
-
version:
|
|
6708
|
+
version: _chunk5SHK4JM5cjs.VERSION
|
|
6599
6709
|
});
|
|
6600
6710
|
}
|
|
6601
6711
|
const { runtime, registry } = configured;
|
|
@@ -6603,7 +6713,7 @@ var Registry = class {
|
|
|
6603
6713
|
return jsonRouteResponse(501, {
|
|
6604
6714
|
status: "unsupported",
|
|
6605
6715
|
runtime: "rivetkit",
|
|
6606
|
-
version:
|
|
6716
|
+
version: _chunk5SHK4JM5cjs.VERSION
|
|
6607
6717
|
});
|
|
6608
6718
|
}
|
|
6609
6719
|
const response = await runtime.registryHealth(registry);
|
|
@@ -6682,11 +6792,9 @@ var Registry = class {
|
|
|
6682
6792
|
await runtime.serveRegistry(registry, serveConfig);
|
|
6683
6793
|
}
|
|
6684
6794
|
);
|
|
6685
|
-
this.#runtimeServePromise = this.#runtimeServeLifecyclePromise.catch(
|
|
6686
|
-
(
|
|
6687
|
-
|
|
6688
|
-
}
|
|
6689
|
-
);
|
|
6795
|
+
this.#runtimeServePromise = this.#runtimeServeLifecyclePromise.catch((error) => {
|
|
6796
|
+
logger2().warn({ error }, "runtime registry serve errored");
|
|
6797
|
+
});
|
|
6690
6798
|
this.#installSignalHandlers(config);
|
|
6691
6799
|
}
|
|
6692
6800
|
if (printWelcome) {
|
|
@@ -6793,6 +6901,9 @@ var Registry = class {
|
|
|
6793
6901
|
if (runtimeServePromise !== void 0) {
|
|
6794
6902
|
await runtimeServePromise.catch(() => void 0);
|
|
6795
6903
|
}
|
|
6904
|
+
if (this.#applicationListenerPromise !== void 0) {
|
|
6905
|
+
await this.#applicationListenerPromise.catch(() => void 0);
|
|
6906
|
+
}
|
|
6796
6907
|
};
|
|
6797
6908
|
await Promise.race([
|
|
6798
6909
|
drain(),
|
|
@@ -6843,11 +6954,13 @@ var Registry = class {
|
|
|
6843
6954
|
startAndWait() {
|
|
6844
6955
|
if (this.#shutdownInFlight !== null) {
|
|
6845
6956
|
return Promise.reject(
|
|
6846
|
-
new Error(
|
|
6957
|
+
new Error(
|
|
6958
|
+
"registry.startAndWait() cannot run after shutdown has begun"
|
|
6959
|
+
)
|
|
6847
6960
|
);
|
|
6848
6961
|
}
|
|
6849
6962
|
if (this.#runtimeReadyPromise) return this.#runtimeReadyPromise;
|
|
6850
|
-
if (
|
|
6963
|
+
if (_chunk5SHK4JM5cjs.getRivetkitRuntimeMode.call(void 0, ) === "serverless") {
|
|
6851
6964
|
return Promise.reject(
|
|
6852
6965
|
new Error(
|
|
6853
6966
|
"registry.startAndWait() requires envoy runtime mode; serverless registries become ready per request"
|
|
@@ -6884,7 +6997,9 @@ var Registry = class {
|
|
|
6884
6997
|
const readinessPromise = (async () => {
|
|
6885
6998
|
const { runtime, registry } = await configuredRegistryPromise;
|
|
6886
6999
|
const stoppedBeforeReady = serveLifecyclePromise.then(() => {
|
|
6887
|
-
throw new Error(
|
|
7000
|
+
throw new Error(
|
|
7001
|
+
"RivetKit registry stopped before becoming ready"
|
|
7002
|
+
);
|
|
6888
7003
|
});
|
|
6889
7004
|
await Promise.race([
|
|
6890
7005
|
runtime.waitRegistryReady(registry),
|
|
@@ -6915,8 +7030,8 @@ var Registry = class {
|
|
|
6915
7030
|
* ```
|
|
6916
7031
|
*/
|
|
6917
7032
|
start() {
|
|
6918
|
-
if (
|
|
6919
|
-
const publicDir = _nullishCoalesce(
|
|
7033
|
+
if (_chunk5SHK4JM5cjs.getRivetkitRuntimeMode.call(void 0, ) === "serverless") {
|
|
7034
|
+
const publicDir = _nullishCoalesce(_chunk5SHK4JM5cjs.getRivetkitPublicDir.call(void 0, ), () => ( "/public"));
|
|
6920
7035
|
this.listen({ publicDir }).catch((error) => {
|
|
6921
7036
|
logger2().error({ error }, "auto-listen failed; exiting");
|
|
6922
7037
|
if (typeof process !== "undefined" && typeof process.exit === "function") {
|
|
@@ -6937,7 +7052,7 @@ var Registry = class {
|
|
|
6937
7052
|
};
|
|
6938
7053
|
console.log();
|
|
6939
7054
|
console.log(
|
|
6940
|
-
` RivetKit ${
|
|
7055
|
+
` RivetKit ${_chunk5SHK4JM5cjs.VERSION} (Engine - ${kind === "serverless" ? "Serverless" : "Serverful"})`
|
|
6941
7056
|
);
|
|
6942
7057
|
if (config.namespace !== "default") {
|
|
6943
7058
|
logLine("Namespace", config.namespace);
|
|
@@ -7012,5 +7127,5 @@ function setup(input) {
|
|
|
7012
7127
|
|
|
7013
7128
|
|
|
7014
7129
|
|
|
7015
|
-
exports.ALLOWED_PUBLIC_HEADERS =
|
|
7130
|
+
exports.ALLOWED_PUBLIC_HEADERS = _chunk3NPCXMJScjs.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 = _chunk3NPCXMJScjs.createClientWithDriver; exports.event = event; exports.isStaticActorDefinition = isStaticActorDefinition; exports.isStaticActorInstance = isStaticActorInstance; exports.lookupInRegistry = lookupInRegistry; exports.noopNext = _chunk5SHK4JM5cjs.noopNext; exports.queue = queue; exports.setup = setup; exports.toUint8Array = _chunk5SHK4JM5cjs.toUint8Array;
|
|
7016
7131
|
//# sourceMappingURL=mod.cjs.map
|