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.
- package/dist/browser/client.d.ts +95 -20
- package/dist/browser/client.js +2 -2
- package/dist/browser/client.js.map +1 -1
- package/dist/browser/inspector/client.js +1 -1
- package/dist/browser/inspector/client.js.map +1 -1
- package/dist/tsup/{chunk-HXJ5U2ZI.cjs → chunk-275ZGRSG.cjs} +3 -3
- package/dist/tsup/{chunk-HXJ5U2ZI.cjs.map → chunk-275ZGRSG.cjs.map} +1 -1
- package/dist/tsup/{chunk-HFGXV2CC.cjs → chunk-E54YPM4V.cjs} +10 -10
- package/dist/tsup/{chunk-HFGXV2CC.cjs.map → chunk-E54YPM4V.cjs.map} +1 -1
- package/dist/tsup/{chunk-Y4QLVCCS.cjs → chunk-I26AW6BG.cjs} +2 -2
- package/dist/tsup/{chunk-Y4QLVCCS.cjs.map → chunk-I26AW6BG.cjs.map} +1 -1
- package/dist/tsup/{chunk-CWN7N5AF.cjs → chunk-JHHUCWBC.cjs} +7 -7
- package/dist/tsup/{chunk-CWN7N5AF.cjs.map → chunk-JHHUCWBC.cjs.map} +1 -1
- package/dist/tsup/{chunk-22S5RCCJ.cjs → chunk-LYXPQB6H.cjs} +3 -3
- package/dist/tsup/{chunk-22S5RCCJ.cjs.map → chunk-LYXPQB6H.cjs.map} +1 -1
- package/dist/tsup/{chunk-NNCL4IBC.js → chunk-M72ZKQ7R.js} +2 -2
- package/dist/tsup/{chunk-NNCL4IBC.js.map → chunk-M72ZKQ7R.js.map} +1 -1
- package/dist/tsup/{chunk-QQIFRR3B.js → chunk-ME74LHJM.js} +7 -7
- package/dist/tsup/chunk-ME74LHJM.js.map +1 -0
- package/dist/tsup/{chunk-UXDASKP6.js → chunk-PBIQPYE5.js} +12 -13
- package/dist/tsup/chunk-PBIQPYE5.js.map +1 -0
- package/dist/tsup/{chunk-2CTZU7GL.js → chunk-R4QCQBB4.js} +2 -2
- package/dist/tsup/{chunk-SW33HMM5.js → chunk-RJ7WDGOJ.js} +3 -3
- package/dist/tsup/{chunk-NG5CUXMM.cjs → chunk-SJJWJU26.cjs} +145 -145
- package/dist/tsup/chunk-SJJWJU26.cjs.map +1 -0
- package/dist/tsup/{chunk-HRKFVQPS.js → chunk-SSMFNH4N.js} +4 -4
- package/dist/tsup/{chunk-Y5CFDGPA.cjs → chunk-TKCX6KNZ.cjs} +4 -4
- package/dist/tsup/{chunk-Y5CFDGPA.cjs.map → chunk-TKCX6KNZ.cjs.map} +1 -1
- package/dist/tsup/{chunk-JJUSO7GJ.cjs → chunk-TVBQQXQE.cjs} +3 -3
- package/dist/tsup/{chunk-JJUSO7GJ.cjs.map → chunk-TVBQQXQE.cjs.map} +1 -1
- package/dist/tsup/{chunk-F5PWAGS7.js → chunk-VXVJHTW6.js} +2 -2
- package/dist/tsup/{chunk-FT6VRK4C.js → chunk-XATHAIZX.js} +2 -2
- package/dist/tsup/{chunk-D7DWNYEO.js → chunk-Y5TV6V5Z.js} +2 -2
- package/dist/tsup/{chunk-SSF2XC33.cjs → chunk-YWWDUC6D.cjs} +12 -13
- package/dist/tsup/chunk-YWWDUC6D.cjs.map +1 -0
- package/dist/tsup/client/mod.cjs +5 -5
- package/dist/tsup/client/mod.d.cts +3 -3
- package/dist/tsup/client/mod.d.ts +3 -3
- package/dist/tsup/client/mod.js +4 -4
- package/dist/tsup/common/log.cjs +2 -2
- package/dist/tsup/common/log.js +1 -1
- package/dist/tsup/common/websocket.cjs +3 -3
- package/dist/tsup/common/websocket.js +2 -2
- package/dist/tsup/{config-BnMhcPHl.d.cts → config-5K0rzjv1.d.cts} +72 -25
- package/dist/tsup/{config-CBTr4IhE.d.cts → config-Df5jOcde.d.cts} +26 -0
- package/dist/tsup/{config-CBTr4IhE.d.ts → config-Df5jOcde.d.ts} +26 -0
- package/dist/tsup/{config-BiiS5T5M.d.ts → config-DsAjIyfZ.d.ts} +72 -25
- package/dist/tsup/{context-iMxXq_Lt.d.ts → context-B19Rx5Zg.d.cts} +5 -2
- package/dist/tsup/{context-DVE8XMm1.d.cts → context-BEh8x4jn.d.ts} +5 -2
- package/dist/tsup/db/drizzle.cjs +2 -2
- package/dist/tsup/db/drizzle.d.cts +1 -1
- package/dist/tsup/db/drizzle.d.ts +1 -1
- package/dist/tsup/db/drizzle.js +1 -1
- package/dist/tsup/db/mod.cjs +3 -3
- package/dist/tsup/db/mod.d.cts +2 -2
- package/dist/tsup/db/mod.d.ts +2 -2
- package/dist/tsup/db/mod.js +2 -2
- package/dist/tsup/dynamic/mod.cjs +2 -2
- package/dist/tsup/dynamic/mod.d.cts +2 -2
- package/dist/tsup/dynamic/mod.d.ts +2 -2
- package/dist/tsup/dynamic/mod.js +1 -1
- package/dist/tsup/inspector/mod.cjs +5 -5
- package/dist/tsup/inspector/mod.js +4 -4
- package/dist/tsup/inspector/workflow.cjs +4 -4
- package/dist/tsup/inspector/workflow.js +3 -3
- package/dist/tsup/inspector-tab/mod.cjs +2 -2
- package/dist/tsup/inspector-tab/mod.d.cts +3 -3
- package/dist/tsup/inspector-tab/mod.d.ts +3 -3
- package/dist/tsup/inspector-tab/mod.js +1 -1
- package/dist/tsup/mod.cjs +548 -169
- package/dist/tsup/mod.cjs.map +1 -1
- package/dist/tsup/mod.d.cts +6 -4
- package/dist/tsup/mod.d.ts +6 -4
- package/dist/tsup/mod.js +447 -68
- package/dist/tsup/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +6 -6
- package/dist/tsup/test/mod.d.cts +2 -2
- package/dist/tsup/test/mod.d.ts +2 -2
- package/dist/tsup/test/mod.js +4 -4
- package/dist/tsup/unstable/migrations.d.cts +1 -1
- package/dist/tsup/unstable/migrations.d.ts +1 -1
- package/dist/tsup/utils.cjs +2 -2
- package/dist/tsup/utils.js +1 -1
- package/dist/tsup/workflow/mod.cjs +13 -10
- package/dist/tsup/workflow/mod.cjs.map +1 -1
- package/dist/tsup/workflow/mod.d.cts +4 -4
- package/dist/tsup/workflow/mod.d.ts +4 -4
- package/dist/tsup/workflow/mod.js +8 -5
- package/dist/tsup/workflow/mod.js.map +1 -1
- package/package.json +9 -9
- package/src/actor/config.ts +41 -29
- package/src/actor/contexts/index.ts +2 -0
- package/src/actor/definition.ts +33 -1
- package/src/actor/schema.ts +4 -0
- package/src/client/actor-common.ts +4 -0
- package/src/client/actor-conn.ts +2 -0
- package/src/client/actor-handle.ts +2 -0
- package/src/client/config.ts +1 -1
- package/src/client/queue.ts +2 -0
- package/src/common/database/config.ts +39 -0
- package/src/common/database/native-database.ts +230 -21
- package/src/registry/index.ts +142 -1
- package/src/registry/napi-runtime.ts +93 -4
- package/src/registry/native.ts +61 -28
- package/src/registry/runtime.ts +58 -8
- package/src/registry/wasm-runtime.ts +88 -14
- package/src/workflow/context.ts +3 -0
- package/dist/tsup/chunk-NG5CUXMM.cjs.map +0 -1
- package/dist/tsup/chunk-QQIFRR3B.js.map +0 -1
- package/dist/tsup/chunk-SSF2XC33.cjs.map +0 -1
- package/dist/tsup/chunk-UXDASKP6.js.map +0 -1
- package/src/common/bare/generated/actor-runtime-socket-protocol/v1.ts +0 -848
- /package/dist/tsup/{chunk-2CTZU7GL.js.map → chunk-R4QCQBB4.js.map} +0 -0
- /package/dist/tsup/{chunk-SW33HMM5.js.map → chunk-RJ7WDGOJ.js.map} +0 -0
- /package/dist/tsup/{chunk-HRKFVQPS.js.map → chunk-SSMFNH4N.js.map} +0 -0
- /package/dist/tsup/{chunk-F5PWAGS7.js.map → chunk-VXVJHTW6.js.map} +0 -0
- /package/dist/tsup/{chunk-FT6VRK4C.js.map → chunk-XATHAIZX.js.map} +0 -0
- /package/dist/tsup/{chunk-D7DWNYEO.js.map → chunk-Y5TV6V5Z.js.map} +0 -0
package/dist/browser/client.d.ts
CHANGED
|
@@ -126,20 +126,46 @@ interface SqliteNativeMetrics {
|
|
|
126
126
|
}
|
|
127
127
|
interface SqliteDatabase {
|
|
128
128
|
exec(sql: string, callback?: (row: unknown[], columns: string[]) => void): Promise<void>;
|
|
129
|
+
execSync?(sql: string, callback?: (row: unknown[], columns: string[]) => void): void;
|
|
129
130
|
execute(sql: string, params?: SqliteBindings): Promise<SqliteExecuteResult>;
|
|
131
|
+
executeSync?(sql: string, params?: SqliteBindings): SqliteExecuteResult;
|
|
130
132
|
executeBatch(statements: SqliteBatchStatement[]): Promise<SqliteExecuteResult[]>;
|
|
131
133
|
beginTransaction(timeoutMs?: number, name?: string): Promise<SqliteTransactionDatabase>;
|
|
134
|
+
beginTransactionSync?(timeoutMs?: number, name?: string): SynchronousSqliteTransactionDatabase;
|
|
132
135
|
run(sql: string, params?: SqliteBindings): Promise<void>;
|
|
133
136
|
query(sql: string, params?: SqliteBindings): Promise<SqliteQueryResult>;
|
|
134
137
|
nativeMetrics?(): SqliteNativeMetrics | Promise<SqliteNativeMetrics | null> | null;
|
|
138
|
+
/**
|
|
139
|
+
* Returns the ticket of the latest local commit. Synchronous writes return before they are
|
|
140
|
+
* durable; pass the ticket to `whenDurable` before releasing output that depends on them.
|
|
141
|
+
*/
|
|
142
|
+
commitTicket?(): number;
|
|
143
|
+
/**
|
|
144
|
+
* Resolves once the commit `ticket` names and every earlier commit are durable. Rejects with
|
|
145
|
+
* `sqlite.durability_failed` once the database broke and the actor is restarting.
|
|
146
|
+
*/
|
|
147
|
+
whenDurable?(ticket: number): Promise<void>;
|
|
148
|
+
/**
|
|
149
|
+
* Restarts the owning actor from durable state. Every later write fails, including the final
|
|
150
|
+
* state save. For native database providers whose in-memory state can no longer be trusted.
|
|
151
|
+
*/
|
|
152
|
+
abortGeneration?(reason: string): void;
|
|
135
153
|
close(): Promise<void>;
|
|
136
154
|
}
|
|
137
155
|
interface SqliteTransactionDatabase {
|
|
138
156
|
exec(sql: string, callback?: (row: unknown[], columns: string[]) => void): Promise<void>;
|
|
157
|
+
execSync?(sql: string, callback?: (row: unknown[], columns: string[]) => void): void;
|
|
139
158
|
execute(sql: string, params?: SqliteBindings): Promise<SqliteExecuteResult>;
|
|
159
|
+
executeSync?(sql: string, params?: SqliteBindings): SqliteExecuteResult;
|
|
140
160
|
commit(): Promise<void>;
|
|
141
161
|
rollback(): Promise<void>;
|
|
142
162
|
}
|
|
163
|
+
type SynchronousSqliteTransactionDatabase = SqliteTransactionDatabase & {
|
|
164
|
+
execSync(sql: string, callback?: (row: unknown[], columns: string[]) => void): void;
|
|
165
|
+
executeSync(sql: string, params?: SqliteBindings): SqliteExecuteResult;
|
|
166
|
+
commitSync(): void;
|
|
167
|
+
rollbackSync(): void;
|
|
168
|
+
};
|
|
143
169
|
/**
|
|
144
170
|
* Provider for opening native databases from the active runtime.
|
|
145
171
|
*/
|
|
@@ -319,6 +345,7 @@ interface EventTypeToken<T, TContext = any> {
|
|
|
319
345
|
interface QueueTypeToken<TMessage, TComplete = never, TContext = any> {
|
|
320
346
|
readonly _queueMessage?: TMessage;
|
|
321
347
|
readonly _queueComplete?: TComplete;
|
|
348
|
+
/** @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 */
|
|
322
349
|
readonly canPublish?: SchemaHook<TContext>;
|
|
323
350
|
readonly message?: PrimitiveSchema;
|
|
324
351
|
readonly complete?: PrimitiveSchema;
|
|
@@ -331,6 +358,7 @@ interface EventSchemaDefinition<TContext = any> {
|
|
|
331
358
|
interface QueueSchemaDefinition<TContext = any> {
|
|
332
359
|
message: PrimitiveSchema;
|
|
333
360
|
complete?: PrimitiveSchema;
|
|
361
|
+
/** @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 */
|
|
334
362
|
canPublish?: SchemaHook<TContext>;
|
|
335
363
|
}
|
|
336
364
|
type EventSchema<TContext = any> = PrimitiveSchema | EventSchemaDefinition<TContext>;
|
|
@@ -714,9 +742,6 @@ type RuntimeSqlBindParam = ({
|
|
|
714
742
|
blobValue: RuntimeBytes;
|
|
715
743
|
};
|
|
716
744
|
type RuntimeSqlBindParams = RuntimeSqlBindParam[] | null;
|
|
717
|
-
interface RuntimeActorRuntimeSocketEndpointInfo {
|
|
718
|
-
path: string;
|
|
719
|
-
}
|
|
720
745
|
interface RuntimeSqlQueryResult {
|
|
721
746
|
columns: string[];
|
|
722
747
|
rows: unknown[][];
|
|
@@ -744,9 +769,9 @@ interface RuntimeActorConfig {
|
|
|
744
769
|
icon?: string;
|
|
745
770
|
hasDatabase?: boolean;
|
|
746
771
|
remoteSqlite?: boolean;
|
|
772
|
+
sqliteDeferredCommits?: boolean;
|
|
747
773
|
sqliteProfiling?: SqliteProfilingOptions;
|
|
748
774
|
tracing?: RuntimeActorTracingConfig;
|
|
749
|
-
enableActorRuntimeSocket?: boolean;
|
|
750
775
|
hasState?: boolean;
|
|
751
776
|
canHibernateWebsocket?: boolean;
|
|
752
777
|
stateSaveIntervalMs?: number;
|
|
@@ -881,6 +906,8 @@ interface CoreRuntime {
|
|
|
881
906
|
shutdownRegistry(registry: RegistryHandle): Promise<void>;
|
|
882
907
|
shutdownTelemetry?(): Promise<void>;
|
|
883
908
|
registryActorStopThresholdMs?(registry: RegistryHandle): Promise<number | undefined>;
|
|
909
|
+
registryActiveActorCount?(registry: RegistryHandle): number;
|
|
910
|
+
onRegistryActiveActorCountChange?(registry: RegistryHandle, callback: (count: number) => void, cancelToken: CancellationTokenHandle): void;
|
|
884
911
|
handleServerlessRequest(registry: RegistryHandle, req: RuntimeServerlessRequest, onStreamEvent: RuntimeServerlessStreamCallback, cancelToken: CancellationTokenHandle, config: RuntimeServeConfig): Promise<RuntimeServerlessResponseHead>;
|
|
885
912
|
serveListener(registry: RegistryHandle, listener: RuntimeListenerConfig, config: RuntimeServeConfig): Promise<void>;
|
|
886
913
|
serveApplicationListener(registry: RegistryHandle, listener: RuntimeApplicationListenerConfig, config: RuntimeServeConfig): Promise<void>;
|
|
@@ -970,13 +997,20 @@ interface CoreRuntime {
|
|
|
970
997
|
actorKvBatchPut(ctx: ActorContextHandle, entries: RuntimeKvEntry[]): Promise<void>;
|
|
971
998
|
actorKvBatchDelete(ctx: ActorContextHandle, keys: RuntimeBytes[]): Promise<void>;
|
|
972
999
|
actorSqlExec(ctx: ActorContextHandle, sql: string): Promise<RuntimeSqlExecResult>;
|
|
1000
|
+
actorSqlExecSync(ctx: ActorContextHandle, sql: string): RuntimeSqlExecResult;
|
|
973
1001
|
actorSqlExecute(ctx: ActorContextHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlExecuteResult>;
|
|
1002
|
+
actorSqlExecuteSync(ctx: ActorContextHandle, sql: string, params?: RuntimeSqlBindParams): RuntimeSqlExecuteResult;
|
|
974
1003
|
actorSqlExecuteBatch(ctx: ActorContextHandle, statements: RuntimeSqlBatchStatement[]): Promise<RuntimeSqlExecuteResult[]>;
|
|
975
1004
|
actorSqlBeginTransaction(ctx: ActorContextHandle, timeoutMs?: number, name?: string): Promise<SqliteTransactionHandle>;
|
|
1005
|
+
actorSqlBeginTransactionSync(ctx: ActorContextHandle, timeoutMs?: number, name?: string): SqliteTransactionHandle;
|
|
976
1006
|
actorSqlTransactionExec(transaction: SqliteTransactionHandle, sql: string): Promise<RuntimeSqlExecResult>;
|
|
1007
|
+
actorSqlTransactionExecSync(transaction: SqliteTransactionHandle, sql: string): RuntimeSqlExecResult;
|
|
977
1008
|
actorSqlTransactionExecute(transaction: SqliteTransactionHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlExecuteResult>;
|
|
1009
|
+
actorSqlTransactionExecuteSync(transaction: SqliteTransactionHandle, sql: string, params?: RuntimeSqlBindParams): RuntimeSqlExecuteResult;
|
|
978
1010
|
actorSqlTransactionCommit(transaction: SqliteTransactionHandle): Promise<void>;
|
|
1011
|
+
actorSqlTransactionCommitSync(transaction: SqliteTransactionHandle): void;
|
|
979
1012
|
actorSqlTransactionRollback(transaction: SqliteTransactionHandle): Promise<void>;
|
|
1013
|
+
actorSqlTransactionRollbackSync(transaction: SqliteTransactionHandle): void;
|
|
980
1014
|
actorBeginStateTransaction(ctx: ActorContextHandle, timeoutMs?: number): Promise<ActorStateTransactionHandle>;
|
|
981
1015
|
actorStateTransactionExecute(transaction: ActorStateTransactionHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlExecuteResult>;
|
|
982
1016
|
actorStateTransactionCommit(transaction: ActorStateTransactionHandle, payload: RuntimeStateDeltaPayload): Promise<void>;
|
|
@@ -985,8 +1019,14 @@ interface CoreRuntime {
|
|
|
985
1019
|
actorSqlRun(ctx: ActorContextHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlRunResult>;
|
|
986
1020
|
actorSqlMetrics(ctx: ActorContextHandle): SqliteNativeMetrics | null;
|
|
987
1021
|
actorSqlTakeLastKvError(ctx: ActorContextHandle): string | null;
|
|
1022
|
+
/** Opens the actor database so later synchronous calls never fetch its first pages. */
|
|
1023
|
+
actorSqlOpen(ctx: ActorContextHandle): Promise<void>;
|
|
1024
|
+
/** Returns the ticket of the latest local commit. */
|
|
1025
|
+
actorSqlCommitTicket(ctx: ActorContextHandle): number;
|
|
1026
|
+
/** Resolves once the commit `ticket` names and every earlier commit are durable. */
|
|
1027
|
+
actorSqlWhenDurable(ctx: ActorContextHandle, ticket: number): Promise<void>;
|
|
1028
|
+
actorSqlAbortGeneration(ctx: ActorContextHandle, reason: string): void;
|
|
988
1029
|
actorSqlClose(ctx: ActorContextHandle): Promise<void>;
|
|
989
|
-
actorRuntimeSocketProvision(ctx: ActorContextHandle): Promise<RuntimeActorRuntimeSocketEndpointInfo>;
|
|
990
1030
|
actorQueueSend(ctx: ActorContextHandle, name: string, body: RuntimeBytes): Promise<RuntimeQueueMessage>;
|
|
991
1031
|
actorQueueNextBatch(ctx: ActorContextHandle, options?: RuntimeQueueNextBatchOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<RuntimeQueueMessage[]>;
|
|
992
1032
|
actorQueueWaitForNames(ctx: ActorContextHandle, names: string[], options?: RuntimeQueueWaitOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<RuntimeQueueMessage>;
|
|
@@ -1067,9 +1107,13 @@ type ActorWebSocketOptions = ActorGatewayOptions;
|
|
|
1067
1107
|
*/
|
|
1068
1108
|
type ActorDefinitionActions<AD extends AnyActorDefinition> = IsAny<AD> extends true ? Record<string, ActorActionFunction<any[], any>> : ActorActionMap<ActionsOf<AD>>;
|
|
1069
1109
|
type ActorQueueSend<TQueues extends QueueSchemaConfig> = {
|
|
1110
|
+
/** @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 */
|
|
1070
1111
|
<K extends keyof TQueues & string>(name: K, body: InferSchemaMap<TQueues>[K], options: QueueSendWaitOptions): Promise<QueueSendResult<InferQueueCompleteMap<TQueues>[K]>>;
|
|
1112
|
+
/** @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 */
|
|
1071
1113
|
<K extends keyof TQueues & string>(name: K, body: InferSchemaMap<TQueues>[K], options?: QueueSendNoWaitOptions): Promise<void>;
|
|
1114
|
+
/** @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 */
|
|
1072
1115
|
(name: keyof TQueues extends never ? string : never, body: unknown, options: QueueSendWaitOptions): Promise<QueueSendResult>;
|
|
1116
|
+
/** @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 */
|
|
1073
1117
|
(name: keyof TQueues extends never ? string : never, body: unknown, options?: QueueSendNoWaitOptions): Promise<void>;
|
|
1074
1118
|
};
|
|
1075
1119
|
type ActorEventSubscribe<TEvents extends EventSchemaConfig> = {
|
|
@@ -1166,7 +1210,9 @@ declare class ActorConnRaw {
|
|
|
1166
1210
|
* @protected
|
|
1167
1211
|
*/
|
|
1168
1212
|
constructor(client: ClientRaw, driver: EngineControlClient, params: unknown, getParams: (() => Promise<unknown>) | undefined, encoding: Encoding, actorResolutionState: ActorResolutionState, gatewayOptions?: ActorGatewayOptions, currentActorInvocation?: CurrentActorInvocation);
|
|
1213
|
+
/** @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 */
|
|
1169
1214
|
send(name: string, body: unknown, options: QueueSendWaitOptions): Promise<QueueSendResult>;
|
|
1215
|
+
/** @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 */
|
|
1170
1216
|
send(name: string, body: unknown, options?: QueueSendNoWaitOptions): Promise<void>;
|
|
1171
1217
|
/**
|
|
1172
1218
|
* Call a raw action connection. See {@link ActorConn} for type-safe action calls.
|
|
@@ -1323,7 +1369,9 @@ declare class ActorHandleRaw {
|
|
|
1323
1369
|
* @protected
|
|
1324
1370
|
*/
|
|
1325
1371
|
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);
|
|
1372
|
+
/** @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 */
|
|
1326
1373
|
send(name: string, body: unknown, options: QueueSendWaitOptions): Promise<QueueSendResult>;
|
|
1374
|
+
/** @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 */
|
|
1327
1375
|
send(name: string, body: unknown, options?: QueueSendNoWaitOptions): Promise<void>;
|
|
1328
1376
|
/**
|
|
1329
1377
|
* Call a raw action. This method sends an HTTP request to invoke the named action.
|
|
@@ -1724,10 +1772,7 @@ type ActorKvListOptions<T extends ActorKvValueType = "text", K extends ActorKvKe
|
|
|
1724
1772
|
limit?: number;
|
|
1725
1773
|
};
|
|
1726
1774
|
type ActorClientFor<T> = T extends Registry<any> ? Client<T> : T;
|
|
1727
|
-
/**
|
|
1728
|
-
* @deprecated Actor KV is deprecated. Use embedded SQLite (`c.db`)
|
|
1729
|
-
* or actor state instead.
|
|
1730
|
-
*/
|
|
1775
|
+
/** @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 */
|
|
1731
1776
|
interface ActorKv {
|
|
1732
1777
|
get<T extends ActorKvValueType = "text">(key: Uint8Array | string, options?: ActorKvValueOptions<T>): Promise<ActorKvValueTypeMap[T] | null>;
|
|
1733
1778
|
put<T extends ActorKvValueType = "text">(key: Uint8Array | string, value: Uint8Array | string | ArrayBuffer, options?: ActorKvValueOptions<T>): Promise<void>;
|
|
@@ -1868,6 +1913,7 @@ interface QueueIterOptions<TName extends string = string, TCompletable extends b
|
|
|
1868
1913
|
signal?: AbortSignal;
|
|
1869
1914
|
completable?: TCompletable;
|
|
1870
1915
|
}
|
|
1916
|
+
/** @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 */
|
|
1871
1917
|
interface ActorQueue<TQueues extends QueueSchemaConfig = Record<never, never>> {
|
|
1872
1918
|
send<TName extends QueueFilterName<TQueues>>(name: TName, body: QueueMessageForName<TQueues, TName>["body"]): Promise<any>;
|
|
1873
1919
|
next<const TName extends QueueFilterName<TQueues>, const TCompletable extends boolean = false>(opts?: QueueNextOptions<TName, TCompletable>): Promise<any>;
|
|
@@ -1889,6 +1935,7 @@ interface ActorQueue<TQueues extends QueueSchemaConfig = Record<never, never>> {
|
|
|
1889
1935
|
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>> {
|
|
1890
1936
|
id: string;
|
|
1891
1937
|
params: TConnParams;
|
|
1938
|
+
/** @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 */
|
|
1892
1939
|
state: TConnState;
|
|
1893
1940
|
isHibernatable: boolean;
|
|
1894
1941
|
send(name: string, ...args: any[]): void;
|
|
@@ -1899,16 +1946,15 @@ interface ActorContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase
|
|
|
1899
1946
|
[ACTOR_CONTEXT_INTERNAL_SYMBOL]?: unknown;
|
|
1900
1947
|
/** Returns the raw unwrapped state without the write-through proxy. */
|
|
1901
1948
|
[RAW_STATE_SYMBOL](): TState;
|
|
1949
|
+
/** @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 */
|
|
1902
1950
|
state: TState;
|
|
1903
1951
|
vars: TVars;
|
|
1904
|
-
/**
|
|
1905
|
-
* @deprecated Actor KV is deprecated. Use embedded SQLite (`c.db`)
|
|
1906
|
-
* or actor state instead.
|
|
1907
|
-
*/
|
|
1952
|
+
/** @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 */
|
|
1908
1953
|
readonly kv: ActorKv;
|
|
1909
1954
|
readonly db: InferDatabaseClient<TDatabase>;
|
|
1910
1955
|
readonly schedule: ActorSchedule;
|
|
1911
1956
|
readonly cron: ActorCron;
|
|
1957
|
+
/** @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 */
|
|
1912
1958
|
readonly queue: ActorQueue<TQueues>;
|
|
1913
1959
|
/** @experimental */
|
|
1914
1960
|
readonly run: ActorRun;
|
|
@@ -1916,25 +1962,22 @@ interface ActorContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase
|
|
|
1916
1962
|
readonly name: string;
|
|
1917
1963
|
readonly key: string[];
|
|
1918
1964
|
readonly region: string;
|
|
1919
|
-
/** Provisions the experimental Actor Runtime Socket for this actor generation. */
|
|
1920
|
-
actorRuntimeSocket(): Promise<{
|
|
1921
|
-
path: string;
|
|
1922
|
-
}>;
|
|
1923
1965
|
readonly conns: Map<string, Conn<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>>;
|
|
1924
1966
|
readonly log: ActorLogger;
|
|
1925
1967
|
readonly abortSignal: AbortSignal;
|
|
1926
1968
|
readonly aborted: boolean;
|
|
1927
1969
|
readonly request?: Request;
|
|
1928
|
-
/** @deprecated
|
|
1970
|
+
/** @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 */
|
|
1929
1971
|
readonly preventSleep: boolean;
|
|
1930
1972
|
broadcast(name: string, ...args: any[]): void;
|
|
1973
|
+
/** @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 */
|
|
1931
1974
|
saveState(opts?: {
|
|
1932
1975
|
immediate?: boolean;
|
|
1933
1976
|
maxWait?: number;
|
|
1934
1977
|
}): Promise<void>;
|
|
1935
1978
|
keepAwake<T>(promise: Promise<T>): Promise<T>;
|
|
1936
1979
|
waitUntil(promise: Promise<unknown>): void;
|
|
1937
|
-
/** @deprecated
|
|
1980
|
+
/** @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 */
|
|
1938
1981
|
setPreventSleep(preventSleep: boolean): void;
|
|
1939
1982
|
sleep(): void;
|
|
1940
1983
|
destroy(): void;
|
|
@@ -1986,6 +2029,7 @@ type ActionContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase ext
|
|
|
1986
2029
|
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>;
|
|
1987
2030
|
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>;
|
|
1988
2031
|
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>;
|
|
2032
|
+
/** @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 */
|
|
1989
2033
|
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>;
|
|
1990
2034
|
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>;
|
|
1991
2035
|
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>;
|
|
@@ -1994,6 +2038,7 @@ type DisconnectContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase
|
|
|
1994
2038
|
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>;
|
|
1995
2039
|
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>;
|
|
1996
2040
|
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>;
|
|
2041
|
+
/** @deprecated Actor state was deprecated in 3.0 and will be removed in a future version. See https://rivet.dev/actors/docs/deprecated/state */
|
|
1997
2042
|
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>;
|
|
1998
2043
|
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>;
|
|
1999
2044
|
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>;
|
|
@@ -2061,7 +2106,6 @@ declare const ActorConfigSchema: z.ZodObject<{
|
|
|
2061
2106
|
options: z.ZodPrefault<z.ZodObject<{
|
|
2062
2107
|
name: z.ZodOptional<z.ZodString>;
|
|
2063
2108
|
icon: z.ZodOptional<z.ZodString>;
|
|
2064
|
-
enableActorRuntimeSocket: z.ZodDefault<z.ZodBoolean>;
|
|
2065
2109
|
canHibernateWebSocket: z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodCustom<(request: Request) => boolean, (request: Request) => boolean>]>>;
|
|
2066
2110
|
createVarsTimeout: z.ZodDefault<z.ZodNumber>;
|
|
2067
2111
|
createConnStateTimeout: z.ZodDefault<z.ZodNumber>;
|
|
@@ -2105,13 +2149,17 @@ declare const ActorConfigSchema: z.ZodObject<{
|
|
|
2105
2149
|
}, z.core.$strict>>;
|
|
2106
2150
|
}, z.core.$strict>;
|
|
2107
2151
|
type CreateState<TState, _TConnParams, _TConnState, _TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig, TQueues extends QueueSchemaConfig> = {
|
|
2152
|
+
/** @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 */
|
|
2108
2153
|
state: TState;
|
|
2109
2154
|
} | {
|
|
2155
|
+
/** @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 */
|
|
2110
2156
|
createState: (c: CreateContext<TState, TInput, TDatabase, TEvents, TQueues>, input: TInput) => TState | Promise<TState>;
|
|
2111
2157
|
} | Record<never, never>;
|
|
2112
2158
|
type CreateConnState<TState, TConnParams, TConnState, TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig, TQueues extends QueueSchemaConfig> = {
|
|
2159
|
+
/** @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 */
|
|
2113
2160
|
connState: TConnState;
|
|
2114
2161
|
} | {
|
|
2162
|
+
/** @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 */
|
|
2115
2163
|
createConnState: (c: CreateConnStateContext<TState, TVars, TInput, TDatabase, TEvents, TQueues>, params: TConnParams) => TConnState | Promise<TConnState>;
|
|
2116
2164
|
} | Record<never, never>;
|
|
2117
2165
|
/**
|
|
@@ -2198,6 +2246,12 @@ interface BaseActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatab
|
|
|
2198
2246
|
*
|
|
2199
2247
|
* Can be either a function or a RunConfig object with optional name/icon metadata.
|
|
2200
2248
|
*
|
|
2249
|
+
* Passing a plain function was deprecated in 3.0 and will be removed in a
|
|
2250
|
+
* future version; it logs a warning at startup. Start background work from
|
|
2251
|
+
* `onWake` with `c.keepAwake` and track it in `c.vars` instead.
|
|
2252
|
+
* `run: workflow(...)` is not deprecated. See
|
|
2253
|
+
* https://rivet.dev/actors/docs/deprecated/run
|
|
2254
|
+
*
|
|
2201
2255
|
* @returns Void or a Promise.
|
|
2202
2256
|
*/
|
|
2203
2257
|
run?: ((c: RunContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>) => void | Promise<void>) | RunConfig<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>;
|
|
@@ -2211,6 +2265,7 @@ interface BaseActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatab
|
|
|
2211
2265
|
* another onStateChange call, preventing infinite recursion.
|
|
2212
2266
|
*
|
|
2213
2267
|
* @param newState The updated state
|
|
2268
|
+
* @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
|
|
2214
2269
|
*/
|
|
2215
2270
|
onStateChange?: (c: StateChangeContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>, newState: TState) => void;
|
|
2216
2271
|
/**
|
|
@@ -2303,6 +2358,8 @@ interface BaseActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatab
|
|
|
2303
2358
|
events?: TEvents;
|
|
2304
2359
|
/**
|
|
2305
2360
|
* Schema map for queue payloads sent by this actor.
|
|
2361
|
+
*
|
|
2362
|
+
* @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
|
|
2306
2363
|
*/
|
|
2307
2364
|
queues?: TQueues;
|
|
2308
2365
|
}
|
|
@@ -2675,6 +2732,24 @@ declare class Registry<A extends RegistryActors> {
|
|
|
2675
2732
|
* ```
|
|
2676
2733
|
*/
|
|
2677
2734
|
start(): void;
|
|
2735
|
+
/**
|
|
2736
|
+
* Returns the number of actors hosted by this process's envoy, which is zero
|
|
2737
|
+
* while it is not serving. Requires the native runtime.
|
|
2738
|
+
*/
|
|
2739
|
+
activeActorCount(): number;
|
|
2740
|
+
/**
|
|
2741
|
+
* Calls `callback` with the number of actors hosted by this process's envoy
|
|
2742
|
+
* and again whenever it changes. Rapid changes may coalesce.
|
|
2743
|
+
* Returns a function that unsubscribes. Requires the native runtime.
|
|
2744
|
+
*
|
|
2745
|
+
* @example
|
|
2746
|
+
* ```ts
|
|
2747
|
+
* const unsubscribe = registry.onActiveActorCountChange((count) => {
|
|
2748
|
+
* setTaskProtection(count > 0);
|
|
2749
|
+
* });
|
|
2750
|
+
* ```
|
|
2751
|
+
*/
|
|
2752
|
+
onActiveActorCountChange(callback: (count: number) => void): () => void;
|
|
2678
2753
|
}
|
|
2679
2754
|
|
|
2680
2755
|
/**
|
package/dist/browser/client.js
CHANGED
|
@@ -230,7 +230,7 @@ function noopNext() {
|
|
|
230
230
|
// package.json
|
|
231
231
|
var package_default = {
|
|
232
232
|
name: "rivetkit",
|
|
233
|
-
version: "0.0.0-sqlite-
|
|
233
|
+
version: "0.0.0-sqlite-sync-3-0-6-final.cf8679c",
|
|
234
234
|
description: "Lightweight libraries for building stateful actors on edge platforms",
|
|
235
235
|
license: "Apache-2.0",
|
|
236
236
|
keywords: [
|
|
@@ -1459,7 +1459,7 @@ var ClientConfigSchemaBase = z3.object({
|
|
|
1459
1459
|
if (!resolved && !hasWarnedMissingEndpoint) {
|
|
1460
1460
|
hasWarnedMissingEndpoint = true;
|
|
1461
1461
|
console.warn(
|
|
1462
|
-
`[rivetkit] No endpoint provided to client. Defaulting to ${DEFAULT_ENDPOINT}. Starting in
|
|
1462
|
+
`[rivetkit] No endpoint provided to client. Defaulting to ${DEFAULT_ENDPOINT}. Starting in 3.2.0, an explicit endpoint will be required. Pass an endpoint to createClient() or createRivetKit(), or set the RIVET_ENDPOINT environment variable.`
|
|
1463
1463
|
);
|
|
1464
1464
|
}
|
|
1465
1465
|
return resolved ?? DEFAULT_ENDPOINT;
|