@rivetkit/rivetkit-wasm 0.0.0-pr.4860.b5fe23b → 0.0.0-pr.4880.b43a278

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,83 +1,2 @@
1
- export interface ServeConfig {
2
- version: number;
3
- endpoint: string;
4
- token?: string;
5
- namespace: string;
6
- poolName: string;
7
- engineBinaryPath?: string;
8
- handleInspectorHttpInRuntime?: boolean;
9
- serverlessBasePath?: string;
10
- serverlessPackageVersion: string;
11
- serverlessClientEndpoint?: string;
12
- serverlessClientNamespace?: string;
13
- serverlessClientToken?: string;
14
- serverlessValidateEndpoint: boolean;
15
- serverlessMaxStartPayloadBytes: number;
16
- }
17
-
18
- export interface ActorConfig {
19
- name?: string;
20
- icon?: string;
21
- hasDatabase?: boolean;
22
- remoteSqlite?: boolean;
23
- hasState?: boolean;
24
- canHibernateWebsocket?: boolean;
25
- stateSaveIntervalMs?: number;
26
- createStateTimeoutMs?: number;
27
- onCreateTimeoutMs?: number;
28
- createVarsTimeoutMs?: number;
29
- createConnStateTimeoutMs?: number;
30
- onBeforeConnectTimeoutMs?: number;
31
- onConnectTimeoutMs?: number;
32
- onMigrateTimeoutMs?: number;
33
- onWakeTimeoutMs?: number;
34
- onBeforeActorStartTimeoutMs?: number;
35
- actionTimeoutMs?: number;
36
- onRequestTimeoutMs?: number;
37
- sleepTimeoutMs?: number;
38
- noSleep?: boolean;
39
- sleepGracePeriodMs?: number;
40
- connectionLivenessTimeoutMs?: number;
41
- connectionLivenessIntervalMs?: number;
42
- maxQueueSize?: number;
43
- maxQueueMessageSize?: number;
44
- maxIncomingMessageSize?: number;
45
- maxOutgoingMessageSize?: number;
46
- preloadMaxWorkflowBytes?: number;
47
- preloadMaxConnectionsBytes?: number;
48
- actions?: Array<{ name: string }>;
49
- }
50
-
51
- export class CoreRegistry {
52
- constructor();
53
- register(name: string, factory: ActorFactory): void;
54
- serve(config: ServeConfig): Promise<void>;
55
- shutdown(): Promise<void>;
56
- }
57
-
58
- export class ActorFactory {
59
- constructor(callbacks: unknown, config?: ActorConfig | null);
60
- }
61
-
62
- export class CancellationToken {
63
- constructor();
64
- aborted(): boolean;
65
- cancel(): void;
66
- onCancelled(callback: () => void): void;
67
- }
68
-
69
- export class ActorContext {
70
- constructor();
71
- }
72
-
73
- export class ConnHandle {}
74
-
75
- export class WebSocketHandle {}
76
-
77
- export function bridgeRivetErrorPrefix(): string;
78
- export function roundTripBytes(bytes: Uint8Array): Uint8Array;
79
- export function uint8ArrayFromBytes(bytes: Uint8Array): Uint8Array;
80
- export function awaitPromise<T>(promise: Promise<T>): Promise<T>;
81
-
82
- declare const init: (input?: RequestInfo | URL | Response | BufferSource | WebAssembly.Module) => Promise<void>;
83
- export default init;
1
+ export * from "./pkg/rivetkit_wasm.js";
2
+ export { default } from "./pkg/rivetkit_wasm.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rivetkit/rivetkit-wasm",
3
- "version": "0.0.0-pr.4860.b5fe23b",
3
+ "version": "0.0.0-pr.4880.b43a278",
4
4
  "description": "WebAssembly bindings for RivetKit core on edge JavaScript runtimes",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -10,21 +10,30 @@
10
10
  ".": {
11
11
  "types": "./index.d.ts",
12
12
  "default": "./index.js"
13
+ },
14
+ "./rivetkit_wasm_bg.wasm": {
15
+ "default": "./pkg/rivetkit_wasm_bg.wasm"
13
16
  }
14
17
  },
15
18
  "files": [
16
19
  "index.js",
17
20
  "index.d.ts",
18
- "pkg/**/*",
21
+ "pkg/rivetkit_wasm.js",
22
+ "pkg/rivetkit_wasm.d.ts",
23
+ "pkg/rivetkit_wasm_bg.wasm",
24
+ "pkg/rivetkit_wasm_bg.wasm.d.ts",
19
25
  "package.json",
20
- "scripts/build.mjs"
26
+ "scripts/build.mjs",
27
+ "scripts/check-package.mjs"
21
28
  ],
22
29
  "scripts": {
23
30
  "build": "node scripts/build.mjs",
24
31
  "build:cloudflare": "node scripts/build.mjs --target bundler --out-dir pkg-cloudflare",
25
32
  "build:deno": "node scripts/build.mjs --target web --out-dir pkg-deno",
33
+ "check:package": "node scripts/check-package.mjs",
26
34
  "check-types": "tsc --noEmit",
27
- "check:wasm": "cargo check -p rivetkit-wasm --target wasm32-unknown-unknown"
35
+ "check:wasm": "cargo check -p rivetkit-wasm --target wasm32-unknown-unknown",
36
+ "prepack": "node scripts/build.mjs"
28
37
  },
29
38
  "devDependencies": {
30
39
  "typescript": "^5.9.2"
@@ -1,10 +1,10 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export function start(): void;
4
- export function awaitPromise(promise: Promise<any>): Promise<any>;
4
+ export function uint8ArrayFromBytes(bytes: Uint8Array): Uint8Array;
5
5
  export function roundTripBytes(bytes: Uint8Array): Uint8Array;
6
+ export function awaitPromise(promise: Promise<any>): Promise<any>;
6
7
  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>): Promise<any>;
@@ -65,6 +65,7 @@ export class ConnHandle {
65
65
  }
66
66
  export class CoreRegistry {
67
67
  free(): void;
68
+ handleServerlessRequest(req: any, on_stream_event: Function, cancel_token: CancellationToken, config: any): Promise<any>;
68
69
  constructor();
69
70
  serve(config: any): Promise<void>;
70
71
  register(name: string, factory: ActorFactory): void;
@@ -186,6 +187,7 @@ export interface InitOutput {
186
187
  readonly connhandle_send: (a: number, b: number, c: number, d: number, e: number) => void;
187
188
  readonly connhandle_setState: (a: number, b: number, c: number) => void;
188
189
  readonly connhandle_state: (a: number) => [number, number];
190
+ readonly coreregistry_handleServerlessRequest: (a: number, b: any, c: any, d: number, e: any) => any;
189
191
  readonly coreregistry_new: () => number;
190
192
  readonly coreregistry_register: (a: number, b: number, c: number, d: number) => [number, number];
191
193
  readonly coreregistry_serve: (a: number, b: any) => any;
@@ -240,9 +242,9 @@ export interface InitOutput {
240
242
  readonly __wbindgen_free: (a: number, b: number, c: number) => void;
241
243
  readonly __wbindgen_export_6: WebAssembly.Table;
242
244
  readonly __externref_table_dealloc: (a: number) => void;
243
- readonly closure1512_externref_shim: (a: number, b: number, c: any) => void;
244
- readonly closure1715_externref_shim: (a: number, b: number, c: any) => void;
245
- readonly closure1934_externref_shim: (a: number, b: number, c: any, d: any) => void;
245
+ readonly closure1552_externref_shim: (a: number, b: number, c: any) => void;
246
+ readonly closure1755_externref_shim: (a: number, b: number, c: any) => void;
247
+ readonly closure1974_externref_shim: (a: number, b: number, c: any, d: any) => void;
246
248
  readonly __wbindgen_start: () => void;
247
249
  }
248
250
 
@@ -227,11 +227,13 @@ export function start() {
227
227
  }
228
228
 
229
229
  /**
230
- * @param {Promise<any>} promise
231
- * @returns {Promise<any>}
230
+ * @param {Uint8Array} bytes
231
+ * @returns {Uint8Array}
232
232
  */
233
- export function awaitPromise(promise) {
234
- const ret = wasm.awaitPromise(promise);
233
+ export function uint8ArrayFromBytes(bytes) {
234
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
235
+ const len0 = WASM_VECTOR_LEN;
236
+ const ret = wasm.uint8ArrayFromBytes(ptr0, len0);
235
237
  return ret;
236
238
  }
237
239
 
@@ -248,6 +250,15 @@ export function roundTripBytes(bytes) {
248
250
  return v2;
249
251
  }
250
252
 
253
+ /**
254
+ * @param {Promise<any>} promise
255
+ * @returns {Promise<any>}
256
+ */
257
+ export function awaitPromise(promise) {
258
+ const ret = wasm.awaitPromise(promise);
259
+ return ret;
260
+ }
261
+
251
262
  /**
252
263
  * @returns {string}
253
264
  */
@@ -264,27 +275,16 @@ export function bridgeRivetErrorPrefix() {
264
275
  }
265
276
  }
266
277
 
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
-
278
278
  function __wbg_adapter_46(arg0, arg1, arg2) {
279
- wasm.closure1512_externref_shim(arg0, arg1, arg2);
279
+ wasm.closure1552_externref_shim(arg0, arg1, arg2);
280
280
  }
281
281
 
282
282
  function __wbg_adapter_55(arg0, arg1, arg2) {
283
- wasm.closure1715_externref_shim(arg0, arg1, arg2);
283
+ wasm.closure1755_externref_shim(arg0, arg1, arg2);
284
284
  }
285
285
 
286
- function __wbg_adapter_222(arg0, arg1, arg2, arg3) {
287
- wasm.closure1934_externref_shim(arg0, arg1, arg2, arg3);
286
+ function __wbg_adapter_223(arg0, arg1, arg2, arg3) {
287
+ wasm.closure1974_externref_shim(arg0, arg1, arg2, arg3);
288
288
  }
289
289
 
290
290
  const __wbindgen_enum_BinaryType = ["blob", "arraybuffer"];
@@ -768,6 +768,18 @@ export class CoreRegistry {
768
768
  const ptr = this.__destroy_into_raw();
769
769
  wasm.__wbg_coreregistry_free(ptr, 0);
770
770
  }
771
+ /**
772
+ * @param {any} req
773
+ * @param {Function} on_stream_event
774
+ * @param {CancellationToken} cancel_token
775
+ * @param {any} config
776
+ * @returns {Promise<any>}
777
+ */
778
+ handleServerlessRequest(req, on_stream_event, cancel_token, config) {
779
+ _assertClass(cancel_token, CancellationToken);
780
+ const ret = wasm.coreregistry_handleServerlessRequest(this.__wbg_ptr, req, on_stream_event, cancel_token.__wbg_ptr, config);
781
+ return ret;
782
+ }
771
783
  constructor() {
772
784
  const ret = wasm.coreregistry_new();
773
785
  this.__wbg_ptr = ret >>> 0;
@@ -1369,6 +1381,10 @@ function __wbg_get_imports() {
1369
1381
  const ret = ActorContext.__wrap(arg0);
1370
1382
  return ret;
1371
1383
  };
1384
+ imports.wbg.__wbg_buffer_09165b52af8c5237 = function(arg0) {
1385
+ const ret = arg0.buffer;
1386
+ return ret;
1387
+ };
1372
1388
  imports.wbg.__wbg_buffer_609cc3eee51ed158 = function(arg0) {
1373
1389
  const ret = arg0.buffer;
1374
1390
  return ret;
@@ -1540,7 +1556,7 @@ function __wbg_get_imports() {
1540
1556
  const a = state0.a;
1541
1557
  state0.a = 0;
1542
1558
  try {
1543
- return __wbg_adapter_222(a, state0.b, arg0, arg1);
1559
+ return __wbg_adapter_223(a, state0.b, arg0, arg1);
1544
1560
  } finally {
1545
1561
  state0.a = a;
1546
1562
  }
@@ -1652,8 +1668,8 @@ function __wbg_get_imports() {
1652
1668
  const ret = Promise.resolve(arg0);
1653
1669
  return ret;
1654
1670
  };
1655
- imports.wbg.__wbg_send_fc0c204e8a1757f4 = function() { return handleError(function (arg0, arg1, arg2) {
1656
- arg0.send(getArrayU8FromWasm0(arg1, arg2));
1671
+ imports.wbg.__wbg_send_7c4769e24cf1d784 = function() { return handleError(function (arg0, arg1) {
1672
+ arg0.send(arg1);
1657
1673
  }, arguments) };
1658
1674
  imports.wbg.__wbg_set_37837023f3d740e8 = function(arg0, arg1, arg2) {
1659
1675
  arg0[arg1 >>> 0] = arg2;
@@ -1752,24 +1768,24 @@ function __wbg_get_imports() {
1752
1768
  const ret = false;
1753
1769
  return ret;
1754
1770
  };
1755
- imports.wbg.__wbindgen_closure_wrapper3452 = function(arg0, arg1, arg2) {
1756
- const ret = makeMutClosure(arg0, arg1, 1513, __wbg_adapter_46);
1771
+ imports.wbg.__wbindgen_closure_wrapper3601 = function(arg0, arg1, arg2) {
1772
+ const ret = makeMutClosure(arg0, arg1, 1553, __wbg_adapter_46);
1757
1773
  return ret;
1758
1774
  };
1759
- imports.wbg.__wbindgen_closure_wrapper3454 = function(arg0, arg1, arg2) {
1760
- const ret = makeMutClosure(arg0, arg1, 1513, __wbg_adapter_46);
1775
+ imports.wbg.__wbindgen_closure_wrapper3603 = function(arg0, arg1, arg2) {
1776
+ const ret = makeMutClosure(arg0, arg1, 1553, __wbg_adapter_46);
1761
1777
  return ret;
1762
1778
  };
1763
- imports.wbg.__wbindgen_closure_wrapper3456 = function(arg0, arg1, arg2) {
1764
- const ret = makeMutClosure(arg0, arg1, 1513, __wbg_adapter_46);
1779
+ imports.wbg.__wbindgen_closure_wrapper3605 = function(arg0, arg1, arg2) {
1780
+ const ret = makeMutClosure(arg0, arg1, 1553, __wbg_adapter_46);
1765
1781
  return ret;
1766
1782
  };
1767
- imports.wbg.__wbindgen_closure_wrapper3458 = function(arg0, arg1, arg2) {
1768
- const ret = makeMutClosure(arg0, arg1, 1513, __wbg_adapter_46);
1783
+ imports.wbg.__wbindgen_closure_wrapper3607 = function(arg0, arg1, arg2) {
1784
+ const ret = makeMutClosure(arg0, arg1, 1553, __wbg_adapter_46);
1769
1785
  return ret;
1770
1786
  };
1771
- imports.wbg.__wbindgen_closure_wrapper4051 = function(arg0, arg1, arg2) {
1772
- const ret = makeMutClosure(arg0, arg1, 1716, __wbg_adapter_55);
1787
+ imports.wbg.__wbindgen_closure_wrapper4200 = function(arg0, arg1, arg2) {
1788
+ const ret = makeMutClosure(arg0, arg1, 1756, __wbg_adapter_55);
1773
1789
  return ret;
1774
1790
  };
1775
1791
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
Binary file
@@ -54,6 +54,7 @@ export const connhandle_params: (a: number) => [number, number];
54
54
  export const connhandle_send: (a: number, b: number, c: number, d: number, e: number) => void;
55
55
  export const connhandle_setState: (a: number, b: number, c: number) => void;
56
56
  export const connhandle_state: (a: number) => [number, number];
57
+ export const coreregistry_handleServerlessRequest: (a: number, b: any, c: any, d: number, e: any) => any;
57
58
  export const coreregistry_new: () => number;
58
59
  export const coreregistry_register: (a: number, b: number, c: number, d: number) => [number, number];
59
60
  export const coreregistry_serve: (a: number, b: any) => any;
@@ -108,7 +109,7 @@ export const __wbindgen_export_4: WebAssembly.Table;
108
109
  export const __wbindgen_free: (a: number, b: number, c: number) => void;
109
110
  export const __wbindgen_export_6: WebAssembly.Table;
110
111
  export const __externref_table_dealloc: (a: number) => void;
111
- export const closure1512_externref_shim: (a: number, b: number, c: any) => void;
112
- export const closure1715_externref_shim: (a: number, b: number, c: any) => void;
113
- export const closure1934_externref_shim: (a: number, b: number, c: any, d: any) => void;
112
+ export const closure1552_externref_shim: (a: number, b: number, c: any) => void;
113
+ export const closure1755_externref_shim: (a: number, b: number, c: any) => void;
114
+ export const closure1974_externref_shim: (a: number, b: number, c: any, d: any) => void;
114
115
  export const __wbindgen_start: () => void;
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env node
2
+ import { execFileSync } from "node:child_process";
3
+
4
+ const requiredFiles = new Set([
5
+ "index.js",
6
+ "index.d.ts",
7
+ "pkg/rivetkit_wasm.js",
8
+ "pkg/rivetkit_wasm.d.ts",
9
+ "pkg/rivetkit_wasm_bg.wasm",
10
+ "pkg/rivetkit_wasm_bg.wasm.d.ts",
11
+ "package.json",
12
+ ]);
13
+
14
+ const output = execFileSync(
15
+ "npm",
16
+ ["pack", "--json", "--dry-run", "--ignore-scripts"],
17
+ {
18
+ encoding: "utf8",
19
+ stdio: ["ignore", "pipe", "pipe"],
20
+ },
21
+ );
22
+ const [pack] = JSON.parse(output);
23
+ const publishedFiles = new Set(
24
+ pack.files.map((file) => file.path.replace(/\\/g, "/")),
25
+ );
26
+ const missingFiles = [...requiredFiles].filter((file) => !publishedFiles.has(file));
27
+
28
+ if (missingFiles.length > 0) {
29
+ throw new Error(
30
+ `@rivetkit/rivetkit-wasm package is missing required files: ${missingFiles.join(", ")}`,
31
+ );
32
+ }
package/pkg/package.json DELETED
@@ -1,19 +0,0 @@
1
- {
2
- "name": "rivetkit-wasm",
3
- "type": "module",
4
- "collaborators": [
5
- "Rivet Gaming, LLC <developer@rivet.gg>"
6
- ],
7
- "version": "2.3.0-rc.4",
8
- "license": "Apache-2.0",
9
- "files": [
10
- "rivetkit_wasm_bg.wasm",
11
- "rivetkit_wasm.js",
12
- "rivetkit_wasm.d.ts"
13
- ],
14
- "main": "rivetkit_wasm.js",
15
- "types": "rivetkit_wasm.d.ts",
16
- "sideEffects": [
17
- "./snippets/*"
18
- ]
19
- }