rivetkit 3.1.1 → 3.1.2-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/dist/browser/client.d.ts +41 -0
  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-JWREVWQL.js → chunk-5RE3IF3C.js} +2 -2
  7. package/dist/tsup/{chunk-HXFGYYOA.js → chunk-7PUO5YRK.js} +3 -3
  8. package/dist/tsup/{chunk-FBRWBUUV.js → chunk-DKVKYLXH.js} +4 -4
  9. package/dist/tsup/{chunk-62DUEJF5.cjs → chunk-GI3TPFCE.cjs} +2 -2
  10. package/dist/tsup/chunk-GI3TPFCE.cjs.map +1 -0
  11. package/dist/tsup/{chunk-C4U5WWM6.js → chunk-J5ZNIJT3.js} +2 -2
  12. package/dist/tsup/{chunk-KTZWFOBF.cjs → chunk-KOB3RR6D.cjs} +7 -7
  13. package/dist/tsup/{chunk-KTZWFOBF.cjs.map → chunk-KOB3RR6D.cjs.map} +1 -1
  14. package/dist/tsup/{chunk-HPVDAB3Q.js → chunk-LNMODE5R.js} +2 -2
  15. package/dist/tsup/{chunk-ZZQFX3FC.cjs → chunk-MM6QYEV7.cjs} +146 -146
  16. package/dist/tsup/{chunk-ZZQFX3FC.cjs.map → chunk-MM6QYEV7.cjs.map} +1 -1
  17. package/dist/tsup/{chunk-O4QOORVK.cjs → chunk-R2GD2TDD.cjs} +3 -3
  18. package/dist/tsup/{chunk-O4QOORVK.cjs.map → chunk-R2GD2TDD.cjs.map} +1 -1
  19. package/dist/tsup/{chunk-RROV4JN4.js → chunk-SPLLB6BX.js} +2 -2
  20. package/dist/tsup/{chunk-2X7ZRXPW.cjs → chunk-TR5YB355.cjs} +3 -3
  21. package/dist/tsup/{chunk-2X7ZRXPW.cjs.map → chunk-TR5YB355.cjs.map} +1 -1
  22. package/dist/tsup/{chunk-SPSBNPLC.cjs → chunk-TYNEZVC2.cjs} +3 -3
  23. package/dist/tsup/{chunk-SPSBNPLC.cjs.map → chunk-TYNEZVC2.cjs.map} +1 -1
  24. package/dist/tsup/{chunk-IROHORSE.cjs → chunk-VUFOIAKH.cjs} +10 -10
  25. package/dist/tsup/{chunk-IROHORSE.cjs.map → chunk-VUFOIAKH.cjs.map} +1 -1
  26. package/dist/tsup/{chunk-CSYHVROJ.js → chunk-WD6L6OTX.js} +2 -2
  27. package/dist/tsup/chunk-WD6L6OTX.js.map +1 -0
  28. package/dist/tsup/{chunk-AGFOGGFH.cjs → chunk-YPJ3QEDL.cjs} +4 -4
  29. package/dist/tsup/{chunk-AGFOGGFH.cjs.map → chunk-YPJ3QEDL.cjs.map} +1 -1
  30. package/dist/tsup/{chunk-IULKFTST.js → chunk-YT77YM32.js} +3 -3
  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-BDdeBoxX.d.cts → config-CTGjM4A5.d.cts} +16 -1
  40. package/dist/tsup/{config-Ch-SMJ-n.d.ts → config-DLXQ_TVP.d.ts} +16 -1
  41. package/dist/tsup/{config-CBTr4IhE.d.cts → config-Df5jOcde.d.cts} +26 -0
  42. package/dist/tsup/{config-CBTr4IhE.d.ts → config-Df5jOcde.d.ts} +26 -0
  43. package/dist/tsup/{context-B-wRuYrf.d.ts → context-Dmz9Hd6K.d.ts} +2 -2
  44. package/dist/tsup/{context-NzsxAAoN.d.cts → context-S-Y75hj1.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 +39 -0
  82. package/src/common/database/native-database.ts +230 -21
  83. package/src/registry/napi-runtime.ts +78 -0
  84. package/src/registry/native.ts +57 -17
  85. package/src/registry/runtime.ts +52 -0
  86. package/src/registry/wasm-runtime.ts +88 -0
  87. package/dist/tsup/chunk-62DUEJF5.cjs.map +0 -1
  88. package/dist/tsup/chunk-CSYHVROJ.js.map +0 -1
  89. /package/dist/tsup/{chunk-JWREVWQL.js.map → chunk-5RE3IF3C.js.map} +0 -0
  90. /package/dist/tsup/{chunk-HXFGYYOA.js.map → chunk-7PUO5YRK.js.map} +0 -0
  91. /package/dist/tsup/{chunk-FBRWBUUV.js.map → chunk-DKVKYLXH.js.map} +0 -0
  92. /package/dist/tsup/{chunk-C4U5WWM6.js.map → chunk-J5ZNIJT3.js.map} +0 -0
  93. /package/dist/tsup/{chunk-HPVDAB3Q.js.map → chunk-LNMODE5R.js.map} +0 -0
  94. /package/dist/tsup/{chunk-RROV4JN4.js.map → chunk-SPLLB6BX.js.map} +0 -0
  95. /package/dist/tsup/{chunk-IULKFTST.js.map → chunk-YT77YM32.js.map} +0 -0
@@ -1,12 +1,12 @@
1
- import { A as AnyActorDefinition, B as BaseActorDefinition, E as EventSchemaConfig, Q as QueueSchemaConfig, a as ActionContext, b as BeforeActionResponseContext, c as BeforeConnectContext, C as ConnectContext, d as CreateConnStateContext, e as CreateContext, f as CreateVarsContext, D as DestroyContext, g as DisconnectContext, M as MigrateContext, R as RequestContext, h as RunContext, S as SleepContext, i as StateChangeContext, W as WakeContext, j as WebSocketContext } from './config-BDdeBoxX.cjs';
2
- export { k as ACTOR_CONTEXT_INTERNAL_SYMBOL, l as ActionInputSchemas, m as ActionSampleRates, n as ActionTraceSamplers, o as Actions, p as ActorConfig, q as ActorConfigInput, r as ActorConfigSchema, s as ActorContext, t as ActorContextOf, u as ActorCron, v as ActorCronEveryOptions, w as ActorCronSetOptions, x as ActorDefinition, y as ActorFork, z as ActorForkLink, F as ActorInspectorConfig, G as ActorInspectorConfigSchema, H as ActorKey, I as ActorKv, J as ActorLogger, K as ActorOptions, L as ActorOptionsInput, N as ActorOptionsSchema, O as ActorQuery, P as ActorQueue, T as ActorRun, U as ActorSchedule, V as ActorTracingOptions, X as ActorTypes, Y as ActorsSchema, Z as AnyActorInstance, _ as AnyClient, $ as AnyConn, a0 as AnyStaticActorDefinition, a1 as AnyStaticActorInstance, a2 as AuthIntent, a3 as BUILTIN_INSPECTOR_TAB_IDS, a4 as BaseActorInstance, a5 as BuiltinInspectorTabIdSchema, a6 as CONN_DRIVER_SYMBOL, a7 as CONN_STATE_MANAGER_SYMBOL, a8 as Client, a9 as Conn, aa as CronFire, ab as CronJobInfo, ac as CustomInspectorTabEntrySchema, ad as DEFAULT_SLEEP_GRACE_PERIOD, ae as DefineRunHandlerOptions, af as DocActorConfigSchema, ag as DocActorOptionsSchema, ah as DocConfigurePoolSchema, ai as DocEnvoyConfigSchema, aj as DocRegistryConfigSchema, ak as DocServerlessConfigSchema, al as DocSqliteConfigSchema, am as FetchHandler, an as GlobalActorOptions, ao as GlobalActorOptionsInput, ap as GlobalActorOptionsSchema, aq as HideInspectorTabEntrySchema, ar as InferEventArgs, as as InferSchemaMap, at as InspectorTabEntrySchema, au as InspectorUnsubscribe, av as InstanceActorOptions, aw as InstanceActorOptionsInput, ax as InstanceActorOptionsSchema, ay as QueueEnqueueAndWaitOptions, az as QueueFilterName, aA as QueueIterOptions, aB as QueueMessageOf, aC as QueueName, aD as QueueNextBatchOptions, aE as QueueNextOptions, aF as QueueResultMessageForName, aG as QueueTryNextBatchOptions, aH as QueueTryNextOptions, aI as QueueWaitOptions, aJ as RAW_STATE_SYMBOL, aK as Registry, aL as RegistryActors, aM as RegistryApplication, aN as RegistryConfig, aO as RegistryConfigInput, aP as RegistryConfigSchema, aQ as RegistryDeps, aR as RegistryListenOptions, aS as RegistryRoutes, aT as RunConfig, aU as RunConfigSchema, aV as RunControl, aW as RunInspectorConfig, aX as RunInspectorFactoryContext, aY as RunInspectorFactoryResult, aZ as RunInspectorKind, a_ as RunWithInactiveOptions, a$ as RuntimeKind, b0 as RuntimeKindSchema, b1 as ScheduledEventInfo, b2 as ScheduledFireInfo, b3 as ServerlessHandler, b4 as SqliteBackend, b5 as SqliteBackendSchema, b6 as SqliteConfig, b7 as SqliteConfigSchema, b8 as TestConfig, b9 as TestConfigSchema, ba as Type, bb as WasmRuntimeBindings, bc as WasmRuntimeConfig, bd as WasmRuntimeConfigSchema, be as WasmRuntimeInitInput, bf as WorkflowInspectorConfig, bg as WorkflowOutcome, bh as WorkflowSpan, bi as WorkflowStepOutcome, bj as WorkflowStepSpan, bk as actor, bl as buildActorNames, bm as createClientWithDriver, bn as defineRunHandler, bo as disposeRunInspector, bp as event, bq as getRunFunction, br as getRunInspectorConfig, bs as getRunMetadata, bt as isStaticActorDefinition, bu as isStaticActorInstance, bv as lookupInRegistry, bw as queue, bx as setup, by as test } from './config-BDdeBoxX.cjs';
1
+ import { A as AnyActorDefinition, B as BaseActorDefinition, E as EventSchemaConfig, Q as QueueSchemaConfig, a as ActionContext, b as BeforeActionResponseContext, c as BeforeConnectContext, C as ConnectContext, d as CreateConnStateContext, e as CreateContext, f as CreateVarsContext, D as DestroyContext, g as DisconnectContext, M as MigrateContext, R as RequestContext, h as RunContext, S as SleepContext, i as StateChangeContext, W as WakeContext, j as WebSocketContext } from './config-CTGjM4A5.cjs';
2
+ export { k as ACTOR_CONTEXT_INTERNAL_SYMBOL, l as ActionInputSchemas, m as ActionSampleRates, n as ActionTraceSamplers, o as Actions, p as ActorConfig, q as ActorConfigInput, r as ActorConfigSchema, s as ActorContext, t as ActorContextOf, u as ActorCron, v as ActorCronEveryOptions, w as ActorCronSetOptions, x as ActorDefinition, y as ActorFork, z as ActorForkLink, F as ActorInspectorConfig, G as ActorInspectorConfigSchema, H as ActorKey, I as ActorKv, J as ActorLogger, K as ActorOptions, L as ActorOptionsInput, N as ActorOptionsSchema, O as ActorQuery, P as ActorQueue, T as ActorRun, U as ActorSchedule, V as ActorTracingOptions, X as ActorTypes, Y as ActorsSchema, Z as AnyActorInstance, _ as AnyClient, $ as AnyConn, a0 as AnyStaticActorDefinition, a1 as AnyStaticActorInstance, a2 as AuthIntent, a3 as BUILTIN_INSPECTOR_TAB_IDS, a4 as BaseActorInstance, a5 as BuiltinInspectorTabIdSchema, a6 as CONN_DRIVER_SYMBOL, a7 as CONN_STATE_MANAGER_SYMBOL, a8 as Client, a9 as Conn, aa as CronFire, ab as CronJobInfo, ac as CustomInspectorTabEntrySchema, ad as DEFAULT_SLEEP_GRACE_PERIOD, ae as DefineRunHandlerOptions, af as DocActorConfigSchema, ag as DocActorOptionsSchema, ah as DocConfigurePoolSchema, ai as DocEnvoyConfigSchema, aj as DocRegistryConfigSchema, ak as DocServerlessConfigSchema, al as DocSqliteConfigSchema, am as FetchHandler, an as GlobalActorOptions, ao as GlobalActorOptionsInput, ap as GlobalActorOptionsSchema, aq as HideInspectorTabEntrySchema, ar as InferEventArgs, as as InferSchemaMap, at as InspectorTabEntrySchema, au as InspectorUnsubscribe, av as InstanceActorOptions, aw as InstanceActorOptionsInput, ax as InstanceActorOptionsSchema, ay as QueueEnqueueAndWaitOptions, az as QueueFilterName, aA as QueueIterOptions, aB as QueueMessageOf, aC as QueueName, aD as QueueNextBatchOptions, aE as QueueNextOptions, aF as QueueResultMessageForName, aG as QueueTryNextBatchOptions, aH as QueueTryNextOptions, aI as QueueWaitOptions, aJ as RAW_STATE_SYMBOL, aK as Registry, aL as RegistryActors, aM as RegistryApplication, aN as RegistryConfig, aO as RegistryConfigInput, aP as RegistryConfigSchema, aQ as RegistryDeps, aR as RegistryListenOptions, aS as RegistryRoutes, aT as RunConfig, aU as RunConfigSchema, aV as RunControl, aW as RunInspectorConfig, aX as RunInspectorFactoryContext, aY as RunInspectorFactoryResult, aZ as RunInspectorKind, a_ as RunWithInactiveOptions, a$ as RuntimeKind, b0 as RuntimeKindSchema, b1 as ScheduledEventInfo, b2 as ScheduledFireInfo, b3 as ServerlessHandler, b4 as SqliteBackend, b5 as SqliteBackendSchema, b6 as SqliteConfig, b7 as SqliteConfigSchema, b8 as TestConfig, b9 as TestConfigSchema, ba as Type, bb as WasmRuntimeBindings, bc as WasmRuntimeConfig, bd as WasmRuntimeConfigSchema, be as WasmRuntimeInitInput, bf as WorkflowInspectorConfig, bg as WorkflowOutcome, bh as WorkflowSpan, bi as WorkflowStepOutcome, bj as WorkflowStepSpan, bk as actor, bl as buildActorNames, bm as createClientWithDriver, bn as defineRunHandler, bo as disposeRunInspector, bp as event, bq as getRunFunction, br as getRunInspectorConfig, bs as getRunMetadata, bt as isStaticActorDefinition, bu as isStaticActorInstance, bv as lookupInRegistry, bw as queue, bx as setup, by as test } from './config-CTGjM4A5.cjs';
3
3
  export { E as Encoding, t as toUint8Array } from './utils-C6b0aYUM.cjs';
4
4
  import { UniversalWebSocket } from '@rivetkit/virtual-websocket';
5
5
  export { RivetCloseEvent, RivetEvent, RivetMessageEvent, UniversalWebSocket } from '@rivetkit/virtual-websocket';
6
- import { A as AnyDatabaseProvider } from './config-CBTr4IhE.cjs';
6
+ import { A as AnyDatabaseProvider } from './config-Df5jOcde.cjs';
7
7
  export { R as ActorError, R as RivetError, a as RivetErrorLike, b as RivetErrorOptions, U as UserError, c as UserErrorOptions, n as noopNext } from './utils-3rsE0JvI.cjs';
8
8
  import { WSContext } from 'hono/ws';
9
- export { W as WorkflowBranchContextOf, a as WorkflowContextOf, b as WorkflowLoopContextOf, c as WorkflowStepContextOf } from './context-NzsxAAoN.cjs';
9
+ export { W as WorkflowBranchContextOf, a as WorkflowContextOf, b as WorkflowLoopContextOf, c as WorkflowStepContextOf } from './context-S-Y75hj1.cjs';
10
10
  import 'zod/v4';
11
11
  import '@rivetkit/rivetkit-wasm';
12
12
  import 'zod';
@@ -1,12 +1,12 @@
1
- import { A as AnyActorDefinition, B as BaseActorDefinition, E as EventSchemaConfig, Q as QueueSchemaConfig, a as ActionContext, b as BeforeActionResponseContext, c as BeforeConnectContext, C as ConnectContext, d as CreateConnStateContext, e as CreateContext, f as CreateVarsContext, D as DestroyContext, g as DisconnectContext, M as MigrateContext, R as RequestContext, h as RunContext, S as SleepContext, i as StateChangeContext, W as WakeContext, j as WebSocketContext } from './config-Ch-SMJ-n.js';
2
- export { k as ACTOR_CONTEXT_INTERNAL_SYMBOL, l as ActionInputSchemas, m as ActionSampleRates, n as ActionTraceSamplers, o as Actions, p as ActorConfig, q as ActorConfigInput, r as ActorConfigSchema, s as ActorContext, t as ActorContextOf, u as ActorCron, v as ActorCronEveryOptions, w as ActorCronSetOptions, x as ActorDefinition, y as ActorFork, z as ActorForkLink, F as ActorInspectorConfig, G as ActorInspectorConfigSchema, H as ActorKey, I as ActorKv, J as ActorLogger, K as ActorOptions, L as ActorOptionsInput, N as ActorOptionsSchema, O as ActorQuery, P as ActorQueue, T as ActorRun, U as ActorSchedule, V as ActorTracingOptions, X as ActorTypes, Y as ActorsSchema, Z as AnyActorInstance, _ as AnyClient, $ as AnyConn, a0 as AnyStaticActorDefinition, a1 as AnyStaticActorInstance, a2 as AuthIntent, a3 as BUILTIN_INSPECTOR_TAB_IDS, a4 as BaseActorInstance, a5 as BuiltinInspectorTabIdSchema, a6 as CONN_DRIVER_SYMBOL, a7 as CONN_STATE_MANAGER_SYMBOL, a8 as Client, a9 as Conn, aa as CronFire, ab as CronJobInfo, ac as CustomInspectorTabEntrySchema, ad as DEFAULT_SLEEP_GRACE_PERIOD, ae as DefineRunHandlerOptions, af as DocActorConfigSchema, ag as DocActorOptionsSchema, ah as DocConfigurePoolSchema, ai as DocEnvoyConfigSchema, aj as DocRegistryConfigSchema, ak as DocServerlessConfigSchema, al as DocSqliteConfigSchema, am as FetchHandler, an as GlobalActorOptions, ao as GlobalActorOptionsInput, ap as GlobalActorOptionsSchema, aq as HideInspectorTabEntrySchema, ar as InferEventArgs, as as InferSchemaMap, at as InspectorTabEntrySchema, au as InspectorUnsubscribe, av as InstanceActorOptions, aw as InstanceActorOptionsInput, ax as InstanceActorOptionsSchema, ay as QueueEnqueueAndWaitOptions, az as QueueFilterName, aA as QueueIterOptions, aB as QueueMessageOf, aC as QueueName, aD as QueueNextBatchOptions, aE as QueueNextOptions, aF as QueueResultMessageForName, aG as QueueTryNextBatchOptions, aH as QueueTryNextOptions, aI as QueueWaitOptions, aJ as RAW_STATE_SYMBOL, aK as Registry, aL as RegistryActors, aM as RegistryApplication, aN as RegistryConfig, aO as RegistryConfigInput, aP as RegistryConfigSchema, aQ as RegistryDeps, aR as RegistryListenOptions, aS as RegistryRoutes, aT as RunConfig, aU as RunConfigSchema, aV as RunControl, aW as RunInspectorConfig, aX as RunInspectorFactoryContext, aY as RunInspectorFactoryResult, aZ as RunInspectorKind, a_ as RunWithInactiveOptions, a$ as RuntimeKind, b0 as RuntimeKindSchema, b1 as ScheduledEventInfo, b2 as ScheduledFireInfo, b3 as ServerlessHandler, b4 as SqliteBackend, b5 as SqliteBackendSchema, b6 as SqliteConfig, b7 as SqliteConfigSchema, b8 as TestConfig, b9 as TestConfigSchema, ba as Type, bb as WasmRuntimeBindings, bc as WasmRuntimeConfig, bd as WasmRuntimeConfigSchema, be as WasmRuntimeInitInput, bf as WorkflowInspectorConfig, bg as WorkflowOutcome, bh as WorkflowSpan, bi as WorkflowStepOutcome, bj as WorkflowStepSpan, bk as actor, bl as buildActorNames, bm as createClientWithDriver, bn as defineRunHandler, bo as disposeRunInspector, bp as event, bq as getRunFunction, br as getRunInspectorConfig, bs as getRunMetadata, bt as isStaticActorDefinition, bu as isStaticActorInstance, bv as lookupInRegistry, bw as queue, bx as setup, by as test } from './config-Ch-SMJ-n.js';
1
+ import { A as AnyActorDefinition, B as BaseActorDefinition, E as EventSchemaConfig, Q as QueueSchemaConfig, a as ActionContext, b as BeforeActionResponseContext, c as BeforeConnectContext, C as ConnectContext, d as CreateConnStateContext, e as CreateContext, f as CreateVarsContext, D as DestroyContext, g as DisconnectContext, M as MigrateContext, R as RequestContext, h as RunContext, S as SleepContext, i as StateChangeContext, W as WakeContext, j as WebSocketContext } from './config-DLXQ_TVP.js';
2
+ export { k as ACTOR_CONTEXT_INTERNAL_SYMBOL, l as ActionInputSchemas, m as ActionSampleRates, n as ActionTraceSamplers, o as Actions, p as ActorConfig, q as ActorConfigInput, r as ActorConfigSchema, s as ActorContext, t as ActorContextOf, u as ActorCron, v as ActorCronEveryOptions, w as ActorCronSetOptions, x as ActorDefinition, y as ActorFork, z as ActorForkLink, F as ActorInspectorConfig, G as ActorInspectorConfigSchema, H as ActorKey, I as ActorKv, J as ActorLogger, K as ActorOptions, L as ActorOptionsInput, N as ActorOptionsSchema, O as ActorQuery, P as ActorQueue, T as ActorRun, U as ActorSchedule, V as ActorTracingOptions, X as ActorTypes, Y as ActorsSchema, Z as AnyActorInstance, _ as AnyClient, $ as AnyConn, a0 as AnyStaticActorDefinition, a1 as AnyStaticActorInstance, a2 as AuthIntent, a3 as BUILTIN_INSPECTOR_TAB_IDS, a4 as BaseActorInstance, a5 as BuiltinInspectorTabIdSchema, a6 as CONN_DRIVER_SYMBOL, a7 as CONN_STATE_MANAGER_SYMBOL, a8 as Client, a9 as Conn, aa as CronFire, ab as CronJobInfo, ac as CustomInspectorTabEntrySchema, ad as DEFAULT_SLEEP_GRACE_PERIOD, ae as DefineRunHandlerOptions, af as DocActorConfigSchema, ag as DocActorOptionsSchema, ah as DocConfigurePoolSchema, ai as DocEnvoyConfigSchema, aj as DocRegistryConfigSchema, ak as DocServerlessConfigSchema, al as DocSqliteConfigSchema, am as FetchHandler, an as GlobalActorOptions, ao as GlobalActorOptionsInput, ap as GlobalActorOptionsSchema, aq as HideInspectorTabEntrySchema, ar as InferEventArgs, as as InferSchemaMap, at as InspectorTabEntrySchema, au as InspectorUnsubscribe, av as InstanceActorOptions, aw as InstanceActorOptionsInput, ax as InstanceActorOptionsSchema, ay as QueueEnqueueAndWaitOptions, az as QueueFilterName, aA as QueueIterOptions, aB as QueueMessageOf, aC as QueueName, aD as QueueNextBatchOptions, aE as QueueNextOptions, aF as QueueResultMessageForName, aG as QueueTryNextBatchOptions, aH as QueueTryNextOptions, aI as QueueWaitOptions, aJ as RAW_STATE_SYMBOL, aK as Registry, aL as RegistryActors, aM as RegistryApplication, aN as RegistryConfig, aO as RegistryConfigInput, aP as RegistryConfigSchema, aQ as RegistryDeps, aR as RegistryListenOptions, aS as RegistryRoutes, aT as RunConfig, aU as RunConfigSchema, aV as RunControl, aW as RunInspectorConfig, aX as RunInspectorFactoryContext, aY as RunInspectorFactoryResult, aZ as RunInspectorKind, a_ as RunWithInactiveOptions, a$ as RuntimeKind, b0 as RuntimeKindSchema, b1 as ScheduledEventInfo, b2 as ScheduledFireInfo, b3 as ServerlessHandler, b4 as SqliteBackend, b5 as SqliteBackendSchema, b6 as SqliteConfig, b7 as SqliteConfigSchema, b8 as TestConfig, b9 as TestConfigSchema, ba as Type, bb as WasmRuntimeBindings, bc as WasmRuntimeConfig, bd as WasmRuntimeConfigSchema, be as WasmRuntimeInitInput, bf as WorkflowInspectorConfig, bg as WorkflowOutcome, bh as WorkflowSpan, bi as WorkflowStepOutcome, bj as WorkflowStepSpan, bk as actor, bl as buildActorNames, bm as createClientWithDriver, bn as defineRunHandler, bo as disposeRunInspector, bp as event, bq as getRunFunction, br as getRunInspectorConfig, bs as getRunMetadata, bt as isStaticActorDefinition, bu as isStaticActorInstance, bv as lookupInRegistry, bw as queue, bx as setup, by as test } from './config-DLXQ_TVP.js';
3
3
  export { E as Encoding, t as toUint8Array } from './utils-C1O-SklO.js';
4
4
  import { UniversalWebSocket } from '@rivetkit/virtual-websocket';
5
5
  export { RivetCloseEvent, RivetEvent, RivetMessageEvent, UniversalWebSocket } from '@rivetkit/virtual-websocket';
6
- import { A as AnyDatabaseProvider } from './config-CBTr4IhE.js';
6
+ import { A as AnyDatabaseProvider } from './config-Df5jOcde.js';
7
7
  export { R as ActorError, R as RivetError, a as RivetErrorLike, b as RivetErrorOptions, U as UserError, c as UserErrorOptions, n as noopNext } from './utils-3rsE0JvI.js';
8
8
  import { WSContext } from 'hono/ws';
9
- export { W as WorkflowBranchContextOf, a as WorkflowContextOf, b as WorkflowLoopContextOf, c as WorkflowStepContextOf } from './context-B-wRuYrf.js';
9
+ export { W as WorkflowBranchContextOf, a as WorkflowContextOf, b as WorkflowLoopContextOf, c as WorkflowStepContextOf } from './context-Dmz9Hd6K.js';
10
10
  import 'zod/v4';
11
11
  import '@rivetkit/rivetkit-wasm';
12
12
  import 'zod';
package/dist/tsup/mod.js CHANGED
@@ -1,3 +1,6 @@
1
+ import {
2
+ decodeWorkflowHistoryTransport
3
+ } from "./chunk-5RE3IF3C.js";
1
4
  import {
2
5
  ACTOR_CONTEXT_INTERNAL_SYMBOL,
3
6
  ActorConfigSchema,
@@ -15,9 +18,6 @@ import {
15
18
  getRunMetadata,
16
19
  hasRunInspectorConfig
17
20
  } from "./chunk-IHEO5OT3.js";
18
- import {
19
- decodeWorkflowHistoryTransport
20
- } from "./chunk-JWREVWQL.js";
21
21
  import {
22
22
  ALLOWED_PUBLIC_HEADERS,
23
23
  ENGINE_HOST,
@@ -35,17 +35,17 @@ import {
35
35
  runWithActorInvocationSpan,
36
36
  tryParseEndpoint,
37
37
  updateRunnerConfig
38
- } from "./chunk-HXFGYYOA.js";
38
+ } from "./chunk-7PUO5YRK.js";
39
39
  import {
40
40
  makePrefixedKey,
41
41
  removePrefixFromKey
42
42
  } from "./chunk-A2CF6PFH.js";
43
- import "./chunk-RROV4JN4.js";
43
+ import "./chunk-SPLLB6BX.js";
44
44
  import {
45
45
  bindNativeStateTransactionContext,
46
46
  db,
47
47
  registerNativeStateTransactionOpener
48
- } from "./chunk-HPVDAB3Q.js";
48
+ } from "./chunk-LNMODE5R.js";
49
49
  import "./chunk-JTHHCZCZ.js";
50
50
  import {
51
51
  LogLevelSchema,
@@ -80,7 +80,7 @@ import {
80
80
  parsePortEnv,
81
81
  stringifyError,
82
82
  toUint8Array
83
- } from "./chunk-CSYHVROJ.js";
83
+ } from "./chunk-WD6L6OTX.js";
84
84
  import {
85
85
  INTERNAL_ERROR_CODE,
86
86
  RivetError,
@@ -971,6 +971,10 @@ var DocRegistryConfigSchema = z3.object({
971
971
  import { VirtualWebSocket as VirtualWebSocket2 } from "@rivetkit/virtual-websocket";
972
972
 
973
973
  // src/common/database/native-database.ts
974
+ function isSynchronousTransaction(transaction) {
975
+ const candidate = transaction;
976
+ return typeof candidate.commitSync === "function" && typeof candidate.rollbackSync === "function";
977
+ }
974
978
  function shouldAttachNativeKvError(message) {
975
979
  return /i\/o error|unable to open database file/i.test(message);
976
980
  }
@@ -991,13 +995,16 @@ function toNativeBinding(arg) {
991
995
  if (arg === null || arg === void 0) {
992
996
  return { kind: "null" };
993
997
  }
994
- if (typeof arg === "bigint") {
995
- return { kind: "int", intValue: Number(arg) };
998
+ if (typeof arg === "bigint" || typeof arg === "number" && Number.isInteger(arg)) {
999
+ const value = Number(arg);
1000
+ if (!Number.isSafeInteger(value)) {
1001
+ throw new RangeError(
1002
+ "SQLite integer bindings must be within the JavaScript safe integer range."
1003
+ );
1004
+ }
1005
+ return { kind: "int", intValue: value };
996
1006
  }
997
1007
  if (typeof arg === "number") {
998
- if (Number.isInteger(arg)) {
999
- return { kind: "int", intValue: arg };
1000
- }
1001
1008
  return { kind: "float", floatValue: arg };
1002
1009
  }
1003
1010
  if (typeof arg === "string") {
@@ -1014,9 +1021,10 @@ function toNativeBinding(arg) {
1014
1021
  function extractNamedSqliteParameters(sql) {
1015
1022
  const orderedNames = [];
1016
1023
  const seen = /* @__PURE__ */ new Set();
1017
- const pattern = /([:@$][A-Za-z_][A-Za-z0-9_]*)/g;
1024
+ const pattern = /'(?:''|[^'])*'|"(?:""|[^"])*"|`(?:``|[^`])*`|\[[^\]]*\]|--[^\n]*|\/\*[\s\S]*?(?:\*\/|$)|([:@$][\w$\u0080-\u{10FFFF}]+(?:::[\w$\u0080-\u{10FFFF}]+)*(?:\([^)]*\))?)|[A-Za-z_\u0080-\u{10FFFF}][\w$\u0080-\u{10FFFF}]*/gu;
1018
1025
  for (const match of sql.matchAll(pattern)) {
1019
1026
  const name = match[1];
1027
+ if (!name) continue;
1020
1028
  if (seen.has(name)) {
1021
1029
  continue;
1022
1030
  }
@@ -1135,20 +1143,44 @@ function wrapJsNativeDatabase(database) {
1135
1143
  let terminalPromise;
1136
1144
  let lastInsertRowId = null;
1137
1145
  const executeNative = async (sql, params) => {
1138
- const lastInsertRowIdColumn = lastInsertRowIdColumnName(sql);
1139
- if (lastInsertRowIdColumn) {
1140
- return {
1141
- columns: [lastInsertRowIdColumn],
1142
- rows: [[lastInsertRowId ?? 0]],
1143
- changes: 0,
1144
- lastInsertRowId
1145
- };
1146
- }
1147
1146
  const release = gate.enter();
1148
1147
  try {
1148
+ const lastInsertRowIdColumn = lastInsertRowIdColumnName(sql);
1149
+ if (lastInsertRowIdColumn) {
1150
+ return {
1151
+ columns: [lastInsertRowIdColumn],
1152
+ rows: [[lastInsertRowId ?? 0]],
1153
+ changes: 0,
1154
+ lastInsertRowId
1155
+ };
1156
+ }
1149
1157
  const nativeParams = toNativeBindings(sql, params);
1150
1158
  const result = await database.execute(sql, nativeParams);
1151
- if (result.lastInsertRowId !== void 0) {
1159
+ if (result.lastInsertRowId != null) {
1160
+ lastInsertRowId = result.lastInsertRowId;
1161
+ }
1162
+ return result;
1163
+ } catch (error) {
1164
+ enrichNativeDatabaseError(database, error);
1165
+ } finally {
1166
+ release();
1167
+ }
1168
+ };
1169
+ const executeNativeSync = (sql, params) => {
1170
+ const release = gate.enter();
1171
+ try {
1172
+ const nativeParams = toNativeBindings(sql, params);
1173
+ const result = database.executeSync(sql, nativeParams);
1174
+ const rowIdColumn = lastInsertRowIdColumnName(sql);
1175
+ if (rowIdColumn) {
1176
+ return {
1177
+ columns: [rowIdColumn],
1178
+ rows: [[lastInsertRowId ?? 0]],
1179
+ changes: 0,
1180
+ lastInsertRowId
1181
+ };
1182
+ }
1183
+ if (result.lastInsertRowId != null) {
1152
1184
  lastInsertRowId = result.lastInsertRowId;
1153
1185
  }
1154
1186
  return result;
@@ -1176,9 +1208,28 @@ function wrapJsNativeDatabase(database) {
1176
1208
  callback(row, result.columns);
1177
1209
  }
1178
1210
  },
1211
+ execSync(sql, callback) {
1212
+ const release = gate.enter();
1213
+ let result;
1214
+ try {
1215
+ result = database.execSync(sql);
1216
+ } catch (error) {
1217
+ enrichNativeDatabaseError(database, error);
1218
+ } finally {
1219
+ release();
1220
+ }
1221
+ if (callback) {
1222
+ for (const row of result.rows) {
1223
+ callback(row, result.columns);
1224
+ }
1225
+ }
1226
+ },
1179
1227
  async execute(sql, params) {
1180
1228
  return await executeNative(sql, params);
1181
1229
  },
1230
+ executeSync(sql, params) {
1231
+ return executeNativeSync(sql, params);
1232
+ },
1182
1233
  async executeBatch(statements) {
1183
1234
  const nativeStatements = statements.map(toNativeBatchStatement);
1184
1235
  const release = gate.enter();
@@ -1200,7 +1251,7 @@ function wrapJsNativeDatabase(database) {
1200
1251
  return transactionResults;
1201
1252
  })();
1202
1253
  for (const result of results) {
1203
- if (result.lastInsertRowId !== void 0) {
1254
+ if (result.lastInsertRowId != null) {
1204
1255
  lastInsertRowId = result.lastInsertRowId;
1205
1256
  }
1206
1257
  }
@@ -1228,7 +1279,23 @@ function wrapJsNativeDatabase(database) {
1228
1279
  release();
1229
1280
  }
1230
1281
  return wrapTransaction(database, transaction, gate, (result) => {
1231
- if (result.lastInsertRowId !== void 0) {
1282
+ if (result.lastInsertRowId != null) {
1283
+ lastInsertRowId = result.lastInsertRowId;
1284
+ }
1285
+ });
1286
+ },
1287
+ beginTransactionSync(timeoutMs, name) {
1288
+ const release = gate.enter();
1289
+ let transaction;
1290
+ try {
1291
+ transaction = database.beginTransactionSync(timeoutMs, name);
1292
+ } catch (error) {
1293
+ enrichNativeDatabaseError(database, error);
1294
+ } finally {
1295
+ release();
1296
+ }
1297
+ return wrapTransaction(database, transaction, gate, (result) => {
1298
+ if (result.lastInsertRowId != null) {
1232
1299
  lastInsertRowId = result.lastInsertRowId;
1233
1300
  }
1234
1301
  });
@@ -1250,7 +1317,7 @@ function wrapJsNativeDatabase(database) {
1250
1317
  release();
1251
1318
  }
1252
1319
  return wrapTransaction(database, transaction, gate, (result) => {
1253
- if (result.lastInsertRowId !== void 0) {
1320
+ if (result.lastInsertRowId != null) {
1254
1321
  lastInsertRowId = result.lastInsertRowId;
1255
1322
  }
1256
1323
  });
@@ -1266,6 +1333,25 @@ function wrapJsNativeDatabase(database) {
1266
1333
  var _a;
1267
1334
  return normalizeNativeMetrics((_a = database.metrics) == null ? void 0 : _a.call(database));
1268
1335
  },
1336
+ async open() {
1337
+ const release = gate.enter();
1338
+ try {
1339
+ await database.open();
1340
+ } catch (error) {
1341
+ enrichNativeDatabaseError(database, error);
1342
+ } finally {
1343
+ release();
1344
+ }
1345
+ },
1346
+ commitTicket() {
1347
+ return database.commitTicket();
1348
+ },
1349
+ async whenDurable(ticket) {
1350
+ await database.whenDurable(ticket);
1351
+ },
1352
+ abortGeneration(reason) {
1353
+ database.abortGeneration(reason);
1354
+ },
1269
1355
  async close() {
1270
1356
  terminalPromise ??= gate.close(() => database.close());
1271
1357
  await terminalPromise;
@@ -1277,7 +1363,7 @@ function wrapJsNativeDatabase(database) {
1277
1363
  };
1278
1364
  }
1279
1365
  function wrapTransaction(database, transaction, gate, onExecute) {
1280
- return {
1366
+ const wrapped = {
1281
1367
  async exec(sql, callback) {
1282
1368
  const release = gate.enter();
1283
1369
  let result;
@@ -1328,6 +1414,61 @@ function wrapTransaction(database, transaction, gate, onExecute) {
1328
1414
  }
1329
1415
  }
1330
1416
  };
1417
+ if (isSynchronousTransaction(transaction)) {
1418
+ return Object.assign(wrapped, {
1419
+ execSync(sql, callback) {
1420
+ const release = gate.enter();
1421
+ let result;
1422
+ try {
1423
+ result = transaction.execSync(sql);
1424
+ } catch (error) {
1425
+ enrichNativeDatabaseError(database, error);
1426
+ } finally {
1427
+ release();
1428
+ }
1429
+ if (callback) {
1430
+ for (const row of result.rows)
1431
+ callback(row, result.columns);
1432
+ }
1433
+ },
1434
+ executeSync(sql, params) {
1435
+ const release = gate.enter();
1436
+ try {
1437
+ const result = transaction.executeSync(
1438
+ sql,
1439
+ toNativeBindings(sql, params)
1440
+ );
1441
+ onExecute(result);
1442
+ return result;
1443
+ } catch (error) {
1444
+ enrichNativeDatabaseError(database, error);
1445
+ } finally {
1446
+ release();
1447
+ }
1448
+ },
1449
+ commitSync() {
1450
+ const release = gate.enter();
1451
+ try {
1452
+ transaction.commitSync();
1453
+ } catch (error) {
1454
+ enrichNativeDatabaseError(database, error);
1455
+ } finally {
1456
+ release();
1457
+ }
1458
+ },
1459
+ rollbackSync() {
1460
+ const release = gate.enter();
1461
+ try {
1462
+ transaction.rollbackSync();
1463
+ } catch (error) {
1464
+ enrichNativeDatabaseError(database, error);
1465
+ } finally {
1466
+ release();
1467
+ }
1468
+ }
1469
+ });
1470
+ }
1471
+ return wrapped;
1331
1472
  }
1332
1473
  function lastInsertRowIdColumnName(sql) {
1333
1474
  const match = sql.match(
@@ -1927,6 +2068,9 @@ var NapiCoreRuntime = class {
1927
2068
  async actorSqlExec(ctx, sql) {
1928
2069
  return await this.#actorSql(ctx).exec(sql);
1929
2070
  }
2071
+ actorSqlExecSync(ctx, sql) {
2072
+ return this.#actorSql(ctx).execSync(sql);
2073
+ }
1930
2074
  async actorSqlExecute(ctx, sql, params) {
1931
2075
  const result = await this.#actorSql(ctx).execute(
1932
2076
  sql,
@@ -1934,6 +2078,13 @@ var NapiCoreRuntime = class {
1934
2078
  );
1935
2079
  return normalizeRuntimeSqlExecuteResult(result);
1936
2080
  }
2081
+ actorSqlExecuteSync(ctx, sql, params) {
2082
+ const result = this.#actorSql(ctx).executeSync(
2083
+ sql,
2084
+ toNapiSqlBindParams(params)
2085
+ );
2086
+ return normalizeRuntimeSqlExecuteResult(result);
2087
+ }
1937
2088
  async actorSqlExecuteBatch(ctx, statements) {
1938
2089
  const results = await this.#actorSql(ctx).executeBatch(
1939
2090
  statements.map(toNapiSqlBatchStatement)
@@ -1946,9 +2097,18 @@ var NapiCoreRuntime = class {
1946
2097
  name
1947
2098
  );
1948
2099
  }
2100
+ actorSqlBeginTransactionSync(ctx, timeoutMs, name) {
2101
+ return this.#actorSql(ctx).beginTransactionSync(
2102
+ timeoutMs,
2103
+ name
2104
+ );
2105
+ }
1949
2106
  async actorSqlTransactionExec(transaction, sql) {
1950
2107
  return await asNativeSqlTransaction(transaction).exec(sql);
1951
2108
  }
2109
+ actorSqlTransactionExecSync(transaction, sql) {
2110
+ return asNativeSqlTransaction(transaction).execSync(sql);
2111
+ }
1952
2112
  async actorSqlTransactionExecute(transaction, sql, params) {
1953
2113
  const result = await asNativeSqlTransaction(transaction).execute(
1954
2114
  sql,
@@ -1956,12 +2116,25 @@ var NapiCoreRuntime = class {
1956
2116
  );
1957
2117
  return normalizeRuntimeSqlExecuteResult(result);
1958
2118
  }
2119
+ actorSqlTransactionExecuteSync(transaction, sql, params) {
2120
+ const result = asNativeSqlTransaction(transaction).executeSync(
2121
+ sql,
2122
+ toNapiSqlBindParams(params)
2123
+ );
2124
+ return normalizeRuntimeSqlExecuteResult(result);
2125
+ }
1959
2126
  async actorSqlTransactionCommit(transaction) {
1960
2127
  await asNativeSqlTransaction(transaction).commit();
1961
2128
  }
2129
+ actorSqlTransactionCommitSync(transaction) {
2130
+ asNativeSqlTransaction(transaction).commitSync();
2131
+ }
1962
2132
  async actorSqlTransactionRollback(transaction) {
1963
2133
  await asNativeSqlTransaction(transaction).rollback();
1964
2134
  }
2135
+ actorSqlTransactionRollbackSync(transaction) {
2136
+ asNativeSqlTransaction(transaction).rollbackSync();
2137
+ }
1965
2138
  async actorBeginStateTransaction(ctx, timeoutMs) {
1966
2139
  return await this.#actorContextForOperation(ctx).beginStateTransaction(
1967
2140
  timeoutMs
@@ -1999,6 +2172,18 @@ var NapiCoreRuntime = class {
1999
2172
  var _a, _b;
2000
2173
  return ((_b = (_a = this.#actorSql(ctx)).takeLastKvError) == null ? void 0 : _b.call(_a)) ?? null;
2001
2174
  }
2175
+ async actorSqlOpen(ctx) {
2176
+ await this.#actorSql(ctx).open();
2177
+ }
2178
+ actorSqlCommitTicket(ctx) {
2179
+ return this.#actorSql(ctx).commitTicket();
2180
+ }
2181
+ actorSqlAbortGeneration(ctx, reason) {
2182
+ this.#actorSql(ctx).abortGeneration(reason);
2183
+ }
2184
+ async actorSqlWhenDurable(ctx, ticket) {
2185
+ await this.#actorSql(ctx).whenDurable(ticket);
2186
+ }
2002
2187
  async actorSqlClose(ctx) {
2003
2188
  const nativeCtx = asNativeActorContext(ctx);
2004
2189
  if (!this.#sqlOpened.delete(nativeCtx)) {
@@ -2579,6 +2764,17 @@ function optionalWasmNumber(value) {
2579
2764
  function wasmNumber(value) {
2580
2765
  return typeof value === "bigint" ? Number(value) : value;
2581
2766
  }
2767
+ function synchronousSqliteUnavailable() {
2768
+ throw new RivetError(
2769
+ "sqlite",
2770
+ "sync_unsupported",
2771
+ "Synchronous SQLite is unavailable because the actor runs on the wasm runtime.",
2772
+ {
2773
+ public: true,
2774
+ metadata: { runtime: "wasm" }
2775
+ }
2776
+ );
2777
+ }
2582
2778
  function normalizeKvEntry(entry) {
2583
2779
  return {
2584
2780
  key: toBytes(entry.key),
@@ -2730,6 +2926,14 @@ var WasmCoreRuntime = class {
2730
2926
  );
2731
2927
  }
2732
2928
  createActorFactory(callbacks, config) {
2929
+ if (config == null ? void 0 : config.sqliteDeferredCommits) {
2930
+ throw new RivetError(
2931
+ "sqlite",
2932
+ "deferred_commits_unsupported",
2933
+ "SQLite deferred commits require local native SQLite, but the wasm runtime uses remote SQLite.",
2934
+ { metadata: { runtime: "wasm" } }
2935
+ );
2936
+ }
2733
2937
  return callWasmSync(
2734
2938
  () => asActorFactoryHandle2(
2735
2939
  new this.#constructors.ActorFactory(callbacks, config)
@@ -3012,12 +3216,18 @@ var WasmCoreRuntime = class {
3012
3216
  async actorSqlExec(ctx, sql) {
3013
3217
  return await callWasm(() => this.#actorSql(ctx).exec(sql));
3014
3218
  }
3219
+ actorSqlExecSync(_ctx, _sql) {
3220
+ return synchronousSqliteUnavailable();
3221
+ }
3015
3222
  async actorSqlExecute(ctx, sql, params) {
3016
3223
  const result = await callWasm(
3017
3224
  () => this.#actorSql(ctx).execute(sql, params)
3018
3225
  );
3019
3226
  return normalizeRuntimeSqlExecuteResult(result);
3020
3227
  }
3228
+ actorSqlExecuteSync(_ctx, _sql, _params) {
3229
+ return synchronousSqliteUnavailable();
3230
+ }
3021
3231
  async actorSqlExecuteBatch(ctx, statements) {
3022
3232
  const results = await callWasm(
3023
3233
  () => this.#actorSql(ctx).executeBatch(statements)
@@ -3029,27 +3239,42 @@ var WasmCoreRuntime = class {
3029
3239
  () => this.#actorSql(ctx).beginTransaction(timeoutMs, name)
3030
3240
  );
3031
3241
  }
3242
+ actorSqlBeginTransactionSync(_ctx, _timeoutMs, _name) {
3243
+ return synchronousSqliteUnavailable();
3244
+ }
3032
3245
  async actorSqlTransactionExec(transaction, sql) {
3033
3246
  return await callWasm(
3034
3247
  () => transaction.exec(sql)
3035
3248
  );
3036
3249
  }
3250
+ actorSqlTransactionExecSync(_transaction, _sql) {
3251
+ return synchronousSqliteUnavailable();
3252
+ }
3037
3253
  async actorSqlTransactionExecute(transaction, sql, params) {
3038
3254
  const result = await callWasm(
3039
3255
  () => transaction.execute(sql, params)
3040
3256
  );
3041
3257
  return normalizeRuntimeSqlExecuteResult(result);
3042
3258
  }
3259
+ actorSqlTransactionExecuteSync(_transaction, _sql, _params) {
3260
+ return synchronousSqliteUnavailable();
3261
+ }
3043
3262
  async actorSqlTransactionCommit(transaction) {
3044
3263
  await callWasm(
3045
3264
  () => transaction.commit()
3046
3265
  );
3047
3266
  }
3267
+ actorSqlTransactionCommitSync(_transaction) {
3268
+ synchronousSqliteUnavailable();
3269
+ }
3048
3270
  async actorSqlTransactionRollback(transaction) {
3049
3271
  await callWasm(
3050
3272
  () => transaction.rollback()
3051
3273
  );
3052
3274
  }
3275
+ actorSqlTransactionRollbackSync(_transaction) {
3276
+ synchronousSqliteUnavailable();
3277
+ }
3053
3278
  async actorBeginStateTransaction(ctx, timeoutMs) {
3054
3279
  return await callWasm(
3055
3280
  () => asWasmActorContext(ctx).beginStateTransaction(timeoutMs)
@@ -3085,6 +3310,17 @@ var WasmCoreRuntime = class {
3085
3310
  var _a, _b;
3086
3311
  return ((_b = (_a = this.#actorSql(ctx)).takeLastKvError) == null ? void 0 : _b.call(_a)) ?? null;
3087
3312
  }
3313
+ async actorSqlOpen(_ctx) {
3314
+ }
3315
+ actorSqlCommitTicket(_ctx) {
3316
+ return synchronousSqliteUnavailable();
3317
+ }
3318
+ actorSqlAbortGeneration(_ctx, _reason) {
3319
+ synchronousSqliteUnavailable();
3320
+ }
3321
+ async actorSqlWhenDurable(_ctx, _ticket) {
3322
+ synchronousSqliteUnavailable();
3323
+ }
3088
3324
  async actorSqlClose(ctx) {
3089
3325
  const wasmCtx = asWasmActorContext(ctx);
3090
3326
  const database = this.#sql.get(wasmCtx);
@@ -3730,15 +3966,29 @@ async function closeNativeDatabaseClient(runtime, ctx) {
3730
3966
  await entry.client.close();
3731
3967
  }
3732
3968
  }
3969
+ function createNativeSqlTransaction(runtime, transaction) {
3970
+ return {
3971
+ exec: (sql) => runtime.actorSqlTransactionExec(transaction, sql),
3972
+ execSync: (sql) => runtime.actorSqlTransactionExecSync(transaction, sql),
3973
+ execute: (sql, params) => runtime.actorSqlTransactionExecute(transaction, sql, params),
3974
+ executeSync: (sql, params) => runtime.actorSqlTransactionExecuteSync(transaction, sql, params),
3975
+ commit: () => runtime.actorSqlTransactionCommit(transaction),
3976
+ commitSync: () => runtime.actorSqlTransactionCommitSync(transaction),
3977
+ rollback: () => runtime.actorSqlTransactionRollback(transaction),
3978
+ rollbackSync: () => runtime.actorSqlTransactionRollbackSync(transaction)
3979
+ };
3980
+ }
3733
3981
  function getOrCreateNativeSqlDatabase(runtime, ctx) {
3734
3982
  const runtimeState = getNativeRuntimeState(runtime, ctx);
3735
3983
  const cachedDatabase = runtimeState.sql;
3736
3984
  if (cachedDatabase) {
3737
3985
  return cachedDatabase;
3738
3986
  }
3739
- const database = wrapJsNativeDatabase({
3987
+ const bindings = {
3740
3988
  exec: (sql) => runtime.actorSqlExec(ctx, sql),
3989
+ execSync: (sql) => runtime.actorSqlExecSync(ctx, sql),
3741
3990
  execute: (sql, params) => runtime.actorSqlExecute(ctx, sql, params),
3991
+ executeSync: (sql, params) => runtime.actorSqlExecuteSync(ctx, sql, params),
3742
3992
  executeBatch: (statements) => runtime.actorSqlExecuteBatch(ctx, statements),
3743
3993
  beginTransaction: async (timeoutMs, name) => {
3744
3994
  const transaction = await runtime.actorSqlBeginTransaction(
@@ -3746,16 +3996,15 @@ function getOrCreateNativeSqlDatabase(runtime, ctx) {
3746
3996
  timeoutMs,
3747
3997
  name
3748
3998
  );
3749
- return {
3750
- exec: (sql) => runtime.actorSqlTransactionExec(transaction, sql),
3751
- execute: (sql, params) => runtime.actorSqlTransactionExecute(
3752
- transaction,
3753
- sql,
3754
- params
3755
- ),
3756
- commit: () => runtime.actorSqlTransactionCommit(transaction),
3757
- rollback: () => runtime.actorSqlTransactionRollback(transaction)
3758
- };
3999
+ return createNativeSqlTransaction(runtime, transaction);
4000
+ },
4001
+ beginTransactionSync: (timeoutMs, name) => {
4002
+ const transaction = runtime.actorSqlBeginTransactionSync(
4003
+ ctx,
4004
+ timeoutMs,
4005
+ name
4006
+ );
4007
+ return createNativeSqlTransaction(runtime, transaction);
3759
4008
  },
3760
4009
  beginStateTransaction: async (timeoutMs, context) => {
3761
4010
  const scope = context;
@@ -3793,8 +4042,13 @@ function getOrCreateNativeSqlDatabase(runtime, ctx) {
3793
4042
  run: (sql, params) => runtime.actorSqlRun(ctx, sql, params),
3794
4043
  metrics: () => runtime.actorSqlMetrics(ctx),
3795
4044
  takeLastKvError: () => runtime.actorSqlTakeLastKvError(ctx),
4045
+ open: () => runtime.actorSqlOpen(ctx),
4046
+ commitTicket: () => runtime.actorSqlCommitTicket(ctx),
4047
+ whenDurable: (ticket) => runtime.actorSqlWhenDurable(ctx, ticket),
4048
+ abortGeneration: (reason) => runtime.actorSqlAbortGeneration(ctx, reason),
3796
4049
  close: () => runtime.actorSqlClose(ctx)
3797
- });
4050
+ };
4051
+ const database = wrapJsNativeDatabase(bindings);
3798
4052
  runtimeState.sql = database;
3799
4053
  return database;
3800
4054
  }
@@ -5547,10 +5801,12 @@ var ActorContextHandleAdapter = class {
5547
5801
  {
5548
5802
  open: async (requestedActorId) => {
5549
5803
  void requestedActorId;
5550
- return getOrCreateNativeSqlDatabase(
5804
+ const database = getOrCreateNativeSqlDatabase(
5551
5805
  this.#runtime,
5552
5806
  this.#ctx
5553
5807
  );
5808
+ await database.open();
5809
+ return database;
5554
5810
  }
5555
5811
  },
5556
5812
  async (timeoutMs, context) => await getOrCreateNativeSqlDatabase(
@@ -6153,18 +6409,21 @@ function buildActorTracingConfig(actions, tracing) {
6153
6409
  actions: flattenActionTraceSamplers(actions, tracing.actions)
6154
6410
  };
6155
6411
  }
6412
+ var SQLITE_DEFERRED_COMMITS = /* @__PURE__ */ Symbol.for("rivetkit.sqlite.deferredCommits");
6156
6413
  function buildActorConfig(definition, registryConfig, runtimeKind) {
6157
- var _a;
6414
+ var _a, _b;
6158
6415
  const config = definition.config;
6159
6416
  const options = config.options ?? {};
6160
6417
  const canHibernate = options.canHibernateWebSocket;
6161
6418
  const usesRemoteSqlite = sqliteBackendForConfig(registryConfig) === "remote";
6162
6419
  const sqliteProfiling = (_a = config.db) == null ? void 0 : _a.sqliteProfiling;
6420
+ const sqliteDeferredCommits = ((_b = config.db) == null ? void 0 : _b[SQLITE_DEFERRED_COMMITS]) === true;
6163
6421
  return {
6164
6422
  name: options.name,
6165
6423
  icon: options.icon,
6166
6424
  hasDatabase: true,
6167
6425
  remoteSqlite: usesRemoteSqlite,
6426
+ sqliteDeferredCommits: sqliteDeferredCommits || void 0,
6168
6427
  sqliteProfiling,
6169
6428
  tracing: buildActorTracingConfig(
6170
6429
  definition.config.actions,