@filen/sdk-rs 0.3.1 → 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,51 +1,43 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- export function from_serialized(serialized: StringifiedClient): FilenState;
3
+ export function fromStringified(serialized: StringifiedClient): Client;
4
+ export function login(email: string, password: string, twoFactorCode?: string | null): Promise<Client>;
4
5
  export function main_js(): void;
5
- export function login(email: string, password: string, two_factor_code?: string | null): Promise<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
  *
30
9
  * *This API requires the following crate features to be activated: `ReadableStreamType`*
31
10
  */
32
11
  type ReadableStreamType = "bytes";
33
- export interface UploadFileStreamParams extends UploadFileParams {
34
- reader: ReadableStream<Uint8Array>;
35
- known_size?: bigint | undefined;
36
- progress?: (bytes: bigint) => void;
12
+ export interface File {
13
+ uuid: UuidStr;
14
+ meta?: DecryptedFileMeta;
15
+ parent: ParentUuid;
16
+ size: bigint;
17
+ favorited: boolean;
18
+ region: string;
19
+ bucket: string;
20
+ chunks: bigint;
37
21
  }
38
22
 
39
- export interface Root {
40
- uuid: UuidStr;
23
+ export interface DecryptedFileMeta {
24
+ name: string;
25
+ mime: string;
26
+ created?: bigint;
27
+ modified: bigint;
28
+ hash?: Uint8Array;
29
+ size: bigint;
30
+ key: string;
31
+ version: FileEncryptionVersion;
41
32
  }
42
33
 
43
- export type NonRootObject = ({ type: "dir" } & Dir) | ({ type: "file" } & File);
34
+ export type Item = File | Dir | Root;
44
35
 
45
- export interface DownloadFileStreamParams {
46
- file: File;
47
- writer: WritableStream<Uint8Array>;
48
- progress?: (bytes: bigint) => void;
36
+ export type DirEnum = Dir | Root;
37
+
38
+ export interface DecryptedDirMeta {
39
+ name: string;
40
+ created?: bigint;
49
41
  }
50
42
 
51
43
  export interface Dir {
@@ -56,22 +48,16 @@ export interface Dir {
56
48
  meta?: DecryptedDirMeta;
57
49
  }
58
50
 
59
- export interface DecryptedDirMeta {
60
- name: string;
61
- created?: bigint;
51
+ export interface Root {
52
+ uuid: UuidStr;
62
53
  }
63
54
 
64
- export type DirEnum = Dir | Root;
55
+ export type NonRootObject = ({ type: "dir" } & Dir) | ({ type: "file" } & File);
65
56
 
66
- export interface DecryptedFileMeta {
67
- name: string;
68
- mime: string;
69
- created?: bigint;
70
- modified: bigint;
71
- hash?: Uint8Array;
72
- size: bigint;
73
- key: string;
74
- version: FileEncryptionVersion;
57
+ export interface DownloadFileToZipParams {
58
+ items: Item[];
59
+ writer: WritableStream<Uint8Array>;
60
+ progress?: (bytes: bigint) => void;
75
61
  }
76
62
 
77
63
  export interface UploadFileParams {
@@ -82,15 +68,16 @@ export interface UploadFileParams {
82
68
  mime?: string;
83
69
  }
84
70
 
85
- export interface File {
86
- uuid: UuidStr;
87
- meta?: DecryptedFileMeta;
88
- parent: ParentUuid;
89
- size: bigint;
90
- favorited: boolean;
91
- region: string;
92
- bucket: string;
93
- chunks: bigint;
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
- dirExists(parent: DirEnum, name: string): Promise<void>;
110
- deleteDirPermanently(dir: Dir): Promise<void>;
111
- root(): Root;
101
+ findItemInDir(dir: DirEnum, nameOrUuid: string): Promise<NonRootObject | undefined>;
112
102
  listDir(dir: DirEnum): Promise<[Dir[], File[]]>;
113
- trashDir(dir: DirEnum): Promise<void>;
103
+ root(): Root;
114
104
  createDir(parent: DirEnum, name: string): Promise<Dir>;
115
- findItemInDir(dir: DirEnum, name_or_uuid: string): Promise<NonRootObject | undefined>;
116
- downloadFile(file: File): Promise<Uint8Array>;
105
+ deleteDirPermanently(dir: Dir): Promise<void>;
106
+ trashDir(dir: Dir): Promise<Dir>;
107
+ dirExists(parent: DirEnum, name: string): Promise<void>;
108
+ downloadItemsToZip(params: DownloadFileToZipParams): Promise<void>;
109
+ uploadFileFromReader(params: UploadFileStreamParams): Promise<File>;
117
110
  deleteFilePermanently(file: File): Promise<void>;
118
111
  uploadFile(data: Uint8Array, params: UploadFileParams): Promise<File>;
119
- uploadFileStream(params: UploadFileStreamParams): Promise<File>;
120
- trashFile(file: File): Promise<void>;
112
+ trashFile(file: File): Promise<File>;
121
113
  downloadFileToWriter(params: DownloadFileStreamParams): Promise<void>;
114
+ downloadFile(file: File): Promise<Uint8Array>;
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
 
@@ -222,196 +212,176 @@ function debugString(val) {
222
212
  }
223
213
 
224
214
  function takeFromExternrefTable0(idx) {
225
- const value = wasm.__wbindgen_export_2.get(idx);
215
+ const value = wasm.__wbindgen_export_4.get(idx);
226
216
  wasm.__externref_table_dealloc(idx);
227
217
  return value;
228
218
  }
229
219
  /**
230
220
  * @param {StringifiedClient} serialized
231
- * @returns {FilenState}
221
+ * @returns {Client}
232
222
  */
233
- export function from_serialized(serialized) {
234
- const ret = wasm.from_serialized(serialized);
223
+ export function fromStringified(serialized) {
224
+ const ret = wasm.fromStringified(serialized);
235
225
  if (ret[2]) {
236
226
  throw takeFromExternrefTable0(ret[1]);
237
227
  }
238
- return FilenState.__wrap(ret[0]);
239
- }
240
-
241
- export function main_js() {
242
- wasm.main_js();
228
+ return Client.__wrap(ret[0]);
243
229
  }
244
230
 
245
231
  /**
246
232
  * @param {string} email
247
233
  * @param {string} password
248
- * @param {string | null} [two_factor_code]
249
- * @returns {Promise<FilenState>}
234
+ * @param {string | null} [twoFactorCode]
235
+ * @returns {Promise<Client>}
250
236
  */
251
- export function login(email, password, two_factor_code) {
237
+ export function login(email, password, twoFactorCode) {
252
238
  const ptr0 = passStringToWasm0(email, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
253
239
  const len0 = WASM_VECTOR_LEN;
254
240
  const ptr1 = passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
255
241
  const len1 = WASM_VECTOR_LEN;
256
- 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);
257
243
  var len2 = WASM_VECTOR_LEN;
258
244
  const ret = wasm.login(ptr0, len0, ptr1, len1, ptr2, len2);
259
245
  return ret;
260
246
  }
261
247
 
248
+ export function main_js() {
249
+ wasm.main_js();
250
+ }
251
+
262
252
  function passArray8ToWasm0(arg, malloc) {
263
253
  const ptr = malloc(arg.length * 1, 1) >>> 0;
264
254
  getUint8ArrayMemory0().set(arg, ptr / 1);
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);
305
+ wasm.__wbg_client_free(ptr, 0);
337
306
  }
338
307
  /**
339
- * @returns {StringifiedClient}
340
- */
341
- serialize() {
342
- const ret = wasm.filenstate_serialize(this.__wbg_ptr);
343
- return ret;
344
- }
345
- /**
346
- * @param {DirEnum} parent
347
- * @param {string} name
348
- * @returns {Promise<void>}
308
+ * @param {DirEnum} dir
309
+ * @param {string} nameOrUuid
310
+ * @returns {Promise<NonRootObject | undefined>}
349
311
  */
350
- dirExists(parent, name) {
351
- const ptr0 = passStringToWasm0(name, 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_dirExists(this.__wbg_ptr, parent, ptr0, len0);
315
+ const ret = wasm.client_findItemInDir(this.__wbg_ptr, dir, ptr0, len0);
354
316
  return ret;
355
317
  }
356
318
  /**
357
- * @param {Dir} dir
358
- * @returns {Promise<void>}
319
+ * @param {DirEnum} dir
320
+ * @returns {[Dir[], File[]]}
359
321
  */
360
- deleteDirPermanently(dir) {
361
- const ret = wasm.filenstate_deleteDirPermanently(this.__wbg_ptr, dir);
322
+ listDir(dir) {
323
+ const ret = wasm.client_listDir(this.__wbg_ptr, dir);
362
324
  return ret;
363
325
  }
364
326
  /**
365
327
  * @returns {Root}
366
328
  */
367
329
  root() {
368
- const ret = wasm.filenstate_root(this.__wbg_ptr);
330
+ const ret = wasm.client_root(this.__wbg_ptr);
369
331
  return ret;
370
332
  }
371
333
  /**
372
- * @param {DirEnum} dir
373
- * @returns {[Dir[], File[]]}
334
+ * @param {DirEnum} parent
335
+ * @param {string} name
336
+ * @returns {Promise<Dir>}
374
337
  */
375
- listDir(dir) {
376
- const ret = wasm.filenstate_listDir(this.__wbg_ptr, dir);
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);
377
342
  return ret;
378
343
  }
379
344
  /**
380
- * @param {DirEnum} dir
345
+ * @param {Dir} dir
381
346
  * @returns {Promise<void>}
382
347
  */
348
+ deleteDirPermanently(dir) {
349
+ const ret = wasm.client_deleteDirPermanently(this.__wbg_ptr, dir);
350
+ return ret;
351
+ }
352
+ /**
353
+ * @param {Dir} dir
354
+ * @returns {Promise<Dir>}
355
+ */
383
356
  trashDir(dir) {
384
- const ret = wasm.filenstate_trashDir(this.__wbg_ptr, dir);
357
+ const ret = wasm.client_trashDir(this.__wbg_ptr, dir);
385
358
  return ret;
386
359
  }
387
360
  /**
388
361
  * @param {DirEnum} parent
389
362
  * @param {string} name
390
- * @returns {Promise<Dir>}
363
+ * @returns {Promise<void>}
391
364
  */
392
- createDir(parent, name) {
365
+ dirExists(parent, name) {
393
366
  const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
394
367
  const len0 = WASM_VECTOR_LEN;
395
- const ret = wasm.filenstate_createDir(this.__wbg_ptr, parent, ptr0, len0);
368
+ const ret = wasm.client_dirExists(this.__wbg_ptr, parent, ptr0, len0);
396
369
  return ret;
397
370
  }
398
371
  /**
399
- * @param {DirEnum} dir
400
- * @param {string} name_or_uuid
401
- * @returns {Promise<NonRootObject | undefined>}
372
+ * @param {DownloadFileToZipParams} params
373
+ * @returns {Promise<void>}
402
374
  */
403
- findItemInDir(dir, name_or_uuid) {
404
- const ptr0 = passStringToWasm0(name_or_uuid, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
405
- const len0 = WASM_VECTOR_LEN;
406
- const ret = wasm.filenstate_findItemInDir(this.__wbg_ptr, dir, ptr0, len0);
375
+ downloadItemsToZip(params) {
376
+ const ret = wasm.client_downloadItemsToZip(this.__wbg_ptr, params);
407
377
  return ret;
408
378
  }
409
379
  /**
410
- * @param {File} file
411
- * @returns {Promise<Uint8Array>}
380
+ * @param {UploadFileStreamParams} params
381
+ * @returns {Promise<File>}
412
382
  */
413
- downloadFile(file) {
414
- const ret = wasm.filenstate_downloadFile(this.__wbg_ptr, file);
383
+ uploadFileFromReader(params) {
384
+ const ret = wasm.client_uploadFileFromReader(this.__wbg_ptr, params);
415
385
  return ret;
416
386
  }
417
387
  /**
@@ -419,7 +389,7 @@ export class FilenState {
419
389
  * @returns {Promise<void>}
420
390
  */
421
391
  deleteFilePermanently(file) {
422
- const ret = wasm.filenstate_deleteFilePermanently(this.__wbg_ptr, file);
392
+ const ret = wasm.client_deleteFilePermanently(this.__wbg_ptr, file);
423
393
  return ret;
424
394
  }
425
395
  /**
@@ -430,31 +400,38 @@ export class FilenState {
430
400
  uploadFile(data, params) {
431
401
  const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
432
402
  const len0 = WASM_VECTOR_LEN;
433
- const ret = wasm.filenstate_uploadFile(this.__wbg_ptr, ptr0, len0, params);
403
+ const ret = wasm.client_uploadFile(this.__wbg_ptr, ptr0, len0, params);
434
404
  return ret;
435
405
  }
436
406
  /**
437
- * @param {UploadFileStreamParams} params
407
+ * @param {File} file
438
408
  * @returns {Promise<File>}
439
409
  */
440
- uploadFileStream(params) {
441
- const ret = wasm.filenstate_uploadFileStream(this.__wbg_ptr, params);
410
+ trashFile(file) {
411
+ const ret = wasm.client_trashFile(this.__wbg_ptr, file);
442
412
  return ret;
443
413
  }
444
414
  /**
445
- * @param {File} file
415
+ * @param {DownloadFileStreamParams} params
446
416
  * @returns {Promise<void>}
447
417
  */
448
- trashFile(file) {
449
- const ret = wasm.filenstate_trashFile(this.__wbg_ptr, file);
418
+ downloadFileToWriter(params) {
419
+ const ret = wasm.client_downloadFileToWriter(this.__wbg_ptr, params);
450
420
  return ret;
451
421
  }
452
422
  /**
453
- * @param {DownloadFileStreamParams} params
454
- * @returns {Promise<void>}
423
+ * @param {File} file
424
+ * @returns {Promise<Uint8Array>}
455
425
  */
456
- downloadFileToWriter(params) {
457
- const ret = wasm.filenstate_downloadFileToWriter(this.__wbg_ptr, params);
426
+ downloadFile(file) {
427
+ const ret = wasm.client_downloadFile(this.__wbg_ptr, file);
428
+ return ret;
429
+ }
430
+ /**
431
+ * @returns {StringifiedClient}
432
+ */
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_wrapper230(arg0, arg1, arg2) {
1281
- const ret = makeMutClosure(arg0, arg1, 110, __wbg_adapter_58);
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_wrapper2407(arg0, arg1, arg2) {
1286
- const ret = makeMutClosure(arg0, arg1, 102, __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_wrapper2703(arg0, arg1, arg2) {
1291
- const ret = makeMutClosure(arg0, arg1, 110, __wbg_adapter_61);
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 login: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
5
- export const from_serialized: (a: any) => [number, number, number];
6
- export const filenstate_serialize: (a: number) => any;
7
4
  export const main_js: () => void;
8
- export const __wbg_filenstate_free: (a: number, b: number) => void;
9
- export const filenstate_listDir: (a: number, b: any) => any;
10
- export const filenstate_createDir: (a: number, b: any, c: number, d: number) => any;
11
- export const filenstate_deleteDirPermanently: (a: number, b: any) => any;
12
- export const filenstate_trashDir: (a: number, b: any) => any;
13
- export const filenstate_dirExists: (a: number, b: any, c: number, d: number) => any;
14
- export const filenstate_findItemInDir: (a: number, b: any, c: number, d: number) => any;
15
- export const filenstate_root: (a: number) => any;
16
- export const filenstate_uploadFileStream: (a: number, b: any) => any;
17
- export const filenstate_downloadFile: (a: number, b: any) => any;
18
- export const filenstate_downloadFileToWriter: (a: number, b: any) => any;
19
- export const filenstate_trashFile: (a: number, b: any) => any;
20
- export const filenstate_deleteFilePermanently: (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.1",
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
  }