@rivetkit/rivetkit-wasm 2.3.0-rc.8 → 2.3.0

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.8",
3
+ "version": "2.3.0",
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 roundTripBytes(bytes: Uint8Array): Uint8Array;
4
3
  export function uint8ArrayFromBytes(bytes: Uint8Array): Uint8Array;
5
4
  export function bridgeRivetErrorPrefix(): string;
6
- export function start(): void;
7
5
  export function awaitPromise(promise: Promise<any>): Promise<any>;
6
+ export function roundTripBytes(bytes: Uint8Array): Uint8Array;
7
+ export function start(): void;
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;
@@ -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 closure1594_externref_shim: (a: number, b: number, c: any) => void;
250
- readonly closure1964_externref_shim: (a: number, b: number, c: any) => void;
251
- readonly closure2187_externref_shim: (a: number, b: number, c: any, d: any) => void;
251
+ readonly closure1598_externref_shim: (a: number, b: number, c: any) => void;
252
+ readonly closure1950_externref_shim: (a: number, b: number, c: any) => void;
253
+ readonly closure2181_externref_shim: (a: number, b: number, c: any, d: any) => void;
252
254
  readonly __wbindgen_start: () => void;
253
255
  }
254
256
 
@@ -221,19 +221,6 @@ function _assertClass(instance, klass) {
221
221
  throw new Error(`expected instance of ${klass.name}`);
222
222
  }
223
223
  }
224
- /**
225
- * @param {Uint8Array} bytes
226
- * @returns {Uint8Array}
227
- */
228
- export function roundTripBytes(bytes) {
229
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
230
- const len0 = WASM_VECTOR_LEN;
231
- const ret = wasm.roundTripBytes(ptr0, len0);
232
- var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
233
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
234
- return v2;
235
- }
236
-
237
224
  /**
238
225
  * @param {Uint8Array} bytes
239
226
  * @returns {Uint8Array}
@@ -261,10 +248,6 @@ export function bridgeRivetErrorPrefix() {
261
248
  }
262
249
  }
263
250
 
264
- export function start() {
265
- wasm.start();
266
- }
267
-
268
251
  /**
269
252
  * @param {Promise<any>} promise
270
253
  * @returns {Promise<any>}
@@ -274,16 +257,33 @@ export function awaitPromise(promise) {
274
257
  return ret;
275
258
  }
276
259
 
260
+ /**
261
+ * @param {Uint8Array} bytes
262
+ * @returns {Uint8Array}
263
+ */
264
+ export function roundTripBytes(bytes) {
265
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
266
+ const len0 = WASM_VECTOR_LEN;
267
+ const ret = wasm.roundTripBytes(ptr0, len0);
268
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
269
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
270
+ return v2;
271
+ }
272
+
273
+ export function start() {
274
+ wasm.start();
275
+ }
276
+
277
277
  function __wbg_adapter_46(arg0, arg1, arg2) {
278
- wasm.closure1594_externref_shim(arg0, arg1, arg2);
278
+ wasm.closure1598_externref_shim(arg0, arg1, arg2);
279
279
  }
280
280
 
281
281
  function __wbg_adapter_55(arg0, arg1, arg2) {
282
- wasm.closure1964_externref_shim(arg0, arg1, arg2);
282
+ wasm.closure1950_externref_shim(arg0, arg1, arg2);
283
283
  }
284
284
 
285
- function __wbg_adapter_225(arg0, arg1, arg2, arg3) {
286
- wasm.closure2187_externref_shim(arg0, arg1, arg2, arg3);
285
+ function __wbg_adapter_268(arg0, arg1, arg2, arg3) {
286
+ wasm.closure2181_externref_shim(arg0, arg1, arg2, arg3);
287
287
  }
288
288
 
289
289
  const __wbindgen_enum_BinaryType = ["blob", "arraybuffer"];
@@ -490,6 +490,13 @@ export class ActorContext {
490
490
  const ret = wasm.actorcontext_sql(this.__wbg_ptr);
491
491
  return SqliteDb.__wrap(ret);
492
492
  }
493
+ /**
494
+ * @returns {Promise<void>}
495
+ */
496
+ waitForTrackedShutdownWorkUnbounded() {
497
+ const ret = wasm.actorcontext_waitForTrackedShutdownWorkUnbounded(this.__wbg_ptr);
498
+ return ret;
499
+ }
493
500
  /**
494
501
  * @returns {string}
495
502
  */
@@ -1448,7 +1455,7 @@ function __wbg_get_imports() {
1448
1455
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
1449
1456
  }
1450
1457
  };
1451
- imports.wbg.__wbg_getRandomValues_38097e921c2494c3 = function() { return handleError(function (arg0, arg1) {
1458
+ imports.wbg.__wbg_getRandomValues_6c498bf966d88108 = function() { return handleError(function (arg0, arg1) {
1452
1459
  globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
1453
1460
  }, arguments) };
1454
1461
  imports.wbg.__wbg_getRandomValues_b8f5dbd5f3995a9e = function() { return handleError(function (arg0, arg1) {
@@ -1562,7 +1569,7 @@ function __wbg_get_imports() {
1562
1569
  const a = state0.a;
1563
1570
  state0.a = 0;
1564
1571
  try {
1565
- return __wbg_adapter_225(a, state0.b, arg0, arg1);
1572
+ return __wbg_adapter_268(a, state0.b, arg0, arg1);
1566
1573
  } finally {
1567
1574
  state0.a = a;
1568
1575
  }
@@ -1774,24 +1781,24 @@ function __wbg_get_imports() {
1774
1781
  const ret = false;
1775
1782
  return ret;
1776
1783
  };
1777
- imports.wbg.__wbindgen_closure_wrapper3733 = function(arg0, arg1, arg2) {
1778
- const ret = makeMutClosure(arg0, arg1, 1595, __wbg_adapter_46);
1784
+ imports.wbg.__wbindgen_closure_wrapper3727 = function(arg0, arg1, arg2) {
1785
+ const ret = makeMutClosure(arg0, arg1, 1599, __wbg_adapter_46);
1779
1786
  return ret;
1780
1787
  };
1781
- imports.wbg.__wbindgen_closure_wrapper3735 = function(arg0, arg1, arg2) {
1782
- const ret = makeMutClosure(arg0, arg1, 1595, __wbg_adapter_46);
1788
+ imports.wbg.__wbindgen_closure_wrapper3729 = function(arg0, arg1, arg2) {
1789
+ const ret = makeMutClosure(arg0, arg1, 1599, __wbg_adapter_46);
1783
1790
  return ret;
1784
1791
  };
1785
- imports.wbg.__wbindgen_closure_wrapper3737 = function(arg0, arg1, arg2) {
1786
- const ret = makeMutClosure(arg0, arg1, 1595, __wbg_adapter_46);
1792
+ imports.wbg.__wbindgen_closure_wrapper3731 = function(arg0, arg1, arg2) {
1793
+ const ret = makeMutClosure(arg0, arg1, 1599, __wbg_adapter_46);
1787
1794
  return ret;
1788
1795
  };
1789
- imports.wbg.__wbindgen_closure_wrapper3739 = function(arg0, arg1, arg2) {
1790
- const ret = makeMutClosure(arg0, arg1, 1595, __wbg_adapter_46);
1796
+ imports.wbg.__wbindgen_closure_wrapper3733 = function(arg0, arg1, arg2) {
1797
+ const ret = makeMutClosure(arg0, arg1, 1599, __wbg_adapter_46);
1791
1798
  return ret;
1792
1799
  };
1793
- imports.wbg.__wbindgen_closure_wrapper4684 = function(arg0, arg1, arg2) {
1794
- const ret = makeMutClosure(arg0, arg1, 1965, __wbg_adapter_55);
1800
+ imports.wbg.__wbindgen_closure_wrapper4574 = function(arg0, arg1, arg2) {
1801
+ const ret = makeMutClosure(arg0, arg1, 1951, __wbg_adapter_55);
1795
1802
  return ret;
1796
1803
  };
1797
1804
  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;
@@ -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 closure1594_externref_shim: (a: number, b: number, c: any) => void;
115
- export const closure1964_externref_shim: (a: number, b: number, c: any) => void;
116
- export const closure2187_externref_shim: (a: number, b: number, c: any, d: any) => void;
115
+ export const closure1598_externref_shim: (a: number, b: number, c: any) => void;
116
+ export const closure1950_externref_shim: (a: number, b: number, c: any) => void;
117
+ export const closure2181_externref_shim: (a: number, b: number, c: any, d: any) => void;
117
118
  export const __wbindgen_start: () => void;