rivetkit 3.1.2-rc.2 → 3.1.2-rc.3
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 +2 -16
- package/dist/browser/client.js +9 -1
- 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-MRWI2HTU.js → chunk-2BXN54R4.js} +2 -2
- package/dist/tsup/{chunk-N2SQDK2F.js → chunk-3ALVCHXR.js} +3 -3
- package/dist/tsup/{chunk-LBYX466L.cjs → chunk-6ANYUVLS.cjs} +3 -3
- package/dist/tsup/{chunk-LBYX466L.cjs.map → chunk-6ANYUVLS.cjs.map} +1 -1
- package/dist/tsup/{chunk-I6P2AHO6.js → chunk-6S73EWWS.js} +2 -2
- package/dist/tsup/{chunk-L2XH4EXJ.cjs → chunk-6YDPLY6F.cjs} +155 -147
- package/dist/tsup/chunk-6YDPLY6F.cjs.map +1 -0
- package/dist/tsup/{chunk-QJ7MIAFD.cjs → chunk-C2I4CPLD.cjs} +7 -7
- package/dist/tsup/{chunk-QJ7MIAFD.cjs.map → chunk-C2I4CPLD.cjs.map} +1 -1
- package/dist/tsup/{chunk-YAGP66QF.cjs → chunk-JK62DI4K.cjs} +4 -4
- package/dist/tsup/{chunk-YAGP66QF.cjs.map → chunk-JK62DI4K.cjs.map} +1 -1
- package/dist/tsup/{chunk-6BGQCMIF.cjs → chunk-MJCM3IZN.cjs} +3 -3
- package/dist/tsup/{chunk-6BGQCMIF.cjs.map → chunk-MJCM3IZN.cjs.map} +1 -1
- package/dist/tsup/{chunk-DDF35AIK.cjs → chunk-MJWDZ4CU.cjs} +2 -2
- package/dist/tsup/{chunk-DDF35AIK.cjs.map → chunk-MJWDZ4CU.cjs.map} +1 -1
- package/dist/tsup/{chunk-TAK6KRMJ.cjs → chunk-P57K5DTD.cjs} +3 -3
- package/dist/tsup/{chunk-TAK6KRMJ.cjs.map → chunk-P57K5DTD.cjs.map} +1 -1
- package/dist/tsup/{chunk-MVOIZGVC.js → chunk-POKN6RC5.js} +2 -2
- package/dist/tsup/{chunk-MVOIZGVC.js.map → chunk-POKN6RC5.js.map} +1 -1
- package/dist/tsup/{chunk-JGMXY4GD.js → chunk-WCVT6UXF.js} +14 -6
- package/dist/tsup/chunk-WCVT6UXF.js.map +1 -0
- package/dist/tsup/{chunk-6MJSWO33.js → chunk-WJSHEWTP.js} +4 -4
- package/dist/tsup/{chunk-A3N3LJC6.cjs → chunk-X4HPTBGP.cjs} +10 -10
- package/dist/tsup/{chunk-A3N3LJC6.cjs.map → chunk-X4HPTBGP.cjs.map} +1 -1
- package/dist/tsup/{chunk-D2CCGHEJ.js → chunk-YXBMGSYD.js} +2 -2
- package/dist/tsup/{chunk-6NHRZU52.js → chunk-ZWLSBELO.js} +2 -2
- 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-BMGUEKMZ.d.cts → config-BbRMYCV8.d.cts} +2 -16
- package/dist/tsup/{config-iBpXyITj.d.ts → config-CW3AWqHa.d.ts} +2 -16
- package/dist/tsup/{context-hyVakgnU.d.ts → context-Cp64yaMW.d.ts} +1 -1
- package/dist/tsup/{context-qfvLuF0P.d.cts → context-NuwP8HjQ.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 +127 -391
- 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 +46 -310
- 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/lifecycle-errors.ts +15 -0
- package/src/common/database/config.ts +0 -52
- package/src/common/database/native-database.ts +18 -229
- package/src/registry/config/index.ts +3 -1
- package/src/registry/index.ts +15 -14
- package/src/registry/napi-runtime.ts +2 -81
- package/src/registry/native.ts +17 -66
- package/src/registry/runtime.ts +2 -53
- package/src/registry/wasm-runtime.ts +0 -88
- package/dist/tsup/chunk-JGMXY4GD.js.map +0 -1
- package/dist/tsup/chunk-L2XH4EXJ.cjs.map +0 -1
- /package/dist/tsup/{chunk-MRWI2HTU.js.map → chunk-2BXN54R4.js.map} +0 -0
- /package/dist/tsup/{chunk-N2SQDK2F.js.map → chunk-3ALVCHXR.js.map} +0 -0
- /package/dist/tsup/{chunk-I6P2AHO6.js.map → chunk-6S73EWWS.js.map} +0 -0
- /package/dist/tsup/{chunk-6MJSWO33.js.map → chunk-WJSHEWTP.js.map} +0 -0
- /package/dist/tsup/{chunk-D2CCGHEJ.js.map → chunk-YXBMGSYD.js.map} +0 -0
- /package/dist/tsup/{chunk-6NHRZU52.js.map → chunk-ZWLSBELO.js.map} +0 -0
package/src/registry/native.ts
CHANGED
|
@@ -62,11 +62,7 @@ import {
|
|
|
62
62
|
db as defaultDb,
|
|
63
63
|
registerNativeStateTransactionOpener,
|
|
64
64
|
} from "@/common/database/mod";
|
|
65
|
-
import {
|
|
66
|
-
type JsNativeDatabaseLike,
|
|
67
|
-
type JsNativeSynchronousTransactionLike,
|
|
68
|
-
wrapJsNativeDatabase,
|
|
69
|
-
} from "@/common/database/native-database";
|
|
65
|
+
import { wrapJsNativeDatabase } from "@/common/database/native-database";
|
|
70
66
|
import { assertJsonCompatValue, type JsonCompatValue } from "@/common/encoding";
|
|
71
67
|
import { isResponseLike } from "@/common/fetch-like";
|
|
72
68
|
import {
|
|
@@ -131,7 +127,6 @@ import type {
|
|
|
131
127
|
RuntimeScheduledFireInfo,
|
|
132
128
|
RuntimeServeConfig,
|
|
133
129
|
RuntimeStateDeltaPayload,
|
|
134
|
-
SqliteTransactionHandle,
|
|
135
130
|
WebSocketHandle,
|
|
136
131
|
} from "./runtime";
|
|
137
132
|
import { servicesBinaryUnavailable } from "./runtime";
|
|
@@ -662,26 +657,6 @@ async function closeNativeDatabaseClient(
|
|
|
662
657
|
}
|
|
663
658
|
}
|
|
664
659
|
|
|
665
|
-
function createNativeSqlTransaction(
|
|
666
|
-
runtime: CoreRuntime,
|
|
667
|
-
transaction: SqliteTransactionHandle,
|
|
668
|
-
): JsNativeSynchronousTransactionLike {
|
|
669
|
-
return {
|
|
670
|
-
exec: (sql) => runtime.actorSqlTransactionExec(transaction, sql),
|
|
671
|
-
execSync: (sql) =>
|
|
672
|
-
runtime.actorSqlTransactionExecSync(transaction, sql),
|
|
673
|
-
execute: (sql, params) =>
|
|
674
|
-
runtime.actorSqlTransactionExecute(transaction, sql, params),
|
|
675
|
-
executeSync: (sql, params) =>
|
|
676
|
-
runtime.actorSqlTransactionExecuteSync(transaction, sql, params),
|
|
677
|
-
commit: () => runtime.actorSqlTransactionCommit(transaction),
|
|
678
|
-
commitSync: () => runtime.actorSqlTransactionCommitSync(transaction),
|
|
679
|
-
rollback: () => runtime.actorSqlTransactionRollback(transaction),
|
|
680
|
-
rollbackSync: () =>
|
|
681
|
-
runtime.actorSqlTransactionRollbackSync(transaction),
|
|
682
|
-
};
|
|
683
|
-
}
|
|
684
|
-
|
|
685
660
|
function getOrCreateNativeSqlDatabase(
|
|
686
661
|
runtime: CoreRuntime,
|
|
687
662
|
ctx: ActorContextHandle,
|
|
@@ -692,12 +667,9 @@ function getOrCreateNativeSqlDatabase(
|
|
|
692
667
|
return cachedDatabase;
|
|
693
668
|
}
|
|
694
669
|
|
|
695
|
-
const
|
|
670
|
+
const database = wrapJsNativeDatabase({
|
|
696
671
|
exec: (sql) => runtime.actorSqlExec(ctx, sql),
|
|
697
|
-
execSync: (sql) => runtime.actorSqlExecSync(ctx, sql),
|
|
698
672
|
execute: (sql, params) => runtime.actorSqlExecute(ctx, sql, params),
|
|
699
|
-
executeSync: (sql, params) =>
|
|
700
|
-
runtime.actorSqlExecuteSync(ctx, sql, params),
|
|
701
673
|
executeBatch: (statements) =>
|
|
702
674
|
runtime.actorSqlExecuteBatch(ctx, statements),
|
|
703
675
|
beginTransaction: async (timeoutMs, name) => {
|
|
@@ -706,15 +678,19 @@ function getOrCreateNativeSqlDatabase(
|
|
|
706
678
|
timeoutMs,
|
|
707
679
|
name,
|
|
708
680
|
);
|
|
709
|
-
return
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
681
|
+
return {
|
|
682
|
+
exec: (sql) =>
|
|
683
|
+
runtime.actorSqlTransactionExec(transaction, sql),
|
|
684
|
+
execute: (sql, params) =>
|
|
685
|
+
runtime.actorSqlTransactionExecute(
|
|
686
|
+
transaction,
|
|
687
|
+
sql,
|
|
688
|
+
params,
|
|
689
|
+
),
|
|
690
|
+
commit: () => runtime.actorSqlTransactionCommit(transaction),
|
|
691
|
+
rollback: () =>
|
|
692
|
+
runtime.actorSqlTransactionRollback(transaction),
|
|
693
|
+
};
|
|
718
694
|
},
|
|
719
695
|
beginStateTransaction: async (timeoutMs, context, name) => {
|
|
720
696
|
const scope = context as NativeStateTransactionScope | undefined;
|
|
@@ -755,14 +731,8 @@ function getOrCreateNativeSqlDatabase(
|
|
|
755
731
|
run: (sql, params) => runtime.actorSqlRun(ctx, sql, params),
|
|
756
732
|
metrics: () => runtime.actorSqlMetrics(ctx),
|
|
757
733
|
takeLastKvError: () => runtime.actorSqlTakeLastKvError(ctx),
|
|
758
|
-
open: () => runtime.actorSqlOpen(ctx),
|
|
759
|
-
commitTicket: () => runtime.actorSqlCommitTicket(ctx),
|
|
760
|
-
whenDurable: (ticket) => runtime.actorSqlWhenDurable(ctx, ticket),
|
|
761
|
-
abortGeneration: (reason) =>
|
|
762
|
-
runtime.actorSqlAbortGeneration(ctx, reason),
|
|
763
734
|
close: () => runtime.actorSqlClose(ctx),
|
|
764
|
-
};
|
|
765
|
-
const database = wrapJsNativeDatabase(bindings);
|
|
735
|
+
});
|
|
766
736
|
runtimeState.sql = database;
|
|
767
737
|
return database;
|
|
768
738
|
}
|
|
@@ -3226,16 +3196,10 @@ export class ActorContextHandleAdapter {
|
|
|
3226
3196
|
{
|
|
3227
3197
|
open: async (requestedActorId) => {
|
|
3228
3198
|
void requestedActorId;
|
|
3229
|
-
|
|
3199
|
+
return getOrCreateNativeSqlDatabase(
|
|
3230
3200
|
this.#runtime,
|
|
3231
3201
|
this.#ctx,
|
|
3232
3202
|
);
|
|
3233
|
-
// Synchronous calls need an open database. Other actors keep opening
|
|
3234
|
-
// it on first use.
|
|
3235
|
-
if (usesSqliteDeferredCommits(this.#databaseProvider)) {
|
|
3236
|
-
await database.open();
|
|
3237
|
-
}
|
|
3238
|
-
return database;
|
|
3239
3203
|
},
|
|
3240
3204
|
},
|
|
3241
3205
|
async (timeoutMs, context, name) =>
|
|
@@ -4032,17 +3996,6 @@ function buildActorTracingConfig(
|
|
|
4032
3996
|
};
|
|
4033
3997
|
}
|
|
4034
3998
|
|
|
4035
|
-
const SQLITE_DEFERRED_COMMITS = Symbol.for("rivetkit.sqlite.deferredCommits");
|
|
4036
|
-
|
|
4037
|
-
// Internal opt-in for embedders, such as Open Orange, that gate outputs on `whenDurable`.
|
|
4038
|
-
function usesSqliteDeferredCommits(databaseProvider: unknown): boolean {
|
|
4039
|
-
return (
|
|
4040
|
-
(databaseProvider as Record<symbol, unknown> | undefined)?.[
|
|
4041
|
-
SQLITE_DEFERRED_COMMITS
|
|
4042
|
-
] === true
|
|
4043
|
-
);
|
|
4044
|
-
}
|
|
4045
|
-
|
|
4046
3999
|
function buildActorConfig(
|
|
4047
4000
|
definition: AnyActorDefinition,
|
|
4048
4001
|
registryConfig: RegistryConfig,
|
|
@@ -4056,14 +4009,12 @@ function buildActorConfig(
|
|
|
4056
4009
|
const sqliteProfiling = (
|
|
4057
4010
|
config.db as { sqliteProfiling?: SqliteProfilingOptions } | undefined
|
|
4058
4011
|
)?.sqliteProfiling;
|
|
4059
|
-
const sqliteDeferredCommits = usesSqliteDeferredCommits(config.db);
|
|
4060
4012
|
|
|
4061
4013
|
return {
|
|
4062
4014
|
name: options.name as string | undefined,
|
|
4063
4015
|
icon: options.icon as string | undefined,
|
|
4064
4016
|
hasDatabase: true,
|
|
4065
4017
|
remoteSqlite: usesRemoteSqlite,
|
|
4066
|
-
sqliteDeferredCommits: sqliteDeferredCommits || undefined,
|
|
4067
4018
|
sqliteProfiling,
|
|
4068
4019
|
tracing: buildActorTracingConfig(
|
|
4069
4020
|
definition.config.actions,
|
package/src/registry/runtime.ts
CHANGED
|
@@ -287,15 +287,10 @@ export interface RuntimeSqlRunResult {
|
|
|
287
287
|
|
|
288
288
|
export interface RuntimeSqlDatabase {
|
|
289
289
|
exec(sql: string): Promise<RuntimeSqlExecResult>;
|
|
290
|
-
execSync(sql: string): RuntimeSqlExecResult;
|
|
291
290
|
execute(
|
|
292
291
|
sql: string,
|
|
293
292
|
params?: RuntimeSqlBindParams,
|
|
294
293
|
): Promise<RuntimeSqlExecuteResult>;
|
|
295
|
-
executeSync(
|
|
296
|
-
sql: string,
|
|
297
|
-
params?: RuntimeSqlBindParams,
|
|
298
|
-
): RuntimeSqlExecuteResult;
|
|
299
294
|
executeBatch(
|
|
300
295
|
statements: RuntimeSqlBatchStatement[],
|
|
301
296
|
): Promise<RuntimeSqlExecuteResult[]>;
|
|
@@ -311,33 +306,19 @@ export interface RuntimeSqlDatabase {
|
|
|
311
306
|
timeoutMs?: number,
|
|
312
307
|
name?: string,
|
|
313
308
|
): Promise<RuntimeSqlTransactionDatabase>;
|
|
314
|
-
beginTransactionSync(
|
|
315
|
-
timeoutMs?: number,
|
|
316
|
-
name?: string,
|
|
317
|
-
): RuntimeSqlTransactionDatabase;
|
|
318
309
|
metrics?(): SqliteNativeMetrics | null;
|
|
319
310
|
takeLastKvError?(): string | null;
|
|
320
|
-
open(): Promise<void>;
|
|
321
|
-
commitTicket(): number;
|
|
322
|
-
whenDurable(ticket: number): Promise<void>;
|
|
323
311
|
close(): Promise<void>;
|
|
324
312
|
}
|
|
325
313
|
|
|
326
314
|
export interface RuntimeSqlTransactionDatabase {
|
|
327
315
|
exec(sql: string): Promise<RuntimeSqlExecResult>;
|
|
328
|
-
execSync(sql: string): RuntimeSqlExecResult;
|
|
329
316
|
execute(
|
|
330
317
|
sql: string,
|
|
331
318
|
params?: RuntimeSqlBindParams,
|
|
332
319
|
): Promise<RuntimeSqlExecuteResult>;
|
|
333
|
-
executeSync(
|
|
334
|
-
sql: string,
|
|
335
|
-
params?: RuntimeSqlBindParams,
|
|
336
|
-
): RuntimeSqlExecuteResult;
|
|
337
320
|
commit(): Promise<void>;
|
|
338
|
-
commitSync(): void;
|
|
339
321
|
rollback(): Promise<void>;
|
|
340
|
-
rollbackSync(): void;
|
|
341
322
|
}
|
|
342
323
|
|
|
343
324
|
/** Sample rates for the traces an actor starts, in the shape core takes. */
|
|
@@ -352,7 +333,6 @@ export interface RuntimeActorConfig {
|
|
|
352
333
|
icon?: string;
|
|
353
334
|
hasDatabase?: boolean;
|
|
354
335
|
remoteSqlite?: boolean;
|
|
355
|
-
sqliteDeferredCommits?: boolean;
|
|
356
336
|
sqliteProfiling?: SqliteProfilingOptions;
|
|
357
337
|
tracing?: RuntimeActorTracingConfig;
|
|
358
338
|
hasState?: boolean;
|
|
@@ -519,7 +499,8 @@ export interface CoreRuntime {
|
|
|
519
499
|
waitRegistryReady(registry: RegistryHandle): Promise<void>;
|
|
520
500
|
shutdownRegistry(registry: RegistryHandle): Promise<void>;
|
|
521
501
|
shutdownTelemetry?(): Promise<void>;
|
|
522
|
-
|
|
502
|
+
/** The engine's drain period plus its actor stop threshold, once the node connected. */
|
|
503
|
+
registryShutdownBudgetMs?(
|
|
523
504
|
registry: RegistryHandle,
|
|
524
505
|
): Promise<number | undefined>;
|
|
525
506
|
registryActiveActorCount?(registry: RegistryHandle): number;
|
|
@@ -728,20 +709,11 @@ export interface CoreRuntime {
|
|
|
728
709
|
ctx: ActorContextHandle,
|
|
729
710
|
sql: string,
|
|
730
711
|
): Promise<RuntimeSqlExecResult>;
|
|
731
|
-
actorSqlExecSync(
|
|
732
|
-
ctx: ActorContextHandle,
|
|
733
|
-
sql: string,
|
|
734
|
-
): RuntimeSqlExecResult;
|
|
735
712
|
actorSqlExecute(
|
|
736
713
|
ctx: ActorContextHandle,
|
|
737
714
|
sql: string,
|
|
738
715
|
params?: RuntimeSqlBindParams,
|
|
739
716
|
): Promise<RuntimeSqlExecuteResult>;
|
|
740
|
-
actorSqlExecuteSync(
|
|
741
|
-
ctx: ActorContextHandle,
|
|
742
|
-
sql: string,
|
|
743
|
-
params?: RuntimeSqlBindParams,
|
|
744
|
-
): RuntimeSqlExecuteResult;
|
|
745
717
|
actorSqlExecuteBatch(
|
|
746
718
|
ctx: ActorContextHandle,
|
|
747
719
|
statements: RuntimeSqlBatchStatement[],
|
|
@@ -751,37 +723,21 @@ export interface CoreRuntime {
|
|
|
751
723
|
timeoutMs?: number,
|
|
752
724
|
name?: string,
|
|
753
725
|
): Promise<SqliteTransactionHandle>;
|
|
754
|
-
actorSqlBeginTransactionSync(
|
|
755
|
-
ctx: ActorContextHandle,
|
|
756
|
-
timeoutMs?: number,
|
|
757
|
-
name?: string,
|
|
758
|
-
): SqliteTransactionHandle;
|
|
759
726
|
actorSqlTransactionExec(
|
|
760
727
|
transaction: SqliteTransactionHandle,
|
|
761
728
|
sql: string,
|
|
762
729
|
): Promise<RuntimeSqlExecResult>;
|
|
763
|
-
actorSqlTransactionExecSync(
|
|
764
|
-
transaction: SqliteTransactionHandle,
|
|
765
|
-
sql: string,
|
|
766
|
-
): RuntimeSqlExecResult;
|
|
767
730
|
actorSqlTransactionExecute(
|
|
768
731
|
transaction: SqliteTransactionHandle,
|
|
769
732
|
sql: string,
|
|
770
733
|
params?: RuntimeSqlBindParams,
|
|
771
734
|
): Promise<RuntimeSqlExecuteResult>;
|
|
772
|
-
actorSqlTransactionExecuteSync(
|
|
773
|
-
transaction: SqliteTransactionHandle,
|
|
774
|
-
sql: string,
|
|
775
|
-
params?: RuntimeSqlBindParams,
|
|
776
|
-
): RuntimeSqlExecuteResult;
|
|
777
735
|
actorSqlTransactionCommit(
|
|
778
736
|
transaction: SqliteTransactionHandle,
|
|
779
737
|
): Promise<void>;
|
|
780
|
-
actorSqlTransactionCommitSync(transaction: SqliteTransactionHandle): void;
|
|
781
738
|
actorSqlTransactionRollback(
|
|
782
739
|
transaction: SqliteTransactionHandle,
|
|
783
740
|
): Promise<void>;
|
|
784
|
-
actorSqlTransactionRollbackSync(transaction: SqliteTransactionHandle): void;
|
|
785
741
|
actorBeginStateTransaction(
|
|
786
742
|
ctx: ActorContextHandle,
|
|
787
743
|
timeoutMs?: number,
|
|
@@ -811,13 +767,6 @@ export interface CoreRuntime {
|
|
|
811
767
|
): Promise<RuntimeSqlRunResult>;
|
|
812
768
|
actorSqlMetrics(ctx: ActorContextHandle): SqliteNativeMetrics | null;
|
|
813
769
|
actorSqlTakeLastKvError(ctx: ActorContextHandle): string | null;
|
|
814
|
-
/** Opens the actor database so later synchronous calls never fetch its first pages. */
|
|
815
|
-
actorSqlOpen(ctx: ActorContextHandle): Promise<void>;
|
|
816
|
-
/** Returns the ticket of the latest local commit. */
|
|
817
|
-
actorSqlCommitTicket(ctx: ActorContextHandle): number;
|
|
818
|
-
/** Resolves once the commit `ticket` names and every earlier commit are durable. */
|
|
819
|
-
actorSqlWhenDurable(ctx: ActorContextHandle, ticket: number): Promise<void>;
|
|
820
|
-
actorSqlAbortGeneration(ctx: ActorContextHandle, reason: string): void;
|
|
821
770
|
actorSqlClose(ctx: ActorContextHandle): Promise<void>;
|
|
822
771
|
|
|
823
772
|
actorQueueSend(
|
|
@@ -151,18 +151,6 @@ function wasmNumber(value: number | bigint): number {
|
|
|
151
151
|
return typeof value === "bigint" ? Number(value) : value;
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
function synchronousSqliteUnavailable(): never {
|
|
155
|
-
throw new RivetError(
|
|
156
|
-
"sqlite",
|
|
157
|
-
"sync_unsupported",
|
|
158
|
-
"Synchronous SQLite is unavailable because the actor runs on the wasm runtime.",
|
|
159
|
-
{
|
|
160
|
-
public: true,
|
|
161
|
-
metadata: { runtime: "wasm" },
|
|
162
|
-
},
|
|
163
|
-
);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
154
|
function normalizeKvEntry(entry: RuntimeKvEntry): RuntimeKvEntry {
|
|
167
155
|
return {
|
|
168
156
|
key: toBytes(entry.key),
|
|
@@ -380,14 +368,6 @@ export class WasmCoreRuntime implements CoreRuntime {
|
|
|
380
368
|
callbacks: object,
|
|
381
369
|
config?: RuntimeActorConfig | undefined | null,
|
|
382
370
|
): ActorFactoryHandle {
|
|
383
|
-
if (config?.sqliteDeferredCommits) {
|
|
384
|
-
throw new RivetError(
|
|
385
|
-
"sqlite",
|
|
386
|
-
"deferred_commits_unsupported",
|
|
387
|
-
"SQLite deferred commits require local native SQLite, but the wasm runtime uses remote SQLite.",
|
|
388
|
-
{ metadata: { runtime: "wasm" } },
|
|
389
|
-
);
|
|
390
|
-
}
|
|
391
371
|
return callWasmSync(() =>
|
|
392
372
|
asActorFactoryHandle(
|
|
393
373
|
new this.#constructors.ActorFactory(callbacks, config),
|
|
@@ -829,13 +809,6 @@ export class WasmCoreRuntime implements CoreRuntime {
|
|
|
829
809
|
return await callWasm(() => this.#actorSql(ctx).exec(sql));
|
|
830
810
|
}
|
|
831
811
|
|
|
832
|
-
actorSqlExecSync(
|
|
833
|
-
_ctx: ActorContextHandle,
|
|
834
|
-
_sql: string,
|
|
835
|
-
): RuntimeSqlExecResult {
|
|
836
|
-
return synchronousSqliteUnavailable();
|
|
837
|
-
}
|
|
838
|
-
|
|
839
812
|
async actorSqlExecute(
|
|
840
813
|
ctx: ActorContextHandle,
|
|
841
814
|
sql: string,
|
|
@@ -847,14 +820,6 @@ export class WasmCoreRuntime implements CoreRuntime {
|
|
|
847
820
|
return normalizeRuntimeSqlExecuteResult(result);
|
|
848
821
|
}
|
|
849
822
|
|
|
850
|
-
actorSqlExecuteSync(
|
|
851
|
-
_ctx: ActorContextHandle,
|
|
852
|
-
_sql: string,
|
|
853
|
-
_params?: RuntimeSqlBindParams,
|
|
854
|
-
): RuntimeSqlExecuteResult {
|
|
855
|
-
return synchronousSqliteUnavailable();
|
|
856
|
-
}
|
|
857
|
-
|
|
858
823
|
async actorSqlExecuteBatch(
|
|
859
824
|
ctx: ActorContextHandle,
|
|
860
825
|
statements: RuntimeSqlBatchStatement[],
|
|
@@ -875,14 +840,6 @@ export class WasmCoreRuntime implements CoreRuntime {
|
|
|
875
840
|
)) as unknown as SqliteTransactionHandle;
|
|
876
841
|
}
|
|
877
842
|
|
|
878
|
-
actorSqlBeginTransactionSync(
|
|
879
|
-
_ctx: ActorContextHandle,
|
|
880
|
-
_timeoutMs?: number,
|
|
881
|
-
_name?: string,
|
|
882
|
-
): SqliteTransactionHandle {
|
|
883
|
-
return synchronousSqliteUnavailable();
|
|
884
|
-
}
|
|
885
|
-
|
|
886
843
|
async actorSqlTransactionExec(
|
|
887
844
|
transaction: SqliteTransactionHandle,
|
|
888
845
|
sql: string,
|
|
@@ -896,13 +853,6 @@ export class WasmCoreRuntime implements CoreRuntime {
|
|
|
896
853
|
);
|
|
897
854
|
}
|
|
898
855
|
|
|
899
|
-
actorSqlTransactionExecSync(
|
|
900
|
-
_transaction: SqliteTransactionHandle,
|
|
901
|
-
_sql: string,
|
|
902
|
-
): RuntimeSqlExecResult {
|
|
903
|
-
return synchronousSqliteUnavailable();
|
|
904
|
-
}
|
|
905
|
-
|
|
906
856
|
async actorSqlTransactionExecute(
|
|
907
857
|
transaction: SqliteTransactionHandle,
|
|
908
858
|
sql: string,
|
|
@@ -921,14 +871,6 @@ export class WasmCoreRuntime implements CoreRuntime {
|
|
|
921
871
|
return normalizeRuntimeSqlExecuteResult(result);
|
|
922
872
|
}
|
|
923
873
|
|
|
924
|
-
actorSqlTransactionExecuteSync(
|
|
925
|
-
_transaction: SqliteTransactionHandle,
|
|
926
|
-
_sql: string,
|
|
927
|
-
_params?: RuntimeSqlBindParams,
|
|
928
|
-
): RuntimeSqlExecuteResult {
|
|
929
|
-
return synchronousSqliteUnavailable();
|
|
930
|
-
}
|
|
931
|
-
|
|
932
874
|
async actorSqlTransactionCommit(
|
|
933
875
|
transaction: SqliteTransactionHandle,
|
|
934
876
|
): Promise<void> {
|
|
@@ -937,10 +879,6 @@ export class WasmCoreRuntime implements CoreRuntime {
|
|
|
937
879
|
);
|
|
938
880
|
}
|
|
939
881
|
|
|
940
|
-
actorSqlTransactionCommitSync(_transaction: SqliteTransactionHandle): void {
|
|
941
|
-
synchronousSqliteUnavailable();
|
|
942
|
-
}
|
|
943
|
-
|
|
944
882
|
async actorSqlTransactionRollback(
|
|
945
883
|
transaction: SqliteTransactionHandle,
|
|
946
884
|
): Promise<void> {
|
|
@@ -950,13 +888,6 @@ export class WasmCoreRuntime implements CoreRuntime {
|
|
|
950
888
|
).rollback(),
|
|
951
889
|
);
|
|
952
890
|
}
|
|
953
|
-
|
|
954
|
-
actorSqlTransactionRollbackSync(
|
|
955
|
-
_transaction: SqliteTransactionHandle,
|
|
956
|
-
): void {
|
|
957
|
-
synchronousSqliteUnavailable();
|
|
958
|
-
}
|
|
959
|
-
|
|
960
891
|
async actorBeginStateTransaction(
|
|
961
892
|
ctx: ActorContextHandle,
|
|
962
893
|
timeoutMs?: number,
|
|
@@ -1039,25 +970,6 @@ export class WasmCoreRuntime implements CoreRuntime {
|
|
|
1039
970
|
return this.#actorSql(ctx).takeLastKvError?.() ?? null;
|
|
1040
971
|
}
|
|
1041
972
|
|
|
1042
|
-
async actorSqlOpen(_ctx: ActorContextHandle): Promise<void> {
|
|
1043
|
-
// Remote SQLite opens on the engine side with each request.
|
|
1044
|
-
}
|
|
1045
|
-
|
|
1046
|
-
actorSqlCommitTicket(_ctx: ActorContextHandle): number {
|
|
1047
|
-
return synchronousSqliteUnavailable();
|
|
1048
|
-
}
|
|
1049
|
-
|
|
1050
|
-
actorSqlAbortGeneration(_ctx: ActorContextHandle, _reason: string): void {
|
|
1051
|
-
synchronousSqliteUnavailable();
|
|
1052
|
-
}
|
|
1053
|
-
|
|
1054
|
-
async actorSqlWhenDurable(
|
|
1055
|
-
_ctx: ActorContextHandle,
|
|
1056
|
-
_ticket: number,
|
|
1057
|
-
): Promise<void> {
|
|
1058
|
-
synchronousSqliteUnavailable();
|
|
1059
|
-
}
|
|
1060
|
-
|
|
1061
973
|
async actorSqlClose(ctx: ActorContextHandle): Promise<void> {
|
|
1062
974
|
const wasmCtx = asWasmActorContext(ctx);
|
|
1063
975
|
const database = this.#sql.get(wasmCtx);
|