@filen/sdk-rs 0.3.0 → 0.3.2

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.
@@ -1,29 +1,8 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+ export function fromStringified(serialized: StringifiedClient): Client;
4
+ export function login(email: string, password: string, twoFactorCode?: string | null): Promise<Client>;
3
5
  export function main_js(): void;
4
- export function login(email: string, password: string, two_factor_code?: string | null): Promise<FilenState>;
5
- export function from_serialized(serialized: StringifiedClient): FilenState;
6
- /**
7
- * Chroma subsampling format
8
- */
9
- export enum ChromaSampling {
10
- /**
11
- * Both vertically and horizontally subsampled.
12
- */
13
- Cs420 = 0,
14
- /**
15
- * Horizontally subsampled.
16
- */
17
- Cs422 = 1,
18
- /**
19
- * Not subsampled.
20
- */
21
- Cs444 = 2,
22
- /**
23
- * Monochrome.
24
- */
25
- Cs400 = 3,
26
- }
27
6
  /**
28
7
  * The `ReadableStreamType` enum.
29
8
  *
@@ -41,29 +20,25 @@ export interface File {
41
20
  chunks: bigint;
42
21
  }
43
22
 
44
- export interface UploadFileStreamParams extends UploadFileParams {
45
- reader: ReadableStream<Uint8Array>;
46
- known_size?: bigint | undefined;
47
- progress?: (bytes: bigint) => void;
48
- }
49
-
50
- export interface UploadFileParams {
51
- parent: DirEnum;
23
+ export interface DecryptedFileMeta {
52
24
  name: string;
25
+ mime: string;
53
26
  created?: bigint;
54
- modified?: bigint;
55
- mime?: string;
27
+ modified: bigint;
28
+ hash?: Uint8Array;
29
+ size: bigint;
30
+ key: string;
31
+ version: FileEncryptionVersion;
56
32
  }
57
33
 
58
- export interface DownloadFileStreamParams {
59
- file: File;
60
- writer: WritableStream<Uint8Array>;
61
- progress?: (bytes: bigint) => void;
62
- }
34
+ export type Item = File | Dir | Root;
63
35
 
64
36
  export type DirEnum = Dir | Root;
65
37
 
66
- export type NonRootObject = ({ type: "dir" } & Dir) | ({ type: "file" } & File);
38
+ export interface DecryptedDirMeta {
39
+ name: string;
40
+ created?: bigint;
41
+ }
67
42
 
68
43
  export interface Dir {
69
44
  uuid: UuidStr;
@@ -73,24 +48,36 @@ export interface Dir {
73
48
  meta?: DecryptedDirMeta;
74
49
  }
75
50
 
76
- export interface DecryptedDirMeta {
77
- name: string;
78
- created?: bigint;
51
+ export interface Root {
52
+ uuid: UuidStr;
79
53
  }
80
54
 
81
- export interface DecryptedFileMeta {
55
+ export type NonRootObject = ({ type: "dir" } & Dir) | ({ type: "file" } & File);
56
+
57
+ export interface DownloadFileToZipParams {
58
+ items: Item[];
59
+ writer: WritableStream<Uint8Array>;
60
+ progress?: (bytes: bigint) => void;
61
+ }
62
+
63
+ export interface UploadFileParams {
64
+ parent: DirEnum;
82
65
  name: string;
83
- mime: string;
84
66
  created?: bigint;
85
- modified: bigint;
86
- hash?: Uint8Array;
87
- size: bigint;
88
- key: string;
89
- version: FileEncryptionVersion;
67
+ modified?: bigint;
68
+ mime?: string;
90
69
  }
91
70
 
92
- export interface Root {
93
- uuid: UuidStr;
71
+ export interface UploadFileStreamParams extends UploadFileParams {
72
+ reader: ReadableStream<Uint8Array>;
73
+ known_size: bigint | undefined;
74
+ progress?: (bytes: bigint) => void;
75
+ }
76
+
77
+ export interface DownloadFileStreamParams {
78
+ file: File;
79
+ writer: WritableStream<Uint8Array>;
80
+ progress?: (bytes: bigint) => void;
94
81
  }
95
82
 
96
83
  export interface StringifiedClient {
@@ -102,39 +89,46 @@ export interface StringifiedClient {
102
89
  authVersion: number;
103
90
  }
104
91
 
105
- export class FilenState {
92
+ export type ParentUuid = UuidStr | "trash" | "recents" | "favorites" | "links";
93
+
94
+ export type FileEncryptionVersion = 1 | 2 | 3;
95
+
96
+ export type UuidStr = string;
97
+
98
+ export class Client {
106
99
  private constructor();
107
100
  free(): void;
108
- serialize(): StringifiedClient;
109
- findItemInDir(dir: DirEnum, name_or_uuid: string): Promise<NonRootObject | undefined>;
110
- listDir(dir: DirEnum): Promise<[DirEnum[], File[]]>;
111
- trashDir(dir: DirEnum): Promise<void>;
101
+ findItemInDir(dir: DirEnum, nameOrUuid: string): Promise<NonRootObject | undefined>;
102
+ listDir(dir: DirEnum): Promise<[Dir[], File[]]>;
103
+ root(): Root;
104
+ createDir(parent: DirEnum, name: string): Promise<Dir>;
112
105
  deleteDirPermanently(dir: Dir): Promise<void>;
106
+ trashDir(dir: Dir): Promise<Dir>;
113
107
  dirExists(parent: DirEnum, name: string): Promise<void>;
114
- createDir(parent: DirEnum, name: string): Promise<Dir>;
115
- root(): Root;
116
- uploadFileStream(params: UploadFileStreamParams): Promise<File>;
117
- trashFile(file: File): Promise<void>;
108
+ downloadItemsToZip(params: DownloadFileToZipParams): Promise<void>;
109
+ uploadFileFromReader(params: UploadFileStreamParams): Promise<File>;
118
110
  deleteFilePermanently(file: File): Promise<void>;
111
+ uploadFile(data: Uint8Array, params: UploadFileParams): Promise<File>;
112
+ trashFile(file: File): Promise<File>;
119
113
  downloadFileToWriter(params: DownloadFileStreamParams): Promise<void>;
120
114
  downloadFile(file: File): Promise<Uint8Array>;
121
- uploadFile(data: Uint8Array, params: UploadFileParams): Promise<File>;
115
+ toStringified(): StringifiedClient;
122
116
  }
123
117
  export class IntoUnderlyingByteSource {
124
118
  private constructor();
125
119
  free(): void;
126
- cancel(): void;
127
- pull(controller: ReadableByteStreamController): Promise<any>;
128
120
  start(controller: ReadableByteStreamController): void;
121
+ pull(controller: ReadableByteStreamController): Promise<any>;
122
+ cancel(): void;
129
123
  readonly type: ReadableStreamType;
130
124
  readonly autoAllocateChunkSize: number;
131
125
  }
132
126
  export class IntoUnderlyingSink {
133
127
  private constructor();
134
128
  free(): void;
135
- close(): Promise<any>;
136
129
  write(chunk: any): Promise<any>;
137
130
  abort(reason: any): Promise<any>;
131
+ close(): Promise<any>;
138
132
  }
139
133
  export class IntoUnderlyingSource {
140
134
  private constructor();
@@ -80,8 +80,6 @@ function getDataViewMemory0() {
80
80
  return cachedDataViewMemory0;
81
81
  }
82
82
 
83
- function getFromExternrefTable0(idx) { return wasm.__wbindgen_export_2.get(idx); }
84
-
85
83
  const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;
86
84
 
87
85
  let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });
@@ -93,17 +91,9 @@ function getStringFromWasm0(ptr, len) {
93
91
  return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
94
92
  }
95
93
 
96
- function getCachedStringFromWasm0(ptr, len) {
97
- if (ptr === 0) {
98
- return getFromExternrefTable0(len);
99
- } else {
100
- return getStringFromWasm0(ptr, len);
101
- }
102
- }
103
-
104
94
  function addToExternrefTable0(obj) {
105
95
  const idx = wasm.__externref_table_alloc();
106
- wasm.__wbindgen_export_2.set(idx, obj);
96
+ wasm.__wbindgen_export_4.set(idx, obj);
107
97
  return idx;
108
98
  }
109
99
 
@@ -221,42 +211,42 @@ function debugString(val) {
221
211
  return className;
222
212
  }
223
213
 
224
- export function main_js() {
225
- wasm.main_js();
214
+ function takeFromExternrefTable0(idx) {
215
+ const value = wasm.__wbindgen_export_4.get(idx);
216
+ wasm.__externref_table_dealloc(idx);
217
+ return value;
218
+ }
219
+ /**
220
+ * @param {StringifiedClient} serialized
221
+ * @returns {Client}
222
+ */
223
+ export function fromStringified(serialized) {
224
+ const ret = wasm.fromStringified(serialized);
225
+ if (ret[2]) {
226
+ throw takeFromExternrefTable0(ret[1]);
227
+ }
228
+ return Client.__wrap(ret[0]);
226
229
  }
227
230
 
228
231
  /**
229
232
  * @param {string} email
230
233
  * @param {string} password
231
- * @param {string | null} [two_factor_code]
232
- * @returns {Promise<FilenState>}
234
+ * @param {string | null} [twoFactorCode]
235
+ * @returns {Promise<Client>}
233
236
  */
234
- export function login(email, password, two_factor_code) {
237
+ export function login(email, password, twoFactorCode) {
235
238
  const ptr0 = passStringToWasm0(email, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
236
239
  const len0 = WASM_VECTOR_LEN;
237
240
  const ptr1 = passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
238
241
  const len1 = WASM_VECTOR_LEN;
239
- var ptr2 = isLikeNone(two_factor_code) ? 0 : passStringToWasm0(two_factor_code, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
242
+ var ptr2 = isLikeNone(twoFactorCode) ? 0 : passStringToWasm0(twoFactorCode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
240
243
  var len2 = WASM_VECTOR_LEN;
241
244
  const ret = wasm.login(ptr0, len0, ptr1, len1, ptr2, len2);
242
245
  return ret;
243
246
  }
244
247
 
245
- function takeFromExternrefTable0(idx) {
246
- const value = wasm.__wbindgen_export_2.get(idx);
247
- wasm.__externref_table_dealloc(idx);
248
- return value;
249
- }
250
- /**
251
- * @param {StringifiedClient} serialized
252
- * @returns {FilenState}
253
- */
254
- export function from_serialized(serialized) {
255
- const ret = wasm.from_serialized(serialized);
256
- if (ret[2]) {
257
- throw takeFromExternrefTable0(ret[1]);
258
- }
259
- return FilenState.__wrap(ret[0]);
248
+ export function main_js() {
249
+ wasm.main_js();
260
250
  }
261
251
 
262
252
  function passArray8ToWasm0(arg, malloc) {
@@ -265,108 +255,90 @@ function passArray8ToWasm0(arg, malloc) {
265
255
  WASM_VECTOR_LEN = arg.length;
266
256
  return ptr;
267
257
  }
268
- function __wbg_adapter_58(arg0, arg1, arg2) {
269
- wasm.closure109_externref_shim(arg0, arg1, arg2);
258
+ function __wbg_adapter_58(arg0, arg1) {
259
+ wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h1ad07d0627257b45(arg0, arg1);
270
260
  }
271
261
 
272
262
  function __wbg_adapter_61(arg0, arg1) {
273
- wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h3a28bb1da68602c0(arg0, arg1);
263
+ wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h96ccbfe273ba439a(arg0, arg1);
274
264
  }
275
265
 
276
- function __wbg_adapter_131(arg0, arg1, arg2, arg3) {
277
- wasm.closure85_externref_shim(arg0, arg1, arg2, arg3);
266
+ function __wbg_adapter_64(arg0, arg1, arg2) {
267
+ wasm.closure830_externref_shim(arg0, arg1, arg2);
278
268
  }
279
269
 
280
- /**
281
- * Chroma subsampling format
282
- * @enum {0 | 1 | 2 | 3}
283
- */
284
- export const ChromaSampling = Object.freeze({
285
- /**
286
- * Both vertically and horizontally subsampled.
287
- */
288
- Cs420: 0, "0": "Cs420",
289
- /**
290
- * Horizontally subsampled.
291
- */
292
- Cs422: 1, "1": "Cs422",
293
- /**
294
- * Not subsampled.
295
- */
296
- Cs444: 2, "2": "Cs444",
297
- /**
298
- * Monochrome.
299
- */
300
- Cs400: 3, "3": "Cs400",
301
- });
270
+ function __wbg_adapter_295(arg0, arg1, arg2, arg3) {
271
+ wasm.closure989_externref_shim(arg0, arg1, arg2, arg3);
272
+ }
302
273
 
303
274
  const __wbindgen_enum_ReadableStreamReaderMode = ["byob"];
304
275
 
305
276
  const __wbindgen_enum_ReadableStreamType = ["bytes"];
306
277
 
307
- const __wbindgen_enum_RequestCache = ["default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached"];
308
-
309
278
  const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
310
279
 
311
280
  const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
312
281
 
313
- const FilenStateFinalization = (typeof FinalizationRegistry === 'undefined')
282
+ const ClientFinalization = (typeof FinalizationRegistry === 'undefined')
314
283
  ? { register: () => {}, unregister: () => {} }
315
- : new FinalizationRegistry(ptr => wasm.__wbg_filenstate_free(ptr >>> 0, 1));
284
+ : new FinalizationRegistry(ptr => wasm.__wbg_client_free(ptr >>> 0, 1));
316
285
 
317
- export class FilenState {
286
+ export class Client {
318
287
 
319
288
  static __wrap(ptr) {
320
289
  ptr = ptr >>> 0;
321
- const obj = Object.create(FilenState.prototype);
290
+ const obj = Object.create(Client.prototype);
322
291
  obj.__wbg_ptr = ptr;
323
- FilenStateFinalization.register(obj, obj.__wbg_ptr, obj);
292
+ ClientFinalization.register(obj, obj.__wbg_ptr, obj);
324
293
  return obj;
325
294
  }
326
295
 
327
296
  __destroy_into_raw() {
328
297
  const ptr = this.__wbg_ptr;
329
298
  this.__wbg_ptr = 0;
330
- FilenStateFinalization.unregister(this);
299
+ ClientFinalization.unregister(this);
331
300
  return ptr;
332
301
  }
333
302
 
334
303
  free() {
335
304
  const ptr = this.__destroy_into_raw();
336
- wasm.__wbg_filenstate_free(ptr, 0);
337
- }
338
- /**
339
- * @returns {StringifiedClient}
340
- */
341
- serialize() {
342
- const ret = wasm.filenstate_serialize(this.__wbg_ptr);
343
- return ret;
305
+ wasm.__wbg_client_free(ptr, 0);
344
306
  }
345
307
  /**
346
308
  * @param {DirEnum} dir
347
- * @param {string} name_or_uuid
309
+ * @param {string} nameOrUuid
348
310
  * @returns {Promise<NonRootObject | undefined>}
349
311
  */
350
- findItemInDir(dir, name_or_uuid) {
351
- const ptr0 = passStringToWasm0(name_or_uuid, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
312
+ findItemInDir(dir, nameOrUuid) {
313
+ const ptr0 = passStringToWasm0(nameOrUuid, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
352
314
  const len0 = WASM_VECTOR_LEN;
353
- const ret = wasm.filenstate_findItemInDir(this.__wbg_ptr, dir, ptr0, len0);
315
+ const ret = wasm.client_findItemInDir(this.__wbg_ptr, dir, ptr0, len0);
354
316
  return ret;
355
317
  }
356
318
  /**
357
319
  * @param {DirEnum} dir
358
- * @returns {[DirEnum[], File[]]}
320
+ * @returns {[Dir[], File[]]}
359
321
  */
360
322
  listDir(dir) {
361
- const ret = wasm.filenstate_listDir(this.__wbg_ptr, dir);
323
+ const ret = wasm.client_listDir(this.__wbg_ptr, dir);
362
324
  return ret;
363
325
  }
364
326
  /**
365
- * @param {DirEnum} dir
366
- * @returns {Promise<void>}
327
+ * @returns {Root}
367
328
  */
368
- trashDir(dir) {
369
- const ret = wasm.filenstate_trashDir(this.__wbg_ptr, dir);
329
+ root() {
330
+ const ret = wasm.client_root(this.__wbg_ptr);
331
+ return ret;
332
+ }
333
+ /**
334
+ * @param {DirEnum} parent
335
+ * @param {string} name
336
+ * @returns {Promise<Dir>}
337
+ */
338
+ createDir(parent, name) {
339
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
340
+ const len0 = WASM_VECTOR_LEN;
341
+ const ret = wasm.client_createDir(this.__wbg_ptr, parent, ptr0, len0);
370
342
  return ret;
371
343
  }
372
344
  /**
@@ -374,60 +346,69 @@ export class FilenState {
374
346
  * @returns {Promise<void>}
375
347
  */
376
348
  deleteDirPermanently(dir) {
377
- const ret = wasm.filenstate_deleteDirPermanently(this.__wbg_ptr, dir);
349
+ const ret = wasm.client_deleteDirPermanently(this.__wbg_ptr, dir);
378
350
  return ret;
379
351
  }
380
352
  /**
381
- * @param {DirEnum} parent
382
- * @param {string} name
383
- * @returns {Promise<void>}
353
+ * @param {Dir} dir
354
+ * @returns {Promise<Dir>}
384
355
  */
385
- dirExists(parent, name) {
386
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
387
- const len0 = WASM_VECTOR_LEN;
388
- const ret = wasm.filenstate_dirExists(this.__wbg_ptr, parent, ptr0, len0);
356
+ trashDir(dir) {
357
+ const ret = wasm.client_trashDir(this.__wbg_ptr, dir);
389
358
  return ret;
390
359
  }
391
360
  /**
392
361
  * @param {DirEnum} parent
393
362
  * @param {string} name
394
- * @returns {Promise<Dir>}
363
+ * @returns {Promise<void>}
395
364
  */
396
- createDir(parent, name) {
365
+ dirExists(parent, name) {
397
366
  const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
398
367
  const len0 = WASM_VECTOR_LEN;
399
- const ret = wasm.filenstate_createDir(this.__wbg_ptr, parent, ptr0, len0);
368
+ const ret = wasm.client_dirExists(this.__wbg_ptr, parent, ptr0, len0);
400
369
  return ret;
401
370
  }
402
371
  /**
403
- * @returns {Root}
372
+ * @param {DownloadFileToZipParams} params
373
+ * @returns {Promise<void>}
404
374
  */
405
- root() {
406
- const ret = wasm.filenstate_root(this.__wbg_ptr);
375
+ downloadItemsToZip(params) {
376
+ const ret = wasm.client_downloadItemsToZip(this.__wbg_ptr, params);
407
377
  return ret;
408
378
  }
409
379
  /**
410
380
  * @param {UploadFileStreamParams} params
411
381
  * @returns {Promise<File>}
412
382
  */
413
- uploadFileStream(params) {
414
- const ret = wasm.filenstate_uploadFileStream(this.__wbg_ptr, params);
383
+ uploadFileFromReader(params) {
384
+ const ret = wasm.client_uploadFileFromReader(this.__wbg_ptr, params);
415
385
  return ret;
416
386
  }
417
387
  /**
418
388
  * @param {File} file
419
389
  * @returns {Promise<void>}
420
390
  */
421
- trashFile(file) {
422
- const ret = wasm.filenstate_trashFile(this.__wbg_ptr, file);
391
+ deleteFilePermanently(file) {
392
+ const ret = wasm.client_deleteFilePermanently(this.__wbg_ptr, file);
393
+ return ret;
394
+ }
395
+ /**
396
+ * @param {Uint8Array} data
397
+ * @param {UploadFileParams} params
398
+ * @returns {Promise<File>}
399
+ */
400
+ uploadFile(data, params) {
401
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
402
+ const len0 = WASM_VECTOR_LEN;
403
+ const ret = wasm.client_uploadFile(this.__wbg_ptr, ptr0, len0, params);
423
404
  return ret;
424
405
  }
425
406
  /**
426
407
  * @param {File} file
427
- * @returns {Promise<void>}
408
+ * @returns {Promise<File>}
428
409
  */
429
- deleteFilePermanently(file) {
430
- const ret = wasm.filenstate_deleteFilePermanently(this.__wbg_ptr, file);
410
+ trashFile(file) {
411
+ const ret = wasm.client_trashFile(this.__wbg_ptr, file);
431
412
  return ret;
432
413
  }
433
414
  /**
@@ -435,7 +416,7 @@ export class FilenState {
435
416
  * @returns {Promise<void>}
436
417
  */
437
418
  downloadFileToWriter(params) {
438
- const ret = wasm.filenstate_downloadFileToWriter(this.__wbg_ptr, params);
419
+ const ret = wasm.client_downloadFileToWriter(this.__wbg_ptr, params);
439
420
  return ret;
440
421
  }
441
422
  /**
@@ -443,18 +424,14 @@ export class FilenState {
443
424
  * @returns {Promise<Uint8Array>}
444
425
  */
445
426
  downloadFile(file) {
446
- const ret = wasm.filenstate_downloadFile(this.__wbg_ptr, file);
427
+ const ret = wasm.client_downloadFile(this.__wbg_ptr, file);
447
428
  return ret;
448
429
  }
449
430
  /**
450
- * @param {Uint8Array} data
451
- * @param {UploadFileParams} params
452
- * @returns {Promise<File>}
431
+ * @returns {StringifiedClient}
453
432
  */
454
- uploadFile(data, params) {
455
- const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
456
- const len0 = WASM_VECTOR_LEN;
457
- const ret = wasm.filenstate_uploadFile(this.__wbg_ptr, ptr0, len0, params);
433
+ toStringified() {
434
+ const ret = wasm.client_toStringified(this.__wbg_ptr);
458
435
  return ret;
459
436
  }
460
437
  }
@@ -476,24 +453,6 @@ export class IntoUnderlyingByteSource {
476
453
  const ptr = this.__destroy_into_raw();
477
454
  wasm.__wbg_intounderlyingbytesource_free(ptr, 0);
478
455
  }
479
- cancel() {
480
- const ptr = this.__destroy_into_raw();
481
- wasm.intounderlyingbytesource_cancel(ptr);
482
- }
483
- /**
484
- * @param {ReadableByteStreamController} controller
485
- * @returns {Promise<any>}
486
- */
487
- pull(controller) {
488
- const ret = wasm.intounderlyingbytesource_pull(this.__wbg_ptr, controller);
489
- return ret;
490
- }
491
- /**
492
- * @param {ReadableByteStreamController} controller
493
- */
494
- start(controller) {
495
- wasm.intounderlyingbytesource_start(this.__wbg_ptr, controller);
496
- }
497
456
  /**
498
457
  * @returns {ReadableStreamType}
499
458
  */
@@ -508,6 +467,24 @@ export class IntoUnderlyingByteSource {
508
467
  const ret = wasm.intounderlyingbytesource_autoAllocateChunkSize(this.__wbg_ptr);
509
468
  return ret >>> 0;
510
469
  }
470
+ /**
471
+ * @param {ReadableByteStreamController} controller
472
+ */
473
+ start(controller) {
474
+ wasm.intounderlyingbytesource_start(this.__wbg_ptr, controller);
475
+ }
476
+ /**
477
+ * @param {ReadableByteStreamController} controller
478
+ * @returns {Promise<any>}
479
+ */
480
+ pull(controller) {
481
+ const ret = wasm.intounderlyingbytesource_pull(this.__wbg_ptr, controller);
482
+ return ret;
483
+ }
484
+ cancel() {
485
+ const ptr = this.__destroy_into_raw();
486
+ wasm.intounderlyingbytesource_cancel(ptr);
487
+ }
511
488
  }
512
489
 
513
490
  const IntoUnderlyingSinkFinalization = (typeof FinalizationRegistry === 'undefined')
@@ -527,14 +504,6 @@ export class IntoUnderlyingSink {
527
504
  const ptr = this.__destroy_into_raw();
528
505
  wasm.__wbg_intounderlyingsink_free(ptr, 0);
529
506
  }
530
- /**
531
- * @returns {Promise<any>}
532
- */
533
- close() {
534
- const ptr = this.__destroy_into_raw();
535
- const ret = wasm.intounderlyingsink_close(ptr);
536
- return ret;
537
- }
538
507
  /**
539
508
  * @param {any} chunk
540
509
  * @returns {Promise<any>}
@@ -552,6 +521,14 @@ export class IntoUnderlyingSink {
552
521
  const ret = wasm.intounderlyingsink_abort(ptr, reason);
553
522
  return ret;
554
523
  }
524
+ /**
525
+ * @returns {Promise<any>}
526
+ */
527
+ close() {
528
+ const ptr = this.__destroy_into_raw();
529
+ const ret = wasm.intounderlyingsink_close(ptr);
530
+ return ret;
531
+ }
555
532
  }
556
533
 
557
534
  const IntoUnderlyingSourceFinalization = (typeof FinalizationRegistry === 'undefined')
@@ -602,9 +579,7 @@ export function __wbg_abort_775ef1d17fc65868(arg0) {
602
579
  };
603
580
 
604
581
  export function __wbg_append_8c7dd8d641a5f01b() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
605
- var v0 = getCachedStringFromWasm0(arg1, arg2);
606
- var v1 = getCachedStringFromWasm0(arg3, arg4);
607
- arg0.append(v0, v1);
582
+ arg0.append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
608
583
  }, arguments) };
609
584
 
610
585
  export function __wbg_arrayBuffer_d1b44c4390db422f() { return handleError(function (arg0) {
@@ -667,11 +642,16 @@ export function __wbg_catch_a6e601879b2610e9(arg0, arg1) {
667
642
  return ret;
668
643
  };
669
644
 
670
- export function __wbg_clearTimeout_6222fede17abcb1a(arg0) {
645
+ export function __wbg_clearTimeout_0b53d391c1b94dda(arg0) {
671
646
  const ret = clearTimeout(arg0);
672
647
  return ret;
673
648
  };
674
649
 
650
+ export function __wbg_client_new(arg0) {
651
+ const ret = Client.__wrap(arg0);
652
+ return ret;
653
+ };
654
+
675
655
  export function __wbg_close_304cc1fef3466669() { return handleError(function (arg0) {
676
656
  arg0.close();
677
657
  }, arguments) };
@@ -680,6 +660,11 @@ export function __wbg_close_5ce03e29be453811() { return handleError(function (ar
680
660
  arg0.close();
681
661
  }, arguments) };
682
662
 
663
+ export function __wbg_close_fa50b16598acbea1(arg0) {
664
+ const ret = arg0.close();
665
+ return ret;
666
+ };
667
+
683
668
  export function __wbg_crypto_574e78ad8b13b65f(arg0) {
684
669
  const ret = arg0.crypto;
685
670
  return ret;
@@ -689,11 +674,6 @@ export function __wbg_debug_e17b51583ca6a632(arg0, arg1, arg2, arg3) {
689
674
  console.debug(arg0, arg1, arg2, arg3);
690
675
  };
691
676
 
692
- export function __wbg_deleteProperty_96363d4a1d977c97() { return handleError(function (arg0, arg1) {
693
- const ret = Reflect.deleteProperty(arg0, arg1);
694
- return ret;
695
- }, arguments) };
696
-
697
677
  export function __wbg_done_769e5ede4b31c67b(arg0) {
698
678
  const ret = arg0.done;
699
679
  return ret;
@@ -713,27 +693,28 @@ export function __wbg_error_524f506f44df1645(arg0) {
713
693
  };
714
694
 
715
695
  export function __wbg_error_7534b8e9a36f1ab4(arg0, arg1) {
716
- var v0 = getCachedStringFromWasm0(arg0, arg1);
717
- if (arg0 !== 0) { wasm.__wbindgen_free(arg0, arg1, 1); }
718
- console.error(v0);
696
+ let deferred0_0;
697
+ let deferred0_1;
698
+ try {
699
+ deferred0_0 = arg0;
700
+ deferred0_1 = arg1;
701
+ console.error(getStringFromWasm0(arg0, arg1));
702
+ } finally {
703
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
704
+ }
719
705
  };
720
706
 
721
707
  export function __wbg_error_80de38b3f7cc3c3c(arg0, arg1, arg2, arg3) {
722
708
  console.error(arg0, arg1, arg2, arg3);
723
709
  };
724
710
 
725
- export function __wbg_fetch_509096533071c657(arg0, arg1) {
726
- const ret = arg0.fetch(arg1);
727
- return ret;
728
- };
729
-
730
- export function __wbg_fetch_f156d10be9a5c88a(arg0) {
711
+ export function __wbg_fetch_11bff8299d0ecd2b(arg0) {
731
712
  const ret = fetch(arg0);
732
713
  return ret;
733
714
  };
734
715
 
735
- export function __wbg_filenstate_new(arg0) {
736
- const ret = FilenState.__wrap(arg0);
716
+ export function __wbg_fetch_509096533071c657(arg0, arg1) {
717
+ const ret = arg0.fetch(arg1);
737
718
  return ret;
738
719
  };
739
720
 
@@ -921,7 +902,7 @@ export function __wbg_new_23a2665fac83c611(arg0, arg1) {
921
902
  const a = state0.a;
922
903
  state0.a = 0;
923
904
  try {
924
- return __wbg_adapter_131(a, state0.b, arg0, arg1);
905
+ return __wbg_adapter_295(a, state0.b, arg0, arg1);
925
906
  } finally {
926
907
  state0.a = a;
927
908
  }
@@ -954,8 +935,7 @@ export function __wbg_new_a12002a7f91c75be(arg0) {
954
935
  };
955
936
 
956
937
  export function __wbg_new_c68d7209be747379(arg0, arg1) {
957
- var v0 = getCachedStringFromWasm0(arg0, arg1);
958
- const ret = new Error(v0);
938
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
959
939
  return ret;
960
940
  };
961
941
 
@@ -965,8 +945,7 @@ export function __wbg_new_e25e5aab09ff45db() { return handleError(function () {
965
945
  }, arguments) };
966
946
 
967
947
  export function __wbg_newnoargs_105ed471475aaf50(arg0, arg1) {
968
- var v0 = getCachedStringFromWasm0(arg0, arg1);
969
- const ret = new Function(v0);
948
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
970
949
  return ret;
971
950
  };
972
951
 
@@ -986,8 +965,7 @@ export function __wbg_newwithlength_c4c419ef0bc8a1f8(arg0) {
986
965
  };
987
966
 
988
967
  export function __wbg_newwithstrandinit_06c535e0a867c635() { return handleError(function (arg0, arg1, arg2) {
989
- var v0 = getCachedStringFromWasm0(arg0, arg1);
990
- const ret = new Request(v0, arg2);
968
+ const ret = new Request(getStringFromWasm0(arg0, arg1), arg2);
991
969
  return ret;
992
970
  }, arguments) };
993
971
 
@@ -1075,16 +1053,16 @@ export function __wbg_respond_1f279fa9f8edcb1c() { return handleError(function (
1075
1053
  arg0.respond(arg1 >>> 0);
1076
1054
  }, arguments) };
1077
1055
 
1078
- export function __wbg_setTimeout_2b339866a2aa3789(arg0, arg1) {
1079
- const ret = setTimeout(arg0, arg1);
1080
- return ret;
1081
- };
1082
-
1083
1056
  export function __wbg_setTimeout_42370cb3051b8c2c() { return handleError(function (arg0, arg1, arg2) {
1084
1057
  const ret = arg0.setTimeout(arg1, arg2);
1085
1058
  return ret;
1086
1059
  }, arguments) };
1087
1060
 
1061
+ export function __wbg_setTimeout_73ce8df12de4f2f2(arg0, arg1) {
1062
+ const ret = setTimeout(arg0, arg1);
1063
+ return ret;
1064
+ };
1065
+
1088
1066
  export function __wbg_set_37837023f3d740e8(arg0, arg1, arg2) {
1089
1067
  arg0[arg1 >>> 0] = arg2;
1090
1068
  };
@@ -1097,19 +1075,10 @@ export function __wbg_set_65595bdd868b3009(arg0, arg1, arg2) {
1097
1075
  arg0.set(arg1, arg2 >>> 0);
1098
1076
  };
1099
1077
 
1100
- export function __wbg_set_bb8cecf6a62b9f46() { return handleError(function (arg0, arg1, arg2) {
1101
- const ret = Reflect.set(arg0, arg1, arg2);
1102
- return ret;
1103
- }, arguments) };
1104
-
1105
1078
  export function __wbg_setbody_5923b78a95eedf29(arg0, arg1) {
1106
1079
  arg0.body = arg1;
1107
1080
  };
1108
1081
 
1109
- export function __wbg_setcache_12f17c3a980650e4(arg0, arg1) {
1110
- arg0.cache = __wbindgen_enum_RequestCache[arg1];
1111
- };
1112
-
1113
1082
  export function __wbg_setcredentials_c3a22f1cd105a2c6(arg0, arg1) {
1114
1083
  arg0.credentials = __wbindgen_enum_RequestCredentials[arg1];
1115
1084
  };
@@ -1119,8 +1088,7 @@ export function __wbg_setheaders_834c0bdb6a8949ad(arg0, arg1) {
1119
1088
  };
1120
1089
 
1121
1090
  export function __wbg_setmethod_3c5280fe5d890842(arg0, arg1, arg2) {
1122
- var v0 = getCachedStringFromWasm0(arg1, arg2);
1123
- arg0.method = v0;
1091
+ arg0.method = getStringFromWasm0(arg1, arg2);
1124
1092
  };
1125
1093
 
1126
1094
  export function __wbg_setmode_4967d329825f7890(arg0, arg1) {
@@ -1277,18 +1245,18 @@ export function __wbindgen_cb_drop(arg0) {
1277
1245
  return ret;
1278
1246
  };
1279
1247
 
1280
- export function __wbindgen_closure_wrapper2409(arg0, arg1, arg2) {
1281
- const ret = makeMutClosure(arg0, arg1, 102, __wbg_adapter_61);
1248
+ export function __wbindgen_closure_wrapper1729(arg0, arg1, arg2) {
1249
+ const ret = makeMutClosure(arg0, arg1, 726, __wbg_adapter_58);
1282
1250
  return ret;
1283
1251
  };
1284
1252
 
1285
- export function __wbindgen_closure_wrapper2706(arg0, arg1, arg2) {
1286
- const ret = makeMutClosure(arg0, arg1, 110, __wbg_adapter_61);
1253
+ export function __wbindgen_closure_wrapper1966(arg0, arg1, arg2) {
1254
+ const ret = makeMutClosure(arg0, arg1, 791, __wbg_adapter_61);
1287
1255
  return ret;
1288
1256
  };
1289
1257
 
1290
- export function __wbindgen_closure_wrapper472(arg0, arg1, arg2) {
1291
- const ret = makeMutClosure(arg0, arg1, 110, __wbg_adapter_58);
1258
+ export function __wbindgen_closure_wrapper2082(arg0, arg1, arg2) {
1259
+ const ret = makeMutClosure(arg0, arg1, 831, __wbg_adapter_64);
1292
1260
  return ret;
1293
1261
  };
1294
1262
 
@@ -1311,7 +1279,7 @@ export function __wbindgen_in(arg0, arg1) {
1311
1279
  };
1312
1280
 
1313
1281
  export function __wbindgen_init_externref_table() {
1314
- const table = wasm.__wbindgen_export_2;
1282
+ const table = wasm.__wbindgen_export_4;
1315
1283
  const offset = table.grow(4);
1316
1284
  table.set(0, undefined);
1317
1285
  table.set(offset + 0, undefined);
Binary file
@@ -1,46 +1,48 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export const from_serialized: (a: any) => [number, number, number];
5
- export const __wbg_filenstate_free: (a: number, b: number) => void;
6
- export const login: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
7
4
  export const main_js: () => void;
8
- export const filenstate_serialize: (a: number) => any;
9
- export const filenstate_trashDir: (a: number, b: any) => any;
10
- export const filenstate_listDir: (a: number, b: any) => any;
11
- export const filenstate_createDir: (a: number, b: any, c: number, d: number) => any;
12
- export const filenstate_deleteDirPermanently: (a: number, b: any) => any;
13
- export const filenstate_findItemInDir: (a: number, b: any, c: number, d: number) => any;
14
- export const filenstate_root: (a: number) => any;
15
- export const filenstate_dirExists: (a: number, b: any, c: number, d: number) => any;
16
- export const filenstate_downloadFile: (a: number, b: any) => any;
17
- export const filenstate_uploadFileStream: (a: number, b: any) => any;
18
- export const filenstate_trashFile: (a: number, b: any) => any;
19
- export const filenstate_deleteFilePermanently: (a: number, b: any) => any;
20
- export const filenstate_downloadFileToWriter: (a: number, b: any) => any;
21
- export const filenstate_uploadFile: (a: number, b: number, c: number, d: any) => any;
22
- export const intounderlyingbytesource_start: (a: number, b: any) => void;
23
- export const intounderlyingbytesource_type: (a: number) => number;
24
- export const intounderlyingbytesource_pull: (a: number, b: any) => any;
25
- export const intounderlyingbytesource_cancel: (a: number) => void;
26
- export const __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
27
- export const intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number;
5
+ export const login: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
6
+ export const fromStringified: (a: any) => [number, number, number];
7
+ export const client_dirExists: (a: number, b: any, c: number, d: number) => any;
8
+ export const client_trashDir: (a: number, b: any) => any;
9
+ export const client_createDir: (a: number, b: any, c: number, d: number) => any;
10
+ export const client_findItemInDir: (a: number, b: any, c: number, d: number) => any;
11
+ export const client_listDir: (a: number, b: any) => any;
12
+ export const client_root: (a: number) => any;
13
+ export const client_deleteDirPermanently: (a: number, b: any) => any;
14
+ export const client_downloadItemsToZip: (a: number, b: any) => any;
15
+ export const client_downloadFileToWriter: (a: number, b: any) => any;
16
+ export const client_trashFile: (a: number, b: any) => any;
17
+ export const client_deleteFilePermanently: (a: number, b: any) => any;
18
+ export const client_uploadFileFromReader: (a: number, b: any) => any;
19
+ export const client_downloadFile: (a: number, b: any) => any;
20
+ export const client_uploadFile: (a: number, b: number, c: number, d: any) => any;
21
+ export const __wbg_client_free: (a: number, b: number) => void;
22
+ export const client_toStringified: (a: number) => any;
28
23
  export const __wbg_intounderlyingsource_free: (a: number, b: number) => void;
29
- export const intounderlyingsource_pull: (a: number, b: any) => any;
30
24
  export const intounderlyingsource_cancel: (a: number) => void;
25
+ export const intounderlyingsource_pull: (a: number, b: any) => any;
31
26
  export const __wbg_intounderlyingsink_free: (a: number, b: number) => void;
32
27
  export const intounderlyingsink_abort: (a: number, b: any) => any;
33
- export const intounderlyingsink_close: (a: number) => any;
34
28
  export const intounderlyingsink_write: (a: number, b: any) => any;
29
+ export const intounderlyingsink_close: (a: number) => any;
30
+ export const __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
31
+ export const intounderlyingbytesource_pull: (a: number, b: any) => any;
32
+ export const intounderlyingbytesource_type: (a: number) => number;
33
+ export const intounderlyingbytesource_start: (a: number, b: any) => void;
34
+ export const intounderlyingbytesource_cancel: (a: number) => void;
35
+ export const intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number;
35
36
  export const __wbindgen_malloc: (a: number, b: number) => number;
36
37
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
37
- export const __wbindgen_export_2: WebAssembly.Table;
38
38
  export const __wbindgen_exn_store: (a: number) => void;
39
39
  export const __externref_table_alloc: () => number;
40
+ export const __wbindgen_export_4: WebAssembly.Table;
40
41
  export const __wbindgen_free: (a: number, b: number, c: number) => void;
41
42
  export const __wbindgen_export_6: WebAssembly.Table;
42
43
  export const __externref_table_dealloc: (a: number) => void;
43
- export const closure109_externref_shim: (a: number, b: number, c: any) => void;
44
- export const _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h3a28bb1da68602c0: (a: number, b: number) => void;
45
- export const closure85_externref_shim: (a: number, b: number, c: any, d: any) => void;
44
+ export const _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h1ad07d0627257b45: (a: number, b: number) => void;
45
+ export const _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h96ccbfe273ba439a: (a: number, b: number) => void;
46
+ export const closure830_externref_shim: (a: number, b: number, c: any) => void;
47
+ export const closure989_externref_shim: (a: number, b: number, c: any, d: any) => void;
46
48
  export const __wbindgen_start: () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@filen/sdk-rs",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Filen WASM SDK using filen-sdk-rs",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -30,11 +30,12 @@
30
30
  "node": ">=23"
31
31
  },
32
32
  "devDependencies": {
33
+ "@zip.js/zip.js": "^2.7.72",
34
+ "dotenv": "^17.2.1",
33
35
  "typescript": "~5.8.3",
34
36
  "vite": "^7.1.2",
35
37
  "vite-plugin-top-level-await": "^1.6.0",
36
38
  "vite-plugin-wasm": "^3.5.0",
37
- "vitest": "^3.2.4",
38
- "dotenv": "^17.2.1"
39
+ "vitest": "^3.2.4"
39
40
  }
40
41
  }