rivetkit 2.3.7 → 2.3.8
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 +34 -6
- package/dist/browser/client.js +33 -14
- 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 +34 -6
- package/dist/tsup/agent-os/index.d.ts +34 -6
- package/dist/tsup/agent-os/index.js +1 -1
- package/dist/tsup/agent-os/index.js.map +1 -1
- package/dist/tsup/{chunk-46AE7JOI.cjs → chunk-5MJPN3QU.cjs} +172 -151
- package/dist/tsup/chunk-5MJPN3QU.cjs.map +1 -0
- package/dist/tsup/{chunk-MNZFNIVI.cjs → chunk-7TNEDX3Y.cjs} +3 -3
- package/dist/tsup/{chunk-MNZFNIVI.cjs.map → chunk-7TNEDX3Y.cjs.map} +1 -1
- package/dist/tsup/{chunk-YU3C5OCU.js → chunk-BL6ERZQO.js} +36 -15
- package/dist/tsup/chunk-BL6ERZQO.js.map +1 -0
- package/dist/tsup/{chunk-DOPH7DT2.cjs → chunk-F6GCLL5Z.cjs} +7 -7
- package/dist/tsup/{chunk-DOPH7DT2.cjs.map → chunk-F6GCLL5Z.cjs.map} +1 -1
- package/dist/tsup/{chunk-6D2WRHJV.js → chunk-HWBISPRP.js} +2 -2
- package/dist/tsup/{chunk-UIZZCJ5W.cjs → chunk-IJMVVULS.cjs} +4 -4
- package/dist/tsup/{chunk-UIZZCJ5W.cjs.map → chunk-IJMVVULS.cjs.map} +1 -1
- package/dist/tsup/{chunk-7YQJXWBW.js → chunk-MY6BRV3S.js} +3 -3
- package/dist/tsup/{chunk-2SGPZEAJ.cjs → chunk-NUMGL52R.cjs} +6 -3
- package/dist/tsup/chunk-NUMGL52R.cjs.map +1 -0
- package/dist/tsup/{chunk-TQHMPWL6.cjs → chunk-TMTJPSHQ.cjs} +9 -9
- package/dist/tsup/{chunk-TQHMPWL6.cjs.map → chunk-TMTJPSHQ.cjs.map} +1 -1
- package/dist/tsup/{chunk-YHPFCYL3.js → chunk-V7PJYBA5.js} +2 -2
- package/dist/tsup/{chunk-CH25U5NO.js → chunk-YFXQ7DBH.js} +3 -3
- package/dist/tsup/{chunk-OG4OR2CM.js → chunk-ZKDZW5DQ.js} +6 -3
- package/dist/tsup/chunk-ZKDZW5DQ.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-CUymbyM6.d.ts} +35 -7
- package/dist/tsup/{config-BobvQpex.d.cts → config-CpB-e4I9.d.cts} +35 -7
- package/dist/tsup/{context-Cj-DFyiy.d.ts → context-YBUBTwTS.d.ts} +1 -1
- package/dist/tsup/{context-YEBNJrws.d.cts → context-c-6G4mjk.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 +449 -124
- 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 +388 -63
- 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 +3 -1
- package/src/client/raw-utils.ts +11 -2
- package/src/common/actor-router-consts.ts +1 -0
- package/src/common/encoding.ts +4 -1
- package/src/common/fetch-like.ts +49 -0
- package/src/engine-client/actor-http-client.ts +6 -22
- package/src/registry/index.ts +159 -14
- package/src/registry/napi-runtime.ts +74 -0
- package/src/registry/native-http.ts +208 -0
- package/src/registry/native.ts +111 -63
- package/src/registry/runtime.ts +35 -0
- package/src/registry/wasm-runtime.ts +11 -0
- package/dist/tsup/chunk-2SGPZEAJ.cjs.map +0 -1
- package/dist/tsup/chunk-46AE7JOI.cjs.map +0 -1
- package/dist/tsup/chunk-OG4OR2CM.js.map +0 -1
- package/dist/tsup/chunk-YU3C5OCU.js.map +0 -1
- /package/dist/tsup/{chunk-6D2WRHJV.js.map → chunk-HWBISPRP.js.map} +0 -0
- /package/dist/tsup/{chunk-7YQJXWBW.js.map → chunk-MY6BRV3S.js.map} +0 -0
- /package/dist/tsup/{chunk-YHPFCYL3.js.map → chunk-V7PJYBA5.js.map} +0 -0
- /package/dist/tsup/{chunk-CH25U5NO.js.map → chunk-YFXQ7DBH.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 _chunkIJMVVULScjs = require('./chunk-IJMVVULS.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -22,12 +22,14 @@ var _chunkHNHLBM3Ycjs = require('./chunk-HNHLBM3Y.cjs');
|
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
var _chunk5MJPN3QUcjs = require('./chunk-5MJPN3QU.cjs');
|
|
26
28
|
|
|
27
29
|
|
|
28
30
|
|
|
29
31
|
var _chunkMYWZCDMLcjs = require('./chunk-MYWZCDML.cjs');
|
|
30
|
-
require('./chunk-
|
|
32
|
+
require('./chunk-7TNEDX3Y.cjs');
|
|
31
33
|
require('./chunk-UEULFXUI.cjs');
|
|
32
34
|
|
|
33
35
|
|
|
@@ -61,7 +63,7 @@ require('./chunk-UEULFXUI.cjs');
|
|
|
61
63
|
|
|
62
64
|
|
|
63
65
|
|
|
64
|
-
var
|
|
66
|
+
var _chunkNUMGL52Rcjs = require('./chunk-NUMGL52R.cjs');
|
|
65
67
|
|
|
66
68
|
|
|
67
69
|
|
|
@@ -77,7 +79,7 @@ var _chunk4FC7TVS6cjs = require('./chunk-4FC7TVS6.cjs');
|
|
|
77
79
|
|
|
78
80
|
// src/actor/log.ts
|
|
79
81
|
function loggerWithoutContext() {
|
|
80
|
-
return
|
|
82
|
+
return _chunkNUMGL52Rcjs.getLogger.call(void 0, "actor-runtime");
|
|
81
83
|
}
|
|
82
84
|
|
|
83
85
|
// src/actor/definition.ts
|
|
@@ -217,7 +219,7 @@ function validateSchemaSync(schemas, key, data) {
|
|
|
217
219
|
var _virtualwebsocket = require('@rivetkit/virtual-websocket');
|
|
218
220
|
var _ws = require('hono/ws');
|
|
219
221
|
function logger() {
|
|
220
|
-
return
|
|
222
|
+
return _chunkNUMGL52Rcjs.getLogger.call(void 0, "inline-websocket-adapter");
|
|
221
223
|
}
|
|
222
224
|
var InlineWebSocketAdapter = class {
|
|
223
225
|
#handler;
|
|
@@ -388,7 +390,7 @@ function isLocalEngineEndpoint(endpoint) {
|
|
|
388
390
|
|
|
389
391
|
// src/registry/log.ts
|
|
390
392
|
function logger2() {
|
|
391
|
-
return
|
|
393
|
+
return _chunkNUMGL52Rcjs.getLogger.call(void 0, "registry");
|
|
392
394
|
}
|
|
393
395
|
|
|
394
396
|
// src/serverless/configure.ts
|
|
@@ -434,8 +436,8 @@ async function configureServerlessPool(config) {
|
|
|
434
436
|
);
|
|
435
437
|
}
|
|
436
438
|
const customConfig = config.configurePool;
|
|
437
|
-
const clientConfig =
|
|
438
|
-
const dcsRes = await
|
|
439
|
+
const clientConfig = _chunk5MJPN3QUcjs.convertRegistryConfigToClientConfig.call(void 0, config);
|
|
440
|
+
const dcsRes = await _chunk5MJPN3QUcjs.getDatacenters.call(void 0, clientConfig);
|
|
439
441
|
const poolName = _nullishCoalesce(customConfig.name, () => ( "default"));
|
|
440
442
|
const serverlessToken = _nullishCoalesce(config.token, () => ( config.publicToken));
|
|
441
443
|
const headers = {
|
|
@@ -457,7 +459,7 @@ async function configureServerlessPool(config) {
|
|
|
457
459
|
metadata: _nullishCoalesce(customConfig.metadata, () => ( {})),
|
|
458
460
|
drain_on_version_upgrade: _nullishCoalesce(customConfig.drainOnVersionUpgrade, () => ( true))
|
|
459
461
|
};
|
|
460
|
-
await
|
|
462
|
+
await _chunk5MJPN3QUcjs.updateRunnerConfig.call(void 0, clientConfig, poolName, {
|
|
461
463
|
datacenters: Object.fromEntries(
|
|
462
464
|
dcsRes.datacenters.map((dc) => [dc.name, serverlessConfig])
|
|
463
465
|
)
|
|
@@ -474,7 +476,7 @@ async function configureServerlessPool(config) {
|
|
|
474
476
|
logger2().warn({
|
|
475
477
|
msg: "serverless pool configuration attempt failed",
|
|
476
478
|
attempts,
|
|
477
|
-
error:
|
|
479
|
+
error: _chunkNUMGL52Rcjs.stringifyError.call(void 0, error)
|
|
478
480
|
});
|
|
479
481
|
await sleep(CONFIGURE_RETRY_DELAY_MS);
|
|
480
482
|
}
|
|
@@ -482,7 +484,7 @@ async function configureServerlessPool(config) {
|
|
|
482
484
|
logger2().error({
|
|
483
485
|
msg: "failed to configure serverless pool, validate endpoint is configured correctly then restart this process",
|
|
484
486
|
attempts,
|
|
485
|
-
error:
|
|
487
|
+
error: _chunkNUMGL52Rcjs.stringifyError.call(void 0, lastError)
|
|
486
488
|
});
|
|
487
489
|
throw lastError;
|
|
488
490
|
}
|
|
@@ -494,20 +496,20 @@ var _zod = require('zod');
|
|
|
494
496
|
var _v4 = require('zod/v4');
|
|
495
497
|
var warnedMissingVersion = false;
|
|
496
498
|
var EnvoyConfigSchema = _v4.z.object({
|
|
497
|
-
poolName: _v4.z.string().default(() => _nullishCoalesce(
|
|
499
|
+
poolName: _v4.z.string().default(() => _nullishCoalesce(_chunkNUMGL52Rcjs.getRivetPool.call(void 0, ), () => ( "default"))),
|
|
498
500
|
version: _v4.z.number().default(() => {
|
|
499
|
-
const version =
|
|
501
|
+
const version = _chunkNUMGL52Rcjs.getRivetEnvoyVersion.call(void 0, );
|
|
500
502
|
if (version !== void 0) return version;
|
|
501
|
-
if (
|
|
503
|
+
if (_chunkNUMGL52Rcjs.getNodeEnv.call(void 0, ) === "production" && !warnedMissingVersion) {
|
|
502
504
|
warnedMissingVersion = true;
|
|
503
|
-
|
|
505
|
+
_chunkNUMGL52Rcjs.getLogger.call(void 0, "rivetkit").error(
|
|
504
506
|
"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
507
|
);
|
|
506
508
|
}
|
|
507
509
|
return 1;
|
|
508
510
|
}),
|
|
509
511
|
// Deprecated.
|
|
510
|
-
totalSlots: _v4.z.number().default(() => _nullishCoalesce(
|
|
512
|
+
totalSlots: _v4.z.number().default(() => _nullishCoalesce(_chunkNUMGL52Rcjs.getRivetTotalSlots.call(void 0, ), () => ( 1e5))),
|
|
511
513
|
envoyKey: _v4.z.string().optional()
|
|
512
514
|
});
|
|
513
515
|
|
|
@@ -545,7 +547,7 @@ var ServerlessConfigSchema = _v4.z.object({
|
|
|
545
547
|
*
|
|
546
548
|
* Can also be set via RIVET_PUBLIC_ENDPOINT environment variable.
|
|
547
549
|
*/
|
|
548
|
-
publicEndpoint: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => (
|
|
550
|
+
publicEndpoint: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkNUMGL52Rcjs.getRivetPublicEndpoint.call(void 0, )))),
|
|
549
551
|
/**
|
|
550
552
|
* Token that clients should use when connecting via the public endpoint.
|
|
551
553
|
*
|
|
@@ -553,7 +555,7 @@ var ServerlessConfigSchema = _v4.z.object({
|
|
|
553
555
|
*
|
|
554
556
|
* Can also be specified in the publicEndpoint URL as `https://namespace:token@host`.
|
|
555
557
|
*/
|
|
556
|
-
publicToken: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => (
|
|
558
|
+
publicToken: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkNUMGL52Rcjs.getRivetPublicToken.call(void 0, ))))
|
|
557
559
|
// There is no publicNamespace config option because the frontend and backend
|
|
558
560
|
// cannot use different namespaces. The namespace is extracted from the
|
|
559
561
|
// publicEndpoint URL auth syntax if provided.
|
|
@@ -607,7 +609,7 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
607
609
|
* Runtime binding to use for RivetKit core.
|
|
608
610
|
* */
|
|
609
611
|
runtime: RuntimeKindSchema.optional().transform((val, ctx) => {
|
|
610
|
-
const rawRuntime = _nullishCoalesce(val, () => (
|
|
612
|
+
const rawRuntime = _nullishCoalesce(val, () => ( _chunkNUMGL52Rcjs.getRivetkitRuntime.call(void 0, )));
|
|
611
613
|
if (rawRuntime === void 0) {
|
|
612
614
|
return "auto";
|
|
613
615
|
}
|
|
@@ -644,7 +646,7 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
644
646
|
* */
|
|
645
647
|
logging: _zod.z.object({
|
|
646
648
|
baseLogger: _zod.z.custom().optional(),
|
|
647
|
-
level:
|
|
649
|
+
level: _chunkNUMGL52Rcjs.LogLevelSchema.optional()
|
|
648
650
|
}).optional().default(() => ({})),
|
|
649
651
|
// MARK: Routing
|
|
650
652
|
// // This is a function to allow for lazy configuration of upgradeWebSocket on the
|
|
@@ -662,9 +664,9 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
662
664
|
*
|
|
663
665
|
* Can also be set via RIVET_ENDPOINT environment variables.
|
|
664
666
|
*/
|
|
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, () => (
|
|
667
|
+
endpoint: _zod.z.string().optional().transform((val) => _nullishCoalesce(_nullishCoalesce(val, () => ( _chunkNUMGL52Rcjs.getRivetEngine.call(void 0, ))), () => ( _chunkNUMGL52Rcjs.getRivetEndpoint.call(void 0, )))),
|
|
668
|
+
token: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkNUMGL52Rcjs.getRivetToken.call(void 0, )))),
|
|
669
|
+
namespace: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkNUMGL52Rcjs.getRivetNamespace.call(void 0, )))),
|
|
668
670
|
headers: _zod.z.record(_zod.z.string(), _zod.z.string()).optional().default({}),
|
|
669
671
|
// MARK: Client
|
|
670
672
|
// TODO:
|
|
@@ -704,21 +706,21 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
704
706
|
*
|
|
705
707
|
* Starts the full Rust engine process locally.
|
|
706
708
|
*/
|
|
707
|
-
startEngine: _zod.z.boolean().default(() =>
|
|
709
|
+
startEngine: _zod.z.boolean().default(() => _chunkNUMGL52Rcjs.getRivetRunEngine.call(void 0, )),
|
|
708
710
|
/**
|
|
709
711
|
* @experimental
|
|
710
712
|
*
|
|
711
713
|
* Host to bind the spawned local engine process to.
|
|
712
714
|
*/
|
|
713
|
-
engineHost: _zod.z.string().optional().default(() => _nullishCoalesce(
|
|
715
|
+
engineHost: _zod.z.string().optional().default(() => _nullishCoalesce(_chunkNUMGL52Rcjs.getRivetRunEngineHost.call(void 0, ), () => ( ENGINE_HOST))),
|
|
714
716
|
/**
|
|
715
717
|
* @experimental
|
|
716
718
|
*
|
|
717
719
|
* Port to bind the spawned local engine process to.
|
|
718
720
|
*/
|
|
719
|
-
enginePort: _zod.z.number().int().min(1).max(65535).optional().default(() => _nullishCoalesce(
|
|
721
|
+
enginePort: _zod.z.number().int().min(1).max(65535).optional().default(() => _nullishCoalesce(_chunkNUMGL52Rcjs.getRivetRunEnginePort.call(void 0, ), () => ( ENGINE_PORT))),
|
|
720
722
|
/** @experimental */
|
|
721
|
-
engineVersion: _zod.z.string().optional().default(() => _nullishCoalesce(
|
|
723
|
+
engineVersion: _zod.z.string().optional().default(() => _nullishCoalesce(_chunkNUMGL52Rcjs.getRivetRunEngineVersion.call(void 0, ), () => ( _chunkNUMGL52Rcjs.VERSION))),
|
|
722
724
|
/**
|
|
723
725
|
* @experimental
|
|
724
726
|
*
|
|
@@ -766,7 +768,7 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
766
768
|
}))
|
|
767
769
|
}).transform((config, ctx) => {
|
|
768
770
|
var _a, _b, _c;
|
|
769
|
-
const isDevEnv =
|
|
771
|
+
const isDevEnv = _chunkNUMGL52Rcjs.isDev.call(void 0, );
|
|
770
772
|
const sqliteBackend = _nullishCoalesce(((_a = config.sqlite) == null ? void 0 : _a.backend), () => ( ((_b = config.test) == null ? void 0 : _b.sqliteBackend)));
|
|
771
773
|
if (config.runtime === "wasm" && sqliteBackend === "local") {
|
|
772
774
|
ctx.addIssue({
|
|
@@ -776,7 +778,7 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
776
778
|
});
|
|
777
779
|
}
|
|
778
780
|
const sqlite = config.runtime === "wasm" && config.sqlite === void 0 ? { backend: "remote" } : config.sqlite;
|
|
779
|
-
const parsedEndpoint = config.endpoint ?
|
|
781
|
+
const parsedEndpoint = config.endpoint ? _chunk5MJPN3QUcjs.tryParseEndpoint.call(void 0, ctx, {
|
|
780
782
|
endpoint: config.endpoint,
|
|
781
783
|
path: ["endpoint"],
|
|
782
784
|
namespace: config.namespace,
|
|
@@ -804,7 +806,7 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
804
806
|
);
|
|
805
807
|
const namespace = _nullishCoalesce(_nullishCoalesce((parsedEndpoint == null ? void 0 : parsedEndpoint.namespace), () => ( config.namespace)), () => ( "default"));
|
|
806
808
|
const token = _nullishCoalesce((parsedEndpoint == null ? void 0 : parsedEndpoint.token), () => ( config.token));
|
|
807
|
-
const parsedPublicEndpoint = config.serverless.publicEndpoint ?
|
|
809
|
+
const parsedPublicEndpoint = config.serverless.publicEndpoint ? _chunk5MJPN3QUcjs.tryParseEndpoint.call(void 0, ctx, {
|
|
808
810
|
endpoint: config.serverless.publicEndpoint,
|
|
809
811
|
path: ["serverless", "publicEndpoint"]
|
|
810
812
|
}) : void 0;
|
|
@@ -907,7 +909,7 @@ var DocRegistryConfigSchema = _zod.z.object({
|
|
|
907
909
|
noWelcome: _zod.z.boolean().optional().describe("Disable the welcome message on startup. Default: false"),
|
|
908
910
|
sqlite: DocSqliteConfigSchema,
|
|
909
911
|
logging: _zod.z.object({
|
|
910
|
-
level:
|
|
912
|
+
level: _chunkNUMGL52Rcjs.LogLevelSchema.optional().describe(
|
|
911
913
|
"Log level for RivetKit. Default: 'warn'"
|
|
912
914
|
)
|
|
913
915
|
}).optional().describe("Logging configuration."),
|
|
@@ -1433,6 +1435,36 @@ function toNapiSqlBatchStatement(statement) {
|
|
|
1433
1435
|
function toNapiBuffer(value) {
|
|
1434
1436
|
return Buffer.from(value);
|
|
1435
1437
|
}
|
|
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
|
+
}
|
|
1436
1468
|
function toNapiHttpRequest(request) {
|
|
1437
1469
|
if (!request) {
|
|
1438
1470
|
return request;
|
|
@@ -1539,12 +1571,25 @@ var NapiCoreRuntime = (_class = class {
|
|
|
1539
1571
|
);
|
|
1540
1572
|
}
|
|
1541
1573
|
async serveListener(registry, listener, config) {
|
|
1574
|
+
const application = listener.application ? toNapiApplication(listener.application) : void 0;
|
|
1542
1575
|
await asNativeRegistry(registry).serveListener(
|
|
1543
1576
|
{
|
|
1544
1577
|
port: listener.port,
|
|
1545
1578
|
host: listener.host,
|
|
1546
1579
|
publicDir: listener.publicDir
|
|
1547
1580
|
},
|
|
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),
|
|
1548
1593
|
config
|
|
1549
1594
|
);
|
|
1550
1595
|
}
|
|
@@ -1932,6 +1977,137 @@ async function loadNapiRuntime() {
|
|
|
1932
1977
|
};
|
|
1933
1978
|
}
|
|
1934
1979
|
|
|
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
|
+
|
|
1935
2111
|
// src/registry/native-validation.ts
|
|
1936
2112
|
var CONN_PARAMS_KEY = "__conn_params__";
|
|
1937
2113
|
function validateActionArgs(schemas, name, args) {
|
|
@@ -2204,6 +2380,11 @@ var WasmCoreRuntime = (_class2 = class {
|
|
|
2204
2380
|
"registry.listen() is not supported on the wasm runtime; use registry.serve() and mount the handler in your platform's HTTP server instead"
|
|
2205
2381
|
);
|
|
2206
2382
|
}
|
|
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
|
+
}
|
|
2207
2388
|
createActorFactory(callbacks, config) {
|
|
2208
2389
|
return callWasmSync(
|
|
2209
2390
|
() => asActorFactoryHandle2(
|
|
@@ -2773,7 +2954,7 @@ function trySetProcessEnv(key, value) {
|
|
|
2773
2954
|
if (typeof process === "undefined") return;
|
|
2774
2955
|
try {
|
|
2775
2956
|
process.env[key] = value;
|
|
2776
|
-
} catch (
|
|
2957
|
+
} catch (e4) {
|
|
2777
2958
|
}
|
|
2778
2959
|
}
|
|
2779
2960
|
function detectRuntimeHost() {
|
|
@@ -2810,7 +2991,7 @@ async function loadAutoRuntime(config, loaders = defaultRuntimeLoaders) {
|
|
|
2810
2991
|
}
|
|
2811
2992
|
try {
|
|
2812
2993
|
return (await loaders.loadNative()).runtime;
|
|
2813
|
-
} catch (
|
|
2994
|
+
} catch (e5) {
|
|
2814
2995
|
return (await loaders.loadWasm(config.wasm)).runtime;
|
|
2815
2996
|
}
|
|
2816
2997
|
}
|
|
@@ -2984,7 +3165,7 @@ async function cleanupNativeSleepRuntimeState(runtime, ctx, afterTrackedWorkDrai
|
|
|
2984
3165
|
}).catch((error) => {
|
|
2985
3166
|
logger2().warn({
|
|
2986
3167
|
msg: "deferred native sleep cleanup failed",
|
|
2987
|
-
error:
|
|
3168
|
+
error: _chunkNUMGL52Rcjs.stringifyError.call(void 0, error)
|
|
2988
3169
|
});
|
|
2989
3170
|
});
|
|
2990
3171
|
return;
|
|
@@ -3061,7 +3242,7 @@ function toRuntimeBytes(value) {
|
|
|
3061
3242
|
function arrayBufferViewToRuntimeBytes(value) {
|
|
3062
3243
|
return new Uint8Array(value.buffer, value.byteOffset, value.byteLength);
|
|
3063
3244
|
}
|
|
3064
|
-
function
|
|
3245
|
+
function runtimeBytesToArrayBuffer2(value) {
|
|
3065
3246
|
return value.buffer.slice(
|
|
3066
3247
|
value.byteOffset,
|
|
3067
3248
|
value.byteOffset + value.byteLength
|
|
@@ -3111,10 +3292,10 @@ function decodeValue(value) {
|
|
|
3111
3292
|
if (!value || value.length === 0) {
|
|
3112
3293
|
return void 0;
|
|
3113
3294
|
}
|
|
3114
|
-
return
|
|
3295
|
+
return _chunkNUMGL52Rcjs.decodeCborCompat.call(void 0, value);
|
|
3115
3296
|
}
|
|
3116
3297
|
function encodeValue(value) {
|
|
3117
|
-
return
|
|
3298
|
+
return _chunkNUMGL52Rcjs.encodeCborCompat.call(void 0, value);
|
|
3118
3299
|
}
|
|
3119
3300
|
function normalizeArgs(value) {
|
|
3120
3301
|
return Array.isArray(value) ? value : value === void 0 || value === null ? [] : [value];
|
|
@@ -3150,7 +3331,7 @@ function isStructuredBridgeError(error) {
|
|
|
3150
3331
|
return _chunk4FC7TVS6cjs.isRivetErrorLike.call(void 0, error) && "__type" in error && (error.__type === "RivetError" || error.__type === "ActorError");
|
|
3151
3332
|
}
|
|
3152
3333
|
function encodeNativeCallbackError(error) {
|
|
3153
|
-
const structuredError = isStructuredBridgeError(error) ? error :
|
|
3334
|
+
const structuredError = isStructuredBridgeError(error) ? error : _chunkNUMGL52Rcjs.deconstructError.call(void 0, error, true);
|
|
3154
3335
|
const bridgeError = new Error(_chunk4FC7TVS6cjs.encodeBridgeRivetError.call(void 0, structuredError), {
|
|
3155
3336
|
cause: error instanceof Error ? error : void 0
|
|
3156
3337
|
});
|
|
@@ -3200,8 +3381,8 @@ function decodeWorkflowCbor(data) {
|
|
|
3200
3381
|
return null;
|
|
3201
3382
|
}
|
|
3202
3383
|
try {
|
|
3203
|
-
return
|
|
3204
|
-
} catch (
|
|
3384
|
+
return _chunkNUMGL52Rcjs.decodeCborCompat.call(void 0, new Uint8Array(data));
|
|
3385
|
+
} catch (e6) {
|
|
3205
3386
|
return null;
|
|
3206
3387
|
}
|
|
3207
3388
|
}
|
|
@@ -3313,7 +3494,7 @@ function serializeWorkflowHistoryForJson(data) {
|
|
|
3313
3494
|
if (data === null) {
|
|
3314
3495
|
return null;
|
|
3315
3496
|
}
|
|
3316
|
-
const history =
|
|
3497
|
+
const history = _chunkIJMVVULScjs.decodeWorkflowHistoryTransport.call(void 0, data);
|
|
3317
3498
|
return jsonSafe({
|
|
3318
3499
|
nameRegistry: [...history.nameRegistry],
|
|
3319
3500
|
entries: history.entries.map((entry) => ({
|
|
@@ -3391,24 +3572,6 @@ function decodeArgs(value) {
|
|
|
3391
3572
|
const decoded = decodeValue(value);
|
|
3392
3573
|
return normalizeArgs(decoded);
|
|
3393
3574
|
}
|
|
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
|
-
}
|
|
3412
3575
|
function toActorKey(segments) {
|
|
3413
3576
|
return segments.map(
|
|
3414
3577
|
(segment) => segment.kind === "number" ? String(_nullishCoalesce(segment.numberValue, () => ( 0))) : _nullishCoalesce(segment.stringValue, () => ( ""))
|
|
@@ -3454,12 +3617,12 @@ var NativeConnAdapter = class {
|
|
|
3454
3617
|
this.#writeState(nextValue, { writeNative: true });
|
|
3455
3618
|
},
|
|
3456
3619
|
(newValue) => {
|
|
3457
|
-
|
|
3620
|
+
_chunkNUMGL52Rcjs.assertJsonCompatValue.call(void 0, newValue);
|
|
3458
3621
|
}
|
|
3459
3622
|
);
|
|
3460
3623
|
}
|
|
3461
3624
|
set state(value) {
|
|
3462
|
-
|
|
3625
|
+
_chunkNUMGL52Rcjs.assertJsonCompatValue.call(void 0, value);
|
|
3463
3626
|
this.#writeState(value, { writeNative: true });
|
|
3464
3627
|
}
|
|
3465
3628
|
initializeState(value) {
|
|
@@ -4073,7 +4236,7 @@ var NativeWebSocketAdapter = class {
|
|
|
4073
4236
|
this.#runtime.webSocketSetEventCallback(this.#ws, (event2) => {
|
|
4074
4237
|
if (event2.kind === "message") {
|
|
4075
4238
|
this.#virtual.triggerMessage(
|
|
4076
|
-
event2.binary ?
|
|
4239
|
+
event2.binary ? runtimeBytesToArrayBuffer2(event2.data) : event2.data,
|
|
4077
4240
|
event2.messageIndex
|
|
4078
4241
|
);
|
|
4079
4242
|
return;
|
|
@@ -4505,7 +4668,7 @@ var ActorContextHandleAdapter = class {
|
|
|
4505
4668
|
},
|
|
4506
4669
|
(newValue) => {
|
|
4507
4670
|
this.#assertCanMutateState();
|
|
4508
|
-
|
|
4671
|
+
_chunkNUMGL52Rcjs.assertJsonCompatValue.call(void 0, newValue);
|
|
4509
4672
|
}
|
|
4510
4673
|
);
|
|
4511
4674
|
}
|
|
@@ -4516,7 +4679,7 @@ var ActorContextHandleAdapter = class {
|
|
|
4516
4679
|
throw stateNotEnabledError();
|
|
4517
4680
|
}
|
|
4518
4681
|
this.#assertCanMutateState();
|
|
4519
|
-
|
|
4682
|
+
_chunkNUMGL52Rcjs.assertJsonCompatValue.call(void 0, value);
|
|
4520
4683
|
this.#writeState(value, { scheduleSave: true });
|
|
4521
4684
|
}
|
|
4522
4685
|
initializeState(value) {
|
|
@@ -4792,7 +4955,7 @@ var ActorContextHandleAdapter = class {
|
|
|
4792
4955
|
const trackedPromise = Promise.resolve(promise).catch((error) => {
|
|
4793
4956
|
logger2().warn({
|
|
4794
4957
|
msg: "keepAwake promise rejected",
|
|
4795
|
-
error:
|
|
4958
|
+
error: _chunkNUMGL52Rcjs.stringifyError.call(void 0, error)
|
|
4796
4959
|
});
|
|
4797
4960
|
}).then(() => null);
|
|
4798
4961
|
try {
|
|
@@ -5254,9 +5417,9 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
5254
5417
|
events: config.events,
|
|
5255
5418
|
queues: config.queues
|
|
5256
5419
|
};
|
|
5257
|
-
const createClient = () =>
|
|
5258
|
-
new (0,
|
|
5259
|
-
|
|
5420
|
+
const createClient = () => _chunk5MJPN3QUcjs.createClientWithDriver.call(void 0,
|
|
5421
|
+
new (0, _chunk5MJPN3QUcjs.RemoteEngineControlClient)(
|
|
5422
|
+
_chunk5MJPN3QUcjs.convertRegistryConfigToClientConfig.call(void 0, registryConfig)
|
|
5260
5423
|
),
|
|
5261
5424
|
{ encoding: "bare" }
|
|
5262
5425
|
);
|
|
@@ -5305,12 +5468,14 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
5305
5468
|
onStateChange,
|
|
5306
5469
|
cancelToken
|
|
5307
5470
|
);
|
|
5308
|
-
const maybeHandleNativeInspectorRequest = async (ctx,
|
|
5471
|
+
const maybeHandleNativeInspectorRequest = async (ctx, rawRequest) => {
|
|
5309
5472
|
var _a2, _b, _c, _d;
|
|
5310
|
-
const
|
|
5473
|
+
const rawUrl = rawRequest.uri.startsWith("http") ? rawRequest.uri : new URL(rawRequest.uri, "http://127.0.0.1").toString();
|
|
5474
|
+
const url = new URL(rawUrl);
|
|
5311
5475
|
if (!url.pathname.startsWith("/inspector/")) {
|
|
5312
5476
|
return void 0;
|
|
5313
5477
|
}
|
|
5478
|
+
const jsRequest = buildNativeHttpRequest(rawRequest);
|
|
5314
5479
|
const jsonResponse = (body, init) => new Response(JSON.stringify(body), {
|
|
5315
5480
|
status: _nullishCoalesce((init == null ? void 0 : init.status), () => ( 200)),
|
|
5316
5481
|
headers: {
|
|
@@ -5416,7 +5581,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
5416
5581
|
let body;
|
|
5417
5582
|
try {
|
|
5418
5583
|
body = await jsRequest.json();
|
|
5419
|
-
} catch (
|
|
5584
|
+
} catch (e7) {
|
|
5420
5585
|
return errorResponse(
|
|
5421
5586
|
new (0, _chunk4FC7TVS6cjs.RivetError)(
|
|
5422
5587
|
"actor",
|
|
@@ -5439,7 +5604,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
5439
5604
|
400
|
|
5440
5605
|
);
|
|
5441
5606
|
}
|
|
5442
|
-
const cbor =
|
|
5607
|
+
const cbor = _chunkNUMGL52Rcjs.encodeCborCompat.call(void 0,
|
|
5443
5608
|
_nullishCoalesce(body.body, () => ( null))
|
|
5444
5609
|
);
|
|
5445
5610
|
const message = await runtime.actorQueueSend(ctx, name, cbor);
|
|
@@ -5841,7 +6006,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
5841
6006
|
);
|
|
5842
6007
|
const actorCtx = makeActorCtx(
|
|
5843
6008
|
ctx,
|
|
5844
|
-
request ?
|
|
6009
|
+
request ? buildNativeHttpRequest(request) : void 0
|
|
5845
6010
|
);
|
|
5846
6011
|
try {
|
|
5847
6012
|
await config.onBeforeConnect(
|
|
@@ -5861,7 +6026,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
5861
6026
|
const { ctx, conn, params, request } = unwrapTsfnPayload(error, payload);
|
|
5862
6027
|
const actorCtx = makeActorCtx(
|
|
5863
6028
|
ctx,
|
|
5864
|
-
request ?
|
|
6029
|
+
request ? buildNativeHttpRequest(request) : void 0
|
|
5865
6030
|
);
|
|
5866
6031
|
const connAdapter = new NativeConnAdapter(
|
|
5867
6032
|
runtime,
|
|
@@ -5898,7 +6063,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
5898
6063
|
);
|
|
5899
6064
|
const actorCtx = makeActorCtx(
|
|
5900
6065
|
ctx,
|
|
5901
|
-
request ?
|
|
6066
|
+
request ? buildNativeHttpRequest(request) : void 0
|
|
5902
6067
|
);
|
|
5903
6068
|
const connAdapter = new NativeConnAdapter(
|
|
5904
6069
|
runtime,
|
|
@@ -6003,27 +6168,45 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
6003
6168
|
onRequest: wrapNativeCallback(
|
|
6004
6169
|
async (error, payload) => {
|
|
6005
6170
|
try {
|
|
6006
|
-
const { ctx, request, cancelToken } = unwrapTsfnPayload(
|
|
6007
|
-
|
|
6008
|
-
payload
|
|
6009
|
-
);
|
|
6010
|
-
const jsRequest = buildRequest(request);
|
|
6011
|
-
const inspectorResponse = await maybeHandleNativeInspectorRequest(
|
|
6012
|
-
ctx,
|
|
6013
|
-
request,
|
|
6014
|
-
jsRequest
|
|
6015
|
-
);
|
|
6171
|
+
const { ctx, request, cancelToken, responseBodyStream } = unwrapTsfnPayload(error, payload);
|
|
6172
|
+
const inspectorResponse = await maybeHandleNativeInspectorRequest(ctx, request);
|
|
6016
6173
|
if (inspectorResponse) {
|
|
6017
|
-
|
|
6174
|
+
await cancelNativeHttpRequestBody(request.bodyStream);
|
|
6175
|
+
return (await convertNativeHttpResponse(
|
|
6176
|
+
inspectorResponse,
|
|
6177
|
+
responseBodyStream
|
|
6178
|
+
)).response;
|
|
6018
6179
|
}
|
|
6019
6180
|
if (typeof config.onRequest !== "function") {
|
|
6020
|
-
|
|
6021
|
-
|
|
6022
|
-
|
|
6181
|
+
await cancelNativeHttpRequestBody(request.bodyStream);
|
|
6182
|
+
return (await convertNativeHttpResponse(
|
|
6183
|
+
new Response(null, { status: 404 }),
|
|
6184
|
+
responseBodyStream
|
|
6185
|
+
)).response;
|
|
6023
6186
|
}
|
|
6024
|
-
const
|
|
6187
|
+
const requestAbortController = new AbortController();
|
|
6188
|
+
const handlerRequest = buildNativeHttpRequest({
|
|
6189
|
+
...request,
|
|
6190
|
+
abortController: requestAbortController
|
|
6191
|
+
});
|
|
6192
|
+
const rawConnParams = handlerRequest.headers.get(_chunk5MJPN3QUcjs.HEADER_CONN_PARAMS);
|
|
6025
6193
|
let requestCtx;
|
|
6026
6194
|
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
|
+
};
|
|
6027
6210
|
try {
|
|
6028
6211
|
const connParams = validateConnParams(
|
|
6029
6212
|
schemaConfig.connParamsSchema,
|
|
@@ -6039,23 +6222,56 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
6039
6222
|
requestCtx = makeConnCtx(
|
|
6040
6223
|
ctx,
|
|
6041
6224
|
conn,
|
|
6042
|
-
|
|
6225
|
+
handlerRequest,
|
|
6043
6226
|
cancelToken
|
|
6044
6227
|
);
|
|
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
|
+
}
|
|
6045
6243
|
const response = await config.onRequest(
|
|
6046
6244
|
requestCtx,
|
|
6047
|
-
|
|
6245
|
+
handlerRequest
|
|
6048
6246
|
);
|
|
6049
|
-
if (!(
|
|
6247
|
+
if (!_chunk5MJPN3QUcjs.isResponseLike.call(void 0, response)) {
|
|
6050
6248
|
throw new Error(
|
|
6051
6249
|
"onRequest handler must return a Response"
|
|
6052
6250
|
);
|
|
6053
6251
|
}
|
|
6054
|
-
|
|
6252
|
+
const conversion = await convertNativeHttpResponse(
|
|
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;
|
|
6055
6266
|
} finally {
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
|
|
6267
|
+
try {
|
|
6268
|
+
await cancelNativeHttpRequestBody(
|
|
6269
|
+
request.bodyStream
|
|
6270
|
+
);
|
|
6271
|
+
} finally {
|
|
6272
|
+
if (!cleanupDeferredToBody) {
|
|
6273
|
+
await cleanupRequest();
|
|
6274
|
+
}
|
|
6059
6275
|
}
|
|
6060
6276
|
}
|
|
6061
6277
|
} catch (error2) {
|
|
@@ -6070,7 +6286,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
6070
6286
|
onWebSocket: typeof config.onWebSocket === "function" ? wrapNativeCallback(
|
|
6071
6287
|
async (error, payload) => {
|
|
6072
6288
|
const { ctx, conn, ws, request } = unwrapTsfnPayload(error, payload);
|
|
6073
|
-
const jsRequest = request ?
|
|
6289
|
+
const jsRequest = request ? buildNativeHttpRequest(request) : void 0;
|
|
6074
6290
|
const actorCtx = makeConnCtx(ctx, conn, jsRequest);
|
|
6075
6291
|
try {
|
|
6076
6292
|
await config.onWebSocket(
|
|
@@ -6167,7 +6383,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
6167
6383
|
timeoutMs,
|
|
6168
6384
|
cancelToken
|
|
6169
6385
|
} = unwrapTsfnPayload(error, payload);
|
|
6170
|
-
const jsRequest =
|
|
6386
|
+
const jsRequest = buildNativeHttpRequest(request);
|
|
6171
6387
|
const actorCtx = withConnContext(
|
|
6172
6388
|
runtime,
|
|
6173
6389
|
ctx,
|
|
@@ -6249,7 +6465,7 @@ async function buildServeConfig(config) {
|
|
|
6249
6465
|
poolName: config.envoy.poolName,
|
|
6250
6466
|
handleInspectorHttpInRuntime: true,
|
|
6251
6467
|
serverlessBasePath: config.serverless.basePath,
|
|
6252
|
-
serverlessPackageVersion:
|
|
6468
|
+
serverlessPackageVersion: _chunkNUMGL52Rcjs.VERSION,
|
|
6253
6469
|
serverlessClientEndpoint: config.publicEndpoint,
|
|
6254
6470
|
serverlessClientNamespace: config.publicNamespace,
|
|
6255
6471
|
serverlessClientToken: config.publicToken,
|
|
@@ -6262,19 +6478,19 @@ async function buildServeConfig(config) {
|
|
|
6262
6478
|
} catch (error) {
|
|
6263
6479
|
logger2().warn({
|
|
6264
6480
|
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:
|
|
6481
|
+
error: _chunkNUMGL52Rcjs.stringifyError.call(void 0, error)
|
|
6266
6482
|
});
|
|
6267
6483
|
}
|
|
6268
6484
|
serveConfig.engineHost = config.engineHost;
|
|
6269
6485
|
serveConfig.enginePort = config.enginePort;
|
|
6270
6486
|
if ((_a = config.test) == null ? void 0 : _a.enabled) {
|
|
6271
|
-
serveConfig.inspectorTestToken = _nullishCoalesce(
|
|
6487
|
+
serveConfig.inspectorTestToken = _nullishCoalesce(_chunkNUMGL52Rcjs.getEnvUniversal.call(void 0, "_RIVET_TEST_INSPECTOR_TOKEN"), () => ( "token"));
|
|
6272
6488
|
}
|
|
6273
6489
|
return serveConfig;
|
|
6274
6490
|
}
|
|
6275
6491
|
async function buildRegistryWithRuntime(config, runtime) {
|
|
6276
6492
|
var _a;
|
|
6277
|
-
if (((_a = config.test) == null ? void 0 : _a.enabled) &&
|
|
6493
|
+
if (((_a = config.test) == null ? void 0 : _a.enabled) && _chunkNUMGL52Rcjs.getEnvUniversal.call(void 0, "_RIVET_TEST_INSPECTOR_TOKEN") === void 0) {
|
|
6278
6494
|
trySetProcessEnv("_RIVET_TEST_INSPECTOR_TOKEN", "token");
|
|
6279
6495
|
}
|
|
6280
6496
|
if (runtime.kind === "napi") {
|
|
@@ -6318,6 +6534,54 @@ function finishShutdownSignal(signal) {
|
|
|
6318
6534
|
}
|
|
6319
6535
|
process.kill(process.pid, signal);
|
|
6320
6536
|
}
|
|
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
|
+
}
|
|
6321
6585
|
var Registry = class {
|
|
6322
6586
|
#config;
|
|
6323
6587
|
#buildConfiguredRegistry;
|
|
@@ -6333,6 +6597,7 @@ var Registry = class {
|
|
|
6333
6597
|
#runtimeReadyPromise;
|
|
6334
6598
|
#runtimeServeConfiguredPromise;
|
|
6335
6599
|
#runtimeServerlessPromise;
|
|
6600
|
+
#applicationListenerPromise;
|
|
6336
6601
|
#configureServerlessPoolPromise;
|
|
6337
6602
|
#welcomePrinted = false;
|
|
6338
6603
|
#shutdownInstalled = false;
|
|
@@ -6342,7 +6607,7 @@ var Registry = class {
|
|
|
6342
6607
|
var _a;
|
|
6343
6608
|
this.#config = config;
|
|
6344
6609
|
if ((_a = config.logging) == null ? void 0 : _a.baseLogger) {
|
|
6345
|
-
|
|
6610
|
+
_chunkNUMGL52Rcjs.configureBaseLogger.call(void 0, config.logging.baseLogger);
|
|
6346
6611
|
}
|
|
6347
6612
|
this.#buildConfiguredRegistry = _nullishCoalesce((deps == null ? void 0 : deps.buildConfiguredRegistry), () => ( buildConfiguredRegistry));
|
|
6348
6613
|
this.routes = {
|
|
@@ -6558,18 +6823,67 @@ var Registry = class {
|
|
|
6558
6823
|
* @param opts.host Address to bind. Defaults to `0.0.0.0`.
|
|
6559
6824
|
* @param opts.publicDir If set, serves static files from this directory
|
|
6560
6825
|
* as a fallback below the framework routes.
|
|
6826
|
+
* @param opts.application If set, handles requests that do not match a
|
|
6827
|
+
* framework route.
|
|
6561
6828
|
*
|
|
6562
6829
|
* @example
|
|
6563
6830
|
* ```ts
|
|
6564
6831
|
* await registry.listen();
|
|
6565
|
-
* await registry.listen({
|
|
6832
|
+
* await registry.listen({ application: app });
|
|
6566
6833
|
* ```
|
|
6567
6834
|
*/
|
|
6568
6835
|
async listen(opts = {}) {
|
|
6569
|
-
const port = _nullishCoalesce(_nullishCoalesce(opts.port, () => (
|
|
6570
|
-
const publicDir = _nullishCoalesce(opts.publicDir, () => (
|
|
6836
|
+
const port = _nullishCoalesce(_nullishCoalesce(opts.port, () => ( _chunkNUMGL52Rcjs.parsePortEnv.call(void 0, process.env.RIVET_PORT))), () => ( 3e3));
|
|
6837
|
+
const publicDir = _nullishCoalesce(opts.publicDir, () => ( _chunkNUMGL52Rcjs.getRivetkitPublicDir.call(void 0, )));
|
|
6571
6838
|
const config = this.parseConfig();
|
|
6572
|
-
|
|
6839
|
+
if (opts.application && _chunkNUMGL52Rcjs.getRivetkitRuntimeMode.call(void 0, ) !== "serverless") {
|
|
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);
|
|
6573
6887
|
this.#runtimeServeConfiguredPromise = configuredRegistryPromise;
|
|
6574
6888
|
this.#runtimeServerlessPromise = configuredRegistryPromise;
|
|
6575
6889
|
this.#installSignalHandlers(config);
|
|
@@ -6580,9 +6894,15 @@ var Registry = class {
|
|
|
6580
6894
|
});
|
|
6581
6895
|
this.#ensureServerlessPoolConfigured(config);
|
|
6582
6896
|
const { runtime, registry, serveConfig } = await configuredRegistryPromise;
|
|
6897
|
+
const application = opts.application ? createApplicationFetch(opts.application, runtime) : void 0;
|
|
6583
6898
|
await runtime.serveListener(
|
|
6584
6899
|
registry,
|
|
6585
|
-
{
|
|
6900
|
+
{
|
|
6901
|
+
port,
|
|
6902
|
+
host: opts.host,
|
|
6903
|
+
publicDir,
|
|
6904
|
+
application
|
|
6905
|
+
},
|
|
6586
6906
|
serveConfig
|
|
6587
6907
|
);
|
|
6588
6908
|
}
|
|
@@ -6595,7 +6915,7 @@ var Registry = class {
|
|
|
6595
6915
|
return jsonRouteResponse(503, {
|
|
6596
6916
|
status: "not_started",
|
|
6597
6917
|
runtime: "rivetkit",
|
|
6598
|
-
version:
|
|
6918
|
+
version: _chunkNUMGL52Rcjs.VERSION
|
|
6599
6919
|
});
|
|
6600
6920
|
}
|
|
6601
6921
|
const { runtime, registry } = configured;
|
|
@@ -6603,7 +6923,7 @@ var Registry = class {
|
|
|
6603
6923
|
return jsonRouteResponse(501, {
|
|
6604
6924
|
status: "unsupported",
|
|
6605
6925
|
runtime: "rivetkit",
|
|
6606
|
-
version:
|
|
6926
|
+
version: _chunkNUMGL52Rcjs.VERSION
|
|
6607
6927
|
});
|
|
6608
6928
|
}
|
|
6609
6929
|
const response = await runtime.registryHealth(registry);
|
|
@@ -6682,11 +7002,9 @@ var Registry = class {
|
|
|
6682
7002
|
await runtime.serveRegistry(registry, serveConfig);
|
|
6683
7003
|
}
|
|
6684
7004
|
);
|
|
6685
|
-
this.#runtimeServePromise = this.#runtimeServeLifecyclePromise.catch(
|
|
6686
|
-
(
|
|
6687
|
-
|
|
6688
|
-
}
|
|
6689
|
-
);
|
|
7005
|
+
this.#runtimeServePromise = this.#runtimeServeLifecyclePromise.catch((error) => {
|
|
7006
|
+
logger2().warn({ error }, "runtime registry serve errored");
|
|
7007
|
+
});
|
|
6690
7008
|
this.#installSignalHandlers(config);
|
|
6691
7009
|
}
|
|
6692
7010
|
if (printWelcome) {
|
|
@@ -6793,6 +7111,9 @@ var Registry = class {
|
|
|
6793
7111
|
if (runtimeServePromise !== void 0) {
|
|
6794
7112
|
await runtimeServePromise.catch(() => void 0);
|
|
6795
7113
|
}
|
|
7114
|
+
if (this.#applicationListenerPromise !== void 0) {
|
|
7115
|
+
await this.#applicationListenerPromise.catch(() => void 0);
|
|
7116
|
+
}
|
|
6796
7117
|
};
|
|
6797
7118
|
await Promise.race([
|
|
6798
7119
|
drain(),
|
|
@@ -6843,11 +7164,13 @@ var Registry = class {
|
|
|
6843
7164
|
startAndWait() {
|
|
6844
7165
|
if (this.#shutdownInFlight !== null) {
|
|
6845
7166
|
return Promise.reject(
|
|
6846
|
-
new Error(
|
|
7167
|
+
new Error(
|
|
7168
|
+
"registry.startAndWait() cannot run after shutdown has begun"
|
|
7169
|
+
)
|
|
6847
7170
|
);
|
|
6848
7171
|
}
|
|
6849
7172
|
if (this.#runtimeReadyPromise) return this.#runtimeReadyPromise;
|
|
6850
|
-
if (
|
|
7173
|
+
if (_chunkNUMGL52Rcjs.getRivetkitRuntimeMode.call(void 0, ) === "serverless") {
|
|
6851
7174
|
return Promise.reject(
|
|
6852
7175
|
new Error(
|
|
6853
7176
|
"registry.startAndWait() requires envoy runtime mode; serverless registries become ready per request"
|
|
@@ -6884,7 +7207,9 @@ var Registry = class {
|
|
|
6884
7207
|
const readinessPromise = (async () => {
|
|
6885
7208
|
const { runtime, registry } = await configuredRegistryPromise;
|
|
6886
7209
|
const stoppedBeforeReady = serveLifecyclePromise.then(() => {
|
|
6887
|
-
throw new Error(
|
|
7210
|
+
throw new Error(
|
|
7211
|
+
"RivetKit registry stopped before becoming ready"
|
|
7212
|
+
);
|
|
6888
7213
|
});
|
|
6889
7214
|
await Promise.race([
|
|
6890
7215
|
runtime.waitRegistryReady(registry),
|
|
@@ -6915,8 +7240,8 @@ var Registry = class {
|
|
|
6915
7240
|
* ```
|
|
6916
7241
|
*/
|
|
6917
7242
|
start() {
|
|
6918
|
-
if (
|
|
6919
|
-
const publicDir = _nullishCoalesce(
|
|
7243
|
+
if (_chunkNUMGL52Rcjs.getRivetkitRuntimeMode.call(void 0, ) === "serverless") {
|
|
7244
|
+
const publicDir = _nullishCoalesce(_chunkNUMGL52Rcjs.getRivetkitPublicDir.call(void 0, ), () => ( "/public"));
|
|
6920
7245
|
this.listen({ publicDir }).catch((error) => {
|
|
6921
7246
|
logger2().error({ error }, "auto-listen failed; exiting");
|
|
6922
7247
|
if (typeof process !== "undefined" && typeof process.exit === "function") {
|
|
@@ -6937,7 +7262,7 @@ var Registry = class {
|
|
|
6937
7262
|
};
|
|
6938
7263
|
console.log();
|
|
6939
7264
|
console.log(
|
|
6940
|
-
` RivetKit ${
|
|
7265
|
+
` RivetKit ${_chunkNUMGL52Rcjs.VERSION} (Engine - ${kind === "serverless" ? "Serverless" : "Serverful"})`
|
|
6941
7266
|
);
|
|
6942
7267
|
if (config.namespace !== "default") {
|
|
6943
7268
|
logLine("Namespace", config.namespace);
|
|
@@ -7012,5 +7337,5 @@ function setup(input) {
|
|
|
7012
7337
|
|
|
7013
7338
|
|
|
7014
7339
|
|
|
7015
|
-
exports.ALLOWED_PUBLIC_HEADERS =
|
|
7340
|
+
exports.ALLOWED_PUBLIC_HEADERS = _chunk5MJPN3QUcjs.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 = _chunk5MJPN3QUcjs.createClientWithDriver; exports.event = event; exports.isStaticActorDefinition = isStaticActorDefinition; exports.isStaticActorInstance = isStaticActorInstance; exports.lookupInRegistry = lookupInRegistry; exports.noopNext = _chunkNUMGL52Rcjs.noopNext; exports.queue = queue; exports.setup = setup; exports.toUint8Array = _chunkNUMGL52Rcjs.toUint8Array;
|
|
7016
7341
|
//# sourceMappingURL=mod.cjs.map
|