rivetkit 0.0.0-sqlite-sync-3x-release.a00b07f → 0.0.0-sqlite-query-metrics-v2.f5d3605
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 +59 -99
- package/dist/browser/client.js +20 -193
- package/dist/browser/client.js.map +1 -1
- package/dist/browser/inspector/client.js +2 -1
- package/dist/browser/inspector/client.js.map +1 -1
- package/dist/tsup/{chunk-D5WUPE47.js → chunk-3URZ4UV5.js} +2 -2
- package/dist/tsup/{chunk-TSQTI6H6.js → chunk-D4G35VTO.js} +4 -4
- package/dist/tsup/{chunk-OTVJYZ2L.cjs → chunk-DDS7OOVF.cjs} +166 -326
- package/dist/tsup/chunk-DDS7OOVF.cjs.map +1 -0
- package/dist/tsup/{chunk-6KXVLIXL.cjs → chunk-DHL2M2E2.cjs} +3 -3
- package/dist/tsup/{chunk-6KXVLIXL.cjs.map → chunk-DHL2M2E2.cjs.map} +1 -1
- package/dist/tsup/{chunk-ZYK4B5WV.js → chunk-E2CUROR3.js} +2 -2
- package/dist/tsup/{chunk-JUWMP5O3.js → chunk-EPRA2TCT.js} +2 -2
- package/dist/tsup/{chunk-3DONDAMG.js → chunk-F7IGTKGM.js} +2 -2
- package/dist/tsup/{chunk-BTSDFFDC.cjs → chunk-FYDB45YU.cjs} +10 -10
- package/dist/tsup/{chunk-BTSDFFDC.cjs.map → chunk-FYDB45YU.cjs.map} +1 -1
- package/dist/tsup/{chunk-73RNTXHB.cjs → chunk-HO76AEDH.cjs} +3 -3
- package/dist/tsup/{chunk-73RNTXHB.cjs.map → chunk-HO76AEDH.cjs.map} +1 -1
- package/dist/tsup/{chunk-A2CF6PFH.js → chunk-JI6GZ2C2.js} +1 -18
- package/dist/tsup/chunk-JI6GZ2C2.js.map +1 -0
- package/dist/tsup/{chunk-Z7E2G3JZ.cjs → chunk-JW2WPE6Z.cjs} +4 -4
- package/dist/tsup/{chunk-Z7E2G3JZ.cjs.map → chunk-JW2WPE6Z.cjs.map} +1 -1
- package/dist/tsup/{chunk-2MOLY6AM.cjs → chunk-KDT56V3Y.cjs} +11 -10
- package/dist/tsup/chunk-KDT56V3Y.cjs.map +1 -0
- package/dist/tsup/{chunk-DJUBJQEQ.js → chunk-KSP3NXGY.js} +3 -3
- package/dist/tsup/{chunk-JUHXV3HF.cjs → chunk-L3Z3W44Q.cjs} +3 -3
- package/dist/tsup/{chunk-JUHXV3HF.cjs.map → chunk-L3Z3W44Q.cjs.map} +1 -1
- package/dist/tsup/{chunk-RTWH3AX3.cjs → chunk-MYWZCDML.cjs} +2 -19
- package/dist/tsup/chunk-MYWZCDML.cjs.map +1 -0
- package/dist/tsup/{chunk-TRUHDXOU.js → chunk-PJ5EXY6F.js} +25 -185
- package/dist/tsup/chunk-PJ5EXY6F.js.map +1 -0
- package/dist/tsup/{chunk-TM76Z7XT.cjs → chunk-QR6EAWEC.cjs} +7 -7
- package/dist/tsup/{chunk-TM76Z7XT.cjs.map → chunk-QR6EAWEC.cjs.map} +1 -1
- package/dist/tsup/{chunk-BRH4PQS5.js → chunk-USKGKQZM.js} +11 -10
- package/dist/tsup/chunk-USKGKQZM.js.map +1 -0
- package/dist/tsup/client/mod.cjs +6 -6
- package/dist/tsup/client/mod.d.cts +3 -15
- package/dist/tsup/client/mod.d.ts +3 -15
- package/dist/tsup/client/mod.js +5 -5
- 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-DK144OAw.d.cts → config-CkmVg2fG.d.cts} +12 -58
- package/dist/tsup/{config-B4erdavw.d.ts → config-Cw_BwH_G.d.ts} +12 -58
- package/dist/tsup/{config-BfG1qpYz.d.cts → config-D4clT6mq.d.cts} +52 -34
- package/dist/tsup/{config-BfG1qpYz.d.ts → config-D4clT6mq.d.ts} +52 -34
- package/dist/tsup/{context-Oxi6YWcG.d.ts → context-BYOKTQJi.d.ts} +2 -2
- package/dist/tsup/{context-Cvnf3BRe.d.cts → context-_xIcgBnE.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 +201 -548
- 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 +116 -463
- package/dist/tsup/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +7 -7
- package/dist/tsup/test/mod.d.cts +2 -2
- package/dist/tsup/test/mod.d.ts +2 -2
- package/dist/tsup/test/mod.js +5 -5
- 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 +17 -17
- 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 +10 -9
- package/src/actor/config.test.ts +78 -0
- package/src/actor/keys.test.ts +275 -0
- package/src/actor/keys.ts +0 -86
- package/src/actor/utils.test.ts +48 -0
- package/src/client/actor-conn.ts +6 -92
- package/src/client/actor-handle.ts +3 -21
- package/src/client/client.ts +0 -6
- package/src/client/config.ts +1 -12
- package/src/client/lifecycle-errors.ts +1 -16
- package/src/client/test.ts +44 -0
- package/src/client/token-provider.test.ts +86 -0
- package/src/client/utils.ts +2 -13
- package/src/common/database/config.ts +52 -46
- package/src/common/database/mod.test.ts +364 -0
- package/src/common/database/native-database.test.ts +220 -0
- package/src/common/database/native-database.ts +27 -247
- package/src/common/inline-websocket-adapter.test.ts +51 -0
- package/src/common/router.ts +1 -1
- package/src/db/drizzle.test.ts +164 -0
- package/src/db/mod.ts +1 -0
- package/src/engine-api/actors.ts +3 -3
- package/src/engine-client/actor-websocket-client.ts +2 -4
- package/src/engine-client/api-endpoints.ts +14 -44
- package/src/engine-client/mod.ts +2 -2
- package/src/registry/config/envoy.ts +1 -1
- package/src/registry/config/index.test.ts +25 -0
- package/src/registry/config/index.ts +31 -28
- package/src/registry/index.ts +19 -51
- package/src/registry/napi-runtime.ts +2 -81
- package/src/registry/native.ts +51 -183
- package/src/registry/run-handler-coordinator.test.ts +252 -0
- package/src/registry/runtime.test.ts +124 -0
- package/src/registry/runtime.ts +10 -79
- package/src/registry/wasm-runtime.ts +3 -94
- package/src/unstable/migrations.test.ts +170 -0
- package/src/utils/endpoint-parser.test.ts +206 -0
- package/src/utils/env-vars.ts +10 -15
- package/src/utils.test.ts +34 -0
- package/src/workflow/driver.test.ts +62 -0
- package/dist/tsup/chunk-2MOLY6AM.cjs.map +0 -1
- package/dist/tsup/chunk-A2CF6PFH.js.map +0 -1
- package/dist/tsup/chunk-BRH4PQS5.js.map +0 -1
- package/dist/tsup/chunk-OTVJYZ2L.cjs.map +0 -1
- package/dist/tsup/chunk-RTWH3AX3.cjs.map +0 -1
- package/dist/tsup/chunk-TRUHDXOU.js.map +0 -1
- package/src/client/retry-budget.ts +0 -78
- /package/dist/tsup/{chunk-D5WUPE47.js.map → chunk-3URZ4UV5.js.map} +0 -0
- /package/dist/tsup/{chunk-TSQTI6H6.js.map → chunk-D4G35VTO.js.map} +0 -0
- /package/dist/tsup/{chunk-ZYK4B5WV.js.map → chunk-E2CUROR3.js.map} +0 -0
- /package/dist/tsup/{chunk-JUWMP5O3.js.map → chunk-EPRA2TCT.js.map} +0 -0
- /package/dist/tsup/{chunk-3DONDAMG.js.map → chunk-F7IGTKGM.js.map} +0 -0
- /package/dist/tsup/{chunk-DJUBJQEQ.js.map → chunk-KSP3NXGY.js.map} +0 -0
package/dist/tsup/mod.cjs
CHANGED
|
@@ -1,5 +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 _chunkJW2WPE6Zcjs = require('./chunk-JW2WPE6Z.cjs');
|
|
3
4
|
|
|
4
5
|
|
|
5
6
|
|
|
@@ -14,10 +15,9 @@
|
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
|
|
17
|
-
var _chunkHDVZ6YZGcjs = require('./chunk-HDVZ6YZG.cjs');
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _chunkHDVZ6YZGcjs = require('./chunk-HDVZ6YZG.cjs');
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
|
|
@@ -35,17 +35,17 @@ var _chunkZ7E2G3JZcjs = require('./chunk-Z7E2G3JZ.cjs');
|
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
|
|
38
|
-
var
|
|
38
|
+
var _chunkDDS7OOVFcjs = require('./chunk-DDS7OOVF.cjs');
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
|
|
42
|
-
var
|
|
43
|
-
require('./chunk-
|
|
42
|
+
var _chunkMYWZCDMLcjs = require('./chunk-MYWZCDML.cjs');
|
|
43
|
+
require('./chunk-L3Z3W44Q.cjs');
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
|
|
47
47
|
|
|
48
|
-
var
|
|
48
|
+
var _chunkHO76AEDHcjs = require('./chunk-HO76AEDH.cjs');
|
|
49
49
|
require('./chunk-KVFIONKQ.cjs');
|
|
50
50
|
|
|
51
51
|
|
|
@@ -80,8 +80,7 @@ require('./chunk-KVFIONKQ.cjs');
|
|
|
80
80
|
|
|
81
81
|
|
|
82
82
|
|
|
83
|
-
var
|
|
84
|
-
|
|
83
|
+
var _chunkKDT56V3Ycjs = require('./chunk-KDT56V3Y.cjs');
|
|
85
84
|
|
|
86
85
|
|
|
87
86
|
|
|
@@ -98,7 +97,7 @@ var _chunkMGI2VVF6cjs = require('./chunk-MGI2VVF6.cjs');
|
|
|
98
97
|
|
|
99
98
|
// src/actor/log.ts
|
|
100
99
|
function loggerWithoutContext() {
|
|
101
|
-
return
|
|
100
|
+
return _chunkKDT56V3Ycjs.getLogger.call(void 0, "actor-runtime");
|
|
102
101
|
}
|
|
103
102
|
|
|
104
103
|
// src/actor/definition.ts
|
|
@@ -240,7 +239,7 @@ function validateSchemaSync(schemas, key, data) {
|
|
|
240
239
|
var _virtualwebsocket = require('@rivetkit/virtual-websocket');
|
|
241
240
|
var _ws = require('hono/ws');
|
|
242
241
|
function logger() {
|
|
243
|
-
return
|
|
242
|
+
return _chunkKDT56V3Ycjs.getLogger.call(void 0, "inline-websocket-adapter");
|
|
244
243
|
}
|
|
245
244
|
var InlineWebSocketAdapter = class {
|
|
246
245
|
#handler;
|
|
@@ -392,7 +391,7 @@ var InlineWebSocketAdapter = class {
|
|
|
392
391
|
|
|
393
392
|
// src/registry/log.ts
|
|
394
393
|
function logger2() {
|
|
395
|
-
return
|
|
394
|
+
return _chunkKDT56V3Ycjs.getLogger.call(void 0, "registry");
|
|
396
395
|
}
|
|
397
396
|
|
|
398
397
|
// src/serverless/configure.ts
|
|
@@ -438,8 +437,8 @@ async function configureServerlessPool(config) {
|
|
|
438
437
|
);
|
|
439
438
|
}
|
|
440
439
|
const customConfig = config.configurePool;
|
|
441
|
-
const clientConfig =
|
|
442
|
-
const dcsRes = await
|
|
440
|
+
const clientConfig = _chunkDDS7OOVFcjs.convertRegistryConfigToClientConfig.call(void 0, config);
|
|
441
|
+
const dcsRes = await _chunkDDS7OOVFcjs.getDatacenters.call(void 0, clientConfig);
|
|
443
442
|
const poolName = _nullishCoalesce(customConfig.name, () => ( "default"));
|
|
444
443
|
const serverlessToken = _nullishCoalesce(config.token, () => ( config.publicToken));
|
|
445
444
|
const headers = {
|
|
@@ -461,7 +460,7 @@ async function configureServerlessPool(config) {
|
|
|
461
460
|
metadata: _nullishCoalesce(customConfig.metadata, () => ( {})),
|
|
462
461
|
drain_on_version_upgrade: _nullishCoalesce(customConfig.drainOnVersionUpgrade, () => ( true))
|
|
463
462
|
};
|
|
464
|
-
await
|
|
463
|
+
await _chunkDDS7OOVFcjs.updateRunnerConfig.call(void 0, clientConfig, poolName, {
|
|
465
464
|
datacenters: Object.fromEntries(
|
|
466
465
|
dcsRes.datacenters.map((dc) => [dc.name, serverlessConfig])
|
|
467
466
|
)
|
|
@@ -478,7 +477,7 @@ async function configureServerlessPool(config) {
|
|
|
478
477
|
logger2().warn({
|
|
479
478
|
msg: "serverless pool configuration attempt failed",
|
|
480
479
|
attempts,
|
|
481
|
-
error:
|
|
480
|
+
error: _chunkKDT56V3Ycjs.stringifyError.call(void 0, error)
|
|
482
481
|
});
|
|
483
482
|
await sleep(CONFIGURE_RETRY_DELAY_MS);
|
|
484
483
|
}
|
|
@@ -486,7 +485,7 @@ async function configureServerlessPool(config) {
|
|
|
486
485
|
logger2().error({
|
|
487
486
|
msg: "failed to configure serverless pool, validate endpoint is configured correctly then restart this process",
|
|
488
487
|
attempts,
|
|
489
|
-
error:
|
|
488
|
+
error: _chunkKDT56V3Ycjs.stringifyError.call(void 0, lastError)
|
|
490
489
|
});
|
|
491
490
|
throw lastError;
|
|
492
491
|
}
|
|
@@ -497,11 +496,11 @@ var _zod = require('zod');
|
|
|
497
496
|
// src/registry/config/envoy.ts
|
|
498
497
|
var _v4 = require('zod/v4');
|
|
499
498
|
var EnvoyConfigSchema = _v4.z.object({
|
|
500
|
-
poolName: _v4.z.string().default(() => _nullishCoalesce(
|
|
501
|
-
version: _v4.z.number().default(() => _nullishCoalesce(
|
|
499
|
+
poolName: _v4.z.string().default(() => _nullishCoalesce(_chunkKDT56V3Ycjs.getRivetPool.call(void 0, ), () => ( "default"))),
|
|
500
|
+
version: _v4.z.number().default(() => _nullishCoalesce(_chunkKDT56V3Ycjs.getRivetEnvoyVersion.call(void 0, ), () => ( 1))),
|
|
502
501
|
// Deprecated.
|
|
503
|
-
totalSlots: _v4.z.number().default(() => _nullishCoalesce(
|
|
504
|
-
|
|
502
|
+
totalSlots: _v4.z.number().default(() => _nullishCoalesce(_chunkKDT56V3Ycjs.getRivetTotalSlots.call(void 0, ), () => ( 1e5))),
|
|
503
|
+
envoyKey: _v4.z.string().optional()
|
|
505
504
|
});
|
|
506
505
|
|
|
507
506
|
// src/registry/config/serverless.ts
|
|
@@ -538,7 +537,7 @@ var ServerlessConfigSchema = _v4.z.object({
|
|
|
538
537
|
*
|
|
539
538
|
* Can also be set via RIVET_PUBLIC_ENDPOINT environment variable.
|
|
540
539
|
*/
|
|
541
|
-
publicEndpoint: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => (
|
|
540
|
+
publicEndpoint: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkKDT56V3Ycjs.getRivetPublicEndpoint.call(void 0, )))),
|
|
542
541
|
/**
|
|
543
542
|
* Token that clients should use when connecting via the public endpoint.
|
|
544
543
|
*
|
|
@@ -546,7 +545,7 @@ var ServerlessConfigSchema = _v4.z.object({
|
|
|
546
545
|
*
|
|
547
546
|
* Can also be specified in the publicEndpoint URL as `https://namespace:token@host`.
|
|
548
547
|
*/
|
|
549
|
-
publicToken: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => (
|
|
548
|
+
publicToken: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkKDT56V3Ycjs.getRivetPublicToken.call(void 0, ))))
|
|
550
549
|
// There is no publicNamespace config option because the frontend and backend
|
|
551
550
|
// cannot use different namespaces. The namespace is extracted from the
|
|
552
551
|
// publicEndpoint URL auth syntax if provided.
|
|
@@ -600,7 +599,7 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
600
599
|
* Runtime binding to use for RivetKit core.
|
|
601
600
|
* */
|
|
602
601
|
runtime: RuntimeKindSchema.optional().transform((val, ctx) => {
|
|
603
|
-
const rawRuntime = _nullishCoalesce(val, () => (
|
|
602
|
+
const rawRuntime = _nullishCoalesce(val, () => ( _chunkKDT56V3Ycjs.getRivetkitRuntime.call(void 0, )));
|
|
604
603
|
if (rawRuntime === void 0) {
|
|
605
604
|
return "auto";
|
|
606
605
|
}
|
|
@@ -637,7 +636,7 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
637
636
|
* */
|
|
638
637
|
logging: _zod.z.object({
|
|
639
638
|
baseLogger: _zod.z.custom().optional(),
|
|
640
|
-
level:
|
|
639
|
+
level: _chunkKDT56V3Ycjs.LogLevelSchema.optional()
|
|
641
640
|
}).optional().default(() => ({})),
|
|
642
641
|
// MARK: Routing
|
|
643
642
|
// // This is a function to allow for lazy configuration of upgradeWebSocket on the
|
|
@@ -645,7 +644,7 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
645
644
|
// // (specifically Node.js) can sometimes only be specified after the router is
|
|
646
645
|
// // created or must be imported async using `await import(...)`
|
|
647
646
|
// getUpgradeWebSocket: z.custom<GetUpgradeWebSocket>().optional(),
|
|
648
|
-
// MARK:
|
|
647
|
+
// MARK: Runner Configuration
|
|
649
648
|
/**
|
|
650
649
|
* Endpoint to connect to for Rivet Engine.
|
|
651
650
|
*
|
|
@@ -655,9 +654,9 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
655
654
|
*
|
|
656
655
|
* Can also be set via RIVET_ENDPOINT environment variables.
|
|
657
656
|
*/
|
|
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, () => (
|
|
657
|
+
endpoint: _zod.z.string().optional().transform((val) => _nullishCoalesce(_nullishCoalesce(val, () => ( _chunkKDT56V3Ycjs.getRivetEngine.call(void 0, ))), () => ( _chunkKDT56V3Ycjs.getRivetEndpoint.call(void 0, )))),
|
|
658
|
+
token: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkKDT56V3Ycjs.getRivetToken.call(void 0, )))),
|
|
659
|
+
namespace: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkKDT56V3Ycjs.getRivetNamespace.call(void 0, )))),
|
|
661
660
|
headers: _zod.z.record(_zod.z.string(), _zod.z.string()).optional().default({}),
|
|
662
661
|
// MARK: Client
|
|
663
662
|
// TODO:
|
|
@@ -697,47 +696,47 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
697
696
|
*
|
|
698
697
|
* Starts the full Rust engine process locally.
|
|
699
698
|
*/
|
|
700
|
-
startEngine: _zod.z.boolean().default(() =>
|
|
699
|
+
startEngine: _zod.z.boolean().default(() => _chunkKDT56V3Ycjs.getRivetRunEngine.call(void 0, )),
|
|
701
700
|
/**
|
|
702
701
|
* @experimental
|
|
703
702
|
*
|
|
704
703
|
* Host to bind the spawned local engine process to.
|
|
705
704
|
*/
|
|
706
|
-
engineHost: _zod.z.string().optional().default(() => _nullishCoalesce(
|
|
705
|
+
engineHost: _zod.z.string().optional().default(() => _nullishCoalesce(_chunkKDT56V3Ycjs.getRivetRunEngineHost.call(void 0, ), () => ( _chunkDDS7OOVFcjs.ENGINE_HOST))),
|
|
707
706
|
/**
|
|
708
707
|
* @experimental
|
|
709
708
|
*
|
|
710
709
|
* Port to bind the spawned local engine process to.
|
|
711
710
|
*/
|
|
712
|
-
enginePort: _zod.z.number().int().min(1).max(65535).optional().default(() => _nullishCoalesce(
|
|
711
|
+
enginePort: _zod.z.number().int().min(1).max(65535).optional().default(() => _nullishCoalesce(_chunkKDT56V3Ycjs.getRivetRunEnginePort.call(void 0, ), () => ( _chunkDDS7OOVFcjs.ENGINE_PORT))),
|
|
713
712
|
/** @experimental */
|
|
714
|
-
engineVersion: _zod.z.string().optional().default(() => _nullishCoalesce(
|
|
713
|
+
engineVersion: _zod.z.string().optional().default(() => _nullishCoalesce(_chunkKDT56V3Ycjs.getRivetRunEngineVersion.call(void 0, ), () => ( _chunkKDT56V3Ycjs.VERSION))),
|
|
715
714
|
/**
|
|
716
715
|
* Starts the first-party Services actor host when RivetKit manages
|
|
717
|
-
* a local engine.
|
|
718
|
-
* or
|
|
716
|
+
* a local engine. Defaults to the local-engine decision. Set
|
|
717
|
+
* RIVET_RUN_SERVICES=0 or 1 to override it.
|
|
719
718
|
*/
|
|
720
719
|
startServices: _zod.z.boolean().optional(),
|
|
721
720
|
/**
|
|
722
721
|
* @experimental
|
|
723
722
|
*
|
|
724
|
-
* Automatically configure serverless
|
|
723
|
+
* Automatically configure serverless envoys in the engine.
|
|
725
724
|
*/
|
|
726
725
|
configurePool: ConfigurePoolSchema.optional(),
|
|
727
726
|
// MARK: Runtime-specific
|
|
728
727
|
serverless: ServerlessConfigSchema.optional().default(
|
|
729
728
|
() => ServerlessConfigSchema.parse({})
|
|
730
729
|
),
|
|
731
|
-
|
|
730
|
+
envoy: EnvoyConfigSchema.optional().default(
|
|
732
731
|
() => EnvoyConfigSchema.parse({})
|
|
733
732
|
),
|
|
734
733
|
// MARK: Shutdown
|
|
735
734
|
/**
|
|
736
735
|
* Graceful shutdown configuration for SIGINT/SIGTERM.
|
|
737
736
|
*
|
|
738
|
-
* When a persistent
|
|
737
|
+
* When a persistent envoy is running (Mode A, started via `registry.start()`),
|
|
739
738
|
* rivetkit installs Node SIGINT/SIGTERM handlers that call into core's
|
|
740
|
-
* `shutdown()` and wait up to `gracePeriodMs` for the
|
|
739
|
+
* `shutdown()` and wait up to `gracePeriodMs` for the envoy to drain
|
|
741
740
|
* before re-raising the signal to let Node exit via its default path.
|
|
742
741
|
*
|
|
743
742
|
* Handlers are NOT installed when `handler(request)` is used alone
|
|
@@ -749,11 +748,9 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
749
748
|
/**
|
|
750
749
|
* Wait this many milliseconds for the serve promise to resolve
|
|
751
750
|
* after calling `CoreRegistry::shutdown()`. Defaults to the
|
|
752
|
-
* engine-provided actor stop threshold once the
|
|
753
|
-
* signal-driven shutdown of a managed local development engine waits
|
|
754
|
-
* one second by default so a file watcher can restart promptly.
|
|
751
|
+
* engine-provided actor stop threshold once the envoy connects.
|
|
755
752
|
*
|
|
756
|
-
*
|
|
753
|
+
* Must be long enough for rivetkit-core to drain the envoy.
|
|
757
754
|
*/
|
|
758
755
|
gracePeriodMs: _zod.z.number().int().min(1e3).optional(),
|
|
759
756
|
/**
|
|
@@ -767,7 +764,7 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
767
764
|
}))
|
|
768
765
|
}).transform((config, ctx) => {
|
|
769
766
|
var _a, _b, _c;
|
|
770
|
-
const isDevEnv =
|
|
767
|
+
const isDevEnv = _chunkKDT56V3Ycjs.isDev.call(void 0, );
|
|
771
768
|
const sqliteBackend = _nullishCoalesce(((_a = config.sqlite) == null ? void 0 : _a.backend), () => ( ((_b = config.test) == null ? void 0 : _b.sqliteBackend)));
|
|
772
769
|
if (config.runtime === "wasm" && sqliteBackend === "local") {
|
|
773
770
|
ctx.addIssue({
|
|
@@ -777,7 +774,7 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
777
774
|
});
|
|
778
775
|
}
|
|
779
776
|
const sqlite = config.runtime === "wasm" && config.sqlite === void 0 ? { backend: "remote" } : config.sqlite;
|
|
780
|
-
const parsedEndpoint = config.endpoint ?
|
|
777
|
+
const parsedEndpoint = config.endpoint ? _chunkDDS7OOVFcjs.tryParseEndpoint.call(void 0, ctx, {
|
|
781
778
|
endpoint: config.endpoint,
|
|
782
779
|
path: ["endpoint"],
|
|
783
780
|
namespace: config.namespace,
|
|
@@ -789,25 +786,24 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
789
786
|
message: "cannot specify both startEngine and endpoint"
|
|
790
787
|
});
|
|
791
788
|
}
|
|
792
|
-
if (config.configurePool) {
|
|
789
|
+
if (config.configurePool && !parsedEndpoint && !config.startEngine) {
|
|
793
790
|
ctx.addIssue({
|
|
794
791
|
code: "custom",
|
|
795
|
-
message: "
|
|
796
|
-
path: ["configurePool"]
|
|
792
|
+
message: "configurePool requires either endpoint or startEngine"
|
|
797
793
|
});
|
|
798
794
|
}
|
|
799
|
-
const localEngineEndpoint =
|
|
795
|
+
const localEngineEndpoint = _chunkDDS7OOVFcjs.buildEngineEndpoint.call(void 0,
|
|
800
796
|
config.engineHost,
|
|
801
797
|
config.enginePort
|
|
802
798
|
);
|
|
803
799
|
const endpoint = config.startEngine ? localEngineEndpoint : _nullishCoalesce((parsedEndpoint == null ? void 0 : parsedEndpoint.endpoint), () => ( (isDevEnv ? localEngineEndpoint : void 0)));
|
|
804
|
-
const startServices = _nullishCoalesce(config.startServices, () => (
|
|
800
|
+
const startServices = _nullishCoalesce(_nullishCoalesce(config.startServices, () => ( _chunkKDT56V3Ycjs.getRivetRunServices.call(void 0, ))), () => ( Boolean(endpoint && _chunkDDS7OOVFcjs.isLocalEngineEndpoint.call(void 0, endpoint))));
|
|
805
801
|
const validateServerlessEndpoint = Boolean(
|
|
806
802
|
config.startEngine || parsedEndpoint
|
|
807
803
|
);
|
|
808
804
|
const namespace = _nullishCoalesce(_nullishCoalesce((parsedEndpoint == null ? void 0 : parsedEndpoint.namespace), () => ( config.namespace)), () => ( "default"));
|
|
809
|
-
const token = _nullishCoalesce(_nullishCoalesce((parsedEndpoint == null ? void 0 : parsedEndpoint.token), () => ( config.token)), () => ( (endpoint &&
|
|
810
|
-
const parsedPublicEndpoint = config.serverless.publicEndpoint ?
|
|
805
|
+
const token = _nullishCoalesce(_nullishCoalesce((parsedEndpoint == null ? void 0 : parsedEndpoint.token), () => ( config.token)), () => ( (endpoint && _chunkDDS7OOVFcjs.isLocalEngineEndpoint.call(void 0, endpoint) ? "default" : void 0)));
|
|
806
|
+
const parsedPublicEndpoint = config.serverless.publicEndpoint ? _chunkDDS7OOVFcjs.tryParseEndpoint.call(void 0, ctx, {
|
|
811
807
|
endpoint: config.serverless.publicEndpoint,
|
|
812
808
|
path: ["serverless", "publicEndpoint"]
|
|
813
809
|
}) : void 0;
|
|
@@ -825,7 +821,6 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
825
821
|
...config,
|
|
826
822
|
sqlite,
|
|
827
823
|
endpoint,
|
|
828
|
-
engineSpawn: !parsedEndpoint && Boolean(endpoint),
|
|
829
824
|
startServices,
|
|
830
825
|
namespace,
|
|
831
826
|
token,
|
|
@@ -855,8 +850,8 @@ function buildActorNames(config) {
|
|
|
855
850
|
);
|
|
856
851
|
}
|
|
857
852
|
var DocConfigurePoolSchema = _zod.z.object({
|
|
858
|
-
name: _zod.z.string().optional().describe("Name of the
|
|
859
|
-
url: _zod.z.string().describe("URL of the serverless platform to configure
|
|
853
|
+
name: _zod.z.string().optional().describe("Name of the runner pool."),
|
|
854
|
+
url: _zod.z.string().describe("URL of the serverless platform to configure runners."),
|
|
860
855
|
headers: _zod.z.record(_zod.z.string(), _zod.z.string()).optional().describe(
|
|
861
856
|
"Headers to include in requests to the serverless platform."
|
|
862
857
|
),
|
|
@@ -871,7 +866,7 @@ var DocConfigurePoolSchema = _zod.z.object({
|
|
|
871
866
|
"Interval in milliseconds between metadata polls from the engine. Defaults to 10000 milliseconds (10 seconds)."
|
|
872
867
|
),
|
|
873
868
|
drainOnVersionUpgrade: _zod.z.boolean().optional().describe(
|
|
874
|
-
"Drain
|
|
869
|
+
"Drain runners when a new version is deployed. Defaults to true."
|
|
875
870
|
)
|
|
876
871
|
}).optional();
|
|
877
872
|
var DocServerlessConfigSchema = _zod.z.object({
|
|
@@ -890,10 +885,10 @@ var DocServerlessConfigSchema = _zod.z.object({
|
|
|
890
885
|
}).describe("Configuration for serverless deployment mode.");
|
|
891
886
|
var DocEnvoyConfigSchema = _zod.z.object({
|
|
892
887
|
totalSlots: _zod.z.number().optional().describe("Total number of actor slots available. Default: 100000"),
|
|
893
|
-
poolName: _zod.z.string().optional().describe("Name of this
|
|
894
|
-
|
|
895
|
-
version: _zod.z.number().optional().describe("Version number of this
|
|
896
|
-
}).describe("Configuration for
|
|
888
|
+
poolName: _zod.z.string().optional().describe("Name of this envoy pool. Default: 'default'"),
|
|
889
|
+
envoyKey: _zod.z.string().optional().describe("Deprecated. Authentication key for the envoy."),
|
|
890
|
+
version: _zod.z.number().optional().describe("Version number of this envoy. Default: 1")
|
|
891
|
+
}).describe("Configuration for envoy mode.");
|
|
897
892
|
var DocSqliteConfigSchema = _zod.z.object({
|
|
898
893
|
backend: SqliteBackendSchema.optional().describe(
|
|
899
894
|
"SQLite backend to use. Native defaults to local. Wasm defaults to remote and cannot use local."
|
|
@@ -912,7 +907,7 @@ var DocRegistryConfigSchema = _zod.z.object({
|
|
|
912
907
|
noWelcome: _zod.z.boolean().optional().describe("Disable the welcome message on startup. Default: false"),
|
|
913
908
|
sqlite: DocSqliteConfigSchema,
|
|
914
909
|
logging: _zod.z.object({
|
|
915
|
-
level:
|
|
910
|
+
level: _chunkKDT56V3Ycjs.LogLevelSchema.optional().describe(
|
|
916
911
|
"Log level for RivetKit. Default: 'warn'"
|
|
917
912
|
)
|
|
918
913
|
}).optional().describe("Logging configuration."),
|
|
@@ -941,23 +936,19 @@ var DocRegistryConfigSchema = _zod.z.object({
|
|
|
941
936
|
"Version of the local engine package to use. Defaults to the current RivetKit version."
|
|
942
937
|
),
|
|
943
938
|
startServices: _zod.z.boolean().optional().describe(
|
|
944
|
-
"Starts Services when RivetKit manages a local Engine.
|
|
939
|
+
"Starts Services when RivetKit manages a local Engine. Defaults to the local-Engine decision. Set RIVET_RUN_SERVICES=0 or 1 to override."
|
|
945
940
|
),
|
|
946
941
|
configurePool: DocConfigurePoolSchema.describe(
|
|
947
|
-
"Automatically configure serverless
|
|
942
|
+
"Automatically configure serverless runners in the engine."
|
|
948
943
|
),
|
|
949
944
|
serverless: DocServerlessConfigSchema.optional(),
|
|
950
|
-
|
|
945
|
+
envoy: DocEnvoyConfigSchema.optional()
|
|
951
946
|
}).describe("RivetKit registry configuration.");
|
|
952
947
|
|
|
953
948
|
// src/registry/native.ts
|
|
954
949
|
|
|
955
950
|
|
|
956
951
|
// src/common/database/native-database.ts
|
|
957
|
-
function isSynchronousTransaction(transaction) {
|
|
958
|
-
const candidate = transaction;
|
|
959
|
-
return typeof candidate.commitSync === "function" && typeof candidate.rollbackSync === "function";
|
|
960
|
-
}
|
|
961
952
|
function shouldAttachNativeKvError(message) {
|
|
962
953
|
return /i\/o error|unable to open database file/i.test(message);
|
|
963
954
|
}
|
|
@@ -978,16 +969,13 @@ function toNativeBinding(arg) {
|
|
|
978
969
|
if (arg === null || arg === void 0) {
|
|
979
970
|
return { kind: "null" };
|
|
980
971
|
}
|
|
981
|
-
if (typeof arg === "bigint"
|
|
982
|
-
|
|
983
|
-
if (!Number.isSafeInteger(value)) {
|
|
984
|
-
throw new RangeError(
|
|
985
|
-
"SQLite integer bindings must be within the JavaScript safe integer range."
|
|
986
|
-
);
|
|
987
|
-
}
|
|
988
|
-
return { kind: "int", intValue: value };
|
|
972
|
+
if (typeof arg === "bigint") {
|
|
973
|
+
return { kind: "int", intValue: Number(arg) };
|
|
989
974
|
}
|
|
990
975
|
if (typeof arg === "number") {
|
|
976
|
+
if (Number.isInteger(arg)) {
|
|
977
|
+
return { kind: "int", intValue: arg };
|
|
978
|
+
}
|
|
991
979
|
return { kind: "float", floatValue: arg };
|
|
992
980
|
}
|
|
993
981
|
if (typeof arg === "string") {
|
|
@@ -1004,10 +992,9 @@ function toNativeBinding(arg) {
|
|
|
1004
992
|
function extractNamedSqliteParameters(sql) {
|
|
1005
993
|
const orderedNames = [];
|
|
1006
994
|
const seen = /* @__PURE__ */ new Set();
|
|
1007
|
-
const pattern = /
|
|
995
|
+
const pattern = /([:@$][A-Za-z_][A-Za-z0-9_]*)/g;
|
|
1008
996
|
for (const match of sql.matchAll(pattern)) {
|
|
1009
997
|
const name = match[1];
|
|
1010
|
-
if (!name) continue;
|
|
1011
998
|
if (seen.has(name)) {
|
|
1012
999
|
continue;
|
|
1013
1000
|
}
|
|
@@ -1118,52 +1105,28 @@ var NativeCloseGate = class {
|
|
|
1118
1105
|
if (this.#active > 0) {
|
|
1119
1106
|
await new Promise((resolve) => this.#waiters.push(resolve));
|
|
1120
1107
|
}
|
|
1121
|
-
await
|
|
1108
|
+
await callback();
|
|
1122
1109
|
}
|
|
1123
1110
|
};
|
|
1124
1111
|
function wrapJsNativeDatabase(database) {
|
|
1125
1112
|
const gate = new NativeCloseGate();
|
|
1126
|
-
let
|
|
1113
|
+
let closePromise;
|
|
1127
1114
|
let lastInsertRowId = null;
|
|
1128
1115
|
const executeNative = async (sql, params) => {
|
|
1129
|
-
const
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
lastInsertRowId
|
|
1138
|
-
};
|
|
1139
|
-
}
|
|
1140
|
-
const nativeParams = toNativeBindings(sql, params);
|
|
1141
|
-
const result = await database.execute(sql, nativeParams);
|
|
1142
|
-
if (result.lastInsertRowId != null) {
|
|
1143
|
-
lastInsertRowId = result.lastInsertRowId;
|
|
1144
|
-
}
|
|
1145
|
-
return result;
|
|
1146
|
-
} catch (error) {
|
|
1147
|
-
enrichNativeDatabaseError(database, error);
|
|
1148
|
-
} finally {
|
|
1149
|
-
release();
|
|
1116
|
+
const lastInsertRowIdColumn = lastInsertRowIdColumnName(sql);
|
|
1117
|
+
if (lastInsertRowIdColumn) {
|
|
1118
|
+
return {
|
|
1119
|
+
columns: [lastInsertRowIdColumn],
|
|
1120
|
+
rows: [[_nullishCoalesce(lastInsertRowId, () => ( 0))]],
|
|
1121
|
+
changes: 0,
|
|
1122
|
+
lastInsertRowId
|
|
1123
|
+
};
|
|
1150
1124
|
}
|
|
1151
|
-
};
|
|
1152
|
-
const executeNativeSync = (sql, params) => {
|
|
1153
1125
|
const release = gate.enter();
|
|
1154
1126
|
try {
|
|
1155
1127
|
const nativeParams = toNativeBindings(sql, params);
|
|
1156
|
-
const result = database.
|
|
1157
|
-
|
|
1158
|
-
if (rowIdColumn) {
|
|
1159
|
-
return {
|
|
1160
|
-
columns: [rowIdColumn],
|
|
1161
|
-
rows: [[_nullishCoalesce(lastInsertRowId, () => ( 0))]],
|
|
1162
|
-
changes: 0,
|
|
1163
|
-
lastInsertRowId
|
|
1164
|
-
};
|
|
1165
|
-
}
|
|
1166
|
-
if (result.lastInsertRowId != null) {
|
|
1128
|
+
const result = await database.execute(sql, nativeParams);
|
|
1129
|
+
if (result.lastInsertRowId !== void 0) {
|
|
1167
1130
|
lastInsertRowId = result.lastInsertRowId;
|
|
1168
1131
|
}
|
|
1169
1132
|
return result;
|
|
@@ -1191,28 +1154,9 @@ function wrapJsNativeDatabase(database) {
|
|
|
1191
1154
|
callback(row, result.columns);
|
|
1192
1155
|
}
|
|
1193
1156
|
},
|
|
1194
|
-
execSync(sql, callback) {
|
|
1195
|
-
const release = gate.enter();
|
|
1196
|
-
let result;
|
|
1197
|
-
try {
|
|
1198
|
-
result = database.execSync(sql);
|
|
1199
|
-
} catch (error) {
|
|
1200
|
-
enrichNativeDatabaseError(database, error);
|
|
1201
|
-
} finally {
|
|
1202
|
-
release();
|
|
1203
|
-
}
|
|
1204
|
-
if (callback) {
|
|
1205
|
-
for (const row of result.rows) {
|
|
1206
|
-
callback(row, result.columns);
|
|
1207
|
-
}
|
|
1208
|
-
}
|
|
1209
|
-
},
|
|
1210
1157
|
async execute(sql, params) {
|
|
1211
1158
|
return await executeNative(sql, params);
|
|
1212
1159
|
},
|
|
1213
|
-
executeSync(sql, params) {
|
|
1214
|
-
return executeNativeSync(sql, params);
|
|
1215
|
-
},
|
|
1216
1160
|
async executeBatch(statements) {
|
|
1217
1161
|
const nativeStatements = statements.map(toNativeBatchStatement);
|
|
1218
1162
|
const release = gate.enter();
|
|
@@ -1234,7 +1178,7 @@ function wrapJsNativeDatabase(database) {
|
|
|
1234
1178
|
return transactionResults;
|
|
1235
1179
|
})();
|
|
1236
1180
|
for (const result of results) {
|
|
1237
|
-
if (result.lastInsertRowId
|
|
1181
|
+
if (result.lastInsertRowId !== void 0) {
|
|
1238
1182
|
lastInsertRowId = result.lastInsertRowId;
|
|
1239
1183
|
}
|
|
1240
1184
|
}
|
|
@@ -1262,23 +1206,7 @@ function wrapJsNativeDatabase(database) {
|
|
|
1262
1206
|
release();
|
|
1263
1207
|
}
|
|
1264
1208
|
return wrapTransaction(database, transaction, gate, (result) => {
|
|
1265
|
-
if (result.lastInsertRowId
|
|
1266
|
-
lastInsertRowId = result.lastInsertRowId;
|
|
1267
|
-
}
|
|
1268
|
-
});
|
|
1269
|
-
},
|
|
1270
|
-
beginTransactionSync(timeoutMs, name) {
|
|
1271
|
-
const release = gate.enter();
|
|
1272
|
-
let transaction;
|
|
1273
|
-
try {
|
|
1274
|
-
transaction = database.beginTransactionSync(timeoutMs, name);
|
|
1275
|
-
} catch (error) {
|
|
1276
|
-
enrichNativeDatabaseError(database, error);
|
|
1277
|
-
} finally {
|
|
1278
|
-
release();
|
|
1279
|
-
}
|
|
1280
|
-
return wrapTransaction(database, transaction, gate, (result) => {
|
|
1281
|
-
if (result.lastInsertRowId != null) {
|
|
1209
|
+
if (result.lastInsertRowId !== void 0) {
|
|
1282
1210
|
lastInsertRowId = result.lastInsertRowId;
|
|
1283
1211
|
}
|
|
1284
1212
|
});
|
|
@@ -1300,7 +1228,7 @@ function wrapJsNativeDatabase(database) {
|
|
|
1300
1228
|
release();
|
|
1301
1229
|
}
|
|
1302
1230
|
return wrapTransaction(database, transaction, gate, (result) => {
|
|
1303
|
-
if (result.lastInsertRowId
|
|
1231
|
+
if (result.lastInsertRowId !== void 0) {
|
|
1304
1232
|
lastInsertRowId = result.lastInsertRowId;
|
|
1305
1233
|
}
|
|
1306
1234
|
});
|
|
@@ -1316,37 +1244,14 @@ function wrapJsNativeDatabase(database) {
|
|
|
1316
1244
|
var _a;
|
|
1317
1245
|
return normalizeNativeMetrics((_a = database.metrics) == null ? void 0 : _a.call(database));
|
|
1318
1246
|
},
|
|
1319
|
-
async open() {
|
|
1320
|
-
const release = gate.enter();
|
|
1321
|
-
try {
|
|
1322
|
-
await database.open();
|
|
1323
|
-
} catch (error) {
|
|
1324
|
-
enrichNativeDatabaseError(database, error);
|
|
1325
|
-
} finally {
|
|
1326
|
-
release();
|
|
1327
|
-
}
|
|
1328
|
-
},
|
|
1329
|
-
commitTicket() {
|
|
1330
|
-
return database.commitTicket();
|
|
1331
|
-
},
|
|
1332
|
-
async whenDurable(ticket) {
|
|
1333
|
-
await database.whenDurable(ticket);
|
|
1334
|
-
},
|
|
1335
|
-
abortGeneration(reason) {
|
|
1336
|
-
database.abortGeneration(reason);
|
|
1337
|
-
},
|
|
1338
1247
|
async close() {
|
|
1339
|
-
|
|
1340
|
-
await
|
|
1341
|
-
},
|
|
1342
|
-
async detachForShutdown() {
|
|
1343
|
-
terminalPromise ??= gate.close();
|
|
1344
|
-
await terminalPromise;
|
|
1248
|
+
closePromise ??= gate.close(() => database.close());
|
|
1249
|
+
await closePromise;
|
|
1345
1250
|
}
|
|
1346
1251
|
};
|
|
1347
1252
|
}
|
|
1348
1253
|
function wrapTransaction(database, transaction, gate, onExecute) {
|
|
1349
|
-
|
|
1254
|
+
return {
|
|
1350
1255
|
async exec(sql, callback) {
|
|
1351
1256
|
const release = gate.enter();
|
|
1352
1257
|
let result;
|
|
@@ -1397,61 +1302,6 @@ function wrapTransaction(database, transaction, gate, onExecute) {
|
|
|
1397
1302
|
}
|
|
1398
1303
|
}
|
|
1399
1304
|
};
|
|
1400
|
-
if (isSynchronousTransaction(transaction)) {
|
|
1401
|
-
return Object.assign(wrapped, {
|
|
1402
|
-
execSync(sql, callback) {
|
|
1403
|
-
const release = gate.enter();
|
|
1404
|
-
let result;
|
|
1405
|
-
try {
|
|
1406
|
-
result = transaction.execSync(sql);
|
|
1407
|
-
} catch (error) {
|
|
1408
|
-
enrichNativeDatabaseError(database, error);
|
|
1409
|
-
} finally {
|
|
1410
|
-
release();
|
|
1411
|
-
}
|
|
1412
|
-
if (callback) {
|
|
1413
|
-
for (const row of result.rows)
|
|
1414
|
-
callback(row, result.columns);
|
|
1415
|
-
}
|
|
1416
|
-
},
|
|
1417
|
-
executeSync(sql, params) {
|
|
1418
|
-
const release = gate.enter();
|
|
1419
|
-
try {
|
|
1420
|
-
const result = transaction.executeSync(
|
|
1421
|
-
sql,
|
|
1422
|
-
toNativeBindings(sql, params)
|
|
1423
|
-
);
|
|
1424
|
-
onExecute(result);
|
|
1425
|
-
return result;
|
|
1426
|
-
} catch (error) {
|
|
1427
|
-
enrichNativeDatabaseError(database, error);
|
|
1428
|
-
} finally {
|
|
1429
|
-
release();
|
|
1430
|
-
}
|
|
1431
|
-
},
|
|
1432
|
-
commitSync() {
|
|
1433
|
-
const release = gate.enter();
|
|
1434
|
-
try {
|
|
1435
|
-
transaction.commitSync();
|
|
1436
|
-
} catch (error) {
|
|
1437
|
-
enrichNativeDatabaseError(database, error);
|
|
1438
|
-
} finally {
|
|
1439
|
-
release();
|
|
1440
|
-
}
|
|
1441
|
-
},
|
|
1442
|
-
rollbackSync() {
|
|
1443
|
-
const release = gate.enter();
|
|
1444
|
-
try {
|
|
1445
|
-
transaction.rollbackSync();
|
|
1446
|
-
} catch (error) {
|
|
1447
|
-
enrichNativeDatabaseError(database, error);
|
|
1448
|
-
} finally {
|
|
1449
|
-
release();
|
|
1450
|
-
}
|
|
1451
|
-
}
|
|
1452
|
-
});
|
|
1453
|
-
}
|
|
1454
|
-
return wrapped;
|
|
1455
1305
|
}
|
|
1456
1306
|
function lastInsertRowIdColumnName(sql) {
|
|
1457
1307
|
const match = sql.match(
|
|
@@ -1542,12 +1392,6 @@ function getNodePath() {
|
|
|
1542
1392
|
function normalizeRuntimeSqlExecuteResult(result) {
|
|
1543
1393
|
return result;
|
|
1544
1394
|
}
|
|
1545
|
-
function servicesBinaryUnavailable(cause) {
|
|
1546
|
-
return new Error(
|
|
1547
|
-
"services.binary_unavailable: Install @rivet-dev/services yourself to run local Services, or set RIVET_SERVICES_BINARY to its executable path.",
|
|
1548
|
-
{ cause }
|
|
1549
|
-
);
|
|
1550
|
-
}
|
|
1551
1395
|
|
|
1552
1396
|
// src/registry/napi-runtime.ts
|
|
1553
1397
|
function asNativeRegistry(handle) {
|
|
@@ -1693,7 +1537,7 @@ var NapiCoreRuntime = (_class = class {
|
|
|
1693
1537
|
if (!(active == null ? void 0 : active.sameActorInstance(ownerCtx))) {
|
|
1694
1538
|
return ownerCtx;
|
|
1695
1539
|
}
|
|
1696
|
-
const applicationSpan =
|
|
1540
|
+
const applicationSpan = _chunkDDS7OOVFcjs.readActiveTraceHeaders.call(void 0, );
|
|
1697
1541
|
if (!applicationSpan) {
|
|
1698
1542
|
return active;
|
|
1699
1543
|
}
|
|
@@ -1820,8 +1664,7 @@ var NapiCoreRuntime = (_class = class {
|
|
|
1820
1664
|
asNativeCancellationToken(token).cancel();
|
|
1821
1665
|
}
|
|
1822
1666
|
onCancellationTokenCancelled(token, callback) {
|
|
1823
|
-
|
|
1824
|
-
return () => listener.release();
|
|
1667
|
+
asNativeCancellationToken(token).onCancelled(callback);
|
|
1825
1668
|
}
|
|
1826
1669
|
actorState(ctx) {
|
|
1827
1670
|
return asNativeActorContext(ctx).state();
|
|
@@ -1897,7 +1740,7 @@ var NapiCoreRuntime = (_class = class {
|
|
|
1897
1740
|
const span = (_a = nativeCtx.invocationTraceContext()) == null ? void 0 : _a.span;
|
|
1898
1741
|
return this.#invocationContext.run(
|
|
1899
1742
|
nativeCtx,
|
|
1900
|
-
() =>
|
|
1743
|
+
() => _chunkDDS7OOVFcjs.runWithActorInvocationSpan.call(void 0, span, run)
|
|
1901
1744
|
);
|
|
1902
1745
|
}
|
|
1903
1746
|
actorInvocationTraceContext(ctx) {
|
|
@@ -2036,9 +1879,6 @@ var NapiCoreRuntime = (_class = class {
|
|
|
2036
1879
|
async actorSqlExec(ctx, sql) {
|
|
2037
1880
|
return await this.#actorSql(ctx).exec(sql);
|
|
2038
1881
|
}
|
|
2039
|
-
actorSqlExecSync(ctx, sql) {
|
|
2040
|
-
return this.#actorSql(ctx).execSync(sql);
|
|
2041
|
-
}
|
|
2042
1882
|
async actorSqlExecute(ctx, sql, params) {
|
|
2043
1883
|
const result = await this.#actorSql(ctx).execute(
|
|
2044
1884
|
sql,
|
|
@@ -2046,13 +1886,6 @@ var NapiCoreRuntime = (_class = class {
|
|
|
2046
1886
|
);
|
|
2047
1887
|
return normalizeRuntimeSqlExecuteResult(result);
|
|
2048
1888
|
}
|
|
2049
|
-
actorSqlExecuteSync(ctx, sql, params) {
|
|
2050
|
-
const result = this.#actorSql(ctx).executeSync(
|
|
2051
|
-
sql,
|
|
2052
|
-
toNapiSqlBindParams(params)
|
|
2053
|
-
);
|
|
2054
|
-
return normalizeRuntimeSqlExecuteResult(result);
|
|
2055
|
-
}
|
|
2056
1889
|
async actorSqlExecuteBatch(ctx, statements) {
|
|
2057
1890
|
const results = await this.#actorSql(ctx).executeBatch(
|
|
2058
1891
|
statements.map(toNapiSqlBatchStatement)
|
|
@@ -2065,18 +1898,9 @@ var NapiCoreRuntime = (_class = class {
|
|
|
2065
1898
|
name
|
|
2066
1899
|
);
|
|
2067
1900
|
}
|
|
2068
|
-
actorSqlBeginTransactionSync(ctx, timeoutMs, name) {
|
|
2069
|
-
return this.#actorSql(ctx).beginTransactionSync(
|
|
2070
|
-
timeoutMs,
|
|
2071
|
-
name
|
|
2072
|
-
);
|
|
2073
|
-
}
|
|
2074
1901
|
async actorSqlTransactionExec(transaction, sql) {
|
|
2075
1902
|
return await asNativeSqlTransaction(transaction).exec(sql);
|
|
2076
1903
|
}
|
|
2077
|
-
actorSqlTransactionExecSync(transaction, sql) {
|
|
2078
|
-
return asNativeSqlTransaction(transaction).execSync(sql);
|
|
2079
|
-
}
|
|
2080
1904
|
async actorSqlTransactionExecute(transaction, sql, params) {
|
|
2081
1905
|
const result = await asNativeSqlTransaction(transaction).execute(
|
|
2082
1906
|
sql,
|
|
@@ -2084,25 +1908,12 @@ var NapiCoreRuntime = (_class = class {
|
|
|
2084
1908
|
);
|
|
2085
1909
|
return normalizeRuntimeSqlExecuteResult(result);
|
|
2086
1910
|
}
|
|
2087
|
-
actorSqlTransactionExecuteSync(transaction, sql, params) {
|
|
2088
|
-
const result = asNativeSqlTransaction(transaction).executeSync(
|
|
2089
|
-
sql,
|
|
2090
|
-
toNapiSqlBindParams(params)
|
|
2091
|
-
);
|
|
2092
|
-
return normalizeRuntimeSqlExecuteResult(result);
|
|
2093
|
-
}
|
|
2094
1911
|
async actorSqlTransactionCommit(transaction) {
|
|
2095
1912
|
await asNativeSqlTransaction(transaction).commit();
|
|
2096
1913
|
}
|
|
2097
|
-
actorSqlTransactionCommitSync(transaction) {
|
|
2098
|
-
asNativeSqlTransaction(transaction).commitSync();
|
|
2099
|
-
}
|
|
2100
1914
|
async actorSqlTransactionRollback(transaction) {
|
|
2101
1915
|
await asNativeSqlTransaction(transaction).rollback();
|
|
2102
1916
|
}
|
|
2103
|
-
actorSqlTransactionRollbackSync(transaction) {
|
|
2104
|
-
asNativeSqlTransaction(transaction).rollbackSync();
|
|
2105
|
-
}
|
|
2106
1917
|
async actorBeginStateTransaction(ctx, timeoutMs) {
|
|
2107
1918
|
return await this.#actorContextForOperation(ctx).beginStateTransaction(
|
|
2108
1919
|
timeoutMs
|
|
@@ -2140,18 +1951,6 @@ var NapiCoreRuntime = (_class = class {
|
|
|
2140
1951
|
var _a, _b;
|
|
2141
1952
|
return _nullishCoalesce(((_b = (_a = this.#actorSql(ctx)).takeLastKvError) == null ? void 0 : _b.call(_a)), () => ( null));
|
|
2142
1953
|
}
|
|
2143
|
-
async actorSqlOpen(ctx) {
|
|
2144
|
-
await this.#actorSql(ctx).open();
|
|
2145
|
-
}
|
|
2146
|
-
actorSqlCommitTicket(ctx) {
|
|
2147
|
-
return this.#actorSql(ctx).commitTicket();
|
|
2148
|
-
}
|
|
2149
|
-
actorSqlAbortGeneration(ctx, reason) {
|
|
2150
|
-
this.#actorSql(ctx).abortGeneration(reason);
|
|
2151
|
-
}
|
|
2152
|
-
async actorSqlWhenDurable(ctx, ticket) {
|
|
2153
|
-
await this.#actorSql(ctx).whenDurable(ticket);
|
|
2154
|
-
}
|
|
2155
1954
|
async actorSqlClose(ctx) {
|
|
2156
1955
|
const nativeCtx = asNativeActorContext(ctx);
|
|
2157
1956
|
if (!this.#sqlOpened.delete(nativeCtx)) {
|
|
@@ -2316,8 +2115,8 @@ function runtimeBytesToArrayBuffer(value) {
|
|
|
2316
2115
|
function buildNativeHttpRequest(init) {
|
|
2317
2116
|
var _a;
|
|
2318
2117
|
const headers = new Headers(init.headers);
|
|
2319
|
-
const originalUrl = headers.get(
|
|
2320
|
-
headers.delete(
|
|
2118
|
+
const originalUrl = headers.get(_chunkDDS7OOVFcjs.HEADER_ORIGINAL_REQUEST_URL);
|
|
2119
|
+
headers.delete(_chunkDDS7OOVFcjs.HEADER_ORIGINAL_REQUEST_URL);
|
|
2321
2120
|
const url = _nullishCoalesce(originalUrl, () => ( (init.uri.startsWith("http") ? init.uri : new URL(init.uri, "http://127.0.0.1").toString())));
|
|
2322
2121
|
const method2 = init.method.toUpperCase();
|
|
2323
2122
|
const bodyForbidden = method2 === "GET" || method2 === "HEAD";
|
|
@@ -2396,7 +2195,7 @@ async function pumpResponseBody(reader, stream) {
|
|
|
2396
2195
|
}
|
|
2397
2196
|
} catch (error) {
|
|
2398
2197
|
try {
|
|
2399
|
-
await stream.error(
|
|
2198
|
+
await stream.error(_chunkKDT56V3Ycjs.stringifyError.call(void 0, error));
|
|
2400
2199
|
} catch (streamError) {
|
|
2401
2200
|
logger2().debug({
|
|
2402
2201
|
msg: "failed to report native http response stream error",
|
|
@@ -2735,17 +2534,6 @@ function optionalWasmNumber(value) {
|
|
|
2735
2534
|
function wasmNumber(value) {
|
|
2736
2535
|
return typeof value === "bigint" ? Number(value) : value;
|
|
2737
2536
|
}
|
|
2738
|
-
function synchronousSqliteUnavailable() {
|
|
2739
|
-
throw new (0, _chunkMGI2VVF6cjs.RivetError)(
|
|
2740
|
-
"sqlite",
|
|
2741
|
-
"sync_unsupported",
|
|
2742
|
-
"Synchronous SQLite is unavailable because the actor runs on the wasm runtime.",
|
|
2743
|
-
{
|
|
2744
|
-
public: true,
|
|
2745
|
-
metadata: { runtime: "wasm" }
|
|
2746
|
-
}
|
|
2747
|
-
);
|
|
2748
|
-
}
|
|
2749
2537
|
function normalizeKvEntry(entry) {
|
|
2750
2538
|
return {
|
|
2751
2539
|
key: toBytes(entry.key),
|
|
@@ -2897,14 +2685,6 @@ var WasmCoreRuntime = (_class2 = class {
|
|
|
2897
2685
|
);
|
|
2898
2686
|
}
|
|
2899
2687
|
createActorFactory(callbacks, config) {
|
|
2900
|
-
if (config == null ? void 0 : config.sqliteDeferredCommits) {
|
|
2901
|
-
throw new (0, _chunkMGI2VVF6cjs.RivetError)(
|
|
2902
|
-
"sqlite",
|
|
2903
|
-
"deferred_commits_unsupported",
|
|
2904
|
-
"SQLite deferred commits require local native SQLite, but the wasm runtime uses remote SQLite.",
|
|
2905
|
-
{ metadata: { runtime: "wasm" } }
|
|
2906
|
-
);
|
|
2907
|
-
}
|
|
2908
2688
|
return callWasmSync(
|
|
2909
2689
|
() => asActorFactoryHandle2(
|
|
2910
2690
|
new this.#constructors.ActorFactory(callbacks, config)
|
|
@@ -2923,10 +2703,9 @@ var WasmCoreRuntime = (_class2 = class {
|
|
|
2923
2703
|
callWasmSync(() => asWasmCancellationToken(token).cancel());
|
|
2924
2704
|
}
|
|
2925
2705
|
onCancellationTokenCancelled(token, callback) {
|
|
2926
|
-
|
|
2706
|
+
callWasmSync(
|
|
2927
2707
|
() => asWasmCancellationToken(token).onCancelled(callback)
|
|
2928
2708
|
);
|
|
2929
|
-
return () => callWasmSync(() => listener.release());
|
|
2930
2709
|
}
|
|
2931
2710
|
actorState(ctx) {
|
|
2932
2711
|
return toBytes(
|
|
@@ -3181,18 +2960,12 @@ var WasmCoreRuntime = (_class2 = class {
|
|
|
3181
2960
|
async actorSqlExec(ctx, sql) {
|
|
3182
2961
|
return await callWasm(() => this.#actorSql(ctx).exec(sql));
|
|
3183
2962
|
}
|
|
3184
|
-
actorSqlExecSync(_ctx, _sql) {
|
|
3185
|
-
return synchronousSqliteUnavailable();
|
|
3186
|
-
}
|
|
3187
2963
|
async actorSqlExecute(ctx, sql, params) {
|
|
3188
2964
|
const result = await callWasm(
|
|
3189
2965
|
() => this.#actorSql(ctx).execute(sql, params)
|
|
3190
2966
|
);
|
|
3191
2967
|
return normalizeRuntimeSqlExecuteResult(result);
|
|
3192
2968
|
}
|
|
3193
|
-
actorSqlExecuteSync(_ctx, _sql, _params) {
|
|
3194
|
-
return synchronousSqliteUnavailable();
|
|
3195
|
-
}
|
|
3196
2969
|
async actorSqlExecuteBatch(ctx, statements) {
|
|
3197
2970
|
const results = await callWasm(
|
|
3198
2971
|
() => this.#actorSql(ctx).executeBatch(statements)
|
|
@@ -3204,42 +2977,27 @@ var WasmCoreRuntime = (_class2 = class {
|
|
|
3204
2977
|
() => this.#actorSql(ctx).beginTransaction(timeoutMs, name)
|
|
3205
2978
|
);
|
|
3206
2979
|
}
|
|
3207
|
-
actorSqlBeginTransactionSync(_ctx, _timeoutMs, _name) {
|
|
3208
|
-
return synchronousSqliteUnavailable();
|
|
3209
|
-
}
|
|
3210
2980
|
async actorSqlTransactionExec(transaction, sql) {
|
|
3211
2981
|
return await callWasm(
|
|
3212
2982
|
() => transaction.exec(sql)
|
|
3213
2983
|
);
|
|
3214
2984
|
}
|
|
3215
|
-
actorSqlTransactionExecSync(_transaction, _sql) {
|
|
3216
|
-
return synchronousSqliteUnavailable();
|
|
3217
|
-
}
|
|
3218
2985
|
async actorSqlTransactionExecute(transaction, sql, params) {
|
|
3219
2986
|
const result = await callWasm(
|
|
3220
2987
|
() => transaction.execute(sql, params)
|
|
3221
2988
|
);
|
|
3222
2989
|
return normalizeRuntimeSqlExecuteResult(result);
|
|
3223
2990
|
}
|
|
3224
|
-
actorSqlTransactionExecuteSync(_transaction, _sql, _params) {
|
|
3225
|
-
return synchronousSqliteUnavailable();
|
|
3226
|
-
}
|
|
3227
2991
|
async actorSqlTransactionCommit(transaction) {
|
|
3228
2992
|
await callWasm(
|
|
3229
2993
|
() => transaction.commit()
|
|
3230
2994
|
);
|
|
3231
2995
|
}
|
|
3232
|
-
actorSqlTransactionCommitSync(_transaction) {
|
|
3233
|
-
synchronousSqliteUnavailable();
|
|
3234
|
-
}
|
|
3235
2996
|
async actorSqlTransactionRollback(transaction) {
|
|
3236
2997
|
await callWasm(
|
|
3237
2998
|
() => transaction.rollback()
|
|
3238
2999
|
);
|
|
3239
3000
|
}
|
|
3240
|
-
actorSqlTransactionRollbackSync(_transaction) {
|
|
3241
|
-
synchronousSqliteUnavailable();
|
|
3242
|
-
}
|
|
3243
3001
|
async actorBeginStateTransaction(ctx, timeoutMs) {
|
|
3244
3002
|
return await callWasm(
|
|
3245
3003
|
() => asWasmActorContext(ctx).beginStateTransaction(timeoutMs)
|
|
@@ -3275,17 +3033,6 @@ var WasmCoreRuntime = (_class2 = class {
|
|
|
3275
3033
|
var _a, _b;
|
|
3276
3034
|
return _nullishCoalesce(((_b = (_a = this.#actorSql(ctx)).takeLastKvError) == null ? void 0 : _b.call(_a)), () => ( null));
|
|
3277
3035
|
}
|
|
3278
|
-
async actorSqlOpen(_ctx) {
|
|
3279
|
-
}
|
|
3280
|
-
actorSqlCommitTicket(_ctx) {
|
|
3281
|
-
return synchronousSqliteUnavailable();
|
|
3282
|
-
}
|
|
3283
|
-
actorSqlAbortGeneration(_ctx, _reason) {
|
|
3284
|
-
synchronousSqliteUnavailable();
|
|
3285
|
-
}
|
|
3286
|
-
async actorSqlWhenDurable(_ctx, _ticket) {
|
|
3287
|
-
synchronousSqliteUnavailable();
|
|
3288
|
-
}
|
|
3289
3036
|
async actorSqlClose(ctx) {
|
|
3290
3037
|
const wasmCtx = asWasmActorContext(ctx);
|
|
3291
3038
|
const database = this.#sql.get(wasmCtx);
|
|
@@ -3686,7 +3433,7 @@ async function loadAutoRuntime(config, loaders = defaultRuntimeLoaders) {
|
|
|
3686
3433
|
nativeError = error;
|
|
3687
3434
|
logger2().warn({
|
|
3688
3435
|
msg: "native runtime failed to load; falling back to wasm",
|
|
3689
|
-
error:
|
|
3436
|
+
error: _chunkKDT56V3Ycjs.stringifyError.call(void 0, error)
|
|
3690
3437
|
});
|
|
3691
3438
|
}
|
|
3692
3439
|
try {
|
|
@@ -3695,7 +3442,7 @@ async function loadAutoRuntime(config, loaders = defaultRuntimeLoaders) {
|
|
|
3695
3442
|
throw new (0, _chunkMGI2VVF6cjs.RivetError)(
|
|
3696
3443
|
"config",
|
|
3697
3444
|
"runtime_unavailable",
|
|
3698
|
-
`RivetKit could not load a core runtime. Native runtime: ${
|
|
3445
|
+
`RivetKit could not load a core runtime. Native runtime: ${_chunkKDT56V3Ycjs.stringifyError.call(void 0, nativeError)} Wasm runtime: ${_chunkKDT56V3Ycjs.stringifyError.call(void 0, wasmError)}`,
|
|
3699
3446
|
{
|
|
3700
3447
|
public: true,
|
|
3701
3448
|
statusCode: 500
|
|
@@ -3751,10 +3498,9 @@ function normalizeRuntimeConfig(config, runtime) {
|
|
|
3751
3498
|
return normalizeRuntimeConfigForKind(config, loadedRuntimeKind(runtime));
|
|
3752
3499
|
}
|
|
3753
3500
|
function getNativeRuntimeState(runtime, ctx) {
|
|
3754
|
-
const runtimeState =
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
}
|
|
3501
|
+
const runtimeState = callNativeSync(
|
|
3502
|
+
() => runtime.actorRuntimeState(ctx)
|
|
3503
|
+
);
|
|
3758
3504
|
if (!runtimeState.destroyGate) {
|
|
3759
3505
|
runtimeState.destroyGate = {};
|
|
3760
3506
|
}
|
|
@@ -3767,14 +3513,6 @@ function getNativeRuntimeState(runtime, ctx) {
|
|
|
3767
3513
|
}
|
|
3768
3514
|
return runtimeState;
|
|
3769
3515
|
}
|
|
3770
|
-
function readNativeRuntimeStateBag(runtime, ctx) {
|
|
3771
|
-
return callNativeSync(
|
|
3772
|
-
() => runtime.actorRuntimeState(ctx)
|
|
3773
|
-
);
|
|
3774
|
-
}
|
|
3775
|
-
function isNativeRuntimeStateCleared(runtime, ctx) {
|
|
3776
|
-
return readNativeRuntimeStateBag(runtime, ctx).cleared === true;
|
|
3777
|
-
}
|
|
3778
3516
|
function getNativePersistState(runtime, ctx) {
|
|
3779
3517
|
const persistState = getNativeRuntimeState(runtime, ctx).persistState;
|
|
3780
3518
|
if (!persistState) {
|
|
@@ -3885,43 +3623,29 @@ function resolveNativeDestroy(runtime, ctx) {
|
|
|
3885
3623
|
gate.destroyCompletion = void 0;
|
|
3886
3624
|
}
|
|
3887
3625
|
function clearNativeRuntimeState(runtime, ctx) {
|
|
3888
|
-
var _a;
|
|
3889
|
-
const pendingSaveHandle = (_a = readNativeRuntimeStateBag(runtime, ctx).persistState) == null ? void 0 : _a.pendingSaveHandle;
|
|
3890
|
-
if (pendingSaveHandle !== void 0) {
|
|
3891
|
-
clearImmediate(pendingSaveHandle);
|
|
3892
|
-
}
|
|
3893
3626
|
callNativeSync(() => runtime.actorClearRuntimeState(ctx));
|
|
3894
|
-
readNativeRuntimeStateBag(runtime, ctx).cleared = true;
|
|
3895
3627
|
}
|
|
3896
3628
|
async function cleanupNativeSleepRuntimeState(runtime, ctx, afterTrackedWorkDrained) {
|
|
3897
3629
|
const drained = await runtime.actorWaitForTrackedShutdownWork(ctx);
|
|
3898
3630
|
if (!drained) {
|
|
3899
|
-
await
|
|
3631
|
+
await closeNativeDatabaseClient(runtime, ctx);
|
|
3632
|
+
await closeNativeSqlDatabase(runtime, ctx);
|
|
3900
3633
|
void runtime.actorWaitForTrackedShutdownWorkUnbounded(ctx).then(async () => {
|
|
3901
3634
|
await (afterTrackedWorkDrained == null ? void 0 : afterTrackedWorkDrained());
|
|
3902
3635
|
clearNativeRuntimeState(runtime, ctx);
|
|
3903
3636
|
}).catch((error) => {
|
|
3904
3637
|
logger2().warn({
|
|
3905
3638
|
msg: "deferred native sleep cleanup failed",
|
|
3906
|
-
error:
|
|
3639
|
+
error: _chunkKDT56V3Ycjs.stringifyError.call(void 0, error)
|
|
3907
3640
|
});
|
|
3908
3641
|
});
|
|
3909
3642
|
return;
|
|
3910
3643
|
}
|
|
3911
3644
|
await (afterTrackedWorkDrained == null ? void 0 : afterTrackedWorkDrained());
|
|
3912
|
-
await
|
|
3645
|
+
await closeNativeDatabaseClient(runtime, ctx);
|
|
3646
|
+
await closeNativeSqlDatabase(runtime, ctx);
|
|
3913
3647
|
clearNativeRuntimeState(runtime, ctx);
|
|
3914
3648
|
}
|
|
3915
|
-
async function detachNativeDatabaseForShutdown(runtime, ctx) {
|
|
3916
|
-
var _a;
|
|
3917
|
-
const runtimeState = getNativeRuntimeState(runtime, ctx);
|
|
3918
|
-
await ((_a = runtimeState.sql) == null ? void 0 : _a.detachForShutdown());
|
|
3919
|
-
try {
|
|
3920
|
-
await closeNativeDatabaseClient(runtime, ctx);
|
|
3921
|
-
} finally {
|
|
3922
|
-
runtimeState.sql = void 0;
|
|
3923
|
-
}
|
|
3924
|
-
}
|
|
3925
3649
|
function closeNativeSqlDatabase(runtime, ctx) {
|
|
3926
3650
|
const runtimeState = getNativeRuntimeState(runtime, ctx);
|
|
3927
3651
|
const database = runtimeState.sql;
|
|
@@ -3942,29 +3666,15 @@ async function closeNativeDatabaseClient(runtime, ctx) {
|
|
|
3942
3666
|
await entry.client.close();
|
|
3943
3667
|
}
|
|
3944
3668
|
}
|
|
3945
|
-
function createNativeSqlTransaction(runtime, transaction) {
|
|
3946
|
-
return {
|
|
3947
|
-
exec: (sql) => runtime.actorSqlTransactionExec(transaction, sql),
|
|
3948
|
-
execSync: (sql) => runtime.actorSqlTransactionExecSync(transaction, sql),
|
|
3949
|
-
execute: (sql, params) => runtime.actorSqlTransactionExecute(transaction, sql, params),
|
|
3950
|
-
executeSync: (sql, params) => runtime.actorSqlTransactionExecuteSync(transaction, sql, params),
|
|
3951
|
-
commit: () => runtime.actorSqlTransactionCommit(transaction),
|
|
3952
|
-
commitSync: () => runtime.actorSqlTransactionCommitSync(transaction),
|
|
3953
|
-
rollback: () => runtime.actorSqlTransactionRollback(transaction),
|
|
3954
|
-
rollbackSync: () => runtime.actorSqlTransactionRollbackSync(transaction)
|
|
3955
|
-
};
|
|
3956
|
-
}
|
|
3957
3669
|
function getOrCreateNativeSqlDatabase(runtime, ctx) {
|
|
3958
3670
|
const runtimeState = getNativeRuntimeState(runtime, ctx);
|
|
3959
3671
|
const cachedDatabase = runtimeState.sql;
|
|
3960
3672
|
if (cachedDatabase) {
|
|
3961
3673
|
return cachedDatabase;
|
|
3962
3674
|
}
|
|
3963
|
-
const
|
|
3675
|
+
const database = wrapJsNativeDatabase({
|
|
3964
3676
|
exec: (sql) => runtime.actorSqlExec(ctx, sql),
|
|
3965
|
-
execSync: (sql) => runtime.actorSqlExecSync(ctx, sql),
|
|
3966
3677
|
execute: (sql, params) => runtime.actorSqlExecute(ctx, sql, params),
|
|
3967
|
-
executeSync: (sql, params) => runtime.actorSqlExecuteSync(ctx, sql, params),
|
|
3968
3678
|
executeBatch: (statements) => runtime.actorSqlExecuteBatch(ctx, statements),
|
|
3969
3679
|
beginTransaction: async (timeoutMs, name) => {
|
|
3970
3680
|
const transaction = await runtime.actorSqlBeginTransaction(
|
|
@@ -3972,15 +3682,16 @@ function getOrCreateNativeSqlDatabase(runtime, ctx) {
|
|
|
3972
3682
|
timeoutMs,
|
|
3973
3683
|
name
|
|
3974
3684
|
);
|
|
3975
|
-
return
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3685
|
+
return {
|
|
3686
|
+
exec: (sql) => runtime.actorSqlTransactionExec(transaction, sql),
|
|
3687
|
+
execute: (sql, params) => runtime.actorSqlTransactionExecute(
|
|
3688
|
+
transaction,
|
|
3689
|
+
sql,
|
|
3690
|
+
params
|
|
3691
|
+
),
|
|
3692
|
+
commit: () => runtime.actorSqlTransactionCommit(transaction),
|
|
3693
|
+
rollback: () => runtime.actorSqlTransactionRollback(transaction)
|
|
3694
|
+
};
|
|
3984
3695
|
},
|
|
3985
3696
|
beginStateTransaction: async (timeoutMs, context) => {
|
|
3986
3697
|
const scope = context;
|
|
@@ -4018,13 +3729,8 @@ function getOrCreateNativeSqlDatabase(runtime, ctx) {
|
|
|
4018
3729
|
run: (sql, params) => runtime.actorSqlRun(ctx, sql, params),
|
|
4019
3730
|
metrics: () => runtime.actorSqlMetrics(ctx),
|
|
4020
3731
|
takeLastKvError: () => runtime.actorSqlTakeLastKvError(ctx),
|
|
4021
|
-
open: () => runtime.actorSqlOpen(ctx),
|
|
4022
|
-
commitTicket: () => runtime.actorSqlCommitTicket(ctx),
|
|
4023
|
-
whenDurable: (ticket) => runtime.actorSqlWhenDurable(ctx, ticket),
|
|
4024
|
-
abortGeneration: (reason) => runtime.actorSqlAbortGeneration(ctx, reason),
|
|
4025
3732
|
close: () => runtime.actorSqlClose(ctx)
|
|
4026
|
-
};
|
|
4027
|
-
const database = wrapJsNativeDatabase(bindings);
|
|
3733
|
+
});
|
|
4028
3734
|
runtimeState.sql = database;
|
|
4029
3735
|
return database;
|
|
4030
3736
|
}
|
|
@@ -4093,10 +3799,10 @@ function decodeValue(value) {
|
|
|
4093
3799
|
if (!value || value.length === 0) {
|
|
4094
3800
|
return void 0;
|
|
4095
3801
|
}
|
|
4096
|
-
return
|
|
3802
|
+
return _chunkKDT56V3Ycjs.decodeCborCompat.call(void 0, value);
|
|
4097
3803
|
}
|
|
4098
3804
|
function encodeValue(value) {
|
|
4099
|
-
return
|
|
3805
|
+
return _chunkKDT56V3Ycjs.encodeCborCompat.call(void 0, value);
|
|
4100
3806
|
}
|
|
4101
3807
|
function normalizeArgs(value) {
|
|
4102
3808
|
return Array.isArray(value) ? value : value === void 0 || value === null ? [] : [value];
|
|
@@ -4132,7 +3838,7 @@ function isStructuredBridgeError(error) {
|
|
|
4132
3838
|
return _chunkMGI2VVF6cjs.isRivetErrorLike.call(void 0, error) && "__type" in error && (error.__type === "RivetError" || error.__type === "ActorError");
|
|
4133
3839
|
}
|
|
4134
3840
|
function encodeNativeCallbackError(error) {
|
|
4135
|
-
const structuredError = isStructuredBridgeError(error) ? error :
|
|
3841
|
+
const structuredError = isStructuredBridgeError(error) ? error : _chunkKDT56V3Ycjs.deconstructError.call(void 0, error, true);
|
|
4136
3842
|
const { encoded, droppedMetadataCause } = _chunkMGI2VVF6cjs.encodeBridgeRivetError.call(void 0, structuredError);
|
|
4137
3843
|
if (droppedMetadataCause !== void 0) {
|
|
4138
3844
|
logger2().warn(
|
|
@@ -4194,7 +3900,7 @@ function decodeWorkflowCbor(data) {
|
|
|
4194
3900
|
return null;
|
|
4195
3901
|
}
|
|
4196
3902
|
try {
|
|
4197
|
-
return
|
|
3903
|
+
return _chunkKDT56V3Ycjs.decodeCborCompat.call(void 0, new Uint8Array(data));
|
|
4198
3904
|
} catch (e3) {
|
|
4199
3905
|
return null;
|
|
4200
3906
|
}
|
|
@@ -4307,7 +4013,7 @@ function serializeWorkflowHistoryForJson(data) {
|
|
|
4307
4013
|
if (data === null) {
|
|
4308
4014
|
return null;
|
|
4309
4015
|
}
|
|
4310
|
-
const history =
|
|
4016
|
+
const history = _chunkJW2WPE6Zcjs.decodeWorkflowHistoryTransport.call(void 0, data);
|
|
4311
4017
|
return jsonSafe({
|
|
4312
4018
|
nameRegistry: [...history.nameRegistry],
|
|
4313
4019
|
entries: history.entries.map((entry) => ({
|
|
@@ -4453,7 +4159,7 @@ var NativeConnAdapter = class {
|
|
|
4453
4159
|
},
|
|
4454
4160
|
(newValue) => {
|
|
4455
4161
|
assertCurrentState();
|
|
4456
|
-
|
|
4162
|
+
_chunkKDT56V3Ycjs.assertJsonCompatValue.call(void 0, newValue);
|
|
4457
4163
|
}
|
|
4458
4164
|
);
|
|
4459
4165
|
}
|
|
@@ -4461,7 +4167,7 @@ var NativeConnAdapter = class {
|
|
|
4461
4167
|
var _a;
|
|
4462
4168
|
(_a = this.#assertCanMutateState) == null ? void 0 : _a.call(this);
|
|
4463
4169
|
const nextValue = unwrapWriteThroughProxy(value);
|
|
4464
|
-
|
|
4170
|
+
_chunkKDT56V3Ycjs.assertJsonCompatValue.call(void 0, nextValue);
|
|
4465
4171
|
this.#writeState(nextValue, { writeNative: true });
|
|
4466
4172
|
}
|
|
4467
4173
|
initializeState(value) {
|
|
@@ -4658,7 +4364,7 @@ var NativeKvAdapter = class {
|
|
|
4658
4364
|
const value = await callNative(
|
|
4659
4365
|
() => this.#runtime.actorKvGet(
|
|
4660
4366
|
this.#ctx,
|
|
4661
|
-
|
|
4367
|
+
_chunkMYWZCDMLcjs.makePrefixedKey.call(void 0, encodeNativeKvUserKey(key))
|
|
4662
4368
|
)
|
|
4663
4369
|
);
|
|
4664
4370
|
return value ? decodeNativeKvValue(new Uint8Array(value), options) : null;
|
|
@@ -4667,7 +4373,7 @@ var NativeKvAdapter = class {
|
|
|
4667
4373
|
await callNative(
|
|
4668
4374
|
() => this.#runtime.actorKvPut(
|
|
4669
4375
|
this.#ctx,
|
|
4670
|
-
|
|
4376
|
+
_chunkMYWZCDMLcjs.makePrefixedKey.call(void 0, encodeNativeKvUserKey(key)),
|
|
4671
4377
|
toRuntimeBytes(value)
|
|
4672
4378
|
)
|
|
4673
4379
|
);
|
|
@@ -4676,7 +4382,7 @@ var NativeKvAdapter = class {
|
|
|
4676
4382
|
await callNative(
|
|
4677
4383
|
() => this.#runtime.actorKvDelete(
|
|
4678
4384
|
this.#ctx,
|
|
4679
|
-
|
|
4385
|
+
_chunkMYWZCDMLcjs.makePrefixedKey.call(void 0, encodeNativeKvUserKey(key))
|
|
4680
4386
|
)
|
|
4681
4387
|
);
|
|
4682
4388
|
}
|
|
@@ -4684,8 +4390,8 @@ var NativeKvAdapter = class {
|
|
|
4684
4390
|
await callNative(
|
|
4685
4391
|
() => this.#runtime.actorKvDeleteRange(
|
|
4686
4392
|
this.#ctx,
|
|
4687
|
-
|
|
4688
|
-
|
|
4393
|
+
_chunkMYWZCDMLcjs.makePrefixedKey.call(void 0, encodeNativeKvUserKey(start)),
|
|
4394
|
+
_chunkMYWZCDMLcjs.makePrefixedKey.call(void 0, encodeNativeKvUserKey(end))
|
|
4689
4395
|
)
|
|
4690
4396
|
);
|
|
4691
4397
|
}
|
|
@@ -4698,7 +4404,7 @@ var NativeKvAdapter = class {
|
|
|
4698
4404
|
const entries = await callNative(
|
|
4699
4405
|
() => this.#runtime.actorKvListPrefix(
|
|
4700
4406
|
this.#ctx,
|
|
4701
|
-
|
|
4407
|
+
_chunkMYWZCDMLcjs.makePrefixedKey.call(void 0,
|
|
4702
4408
|
encodeNativeKvUserKey(
|
|
4703
4409
|
prefix,
|
|
4704
4410
|
options == null ? void 0 : options.keyType
|
|
@@ -4712,7 +4418,7 @@ var NativeKvAdapter = class {
|
|
|
4712
4418
|
);
|
|
4713
4419
|
return entries.map((entry) => [
|
|
4714
4420
|
decodeNativeKvKey(
|
|
4715
|
-
|
|
4421
|
+
_chunkMYWZCDMLcjs.removePrefixFromKey.call(void 0, new Uint8Array(entry.key)),
|
|
4716
4422
|
options == null ? void 0 : options.keyType
|
|
4717
4423
|
),
|
|
4718
4424
|
decodeNativeKvValue(new Uint8Array(entry.value), options)
|
|
@@ -4731,13 +4437,13 @@ var NativeKvAdapter = class {
|
|
|
4731
4437
|
const entries = await callNative(
|
|
4732
4438
|
() => this.#runtime.actorKvListRange(
|
|
4733
4439
|
this.#ctx,
|
|
4734
|
-
|
|
4440
|
+
_chunkMYWZCDMLcjs.makePrefixedKey.call(void 0,
|
|
4735
4441
|
encodeNativeKvUserKey(
|
|
4736
4442
|
start,
|
|
4737
4443
|
options == null ? void 0 : options.keyType
|
|
4738
4444
|
)
|
|
4739
4445
|
),
|
|
4740
|
-
|
|
4446
|
+
_chunkMYWZCDMLcjs.makePrefixedKey.call(void 0,
|
|
4741
4447
|
encodeNativeKvUserKey(
|
|
4742
4448
|
end,
|
|
4743
4449
|
options == null ? void 0 : options.keyType
|
|
@@ -4751,7 +4457,7 @@ var NativeKvAdapter = class {
|
|
|
4751
4457
|
);
|
|
4752
4458
|
return entries.map((entry) => [
|
|
4753
4459
|
decodeNativeKvKey(
|
|
4754
|
-
|
|
4460
|
+
_chunkMYWZCDMLcjs.removePrefixFromKey.call(void 0, new Uint8Array(entry.key)),
|
|
4755
4461
|
options == null ? void 0 : options.keyType
|
|
4756
4462
|
),
|
|
4757
4463
|
decodeNativeKvValue(new Uint8Array(entry.value), options)
|
|
@@ -5540,7 +5246,7 @@ var ActorContextHandleAdapter = class {
|
|
|
5540
5246
|
},
|
|
5541
5247
|
(newValue) => {
|
|
5542
5248
|
assertCurrentState();
|
|
5543
|
-
|
|
5249
|
+
_chunkKDT56V3Ycjs.assertJsonCompatValue.call(void 0, newValue);
|
|
5544
5250
|
}
|
|
5545
5251
|
);
|
|
5546
5252
|
}
|
|
@@ -5552,7 +5258,7 @@ var ActorContextHandleAdapter = class {
|
|
|
5552
5258
|
}
|
|
5553
5259
|
this.#assertCanMutateState();
|
|
5554
5260
|
const nextValue = unwrapWriteThroughProxy(value);
|
|
5555
|
-
|
|
5261
|
+
_chunkKDT56V3Ycjs.assertJsonCompatValue.call(void 0, nextValue);
|
|
5556
5262
|
this.#writeState(nextValue, { scheduleSave: true });
|
|
5557
5263
|
}
|
|
5558
5264
|
initializeState(value) {
|
|
@@ -5680,14 +5386,12 @@ var ActorContextHandleAdapter = class {
|
|
|
5680
5386
|
}
|
|
5681
5387
|
get abortSignal() {
|
|
5682
5388
|
if (!this.#abortSignal) {
|
|
5683
|
-
const
|
|
5684
|
-
const actorSignal = actorAbort.signal;
|
|
5389
|
+
const actorSignal = this.#createActorAbortSignal();
|
|
5685
5390
|
if (this.#dispatchCancelToken === void 0) {
|
|
5686
5391
|
this.#abortSignal = actorSignal;
|
|
5687
5392
|
} else {
|
|
5688
5393
|
const controller = new AbortController();
|
|
5689
5394
|
let cleanedUp = false;
|
|
5690
|
-
let releaseDispatchListener;
|
|
5691
5395
|
const onActorAbort = () => {
|
|
5692
5396
|
cleanup();
|
|
5693
5397
|
controller.abort();
|
|
@@ -5697,9 +5401,7 @@ var ActorContextHandleAdapter = class {
|
|
|
5697
5401
|
return;
|
|
5698
5402
|
}
|
|
5699
5403
|
cleanedUp = true;
|
|
5700
|
-
|
|
5701
|
-
releaseDispatchListener == null ? void 0 : releaseDispatchListener();
|
|
5702
|
-
releaseDispatchListener = void 0;
|
|
5404
|
+
actorSignal.removeEventListener("abort", onActorAbort);
|
|
5703
5405
|
this.#abortSignalCleanup = void 0;
|
|
5704
5406
|
};
|
|
5705
5407
|
if (actorSignal.aborted || this.#runtime.cancellationTokenAborted(
|
|
@@ -5709,8 +5411,10 @@ var ActorContextHandleAdapter = class {
|
|
|
5709
5411
|
} else {
|
|
5710
5412
|
const dispatchCancelToken = this.#dispatchCancelToken;
|
|
5711
5413
|
this.#abortSignalCleanup = cleanup;
|
|
5712
|
-
|
|
5713
|
-
|
|
5414
|
+
actorSignal.addEventListener("abort", onActorAbort, {
|
|
5415
|
+
once: true
|
|
5416
|
+
});
|
|
5417
|
+
callNativeSync(
|
|
5714
5418
|
() => this.#runtime.onCancellationTokenCancelled(
|
|
5715
5419
|
dispatchCancelToken,
|
|
5716
5420
|
() => {
|
|
@@ -5766,16 +5470,14 @@ var ActorContextHandleAdapter = class {
|
|
|
5766
5470
|
log: {
|
|
5767
5471
|
debug: (obj) => logger2().debug(obj)
|
|
5768
5472
|
},
|
|
5769
|
-
nativeDatabaseProvider:
|
|
5473
|
+
nativeDatabaseProvider: _chunkHO76AEDHcjs.registerNativeStateTransactionOpener.call(void 0,
|
|
5770
5474
|
{
|
|
5771
5475
|
open: async (requestedActorId) => {
|
|
5772
5476
|
void requestedActorId;
|
|
5773
|
-
|
|
5477
|
+
return getOrCreateNativeSqlDatabase(
|
|
5774
5478
|
this.#runtime,
|
|
5775
5479
|
this.#ctx
|
|
5776
5480
|
);
|
|
5777
|
-
await database.open();
|
|
5778
|
-
return database;
|
|
5779
5481
|
}
|
|
5780
5482
|
},
|
|
5781
5483
|
async (timeoutMs, context) => await getOrCreateNativeSqlDatabase(
|
|
@@ -5791,7 +5493,7 @@ var ActorContextHandleAdapter = class {
|
|
|
5791
5493
|
return this.#db;
|
|
5792
5494
|
}
|
|
5793
5495
|
#bindDatabaseClient(client) {
|
|
5794
|
-
return
|
|
5496
|
+
return _chunkHO76AEDHcjs.bindNativeStateTransactionContext.call(void 0, client, {
|
|
5795
5497
|
enter: async () => await this.#enterStateTransaction(),
|
|
5796
5498
|
exit: (scope) => this.#exitStateTransaction(
|
|
5797
5499
|
scope
|
|
@@ -5995,7 +5697,7 @@ var ActorContextHandleAdapter = class {
|
|
|
5995
5697
|
const trackedPromise = Promise.resolve(promise).catch((error) => {
|
|
5996
5698
|
logger2().warn({
|
|
5997
5699
|
msg: "keepAwake promise rejected",
|
|
5998
|
-
error:
|
|
5700
|
+
error: _chunkKDT56V3Ycjs.stringifyError.call(void 0, error)
|
|
5999
5701
|
});
|
|
6000
5702
|
}).then(() => null);
|
|
6001
5703
|
try {
|
|
@@ -6088,42 +5790,22 @@ var ActorContextHandleAdapter = class {
|
|
|
6088
5790
|
}
|
|
6089
5791
|
async dispose() {
|
|
6090
5792
|
var _a;
|
|
6091
|
-
|
|
6092
|
-
this.#flushStateChange();
|
|
6093
|
-
}
|
|
5793
|
+
this.#flushStateChange();
|
|
6094
5794
|
(_a = this.#abortSignalCleanup) == null ? void 0 : _a.call(this);
|
|
6095
5795
|
}
|
|
6096
|
-
#
|
|
6097
|
-
const runtimeState = readNativeRuntimeStateBag(
|
|
6098
|
-
this.#runtime,
|
|
6099
|
-
this.#ctx
|
|
6100
|
-
);
|
|
6101
|
-
const cached = runtimeState.actorAbort;
|
|
6102
|
-
if (cached && !cached.signal.aborted) {
|
|
6103
|
-
return cached;
|
|
6104
|
-
}
|
|
5796
|
+
#createActorAbortSignal() {
|
|
6105
5797
|
const nativeSignal = callNativeSync(
|
|
6106
5798
|
() => this.#runtime.actorAbortSignal(this.#ctx)
|
|
6107
5799
|
);
|
|
6108
5800
|
const controller = new AbortController();
|
|
6109
|
-
const actorAbort = {
|
|
6110
|
-
signal: controller.signal,
|
|
6111
|
-
listeners: /* @__PURE__ */ new Set()
|
|
6112
|
-
};
|
|
6113
|
-
const abort = () => {
|
|
6114
|
-
controller.abort();
|
|
6115
|
-
for (const listener of actorAbort.listeners) {
|
|
6116
|
-
listener();
|
|
6117
|
-
}
|
|
6118
|
-
actorAbort.listeners.clear();
|
|
6119
|
-
};
|
|
6120
5801
|
if (nativeSignal.aborted) {
|
|
6121
|
-
abort();
|
|
5802
|
+
controller.abort();
|
|
6122
5803
|
} else {
|
|
6123
|
-
nativeSignal.addEventListener("abort", abort, {
|
|
5804
|
+
nativeSignal.addEventListener("abort", () => controller.abort(), {
|
|
5805
|
+
once: true
|
|
5806
|
+
});
|
|
6124
5807
|
}
|
|
6125
|
-
|
|
6126
|
-
return actorAbort;
|
|
5808
|
+
return controller.signal;
|
|
6127
5809
|
}
|
|
6128
5810
|
#readState() {
|
|
6129
5811
|
const actorState = getNativePersistState(this.#runtime, this.#ctx);
|
|
@@ -6378,21 +6060,18 @@ function buildActorTracingConfig(actions, tracing) {
|
|
|
6378
6060
|
actions: _chunkHDVZ6YZGcjs.flattenActionTraceSamplers.call(void 0, actions, tracing.actions)
|
|
6379
6061
|
};
|
|
6380
6062
|
}
|
|
6381
|
-
var SQLITE_DEFERRED_COMMITS = /* @__PURE__ */ Symbol.for("rivetkit.sqlite.deferredCommits");
|
|
6382
6063
|
function buildActorConfig(definition, registryConfig, runtimeKind) {
|
|
6383
|
-
var _a
|
|
6064
|
+
var _a;
|
|
6384
6065
|
const config = definition.config;
|
|
6385
6066
|
const options = _nullishCoalesce(config.options, () => ( {}));
|
|
6386
6067
|
const canHibernate = options.canHibernateWebSocket;
|
|
6387
6068
|
const usesRemoteSqlite = sqliteBackendForConfig(registryConfig) === "remote";
|
|
6388
6069
|
const sqliteProfiling = (_a = config.db) == null ? void 0 : _a.sqliteProfiling;
|
|
6389
|
-
const sqliteDeferredCommits = ((_b = config.db) == null ? void 0 : _b[SQLITE_DEFERRED_COMMITS]) === true;
|
|
6390
6070
|
return {
|
|
6391
6071
|
name: options.name,
|
|
6392
6072
|
icon: options.icon,
|
|
6393
6073
|
hasDatabase: true,
|
|
6394
6074
|
remoteSqlite: usesRemoteSqlite,
|
|
6395
|
-
sqliteDeferredCommits: sqliteDeferredCommits || void 0,
|
|
6396
6075
|
sqliteProfiling,
|
|
6397
6076
|
tracing: buildActorTracingConfig(
|
|
6398
6077
|
definition.config.actions,
|
|
@@ -6496,7 +6175,7 @@ function validateInspectorTabSource(tabId, resolved) {
|
|
|
6496
6175
|
function buildNativeFactory(runtime, registryConfig, definition) {
|
|
6497
6176
|
var _a;
|
|
6498
6177
|
const config = definition.config;
|
|
6499
|
-
const databaseProvider = _nullishCoalesce(config.db, () => (
|
|
6178
|
+
const databaseProvider = _nullishCoalesce(config.db, () => ( _chunkHO76AEDHcjs.db.call(void 0, )));
|
|
6500
6179
|
const actionHandlers = _chunkHDVZ6YZGcjs.flattenActionHandlers.call(void 0, config.actions);
|
|
6501
6180
|
const schemaConfig = {
|
|
6502
6181
|
actionInputSchemas: _chunkHDVZ6YZGcjs.flattenActionInputSchemas.call(void 0,
|
|
@@ -6507,9 +6186,9 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
6507
6186
|
events: config.events,
|
|
6508
6187
|
queues: config.queues
|
|
6509
6188
|
};
|
|
6510
|
-
const createClient = (ctx) =>
|
|
6511
|
-
new (0,
|
|
6512
|
-
|
|
6189
|
+
const createClient = (ctx) => _chunkDDS7OOVFcjs.createClientWithDriver.call(void 0,
|
|
6190
|
+
new (0, _chunkDDS7OOVFcjs.RemoteEngineControlClient)(
|
|
6191
|
+
_chunkDDS7OOVFcjs.convertRegistryConfigToClientConfig.call(void 0, registryConfig)
|
|
6513
6192
|
),
|
|
6514
6193
|
{
|
|
6515
6194
|
encoding: "bare",
|
|
@@ -6701,7 +6380,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
6701
6380
|
400
|
|
6702
6381
|
);
|
|
6703
6382
|
}
|
|
6704
|
-
const cbor =
|
|
6383
|
+
const cbor = _chunkKDT56V3Ycjs.encodeCborCompat.call(void 0,
|
|
6705
6384
|
_nullishCoalesce(body.body, () => ( null))
|
|
6706
6385
|
);
|
|
6707
6386
|
const message = await runtime.actorQueueSend(ctx, name, cbor);
|
|
@@ -7088,7 +6767,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
7088
6767
|
}
|
|
7089
6768
|
} finally {
|
|
7090
6769
|
resolveNativeDestroy(runtime, ctx);
|
|
7091
|
-
await
|
|
6770
|
+
await actorCtx.closeDatabase();
|
|
7092
6771
|
clearNativeRuntimeState(runtime, ctx);
|
|
7093
6772
|
await actorCtx.dispose();
|
|
7094
6773
|
}
|
|
@@ -7298,7 +6977,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
7298
6977
|
...request,
|
|
7299
6978
|
abortController: requestAbortController
|
|
7300
6979
|
});
|
|
7301
|
-
const rawConnParams = handlerRequest.headers.get(
|
|
6980
|
+
const rawConnParams = handlerRequest.headers.get(_chunkDDS7OOVFcjs.HEADER_CONN_PARAMS);
|
|
7302
6981
|
let requestCtx;
|
|
7303
6982
|
let conn;
|
|
7304
6983
|
let removeRequestAbortListener;
|
|
@@ -7355,7 +7034,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
7355
7034
|
requestCtx,
|
|
7356
7035
|
handlerRequest
|
|
7357
7036
|
);
|
|
7358
|
-
if (!
|
|
7037
|
+
if (!_chunkDDS7OOVFcjs.isResponseLike.call(void 0, response)) {
|
|
7359
7038
|
throw new Error(
|
|
7360
7039
|
"onRequest handler must return a Response"
|
|
7361
7040
|
);
|
|
@@ -7450,7 +7129,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
7450
7129
|
var _a2;
|
|
7451
7130
|
const { ctx } = unwrapTsfnPayload(error, payload);
|
|
7452
7131
|
const history = (_a2 = getNativeWorkflowInspector(ctx)) == null ? void 0 : _a2.getHistory();
|
|
7453
|
-
return history == null ? void 0 :
|
|
7132
|
+
return history == null ? void 0 : _chunkKDT56V3Ycjs.toUint8Array.call(void 0, history);
|
|
7454
7133
|
}
|
|
7455
7134
|
) : void 0,
|
|
7456
7135
|
replayWorkflow: _chunkHDVZ6YZGcjs.hasRunInspectorConfig.call(void 0, config.run) ? wrapNativeCallback(
|
|
@@ -7464,7 +7143,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
7464
7143
|
return void 0;
|
|
7465
7144
|
}
|
|
7466
7145
|
const history = await _asyncNullishCoalesce(await workflowInspector.replayFromStep(entryId), async () => ( null));
|
|
7467
|
-
return history == null ? void 0 :
|
|
7146
|
+
return history == null ? void 0 : _chunkKDT56V3Ycjs.toUint8Array.call(void 0, history);
|
|
7468
7147
|
}
|
|
7469
7148
|
) : void 0,
|
|
7470
7149
|
actions: Object.fromEntries(
|
|
@@ -7592,16 +7271,15 @@ async function buildServeConfig(config, resolveServicesBinary = true) {
|
|
|
7592
7271
|
throw nativeEndpointNotConfiguredError();
|
|
7593
7272
|
}
|
|
7594
7273
|
const serveConfig = {
|
|
7595
|
-
version: config.
|
|
7274
|
+
version: config.envoy.version,
|
|
7596
7275
|
endpoint: config.endpoint,
|
|
7597
|
-
engineSpawn: config.engineSpawn,
|
|
7598
7276
|
token: config.token,
|
|
7599
7277
|
namespace: config.namespace,
|
|
7600
|
-
poolName: config.
|
|
7278
|
+
poolName: config.envoy.poolName,
|
|
7601
7279
|
startServices: resolveServicesBinary && config.startServices,
|
|
7602
7280
|
handleInspectorHttpInRuntime: true,
|
|
7603
7281
|
serverlessBasePath: config.serverless.basePath,
|
|
7604
|
-
serverlessPackageVersion:
|
|
7282
|
+
serverlessPackageVersion: _chunkKDT56V3Ycjs.VERSION,
|
|
7605
7283
|
serverlessClientEndpoint: config.publicEndpoint,
|
|
7606
7284
|
serverlessClientNamespace: config.publicNamespace,
|
|
7607
7285
|
serverlessClientToken: config.publicToken,
|
|
@@ -7614,32 +7292,30 @@ async function buildServeConfig(config, resolveServicesBinary = true) {
|
|
|
7614
7292
|
} catch (error) {
|
|
7615
7293
|
logger2().warn({
|
|
7616
7294
|
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",
|
|
7617
|
-
error:
|
|
7295
|
+
error: _chunkKDT56V3Ycjs.stringifyError.call(void 0, error)
|
|
7618
7296
|
});
|
|
7619
7297
|
}
|
|
7620
7298
|
if (resolveServicesBinary && config.startServices) {
|
|
7621
|
-
|
|
7622
|
-
|
|
7623
|
-
serveConfig.servicesBinaryPath =
|
|
7624
|
-
}
|
|
7625
|
-
|
|
7626
|
-
|
|
7627
|
-
|
|
7628
|
-
}
|
|
7629
|
-
throw servicesBinaryUnavailable(error);
|
|
7630
|
-
}
|
|
7299
|
+
try {
|
|
7300
|
+
const { getServicesPath } = await loadServices();
|
|
7301
|
+
serveConfig.servicesBinaryPath = getServicesPath();
|
|
7302
|
+
} catch (error) {
|
|
7303
|
+
logger2().warn({
|
|
7304
|
+
msg: "could not resolve the Services binary; a local engine will fail with services.binary_unavailable \u2014 set RIVET_RUN_SERVICES=0 to disable Services or RIVET_SERVICES_BINARY to a local rivet-services binary",
|
|
7305
|
+
error: _chunkKDT56V3Ycjs.stringifyError.call(void 0, error)
|
|
7306
|
+
});
|
|
7631
7307
|
}
|
|
7632
7308
|
}
|
|
7633
7309
|
serveConfig.engineHost = config.engineHost;
|
|
7634
7310
|
serveConfig.enginePort = config.enginePort;
|
|
7635
7311
|
if ((_a = config.test) == null ? void 0 : _a.enabled) {
|
|
7636
|
-
serveConfig.inspectorTestToken = _nullishCoalesce(
|
|
7312
|
+
serveConfig.inspectorTestToken = _nullishCoalesce(_chunkKDT56V3Ycjs.getEnvUniversal.call(void 0, "_RIVET_TEST_INSPECTOR_TOKEN"), () => ( "token"));
|
|
7637
7313
|
}
|
|
7638
7314
|
return serveConfig;
|
|
7639
7315
|
}
|
|
7640
7316
|
async function buildRegistryWithRuntime(config, runtime) {
|
|
7641
7317
|
var _a;
|
|
7642
|
-
if (((_a = config.test) == null ? void 0 : _a.enabled) &&
|
|
7318
|
+
if (((_a = config.test) == null ? void 0 : _a.enabled) && _chunkKDT56V3Ycjs.getEnvUniversal.call(void 0, "_RIVET_TEST_INSPECTOR_TOKEN") === void 0) {
|
|
7643
7319
|
trySetProcessEnv("_RIVET_TEST_INSPECTOR_TOKEN", "token");
|
|
7644
7320
|
}
|
|
7645
7321
|
if (runtime.kind === "napi") {
|
|
@@ -7669,9 +7345,6 @@ async function buildConfiguredRegistry(config) {
|
|
|
7669
7345
|
|
|
7670
7346
|
// src/registry/index.ts
|
|
7671
7347
|
var REGISTRY_READY_TIMEOUT_MS = 3e4;
|
|
7672
|
-
function rejectServerless() {
|
|
7673
|
-
throw new Error("serverless is disabled in this version");
|
|
7674
|
-
}
|
|
7675
7348
|
function signalExitCode(signal) {
|
|
7676
7349
|
switch (signal) {
|
|
7677
7350
|
case "SIGINT":
|
|
@@ -7709,7 +7382,7 @@ function createApplicationFetch(application, runtime) {
|
|
|
7709
7382
|
signal: abortController.signal
|
|
7710
7383
|
})
|
|
7711
7384
|
);
|
|
7712
|
-
if (!
|
|
7385
|
+
if (!_chunkDDS7OOVFcjs.isResponseLike.call(void 0, response)) {
|
|
7713
7386
|
throw new TypeError(
|
|
7714
7387
|
"registry.listen() application fetch must return a Response"
|
|
7715
7388
|
);
|
|
@@ -7759,7 +7432,7 @@ var Registry = class {
|
|
|
7759
7432
|
var _a;
|
|
7760
7433
|
this.#config = config;
|
|
7761
7434
|
if ((_a = config.logging) == null ? void 0 : _a.baseLogger) {
|
|
7762
|
-
|
|
7435
|
+
_chunkKDT56V3Ycjs.configureBaseLogger.call(void 0, config.logging.baseLogger);
|
|
7763
7436
|
}
|
|
7764
7437
|
this.#buildConfiguredRegistry = _nullishCoalesce((deps == null ? void 0 : deps.buildConfiguredRegistry), () => ( buildConfiguredRegistry));
|
|
7765
7438
|
this.routes = {
|
|
@@ -7776,7 +7449,6 @@ var Registry = class {
|
|
|
7776
7449
|
*/
|
|
7777
7450
|
#ensureServerlessPoolConfigured(config) {
|
|
7778
7451
|
if (!config.configurePool) return void 0;
|
|
7779
|
-
rejectServerless();
|
|
7780
7452
|
if (!this.#configureServerlessPoolPromise) {
|
|
7781
7453
|
this.#configureServerlessPoolPromise = configureServerlessPool(
|
|
7782
7454
|
config
|
|
@@ -7801,7 +7473,6 @@ var Registry = class {
|
|
|
7801
7473
|
*/
|
|
7802
7474
|
async handler(request) {
|
|
7803
7475
|
var _a;
|
|
7804
|
-
rejectServerless();
|
|
7805
7476
|
const config = this.parseConfig();
|
|
7806
7477
|
this.#printWelcome(config, "serverless");
|
|
7807
7478
|
if (!this.#runtimeServerlessPromise) {
|
|
@@ -7963,7 +7634,6 @@ var Registry = class {
|
|
|
7963
7634
|
* ```
|
|
7964
7635
|
*/
|
|
7965
7636
|
serve() {
|
|
7966
|
-
rejectServerless();
|
|
7967
7637
|
return {
|
|
7968
7638
|
fetch: (request) => this.handler(request)
|
|
7969
7639
|
};
|
|
@@ -7988,13 +7658,10 @@ var Registry = class {
|
|
|
7988
7658
|
* ```
|
|
7989
7659
|
*/
|
|
7990
7660
|
async listen(opts = {}) {
|
|
7991
|
-
|
|
7992
|
-
|
|
7993
|
-
}
|
|
7994
|
-
const port = _nullishCoalesce(_nullishCoalesce(opts.port, () => ( _chunk2MOLY6AMcjs.parsePortEnv.call(void 0, process.env.RIVET_PORT))), () => ( 3e3));
|
|
7995
|
-
const publicDir = _nullishCoalesce(opts.publicDir, () => ( _chunk2MOLY6AMcjs.getRivetkitPublicDir.call(void 0, )));
|
|
7661
|
+
const port = _nullishCoalesce(_nullishCoalesce(opts.port, () => ( _chunkKDT56V3Ycjs.parsePortEnv.call(void 0, process.env.RIVET_PORT))), () => ( 3e3));
|
|
7662
|
+
const publicDir = _nullishCoalesce(opts.publicDir, () => ( _chunkKDT56V3Ycjs.getRivetkitPublicDir.call(void 0, )));
|
|
7996
7663
|
const config = this.parseConfig();
|
|
7997
|
-
if (opts.application &&
|
|
7664
|
+
if (opts.application && _chunkKDT56V3Ycjs.getRivetkitRuntimeMode.call(void 0, ) !== "serverless") {
|
|
7998
7665
|
if (config.runtime === "wasm") {
|
|
7999
7666
|
throw new Error(
|
|
8000
7667
|
"registry.listen() requires the native runtime; use an application-owned HTTP server with WebAssembly"
|
|
@@ -8070,7 +7737,7 @@ var Registry = class {
|
|
|
8070
7737
|
return jsonRouteResponse(503, {
|
|
8071
7738
|
status: "not_started",
|
|
8072
7739
|
runtime: "rivetkit",
|
|
8073
|
-
version:
|
|
7740
|
+
version: _chunkKDT56V3Ycjs.VERSION
|
|
8074
7741
|
});
|
|
8075
7742
|
}
|
|
8076
7743
|
const { runtime, registry } = configured;
|
|
@@ -8078,7 +7745,7 @@ var Registry = class {
|
|
|
8078
7745
|
return jsonRouteResponse(501, {
|
|
8079
7746
|
status: "unsupported",
|
|
8080
7747
|
runtime: "rivetkit",
|
|
8081
|
-
version:
|
|
7748
|
+
version: _chunkKDT56V3Ycjs.VERSION
|
|
8082
7749
|
});
|
|
8083
7750
|
}
|
|
8084
7751
|
const response = await runtime.registryHealth(registry);
|
|
@@ -8091,7 +7758,6 @@ var Registry = class {
|
|
|
8091
7758
|
* Returns serverless metadata suitable for mounting in a user-owned router.
|
|
8092
7759
|
*/
|
|
8093
7760
|
async #metadataRoute() {
|
|
8094
|
-
rejectServerless();
|
|
8095
7761
|
const configured = await this.#activeConfiguredRegistry();
|
|
8096
7762
|
if (!configured) {
|
|
8097
7763
|
return new Response("registry not started\n", {
|
|
@@ -8152,18 +7818,18 @@ var Registry = class {
|
|
|
8152
7818
|
#startEnvoy(config, printWelcome) {
|
|
8153
7819
|
var _a;
|
|
8154
7820
|
if (!this.#runtimeServePromise) {
|
|
8155
|
-
const configuredEnvoyVersion = (_a = this.#config.
|
|
8156
|
-
const envoyVersionSource = configuredEnvoyVersion !== void 0 ? "config" :
|
|
7821
|
+
const configuredEnvoyVersion = (_a = this.#config.envoy) == null ? void 0 : _a.version;
|
|
7822
|
+
const envoyVersionSource = configuredEnvoyVersion !== void 0 ? "config" : _chunkKDT56V3Ycjs.getRivetEnvoyVersion.call(void 0, ) !== void 0 ? "environment" : "default";
|
|
8157
7823
|
logger2().info({
|
|
8158
7824
|
msg: "starting rivetkit envoy",
|
|
8159
|
-
rivetkitVersion:
|
|
8160
|
-
envoyVersion: config.
|
|
7825
|
+
rivetkitVersion: _chunkKDT56V3Ycjs.VERSION,
|
|
7826
|
+
envoyVersion: config.envoy.version,
|
|
8161
7827
|
envoyVersionSource
|
|
8162
7828
|
});
|
|
8163
|
-
if (envoyVersionSource === "default" &&
|
|
7829
|
+
if (envoyVersionSource === "default" && _chunkKDT56V3Ycjs.getNodeEnv.call(void 0, ) === "production") {
|
|
8164
7830
|
logger2().error({
|
|
8165
|
-
msg: "
|
|
8166
|
-
envoyVersion: config.
|
|
7831
|
+
msg: "envoy version defaulted because neither config.envoy.version nor RIVET_ENVOY_VERSION is set; actors will not drain automatically across deploys. See https://rivet.dev/docs/actors/versions",
|
|
7832
|
+
envoyVersion: config.envoy.version,
|
|
8167
7833
|
envoyVersionSource
|
|
8168
7834
|
});
|
|
8169
7835
|
}
|
|
@@ -8175,10 +7841,7 @@ var Registry = class {
|
|
|
8175
7841
|
}
|
|
8176
7842
|
);
|
|
8177
7843
|
this.#runtimeServePromise = this.#runtimeServeLifecyclePromise.catch((error) => {
|
|
8178
|
-
logger2().
|
|
8179
|
-
if (typeof process !== "undefined" && typeof process.exit === "function") {
|
|
8180
|
-
process.exit(1);
|
|
8181
|
-
}
|
|
7844
|
+
logger2().warn({ error }, "runtime registry serve errored");
|
|
8182
7845
|
});
|
|
8183
7846
|
this.#installSignalHandlers(config);
|
|
8184
7847
|
}
|
|
@@ -8208,7 +7871,7 @@ var Registry = class {
|
|
|
8208
7871
|
finishShutdownSignal(signal);
|
|
8209
7872
|
return;
|
|
8210
7873
|
}
|
|
8211
|
-
this.#shutdownInFlight = this.#drain(config
|
|
7874
|
+
this.#shutdownInFlight = this.#drain(config).catch((err) => {
|
|
8212
7875
|
logger2().warn({ err }, "shutdown error");
|
|
8213
7876
|
}).then(() => {
|
|
8214
7877
|
this.#removeSignalHandlers();
|
|
@@ -8244,18 +7907,12 @@ var Registry = class {
|
|
|
8244
7907
|
});
|
|
8245
7908
|
return this.#shutdownInFlight;
|
|
8246
7909
|
}
|
|
8247
|
-
async #drain(config
|
|
7910
|
+
async #drain(config) {
|
|
8248
7911
|
var _a;
|
|
8249
7912
|
const modeAPromise = this.#runtimeServeConfiguredPromise;
|
|
8250
7913
|
const modeBPromise = this.#runtimeServerlessPromise;
|
|
8251
7914
|
const runtimes = /* @__PURE__ */ new Set();
|
|
8252
|
-
const
|
|
8253
|
-
let gracePeriodMs = (_a = config.shutdown) == null ? void 0 : _a.gracePeriodMs;
|
|
8254
|
-
if (gracePeriodMs === void 0) {
|
|
8255
|
-
gracePeriodMs = localDevSignal ? 1e3 : await _asyncNullishCoalesce(await this.#actorStopThresholdMs(
|
|
8256
|
-
_nullishCoalesce(modeAPromise, () => ( modeBPromise))
|
|
8257
|
-
), async () => ( 30 * 60 * 1e3));
|
|
8258
|
-
}
|
|
7915
|
+
const gracePeriodMs = await _asyncNullishCoalesce(await _asyncNullishCoalesce(((_a = config.shutdown) == null ? void 0 : _a.gracePeriodMs), async () => ( await this.#actorStopThresholdMs(_nullishCoalesce(modeAPromise, () => ( modeBPromise))))), async () => ( 30 * 60 * 1e3));
|
|
8259
7916
|
const drain = async () => {
|
|
8260
7917
|
const registries = [];
|
|
8261
7918
|
if (modeAPromise !== void 0) {
|
|
@@ -8360,16 +8017,12 @@ var Registry = class {
|
|
|
8360
8017
|
);
|
|
8361
8018
|
}
|
|
8362
8019
|
if (this.#runtimeReadyPromise) return this.#runtimeReadyPromise;
|
|
8363
|
-
|
|
8364
|
-
|
|
8365
|
-
|
|
8366
|
-
|
|
8367
|
-
|
|
8368
|
-
|
|
8369
|
-
);
|
|
8370
|
-
}
|
|
8371
|
-
} catch (error) {
|
|
8372
|
-
return Promise.reject(error);
|
|
8020
|
+
if (_chunkKDT56V3Ycjs.getRivetkitRuntimeMode.call(void 0, ) === "serverless") {
|
|
8021
|
+
return Promise.reject(
|
|
8022
|
+
new Error(
|
|
8023
|
+
"registry.startAndWait() requires envoy runtime mode; serverless registries become ready per request"
|
|
8024
|
+
)
|
|
8025
|
+
);
|
|
8373
8026
|
}
|
|
8374
8027
|
const config = this.parseConfig();
|
|
8375
8028
|
if (config.runtime === "wasm") {
|
|
@@ -8434,8 +8087,8 @@ var Registry = class {
|
|
|
8434
8087
|
* ```
|
|
8435
8088
|
*/
|
|
8436
8089
|
start() {
|
|
8437
|
-
if (
|
|
8438
|
-
const publicDir = _nullishCoalesce(
|
|
8090
|
+
if (_chunkKDT56V3Ycjs.getRivetkitRuntimeMode.call(void 0, ) === "serverless") {
|
|
8091
|
+
const publicDir = _nullishCoalesce(_chunkKDT56V3Ycjs.getRivetkitPublicDir.call(void 0, ), () => ( "/public"));
|
|
8439
8092
|
this.listen({ publicDir }).catch((error) => {
|
|
8440
8093
|
logger2().error({ error }, "auto-listen failed; exiting");
|
|
8441
8094
|
if (typeof process !== "undefined" && typeof process.exit === "function") {
|
|
@@ -8456,13 +8109,13 @@ var Registry = class {
|
|
|
8456
8109
|
};
|
|
8457
8110
|
console.log();
|
|
8458
8111
|
console.log(
|
|
8459
|
-
` RivetKit ${
|
|
8112
|
+
` RivetKit ${_chunkKDT56V3Ycjs.VERSION} (Engine - ${kind === "serverless" ? "Serverless" : "Serverful"})`
|
|
8460
8113
|
);
|
|
8461
8114
|
if (config.namespace !== "default") {
|
|
8462
8115
|
logLine("Namespace", config.namespace);
|
|
8463
8116
|
}
|
|
8464
8117
|
if (config.endpoint) {
|
|
8465
|
-
const endpointType = config.startEngine ||
|
|
8118
|
+
const endpointType = config.startEngine || _chunkDDS7OOVFcjs.isLocalEngineEndpoint.call(void 0, config.endpoint) ? "local native" : "remote";
|
|
8466
8119
|
logLine("Endpoint", `${config.endpoint} (${endpointType})`);
|
|
8467
8120
|
}
|
|
8468
8121
|
if (kind === "serverless" && config.publicEndpoint) {
|
|
@@ -8532,5 +8185,5 @@ function setup(input) {
|
|
|
8532
8185
|
|
|
8533
8186
|
|
|
8534
8187
|
|
|
8535
|
-
exports.ALLOWED_PUBLIC_HEADERS =
|
|
8188
|
+
exports.ALLOWED_PUBLIC_HEADERS = _chunkDDS7OOVFcjs.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 = _chunkDDS7OOVFcjs.createClientWithDriver; exports.defineRunHandler = _chunkHDVZ6YZGcjs.defineRunHandler; exports.event = event; exports.isStaticActorDefinition = isStaticActorDefinition; exports.isStaticActorInstance = isStaticActorInstance; exports.lookupInRegistry = lookupInRegistry; exports.noopNext = _chunkKDT56V3Ycjs.noopNext; exports.queue = queue; exports.setup = setup; exports.toUint8Array = _chunkKDT56V3Ycjs.toUint8Array;
|
|
8536
8189
|
//# sourceMappingURL=mod.cjs.map
|