@filen/sdk-rs 0.3.2 → 0.3.4

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.
@@ -9,15 +9,13 @@ export function main_js(): void;
9
9
  * *This API requires the following crate features to be activated: `ReadableStreamType`*
10
10
  */
11
11
  type ReadableStreamType = "bytes";
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;
12
+ export interface StringifiedClient {
13
+ email: string;
14
+ rootUuid: string;
15
+ authInfo: string;
16
+ privateKey: string;
17
+ apiKey: string;
18
+ authVersion: number;
21
19
  }
22
20
 
23
21
  export interface DecryptedFileMeta {
@@ -31,41 +29,26 @@ export interface DecryptedFileMeta {
31
29
  version: FileEncryptionVersion;
32
30
  }
33
31
 
34
- export type Item = File | Dir | Root;
35
-
36
- export type DirEnum = Dir | Root;
37
-
38
- export interface DecryptedDirMeta {
39
- name: string;
40
- created?: bigint;
41
- }
42
-
43
- export interface Dir {
32
+ export interface File {
44
33
  uuid: UuidStr;
34
+ meta?: DecryptedFileMeta;
45
35
  parent: ParentUuid;
46
- color?: string;
36
+ size: bigint;
47
37
  favorited: boolean;
48
- meta?: DecryptedDirMeta;
49
- }
50
-
51
- export interface Root {
52
- uuid: UuidStr;
38
+ region: string;
39
+ bucket: string;
40
+ chunks: bigint;
53
41
  }
54
42
 
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
- }
43
+ export type AbortSignal = AbortSignal;
62
44
 
63
45
  export interface UploadFileParams {
64
46
  parent: DirEnum;
65
47
  name: string;
66
48
  created?: bigint;
67
49
  modified?: bigint;
68
- mime?: string;
50
+ mime?: string | undefined;
51
+ abortSignal?: AbortSignal;
69
52
  }
70
53
 
71
54
  export interface UploadFileStreamParams extends UploadFileParams {
@@ -78,17 +61,39 @@ export interface DownloadFileStreamParams {
78
61
  file: File;
79
62
  writer: WritableStream<Uint8Array>;
80
63
  progress?: (bytes: bigint) => void;
64
+ abort_signal?: AbortSignal;
81
65
  }
82
66
 
83
- export interface StringifiedClient {
84
- email: string;
85
- rootUuid: string;
86
- authInfo: string;
87
- privateKey: string;
88
- apiKey: string;
89
- authVersion: number;
67
+ export interface DownloadFileToZipParams {
68
+ items: Item[];
69
+ writer: WritableStream<Uint8Array>;
70
+ progress?: (bytes: bigint) => void;
71
+ abort_signal?: AbortSignal;
90
72
  }
91
73
 
74
+ export interface Root {
75
+ uuid: UuidStr;
76
+ }
77
+
78
+ export type DirEnum = Dir | Root;
79
+
80
+ export interface DecryptedDirMeta {
81
+ name: string;
82
+ created?: bigint;
83
+ }
84
+
85
+ export interface Dir {
86
+ uuid: UuidStr;
87
+ parent: ParentUuid;
88
+ color?: string;
89
+ favorited: boolean;
90
+ meta?: DecryptedDirMeta;
91
+ }
92
+
93
+ export type NonRootObject = ({ type: "dir" } & Dir) | ({ type: "file" } & File);
94
+
95
+ export type Item = File | Dir | Root;
96
+
92
97
  export type ParentUuid = UuidStr | "trash" | "recents" | "favorites" | "links";
93
98
 
94
99
  export type FileEncryptionVersion = 1 | 2 | 3;
@@ -98,21 +103,21 @@ export type UuidStr = string;
98
103
  export class Client {
99
104
  private constructor();
100
105
  free(): 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>;
105
- deleteDirPermanently(dir: Dir): Promise<void>;
106
- trashDir(dir: Dir): Promise<Dir>;
107
- dirExists(parent: DirEnum, name: string): Promise<void>;
106
+ toStringified(): StringifiedClient;
108
107
  downloadItemsToZip(params: DownloadFileToZipParams): Promise<void>;
108
+ downloadFileToWriter(params: DownloadFileStreamParams): Promise<void>;
109
+ trashFile(file: File): Promise<File>;
110
+ downloadFile(file: File): Promise<Uint8Array>;
109
111
  uploadFileFromReader(params: UploadFileStreamParams): Promise<File>;
110
112
  deleteFilePermanently(file: File): Promise<void>;
111
113
  uploadFile(data: Uint8Array, params: UploadFileParams): Promise<File>;
112
- trashFile(file: File): Promise<File>;
113
- downloadFileToWriter(params: DownloadFileStreamParams): Promise<void>;
114
- downloadFile(file: File): Promise<Uint8Array>;
115
- toStringified(): StringifiedClient;
114
+ listDir(dir: DirEnum): Promise<[Dir[], File[]]>;
115
+ root(): Root;
116
+ findItemInDir(dir: DirEnum, nameOrUuid: string): Promise<NonRootObject | undefined>;
117
+ trashDir(dir: Dir): Promise<Dir>;
118
+ deleteDirPermanently(dir: Dir): Promise<void>;
119
+ dirExists(parent: DirEnum, name: string): Promise<void>;
120
+ createDir(parent: DirEnum, name: string): Promise<Dir>;
116
121
  }
117
122
  export class IntoUnderlyingByteSource {
118
123
  private constructor();
@@ -211,6 +211,13 @@ function debugString(val) {
211
211
  return className;
212
212
  }
213
213
 
214
+ function passArray8ToWasm0(arg, malloc) {
215
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
216
+ getUint8ArrayMemory0().set(arg, ptr / 1);
217
+ WASM_VECTOR_LEN = arg.length;
218
+ return ptr;
219
+ }
220
+
214
221
  function takeFromExternrefTable0(idx) {
215
222
  const value = wasm.__wbindgen_export_4.get(idx);
216
223
  wasm.__externref_table_dealloc(idx);
@@ -249,26 +256,20 @@ export function main_js() {
249
256
  wasm.main_js();
250
257
  }
251
258
 
252
- function passArray8ToWasm0(arg, malloc) {
253
- const ptr = malloc(arg.length * 1, 1) >>> 0;
254
- getUint8ArrayMemory0().set(arg, ptr / 1);
255
- WASM_VECTOR_LEN = arg.length;
256
- return ptr;
257
- }
258
- function __wbg_adapter_58(arg0, arg1) {
259
+ function __wbg_adapter_60(arg0, arg1) {
259
260
  wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h1ad07d0627257b45(arg0, arg1);
260
261
  }
261
262
 
262
- function __wbg_adapter_61(arg0, arg1) {
263
+ function __wbg_adapter_63(arg0, arg1) {
263
264
  wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h96ccbfe273ba439a(arg0, arg1);
264
265
  }
265
266
 
266
- function __wbg_adapter_64(arg0, arg1, arg2) {
267
- wasm.closure830_externref_shim(arg0, arg1, arg2);
267
+ function __wbg_adapter_66(arg0, arg1, arg2) {
268
+ wasm.closure837_externref_shim(arg0, arg1, arg2);
268
269
  }
269
270
 
270
- function __wbg_adapter_295(arg0, arg1, arg2, arg3) {
271
- wasm.closure989_externref_shim(arg0, arg1, arg2, arg3);
271
+ function __wbg_adapter_303(arg0, arg1, arg2, arg3) {
272
+ wasm.closure996_externref_shim(arg0, arg1, arg2, arg3);
272
273
  }
273
274
 
274
275
  const __wbindgen_enum_ReadableStreamReaderMode = ["byob"];
@@ -305,75 +306,42 @@ export class Client {
305
306
  wasm.__wbg_client_free(ptr, 0);
306
307
  }
307
308
  /**
308
- * @param {DirEnum} dir
309
- * @param {string} nameOrUuid
310
- * @returns {Promise<NonRootObject | undefined>}
311
- */
312
- findItemInDir(dir, nameOrUuid) {
313
- const ptr0 = passStringToWasm0(nameOrUuid, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
314
- const len0 = WASM_VECTOR_LEN;
315
- const ret = wasm.client_findItemInDir(this.__wbg_ptr, dir, ptr0, len0);
316
- return ret;
317
- }
318
- /**
319
- * @param {DirEnum} dir
320
- * @returns {[Dir[], File[]]}
321
- */
322
- listDir(dir) {
323
- const ret = wasm.client_listDir(this.__wbg_ptr, dir);
324
- return ret;
325
- }
326
- /**
327
- * @returns {Root}
328
- */
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>}
309
+ * @returns {StringifiedClient}
337
310
  */
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);
311
+ toStringified() {
312
+ const ret = wasm.client_toStringified(this.__wbg_ptr);
342
313
  return ret;
343
314
  }
344
315
  /**
345
- * @param {Dir} dir
316
+ * @param {DownloadFileToZipParams} params
346
317
  * @returns {Promise<void>}
347
318
  */
348
- deleteDirPermanently(dir) {
349
- const ret = wasm.client_deleteDirPermanently(this.__wbg_ptr, dir);
319
+ downloadItemsToZip(params) {
320
+ const ret = wasm.client_downloadItemsToZip(this.__wbg_ptr, params);
350
321
  return ret;
351
322
  }
352
323
  /**
353
- * @param {Dir} dir
354
- * @returns {Promise<Dir>}
324
+ * @param {DownloadFileStreamParams} params
325
+ * @returns {Promise<void>}
355
326
  */
356
- trashDir(dir) {
357
- const ret = wasm.client_trashDir(this.__wbg_ptr, dir);
327
+ downloadFileToWriter(params) {
328
+ const ret = wasm.client_downloadFileToWriter(this.__wbg_ptr, params);
358
329
  return ret;
359
330
  }
360
331
  /**
361
- * @param {DirEnum} parent
362
- * @param {string} name
363
- * @returns {Promise<void>}
332
+ * @param {File} file
333
+ * @returns {Promise<File>}
364
334
  */
365
- dirExists(parent, name) {
366
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
367
- const len0 = WASM_VECTOR_LEN;
368
- const ret = wasm.client_dirExists(this.__wbg_ptr, parent, ptr0, len0);
335
+ trashFile(file) {
336
+ const ret = wasm.client_trashFile(this.__wbg_ptr, file);
369
337
  return ret;
370
338
  }
371
339
  /**
372
- * @param {DownloadFileToZipParams} params
373
- * @returns {Promise<void>}
340
+ * @param {File} file
341
+ * @returns {Promise<Uint8Array>}
374
342
  */
375
- downloadItemsToZip(params) {
376
- const ret = wasm.client_downloadItemsToZip(this.__wbg_ptr, params);
343
+ downloadFile(file) {
344
+ const ret = wasm.client_downloadFile(this.__wbg_ptr, file);
377
345
  return ret;
378
346
  }
379
347
  /**
@@ -404,34 +372,67 @@ export class Client {
404
372
  return ret;
405
373
  }
406
374
  /**
407
- * @param {File} file
408
- * @returns {Promise<File>}
375
+ * @param {DirEnum} dir
376
+ * @returns {[Dir[], File[]]}
409
377
  */
410
- trashFile(file) {
411
- const ret = wasm.client_trashFile(this.__wbg_ptr, file);
378
+ listDir(dir) {
379
+ const ret = wasm.client_listDir(this.__wbg_ptr, dir);
412
380
  return ret;
413
381
  }
414
382
  /**
415
- * @param {DownloadFileStreamParams} params
383
+ * @returns {Root}
384
+ */
385
+ root() {
386
+ const ret = wasm.client_root(this.__wbg_ptr);
387
+ return ret;
388
+ }
389
+ /**
390
+ * @param {DirEnum} dir
391
+ * @param {string} nameOrUuid
392
+ * @returns {Promise<NonRootObject | undefined>}
393
+ */
394
+ findItemInDir(dir, nameOrUuid) {
395
+ const ptr0 = passStringToWasm0(nameOrUuid, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
396
+ const len0 = WASM_VECTOR_LEN;
397
+ const ret = wasm.client_findItemInDir(this.__wbg_ptr, dir, ptr0, len0);
398
+ return ret;
399
+ }
400
+ /**
401
+ * @param {Dir} dir
402
+ * @returns {Promise<Dir>}
403
+ */
404
+ trashDir(dir) {
405
+ const ret = wasm.client_trashDir(this.__wbg_ptr, dir);
406
+ return ret;
407
+ }
408
+ /**
409
+ * @param {Dir} dir
416
410
  * @returns {Promise<void>}
417
411
  */
418
- downloadFileToWriter(params) {
419
- const ret = wasm.client_downloadFileToWriter(this.__wbg_ptr, params);
412
+ deleteDirPermanently(dir) {
413
+ const ret = wasm.client_deleteDirPermanently(this.__wbg_ptr, dir);
420
414
  return ret;
421
415
  }
422
416
  /**
423
- * @param {File} file
424
- * @returns {Promise<Uint8Array>}
417
+ * @param {DirEnum} parent
418
+ * @param {string} name
419
+ * @returns {Promise<void>}
425
420
  */
426
- downloadFile(file) {
427
- const ret = wasm.client_downloadFile(this.__wbg_ptr, file);
421
+ dirExists(parent, name) {
422
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
423
+ const len0 = WASM_VECTOR_LEN;
424
+ const ret = wasm.client_dirExists(this.__wbg_ptr, parent, ptr0, len0);
428
425
  return ret;
429
426
  }
430
427
  /**
431
- * @returns {StringifiedClient}
428
+ * @param {DirEnum} parent
429
+ * @param {string} name
430
+ * @returns {Promise<Dir>}
432
431
  */
433
- toStringified() {
434
- const ret = wasm.client_toStringified(this.__wbg_ptr);
432
+ createDir(parent, name) {
433
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
434
+ const len0 = WASM_VECTOR_LEN;
435
+ const ret = wasm.client_createDir(this.__wbg_ptr, parent, ptr0, len0);
435
436
  return ret;
436
437
  }
437
438
  }
@@ -578,6 +579,11 @@ export function __wbg_abort_775ef1d17fc65868(arg0) {
578
579
  arg0.abort();
579
580
  };
580
581
 
582
+ export function __wbg_aborted_c078e36031795a9a(arg0) {
583
+ const ret = arg0.aborted;
584
+ return ret;
585
+ };
586
+
581
587
  export function __wbg_append_8c7dd8d641a5f01b() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
582
588
  arg0.append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
583
589
  }, arguments) };
@@ -785,6 +791,17 @@ export function __wbg_info_033d8b8a0838f1d3(arg0, arg1, arg2, arg3) {
785
791
  console.info(arg0, arg1, arg2, arg3);
786
792
  };
787
793
 
794
+ export function __wbg_instanceof_AbortSignal_ec9211148136acd1(arg0) {
795
+ let result;
796
+ try {
797
+ result = arg0 instanceof AbortSignal;
798
+ } catch (_) {
799
+ result = false;
800
+ }
801
+ const ret = result;
802
+ return ret;
803
+ };
804
+
788
805
  export function __wbg_instanceof_ArrayBuffer_e14585432e3737fc(arg0) {
789
806
  let result;
790
807
  try {
@@ -902,7 +919,7 @@ export function __wbg_new_23a2665fac83c611(arg0, arg1) {
902
919
  const a = state0.a;
903
920
  state0.a = 0;
904
921
  try {
905
- return __wbg_adapter_295(a, state0.b, arg0, arg1);
922
+ return __wbg_adapter_303(a, state0.b, arg0, arg1);
906
923
  } finally {
907
924
  state0.a = a;
908
925
  }
@@ -1099,6 +1116,10 @@ export function __wbg_setmode_5dc300b865044b65(arg0, arg1) {
1099
1116
  arg0.mode = __wbindgen_enum_RequestMode[arg1];
1100
1117
  };
1101
1118
 
1119
+ export function __wbg_setonabort_a12865ed9905809a(arg0, arg1) {
1120
+ arg0.onabort = arg1;
1121
+ };
1122
+
1102
1123
  export function __wbg_setsignal_75b21ef3a81de905(arg0, arg1) {
1103
1124
  arg0.signal = arg1;
1104
1125
  };
@@ -1245,18 +1266,18 @@ export function __wbindgen_cb_drop(arg0) {
1245
1266
  return ret;
1246
1267
  };
1247
1268
 
1248
- export function __wbindgen_closure_wrapper1729(arg0, arg1, arg2) {
1249
- const ret = makeMutClosure(arg0, arg1, 726, __wbg_adapter_58);
1269
+ export function __wbindgen_closure_wrapper1759(arg0, arg1, arg2) {
1270
+ const ret = makeMutClosure(arg0, arg1, 733, __wbg_adapter_60);
1250
1271
  return ret;
1251
1272
  };
1252
1273
 
1253
- export function __wbindgen_closure_wrapper1966(arg0, arg1, arg2) {
1254
- const ret = makeMutClosure(arg0, arg1, 791, __wbg_adapter_61);
1274
+ export function __wbindgen_closure_wrapper2007(arg0, arg1, arg2) {
1275
+ const ret = makeMutClosure(arg0, arg1, 798, __wbg_adapter_63);
1255
1276
  return ret;
1256
1277
  };
1257
1278
 
1258
- export function __wbindgen_closure_wrapper2082(arg0, arg1, arg2) {
1259
- const ret = makeMutClosure(arg0, arg1, 831, __wbg_adapter_64);
1279
+ export function __wbindgen_closure_wrapper2123(arg0, arg1, arg2) {
1280
+ const ret = makeMutClosure(arg0, arg1, 838, __wbg_adapter_66);
1260
1281
  return ret;
1261
1282
  };
1262
1283
 
@@ -1360,6 +1381,11 @@ export function __wbindgen_throw(arg0, arg1) {
1360
1381
  throw new Error(getStringFromWasm0(arg0, arg1));
1361
1382
  };
1362
1383
 
1384
+ export function __wbindgen_typeof(arg0) {
1385
+ const ret = typeof arg0;
1386
+ return ret;
1387
+ };
1388
+
1363
1389
  export function __wbindgen_uint8_array_new(arg0, arg1) {
1364
1390
  var v0 = getArrayU8FromWasm0(arg0, arg1).slice();
1365
1391
  wasm.__wbindgen_free(arg0, arg1 * 1, 1);
Binary file
@@ -1,25 +1,25 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
+ export const client_toStringified: (a: number) => any;
5
+ export const __wbg_client_free: (a: number, b: number) => void;
6
+ export const client_downloadItemsToZip: (a: number, b: any) => any;
7
+ export const client_trashFile: (a: number, b: any) => any;
8
+ export const client_downloadFile: (a: number, b: any) => any;
9
+ export const client_downloadFileToWriter: (a: number, b: any) => any;
10
+ export const client_uploadFileFromReader: (a: number, b: any) => any;
11
+ export const client_uploadFile: (a: number, b: number, c: number, d: any) => any;
12
+ export const client_deleteFilePermanently: (a: number, b: any) => any;
4
13
  export const main_js: () => void;
5
- export const login: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
6
14
  export const fromStringified: (a: any) => [number, number, number];
7
- export const client_dirExists: (a: number, b: any, c: number, d: number) => any;
15
+ export const login: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
8
16
  export const client_trashDir: (a: number, b: any) => any;
9
17
  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;
18
+ export const client_dirExists: (a: number, b: any, c: number, d: number) => any;
11
19
  export const client_listDir: (a: number, b: any) => any;
12
- export const client_root: (a: number) => any;
20
+ export const client_findItemInDir: (a: number, b: any, c: number, d: number) => any;
13
21
  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;
22
+ export const client_root: (a: number) => any;
23
23
  export const __wbg_intounderlyingsource_free: (a: number, b: number) => void;
24
24
  export const intounderlyingsource_cancel: (a: number) => void;
25
25
  export const intounderlyingsource_pull: (a: number, b: any) => any;
@@ -43,6 +43,6 @@ export const __wbindgen_export_6: WebAssembly.Table;
43
43
  export const __externref_table_dealloc: (a: number) => void;
44
44
  export const _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h1ad07d0627257b45: (a: number, b: number) => void;
45
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
+ export const closure837_externref_shim: (a: number, b: number, c: any) => void;
47
+ export const closure996_externref_shim: (a: number, b: number, c: any, d: any) => void;
48
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.2",
3
+ "version": "0.3.4",
4
4
  "description": "Filen WASM SDK using filen-sdk-rs",
5
5
  "type": "module",
6
6
  "scripts": {