rivetkit 3.1.2-rc.1 → 3.1.2-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 +1 -27
- package/dist/browser/client.js +1 -1
- 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/{chunk-TYNEZVC2.cjs → chunk-6BGQCMIF.cjs} +3 -3
- package/dist/tsup/{chunk-TYNEZVC2.cjs.map → chunk-6BGQCMIF.cjs.map} +1 -1
- package/dist/tsup/{chunk-DKVKYLXH.js → chunk-6MJSWO33.js} +4 -4
- package/dist/tsup/{chunk-J5ZNIJT3.js → chunk-6NHRZU52.js} +2 -2
- package/dist/tsup/{chunk-VUFOIAKH.cjs → chunk-A3N3LJC6.cjs} +10 -10
- package/dist/tsup/{chunk-VUFOIAKH.cjs.map → chunk-A3N3LJC6.cjs.map} +1 -1
- package/dist/tsup/{chunk-LNMODE5R.js → chunk-D2CCGHEJ.js} +4 -3
- package/dist/tsup/chunk-D2CCGHEJ.js.map +1 -0
- package/dist/tsup/{chunk-GI3TPFCE.cjs → chunk-DDF35AIK.cjs} +2 -2
- package/dist/tsup/{chunk-GI3TPFCE.cjs.map → chunk-DDF35AIK.cjs.map} +1 -1
- package/dist/tsup/{chunk-5RE3IF3C.js → chunk-I6P2AHO6.js} +2 -2
- package/dist/tsup/{chunk-7PUO5YRK.js → chunk-JGMXY4GD.js} +3 -3
- package/dist/tsup/{chunk-MM6QYEV7.cjs → chunk-L2XH4EXJ.cjs} +146 -146
- package/dist/tsup/{chunk-MM6QYEV7.cjs.map → chunk-L2XH4EXJ.cjs.map} +1 -1
- package/dist/tsup/{chunk-R2GD2TDD.cjs → chunk-LBYX466L.cjs} +3 -3
- package/dist/tsup/{chunk-R2GD2TDD.cjs.map → chunk-LBYX466L.cjs.map} +1 -1
- package/dist/tsup/{chunk-SPLLB6BX.js → chunk-MRWI2HTU.js} +2 -2
- package/dist/tsup/{chunk-WD6L6OTX.js → chunk-MVOIZGVC.js} +2 -2
- package/dist/tsup/{chunk-WD6L6OTX.js.map → chunk-MVOIZGVC.js.map} +1 -1
- package/dist/tsup/{chunk-YT77YM32.js → chunk-N2SQDK2F.js} +3 -3
- package/dist/tsup/{chunk-KOB3RR6D.cjs → chunk-QJ7MIAFD.cjs} +7 -7
- package/dist/tsup/{chunk-KOB3RR6D.cjs.map → chunk-QJ7MIAFD.cjs.map} +1 -1
- package/dist/tsup/{chunk-TR5YB355.cjs → chunk-TAK6KRMJ.cjs} +5 -4
- package/dist/tsup/chunk-TAK6KRMJ.cjs.map +1 -0
- package/dist/tsup/{chunk-YPJ3QEDL.cjs → chunk-YAGP66QF.cjs} +4 -4
- package/dist/tsup/{chunk-YPJ3QEDL.cjs.map → chunk-YAGP66QF.cjs.map} +1 -1
- package/dist/tsup/client/mod.cjs +5 -5
- package/dist/tsup/client/mod.d.cts +3 -3
- package/dist/tsup/client/mod.d.ts +3 -3
- 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-CTGjM4A5.d.cts → config-BMGUEKMZ.d.cts} +2 -2
- package/dist/tsup/{config-Df5jOcde.d.ts → config-CBTr4IhE.d.cts} +0 -26
- package/dist/tsup/{config-Df5jOcde.d.cts → config-CBTr4IhE.d.ts} +0 -26
- package/dist/tsup/{config-DLXQ_TVP.d.ts → config-iBpXyITj.d.ts} +2 -2
- package/dist/tsup/{context-Dmz9Hd6K.d.ts → context-hyVakgnU.d.ts} +2 -2
- package/dist/tsup/{context-S-Y75hj1.d.cts → context-qfvLuF0P.d.cts} +2 -2
- package/dist/tsup/db/drizzle.cjs +2 -2
- package/dist/tsup/db/drizzle.d.cts +1 -1
- package/dist/tsup/db/drizzle.d.ts +1 -1
- package/dist/tsup/db/drizzle.js +1 -1
- package/dist/tsup/db/mod.cjs +3 -3
- package/dist/tsup/db/mod.d.cts +2 -2
- package/dist/tsup/db/mod.d.ts +2 -2
- package/dist/tsup/db/mod.js +2 -2
- package/dist/tsup/dynamic/mod.d.cts +2 -2
- package/dist/tsup/dynamic/mod.d.ts +2 -2
- package/dist/tsup/inspector/mod.cjs +5 -5
- package/dist/tsup/inspector/mod.js +4 -4
- package/dist/tsup/inspector/workflow.cjs +4 -4
- package/dist/tsup/inspector/workflow.js +3 -3
- package/dist/tsup/inspector-tab/mod.d.cts +3 -3
- package/dist/tsup/inspector-tab/mod.d.ts +3 -3
- package/dist/tsup/mod.cjs +119 -105
- package/dist/tsup/mod.cjs.map +1 -1
- package/dist/tsup/mod.d.cts +4 -4
- package/dist/tsup/mod.d.ts +4 -4
- package/dist/tsup/mod.js +38 -24
- package/dist/tsup/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +6 -6
- package/dist/tsup/test/mod.d.cts +2 -2
- package/dist/tsup/test/mod.d.ts +2 -2
- package/dist/tsup/test/mod.js +4 -4
- package/dist/tsup/unstable/migrations.d.cts +1 -1
- package/dist/tsup/unstable/migrations.d.ts +1 -1
- package/dist/tsup/utils.cjs +2 -2
- package/dist/tsup/utils.js +1 -1
- package/dist/tsup/workflow/mod.cjs +35 -27
- package/dist/tsup/workflow/mod.cjs.map +1 -1
- package/dist/tsup/workflow/mod.d.cts +4 -4
- package/dist/tsup/workflow/mod.d.ts +4 -4
- package/dist/tsup/workflow/mod.js +32 -24
- package/dist/tsup/workflow/mod.js.map +1 -1
- package/package.json +9 -9
- package/src/common/database/config.ts +41 -28
- package/src/common/database/mod.ts +3 -0
- package/src/common/database/native-database.ts +25 -13
- package/src/registry/napi-runtime.ts +2 -0
- package/src/registry/native.ts +19 -9
- package/src/registry/runtime.ts +1 -0
- package/src/registry/wasm-runtime.ts +3 -1
- package/src/workflow/driver.ts +29 -20
- package/dist/tsup/chunk-LNMODE5R.js.map +0 -1
- package/dist/tsup/chunk-TR5YB355.cjs.map +0 -1
- /package/dist/tsup/{chunk-DKVKYLXH.js.map → chunk-6MJSWO33.js.map} +0 -0
- /package/dist/tsup/{chunk-J5ZNIJT3.js.map → chunk-6NHRZU52.js.map} +0 -0
- /package/dist/tsup/{chunk-5RE3IF3C.js.map → chunk-I6P2AHO6.js.map} +0 -0
- /package/dist/tsup/{chunk-7PUO5YRK.js.map → chunk-JGMXY4GD.js.map} +0 -0
- /package/dist/tsup/{chunk-SPLLB6BX.js.map → chunk-MRWI2HTU.js.map} +0 -0
- /package/dist/tsup/{chunk-YT77YM32.js.map → chunk-N2SQDK2F.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 _chunkYAGP66QFcjs = require('./chunk-YAGP66QF.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -35,17 +35,17 @@ var _chunkAQJFKHBKcjs = require('./chunk-AQJFKHBK.cjs');
|
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
|
|
38
|
-
var
|
|
38
|
+
var _chunkL2XH4EXJcjs = require('./chunk-L2XH4EXJ.cjs');
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
var _chunkRTWH3AX3cjs = require('./chunk-RTWH3AX3.cjs');
|
|
43
|
-
require('./chunk-
|
|
43
|
+
require('./chunk-LBYX466L.cjs');
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
|
|
47
47
|
|
|
48
|
-
var
|
|
48
|
+
var _chunkTAK6KRMJcjs = require('./chunk-TAK6KRMJ.cjs');
|
|
49
49
|
require('./chunk-KVFIONKQ.cjs');
|
|
50
50
|
|
|
51
51
|
|
|
@@ -80,7 +80,7 @@ require('./chunk-KVFIONKQ.cjs');
|
|
|
80
80
|
|
|
81
81
|
|
|
82
82
|
|
|
83
|
-
var
|
|
83
|
+
var _chunkDDF35AIKcjs = require('./chunk-DDF35AIK.cjs');
|
|
84
84
|
|
|
85
85
|
|
|
86
86
|
|
|
@@ -98,7 +98,7 @@ var _chunkMGI2VVF6cjs = require('./chunk-MGI2VVF6.cjs');
|
|
|
98
98
|
|
|
99
99
|
// src/actor/log.ts
|
|
100
100
|
function loggerWithoutContext() {
|
|
101
|
-
return
|
|
101
|
+
return _chunkDDF35AIKcjs.getLogger.call(void 0, "actor-runtime");
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
// src/actor/definition.ts
|
|
@@ -255,7 +255,7 @@ function validateSchemaSync(schemas, key, data) {
|
|
|
255
255
|
var _virtualwebsocket = require('@rivetkit/virtual-websocket');
|
|
256
256
|
var _ws = require('hono/ws');
|
|
257
257
|
function logger() {
|
|
258
|
-
return
|
|
258
|
+
return _chunkDDF35AIKcjs.getLogger.call(void 0, "inline-websocket-adapter");
|
|
259
259
|
}
|
|
260
260
|
var InlineWebSocketAdapter = class {
|
|
261
261
|
#handler;
|
|
@@ -407,7 +407,7 @@ var InlineWebSocketAdapter = class {
|
|
|
407
407
|
|
|
408
408
|
// src/registry/log.ts
|
|
409
409
|
function logger2() {
|
|
410
|
-
return
|
|
410
|
+
return _chunkDDF35AIKcjs.getLogger.call(void 0, "registry");
|
|
411
411
|
}
|
|
412
412
|
|
|
413
413
|
// src/serverless/configure.ts
|
|
@@ -453,8 +453,8 @@ async function configureServerlessPool(config) {
|
|
|
453
453
|
);
|
|
454
454
|
}
|
|
455
455
|
const customConfig = config.configurePool;
|
|
456
|
-
const clientConfig =
|
|
457
|
-
const dcsRes = await
|
|
456
|
+
const clientConfig = _chunkL2XH4EXJcjs.convertRegistryConfigToClientConfig.call(void 0, config);
|
|
457
|
+
const dcsRes = await _chunkL2XH4EXJcjs.getDatacenters.call(void 0, clientConfig);
|
|
458
458
|
const poolName = _nullishCoalesce(customConfig.name, () => ( "default"));
|
|
459
459
|
const serverlessToken = _nullishCoalesce(config.token, () => ( config.publicToken));
|
|
460
460
|
const headers = {
|
|
@@ -476,7 +476,7 @@ async function configureServerlessPool(config) {
|
|
|
476
476
|
metadata: _nullishCoalesce(customConfig.metadata, () => ( {})),
|
|
477
477
|
drain_on_version_upgrade: _nullishCoalesce(customConfig.drainOnVersionUpgrade, () => ( true))
|
|
478
478
|
};
|
|
479
|
-
await
|
|
479
|
+
await _chunkL2XH4EXJcjs.updateRunnerConfig.call(void 0, clientConfig, poolName, {
|
|
480
480
|
datacenters: Object.fromEntries(
|
|
481
481
|
dcsRes.datacenters.map((dc) => [dc.name, serverlessConfig])
|
|
482
482
|
)
|
|
@@ -493,7 +493,7 @@ async function configureServerlessPool(config) {
|
|
|
493
493
|
logger2().warn({
|
|
494
494
|
msg: "serverless pool configuration attempt failed",
|
|
495
495
|
attempts,
|
|
496
|
-
error:
|
|
496
|
+
error: _chunkDDF35AIKcjs.stringifyError.call(void 0, error)
|
|
497
497
|
});
|
|
498
498
|
await sleep(CONFIGURE_RETRY_DELAY_MS);
|
|
499
499
|
}
|
|
@@ -501,7 +501,7 @@ async function configureServerlessPool(config) {
|
|
|
501
501
|
logger2().error({
|
|
502
502
|
msg: "failed to configure serverless pool, validate endpoint is configured correctly then restart this process",
|
|
503
503
|
attempts,
|
|
504
|
-
error:
|
|
504
|
+
error: _chunkDDF35AIKcjs.stringifyError.call(void 0, lastError)
|
|
505
505
|
});
|
|
506
506
|
throw lastError;
|
|
507
507
|
}
|
|
@@ -512,10 +512,10 @@ var _zod = require('zod');
|
|
|
512
512
|
// src/registry/config/envoy.ts
|
|
513
513
|
var _v4 = require('zod/v4');
|
|
514
514
|
var EnvoyConfigSchema = _v4.z.object({
|
|
515
|
-
poolName: _v4.z.string().default(() => _nullishCoalesce(
|
|
516
|
-
version: _v4.z.number().default(() => _nullishCoalesce(
|
|
515
|
+
poolName: _v4.z.string().default(() => _nullishCoalesce(_chunkDDF35AIKcjs.getRivetPool.call(void 0, ), () => ( "default"))),
|
|
516
|
+
version: _v4.z.number().default(() => _nullishCoalesce(_chunkDDF35AIKcjs.getRivetEnvoyVersion.call(void 0, ), () => ( 1))),
|
|
517
517
|
// Deprecated.
|
|
518
|
-
totalSlots: _v4.z.number().default(() => _nullishCoalesce(
|
|
518
|
+
totalSlots: _v4.z.number().default(() => _nullishCoalesce(_chunkDDF35AIKcjs.getRivetTotalSlots.call(void 0, ), () => ( 1e5))),
|
|
519
519
|
nodeKey: _v4.z.string().optional()
|
|
520
520
|
});
|
|
521
521
|
|
|
@@ -553,7 +553,7 @@ var ServerlessConfigSchema = _v4.z.object({
|
|
|
553
553
|
*
|
|
554
554
|
* Can also be set via RIVET_PUBLIC_ENDPOINT environment variable.
|
|
555
555
|
*/
|
|
556
|
-
publicEndpoint: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => (
|
|
556
|
+
publicEndpoint: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkDDF35AIKcjs.getRivetPublicEndpoint.call(void 0, )))),
|
|
557
557
|
/**
|
|
558
558
|
* Token that clients should use when connecting via the public endpoint.
|
|
559
559
|
*
|
|
@@ -561,7 +561,7 @@ var ServerlessConfigSchema = _v4.z.object({
|
|
|
561
561
|
*
|
|
562
562
|
* Can also be specified in the publicEndpoint URL as `https://namespace:token@host`.
|
|
563
563
|
*/
|
|
564
|
-
publicToken: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => (
|
|
564
|
+
publicToken: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkDDF35AIKcjs.getRivetPublicToken.call(void 0, ))))
|
|
565
565
|
// There is no publicNamespace config option because the frontend and backend
|
|
566
566
|
// cannot use different namespaces. The namespace is extracted from the
|
|
567
567
|
// publicEndpoint URL auth syntax if provided.
|
|
@@ -615,7 +615,7 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
615
615
|
* Runtime binding to use for RivetKit core.
|
|
616
616
|
* */
|
|
617
617
|
runtime: RuntimeKindSchema.optional().transform((val, ctx) => {
|
|
618
|
-
const rawRuntime = _nullishCoalesce(val, () => (
|
|
618
|
+
const rawRuntime = _nullishCoalesce(val, () => ( _chunkDDF35AIKcjs.getRivetkitRuntime.call(void 0, )));
|
|
619
619
|
if (rawRuntime === void 0) {
|
|
620
620
|
return "auto";
|
|
621
621
|
}
|
|
@@ -652,7 +652,7 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
652
652
|
* */
|
|
653
653
|
logging: _zod.z.object({
|
|
654
654
|
baseLogger: _zod.z.custom().optional(),
|
|
655
|
-
level:
|
|
655
|
+
level: _chunkDDF35AIKcjs.LogLevelSchema.optional()
|
|
656
656
|
}).optional().default(() => ({})),
|
|
657
657
|
// MARK: Routing
|
|
658
658
|
// // This is a function to allow for lazy configuration of upgradeWebSocket on the
|
|
@@ -670,9 +670,9 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
670
670
|
*
|
|
671
671
|
* Can also be set via RIVET_ENDPOINT environment variables.
|
|
672
672
|
*/
|
|
673
|
-
endpoint: _zod.z.string().optional().transform((val) => _nullishCoalesce(_nullishCoalesce(val, () => (
|
|
674
|
-
token: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => (
|
|
675
|
-
namespace: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => (
|
|
673
|
+
endpoint: _zod.z.string().optional().transform((val) => _nullishCoalesce(_nullishCoalesce(val, () => ( _chunkDDF35AIKcjs.getRivetEngine.call(void 0, ))), () => ( _chunkDDF35AIKcjs.getRivetEndpoint.call(void 0, )))),
|
|
674
|
+
token: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkDDF35AIKcjs.getRivetToken.call(void 0, )))),
|
|
675
|
+
namespace: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkDDF35AIKcjs.getRivetNamespace.call(void 0, )))),
|
|
676
676
|
headers: _zod.z.record(_zod.z.string(), _zod.z.string()).optional().default({}),
|
|
677
677
|
// MARK: Client
|
|
678
678
|
// TODO:
|
|
@@ -712,21 +712,21 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
712
712
|
*
|
|
713
713
|
* Starts the full Rust engine process locally.
|
|
714
714
|
*/
|
|
715
|
-
startEngine: _zod.z.boolean().default(() =>
|
|
715
|
+
startEngine: _zod.z.boolean().default(() => _chunkDDF35AIKcjs.getRivetRunEngine.call(void 0, )),
|
|
716
716
|
/**
|
|
717
717
|
* @experimental
|
|
718
718
|
*
|
|
719
719
|
* Host to bind the spawned local engine process to.
|
|
720
720
|
*/
|
|
721
|
-
engineHost: _zod.z.string().optional().default(() => _nullishCoalesce(
|
|
721
|
+
engineHost: _zod.z.string().optional().default(() => _nullishCoalesce(_chunkDDF35AIKcjs.getRivetRunEngineHost.call(void 0, ), () => ( _chunkL2XH4EXJcjs.ENGINE_HOST))),
|
|
722
722
|
/**
|
|
723
723
|
* @experimental
|
|
724
724
|
*
|
|
725
725
|
* Port to bind the spawned local engine process to.
|
|
726
726
|
*/
|
|
727
|
-
enginePort: _zod.z.number().int().min(1).max(65535).optional().default(() => _nullishCoalesce(
|
|
727
|
+
enginePort: _zod.z.number().int().min(1).max(65535).optional().default(() => _nullishCoalesce(_chunkDDF35AIKcjs.getRivetRunEnginePort.call(void 0, ), () => ( _chunkL2XH4EXJcjs.ENGINE_PORT))),
|
|
728
728
|
/** @experimental */
|
|
729
|
-
engineVersion: _zod.z.string().optional().default(() => _nullishCoalesce(
|
|
729
|
+
engineVersion: _zod.z.string().optional().default(() => _nullishCoalesce(_chunkDDF35AIKcjs.getRivetRunEngineVersion.call(void 0, ), () => ( _chunkDDF35AIKcjs.VERSION))),
|
|
730
730
|
/**
|
|
731
731
|
* Starts the first-party Services actor host when RivetKit manages
|
|
732
732
|
* a local engine. Enabled by default for a managed local Engine. Set
|
|
@@ -783,7 +783,7 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
783
783
|
}))
|
|
784
784
|
}).transform((config, ctx) => {
|
|
785
785
|
var _a, _b, _c;
|
|
786
|
-
const isDevEnv =
|
|
786
|
+
const isDevEnv = _chunkDDF35AIKcjs.isDev.call(void 0, );
|
|
787
787
|
const sqliteBackend = _nullishCoalesce(((_a = config.sqlite) == null ? void 0 : _a.backend), () => ( ((_b = config.test) == null ? void 0 : _b.sqliteBackend)));
|
|
788
788
|
if (config.runtime === "wasm" && sqliteBackend === "local") {
|
|
789
789
|
ctx.addIssue({
|
|
@@ -793,7 +793,7 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
793
793
|
});
|
|
794
794
|
}
|
|
795
795
|
const sqlite = config.runtime === "wasm" && config.sqlite === void 0 ? { backend: "remote" } : config.sqlite;
|
|
796
|
-
const parsedEndpoint = config.endpoint ?
|
|
796
|
+
const parsedEndpoint = config.endpoint ? _chunkL2XH4EXJcjs.tryParseEndpoint.call(void 0, ctx, {
|
|
797
797
|
endpoint: config.endpoint,
|
|
798
798
|
path: ["endpoint"],
|
|
799
799
|
namespace: config.namespace,
|
|
@@ -812,19 +812,19 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
812
812
|
path: ["configurePool"]
|
|
813
813
|
});
|
|
814
814
|
}
|
|
815
|
-
const localEngineEndpoint =
|
|
815
|
+
const localEngineEndpoint = _chunkL2XH4EXJcjs.buildEngineEndpoint.call(void 0,
|
|
816
816
|
config.engineHost,
|
|
817
817
|
config.enginePort
|
|
818
818
|
);
|
|
819
819
|
const endpoint = config.startEngine ? localEngineEndpoint : _nullishCoalesce((parsedEndpoint == null ? void 0 : parsedEndpoint.endpoint), () => ( (isDevEnv ? localEngineEndpoint : void 0)));
|
|
820
820
|
const engineSpawn = !parsedEndpoint && Boolean(endpoint);
|
|
821
|
-
const startServices = _nullishCoalesce(_nullishCoalesce(config.startServices, () => (
|
|
821
|
+
const startServices = _nullishCoalesce(_nullishCoalesce(config.startServices, () => ( _chunkDDF35AIKcjs.getRivetRunServices.call(void 0, ))), () => ( engineSpawn));
|
|
822
822
|
const validateServerlessEndpoint = Boolean(
|
|
823
823
|
config.startEngine || parsedEndpoint
|
|
824
824
|
);
|
|
825
825
|
const namespace = _nullishCoalesce(_nullishCoalesce((parsedEndpoint == null ? void 0 : parsedEndpoint.namespace), () => ( config.namespace)), () => ( "default"));
|
|
826
|
-
const token = _nullishCoalesce(_nullishCoalesce((parsedEndpoint == null ? void 0 : parsedEndpoint.token), () => ( config.token)), () => ( (endpoint &&
|
|
827
|
-
const parsedPublicEndpoint = config.serverless.publicEndpoint ?
|
|
826
|
+
const token = _nullishCoalesce(_nullishCoalesce((parsedEndpoint == null ? void 0 : parsedEndpoint.token), () => ( config.token)), () => ( (endpoint && _chunkL2XH4EXJcjs.isLocalEngineEndpoint.call(void 0, endpoint) ? "default" : void 0)));
|
|
827
|
+
const parsedPublicEndpoint = config.serverless.publicEndpoint ? _chunkL2XH4EXJcjs.tryParseEndpoint.call(void 0, ctx, {
|
|
828
828
|
endpoint: config.serverless.publicEndpoint,
|
|
829
829
|
path: ["serverless", "publicEndpoint"]
|
|
830
830
|
}) : void 0;
|
|
@@ -929,7 +929,7 @@ var DocRegistryConfigSchema = _zod.z.object({
|
|
|
929
929
|
noWelcome: _zod.z.boolean().optional().describe("Disable the welcome message on startup. Default: false"),
|
|
930
930
|
sqlite: DocSqliteConfigSchema,
|
|
931
931
|
logging: _zod.z.object({
|
|
932
|
-
level:
|
|
932
|
+
level: _chunkDDF35AIKcjs.LogLevelSchema.optional().describe(
|
|
933
933
|
"Log level for RivetKit. Default: 'warn'"
|
|
934
934
|
)
|
|
935
935
|
}).optional().describe("Logging configuration."),
|
|
@@ -971,6 +971,7 @@ var DocRegistryConfigSchema = _zod.z.object({
|
|
|
971
971
|
|
|
972
972
|
|
|
973
973
|
// src/common/database/native-database.ts
|
|
974
|
+
var EXECUTE_BATCH_TRANSACTION_NAME = "rivetkit-execute-batch";
|
|
974
975
|
function isSynchronousTransaction(transaction) {
|
|
975
976
|
const candidate = transaction;
|
|
976
977
|
return typeof candidate.commitSync === "function" && typeof candidate.rollbackSync === "function";
|
|
@@ -995,16 +996,18 @@ function toNativeBinding(arg) {
|
|
|
995
996
|
if (arg === null || arg === void 0) {
|
|
996
997
|
return { kind: "null" };
|
|
997
998
|
}
|
|
998
|
-
if (typeof arg === "bigint"
|
|
999
|
-
|
|
1000
|
-
if (!Number.isSafeInteger(value)) {
|
|
999
|
+
if (typeof arg === "bigint") {
|
|
1000
|
+
if (arg > BigInt(Number.MAX_SAFE_INTEGER) || arg < BigInt(Number.MIN_SAFE_INTEGER)) {
|
|
1001
1001
|
throw new RangeError(
|
|
1002
|
-
"SQLite
|
|
1002
|
+
"SQLite bigint bindings must be within the JavaScript safe integer range."
|
|
1003
1003
|
);
|
|
1004
1004
|
}
|
|
1005
|
-
return { kind: "int", intValue:
|
|
1005
|
+
return { kind: "int", intValue: Number(arg) };
|
|
1006
1006
|
}
|
|
1007
1007
|
if (typeof arg === "number") {
|
|
1008
|
+
if (Number.isInteger(arg)) {
|
|
1009
|
+
return { kind: "int", intValue: arg };
|
|
1010
|
+
}
|
|
1008
1011
|
return { kind: "float", floatValue: arg };
|
|
1009
1012
|
}
|
|
1010
1013
|
if (typeof arg === "string") {
|
|
@@ -1236,7 +1239,10 @@ function wrapJsNativeDatabase(database) {
|
|
|
1236
1239
|
let transaction;
|
|
1237
1240
|
try {
|
|
1238
1241
|
const results = database.executeBatch ? await database.executeBatch(nativeStatements) : await (async () => {
|
|
1239
|
-
transaction = await database.beginTransaction(
|
|
1242
|
+
transaction = await database.beginTransaction(
|
|
1243
|
+
void 0,
|
|
1244
|
+
EXECUTE_BATCH_TRANSACTION_NAME
|
|
1245
|
+
);
|
|
1240
1246
|
const transactionResults = [];
|
|
1241
1247
|
for (const statement of nativeStatements) {
|
|
1242
1248
|
transactionResults.push(
|
|
@@ -1300,7 +1306,7 @@ function wrapJsNativeDatabase(database) {
|
|
|
1300
1306
|
}
|
|
1301
1307
|
});
|
|
1302
1308
|
},
|
|
1303
|
-
async beginStateTransaction(timeoutMs, context) {
|
|
1309
|
+
async beginStateTransaction(timeoutMs, context, name) {
|
|
1304
1310
|
if (!database.beginStateTransaction) {
|
|
1305
1311
|
throw new Error("actor state transactions are not configured");
|
|
1306
1312
|
}
|
|
@@ -1309,7 +1315,8 @@ function wrapJsNativeDatabase(database) {
|
|
|
1309
1315
|
try {
|
|
1310
1316
|
transaction = await database.beginStateTransaction(
|
|
1311
1317
|
timeoutMs,
|
|
1312
|
-
context
|
|
1318
|
+
context,
|
|
1319
|
+
name
|
|
1313
1320
|
);
|
|
1314
1321
|
} catch (error) {
|
|
1315
1322
|
enrichNativeDatabaseError(database, error);
|
|
@@ -1710,7 +1717,7 @@ var NapiCoreRuntime = (_class = class {
|
|
|
1710
1717
|
if (!(active == null ? void 0 : active.sameActorInstance(ownerCtx))) {
|
|
1711
1718
|
return ownerCtx;
|
|
1712
1719
|
}
|
|
1713
|
-
const applicationSpan =
|
|
1720
|
+
const applicationSpan = _chunkL2XH4EXJcjs.readActiveTraceHeaders.call(void 0, );
|
|
1714
1721
|
if (!applicationSpan) {
|
|
1715
1722
|
return active;
|
|
1716
1723
|
}
|
|
@@ -1923,7 +1930,7 @@ var NapiCoreRuntime = (_class = class {
|
|
|
1923
1930
|
const span = (_a = nativeCtx.invocationTraceContext()) == null ? void 0 : _a.span;
|
|
1924
1931
|
return this.#invocationContext.run(
|
|
1925
1932
|
nativeCtx,
|
|
1926
|
-
() =>
|
|
1933
|
+
() => _chunkL2XH4EXJcjs.runWithActorInvocationSpan.call(void 0, span, run)
|
|
1927
1934
|
);
|
|
1928
1935
|
}
|
|
1929
1936
|
actorInvocationTraceContext(ctx) {
|
|
@@ -2135,9 +2142,10 @@ var NapiCoreRuntime = (_class = class {
|
|
|
2135
2142
|
actorSqlTransactionRollbackSync(transaction) {
|
|
2136
2143
|
asNativeSqlTransaction(transaction).rollbackSync();
|
|
2137
2144
|
}
|
|
2138
|
-
async actorBeginStateTransaction(ctx, timeoutMs) {
|
|
2145
|
+
async actorBeginStateTransaction(ctx, timeoutMs, name) {
|
|
2139
2146
|
return await this.#actorContextForOperation(ctx).beginStateTransaction(
|
|
2140
|
-
timeoutMs
|
|
2147
|
+
timeoutMs,
|
|
2148
|
+
name
|
|
2141
2149
|
);
|
|
2142
2150
|
}
|
|
2143
2151
|
async actorStateTransactionExecute(transaction, sql, params) {
|
|
@@ -2345,8 +2353,8 @@ function runtimeBytesToArrayBuffer(value) {
|
|
|
2345
2353
|
function buildNativeHttpRequest(init) {
|
|
2346
2354
|
var _a;
|
|
2347
2355
|
const headers = new Headers(init.headers);
|
|
2348
|
-
const originalUrl = headers.get(
|
|
2349
|
-
headers.delete(
|
|
2356
|
+
const originalUrl = headers.get(_chunkL2XH4EXJcjs.HEADER_ORIGINAL_REQUEST_URL);
|
|
2357
|
+
headers.delete(_chunkL2XH4EXJcjs.HEADER_ORIGINAL_REQUEST_URL);
|
|
2350
2358
|
const url = _nullishCoalesce(originalUrl, () => ( (init.uri.startsWith("http") ? init.uri : new URL(init.uri, "http://127.0.0.1").toString())));
|
|
2351
2359
|
const method2 = init.method.toUpperCase();
|
|
2352
2360
|
const bodyForbidden = method2 === "GET" || method2 === "HEAD";
|
|
@@ -2425,7 +2433,7 @@ async function pumpResponseBody(reader, stream) {
|
|
|
2425
2433
|
}
|
|
2426
2434
|
} catch (error) {
|
|
2427
2435
|
try {
|
|
2428
|
-
await stream.error(
|
|
2436
|
+
await stream.error(_chunkDDF35AIKcjs.stringifyError.call(void 0, error));
|
|
2429
2437
|
} catch (streamError) {
|
|
2430
2438
|
logger2().debug({
|
|
2431
2439
|
msg: "failed to report native http response stream error",
|
|
@@ -3275,9 +3283,9 @@ var WasmCoreRuntime = (_class2 = class {
|
|
|
3275
3283
|
actorSqlTransactionRollbackSync(_transaction) {
|
|
3276
3284
|
synchronousSqliteUnavailable();
|
|
3277
3285
|
}
|
|
3278
|
-
async actorBeginStateTransaction(ctx, timeoutMs) {
|
|
3286
|
+
async actorBeginStateTransaction(ctx, timeoutMs, name) {
|
|
3279
3287
|
return await callWasm(
|
|
3280
|
-
() => asWasmActorContext(ctx).beginStateTransaction(timeoutMs)
|
|
3288
|
+
() => asWasmActorContext(ctx).beginStateTransaction(timeoutMs, name)
|
|
3281
3289
|
);
|
|
3282
3290
|
}
|
|
3283
3291
|
async actorStateTransactionExecute(transaction, sql, params) {
|
|
@@ -3710,7 +3718,7 @@ async function loadAutoRuntime(config, loaders = defaultRuntimeLoaders) {
|
|
|
3710
3718
|
nativeError = error;
|
|
3711
3719
|
logger2().warn({
|
|
3712
3720
|
msg: "native runtime failed to load; falling back to wasm",
|
|
3713
|
-
error:
|
|
3721
|
+
error: _chunkDDF35AIKcjs.stringifyError.call(void 0, error)
|
|
3714
3722
|
});
|
|
3715
3723
|
}
|
|
3716
3724
|
try {
|
|
@@ -3719,7 +3727,7 @@ async function loadAutoRuntime(config, loaders = defaultRuntimeLoaders) {
|
|
|
3719
3727
|
throw new (0, _chunkMGI2VVF6cjs.RivetError)(
|
|
3720
3728
|
"config",
|
|
3721
3729
|
"runtime_unavailable",
|
|
3722
|
-
`RivetKit could not load a core runtime. Native runtime: ${
|
|
3730
|
+
`RivetKit could not load a core runtime. Native runtime: ${_chunkDDF35AIKcjs.stringifyError.call(void 0, nativeError)} Wasm runtime: ${_chunkDDF35AIKcjs.stringifyError.call(void 0, wasmError)}`,
|
|
3723
3731
|
{
|
|
3724
3732
|
public: true,
|
|
3725
3733
|
statusCode: 500
|
|
@@ -3927,7 +3935,7 @@ async function cleanupNativeSleepRuntimeState(runtime, ctx, afterTrackedWorkDrai
|
|
|
3927
3935
|
}).catch((error) => {
|
|
3928
3936
|
logger2().warn({
|
|
3929
3937
|
msg: "deferred native sleep cleanup failed",
|
|
3930
|
-
error:
|
|
3938
|
+
error: _chunkDDF35AIKcjs.stringifyError.call(void 0, error)
|
|
3931
3939
|
});
|
|
3932
3940
|
});
|
|
3933
3941
|
return;
|
|
@@ -4006,7 +4014,7 @@ function getOrCreateNativeSqlDatabase(runtime, ctx) {
|
|
|
4006
4014
|
);
|
|
4007
4015
|
return createNativeSqlTransaction(runtime, transaction);
|
|
4008
4016
|
},
|
|
4009
|
-
beginStateTransaction: async (timeoutMs, context) => {
|
|
4017
|
+
beginStateTransaction: async (timeoutMs, context, name) => {
|
|
4010
4018
|
const scope = context;
|
|
4011
4019
|
if (!scope) {
|
|
4012
4020
|
throw new Error(
|
|
@@ -4015,7 +4023,8 @@ function getOrCreateNativeSqlDatabase(runtime, ctx) {
|
|
|
4015
4023
|
}
|
|
4016
4024
|
const transaction = await runtime.actorBeginStateTransaction(
|
|
4017
4025
|
ctx,
|
|
4018
|
-
timeoutMs
|
|
4026
|
+
timeoutMs,
|
|
4027
|
+
name
|
|
4019
4028
|
);
|
|
4020
4029
|
return {
|
|
4021
4030
|
exec: async () => {
|
|
@@ -4117,10 +4126,10 @@ function decodeValue(value) {
|
|
|
4117
4126
|
if (!value || value.length === 0) {
|
|
4118
4127
|
return void 0;
|
|
4119
4128
|
}
|
|
4120
|
-
return
|
|
4129
|
+
return _chunkDDF35AIKcjs.decodeCborCompat.call(void 0, value);
|
|
4121
4130
|
}
|
|
4122
4131
|
function encodeValue(value) {
|
|
4123
|
-
return
|
|
4132
|
+
return _chunkDDF35AIKcjs.encodeCborCompat.call(void 0, value);
|
|
4124
4133
|
}
|
|
4125
4134
|
function normalizeArgs(value) {
|
|
4126
4135
|
return Array.isArray(value) ? value : value === void 0 || value === null ? [] : [value];
|
|
@@ -4156,7 +4165,7 @@ function isStructuredBridgeError(error) {
|
|
|
4156
4165
|
return _chunkMGI2VVF6cjs.isRivetErrorLike.call(void 0, error) && "__type" in error && (error.__type === "RivetError" || error.__type === "ActorError");
|
|
4157
4166
|
}
|
|
4158
4167
|
function encodeNativeCallbackError(error) {
|
|
4159
|
-
const structuredError = isStructuredBridgeError(error) ? error :
|
|
4168
|
+
const structuredError = isStructuredBridgeError(error) ? error : _chunkDDF35AIKcjs.deconstructError.call(void 0, error, true);
|
|
4160
4169
|
const { encoded, droppedMetadataCause } = _chunkMGI2VVF6cjs.encodeBridgeRivetError.call(void 0, structuredError);
|
|
4161
4170
|
if (droppedMetadataCause !== void 0) {
|
|
4162
4171
|
logger2().warn(
|
|
@@ -4218,7 +4227,7 @@ function decodeWorkflowCbor(data) {
|
|
|
4218
4227
|
return null;
|
|
4219
4228
|
}
|
|
4220
4229
|
try {
|
|
4221
|
-
return
|
|
4230
|
+
return _chunkDDF35AIKcjs.decodeCborCompat.call(void 0, new Uint8Array(data));
|
|
4222
4231
|
} catch (e3) {
|
|
4223
4232
|
return null;
|
|
4224
4233
|
}
|
|
@@ -4331,7 +4340,7 @@ function serializeWorkflowHistoryForJson(data) {
|
|
|
4331
4340
|
if (data === null) {
|
|
4332
4341
|
return null;
|
|
4333
4342
|
}
|
|
4334
|
-
const history =
|
|
4343
|
+
const history = _chunkYAGP66QFcjs.decodeWorkflowHistoryTransport.call(void 0, data);
|
|
4335
4344
|
return jsonSafe({
|
|
4336
4345
|
nameRegistry: [...history.nameRegistry],
|
|
4337
4346
|
entries: history.entries.map((entry) => ({
|
|
@@ -4477,7 +4486,7 @@ var NativeConnAdapter = class {
|
|
|
4477
4486
|
},
|
|
4478
4487
|
(newValue) => {
|
|
4479
4488
|
assertCurrentState();
|
|
4480
|
-
|
|
4489
|
+
_chunkDDF35AIKcjs.assertJsonCompatValue.call(void 0, newValue);
|
|
4481
4490
|
}
|
|
4482
4491
|
);
|
|
4483
4492
|
}
|
|
@@ -4485,7 +4494,7 @@ var NativeConnAdapter = class {
|
|
|
4485
4494
|
var _a;
|
|
4486
4495
|
(_a = this.#assertCanMutateState) == null ? void 0 : _a.call(this);
|
|
4487
4496
|
const nextValue = unwrapWriteThroughProxy(value);
|
|
4488
|
-
|
|
4497
|
+
_chunkDDF35AIKcjs.assertJsonCompatValue.call(void 0, nextValue);
|
|
4489
4498
|
this.#writeState(nextValue, { writeNative: true });
|
|
4490
4499
|
}
|
|
4491
4500
|
initializeState(value) {
|
|
@@ -5559,7 +5568,7 @@ var ActorContextHandleAdapter = class {
|
|
|
5559
5568
|
},
|
|
5560
5569
|
(newValue) => {
|
|
5561
5570
|
assertCurrentState();
|
|
5562
|
-
|
|
5571
|
+
_chunkDDF35AIKcjs.assertJsonCompatValue.call(void 0, newValue);
|
|
5563
5572
|
}
|
|
5564
5573
|
);
|
|
5565
5574
|
}
|
|
@@ -5571,7 +5580,7 @@ var ActorContextHandleAdapter = class {
|
|
|
5571
5580
|
}
|
|
5572
5581
|
this.#assertCanMutateState();
|
|
5573
5582
|
const nextValue = unwrapWriteThroughProxy(value);
|
|
5574
|
-
|
|
5583
|
+
_chunkDDF35AIKcjs.assertJsonCompatValue.call(void 0, nextValue);
|
|
5575
5584
|
this.#writeState(nextValue, { scheduleSave: true });
|
|
5576
5585
|
}
|
|
5577
5586
|
initializeState(value) {
|
|
@@ -5797,7 +5806,7 @@ var ActorContextHandleAdapter = class {
|
|
|
5797
5806
|
log: {
|
|
5798
5807
|
debug: (obj) => logger2().debug(obj)
|
|
5799
5808
|
},
|
|
5800
|
-
nativeDatabaseProvider:
|
|
5809
|
+
nativeDatabaseProvider: _chunkTAK6KRMJcjs.registerNativeStateTransactionOpener.call(void 0,
|
|
5801
5810
|
{
|
|
5802
5811
|
open: async (requestedActorId) => {
|
|
5803
5812
|
void requestedActorId;
|
|
@@ -5805,14 +5814,16 @@ var ActorContextHandleAdapter = class {
|
|
|
5805
5814
|
this.#runtime,
|
|
5806
5815
|
this.#ctx
|
|
5807
5816
|
);
|
|
5808
|
-
|
|
5817
|
+
if (usesSqliteDeferredCommits(this.#databaseProvider)) {
|
|
5818
|
+
await database.open();
|
|
5819
|
+
}
|
|
5809
5820
|
return database;
|
|
5810
5821
|
}
|
|
5811
5822
|
},
|
|
5812
|
-
async (timeoutMs, context) => await getOrCreateNativeSqlDatabase(
|
|
5823
|
+
async (timeoutMs, context, name) => await getOrCreateNativeSqlDatabase(
|
|
5813
5824
|
this.#runtime,
|
|
5814
5825
|
this.#ctx
|
|
5815
|
-
).beginStateTransaction(timeoutMs, context)
|
|
5826
|
+
).beginStateTransaction(timeoutMs, context, name)
|
|
5816
5827
|
)
|
|
5817
5828
|
});
|
|
5818
5829
|
runtimeState.databaseClient = {
|
|
@@ -5822,7 +5833,7 @@ var ActorContextHandleAdapter = class {
|
|
|
5822
5833
|
return this.#db;
|
|
5823
5834
|
}
|
|
5824
5835
|
#bindDatabaseClient(client) {
|
|
5825
|
-
return
|
|
5836
|
+
return _chunkTAK6KRMJcjs.bindNativeStateTransactionContext.call(void 0, client, {
|
|
5826
5837
|
enter: async () => await this.#enterStateTransaction(),
|
|
5827
5838
|
exit: (scope) => this.#exitStateTransaction(
|
|
5828
5839
|
scope
|
|
@@ -6026,7 +6037,7 @@ var ActorContextHandleAdapter = class {
|
|
|
6026
6037
|
const trackedPromise = Promise.resolve(promise).catch((error) => {
|
|
6027
6038
|
logger2().warn({
|
|
6028
6039
|
msg: "keepAwake promise rejected",
|
|
6029
|
-
error:
|
|
6040
|
+
error: _chunkDDF35AIKcjs.stringifyError.call(void 0, error)
|
|
6030
6041
|
});
|
|
6031
6042
|
}).then(() => null);
|
|
6032
6043
|
try {
|
|
@@ -6410,14 +6421,17 @@ function buildActorTracingConfig(actions, tracing) {
|
|
|
6410
6421
|
};
|
|
6411
6422
|
}
|
|
6412
6423
|
var SQLITE_DEFERRED_COMMITS = /* @__PURE__ */ Symbol.for("rivetkit.sqlite.deferredCommits");
|
|
6424
|
+
function usesSqliteDeferredCommits(databaseProvider) {
|
|
6425
|
+
return (databaseProvider == null ? void 0 : databaseProvider[SQLITE_DEFERRED_COMMITS]) === true;
|
|
6426
|
+
}
|
|
6413
6427
|
function buildActorConfig(definition, registryConfig, runtimeKind) {
|
|
6414
|
-
var _a
|
|
6428
|
+
var _a;
|
|
6415
6429
|
const config = definition.config;
|
|
6416
6430
|
const options = _nullishCoalesce(config.options, () => ( {}));
|
|
6417
6431
|
const canHibernate = options.canHibernateWebSocket;
|
|
6418
6432
|
const usesRemoteSqlite = sqliteBackendForConfig(registryConfig) === "remote";
|
|
6419
6433
|
const sqliteProfiling = (_a = config.db) == null ? void 0 : _a.sqliteProfiling;
|
|
6420
|
-
const sqliteDeferredCommits = (
|
|
6434
|
+
const sqliteDeferredCommits = usesSqliteDeferredCommits(config.db);
|
|
6421
6435
|
return {
|
|
6422
6436
|
name: options.name,
|
|
6423
6437
|
icon: options.icon,
|
|
@@ -6526,7 +6540,7 @@ function validateInspectorTabSource(tabId, resolved) {
|
|
|
6526
6540
|
function buildNativeFactory(runtime, registryConfig, definition) {
|
|
6527
6541
|
var _a;
|
|
6528
6542
|
const config = definition.config;
|
|
6529
|
-
const databaseProvider = _nullishCoalesce(config.db, () => (
|
|
6543
|
+
const databaseProvider = _nullishCoalesce(config.db, () => ( _chunkTAK6KRMJcjs.db.call(void 0, )));
|
|
6530
6544
|
const actionHandlers = _chunkAQJFKHBKcjs.flattenActionHandlers.call(void 0, config.actions);
|
|
6531
6545
|
const schemaConfig = {
|
|
6532
6546
|
actionInputSchemas: _chunkAQJFKHBKcjs.flattenActionInputSchemas.call(void 0,
|
|
@@ -6537,9 +6551,9 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
6537
6551
|
events: config.events,
|
|
6538
6552
|
queues: config.queues
|
|
6539
6553
|
};
|
|
6540
|
-
const createClient = (ctx) =>
|
|
6541
|
-
new (0,
|
|
6542
|
-
|
|
6554
|
+
const createClient = (ctx) => _chunkL2XH4EXJcjs.createClientWithDriver.call(void 0,
|
|
6555
|
+
new (0, _chunkL2XH4EXJcjs.RemoteEngineControlClient)(
|
|
6556
|
+
_chunkL2XH4EXJcjs.convertRegistryConfigToClientConfig.call(void 0, registryConfig)
|
|
6543
6557
|
),
|
|
6544
6558
|
{
|
|
6545
6559
|
encoding: "bare",
|
|
@@ -6731,7 +6745,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
6731
6745
|
400
|
|
6732
6746
|
);
|
|
6733
6747
|
}
|
|
6734
|
-
const cbor =
|
|
6748
|
+
const cbor = _chunkDDF35AIKcjs.encodeCborCompat.call(void 0,
|
|
6735
6749
|
_nullishCoalesce(body.body, () => ( null))
|
|
6736
6750
|
);
|
|
6737
6751
|
const message = await runtime.actorQueueSend(ctx, name, cbor);
|
|
@@ -7347,7 +7361,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
7347
7361
|
...request,
|
|
7348
7362
|
abortController: requestAbortController
|
|
7349
7363
|
});
|
|
7350
|
-
const rawConnParams = handlerRequest.headers.get(
|
|
7364
|
+
const rawConnParams = handlerRequest.headers.get(_chunkL2XH4EXJcjs.HEADER_CONN_PARAMS);
|
|
7351
7365
|
let requestCtx;
|
|
7352
7366
|
let conn;
|
|
7353
7367
|
let removeRequestAbortListener;
|
|
@@ -7404,7 +7418,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
7404
7418
|
requestCtx,
|
|
7405
7419
|
handlerRequest
|
|
7406
7420
|
);
|
|
7407
|
-
if (!
|
|
7421
|
+
if (!_chunkL2XH4EXJcjs.isResponseLike.call(void 0, response)) {
|
|
7408
7422
|
throw new Error(
|
|
7409
7423
|
"onRequest handler must return a Response"
|
|
7410
7424
|
);
|
|
@@ -7499,7 +7513,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
7499
7513
|
var _a2;
|
|
7500
7514
|
const { ctx } = unwrapTsfnPayload(error, payload);
|
|
7501
7515
|
const history = (_a2 = getNativeWorkflowInspector(ctx)) == null ? void 0 : _a2.getHistory();
|
|
7502
|
-
return history == null ? void 0 :
|
|
7516
|
+
return history == null ? void 0 : _chunkDDF35AIKcjs.toUint8Array.call(void 0, history);
|
|
7503
7517
|
}
|
|
7504
7518
|
) : void 0,
|
|
7505
7519
|
replayWorkflow: _chunkAQJFKHBKcjs.hasRunInspectorConfig.call(void 0, config.run) ? wrapNativeCallback(
|
|
@@ -7513,7 +7527,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
7513
7527
|
return void 0;
|
|
7514
7528
|
}
|
|
7515
7529
|
const history = await _asyncNullishCoalesce(await workflowInspector.replayFromStep(entryId), async () => ( null));
|
|
7516
|
-
return history == null ? void 0 :
|
|
7530
|
+
return history == null ? void 0 : _chunkDDF35AIKcjs.toUint8Array.call(void 0, history);
|
|
7517
7531
|
}
|
|
7518
7532
|
) : void 0,
|
|
7519
7533
|
actions: Object.fromEntries(
|
|
@@ -7655,7 +7669,7 @@ async function buildServeConfig(config, resolveNativeBinaries = true) {
|
|
|
7655
7669
|
startServices: resolveNativeBinaries && config.startServices,
|
|
7656
7670
|
handleInspectorHttpInRuntime: true,
|
|
7657
7671
|
serverlessBasePath: config.serverless.basePath,
|
|
7658
|
-
serverlessPackageVersion:
|
|
7672
|
+
serverlessPackageVersion: _chunkDDF35AIKcjs.VERSION,
|
|
7659
7673
|
serverlessClientEndpoint: config.publicEndpoint,
|
|
7660
7674
|
serverlessClientNamespace: config.publicNamespace,
|
|
7661
7675
|
serverlessClientToken: config.publicToken,
|
|
@@ -7669,12 +7683,12 @@ async function buildServeConfig(config, resolveNativeBinaries = true) {
|
|
|
7669
7683
|
} catch (error) {
|
|
7670
7684
|
logger2().warn({
|
|
7671
7685
|
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",
|
|
7672
|
-
error:
|
|
7686
|
+
error: _chunkDDF35AIKcjs.stringifyError.call(void 0, error)
|
|
7673
7687
|
});
|
|
7674
7688
|
}
|
|
7675
7689
|
}
|
|
7676
7690
|
if (resolveNativeBinaries && config.startServices) {
|
|
7677
|
-
const servicesBinary =
|
|
7691
|
+
const servicesBinary = _chunkDDF35AIKcjs.getEnvUniversal.call(void 0, "RIVET_SERVICES_BINARY");
|
|
7678
7692
|
if (servicesBinary) {
|
|
7679
7693
|
serveConfig.servicesBinaryPath = servicesBinary;
|
|
7680
7694
|
} else {
|
|
@@ -7689,13 +7703,13 @@ async function buildServeConfig(config, resolveNativeBinaries = true) {
|
|
|
7689
7703
|
serveConfig.engineHost = config.engineHost;
|
|
7690
7704
|
serveConfig.enginePort = config.enginePort;
|
|
7691
7705
|
if ((_a = config.test) == null ? void 0 : _a.enabled) {
|
|
7692
|
-
serveConfig.inspectorTestToken = _nullishCoalesce(
|
|
7706
|
+
serveConfig.inspectorTestToken = _nullishCoalesce(_chunkDDF35AIKcjs.getEnvUniversal.call(void 0, "_RIVET_TEST_INSPECTOR_TOKEN"), () => ( "token"));
|
|
7693
7707
|
}
|
|
7694
7708
|
return serveConfig;
|
|
7695
7709
|
}
|
|
7696
7710
|
async function buildRegistryWithRuntime(config, runtime) {
|
|
7697
7711
|
var _a;
|
|
7698
|
-
if (((_a = config.test) == null ? void 0 : _a.enabled) &&
|
|
7712
|
+
if (((_a = config.test) == null ? void 0 : _a.enabled) && _chunkDDF35AIKcjs.getEnvUniversal.call(void 0, "_RIVET_TEST_INSPECTOR_TOKEN") === void 0) {
|
|
7699
7713
|
trySetProcessEnv("_RIVET_TEST_INSPECTOR_TOKEN", "token");
|
|
7700
7714
|
}
|
|
7701
7715
|
if (runtime.kind === "napi") {
|
|
@@ -7768,7 +7782,7 @@ function createApplicationFetch(application, runtime) {
|
|
|
7768
7782
|
signal: abortController.signal
|
|
7769
7783
|
})
|
|
7770
7784
|
);
|
|
7771
|
-
if (!
|
|
7785
|
+
if (!_chunkL2XH4EXJcjs.isResponseLike.call(void 0, response)) {
|
|
7772
7786
|
throw new TypeError(
|
|
7773
7787
|
"registry.listen() application fetch must return a Response"
|
|
7774
7788
|
);
|
|
@@ -7823,7 +7837,7 @@ var Registry = class {
|
|
|
7823
7837
|
var _a;
|
|
7824
7838
|
this.#config = config;
|
|
7825
7839
|
if ((_a = config.logging) == null ? void 0 : _a.baseLogger) {
|
|
7826
|
-
|
|
7840
|
+
_chunkDDF35AIKcjs.configureBaseLogger.call(void 0, config.logging.baseLogger);
|
|
7827
7841
|
}
|
|
7828
7842
|
this.#buildConfiguredRegistry = _nullishCoalesce((deps == null ? void 0 : deps.buildConfiguredRegistry), () => ( buildConfiguredRegistry));
|
|
7829
7843
|
this.routes = {
|
|
@@ -8055,10 +8069,10 @@ var Registry = class {
|
|
|
8055
8069
|
if (!opts.application) {
|
|
8056
8070
|
rejectServerless();
|
|
8057
8071
|
}
|
|
8058
|
-
const port = _nullishCoalesce(_nullishCoalesce(opts.port, () => (
|
|
8059
|
-
const publicDir = _nullishCoalesce(opts.publicDir, () => (
|
|
8072
|
+
const port = _nullishCoalesce(_nullishCoalesce(opts.port, () => ( _chunkDDF35AIKcjs.parsePortEnv.call(void 0, process.env.RIVET_PORT))), () => ( 3e3));
|
|
8073
|
+
const publicDir = _nullishCoalesce(opts.publicDir, () => ( _chunkDDF35AIKcjs.getRivetkitPublicDir.call(void 0, )));
|
|
8060
8074
|
const config = this.parseConfig();
|
|
8061
|
-
if (opts.application &&
|
|
8075
|
+
if (opts.application && _chunkDDF35AIKcjs.getRivetkitRuntimeMode.call(void 0, ) !== "serverless") {
|
|
8062
8076
|
if (config.runtime === "wasm") {
|
|
8063
8077
|
throw new Error(
|
|
8064
8078
|
"registry.listen() requires the native runtime; use an application-owned HTTP server with WebAssembly"
|
|
@@ -8134,7 +8148,7 @@ var Registry = class {
|
|
|
8134
8148
|
return jsonRouteResponse(503, {
|
|
8135
8149
|
status: "not_started",
|
|
8136
8150
|
runtime: "rivetkit",
|
|
8137
|
-
version:
|
|
8151
|
+
version: _chunkDDF35AIKcjs.VERSION
|
|
8138
8152
|
});
|
|
8139
8153
|
}
|
|
8140
8154
|
const { runtime, registry } = configured;
|
|
@@ -8142,7 +8156,7 @@ var Registry = class {
|
|
|
8142
8156
|
return jsonRouteResponse(501, {
|
|
8143
8157
|
status: "unsupported",
|
|
8144
8158
|
runtime: "rivetkit",
|
|
8145
|
-
version:
|
|
8159
|
+
version: _chunkDDF35AIKcjs.VERSION
|
|
8146
8160
|
});
|
|
8147
8161
|
}
|
|
8148
8162
|
const response = await runtime.registryHealth(registry);
|
|
@@ -8217,14 +8231,14 @@ var Registry = class {
|
|
|
8217
8231
|
var _a;
|
|
8218
8232
|
if (!this.#runtimeServePromise) {
|
|
8219
8233
|
const configuredEnvoyVersion = (_a = this.#config.node) == null ? void 0 : _a.version;
|
|
8220
|
-
const envoyVersionSource = configuredEnvoyVersion !== void 0 ? "config" :
|
|
8234
|
+
const envoyVersionSource = configuredEnvoyVersion !== void 0 ? "config" : _chunkDDF35AIKcjs.getRivetEnvoyVersion.call(void 0, ) !== void 0 ? "environment" : "default";
|
|
8221
8235
|
logger2().info({
|
|
8222
8236
|
msg: "starting rivetkit envoy",
|
|
8223
|
-
rivetkitVersion:
|
|
8237
|
+
rivetkitVersion: _chunkDDF35AIKcjs.VERSION,
|
|
8224
8238
|
envoyVersion: config.node.version,
|
|
8225
8239
|
envoyVersionSource
|
|
8226
8240
|
});
|
|
8227
|
-
if (envoyVersionSource === "default" &&
|
|
8241
|
+
if (envoyVersionSource === "default" && _chunkDDF35AIKcjs.getNodeEnv.call(void 0, ) === "production") {
|
|
8228
8242
|
logger2().error({
|
|
8229
8243
|
msg: "node version defaulted because neither config.node.version nor RIVET_NODE_VERSION is set; actors will not drain automatically across deploys. See https://rivet.dev/docs/actors/versions",
|
|
8230
8244
|
envoyVersion: config.node.version,
|
|
@@ -8328,7 +8342,7 @@ var Registry = class {
|
|
|
8328
8342
|
const modeAPromise = this.#runtimeServeConfiguredPromise;
|
|
8329
8343
|
const modeBPromise = this.#runtimeServerlessPromise;
|
|
8330
8344
|
const runtimes = /* @__PURE__ */ new Set();
|
|
8331
|
-
const localDevSignal = signalDriven &&
|
|
8345
|
+
const localDevSignal = signalDriven && _chunkDDF35AIKcjs.getNodeEnv.call(void 0, ) !== "production" && config.engineSpawn && config.endpoint !== void 0 && _chunkL2XH4EXJcjs.isLocalEngineEndpoint.call(void 0, config.endpoint);
|
|
8332
8346
|
let gracePeriodMs = (_a = config.shutdown) == null ? void 0 : _a.gracePeriodMs;
|
|
8333
8347
|
if (gracePeriodMs === void 0) {
|
|
8334
8348
|
gracePeriodMs = localDevSignal ? LOCAL_DEV_SHUTDOWN_GRACE_PERIOD_MS : await _asyncNullishCoalesce(await this.#actorStopThresholdMs(
|
|
@@ -8440,7 +8454,7 @@ var Registry = class {
|
|
|
8440
8454
|
}
|
|
8441
8455
|
if (this.#runtimeReadyPromise) return this.#runtimeReadyPromise;
|
|
8442
8456
|
try {
|
|
8443
|
-
if (
|
|
8457
|
+
if (_chunkDDF35AIKcjs.getRivetkitRuntimeMode.call(void 0, ) === "serverless") {
|
|
8444
8458
|
return Promise.reject(
|
|
8445
8459
|
new Error(
|
|
8446
8460
|
"registry.startAndWait() requires envoy runtime mode; serverless registries become ready per request"
|
|
@@ -8464,7 +8478,7 @@ var Registry = class {
|
|
|
8464
8478
|
if (!configuredRegistryPromise || !serveLifecyclePromise) {
|
|
8465
8479
|
throw new Error("registry envoy startup did not initialize");
|
|
8466
8480
|
}
|
|
8467
|
-
const readyTimeoutMs = config.engineSpawn && config.endpoint !== void 0 &&
|
|
8481
|
+
const readyTimeoutMs = config.engineSpawn && config.endpoint !== void 0 && _chunkL2XH4EXJcjs.isLocalEngineEndpoint.call(void 0, config.endpoint) ? LOCAL_ENGINE_READY_TIMEOUT_MS : REGISTRY_READY_TIMEOUT_MS;
|
|
8468
8482
|
let timeout;
|
|
8469
8483
|
const timeoutPromise = new Promise((_resolve, reject) => {
|
|
8470
8484
|
var _a;
|
|
@@ -8514,8 +8528,8 @@ var Registry = class {
|
|
|
8514
8528
|
* ```
|
|
8515
8529
|
*/
|
|
8516
8530
|
start() {
|
|
8517
|
-
if (
|
|
8518
|
-
const publicDir = _nullishCoalesce(
|
|
8531
|
+
if (_chunkDDF35AIKcjs.getRivetkitRuntimeMode.call(void 0, ) === "serverless") {
|
|
8532
|
+
const publicDir = _nullishCoalesce(_chunkDDF35AIKcjs.getRivetkitPublicDir.call(void 0, ), () => ( "/public"));
|
|
8519
8533
|
this.listen({ publicDir }).catch((error) => {
|
|
8520
8534
|
logger2().error({ error }, "auto-listen failed; exiting");
|
|
8521
8535
|
if (typeof process !== "undefined" && typeof process.exit === "function") {
|
|
@@ -8631,13 +8645,13 @@ var Registry = class {
|
|
|
8631
8645
|
};
|
|
8632
8646
|
console.log();
|
|
8633
8647
|
console.log(
|
|
8634
|
-
` RivetKit ${
|
|
8648
|
+
` RivetKit ${_chunkDDF35AIKcjs.VERSION} (Engine - ${kind === "serverless" ? "Serverless" : "Serverful"})`
|
|
8635
8649
|
);
|
|
8636
8650
|
if (config.namespace !== "default") {
|
|
8637
8651
|
logLine("Namespace", config.namespace);
|
|
8638
8652
|
}
|
|
8639
8653
|
if (config.endpoint) {
|
|
8640
|
-
const endpointType = config.startEngine ||
|
|
8654
|
+
const endpointType = config.startEngine || _chunkL2XH4EXJcjs.isLocalEngineEndpoint.call(void 0, config.endpoint) ? "local native" : "remote";
|
|
8641
8655
|
logLine("Endpoint", `${config.endpoint} (${endpointType})`);
|
|
8642
8656
|
}
|
|
8643
8657
|
if (kind === "serverless" && config.publicEndpoint) {
|
|
@@ -8707,5 +8721,5 @@ function setup(input) {
|
|
|
8707
8721
|
|
|
8708
8722
|
|
|
8709
8723
|
|
|
8710
|
-
exports.ALLOWED_PUBLIC_HEADERS =
|
|
8724
|
+
exports.ALLOWED_PUBLIC_HEADERS = _chunkL2XH4EXJcjs.ALLOWED_PUBLIC_HEADERS; exports.ActorDefinition = ActorDefinition; exports.ActorError = _chunkMGI2VVF6cjs.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 = _chunkMGI2VVF6cjs.RivetError; exports.RuntimeKindSchema = RuntimeKindSchema; exports.SqliteBackendSchema = SqliteBackendSchema; exports.SqliteConfigSchema = SqliteConfigSchema; exports.TestConfigSchema = TestConfigSchema; exports.UserError = _chunkMGI2VVF6cjs.UserError; exports.WasmRuntimeConfigSchema = WasmRuntimeConfigSchema; exports.actor = actor; exports.buildActorNames = buildActorNames; exports.createClientWithDriver = _chunkL2XH4EXJcjs.createClientWithDriver; exports.defineRunHandler = _chunkAQJFKHBKcjs.defineRunHandler; exports.event = event; exports.isStaticActorDefinition = isStaticActorDefinition; exports.isStaticActorInstance = isStaticActorInstance; exports.lookupInRegistry = lookupInRegistry; exports.noopNext = _chunkDDF35AIKcjs.noopNext; exports.queue = queue; exports.setup = setup; exports.toUint8Array = _chunkDDF35AIKcjs.toUint8Array;
|
|
8711
8725
|
//# sourceMappingURL=mod.cjs.map
|