libfw-client 0.2.4 → 0.3.1

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/README.md CHANGED
@@ -9,13 +9,12 @@ WASM engine, the File System Access API and IndexedDB.
9
9
  import { LibfwClient } from 'libfw-client';
10
10
 
11
11
  const client = new LibfwClient({
12
- baseUrl: '/', // server origin; the engine derives ws(s)://host/ws
13
- // from it (or set wsUrl explicitly)
14
- concurrency: 4, // max parallel file transfers (one WS connection each)
15
- uploadWindow: 8, // in-flight blocks per single file upload (raise to
12
+ baseUrl: '/', // server origin (same-origin when empty)
13
+ concurrency: 4, // max parallel file transfers (independent HTTP streams)
14
+ uploadWindow: 8, // in-flight chunks per single file upload (raise to
16
15
  // reduce upload stutter on high-latency links)
17
- downloadWindow: 4, // in-flight blocks per single file download (raise to
18
- // reduce download stutter on high-latency links)
16
+ downloadWindow: 4, // parallel byte-range GETs per single file download
17
+ // (raise to reduce download stutter on high-latency links)
19
18
  compress: true, // zrip per-block compression
20
19
  onEvent: (e) => console.log(e), // { type: 'progress', done, total }
21
20
  });
@@ -40,29 +39,32 @@ client.cancel();
40
39
 
41
40
  ## How it works
42
41
 
43
- - **One WebSocket per transfer** — the engine talks to the server over
44
- `ws(s)://…/ws` for **all** control commands (handshake, directory listing,
45
- metadata) and data. Upload and download use the **same** block protocol:
46
- the sender pipelines fixed-size blocks with **no per-block ack** (they may
47
- travel out of order), and the receiver **verifies every block in real time**
48
- (CRC32 + length + bounds), marks bad blocks (`NAK`) and asks the sender to
49
- re-add them to its transfer queue; a wave boundary reconciles until every
50
- block is verified. `downloadWindow`/`uploadWindow` bound the in-flight
51
- blocks per wave (raise them on high-latency links).
52
- - `downloadFolder(token, dirPath?)` / `downloadFile(token, filePath)` the
53
- engine lists (for folders) and downloads each file as a receiver, reorders
54
- out-of-order blocks in memory and pushes `Uint8Array` chunks to the SDK
55
- strictly in order (append-mode `createWritable()`, no `.crswap` churn).
56
- With the File System Access API the SDK streams them to disk via
57
- `fileHandle.createWritable()`; without it (or with `downloadMode: 'browser'`)
58
- the SDK buffers the chunks and saves the result through a traditional
59
- browser download — a single file as-is, a folder packed into a `.zip`.
60
- - `upload(token, files?)` — the engine slices each file into fixed-size
61
- blocks, reads them via `readFile`, compresses each block into one zstd
62
- frame, and sends them over the WebSocket as the sender. Only the blocks the
63
- server still misses are sent (`READY.received` seeds resume), so a
64
- high-latency link stays saturated and interrupted uploads resume
65
- BitTorrent-style (only the broken/lost parts are re-transmitted).
42
+ - **HTTP transport, not WebSocket** — the engine drives all control commands
43
+ (directory listing, metadata) and data over plain HTTP. This is what keeps
44
+ transfers robust on lossy/unstable links: each transfer uses **independent
45
+ parallel HTTP streams**, so a lost packet stalls only that one stream
46
+ (which retries just its own bytes) instead of blocking a whole multiplexed
47
+ WebSocket connection.
48
+ - **Downloads** `downloadFolder(token, dirPath?)` / `downloadFile(token,
49
+ filePath)` list the tree (for folders) and fetch each large file as
50
+ `downloadWindow` concurrent `Range` GETs (tus-style parallel transfer, one
51
+ independent connection per range). Each chunk is retried independently
52
+ (only the lost part is re-fetched); the engine reorders the chunks in
53
+ memory and pushes `Uint8Array`s to the SDK **strictly in order**.
54
+ `Range`/`If-Range`/`416` give natural resume against the server ETag (the
55
+ server is the source of truth). With the File System Access API the SDK
56
+ streams chunks to disk via `fileHandle.createWritable()`; without it (or
57
+ with `downloadMode: 'browser'`) it buffers the chunks and saves the result
58
+ through a traditional browser download — a single file as-is, a folder
59
+ packed into a `.zip`.
60
+ - **Uploads** `upload(token, files?)` slices each file into chunks, reads
61
+ them via `readFile`, compresses each into one zstd frame and POSTs the
62
+ missing chunks concurrently (out of order) with `x-libfw-offset` into a
63
+ shared per-session temp on the server (positional writes). A final
64
+ `x-libfw-final` commit validates the size and atomically renames the temp
65
+ into place. Only the chunks the server still misses are re-sent
66
+ (`x-libfw-session-status` probe seeds resume), so interrupted uploads
67
+ resume BitTorrent-style (only the broken/lost parts are re-transmitted).
66
68
  - Resume state (`etag`, `offset`, `size`) is persisted per path in
67
69
  IndexedDB and re-validated on every retry.
68
70
  - Pause/resume/cancel drive the WASM state machine
@@ -91,16 +93,13 @@ dist/libfw-client.umd.js UMD bundle (after build:umd)
91
93
  ## API
92
94
 
93
95
  - `new LibfwClient(options?)`
94
- - `downloadWindow: number` (default `4`) — in-flight blocks per single file
95
- download (how many blocks the server pipelines per wave before a
96
- reconciliation round); raise it on high-latency links.
97
- - `downloadChunkSize: number` (default `262144`, 256 KiB) — block size for
98
- downloads; the engine reorders out-of-order blocks in memory (worst case
99
- ≈ `downloadWindow * downloadChunkSize` bytes) so the SDK still receives
100
- data in order.
101
- - `wsUrl: string` — explicit WebSocket endpoint (`wss://host/ws`); when
102
- omitted it is derived from `baseUrl` (`http://h:8080` → `ws://h:8080/ws`,
103
- same-origin when empty).
96
+ - `downloadWindow: number` (default `4`) — in-flight byte-range window per
97
+ single file download (how many concurrent `Range` GETs); raise it on
98
+ high-latency links. `1` disables parallelism (sequential downloads).
99
+ - `downloadChunkSize: number` (default `262144`, 256 KiB) — byte range size
100
+ for parallel downloads; the engine reorders in-flight chunks in memory
101
+ (worst case ≈ `downloadWindow * downloadChunkSize` bytes) so the SDK
102
+ still receives data in order.
104
103
  - `downloadMode: 'auto' | 'fs' | 'browser'` (default `'auto'`) — `'fs'`
105
104
  streams downloads through the File System Access API; `'browser'` buffers
106
105
  and triggers a traditional browser download (folders become `.zip`);
package/index.d.ts CHANGED
@@ -51,39 +51,39 @@ export interface LibfwEvent {
51
51
  /** Options accepted by the {@link LibfwClient} constructor. */
52
52
  export interface LibfwClientOptions {
53
53
  /**
54
- * Base URL the libfw server is served from. The engine derives the
55
- * WebSocket endpoint from it (`http://h:8080` `ws://h:8080/ws`);
56
- * same-origin when empty. All control commands and data transfer travel
57
- * over that WebSocket. Default `''`.
54
+ * Base URL the libfw server is served from (same-origin when empty). The
55
+ * engine drives all control commands and data transfer over plain HTTP
56
+ * (parallel `Range` downloads, tus-style chunked uploads) no WebSocket
57
+ * is used. Default `''`.
58
58
  */
59
59
  baseUrl?: string;
60
60
  /** Max concurrently-transferring files. Default `4`. */
61
61
  concurrency?: number;
62
62
  /**
63
- * In-flight block window for a single file's upload, independent of
64
- * `concurrency`. Blocks are pipelined over one WebSocket without per-block
65
- * acknowledgments; this bounds how many are in flight before a
66
- * reconciliation round. A higher value keeps high-latency links saturated.
67
- * Default `8`.
63
+ * In-flight chunk window for a single file's upload, independent of
64
+ * `concurrency`. The missing chunks are POSTed concurrently (out of
65
+ * order) into a shared per-session temp on the server; a higher value
66
+ * keeps high-latency links saturated. Default `8`.
68
67
  */
69
68
  uploadWindow?: number;
70
69
  /**
71
- * In-flight block window for a single file's download. The server
72
- * pipelines up to this many blocks per wave; a higher value keeps
73
- * high-latency links saturated. The engine reorders out-of-order blocks in
74
- * memory (worst case `downloadWindow * downloadChunkSize` bytes) so the
75
- * SDK still receives data strictly in order. Default `4`.
70
+ * In-flight byte-range window for a single file's download. Large files
71
+ * are fetched as `downloadWindow` concurrent `Range` GETs (tus-style
72
+ * parallel transfer), so a single file's throughput is bounded by
73
+ * bandwidth instead of one connection's `chunkSize / RTT`. `1` disables
74
+ * parallelism (sequential downloads). Default `4`.
76
75
  */
77
76
  downloadWindow?: number;
78
77
  /**
79
- * Block size for downloads. The engine reorders in-flight blocks in
80
- * memory (worst case ≈ `downloadWindow * downloadChunkSize` bytes) so the
81
- * SDK still receives data strictly in order. Default `262144` (256 KiB).
78
+ * Byte range size for parallel downloads. The engine reorders in-flight
79
+ * chunks in memory (worst case ≈ `downloadWindow * downloadChunkSize`
80
+ * bytes) so the SDK still receives data strictly in order. Default
81
+ * `262144` (256 KiB).
82
82
  */
83
83
  downloadChunkSize?: number;
84
84
  /** Negotiate zrip compression. Default `true`. */
85
85
  compress?: boolean;
86
- /** Upload block size in bytes. Default 2 MiB. */
86
+ /** Upload chunk size in bytes. Default 2 MiB. */
87
87
  chunkSize?: number;
88
88
  /** Retries per chunk/file before failing. Default `3`. */
89
89
  maxRetries?: number;
@@ -93,11 +93,6 @@ export interface LibfwClientOptions {
93
93
  maxRetryDelayMs?: number;
94
94
  /** Per-read timeout (ms). Default `60000`. */
95
95
  timeoutMs?: number;
96
- /**
97
- * Explicit WebSocket endpoint (e.g. `wss://host/ws`). When omitted it is
98
- * derived from `baseUrl`.
99
- */
100
- wsUrl?: string;
101
96
  /**
102
97
  * Explicit URL of `libfw_client_bg.wasm`. When omitted it is resolved
103
98
  * automatically for both ESM and classic-`<script>`/UMD consumers.
package/index.js CHANGED
@@ -187,15 +187,20 @@ const BUNDLE_SCRIPT_SRC =
187
187
  export class LibfwClient {
188
188
  /**
189
189
  * @param {object} [options]
190
- * @param {string} [options.baseUrl=''] base URL the server is served from. The
191
- * engine derives the WebSocket endpoint from it (e.g. `http://h:8080`
192
- * `ws://h:8080/ws`); same-origin when empty. All control commands
193
- * and data transfer travel over that WebSocket.
194
- * @param {number} [options.concurrency=4] max concurrently-transferring files
195
- * @param {number} [options.uploadWindow=8] in-flight chunk window for a
196
- * single file's upload; independent of `concurrency`, keeps a
197
- * high-latency link saturated (raise it to reduce upload stutter;
198
- * keep within your server's connection limit, ~6 for HTTP/1.1)
190
+ * @param {string} [options.baseUrl=''] base URL the server is served from
191
+ * (same-origin when empty). The engine drives all control commands
192
+ * and data transfer over plain HTTP (parallel `Range` downloads,
193
+ * tus-style chunked uploads) no WebSocket is used.
194
+ * @param {number} [options.concurrency=4] global cap on concurrent
195
+ * in-flight HTTP transfers (files and per-file chunk/range windows
196
+ * combined). Every chunk upload and range download takes a shared
197
+ * permit, so this is what actually bounds the engine's network
198
+ * parallelism set it to your server/browser connection budget
199
+ * (e.g. 1 = strictly one transfer at a time).
200
+ * @param {number} [options.uploadWindow=8] per-file scheduling window for a
201
+ * single file's upload: keeps that file's read/compress pipeline
202
+ * full on high-latency links, but the TOTAL in-flight requests never
203
+ * exceed `concurrency`
199
204
  * @param {number} [options.downloadWindow=4] in-flight byte-range window
200
205
  * for a single file's download. Large files are fetched as
201
206
  * `downloadWindow` concurrent `Range` GETs (tus-style parallel
@@ -209,12 +214,13 @@ export class LibfwClient {
209
214
  * SDK still receives data strictly in order.
210
215
  * @param {boolean} [options.compress=true] negotiate zrip compression
211
216
  * @param {number} [options.chunkSize=2097152] upload chunk size in bytes
217
+ * (each chunk is split into many small ~64 KiB compressed frames, so
218
+ * any value works; larger = fewer, bigger POST requests — bounded
219
+ * only by the server's upload limit and client memory)
212
220
  * @param {number} [options.maxRetries=3] retries per chunk/file before failing
213
221
  * @param {number} [options.baseRetryDelayMs=500] initial backoff (ms)
214
222
  * @param {number} [options.maxRetryDelayMs=30000] backoff ceiling (ms)
215
223
  * @param {number} [options.timeoutMs=60000] per-read timeout (ms)
216
- * @param {string} [options.wsUrl] explicit WebSocket endpoint (e.g.
217
- * `wss://host/ws`); when omitted it is derived from `baseUrl`
218
224
  * @param {string} [options.wasmUrl] explicit URL of `libfw_client_bg.wasm`;
219
225
  * when omitted it is resolved automatically for both ESM and
220
226
  * classic-`<script>`/UMD consumers (see {@link LibfwClient#_wasmUrl})
@@ -245,7 +251,6 @@ export class LibfwClient {
245
251
  baseRetryDelayMs: 500,
246
252
  maxRetryDelayMs: 30000,
247
253
  timeoutMs: 60000,
248
- wsUrl: null,
249
254
  wasmUrl: null,
250
255
  downloadMode: 'auto',
251
256
  maxFallbackBytes: 512 * 1024 * 1024,
@@ -305,7 +310,6 @@ export class LibfwClient {
305
310
  baseRetryDelayMs: this._options.baseRetryDelayMs,
306
311
  maxRetryDelayMs: this._options.maxRetryDelayMs,
307
312
  timeoutMs: this._options.timeoutMs,
308
- wsUrl: this._options.wsUrl,
309
313
  });
310
314
  engine.set_callbacks(this._makeCallbacks());
311
315
  this._engine = engine;
@@ -729,7 +733,20 @@ export class LibfwClient {
729
733
  this._emit({ type: 'fileCompleted', path });
730
734
  return;
731
735
  }
732
- await this._closeWritable(path);
736
+ if (this._writables.has(path)) {
737
+ await this._closeWritable(path);
738
+ } else {
739
+ // No bytes were written this run — either a zero-byte file or a file
740
+ // already fully on disk from a resume. Materialize the target so an
741
+ // empty file still appears on disk. `getFileHandle({ create: true })`
742
+ // only creates a missing file, so an already-complete (resumed) file
743
+ // is never truncated here.
744
+ try {
745
+ await this._ensureFileHandle(path);
746
+ } catch {
747
+ /* best-effort: never fail the transfer on materialization errors */
748
+ }
749
+ }
733
750
  this._emit({ type: 'fileCompleted', path });
734
751
  }
735
752
 
@@ -835,7 +852,13 @@ export class LibfwClient {
835
852
  const offset = Number(state.offset) || 0;
836
853
  if (offset <= 0) return state;
837
854
  const handle = await this._resolveFileHandle(path);
838
- if (!handle) return state; // can't know the on-disk length → trust state
855
+ if (!handle) {
856
+ // No on-disk file to resume from: whatever offset was persisted has
857
+ // nothing behind it. Restart from 0 instead of trusting a stale offset
858
+ // that would make the engine skip the download entirely (producing an
859
+ // empty/missing file while reporting "complete").
860
+ return { ...state, offset: 0, size: 0 };
861
+ }
839
862
  let diskLen = 0;
840
863
  try {
841
864
  diskLen = (await handle.getFile()).size;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "libfw-client",
3
- "version": "0.2.4",
3
+ "version": "0.3.1",
4
4
  "description": "High-performance streaming file & folder transfer SDK for the browser (libfw WASM engine + File System Access API + IndexedDB resume).",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -97,9 +97,7 @@ export interface InitOutput {
97
97
  readonly libfwclient_upload: (a: number, b: number, c: number, d: number, e: number) => any;
98
98
  readonly wasm_bindgen_1e05ddb24c0b7df4___convert__closures_____invoke___wasm_bindgen_1e05ddb24c0b7df4___JsValue__core_9b3796e30d99ddb7___result__Result_____wasm_bindgen_1e05ddb24c0b7df4___JsError___true_: (a: number, b: number, c: any) => [number, number];
99
99
  readonly wasm_bindgen_1e05ddb24c0b7df4___convert__closures_____invoke___js_sys_bb6c79d0abe11c10___Function_fn_wasm_bindgen_1e05ddb24c0b7df4___JsValue_____wasm_bindgen_1e05ddb24c0b7df4___sys__Undefined___js_sys_bb6c79d0abe11c10___Function_fn_wasm_bindgen_1e05ddb24c0b7df4___JsValue_____wasm_bindgen_1e05ddb24c0b7df4___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;
100
- readonly wasm_bindgen_1e05ddb24c0b7df4___convert__closures_____invoke___web_sys_86e1b1c7d411e716___features__gen_CloseEvent__CloseEvent______true_: (a: number, b: number, c: any) => void;
101
- readonly wasm_bindgen_1e05ddb24c0b7df4___convert__closures_____invoke___web_sys_86e1b1c7d411e716___features__gen_CloseEvent__CloseEvent______true__2: (a: number, b: number, c: any) => void;
102
- readonly wasm_bindgen_1e05ddb24c0b7df4___convert__closures_____invoke___web_sys_86e1b1c7d411e716___features__gen_CloseEvent__CloseEvent______true__3: (a: number, b: number, c: any) => void;
100
+ readonly wasm_bindgen_1e05ddb24c0b7df4___convert__closures_____invoke_______true_: (a: number, b: number) => void;
103
101
  readonly __wbindgen_malloc: (a: number, b: number) => number;
104
102
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
105
103
  readonly __wbindgen_exn_store: (a: number) => void;
@@ -227,26 +227,51 @@ function __wbg_get_imports() {
227
227
  __wbg__wbg_cb_unref_fffb441def202758: function(arg0) {
228
228
  arg0._wbg_cb_unref();
229
229
  },
230
+ __wbg_abort_4426bc6bd4153680: function() { return handleError(function (arg0) {
231
+ arg0.abort();
232
+ }, arguments); },
230
233
  __wbg_apply_3ac86a26fdb56c05: function() { return handleError(function (arg0, arg1, arg2) {
231
234
  const ret = arg0.apply(arg1, arg2);
232
235
  return ret;
233
236
  }, arguments); },
234
- __wbg_bufferedAmount_2f95480ad75d4988: function(arg0) {
235
- const ret = arg0.bufferedAmount;
237
+ __wbg_arrayBuffer_3b637f0fa65c5351: function() { return handleError(function (arg0) {
238
+ const ret = arg0.arrayBuffer();
236
239
  return ret;
240
+ }, arguments); },
241
+ __wbg_body_18c9f2ac15ead4b2: function(arg0) {
242
+ const ret = arg0.body;
243
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
237
244
  },
238
245
  __wbg_call_a6e5c5dce5018821: function() { return handleError(function (arg0, arg1, arg2) {
239
246
  const ret = arg0.call(arg1, arg2);
240
247
  return ret;
241
248
  }, arguments); },
242
- __wbg_data_328de4280640da92: function(arg0) {
243
- const ret = arg0.data;
249
+ __wbg_clearInterval_2e2069e95ad09d4f: function(arg0, arg1) {
250
+ arg0.clearInterval(arg1);
251
+ },
252
+ __wbg_encodeURIComponent_d0140ae6e13eb27b: function(arg0, arg1) {
253
+ const ret = encodeURIComponent(getStringFromWasm0(arg0, arg1));
254
+ return ret;
255
+ },
256
+ __wbg_fetch_6ecc661950e58d49: function(arg0, arg1) {
257
+ const ret = arg0.fetch(arg1);
244
258
  return ret;
245
259
  },
246
260
  __wbg_from_13e323c65fc8f464: function(arg0) {
247
261
  const ret = Array.from(arg0);
248
262
  return ret;
249
263
  },
264
+ __wbg_getReader_7455d080fa48369b: function(arg0) {
265
+ const ret = arg0.getReader();
266
+ return ret;
267
+ },
268
+ __wbg_get_18e0163e38e5048d: function() { return handleError(function (arg0, arg1, arg2, arg3) {
269
+ const ret = arg1.get(getStringFromWasm0(arg2, arg3));
270
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
271
+ var len1 = WASM_VECTOR_LEN;
272
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
273
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
274
+ }, arguments); },
250
275
  __wbg_get_78f252d074a84d0b: function() { return handleError(function (arg0, arg1) {
251
276
  const ret = Reflect.get(arg0, arg1);
252
277
  return ret;
@@ -255,13 +280,10 @@ function __wbg_get_imports() {
255
280
  const ret = arg0[arg1 >>> 0];
256
281
  return ret;
257
282
  },
258
- __wbg_host_21c8d54c9bdcd04a: function() { return handleError(function (arg0, arg1) {
259
- const ret = arg1.host;
260
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
261
- const len1 = WASM_VECTOR_LEN;
262
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
263
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
264
- }, arguments); },
283
+ __wbg_headers_cf9c80f30e2a4eff: function(arg0) {
284
+ const ret = arg0.headers;
285
+ return ret;
286
+ },
265
287
  __wbg_instanceof_ArrayBuffer_4480b9e0068a8adb: function(arg0) {
266
288
  let result;
267
289
  try {
@@ -300,14 +322,18 @@ function __wbg_get_imports() {
300
322
  const ret = arg0.length;
301
323
  return ret;
302
324
  },
303
- __wbg_location_c9a2271428996698: function(arg0) {
304
- const ret = arg0.location;
325
+ __wbg_new_0d809930cd1354c6: function() { return handleError(function () {
326
+ const ret = new Headers();
305
327
  return ret;
306
- },
328
+ }, arguments); },
307
329
  __wbg_new_32b398fb48b6d94a: function() {
308
330
  const ret = new Array();
309
331
  return ret;
310
332
  },
333
+ __wbg_new_6b1dd7bed0e5462c: function() { return handleError(function () {
334
+ const ret = new XMLHttpRequest();
335
+ return ret;
336
+ }, arguments); },
311
337
  __wbg_new_aec3e25493d729fe: function(arg0, arg1) {
312
338
  try {
313
339
  var state0 = {a: arg0, b: arg1};
@@ -330,10 +356,6 @@ function __wbg_get_imports() {
330
356
  const ret = new Error(getStringFromWasm0(arg0, arg1));
331
357
  return ret;
332
358
  },
333
- __wbg_new_bf8729ffe10e9ee7: function() { return handleError(function (arg0, arg1) {
334
- const ret = new WebSocket(getStringFromWasm0(arg0, arg1));
335
- return ret;
336
- }, arguments); },
337
359
  __wbg_new_cd45aabdf6073e84: function(arg0) {
338
360
  const ret = new Uint8Array(arg0);
339
361
  return ret;
@@ -364,6 +386,10 @@ function __wbg_get_imports() {
364
386
  state0.a = 0;
365
387
  }
366
388
  },
389
+ __wbg_new_with_str_and_init_d95cbe11ce28e65e: function() { return handleError(function (arg0, arg1, arg2) {
390
+ const ret = new Request(getStringFromWasm0(arg0, arg1), arg2);
391
+ return ret;
392
+ }, arguments); },
367
393
  __wbg_now_86c0d4ba3fa605b8: function() {
368
394
  const ret = Date.now();
369
395
  return ret;
@@ -372,12 +398,8 @@ function __wbg_get_imports() {
372
398
  const ret = Array.of(arg0, arg1);
373
399
  return ret;
374
400
  },
375
- __wbg_protocol_0598aef25eb71eae: function() { return handleError(function (arg0, arg1) {
376
- const ret = arg1.protocol;
377
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
378
- const len1 = WASM_VECTOR_LEN;
379
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
380
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
401
+ __wbg_open_90286a4ce0ae2098: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
402
+ arg0.open(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4), arg5 !== 0);
381
403
  }, arguments); },
382
404
  __wbg_prototypesetcall_4770620bbe4688a0: function(arg0, arg1, arg2) {
383
405
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
@@ -397,12 +419,27 @@ function __wbg_get_imports() {
397
419
  const ret = Promise.race(arg0);
398
420
  return ret;
399
421
  },
422
+ __wbg_read_8afa15f12a160ef8: function(arg0) {
423
+ const ret = arg0.read();
424
+ return ret;
425
+ },
426
+ __wbg_readyState_e916e521239696c1: function(arg0) {
427
+ const ret = arg0.readyState;
428
+ return ret;
429
+ },
400
430
  __wbg_resolve_2191a4dfe481c25b: function(arg0) {
401
431
  const ret = Promise.resolve(arg0);
402
432
  return ret;
403
433
  },
404
- __wbg_send_a321b376d40ec867: function() { return handleError(function (arg0, arg1, arg2) {
405
- arg0.send(getArrayU8FromWasm0(arg1, arg2));
434
+ __wbg_send_4a966e8f532ab09b: function() { return handleError(function (arg0, arg1, arg2) {
435
+ arg0.send(arg1 === 0 ? undefined : getArrayU8FromWasm0(arg1, arg2));
436
+ }, arguments); },
437
+ __wbg_setInterval_93ec7461c3650c76: function() { return handleError(function (arg0, arg1, arg2) {
438
+ const ret = arg0.setInterval(arg1, arg2);
439
+ return ret;
440
+ }, arguments); },
441
+ __wbg_setRequestHeader_fe390ff50d349432: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
442
+ arg0.setRequestHeader(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
406
443
  }, arguments); },
407
444
  __wbg_setTimeout_725a27c387d005c7: function() { return handleError(function (arg0, arg1, arg2, arg3) {
408
445
  const ret = arg0.setTimeout(arg1, arg2, arg3);
@@ -412,24 +449,33 @@ function __wbg_get_imports() {
412
449
  const ret = arg0.setTimeout(arg1, arg2);
413
450
  return ret;
414
451
  }, arguments); },
452
+ __wbg_set_0de9c62c23d04ad5: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
453
+ arg0.set(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
454
+ }, arguments); },
415
455
  __wbg_set_8535240470bf2500: function() { return handleError(function (arg0, arg1, arg2) {
416
456
  const ret = Reflect.set(arg0, arg1, arg2);
417
457
  return ret;
418
458
  }, arguments); },
419
- __wbg_set_binaryType_a37b086c78ca7c29: function(arg0, arg1) {
420
- arg0.binaryType = __wbindgen_enum_BinaryType[arg1];
459
+ __wbg_set_body_029f2d171e0a005f: function(arg0, arg1) {
460
+ arg0.body = arg1;
461
+ },
462
+ __wbg_set_headers_9c61d123c3ee1f10: function(arg0, arg1) {
463
+ arg0.headers = arg1;
464
+ },
465
+ __wbg_set_method_5532d59b92d76467: function(arg0, arg1, arg2) {
466
+ arg0.method = getStringFromWasm0(arg1, arg2);
421
467
  },
422
- __wbg_set_onclose_f706475385ecce07: function(arg0, arg1) {
423
- arg0.onclose = arg1;
468
+ __wbg_set_onabort_549ef96670787286: function(arg0, arg1) {
469
+ arg0.onabort = arg1;
424
470
  },
425
- __wbg_set_onerror_9f5773fd31512333: function(arg0, arg1) {
471
+ __wbg_set_onerror_c810587e53729112: function(arg0, arg1) {
426
472
  arg0.onerror = arg1;
427
473
  },
428
- __wbg_set_onmessage_836d2f72130b4706: function(arg0, arg1) {
429
- arg0.onmessage = arg1;
474
+ __wbg_set_onprogress_ba0113ededd552ae: function(arg0, arg1) {
475
+ arg0.onprogress = arg1;
430
476
  },
431
- __wbg_set_onopen_4f65470ae522a61a: function(arg0, arg1) {
432
- arg0.onopen = arg1;
477
+ __wbg_set_onreadystatechange_14ce44725c7e0789: function(arg0, arg1) {
478
+ arg0.onreadystatechange = arg1;
433
479
  },
434
480
  __wbg_static_accessor_GLOBAL_4ef717fb391d88b7: function() {
435
481
  const ret = typeof global === 'undefined' ? null : global;
@@ -447,6 +493,14 @@ function __wbg_get_imports() {
447
493
  const ret = typeof window === 'undefined' ? null : window;
448
494
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
449
495
  },
496
+ __wbg_status_bab532bcb3b5d775: function() { return handleError(function (arg0) {
497
+ const ret = arg0.status;
498
+ return ret;
499
+ }, arguments); },
500
+ __wbg_status_c45b3b9b3033184a: function(arg0) {
501
+ const ret = arg0.status;
502
+ return ret;
503
+ },
450
504
  __wbg_then_16d107c451e9905d: function(arg0, arg1, arg2) {
451
505
  const ret = arg0.then(arg1, arg2);
452
506
  return ret;
@@ -455,32 +509,26 @@ function __wbg_get_imports() {
455
509
  const ret = arg0.then(arg1);
456
510
  return ret;
457
511
  },
512
+ __wbg_upload_65cdbdfcc901f1b1: function() { return handleError(function (arg0) {
513
+ const ret = arg0.upload;
514
+ return ret;
515
+ }, arguments); },
458
516
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
459
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 151, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
517
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 163, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
460
518
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_1e05ddb24c0b7df4___convert__closures_____invoke___wasm_bindgen_1e05ddb24c0b7df4___JsValue__core_9b3796e30d99ddb7___result__Result_____wasm_bindgen_1e05ddb24c0b7df4___JsError___true_);
461
519
  return ret;
462
520
  },
463
521
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
464
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 4, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
465
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen_1e05ddb24c0b7df4___convert__closures_____invoke___web_sys_86e1b1c7d411e716___features__gen_CloseEvent__CloseEvent______true_);
466
- return ret;
467
- },
468
- __wbindgen_cast_0000000000000003: function(arg0, arg1) {
469
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 4, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
470
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen_1e05ddb24c0b7df4___convert__closures_____invoke___web_sys_86e1b1c7d411e716___features__gen_CloseEvent__CloseEvent______true__2);
471
- return ret;
472
- },
473
- __wbindgen_cast_0000000000000004: function(arg0, arg1) {
474
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 4, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
475
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen_1e05ddb24c0b7df4___convert__closures_____invoke___web_sys_86e1b1c7d411e716___features__gen_CloseEvent__CloseEvent______true__3);
522
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 5, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
523
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_1e05ddb24c0b7df4___convert__closures_____invoke_______true_);
476
524
  return ret;
477
525
  },
478
- __wbindgen_cast_0000000000000005: function(arg0) {
526
+ __wbindgen_cast_0000000000000003: function(arg0) {
479
527
  // Cast intrinsic for `F64 -> Externref`.
480
528
  const ret = arg0;
481
529
  return ret;
482
530
  },
483
- __wbindgen_cast_0000000000000006: function(arg0, arg1) {
531
+ __wbindgen_cast_0000000000000004: function(arg0, arg1) {
484
532
  // Cast intrinsic for `Ref(String) -> Externref`.
485
533
  const ret = getStringFromWasm0(arg0, arg1);
486
534
  return ret;
@@ -501,16 +549,8 @@ function __wbg_get_imports() {
501
549
  };
502
550
  }
503
551
 
504
- function wasm_bindgen_1e05ddb24c0b7df4___convert__closures_____invoke___web_sys_86e1b1c7d411e716___features__gen_CloseEvent__CloseEvent______true_(arg0, arg1, arg2) {
505
- wasm.wasm_bindgen_1e05ddb24c0b7df4___convert__closures_____invoke___web_sys_86e1b1c7d411e716___features__gen_CloseEvent__CloseEvent______true_(arg0, arg1, arg2);
506
- }
507
-
508
- function wasm_bindgen_1e05ddb24c0b7df4___convert__closures_____invoke___web_sys_86e1b1c7d411e716___features__gen_CloseEvent__CloseEvent______true__2(arg0, arg1, arg2) {
509
- wasm.wasm_bindgen_1e05ddb24c0b7df4___convert__closures_____invoke___web_sys_86e1b1c7d411e716___features__gen_CloseEvent__CloseEvent______true__2(arg0, arg1, arg2);
510
- }
511
-
512
- function wasm_bindgen_1e05ddb24c0b7df4___convert__closures_____invoke___web_sys_86e1b1c7d411e716___features__gen_CloseEvent__CloseEvent______true__3(arg0, arg1, arg2) {
513
- wasm.wasm_bindgen_1e05ddb24c0b7df4___convert__closures_____invoke___web_sys_86e1b1c7d411e716___features__gen_CloseEvent__CloseEvent______true__3(arg0, arg1, arg2);
552
+ function wasm_bindgen_1e05ddb24c0b7df4___convert__closures_____invoke_______true_(arg0, arg1) {
553
+ wasm.wasm_bindgen_1e05ddb24c0b7df4___convert__closures_____invoke_______true_(arg0, arg1);
514
554
  }
515
555
 
516
556
  function wasm_bindgen_1e05ddb24c0b7df4___convert__closures_____invoke___wasm_bindgen_1e05ddb24c0b7df4___JsValue__core_9b3796e30d99ddb7___result__Result_____wasm_bindgen_1e05ddb24c0b7df4___JsError___true_(arg0, arg1, arg2) {
@@ -524,8 +564,6 @@ function wasm_bindgen_1e05ddb24c0b7df4___convert__closures_____invoke___js_sys_b
524
564
  wasm.wasm_bindgen_1e05ddb24c0b7df4___convert__closures_____invoke___js_sys_bb6c79d0abe11c10___Function_fn_wasm_bindgen_1e05ddb24c0b7df4___JsValue_____wasm_bindgen_1e05ddb24c0b7df4___sys__Undefined___js_sys_bb6c79d0abe11c10___Function_fn_wasm_bindgen_1e05ddb24c0b7df4___JsValue_____wasm_bindgen_1e05ddb24c0b7df4___sys__Undefined_______true_(arg0, arg1, arg2, arg3);
525
565
  }
526
566
 
527
-
528
- const __wbindgen_enum_BinaryType = ["blob", "arraybuffer"];
529
567
  const LibfwClientFinalization = (typeof FinalizationRegistry === 'undefined')
530
568
  ? { register: () => {}, unregister: () => {} }
531
569
  : new FinalizationRegistry(ptr => wasm.__wbg_libfwclient_free(ptr, 1));
Binary file
@@ -18,9 +18,7 @@ export const libfwclient_total_bytes: (a: number) => number;
18
18
  export const libfwclient_upload: (a: number, b: number, c: number, d: number, e: number) => any;
19
19
  export const wasm_bindgen_1e05ddb24c0b7df4___convert__closures_____invoke___wasm_bindgen_1e05ddb24c0b7df4___JsValue__core_9b3796e30d99ddb7___result__Result_____wasm_bindgen_1e05ddb24c0b7df4___JsError___true_: (a: number, b: number, c: any) => [number, number];
20
20
  export const wasm_bindgen_1e05ddb24c0b7df4___convert__closures_____invoke___js_sys_bb6c79d0abe11c10___Function_fn_wasm_bindgen_1e05ddb24c0b7df4___JsValue_____wasm_bindgen_1e05ddb24c0b7df4___sys__Undefined___js_sys_bb6c79d0abe11c10___Function_fn_wasm_bindgen_1e05ddb24c0b7df4___JsValue_____wasm_bindgen_1e05ddb24c0b7df4___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;
21
- export const wasm_bindgen_1e05ddb24c0b7df4___convert__closures_____invoke___web_sys_86e1b1c7d411e716___features__gen_CloseEvent__CloseEvent______true_: (a: number, b: number, c: any) => void;
22
- export const wasm_bindgen_1e05ddb24c0b7df4___convert__closures_____invoke___web_sys_86e1b1c7d411e716___features__gen_CloseEvent__CloseEvent______true__2: (a: number, b: number, c: any) => void;
23
- export const wasm_bindgen_1e05ddb24c0b7df4___convert__closures_____invoke___web_sys_86e1b1c7d411e716___features__gen_CloseEvent__CloseEvent______true__3: (a: number, b: number, c: any) => void;
21
+ export const wasm_bindgen_1e05ddb24c0b7df4___convert__closures_____invoke_______true_: (a: number, b: number) => void;
24
22
  export const __wbindgen_malloc: (a: number, b: number) => number;
25
23
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
26
24
  export const __wbindgen_exn_store: (a: number) => void;
package/pkg/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "libfw-client",
3
3
  "type": "module",
4
4
  "description": "WASM engine + JS SDK for libfw browser clients",
5
- "version": "0.2.4",
5
+ "version": "0.3.1",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",