rivetkit 0.0.0-sqlite-sync-3-0-1-release.95f6e2d → 0.0.0-sqlite-query-metrics-v3.1dff84f
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 +58 -48
- package/dist/browser/client.js +67 -7
- package/dist/browser/client.js.map +1 -1
- package/dist/browser/inspector/client.js +4 -1
- package/dist/browser/inspector/client.js.map +1 -1
- package/dist/tsup/{chunk-UHMB5FFB.cjs → chunk-22S5RCCJ.cjs} +3 -3
- package/dist/tsup/{chunk-UHMB5FFB.cjs.map → chunk-22S5RCCJ.cjs.map} +1 -1
- package/dist/tsup/{chunk-ZMVYZ7ZI.js → chunk-2CTZU7GL.js} +2 -2
- package/dist/tsup/{chunk-VKXEBB3Z.cjs → chunk-CWN7N5AF.cjs} +7 -7
- package/dist/tsup/{chunk-VKXEBB3Z.cjs.map → chunk-CWN7N5AF.cjs.map} +1 -1
- package/dist/tsup/{chunk-2HWY7FZU.js → chunk-D7DWNYEO.js} +2 -2
- package/dist/tsup/{chunk-OWZ76NSH.js → chunk-F5PWAGS7.js} +2 -2
- package/dist/tsup/{chunk-QIIIRYN7.js → chunk-FT6VRK4C.js} +2 -2
- package/dist/tsup/{chunk-MYWNJP55.cjs → chunk-HFGXV2CC.cjs} +10 -10
- package/dist/tsup/{chunk-MYWNJP55.cjs.map → chunk-HFGXV2CC.cjs.map} +1 -1
- package/dist/tsup/{chunk-QFZY2CK3.js → chunk-HRKFVQPS.js} +4 -4
- package/dist/tsup/{chunk-E6HKVCPA.cjs → chunk-HXJ5U2ZI.cjs} +3 -3
- package/dist/tsup/{chunk-E6HKVCPA.cjs.map → chunk-HXJ5U2ZI.cjs.map} +1 -1
- package/dist/tsup/{chunk-E4KDQJCR.cjs → chunk-JJUSO7GJ.cjs} +3 -3
- package/dist/tsup/{chunk-E4KDQJCR.cjs.map → chunk-JJUSO7GJ.cjs.map} +1 -1
- package/dist/tsup/{chunk-EQBUH25O.cjs → chunk-NG5CUXMM.cjs} +203 -146
- package/dist/tsup/chunk-NG5CUXMM.cjs.map +1 -0
- package/dist/tsup/{chunk-HQHTTJW5.js → chunk-NNCL4IBC.js} +9 -3
- package/dist/tsup/chunk-NNCL4IBC.js.map +1 -0
- package/dist/tsup/{chunk-62WFU3BQ.js → chunk-QQIFRR3B.js} +69 -12
- package/dist/tsup/chunk-QQIFRR3B.js.map +1 -0
- package/dist/tsup/{chunk-HDVZ6YZG.cjs → chunk-SSF2XC33.cjs} +1 -1
- package/dist/tsup/chunk-SSF2XC33.cjs.map +1 -0
- package/dist/tsup/{chunk-QE5MTZHB.js → chunk-SW33HMM5.js} +3 -3
- package/dist/tsup/{chunk-6FEYCVZC.js → chunk-UXDASKP6.js} +1 -1
- package/dist/tsup/chunk-UXDASKP6.js.map +1 -0
- package/dist/tsup/{chunk-AQWZWR2P.cjs → chunk-Y4QLVCCS.cjs} +9 -3
- package/dist/tsup/chunk-Y4QLVCCS.cjs.map +1 -0
- package/dist/tsup/{chunk-M5SQGPRJ.cjs → chunk-Y5CFDGPA.cjs} +4 -4
- package/dist/tsup/{chunk-M5SQGPRJ.cjs.map → chunk-Y5CFDGPA.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-B4erdavw.d.ts → config-BiiS5T5M.d.ts} +3 -16
- package/dist/tsup/{config-DK144OAw.d.cts → config-BnMhcPHl.d.cts} +3 -16
- package/dist/tsup/{config-BfG1qpYz.d.cts → config-CBTr4IhE.d.cts} +50 -34
- package/dist/tsup/{config-BfG1qpYz.d.ts → config-CBTr4IhE.d.ts} +50 -34
- package/dist/tsup/{context-Cvnf3BRe.d.cts → context-DVE8XMm1.d.cts} +2 -2
- package/dist/tsup/{context-Oxi6YWcG.d.ts → context-iMxXq_Lt.d.ts} +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.cjs +2 -2
- package/dist/tsup/dynamic/mod.d.cts +2 -2
- package/dist/tsup/dynamic/mod.d.ts +2 -2
- package/dist/tsup/dynamic/mod.js +1 -1
- 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.cjs +2 -2
- package/dist/tsup/inspector-tab/mod.d.cts +3 -3
- package/dist/tsup/inspector-tab/mod.d.ts +3 -3
- package/dist/tsup/inspector-tab/mod.js +1 -1
- package/dist/tsup/mod.cjs +166 -417
- 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 +67 -318
- 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 +10 -10
- 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 +5 -5
- package/package.json +12 -9
- package/src/actor/config.ts +2 -0
- package/src/client/actor-handle.ts +43 -7
- package/src/client/raw-utils.ts +17 -3
- package/src/client/utils.ts +4 -0
- package/src/common/database/config.ts +50 -46
- package/src/common/database/native-database.ts +21 -230
- package/src/db/mod.ts +1 -0
- package/src/registry/config/index.ts +7 -5
- package/src/registry/napi-runtime.ts +0 -78
- package/src/registry/native.ts +41 -74
- package/src/registry/runtime.ts +1 -53
- package/src/registry/wasm-runtime.ts +0 -88
- package/src/utils/env-vars.ts +4 -2
- package/dist/tsup/chunk-62WFU3BQ.js.map +0 -1
- package/dist/tsup/chunk-6FEYCVZC.js.map +0 -1
- package/dist/tsup/chunk-AQWZWR2P.cjs.map +0 -1
- package/dist/tsup/chunk-EQBUH25O.cjs.map +0 -1
- package/dist/tsup/chunk-HDVZ6YZG.cjs.map +0 -1
- package/dist/tsup/chunk-HQHTTJW5.js.map +0 -1
- /package/dist/tsup/{chunk-ZMVYZ7ZI.js.map → chunk-2CTZU7GL.js.map} +0 -0
- /package/dist/tsup/{chunk-2HWY7FZU.js.map → chunk-D7DWNYEO.js.map} +0 -0
- /package/dist/tsup/{chunk-OWZ76NSH.js.map → chunk-F5PWAGS7.js.map} +0 -0
- /package/dist/tsup/{chunk-QIIIRYN7.js.map → chunk-FT6VRK4C.js.map} +0 -0
- /package/dist/tsup/{chunk-QFZY2CK3.js.map → chunk-HRKFVQPS.js.map} +0 -0
- /package/dist/tsup/{chunk-QE5MTZHB.js.map → chunk-SW33HMM5.js.map} +0 -0
package/dist/tsup/mod.cjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
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 _chunkM5SQGPRJcjs = require('./chunk-M5SQGPRJ.cjs');
|
|
4
3
|
|
|
5
4
|
|
|
6
5
|
|
|
@@ -15,9 +14,10 @@ var _chunkM5SQGPRJcjs = require('./chunk-M5SQGPRJ.cjs');
|
|
|
15
14
|
|
|
16
15
|
|
|
17
16
|
|
|
17
|
+
var _chunkSSF2XC33cjs = require('./chunk-SSF2XC33.cjs');
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _chunkY5CFDGPAcjs = require('./chunk-Y5CFDGPA.cjs');
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
|
|
@@ -35,18 +35,18 @@ var _chunkHDVZ6YZGcjs = require('./chunk-HDVZ6YZG.cjs');
|
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
|
|
38
|
-
var
|
|
38
|
+
var _chunkNG5CUXMMcjs = require('./chunk-NG5CUXMM.cjs');
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
var _chunkRTWH3AX3cjs = require('./chunk-RTWH3AX3.cjs');
|
|
43
|
+
require('./chunk-JJUSO7GJ.cjs');
|
|
43
44
|
|
|
44
45
|
|
|
45
46
|
|
|
46
47
|
|
|
47
|
-
var
|
|
48
|
+
var _chunk22S5RCCJcjs = require('./chunk-22S5RCCJ.cjs');
|
|
48
49
|
require('./chunk-KVFIONKQ.cjs');
|
|
49
|
-
require('./chunk-E4KDQJCR.cjs');
|
|
50
50
|
|
|
51
51
|
|
|
52
52
|
|
|
@@ -80,7 +80,7 @@ require('./chunk-E4KDQJCR.cjs');
|
|
|
80
80
|
|
|
81
81
|
|
|
82
82
|
|
|
83
|
-
var
|
|
83
|
+
var _chunkY4QLVCCScjs = require('./chunk-Y4QLVCCS.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 _chunkY4QLVCCScjs.getLogger.call(void 0, "actor-runtime");
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
// src/actor/definition.ts
|
|
@@ -138,10 +138,10 @@ function actor(input) {
|
|
|
138
138
|
warnDeprecatedOptionKeys(
|
|
139
139
|
input == null ? void 0 : input.options
|
|
140
140
|
);
|
|
141
|
-
const config =
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
141
|
+
const config = _chunkSSF2XC33cjs.ActorConfigSchema.parse(input);
|
|
142
|
+
_chunkSSF2XC33cjs.flattenActionHandlers.call(void 0, config.actions);
|
|
143
|
+
_chunkSSF2XC33cjs.flattenActionInputSchemas.call(void 0, config.actions, config.actionInputSchemas);
|
|
144
|
+
_chunkSSF2XC33cjs.flattenActionTraceSamplers.call(void 0, config.actions, (_a = config.tracing) == null ? void 0 : _a.actions);
|
|
145
145
|
return new ActorDefinition(config);
|
|
146
146
|
}
|
|
147
147
|
function isStaticActorDefinition(definition) {
|
|
@@ -240,7 +240,7 @@ function validateSchemaSync(schemas, key, data) {
|
|
|
240
240
|
var _virtualwebsocket = require('@rivetkit/virtual-websocket');
|
|
241
241
|
var _ws = require('hono/ws');
|
|
242
242
|
function logger() {
|
|
243
|
-
return
|
|
243
|
+
return _chunkY4QLVCCScjs.getLogger.call(void 0, "inline-websocket-adapter");
|
|
244
244
|
}
|
|
245
245
|
var InlineWebSocketAdapter = class {
|
|
246
246
|
#handler;
|
|
@@ -392,7 +392,7 @@ var InlineWebSocketAdapter = class {
|
|
|
392
392
|
|
|
393
393
|
// src/registry/log.ts
|
|
394
394
|
function logger2() {
|
|
395
|
-
return
|
|
395
|
+
return _chunkY4QLVCCScjs.getLogger.call(void 0, "registry");
|
|
396
396
|
}
|
|
397
397
|
|
|
398
398
|
// src/serverless/configure.ts
|
|
@@ -438,8 +438,8 @@ async function configureServerlessPool(config) {
|
|
|
438
438
|
);
|
|
439
439
|
}
|
|
440
440
|
const customConfig = config.configurePool;
|
|
441
|
-
const clientConfig =
|
|
442
|
-
const dcsRes = await
|
|
441
|
+
const clientConfig = _chunkNG5CUXMMcjs.convertRegistryConfigToClientConfig.call(void 0, config);
|
|
442
|
+
const dcsRes = await _chunkNG5CUXMMcjs.getDatacenters.call(void 0, clientConfig);
|
|
443
443
|
const poolName = _nullishCoalesce(customConfig.name, () => ( "default"));
|
|
444
444
|
const serverlessToken = _nullishCoalesce(config.token, () => ( config.publicToken));
|
|
445
445
|
const headers = {
|
|
@@ -461,7 +461,7 @@ async function configureServerlessPool(config) {
|
|
|
461
461
|
metadata: _nullishCoalesce(customConfig.metadata, () => ( {})),
|
|
462
462
|
drain_on_version_upgrade: _nullishCoalesce(customConfig.drainOnVersionUpgrade, () => ( true))
|
|
463
463
|
};
|
|
464
|
-
await
|
|
464
|
+
await _chunkNG5CUXMMcjs.updateRunnerConfig.call(void 0, clientConfig, poolName, {
|
|
465
465
|
datacenters: Object.fromEntries(
|
|
466
466
|
dcsRes.datacenters.map((dc) => [dc.name, serverlessConfig])
|
|
467
467
|
)
|
|
@@ -478,7 +478,7 @@ async function configureServerlessPool(config) {
|
|
|
478
478
|
logger2().warn({
|
|
479
479
|
msg: "serverless pool configuration attempt failed",
|
|
480
480
|
attempts,
|
|
481
|
-
error:
|
|
481
|
+
error: _chunkY4QLVCCScjs.stringifyError.call(void 0, error)
|
|
482
482
|
});
|
|
483
483
|
await sleep(CONFIGURE_RETRY_DELAY_MS);
|
|
484
484
|
}
|
|
@@ -486,7 +486,7 @@ async function configureServerlessPool(config) {
|
|
|
486
486
|
logger2().error({
|
|
487
487
|
msg: "failed to configure serverless pool, validate endpoint is configured correctly then restart this process",
|
|
488
488
|
attempts,
|
|
489
|
-
error:
|
|
489
|
+
error: _chunkY4QLVCCScjs.stringifyError.call(void 0, lastError)
|
|
490
490
|
});
|
|
491
491
|
throw lastError;
|
|
492
492
|
}
|
|
@@ -497,10 +497,10 @@ var _zod = require('zod');
|
|
|
497
497
|
// src/registry/config/envoy.ts
|
|
498
498
|
var _v4 = require('zod/v4');
|
|
499
499
|
var EnvoyConfigSchema = _v4.z.object({
|
|
500
|
-
poolName: _v4.z.string().default(() => _nullishCoalesce(
|
|
501
|
-
version: _v4.z.number().default(() => _nullishCoalesce(
|
|
500
|
+
poolName: _v4.z.string().default(() => _nullishCoalesce(_chunkY4QLVCCScjs.getRivetPool.call(void 0, ), () => ( "default"))),
|
|
501
|
+
version: _v4.z.number().default(() => _nullishCoalesce(_chunkY4QLVCCScjs.getRivetEnvoyVersion.call(void 0, ), () => ( 1))),
|
|
502
502
|
// Deprecated.
|
|
503
|
-
totalSlots: _v4.z.number().default(() => _nullishCoalesce(
|
|
503
|
+
totalSlots: _v4.z.number().default(() => _nullishCoalesce(_chunkY4QLVCCScjs.getRivetTotalSlots.call(void 0, ), () => ( 1e5))),
|
|
504
504
|
nodeKey: _v4.z.string().optional()
|
|
505
505
|
});
|
|
506
506
|
|
|
@@ -538,7 +538,7 @@ var ServerlessConfigSchema = _v4.z.object({
|
|
|
538
538
|
*
|
|
539
539
|
* Can also be set via RIVET_PUBLIC_ENDPOINT environment variable.
|
|
540
540
|
*/
|
|
541
|
-
publicEndpoint: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => (
|
|
541
|
+
publicEndpoint: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkY4QLVCCScjs.getRivetPublicEndpoint.call(void 0, )))),
|
|
542
542
|
/**
|
|
543
543
|
* Token that clients should use when connecting via the public endpoint.
|
|
544
544
|
*
|
|
@@ -546,7 +546,7 @@ var ServerlessConfigSchema = _v4.z.object({
|
|
|
546
546
|
*
|
|
547
547
|
* Can also be specified in the publicEndpoint URL as `https://namespace:token@host`.
|
|
548
548
|
*/
|
|
549
|
-
publicToken: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => (
|
|
549
|
+
publicToken: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkY4QLVCCScjs.getRivetPublicToken.call(void 0, ))))
|
|
550
550
|
// There is no publicNamespace config option because the frontend and backend
|
|
551
551
|
// cannot use different namespaces. The namespace is extracted from the
|
|
552
552
|
// publicEndpoint URL auth syntax if provided.
|
|
@@ -600,7 +600,7 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
600
600
|
* Runtime binding to use for RivetKit core.
|
|
601
601
|
* */
|
|
602
602
|
runtime: RuntimeKindSchema.optional().transform((val, ctx) => {
|
|
603
|
-
const rawRuntime = _nullishCoalesce(val, () => (
|
|
603
|
+
const rawRuntime = _nullishCoalesce(val, () => ( _chunkY4QLVCCScjs.getRivetkitRuntime.call(void 0, )));
|
|
604
604
|
if (rawRuntime === void 0) {
|
|
605
605
|
return "auto";
|
|
606
606
|
}
|
|
@@ -637,7 +637,7 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
637
637
|
* */
|
|
638
638
|
logging: _zod.z.object({
|
|
639
639
|
baseLogger: _zod.z.custom().optional(),
|
|
640
|
-
level:
|
|
640
|
+
level: _chunkY4QLVCCScjs.LogLevelSchema.optional()
|
|
641
641
|
}).optional().default(() => ({})),
|
|
642
642
|
// MARK: Routing
|
|
643
643
|
// // This is a function to allow for lazy configuration of upgradeWebSocket on the
|
|
@@ -655,9 +655,9 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
655
655
|
*
|
|
656
656
|
* Can also be set via RIVET_ENDPOINT environment variables.
|
|
657
657
|
*/
|
|
658
|
-
endpoint: _zod.z.string().optional().transform((val) => _nullishCoalesce(_nullishCoalesce(val, () => (
|
|
659
|
-
token: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => (
|
|
660
|
-
namespace: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => (
|
|
658
|
+
endpoint: _zod.z.string().optional().transform((val) => _nullishCoalesce(_nullishCoalesce(val, () => ( _chunkY4QLVCCScjs.getRivetEngine.call(void 0, ))), () => ( _chunkY4QLVCCScjs.getRivetEndpoint.call(void 0, )))),
|
|
659
|
+
token: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkY4QLVCCScjs.getRivetToken.call(void 0, )))),
|
|
660
|
+
namespace: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkY4QLVCCScjs.getRivetNamespace.call(void 0, )))),
|
|
661
661
|
headers: _zod.z.record(_zod.z.string(), _zod.z.string()).optional().default({}),
|
|
662
662
|
// MARK: Client
|
|
663
663
|
// TODO:
|
|
@@ -697,25 +697,25 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
697
697
|
*
|
|
698
698
|
* Starts the full Rust engine process locally.
|
|
699
699
|
*/
|
|
700
|
-
startEngine: _zod.z.boolean().default(() =>
|
|
700
|
+
startEngine: _zod.z.boolean().default(() => _chunkY4QLVCCScjs.getRivetRunEngine.call(void 0, )),
|
|
701
701
|
/**
|
|
702
702
|
* @experimental
|
|
703
703
|
*
|
|
704
704
|
* Host to bind the spawned local engine process to.
|
|
705
705
|
*/
|
|
706
|
-
engineHost: _zod.z.string().optional().default(() => _nullishCoalesce(
|
|
706
|
+
engineHost: _zod.z.string().optional().default(() => _nullishCoalesce(_chunkY4QLVCCScjs.getRivetRunEngineHost.call(void 0, ), () => ( _chunkNG5CUXMMcjs.ENGINE_HOST))),
|
|
707
707
|
/**
|
|
708
708
|
* @experimental
|
|
709
709
|
*
|
|
710
710
|
* Port to bind the spawned local engine process to.
|
|
711
711
|
*/
|
|
712
|
-
enginePort: _zod.z.number().int().min(1).max(65535).optional().default(() => _nullishCoalesce(
|
|
712
|
+
enginePort: _zod.z.number().int().min(1).max(65535).optional().default(() => _nullishCoalesce(_chunkY4QLVCCScjs.getRivetRunEnginePort.call(void 0, ), () => ( _chunkNG5CUXMMcjs.ENGINE_PORT))),
|
|
713
713
|
/** @experimental */
|
|
714
|
-
engineVersion: _zod.z.string().optional().default(() => _nullishCoalesce(
|
|
714
|
+
engineVersion: _zod.z.string().optional().default(() => _nullishCoalesce(_chunkY4QLVCCScjs.getRivetRunEngineVersion.call(void 0, ), () => ( _chunkY4QLVCCScjs.VERSION))),
|
|
715
715
|
/**
|
|
716
716
|
* Starts the first-party Services actor host when RivetKit manages
|
|
717
|
-
* a local engine.
|
|
718
|
-
* or startServices:
|
|
717
|
+
* a local engine. Enabled by default for a managed local Engine. Set
|
|
718
|
+
* RIVET_RUN_SERVICES=0 or startServices: false to disable it.
|
|
719
719
|
*/
|
|
720
720
|
startServices: _zod.z.boolean().optional(),
|
|
721
721
|
/**
|
|
@@ -768,7 +768,7 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
768
768
|
}))
|
|
769
769
|
}).transform((config, ctx) => {
|
|
770
770
|
var _a, _b, _c;
|
|
771
|
-
const isDevEnv =
|
|
771
|
+
const isDevEnv = _chunkY4QLVCCScjs.isDev.call(void 0, );
|
|
772
772
|
const sqliteBackend = _nullishCoalesce(((_a = config.sqlite) == null ? void 0 : _a.backend), () => ( ((_b = config.test) == null ? void 0 : _b.sqliteBackend)));
|
|
773
773
|
if (config.runtime === "wasm" && sqliteBackend === "local") {
|
|
774
774
|
ctx.addIssue({
|
|
@@ -778,7 +778,7 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
778
778
|
});
|
|
779
779
|
}
|
|
780
780
|
const sqlite = config.runtime === "wasm" && config.sqlite === void 0 ? { backend: "remote" } : config.sqlite;
|
|
781
|
-
const parsedEndpoint = config.endpoint ?
|
|
781
|
+
const parsedEndpoint = config.endpoint ? _chunkNG5CUXMMcjs.tryParseEndpoint.call(void 0, ctx, {
|
|
782
782
|
endpoint: config.endpoint,
|
|
783
783
|
path: ["endpoint"],
|
|
784
784
|
namespace: config.namespace,
|
|
@@ -797,18 +797,19 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
797
797
|
path: ["configurePool"]
|
|
798
798
|
});
|
|
799
799
|
}
|
|
800
|
-
const localEngineEndpoint =
|
|
800
|
+
const localEngineEndpoint = _chunkNG5CUXMMcjs.buildEngineEndpoint.call(void 0,
|
|
801
801
|
config.engineHost,
|
|
802
802
|
config.enginePort
|
|
803
803
|
);
|
|
804
804
|
const endpoint = config.startEngine ? localEngineEndpoint : _nullishCoalesce((parsedEndpoint == null ? void 0 : parsedEndpoint.endpoint), () => ( (isDevEnv ? localEngineEndpoint : void 0)));
|
|
805
|
-
const
|
|
805
|
+
const engineSpawn = !parsedEndpoint && Boolean(endpoint);
|
|
806
|
+
const startServices = _nullishCoalesce(_nullishCoalesce(config.startServices, () => ( _chunkY4QLVCCScjs.getRivetRunServices.call(void 0, ))), () => ( engineSpawn));
|
|
806
807
|
const validateServerlessEndpoint = Boolean(
|
|
807
808
|
config.startEngine || parsedEndpoint
|
|
808
809
|
);
|
|
809
810
|
const namespace = _nullishCoalesce(_nullishCoalesce((parsedEndpoint == null ? void 0 : parsedEndpoint.namespace), () => ( config.namespace)), () => ( "default"));
|
|
810
|
-
const token = _nullishCoalesce(_nullishCoalesce((parsedEndpoint == null ? void 0 : parsedEndpoint.token), () => ( config.token)), () => ( (endpoint &&
|
|
811
|
-
const parsedPublicEndpoint = config.serverless.publicEndpoint ?
|
|
811
|
+
const token = _nullishCoalesce(_nullishCoalesce((parsedEndpoint == null ? void 0 : parsedEndpoint.token), () => ( config.token)), () => ( (endpoint && _chunkNG5CUXMMcjs.isLocalEngineEndpoint.call(void 0, endpoint) ? "default" : void 0)));
|
|
812
|
+
const parsedPublicEndpoint = config.serverless.publicEndpoint ? _chunkNG5CUXMMcjs.tryParseEndpoint.call(void 0, ctx, {
|
|
812
813
|
endpoint: config.serverless.publicEndpoint,
|
|
813
814
|
path: ["serverless", "publicEndpoint"]
|
|
814
815
|
}) : void 0;
|
|
@@ -826,7 +827,7 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
826
827
|
...config,
|
|
827
828
|
sqlite,
|
|
828
829
|
endpoint,
|
|
829
|
-
engineSpawn
|
|
830
|
+
engineSpawn,
|
|
830
831
|
startServices,
|
|
831
832
|
namespace,
|
|
832
833
|
token,
|
|
@@ -845,7 +846,7 @@ function buildActorNames(config) {
|
|
|
845
846
|
Object.keys(config.use).map((actorName) => {
|
|
846
847
|
const definition = config.use[actorName];
|
|
847
848
|
const options = _nullishCoalesce(definition.config.options, () => ( {}));
|
|
848
|
-
const runMeta =
|
|
849
|
+
const runMeta = _chunkSSF2XC33cjs.getRunMetadata.call(void 0, definition.config.run);
|
|
849
850
|
const metadata = {};
|
|
850
851
|
metadata.icon = _nullishCoalesce(options.icon, () => ( runMeta.icon));
|
|
851
852
|
metadata.name = _nullishCoalesce(options.name, () => ( runMeta.name));
|
|
@@ -913,7 +914,7 @@ var DocRegistryConfigSchema = _zod.z.object({
|
|
|
913
914
|
noWelcome: _zod.z.boolean().optional().describe("Disable the welcome message on startup. Default: false"),
|
|
914
915
|
sqlite: DocSqliteConfigSchema,
|
|
915
916
|
logging: _zod.z.object({
|
|
916
|
-
level:
|
|
917
|
+
level: _chunkY4QLVCCScjs.LogLevelSchema.optional().describe(
|
|
917
918
|
"Log level for RivetKit. Default: 'warn'"
|
|
918
919
|
)
|
|
919
920
|
}).optional().describe("Logging configuration."),
|
|
@@ -942,7 +943,7 @@ var DocRegistryConfigSchema = _zod.z.object({
|
|
|
942
943
|
"Version of the local engine package to use. Defaults to the current RivetKit version."
|
|
943
944
|
),
|
|
944
945
|
startServices: _zod.z.boolean().optional().describe(
|
|
945
|
-
"Starts Services when RivetKit manages a local Engine.
|
|
946
|
+
"Starts Services when RivetKit manages a local Engine. Enabled by default for a managed local Engine. Set RIVET_RUN_SERVICES=0 or startServices: false to disable."
|
|
946
947
|
),
|
|
947
948
|
configurePool: DocConfigurePoolSchema.describe(
|
|
948
949
|
"Automatically configure serverless nodes in the engine."
|
|
@@ -955,10 +956,6 @@ var DocRegistryConfigSchema = _zod.z.object({
|
|
|
955
956
|
|
|
956
957
|
|
|
957
958
|
// src/common/database/native-database.ts
|
|
958
|
-
function isSynchronousTransaction(transaction) {
|
|
959
|
-
const candidate = transaction;
|
|
960
|
-
return typeof candidate.commitSync === "function" && typeof candidate.rollbackSync === "function";
|
|
961
|
-
}
|
|
962
959
|
function shouldAttachNativeKvError(message) {
|
|
963
960
|
return /i\/o error|unable to open database file/i.test(message);
|
|
964
961
|
}
|
|
@@ -979,16 +976,13 @@ function toNativeBinding(arg) {
|
|
|
979
976
|
if (arg === null || arg === void 0) {
|
|
980
977
|
return { kind: "null" };
|
|
981
978
|
}
|
|
982
|
-
if (typeof arg === "bigint"
|
|
983
|
-
|
|
984
|
-
if (!Number.isSafeInteger(value)) {
|
|
985
|
-
throw new RangeError(
|
|
986
|
-
"SQLite integer bindings must be within the JavaScript safe integer range."
|
|
987
|
-
);
|
|
988
|
-
}
|
|
989
|
-
return { kind: "int", intValue: value };
|
|
979
|
+
if (typeof arg === "bigint") {
|
|
980
|
+
return { kind: "int", intValue: Number(arg) };
|
|
990
981
|
}
|
|
991
982
|
if (typeof arg === "number") {
|
|
983
|
+
if (Number.isInteger(arg)) {
|
|
984
|
+
return { kind: "int", intValue: arg };
|
|
985
|
+
}
|
|
992
986
|
return { kind: "float", floatValue: arg };
|
|
993
987
|
}
|
|
994
988
|
if (typeof arg === "string") {
|
|
@@ -1005,10 +999,9 @@ function toNativeBinding(arg) {
|
|
|
1005
999
|
function extractNamedSqliteParameters(sql) {
|
|
1006
1000
|
const orderedNames = [];
|
|
1007
1001
|
const seen = /* @__PURE__ */ new Set();
|
|
1008
|
-
const pattern = /
|
|
1002
|
+
const pattern = /([:@$][A-Za-z_][A-Za-z0-9_]*)/g;
|
|
1009
1003
|
for (const match of sql.matchAll(pattern)) {
|
|
1010
1004
|
const name = match[1];
|
|
1011
|
-
if (!name) continue;
|
|
1012
1005
|
if (seen.has(name)) {
|
|
1013
1006
|
continue;
|
|
1014
1007
|
}
|
|
@@ -1127,44 +1120,20 @@ function wrapJsNativeDatabase(database) {
|
|
|
1127
1120
|
let terminalPromise;
|
|
1128
1121
|
let lastInsertRowId = null;
|
|
1129
1122
|
const executeNative = async (sql, params) => {
|
|
1130
|
-
const
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
lastInsertRowId
|
|
1139
|
-
};
|
|
1140
|
-
}
|
|
1141
|
-
const nativeParams = toNativeBindings(sql, params);
|
|
1142
|
-
const result = await database.execute(sql, nativeParams);
|
|
1143
|
-
if (result.lastInsertRowId != null) {
|
|
1144
|
-
lastInsertRowId = result.lastInsertRowId;
|
|
1145
|
-
}
|
|
1146
|
-
return result;
|
|
1147
|
-
} catch (error) {
|
|
1148
|
-
enrichNativeDatabaseError(database, error);
|
|
1149
|
-
} finally {
|
|
1150
|
-
release();
|
|
1123
|
+
const lastInsertRowIdColumn = lastInsertRowIdColumnName(sql);
|
|
1124
|
+
if (lastInsertRowIdColumn) {
|
|
1125
|
+
return {
|
|
1126
|
+
columns: [lastInsertRowIdColumn],
|
|
1127
|
+
rows: [[_nullishCoalesce(lastInsertRowId, () => ( 0))]],
|
|
1128
|
+
changes: 0,
|
|
1129
|
+
lastInsertRowId
|
|
1130
|
+
};
|
|
1151
1131
|
}
|
|
1152
|
-
};
|
|
1153
|
-
const executeNativeSync = (sql, params) => {
|
|
1154
1132
|
const release = gate.enter();
|
|
1155
1133
|
try {
|
|
1156
1134
|
const nativeParams = toNativeBindings(sql, params);
|
|
1157
|
-
const result = database.
|
|
1158
|
-
|
|
1159
|
-
if (rowIdColumn) {
|
|
1160
|
-
return {
|
|
1161
|
-
columns: [rowIdColumn],
|
|
1162
|
-
rows: [[_nullishCoalesce(lastInsertRowId, () => ( 0))]],
|
|
1163
|
-
changes: 0,
|
|
1164
|
-
lastInsertRowId
|
|
1165
|
-
};
|
|
1166
|
-
}
|
|
1167
|
-
if (result.lastInsertRowId != null) {
|
|
1135
|
+
const result = await database.execute(sql, nativeParams);
|
|
1136
|
+
if (result.lastInsertRowId !== void 0) {
|
|
1168
1137
|
lastInsertRowId = result.lastInsertRowId;
|
|
1169
1138
|
}
|
|
1170
1139
|
return result;
|
|
@@ -1192,28 +1161,9 @@ function wrapJsNativeDatabase(database) {
|
|
|
1192
1161
|
callback(row, result.columns);
|
|
1193
1162
|
}
|
|
1194
1163
|
},
|
|
1195
|
-
execSync(sql, callback) {
|
|
1196
|
-
const release = gate.enter();
|
|
1197
|
-
let result;
|
|
1198
|
-
try {
|
|
1199
|
-
result = database.execSync(sql);
|
|
1200
|
-
} catch (error) {
|
|
1201
|
-
enrichNativeDatabaseError(database, error);
|
|
1202
|
-
} finally {
|
|
1203
|
-
release();
|
|
1204
|
-
}
|
|
1205
|
-
if (callback) {
|
|
1206
|
-
for (const row of result.rows) {
|
|
1207
|
-
callback(row, result.columns);
|
|
1208
|
-
}
|
|
1209
|
-
}
|
|
1210
|
-
},
|
|
1211
1164
|
async execute(sql, params) {
|
|
1212
1165
|
return await executeNative(sql, params);
|
|
1213
1166
|
},
|
|
1214
|
-
executeSync(sql, params) {
|
|
1215
|
-
return executeNativeSync(sql, params);
|
|
1216
|
-
},
|
|
1217
1167
|
async executeBatch(statements) {
|
|
1218
1168
|
const nativeStatements = statements.map(toNativeBatchStatement);
|
|
1219
1169
|
const release = gate.enter();
|
|
@@ -1235,7 +1185,7 @@ function wrapJsNativeDatabase(database) {
|
|
|
1235
1185
|
return transactionResults;
|
|
1236
1186
|
})();
|
|
1237
1187
|
for (const result of results) {
|
|
1238
|
-
if (result.lastInsertRowId
|
|
1188
|
+
if (result.lastInsertRowId !== void 0) {
|
|
1239
1189
|
lastInsertRowId = result.lastInsertRowId;
|
|
1240
1190
|
}
|
|
1241
1191
|
}
|
|
@@ -1263,23 +1213,7 @@ function wrapJsNativeDatabase(database) {
|
|
|
1263
1213
|
release();
|
|
1264
1214
|
}
|
|
1265
1215
|
return wrapTransaction(database, transaction, gate, (result) => {
|
|
1266
|
-
if (result.lastInsertRowId
|
|
1267
|
-
lastInsertRowId = result.lastInsertRowId;
|
|
1268
|
-
}
|
|
1269
|
-
});
|
|
1270
|
-
},
|
|
1271
|
-
beginTransactionSync(timeoutMs, name) {
|
|
1272
|
-
const release = gate.enter();
|
|
1273
|
-
let transaction;
|
|
1274
|
-
try {
|
|
1275
|
-
transaction = database.beginTransactionSync(timeoutMs, name);
|
|
1276
|
-
} catch (error) {
|
|
1277
|
-
enrichNativeDatabaseError(database, error);
|
|
1278
|
-
} finally {
|
|
1279
|
-
release();
|
|
1280
|
-
}
|
|
1281
|
-
return wrapTransaction(database, transaction, gate, (result) => {
|
|
1282
|
-
if (result.lastInsertRowId != null) {
|
|
1216
|
+
if (result.lastInsertRowId !== void 0) {
|
|
1283
1217
|
lastInsertRowId = result.lastInsertRowId;
|
|
1284
1218
|
}
|
|
1285
1219
|
});
|
|
@@ -1301,7 +1235,7 @@ function wrapJsNativeDatabase(database) {
|
|
|
1301
1235
|
release();
|
|
1302
1236
|
}
|
|
1303
1237
|
return wrapTransaction(database, transaction, gate, (result) => {
|
|
1304
|
-
if (result.lastInsertRowId
|
|
1238
|
+
if (result.lastInsertRowId !== void 0) {
|
|
1305
1239
|
lastInsertRowId = result.lastInsertRowId;
|
|
1306
1240
|
}
|
|
1307
1241
|
});
|
|
@@ -1317,25 +1251,6 @@ function wrapJsNativeDatabase(database) {
|
|
|
1317
1251
|
var _a;
|
|
1318
1252
|
return normalizeNativeMetrics((_a = database.metrics) == null ? void 0 : _a.call(database));
|
|
1319
1253
|
},
|
|
1320
|
-
async open() {
|
|
1321
|
-
const release = gate.enter();
|
|
1322
|
-
try {
|
|
1323
|
-
await database.open();
|
|
1324
|
-
} catch (error) {
|
|
1325
|
-
enrichNativeDatabaseError(database, error);
|
|
1326
|
-
} finally {
|
|
1327
|
-
release();
|
|
1328
|
-
}
|
|
1329
|
-
},
|
|
1330
|
-
commitTicket() {
|
|
1331
|
-
return database.commitTicket();
|
|
1332
|
-
},
|
|
1333
|
-
async whenDurable(ticket) {
|
|
1334
|
-
await database.whenDurable(ticket);
|
|
1335
|
-
},
|
|
1336
|
-
abortGeneration(reason) {
|
|
1337
|
-
database.abortGeneration(reason);
|
|
1338
|
-
},
|
|
1339
1254
|
async close() {
|
|
1340
1255
|
terminalPromise ??= gate.close(() => database.close());
|
|
1341
1256
|
await terminalPromise;
|
|
@@ -1347,7 +1262,7 @@ function wrapJsNativeDatabase(database) {
|
|
|
1347
1262
|
};
|
|
1348
1263
|
}
|
|
1349
1264
|
function wrapTransaction(database, transaction, gate, onExecute) {
|
|
1350
|
-
|
|
1265
|
+
return {
|
|
1351
1266
|
async exec(sql, callback) {
|
|
1352
1267
|
const release = gate.enter();
|
|
1353
1268
|
let result;
|
|
@@ -1398,61 +1313,6 @@ function wrapTransaction(database, transaction, gate, onExecute) {
|
|
|
1398
1313
|
}
|
|
1399
1314
|
}
|
|
1400
1315
|
};
|
|
1401
|
-
if (isSynchronousTransaction(transaction)) {
|
|
1402
|
-
return Object.assign(wrapped, {
|
|
1403
|
-
execSync(sql, callback) {
|
|
1404
|
-
const release = gate.enter();
|
|
1405
|
-
let result;
|
|
1406
|
-
try {
|
|
1407
|
-
result = transaction.execSync(sql);
|
|
1408
|
-
} catch (error) {
|
|
1409
|
-
enrichNativeDatabaseError(database, error);
|
|
1410
|
-
} finally {
|
|
1411
|
-
release();
|
|
1412
|
-
}
|
|
1413
|
-
if (callback) {
|
|
1414
|
-
for (const row of result.rows)
|
|
1415
|
-
callback(row, result.columns);
|
|
1416
|
-
}
|
|
1417
|
-
},
|
|
1418
|
-
executeSync(sql, params) {
|
|
1419
|
-
const release = gate.enter();
|
|
1420
|
-
try {
|
|
1421
|
-
const result = transaction.executeSync(
|
|
1422
|
-
sql,
|
|
1423
|
-
toNativeBindings(sql, params)
|
|
1424
|
-
);
|
|
1425
|
-
onExecute(result);
|
|
1426
|
-
return result;
|
|
1427
|
-
} catch (error) {
|
|
1428
|
-
enrichNativeDatabaseError(database, error);
|
|
1429
|
-
} finally {
|
|
1430
|
-
release();
|
|
1431
|
-
}
|
|
1432
|
-
},
|
|
1433
|
-
commitSync() {
|
|
1434
|
-
const release = gate.enter();
|
|
1435
|
-
try {
|
|
1436
|
-
transaction.commitSync();
|
|
1437
|
-
} catch (error) {
|
|
1438
|
-
enrichNativeDatabaseError(database, error);
|
|
1439
|
-
} finally {
|
|
1440
|
-
release();
|
|
1441
|
-
}
|
|
1442
|
-
},
|
|
1443
|
-
rollbackSync() {
|
|
1444
|
-
const release = gate.enter();
|
|
1445
|
-
try {
|
|
1446
|
-
transaction.rollbackSync();
|
|
1447
|
-
} catch (error) {
|
|
1448
|
-
enrichNativeDatabaseError(database, error);
|
|
1449
|
-
} finally {
|
|
1450
|
-
release();
|
|
1451
|
-
}
|
|
1452
|
-
}
|
|
1453
|
-
});
|
|
1454
|
-
}
|
|
1455
|
-
return wrapped;
|
|
1456
1316
|
}
|
|
1457
1317
|
function lastInsertRowIdColumnName(sql) {
|
|
1458
1318
|
const match = sql.match(
|
|
@@ -1545,7 +1405,7 @@ function normalizeRuntimeSqlExecuteResult(result) {
|
|
|
1545
1405
|
}
|
|
1546
1406
|
function servicesBinaryUnavailable(cause) {
|
|
1547
1407
|
return new Error(
|
|
1548
|
-
"services.binary_unavailable: Install @rivet-dev/services
|
|
1408
|
+
"services.binary_unavailable: Install @rivet-dev/services to run local Services, set RIVET_SERVICES_BINARY to its executable path, or set RIVET_RUN_SERVICES=0 to disable Services.",
|
|
1549
1409
|
{ cause }
|
|
1550
1410
|
);
|
|
1551
1411
|
}
|
|
@@ -1694,7 +1554,7 @@ var NapiCoreRuntime = (_class = class {
|
|
|
1694
1554
|
if (!(active == null ? void 0 : active.sameActorInstance(ownerCtx))) {
|
|
1695
1555
|
return ownerCtx;
|
|
1696
1556
|
}
|
|
1697
|
-
const applicationSpan =
|
|
1557
|
+
const applicationSpan = _chunkNG5CUXMMcjs.readActiveTraceHeaders.call(void 0, );
|
|
1698
1558
|
if (!applicationSpan) {
|
|
1699
1559
|
return active;
|
|
1700
1560
|
}
|
|
@@ -1898,7 +1758,7 @@ var NapiCoreRuntime = (_class = class {
|
|
|
1898
1758
|
const span = (_a = nativeCtx.invocationTraceContext()) == null ? void 0 : _a.span;
|
|
1899
1759
|
return this.#invocationContext.run(
|
|
1900
1760
|
nativeCtx,
|
|
1901
|
-
() =>
|
|
1761
|
+
() => _chunkNG5CUXMMcjs.runWithActorInvocationSpan.call(void 0, span, run)
|
|
1902
1762
|
);
|
|
1903
1763
|
}
|
|
1904
1764
|
actorInvocationTraceContext(ctx) {
|
|
@@ -2037,9 +1897,6 @@ var NapiCoreRuntime = (_class = class {
|
|
|
2037
1897
|
async actorSqlExec(ctx, sql) {
|
|
2038
1898
|
return await this.#actorSql(ctx).exec(sql);
|
|
2039
1899
|
}
|
|
2040
|
-
actorSqlExecSync(ctx, sql) {
|
|
2041
|
-
return this.#actorSql(ctx).execSync(sql);
|
|
2042
|
-
}
|
|
2043
1900
|
async actorSqlExecute(ctx, sql, params) {
|
|
2044
1901
|
const result = await this.#actorSql(ctx).execute(
|
|
2045
1902
|
sql,
|
|
@@ -2047,13 +1904,6 @@ var NapiCoreRuntime = (_class = class {
|
|
|
2047
1904
|
);
|
|
2048
1905
|
return normalizeRuntimeSqlExecuteResult(result);
|
|
2049
1906
|
}
|
|
2050
|
-
actorSqlExecuteSync(ctx, sql, params) {
|
|
2051
|
-
const result = this.#actorSql(ctx).executeSync(
|
|
2052
|
-
sql,
|
|
2053
|
-
toNapiSqlBindParams(params)
|
|
2054
|
-
);
|
|
2055
|
-
return normalizeRuntimeSqlExecuteResult(result);
|
|
2056
|
-
}
|
|
2057
1907
|
async actorSqlExecuteBatch(ctx, statements) {
|
|
2058
1908
|
const results = await this.#actorSql(ctx).executeBatch(
|
|
2059
1909
|
statements.map(toNapiSqlBatchStatement)
|
|
@@ -2066,18 +1916,9 @@ var NapiCoreRuntime = (_class = class {
|
|
|
2066
1916
|
name
|
|
2067
1917
|
);
|
|
2068
1918
|
}
|
|
2069
|
-
actorSqlBeginTransactionSync(ctx, timeoutMs, name) {
|
|
2070
|
-
return this.#actorSql(ctx).beginTransactionSync(
|
|
2071
|
-
timeoutMs,
|
|
2072
|
-
name
|
|
2073
|
-
);
|
|
2074
|
-
}
|
|
2075
1919
|
async actorSqlTransactionExec(transaction, sql) {
|
|
2076
1920
|
return await asNativeSqlTransaction(transaction).exec(sql);
|
|
2077
1921
|
}
|
|
2078
|
-
actorSqlTransactionExecSync(transaction, sql) {
|
|
2079
|
-
return asNativeSqlTransaction(transaction).execSync(sql);
|
|
2080
|
-
}
|
|
2081
1922
|
async actorSqlTransactionExecute(transaction, sql, params) {
|
|
2082
1923
|
const result = await asNativeSqlTransaction(transaction).execute(
|
|
2083
1924
|
sql,
|
|
@@ -2085,25 +1926,12 @@ var NapiCoreRuntime = (_class = class {
|
|
|
2085
1926
|
);
|
|
2086
1927
|
return normalizeRuntimeSqlExecuteResult(result);
|
|
2087
1928
|
}
|
|
2088
|
-
actorSqlTransactionExecuteSync(transaction, sql, params) {
|
|
2089
|
-
const result = asNativeSqlTransaction(transaction).executeSync(
|
|
2090
|
-
sql,
|
|
2091
|
-
toNapiSqlBindParams(params)
|
|
2092
|
-
);
|
|
2093
|
-
return normalizeRuntimeSqlExecuteResult(result);
|
|
2094
|
-
}
|
|
2095
1929
|
async actorSqlTransactionCommit(transaction) {
|
|
2096
1930
|
await asNativeSqlTransaction(transaction).commit();
|
|
2097
1931
|
}
|
|
2098
|
-
actorSqlTransactionCommitSync(transaction) {
|
|
2099
|
-
asNativeSqlTransaction(transaction).commitSync();
|
|
2100
|
-
}
|
|
2101
1932
|
async actorSqlTransactionRollback(transaction) {
|
|
2102
1933
|
await asNativeSqlTransaction(transaction).rollback();
|
|
2103
1934
|
}
|
|
2104
|
-
actorSqlTransactionRollbackSync(transaction) {
|
|
2105
|
-
asNativeSqlTransaction(transaction).rollbackSync();
|
|
2106
|
-
}
|
|
2107
1935
|
async actorBeginStateTransaction(ctx, timeoutMs) {
|
|
2108
1936
|
return await this.#actorContextForOperation(ctx).beginStateTransaction(
|
|
2109
1937
|
timeoutMs
|
|
@@ -2141,18 +1969,6 @@ var NapiCoreRuntime = (_class = class {
|
|
|
2141
1969
|
var _a, _b;
|
|
2142
1970
|
return _nullishCoalesce(((_b = (_a = this.#actorSql(ctx)).takeLastKvError) == null ? void 0 : _b.call(_a)), () => ( null));
|
|
2143
1971
|
}
|
|
2144
|
-
async actorSqlOpen(ctx) {
|
|
2145
|
-
await this.#actorSql(ctx).open();
|
|
2146
|
-
}
|
|
2147
|
-
actorSqlCommitTicket(ctx) {
|
|
2148
|
-
return this.#actorSql(ctx).commitTicket();
|
|
2149
|
-
}
|
|
2150
|
-
actorSqlAbortGeneration(ctx, reason) {
|
|
2151
|
-
this.#actorSql(ctx).abortGeneration(reason);
|
|
2152
|
-
}
|
|
2153
|
-
async actorSqlWhenDurable(ctx, ticket) {
|
|
2154
|
-
await this.#actorSql(ctx).whenDurable(ticket);
|
|
2155
|
-
}
|
|
2156
1972
|
async actorSqlClose(ctx) {
|
|
2157
1973
|
const nativeCtx = asNativeActorContext(ctx);
|
|
2158
1974
|
if (!this.#sqlOpened.delete(nativeCtx)) {
|
|
@@ -2317,8 +2133,8 @@ function runtimeBytesToArrayBuffer(value) {
|
|
|
2317
2133
|
function buildNativeHttpRequest(init) {
|
|
2318
2134
|
var _a;
|
|
2319
2135
|
const headers = new Headers(init.headers);
|
|
2320
|
-
const originalUrl = headers.get(
|
|
2321
|
-
headers.delete(
|
|
2136
|
+
const originalUrl = headers.get(_chunkNG5CUXMMcjs.HEADER_ORIGINAL_REQUEST_URL);
|
|
2137
|
+
headers.delete(_chunkNG5CUXMMcjs.HEADER_ORIGINAL_REQUEST_URL);
|
|
2322
2138
|
const url = _nullishCoalesce(originalUrl, () => ( (init.uri.startsWith("http") ? init.uri : new URL(init.uri, "http://127.0.0.1").toString())));
|
|
2323
2139
|
const method2 = init.method.toUpperCase();
|
|
2324
2140
|
const bodyForbidden = method2 === "GET" || method2 === "HEAD";
|
|
@@ -2397,7 +2213,7 @@ async function pumpResponseBody(reader, stream) {
|
|
|
2397
2213
|
}
|
|
2398
2214
|
} catch (error) {
|
|
2399
2215
|
try {
|
|
2400
|
-
await stream.error(
|
|
2216
|
+
await stream.error(_chunkY4QLVCCScjs.stringifyError.call(void 0, error));
|
|
2401
2217
|
} catch (streamError) {
|
|
2402
2218
|
logger2().debug({
|
|
2403
2219
|
msg: "failed to report native http response stream error",
|
|
@@ -2565,7 +2381,7 @@ var RunHandlerCoordinator = class {
|
|
|
2565
2381
|
this.#run = run;
|
|
2566
2382
|
}
|
|
2567
2383
|
get inspectorKind() {
|
|
2568
|
-
return
|
|
2384
|
+
return _chunkSSF2XC33cjs.getRunInspectorKind.call(void 0, this.#run);
|
|
2569
2385
|
}
|
|
2570
2386
|
async run(actorId, restart, callback) {
|
|
2571
2387
|
const state = this.#getOrCreate(actorId);
|
|
@@ -2673,7 +2489,7 @@ var RunHandlerCoordinator = class {
|
|
|
2673
2489
|
}
|
|
2674
2490
|
#initializeInspector(actorId, state) {
|
|
2675
2491
|
if (state.inspectorInitialized) return;
|
|
2676
|
-
const inspector =
|
|
2492
|
+
const inspector = _chunkSSF2XC33cjs.createRunInspector.call(void 0, this.#run, {
|
|
2677
2493
|
actorId,
|
|
2678
2494
|
control: this.#control(actorId, state)
|
|
2679
2495
|
});
|
|
@@ -2736,17 +2552,6 @@ function optionalWasmNumber(value) {
|
|
|
2736
2552
|
function wasmNumber(value) {
|
|
2737
2553
|
return typeof value === "bigint" ? Number(value) : value;
|
|
2738
2554
|
}
|
|
2739
|
-
function synchronousSqliteUnavailable() {
|
|
2740
|
-
throw new (0, _chunkMGI2VVF6cjs.RivetError)(
|
|
2741
|
-
"sqlite",
|
|
2742
|
-
"sync_unsupported",
|
|
2743
|
-
"Synchronous SQLite is unavailable because the actor runs on the wasm runtime.",
|
|
2744
|
-
{
|
|
2745
|
-
public: true,
|
|
2746
|
-
metadata: { runtime: "wasm" }
|
|
2747
|
-
}
|
|
2748
|
-
);
|
|
2749
|
-
}
|
|
2750
2555
|
function normalizeKvEntry(entry) {
|
|
2751
2556
|
return {
|
|
2752
2557
|
key: toBytes(entry.key),
|
|
@@ -2898,14 +2703,6 @@ var WasmCoreRuntime = (_class2 = class {
|
|
|
2898
2703
|
);
|
|
2899
2704
|
}
|
|
2900
2705
|
createActorFactory(callbacks, config) {
|
|
2901
|
-
if (config == null ? void 0 : config.sqliteDeferredCommits) {
|
|
2902
|
-
throw new (0, _chunkMGI2VVF6cjs.RivetError)(
|
|
2903
|
-
"sqlite",
|
|
2904
|
-
"deferred_commits_unsupported",
|
|
2905
|
-
"SQLite deferred commits require local native SQLite, but the wasm runtime uses remote SQLite.",
|
|
2906
|
-
{ metadata: { runtime: "wasm" } }
|
|
2907
|
-
);
|
|
2908
|
-
}
|
|
2909
2706
|
return callWasmSync(
|
|
2910
2707
|
() => asActorFactoryHandle2(
|
|
2911
2708
|
new this.#constructors.ActorFactory(callbacks, config)
|
|
@@ -3182,18 +2979,12 @@ var WasmCoreRuntime = (_class2 = class {
|
|
|
3182
2979
|
async actorSqlExec(ctx, sql) {
|
|
3183
2980
|
return await callWasm(() => this.#actorSql(ctx).exec(sql));
|
|
3184
2981
|
}
|
|
3185
|
-
actorSqlExecSync(_ctx, _sql) {
|
|
3186
|
-
return synchronousSqliteUnavailable();
|
|
3187
|
-
}
|
|
3188
2982
|
async actorSqlExecute(ctx, sql, params) {
|
|
3189
2983
|
const result = await callWasm(
|
|
3190
2984
|
() => this.#actorSql(ctx).execute(sql, params)
|
|
3191
2985
|
);
|
|
3192
2986
|
return normalizeRuntimeSqlExecuteResult(result);
|
|
3193
2987
|
}
|
|
3194
|
-
actorSqlExecuteSync(_ctx, _sql, _params) {
|
|
3195
|
-
return synchronousSqliteUnavailable();
|
|
3196
|
-
}
|
|
3197
2988
|
async actorSqlExecuteBatch(ctx, statements) {
|
|
3198
2989
|
const results = await callWasm(
|
|
3199
2990
|
() => this.#actorSql(ctx).executeBatch(statements)
|
|
@@ -3205,42 +2996,27 @@ var WasmCoreRuntime = (_class2 = class {
|
|
|
3205
2996
|
() => this.#actorSql(ctx).beginTransaction(timeoutMs, name)
|
|
3206
2997
|
);
|
|
3207
2998
|
}
|
|
3208
|
-
actorSqlBeginTransactionSync(_ctx, _timeoutMs, _name) {
|
|
3209
|
-
return synchronousSqliteUnavailable();
|
|
3210
|
-
}
|
|
3211
2999
|
async actorSqlTransactionExec(transaction, sql) {
|
|
3212
3000
|
return await callWasm(
|
|
3213
3001
|
() => transaction.exec(sql)
|
|
3214
3002
|
);
|
|
3215
3003
|
}
|
|
3216
|
-
actorSqlTransactionExecSync(_transaction, _sql) {
|
|
3217
|
-
return synchronousSqliteUnavailable();
|
|
3218
|
-
}
|
|
3219
3004
|
async actorSqlTransactionExecute(transaction, sql, params) {
|
|
3220
3005
|
const result = await callWasm(
|
|
3221
3006
|
() => transaction.execute(sql, params)
|
|
3222
3007
|
);
|
|
3223
3008
|
return normalizeRuntimeSqlExecuteResult(result);
|
|
3224
3009
|
}
|
|
3225
|
-
actorSqlTransactionExecuteSync(_transaction, _sql, _params) {
|
|
3226
|
-
return synchronousSqliteUnavailable();
|
|
3227
|
-
}
|
|
3228
3010
|
async actorSqlTransactionCommit(transaction) {
|
|
3229
3011
|
await callWasm(
|
|
3230
3012
|
() => transaction.commit()
|
|
3231
3013
|
);
|
|
3232
3014
|
}
|
|
3233
|
-
actorSqlTransactionCommitSync(_transaction) {
|
|
3234
|
-
synchronousSqliteUnavailable();
|
|
3235
|
-
}
|
|
3236
3015
|
async actorSqlTransactionRollback(transaction) {
|
|
3237
3016
|
await callWasm(
|
|
3238
3017
|
() => transaction.rollback()
|
|
3239
3018
|
);
|
|
3240
3019
|
}
|
|
3241
|
-
actorSqlTransactionRollbackSync(_transaction) {
|
|
3242
|
-
synchronousSqliteUnavailable();
|
|
3243
|
-
}
|
|
3244
3020
|
async actorBeginStateTransaction(ctx, timeoutMs) {
|
|
3245
3021
|
return await callWasm(
|
|
3246
3022
|
() => asWasmActorContext(ctx).beginStateTransaction(timeoutMs)
|
|
@@ -3276,17 +3052,6 @@ var WasmCoreRuntime = (_class2 = class {
|
|
|
3276
3052
|
var _a, _b;
|
|
3277
3053
|
return _nullishCoalesce(((_b = (_a = this.#actorSql(ctx)).takeLastKvError) == null ? void 0 : _b.call(_a)), () => ( null));
|
|
3278
3054
|
}
|
|
3279
|
-
async actorSqlOpen(_ctx) {
|
|
3280
|
-
}
|
|
3281
|
-
actorSqlCommitTicket(_ctx) {
|
|
3282
|
-
return synchronousSqliteUnavailable();
|
|
3283
|
-
}
|
|
3284
|
-
actorSqlAbortGeneration(_ctx, _reason) {
|
|
3285
|
-
synchronousSqliteUnavailable();
|
|
3286
|
-
}
|
|
3287
|
-
async actorSqlWhenDurable(_ctx, _ticket) {
|
|
3288
|
-
synchronousSqliteUnavailable();
|
|
3289
|
-
}
|
|
3290
3055
|
async actorSqlClose(ctx) {
|
|
3291
3056
|
const wasmCtx = asWasmActorContext(ctx);
|
|
3292
3057
|
const database = this.#sql.get(wasmCtx);
|
|
@@ -3687,7 +3452,7 @@ async function loadAutoRuntime(config, loaders = defaultRuntimeLoaders) {
|
|
|
3687
3452
|
nativeError = error;
|
|
3688
3453
|
logger2().warn({
|
|
3689
3454
|
msg: "native runtime failed to load; falling back to wasm",
|
|
3690
|
-
error:
|
|
3455
|
+
error: _chunkY4QLVCCScjs.stringifyError.call(void 0, error)
|
|
3691
3456
|
});
|
|
3692
3457
|
}
|
|
3693
3458
|
try {
|
|
@@ -3696,7 +3461,7 @@ async function loadAutoRuntime(config, loaders = defaultRuntimeLoaders) {
|
|
|
3696
3461
|
throw new (0, _chunkMGI2VVF6cjs.RivetError)(
|
|
3697
3462
|
"config",
|
|
3698
3463
|
"runtime_unavailable",
|
|
3699
|
-
`RivetKit could not load a core runtime. Native runtime: ${
|
|
3464
|
+
`RivetKit could not load a core runtime. Native runtime: ${_chunkY4QLVCCScjs.stringifyError.call(void 0, nativeError)} Wasm runtime: ${_chunkY4QLVCCScjs.stringifyError.call(void 0, wasmError)}`,
|
|
3700
3465
|
{
|
|
3701
3466
|
public: true,
|
|
3702
3467
|
statusCode: 500
|
|
@@ -3904,7 +3669,7 @@ async function cleanupNativeSleepRuntimeState(runtime, ctx, afterTrackedWorkDrai
|
|
|
3904
3669
|
}).catch((error) => {
|
|
3905
3670
|
logger2().warn({
|
|
3906
3671
|
msg: "deferred native sleep cleanup failed",
|
|
3907
|
-
error:
|
|
3672
|
+
error: _chunkY4QLVCCScjs.stringifyError.call(void 0, error)
|
|
3908
3673
|
});
|
|
3909
3674
|
});
|
|
3910
3675
|
return;
|
|
@@ -3943,29 +3708,15 @@ async function closeNativeDatabaseClient(runtime, ctx) {
|
|
|
3943
3708
|
await entry.client.close();
|
|
3944
3709
|
}
|
|
3945
3710
|
}
|
|
3946
|
-
function createNativeSqlTransaction(runtime, transaction) {
|
|
3947
|
-
return {
|
|
3948
|
-
exec: (sql) => runtime.actorSqlTransactionExec(transaction, sql),
|
|
3949
|
-
execSync: (sql) => runtime.actorSqlTransactionExecSync(transaction, sql),
|
|
3950
|
-
execute: (sql, params) => runtime.actorSqlTransactionExecute(transaction, sql, params),
|
|
3951
|
-
executeSync: (sql, params) => runtime.actorSqlTransactionExecuteSync(transaction, sql, params),
|
|
3952
|
-
commit: () => runtime.actorSqlTransactionCommit(transaction),
|
|
3953
|
-
commitSync: () => runtime.actorSqlTransactionCommitSync(transaction),
|
|
3954
|
-
rollback: () => runtime.actorSqlTransactionRollback(transaction),
|
|
3955
|
-
rollbackSync: () => runtime.actorSqlTransactionRollbackSync(transaction)
|
|
3956
|
-
};
|
|
3957
|
-
}
|
|
3958
3711
|
function getOrCreateNativeSqlDatabase(runtime, ctx) {
|
|
3959
3712
|
const runtimeState = getNativeRuntimeState(runtime, ctx);
|
|
3960
3713
|
const cachedDatabase = runtimeState.sql;
|
|
3961
3714
|
if (cachedDatabase) {
|
|
3962
3715
|
return cachedDatabase;
|
|
3963
3716
|
}
|
|
3964
|
-
const
|
|
3717
|
+
const database = wrapJsNativeDatabase({
|
|
3965
3718
|
exec: (sql) => runtime.actorSqlExec(ctx, sql),
|
|
3966
|
-
execSync: (sql) => runtime.actorSqlExecSync(ctx, sql),
|
|
3967
3719
|
execute: (sql, params) => runtime.actorSqlExecute(ctx, sql, params),
|
|
3968
|
-
executeSync: (sql, params) => runtime.actorSqlExecuteSync(ctx, sql, params),
|
|
3969
3720
|
executeBatch: (statements) => runtime.actorSqlExecuteBatch(ctx, statements),
|
|
3970
3721
|
beginTransaction: async (timeoutMs, name) => {
|
|
3971
3722
|
const transaction = await runtime.actorSqlBeginTransaction(
|
|
@@ -3973,15 +3724,16 @@ function getOrCreateNativeSqlDatabase(runtime, ctx) {
|
|
|
3973
3724
|
timeoutMs,
|
|
3974
3725
|
name
|
|
3975
3726
|
);
|
|
3976
|
-
return
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3727
|
+
return {
|
|
3728
|
+
exec: (sql) => runtime.actorSqlTransactionExec(transaction, sql),
|
|
3729
|
+
execute: (sql, params) => runtime.actorSqlTransactionExecute(
|
|
3730
|
+
transaction,
|
|
3731
|
+
sql,
|
|
3732
|
+
params
|
|
3733
|
+
),
|
|
3734
|
+
commit: () => runtime.actorSqlTransactionCommit(transaction),
|
|
3735
|
+
rollback: () => runtime.actorSqlTransactionRollback(transaction)
|
|
3736
|
+
};
|
|
3985
3737
|
},
|
|
3986
3738
|
beginStateTransaction: async (timeoutMs, context) => {
|
|
3987
3739
|
const scope = context;
|
|
@@ -4019,13 +3771,8 @@ function getOrCreateNativeSqlDatabase(runtime, ctx) {
|
|
|
4019
3771
|
run: (sql, params) => runtime.actorSqlRun(ctx, sql, params),
|
|
4020
3772
|
metrics: () => runtime.actorSqlMetrics(ctx),
|
|
4021
3773
|
takeLastKvError: () => runtime.actorSqlTakeLastKvError(ctx),
|
|
4022
|
-
open: () => runtime.actorSqlOpen(ctx),
|
|
4023
|
-
commitTicket: () => runtime.actorSqlCommitTicket(ctx),
|
|
4024
|
-
whenDurable: (ticket) => runtime.actorSqlWhenDurable(ctx, ticket),
|
|
4025
|
-
abortGeneration: (reason) => runtime.actorSqlAbortGeneration(ctx, reason),
|
|
4026
3774
|
close: () => runtime.actorSqlClose(ctx)
|
|
4027
|
-
};
|
|
4028
|
-
const database = wrapJsNativeDatabase(bindings);
|
|
3775
|
+
});
|
|
4029
3776
|
runtimeState.sql = database;
|
|
4030
3777
|
return database;
|
|
4031
3778
|
}
|
|
@@ -4094,10 +3841,10 @@ function decodeValue(value) {
|
|
|
4094
3841
|
if (!value || value.length === 0) {
|
|
4095
3842
|
return void 0;
|
|
4096
3843
|
}
|
|
4097
|
-
return
|
|
3844
|
+
return _chunkY4QLVCCScjs.decodeCborCompat.call(void 0, value);
|
|
4098
3845
|
}
|
|
4099
3846
|
function encodeValue(value) {
|
|
4100
|
-
return
|
|
3847
|
+
return _chunkY4QLVCCScjs.encodeCborCompat.call(void 0, value);
|
|
4101
3848
|
}
|
|
4102
3849
|
function normalizeArgs(value) {
|
|
4103
3850
|
return Array.isArray(value) ? value : value === void 0 || value === null ? [] : [value];
|
|
@@ -4133,7 +3880,7 @@ function isStructuredBridgeError(error) {
|
|
|
4133
3880
|
return _chunkMGI2VVF6cjs.isRivetErrorLike.call(void 0, error) && "__type" in error && (error.__type === "RivetError" || error.__type === "ActorError");
|
|
4134
3881
|
}
|
|
4135
3882
|
function encodeNativeCallbackError(error) {
|
|
4136
|
-
const structuredError = isStructuredBridgeError(error) ? error :
|
|
3883
|
+
const structuredError = isStructuredBridgeError(error) ? error : _chunkY4QLVCCScjs.deconstructError.call(void 0, error, true);
|
|
4137
3884
|
const { encoded, droppedMetadataCause } = _chunkMGI2VVF6cjs.encodeBridgeRivetError.call(void 0, structuredError);
|
|
4138
3885
|
if (droppedMetadataCause !== void 0) {
|
|
4139
3886
|
logger2().warn(
|
|
@@ -4195,7 +3942,7 @@ function decodeWorkflowCbor(data) {
|
|
|
4195
3942
|
return null;
|
|
4196
3943
|
}
|
|
4197
3944
|
try {
|
|
4198
|
-
return
|
|
3945
|
+
return _chunkY4QLVCCScjs.decodeCborCompat.call(void 0, new Uint8Array(data));
|
|
4199
3946
|
} catch (e3) {
|
|
4200
3947
|
return null;
|
|
4201
3948
|
}
|
|
@@ -4308,7 +4055,7 @@ function serializeWorkflowHistoryForJson(data) {
|
|
|
4308
4055
|
if (data === null) {
|
|
4309
4056
|
return null;
|
|
4310
4057
|
}
|
|
4311
|
-
const history =
|
|
4058
|
+
const history = _chunkY5CFDGPAcjs.decodeWorkflowHistoryTransport.call(void 0, data);
|
|
4312
4059
|
return jsonSafe({
|
|
4313
4060
|
nameRegistry: [...history.nameRegistry],
|
|
4314
4061
|
entries: history.entries.map((entry) => ({
|
|
@@ -4407,7 +4154,7 @@ var NativeConnAdapter = class {
|
|
|
4407
4154
|
this.#ctx = ctx;
|
|
4408
4155
|
this.#queueHibernationRemoval = queueHibernationRemoval;
|
|
4409
4156
|
this.#assertCanMutateState = assertCanMutateState;
|
|
4410
|
-
this[
|
|
4157
|
+
this[_chunkSSF2XC33cjs.CONN_STATE_MANAGER_SYMBOL] = {
|
|
4411
4158
|
stateEnabled: true,
|
|
4412
4159
|
get state() {
|
|
4413
4160
|
return thisConn.state;
|
|
@@ -4424,7 +4171,7 @@ var NativeConnAdapter = class {
|
|
|
4424
4171
|
decodeValue(this.#runtime.connParams(this.#conn))
|
|
4425
4172
|
);
|
|
4426
4173
|
}
|
|
4427
|
-
[
|
|
4174
|
+
[_chunkSSF2XC33cjs.RAW_STATE_SYMBOL]() {
|
|
4428
4175
|
return this.#readState();
|
|
4429
4176
|
}
|
|
4430
4177
|
get state() {
|
|
@@ -4454,7 +4201,7 @@ var NativeConnAdapter = class {
|
|
|
4454
4201
|
},
|
|
4455
4202
|
(newValue) => {
|
|
4456
4203
|
assertCurrentState();
|
|
4457
|
-
|
|
4204
|
+
_chunkY4QLVCCScjs.assertJsonCompatValue.call(void 0, newValue);
|
|
4458
4205
|
}
|
|
4459
4206
|
);
|
|
4460
4207
|
}
|
|
@@ -4462,7 +4209,7 @@ var NativeConnAdapter = class {
|
|
|
4462
4209
|
var _a;
|
|
4463
4210
|
(_a = this.#assertCanMutateState) == null ? void 0 : _a.call(this);
|
|
4464
4211
|
const nextValue = unwrapWriteThroughProxy(value);
|
|
4465
|
-
|
|
4212
|
+
_chunkY4QLVCCScjs.assertJsonCompatValue.call(void 0, nextValue);
|
|
4466
4213
|
this.#writeState(nextValue, { writeNative: true });
|
|
4467
4214
|
}
|
|
4468
4215
|
initializeState(value) {
|
|
@@ -5481,7 +5228,7 @@ var ActorContextHandleAdapter = class {
|
|
|
5481
5228
|
this.#databaseProvider = databaseProvider;
|
|
5482
5229
|
}
|
|
5483
5230
|
this.#request = request;
|
|
5484
|
-
this[
|
|
5231
|
+
this[_chunkSSF2XC33cjs.ACTOR_CONTEXT_INTERNAL_SYMBOL] = new NativeWorkflowRuntimeAdapter(
|
|
5485
5232
|
this,
|
|
5486
5233
|
() => this.#logByInvocationScope.delete(
|
|
5487
5234
|
_nullishCoalesce(this.#runtime.currentInvocationScope(), () => ( NO_INVOCATION_SCOPE))
|
|
@@ -5514,7 +5261,7 @@ var ActorContextHandleAdapter = class {
|
|
|
5514
5261
|
}
|
|
5515
5262
|
throw databaseClientNotReadyError();
|
|
5516
5263
|
}
|
|
5517
|
-
[
|
|
5264
|
+
[_chunkSSF2XC33cjs.RAW_STATE_SYMBOL]() {
|
|
5518
5265
|
if (!this.#stateEnabled) {
|
|
5519
5266
|
throw stateNotEnabledError();
|
|
5520
5267
|
}
|
|
@@ -5541,7 +5288,7 @@ var ActorContextHandleAdapter = class {
|
|
|
5541
5288
|
},
|
|
5542
5289
|
(newValue) => {
|
|
5543
5290
|
assertCurrentState();
|
|
5544
|
-
|
|
5291
|
+
_chunkY4QLVCCScjs.assertJsonCompatValue.call(void 0, newValue);
|
|
5545
5292
|
}
|
|
5546
5293
|
);
|
|
5547
5294
|
}
|
|
@@ -5553,7 +5300,7 @@ var ActorContextHandleAdapter = class {
|
|
|
5553
5300
|
}
|
|
5554
5301
|
this.#assertCanMutateState();
|
|
5555
5302
|
const nextValue = unwrapWriteThroughProxy(value);
|
|
5556
|
-
|
|
5303
|
+
_chunkY4QLVCCScjs.assertJsonCompatValue.call(void 0, nextValue);
|
|
5557
5304
|
this.#writeState(nextValue, { scheduleSave: true });
|
|
5558
5305
|
}
|
|
5559
5306
|
initializeState(value) {
|
|
@@ -5767,16 +5514,14 @@ var ActorContextHandleAdapter = class {
|
|
|
5767
5514
|
log: {
|
|
5768
5515
|
debug: (obj) => logger2().debug(obj)
|
|
5769
5516
|
},
|
|
5770
|
-
nativeDatabaseProvider:
|
|
5517
|
+
nativeDatabaseProvider: _chunk22S5RCCJcjs.registerNativeStateTransactionOpener.call(void 0,
|
|
5771
5518
|
{
|
|
5772
5519
|
open: async (requestedActorId) => {
|
|
5773
5520
|
void requestedActorId;
|
|
5774
|
-
|
|
5521
|
+
return getOrCreateNativeSqlDatabase(
|
|
5775
5522
|
this.#runtime,
|
|
5776
5523
|
this.#ctx
|
|
5777
5524
|
);
|
|
5778
|
-
await database.open();
|
|
5779
|
-
return database;
|
|
5780
5525
|
}
|
|
5781
5526
|
},
|
|
5782
5527
|
async (timeoutMs, context) => await getOrCreateNativeSqlDatabase(
|
|
@@ -5792,7 +5537,7 @@ var ActorContextHandleAdapter = class {
|
|
|
5792
5537
|
return this.#db;
|
|
5793
5538
|
}
|
|
5794
5539
|
#bindDatabaseClient(client) {
|
|
5795
|
-
return
|
|
5540
|
+
return _chunk22S5RCCJcjs.bindNativeStateTransactionContext.call(void 0, client, {
|
|
5796
5541
|
enter: async () => await this.#enterStateTransaction(),
|
|
5797
5542
|
exit: (scope) => this.#exitStateTransaction(
|
|
5798
5543
|
scope
|
|
@@ -5996,7 +5741,7 @@ var ActorContextHandleAdapter = class {
|
|
|
5996
5741
|
const trackedPromise = Promise.resolve(promise).catch((error) => {
|
|
5997
5742
|
logger2().warn({
|
|
5998
5743
|
msg: "keepAwake promise rejected",
|
|
5999
|
-
error:
|
|
5744
|
+
error: _chunkY4QLVCCScjs.stringifyError.call(void 0, error)
|
|
6000
5745
|
});
|
|
6001
5746
|
}).then(() => null);
|
|
6002
5747
|
try {
|
|
@@ -6376,24 +6121,21 @@ function buildActorTracingConfig(actions, tracing) {
|
|
|
6376
6121
|
if (tracing === void 0) return void 0;
|
|
6377
6122
|
return {
|
|
6378
6123
|
sampler: tracing.sampler,
|
|
6379
|
-
actions:
|
|
6124
|
+
actions: _chunkSSF2XC33cjs.flattenActionTraceSamplers.call(void 0, actions, tracing.actions)
|
|
6380
6125
|
};
|
|
6381
6126
|
}
|
|
6382
|
-
var SQLITE_DEFERRED_COMMITS = /* @__PURE__ */ Symbol.for("rivetkit.sqlite.deferredCommits");
|
|
6383
6127
|
function buildActorConfig(definition, registryConfig, runtimeKind) {
|
|
6384
|
-
var _a
|
|
6128
|
+
var _a;
|
|
6385
6129
|
const config = definition.config;
|
|
6386
6130
|
const options = _nullishCoalesce(config.options, () => ( {}));
|
|
6387
6131
|
const canHibernate = options.canHibernateWebSocket;
|
|
6388
6132
|
const usesRemoteSqlite = sqliteBackendForConfig(registryConfig) === "remote";
|
|
6389
6133
|
const sqliteProfiling = (_a = config.db) == null ? void 0 : _a.sqliteProfiling;
|
|
6390
|
-
const sqliteDeferredCommits = ((_b = config.db) == null ? void 0 : _b[SQLITE_DEFERRED_COMMITS]) === true;
|
|
6391
6134
|
return {
|
|
6392
6135
|
name: options.name,
|
|
6393
6136
|
icon: options.icon,
|
|
6394
6137
|
hasDatabase: true,
|
|
6395
6138
|
remoteSqlite: usesRemoteSqlite,
|
|
6396
|
-
sqliteDeferredCommits: sqliteDeferredCommits || void 0,
|
|
6397
6139
|
sqliteProfiling,
|
|
6398
6140
|
tracing: buildActorTracingConfig(
|
|
6399
6141
|
definition.config.actions,
|
|
@@ -6421,7 +6163,7 @@ function buildActorConfig(definition, registryConfig, runtimeKind) {
|
|
|
6421
6163
|
maxOutgoingMessageSize: registryConfig.maxOutgoingMessageSize,
|
|
6422
6164
|
preloadMaxWorkflowBytes: options.preloadMaxWorkflowBytes,
|
|
6423
6165
|
preloadMaxConnectionsBytes: options.preloadMaxConnectionsBytes,
|
|
6424
|
-
actions: Object.keys(
|
|
6166
|
+
actions: Object.keys(_chunkSSF2XC33cjs.flattenActionHandlers.call(void 0, config.actions)).sort().map((name) => ({ name })),
|
|
6425
6167
|
inspectorTabs: buildInspectorTabs(config.inspector, runtimeKind)
|
|
6426
6168
|
};
|
|
6427
6169
|
}
|
|
@@ -6497,10 +6239,10 @@ function validateInspectorTabSource(tabId, resolved) {
|
|
|
6497
6239
|
function buildNativeFactory(runtime, registryConfig, definition) {
|
|
6498
6240
|
var _a;
|
|
6499
6241
|
const config = definition.config;
|
|
6500
|
-
const databaseProvider = _nullishCoalesce(config.db, () => (
|
|
6501
|
-
const actionHandlers =
|
|
6242
|
+
const databaseProvider = _nullishCoalesce(config.db, () => ( _chunk22S5RCCJcjs.db.call(void 0, )));
|
|
6243
|
+
const actionHandlers = _chunkSSF2XC33cjs.flattenActionHandlers.call(void 0, config.actions);
|
|
6502
6244
|
const schemaConfig = {
|
|
6503
|
-
actionInputSchemas:
|
|
6245
|
+
actionInputSchemas: _chunkSSF2XC33cjs.flattenActionInputSchemas.call(void 0,
|
|
6504
6246
|
config.actions,
|
|
6505
6247
|
config.actionInputSchemas
|
|
6506
6248
|
),
|
|
@@ -6508,9 +6250,9 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
6508
6250
|
events: config.events,
|
|
6509
6251
|
queues: config.queues
|
|
6510
6252
|
};
|
|
6511
|
-
const createClient = (ctx) =>
|
|
6512
|
-
new (0,
|
|
6513
|
-
|
|
6253
|
+
const createClient = (ctx) => _chunkNG5CUXMMcjs.createClientWithDriver.call(void 0,
|
|
6254
|
+
new (0, _chunkNG5CUXMMcjs.RemoteEngineControlClient)(
|
|
6255
|
+
_chunkNG5CUXMMcjs.convertRegistryConfigToClientConfig.call(void 0, registryConfig)
|
|
6514
6256
|
),
|
|
6515
6257
|
{
|
|
6516
6258
|
encoding: "bare",
|
|
@@ -6522,13 +6264,13 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
6522
6264
|
)
|
|
6523
6265
|
}
|
|
6524
6266
|
);
|
|
6525
|
-
const run =
|
|
6526
|
-
const runHandlerCoordinator =
|
|
6267
|
+
const run = _chunkSSF2XC33cjs.getRunFunction.call(void 0, config.run);
|
|
6268
|
+
const runHandlerCoordinator = _chunkSSF2XC33cjs.getRunInspectorKind.call(void 0, config.run) === "workflow" ? new RunHandlerCoordinator(config.run) : void 0;
|
|
6527
6269
|
const getNativeWorkflowInspector = (ctx) => {
|
|
6528
6270
|
var _a2, _b;
|
|
6529
6271
|
const actorId = callNativeSync(() => runtime.actorId(ctx));
|
|
6530
6272
|
const restart = () => callNativeSync(() => runtime.actorRestartRunHandler(ctx));
|
|
6531
|
-
return _nullishCoalesce(((_a2 = runHandlerCoordinator == null ? void 0 : runHandlerCoordinator.getInspector(actorId, restart)) == null ? void 0 : _a2.workflow), () => ( ((_b =
|
|
6273
|
+
return _nullishCoalesce(((_a2 = runHandlerCoordinator == null ? void 0 : runHandlerCoordinator.getInspector(actorId, restart)) == null ? void 0 : _a2.workflow), () => ( ((_b = _chunkSSF2XC33cjs.getRunInspectorConfig.call(void 0, config.run, actorId)) == null ? void 0 : _b.workflow)));
|
|
6532
6274
|
};
|
|
6533
6275
|
const onStateChange = typeof config.onStateChange === "function" ? (actorCtx, nextState) => {
|
|
6534
6276
|
config.onStateChange(actorCtx, nextState);
|
|
@@ -6702,7 +6444,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
6702
6444
|
400
|
|
6703
6445
|
);
|
|
6704
6446
|
}
|
|
6705
|
-
const cbor =
|
|
6447
|
+
const cbor = _chunkY4QLVCCScjs.encodeCborCompat.call(void 0,
|
|
6706
6448
|
_nullishCoalesce(body.body, () => ( null))
|
|
6707
6449
|
);
|
|
6708
6450
|
const message = await runtime.actorQueueSend(ctx, name, cbor);
|
|
@@ -7070,7 +6812,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
7070
6812
|
);
|
|
7071
6813
|
} finally {
|
|
7072
6814
|
runHandlerCoordinator == null ? void 0 : runHandlerCoordinator.destroy(actorId);
|
|
7073
|
-
|
|
6815
|
+
_chunkSSF2XC33cjs.disposeRunInspector.call(void 0, config.run, actorId);
|
|
7074
6816
|
await actorCtx.dispose();
|
|
7075
6817
|
}
|
|
7076
6818
|
}
|
|
@@ -7082,7 +6824,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
7082
6824
|
const actorCtx = makeActorCtx(ctx);
|
|
7083
6825
|
const actorId = callNativeSync(() => runtime.actorId(ctx));
|
|
7084
6826
|
runHandlerCoordinator == null ? void 0 : runHandlerCoordinator.destroy(actorId);
|
|
7085
|
-
|
|
6827
|
+
_chunkSSF2XC33cjs.disposeRunInspector.call(void 0, config.run, actorId);
|
|
7086
6828
|
try {
|
|
7087
6829
|
if (typeof config.onDestroy === "function") {
|
|
7088
6830
|
await config.onDestroy(actorCtx);
|
|
@@ -7299,7 +7041,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
7299
7041
|
...request,
|
|
7300
7042
|
abortController: requestAbortController
|
|
7301
7043
|
});
|
|
7302
|
-
const rawConnParams = handlerRequest.headers.get(
|
|
7044
|
+
const rawConnParams = handlerRequest.headers.get(_chunkNG5CUXMMcjs.HEADER_CONN_PARAMS);
|
|
7303
7045
|
let requestCtx;
|
|
7304
7046
|
let conn;
|
|
7305
7047
|
let removeRequestAbortListener;
|
|
@@ -7356,7 +7098,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
7356
7098
|
requestCtx,
|
|
7357
7099
|
handlerRequest
|
|
7358
7100
|
);
|
|
7359
|
-
if (!
|
|
7101
|
+
if (!_chunkNG5CUXMMcjs.isResponseLike.call(void 0, response)) {
|
|
7360
7102
|
throw new Error(
|
|
7361
7103
|
"onRequest handler must return a Response"
|
|
7362
7104
|
);
|
|
@@ -7446,15 +7188,15 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
7446
7188
|
}
|
|
7447
7189
|
);
|
|
7448
7190
|
})(),
|
|
7449
|
-
getWorkflowHistory:
|
|
7191
|
+
getWorkflowHistory: _chunkSSF2XC33cjs.hasRunInspectorConfig.call(void 0, config.run) ? wrapNativeCallback(
|
|
7450
7192
|
async (error, payload) => {
|
|
7451
7193
|
var _a2;
|
|
7452
7194
|
const { ctx } = unwrapTsfnPayload(error, payload);
|
|
7453
7195
|
const history = (_a2 = getNativeWorkflowInspector(ctx)) == null ? void 0 : _a2.getHistory();
|
|
7454
|
-
return history == null ? void 0 :
|
|
7196
|
+
return history == null ? void 0 : _chunkY4QLVCCScjs.toUint8Array.call(void 0, history);
|
|
7455
7197
|
}
|
|
7456
7198
|
) : void 0,
|
|
7457
|
-
replayWorkflow:
|
|
7199
|
+
replayWorkflow: _chunkSSF2XC33cjs.hasRunInspectorConfig.call(void 0, config.run) ? wrapNativeCallback(
|
|
7458
7200
|
async (error, payload) => {
|
|
7459
7201
|
const { ctx, entryId } = unwrapTsfnPayload(
|
|
7460
7202
|
error,
|
|
@@ -7465,7 +7207,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
7465
7207
|
return void 0;
|
|
7466
7208
|
}
|
|
7467
7209
|
const history = await _asyncNullishCoalesce(await workflowInspector.replayFromStep(entryId), async () => ( null));
|
|
7468
|
-
return history == null ? void 0 :
|
|
7210
|
+
return history == null ? void 0 : _chunkY4QLVCCScjs.toUint8Array.call(void 0, history);
|
|
7469
7211
|
}
|
|
7470
7212
|
) : void 0,
|
|
7471
7213
|
actions: Object.fromEntries(
|
|
@@ -7475,6 +7217,11 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
7475
7217
|
async (error, payload) => {
|
|
7476
7218
|
const { ctx, conn, args, scheduledFire, cancelToken } = unwrapTsfnPayload(error, payload);
|
|
7477
7219
|
const actorCtx = conn != null ? makeConnCtx(ctx, conn, void 0, cancelToken) : makeActorCtx(ctx, void 0, cancelToken);
|
|
7220
|
+
if (scheduledFire) {
|
|
7221
|
+
Object.defineProperty(actorCtx, "scheduledFire", {
|
|
7222
|
+
value: scheduledFire
|
|
7223
|
+
});
|
|
7224
|
+
}
|
|
7478
7225
|
const runAction = async () => {
|
|
7479
7226
|
try {
|
|
7480
7227
|
return encodeValue(
|
|
@@ -7587,7 +7334,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
7587
7334
|
buildActorConfig(definition, registryConfig, runtime.kind)
|
|
7588
7335
|
);
|
|
7589
7336
|
}
|
|
7590
|
-
async function buildServeConfig(config,
|
|
7337
|
+
async function buildServeConfig(config, resolveNativeBinaries = true) {
|
|
7591
7338
|
var _a;
|
|
7592
7339
|
if (!config.endpoint) {
|
|
7593
7340
|
throw nativeEndpointNotConfiguredError();
|
|
@@ -7599,27 +7346,29 @@ async function buildServeConfig(config, resolveServicesBinary = true) {
|
|
|
7599
7346
|
token: config.token,
|
|
7600
7347
|
namespace: config.namespace,
|
|
7601
7348
|
poolName: config.node.poolName,
|
|
7602
|
-
startServices:
|
|
7349
|
+
startServices: resolveNativeBinaries && config.startServices,
|
|
7603
7350
|
handleInspectorHttpInRuntime: true,
|
|
7604
7351
|
serverlessBasePath: config.serverless.basePath,
|
|
7605
|
-
serverlessPackageVersion:
|
|
7352
|
+
serverlessPackageVersion: _chunkY4QLVCCScjs.VERSION,
|
|
7606
7353
|
serverlessClientEndpoint: config.publicEndpoint,
|
|
7607
7354
|
serverlessClientNamespace: config.publicNamespace,
|
|
7608
7355
|
serverlessClientToken: config.publicToken,
|
|
7609
7356
|
serverlessValidateEndpoint: config.validateServerlessEndpoint,
|
|
7610
7357
|
serverlessMaxStartPayloadBytes: config.serverless.maxStartPayloadBytes
|
|
7611
7358
|
};
|
|
7612
|
-
|
|
7613
|
-
|
|
7614
|
-
|
|
7615
|
-
|
|
7616
|
-
|
|
7617
|
-
|
|
7618
|
-
|
|
7619
|
-
|
|
7359
|
+
if (resolveNativeBinaries) {
|
|
7360
|
+
try {
|
|
7361
|
+
const { getEnginePath } = await loadEngineCli();
|
|
7362
|
+
serveConfig.engineBinaryPath = getEnginePath();
|
|
7363
|
+
} catch (error) {
|
|
7364
|
+
logger2().warn({
|
|
7365
|
+
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",
|
|
7366
|
+
error: _chunkY4QLVCCScjs.stringifyError.call(void 0, error)
|
|
7367
|
+
});
|
|
7368
|
+
}
|
|
7620
7369
|
}
|
|
7621
|
-
if (
|
|
7622
|
-
const servicesBinary =
|
|
7370
|
+
if (resolveNativeBinaries && config.startServices) {
|
|
7371
|
+
const servicesBinary = _chunkY4QLVCCScjs.getEnvUniversal.call(void 0, "RIVET_SERVICES_BINARY");
|
|
7623
7372
|
if (servicesBinary) {
|
|
7624
7373
|
serveConfig.servicesBinaryPath = servicesBinary;
|
|
7625
7374
|
} else {
|
|
@@ -7634,13 +7383,13 @@ async function buildServeConfig(config, resolveServicesBinary = true) {
|
|
|
7634
7383
|
serveConfig.engineHost = config.engineHost;
|
|
7635
7384
|
serveConfig.enginePort = config.enginePort;
|
|
7636
7385
|
if ((_a = config.test) == null ? void 0 : _a.enabled) {
|
|
7637
|
-
serveConfig.inspectorTestToken = _nullishCoalesce(
|
|
7386
|
+
serveConfig.inspectorTestToken = _nullishCoalesce(_chunkY4QLVCCScjs.getEnvUniversal.call(void 0, "_RIVET_TEST_INSPECTOR_TOKEN"), () => ( "token"));
|
|
7638
7387
|
}
|
|
7639
7388
|
return serveConfig;
|
|
7640
7389
|
}
|
|
7641
7390
|
async function buildRegistryWithRuntime(config, runtime) {
|
|
7642
7391
|
var _a;
|
|
7643
|
-
if (((_a = config.test) == null ? void 0 : _a.enabled) &&
|
|
7392
|
+
if (((_a = config.test) == null ? void 0 : _a.enabled) && _chunkY4QLVCCScjs.getEnvUniversal.call(void 0, "_RIVET_TEST_INSPECTOR_TOKEN") === void 0) {
|
|
7644
7393
|
trySetProcessEnv("_RIVET_TEST_INSPECTOR_TOKEN", "token");
|
|
7645
7394
|
}
|
|
7646
7395
|
if (runtime.kind === "napi") {
|
|
@@ -7712,7 +7461,7 @@ function createApplicationFetch(application, runtime) {
|
|
|
7712
7461
|
signal: abortController.signal
|
|
7713
7462
|
})
|
|
7714
7463
|
);
|
|
7715
|
-
if (!
|
|
7464
|
+
if (!_chunkNG5CUXMMcjs.isResponseLike.call(void 0, response)) {
|
|
7716
7465
|
throw new TypeError(
|
|
7717
7466
|
"registry.listen() application fetch must return a Response"
|
|
7718
7467
|
);
|
|
@@ -7762,7 +7511,7 @@ var Registry = class {
|
|
|
7762
7511
|
var _a;
|
|
7763
7512
|
this.#config = config;
|
|
7764
7513
|
if ((_a = config.logging) == null ? void 0 : _a.baseLogger) {
|
|
7765
|
-
|
|
7514
|
+
_chunkY4QLVCCScjs.configureBaseLogger.call(void 0, config.logging.baseLogger);
|
|
7766
7515
|
}
|
|
7767
7516
|
this.#buildConfiguredRegistry = _nullishCoalesce((deps == null ? void 0 : deps.buildConfiguredRegistry), () => ( buildConfiguredRegistry));
|
|
7768
7517
|
this.routes = {
|
|
@@ -7994,10 +7743,10 @@ var Registry = class {
|
|
|
7994
7743
|
if (!opts.application) {
|
|
7995
7744
|
rejectServerless();
|
|
7996
7745
|
}
|
|
7997
|
-
const port = _nullishCoalesce(_nullishCoalesce(opts.port, () => (
|
|
7998
|
-
const publicDir = _nullishCoalesce(opts.publicDir, () => (
|
|
7746
|
+
const port = _nullishCoalesce(_nullishCoalesce(opts.port, () => ( _chunkY4QLVCCScjs.parsePortEnv.call(void 0, process.env.RIVET_PORT))), () => ( 3e3));
|
|
7747
|
+
const publicDir = _nullishCoalesce(opts.publicDir, () => ( _chunkY4QLVCCScjs.getRivetkitPublicDir.call(void 0, )));
|
|
7999
7748
|
const config = this.parseConfig();
|
|
8000
|
-
if (opts.application &&
|
|
7749
|
+
if (opts.application && _chunkY4QLVCCScjs.getRivetkitRuntimeMode.call(void 0, ) !== "serverless") {
|
|
8001
7750
|
if (config.runtime === "wasm") {
|
|
8002
7751
|
throw new Error(
|
|
8003
7752
|
"registry.listen() requires the native runtime; use an application-owned HTTP server with WebAssembly"
|
|
@@ -8073,7 +7822,7 @@ var Registry = class {
|
|
|
8073
7822
|
return jsonRouteResponse(503, {
|
|
8074
7823
|
status: "not_started",
|
|
8075
7824
|
runtime: "rivetkit",
|
|
8076
|
-
version:
|
|
7825
|
+
version: _chunkY4QLVCCScjs.VERSION
|
|
8077
7826
|
});
|
|
8078
7827
|
}
|
|
8079
7828
|
const { runtime, registry } = configured;
|
|
@@ -8081,7 +7830,7 @@ var Registry = class {
|
|
|
8081
7830
|
return jsonRouteResponse(501, {
|
|
8082
7831
|
status: "unsupported",
|
|
8083
7832
|
runtime: "rivetkit",
|
|
8084
|
-
version:
|
|
7833
|
+
version: _chunkY4QLVCCScjs.VERSION
|
|
8085
7834
|
});
|
|
8086
7835
|
}
|
|
8087
7836
|
const response = await runtime.registryHealth(registry);
|
|
@@ -8156,14 +7905,14 @@ var Registry = class {
|
|
|
8156
7905
|
var _a;
|
|
8157
7906
|
if (!this.#runtimeServePromise) {
|
|
8158
7907
|
const configuredEnvoyVersion = (_a = this.#config.node) == null ? void 0 : _a.version;
|
|
8159
|
-
const envoyVersionSource = configuredEnvoyVersion !== void 0 ? "config" :
|
|
7908
|
+
const envoyVersionSource = configuredEnvoyVersion !== void 0 ? "config" : _chunkY4QLVCCScjs.getRivetEnvoyVersion.call(void 0, ) !== void 0 ? "environment" : "default";
|
|
8160
7909
|
logger2().info({
|
|
8161
7910
|
msg: "starting rivetkit envoy",
|
|
8162
|
-
rivetkitVersion:
|
|
7911
|
+
rivetkitVersion: _chunkY4QLVCCScjs.VERSION,
|
|
8163
7912
|
envoyVersion: config.node.version,
|
|
8164
7913
|
envoyVersionSource
|
|
8165
7914
|
});
|
|
8166
|
-
if (envoyVersionSource === "default" &&
|
|
7915
|
+
if (envoyVersionSource === "default" && _chunkY4QLVCCScjs.getNodeEnv.call(void 0, ) === "production") {
|
|
8167
7916
|
logger2().error({
|
|
8168
7917
|
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",
|
|
8169
7918
|
envoyVersion: config.node.version,
|
|
@@ -8252,7 +8001,7 @@ var Registry = class {
|
|
|
8252
8001
|
const modeAPromise = this.#runtimeServeConfiguredPromise;
|
|
8253
8002
|
const modeBPromise = this.#runtimeServerlessPromise;
|
|
8254
8003
|
const runtimes = /* @__PURE__ */ new Set();
|
|
8255
|
-
const localDevSignal = signalDriven &&
|
|
8004
|
+
const localDevSignal = signalDriven && _chunkY4QLVCCScjs.getNodeEnv.call(void 0, ) !== "production" && config.engineSpawn && config.endpoint !== void 0 && _chunkNG5CUXMMcjs.isLocalEngineEndpoint.call(void 0, config.endpoint);
|
|
8256
8005
|
let gracePeriodMs = (_a = config.shutdown) == null ? void 0 : _a.gracePeriodMs;
|
|
8257
8006
|
if (gracePeriodMs === void 0) {
|
|
8258
8007
|
gracePeriodMs = localDevSignal ? LOCAL_DEV_SHUTDOWN_GRACE_PERIOD_MS : await _asyncNullishCoalesce(await this.#actorStopThresholdMs(
|
|
@@ -8364,7 +8113,7 @@ var Registry = class {
|
|
|
8364
8113
|
}
|
|
8365
8114
|
if (this.#runtimeReadyPromise) return this.#runtimeReadyPromise;
|
|
8366
8115
|
try {
|
|
8367
|
-
if (
|
|
8116
|
+
if (_chunkY4QLVCCScjs.getRivetkitRuntimeMode.call(void 0, ) === "serverless") {
|
|
8368
8117
|
return Promise.reject(
|
|
8369
8118
|
new Error(
|
|
8370
8119
|
"registry.startAndWait() requires envoy runtime mode; serverless registries become ready per request"
|
|
@@ -8388,7 +8137,7 @@ var Registry = class {
|
|
|
8388
8137
|
if (!configuredRegistryPromise || !serveLifecyclePromise) {
|
|
8389
8138
|
throw new Error("registry envoy startup did not initialize");
|
|
8390
8139
|
}
|
|
8391
|
-
const readyTimeoutMs = config.engineSpawn && config.endpoint !== void 0 &&
|
|
8140
|
+
const readyTimeoutMs = config.engineSpawn && config.endpoint !== void 0 && _chunkNG5CUXMMcjs.isLocalEngineEndpoint.call(void 0, config.endpoint) ? LOCAL_ENGINE_READY_TIMEOUT_MS : REGISTRY_READY_TIMEOUT_MS;
|
|
8392
8141
|
let timeout;
|
|
8393
8142
|
const timeoutPromise = new Promise((_resolve, reject) => {
|
|
8394
8143
|
var _a;
|
|
@@ -8438,8 +8187,8 @@ var Registry = class {
|
|
|
8438
8187
|
* ```
|
|
8439
8188
|
*/
|
|
8440
8189
|
start() {
|
|
8441
|
-
if (
|
|
8442
|
-
const publicDir = _nullishCoalesce(
|
|
8190
|
+
if (_chunkY4QLVCCScjs.getRivetkitRuntimeMode.call(void 0, ) === "serverless") {
|
|
8191
|
+
const publicDir = _nullishCoalesce(_chunkY4QLVCCScjs.getRivetkitPublicDir.call(void 0, ), () => ( "/public"));
|
|
8443
8192
|
this.listen({ publicDir }).catch((error) => {
|
|
8444
8193
|
logger2().error({ error }, "auto-listen failed; exiting");
|
|
8445
8194
|
if (typeof process !== "undefined" && typeof process.exit === "function") {
|
|
@@ -8460,13 +8209,13 @@ var Registry = class {
|
|
|
8460
8209
|
};
|
|
8461
8210
|
console.log();
|
|
8462
8211
|
console.log(
|
|
8463
|
-
` RivetKit ${
|
|
8212
|
+
` RivetKit ${_chunkY4QLVCCScjs.VERSION} (Engine - ${kind === "serverless" ? "Serverless" : "Serverful"})`
|
|
8464
8213
|
);
|
|
8465
8214
|
if (config.namespace !== "default") {
|
|
8466
8215
|
logLine("Namespace", config.namespace);
|
|
8467
8216
|
}
|
|
8468
8217
|
if (config.endpoint) {
|
|
8469
|
-
const endpointType = config.startEngine ||
|
|
8218
|
+
const endpointType = config.startEngine || _chunkNG5CUXMMcjs.isLocalEngineEndpoint.call(void 0, config.endpoint) ? "local native" : "remote";
|
|
8470
8219
|
logLine("Endpoint", `${config.endpoint} (${endpointType})`);
|
|
8471
8220
|
}
|
|
8472
8221
|
if (kind === "serverless" && config.publicEndpoint) {
|
|
@@ -8536,5 +8285,5 @@ function setup(input) {
|
|
|
8536
8285
|
|
|
8537
8286
|
|
|
8538
8287
|
|
|
8539
|
-
exports.ALLOWED_PUBLIC_HEADERS =
|
|
8288
|
+
exports.ALLOWED_PUBLIC_HEADERS = _chunkNG5CUXMMcjs.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 = _chunkNG5CUXMMcjs.createClientWithDriver; exports.defineRunHandler = _chunkSSF2XC33cjs.defineRunHandler; exports.event = event; exports.isStaticActorDefinition = isStaticActorDefinition; exports.isStaticActorInstance = isStaticActorInstance; exports.lookupInRegistry = lookupInRegistry; exports.noopNext = _chunkY4QLVCCScjs.noopNext; exports.queue = queue; exports.setup = setup; exports.toUint8Array = _chunkY4QLVCCScjs.toUint8Array;
|
|
8540
8289
|
//# sourceMappingURL=mod.cjs.map
|