rivetkit 3.1.1-rc.1 → 3.1.2-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/client.d.ts +41 -0
- 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-2IGAVNUL.js → chunk-5RE3IF3C.js} +2 -2
- package/dist/tsup/{chunk-5HIBMO55.js → chunk-7PUO5YRK.js} +3 -3
- package/dist/tsup/{chunk-LZD54EPS.js → chunk-DKVKYLXH.js} +4 -4
- package/dist/tsup/{chunk-WLFARJG2.cjs → chunk-GI3TPFCE.cjs} +2 -2
- package/dist/tsup/{chunk-WLFARJG2.cjs.map → chunk-GI3TPFCE.cjs.map} +1 -1
- package/dist/tsup/{chunk-BDAEZMRQ.js → chunk-J5ZNIJT3.js} +2 -2
- package/dist/tsup/{chunk-4TUVJYKQ.cjs → chunk-KOB3RR6D.cjs} +7 -7
- package/dist/tsup/{chunk-4TUVJYKQ.cjs.map → chunk-KOB3RR6D.cjs.map} +1 -1
- package/dist/tsup/{chunk-QBM464NJ.js → chunk-LNMODE5R.js} +2 -2
- package/dist/tsup/{chunk-6GQM5TX3.cjs → chunk-MM6QYEV7.cjs} +146 -146
- package/dist/tsup/{chunk-6GQM5TX3.cjs.map → chunk-MM6QYEV7.cjs.map} +1 -1
- package/dist/tsup/{chunk-XOU5GIVI.cjs → chunk-R2GD2TDD.cjs} +3 -3
- package/dist/tsup/{chunk-XOU5GIVI.cjs.map → chunk-R2GD2TDD.cjs.map} +1 -1
- package/dist/tsup/{chunk-TSSTKUHB.js → chunk-SPLLB6BX.js} +2 -2
- package/dist/tsup/{chunk-57I23ITV.cjs → chunk-TR5YB355.cjs} +3 -3
- package/dist/tsup/{chunk-57I23ITV.cjs.map → chunk-TR5YB355.cjs.map} +1 -1
- package/dist/tsup/{chunk-E3FNI5G7.cjs → chunk-TYNEZVC2.cjs} +3 -3
- package/dist/tsup/{chunk-E3FNI5G7.cjs.map → chunk-TYNEZVC2.cjs.map} +1 -1
- package/dist/tsup/{chunk-XA44EGFZ.cjs → chunk-VUFOIAKH.cjs} +10 -10
- package/dist/tsup/{chunk-XA44EGFZ.cjs.map → chunk-VUFOIAKH.cjs.map} +1 -1
- package/dist/tsup/{chunk-HB3RUCG5.js → chunk-WD6L6OTX.js} +2 -2
- package/dist/tsup/{chunk-HB3RUCG5.js.map → chunk-WD6L6OTX.js.map} +1 -1
- package/dist/tsup/{chunk-SQ4KBKBS.cjs → chunk-YPJ3QEDL.cjs} +4 -4
- package/dist/tsup/{chunk-SQ4KBKBS.cjs.map → chunk-YPJ3QEDL.cjs.map} +1 -1
- package/dist/tsup/{chunk-ZIIQIZLQ.js → chunk-YT77YM32.js} +3 -3
- 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-BDdeBoxX.d.cts → config-CTGjM4A5.d.cts} +16 -1
- package/dist/tsup/{config-Ch-SMJ-n.d.ts → config-DLXQ_TVP.d.ts} +16 -1
- package/dist/tsup/{config-CBTr4IhE.d.ts → config-Df5jOcde.d.cts} +26 -0
- package/dist/tsup/{config-CBTr4IhE.d.cts → config-Df5jOcde.d.ts} +26 -0
- package/dist/tsup/{context-B-wRuYrf.d.ts → context-Dmz9Hd6K.d.ts} +2 -2
- package/dist/tsup/{context-NzsxAAoN.d.cts → context-S-Y75hj1.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 +379 -120
- 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 +298 -39
- 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 +7 -7
- package/dist/tsup/workflow/mod.d.cts +4 -4
- package/dist/tsup/workflow/mod.d.ts +4 -4
- package/dist/tsup/workflow/mod.js +4 -4
- package/package.json +9 -9
- package/src/common/database/config.ts +39 -0
- package/src/common/database/native-database.ts +230 -21
- package/src/registry/napi-runtime.ts +78 -0
- package/src/registry/native.ts +57 -17
- package/src/registry/runtime.ts +52 -0
- package/src/registry/wasm-runtime.ts +88 -0
- /package/dist/tsup/{chunk-2IGAVNUL.js.map → chunk-5RE3IF3C.js.map} +0 -0
- /package/dist/tsup/{chunk-5HIBMO55.js.map → chunk-7PUO5YRK.js.map} +0 -0
- /package/dist/tsup/{chunk-LZD54EPS.js.map → chunk-DKVKYLXH.js.map} +0 -0
- /package/dist/tsup/{chunk-BDAEZMRQ.js.map → chunk-J5ZNIJT3.js.map} +0 -0
- /package/dist/tsup/{chunk-QBM464NJ.js.map → chunk-LNMODE5R.js.map} +0 -0
- /package/dist/tsup/{chunk-TSSTKUHB.js.map → chunk-SPLLB6BX.js.map} +0 -0
- /package/dist/tsup/{chunk-ZIIQIZLQ.js.map → chunk-YT77YM32.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 _chunkYPJ3QEDLcjs = require('./chunk-YPJ3QEDL.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 _chunkMM6QYEV7cjs = require('./chunk-MM6QYEV7.cjs');
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
var _chunkRTWH3AX3cjs = require('./chunk-RTWH3AX3.cjs');
|
|
43
|
-
require('./chunk-
|
|
43
|
+
require('./chunk-R2GD2TDD.cjs');
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
|
|
47
47
|
|
|
48
|
-
var
|
|
48
|
+
var _chunkTR5YB355cjs = require('./chunk-TR5YB355.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 _chunkGI3TPFCEcjs = require('./chunk-GI3TPFCE.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 _chunkGI3TPFCEcjs.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 _chunkGI3TPFCEcjs.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 _chunkGI3TPFCEcjs.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 = _chunkMM6QYEV7cjs.convertRegistryConfigToClientConfig.call(void 0, config);
|
|
457
|
+
const dcsRes = await _chunkMM6QYEV7cjs.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 _chunkMM6QYEV7cjs.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: _chunkGI3TPFCEcjs.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: _chunkGI3TPFCEcjs.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(_chunkGI3TPFCEcjs.getRivetPool.call(void 0, ), () => ( "default"))),
|
|
516
|
+
version: _v4.z.number().default(() => _nullishCoalesce(_chunkGI3TPFCEcjs.getRivetEnvoyVersion.call(void 0, ), () => ( 1))),
|
|
517
517
|
// Deprecated.
|
|
518
|
-
totalSlots: _v4.z.number().default(() => _nullishCoalesce(
|
|
518
|
+
totalSlots: _v4.z.number().default(() => _nullishCoalesce(_chunkGI3TPFCEcjs.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, () => ( _chunkGI3TPFCEcjs.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, () => ( _chunkGI3TPFCEcjs.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, () => ( _chunkGI3TPFCEcjs.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: _chunkGI3TPFCEcjs.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, () => ( _chunkGI3TPFCEcjs.getRivetEngine.call(void 0, ))), () => ( _chunkGI3TPFCEcjs.getRivetEndpoint.call(void 0, )))),
|
|
674
|
+
token: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkGI3TPFCEcjs.getRivetToken.call(void 0, )))),
|
|
675
|
+
namespace: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkGI3TPFCEcjs.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(() => _chunkGI3TPFCEcjs.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(_chunkGI3TPFCEcjs.getRivetRunEngineHost.call(void 0, ), () => ( _chunkMM6QYEV7cjs.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(_chunkGI3TPFCEcjs.getRivetRunEnginePort.call(void 0, ), () => ( _chunkMM6QYEV7cjs.ENGINE_PORT))),
|
|
728
728
|
/** @experimental */
|
|
729
|
-
engineVersion: _zod.z.string().optional().default(() => _nullishCoalesce(
|
|
729
|
+
engineVersion: _zod.z.string().optional().default(() => _nullishCoalesce(_chunkGI3TPFCEcjs.getRivetRunEngineVersion.call(void 0, ), () => ( _chunkGI3TPFCEcjs.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 = _chunkGI3TPFCEcjs.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 ? _chunkMM6QYEV7cjs.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 = _chunkMM6QYEV7cjs.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, () => ( _chunkGI3TPFCEcjs.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 && _chunkMM6QYEV7cjs.isLocalEngineEndpoint.call(void 0, endpoint) ? "default" : void 0)));
|
|
827
|
+
const parsedPublicEndpoint = config.serverless.publicEndpoint ? _chunkMM6QYEV7cjs.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: _chunkGI3TPFCEcjs.LogLevelSchema.optional().describe(
|
|
933
933
|
"Log level for RivetKit. Default: 'warn'"
|
|
934
934
|
)
|
|
935
935
|
}).optional().describe("Logging configuration."),
|
|
@@ -971,6 +971,10 @@ var DocRegistryConfigSchema = _zod.z.object({
|
|
|
971
971
|
|
|
972
972
|
|
|
973
973
|
// src/common/database/native-database.ts
|
|
974
|
+
function isSynchronousTransaction(transaction) {
|
|
975
|
+
const candidate = transaction;
|
|
976
|
+
return typeof candidate.commitSync === "function" && typeof candidate.rollbackSync === "function";
|
|
977
|
+
}
|
|
974
978
|
function shouldAttachNativeKvError(message) {
|
|
975
979
|
return /i\/o error|unable to open database file/i.test(message);
|
|
976
980
|
}
|
|
@@ -991,13 +995,16 @@ function toNativeBinding(arg) {
|
|
|
991
995
|
if (arg === null || arg === void 0) {
|
|
992
996
|
return { kind: "null" };
|
|
993
997
|
}
|
|
994
|
-
if (typeof arg === "bigint") {
|
|
995
|
-
|
|
998
|
+
if (typeof arg === "bigint" || typeof arg === "number" && Number.isInteger(arg)) {
|
|
999
|
+
const value = Number(arg);
|
|
1000
|
+
if (!Number.isSafeInteger(value)) {
|
|
1001
|
+
throw new RangeError(
|
|
1002
|
+
"SQLite integer bindings must be within the JavaScript safe integer range."
|
|
1003
|
+
);
|
|
1004
|
+
}
|
|
1005
|
+
return { kind: "int", intValue: value };
|
|
996
1006
|
}
|
|
997
1007
|
if (typeof arg === "number") {
|
|
998
|
-
if (Number.isInteger(arg)) {
|
|
999
|
-
return { kind: "int", intValue: arg };
|
|
1000
|
-
}
|
|
1001
1008
|
return { kind: "float", floatValue: arg };
|
|
1002
1009
|
}
|
|
1003
1010
|
if (typeof arg === "string") {
|
|
@@ -1014,9 +1021,10 @@ function toNativeBinding(arg) {
|
|
|
1014
1021
|
function extractNamedSqliteParameters(sql) {
|
|
1015
1022
|
const orderedNames = [];
|
|
1016
1023
|
const seen = /* @__PURE__ */ new Set();
|
|
1017
|
-
const pattern = /([:@$][A-Za-z_][
|
|
1024
|
+
const pattern = /'(?:''|[^'])*'|"(?:""|[^"])*"|`(?:``|[^`])*`|\[[^\]]*\]|--[^\n]*|\/\*[\s\S]*?(?:\*\/|$)|([:@$][\w$\u0080-\u{10FFFF}]+(?:::[\w$\u0080-\u{10FFFF}]+)*(?:\([^)]*\))?)|[A-Za-z_\u0080-\u{10FFFF}][\w$\u0080-\u{10FFFF}]*/gu;
|
|
1018
1025
|
for (const match of sql.matchAll(pattern)) {
|
|
1019
1026
|
const name = match[1];
|
|
1027
|
+
if (!name) continue;
|
|
1020
1028
|
if (seen.has(name)) {
|
|
1021
1029
|
continue;
|
|
1022
1030
|
}
|
|
@@ -1135,20 +1143,44 @@ function wrapJsNativeDatabase(database) {
|
|
|
1135
1143
|
let terminalPromise;
|
|
1136
1144
|
let lastInsertRowId = null;
|
|
1137
1145
|
const executeNative = async (sql, params) => {
|
|
1138
|
-
const lastInsertRowIdColumn = lastInsertRowIdColumnName(sql);
|
|
1139
|
-
if (lastInsertRowIdColumn) {
|
|
1140
|
-
return {
|
|
1141
|
-
columns: [lastInsertRowIdColumn],
|
|
1142
|
-
rows: [[_nullishCoalesce(lastInsertRowId, () => ( 0))]],
|
|
1143
|
-
changes: 0,
|
|
1144
|
-
lastInsertRowId
|
|
1145
|
-
};
|
|
1146
|
-
}
|
|
1147
1146
|
const release = gate.enter();
|
|
1148
1147
|
try {
|
|
1148
|
+
const lastInsertRowIdColumn = lastInsertRowIdColumnName(sql);
|
|
1149
|
+
if (lastInsertRowIdColumn) {
|
|
1150
|
+
return {
|
|
1151
|
+
columns: [lastInsertRowIdColumn],
|
|
1152
|
+
rows: [[_nullishCoalesce(lastInsertRowId, () => ( 0))]],
|
|
1153
|
+
changes: 0,
|
|
1154
|
+
lastInsertRowId
|
|
1155
|
+
};
|
|
1156
|
+
}
|
|
1149
1157
|
const nativeParams = toNativeBindings(sql, params);
|
|
1150
1158
|
const result = await database.execute(sql, nativeParams);
|
|
1151
|
-
if (result.lastInsertRowId
|
|
1159
|
+
if (result.lastInsertRowId != null) {
|
|
1160
|
+
lastInsertRowId = result.lastInsertRowId;
|
|
1161
|
+
}
|
|
1162
|
+
return result;
|
|
1163
|
+
} catch (error) {
|
|
1164
|
+
enrichNativeDatabaseError(database, error);
|
|
1165
|
+
} finally {
|
|
1166
|
+
release();
|
|
1167
|
+
}
|
|
1168
|
+
};
|
|
1169
|
+
const executeNativeSync = (sql, params) => {
|
|
1170
|
+
const release = gate.enter();
|
|
1171
|
+
try {
|
|
1172
|
+
const nativeParams = toNativeBindings(sql, params);
|
|
1173
|
+
const result = database.executeSync(sql, nativeParams);
|
|
1174
|
+
const rowIdColumn = lastInsertRowIdColumnName(sql);
|
|
1175
|
+
if (rowIdColumn) {
|
|
1176
|
+
return {
|
|
1177
|
+
columns: [rowIdColumn],
|
|
1178
|
+
rows: [[_nullishCoalesce(lastInsertRowId, () => ( 0))]],
|
|
1179
|
+
changes: 0,
|
|
1180
|
+
lastInsertRowId
|
|
1181
|
+
};
|
|
1182
|
+
}
|
|
1183
|
+
if (result.lastInsertRowId != null) {
|
|
1152
1184
|
lastInsertRowId = result.lastInsertRowId;
|
|
1153
1185
|
}
|
|
1154
1186
|
return result;
|
|
@@ -1176,9 +1208,28 @@ function wrapJsNativeDatabase(database) {
|
|
|
1176
1208
|
callback(row, result.columns);
|
|
1177
1209
|
}
|
|
1178
1210
|
},
|
|
1211
|
+
execSync(sql, callback) {
|
|
1212
|
+
const release = gate.enter();
|
|
1213
|
+
let result;
|
|
1214
|
+
try {
|
|
1215
|
+
result = database.execSync(sql);
|
|
1216
|
+
} catch (error) {
|
|
1217
|
+
enrichNativeDatabaseError(database, error);
|
|
1218
|
+
} finally {
|
|
1219
|
+
release();
|
|
1220
|
+
}
|
|
1221
|
+
if (callback) {
|
|
1222
|
+
for (const row of result.rows) {
|
|
1223
|
+
callback(row, result.columns);
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
},
|
|
1179
1227
|
async execute(sql, params) {
|
|
1180
1228
|
return await executeNative(sql, params);
|
|
1181
1229
|
},
|
|
1230
|
+
executeSync(sql, params) {
|
|
1231
|
+
return executeNativeSync(sql, params);
|
|
1232
|
+
},
|
|
1182
1233
|
async executeBatch(statements) {
|
|
1183
1234
|
const nativeStatements = statements.map(toNativeBatchStatement);
|
|
1184
1235
|
const release = gate.enter();
|
|
@@ -1200,7 +1251,7 @@ function wrapJsNativeDatabase(database) {
|
|
|
1200
1251
|
return transactionResults;
|
|
1201
1252
|
})();
|
|
1202
1253
|
for (const result of results) {
|
|
1203
|
-
if (result.lastInsertRowId
|
|
1254
|
+
if (result.lastInsertRowId != null) {
|
|
1204
1255
|
lastInsertRowId = result.lastInsertRowId;
|
|
1205
1256
|
}
|
|
1206
1257
|
}
|
|
@@ -1228,7 +1279,23 @@ function wrapJsNativeDatabase(database) {
|
|
|
1228
1279
|
release();
|
|
1229
1280
|
}
|
|
1230
1281
|
return wrapTransaction(database, transaction, gate, (result) => {
|
|
1231
|
-
if (result.lastInsertRowId
|
|
1282
|
+
if (result.lastInsertRowId != null) {
|
|
1283
|
+
lastInsertRowId = result.lastInsertRowId;
|
|
1284
|
+
}
|
|
1285
|
+
});
|
|
1286
|
+
},
|
|
1287
|
+
beginTransactionSync(timeoutMs, name) {
|
|
1288
|
+
const release = gate.enter();
|
|
1289
|
+
let transaction;
|
|
1290
|
+
try {
|
|
1291
|
+
transaction = database.beginTransactionSync(timeoutMs, name);
|
|
1292
|
+
} catch (error) {
|
|
1293
|
+
enrichNativeDatabaseError(database, error);
|
|
1294
|
+
} finally {
|
|
1295
|
+
release();
|
|
1296
|
+
}
|
|
1297
|
+
return wrapTransaction(database, transaction, gate, (result) => {
|
|
1298
|
+
if (result.lastInsertRowId != null) {
|
|
1232
1299
|
lastInsertRowId = result.lastInsertRowId;
|
|
1233
1300
|
}
|
|
1234
1301
|
});
|
|
@@ -1250,7 +1317,7 @@ function wrapJsNativeDatabase(database) {
|
|
|
1250
1317
|
release();
|
|
1251
1318
|
}
|
|
1252
1319
|
return wrapTransaction(database, transaction, gate, (result) => {
|
|
1253
|
-
if (result.lastInsertRowId
|
|
1320
|
+
if (result.lastInsertRowId != null) {
|
|
1254
1321
|
lastInsertRowId = result.lastInsertRowId;
|
|
1255
1322
|
}
|
|
1256
1323
|
});
|
|
@@ -1266,6 +1333,25 @@ function wrapJsNativeDatabase(database) {
|
|
|
1266
1333
|
var _a;
|
|
1267
1334
|
return normalizeNativeMetrics((_a = database.metrics) == null ? void 0 : _a.call(database));
|
|
1268
1335
|
},
|
|
1336
|
+
async open() {
|
|
1337
|
+
const release = gate.enter();
|
|
1338
|
+
try {
|
|
1339
|
+
await database.open();
|
|
1340
|
+
} catch (error) {
|
|
1341
|
+
enrichNativeDatabaseError(database, error);
|
|
1342
|
+
} finally {
|
|
1343
|
+
release();
|
|
1344
|
+
}
|
|
1345
|
+
},
|
|
1346
|
+
commitTicket() {
|
|
1347
|
+
return database.commitTicket();
|
|
1348
|
+
},
|
|
1349
|
+
async whenDurable(ticket) {
|
|
1350
|
+
await database.whenDurable(ticket);
|
|
1351
|
+
},
|
|
1352
|
+
abortGeneration(reason) {
|
|
1353
|
+
database.abortGeneration(reason);
|
|
1354
|
+
},
|
|
1269
1355
|
async close() {
|
|
1270
1356
|
terminalPromise ??= gate.close(() => database.close());
|
|
1271
1357
|
await terminalPromise;
|
|
@@ -1277,7 +1363,7 @@ function wrapJsNativeDatabase(database) {
|
|
|
1277
1363
|
};
|
|
1278
1364
|
}
|
|
1279
1365
|
function wrapTransaction(database, transaction, gate, onExecute) {
|
|
1280
|
-
|
|
1366
|
+
const wrapped = {
|
|
1281
1367
|
async exec(sql, callback) {
|
|
1282
1368
|
const release = gate.enter();
|
|
1283
1369
|
let result;
|
|
@@ -1328,6 +1414,61 @@ function wrapTransaction(database, transaction, gate, onExecute) {
|
|
|
1328
1414
|
}
|
|
1329
1415
|
}
|
|
1330
1416
|
};
|
|
1417
|
+
if (isSynchronousTransaction(transaction)) {
|
|
1418
|
+
return Object.assign(wrapped, {
|
|
1419
|
+
execSync(sql, callback) {
|
|
1420
|
+
const release = gate.enter();
|
|
1421
|
+
let result;
|
|
1422
|
+
try {
|
|
1423
|
+
result = transaction.execSync(sql);
|
|
1424
|
+
} catch (error) {
|
|
1425
|
+
enrichNativeDatabaseError(database, error);
|
|
1426
|
+
} finally {
|
|
1427
|
+
release();
|
|
1428
|
+
}
|
|
1429
|
+
if (callback) {
|
|
1430
|
+
for (const row of result.rows)
|
|
1431
|
+
callback(row, result.columns);
|
|
1432
|
+
}
|
|
1433
|
+
},
|
|
1434
|
+
executeSync(sql, params) {
|
|
1435
|
+
const release = gate.enter();
|
|
1436
|
+
try {
|
|
1437
|
+
const result = transaction.executeSync(
|
|
1438
|
+
sql,
|
|
1439
|
+
toNativeBindings(sql, params)
|
|
1440
|
+
);
|
|
1441
|
+
onExecute(result);
|
|
1442
|
+
return result;
|
|
1443
|
+
} catch (error) {
|
|
1444
|
+
enrichNativeDatabaseError(database, error);
|
|
1445
|
+
} finally {
|
|
1446
|
+
release();
|
|
1447
|
+
}
|
|
1448
|
+
},
|
|
1449
|
+
commitSync() {
|
|
1450
|
+
const release = gate.enter();
|
|
1451
|
+
try {
|
|
1452
|
+
transaction.commitSync();
|
|
1453
|
+
} catch (error) {
|
|
1454
|
+
enrichNativeDatabaseError(database, error);
|
|
1455
|
+
} finally {
|
|
1456
|
+
release();
|
|
1457
|
+
}
|
|
1458
|
+
},
|
|
1459
|
+
rollbackSync() {
|
|
1460
|
+
const release = gate.enter();
|
|
1461
|
+
try {
|
|
1462
|
+
transaction.rollbackSync();
|
|
1463
|
+
} catch (error) {
|
|
1464
|
+
enrichNativeDatabaseError(database, error);
|
|
1465
|
+
} finally {
|
|
1466
|
+
release();
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
});
|
|
1470
|
+
}
|
|
1471
|
+
return wrapped;
|
|
1331
1472
|
}
|
|
1332
1473
|
function lastInsertRowIdColumnName(sql) {
|
|
1333
1474
|
const match = sql.match(
|
|
@@ -1569,7 +1710,7 @@ var NapiCoreRuntime = (_class = class {
|
|
|
1569
1710
|
if (!(active == null ? void 0 : active.sameActorInstance(ownerCtx))) {
|
|
1570
1711
|
return ownerCtx;
|
|
1571
1712
|
}
|
|
1572
|
-
const applicationSpan =
|
|
1713
|
+
const applicationSpan = _chunkMM6QYEV7cjs.readActiveTraceHeaders.call(void 0, );
|
|
1573
1714
|
if (!applicationSpan) {
|
|
1574
1715
|
return active;
|
|
1575
1716
|
}
|
|
@@ -1782,7 +1923,7 @@ var NapiCoreRuntime = (_class = class {
|
|
|
1782
1923
|
const span = (_a = nativeCtx.invocationTraceContext()) == null ? void 0 : _a.span;
|
|
1783
1924
|
return this.#invocationContext.run(
|
|
1784
1925
|
nativeCtx,
|
|
1785
|
-
() =>
|
|
1926
|
+
() => _chunkMM6QYEV7cjs.runWithActorInvocationSpan.call(void 0, span, run)
|
|
1786
1927
|
);
|
|
1787
1928
|
}
|
|
1788
1929
|
actorInvocationTraceContext(ctx) {
|
|
@@ -1927,6 +2068,9 @@ var NapiCoreRuntime = (_class = class {
|
|
|
1927
2068
|
async actorSqlExec(ctx, sql) {
|
|
1928
2069
|
return await this.#actorSql(ctx).exec(sql);
|
|
1929
2070
|
}
|
|
2071
|
+
actorSqlExecSync(ctx, sql) {
|
|
2072
|
+
return this.#actorSql(ctx).execSync(sql);
|
|
2073
|
+
}
|
|
1930
2074
|
async actorSqlExecute(ctx, sql, params) {
|
|
1931
2075
|
const result = await this.#actorSql(ctx).execute(
|
|
1932
2076
|
sql,
|
|
@@ -1934,6 +2078,13 @@ var NapiCoreRuntime = (_class = class {
|
|
|
1934
2078
|
);
|
|
1935
2079
|
return normalizeRuntimeSqlExecuteResult(result);
|
|
1936
2080
|
}
|
|
2081
|
+
actorSqlExecuteSync(ctx, sql, params) {
|
|
2082
|
+
const result = this.#actorSql(ctx).executeSync(
|
|
2083
|
+
sql,
|
|
2084
|
+
toNapiSqlBindParams(params)
|
|
2085
|
+
);
|
|
2086
|
+
return normalizeRuntimeSqlExecuteResult(result);
|
|
2087
|
+
}
|
|
1937
2088
|
async actorSqlExecuteBatch(ctx, statements) {
|
|
1938
2089
|
const results = await this.#actorSql(ctx).executeBatch(
|
|
1939
2090
|
statements.map(toNapiSqlBatchStatement)
|
|
@@ -1946,9 +2097,18 @@ var NapiCoreRuntime = (_class = class {
|
|
|
1946
2097
|
name
|
|
1947
2098
|
);
|
|
1948
2099
|
}
|
|
2100
|
+
actorSqlBeginTransactionSync(ctx, timeoutMs, name) {
|
|
2101
|
+
return this.#actorSql(ctx).beginTransactionSync(
|
|
2102
|
+
timeoutMs,
|
|
2103
|
+
name
|
|
2104
|
+
);
|
|
2105
|
+
}
|
|
1949
2106
|
async actorSqlTransactionExec(transaction, sql) {
|
|
1950
2107
|
return await asNativeSqlTransaction(transaction).exec(sql);
|
|
1951
2108
|
}
|
|
2109
|
+
actorSqlTransactionExecSync(transaction, sql) {
|
|
2110
|
+
return asNativeSqlTransaction(transaction).execSync(sql);
|
|
2111
|
+
}
|
|
1952
2112
|
async actorSqlTransactionExecute(transaction, sql, params) {
|
|
1953
2113
|
const result = await asNativeSqlTransaction(transaction).execute(
|
|
1954
2114
|
sql,
|
|
@@ -1956,12 +2116,25 @@ var NapiCoreRuntime = (_class = class {
|
|
|
1956
2116
|
);
|
|
1957
2117
|
return normalizeRuntimeSqlExecuteResult(result);
|
|
1958
2118
|
}
|
|
2119
|
+
actorSqlTransactionExecuteSync(transaction, sql, params) {
|
|
2120
|
+
const result = asNativeSqlTransaction(transaction).executeSync(
|
|
2121
|
+
sql,
|
|
2122
|
+
toNapiSqlBindParams(params)
|
|
2123
|
+
);
|
|
2124
|
+
return normalizeRuntimeSqlExecuteResult(result);
|
|
2125
|
+
}
|
|
1959
2126
|
async actorSqlTransactionCommit(transaction) {
|
|
1960
2127
|
await asNativeSqlTransaction(transaction).commit();
|
|
1961
2128
|
}
|
|
2129
|
+
actorSqlTransactionCommitSync(transaction) {
|
|
2130
|
+
asNativeSqlTransaction(transaction).commitSync();
|
|
2131
|
+
}
|
|
1962
2132
|
async actorSqlTransactionRollback(transaction) {
|
|
1963
2133
|
await asNativeSqlTransaction(transaction).rollback();
|
|
1964
2134
|
}
|
|
2135
|
+
actorSqlTransactionRollbackSync(transaction) {
|
|
2136
|
+
asNativeSqlTransaction(transaction).rollbackSync();
|
|
2137
|
+
}
|
|
1965
2138
|
async actorBeginStateTransaction(ctx, timeoutMs) {
|
|
1966
2139
|
return await this.#actorContextForOperation(ctx).beginStateTransaction(
|
|
1967
2140
|
timeoutMs
|
|
@@ -1999,6 +2172,18 @@ var NapiCoreRuntime = (_class = class {
|
|
|
1999
2172
|
var _a, _b;
|
|
2000
2173
|
return _nullishCoalesce(((_b = (_a = this.#actorSql(ctx)).takeLastKvError) == null ? void 0 : _b.call(_a)), () => ( null));
|
|
2001
2174
|
}
|
|
2175
|
+
async actorSqlOpen(ctx) {
|
|
2176
|
+
await this.#actorSql(ctx).open();
|
|
2177
|
+
}
|
|
2178
|
+
actorSqlCommitTicket(ctx) {
|
|
2179
|
+
return this.#actorSql(ctx).commitTicket();
|
|
2180
|
+
}
|
|
2181
|
+
actorSqlAbortGeneration(ctx, reason) {
|
|
2182
|
+
this.#actorSql(ctx).abortGeneration(reason);
|
|
2183
|
+
}
|
|
2184
|
+
async actorSqlWhenDurable(ctx, ticket) {
|
|
2185
|
+
await this.#actorSql(ctx).whenDurable(ticket);
|
|
2186
|
+
}
|
|
2002
2187
|
async actorSqlClose(ctx) {
|
|
2003
2188
|
const nativeCtx = asNativeActorContext(ctx);
|
|
2004
2189
|
if (!this.#sqlOpened.delete(nativeCtx)) {
|
|
@@ -2160,8 +2345,8 @@ function runtimeBytesToArrayBuffer(value) {
|
|
|
2160
2345
|
function buildNativeHttpRequest(init) {
|
|
2161
2346
|
var _a;
|
|
2162
2347
|
const headers = new Headers(init.headers);
|
|
2163
|
-
const originalUrl = headers.get(
|
|
2164
|
-
headers.delete(
|
|
2348
|
+
const originalUrl = headers.get(_chunkMM6QYEV7cjs.HEADER_ORIGINAL_REQUEST_URL);
|
|
2349
|
+
headers.delete(_chunkMM6QYEV7cjs.HEADER_ORIGINAL_REQUEST_URL);
|
|
2165
2350
|
const url = _nullishCoalesce(originalUrl, () => ( (init.uri.startsWith("http") ? init.uri : new URL(init.uri, "http://127.0.0.1").toString())));
|
|
2166
2351
|
const method2 = init.method.toUpperCase();
|
|
2167
2352
|
const bodyForbidden = method2 === "GET" || method2 === "HEAD";
|
|
@@ -2240,7 +2425,7 @@ async function pumpResponseBody(reader, stream) {
|
|
|
2240
2425
|
}
|
|
2241
2426
|
} catch (error) {
|
|
2242
2427
|
try {
|
|
2243
|
-
await stream.error(
|
|
2428
|
+
await stream.error(_chunkGI3TPFCEcjs.stringifyError.call(void 0, error));
|
|
2244
2429
|
} catch (streamError) {
|
|
2245
2430
|
logger2().debug({
|
|
2246
2431
|
msg: "failed to report native http response stream error",
|
|
@@ -2579,6 +2764,17 @@ function optionalWasmNumber(value) {
|
|
|
2579
2764
|
function wasmNumber(value) {
|
|
2580
2765
|
return typeof value === "bigint" ? Number(value) : value;
|
|
2581
2766
|
}
|
|
2767
|
+
function synchronousSqliteUnavailable() {
|
|
2768
|
+
throw new (0, _chunkMGI2VVF6cjs.RivetError)(
|
|
2769
|
+
"sqlite",
|
|
2770
|
+
"sync_unsupported",
|
|
2771
|
+
"Synchronous SQLite is unavailable because the actor runs on the wasm runtime.",
|
|
2772
|
+
{
|
|
2773
|
+
public: true,
|
|
2774
|
+
metadata: { runtime: "wasm" }
|
|
2775
|
+
}
|
|
2776
|
+
);
|
|
2777
|
+
}
|
|
2582
2778
|
function normalizeKvEntry(entry) {
|
|
2583
2779
|
return {
|
|
2584
2780
|
key: toBytes(entry.key),
|
|
@@ -2730,6 +2926,14 @@ var WasmCoreRuntime = (_class2 = class {
|
|
|
2730
2926
|
);
|
|
2731
2927
|
}
|
|
2732
2928
|
createActorFactory(callbacks, config) {
|
|
2929
|
+
if (config == null ? void 0 : config.sqliteDeferredCommits) {
|
|
2930
|
+
throw new (0, _chunkMGI2VVF6cjs.RivetError)(
|
|
2931
|
+
"sqlite",
|
|
2932
|
+
"deferred_commits_unsupported",
|
|
2933
|
+
"SQLite deferred commits require local native SQLite, but the wasm runtime uses remote SQLite.",
|
|
2934
|
+
{ metadata: { runtime: "wasm" } }
|
|
2935
|
+
);
|
|
2936
|
+
}
|
|
2733
2937
|
return callWasmSync(
|
|
2734
2938
|
() => asActorFactoryHandle2(
|
|
2735
2939
|
new this.#constructors.ActorFactory(callbacks, config)
|
|
@@ -3012,12 +3216,18 @@ var WasmCoreRuntime = (_class2 = class {
|
|
|
3012
3216
|
async actorSqlExec(ctx, sql) {
|
|
3013
3217
|
return await callWasm(() => this.#actorSql(ctx).exec(sql));
|
|
3014
3218
|
}
|
|
3219
|
+
actorSqlExecSync(_ctx, _sql) {
|
|
3220
|
+
return synchronousSqliteUnavailable();
|
|
3221
|
+
}
|
|
3015
3222
|
async actorSqlExecute(ctx, sql, params) {
|
|
3016
3223
|
const result = await callWasm(
|
|
3017
3224
|
() => this.#actorSql(ctx).execute(sql, params)
|
|
3018
3225
|
);
|
|
3019
3226
|
return normalizeRuntimeSqlExecuteResult(result);
|
|
3020
3227
|
}
|
|
3228
|
+
actorSqlExecuteSync(_ctx, _sql, _params) {
|
|
3229
|
+
return synchronousSqliteUnavailable();
|
|
3230
|
+
}
|
|
3021
3231
|
async actorSqlExecuteBatch(ctx, statements) {
|
|
3022
3232
|
const results = await callWasm(
|
|
3023
3233
|
() => this.#actorSql(ctx).executeBatch(statements)
|
|
@@ -3029,27 +3239,42 @@ var WasmCoreRuntime = (_class2 = class {
|
|
|
3029
3239
|
() => this.#actorSql(ctx).beginTransaction(timeoutMs, name)
|
|
3030
3240
|
);
|
|
3031
3241
|
}
|
|
3242
|
+
actorSqlBeginTransactionSync(_ctx, _timeoutMs, _name) {
|
|
3243
|
+
return synchronousSqliteUnavailable();
|
|
3244
|
+
}
|
|
3032
3245
|
async actorSqlTransactionExec(transaction, sql) {
|
|
3033
3246
|
return await callWasm(
|
|
3034
3247
|
() => transaction.exec(sql)
|
|
3035
3248
|
);
|
|
3036
3249
|
}
|
|
3250
|
+
actorSqlTransactionExecSync(_transaction, _sql) {
|
|
3251
|
+
return synchronousSqliteUnavailable();
|
|
3252
|
+
}
|
|
3037
3253
|
async actorSqlTransactionExecute(transaction, sql, params) {
|
|
3038
3254
|
const result = await callWasm(
|
|
3039
3255
|
() => transaction.execute(sql, params)
|
|
3040
3256
|
);
|
|
3041
3257
|
return normalizeRuntimeSqlExecuteResult(result);
|
|
3042
3258
|
}
|
|
3259
|
+
actorSqlTransactionExecuteSync(_transaction, _sql, _params) {
|
|
3260
|
+
return synchronousSqliteUnavailable();
|
|
3261
|
+
}
|
|
3043
3262
|
async actorSqlTransactionCommit(transaction) {
|
|
3044
3263
|
await callWasm(
|
|
3045
3264
|
() => transaction.commit()
|
|
3046
3265
|
);
|
|
3047
3266
|
}
|
|
3267
|
+
actorSqlTransactionCommitSync(_transaction) {
|
|
3268
|
+
synchronousSqliteUnavailable();
|
|
3269
|
+
}
|
|
3048
3270
|
async actorSqlTransactionRollback(transaction) {
|
|
3049
3271
|
await callWasm(
|
|
3050
3272
|
() => transaction.rollback()
|
|
3051
3273
|
);
|
|
3052
3274
|
}
|
|
3275
|
+
actorSqlTransactionRollbackSync(_transaction) {
|
|
3276
|
+
synchronousSqliteUnavailable();
|
|
3277
|
+
}
|
|
3053
3278
|
async actorBeginStateTransaction(ctx, timeoutMs) {
|
|
3054
3279
|
return await callWasm(
|
|
3055
3280
|
() => asWasmActorContext(ctx).beginStateTransaction(timeoutMs)
|
|
@@ -3085,6 +3310,17 @@ var WasmCoreRuntime = (_class2 = class {
|
|
|
3085
3310
|
var _a, _b;
|
|
3086
3311
|
return _nullishCoalesce(((_b = (_a = this.#actorSql(ctx)).takeLastKvError) == null ? void 0 : _b.call(_a)), () => ( null));
|
|
3087
3312
|
}
|
|
3313
|
+
async actorSqlOpen(_ctx) {
|
|
3314
|
+
}
|
|
3315
|
+
actorSqlCommitTicket(_ctx) {
|
|
3316
|
+
return synchronousSqliteUnavailable();
|
|
3317
|
+
}
|
|
3318
|
+
actorSqlAbortGeneration(_ctx, _reason) {
|
|
3319
|
+
synchronousSqliteUnavailable();
|
|
3320
|
+
}
|
|
3321
|
+
async actorSqlWhenDurable(_ctx, _ticket) {
|
|
3322
|
+
synchronousSqliteUnavailable();
|
|
3323
|
+
}
|
|
3088
3324
|
async actorSqlClose(ctx) {
|
|
3089
3325
|
const wasmCtx = asWasmActorContext(ctx);
|
|
3090
3326
|
const database = this.#sql.get(wasmCtx);
|
|
@@ -3474,7 +3710,7 @@ async function loadAutoRuntime(config, loaders = defaultRuntimeLoaders) {
|
|
|
3474
3710
|
nativeError = error;
|
|
3475
3711
|
logger2().warn({
|
|
3476
3712
|
msg: "native runtime failed to load; falling back to wasm",
|
|
3477
|
-
error:
|
|
3713
|
+
error: _chunkGI3TPFCEcjs.stringifyError.call(void 0, error)
|
|
3478
3714
|
});
|
|
3479
3715
|
}
|
|
3480
3716
|
try {
|
|
@@ -3483,7 +3719,7 @@ async function loadAutoRuntime(config, loaders = defaultRuntimeLoaders) {
|
|
|
3483
3719
|
throw new (0, _chunkMGI2VVF6cjs.RivetError)(
|
|
3484
3720
|
"config",
|
|
3485
3721
|
"runtime_unavailable",
|
|
3486
|
-
`RivetKit could not load a core runtime. Native runtime: ${
|
|
3722
|
+
`RivetKit could not load a core runtime. Native runtime: ${_chunkGI3TPFCEcjs.stringifyError.call(void 0, nativeError)} Wasm runtime: ${_chunkGI3TPFCEcjs.stringifyError.call(void 0, wasmError)}`,
|
|
3487
3723
|
{
|
|
3488
3724
|
public: true,
|
|
3489
3725
|
statusCode: 500
|
|
@@ -3691,7 +3927,7 @@ async function cleanupNativeSleepRuntimeState(runtime, ctx, afterTrackedWorkDrai
|
|
|
3691
3927
|
}).catch((error) => {
|
|
3692
3928
|
logger2().warn({
|
|
3693
3929
|
msg: "deferred native sleep cleanup failed",
|
|
3694
|
-
error:
|
|
3930
|
+
error: _chunkGI3TPFCEcjs.stringifyError.call(void 0, error)
|
|
3695
3931
|
});
|
|
3696
3932
|
});
|
|
3697
3933
|
return;
|
|
@@ -3730,15 +3966,29 @@ async function closeNativeDatabaseClient(runtime, ctx) {
|
|
|
3730
3966
|
await entry.client.close();
|
|
3731
3967
|
}
|
|
3732
3968
|
}
|
|
3969
|
+
function createNativeSqlTransaction(runtime, transaction) {
|
|
3970
|
+
return {
|
|
3971
|
+
exec: (sql) => runtime.actorSqlTransactionExec(transaction, sql),
|
|
3972
|
+
execSync: (sql) => runtime.actorSqlTransactionExecSync(transaction, sql),
|
|
3973
|
+
execute: (sql, params) => runtime.actorSqlTransactionExecute(transaction, sql, params),
|
|
3974
|
+
executeSync: (sql, params) => runtime.actorSqlTransactionExecuteSync(transaction, sql, params),
|
|
3975
|
+
commit: () => runtime.actorSqlTransactionCommit(transaction),
|
|
3976
|
+
commitSync: () => runtime.actorSqlTransactionCommitSync(transaction),
|
|
3977
|
+
rollback: () => runtime.actorSqlTransactionRollback(transaction),
|
|
3978
|
+
rollbackSync: () => runtime.actorSqlTransactionRollbackSync(transaction)
|
|
3979
|
+
};
|
|
3980
|
+
}
|
|
3733
3981
|
function getOrCreateNativeSqlDatabase(runtime, ctx) {
|
|
3734
3982
|
const runtimeState = getNativeRuntimeState(runtime, ctx);
|
|
3735
3983
|
const cachedDatabase = runtimeState.sql;
|
|
3736
3984
|
if (cachedDatabase) {
|
|
3737
3985
|
return cachedDatabase;
|
|
3738
3986
|
}
|
|
3739
|
-
const
|
|
3987
|
+
const bindings = {
|
|
3740
3988
|
exec: (sql) => runtime.actorSqlExec(ctx, sql),
|
|
3989
|
+
execSync: (sql) => runtime.actorSqlExecSync(ctx, sql),
|
|
3741
3990
|
execute: (sql, params) => runtime.actorSqlExecute(ctx, sql, params),
|
|
3991
|
+
executeSync: (sql, params) => runtime.actorSqlExecuteSync(ctx, sql, params),
|
|
3742
3992
|
executeBatch: (statements) => runtime.actorSqlExecuteBatch(ctx, statements),
|
|
3743
3993
|
beginTransaction: async (timeoutMs, name) => {
|
|
3744
3994
|
const transaction = await runtime.actorSqlBeginTransaction(
|
|
@@ -3746,16 +3996,15 @@ function getOrCreateNativeSqlDatabase(runtime, ctx) {
|
|
|
3746
3996
|
timeoutMs,
|
|
3747
3997
|
name
|
|
3748
3998
|
);
|
|
3749
|
-
return
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
};
|
|
3999
|
+
return createNativeSqlTransaction(runtime, transaction);
|
|
4000
|
+
},
|
|
4001
|
+
beginTransactionSync: (timeoutMs, name) => {
|
|
4002
|
+
const transaction = runtime.actorSqlBeginTransactionSync(
|
|
4003
|
+
ctx,
|
|
4004
|
+
timeoutMs,
|
|
4005
|
+
name
|
|
4006
|
+
);
|
|
4007
|
+
return createNativeSqlTransaction(runtime, transaction);
|
|
3759
4008
|
},
|
|
3760
4009
|
beginStateTransaction: async (timeoutMs, context) => {
|
|
3761
4010
|
const scope = context;
|
|
@@ -3793,8 +4042,13 @@ function getOrCreateNativeSqlDatabase(runtime, ctx) {
|
|
|
3793
4042
|
run: (sql, params) => runtime.actorSqlRun(ctx, sql, params),
|
|
3794
4043
|
metrics: () => runtime.actorSqlMetrics(ctx),
|
|
3795
4044
|
takeLastKvError: () => runtime.actorSqlTakeLastKvError(ctx),
|
|
4045
|
+
open: () => runtime.actorSqlOpen(ctx),
|
|
4046
|
+
commitTicket: () => runtime.actorSqlCommitTicket(ctx),
|
|
4047
|
+
whenDurable: (ticket) => runtime.actorSqlWhenDurable(ctx, ticket),
|
|
4048
|
+
abortGeneration: (reason) => runtime.actorSqlAbortGeneration(ctx, reason),
|
|
3796
4049
|
close: () => runtime.actorSqlClose(ctx)
|
|
3797
|
-
}
|
|
4050
|
+
};
|
|
4051
|
+
const database = wrapJsNativeDatabase(bindings);
|
|
3798
4052
|
runtimeState.sql = database;
|
|
3799
4053
|
return database;
|
|
3800
4054
|
}
|
|
@@ -3863,10 +4117,10 @@ function decodeValue(value) {
|
|
|
3863
4117
|
if (!value || value.length === 0) {
|
|
3864
4118
|
return void 0;
|
|
3865
4119
|
}
|
|
3866
|
-
return
|
|
4120
|
+
return _chunkGI3TPFCEcjs.decodeCborCompat.call(void 0, value);
|
|
3867
4121
|
}
|
|
3868
4122
|
function encodeValue(value) {
|
|
3869
|
-
return
|
|
4123
|
+
return _chunkGI3TPFCEcjs.encodeCborCompat.call(void 0, value);
|
|
3870
4124
|
}
|
|
3871
4125
|
function normalizeArgs(value) {
|
|
3872
4126
|
return Array.isArray(value) ? value : value === void 0 || value === null ? [] : [value];
|
|
@@ -3902,7 +4156,7 @@ function isStructuredBridgeError(error) {
|
|
|
3902
4156
|
return _chunkMGI2VVF6cjs.isRivetErrorLike.call(void 0, error) && "__type" in error && (error.__type === "RivetError" || error.__type === "ActorError");
|
|
3903
4157
|
}
|
|
3904
4158
|
function encodeNativeCallbackError(error) {
|
|
3905
|
-
const structuredError = isStructuredBridgeError(error) ? error :
|
|
4159
|
+
const structuredError = isStructuredBridgeError(error) ? error : _chunkGI3TPFCEcjs.deconstructError.call(void 0, error, true);
|
|
3906
4160
|
const { encoded, droppedMetadataCause } = _chunkMGI2VVF6cjs.encodeBridgeRivetError.call(void 0, structuredError);
|
|
3907
4161
|
if (droppedMetadataCause !== void 0) {
|
|
3908
4162
|
logger2().warn(
|
|
@@ -3964,7 +4218,7 @@ function decodeWorkflowCbor(data) {
|
|
|
3964
4218
|
return null;
|
|
3965
4219
|
}
|
|
3966
4220
|
try {
|
|
3967
|
-
return
|
|
4221
|
+
return _chunkGI3TPFCEcjs.decodeCborCompat.call(void 0, new Uint8Array(data));
|
|
3968
4222
|
} catch (e3) {
|
|
3969
4223
|
return null;
|
|
3970
4224
|
}
|
|
@@ -4077,7 +4331,7 @@ function serializeWorkflowHistoryForJson(data) {
|
|
|
4077
4331
|
if (data === null) {
|
|
4078
4332
|
return null;
|
|
4079
4333
|
}
|
|
4080
|
-
const history =
|
|
4334
|
+
const history = _chunkYPJ3QEDLcjs.decodeWorkflowHistoryTransport.call(void 0, data);
|
|
4081
4335
|
return jsonSafe({
|
|
4082
4336
|
nameRegistry: [...history.nameRegistry],
|
|
4083
4337
|
entries: history.entries.map((entry) => ({
|
|
@@ -4223,7 +4477,7 @@ var NativeConnAdapter = class {
|
|
|
4223
4477
|
},
|
|
4224
4478
|
(newValue) => {
|
|
4225
4479
|
assertCurrentState();
|
|
4226
|
-
|
|
4480
|
+
_chunkGI3TPFCEcjs.assertJsonCompatValue.call(void 0, newValue);
|
|
4227
4481
|
}
|
|
4228
4482
|
);
|
|
4229
4483
|
}
|
|
@@ -4231,7 +4485,7 @@ var NativeConnAdapter = class {
|
|
|
4231
4485
|
var _a;
|
|
4232
4486
|
(_a = this.#assertCanMutateState) == null ? void 0 : _a.call(this);
|
|
4233
4487
|
const nextValue = unwrapWriteThroughProxy(value);
|
|
4234
|
-
|
|
4488
|
+
_chunkGI3TPFCEcjs.assertJsonCompatValue.call(void 0, nextValue);
|
|
4235
4489
|
this.#writeState(nextValue, { writeNative: true });
|
|
4236
4490
|
}
|
|
4237
4491
|
initializeState(value) {
|
|
@@ -5305,7 +5559,7 @@ var ActorContextHandleAdapter = class {
|
|
|
5305
5559
|
},
|
|
5306
5560
|
(newValue) => {
|
|
5307
5561
|
assertCurrentState();
|
|
5308
|
-
|
|
5562
|
+
_chunkGI3TPFCEcjs.assertJsonCompatValue.call(void 0, newValue);
|
|
5309
5563
|
}
|
|
5310
5564
|
);
|
|
5311
5565
|
}
|
|
@@ -5317,7 +5571,7 @@ var ActorContextHandleAdapter = class {
|
|
|
5317
5571
|
}
|
|
5318
5572
|
this.#assertCanMutateState();
|
|
5319
5573
|
const nextValue = unwrapWriteThroughProxy(value);
|
|
5320
|
-
|
|
5574
|
+
_chunkGI3TPFCEcjs.assertJsonCompatValue.call(void 0, nextValue);
|
|
5321
5575
|
this.#writeState(nextValue, { scheduleSave: true });
|
|
5322
5576
|
}
|
|
5323
5577
|
initializeState(value) {
|
|
@@ -5543,14 +5797,16 @@ var ActorContextHandleAdapter = class {
|
|
|
5543
5797
|
log: {
|
|
5544
5798
|
debug: (obj) => logger2().debug(obj)
|
|
5545
5799
|
},
|
|
5546
|
-
nativeDatabaseProvider:
|
|
5800
|
+
nativeDatabaseProvider: _chunkTR5YB355cjs.registerNativeStateTransactionOpener.call(void 0,
|
|
5547
5801
|
{
|
|
5548
5802
|
open: async (requestedActorId) => {
|
|
5549
5803
|
void requestedActorId;
|
|
5550
|
-
|
|
5804
|
+
const database = getOrCreateNativeSqlDatabase(
|
|
5551
5805
|
this.#runtime,
|
|
5552
5806
|
this.#ctx
|
|
5553
5807
|
);
|
|
5808
|
+
await database.open();
|
|
5809
|
+
return database;
|
|
5554
5810
|
}
|
|
5555
5811
|
},
|
|
5556
5812
|
async (timeoutMs, context) => await getOrCreateNativeSqlDatabase(
|
|
@@ -5566,7 +5822,7 @@ var ActorContextHandleAdapter = class {
|
|
|
5566
5822
|
return this.#db;
|
|
5567
5823
|
}
|
|
5568
5824
|
#bindDatabaseClient(client) {
|
|
5569
|
-
return
|
|
5825
|
+
return _chunkTR5YB355cjs.bindNativeStateTransactionContext.call(void 0, client, {
|
|
5570
5826
|
enter: async () => await this.#enterStateTransaction(),
|
|
5571
5827
|
exit: (scope) => this.#exitStateTransaction(
|
|
5572
5828
|
scope
|
|
@@ -5770,7 +6026,7 @@ var ActorContextHandleAdapter = class {
|
|
|
5770
6026
|
const trackedPromise = Promise.resolve(promise).catch((error) => {
|
|
5771
6027
|
logger2().warn({
|
|
5772
6028
|
msg: "keepAwake promise rejected",
|
|
5773
|
-
error:
|
|
6029
|
+
error: _chunkGI3TPFCEcjs.stringifyError.call(void 0, error)
|
|
5774
6030
|
});
|
|
5775
6031
|
}).then(() => null);
|
|
5776
6032
|
try {
|
|
@@ -6153,18 +6409,21 @@ function buildActorTracingConfig(actions, tracing) {
|
|
|
6153
6409
|
actions: _chunkAQJFKHBKcjs.flattenActionTraceSamplers.call(void 0, actions, tracing.actions)
|
|
6154
6410
|
};
|
|
6155
6411
|
}
|
|
6412
|
+
var SQLITE_DEFERRED_COMMITS = /* @__PURE__ */ Symbol.for("rivetkit.sqlite.deferredCommits");
|
|
6156
6413
|
function buildActorConfig(definition, registryConfig, runtimeKind) {
|
|
6157
|
-
var _a;
|
|
6414
|
+
var _a, _b;
|
|
6158
6415
|
const config = definition.config;
|
|
6159
6416
|
const options = _nullishCoalesce(config.options, () => ( {}));
|
|
6160
6417
|
const canHibernate = options.canHibernateWebSocket;
|
|
6161
6418
|
const usesRemoteSqlite = sqliteBackendForConfig(registryConfig) === "remote";
|
|
6162
6419
|
const sqliteProfiling = (_a = config.db) == null ? void 0 : _a.sqliteProfiling;
|
|
6420
|
+
const sqliteDeferredCommits = ((_b = config.db) == null ? void 0 : _b[SQLITE_DEFERRED_COMMITS]) === true;
|
|
6163
6421
|
return {
|
|
6164
6422
|
name: options.name,
|
|
6165
6423
|
icon: options.icon,
|
|
6166
6424
|
hasDatabase: true,
|
|
6167
6425
|
remoteSqlite: usesRemoteSqlite,
|
|
6426
|
+
sqliteDeferredCommits: sqliteDeferredCommits || void 0,
|
|
6168
6427
|
sqliteProfiling,
|
|
6169
6428
|
tracing: buildActorTracingConfig(
|
|
6170
6429
|
definition.config.actions,
|
|
@@ -6267,7 +6526,7 @@ function validateInspectorTabSource(tabId, resolved) {
|
|
|
6267
6526
|
function buildNativeFactory(runtime, registryConfig, definition) {
|
|
6268
6527
|
var _a;
|
|
6269
6528
|
const config = definition.config;
|
|
6270
|
-
const databaseProvider = _nullishCoalesce(config.db, () => (
|
|
6529
|
+
const databaseProvider = _nullishCoalesce(config.db, () => ( _chunkTR5YB355cjs.db.call(void 0, )));
|
|
6271
6530
|
const actionHandlers = _chunkAQJFKHBKcjs.flattenActionHandlers.call(void 0, config.actions);
|
|
6272
6531
|
const schemaConfig = {
|
|
6273
6532
|
actionInputSchemas: _chunkAQJFKHBKcjs.flattenActionInputSchemas.call(void 0,
|
|
@@ -6278,9 +6537,9 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
6278
6537
|
events: config.events,
|
|
6279
6538
|
queues: config.queues
|
|
6280
6539
|
};
|
|
6281
|
-
const createClient = (ctx) =>
|
|
6282
|
-
new (0,
|
|
6283
|
-
|
|
6540
|
+
const createClient = (ctx) => _chunkMM6QYEV7cjs.createClientWithDriver.call(void 0,
|
|
6541
|
+
new (0, _chunkMM6QYEV7cjs.RemoteEngineControlClient)(
|
|
6542
|
+
_chunkMM6QYEV7cjs.convertRegistryConfigToClientConfig.call(void 0, registryConfig)
|
|
6284
6543
|
),
|
|
6285
6544
|
{
|
|
6286
6545
|
encoding: "bare",
|
|
@@ -6472,7 +6731,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
6472
6731
|
400
|
|
6473
6732
|
);
|
|
6474
6733
|
}
|
|
6475
|
-
const cbor =
|
|
6734
|
+
const cbor = _chunkGI3TPFCEcjs.encodeCborCompat.call(void 0,
|
|
6476
6735
|
_nullishCoalesce(body.body, () => ( null))
|
|
6477
6736
|
);
|
|
6478
6737
|
const message = await runtime.actorQueueSend(ctx, name, cbor);
|
|
@@ -7088,7 +7347,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
7088
7347
|
...request,
|
|
7089
7348
|
abortController: requestAbortController
|
|
7090
7349
|
});
|
|
7091
|
-
const rawConnParams = handlerRequest.headers.get(
|
|
7350
|
+
const rawConnParams = handlerRequest.headers.get(_chunkMM6QYEV7cjs.HEADER_CONN_PARAMS);
|
|
7092
7351
|
let requestCtx;
|
|
7093
7352
|
let conn;
|
|
7094
7353
|
let removeRequestAbortListener;
|
|
@@ -7145,7 +7404,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
7145
7404
|
requestCtx,
|
|
7146
7405
|
handlerRequest
|
|
7147
7406
|
);
|
|
7148
|
-
if (!
|
|
7407
|
+
if (!_chunkMM6QYEV7cjs.isResponseLike.call(void 0, response)) {
|
|
7149
7408
|
throw new Error(
|
|
7150
7409
|
"onRequest handler must return a Response"
|
|
7151
7410
|
);
|
|
@@ -7240,7 +7499,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
7240
7499
|
var _a2;
|
|
7241
7500
|
const { ctx } = unwrapTsfnPayload(error, payload);
|
|
7242
7501
|
const history = (_a2 = getNativeWorkflowInspector(ctx)) == null ? void 0 : _a2.getHistory();
|
|
7243
|
-
return history == null ? void 0 :
|
|
7502
|
+
return history == null ? void 0 : _chunkGI3TPFCEcjs.toUint8Array.call(void 0, history);
|
|
7244
7503
|
}
|
|
7245
7504
|
) : void 0,
|
|
7246
7505
|
replayWorkflow: _chunkAQJFKHBKcjs.hasRunInspectorConfig.call(void 0, config.run) ? wrapNativeCallback(
|
|
@@ -7254,7 +7513,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
7254
7513
|
return void 0;
|
|
7255
7514
|
}
|
|
7256
7515
|
const history = await _asyncNullishCoalesce(await workflowInspector.replayFromStep(entryId), async () => ( null));
|
|
7257
|
-
return history == null ? void 0 :
|
|
7516
|
+
return history == null ? void 0 : _chunkGI3TPFCEcjs.toUint8Array.call(void 0, history);
|
|
7258
7517
|
}
|
|
7259
7518
|
) : void 0,
|
|
7260
7519
|
actions: Object.fromEntries(
|
|
@@ -7396,7 +7655,7 @@ async function buildServeConfig(config, resolveNativeBinaries = true) {
|
|
|
7396
7655
|
startServices: resolveNativeBinaries && config.startServices,
|
|
7397
7656
|
handleInspectorHttpInRuntime: true,
|
|
7398
7657
|
serverlessBasePath: config.serverless.basePath,
|
|
7399
|
-
serverlessPackageVersion:
|
|
7658
|
+
serverlessPackageVersion: _chunkGI3TPFCEcjs.VERSION,
|
|
7400
7659
|
serverlessClientEndpoint: config.publicEndpoint,
|
|
7401
7660
|
serverlessClientNamespace: config.publicNamespace,
|
|
7402
7661
|
serverlessClientToken: config.publicToken,
|
|
@@ -7410,12 +7669,12 @@ async function buildServeConfig(config, resolveNativeBinaries = true) {
|
|
|
7410
7669
|
} catch (error) {
|
|
7411
7670
|
logger2().warn({
|
|
7412
7671
|
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",
|
|
7413
|
-
error:
|
|
7672
|
+
error: _chunkGI3TPFCEcjs.stringifyError.call(void 0, error)
|
|
7414
7673
|
});
|
|
7415
7674
|
}
|
|
7416
7675
|
}
|
|
7417
7676
|
if (resolveNativeBinaries && config.startServices) {
|
|
7418
|
-
const servicesBinary =
|
|
7677
|
+
const servicesBinary = _chunkGI3TPFCEcjs.getEnvUniversal.call(void 0, "RIVET_SERVICES_BINARY");
|
|
7419
7678
|
if (servicesBinary) {
|
|
7420
7679
|
serveConfig.servicesBinaryPath = servicesBinary;
|
|
7421
7680
|
} else {
|
|
@@ -7430,13 +7689,13 @@ async function buildServeConfig(config, resolveNativeBinaries = true) {
|
|
|
7430
7689
|
serveConfig.engineHost = config.engineHost;
|
|
7431
7690
|
serveConfig.enginePort = config.enginePort;
|
|
7432
7691
|
if ((_a = config.test) == null ? void 0 : _a.enabled) {
|
|
7433
|
-
serveConfig.inspectorTestToken = _nullishCoalesce(
|
|
7692
|
+
serveConfig.inspectorTestToken = _nullishCoalesce(_chunkGI3TPFCEcjs.getEnvUniversal.call(void 0, "_RIVET_TEST_INSPECTOR_TOKEN"), () => ( "token"));
|
|
7434
7693
|
}
|
|
7435
7694
|
return serveConfig;
|
|
7436
7695
|
}
|
|
7437
7696
|
async function buildRegistryWithRuntime(config, runtime) {
|
|
7438
7697
|
var _a;
|
|
7439
|
-
if (((_a = config.test) == null ? void 0 : _a.enabled) &&
|
|
7698
|
+
if (((_a = config.test) == null ? void 0 : _a.enabled) && _chunkGI3TPFCEcjs.getEnvUniversal.call(void 0, "_RIVET_TEST_INSPECTOR_TOKEN") === void 0) {
|
|
7440
7699
|
trySetProcessEnv("_RIVET_TEST_INSPECTOR_TOKEN", "token");
|
|
7441
7700
|
}
|
|
7442
7701
|
if (runtime.kind === "napi") {
|
|
@@ -7509,7 +7768,7 @@ function createApplicationFetch(application, runtime) {
|
|
|
7509
7768
|
signal: abortController.signal
|
|
7510
7769
|
})
|
|
7511
7770
|
);
|
|
7512
|
-
if (!
|
|
7771
|
+
if (!_chunkMM6QYEV7cjs.isResponseLike.call(void 0, response)) {
|
|
7513
7772
|
throw new TypeError(
|
|
7514
7773
|
"registry.listen() application fetch must return a Response"
|
|
7515
7774
|
);
|
|
@@ -7564,7 +7823,7 @@ var Registry = class {
|
|
|
7564
7823
|
var _a;
|
|
7565
7824
|
this.#config = config;
|
|
7566
7825
|
if ((_a = config.logging) == null ? void 0 : _a.baseLogger) {
|
|
7567
|
-
|
|
7826
|
+
_chunkGI3TPFCEcjs.configureBaseLogger.call(void 0, config.logging.baseLogger);
|
|
7568
7827
|
}
|
|
7569
7828
|
this.#buildConfiguredRegistry = _nullishCoalesce((deps == null ? void 0 : deps.buildConfiguredRegistry), () => ( buildConfiguredRegistry));
|
|
7570
7829
|
this.routes = {
|
|
@@ -7796,10 +8055,10 @@ var Registry = class {
|
|
|
7796
8055
|
if (!opts.application) {
|
|
7797
8056
|
rejectServerless();
|
|
7798
8057
|
}
|
|
7799
|
-
const port = _nullishCoalesce(_nullishCoalesce(opts.port, () => (
|
|
7800
|
-
const publicDir = _nullishCoalesce(opts.publicDir, () => (
|
|
8058
|
+
const port = _nullishCoalesce(_nullishCoalesce(opts.port, () => ( _chunkGI3TPFCEcjs.parsePortEnv.call(void 0, process.env.RIVET_PORT))), () => ( 3e3));
|
|
8059
|
+
const publicDir = _nullishCoalesce(opts.publicDir, () => ( _chunkGI3TPFCEcjs.getRivetkitPublicDir.call(void 0, )));
|
|
7801
8060
|
const config = this.parseConfig();
|
|
7802
|
-
if (opts.application &&
|
|
8061
|
+
if (opts.application && _chunkGI3TPFCEcjs.getRivetkitRuntimeMode.call(void 0, ) !== "serverless") {
|
|
7803
8062
|
if (config.runtime === "wasm") {
|
|
7804
8063
|
throw new Error(
|
|
7805
8064
|
"registry.listen() requires the native runtime; use an application-owned HTTP server with WebAssembly"
|
|
@@ -7875,7 +8134,7 @@ var Registry = class {
|
|
|
7875
8134
|
return jsonRouteResponse(503, {
|
|
7876
8135
|
status: "not_started",
|
|
7877
8136
|
runtime: "rivetkit",
|
|
7878
|
-
version:
|
|
8137
|
+
version: _chunkGI3TPFCEcjs.VERSION
|
|
7879
8138
|
});
|
|
7880
8139
|
}
|
|
7881
8140
|
const { runtime, registry } = configured;
|
|
@@ -7883,7 +8142,7 @@ var Registry = class {
|
|
|
7883
8142
|
return jsonRouteResponse(501, {
|
|
7884
8143
|
status: "unsupported",
|
|
7885
8144
|
runtime: "rivetkit",
|
|
7886
|
-
version:
|
|
8145
|
+
version: _chunkGI3TPFCEcjs.VERSION
|
|
7887
8146
|
});
|
|
7888
8147
|
}
|
|
7889
8148
|
const response = await runtime.registryHealth(registry);
|
|
@@ -7958,14 +8217,14 @@ var Registry = class {
|
|
|
7958
8217
|
var _a;
|
|
7959
8218
|
if (!this.#runtimeServePromise) {
|
|
7960
8219
|
const configuredEnvoyVersion = (_a = this.#config.node) == null ? void 0 : _a.version;
|
|
7961
|
-
const envoyVersionSource = configuredEnvoyVersion !== void 0 ? "config" :
|
|
8220
|
+
const envoyVersionSource = configuredEnvoyVersion !== void 0 ? "config" : _chunkGI3TPFCEcjs.getRivetEnvoyVersion.call(void 0, ) !== void 0 ? "environment" : "default";
|
|
7962
8221
|
logger2().info({
|
|
7963
8222
|
msg: "starting rivetkit envoy",
|
|
7964
|
-
rivetkitVersion:
|
|
8223
|
+
rivetkitVersion: _chunkGI3TPFCEcjs.VERSION,
|
|
7965
8224
|
envoyVersion: config.node.version,
|
|
7966
8225
|
envoyVersionSource
|
|
7967
8226
|
});
|
|
7968
|
-
if (envoyVersionSource === "default" &&
|
|
8227
|
+
if (envoyVersionSource === "default" && _chunkGI3TPFCEcjs.getNodeEnv.call(void 0, ) === "production") {
|
|
7969
8228
|
logger2().error({
|
|
7970
8229
|
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",
|
|
7971
8230
|
envoyVersion: config.node.version,
|
|
@@ -8069,7 +8328,7 @@ var Registry = class {
|
|
|
8069
8328
|
const modeAPromise = this.#runtimeServeConfiguredPromise;
|
|
8070
8329
|
const modeBPromise = this.#runtimeServerlessPromise;
|
|
8071
8330
|
const runtimes = /* @__PURE__ */ new Set();
|
|
8072
|
-
const localDevSignal = signalDriven &&
|
|
8331
|
+
const localDevSignal = signalDriven && _chunkGI3TPFCEcjs.getNodeEnv.call(void 0, ) !== "production" && config.engineSpawn && config.endpoint !== void 0 && _chunkMM6QYEV7cjs.isLocalEngineEndpoint.call(void 0, config.endpoint);
|
|
8073
8332
|
let gracePeriodMs = (_a = config.shutdown) == null ? void 0 : _a.gracePeriodMs;
|
|
8074
8333
|
if (gracePeriodMs === void 0) {
|
|
8075
8334
|
gracePeriodMs = localDevSignal ? LOCAL_DEV_SHUTDOWN_GRACE_PERIOD_MS : await _asyncNullishCoalesce(await this.#actorStopThresholdMs(
|
|
@@ -8181,7 +8440,7 @@ var Registry = class {
|
|
|
8181
8440
|
}
|
|
8182
8441
|
if (this.#runtimeReadyPromise) return this.#runtimeReadyPromise;
|
|
8183
8442
|
try {
|
|
8184
|
-
if (
|
|
8443
|
+
if (_chunkGI3TPFCEcjs.getRivetkitRuntimeMode.call(void 0, ) === "serverless") {
|
|
8185
8444
|
return Promise.reject(
|
|
8186
8445
|
new Error(
|
|
8187
8446
|
"registry.startAndWait() requires envoy runtime mode; serverless registries become ready per request"
|
|
@@ -8205,7 +8464,7 @@ var Registry = class {
|
|
|
8205
8464
|
if (!configuredRegistryPromise || !serveLifecyclePromise) {
|
|
8206
8465
|
throw new Error("registry envoy startup did not initialize");
|
|
8207
8466
|
}
|
|
8208
|
-
const readyTimeoutMs = config.engineSpawn && config.endpoint !== void 0 &&
|
|
8467
|
+
const readyTimeoutMs = config.engineSpawn && config.endpoint !== void 0 && _chunkMM6QYEV7cjs.isLocalEngineEndpoint.call(void 0, config.endpoint) ? LOCAL_ENGINE_READY_TIMEOUT_MS : REGISTRY_READY_TIMEOUT_MS;
|
|
8209
8468
|
let timeout;
|
|
8210
8469
|
const timeoutPromise = new Promise((_resolve, reject) => {
|
|
8211
8470
|
var _a;
|
|
@@ -8255,8 +8514,8 @@ var Registry = class {
|
|
|
8255
8514
|
* ```
|
|
8256
8515
|
*/
|
|
8257
8516
|
start() {
|
|
8258
|
-
if (
|
|
8259
|
-
const publicDir = _nullishCoalesce(
|
|
8517
|
+
if (_chunkGI3TPFCEcjs.getRivetkitRuntimeMode.call(void 0, ) === "serverless") {
|
|
8518
|
+
const publicDir = _nullishCoalesce(_chunkGI3TPFCEcjs.getRivetkitPublicDir.call(void 0, ), () => ( "/public"));
|
|
8260
8519
|
this.listen({ publicDir }).catch((error) => {
|
|
8261
8520
|
logger2().error({ error }, "auto-listen failed; exiting");
|
|
8262
8521
|
if (typeof process !== "undefined" && typeof process.exit === "function") {
|
|
@@ -8372,13 +8631,13 @@ var Registry = class {
|
|
|
8372
8631
|
};
|
|
8373
8632
|
console.log();
|
|
8374
8633
|
console.log(
|
|
8375
|
-
` RivetKit ${
|
|
8634
|
+
` RivetKit ${_chunkGI3TPFCEcjs.VERSION} (Engine - ${kind === "serverless" ? "Serverless" : "Serverful"})`
|
|
8376
8635
|
);
|
|
8377
8636
|
if (config.namespace !== "default") {
|
|
8378
8637
|
logLine("Namespace", config.namespace);
|
|
8379
8638
|
}
|
|
8380
8639
|
if (config.endpoint) {
|
|
8381
|
-
const endpointType = config.startEngine ||
|
|
8640
|
+
const endpointType = config.startEngine || _chunkMM6QYEV7cjs.isLocalEngineEndpoint.call(void 0, config.endpoint) ? "local native" : "remote";
|
|
8382
8641
|
logLine("Endpoint", `${config.endpoint} (${endpointType})`);
|
|
8383
8642
|
}
|
|
8384
8643
|
if (kind === "serverless" && config.publicEndpoint) {
|
|
@@ -8448,5 +8707,5 @@ function setup(input) {
|
|
|
8448
8707
|
|
|
8449
8708
|
|
|
8450
8709
|
|
|
8451
|
-
exports.ALLOWED_PUBLIC_HEADERS =
|
|
8710
|
+
exports.ALLOWED_PUBLIC_HEADERS = _chunkMM6QYEV7cjs.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 = _chunkMM6QYEV7cjs.createClientWithDriver; exports.defineRunHandler = _chunkAQJFKHBKcjs.defineRunHandler; exports.event = event; exports.isStaticActorDefinition = isStaticActorDefinition; exports.isStaticActorInstance = isStaticActorInstance; exports.lookupInRegistry = lookupInRegistry; exports.noopNext = _chunkGI3TPFCEcjs.noopNext; exports.queue = queue; exports.setup = setup; exports.toUint8Array = _chunkGI3TPFCEcjs.toUint8Array;
|
|
8452
8711
|
//# sourceMappingURL=mod.cjs.map
|