rivetkit 0.0.0-sqlite-query-metrics-v3.1dff84f → 0.0.0-sqlite-sync-3-0-1-final.5663d2f

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.
Files changed (94) hide show
  1. package/dist/browser/client.d.ts +48 -49
  2. package/dist/browser/client.js +1 -1
  3. package/dist/browser/client.js.map +1 -1
  4. package/dist/browser/inspector/client.js +1 -1
  5. package/dist/browser/inspector/client.js.map +1 -1
  6. package/dist/tsup/{chunk-QQIFRR3B.js → chunk-3ZKCK6NL.js} +3 -3
  7. package/dist/tsup/{chunk-Y4QLVCCS.cjs → chunk-6UDO6UYM.cjs} +2 -2
  8. package/dist/tsup/{chunk-Y4QLVCCS.cjs.map → chunk-6UDO6UYM.cjs.map} +1 -1
  9. package/dist/tsup/{chunk-CWN7N5AF.cjs → chunk-C2NON6V4.cjs} +7 -7
  10. package/dist/tsup/{chunk-CWN7N5AF.cjs.map → chunk-C2NON6V4.cjs.map} +1 -1
  11. package/dist/tsup/{chunk-HXJ5U2ZI.cjs → chunk-DGU2H5IJ.cjs} +3 -3
  12. package/dist/tsup/{chunk-HXJ5U2ZI.cjs.map → chunk-DGU2H5IJ.cjs.map} +1 -1
  13. package/dist/tsup/{chunk-NNCL4IBC.js → chunk-DU7V4SDK.js} +2 -2
  14. package/dist/tsup/{chunk-NNCL4IBC.js.map → chunk-DU7V4SDK.js.map} +1 -1
  15. package/dist/tsup/{chunk-Y5CFDGPA.cjs → chunk-EKERHPCE.cjs} +4 -4
  16. package/dist/tsup/{chunk-Y5CFDGPA.cjs.map → chunk-EKERHPCE.cjs.map} +1 -1
  17. package/dist/tsup/{chunk-JJUSO7GJ.cjs → chunk-G26OT2Q6.cjs} +3 -3
  18. package/dist/tsup/{chunk-JJUSO7GJ.cjs.map → chunk-G26OT2Q6.cjs.map} +1 -1
  19. package/dist/tsup/{chunk-SW33HMM5.js → chunk-GAFMEUAL.js} +3 -3
  20. package/dist/tsup/{chunk-FT6VRK4C.js → chunk-MT4SROQM.js} +2 -2
  21. package/dist/tsup/{chunk-HRKFVQPS.js → chunk-SEKTNJU6.js} +4 -4
  22. package/dist/tsup/{chunk-D7DWNYEO.js → chunk-T7DJZSPH.js} +2 -2
  23. package/dist/tsup/{chunk-2CTZU7GL.js → chunk-TTMWSZZA.js} +2 -2
  24. package/dist/tsup/{chunk-HFGXV2CC.cjs → chunk-X567WA3N.cjs} +10 -10
  25. package/dist/tsup/{chunk-HFGXV2CC.cjs.map → chunk-X567WA3N.cjs.map} +1 -1
  26. package/dist/tsup/{chunk-22S5RCCJ.cjs → chunk-XLD6TRSE.cjs} +3 -3
  27. package/dist/tsup/{chunk-22S5RCCJ.cjs.map → chunk-XLD6TRSE.cjs.map} +1 -1
  28. package/dist/tsup/{chunk-NG5CUXMM.cjs → chunk-YJ2X5STT.cjs} +143 -143
  29. package/dist/tsup/{chunk-NG5CUXMM.cjs.map → chunk-YJ2X5STT.cjs.map} +1 -1
  30. package/dist/tsup/{chunk-F5PWAGS7.js → chunk-YNAEH775.js} +2 -2
  31. package/dist/tsup/client/mod.cjs +5 -5
  32. package/dist/tsup/client/mod.d.cts +3 -3
  33. package/dist/tsup/client/mod.d.ts +3 -3
  34. package/dist/tsup/client/mod.js +4 -4
  35. package/dist/tsup/common/log.cjs +2 -2
  36. package/dist/tsup/common/log.js +1 -1
  37. package/dist/tsup/common/websocket.cjs +3 -3
  38. package/dist/tsup/common/websocket.js +2 -2
  39. package/dist/tsup/{config-CBTr4IhE.d.cts → config-BfG1qpYz.d.cts} +34 -50
  40. package/dist/tsup/{config-CBTr4IhE.d.ts → config-BfG1qpYz.d.ts} +34 -50
  41. package/dist/tsup/{config-BiiS5T5M.d.ts → config-CASGH-5t.d.ts} +16 -1
  42. package/dist/tsup/{config-BnMhcPHl.d.cts → config-RMLak20L.d.cts} +16 -1
  43. package/dist/tsup/{context-iMxXq_Lt.d.ts → context-C1tMYvV-.d.ts} +2 -2
  44. package/dist/tsup/{context-DVE8XMm1.d.cts → context-CxNE2KvK.d.cts} +2 -2
  45. package/dist/tsup/db/drizzle.cjs +2 -2
  46. package/dist/tsup/db/drizzle.d.cts +1 -1
  47. package/dist/tsup/db/drizzle.d.ts +1 -1
  48. package/dist/tsup/db/drizzle.js +1 -1
  49. package/dist/tsup/db/mod.cjs +3 -3
  50. package/dist/tsup/db/mod.d.cts +2 -2
  51. package/dist/tsup/db/mod.d.ts +2 -2
  52. package/dist/tsup/db/mod.js +2 -2
  53. package/dist/tsup/dynamic/mod.d.cts +2 -2
  54. package/dist/tsup/dynamic/mod.d.ts +2 -2
  55. package/dist/tsup/inspector/mod.cjs +5 -5
  56. package/dist/tsup/inspector/mod.js +4 -4
  57. package/dist/tsup/inspector/workflow.cjs +4 -4
  58. package/dist/tsup/inspector/workflow.js +3 -3
  59. package/dist/tsup/inspector-tab/mod.d.cts +3 -3
  60. package/dist/tsup/inspector-tab/mod.d.ts +3 -3
  61. package/dist/tsup/mod.cjs +380 -121
  62. package/dist/tsup/mod.cjs.map +1 -1
  63. package/dist/tsup/mod.d.cts +4 -4
  64. package/dist/tsup/mod.d.ts +4 -4
  65. package/dist/tsup/mod.js +300 -41
  66. package/dist/tsup/mod.js.map +1 -1
  67. package/dist/tsup/test/mod.cjs +6 -6
  68. package/dist/tsup/test/mod.d.cts +2 -2
  69. package/dist/tsup/test/mod.d.ts +2 -2
  70. package/dist/tsup/test/mod.js +4 -4
  71. package/dist/tsup/unstable/migrations.d.cts +1 -1
  72. package/dist/tsup/unstable/migrations.d.ts +1 -1
  73. package/dist/tsup/utils.cjs +2 -2
  74. package/dist/tsup/utils.js +1 -1
  75. package/dist/tsup/workflow/mod.cjs +7 -7
  76. package/dist/tsup/workflow/mod.cjs.map +1 -1
  77. package/dist/tsup/workflow/mod.d.cts +4 -4
  78. package/dist/tsup/workflow/mod.d.ts +4 -4
  79. package/dist/tsup/workflow/mod.js +4 -4
  80. package/package.json +9 -9
  81. package/src/common/database/config.ts +46 -50
  82. package/src/common/database/native-database.ts +230 -21
  83. package/src/db/mod.ts +0 -1
  84. package/src/registry/napi-runtime.ts +78 -0
  85. package/src/registry/native.ts +57 -17
  86. package/src/registry/runtime.ts +52 -0
  87. package/src/registry/wasm-runtime.ts +88 -0
  88. /package/dist/tsup/{chunk-QQIFRR3B.js.map → chunk-3ZKCK6NL.js.map} +0 -0
  89. /package/dist/tsup/{chunk-SW33HMM5.js.map → chunk-GAFMEUAL.js.map} +0 -0
  90. /package/dist/tsup/{chunk-FT6VRK4C.js.map → chunk-MT4SROQM.js.map} +0 -0
  91. /package/dist/tsup/{chunk-HRKFVQPS.js.map → chunk-SEKTNJU6.js.map} +0 -0
  92. /package/dist/tsup/{chunk-D7DWNYEO.js.map → chunk-T7DJZSPH.js.map} +0 -0
  93. /package/dist/tsup/{chunk-2CTZU7GL.js.map → chunk-TTMWSZZA.js.map} +0 -0
  94. /package/dist/tsup/{chunk-F5PWAGS7.js.map → chunk-YNAEH775.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 _chunkEKERHPCEcjs = require('./chunk-EKERHPCE.cjs');
3
4
 
4
5
 
5
6
 
@@ -14,10 +15,9 @@
14
15
 
15
16
 
16
17
 
17
- var _chunkSSF2XC33cjs = require('./chunk-SSF2XC33.cjs');
18
18
 
19
19
 
20
- var _chunkY5CFDGPAcjs = require('./chunk-Y5CFDGPA.cjs');
20
+ var _chunkSSF2XC33cjs = require('./chunk-SSF2XC33.cjs');
21
21
 
22
22
 
23
23
 
@@ -35,17 +35,17 @@ var _chunkY5CFDGPAcjs = require('./chunk-Y5CFDGPA.cjs');
35
35
 
36
36
 
37
37
 
38
- var _chunkNG5CUXMMcjs = require('./chunk-NG5CUXMM.cjs');
38
+ var _chunkYJ2X5STTcjs = require('./chunk-YJ2X5STT.cjs');
39
39
 
40
40
 
41
41
 
42
42
  var _chunkRTWH3AX3cjs = require('./chunk-RTWH3AX3.cjs');
43
- require('./chunk-JJUSO7GJ.cjs');
43
+ require('./chunk-G26OT2Q6.cjs');
44
44
 
45
45
 
46
46
 
47
47
 
48
- var _chunk22S5RCCJcjs = require('./chunk-22S5RCCJ.cjs');
48
+ var _chunkXLD6TRSEcjs = require('./chunk-XLD6TRSE.cjs');
49
49
  require('./chunk-KVFIONKQ.cjs');
50
50
 
51
51
 
@@ -80,7 +80,7 @@ require('./chunk-KVFIONKQ.cjs');
80
80
 
81
81
 
82
82
 
83
- var _chunkY4QLVCCScjs = require('./chunk-Y4QLVCCS.cjs');
83
+ var _chunk6UDO6UYMcjs = require('./chunk-6UDO6UYM.cjs');
84
84
 
85
85
 
86
86
 
@@ -98,7 +98,7 @@ var _chunkMGI2VVF6cjs = require('./chunk-MGI2VVF6.cjs');
98
98
 
99
99
  // src/actor/log.ts
100
100
  function loggerWithoutContext() {
101
- return _chunkY4QLVCCScjs.getLogger.call(void 0, "actor-runtime");
101
+ return _chunk6UDO6UYMcjs.getLogger.call(void 0, "actor-runtime");
102
102
  }
103
103
 
104
104
  // src/actor/definition.ts
@@ -240,7 +240,7 @@ function validateSchemaSync(schemas, key, data) {
240
240
  var _virtualwebsocket = require('@rivetkit/virtual-websocket');
241
241
  var _ws = require('hono/ws');
242
242
  function logger() {
243
- return _chunkY4QLVCCScjs.getLogger.call(void 0, "inline-websocket-adapter");
243
+ return _chunk6UDO6UYMcjs.getLogger.call(void 0, "inline-websocket-adapter");
244
244
  }
245
245
  var InlineWebSocketAdapter = class {
246
246
  #handler;
@@ -392,7 +392,7 @@ var InlineWebSocketAdapter = class {
392
392
 
393
393
  // src/registry/log.ts
394
394
  function logger2() {
395
- return _chunkY4QLVCCScjs.getLogger.call(void 0, "registry");
395
+ return _chunk6UDO6UYMcjs.getLogger.call(void 0, "registry");
396
396
  }
397
397
 
398
398
  // src/serverless/configure.ts
@@ -438,8 +438,8 @@ async function configureServerlessPool(config) {
438
438
  );
439
439
  }
440
440
  const customConfig = config.configurePool;
441
- const clientConfig = _chunkNG5CUXMMcjs.convertRegistryConfigToClientConfig.call(void 0, config);
442
- const dcsRes = await _chunkNG5CUXMMcjs.getDatacenters.call(void 0, clientConfig);
441
+ const clientConfig = _chunkYJ2X5STTcjs.convertRegistryConfigToClientConfig.call(void 0, config);
442
+ const dcsRes = await _chunkYJ2X5STTcjs.getDatacenters.call(void 0, clientConfig);
443
443
  const poolName = _nullishCoalesce(customConfig.name, () => ( "default"));
444
444
  const serverlessToken = _nullishCoalesce(config.token, () => ( config.publicToken));
445
445
  const headers = {
@@ -461,7 +461,7 @@ async function configureServerlessPool(config) {
461
461
  metadata: _nullishCoalesce(customConfig.metadata, () => ( {})),
462
462
  drain_on_version_upgrade: _nullishCoalesce(customConfig.drainOnVersionUpgrade, () => ( true))
463
463
  };
464
- await _chunkNG5CUXMMcjs.updateRunnerConfig.call(void 0, clientConfig, poolName, {
464
+ await _chunkYJ2X5STTcjs.updateRunnerConfig.call(void 0, clientConfig, poolName, {
465
465
  datacenters: Object.fromEntries(
466
466
  dcsRes.datacenters.map((dc) => [dc.name, serverlessConfig])
467
467
  )
@@ -478,7 +478,7 @@ async function configureServerlessPool(config) {
478
478
  logger2().warn({
479
479
  msg: "serverless pool configuration attempt failed",
480
480
  attempts,
481
- error: _chunkY4QLVCCScjs.stringifyError.call(void 0, error)
481
+ error: _chunk6UDO6UYMcjs.stringifyError.call(void 0, error)
482
482
  });
483
483
  await sleep(CONFIGURE_RETRY_DELAY_MS);
484
484
  }
@@ -486,7 +486,7 @@ async function configureServerlessPool(config) {
486
486
  logger2().error({
487
487
  msg: "failed to configure serverless pool, validate endpoint is configured correctly then restart this process",
488
488
  attempts,
489
- error: _chunkY4QLVCCScjs.stringifyError.call(void 0, lastError)
489
+ error: _chunk6UDO6UYMcjs.stringifyError.call(void 0, lastError)
490
490
  });
491
491
  throw lastError;
492
492
  }
@@ -497,10 +497,10 @@ var _zod = require('zod');
497
497
  // src/registry/config/envoy.ts
498
498
  var _v4 = require('zod/v4');
499
499
  var EnvoyConfigSchema = _v4.z.object({
500
- poolName: _v4.z.string().default(() => _nullishCoalesce(_chunkY4QLVCCScjs.getRivetPool.call(void 0, ), () => ( "default"))),
501
- version: _v4.z.number().default(() => _nullishCoalesce(_chunkY4QLVCCScjs.getRivetEnvoyVersion.call(void 0, ), () => ( 1))),
500
+ poolName: _v4.z.string().default(() => _nullishCoalesce(_chunk6UDO6UYMcjs.getRivetPool.call(void 0, ), () => ( "default"))),
501
+ version: _v4.z.number().default(() => _nullishCoalesce(_chunk6UDO6UYMcjs.getRivetEnvoyVersion.call(void 0, ), () => ( 1))),
502
502
  // Deprecated.
503
- totalSlots: _v4.z.number().default(() => _nullishCoalesce(_chunkY4QLVCCScjs.getRivetTotalSlots.call(void 0, ), () => ( 1e5))),
503
+ totalSlots: _v4.z.number().default(() => _nullishCoalesce(_chunk6UDO6UYMcjs.getRivetTotalSlots.call(void 0, ), () => ( 1e5))),
504
504
  nodeKey: _v4.z.string().optional()
505
505
  });
506
506
 
@@ -538,7 +538,7 @@ var ServerlessConfigSchema = _v4.z.object({
538
538
  *
539
539
  * Can also be set via RIVET_PUBLIC_ENDPOINT environment variable.
540
540
  */
541
- publicEndpoint: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkY4QLVCCScjs.getRivetPublicEndpoint.call(void 0, )))),
541
+ publicEndpoint: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunk6UDO6UYMcjs.getRivetPublicEndpoint.call(void 0, )))),
542
542
  /**
543
543
  * Token that clients should use when connecting via the public endpoint.
544
544
  *
@@ -546,7 +546,7 @@ var ServerlessConfigSchema = _v4.z.object({
546
546
  *
547
547
  * Can also be specified in the publicEndpoint URL as `https://namespace:token@host`.
548
548
  */
549
- publicToken: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkY4QLVCCScjs.getRivetPublicToken.call(void 0, ))))
549
+ publicToken: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunk6UDO6UYMcjs.getRivetPublicToken.call(void 0, ))))
550
550
  // There is no publicNamespace config option because the frontend and backend
551
551
  // cannot use different namespaces. The namespace is extracted from the
552
552
  // publicEndpoint URL auth syntax if provided.
@@ -600,7 +600,7 @@ var RegistryConfigSchema = _zod.z.object({
600
600
  * Runtime binding to use for RivetKit core.
601
601
  * */
602
602
  runtime: RuntimeKindSchema.optional().transform((val, ctx) => {
603
- const rawRuntime = _nullishCoalesce(val, () => ( _chunkY4QLVCCScjs.getRivetkitRuntime.call(void 0, )));
603
+ const rawRuntime = _nullishCoalesce(val, () => ( _chunk6UDO6UYMcjs.getRivetkitRuntime.call(void 0, )));
604
604
  if (rawRuntime === void 0) {
605
605
  return "auto";
606
606
  }
@@ -637,7 +637,7 @@ var RegistryConfigSchema = _zod.z.object({
637
637
  * */
638
638
  logging: _zod.z.object({
639
639
  baseLogger: _zod.z.custom().optional(),
640
- level: _chunkY4QLVCCScjs.LogLevelSchema.optional()
640
+ level: _chunk6UDO6UYMcjs.LogLevelSchema.optional()
641
641
  }).optional().default(() => ({})),
642
642
  // MARK: Routing
643
643
  // // This is a function to allow for lazy configuration of upgradeWebSocket on the
@@ -655,9 +655,9 @@ var RegistryConfigSchema = _zod.z.object({
655
655
  *
656
656
  * Can also be set via RIVET_ENDPOINT environment variables.
657
657
  */
658
- endpoint: _zod.z.string().optional().transform((val) => _nullishCoalesce(_nullishCoalesce(val, () => ( _chunkY4QLVCCScjs.getRivetEngine.call(void 0, ))), () => ( _chunkY4QLVCCScjs.getRivetEndpoint.call(void 0, )))),
659
- token: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkY4QLVCCScjs.getRivetToken.call(void 0, )))),
660
- namespace: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkY4QLVCCScjs.getRivetNamespace.call(void 0, )))),
658
+ endpoint: _zod.z.string().optional().transform((val) => _nullishCoalesce(_nullishCoalesce(val, () => ( _chunk6UDO6UYMcjs.getRivetEngine.call(void 0, ))), () => ( _chunk6UDO6UYMcjs.getRivetEndpoint.call(void 0, )))),
659
+ token: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunk6UDO6UYMcjs.getRivetToken.call(void 0, )))),
660
+ namespace: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunk6UDO6UYMcjs.getRivetNamespace.call(void 0, )))),
661
661
  headers: _zod.z.record(_zod.z.string(), _zod.z.string()).optional().default({}),
662
662
  // MARK: Client
663
663
  // TODO:
@@ -697,21 +697,21 @@ var RegistryConfigSchema = _zod.z.object({
697
697
  *
698
698
  * Starts the full Rust engine process locally.
699
699
  */
700
- startEngine: _zod.z.boolean().default(() => _chunkY4QLVCCScjs.getRivetRunEngine.call(void 0, )),
700
+ startEngine: _zod.z.boolean().default(() => _chunk6UDO6UYMcjs.getRivetRunEngine.call(void 0, )),
701
701
  /**
702
702
  * @experimental
703
703
  *
704
704
  * Host to bind the spawned local engine process to.
705
705
  */
706
- engineHost: _zod.z.string().optional().default(() => _nullishCoalesce(_chunkY4QLVCCScjs.getRivetRunEngineHost.call(void 0, ), () => ( _chunkNG5CUXMMcjs.ENGINE_HOST))),
706
+ engineHost: _zod.z.string().optional().default(() => _nullishCoalesce(_chunk6UDO6UYMcjs.getRivetRunEngineHost.call(void 0, ), () => ( _chunkYJ2X5STTcjs.ENGINE_HOST))),
707
707
  /**
708
708
  * @experimental
709
709
  *
710
710
  * Port to bind the spawned local engine process to.
711
711
  */
712
- enginePort: _zod.z.number().int().min(1).max(65535).optional().default(() => _nullishCoalesce(_chunkY4QLVCCScjs.getRivetRunEnginePort.call(void 0, ), () => ( _chunkNG5CUXMMcjs.ENGINE_PORT))),
712
+ enginePort: _zod.z.number().int().min(1).max(65535).optional().default(() => _nullishCoalesce(_chunk6UDO6UYMcjs.getRivetRunEnginePort.call(void 0, ), () => ( _chunkYJ2X5STTcjs.ENGINE_PORT))),
713
713
  /** @experimental */
714
- engineVersion: _zod.z.string().optional().default(() => _nullishCoalesce(_chunkY4QLVCCScjs.getRivetRunEngineVersion.call(void 0, ), () => ( _chunkY4QLVCCScjs.VERSION))),
714
+ engineVersion: _zod.z.string().optional().default(() => _nullishCoalesce(_chunk6UDO6UYMcjs.getRivetRunEngineVersion.call(void 0, ), () => ( _chunk6UDO6UYMcjs.VERSION))),
715
715
  /**
716
716
  * Starts the first-party Services actor host when RivetKit manages
717
717
  * a local engine. Enabled by default for a managed local Engine. Set
@@ -768,7 +768,7 @@ var RegistryConfigSchema = _zod.z.object({
768
768
  }))
769
769
  }).transform((config, ctx) => {
770
770
  var _a, _b, _c;
771
- const isDevEnv = _chunkY4QLVCCScjs.isDev.call(void 0, );
771
+ const isDevEnv = _chunk6UDO6UYMcjs.isDev.call(void 0, );
772
772
  const sqliteBackend = _nullishCoalesce(((_a = config.sqlite) == null ? void 0 : _a.backend), () => ( ((_b = config.test) == null ? void 0 : _b.sqliteBackend)));
773
773
  if (config.runtime === "wasm" && sqliteBackend === "local") {
774
774
  ctx.addIssue({
@@ -778,7 +778,7 @@ var RegistryConfigSchema = _zod.z.object({
778
778
  });
779
779
  }
780
780
  const sqlite = config.runtime === "wasm" && config.sqlite === void 0 ? { backend: "remote" } : config.sqlite;
781
- const parsedEndpoint = config.endpoint ? _chunkNG5CUXMMcjs.tryParseEndpoint.call(void 0, ctx, {
781
+ const parsedEndpoint = config.endpoint ? _chunkYJ2X5STTcjs.tryParseEndpoint.call(void 0, ctx, {
782
782
  endpoint: config.endpoint,
783
783
  path: ["endpoint"],
784
784
  namespace: config.namespace,
@@ -797,19 +797,19 @@ var RegistryConfigSchema = _zod.z.object({
797
797
  path: ["configurePool"]
798
798
  });
799
799
  }
800
- const localEngineEndpoint = _chunkNG5CUXMMcjs.buildEngineEndpoint.call(void 0,
800
+ const localEngineEndpoint = _chunkYJ2X5STTcjs.buildEngineEndpoint.call(void 0,
801
801
  config.engineHost,
802
802
  config.enginePort
803
803
  );
804
804
  const endpoint = config.startEngine ? localEngineEndpoint : _nullishCoalesce((parsedEndpoint == null ? void 0 : parsedEndpoint.endpoint), () => ( (isDevEnv ? localEngineEndpoint : void 0)));
805
805
  const engineSpawn = !parsedEndpoint && Boolean(endpoint);
806
- const startServices = _nullishCoalesce(_nullishCoalesce(config.startServices, () => ( _chunkY4QLVCCScjs.getRivetRunServices.call(void 0, ))), () => ( engineSpawn));
806
+ const startServices = _nullishCoalesce(_nullishCoalesce(config.startServices, () => ( _chunk6UDO6UYMcjs.getRivetRunServices.call(void 0, ))), () => ( engineSpawn));
807
807
  const validateServerlessEndpoint = Boolean(
808
808
  config.startEngine || parsedEndpoint
809
809
  );
810
810
  const namespace = _nullishCoalesce(_nullishCoalesce((parsedEndpoint == null ? void 0 : parsedEndpoint.namespace), () => ( config.namespace)), () => ( "default"));
811
- const token = _nullishCoalesce(_nullishCoalesce((parsedEndpoint == null ? void 0 : parsedEndpoint.token), () => ( config.token)), () => ( (endpoint && _chunkNG5CUXMMcjs.isLocalEngineEndpoint.call(void 0, endpoint) ? "default" : void 0)));
812
- const parsedPublicEndpoint = config.serverless.publicEndpoint ? _chunkNG5CUXMMcjs.tryParseEndpoint.call(void 0, ctx, {
811
+ const token = _nullishCoalesce(_nullishCoalesce((parsedEndpoint == null ? void 0 : parsedEndpoint.token), () => ( config.token)), () => ( (endpoint && _chunkYJ2X5STTcjs.isLocalEngineEndpoint.call(void 0, endpoint) ? "default" : void 0)));
812
+ const parsedPublicEndpoint = config.serverless.publicEndpoint ? _chunkYJ2X5STTcjs.tryParseEndpoint.call(void 0, ctx, {
813
813
  endpoint: config.serverless.publicEndpoint,
814
814
  path: ["serverless", "publicEndpoint"]
815
815
  }) : void 0;
@@ -914,7 +914,7 @@ var DocRegistryConfigSchema = _zod.z.object({
914
914
  noWelcome: _zod.z.boolean().optional().describe("Disable the welcome message on startup. Default: false"),
915
915
  sqlite: DocSqliteConfigSchema,
916
916
  logging: _zod.z.object({
917
- level: _chunkY4QLVCCScjs.LogLevelSchema.optional().describe(
917
+ level: _chunk6UDO6UYMcjs.LogLevelSchema.optional().describe(
918
918
  "Log level for RivetKit. Default: 'warn'"
919
919
  )
920
920
  }).optional().describe("Logging configuration."),
@@ -956,6 +956,10 @@ var DocRegistryConfigSchema = _zod.z.object({
956
956
 
957
957
 
958
958
  // src/common/database/native-database.ts
959
+ function isSynchronousTransaction(transaction) {
960
+ const candidate = transaction;
961
+ return typeof candidate.commitSync === "function" && typeof candidate.rollbackSync === "function";
962
+ }
959
963
  function shouldAttachNativeKvError(message) {
960
964
  return /i\/o error|unable to open database file/i.test(message);
961
965
  }
@@ -976,13 +980,16 @@ function toNativeBinding(arg) {
976
980
  if (arg === null || arg === void 0) {
977
981
  return { kind: "null" };
978
982
  }
979
- if (typeof arg === "bigint") {
980
- return { kind: "int", intValue: Number(arg) };
983
+ if (typeof arg === "bigint" || typeof arg === "number" && Number.isInteger(arg)) {
984
+ const value = Number(arg);
985
+ if (!Number.isSafeInteger(value)) {
986
+ throw new RangeError(
987
+ "SQLite integer bindings must be within the JavaScript safe integer range."
988
+ );
989
+ }
990
+ return { kind: "int", intValue: value };
981
991
  }
982
992
  if (typeof arg === "number") {
983
- if (Number.isInteger(arg)) {
984
- return { kind: "int", intValue: arg };
985
- }
986
993
  return { kind: "float", floatValue: arg };
987
994
  }
988
995
  if (typeof arg === "string") {
@@ -999,9 +1006,10 @@ function toNativeBinding(arg) {
999
1006
  function extractNamedSqliteParameters(sql) {
1000
1007
  const orderedNames = [];
1001
1008
  const seen = /* @__PURE__ */ new Set();
1002
- const pattern = /([:@$][A-Za-z_][A-Za-z0-9_]*)/g;
1009
+ const pattern = /'(?:''|[^'])*'|"(?:""|[^"])*"|`(?:``|[^`])*`|\[[^\]]*\]|--[^\n]*|\/\*[\s\S]*?(?:\*\/|$)|([:@$][\w$\u0080-\u{10FFFF}]+(?:::[\w$\u0080-\u{10FFFF}]+)*(?:\([^)]*\))?)|[A-Za-z_\u0080-\u{10FFFF}][\w$\u0080-\u{10FFFF}]*/gu;
1003
1010
  for (const match of sql.matchAll(pattern)) {
1004
1011
  const name = match[1];
1012
+ if (!name) continue;
1005
1013
  if (seen.has(name)) {
1006
1014
  continue;
1007
1015
  }
@@ -1120,20 +1128,44 @@ function wrapJsNativeDatabase(database) {
1120
1128
  let terminalPromise;
1121
1129
  let lastInsertRowId = null;
1122
1130
  const executeNative = async (sql, params) => {
1123
- const lastInsertRowIdColumn = lastInsertRowIdColumnName(sql);
1124
- if (lastInsertRowIdColumn) {
1125
- return {
1126
- columns: [lastInsertRowIdColumn],
1127
- rows: [[_nullishCoalesce(lastInsertRowId, () => ( 0))]],
1128
- changes: 0,
1129
- lastInsertRowId
1130
- };
1131
- }
1132
1131
  const release = gate.enter();
1133
1132
  try {
1133
+ const lastInsertRowIdColumn = lastInsertRowIdColumnName(sql);
1134
+ if (lastInsertRowIdColumn) {
1135
+ return {
1136
+ columns: [lastInsertRowIdColumn],
1137
+ rows: [[_nullishCoalesce(lastInsertRowId, () => ( 0))]],
1138
+ changes: 0,
1139
+ lastInsertRowId
1140
+ };
1141
+ }
1134
1142
  const nativeParams = toNativeBindings(sql, params);
1135
1143
  const result = await database.execute(sql, nativeParams);
1136
- if (result.lastInsertRowId !== void 0) {
1144
+ if (result.lastInsertRowId != null) {
1145
+ lastInsertRowId = result.lastInsertRowId;
1146
+ }
1147
+ return result;
1148
+ } catch (error) {
1149
+ enrichNativeDatabaseError(database, error);
1150
+ } finally {
1151
+ release();
1152
+ }
1153
+ };
1154
+ const executeNativeSync = (sql, params) => {
1155
+ const release = gate.enter();
1156
+ try {
1157
+ const nativeParams = toNativeBindings(sql, params);
1158
+ const result = database.executeSync(sql, nativeParams);
1159
+ const rowIdColumn = lastInsertRowIdColumnName(sql);
1160
+ if (rowIdColumn) {
1161
+ return {
1162
+ columns: [rowIdColumn],
1163
+ rows: [[_nullishCoalesce(lastInsertRowId, () => ( 0))]],
1164
+ changes: 0,
1165
+ lastInsertRowId
1166
+ };
1167
+ }
1168
+ if (result.lastInsertRowId != null) {
1137
1169
  lastInsertRowId = result.lastInsertRowId;
1138
1170
  }
1139
1171
  return result;
@@ -1161,9 +1193,28 @@ function wrapJsNativeDatabase(database) {
1161
1193
  callback(row, result.columns);
1162
1194
  }
1163
1195
  },
1196
+ execSync(sql, callback) {
1197
+ const release = gate.enter();
1198
+ let result;
1199
+ try {
1200
+ result = database.execSync(sql);
1201
+ } catch (error) {
1202
+ enrichNativeDatabaseError(database, error);
1203
+ } finally {
1204
+ release();
1205
+ }
1206
+ if (callback) {
1207
+ for (const row of result.rows) {
1208
+ callback(row, result.columns);
1209
+ }
1210
+ }
1211
+ },
1164
1212
  async execute(sql, params) {
1165
1213
  return await executeNative(sql, params);
1166
1214
  },
1215
+ executeSync(sql, params) {
1216
+ return executeNativeSync(sql, params);
1217
+ },
1167
1218
  async executeBatch(statements) {
1168
1219
  const nativeStatements = statements.map(toNativeBatchStatement);
1169
1220
  const release = gate.enter();
@@ -1185,7 +1236,7 @@ function wrapJsNativeDatabase(database) {
1185
1236
  return transactionResults;
1186
1237
  })();
1187
1238
  for (const result of results) {
1188
- if (result.lastInsertRowId !== void 0) {
1239
+ if (result.lastInsertRowId != null) {
1189
1240
  lastInsertRowId = result.lastInsertRowId;
1190
1241
  }
1191
1242
  }
@@ -1213,7 +1264,23 @@ function wrapJsNativeDatabase(database) {
1213
1264
  release();
1214
1265
  }
1215
1266
  return wrapTransaction(database, transaction, gate, (result) => {
1216
- if (result.lastInsertRowId !== void 0) {
1267
+ if (result.lastInsertRowId != null) {
1268
+ lastInsertRowId = result.lastInsertRowId;
1269
+ }
1270
+ });
1271
+ },
1272
+ beginTransactionSync(timeoutMs, name) {
1273
+ const release = gate.enter();
1274
+ let transaction;
1275
+ try {
1276
+ transaction = database.beginTransactionSync(timeoutMs, name);
1277
+ } catch (error) {
1278
+ enrichNativeDatabaseError(database, error);
1279
+ } finally {
1280
+ release();
1281
+ }
1282
+ return wrapTransaction(database, transaction, gate, (result) => {
1283
+ if (result.lastInsertRowId != null) {
1217
1284
  lastInsertRowId = result.lastInsertRowId;
1218
1285
  }
1219
1286
  });
@@ -1235,7 +1302,7 @@ function wrapJsNativeDatabase(database) {
1235
1302
  release();
1236
1303
  }
1237
1304
  return wrapTransaction(database, transaction, gate, (result) => {
1238
- if (result.lastInsertRowId !== void 0) {
1305
+ if (result.lastInsertRowId != null) {
1239
1306
  lastInsertRowId = result.lastInsertRowId;
1240
1307
  }
1241
1308
  });
@@ -1251,6 +1318,25 @@ function wrapJsNativeDatabase(database) {
1251
1318
  var _a;
1252
1319
  return normalizeNativeMetrics((_a = database.metrics) == null ? void 0 : _a.call(database));
1253
1320
  },
1321
+ async open() {
1322
+ const release = gate.enter();
1323
+ try {
1324
+ await database.open();
1325
+ } catch (error) {
1326
+ enrichNativeDatabaseError(database, error);
1327
+ } finally {
1328
+ release();
1329
+ }
1330
+ },
1331
+ commitTicket() {
1332
+ return database.commitTicket();
1333
+ },
1334
+ async whenDurable(ticket) {
1335
+ await database.whenDurable(ticket);
1336
+ },
1337
+ abortGeneration(reason) {
1338
+ database.abortGeneration(reason);
1339
+ },
1254
1340
  async close() {
1255
1341
  terminalPromise ??= gate.close(() => database.close());
1256
1342
  await terminalPromise;
@@ -1262,7 +1348,7 @@ function wrapJsNativeDatabase(database) {
1262
1348
  };
1263
1349
  }
1264
1350
  function wrapTransaction(database, transaction, gate, onExecute) {
1265
- return {
1351
+ const wrapped = {
1266
1352
  async exec(sql, callback) {
1267
1353
  const release = gate.enter();
1268
1354
  let result;
@@ -1313,6 +1399,61 @@ function wrapTransaction(database, transaction, gate, onExecute) {
1313
1399
  }
1314
1400
  }
1315
1401
  };
1402
+ if (isSynchronousTransaction(transaction)) {
1403
+ return Object.assign(wrapped, {
1404
+ execSync(sql, callback) {
1405
+ const release = gate.enter();
1406
+ let result;
1407
+ try {
1408
+ result = transaction.execSync(sql);
1409
+ } catch (error) {
1410
+ enrichNativeDatabaseError(database, error);
1411
+ } finally {
1412
+ release();
1413
+ }
1414
+ if (callback) {
1415
+ for (const row of result.rows)
1416
+ callback(row, result.columns);
1417
+ }
1418
+ },
1419
+ executeSync(sql, params) {
1420
+ const release = gate.enter();
1421
+ try {
1422
+ const result = transaction.executeSync(
1423
+ sql,
1424
+ toNativeBindings(sql, params)
1425
+ );
1426
+ onExecute(result);
1427
+ return result;
1428
+ } catch (error) {
1429
+ enrichNativeDatabaseError(database, error);
1430
+ } finally {
1431
+ release();
1432
+ }
1433
+ },
1434
+ commitSync() {
1435
+ const release = gate.enter();
1436
+ try {
1437
+ transaction.commitSync();
1438
+ } catch (error) {
1439
+ enrichNativeDatabaseError(database, error);
1440
+ } finally {
1441
+ release();
1442
+ }
1443
+ },
1444
+ rollbackSync() {
1445
+ const release = gate.enter();
1446
+ try {
1447
+ transaction.rollbackSync();
1448
+ } catch (error) {
1449
+ enrichNativeDatabaseError(database, error);
1450
+ } finally {
1451
+ release();
1452
+ }
1453
+ }
1454
+ });
1455
+ }
1456
+ return wrapped;
1316
1457
  }
1317
1458
  function lastInsertRowIdColumnName(sql) {
1318
1459
  const match = sql.match(
@@ -1554,7 +1695,7 @@ var NapiCoreRuntime = (_class = class {
1554
1695
  if (!(active == null ? void 0 : active.sameActorInstance(ownerCtx))) {
1555
1696
  return ownerCtx;
1556
1697
  }
1557
- const applicationSpan = _chunkNG5CUXMMcjs.readActiveTraceHeaders.call(void 0, );
1698
+ const applicationSpan = _chunkYJ2X5STTcjs.readActiveTraceHeaders.call(void 0, );
1558
1699
  if (!applicationSpan) {
1559
1700
  return active;
1560
1701
  }
@@ -1758,7 +1899,7 @@ var NapiCoreRuntime = (_class = class {
1758
1899
  const span = (_a = nativeCtx.invocationTraceContext()) == null ? void 0 : _a.span;
1759
1900
  return this.#invocationContext.run(
1760
1901
  nativeCtx,
1761
- () => _chunkNG5CUXMMcjs.runWithActorInvocationSpan.call(void 0, span, run)
1902
+ () => _chunkYJ2X5STTcjs.runWithActorInvocationSpan.call(void 0, span, run)
1762
1903
  );
1763
1904
  }
1764
1905
  actorInvocationTraceContext(ctx) {
@@ -1897,6 +2038,9 @@ var NapiCoreRuntime = (_class = class {
1897
2038
  async actorSqlExec(ctx, sql) {
1898
2039
  return await this.#actorSql(ctx).exec(sql);
1899
2040
  }
2041
+ actorSqlExecSync(ctx, sql) {
2042
+ return this.#actorSql(ctx).execSync(sql);
2043
+ }
1900
2044
  async actorSqlExecute(ctx, sql, params) {
1901
2045
  const result = await this.#actorSql(ctx).execute(
1902
2046
  sql,
@@ -1904,6 +2048,13 @@ var NapiCoreRuntime = (_class = class {
1904
2048
  );
1905
2049
  return normalizeRuntimeSqlExecuteResult(result);
1906
2050
  }
2051
+ actorSqlExecuteSync(ctx, sql, params) {
2052
+ const result = this.#actorSql(ctx).executeSync(
2053
+ sql,
2054
+ toNapiSqlBindParams(params)
2055
+ );
2056
+ return normalizeRuntimeSqlExecuteResult(result);
2057
+ }
1907
2058
  async actorSqlExecuteBatch(ctx, statements) {
1908
2059
  const results = await this.#actorSql(ctx).executeBatch(
1909
2060
  statements.map(toNapiSqlBatchStatement)
@@ -1916,9 +2067,18 @@ var NapiCoreRuntime = (_class = class {
1916
2067
  name
1917
2068
  );
1918
2069
  }
2070
+ actorSqlBeginTransactionSync(ctx, timeoutMs, name) {
2071
+ return this.#actorSql(ctx).beginTransactionSync(
2072
+ timeoutMs,
2073
+ name
2074
+ );
2075
+ }
1919
2076
  async actorSqlTransactionExec(transaction, sql) {
1920
2077
  return await asNativeSqlTransaction(transaction).exec(sql);
1921
2078
  }
2079
+ actorSqlTransactionExecSync(transaction, sql) {
2080
+ return asNativeSqlTransaction(transaction).execSync(sql);
2081
+ }
1922
2082
  async actorSqlTransactionExecute(transaction, sql, params) {
1923
2083
  const result = await asNativeSqlTransaction(transaction).execute(
1924
2084
  sql,
@@ -1926,12 +2086,25 @@ var NapiCoreRuntime = (_class = class {
1926
2086
  );
1927
2087
  return normalizeRuntimeSqlExecuteResult(result);
1928
2088
  }
2089
+ actorSqlTransactionExecuteSync(transaction, sql, params) {
2090
+ const result = asNativeSqlTransaction(transaction).executeSync(
2091
+ sql,
2092
+ toNapiSqlBindParams(params)
2093
+ );
2094
+ return normalizeRuntimeSqlExecuteResult(result);
2095
+ }
1929
2096
  async actorSqlTransactionCommit(transaction) {
1930
2097
  await asNativeSqlTransaction(transaction).commit();
1931
2098
  }
2099
+ actorSqlTransactionCommitSync(transaction) {
2100
+ asNativeSqlTransaction(transaction).commitSync();
2101
+ }
1932
2102
  async actorSqlTransactionRollback(transaction) {
1933
2103
  await asNativeSqlTransaction(transaction).rollback();
1934
2104
  }
2105
+ actorSqlTransactionRollbackSync(transaction) {
2106
+ asNativeSqlTransaction(transaction).rollbackSync();
2107
+ }
1935
2108
  async actorBeginStateTransaction(ctx, timeoutMs) {
1936
2109
  return await this.#actorContextForOperation(ctx).beginStateTransaction(
1937
2110
  timeoutMs
@@ -1969,6 +2142,18 @@ var NapiCoreRuntime = (_class = class {
1969
2142
  var _a, _b;
1970
2143
  return _nullishCoalesce(((_b = (_a = this.#actorSql(ctx)).takeLastKvError) == null ? void 0 : _b.call(_a)), () => ( null));
1971
2144
  }
2145
+ async actorSqlOpen(ctx) {
2146
+ await this.#actorSql(ctx).open();
2147
+ }
2148
+ actorSqlCommitTicket(ctx) {
2149
+ return this.#actorSql(ctx).commitTicket();
2150
+ }
2151
+ actorSqlAbortGeneration(ctx, reason) {
2152
+ this.#actorSql(ctx).abortGeneration(reason);
2153
+ }
2154
+ async actorSqlWhenDurable(ctx, ticket) {
2155
+ await this.#actorSql(ctx).whenDurable(ticket);
2156
+ }
1972
2157
  async actorSqlClose(ctx) {
1973
2158
  const nativeCtx = asNativeActorContext(ctx);
1974
2159
  if (!this.#sqlOpened.delete(nativeCtx)) {
@@ -2133,8 +2318,8 @@ function runtimeBytesToArrayBuffer(value) {
2133
2318
  function buildNativeHttpRequest(init) {
2134
2319
  var _a;
2135
2320
  const headers = new Headers(init.headers);
2136
- const originalUrl = headers.get(_chunkNG5CUXMMcjs.HEADER_ORIGINAL_REQUEST_URL);
2137
- headers.delete(_chunkNG5CUXMMcjs.HEADER_ORIGINAL_REQUEST_URL);
2321
+ const originalUrl = headers.get(_chunkYJ2X5STTcjs.HEADER_ORIGINAL_REQUEST_URL);
2322
+ headers.delete(_chunkYJ2X5STTcjs.HEADER_ORIGINAL_REQUEST_URL);
2138
2323
  const url = _nullishCoalesce(originalUrl, () => ( (init.uri.startsWith("http") ? init.uri : new URL(init.uri, "http://127.0.0.1").toString())));
2139
2324
  const method2 = init.method.toUpperCase();
2140
2325
  const bodyForbidden = method2 === "GET" || method2 === "HEAD";
@@ -2213,7 +2398,7 @@ async function pumpResponseBody(reader, stream) {
2213
2398
  }
2214
2399
  } catch (error) {
2215
2400
  try {
2216
- await stream.error(_chunkY4QLVCCScjs.stringifyError.call(void 0, error));
2401
+ await stream.error(_chunk6UDO6UYMcjs.stringifyError.call(void 0, error));
2217
2402
  } catch (streamError) {
2218
2403
  logger2().debug({
2219
2404
  msg: "failed to report native http response stream error",
@@ -2552,6 +2737,17 @@ function optionalWasmNumber(value) {
2552
2737
  function wasmNumber(value) {
2553
2738
  return typeof value === "bigint" ? Number(value) : value;
2554
2739
  }
2740
+ function synchronousSqliteUnavailable() {
2741
+ throw new (0, _chunkMGI2VVF6cjs.RivetError)(
2742
+ "sqlite",
2743
+ "sync_unsupported",
2744
+ "Synchronous SQLite is unavailable because the actor runs on the wasm runtime.",
2745
+ {
2746
+ public: true,
2747
+ metadata: { runtime: "wasm" }
2748
+ }
2749
+ );
2750
+ }
2555
2751
  function normalizeKvEntry(entry) {
2556
2752
  return {
2557
2753
  key: toBytes(entry.key),
@@ -2703,6 +2899,14 @@ var WasmCoreRuntime = (_class2 = class {
2703
2899
  );
2704
2900
  }
2705
2901
  createActorFactory(callbacks, config) {
2902
+ if (config == null ? void 0 : config.sqliteDeferredCommits) {
2903
+ throw new (0, _chunkMGI2VVF6cjs.RivetError)(
2904
+ "sqlite",
2905
+ "deferred_commits_unsupported",
2906
+ "SQLite deferred commits require local native SQLite, but the wasm runtime uses remote SQLite.",
2907
+ { metadata: { runtime: "wasm" } }
2908
+ );
2909
+ }
2706
2910
  return callWasmSync(
2707
2911
  () => asActorFactoryHandle2(
2708
2912
  new this.#constructors.ActorFactory(callbacks, config)
@@ -2979,12 +3183,18 @@ var WasmCoreRuntime = (_class2 = class {
2979
3183
  async actorSqlExec(ctx, sql) {
2980
3184
  return await callWasm(() => this.#actorSql(ctx).exec(sql));
2981
3185
  }
3186
+ actorSqlExecSync(_ctx, _sql) {
3187
+ return synchronousSqliteUnavailable();
3188
+ }
2982
3189
  async actorSqlExecute(ctx, sql, params) {
2983
3190
  const result = await callWasm(
2984
3191
  () => this.#actorSql(ctx).execute(sql, params)
2985
3192
  );
2986
3193
  return normalizeRuntimeSqlExecuteResult(result);
2987
3194
  }
3195
+ actorSqlExecuteSync(_ctx, _sql, _params) {
3196
+ return synchronousSqliteUnavailable();
3197
+ }
2988
3198
  async actorSqlExecuteBatch(ctx, statements) {
2989
3199
  const results = await callWasm(
2990
3200
  () => this.#actorSql(ctx).executeBatch(statements)
@@ -2996,27 +3206,42 @@ var WasmCoreRuntime = (_class2 = class {
2996
3206
  () => this.#actorSql(ctx).beginTransaction(timeoutMs, name)
2997
3207
  );
2998
3208
  }
3209
+ actorSqlBeginTransactionSync(_ctx, _timeoutMs, _name) {
3210
+ return synchronousSqliteUnavailable();
3211
+ }
2999
3212
  async actorSqlTransactionExec(transaction, sql) {
3000
3213
  return await callWasm(
3001
3214
  () => transaction.exec(sql)
3002
3215
  );
3003
3216
  }
3217
+ actorSqlTransactionExecSync(_transaction, _sql) {
3218
+ return synchronousSqliteUnavailable();
3219
+ }
3004
3220
  async actorSqlTransactionExecute(transaction, sql, params) {
3005
3221
  const result = await callWasm(
3006
3222
  () => transaction.execute(sql, params)
3007
3223
  );
3008
3224
  return normalizeRuntimeSqlExecuteResult(result);
3009
3225
  }
3226
+ actorSqlTransactionExecuteSync(_transaction, _sql, _params) {
3227
+ return synchronousSqliteUnavailable();
3228
+ }
3010
3229
  async actorSqlTransactionCommit(transaction) {
3011
3230
  await callWasm(
3012
3231
  () => transaction.commit()
3013
3232
  );
3014
3233
  }
3234
+ actorSqlTransactionCommitSync(_transaction) {
3235
+ synchronousSqliteUnavailable();
3236
+ }
3015
3237
  async actorSqlTransactionRollback(transaction) {
3016
3238
  await callWasm(
3017
3239
  () => transaction.rollback()
3018
3240
  );
3019
3241
  }
3242
+ actorSqlTransactionRollbackSync(_transaction) {
3243
+ synchronousSqliteUnavailable();
3244
+ }
3020
3245
  async actorBeginStateTransaction(ctx, timeoutMs) {
3021
3246
  return await callWasm(
3022
3247
  () => asWasmActorContext(ctx).beginStateTransaction(timeoutMs)
@@ -3052,6 +3277,17 @@ var WasmCoreRuntime = (_class2 = class {
3052
3277
  var _a, _b;
3053
3278
  return _nullishCoalesce(((_b = (_a = this.#actorSql(ctx)).takeLastKvError) == null ? void 0 : _b.call(_a)), () => ( null));
3054
3279
  }
3280
+ async actorSqlOpen(_ctx) {
3281
+ }
3282
+ actorSqlCommitTicket(_ctx) {
3283
+ return synchronousSqliteUnavailable();
3284
+ }
3285
+ actorSqlAbortGeneration(_ctx, _reason) {
3286
+ synchronousSqliteUnavailable();
3287
+ }
3288
+ async actorSqlWhenDurable(_ctx, _ticket) {
3289
+ synchronousSqliteUnavailable();
3290
+ }
3055
3291
  async actorSqlClose(ctx) {
3056
3292
  const wasmCtx = asWasmActorContext(ctx);
3057
3293
  const database = this.#sql.get(wasmCtx);
@@ -3452,7 +3688,7 @@ async function loadAutoRuntime(config, loaders = defaultRuntimeLoaders) {
3452
3688
  nativeError = error;
3453
3689
  logger2().warn({
3454
3690
  msg: "native runtime failed to load; falling back to wasm",
3455
- error: _chunkY4QLVCCScjs.stringifyError.call(void 0, error)
3691
+ error: _chunk6UDO6UYMcjs.stringifyError.call(void 0, error)
3456
3692
  });
3457
3693
  }
3458
3694
  try {
@@ -3461,7 +3697,7 @@ async function loadAutoRuntime(config, loaders = defaultRuntimeLoaders) {
3461
3697
  throw new (0, _chunkMGI2VVF6cjs.RivetError)(
3462
3698
  "config",
3463
3699
  "runtime_unavailable",
3464
- `RivetKit could not load a core runtime. Native runtime: ${_chunkY4QLVCCScjs.stringifyError.call(void 0, nativeError)} Wasm runtime: ${_chunkY4QLVCCScjs.stringifyError.call(void 0, wasmError)}`,
3700
+ `RivetKit could not load a core runtime. Native runtime: ${_chunk6UDO6UYMcjs.stringifyError.call(void 0, nativeError)} Wasm runtime: ${_chunk6UDO6UYMcjs.stringifyError.call(void 0, wasmError)}`,
3465
3701
  {
3466
3702
  public: true,
3467
3703
  statusCode: 500
@@ -3669,7 +3905,7 @@ async function cleanupNativeSleepRuntimeState(runtime, ctx, afterTrackedWorkDrai
3669
3905
  }).catch((error) => {
3670
3906
  logger2().warn({
3671
3907
  msg: "deferred native sleep cleanup failed",
3672
- error: _chunkY4QLVCCScjs.stringifyError.call(void 0, error)
3908
+ error: _chunk6UDO6UYMcjs.stringifyError.call(void 0, error)
3673
3909
  });
3674
3910
  });
3675
3911
  return;
@@ -3708,15 +3944,29 @@ async function closeNativeDatabaseClient(runtime, ctx) {
3708
3944
  await entry.client.close();
3709
3945
  }
3710
3946
  }
3947
+ function createNativeSqlTransaction(runtime, transaction) {
3948
+ return {
3949
+ exec: (sql) => runtime.actorSqlTransactionExec(transaction, sql),
3950
+ execSync: (sql) => runtime.actorSqlTransactionExecSync(transaction, sql),
3951
+ execute: (sql, params) => runtime.actorSqlTransactionExecute(transaction, sql, params),
3952
+ executeSync: (sql, params) => runtime.actorSqlTransactionExecuteSync(transaction, sql, params),
3953
+ commit: () => runtime.actorSqlTransactionCommit(transaction),
3954
+ commitSync: () => runtime.actorSqlTransactionCommitSync(transaction),
3955
+ rollback: () => runtime.actorSqlTransactionRollback(transaction),
3956
+ rollbackSync: () => runtime.actorSqlTransactionRollbackSync(transaction)
3957
+ };
3958
+ }
3711
3959
  function getOrCreateNativeSqlDatabase(runtime, ctx) {
3712
3960
  const runtimeState = getNativeRuntimeState(runtime, ctx);
3713
3961
  const cachedDatabase = runtimeState.sql;
3714
3962
  if (cachedDatabase) {
3715
3963
  return cachedDatabase;
3716
3964
  }
3717
- const database = wrapJsNativeDatabase({
3965
+ const bindings = {
3718
3966
  exec: (sql) => runtime.actorSqlExec(ctx, sql),
3967
+ execSync: (sql) => runtime.actorSqlExecSync(ctx, sql),
3719
3968
  execute: (sql, params) => runtime.actorSqlExecute(ctx, sql, params),
3969
+ executeSync: (sql, params) => runtime.actorSqlExecuteSync(ctx, sql, params),
3720
3970
  executeBatch: (statements) => runtime.actorSqlExecuteBatch(ctx, statements),
3721
3971
  beginTransaction: async (timeoutMs, name) => {
3722
3972
  const transaction = await runtime.actorSqlBeginTransaction(
@@ -3724,16 +3974,15 @@ function getOrCreateNativeSqlDatabase(runtime, ctx) {
3724
3974
  timeoutMs,
3725
3975
  name
3726
3976
  );
3727
- return {
3728
- exec: (sql) => runtime.actorSqlTransactionExec(transaction, sql),
3729
- execute: (sql, params) => runtime.actorSqlTransactionExecute(
3730
- transaction,
3731
- sql,
3732
- params
3733
- ),
3734
- commit: () => runtime.actorSqlTransactionCommit(transaction),
3735
- rollback: () => runtime.actorSqlTransactionRollback(transaction)
3736
- };
3977
+ return createNativeSqlTransaction(runtime, transaction);
3978
+ },
3979
+ beginTransactionSync: (timeoutMs, name) => {
3980
+ const transaction = runtime.actorSqlBeginTransactionSync(
3981
+ ctx,
3982
+ timeoutMs,
3983
+ name
3984
+ );
3985
+ return createNativeSqlTransaction(runtime, transaction);
3737
3986
  },
3738
3987
  beginStateTransaction: async (timeoutMs, context) => {
3739
3988
  const scope = context;
@@ -3771,8 +4020,13 @@ function getOrCreateNativeSqlDatabase(runtime, ctx) {
3771
4020
  run: (sql, params) => runtime.actorSqlRun(ctx, sql, params),
3772
4021
  metrics: () => runtime.actorSqlMetrics(ctx),
3773
4022
  takeLastKvError: () => runtime.actorSqlTakeLastKvError(ctx),
4023
+ open: () => runtime.actorSqlOpen(ctx),
4024
+ commitTicket: () => runtime.actorSqlCommitTicket(ctx),
4025
+ whenDurable: (ticket) => runtime.actorSqlWhenDurable(ctx, ticket),
4026
+ abortGeneration: (reason) => runtime.actorSqlAbortGeneration(ctx, reason),
3774
4027
  close: () => runtime.actorSqlClose(ctx)
3775
- });
4028
+ };
4029
+ const database = wrapJsNativeDatabase(bindings);
3776
4030
  runtimeState.sql = database;
3777
4031
  return database;
3778
4032
  }
@@ -3841,10 +4095,10 @@ function decodeValue(value) {
3841
4095
  if (!value || value.length === 0) {
3842
4096
  return void 0;
3843
4097
  }
3844
- return _chunkY4QLVCCScjs.decodeCborCompat.call(void 0, value);
4098
+ return _chunk6UDO6UYMcjs.decodeCborCompat.call(void 0, value);
3845
4099
  }
3846
4100
  function encodeValue(value) {
3847
- return _chunkY4QLVCCScjs.encodeCborCompat.call(void 0, value);
4101
+ return _chunk6UDO6UYMcjs.encodeCborCompat.call(void 0, value);
3848
4102
  }
3849
4103
  function normalizeArgs(value) {
3850
4104
  return Array.isArray(value) ? value : value === void 0 || value === null ? [] : [value];
@@ -3880,7 +4134,7 @@ function isStructuredBridgeError(error) {
3880
4134
  return _chunkMGI2VVF6cjs.isRivetErrorLike.call(void 0, error) && "__type" in error && (error.__type === "RivetError" || error.__type === "ActorError");
3881
4135
  }
3882
4136
  function encodeNativeCallbackError(error) {
3883
- const structuredError = isStructuredBridgeError(error) ? error : _chunkY4QLVCCScjs.deconstructError.call(void 0, error, true);
4137
+ const structuredError = isStructuredBridgeError(error) ? error : _chunk6UDO6UYMcjs.deconstructError.call(void 0, error, true);
3884
4138
  const { encoded, droppedMetadataCause } = _chunkMGI2VVF6cjs.encodeBridgeRivetError.call(void 0, structuredError);
3885
4139
  if (droppedMetadataCause !== void 0) {
3886
4140
  logger2().warn(
@@ -3942,7 +4196,7 @@ function decodeWorkflowCbor(data) {
3942
4196
  return null;
3943
4197
  }
3944
4198
  try {
3945
- return _chunkY4QLVCCScjs.decodeCborCompat.call(void 0, new Uint8Array(data));
4199
+ return _chunk6UDO6UYMcjs.decodeCborCompat.call(void 0, new Uint8Array(data));
3946
4200
  } catch (e3) {
3947
4201
  return null;
3948
4202
  }
@@ -4055,7 +4309,7 @@ function serializeWorkflowHistoryForJson(data) {
4055
4309
  if (data === null) {
4056
4310
  return null;
4057
4311
  }
4058
- const history = _chunkY5CFDGPAcjs.decodeWorkflowHistoryTransport.call(void 0, data);
4312
+ const history = _chunkEKERHPCEcjs.decodeWorkflowHistoryTransport.call(void 0, data);
4059
4313
  return jsonSafe({
4060
4314
  nameRegistry: [...history.nameRegistry],
4061
4315
  entries: history.entries.map((entry) => ({
@@ -4201,7 +4455,7 @@ var NativeConnAdapter = class {
4201
4455
  },
4202
4456
  (newValue) => {
4203
4457
  assertCurrentState();
4204
- _chunkY4QLVCCScjs.assertJsonCompatValue.call(void 0, newValue);
4458
+ _chunk6UDO6UYMcjs.assertJsonCompatValue.call(void 0, newValue);
4205
4459
  }
4206
4460
  );
4207
4461
  }
@@ -4209,7 +4463,7 @@ var NativeConnAdapter = class {
4209
4463
  var _a;
4210
4464
  (_a = this.#assertCanMutateState) == null ? void 0 : _a.call(this);
4211
4465
  const nextValue = unwrapWriteThroughProxy(value);
4212
- _chunkY4QLVCCScjs.assertJsonCompatValue.call(void 0, nextValue);
4466
+ _chunk6UDO6UYMcjs.assertJsonCompatValue.call(void 0, nextValue);
4213
4467
  this.#writeState(nextValue, { writeNative: true });
4214
4468
  }
4215
4469
  initializeState(value) {
@@ -5288,7 +5542,7 @@ var ActorContextHandleAdapter = class {
5288
5542
  },
5289
5543
  (newValue) => {
5290
5544
  assertCurrentState();
5291
- _chunkY4QLVCCScjs.assertJsonCompatValue.call(void 0, newValue);
5545
+ _chunk6UDO6UYMcjs.assertJsonCompatValue.call(void 0, newValue);
5292
5546
  }
5293
5547
  );
5294
5548
  }
@@ -5300,7 +5554,7 @@ var ActorContextHandleAdapter = class {
5300
5554
  }
5301
5555
  this.#assertCanMutateState();
5302
5556
  const nextValue = unwrapWriteThroughProxy(value);
5303
- _chunkY4QLVCCScjs.assertJsonCompatValue.call(void 0, nextValue);
5557
+ _chunk6UDO6UYMcjs.assertJsonCompatValue.call(void 0, nextValue);
5304
5558
  this.#writeState(nextValue, { scheduleSave: true });
5305
5559
  }
5306
5560
  initializeState(value) {
@@ -5514,14 +5768,16 @@ var ActorContextHandleAdapter = class {
5514
5768
  log: {
5515
5769
  debug: (obj) => logger2().debug(obj)
5516
5770
  },
5517
- nativeDatabaseProvider: _chunk22S5RCCJcjs.registerNativeStateTransactionOpener.call(void 0,
5771
+ nativeDatabaseProvider: _chunkXLD6TRSEcjs.registerNativeStateTransactionOpener.call(void 0,
5518
5772
  {
5519
5773
  open: async (requestedActorId) => {
5520
5774
  void requestedActorId;
5521
- return getOrCreateNativeSqlDatabase(
5775
+ const database = getOrCreateNativeSqlDatabase(
5522
5776
  this.#runtime,
5523
5777
  this.#ctx
5524
5778
  );
5779
+ await database.open();
5780
+ return database;
5525
5781
  }
5526
5782
  },
5527
5783
  async (timeoutMs, context) => await getOrCreateNativeSqlDatabase(
@@ -5537,7 +5793,7 @@ var ActorContextHandleAdapter = class {
5537
5793
  return this.#db;
5538
5794
  }
5539
5795
  #bindDatabaseClient(client) {
5540
- return _chunk22S5RCCJcjs.bindNativeStateTransactionContext.call(void 0, client, {
5796
+ return _chunkXLD6TRSEcjs.bindNativeStateTransactionContext.call(void 0, client, {
5541
5797
  enter: async () => await this.#enterStateTransaction(),
5542
5798
  exit: (scope) => this.#exitStateTransaction(
5543
5799
  scope
@@ -5741,7 +5997,7 @@ var ActorContextHandleAdapter = class {
5741
5997
  const trackedPromise = Promise.resolve(promise).catch((error) => {
5742
5998
  logger2().warn({
5743
5999
  msg: "keepAwake promise rejected",
5744
- error: _chunkY4QLVCCScjs.stringifyError.call(void 0, error)
6000
+ error: _chunk6UDO6UYMcjs.stringifyError.call(void 0, error)
5745
6001
  });
5746
6002
  }).then(() => null);
5747
6003
  try {
@@ -6124,18 +6380,21 @@ function buildActorTracingConfig(actions, tracing) {
6124
6380
  actions: _chunkSSF2XC33cjs.flattenActionTraceSamplers.call(void 0, actions, tracing.actions)
6125
6381
  };
6126
6382
  }
6383
+ var SQLITE_DEFERRED_COMMITS = /* @__PURE__ */ Symbol.for("rivetkit.sqlite.deferredCommits");
6127
6384
  function buildActorConfig(definition, registryConfig, runtimeKind) {
6128
- var _a;
6385
+ var _a, _b;
6129
6386
  const config = definition.config;
6130
6387
  const options = _nullishCoalesce(config.options, () => ( {}));
6131
6388
  const canHibernate = options.canHibernateWebSocket;
6132
6389
  const usesRemoteSqlite = sqliteBackendForConfig(registryConfig) === "remote";
6133
6390
  const sqliteProfiling = (_a = config.db) == null ? void 0 : _a.sqliteProfiling;
6391
+ const sqliteDeferredCommits = ((_b = config.db) == null ? void 0 : _b[SQLITE_DEFERRED_COMMITS]) === true;
6134
6392
  return {
6135
6393
  name: options.name,
6136
6394
  icon: options.icon,
6137
6395
  hasDatabase: true,
6138
6396
  remoteSqlite: usesRemoteSqlite,
6397
+ sqliteDeferredCommits: sqliteDeferredCommits || void 0,
6139
6398
  sqliteProfiling,
6140
6399
  tracing: buildActorTracingConfig(
6141
6400
  definition.config.actions,
@@ -6239,7 +6498,7 @@ function validateInspectorTabSource(tabId, resolved) {
6239
6498
  function buildNativeFactory(runtime, registryConfig, definition) {
6240
6499
  var _a;
6241
6500
  const config = definition.config;
6242
- const databaseProvider = _nullishCoalesce(config.db, () => ( _chunk22S5RCCJcjs.db.call(void 0, )));
6501
+ const databaseProvider = _nullishCoalesce(config.db, () => ( _chunkXLD6TRSEcjs.db.call(void 0, )));
6243
6502
  const actionHandlers = _chunkSSF2XC33cjs.flattenActionHandlers.call(void 0, config.actions);
6244
6503
  const schemaConfig = {
6245
6504
  actionInputSchemas: _chunkSSF2XC33cjs.flattenActionInputSchemas.call(void 0,
@@ -6250,9 +6509,9 @@ function buildNativeFactory(runtime, registryConfig, definition) {
6250
6509
  events: config.events,
6251
6510
  queues: config.queues
6252
6511
  };
6253
- const createClient = (ctx) => _chunkNG5CUXMMcjs.createClientWithDriver.call(void 0,
6254
- new (0, _chunkNG5CUXMMcjs.RemoteEngineControlClient)(
6255
- _chunkNG5CUXMMcjs.convertRegistryConfigToClientConfig.call(void 0, registryConfig)
6512
+ const createClient = (ctx) => _chunkYJ2X5STTcjs.createClientWithDriver.call(void 0,
6513
+ new (0, _chunkYJ2X5STTcjs.RemoteEngineControlClient)(
6514
+ _chunkYJ2X5STTcjs.convertRegistryConfigToClientConfig.call(void 0, registryConfig)
6256
6515
  ),
6257
6516
  {
6258
6517
  encoding: "bare",
@@ -6444,7 +6703,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
6444
6703
  400
6445
6704
  );
6446
6705
  }
6447
- const cbor = _chunkY4QLVCCScjs.encodeCborCompat.call(void 0,
6706
+ const cbor = _chunk6UDO6UYMcjs.encodeCborCompat.call(void 0,
6448
6707
  _nullishCoalesce(body.body, () => ( null))
6449
6708
  );
6450
6709
  const message = await runtime.actorQueueSend(ctx, name, cbor);
@@ -7041,7 +7300,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
7041
7300
  ...request,
7042
7301
  abortController: requestAbortController
7043
7302
  });
7044
- const rawConnParams = handlerRequest.headers.get(_chunkNG5CUXMMcjs.HEADER_CONN_PARAMS);
7303
+ const rawConnParams = handlerRequest.headers.get(_chunkYJ2X5STTcjs.HEADER_CONN_PARAMS);
7045
7304
  let requestCtx;
7046
7305
  let conn;
7047
7306
  let removeRequestAbortListener;
@@ -7098,7 +7357,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
7098
7357
  requestCtx,
7099
7358
  handlerRequest
7100
7359
  );
7101
- if (!_chunkNG5CUXMMcjs.isResponseLike.call(void 0, response)) {
7360
+ if (!_chunkYJ2X5STTcjs.isResponseLike.call(void 0, response)) {
7102
7361
  throw new Error(
7103
7362
  "onRequest handler must return a Response"
7104
7363
  );
@@ -7193,7 +7452,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
7193
7452
  var _a2;
7194
7453
  const { ctx } = unwrapTsfnPayload(error, payload);
7195
7454
  const history = (_a2 = getNativeWorkflowInspector(ctx)) == null ? void 0 : _a2.getHistory();
7196
- return history == null ? void 0 : _chunkY4QLVCCScjs.toUint8Array.call(void 0, history);
7455
+ return history == null ? void 0 : _chunk6UDO6UYMcjs.toUint8Array.call(void 0, history);
7197
7456
  }
7198
7457
  ) : void 0,
7199
7458
  replayWorkflow: _chunkSSF2XC33cjs.hasRunInspectorConfig.call(void 0, config.run) ? wrapNativeCallback(
@@ -7207,7 +7466,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
7207
7466
  return void 0;
7208
7467
  }
7209
7468
  const history = await _asyncNullishCoalesce(await workflowInspector.replayFromStep(entryId), async () => ( null));
7210
- return history == null ? void 0 : _chunkY4QLVCCScjs.toUint8Array.call(void 0, history);
7469
+ return history == null ? void 0 : _chunk6UDO6UYMcjs.toUint8Array.call(void 0, history);
7211
7470
  }
7212
7471
  ) : void 0,
7213
7472
  actions: Object.fromEntries(
@@ -7349,7 +7608,7 @@ async function buildServeConfig(config, resolveNativeBinaries = true) {
7349
7608
  startServices: resolveNativeBinaries && config.startServices,
7350
7609
  handleInspectorHttpInRuntime: true,
7351
7610
  serverlessBasePath: config.serverless.basePath,
7352
- serverlessPackageVersion: _chunkY4QLVCCScjs.VERSION,
7611
+ serverlessPackageVersion: _chunk6UDO6UYMcjs.VERSION,
7353
7612
  serverlessClientEndpoint: config.publicEndpoint,
7354
7613
  serverlessClientNamespace: config.publicNamespace,
7355
7614
  serverlessClientToken: config.publicToken,
@@ -7363,12 +7622,12 @@ async function buildServeConfig(config, resolveNativeBinaries = true) {
7363
7622
  } catch (error) {
7364
7623
  logger2().warn({
7365
7624
  msg: "could not resolve a local engine binary; if a local engine must be spawned it will fail with engine.binary_unavailable \u2014 set RIVET_ENGINE_BINARY_PATH or install the @rivetkit/engine-cli platform package",
7366
- error: _chunkY4QLVCCScjs.stringifyError.call(void 0, error)
7625
+ error: _chunk6UDO6UYMcjs.stringifyError.call(void 0, error)
7367
7626
  });
7368
7627
  }
7369
7628
  }
7370
7629
  if (resolveNativeBinaries && config.startServices) {
7371
- const servicesBinary = _chunkY4QLVCCScjs.getEnvUniversal.call(void 0, "RIVET_SERVICES_BINARY");
7630
+ const servicesBinary = _chunk6UDO6UYMcjs.getEnvUniversal.call(void 0, "RIVET_SERVICES_BINARY");
7372
7631
  if (servicesBinary) {
7373
7632
  serveConfig.servicesBinaryPath = servicesBinary;
7374
7633
  } else {
@@ -7383,13 +7642,13 @@ async function buildServeConfig(config, resolveNativeBinaries = true) {
7383
7642
  serveConfig.engineHost = config.engineHost;
7384
7643
  serveConfig.enginePort = config.enginePort;
7385
7644
  if ((_a = config.test) == null ? void 0 : _a.enabled) {
7386
- serveConfig.inspectorTestToken = _nullishCoalesce(_chunkY4QLVCCScjs.getEnvUniversal.call(void 0, "_RIVET_TEST_INSPECTOR_TOKEN"), () => ( "token"));
7645
+ serveConfig.inspectorTestToken = _nullishCoalesce(_chunk6UDO6UYMcjs.getEnvUniversal.call(void 0, "_RIVET_TEST_INSPECTOR_TOKEN"), () => ( "token"));
7387
7646
  }
7388
7647
  return serveConfig;
7389
7648
  }
7390
7649
  async function buildRegistryWithRuntime(config, runtime) {
7391
7650
  var _a;
7392
- if (((_a = config.test) == null ? void 0 : _a.enabled) && _chunkY4QLVCCScjs.getEnvUniversal.call(void 0, "_RIVET_TEST_INSPECTOR_TOKEN") === void 0) {
7651
+ if (((_a = config.test) == null ? void 0 : _a.enabled) && _chunk6UDO6UYMcjs.getEnvUniversal.call(void 0, "_RIVET_TEST_INSPECTOR_TOKEN") === void 0) {
7393
7652
  trySetProcessEnv("_RIVET_TEST_INSPECTOR_TOKEN", "token");
7394
7653
  }
7395
7654
  if (runtime.kind === "napi") {
@@ -7461,7 +7720,7 @@ function createApplicationFetch(application, runtime) {
7461
7720
  signal: abortController.signal
7462
7721
  })
7463
7722
  );
7464
- if (!_chunkNG5CUXMMcjs.isResponseLike.call(void 0, response)) {
7723
+ if (!_chunkYJ2X5STTcjs.isResponseLike.call(void 0, response)) {
7465
7724
  throw new TypeError(
7466
7725
  "registry.listen() application fetch must return a Response"
7467
7726
  );
@@ -7511,7 +7770,7 @@ var Registry = class {
7511
7770
  var _a;
7512
7771
  this.#config = config;
7513
7772
  if ((_a = config.logging) == null ? void 0 : _a.baseLogger) {
7514
- _chunkY4QLVCCScjs.configureBaseLogger.call(void 0, config.logging.baseLogger);
7773
+ _chunk6UDO6UYMcjs.configureBaseLogger.call(void 0, config.logging.baseLogger);
7515
7774
  }
7516
7775
  this.#buildConfiguredRegistry = _nullishCoalesce((deps == null ? void 0 : deps.buildConfiguredRegistry), () => ( buildConfiguredRegistry));
7517
7776
  this.routes = {
@@ -7743,10 +8002,10 @@ var Registry = class {
7743
8002
  if (!opts.application) {
7744
8003
  rejectServerless();
7745
8004
  }
7746
- const port = _nullishCoalesce(_nullishCoalesce(opts.port, () => ( _chunkY4QLVCCScjs.parsePortEnv.call(void 0, process.env.RIVET_PORT))), () => ( 3e3));
7747
- const publicDir = _nullishCoalesce(opts.publicDir, () => ( _chunkY4QLVCCScjs.getRivetkitPublicDir.call(void 0, )));
8005
+ const port = _nullishCoalesce(_nullishCoalesce(opts.port, () => ( _chunk6UDO6UYMcjs.parsePortEnv.call(void 0, process.env.RIVET_PORT))), () => ( 3e3));
8006
+ const publicDir = _nullishCoalesce(opts.publicDir, () => ( _chunk6UDO6UYMcjs.getRivetkitPublicDir.call(void 0, )));
7748
8007
  const config = this.parseConfig();
7749
- if (opts.application && _chunkY4QLVCCScjs.getRivetkitRuntimeMode.call(void 0, ) !== "serverless") {
8008
+ if (opts.application && _chunk6UDO6UYMcjs.getRivetkitRuntimeMode.call(void 0, ) !== "serverless") {
7750
8009
  if (config.runtime === "wasm") {
7751
8010
  throw new Error(
7752
8011
  "registry.listen() requires the native runtime; use an application-owned HTTP server with WebAssembly"
@@ -7822,7 +8081,7 @@ var Registry = class {
7822
8081
  return jsonRouteResponse(503, {
7823
8082
  status: "not_started",
7824
8083
  runtime: "rivetkit",
7825
- version: _chunkY4QLVCCScjs.VERSION
8084
+ version: _chunk6UDO6UYMcjs.VERSION
7826
8085
  });
7827
8086
  }
7828
8087
  const { runtime, registry } = configured;
@@ -7830,7 +8089,7 @@ var Registry = class {
7830
8089
  return jsonRouteResponse(501, {
7831
8090
  status: "unsupported",
7832
8091
  runtime: "rivetkit",
7833
- version: _chunkY4QLVCCScjs.VERSION
8092
+ version: _chunk6UDO6UYMcjs.VERSION
7834
8093
  });
7835
8094
  }
7836
8095
  const response = await runtime.registryHealth(registry);
@@ -7905,14 +8164,14 @@ var Registry = class {
7905
8164
  var _a;
7906
8165
  if (!this.#runtimeServePromise) {
7907
8166
  const configuredEnvoyVersion = (_a = this.#config.node) == null ? void 0 : _a.version;
7908
- const envoyVersionSource = configuredEnvoyVersion !== void 0 ? "config" : _chunkY4QLVCCScjs.getRivetEnvoyVersion.call(void 0, ) !== void 0 ? "environment" : "default";
8167
+ const envoyVersionSource = configuredEnvoyVersion !== void 0 ? "config" : _chunk6UDO6UYMcjs.getRivetEnvoyVersion.call(void 0, ) !== void 0 ? "environment" : "default";
7909
8168
  logger2().info({
7910
8169
  msg: "starting rivetkit envoy",
7911
- rivetkitVersion: _chunkY4QLVCCScjs.VERSION,
8170
+ rivetkitVersion: _chunk6UDO6UYMcjs.VERSION,
7912
8171
  envoyVersion: config.node.version,
7913
8172
  envoyVersionSource
7914
8173
  });
7915
- if (envoyVersionSource === "default" && _chunkY4QLVCCScjs.getNodeEnv.call(void 0, ) === "production") {
8174
+ if (envoyVersionSource === "default" && _chunk6UDO6UYMcjs.getNodeEnv.call(void 0, ) === "production") {
7916
8175
  logger2().error({
7917
8176
  msg: "node version defaulted because neither config.node.version nor RIVET_NODE_VERSION is set; actors will not drain automatically across deploys. See https://rivet.dev/docs/actors/versions",
7918
8177
  envoyVersion: config.node.version,
@@ -8001,7 +8260,7 @@ var Registry = class {
8001
8260
  const modeAPromise = this.#runtimeServeConfiguredPromise;
8002
8261
  const modeBPromise = this.#runtimeServerlessPromise;
8003
8262
  const runtimes = /* @__PURE__ */ new Set();
8004
- const localDevSignal = signalDriven && _chunkY4QLVCCScjs.getNodeEnv.call(void 0, ) !== "production" && config.engineSpawn && config.endpoint !== void 0 && _chunkNG5CUXMMcjs.isLocalEngineEndpoint.call(void 0, config.endpoint);
8263
+ const localDevSignal = signalDriven && _chunk6UDO6UYMcjs.getNodeEnv.call(void 0, ) !== "production" && config.engineSpawn && config.endpoint !== void 0 && _chunkYJ2X5STTcjs.isLocalEngineEndpoint.call(void 0, config.endpoint);
8005
8264
  let gracePeriodMs = (_a = config.shutdown) == null ? void 0 : _a.gracePeriodMs;
8006
8265
  if (gracePeriodMs === void 0) {
8007
8266
  gracePeriodMs = localDevSignal ? LOCAL_DEV_SHUTDOWN_GRACE_PERIOD_MS : await _asyncNullishCoalesce(await this.#actorStopThresholdMs(
@@ -8113,7 +8372,7 @@ var Registry = class {
8113
8372
  }
8114
8373
  if (this.#runtimeReadyPromise) return this.#runtimeReadyPromise;
8115
8374
  try {
8116
- if (_chunkY4QLVCCScjs.getRivetkitRuntimeMode.call(void 0, ) === "serverless") {
8375
+ if (_chunk6UDO6UYMcjs.getRivetkitRuntimeMode.call(void 0, ) === "serverless") {
8117
8376
  return Promise.reject(
8118
8377
  new Error(
8119
8378
  "registry.startAndWait() requires envoy runtime mode; serverless registries become ready per request"
@@ -8137,7 +8396,7 @@ var Registry = class {
8137
8396
  if (!configuredRegistryPromise || !serveLifecyclePromise) {
8138
8397
  throw new Error("registry envoy startup did not initialize");
8139
8398
  }
8140
- const readyTimeoutMs = config.engineSpawn && config.endpoint !== void 0 && _chunkNG5CUXMMcjs.isLocalEngineEndpoint.call(void 0, config.endpoint) ? LOCAL_ENGINE_READY_TIMEOUT_MS : REGISTRY_READY_TIMEOUT_MS;
8399
+ const readyTimeoutMs = config.engineSpawn && config.endpoint !== void 0 && _chunkYJ2X5STTcjs.isLocalEngineEndpoint.call(void 0, config.endpoint) ? LOCAL_ENGINE_READY_TIMEOUT_MS : REGISTRY_READY_TIMEOUT_MS;
8141
8400
  let timeout;
8142
8401
  const timeoutPromise = new Promise((_resolve, reject) => {
8143
8402
  var _a;
@@ -8187,8 +8446,8 @@ var Registry = class {
8187
8446
  * ```
8188
8447
  */
8189
8448
  start() {
8190
- if (_chunkY4QLVCCScjs.getRivetkitRuntimeMode.call(void 0, ) === "serverless") {
8191
- const publicDir = _nullishCoalesce(_chunkY4QLVCCScjs.getRivetkitPublicDir.call(void 0, ), () => ( "/public"));
8449
+ if (_chunk6UDO6UYMcjs.getRivetkitRuntimeMode.call(void 0, ) === "serverless") {
8450
+ const publicDir = _nullishCoalesce(_chunk6UDO6UYMcjs.getRivetkitPublicDir.call(void 0, ), () => ( "/public"));
8192
8451
  this.listen({ publicDir }).catch((error) => {
8193
8452
  logger2().error({ error }, "auto-listen failed; exiting");
8194
8453
  if (typeof process !== "undefined" && typeof process.exit === "function") {
@@ -8209,13 +8468,13 @@ var Registry = class {
8209
8468
  };
8210
8469
  console.log();
8211
8470
  console.log(
8212
- ` RivetKit ${_chunkY4QLVCCScjs.VERSION} (Engine - ${kind === "serverless" ? "Serverless" : "Serverful"})`
8471
+ ` RivetKit ${_chunk6UDO6UYMcjs.VERSION} (Engine - ${kind === "serverless" ? "Serverless" : "Serverful"})`
8213
8472
  );
8214
8473
  if (config.namespace !== "default") {
8215
8474
  logLine("Namespace", config.namespace);
8216
8475
  }
8217
8476
  if (config.endpoint) {
8218
- const endpointType = config.startEngine || _chunkNG5CUXMMcjs.isLocalEngineEndpoint.call(void 0, config.endpoint) ? "local native" : "remote";
8477
+ const endpointType = config.startEngine || _chunkYJ2X5STTcjs.isLocalEngineEndpoint.call(void 0, config.endpoint) ? "local native" : "remote";
8219
8478
  logLine("Endpoint", `${config.endpoint} (${endpointType})`);
8220
8479
  }
8221
8480
  if (kind === "serverless" && config.publicEndpoint) {
@@ -8285,5 +8544,5 @@ function setup(input) {
8285
8544
 
8286
8545
 
8287
8546
 
8288
- exports.ALLOWED_PUBLIC_HEADERS = _chunkNG5CUXMMcjs.ALLOWED_PUBLIC_HEADERS; exports.ActorDefinition = ActorDefinition; exports.ActorError = _chunkMGI2VVF6cjs.RivetError; exports.ActorsSchema = ActorsSchema; exports.DocConfigurePoolSchema = DocConfigurePoolSchema; exports.DocEnvoyConfigSchema = DocEnvoyConfigSchema; exports.DocRegistryConfigSchema = DocRegistryConfigSchema; exports.DocServerlessConfigSchema = DocServerlessConfigSchema; exports.DocSqliteConfigSchema = DocSqliteConfigSchema; exports.InlineWebSocketAdapter = InlineWebSocketAdapter; exports.Registry = Registry; exports.RegistryConfigSchema = RegistryConfigSchema; exports.RivetError = _chunkMGI2VVF6cjs.RivetError; exports.RuntimeKindSchema = RuntimeKindSchema; exports.SqliteBackendSchema = SqliteBackendSchema; exports.SqliteConfigSchema = SqliteConfigSchema; exports.TestConfigSchema = TestConfigSchema; exports.UserError = _chunkMGI2VVF6cjs.UserError; exports.WasmRuntimeConfigSchema = WasmRuntimeConfigSchema; exports.actor = actor; exports.buildActorNames = buildActorNames; exports.createClientWithDriver = _chunkNG5CUXMMcjs.createClientWithDriver; exports.defineRunHandler = _chunkSSF2XC33cjs.defineRunHandler; exports.event = event; exports.isStaticActorDefinition = isStaticActorDefinition; exports.isStaticActorInstance = isStaticActorInstance; exports.lookupInRegistry = lookupInRegistry; exports.noopNext = _chunkY4QLVCCScjs.noopNext; exports.queue = queue; exports.setup = setup; exports.toUint8Array = _chunkY4QLVCCScjs.toUint8Array;
8547
+ exports.ALLOWED_PUBLIC_HEADERS = _chunkYJ2X5STTcjs.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 = _chunkYJ2X5STTcjs.createClientWithDriver; exports.defineRunHandler = _chunkSSF2XC33cjs.defineRunHandler; exports.event = event; exports.isStaticActorDefinition = isStaticActorDefinition; exports.isStaticActorInstance = isStaticActorInstance; exports.lookupInRegistry = lookupInRegistry; exports.noopNext = _chunk6UDO6UYMcjs.noopNext; exports.queue = queue; exports.setup = setup; exports.toUint8Array = _chunk6UDO6UYMcjs.toUint8Array;
8289
8548
  //# sourceMappingURL=mod.cjs.map