rivetkit 3.1.2-rc.5 → 3.1.2-rc.6
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 +16 -2
- package/dist/browser/client.js +18 -48
- 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-3T3EMLZW.js → chunk-2OEJM5K3.js} +2 -2
- package/dist/tsup/{chunk-3T3EMLZW.js.map → chunk-2OEJM5K3.js.map} +1 -1
- package/dist/tsup/{chunk-URACKJQW.js → chunk-4GCDILHQ.js} +2 -2
- package/dist/tsup/{chunk-W7R5OF2Y.cjs → chunk-7EDYE6RS.cjs} +164 -194
- package/dist/tsup/chunk-7EDYE6RS.cjs.map +1 -0
- package/dist/tsup/{chunk-2BOGDAXY.cjs → chunk-AKADRXK5.cjs} +3 -3
- package/dist/tsup/{chunk-2BOGDAXY.cjs.map → chunk-AKADRXK5.cjs.map} +1 -1
- package/dist/tsup/{chunk-2PPPGFWJ.js → chunk-AUC22H3Q.js} +4 -4
- package/dist/tsup/{chunk-J7FZTBPN.js → chunk-GPNKYTKX.js} +2 -2
- package/dist/tsup/{chunk-4M2YYW5C.js → chunk-HEWH252Y.js} +2 -2
- package/dist/tsup/{chunk-CKNOZ3G3.cjs → chunk-JHBRUK2G.cjs} +2 -2
- package/dist/tsup/{chunk-CKNOZ3G3.cjs.map → chunk-JHBRUK2G.cjs.map} +1 -1
- package/dist/tsup/{chunk-6JRISJJK.cjs → chunk-KCL4AISR.cjs} +4 -4
- package/dist/tsup/{chunk-6JRISJJK.cjs.map → chunk-KCL4AISR.cjs.map} +1 -1
- package/dist/tsup/{chunk-KRUDOIRE.js → chunk-LFGYDRKK.js} +2 -2
- package/dist/tsup/{chunk-GSS3YRUD.cjs → chunk-NHTD4LYE.cjs} +3 -3
- package/dist/tsup/{chunk-GSS3YRUD.cjs.map → chunk-NHTD4LYE.cjs.map} +1 -1
- package/dist/tsup/{chunk-6KETXN6K.js → chunk-O6BVKXY4.js} +23 -53
- package/dist/tsup/chunk-O6BVKXY4.js.map +1 -0
- package/dist/tsup/{chunk-62HCCSWY.cjs → chunk-V32FXQ3Y.cjs} +3 -3
- package/dist/tsup/{chunk-62HCCSWY.cjs.map → chunk-V32FXQ3Y.cjs.map} +1 -1
- package/dist/tsup/{chunk-ITW5YHD2.cjs → chunk-X3EPJHTD.cjs} +7 -7
- package/dist/tsup/{chunk-ITW5YHD2.cjs.map → chunk-X3EPJHTD.cjs.map} +1 -1
- package/dist/tsup/{chunk-MFJDJ2X6.cjs → chunk-X7HD5E4N.cjs} +10 -10
- package/dist/tsup/{chunk-MFJDJ2X6.cjs.map → chunk-X7HD5E4N.cjs.map} +1 -1
- package/dist/tsup/{chunk-OLOQ3NAM.js → chunk-Y5RH2IT6.js} +3 -3
- package/dist/tsup/client/mod.cjs +5 -5
- package/dist/tsup/client/mod.d.cts +2 -2
- package/dist/tsup/client/mod.d.ts +2 -2
- 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-BbRMYCV8.d.cts → config-BMGUEKMZ.d.cts} +16 -2
- package/dist/tsup/{config-CW3AWqHa.d.ts → config-iBpXyITj.d.ts} +16 -2
- package/dist/tsup/{context-Cp64yaMW.d.ts → context-hyVakgnU.d.ts} +1 -1
- package/dist/tsup/{context-NuwP8HjQ.d.cts → context-qfvLuF0P.d.cts} +1 -1
- package/dist/tsup/db/drizzle.cjs +2 -2
- package/dist/tsup/db/drizzle.js +1 -1
- package/dist/tsup/db/mod.cjs +3 -3
- package/dist/tsup/db/mod.js +2 -2
- package/dist/tsup/dynamic/mod.d.cts +1 -1
- package/dist/tsup/dynamic/mod.d.ts +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.d.cts +2 -2
- package/dist/tsup/inspector-tab/mod.d.ts +2 -2
- package/dist/tsup/mod.cjs +391 -127
- package/dist/tsup/mod.cjs.map +1 -1
- package/dist/tsup/mod.d.cts +3 -3
- package/dist/tsup/mod.d.ts +3 -3
- package/dist/tsup/mod.js +310 -46
- package/dist/tsup/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +6 -6
- package/dist/tsup/test/mod.d.cts +1 -1
- package/dist/tsup/test/mod.d.ts +1 -1
- package/dist/tsup/test/mod.js +4 -4
- package/dist/tsup/utils.cjs +2 -2
- package/dist/tsup/utils.js +1 -1
- package/dist/tsup/workflow/mod.cjs +7 -7
- package/dist/tsup/workflow/mod.d.cts +3 -3
- package/dist/tsup/workflow/mod.d.ts +3 -3
- package/dist/tsup/workflow/mod.js +4 -4
- package/package.json +9 -9
- package/src/client/actor-handle.ts +0 -1
- package/src/client/client.ts +1 -4
- package/src/client/lifecycle-errors.ts +0 -37
- package/src/client/resolve-gateway-target.ts +15 -34
- package/src/common/database/config.ts +52 -0
- package/src/common/database/native-database.ts +229 -18
- package/src/registry/config/index.ts +1 -3
- package/src/registry/index.ts +14 -15
- package/src/registry/napi-runtime.ts +81 -2
- package/src/registry/native.ts +66 -17
- package/src/registry/runtime.ts +53 -2
- package/src/registry/wasm-runtime.ts +88 -0
- package/dist/tsup/chunk-6KETXN6K.js.map +0 -1
- package/dist/tsup/chunk-W7R5OF2Y.cjs.map +0 -1
- /package/dist/tsup/{chunk-URACKJQW.js.map → chunk-4GCDILHQ.js.map} +0 -0
- /package/dist/tsup/{chunk-2PPPGFWJ.js.map → chunk-AUC22H3Q.js.map} +0 -0
- /package/dist/tsup/{chunk-J7FZTBPN.js.map → chunk-GPNKYTKX.js.map} +0 -0
- /package/dist/tsup/{chunk-4M2YYW5C.js.map → chunk-HEWH252Y.js.map} +0 -0
- /package/dist/tsup/{chunk-KRUDOIRE.js.map → chunk-LFGYDRKK.js.map} +0 -0
- /package/dist/tsup/{chunk-OLOQ3NAM.js.map → chunk-Y5RH2IT6.js.map} +0 -0
package/dist/browser/client.d.ts
CHANGED
|
@@ -760,6 +760,7 @@ interface RuntimeActorConfig {
|
|
|
760
760
|
icon?: string;
|
|
761
761
|
hasDatabase?: boolean;
|
|
762
762
|
remoteSqlite?: boolean;
|
|
763
|
+
sqliteDeferredCommits?: boolean;
|
|
763
764
|
sqliteProfiling?: SqliteProfilingOptions;
|
|
764
765
|
tracing?: RuntimeActorTracingConfig;
|
|
765
766
|
hasState?: boolean;
|
|
@@ -895,8 +896,7 @@ interface CoreRuntime {
|
|
|
895
896
|
waitRegistryReady(registry: RegistryHandle): Promise<void>;
|
|
896
897
|
shutdownRegistry(registry: RegistryHandle): Promise<void>;
|
|
897
898
|
shutdownTelemetry?(): Promise<void>;
|
|
898
|
-
|
|
899
|
-
registryShutdownBudgetMs?(registry: RegistryHandle): Promise<number | undefined>;
|
|
899
|
+
registryActorStopThresholdMs?(registry: RegistryHandle): Promise<number | undefined>;
|
|
900
900
|
registryActiveActorCount?(registry: RegistryHandle): number;
|
|
901
901
|
onRegistryActiveActorCountChange?(registry: RegistryHandle, callback: (count: number) => void, cancelToken: CancellationTokenHandle): void;
|
|
902
902
|
handleServerlessRequest(registry: RegistryHandle, req: RuntimeServerlessRequest, onStreamEvent: RuntimeServerlessStreamCallback, cancelToken: CancellationTokenHandle, config: RuntimeServeConfig): Promise<RuntimeServerlessResponseHead>;
|
|
@@ -992,13 +992,20 @@ interface CoreRuntime {
|
|
|
992
992
|
actorKvBatchPut(ctx: ActorContextHandle, entries: RuntimeKvEntry[]): Promise<void>;
|
|
993
993
|
actorKvBatchDelete(ctx: ActorContextHandle, keys: RuntimeBytes[]): Promise<void>;
|
|
994
994
|
actorSqlExec(ctx: ActorContextHandle, sql: string): Promise<RuntimeSqlExecResult>;
|
|
995
|
+
actorSqlExecSync(ctx: ActorContextHandle, sql: string): RuntimeSqlExecResult;
|
|
995
996
|
actorSqlExecute(ctx: ActorContextHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlExecuteResult>;
|
|
997
|
+
actorSqlExecuteSync(ctx: ActorContextHandle, sql: string, params?: RuntimeSqlBindParams): RuntimeSqlExecuteResult;
|
|
996
998
|
actorSqlExecuteBatch(ctx: ActorContextHandle, statements: RuntimeSqlBatchStatement[]): Promise<RuntimeSqlExecuteResult[]>;
|
|
997
999
|
actorSqlBeginTransaction(ctx: ActorContextHandle, timeoutMs?: number, name?: string): Promise<SqliteTransactionHandle>;
|
|
1000
|
+
actorSqlBeginTransactionSync(ctx: ActorContextHandle, timeoutMs?: number, name?: string): SqliteTransactionHandle;
|
|
998
1001
|
actorSqlTransactionExec(transaction: SqliteTransactionHandle, sql: string): Promise<RuntimeSqlExecResult>;
|
|
1002
|
+
actorSqlTransactionExecSync(transaction: SqliteTransactionHandle, sql: string): RuntimeSqlExecResult;
|
|
999
1003
|
actorSqlTransactionExecute(transaction: SqliteTransactionHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlExecuteResult>;
|
|
1004
|
+
actorSqlTransactionExecuteSync(transaction: SqliteTransactionHandle, sql: string, params?: RuntimeSqlBindParams): RuntimeSqlExecuteResult;
|
|
1000
1005
|
actorSqlTransactionCommit(transaction: SqliteTransactionHandle): Promise<void>;
|
|
1006
|
+
actorSqlTransactionCommitSync(transaction: SqliteTransactionHandle): void;
|
|
1001
1007
|
actorSqlTransactionRollback(transaction: SqliteTransactionHandle): Promise<void>;
|
|
1008
|
+
actorSqlTransactionRollbackSync(transaction: SqliteTransactionHandle): void;
|
|
1002
1009
|
actorBeginStateTransaction(ctx: ActorContextHandle, timeoutMs?: number, name?: string): Promise<ActorStateTransactionHandle>;
|
|
1003
1010
|
actorStateTransactionExecute(transaction: ActorStateTransactionHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlExecuteResult>;
|
|
1004
1011
|
actorStateTransactionCommit(transaction: ActorStateTransactionHandle, payload: RuntimeStateDeltaPayload): Promise<void>;
|
|
@@ -1007,6 +1014,13 @@ interface CoreRuntime {
|
|
|
1007
1014
|
actorSqlRun(ctx: ActorContextHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlRunResult>;
|
|
1008
1015
|
actorSqlMetrics(ctx: ActorContextHandle): SqliteNativeMetrics | null;
|
|
1009
1016
|
actorSqlTakeLastKvError(ctx: ActorContextHandle): string | null;
|
|
1017
|
+
/** Opens the actor database so later synchronous calls never fetch its first pages. */
|
|
1018
|
+
actorSqlOpen(ctx: ActorContextHandle): Promise<void>;
|
|
1019
|
+
/** Returns the ticket of the latest local commit. */
|
|
1020
|
+
actorSqlCommitTicket(ctx: ActorContextHandle): number;
|
|
1021
|
+
/** Resolves once the commit `ticket` names and every earlier commit are durable. */
|
|
1022
|
+
actorSqlWhenDurable(ctx: ActorContextHandle, ticket: number): Promise<void>;
|
|
1023
|
+
actorSqlAbortGeneration(ctx: ActorContextHandle, reason: string): void;
|
|
1010
1024
|
actorSqlClose(ctx: ActorContextHandle): Promise<void>;
|
|
1011
1025
|
actorQueueSend(ctx: ActorContextHandle, name: string, body: RuntimeBytes): Promise<RuntimeQueueMessage>;
|
|
1012
1026
|
actorQueueNextBatch(ctx: ActorContextHandle, options?: RuntimeQueueNextBatchOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<RuntimeQueueMessage[]>;
|
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: "3.1.2-rc.
|
|
233
|
+
version: "3.1.2-rc.6",
|
|
234
234
|
description: "Lightweight libraries for building stateful actors on edge platforms",
|
|
235
235
|
license: "Apache-2.0",
|
|
236
236
|
keywords: [
|
|
@@ -4998,14 +4998,6 @@ function classifyActorError(error) {
|
|
|
4998
4998
|
}
|
|
4999
4999
|
);
|
|
5000
5000
|
}
|
|
5001
|
-
if (error.group === "sqlite" && error.code === "storage_overloaded" || error.group === "depot" && error.code === "overloaded") {
|
|
5002
|
-
return buildLifecycleBoundaryInfo(
|
|
5003
|
-
"reconnect_only",
|
|
5004
|
-
"actor_error",
|
|
5005
|
-
error.message,
|
|
5006
|
-
{ group: error.group, code: error.code }
|
|
5007
|
-
);
|
|
5008
|
-
}
|
|
5009
5001
|
if (error.group === "ups" && error.code === "consumer_closed" || error.group === "depot" && error.code === "request_deadline_exceeded") {
|
|
5010
5002
|
return buildLifecycleBoundaryInfo(
|
|
5011
5003
|
"reconnect_only",
|
|
@@ -5161,15 +5153,6 @@ function isRetryableForkRefusal(error) {
|
|
|
5161
5153
|
}
|
|
5162
5154
|
return false;
|
|
5163
5155
|
}
|
|
5164
|
-
function isRetryableCreateRefusal(error) {
|
|
5165
|
-
if (isRetryableLifecycleRequestError(error)) {
|
|
5166
|
-
return true;
|
|
5167
|
-
}
|
|
5168
|
-
if (!(error instanceof RivetError) || retryAfterMs(error) === void 0) {
|
|
5169
|
-
return false;
|
|
5170
|
-
}
|
|
5171
|
-
return error.group === "depot" && (error.code === "overloaded" || error.code === "read_interrupted") || error.group === "guard" && error.code === "service_unavailable" || error.group === "namespace" && error.code === "creating";
|
|
5172
|
-
}
|
|
5173
5156
|
async function retryOnLifecycleBoundary(run, opts) {
|
|
5174
5157
|
const maxAttempts = opts?.maxAttempts ?? 5;
|
|
5175
5158
|
const initialDelayMs = opts?.initialDelayMs ?? 25;
|
|
@@ -6703,12 +6686,7 @@ async function rawWebSocket(driver, target, params, path, _protocols, options =
|
|
|
6703
6686
|
}
|
|
6704
6687
|
|
|
6705
6688
|
// src/client/resolve-gateway-target.ts
|
|
6706
|
-
async function resolveGatewayTarget(driver, target
|
|
6707
|
-
const retryCreate = (run) => retryOnLifecycleBoundary(run, {
|
|
6708
|
-
signal: opts?.signal,
|
|
6709
|
-
budget: opts?.budget,
|
|
6710
|
-
isRetryable: isRetryableCreateRefusal
|
|
6711
|
-
});
|
|
6689
|
+
async function resolveGatewayTarget(driver, target) {
|
|
6712
6690
|
if ("directId" in target) {
|
|
6713
6691
|
return target.directId;
|
|
6714
6692
|
}
|
|
@@ -6728,27 +6706,23 @@ async function resolveGatewayTarget(driver, target, opts) {
|
|
|
6728
6706
|
return output.actorId;
|
|
6729
6707
|
}
|
|
6730
6708
|
if ("getOrCreateForKey" in target) {
|
|
6731
|
-
const output = await
|
|
6732
|
-
|
|
6733
|
-
|
|
6734
|
-
|
|
6735
|
-
|
|
6736
|
-
|
|
6737
|
-
|
|
6738
|
-
})
|
|
6739
|
-
);
|
|
6709
|
+
const output = await driver.getOrCreateWithKey({
|
|
6710
|
+
name: target.getOrCreateForKey.name,
|
|
6711
|
+
key: target.getOrCreateForKey.key,
|
|
6712
|
+
input: target.getOrCreateForKey.input,
|
|
6713
|
+
region: target.getOrCreateForKey.region,
|
|
6714
|
+
poolName: target.getOrCreateForKey.poolName
|
|
6715
|
+
});
|
|
6740
6716
|
return output.actorId;
|
|
6741
6717
|
}
|
|
6742
6718
|
if ("create" in target) {
|
|
6743
|
-
const output = await
|
|
6744
|
-
|
|
6745
|
-
|
|
6746
|
-
|
|
6747
|
-
|
|
6748
|
-
|
|
6749
|
-
|
|
6750
|
-
})
|
|
6751
|
-
);
|
|
6719
|
+
const output = await driver.createActor({
|
|
6720
|
+
name: target.create.name,
|
|
6721
|
+
key: target.create.key,
|
|
6722
|
+
input: target.create.input,
|
|
6723
|
+
region: target.create.region,
|
|
6724
|
+
poolName: target.create.poolName
|
|
6725
|
+
});
|
|
6752
6726
|
return output.actorId;
|
|
6753
6727
|
}
|
|
6754
6728
|
throw invalidRequest("Invalid query format");
|
|
@@ -7170,8 +7144,7 @@ var ActorHandleRaw = class {
|
|
|
7170
7144
|
if (!this.#resolvingActorId) {
|
|
7171
7145
|
this.#resolvingActorId = resolveGatewayTarget(
|
|
7172
7146
|
this.#driver,
|
|
7173
|
-
this.#actorResolutionState
|
|
7174
|
-
{ budget: this.#retryBudget, signal: this.#signal }
|
|
7147
|
+
this.#actorResolutionState
|
|
7175
7148
|
).then((actorId) => {
|
|
7176
7149
|
this.#resolvedActorId = actorId;
|
|
7177
7150
|
return actorId;
|
|
@@ -7645,10 +7618,7 @@ var ClientRaw = class {
|
|
|
7645
7618
|
parameters: opts?.params,
|
|
7646
7619
|
create: createQuery.create
|
|
7647
7620
|
});
|
|
7648
|
-
const actorId = await resolveGatewayTarget(this.#driver, createQuery
|
|
7649
|
-
budget: this.#retryBudget,
|
|
7650
|
-
signal: opts?.signal
|
|
7651
|
-
});
|
|
7621
|
+
const actorId = await resolveGatewayTarget(this.#driver, createQuery);
|
|
7652
7622
|
logger2().debug({
|
|
7653
7623
|
msg: "created actor with ID",
|
|
7654
7624
|
name,
|