rivetkit 0.0.0-sqlite-query-metrics-v3.1dff84f → 0.0.0-sqlite-sync-3-0-6-final.cf8679c

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 (118) hide show
  1. package/dist/browser/client.d.ts +95 -20
  2. package/dist/browser/client.js +2 -2
  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-HXJ5U2ZI.cjs → chunk-275ZGRSG.cjs} +3 -3
  7. package/dist/tsup/{chunk-HXJ5U2ZI.cjs.map → chunk-275ZGRSG.cjs.map} +1 -1
  8. package/dist/tsup/{chunk-HFGXV2CC.cjs → chunk-E54YPM4V.cjs} +10 -10
  9. package/dist/tsup/{chunk-HFGXV2CC.cjs.map → chunk-E54YPM4V.cjs.map} +1 -1
  10. package/dist/tsup/{chunk-Y4QLVCCS.cjs → chunk-I26AW6BG.cjs} +2 -2
  11. package/dist/tsup/{chunk-Y4QLVCCS.cjs.map → chunk-I26AW6BG.cjs.map} +1 -1
  12. package/dist/tsup/{chunk-CWN7N5AF.cjs → chunk-JHHUCWBC.cjs} +7 -7
  13. package/dist/tsup/{chunk-CWN7N5AF.cjs.map → chunk-JHHUCWBC.cjs.map} +1 -1
  14. package/dist/tsup/{chunk-22S5RCCJ.cjs → chunk-LYXPQB6H.cjs} +3 -3
  15. package/dist/tsup/{chunk-22S5RCCJ.cjs.map → chunk-LYXPQB6H.cjs.map} +1 -1
  16. package/dist/tsup/{chunk-NNCL4IBC.js → chunk-M72ZKQ7R.js} +2 -2
  17. package/dist/tsup/{chunk-NNCL4IBC.js.map → chunk-M72ZKQ7R.js.map} +1 -1
  18. package/dist/tsup/{chunk-QQIFRR3B.js → chunk-ME74LHJM.js} +7 -7
  19. package/dist/tsup/chunk-ME74LHJM.js.map +1 -0
  20. package/dist/tsup/{chunk-UXDASKP6.js → chunk-PBIQPYE5.js} +12 -13
  21. package/dist/tsup/chunk-PBIQPYE5.js.map +1 -0
  22. package/dist/tsup/{chunk-2CTZU7GL.js → chunk-R4QCQBB4.js} +2 -2
  23. package/dist/tsup/{chunk-SW33HMM5.js → chunk-RJ7WDGOJ.js} +3 -3
  24. package/dist/tsup/{chunk-NG5CUXMM.cjs → chunk-SJJWJU26.cjs} +145 -145
  25. package/dist/tsup/chunk-SJJWJU26.cjs.map +1 -0
  26. package/dist/tsup/{chunk-HRKFVQPS.js → chunk-SSMFNH4N.js} +4 -4
  27. package/dist/tsup/{chunk-Y5CFDGPA.cjs → chunk-TKCX6KNZ.cjs} +4 -4
  28. package/dist/tsup/{chunk-Y5CFDGPA.cjs.map → chunk-TKCX6KNZ.cjs.map} +1 -1
  29. package/dist/tsup/{chunk-JJUSO7GJ.cjs → chunk-TVBQQXQE.cjs} +3 -3
  30. package/dist/tsup/{chunk-JJUSO7GJ.cjs.map → chunk-TVBQQXQE.cjs.map} +1 -1
  31. package/dist/tsup/{chunk-F5PWAGS7.js → chunk-VXVJHTW6.js} +2 -2
  32. package/dist/tsup/{chunk-FT6VRK4C.js → chunk-XATHAIZX.js} +2 -2
  33. package/dist/tsup/{chunk-D7DWNYEO.js → chunk-Y5TV6V5Z.js} +2 -2
  34. package/dist/tsup/{chunk-SSF2XC33.cjs → chunk-YWWDUC6D.cjs} +12 -13
  35. package/dist/tsup/chunk-YWWDUC6D.cjs.map +1 -0
  36. package/dist/tsup/client/mod.cjs +5 -5
  37. package/dist/tsup/client/mod.d.cts +3 -3
  38. package/dist/tsup/client/mod.d.ts +3 -3
  39. package/dist/tsup/client/mod.js +4 -4
  40. package/dist/tsup/common/log.cjs +2 -2
  41. package/dist/tsup/common/log.js +1 -1
  42. package/dist/tsup/common/websocket.cjs +3 -3
  43. package/dist/tsup/common/websocket.js +2 -2
  44. package/dist/tsup/{config-BnMhcPHl.d.cts → config-5K0rzjv1.d.cts} +72 -25
  45. package/dist/tsup/{config-CBTr4IhE.d.cts → config-Df5jOcde.d.cts} +26 -0
  46. package/dist/tsup/{config-CBTr4IhE.d.ts → config-Df5jOcde.d.ts} +26 -0
  47. package/dist/tsup/{config-BiiS5T5M.d.ts → config-DsAjIyfZ.d.ts} +72 -25
  48. package/dist/tsup/{context-iMxXq_Lt.d.ts → context-B19Rx5Zg.d.cts} +5 -2
  49. package/dist/tsup/{context-DVE8XMm1.d.cts → context-BEh8x4jn.d.ts} +5 -2
  50. package/dist/tsup/db/drizzle.cjs +2 -2
  51. package/dist/tsup/db/drizzle.d.cts +1 -1
  52. package/dist/tsup/db/drizzle.d.ts +1 -1
  53. package/dist/tsup/db/drizzle.js +1 -1
  54. package/dist/tsup/db/mod.cjs +3 -3
  55. package/dist/tsup/db/mod.d.cts +2 -2
  56. package/dist/tsup/db/mod.d.ts +2 -2
  57. package/dist/tsup/db/mod.js +2 -2
  58. package/dist/tsup/dynamic/mod.cjs +2 -2
  59. package/dist/tsup/dynamic/mod.d.cts +2 -2
  60. package/dist/tsup/dynamic/mod.d.ts +2 -2
  61. package/dist/tsup/dynamic/mod.js +1 -1
  62. package/dist/tsup/inspector/mod.cjs +5 -5
  63. package/dist/tsup/inspector/mod.js +4 -4
  64. package/dist/tsup/inspector/workflow.cjs +4 -4
  65. package/dist/tsup/inspector/workflow.js +3 -3
  66. package/dist/tsup/inspector-tab/mod.cjs +2 -2
  67. package/dist/tsup/inspector-tab/mod.d.cts +3 -3
  68. package/dist/tsup/inspector-tab/mod.d.ts +3 -3
  69. package/dist/tsup/inspector-tab/mod.js +1 -1
  70. package/dist/tsup/mod.cjs +548 -169
  71. package/dist/tsup/mod.cjs.map +1 -1
  72. package/dist/tsup/mod.d.cts +6 -4
  73. package/dist/tsup/mod.d.ts +6 -4
  74. package/dist/tsup/mod.js +447 -68
  75. package/dist/tsup/mod.js.map +1 -1
  76. package/dist/tsup/test/mod.cjs +6 -6
  77. package/dist/tsup/test/mod.d.cts +2 -2
  78. package/dist/tsup/test/mod.d.ts +2 -2
  79. package/dist/tsup/test/mod.js +4 -4
  80. package/dist/tsup/unstable/migrations.d.cts +1 -1
  81. package/dist/tsup/unstable/migrations.d.ts +1 -1
  82. package/dist/tsup/utils.cjs +2 -2
  83. package/dist/tsup/utils.js +1 -1
  84. package/dist/tsup/workflow/mod.cjs +13 -10
  85. package/dist/tsup/workflow/mod.cjs.map +1 -1
  86. package/dist/tsup/workflow/mod.d.cts +4 -4
  87. package/dist/tsup/workflow/mod.d.ts +4 -4
  88. package/dist/tsup/workflow/mod.js +8 -5
  89. package/dist/tsup/workflow/mod.js.map +1 -1
  90. package/package.json +9 -9
  91. package/src/actor/config.ts +41 -29
  92. package/src/actor/contexts/index.ts +2 -0
  93. package/src/actor/definition.ts +33 -1
  94. package/src/actor/schema.ts +4 -0
  95. package/src/client/actor-common.ts +4 -0
  96. package/src/client/actor-conn.ts +2 -0
  97. package/src/client/actor-handle.ts +2 -0
  98. package/src/client/config.ts +1 -1
  99. package/src/client/queue.ts +2 -0
  100. package/src/common/database/config.ts +39 -0
  101. package/src/common/database/native-database.ts +230 -21
  102. package/src/registry/index.ts +142 -1
  103. package/src/registry/napi-runtime.ts +93 -4
  104. package/src/registry/native.ts +61 -28
  105. package/src/registry/runtime.ts +58 -8
  106. package/src/registry/wasm-runtime.ts +88 -14
  107. package/src/workflow/context.ts +3 -0
  108. package/dist/tsup/chunk-NG5CUXMM.cjs.map +0 -1
  109. package/dist/tsup/chunk-QQIFRR3B.js.map +0 -1
  110. package/dist/tsup/chunk-SSF2XC33.cjs.map +0 -1
  111. package/dist/tsup/chunk-UXDASKP6.js.map +0 -1
  112. package/src/common/bare/generated/actor-runtime-socket-protocol/v1.ts +0 -848
  113. /package/dist/tsup/{chunk-2CTZU7GL.js.map → chunk-R4QCQBB4.js.map} +0 -0
  114. /package/dist/tsup/{chunk-SW33HMM5.js.map → chunk-RJ7WDGOJ.js.map} +0 -0
  115. /package/dist/tsup/{chunk-HRKFVQPS.js.map → chunk-SSMFNH4N.js.map} +0 -0
  116. /package/dist/tsup/{chunk-F5PWAGS7.js.map → chunk-VXVJHTW6.js.map} +0 -0
  117. /package/dist/tsup/{chunk-FT6VRK4C.js.map → chunk-XATHAIZX.js.map} +0 -0
  118. /package/dist/tsup/{chunk-D7DWNYEO.js.map → chunk-Y5TV6V5Z.js.map} +0 -0
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod/v4';
2
- import { A as AnyDatabaseProvider, a as SqliteProfilingOptions, f as SqliteNativeMetrics, I as InferDatabaseClient } from './config-CBTr4IhE.cjs';
2
+ import { A as AnyDatabaseProvider, a as SqliteProfilingOptions, f as SqliteNativeMetrics, I as InferDatabaseClient } from './config-Df5jOcde.cjs';
3
3
  import * as _rivetkit_rivetkit_wasm from '@rivetkit/rivetkit-wasm';
4
4
  import { z as z$1 } from 'zod';
5
5
  import { Logger } from 'pino';
@@ -420,6 +420,7 @@ interface EventTypeToken<T, TContext = any> {
420
420
  interface QueueTypeToken<TMessage, TComplete = never, TContext = any> {
421
421
  readonly _queueMessage?: TMessage;
422
422
  readonly _queueComplete?: TComplete;
423
+ /** @deprecated Queues were deprecated in 3.0 and will be removed in a future version. Use actions and store pending work in SQLite (`c.db`). See https://rivet.dev/actors/docs/deprecated/queues */
423
424
  readonly canPublish?: SchemaHook<TContext>;
424
425
  readonly message?: PrimitiveSchema;
425
426
  readonly complete?: PrimitiveSchema;
@@ -431,11 +432,13 @@ interface EventOptions<TContext = any> {
431
432
  schema?: PrimitiveSchema;
432
433
  }
433
434
  interface QueueOptions<TContext = any> {
435
+ /** @deprecated Queues were deprecated in 3.0 and will be removed in a future version. Use actions and store pending work in SQLite (`c.db`). See https://rivet.dev/actors/docs/deprecated/queues */
434
436
  canPublish?: SchemaHook<TContext>;
435
437
  message?: PrimitiveSchema;
436
438
  complete?: PrimitiveSchema;
437
439
  }
438
440
  declare function event<T, TContext = any>(options?: EventOptions<TContext>): EventTypeToken<T, TContext>;
441
+ /** @deprecated Queues were deprecated in 3.0 and will be removed in a future version. Use actions and store pending work in SQLite (`c.db`). See https://rivet.dev/actors/docs/deprecated/queues */
439
442
  declare function queue<TMessage, TComplete = never, TContext = any>(options?: QueueOptions<TContext>): QueueTypeToken<TMessage, TComplete, TContext>;
440
443
  type PrimitiveSchema = StandardSchemaV1 | EventTypeToken<unknown, any>;
441
444
  interface EventSchemaDefinition<TContext = any> {
@@ -445,6 +448,7 @@ interface EventSchemaDefinition<TContext = any> {
445
448
  interface QueueSchemaDefinition<TContext = any> {
446
449
  message: PrimitiveSchema;
447
450
  complete?: PrimitiveSchema;
451
+ /** @deprecated Queues were deprecated in 3.0 and will be removed in a future version. Use actions and store pending work in SQLite (`c.db`). See https://rivet.dev/actors/docs/deprecated/queues */
448
452
  canPublish?: SchemaHook<TContext>;
449
453
  }
450
454
  type EventSchema<TContext = any> = PrimitiveSchema | EventSchemaDefinition<TContext>;
@@ -786,9 +790,6 @@ type RuntimeSqlBindParam = ({
786
790
  blobValue: RuntimeBytes;
787
791
  };
788
792
  type RuntimeSqlBindParams = RuntimeSqlBindParam[] | null;
789
- interface RuntimeActorRuntimeSocketEndpointInfo {
790
- path: string;
791
- }
792
793
  interface RuntimeSqlQueryResult {
793
794
  columns: string[];
794
795
  rows: unknown[][];
@@ -816,9 +817,9 @@ interface RuntimeActorConfig {
816
817
  icon?: string;
817
818
  hasDatabase?: boolean;
818
819
  remoteSqlite?: boolean;
820
+ sqliteDeferredCommits?: boolean;
819
821
  sqliteProfiling?: SqliteProfilingOptions;
820
822
  tracing?: RuntimeActorTracingConfig;
821
- enableActorRuntimeSocket?: boolean;
822
823
  hasState?: boolean;
823
824
  canHibernateWebsocket?: boolean;
824
825
  stateSaveIntervalMs?: number;
@@ -953,6 +954,8 @@ interface CoreRuntime {
953
954
  shutdownRegistry(registry: RegistryHandle): Promise<void>;
954
955
  shutdownTelemetry?(): Promise<void>;
955
956
  registryActorStopThresholdMs?(registry: RegistryHandle): Promise<number | undefined>;
957
+ registryActiveActorCount?(registry: RegistryHandle): number;
958
+ onRegistryActiveActorCountChange?(registry: RegistryHandle, callback: (count: number) => void, cancelToken: CancellationTokenHandle): void;
956
959
  handleServerlessRequest(registry: RegistryHandle, req: RuntimeServerlessRequest, onStreamEvent: RuntimeServerlessStreamCallback, cancelToken: CancellationTokenHandle, config: RuntimeServeConfig): Promise<RuntimeServerlessResponseHead>;
957
960
  serveListener(registry: RegistryHandle, listener: RuntimeListenerConfig, config: RuntimeServeConfig): Promise<void>;
958
961
  serveApplicationListener(registry: RegistryHandle, listener: RuntimeApplicationListenerConfig, config: RuntimeServeConfig): Promise<void>;
@@ -1042,13 +1045,20 @@ interface CoreRuntime {
1042
1045
  actorKvBatchPut(ctx: ActorContextHandle, entries: RuntimeKvEntry[]): Promise<void>;
1043
1046
  actorKvBatchDelete(ctx: ActorContextHandle, keys: RuntimeBytes[]): Promise<void>;
1044
1047
  actorSqlExec(ctx: ActorContextHandle, sql: string): Promise<RuntimeSqlExecResult>;
1048
+ actorSqlExecSync(ctx: ActorContextHandle, sql: string): RuntimeSqlExecResult;
1045
1049
  actorSqlExecute(ctx: ActorContextHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlExecuteResult>;
1050
+ actorSqlExecuteSync(ctx: ActorContextHandle, sql: string, params?: RuntimeSqlBindParams): RuntimeSqlExecuteResult;
1046
1051
  actorSqlExecuteBatch(ctx: ActorContextHandle, statements: RuntimeSqlBatchStatement[]): Promise<RuntimeSqlExecuteResult[]>;
1047
1052
  actorSqlBeginTransaction(ctx: ActorContextHandle, timeoutMs?: number, name?: string): Promise<SqliteTransactionHandle>;
1053
+ actorSqlBeginTransactionSync(ctx: ActorContextHandle, timeoutMs?: number, name?: string): SqliteTransactionHandle;
1048
1054
  actorSqlTransactionExec(transaction: SqliteTransactionHandle, sql: string): Promise<RuntimeSqlExecResult>;
1055
+ actorSqlTransactionExecSync(transaction: SqliteTransactionHandle, sql: string): RuntimeSqlExecResult;
1049
1056
  actorSqlTransactionExecute(transaction: SqliteTransactionHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlExecuteResult>;
1057
+ actorSqlTransactionExecuteSync(transaction: SqliteTransactionHandle, sql: string, params?: RuntimeSqlBindParams): RuntimeSqlExecuteResult;
1050
1058
  actorSqlTransactionCommit(transaction: SqliteTransactionHandle): Promise<void>;
1059
+ actorSqlTransactionCommitSync(transaction: SqliteTransactionHandle): void;
1051
1060
  actorSqlTransactionRollback(transaction: SqliteTransactionHandle): Promise<void>;
1061
+ actorSqlTransactionRollbackSync(transaction: SqliteTransactionHandle): void;
1052
1062
  actorBeginStateTransaction(ctx: ActorContextHandle, timeoutMs?: number): Promise<ActorStateTransactionHandle>;
1053
1063
  actorStateTransactionExecute(transaction: ActorStateTransactionHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlExecuteResult>;
1054
1064
  actorStateTransactionCommit(transaction: ActorStateTransactionHandle, payload: RuntimeStateDeltaPayload): Promise<void>;
@@ -1057,8 +1067,14 @@ interface CoreRuntime {
1057
1067
  actorSqlRun(ctx: ActorContextHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlRunResult>;
1058
1068
  actorSqlMetrics(ctx: ActorContextHandle): SqliteNativeMetrics | null;
1059
1069
  actorSqlTakeLastKvError(ctx: ActorContextHandle): string | null;
1070
+ /** Opens the actor database so later synchronous calls never fetch its first pages. */
1071
+ actorSqlOpen(ctx: ActorContextHandle): Promise<void>;
1072
+ /** Returns the ticket of the latest local commit. */
1073
+ actorSqlCommitTicket(ctx: ActorContextHandle): number;
1074
+ /** Resolves once the commit `ticket` names and every earlier commit are durable. */
1075
+ actorSqlWhenDurable(ctx: ActorContextHandle, ticket: number): Promise<void>;
1076
+ actorSqlAbortGeneration(ctx: ActorContextHandle, reason: string): void;
1060
1077
  actorSqlClose(ctx: ActorContextHandle): Promise<void>;
1061
- actorRuntimeSocketProvision(ctx: ActorContextHandle): Promise<RuntimeActorRuntimeSocketEndpointInfo>;
1062
1078
  actorQueueSend(ctx: ActorContextHandle, name: string, body: RuntimeBytes): Promise<RuntimeQueueMessage>;
1063
1079
  actorQueueNextBatch(ctx: ActorContextHandle, options?: RuntimeQueueNextBatchOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<RuntimeQueueMessage[]>;
1064
1080
  actorQueueWaitForNames(ctx: ActorContextHandle, names: string[], options?: RuntimeQueueWaitOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<RuntimeQueueMessage>;
@@ -1215,6 +1231,24 @@ declare class Registry<A extends RegistryActors> {
1215
1231
  * ```
1216
1232
  */
1217
1233
  start(): void;
1234
+ /**
1235
+ * Returns the number of actors hosted by this process's envoy, which is zero
1236
+ * while it is not serving. Requires the native runtime.
1237
+ */
1238
+ activeActorCount(): number;
1239
+ /**
1240
+ * Calls `callback` with the number of actors hosted by this process's envoy
1241
+ * and again whenever it changes. Rapid changes may coalesce.
1242
+ * Returns a function that unsubscribes. Requires the native runtime.
1243
+ *
1244
+ * @example
1245
+ * ```ts
1246
+ * const unsubscribe = registry.onActiveActorCountChange((count) => {
1247
+ * setTaskProtection(count > 0);
1248
+ * });
1249
+ * ```
1250
+ */
1251
+ onActiveActorCountChange(callback: (count: number) => void): () => void;
1218
1252
  }
1219
1253
  declare function setup<A extends RegistryActors>(input: RegistryConfigInput<A>): Registry<A>;
1220
1254
 
@@ -1265,9 +1299,13 @@ type ActorWebSocketOptions = ActorGatewayOptions;
1265
1299
  */
1266
1300
  type ActorDefinitionActions<AD extends AnyActorDefinition> = IsAny<AD> extends true ? Record<string, ActorActionFunction<any[], any>> : ActorActionMap<ActionsOf<AD>>;
1267
1301
  type ActorQueueSend<TQueues extends QueueSchemaConfig> = {
1302
+ /** @deprecated Queues were deprecated in 3.0 and will be removed in a future version. Use actions and store pending work in SQLite (`c.db`). See https://rivet.dev/actors/docs/deprecated/queues */
1268
1303
  <K extends keyof TQueues & string>(name: K, body: InferSchemaMap<TQueues>[K], options: QueueSendWaitOptions): Promise<QueueSendResult<InferQueueCompleteMap<TQueues>[K]>>;
1304
+ /** @deprecated Queues were deprecated in 3.0 and will be removed in a future version. Use actions and store pending work in SQLite (`c.db`). See https://rivet.dev/actors/docs/deprecated/queues */
1269
1305
  <K extends keyof TQueues & string>(name: K, body: InferSchemaMap<TQueues>[K], options?: QueueSendNoWaitOptions): Promise<void>;
1306
+ /** @deprecated Queues were deprecated in 3.0 and will be removed in a future version. Use actions and store pending work in SQLite (`c.db`). See https://rivet.dev/actors/docs/deprecated/queues */
1270
1307
  (name: keyof TQueues extends never ? string : never, body: unknown, options: QueueSendWaitOptions): Promise<QueueSendResult>;
1308
+ /** @deprecated Queues were deprecated in 3.0 and will be removed in a future version. Use actions and store pending work in SQLite (`c.db`). See https://rivet.dev/actors/docs/deprecated/queues */
1271
1309
  (name: keyof TQueues extends never ? string : never, body: unknown, options?: QueueSendNoWaitOptions): Promise<void>;
1272
1310
  };
1273
1311
  type ActorEventSubscribe<TEvents extends EventSchemaConfig> = {
@@ -1351,7 +1389,9 @@ declare class ActorConnRaw {
1351
1389
  * @protected
1352
1390
  */
1353
1391
  constructor(client: ClientRaw, driver: EngineControlClient, params: unknown, getParams: (() => Promise<unknown>) | undefined, encoding: Encoding, actorResolutionState: ActorResolutionState, gatewayOptions?: ActorGatewayOptions, currentActorInvocation?: CurrentActorInvocation);
1392
+ /** @deprecated Queues were deprecated in 3.0 and will be removed in a future version. Use actions and store pending work in SQLite (`c.db`). See https://rivet.dev/actors/docs/deprecated/queues */
1354
1393
  send(name: string, body: unknown, options: QueueSendWaitOptions): Promise<QueueSendResult>;
1394
+ /** @deprecated Queues were deprecated in 3.0 and will be removed in a future version. Use actions and store pending work in SQLite (`c.db`). See https://rivet.dev/actors/docs/deprecated/queues */
1355
1395
  send(name: string, body: unknown, options?: QueueSendNoWaitOptions): Promise<void>;
1356
1396
  /**
1357
1397
  * Call a raw action connection. See {@link ActorConn} for type-safe action calls.
@@ -1508,7 +1548,9 @@ declare class ActorHandleRaw {
1508
1548
  * @protected
1509
1549
  */
1510
1550
  constructor(client: any, driver: EngineControlClient, params: unknown, getParams: (() => Promise<unknown>) | undefined, encoding: Encoding, actorResolutionState: ActorResolutionState, gatewayOptions?: ActorGatewayOptions, signal?: AbortSignal, currentActorInvocation?: CurrentActorInvocation, startCallSpan?: StartCallSpan, retryBudget?: RetryBudget);
1551
+ /** @deprecated Queues were deprecated in 3.0 and will be removed in a future version. Use actions and store pending work in SQLite (`c.db`). See https://rivet.dev/actors/docs/deprecated/queues */
1511
1552
  send(name: string, body: unknown, options: QueueSendWaitOptions): Promise<QueueSendResult>;
1553
+ /** @deprecated Queues were deprecated in 3.0 and will be removed in a future version. Use actions and store pending work in SQLite (`c.db`). See https://rivet.dev/actors/docs/deprecated/queues */
1512
1554
  send(name: string, body: unknown, options?: QueueSendNoWaitOptions): Promise<void>;
1513
1555
  /**
1514
1556
  * Call a raw action. This method sends an HTTP request to invoke the named action.
@@ -1862,10 +1904,7 @@ type ActorKvListOptions<T extends ActorKvValueType = "text", K extends ActorKvKe
1862
1904
  limit?: number;
1863
1905
  };
1864
1906
  type ActorClientFor<T> = T extends Registry<any> ? Client<T> : T;
1865
- /**
1866
- * @deprecated Actor KV is deprecated. Use embedded SQLite (`c.db`)
1867
- * or actor state instead.
1868
- */
1907
+ /** @deprecated Actor KV was deprecated in 3.0 and will be removed in a future version. Store data in SQLite (`c.db`). See https://rivet.dev/actors/docs/deprecated/kv */
1869
1908
  interface ActorKv {
1870
1909
  get<T extends ActorKvValueType = "text">(key: Uint8Array | string, options?: ActorKvValueOptions<T>): Promise<ActorKvValueTypeMap[T] | null>;
1871
1910
  put<T extends ActorKvValueType = "text">(key: Uint8Array | string, value: Uint8Array | string | ArrayBuffer, options?: ActorKvValueOptions<T>): Promise<void>;
@@ -2010,6 +2049,7 @@ interface QueueIterOptions<TName extends string = string, TCompletable extends b
2010
2049
  signal?: AbortSignal;
2011
2050
  completable?: TCompletable;
2012
2051
  }
2052
+ /** @deprecated Queues were deprecated in 3.0 and will be removed in a future version. Use actions and store pending work in SQLite (`c.db`). See https://rivet.dev/actors/docs/deprecated/queues */
2013
2053
  interface ActorQueue<TQueues extends QueueSchemaConfig = Record<never, never>> {
2014
2054
  send<TName extends QueueFilterName<TQueues>>(name: TName, body: QueueMessageForName<TQueues, TName>["body"]): Promise<any>;
2015
2055
  next<const TName extends QueueFilterName<TQueues>, const TCompletable extends boolean = false>(opts?: QueueNextOptions<TName, TCompletable>): Promise<any>;
@@ -2031,6 +2071,7 @@ interface ActorQueue<TQueues extends QueueSchemaConfig = Record<never, never>> {
2031
2071
  interface Conn<_TState = unknown, TConnParams = unknown, TConnState = unknown, _TVars = unknown, _TInput = unknown, _TDatabase extends AnyDatabaseProvider = AnyDatabaseProvider, _TEvents extends EventSchemaConfig = Record<never, never>, _TQueues extends QueueSchemaConfig = Record<never, never>> {
2032
2072
  id: string;
2033
2073
  params: TConnParams;
2074
+ /** @deprecated Connection state was deprecated in 3.0 and will be removed in a future version. Track live connections in `c.vars` from `onConnect` and `onDisconnect`, and store durable per-connection data in SQLite. See https://rivet.dev/actors/docs/deprecated/state#connection-state */
2034
2075
  state: TConnState;
2035
2076
  isHibernatable: boolean;
2036
2077
  send(name: string, ...args: any[]): void;
@@ -2042,16 +2083,15 @@ interface ActorContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase
2042
2083
  [ACTOR_CONTEXT_INTERNAL_SYMBOL]?: unknown;
2043
2084
  /** Returns the raw unwrapped state without the write-through proxy. */
2044
2085
  [RAW_STATE_SYMBOL](): TState;
2086
+ /** @deprecated Actor state was deprecated in 3.0 and will be removed in a future version. Store durable data in SQLite (`c.db`) and in-memory data in `c.vars`. See https://rivet.dev/actors/docs/deprecated/state */
2045
2087
  state: TState;
2046
2088
  vars: TVars;
2047
- /**
2048
- * @deprecated Actor KV is deprecated. Use embedded SQLite (`c.db`)
2049
- * or actor state instead.
2050
- */
2089
+ /** @deprecated Actor KV was deprecated in 3.0 and will be removed in a future version. Store data in SQLite (`c.db`). See https://rivet.dev/actors/docs/deprecated/kv */
2051
2090
  readonly kv: ActorKv;
2052
2091
  readonly db: InferDatabaseClient<TDatabase>;
2053
2092
  readonly schedule: ActorSchedule;
2054
2093
  readonly cron: ActorCron;
2094
+ /** @deprecated Queues were deprecated in 3.0 and will be removed in a future version. Use actions and store pending work in SQLite (`c.db`). See https://rivet.dev/actors/docs/deprecated/queues */
2055
2095
  readonly queue: ActorQueue<TQueues>;
2056
2096
  /** @experimental */
2057
2097
  readonly run: ActorRun;
@@ -2059,25 +2099,22 @@ interface ActorContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase
2059
2099
  readonly name: string;
2060
2100
  readonly key: string[];
2061
2101
  readonly region: string;
2062
- /** Provisions the experimental Actor Runtime Socket for this actor generation. */
2063
- actorRuntimeSocket(): Promise<{
2064
- path: string;
2065
- }>;
2066
2102
  readonly conns: Map<string, Conn<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>>;
2067
2103
  readonly log: ActorLogger;
2068
2104
  readonly abortSignal: AbortSignal;
2069
2105
  readonly aborted: boolean;
2070
2106
  readonly request?: Request;
2071
- /** @deprecated No-op. Always returns `false`. Use `keepAwake(promise)` or `waitUntil(promise)` instead. Will be removed in 2.2.0. */
2107
+ /** @deprecated `preventSleep` was deprecated in 3.0 and will be removed in a future version. It is a no-op that always returns `false`. Use `c.keepAwake(promise)` or `c.waitUntil(promise)`. See https://rivet.dev/actors/docs/deprecated/prevent-sleep */
2072
2108
  readonly preventSleep: boolean;
2073
2109
  broadcast(name: string, ...args: any[]): void;
2110
+ /** @deprecated Actor state was deprecated in 3.0 and will be removed in a future version. Store durable data in SQLite (`c.db`) and in-memory data in `c.vars`. See https://rivet.dev/actors/docs/deprecated/state */
2074
2111
  saveState(opts?: {
2075
2112
  immediate?: boolean;
2076
2113
  maxWait?: number;
2077
2114
  }): Promise<void>;
2078
2115
  keepAwake<T>(promise: Promise<T>): Promise<T>;
2079
2116
  waitUntil(promise: Promise<unknown>): void;
2080
- /** @deprecated No-op. Use `keepAwake(promise)` to hold the actor awake for a specific promise. Will be removed in 2.2.0. */
2117
+ /** @deprecated `setPreventSleep` was deprecated in 3.0 and will be removed in a future version. It is a no-op. Use `c.keepAwake(promise)` or `c.waitUntil(promise)`. See https://rivet.dev/actors/docs/deprecated/prevent-sleep */
2081
2118
  setPreventSleep(preventSleep: boolean): void;
2082
2119
  sleep(): void;
2083
2120
  destroy(): void;
@@ -2129,6 +2166,7 @@ type ActionContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase ext
2129
2166
  type BeforeActionResponseContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig = Record<never, never>, TQueues extends QueueSchemaConfig = Record<never, never>> = ActionContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>;
2130
2167
  type BeforeConnectContext<TState, TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig = Record<never, never>, TQueues extends QueueSchemaConfig = Record<never, never>> = ActorContext<TState, unknown, unknown, TVars, TInput, TDatabase, TEvents, TQueues>;
2131
2168
  type ConnectContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig = Record<never, never>, TQueues extends QueueSchemaConfig = Record<never, never>> = ActionContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>;
2169
+ /** @deprecated Connection state was deprecated in 3.0 and will be removed in a future version. Track live connections in `c.vars` from `onConnect` and `onDisconnect`, and store durable per-connection data in SQLite. See https://rivet.dev/actors/docs/deprecated/state#connection-state */
2132
2170
  type CreateConnStateContext<TState, TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig = Record<never, never>, TQueues extends QueueSchemaConfig = Record<never, never>> = ActorContext<TState, unknown, unknown, TVars, TInput, TDatabase, TEvents, TQueues>;
2133
2171
  type CreateContext<TState, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig = Record<never, never>, TQueues extends QueueSchemaConfig = Record<never, never>> = ActorContext<TState, unknown, unknown, unknown, TInput, TDatabase, TEvents, TQueues>;
2134
2172
  type CreateVarsContext<TState, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig = Record<never, never>, TQueues extends QueueSchemaConfig = Record<never, never>> = CreateContext<TState, TInput, TDatabase, TEvents, TQueues>;
@@ -2137,6 +2175,7 @@ type DisconnectContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase
2137
2175
  type RequestContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig = Record<never, never>, TQueues extends QueueSchemaConfig = Record<never, never>> = ActionContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>;
2138
2176
  type RunContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig = Record<never, never>, TQueues extends QueueSchemaConfig = Record<never, never>> = ActorContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>;
2139
2177
  type SleepContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig = Record<never, never>, TQueues extends QueueSchemaConfig = Record<never, never>> = RunContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>;
2178
+ /** @deprecated Actor state was deprecated in 3.0 and will be removed in a future version. See https://rivet.dev/actors/docs/deprecated/state */
2140
2179
  type StateChangeContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig = Record<never, never>, TQueues extends QueueSchemaConfig = Record<never, never>> = RunContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>;
2141
2180
  type WakeContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig = Record<never, never>, TQueues extends QueueSchemaConfig = Record<never, never>> = RunContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>;
2142
2181
  type MigrateContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig = Record<never, never>, TQueues extends QueueSchemaConfig = Record<never, never>> = WakeContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>;
@@ -2320,7 +2359,6 @@ declare function disposeRunInspector(run: ((...args: any[]) => any) | AnyRunConf
2320
2359
  declare const GlobalActorOptionsSchema: z.ZodPrefault<z.ZodObject<{
2321
2360
  name: z.ZodOptional<z.ZodString>;
2322
2361
  icon: z.ZodOptional<z.ZodString>;
2323
- enableActorRuntimeSocket: z.ZodDefault<z.ZodBoolean>;
2324
2362
  canHibernateWebSocket: z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodCustom<(request: Request) => boolean, (request: Request) => boolean>]>>;
2325
2363
  }, z.core.$strict>>;
2326
2364
  type GlobalActorOptions = z.infer<typeof GlobalActorOptionsSchema>;
@@ -2351,7 +2389,6 @@ type InstanceActorOptionsInput = z.input<typeof InstanceActorOptionsSchema>;
2351
2389
  declare const ActorOptionsSchema: z.ZodPrefault<z.ZodObject<{
2352
2390
  name: z.ZodOptional<z.ZodString>;
2353
2391
  icon: z.ZodOptional<z.ZodString>;
2354
- enableActorRuntimeSocket: z.ZodDefault<z.ZodBoolean>;
2355
2392
  canHibernateWebSocket: z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodCustom<(request: Request) => boolean, (request: Request) => boolean>]>>;
2356
2393
  createVarsTimeout: z.ZodDefault<z.ZodNumber>;
2357
2394
  createConnStateTimeout: z.ZodDefault<z.ZodNumber>;
@@ -2420,7 +2457,6 @@ declare const ActorConfigSchema: z.ZodObject<{
2420
2457
  options: z.ZodPrefault<z.ZodObject<{
2421
2458
  name: z.ZodOptional<z.ZodString>;
2422
2459
  icon: z.ZodOptional<z.ZodString>;
2423
- enableActorRuntimeSocket: z.ZodDefault<z.ZodBoolean>;
2424
2460
  canHibernateWebSocket: z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodCustom<(request: Request) => boolean, (request: Request) => boolean>]>>;
2425
2461
  createVarsTimeout: z.ZodDefault<z.ZodNumber>;
2426
2462
  createConnStateTimeout: z.ZodDefault<z.ZodNumber>;
@@ -2464,13 +2500,17 @@ declare const ActorConfigSchema: z.ZodObject<{
2464
2500
  }, z.core.$strict>>;
2465
2501
  }, z.core.$strict>;
2466
2502
  type CreateState<TState, _TConnParams, _TConnState, _TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig, TQueues extends QueueSchemaConfig> = {
2503
+ /** @deprecated Actor state was deprecated in 3.0 and will be removed in a future version. Store durable data in SQLite (`c.db`) and in-memory data in `c.vars`. See https://rivet.dev/actors/docs/deprecated/state */
2467
2504
  state: TState;
2468
2505
  } | {
2506
+ /** @deprecated Actor state was deprecated in 3.0 and will be removed in a future version. Store durable data in SQLite (`c.db`) and in-memory data in `c.vars`. See https://rivet.dev/actors/docs/deprecated/state */
2469
2507
  createState: (c: CreateContext<TState, TInput, TDatabase, TEvents, TQueues>, input: TInput) => TState | Promise<TState>;
2470
2508
  } | Record<never, never>;
2471
2509
  type CreateConnState<TState, TConnParams, TConnState, TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig, TQueues extends QueueSchemaConfig> = {
2510
+ /** @deprecated Connection state was deprecated in 3.0 and will be removed in a future version. Track live connections in `c.vars` from `onConnect` and `onDisconnect`, and store durable per-connection data in SQLite. See https://rivet.dev/actors/docs/deprecated/state#connection-state */
2472
2511
  connState: TConnState;
2473
2512
  } | {
2513
+ /** @deprecated Connection state was deprecated in 3.0 and will be removed in a future version. Track live connections in `c.vars` from `onConnect` and `onDisconnect`, and store durable per-connection data in SQLite. See https://rivet.dev/actors/docs/deprecated/state#connection-state */
2474
2514
  createConnState: (c: CreateConnStateContext<TState, TVars, TInput, TDatabase, TEvents, TQueues>, params: TConnParams) => TConnState | Promise<TConnState>;
2475
2515
  } | Record<never, never>;
2476
2516
  /**
@@ -2561,6 +2601,12 @@ interface BaseActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatab
2561
2601
  *
2562
2602
  * Can be either a function or a RunConfig object with optional name/icon metadata.
2563
2603
  *
2604
+ * Passing a plain function was deprecated in 3.0 and will be removed in a
2605
+ * future version; it logs a warning at startup. Start background work from
2606
+ * `onWake` with `c.keepAwake` and track it in `c.vars` instead.
2607
+ * `run: workflow(...)` is not deprecated. See
2608
+ * https://rivet.dev/actors/docs/deprecated/run
2609
+ *
2564
2610
  * @returns Void or a Promise.
2565
2611
  */
2566
2612
  run?: ((c: RunContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>) => void | Promise<void>) | RunConfig<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>;
@@ -2574,6 +2620,7 @@ interface BaseActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatab
2574
2620
  * another onStateChange call, preventing infinite recursion.
2575
2621
  *
2576
2622
  * @param newState The updated state
2623
+ * @deprecated Actor state was deprecated in 3.0 and will be removed in a future version. Store durable data in SQLite (`c.db`) and in-memory data in `c.vars`. See https://rivet.dev/actors/docs/deprecated/state
2577
2624
  */
2578
2625
  onStateChange?: (c: StateChangeContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>, newState: TState) => void;
2579
2626
  /**
@@ -2666,6 +2713,8 @@ interface BaseActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatab
2666
2713
  events?: TEvents;
2667
2714
  /**
2668
2715
  * Schema map for queue payloads sent by this actor.
2716
+ *
2717
+ * @deprecated Queues were deprecated in 3.0 and will be removed in a future version. Use actions and store pending work in SQLite (`c.db`). See https://rivet.dev/actors/docs/deprecated/queues
2669
2718
  */
2670
2719
  queues?: TQueues;
2671
2720
  }
@@ -2683,7 +2732,6 @@ declare function test<TState, TConnParams, TConnState, TVars, TInput, TDatabase
2683
2732
  declare const DocActorOptionsSchema: z.ZodObject<{
2684
2733
  name: z.ZodOptional<z.ZodString>;
2685
2734
  icon: z.ZodOptional<z.ZodString>;
2686
- enableActorRuntimeSocket: z.ZodOptional<z.ZodBoolean>;
2687
2735
  createVarsTimeout: z.ZodOptional<z.ZodNumber>;
2688
2736
  createConnStateTimeout: z.ZodOptional<z.ZodNumber>;
2689
2737
  onMigrateTimeout: z.ZodOptional<z.ZodNumber>;
@@ -2733,7 +2781,6 @@ declare const DocActorConfigSchema: z.ZodObject<{
2733
2781
  options: z.ZodOptional<z.ZodObject<{
2734
2782
  name: z.ZodOptional<z.ZodString>;
2735
2783
  icon: z.ZodOptional<z.ZodString>;
2736
- enableActorRuntimeSocket: z.ZodOptional<z.ZodBoolean>;
2737
2784
  createVarsTimeout: z.ZodOptional<z.ZodNumber>;
2738
2785
  createConnStateTimeout: z.ZodOptional<z.ZodNumber>;
2739
2786
  onMigrateTimeout: z.ZodOptional<z.ZodNumber>;
@@ -116,20 +116,46 @@ interface SqliteNativeMetrics {
116
116
  }
117
117
  interface SqliteDatabase {
118
118
  exec(sql: string, callback?: (row: unknown[], columns: string[]) => void): Promise<void>;
119
+ execSync?(sql: string, callback?: (row: unknown[], columns: string[]) => void): void;
119
120
  execute(sql: string, params?: SqliteBindings): Promise<SqliteExecuteResult>;
121
+ executeSync?(sql: string, params?: SqliteBindings): SqliteExecuteResult;
120
122
  executeBatch(statements: SqliteBatchStatement[]): Promise<SqliteExecuteResult[]>;
121
123
  beginTransaction(timeoutMs?: number, name?: string): Promise<SqliteTransactionDatabase>;
124
+ beginTransactionSync?(timeoutMs?: number, name?: string): SynchronousSqliteTransactionDatabase;
122
125
  run(sql: string, params?: SqliteBindings): Promise<void>;
123
126
  query(sql: string, params?: SqliteBindings): Promise<SqliteQueryResult>;
124
127
  nativeMetrics?(): SqliteNativeMetrics | Promise<SqliteNativeMetrics | null> | null;
128
+ /**
129
+ * Returns the ticket of the latest local commit. Synchronous writes return before they are
130
+ * durable; pass the ticket to `whenDurable` before releasing output that depends on them.
131
+ */
132
+ commitTicket?(): number;
133
+ /**
134
+ * Resolves once the commit `ticket` names and every earlier commit are durable. Rejects with
135
+ * `sqlite.durability_failed` once the database broke and the actor is restarting.
136
+ */
137
+ whenDurable?(ticket: number): Promise<void>;
138
+ /**
139
+ * Restarts the owning actor from durable state. Every later write fails, including the final
140
+ * state save. For native database providers whose in-memory state can no longer be trusted.
141
+ */
142
+ abortGeneration?(reason: string): void;
125
143
  close(): Promise<void>;
126
144
  }
127
145
  interface SqliteTransactionDatabase {
128
146
  exec(sql: string, callback?: (row: unknown[], columns: string[]) => void): Promise<void>;
147
+ execSync?(sql: string, callback?: (row: unknown[], columns: string[]) => void): void;
129
148
  execute(sql: string, params?: SqliteBindings): Promise<SqliteExecuteResult>;
149
+ executeSync?(sql: string, params?: SqliteBindings): SqliteExecuteResult;
130
150
  commit(): Promise<void>;
131
151
  rollback(): Promise<void>;
132
152
  }
153
+ type SynchronousSqliteTransactionDatabase = SqliteTransactionDatabase & {
154
+ execSync(sql: string, callback?: (row: unknown[], columns: string[]) => void): void;
155
+ executeSync(sql: string, params?: SqliteBindings): SqliteExecuteResult;
156
+ commitSync(): void;
157
+ rollbackSync(): void;
158
+ };
133
159
  /**
134
160
  * Provider for opening native databases from the active runtime.
135
161
  */
@@ -116,20 +116,46 @@ interface SqliteNativeMetrics {
116
116
  }
117
117
  interface SqliteDatabase {
118
118
  exec(sql: string, callback?: (row: unknown[], columns: string[]) => void): Promise<void>;
119
+ execSync?(sql: string, callback?: (row: unknown[], columns: string[]) => void): void;
119
120
  execute(sql: string, params?: SqliteBindings): Promise<SqliteExecuteResult>;
121
+ executeSync?(sql: string, params?: SqliteBindings): SqliteExecuteResult;
120
122
  executeBatch(statements: SqliteBatchStatement[]): Promise<SqliteExecuteResult[]>;
121
123
  beginTransaction(timeoutMs?: number, name?: string): Promise<SqliteTransactionDatabase>;
124
+ beginTransactionSync?(timeoutMs?: number, name?: string): SynchronousSqliteTransactionDatabase;
122
125
  run(sql: string, params?: SqliteBindings): Promise<void>;
123
126
  query(sql: string, params?: SqliteBindings): Promise<SqliteQueryResult>;
124
127
  nativeMetrics?(): SqliteNativeMetrics | Promise<SqliteNativeMetrics | null> | null;
128
+ /**
129
+ * Returns the ticket of the latest local commit. Synchronous writes return before they are
130
+ * durable; pass the ticket to `whenDurable` before releasing output that depends on them.
131
+ */
132
+ commitTicket?(): number;
133
+ /**
134
+ * Resolves once the commit `ticket` names and every earlier commit are durable. Rejects with
135
+ * `sqlite.durability_failed` once the database broke and the actor is restarting.
136
+ */
137
+ whenDurable?(ticket: number): Promise<void>;
138
+ /**
139
+ * Restarts the owning actor from durable state. Every later write fails, including the final
140
+ * state save. For native database providers whose in-memory state can no longer be trusted.
141
+ */
142
+ abortGeneration?(reason: string): void;
125
143
  close(): Promise<void>;
126
144
  }
127
145
  interface SqliteTransactionDatabase {
128
146
  exec(sql: string, callback?: (row: unknown[], columns: string[]) => void): Promise<void>;
147
+ execSync?(sql: string, callback?: (row: unknown[], columns: string[]) => void): void;
129
148
  execute(sql: string, params?: SqliteBindings): Promise<SqliteExecuteResult>;
149
+ executeSync?(sql: string, params?: SqliteBindings): SqliteExecuteResult;
130
150
  commit(): Promise<void>;
131
151
  rollback(): Promise<void>;
132
152
  }
153
+ type SynchronousSqliteTransactionDatabase = SqliteTransactionDatabase & {
154
+ execSync(sql: string, callback?: (row: unknown[], columns: string[]) => void): void;
155
+ executeSync(sql: string, params?: SqliteBindings): SqliteExecuteResult;
156
+ commitSync(): void;
157
+ rollbackSync(): void;
158
+ };
133
159
  /**
134
160
  * Provider for opening native databases from the active runtime.
135
161
  */