@rivetkit/rivetkit-wasm 2.3.0-rc.10 → 2.3.0-rc.12

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,175 @@
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
+ }
124
+
125
+ export class QueueMessage {
126
+ private constructor();
127
+ free(): void;
128
+ createdAt(): number;
129
+ isCompletable(): boolean;
130
+ id(): bigint;
131
+ body(): Uint8Array;
132
+ name(): string;
133
+ complete(response: any): Promise<void>;
134
+ }
135
+
136
+ export class Schedule {
137
+ private constructor();
138
+ free(): void;
139
+ at(timestamp_ms: number, action_name: string, args: Uint8Array): void;
140
+ after(duration_ms: number, action_name: string, args: Uint8Array): void;
141
+ }
142
+
143
+ export class SqliteDb {
144
+ private constructor();
145
+ free(): void;
146
+ run(sql: string, params: any): Promise<any>;
147
+ exec(sql: string): Promise<any>;
148
+ close(): Promise<void>;
149
+ query(sql: string, params: any): Promise<any>;
150
+ execute(sql: string, params: any): Promise<any>;
151
+ }
152
+
153
+ export class WebSocketHandle {
154
+ private constructor();
155
+ free(): void;
156
+ setEventCallback(callback: Function): void;
157
+ send(data: Uint8Array, binary: boolean): void;
158
+ close(code?: number | null, reason?: string | null): Promise<void>;
159
+ }
160
+
161
+ export type InitInput =
162
+ | RequestInfo
163
+ | URL
164
+ | Response
165
+ | BufferSource
166
+ | WebAssembly.Module;
167
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
168
+ export interface InitOutput {
169
+ readonly memory: WebAssembly.Memory;
170
+ }
171
+
172
+ declare function init(
173
+ module_or_path?: InitInput | Promise<InitInput>,
174
+ ): Promise<InitOutput>;
175
+ export default init;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rivetkit/rivetkit-wasm",
3
- "version": "2.3.0-rc.10",
3
+ "version": "2.3.0-rc.12",
4
4
  "description": "WebAssembly bindings for RivetKit core on edge JavaScript runtimes",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -37,6 +37,6 @@
37
37
  },
38
38
  "devDependencies": {
39
39
  "typescript": "^5.9.2",
40
- "wasm-pack": "0.14.0"
40
+ "wasm-pack": "0.15.0"
41
41
  }
42
42
  }
@@ -1,10 +1,10 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- export function bridgeRivetErrorPrefix(): string;
4
3
  export function start(): void;
5
4
  export function roundTripBytes(bytes: Uint8Array): Uint8Array;
6
- export function awaitPromise(promise: Promise<any>): Promise<any>;
7
5
  export function uint8ArrayFromBytes(bytes: Uint8Array): Uint8Array;
6
+ export function awaitPromise(promise: Promise<any>): Promise<any>;
7
+ export function bridgeRivetErrorPrefix(): string;
8
8
  export class ActorContext {
9
9
  free(): void;
10
10
  keepAwake(promise: Promise<any>): void;
@@ -32,6 +32,7 @@ export class ActorContext {
32
32
  key(): any;
33
33
  constructor();
34
34
  sql(): SqliteDb;
35
+ waitForTrackedShutdownWorkUnbounded(): Promise<void>;
35
36
  name(): string;
36
37
  conns(): Array<any>;
37
38
  queue(): Queue;
@@ -178,6 +179,7 @@ export interface InitOutput {
178
179
  readonly actorcontext_takePendingHibernationChanges: (a: number) => any;
179
180
  readonly actorcontext_verifyInspectorAuth: (a: number, b: number, c: number) => any;
180
181
  readonly actorcontext_waitForTrackedShutdownWork: (a: number) => any;
182
+ readonly actorcontext_waitForTrackedShutdownWorkUnbounded: (a: number) => any;
181
183
  readonly actorcontext_waitUntil: (a: number, b: any) => void;
182
184
  readonly actorfactory_new: (a: any, b: any) => [number, number, number];
183
185
  readonly awaitPromise: (a: any) => any;
@@ -236,8 +238,8 @@ export interface InitOutput {
236
238
  readonly start: () => void;
237
239
  readonly actorcontext_queue: (a: number) => number;
238
240
  readonly actorcontext_schedule: (a: number) => number;
239
- readonly __wbg_schedule_free: (a: number, b: number) => void;
240
241
  readonly __wbg_queue_free: (a: number, b: number) => void;
242
+ readonly __wbg_schedule_free: (a: number, b: number) => void;
241
243
  readonly __wbindgen_malloc: (a: number, b: number) => number;
242
244
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
243
245
  readonly __wbindgen_exn_store: (a: number) => void;
@@ -246,9 +248,9 @@ export interface InitOutput {
246
248
  readonly __wbindgen_free: (a: number, b: number, c: number) => void;
247
249
  readonly __wbindgen_export_6: WebAssembly.Table;
248
250
  readonly __externref_table_dealloc: (a: number) => void;
249
- readonly closure1590_externref_shim: (a: number, b: number, c: any) => void;
250
- readonly closure1943_externref_shim: (a: number, b: number, c: any) => void;
251
- readonly closure2166_externref_shim: (a: number, b: number, c: any, d: any) => void;
251
+ readonly closure1594_externref_shim: (a: number, b: number, c: any) => void;
252
+ readonly closure1946_externref_shim: (a: number, b: number, c: any) => void;
253
+ readonly closure2169_externref_shim: (a: number, b: number, c: any, d: any) => void;
252
254
  readonly __wbindgen_start: () => void;
253
255
  }
254
256
 
@@ -221,21 +221,6 @@ function _assertClass(instance, klass) {
221
221
  throw new Error(`expected instance of ${klass.name}`);
222
222
  }
223
223
  }
224
- /**
225
- * @returns {string}
226
- */
227
- export function bridgeRivetErrorPrefix() {
228
- let deferred1_0;
229
- let deferred1_1;
230
- try {
231
- const ret = wasm.bridgeRivetErrorPrefix();
232
- deferred1_0 = ret[0];
233
- deferred1_1 = ret[1];
234
- return getStringFromWasm0(ret[0], ret[1]);
235
- } finally {
236
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
237
- }
238
- }
239
224
 
240
225
  export function start() {
241
226
  wasm.start();
@@ -254,6 +239,17 @@ export function roundTripBytes(bytes) {
254
239
  return v2;
255
240
  }
256
241
 
242
+ /**
243
+ * @param {Uint8Array} bytes
244
+ * @returns {Uint8Array}
245
+ */
246
+ export function uint8ArrayFromBytes(bytes) {
247
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
248
+ const len0 = WASM_VECTOR_LEN;
249
+ const ret = wasm.uint8ArrayFromBytes(ptr0, len0);
250
+ return ret;
251
+ }
252
+
257
253
  /**
258
254
  * @param {Promise<any>} promise
259
255
  * @returns {Promise<any>}
@@ -264,26 +260,31 @@ export function awaitPromise(promise) {
264
260
  }
265
261
 
266
262
  /**
267
- * @param {Uint8Array} bytes
268
- * @returns {Uint8Array}
263
+ * @returns {string}
269
264
  */
270
- export function uint8ArrayFromBytes(bytes) {
271
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
272
- const len0 = WASM_VECTOR_LEN;
273
- const ret = wasm.uint8ArrayFromBytes(ptr0, len0);
274
- return ret;
265
+ export function bridgeRivetErrorPrefix() {
266
+ let deferred1_0;
267
+ let deferred1_1;
268
+ try {
269
+ const ret = wasm.bridgeRivetErrorPrefix();
270
+ deferred1_0 = ret[0];
271
+ deferred1_1 = ret[1];
272
+ return getStringFromWasm0(ret[0], ret[1]);
273
+ } finally {
274
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
275
+ }
275
276
  }
276
277
 
277
278
  function __wbg_adapter_46(arg0, arg1, arg2) {
278
- wasm.closure1590_externref_shim(arg0, arg1, arg2);
279
+ wasm.closure1594_externref_shim(arg0, arg1, arg2);
279
280
  }
280
281
 
281
282
  function __wbg_adapter_55(arg0, arg1, arg2) {
282
- wasm.closure1943_externref_shim(arg0, arg1, arg2);
283
+ wasm.closure1946_externref_shim(arg0, arg1, arg2);
283
284
  }
284
285
 
285
- function __wbg_adapter_225(arg0, arg1, arg2, arg3) {
286
- wasm.closure2166_externref_shim(arg0, arg1, arg2, arg3);
286
+ function __wbg_adapter_268(arg0, arg1, arg2, arg3) {
287
+ wasm.closure2169_externref_shim(arg0, arg1, arg2, arg3);
287
288
  }
288
289
 
289
290
  const __wbindgen_enum_BinaryType = ["blob", "arraybuffer"];
@@ -490,6 +491,13 @@ export class ActorContext {
490
491
  const ret = wasm.actorcontext_sql(this.__wbg_ptr);
491
492
  return SqliteDb.__wrap(ret);
492
493
  }
494
+ /**
495
+ * @returns {Promise<void>}
496
+ */
497
+ waitForTrackedShutdownWorkUnbounded() {
498
+ const ret = wasm.actorcontext_waitForTrackedShutdownWorkUnbounded(this.__wbg_ptr);
499
+ return ret;
500
+ }
493
501
  /**
494
502
  * @returns {string}
495
503
  */
@@ -1448,7 +1456,7 @@ function __wbg_get_imports() {
1448
1456
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
1449
1457
  }
1450
1458
  };
1451
- imports.wbg.__wbg_getRandomValues_38097e921c2494c3 = function() { return handleError(function (arg0, arg1) {
1459
+ imports.wbg.__wbg_getRandomValues_6c498bf966d88108 = function() { return handleError(function (arg0, arg1) {
1452
1460
  globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
1453
1461
  }, arguments) };
1454
1462
  imports.wbg.__wbg_getRandomValues_b8f5dbd5f3995a9e = function() { return handleError(function (arg0, arg1) {
@@ -1562,7 +1570,7 @@ function __wbg_get_imports() {
1562
1570
  const a = state0.a;
1563
1571
  state0.a = 0;
1564
1572
  try {
1565
- return __wbg_adapter_225(a, state0.b, arg0, arg1);
1573
+ return __wbg_adapter_268(a, state0.b, arg0, arg1);
1566
1574
  } finally {
1567
1575
  state0.a = a;
1568
1576
  }
@@ -1774,24 +1782,24 @@ function __wbg_get_imports() {
1774
1782
  const ret = false;
1775
1783
  return ret;
1776
1784
  };
1777
- imports.wbg.__wbindgen_closure_wrapper3700 = function(arg0, arg1, arg2) {
1778
- const ret = makeMutClosure(arg0, arg1, 1591, __wbg_adapter_46);
1785
+ imports.wbg.__wbindgen_closure_wrapper3703 = function(arg0, arg1, arg2) {
1786
+ const ret = makeMutClosure(arg0, arg1, 1595, __wbg_adapter_46);
1779
1787
  return ret;
1780
1788
  };
1781
- imports.wbg.__wbindgen_closure_wrapper3702 = function(arg0, arg1, arg2) {
1782
- const ret = makeMutClosure(arg0, arg1, 1591, __wbg_adapter_46);
1789
+ imports.wbg.__wbindgen_closure_wrapper3705 = function(arg0, arg1, arg2) {
1790
+ const ret = makeMutClosure(arg0, arg1, 1595, __wbg_adapter_46);
1783
1791
  return ret;
1784
1792
  };
1785
- imports.wbg.__wbindgen_closure_wrapper3704 = function(arg0, arg1, arg2) {
1786
- const ret = makeMutClosure(arg0, arg1, 1591, __wbg_adapter_46);
1793
+ imports.wbg.__wbindgen_closure_wrapper3707 = function(arg0, arg1, arg2) {
1794
+ const ret = makeMutClosure(arg0, arg1, 1595, __wbg_adapter_46);
1787
1795
  return ret;
1788
1796
  };
1789
- imports.wbg.__wbindgen_closure_wrapper3706 = function(arg0, arg1, arg2) {
1790
- const ret = makeMutClosure(arg0, arg1, 1591, __wbg_adapter_46);
1797
+ imports.wbg.__wbindgen_closure_wrapper3709 = function(arg0, arg1, arg2) {
1798
+ const ret = makeMutClosure(arg0, arg1, 1595, __wbg_adapter_46);
1791
1799
  return ret;
1792
1800
  };
1793
1801
  imports.wbg.__wbindgen_closure_wrapper4549 = function(arg0, arg1, arg2) {
1794
- const ret = makeMutClosure(arg0, arg1, 1944, __wbg_adapter_55);
1802
+ const ret = makeMutClosure(arg0, arg1, 1947, __wbg_adapter_55);
1795
1803
  return ret;
1796
1804
  };
1797
1805
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
Binary file
@@ -43,6 +43,7 @@ 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
45
  export const actorcontext_waitForTrackedShutdownWork: (a: number) => any;
46
+ export const actorcontext_waitForTrackedShutdownWorkUnbounded: (a: number) => any;
46
47
  export const actorcontext_waitUntil: (a: number, b: any) => void;
47
48
  export const actorfactory_new: (a: any, b: any) => [number, number, number];
48
49
  export const awaitPromise: (a: any) => any;
@@ -101,8 +102,8 @@ export const websockethandle_setEventCallback: (a: number, b: any) => void;
101
102
  export const start: () => void;
102
103
  export const actorcontext_queue: (a: number) => number;
103
104
  export const actorcontext_schedule: (a: number) => number;
104
- export const __wbg_schedule_free: (a: number, b: number) => void;
105
105
  export const __wbg_queue_free: (a: number, b: number) => void;
106
+ export const __wbg_schedule_free: (a: number, b: number) => void;
106
107
  export const __wbindgen_malloc: (a: number, b: number) => number;
107
108
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
108
109
  export const __wbindgen_exn_store: (a: number) => void;
@@ -111,7 +112,7 @@ export const __wbindgen_export_4: WebAssembly.Table;
111
112
  export const __wbindgen_free: (a: number, b: number, c: number) => void;
112
113
  export const __wbindgen_export_6: WebAssembly.Table;
113
114
  export const __externref_table_dealloc: (a: number) => void;
114
- export const closure1590_externref_shim: (a: number, b: number, c: any) => void;
115
- export const closure1943_externref_shim: (a: number, b: number, c: any) => void;
116
- export const closure2166_externref_shim: (a: number, b: number, c: any, d: any) => void;
115
+ export const closure1594_externref_shim: (a: number, b: number, c: any) => void;
116
+ export const closure1946_externref_shim: (a: number, b: number, c: any) => void;
117
+ export const closure2169_externref_shim: (a: number, b: number, c: any, d: any) => void;
117
118
  export const __wbindgen_start: () => void;