@rivetkit/rivetkit-wasm 2.3.0-rc.11 → 2.3.0-rc.13

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.11",
3
+ "version": "2.3.0-rc.13",
4
4
  "description": "WebAssembly bindings for RivetKit core on edge JavaScript runtimes",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -1,9 +1,9 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export function bridgeRivetErrorPrefix(): string;
4
- export function uint8ArrayFromBytes(bytes: Uint8Array): Uint8Array;
5
4
  export function roundTripBytes(bytes: Uint8Array): Uint8Array;
6
5
  export function awaitPromise(promise: Promise<any>): Promise<any>;
6
+ export function uint8ArrayFromBytes(bytes: Uint8Array): Uint8Array;
7
7
  export function start(): void;
8
8
  export class ActorContext {
9
9
  free(): 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 closure1688_externref_shim: (a: number, b: number, c: any) => void;
250
- readonly closure1891_externref_shim: (a: number, b: number, c: any) => void;
251
- readonly closure2114_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
 
@@ -237,17 +237,6 @@ export function bridgeRivetErrorPrefix() {
237
237
  }
238
238
  }
239
239
 
240
- /**
241
- * @param {Uint8Array} bytes
242
- * @returns {Uint8Array}
243
- */
244
- export function uint8ArrayFromBytes(bytes) {
245
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
246
- const len0 = WASM_VECTOR_LEN;
247
- const ret = wasm.uint8ArrayFromBytes(ptr0, len0);
248
- return ret;
249
- }
250
-
251
240
  /**
252
241
  * @param {Uint8Array} bytes
253
242
  * @returns {Uint8Array}
@@ -270,20 +259,31 @@ export function awaitPromise(promise) {
270
259
  return ret;
271
260
  }
272
261
 
262
+ /**
263
+ * @param {Uint8Array} bytes
264
+ * @returns {Uint8Array}
265
+ */
266
+ export function uint8ArrayFromBytes(bytes) {
267
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
268
+ const len0 = WASM_VECTOR_LEN;
269
+ const ret = wasm.uint8ArrayFromBytes(ptr0, len0);
270
+ return ret;
271
+ }
272
+
273
273
  export function start() {
274
274
  wasm.start();
275
275
  }
276
276
 
277
277
  function __wbg_adapter_46(arg0, arg1, arg2) {
278
- wasm.closure1688_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.closure1891_externref_shim(arg0, arg1, arg2);
282
+ wasm.closure1950_externref_shim(arg0, arg1, arg2);
283
283
  }
284
284
 
285
- function __wbg_adapter_267(arg0, arg1, arg2, arg3) {
286
- wasm.closure2114_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
  */
@@ -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_267(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_wrapper3860 = function(arg0, arg1, arg2) {
1778
- const ret = makeMutClosure(arg0, arg1, 1689, __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_wrapper3862 = function(arg0, arg1, arg2) {
1782
- const ret = makeMutClosure(arg0, arg1, 1689, __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_wrapper3864 = function(arg0, arg1, arg2) {
1786
- const ret = makeMutClosure(arg0, arg1, 1689, __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_wrapper3866 = function(arg0, arg1, arg2) {
1790
- const ret = makeMutClosure(arg0, arg1, 1689, __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_wrapper4463 = function(arg0, arg1, arg2) {
1794
- const ret = makeMutClosure(arg0, arg1, 1892, __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;
@@ -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 closure1688_externref_shim: (a: number, b: number, c: any) => void;
115
- export const closure1891_externref_shim: (a: number, b: number, c: any) => void;
116
- export const closure2114_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;