rivetkit 0.0.0-sqlite-sync-3-0-6-final.cf8679c → 0.0.0-sqlite-query-metrics-2-3-32.d7c4474
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 +30 -155
- package/dist/browser/client.js +41 -295
- package/dist/browser/client.js.map +1 -1
- package/dist/browser/inspector/client.js +2 -4
- package/dist/browser/inspector/client.js.map +1 -1
- package/dist/tsup/{chunk-SJJWJU26.cjs → chunk-2IWEUZP7.cjs} +183 -421
- package/dist/tsup/chunk-2IWEUZP7.cjs.map +1 -0
- package/dist/tsup/{chunk-Y5TV6V5Z.js → chunk-4VWG4KGD.js} +2 -2
- package/dist/tsup/{chunk-XATHAIZX.js → chunk-6BHNZKBA.js} +2 -2
- package/dist/tsup/{chunk-PBIQPYE5.js → chunk-6FEYCVZC.js} +13 -12
- package/dist/tsup/chunk-6FEYCVZC.js.map +1 -0
- package/dist/tsup/{chunk-RJ7WDGOJ.js → chunk-B5PFJK5F.js} +3 -3
- package/dist/tsup/{chunk-M72ZKQ7R.js → chunk-BH4XGS3I.js} +7 -12
- package/dist/tsup/chunk-BH4XGS3I.js.map +1 -0
- package/dist/tsup/{chunk-ME74LHJM.js → chunk-DOY3UGSH.js} +46 -284
- package/dist/tsup/chunk-DOY3UGSH.js.map +1 -0
- package/dist/tsup/{chunk-E54YPM4V.cjs → chunk-EFISWKCE.cjs} +10 -10
- package/dist/tsup/{chunk-E54YPM4V.cjs.map → chunk-EFISWKCE.cjs.map} +1 -1
- package/dist/tsup/{chunk-SSMFNH4N.js → chunk-ETQBP7QF.js} +4 -4
- package/dist/tsup/{chunk-TVBQQXQE.cjs → chunk-EYTAUWAY.cjs} +3 -3
- package/dist/tsup/{chunk-TVBQQXQE.cjs.map → chunk-EYTAUWAY.cjs.map} +1 -1
- package/dist/tsup/{chunk-LYXPQB6H.cjs → chunk-FDR2ZH3U.cjs} +3 -3
- package/dist/tsup/{chunk-LYXPQB6H.cjs.map → chunk-FDR2ZH3U.cjs.map} +1 -1
- package/dist/tsup/{chunk-YWWDUC6D.cjs → chunk-HDVZ6YZG.cjs} +13 -12
- package/dist/tsup/chunk-HDVZ6YZG.cjs.map +1 -0
- package/dist/tsup/{chunk-I26AW6BG.cjs → chunk-HUYHXO47.cjs} +7 -12
- package/dist/tsup/chunk-HUYHXO47.cjs.map +1 -0
- package/dist/tsup/{chunk-A2CF6PFH.js → chunk-JI6GZ2C2.js} +1 -18
- package/dist/tsup/chunk-JI6GZ2C2.js.map +1 -0
- package/dist/tsup/{chunk-RTWH3AX3.cjs → chunk-MYWZCDML.cjs} +2 -19
- package/dist/tsup/chunk-MYWZCDML.cjs.map +1 -0
- package/dist/tsup/{chunk-JHHUCWBC.cjs → chunk-QOFSDTX6.cjs} +7 -7
- package/dist/tsup/{chunk-JHHUCWBC.cjs.map → chunk-QOFSDTX6.cjs.map} +1 -1
- package/dist/tsup/{chunk-R4QCQBB4.js → chunk-UUMXC2JC.js} +2 -2
- package/dist/tsup/{chunk-VXVJHTW6.js → chunk-VFZACMON.js} +2 -2
- package/dist/tsup/{chunk-275ZGRSG.cjs → chunk-XHOMVSEF.cjs} +3 -3
- package/dist/tsup/{chunk-275ZGRSG.cjs.map → chunk-XHOMVSEF.cjs.map} +1 -1
- package/dist/tsup/{chunk-TKCX6KNZ.cjs → chunk-YG463XPX.cjs} +4 -4
- package/dist/tsup/{chunk-TKCX6KNZ.cjs.map → chunk-YG463XPX.cjs.map} +1 -1
- package/dist/tsup/client/mod.cjs +6 -6
- package/dist/tsup/client/mod.d.cts +3 -15
- package/dist/tsup/client/mod.d.ts +3 -15
- package/dist/tsup/client/mod.js +5 -5
- package/dist/tsup/common/log.cjs +2 -2
- package/dist/tsup/common/log.js +1 -1
- package/dist/tsup/common/websocket.cjs +3 -3
- package/dist/tsup/common/websocket.js +2 -2
- package/dist/tsup/{config-5K0rzjv1.d.cts → config-CkmVg2fG.d.cts} +36 -116
- package/dist/tsup/{config-DsAjIyfZ.d.ts → config-Cw_BwH_G.d.ts} +36 -116
- package/dist/tsup/{config-Df5jOcde.d.ts → config-D4clT6mq.d.cts} +2 -26
- package/dist/tsup/{config-Df5jOcde.d.cts → config-D4clT6mq.d.ts} +2 -26
- package/dist/tsup/{context-BEh8x4jn.d.ts → context-BYOKTQJi.d.ts} +2 -5
- package/dist/tsup/{context-B19Rx5Zg.d.cts → context-_xIcgBnE.d.cts} +2 -5
- 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 +257 -736
- package/dist/tsup/mod.cjs.map +1 -1
- package/dist/tsup/mod.d.cts +4 -6
- package/dist/tsup/mod.d.ts +4 -6
- package/dist/tsup/mod.js +149 -628
- package/dist/tsup/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +7 -7
- package/dist/tsup/test/mod.d.cts +2 -2
- package/dist/tsup/test/mod.d.ts +2 -2
- package/dist/tsup/test/mod.js +5 -5
- package/dist/tsup/unstable/migrations.d.cts +1 -1
- package/dist/tsup/unstable/migrations.d.ts +1 -1
- package/dist/tsup/utils.cjs +2 -2
- package/dist/tsup/utils.js +1 -1
- package/dist/tsup/workflow/mod.cjs +22 -28
- 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 -14
- package/dist/tsup/workflow/mod.js.map +1 -1
- package/package.json +10 -12
- package/src/actor/config.test.ts +78 -0
- package/src/actor/config.ts +29 -43
- package/src/actor/contexts/index.ts +0 -2
- package/src/actor/definition.ts +1 -33
- package/src/actor/keys.test.ts +275 -0
- package/src/actor/keys.ts +0 -86
- package/src/actor/schema.ts +0 -4
- package/src/actor/utils.test.ts +48 -0
- package/src/client/actor-common.ts +0 -4
- package/src/client/actor-conn.ts +24 -138
- package/src/client/actor-handle.ts +10 -66
- package/src/client/client.ts +0 -6
- package/src/client/config.ts +2 -13
- package/src/client/lifecycle-errors.ts +2 -35
- package/src/client/queue.ts +0 -2
- package/src/client/raw-utils.ts +3 -17
- package/src/client/test.ts +44 -0
- package/src/client/token-provider.test.ts +86 -0
- package/src/client/utils.ts +2 -17
- package/src/common/bare/generated/actor-runtime-socket-protocol/v1.ts +848 -0
- package/src/common/database/config.ts +2 -39
- package/src/common/database/mod.test.ts +364 -0
- package/src/common/database/native-database.test.ts +220 -0
- package/src/common/database/native-database.ts +27 -247
- package/src/common/inline-websocket-adapter.test.ts +51 -0
- package/src/common/router.ts +1 -1
- package/src/db/drizzle.test.ts +164 -0
- package/src/engine-api/actors.ts +3 -3
- package/src/engine-client/actor-websocket-client.ts +2 -4
- package/src/engine-client/api-endpoints.ts +14 -44
- package/src/engine-client/mod.ts +2 -2
- package/src/registry/config/envoy.ts +1 -1
- package/src/registry/config/index.test.ts +25 -0
- package/src/registry/config/index.ts +30 -30
- package/src/registry/index.ts +21 -207
- package/src/registry/napi-runtime.ts +7 -97
- package/src/registry/native.ts +76 -208
- package/src/registry/run-handler-coordinator.test.ts +252 -0
- package/src/registry/runtime.test.ts +124 -0
- package/src/registry/runtime.ts +18 -85
- package/src/registry/wasm-runtime.ts +17 -94
- package/src/unstable/migrations.test.ts +170 -0
- package/src/utils/endpoint-parser.test.ts +206 -0
- package/src/utils/env-vars.ts +6 -13
- package/src/utils.test.ts +34 -0
- package/src/workflow/context.ts +0 -3
- package/src/workflow/driver.test.ts +62 -0
- package/src/workflow/driver.ts +3 -5
- package/dist/tsup/chunk-A2CF6PFH.js.map +0 -1
- package/dist/tsup/chunk-I26AW6BG.cjs.map +0 -1
- package/dist/tsup/chunk-M72ZKQ7R.js.map +0 -1
- package/dist/tsup/chunk-ME74LHJM.js.map +0 -1
- package/dist/tsup/chunk-PBIQPYE5.js.map +0 -1
- package/dist/tsup/chunk-RTWH3AX3.cjs.map +0 -1
- package/dist/tsup/chunk-SJJWJU26.cjs.map +0 -1
- package/dist/tsup/chunk-YWWDUC6D.cjs.map +0 -1
- package/src/client/retry-budget.ts +0 -78
- /package/dist/tsup/{chunk-Y5TV6V5Z.js.map → chunk-4VWG4KGD.js.map} +0 -0
- /package/dist/tsup/{chunk-XATHAIZX.js.map → chunk-6BHNZKBA.js.map} +0 -0
- /package/dist/tsup/{chunk-RJ7WDGOJ.js.map → chunk-B5PFJK5F.js.map} +0 -0
- /package/dist/tsup/{chunk-SSMFNH4N.js.map → chunk-ETQBP7QF.js.map} +0 -0
- /package/dist/tsup/{chunk-R4QCQBB4.js.map → chunk-UUMXC2JC.js.map} +0 -0
- /package/dist/tsup/{chunk-VXVJHTW6.js.map → chunk-VFZACMON.js.map} +0 -0
package/dist/browser/client.d.ts
CHANGED
|
@@ -51,6 +51,8 @@ interface SqliteTransactionOptions {
|
|
|
51
51
|
* to change without notice.
|
|
52
52
|
*/
|
|
53
53
|
interface SqliteProfilingOptions {
|
|
54
|
+
/** Existing v2 switch. Default: true. */
|
|
55
|
+
enabled?: boolean;
|
|
54
56
|
/** Exact SQL filter. Union with filterQueryFingerprints; both empty means all queries. */
|
|
55
57
|
filterQueries?: string[];
|
|
56
58
|
/** Fingerprint filter, including transaction fingerprints. Filters metrics, not diagnostic logs. */
|
|
@@ -126,46 +128,20 @@ interface SqliteNativeMetrics {
|
|
|
126
128
|
}
|
|
127
129
|
interface SqliteDatabase {
|
|
128
130
|
exec(sql: string, callback?: (row: unknown[], columns: string[]) => void): Promise<void>;
|
|
129
|
-
execSync?(sql: string, callback?: (row: unknown[], columns: string[]) => void): void;
|
|
130
131
|
execute(sql: string, params?: SqliteBindings): Promise<SqliteExecuteResult>;
|
|
131
|
-
executeSync?(sql: string, params?: SqliteBindings): SqliteExecuteResult;
|
|
132
132
|
executeBatch(statements: SqliteBatchStatement[]): Promise<SqliteExecuteResult[]>;
|
|
133
133
|
beginTransaction(timeoutMs?: number, name?: string): Promise<SqliteTransactionDatabase>;
|
|
134
|
-
beginTransactionSync?(timeoutMs?: number, name?: string): SynchronousSqliteTransactionDatabase;
|
|
135
134
|
run(sql: string, params?: SqliteBindings): Promise<void>;
|
|
136
135
|
query(sql: string, params?: SqliteBindings): Promise<SqliteQueryResult>;
|
|
137
136
|
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;
|
|
153
137
|
close(): Promise<void>;
|
|
154
138
|
}
|
|
155
139
|
interface SqliteTransactionDatabase {
|
|
156
140
|
exec(sql: string, callback?: (row: unknown[], columns: string[]) => void): Promise<void>;
|
|
157
|
-
execSync?(sql: string, callback?: (row: unknown[], columns: string[]) => void): void;
|
|
158
141
|
execute(sql: string, params?: SqliteBindings): Promise<SqliteExecuteResult>;
|
|
159
|
-
executeSync?(sql: string, params?: SqliteBindings): SqliteExecuteResult;
|
|
160
142
|
commit(): Promise<void>;
|
|
161
143
|
rollback(): Promise<void>;
|
|
162
144
|
}
|
|
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
|
-
};
|
|
169
145
|
/**
|
|
170
146
|
* Provider for opening native databases from the active runtime.
|
|
171
147
|
*/
|
|
@@ -345,7 +321,6 @@ interface EventTypeToken<T, TContext = any> {
|
|
|
345
321
|
interface QueueTypeToken<TMessage, TComplete = never, TContext = any> {
|
|
346
322
|
readonly _queueMessage?: TMessage;
|
|
347
323
|
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 */
|
|
349
324
|
readonly canPublish?: SchemaHook<TContext>;
|
|
350
325
|
readonly message?: PrimitiveSchema;
|
|
351
326
|
readonly complete?: PrimitiveSchema;
|
|
@@ -358,7 +333,6 @@ interface EventSchemaDefinition<TContext = any> {
|
|
|
358
333
|
interface QueueSchemaDefinition<TContext = any> {
|
|
359
334
|
message: PrimitiveSchema;
|
|
360
335
|
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 */
|
|
362
336
|
canPublish?: SchemaHook<TContext>;
|
|
363
337
|
}
|
|
364
338
|
type EventSchema<TContext = any> = PrimitiveSchema | EventSchemaDefinition<TContext>;
|
|
@@ -742,6 +716,9 @@ type RuntimeSqlBindParam = ({
|
|
|
742
716
|
blobValue: RuntimeBytes;
|
|
743
717
|
};
|
|
744
718
|
type RuntimeSqlBindParams = RuntimeSqlBindParam[] | null;
|
|
719
|
+
interface RuntimeActorRuntimeSocketEndpointInfo {
|
|
720
|
+
path: string;
|
|
721
|
+
}
|
|
745
722
|
interface RuntimeSqlQueryResult {
|
|
746
723
|
columns: string[];
|
|
747
724
|
rows: unknown[][];
|
|
@@ -769,9 +746,9 @@ interface RuntimeActorConfig {
|
|
|
769
746
|
icon?: string;
|
|
770
747
|
hasDatabase?: boolean;
|
|
771
748
|
remoteSqlite?: boolean;
|
|
772
|
-
sqliteDeferredCommits?: boolean;
|
|
773
749
|
sqliteProfiling?: SqliteProfilingOptions;
|
|
774
750
|
tracing?: RuntimeActorTracingConfig;
|
|
751
|
+
enableActorRuntimeSocket?: boolean;
|
|
775
752
|
hasState?: boolean;
|
|
776
753
|
canHibernateWebsocket?: boolean;
|
|
777
754
|
stateSaveIntervalMs?: number;
|
|
@@ -826,8 +803,6 @@ interface RuntimeServeConfig {
|
|
|
826
803
|
engineBinaryPath?: string;
|
|
827
804
|
startServices?: boolean;
|
|
828
805
|
servicesBinaryPath?: string;
|
|
829
|
-
/** Whether config resolution selected a managed local development engine. */
|
|
830
|
-
engineSpawn?: boolean;
|
|
831
806
|
engineHost?: string;
|
|
832
807
|
enginePort?: number;
|
|
833
808
|
handleInspectorHttpInRuntime?: boolean;
|
|
@@ -906,8 +881,6 @@ interface CoreRuntime {
|
|
|
906
881
|
shutdownRegistry(registry: RegistryHandle): Promise<void>;
|
|
907
882
|
shutdownTelemetry?(): Promise<void>;
|
|
908
883
|
registryActorStopThresholdMs?(registry: RegistryHandle): Promise<number | undefined>;
|
|
909
|
-
registryActiveActorCount?(registry: RegistryHandle): number;
|
|
910
|
-
onRegistryActiveActorCountChange?(registry: RegistryHandle, callback: (count: number) => void, cancelToken: CancellationTokenHandle): void;
|
|
911
884
|
handleServerlessRequest(registry: RegistryHandle, req: RuntimeServerlessRequest, onStreamEvent: RuntimeServerlessStreamCallback, cancelToken: CancellationTokenHandle, config: RuntimeServeConfig): Promise<RuntimeServerlessResponseHead>;
|
|
912
885
|
serveListener(registry: RegistryHandle, listener: RuntimeListenerConfig, config: RuntimeServeConfig): Promise<void>;
|
|
913
886
|
serveApplicationListener(registry: RegistryHandle, listener: RuntimeApplicationListenerConfig, config: RuntimeServeConfig): Promise<void>;
|
|
@@ -918,12 +891,7 @@ interface CoreRuntime {
|
|
|
918
891
|
createCancellationToken(): CancellationTokenHandle;
|
|
919
892
|
cancellationTokenAborted(token: CancellationTokenHandle): boolean;
|
|
920
893
|
cancelCancellationToken(token: CancellationTokenHandle): void;
|
|
921
|
-
|
|
922
|
-
* Calls `callback` once when `token` is cancelled. Returns a release
|
|
923
|
-
* function that drops the registration without calling `callback`; call it
|
|
924
|
-
* once cancellation no longer matters so the native listener is freed.
|
|
925
|
-
*/
|
|
926
|
-
onCancellationTokenCancelled(token: CancellationTokenHandle, callback: (...args: unknown[]) => unknown): () => void;
|
|
894
|
+
onCancellationTokenCancelled(token: CancellationTokenHandle, callback: (...args: unknown[]) => unknown): void;
|
|
927
895
|
actorState(ctx: ActorContextHandle): RuntimeBytes;
|
|
928
896
|
actorBeginOnStateChange(ctx: ActorContextHandle): void;
|
|
929
897
|
actorEndOnStateChange(ctx: ActorContextHandle): void;
|
|
@@ -997,20 +965,13 @@ interface CoreRuntime {
|
|
|
997
965
|
actorKvBatchPut(ctx: ActorContextHandle, entries: RuntimeKvEntry[]): Promise<void>;
|
|
998
966
|
actorKvBatchDelete(ctx: ActorContextHandle, keys: RuntimeBytes[]): Promise<void>;
|
|
999
967
|
actorSqlExec(ctx: ActorContextHandle, sql: string): Promise<RuntimeSqlExecResult>;
|
|
1000
|
-
actorSqlExecSync(ctx: ActorContextHandle, sql: string): RuntimeSqlExecResult;
|
|
1001
968
|
actorSqlExecute(ctx: ActorContextHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlExecuteResult>;
|
|
1002
|
-
actorSqlExecuteSync(ctx: ActorContextHandle, sql: string, params?: RuntimeSqlBindParams): RuntimeSqlExecuteResult;
|
|
1003
969
|
actorSqlExecuteBatch(ctx: ActorContextHandle, statements: RuntimeSqlBatchStatement[]): Promise<RuntimeSqlExecuteResult[]>;
|
|
1004
970
|
actorSqlBeginTransaction(ctx: ActorContextHandle, timeoutMs?: number, name?: string): Promise<SqliteTransactionHandle>;
|
|
1005
|
-
actorSqlBeginTransactionSync(ctx: ActorContextHandle, timeoutMs?: number, name?: string): SqliteTransactionHandle;
|
|
1006
971
|
actorSqlTransactionExec(transaction: SqliteTransactionHandle, sql: string): Promise<RuntimeSqlExecResult>;
|
|
1007
|
-
actorSqlTransactionExecSync(transaction: SqliteTransactionHandle, sql: string): RuntimeSqlExecResult;
|
|
1008
972
|
actorSqlTransactionExecute(transaction: SqliteTransactionHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlExecuteResult>;
|
|
1009
|
-
actorSqlTransactionExecuteSync(transaction: SqliteTransactionHandle, sql: string, params?: RuntimeSqlBindParams): RuntimeSqlExecuteResult;
|
|
1010
973
|
actorSqlTransactionCommit(transaction: SqliteTransactionHandle): Promise<void>;
|
|
1011
|
-
actorSqlTransactionCommitSync(transaction: SqliteTransactionHandle): void;
|
|
1012
974
|
actorSqlTransactionRollback(transaction: SqliteTransactionHandle): Promise<void>;
|
|
1013
|
-
actorSqlTransactionRollbackSync(transaction: SqliteTransactionHandle): void;
|
|
1014
975
|
actorBeginStateTransaction(ctx: ActorContextHandle, timeoutMs?: number): Promise<ActorStateTransactionHandle>;
|
|
1015
976
|
actorStateTransactionExecute(transaction: ActorStateTransactionHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlExecuteResult>;
|
|
1016
977
|
actorStateTransactionCommit(transaction: ActorStateTransactionHandle, payload: RuntimeStateDeltaPayload): Promise<void>;
|
|
@@ -1019,14 +980,8 @@ interface CoreRuntime {
|
|
|
1019
980
|
actorSqlRun(ctx: ActorContextHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlRunResult>;
|
|
1020
981
|
actorSqlMetrics(ctx: ActorContextHandle): SqliteNativeMetrics | null;
|
|
1021
982
|
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;
|
|
1029
983
|
actorSqlClose(ctx: ActorContextHandle): Promise<void>;
|
|
984
|
+
actorRuntimeSocketProvision(ctx: ActorContextHandle): Promise<RuntimeActorRuntimeSocketEndpointInfo>;
|
|
1030
985
|
actorQueueSend(ctx: ActorContextHandle, name: string, body: RuntimeBytes): Promise<RuntimeQueueMessage>;
|
|
1031
986
|
actorQueueNextBatch(ctx: ActorContextHandle, options?: RuntimeQueueNextBatchOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<RuntimeQueueMessage[]>;
|
|
1032
987
|
actorQueueWaitForNames(ctx: ActorContextHandle, names: string[], options?: RuntimeQueueWaitOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<RuntimeQueueMessage>;
|
|
@@ -1107,13 +1062,9 @@ type ActorWebSocketOptions = ActorGatewayOptions;
|
|
|
1107
1062
|
*/
|
|
1108
1063
|
type ActorDefinitionActions<AD extends AnyActorDefinition> = IsAny<AD> extends true ? Record<string, ActorActionFunction<any[], any>> : ActorActionMap<ActionsOf<AD>>;
|
|
1109
1064
|
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 */
|
|
1111
1065
|
<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 */
|
|
1113
1066
|
<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 */
|
|
1115
1067
|
(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 */
|
|
1117
1068
|
(name: keyof TQueues extends never ? string : never, body: unknown, options?: QueueSendNoWaitOptions): Promise<void>;
|
|
1118
1069
|
};
|
|
1119
1070
|
type ActorEventSubscribe<TEvents extends EventSchemaConfig> = {
|
|
@@ -1210,9 +1161,7 @@ declare class ActorConnRaw {
|
|
|
1210
1161
|
* @protected
|
|
1211
1162
|
*/
|
|
1212
1163
|
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 */
|
|
1214
1164
|
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 */
|
|
1216
1165
|
send(name: string, body: unknown, options?: QueueSendNoWaitOptions): Promise<void>;
|
|
1217
1166
|
/**
|
|
1218
1167
|
* Call a raw action connection. See {@link ActorConn} for type-safe action calls.
|
|
@@ -1332,27 +1281,6 @@ declare class ActorConnRaw {
|
|
|
1332
1281
|
*/
|
|
1333
1282
|
type ActorConn<AD extends AnyActorDefinition> = Omit<ActorConnRaw, "send" | "on" | "once"> & ActorDefinitionQueueSend<AD> & ActorDefinitionEventSubscriptions<AD> & ActorDefinitionActions<AD>;
|
|
1334
1283
|
|
|
1335
|
-
/** How many retries a client may spend, as a share of the requests it sends. */
|
|
1336
|
-
interface RetryBudgetOptions {
|
|
1337
|
-
/** Retries allowed per 100 requests (default 10). */
|
|
1338
|
-
percent?: number;
|
|
1339
|
-
/** Retries the client can bank for a burst of refusals; the budget starts full (default 100). */
|
|
1340
|
-
maxTokens?: number;
|
|
1341
|
-
}
|
|
1342
|
-
/**
|
|
1343
|
-
* Bounds the client's retries of refused requests. Each request adds a fraction of a token and
|
|
1344
|
-
* each retry spends one, so retries stay a fixed share of traffic while the service sheds load
|
|
1345
|
-
* instead of multiplying it.
|
|
1346
|
-
*/
|
|
1347
|
-
declare class RetryBudget {
|
|
1348
|
-
#private;
|
|
1349
|
-
constructor(options?: RetryBudgetOptions);
|
|
1350
|
-
/** Credits one request sent. */
|
|
1351
|
-
deposit(): void;
|
|
1352
|
-
/** Spends one token. Returns `false` when the budget is spent. */
|
|
1353
|
-
tryWithdraw(): boolean;
|
|
1354
|
-
}
|
|
1355
|
-
|
|
1356
1284
|
/**
|
|
1357
1285
|
* Provides underlying functions for stateless {@link ActorHandle} for action calls.
|
|
1358
1286
|
* Similar to ActorConnRaw but doesn't maintain a connection.
|
|
@@ -1368,10 +1296,8 @@ declare class ActorHandleRaw {
|
|
|
1368
1296
|
*
|
|
1369
1297
|
* @protected
|
|
1370
1298
|
*/
|
|
1371
|
-
constructor(client: any, driver: EngineControlClient, params: unknown, getParams: (() => Promise<unknown>) | undefined, encoding: Encoding, actorResolutionState: ActorResolutionState, gatewayOptions?: ActorGatewayOptions, signal?: AbortSignal, currentActorInvocation?: CurrentActorInvocation, startCallSpan?: StartCallSpan
|
|
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 */
|
|
1299
|
+
constructor(client: any, driver: EngineControlClient, params: unknown, getParams: (() => Promise<unknown>) | undefined, encoding: Encoding, actorResolutionState: ActorResolutionState, gatewayOptions?: ActorGatewayOptions, signal?: AbortSignal, currentActorInvocation?: CurrentActorInvocation, startCallSpan?: StartCallSpan);
|
|
1373
1300
|
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 */
|
|
1375
1301
|
send(name: string, body: unknown, options?: QueueSendNoWaitOptions): Promise<void>;
|
|
1376
1302
|
/**
|
|
1377
1303
|
* Call a raw action. This method sends an HTTP request to invoke the named action.
|
|
@@ -1454,10 +1380,6 @@ declare const ClientConfigSchema: z$1.ZodPipe<z$1.ZodObject<{
|
|
|
1454
1380
|
skipReadyWait: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBoolean>>;
|
|
1455
1381
|
}, z$1.core.$strip>>>;
|
|
1456
1382
|
getUpgradeWebSocket: z$1.ZodOptional<z$1.ZodCustom<GetUpgradeWebSocket, GetUpgradeWebSocket>>;
|
|
1457
|
-
retryBudget: z$1.ZodOptional<z$1.ZodObject<{
|
|
1458
|
-
percent: z$1.ZodOptional<z$1.ZodNumber>;
|
|
1459
|
-
maxTokens: z$1.ZodOptional<z$1.ZodNumber>;
|
|
1460
|
-
}, z$1.core.$strip>>;
|
|
1461
1383
|
fetch: z$1.ZodOptional<z$1.ZodCustom<typeof fetch, typeof fetch>>;
|
|
1462
1384
|
disableMetadataLookup: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBoolean>>;
|
|
1463
1385
|
maxInputSize: z$1.ZodDefault<z$1.ZodNumber>;
|
|
@@ -1477,10 +1399,6 @@ declare const ClientConfigSchema: z$1.ZodPipe<z$1.ZodObject<{
|
|
|
1477
1399
|
devtools: boolean;
|
|
1478
1400
|
getToken?: GetToken | undefined;
|
|
1479
1401
|
getUpgradeWebSocket?: GetUpgradeWebSocket | undefined;
|
|
1480
|
-
retryBudget?: {
|
|
1481
|
-
percent?: number | undefined;
|
|
1482
|
-
maxTokens?: number | undefined;
|
|
1483
|
-
} | undefined;
|
|
1484
1402
|
fetch?: typeof fetch | undefined;
|
|
1485
1403
|
}, {
|
|
1486
1404
|
endpoint: string;
|
|
@@ -1497,10 +1415,6 @@ declare const ClientConfigSchema: z$1.ZodPipe<z$1.ZodObject<{
|
|
|
1497
1415
|
devtools: boolean;
|
|
1498
1416
|
getToken?: GetToken | undefined;
|
|
1499
1417
|
getUpgradeWebSocket?: GetUpgradeWebSocket | undefined;
|
|
1500
|
-
retryBudget?: {
|
|
1501
|
-
percent?: number | undefined;
|
|
1502
|
-
maxTokens?: number | undefined;
|
|
1503
|
-
} | undefined;
|
|
1504
1418
|
fetch?: typeof fetch | undefined;
|
|
1505
1419
|
}>>;
|
|
1506
1420
|
type ClientConfigInput = z$1.input<typeof ClientConfigSchema>;
|
|
@@ -1649,8 +1563,6 @@ declare const CREATE_ACTOR_CONN_PROXY: unique symbol;
|
|
|
1649
1563
|
interface ClientRawOptions {
|
|
1650
1564
|
encoding?: Encoding;
|
|
1651
1565
|
gateway?: ActorGatewayOptions;
|
|
1652
|
-
/** Bounds retries of refused requests across every handle of this client. */
|
|
1653
|
-
retryBudget?: RetryBudgetOptions;
|
|
1654
1566
|
}
|
|
1655
1567
|
/** Runtime-supplied wiring for clients created inside an actor. Set only by the native runtime. */
|
|
1656
1568
|
interface ActorClientRuntimeOptions {
|
|
@@ -1772,7 +1684,10 @@ type ActorKvListOptions<T extends ActorKvValueType = "text", K extends ActorKvKe
|
|
|
1772
1684
|
limit?: number;
|
|
1773
1685
|
};
|
|
1774
1686
|
type ActorClientFor<T> = T extends Registry<any> ? Client<T> : T;
|
|
1775
|
-
/**
|
|
1687
|
+
/**
|
|
1688
|
+
* @deprecated Actor KV is deprecated. Use embedded SQLite (`c.db`)
|
|
1689
|
+
* or actor state instead.
|
|
1690
|
+
*/
|
|
1776
1691
|
interface ActorKv {
|
|
1777
1692
|
get<T extends ActorKvValueType = "text">(key: Uint8Array | string, options?: ActorKvValueOptions<T>): Promise<ActorKvValueTypeMap[T] | null>;
|
|
1778
1693
|
put<T extends ActorKvValueType = "text">(key: Uint8Array | string, value: Uint8Array | string | ArrayBuffer, options?: ActorKvValueOptions<T>): Promise<void>;
|
|
@@ -1844,13 +1759,6 @@ type CronJobInfo = {
|
|
|
1844
1759
|
kind: "every";
|
|
1845
1760
|
interval: number;
|
|
1846
1761
|
});
|
|
1847
|
-
interface ScheduledFireInfo {
|
|
1848
|
-
kind: "at" | "cron" | "every";
|
|
1849
|
-
id: string;
|
|
1850
|
-
name?: string;
|
|
1851
|
-
scheduledAt: number;
|
|
1852
|
-
firedAt: number;
|
|
1853
|
-
}
|
|
1854
1762
|
interface CronFire {
|
|
1855
1763
|
action: string;
|
|
1856
1764
|
scheduledAt: number;
|
|
@@ -1913,7 +1821,6 @@ interface QueueIterOptions<TName extends string = string, TCompletable extends b
|
|
|
1913
1821
|
signal?: AbortSignal;
|
|
1914
1822
|
completable?: TCompletable;
|
|
1915
1823
|
}
|
|
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 */
|
|
1917
1824
|
interface ActorQueue<TQueues extends QueueSchemaConfig = Record<never, never>> {
|
|
1918
1825
|
send<TName extends QueueFilterName<TQueues>>(name: TName, body: QueueMessageForName<TQueues, TName>["body"]): Promise<any>;
|
|
1919
1826
|
next<const TName extends QueueFilterName<TQueues>, const TCompletable extends boolean = false>(opts?: QueueNextOptions<TName, TCompletable>): Promise<any>;
|
|
@@ -1935,7 +1842,6 @@ interface ActorQueue<TQueues extends QueueSchemaConfig = Record<never, never>> {
|
|
|
1935
1842
|
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>> {
|
|
1936
1843
|
id: string;
|
|
1937
1844
|
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 */
|
|
1939
1845
|
state: TConnState;
|
|
1940
1846
|
isHibernatable: boolean;
|
|
1941
1847
|
send(name: string, ...args: any[]): void;
|
|
@@ -1946,15 +1852,16 @@ interface ActorContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase
|
|
|
1946
1852
|
[ACTOR_CONTEXT_INTERNAL_SYMBOL]?: unknown;
|
|
1947
1853
|
/** Returns the raw unwrapped state without the write-through proxy. */
|
|
1948
1854
|
[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 */
|
|
1950
1855
|
state: TState;
|
|
1951
1856
|
vars: TVars;
|
|
1952
|
-
/**
|
|
1857
|
+
/**
|
|
1858
|
+
* @deprecated Actor KV is deprecated. Use embedded SQLite (`c.db`)
|
|
1859
|
+
* or actor state instead.
|
|
1860
|
+
*/
|
|
1953
1861
|
readonly kv: ActorKv;
|
|
1954
1862
|
readonly db: InferDatabaseClient<TDatabase>;
|
|
1955
1863
|
readonly schedule: ActorSchedule;
|
|
1956
1864
|
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 */
|
|
1958
1865
|
readonly queue: ActorQueue<TQueues>;
|
|
1959
1866
|
/** @experimental */
|
|
1960
1867
|
readonly run: ActorRun;
|
|
@@ -1962,22 +1869,25 @@ interface ActorContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase
|
|
|
1962
1869
|
readonly name: string;
|
|
1963
1870
|
readonly key: string[];
|
|
1964
1871
|
readonly region: string;
|
|
1872
|
+
/** Provisions the experimental Actor Runtime Socket for this actor generation. */
|
|
1873
|
+
actorRuntimeSocket(): Promise<{
|
|
1874
|
+
path: string;
|
|
1875
|
+
}>;
|
|
1965
1876
|
readonly conns: Map<string, Conn<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>>;
|
|
1966
1877
|
readonly log: ActorLogger;
|
|
1967
1878
|
readonly abortSignal: AbortSignal;
|
|
1968
1879
|
readonly aborted: boolean;
|
|
1969
1880
|
readonly request?: Request;
|
|
1970
|
-
/** @deprecated
|
|
1881
|
+
/** @deprecated No-op. Always returns `false`. Use `keepAwake(promise)` or `waitUntil(promise)` instead. Will be removed in 2.2.0. */
|
|
1971
1882
|
readonly preventSleep: boolean;
|
|
1972
1883
|
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 */
|
|
1974
1884
|
saveState(opts?: {
|
|
1975
1885
|
immediate?: boolean;
|
|
1976
1886
|
maxWait?: number;
|
|
1977
1887
|
}): Promise<void>;
|
|
1978
1888
|
keepAwake<T>(promise: Promise<T>): Promise<T>;
|
|
1979
1889
|
waitUntil(promise: Promise<unknown>): void;
|
|
1980
|
-
/** @deprecated `
|
|
1890
|
+
/** @deprecated No-op. Use `keepAwake(promise)` to hold the actor awake for a specific promise. Will be removed in 2.2.0. */
|
|
1981
1891
|
setPreventSleep(preventSleep: boolean): void;
|
|
1982
1892
|
sleep(): void;
|
|
1983
1893
|
destroy(): void;
|
|
@@ -2022,14 +1932,11 @@ interface ActorRun {
|
|
|
2022
1932
|
runOutsideWorkflowSpan<T>(body: () => T): T;
|
|
2023
1933
|
}
|
|
2024
1934
|
type ActionContext<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> & {
|
|
2025
|
-
/** Present only when a durable schedule or cron invokes this action. */
|
|
2026
|
-
readonly scheduledFire?: ScheduledFireInfo;
|
|
2027
1935
|
conn: Conn<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>;
|
|
2028
1936
|
};
|
|
2029
1937
|
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>;
|
|
2030
1938
|
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>;
|
|
2031
1939
|
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 */
|
|
2033
1940
|
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>;
|
|
2034
1941
|
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>;
|
|
2035
1942
|
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>;
|
|
@@ -2038,7 +1945,6 @@ type DisconnectContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase
|
|
|
2038
1945
|
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>;
|
|
2039
1946
|
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>;
|
|
2040
1947
|
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 */
|
|
2042
1948
|
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>;
|
|
2043
1949
|
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>;
|
|
2044
1950
|
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>;
|
|
@@ -2106,6 +2012,7 @@ declare const ActorConfigSchema: z.ZodObject<{
|
|
|
2106
2012
|
options: z.ZodPrefault<z.ZodObject<{
|
|
2107
2013
|
name: z.ZodOptional<z.ZodString>;
|
|
2108
2014
|
icon: z.ZodOptional<z.ZodString>;
|
|
2015
|
+
enableActorRuntimeSocket: z.ZodDefault<z.ZodBoolean>;
|
|
2109
2016
|
canHibernateWebSocket: z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodCustom<(request: Request) => boolean, (request: Request) => boolean>]>>;
|
|
2110
2017
|
createVarsTimeout: z.ZodDefault<z.ZodNumber>;
|
|
2111
2018
|
createConnStateTimeout: z.ZodDefault<z.ZodNumber>;
|
|
@@ -2149,17 +2056,13 @@ declare const ActorConfigSchema: z.ZodObject<{
|
|
|
2149
2056
|
}, z.core.$strict>>;
|
|
2150
2057
|
}, z.core.$strict>;
|
|
2151
2058
|
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 */
|
|
2153
2059
|
state: TState;
|
|
2154
2060
|
} | {
|
|
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 */
|
|
2156
2061
|
createState: (c: CreateContext<TState, TInput, TDatabase, TEvents, TQueues>, input: TInput) => TState | Promise<TState>;
|
|
2157
2062
|
} | Record<never, never>;
|
|
2158
2063
|
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 */
|
|
2160
2064
|
connState: TConnState;
|
|
2161
2065
|
} | {
|
|
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 */
|
|
2163
2066
|
createConnState: (c: CreateConnStateContext<TState, TVars, TInput, TDatabase, TEvents, TQueues>, params: TConnParams) => TConnState | Promise<TConnState>;
|
|
2164
2067
|
} | Record<never, never>;
|
|
2165
2068
|
/**
|
|
@@ -2246,12 +2149,6 @@ interface BaseActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatab
|
|
|
2246
2149
|
*
|
|
2247
2150
|
* Can be either a function or a RunConfig object with optional name/icon metadata.
|
|
2248
2151
|
*
|
|
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
|
-
*
|
|
2255
2152
|
* @returns Void or a Promise.
|
|
2256
2153
|
*/
|
|
2257
2154
|
run?: ((c: RunContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>) => void | Promise<void>) | RunConfig<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>;
|
|
@@ -2265,7 +2162,6 @@ interface BaseActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatab
|
|
|
2265
2162
|
* another onStateChange call, preventing infinite recursion.
|
|
2266
2163
|
*
|
|
2267
2164
|
* @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
|
|
2269
2165
|
*/
|
|
2270
2166
|
onStateChange?: (c: StateChangeContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>, newState: TState) => void;
|
|
2271
2167
|
/**
|
|
@@ -2358,8 +2254,6 @@ interface BaseActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatab
|
|
|
2358
2254
|
events?: TEvents;
|
|
2359
2255
|
/**
|
|
2360
2256
|
* 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
|
|
2363
2257
|
*/
|
|
2364
2258
|
queues?: TQueues;
|
|
2365
2259
|
}
|
|
@@ -2464,11 +2358,11 @@ declare const RegistryConfigSchema: z$2.ZodPipe<z$2.ZodObject<{
|
|
|
2464
2358
|
publicEndpoint: z$2.ZodPipe<z$2.ZodOptional<z$2.ZodString>, z$2.ZodTransform<string | undefined, string | undefined>>;
|
|
2465
2359
|
publicToken: z$2.ZodPipe<z$2.ZodOptional<z$2.ZodString>, z$2.ZodTransform<string | undefined, string | undefined>>;
|
|
2466
2360
|
}, z$2.core.$strip>>>;
|
|
2467
|
-
|
|
2361
|
+
envoy: z$2.ZodDefault<z$2.ZodOptional<z$2.ZodObject<{
|
|
2468
2362
|
poolName: z$2.ZodDefault<z$2.ZodString>;
|
|
2469
2363
|
version: z$2.ZodDefault<z$2.ZodNumber>;
|
|
2470
2364
|
totalSlots: z$2.ZodDefault<z$2.ZodNumber>;
|
|
2471
|
-
|
|
2365
|
+
envoyKey: z$2.ZodOptional<z$2.ZodString>;
|
|
2472
2366
|
}, z$2.core.$strip>>>;
|
|
2473
2367
|
shutdown: z$2.ZodDefault<z$2.ZodOptional<z$2.ZodObject<{
|
|
2474
2368
|
gracePeriodMs: z$2.ZodOptional<z$2.ZodNumber>;
|
|
@@ -2479,7 +2373,6 @@ declare const RegistryConfigSchema: z$2.ZodPipe<z$2.ZodObject<{
|
|
|
2479
2373
|
backend: "local" | "remote";
|
|
2480
2374
|
} | undefined;
|
|
2481
2375
|
endpoint: string | undefined;
|
|
2482
|
-
engineSpawn: boolean;
|
|
2483
2376
|
startServices: boolean;
|
|
2484
2377
|
namespace: string;
|
|
2485
2378
|
token: string | undefined;
|
|
@@ -2519,11 +2412,11 @@ declare const RegistryConfigSchema: z$2.ZodPipe<z$2.ZodObject<{
|
|
|
2519
2412
|
engineHost: string;
|
|
2520
2413
|
enginePort: number;
|
|
2521
2414
|
engineVersion: string;
|
|
2522
|
-
|
|
2415
|
+
envoy: {
|
|
2523
2416
|
poolName: string;
|
|
2524
2417
|
version: number;
|
|
2525
2418
|
totalSlots: number;
|
|
2526
|
-
|
|
2419
|
+
envoyKey?: string | undefined;
|
|
2527
2420
|
};
|
|
2528
2421
|
shutdown: {
|
|
2529
2422
|
disableSignalHandlers: boolean;
|
|
@@ -2580,11 +2473,11 @@ declare const RegistryConfigSchema: z$2.ZodPipe<z$2.ZodObject<{
|
|
|
2580
2473
|
publicEndpoint: string | undefined;
|
|
2581
2474
|
publicToken: string | undefined;
|
|
2582
2475
|
};
|
|
2583
|
-
|
|
2476
|
+
envoy: {
|
|
2584
2477
|
poolName: string;
|
|
2585
2478
|
version: number;
|
|
2586
2479
|
totalSlots: number;
|
|
2587
|
-
|
|
2480
|
+
envoyKey?: string | undefined;
|
|
2588
2481
|
};
|
|
2589
2482
|
shutdown: {
|
|
2590
2483
|
disableSignalHandlers: boolean;
|
|
@@ -2732,24 +2625,6 @@ declare class Registry<A extends RegistryActors> {
|
|
|
2732
2625
|
* ```
|
|
2733
2626
|
*/
|
|
2734
2627
|
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;
|
|
2753
2628
|
}
|
|
2754
2629
|
|
|
2755
2630
|
/**
|