@rivetkit/rivetkit-wasm 0.0.0-runner-config-drain-grace-threshold.e1be3d6 → 0.0.0-sqlite-uds.4e59a38

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/index.d.ts CHANGED
@@ -1,2 +1,176 @@
1
- export * from "./pkg/rivetkit_wasm.js";
2
- export { default } from "./pkg/rivetkit_wasm.js";
1
+ export function start(): void;
2
+ export function awaitPromise(promise: Promise<any>): Promise<any>;
3
+ export function uint8ArrayFromBytes(bytes: Uint8Array): Uint8Array;
4
+ export function bridgeRivetErrorPrefix(): string;
5
+ export function roundTripBytes(bytes: Uint8Array): Uint8Array;
6
+
7
+ export class ActorContext {
8
+ free(): void;
9
+ keepAwake(promise: Promise<any>): void;
10
+ saveState(payload: any): Promise<void>;
11
+ waitUntil(promise: Promise<any>): void;
12
+ abortSignal(): any;
13
+ connectConn(params: Uint8Array, request: any): Promise<ConnHandle>;
14
+ requestSave(opts: any): void;
15
+ registerTask(promise: Promise<any>): void;
16
+ runtimeState(): any;
17
+ endKeepAwake(region_id: number): void;
18
+ beginKeepAwake(): number;
19
+ inspectorSnapshot(): object;
20
+ endOnStateChange(): void;
21
+ restartRunHandler(): void;
22
+ beginOnStateChange(): void;
23
+ requestSaveAndWait(opts: any): Promise<void>;
24
+ verifyInspectorAuth(bearer_token?: string | null): Promise<void>;
25
+ endWebsocketCallback(region_id: number): void;
26
+ beginWebsocketCallback(): number;
27
+ dirtyHibernatableConns(): Array<any>;
28
+ kv(): Kv;
29
+ waitForTrackedShutdownWork(): Promise<boolean>;
30
+ takePendingHibernationChanges(): Array<any>;
31
+ key(): any;
32
+ constructor();
33
+ sql(): SqliteDb;
34
+ name(): string;
35
+ conns(): Array<any>;
36
+ queue(): Queue;
37
+ sleep(): void;
38
+ state(): Uint8Array;
39
+ region(): string;
40
+ destroy(): void;
41
+ actorId(): string;
42
+ schedule(): Schedule;
43
+ broadcast(name: string, args: Uint8Array): void;
44
+ setAlarm(timestamp_ms?: number | null): void;
45
+ }
46
+
47
+ export class ActorFactory {
48
+ free(): void;
49
+ constructor(callbacks: any, config: any);
50
+ }
51
+
52
+ export class CancellationToken {
53
+ free(): void;
54
+ onCancelled(callback: Function): void;
55
+ constructor();
56
+ cancel(): void;
57
+ aborted(): boolean;
58
+ }
59
+
60
+ export class ConnHandle {
61
+ private constructor();
62
+ free(): void;
63
+ disconnect(reason?: string | null): Promise<void>;
64
+ isHibernatable(): boolean;
65
+ id(): string;
66
+ send(name: string, args: Uint8Array): void;
67
+ state(): Uint8Array;
68
+ params(): Uint8Array;
69
+ setState(state: Uint8Array): void;
70
+ }
71
+
72
+ export class CoreRegistry {
73
+ free(): void;
74
+ handleServerlessRequest(
75
+ req: any,
76
+ on_stream_event: Function,
77
+ cancel_token: CancellationToken,
78
+ config: any,
79
+ ): Promise<any>;
80
+ constructor();
81
+ serve(config: any): Promise<void>;
82
+ register(name: string, factory: ActorFactory): void;
83
+ shutdown(): Promise<void>;
84
+ }
85
+
86
+ export class Kv {
87
+ private constructor();
88
+ free(): void;
89
+ delete(key: Uint8Array): Promise<void>;
90
+ listRange(start: Uint8Array, end: Uint8Array, options: any): Promise<any>;
91
+ listPrefix(prefix: Uint8Array, options: any): Promise<any>;
92
+ batchDelete(keys: Array<any>): Promise<void>;
93
+ deleteRange(start: Uint8Array, end: Uint8Array): Promise<void>;
94
+ get(key: Uint8Array): Promise<any>;
95
+ put(key: Uint8Array, value: Uint8Array): Promise<void>;
96
+ batchGet(keys: Array<any>): Promise<any>;
97
+ batchPut(entries: Array<any>): Promise<void>;
98
+ }
99
+
100
+ export class Queue {
101
+ private constructor();
102
+ free(): void;
103
+ nextBatch(
104
+ options: any,
105
+ signal?: CancellationToken | null,
106
+ ): Promise<Array<any>>;
107
+ tryNextBatch(options: any): Array<any>;
108
+ waitForNames(
109
+ names: any,
110
+ options: any,
111
+ signal?: CancellationToken | null,
112
+ ): Promise<QueueMessage>;
113
+ enqueueAndWait(
114
+ name: string,
115
+ body: Uint8Array,
116
+ options: any,
117
+ signal?: CancellationToken | null,
118
+ ): Promise<Uint8Array | undefined>;
119
+ inspectMessages(): Promise<Array<any>>;
120
+ waitForNamesAvailable(names: any, options: any): Promise<void>;
121
+ send(name: string, body: Uint8Array): Promise<QueueMessage>;
122
+ maxSize(): number;
123
+ reset(): Promise<void>;
124
+ }
125
+
126
+ export class QueueMessage {
127
+ private constructor();
128
+ free(): void;
129
+ createdAt(): number;
130
+ isCompletable(): boolean;
131
+ id(): bigint;
132
+ body(): Uint8Array;
133
+ name(): string;
134
+ complete(response: any): Promise<void>;
135
+ }
136
+
137
+ export class Schedule {
138
+ private constructor();
139
+ free(): void;
140
+ at(timestamp_ms: number, action_name: string, args: Uint8Array): void;
141
+ after(duration_ms: number, action_name: string, args: Uint8Array): void;
142
+ }
143
+
144
+ export class SqliteDb {
145
+ private constructor();
146
+ free(): void;
147
+ run(sql: string, params: any): Promise<any>;
148
+ exec(sql: string): Promise<any>;
149
+ close(): Promise<void>;
150
+ query(sql: string, params: any): Promise<any>;
151
+ execute(sql: string, params: any): Promise<any>;
152
+ }
153
+
154
+ export class WebSocketHandle {
155
+ private constructor();
156
+ free(): void;
157
+ setEventCallback(callback: Function): void;
158
+ send(data: Uint8Array, binary: boolean): void;
159
+ close(code?: number | null, reason?: string | null): Promise<void>;
160
+ }
161
+
162
+ export type InitInput =
163
+ | RequestInfo
164
+ | URL
165
+ | Response
166
+ | BufferSource
167
+ | WebAssembly.Module;
168
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
169
+ export interface InitOutput {
170
+ readonly memory: WebAssembly.Memory;
171
+ }
172
+
173
+ declare function init(
174
+ module_or_path?: InitInput | Promise<InitInput>,
175
+ ): Promise<InitOutput>;
176
+ export default init;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rivetkit/rivetkit-wasm",
3
- "version": "0.0.0-runner-config-drain-grace-threshold.e1be3d6",
3
+ "version": "0.0.0-sqlite-uds.4e59a38",
4
4
  "description": "WebAssembly bindings for RivetKit core on edge JavaScript runtimes",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -28,6 +28,7 @@
28
28
  ],
29
29
  "scripts": {
30
30
  "build": "node scripts/build.mjs",
31
+ "build:embed": "node scripts/build.mjs",
31
32
  "build:cloudflare": "node scripts/build.mjs --target bundler --out-dir pkg-cloudflare",
32
33
  "build:deno": "node scripts/build.mjs --target web --out-dir pkg-deno",
33
34
  "check:package": "node scripts/check-package.mjs",
@@ -37,6 +38,6 @@
37
38
  },
38
39
  "devDependencies": {
39
40
  "typescript": "^5.9.2",
40
- "wasm-pack": "0.14.0"
41
+ "wasm-pack": "0.15.0"
41
42
  }
42
43
  }
@@ -1,10 +1,10 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- export function awaitPromise(promise: Promise<any>): Promise<any>;
4
- export function roundTripBytes(bytes: Uint8Array): Uint8Array;
5
3
  export function start(): void;
6
- export function uint8ArrayFromBytes(bytes: Uint8Array): Uint8Array;
4
+ export function roundTripBytes(bytes: Uint8Array): Uint8Array;
5
+ export function awaitPromise(promise: Promise<any>): Promise<any>;
7
6
  export function bridgeRivetErrorPrefix(): string;
7
+ export function uint8ArrayFromBytes(bytes: Uint8Array): Uint8Array;
8
8
  export class ActorContext {
9
9
  free(): void;
10
10
  keepAwake(promise: Promise<any>): void;
@@ -27,10 +27,12 @@ export class ActorContext {
27
27
  beginWebsocketCallback(): number;
28
28
  dirtyHibernatableConns(): Array<any>;
29
29
  kv(): Kv;
30
+ waitForTrackedShutdownWork(): Promise<boolean>;
30
31
  takePendingHibernationChanges(): Array<any>;
31
32
  key(): any;
32
33
  constructor();
33
34
  sql(): SqliteDb;
35
+ waitForTrackedShutdownWorkUnbounded(): Promise<void>;
34
36
  name(): string;
35
37
  conns(): Array<any>;
36
38
  queue(): Queue;
@@ -96,6 +98,7 @@ export class Queue {
96
98
  inspectMessages(): Promise<Array<any>>;
97
99
  waitForNamesAvailable(names: any, options: any): Promise<void>;
98
100
  send(name: string, body: Uint8Array): Promise<QueueMessage>;
101
+ reset(): Promise<void>;
99
102
  maxSize(): number;
100
103
  }
101
104
  export class QueueMessage {
@@ -176,6 +179,8 @@ export interface InitOutput {
176
179
  readonly actorcontext_state: (a: number) => [number, number];
177
180
  readonly actorcontext_takePendingHibernationChanges: (a: number) => any;
178
181
  readonly actorcontext_verifyInspectorAuth: (a: number, b: number, c: number) => any;
182
+ readonly actorcontext_waitForTrackedShutdownWork: (a: number) => any;
183
+ readonly actorcontext_waitForTrackedShutdownWorkUnbounded: (a: number) => any;
179
184
  readonly actorcontext_waitUntil: (a: number, b: any) => void;
180
185
  readonly actorfactory_new: (a: any, b: any) => [number, number, number];
181
186
  readonly awaitPromise: (a: any) => any;
@@ -209,6 +214,7 @@ export interface InitOutput {
209
214
  readonly queue_inspectMessages: (a: number) => any;
210
215
  readonly queue_maxSize: (a: number) => number;
211
216
  readonly queue_nextBatch: (a: number, b: any, c: number) => any;
217
+ readonly queue_reset: (a: number) => any;
212
218
  readonly queue_send: (a: number, b: number, c: number, d: number, e: number) => any;
213
219
  readonly queue_tryNextBatch: (a: number, b: any) => [number, number, number];
214
220
  readonly queue_waitForNames: (a: number, b: any, c: any, d: number) => any;
@@ -234,8 +240,8 @@ export interface InitOutput {
234
240
  readonly start: () => void;
235
241
  readonly actorcontext_queue: (a: number) => number;
236
242
  readonly actorcontext_schedule: (a: number) => number;
237
- readonly __wbg_schedule_free: (a: number, b: number) => void;
238
243
  readonly __wbg_queue_free: (a: number, b: number) => void;
244
+ readonly __wbg_schedule_free: (a: number, b: number) => void;
239
245
  readonly __wbindgen_malloc: (a: number, b: number) => number;
240
246
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
241
247
  readonly __wbindgen_exn_store: (a: number) => void;
@@ -244,9 +250,9 @@ export interface InitOutput {
244
250
  readonly __wbindgen_free: (a: number, b: number, c: number) => void;
245
251
  readonly __wbindgen_export_6: WebAssembly.Table;
246
252
  readonly __externref_table_dealloc: (a: number) => void;
247
- readonly closure1602_externref_shim: (a: number, b: number, c: any) => void;
248
- readonly closure1805_externref_shim: (a: number, b: number, c: any) => void;
249
- readonly closure2018_externref_shim: (a: number, b: number, c: any, d: any) => void;
253
+ readonly closure1608_externref_shim: (a: number, b: number, c: any) => void;
254
+ readonly closure1960_externref_shim: (a: number, b: number, c: any) => void;
255
+ readonly closure2191_externref_shim: (a: number, b: number, c: any, d: any) => void;
250
256
  readonly __wbindgen_start: () => void;
251
257
  }
252
258
 
@@ -221,13 +221,9 @@ function _assertClass(instance, klass) {
221
221
  throw new Error(`expected instance of ${klass.name}`);
222
222
  }
223
223
  }
224
- /**
225
- * @param {Promise<any>} promise
226
- * @returns {Promise<any>}
227
- */
228
- export function awaitPromise(promise) {
229
- const ret = wasm.awaitPromise(promise);
230
- return ret;
224
+
225
+ export function start() {
226
+ wasm.start();
231
227
  }
232
228
 
233
229
  /**
@@ -243,18 +239,12 @@ export function roundTripBytes(bytes) {
243
239
  return v2;
244
240
  }
245
241
 
246
- export function start() {
247
- wasm.start();
248
- }
249
-
250
242
  /**
251
- * @param {Uint8Array} bytes
252
- * @returns {Uint8Array}
243
+ * @param {Promise<any>} promise
244
+ * @returns {Promise<any>}
253
245
  */
254
- export function uint8ArrayFromBytes(bytes) {
255
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
256
- const len0 = WASM_VECTOR_LEN;
257
- const ret = wasm.uint8ArrayFromBytes(ptr0, len0);
246
+ export function awaitPromise(promise) {
247
+ const ret = wasm.awaitPromise(promise);
258
248
  return ret;
259
249
  }
260
250
 
@@ -274,16 +264,27 @@ export function bridgeRivetErrorPrefix() {
274
264
  }
275
265
  }
276
266
 
267
+ /**
268
+ * @param {Uint8Array} bytes
269
+ * @returns {Uint8Array}
270
+ */
271
+ export function uint8ArrayFromBytes(bytes) {
272
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
273
+ const len0 = WASM_VECTOR_LEN;
274
+ const ret = wasm.uint8ArrayFromBytes(ptr0, len0);
275
+ return ret;
276
+ }
277
+
277
278
  function __wbg_adapter_46(arg0, arg1, arg2) {
278
- wasm.closure1602_externref_shim(arg0, arg1, arg2);
279
+ wasm.closure1608_externref_shim(arg0, arg1, arg2);
279
280
  }
280
281
 
281
282
  function __wbg_adapter_55(arg0, arg1, arg2) {
282
- wasm.closure1805_externref_shim(arg0, arg1, arg2);
283
+ wasm.closure1960_externref_shim(arg0, arg1, arg2);
283
284
  }
284
285
 
285
- function __wbg_adapter_224(arg0, arg1, arg2, arg3) {
286
- wasm.closure2018_externref_shim(arg0, arg1, arg2, arg3);
286
+ function __wbg_adapter_239(arg0, arg1, arg2, arg3) {
287
+ wasm.closure2191_externref_shim(arg0, arg1, arg2, arg3);
287
288
  }
288
289
 
289
290
  const __wbindgen_enum_BinaryType = ["blob", "arraybuffer"];
@@ -450,6 +451,13 @@ export class ActorContext {
450
451
  const ret = wasm.actorcontext_kv(this.__wbg_ptr);
451
452
  return Kv.__wrap(ret);
452
453
  }
454
+ /**
455
+ * @returns {Promise<boolean>}
456
+ */
457
+ waitForTrackedShutdownWork() {
458
+ const ret = wasm.actorcontext_waitForTrackedShutdownWork(this.__wbg_ptr);
459
+ return ret;
460
+ }
453
461
  /**
454
462
  * @returns {Array<any>}
455
463
  */
@@ -483,6 +491,13 @@ export class ActorContext {
483
491
  const ret = wasm.actorcontext_sql(this.__wbg_ptr);
484
492
  return SqliteDb.__wrap(ret);
485
493
  }
494
+ /**
495
+ * @returns {Promise<void>}
496
+ */
497
+ waitForTrackedShutdownWorkUnbounded() {
498
+ const ret = wasm.actorcontext_waitForTrackedShutdownWorkUnbounded(this.__wbg_ptr);
499
+ return ret;
500
+ }
486
501
  /**
487
502
  * @returns {string}
488
503
  */
@@ -1062,6 +1077,13 @@ export class Queue {
1062
1077
  const ret = wasm.queue_send(this.__wbg_ptr, ptr0, len0, ptr1, len1);
1063
1078
  return ret;
1064
1079
  }
1080
+ /**
1081
+ * @returns {Promise<void>}
1082
+ */
1083
+ reset() {
1084
+ const ret = wasm.queue_reset(this.__wbg_ptr);
1085
+ return ret;
1086
+ }
1065
1087
  /**
1066
1088
  * @returns {number}
1067
1089
  */
@@ -1441,7 +1463,7 @@ function __wbg_get_imports() {
1441
1463
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
1442
1464
  }
1443
1465
  };
1444
- imports.wbg.__wbg_getRandomValues_38097e921c2494c3 = function() { return handleError(function (arg0, arg1) {
1466
+ imports.wbg.__wbg_getRandomValues_6c498bf966d88108 = function() { return handleError(function (arg0, arg1) {
1445
1467
  globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
1446
1468
  }, arguments) };
1447
1469
  imports.wbg.__wbg_getRandomValues_b8f5dbd5f3995a9e = function() { return handleError(function (arg0, arg1) {
@@ -1555,7 +1577,7 @@ function __wbg_get_imports() {
1555
1577
  const a = state0.a;
1556
1578
  state0.a = 0;
1557
1579
  try {
1558
- return __wbg_adapter_224(a, state0.b, arg0, arg1);
1580
+ return __wbg_adapter_239(a, state0.b, arg0, arg1);
1559
1581
  } finally {
1560
1582
  state0.a = a;
1561
1583
  }
@@ -1767,24 +1789,24 @@ function __wbg_get_imports() {
1767
1789
  const ret = false;
1768
1790
  return ret;
1769
1791
  };
1770
- imports.wbg.__wbindgen_closure_wrapper3785 = function(arg0, arg1, arg2) {
1771
- const ret = makeMutClosure(arg0, arg1, 1603, __wbg_adapter_46);
1792
+ imports.wbg.__wbindgen_closure_wrapper3780 = function(arg0, arg1, arg2) {
1793
+ const ret = makeMutClosure(arg0, arg1, 1609, __wbg_adapter_46);
1772
1794
  return ret;
1773
1795
  };
1774
- imports.wbg.__wbindgen_closure_wrapper3787 = function(arg0, arg1, arg2) {
1775
- const ret = makeMutClosure(arg0, arg1, 1603, __wbg_adapter_46);
1796
+ imports.wbg.__wbindgen_closure_wrapper3782 = function(arg0, arg1, arg2) {
1797
+ const ret = makeMutClosure(arg0, arg1, 1609, __wbg_adapter_46);
1776
1798
  return ret;
1777
1799
  };
1778
- imports.wbg.__wbindgen_closure_wrapper3789 = function(arg0, arg1, arg2) {
1779
- const ret = makeMutClosure(arg0, arg1, 1603, __wbg_adapter_46);
1800
+ imports.wbg.__wbindgen_closure_wrapper3784 = function(arg0, arg1, arg2) {
1801
+ const ret = makeMutClosure(arg0, arg1, 1609, __wbg_adapter_46);
1780
1802
  return ret;
1781
1803
  };
1782
- imports.wbg.__wbindgen_closure_wrapper3791 = function(arg0, arg1, arg2) {
1783
- const ret = makeMutClosure(arg0, arg1, 1603, __wbg_adapter_46);
1804
+ imports.wbg.__wbindgen_closure_wrapper3786 = function(arg0, arg1, arg2) {
1805
+ const ret = makeMutClosure(arg0, arg1, 1609, __wbg_adapter_46);
1784
1806
  return ret;
1785
1807
  };
1786
- imports.wbg.__wbindgen_closure_wrapper4389 = function(arg0, arg1, arg2) {
1787
- const ret = makeMutClosure(arg0, arg1, 1806, __wbg_adapter_55);
1808
+ imports.wbg.__wbindgen_closure_wrapper4626 = function(arg0, arg1, arg2) {
1809
+ const ret = makeMutClosure(arg0, arg1, 1961, __wbg_adapter_55);
1788
1810
  return ret;
1789
1811
  };
1790
1812
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
Binary file
@@ -42,6 +42,8 @@ export const actorcontext_sql: (a: number) => number;
42
42
  export const actorcontext_state: (a: number) => [number, number];
43
43
  export const actorcontext_takePendingHibernationChanges: (a: number) => any;
44
44
  export const actorcontext_verifyInspectorAuth: (a: number, b: number, c: number) => any;
45
+ export const actorcontext_waitForTrackedShutdownWork: (a: number) => any;
46
+ export const actorcontext_waitForTrackedShutdownWorkUnbounded: (a: number) => any;
45
47
  export const actorcontext_waitUntil: (a: number, b: any) => void;
46
48
  export const actorfactory_new: (a: any, b: any) => [number, number, number];
47
49
  export const awaitPromise: (a: any) => any;
@@ -75,6 +77,7 @@ export const queue_enqueueAndWait: (a: number, b: number, c: number, d: number,
75
77
  export const queue_inspectMessages: (a: number) => any;
76
78
  export const queue_maxSize: (a: number) => number;
77
79
  export const queue_nextBatch: (a: number, b: any, c: number) => any;
80
+ export const queue_reset: (a: number) => any;
78
81
  export const queue_send: (a: number, b: number, c: number, d: number, e: number) => any;
79
82
  export const queue_tryNextBatch: (a: number, b: any) => [number, number, number];
80
83
  export const queue_waitForNames: (a: number, b: any, c: any, d: number) => any;
@@ -100,8 +103,8 @@ export const websockethandle_setEventCallback: (a: number, b: any) => void;
100
103
  export const start: () => void;
101
104
  export const actorcontext_queue: (a: number) => number;
102
105
  export const actorcontext_schedule: (a: number) => number;
103
- export const __wbg_schedule_free: (a: number, b: number) => void;
104
106
  export const __wbg_queue_free: (a: number, b: number) => void;
107
+ export const __wbg_schedule_free: (a: number, b: number) => void;
105
108
  export const __wbindgen_malloc: (a: number, b: number) => number;
106
109
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
107
110
  export const __wbindgen_exn_store: (a: number) => void;
@@ -110,7 +113,7 @@ export const __wbindgen_export_4: WebAssembly.Table;
110
113
  export const __wbindgen_free: (a: number, b: number, c: number) => void;
111
114
  export const __wbindgen_export_6: WebAssembly.Table;
112
115
  export const __externref_table_dealloc: (a: number) => void;
113
- export const closure1602_externref_shim: (a: number, b: number, c: any) => void;
114
- export const closure1805_externref_shim: (a: number, b: number, c: any) => void;
115
- export const closure2018_externref_shim: (a: number, b: number, c: any, d: any) => void;
116
+ export const closure1608_externref_shim: (a: number, b: number, c: any) => void;
117
+ export const closure1960_externref_shim: (a: number, b: number, c: any) => void;
118
+ export const closure2191_externref_shim: (a: number, b: number, c: any, d: any) => void;
116
119
  export const __wbindgen_start: () => void;