@filen/sdk-rs 0.3.2 → 0.3.3

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,8 +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>;
5
3
  export function main_js(): void;
4
+ export function login(email: string, password: string, twoFactorCode?: string | null): Promise<Client>;
5
+ export function fromStringified(serialized: StringifiedClient): Client;
6
6
  /**
7
7
  * The `ReadableStreamType` enum.
8
8
  *
@@ -33,13 +33,21 @@ export interface DecryptedFileMeta {
33
33
 
34
34
  export type Item = File | Dir | Root;
35
35
 
36
- export type DirEnum = Dir | Root;
36
+ export interface StringifiedClient {
37
+ email: string;
38
+ rootUuid: string;
39
+ authInfo: string;
40
+ privateKey: string;
41
+ apiKey: string;
42
+ authVersion: number;
43
+ }
37
44
 
38
- export interface DecryptedDirMeta {
39
- name: string;
40
- created?: bigint;
45
+ export interface Root {
46
+ uuid: UuidStr;
41
47
  }
42
48
 
49
+ export type DirEnum = Dir | Root;
50
+
43
51
  export interface Dir {
44
52
  uuid: UuidStr;
45
53
  parent: ParentUuid;
@@ -48,45 +56,37 @@ export interface Dir {
48
56
  meta?: DecryptedDirMeta;
49
57
  }
50
58
 
51
- export interface Root {
52
- uuid: UuidStr;
53
- }
54
-
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;
59
+ export interface DecryptedDirMeta {
65
60
  name: string;
66
61
  created?: bigint;
67
- modified?: bigint;
68
- mime?: string;
69
62
  }
70
63
 
64
+ export type NonRootObject = ({ type: "dir" } & Dir) | ({ type: "file" } & File);
65
+
71
66
  export interface UploadFileStreamParams extends UploadFileParams {
72
67
  reader: ReadableStream<Uint8Array>;
73
68
  known_size: bigint | undefined;
74
69
  progress?: (bytes: bigint) => void;
75
70
  }
76
71
 
72
+ export interface DownloadFileToZipParams {
73
+ items: Item[];
74
+ writer: WritableStream<Uint8Array>;
75
+ progress?: (bytes: bigint) => void;
76
+ }
77
+
77
78
  export interface DownloadFileStreamParams {
78
79
  file: File;
79
80
  writer: WritableStream<Uint8Array>;
80
81
  progress?: (bytes: bigint) => void;
81
82
  }
82
83
 
83
- export interface StringifiedClient {
84
- email: string;
85
- rootUuid: string;
86
- authInfo: string;
87
- privateKey: string;
88
- apiKey: string;
89
- authVersion: number;
84
+ export interface UploadFileParams {
85
+ parent: DirEnum;
86
+ name: string;
87
+ created?: bigint;
88
+ modified?: bigint;
89
+ mime?: string;
90
90
  }
91
91
 
92
92
  export type ParentUuid = UuidStr | "trash" | "recents" | "favorites" | "links";
@@ -98,21 +98,21 @@ export type UuidStr = string;
98
98
  export class Client {
99
99
  private constructor();
100
100
  free(): void;
101
- findItemInDir(dir: DirEnum, nameOrUuid: string): Promise<NonRootObject | undefined>;
102
- listDir(dir: DirEnum): Promise<[Dir[], File[]]>;
103
- root(): Root;
104
101
  createDir(parent: DirEnum, name: string): Promise<Dir>;
105
- deleteDirPermanently(dir: Dir): Promise<void>;
102
+ findItemInDir(dir: DirEnum, nameOrUuid: string): Promise<NonRootObject | undefined>;
106
103
  trashDir(dir: Dir): Promise<Dir>;
104
+ deleteDirPermanently(dir: Dir): Promise<void>;
107
105
  dirExists(parent: DirEnum, name: string): Promise<void>;
106
+ root(): Root;
107
+ listDir(dir: DirEnum): Promise<[Dir[], File[]]>;
108
+ toStringified(): StringifiedClient;
108
109
  downloadItemsToZip(params: DownloadFileToZipParams): Promise<void>;
109
- uploadFileFromReader(params: UploadFileStreamParams): Promise<File>;
110
- deleteFilePermanently(file: File): Promise<void>;
111
- uploadFile(data: Uint8Array, params: UploadFileParams): Promise<File>;
112
110
  trashFile(file: File): Promise<File>;
113
- downloadFileToWriter(params: DownloadFileStreamParams): Promise<void>;
111
+ deleteFilePermanently(file: File): Promise<void>;
114
112
  downloadFile(file: File): Promise<Uint8Array>;
115
- toStringified(): StringifiedClient;
113
+ downloadFileToWriter(params: DownloadFileStreamParams): Promise<void>;
114
+ uploadFileFromReader(params: UploadFileStreamParams): Promise<File>;
115
+ uploadFile(data: Uint8Array, params: UploadFileParams): Promise<File>;
116
116
  }
117
117
  export class IntoUnderlyingByteSource {
118
118
  private constructor();
@@ -211,21 +211,8 @@ function debugString(val) {
211
211
  return className;
212
212
  }
213
213
 
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]);
214
+ export function main_js() {
215
+ wasm.main_js();
229
216
  }
230
217
 
231
218
  /**
@@ -245,8 +232,21 @@ export function login(email, password, twoFactorCode) {
245
232
  return ret;
246
233
  }
247
234
 
248
- export function main_js() {
249
- wasm.main_js();
235
+ function takeFromExternrefTable0(idx) {
236
+ const value = wasm.__wbindgen_export_4.get(idx);
237
+ wasm.__externref_table_dealloc(idx);
238
+ return value;
239
+ }
240
+ /**
241
+ * @param {StringifiedClient} serialized
242
+ * @returns {Client}
243
+ */
244
+ export function fromStringified(serialized) {
245
+ const ret = wasm.fromStringified(serialized);
246
+ if (ret[2]) {
247
+ throw takeFromExternrefTable0(ret[1]);
248
+ }
249
+ return Client.__wrap(ret[0]);
250
250
  }
251
251
 
252
252
  function passArray8ToWasm0(arg, malloc) {
@@ -264,11 +264,11 @@ function __wbg_adapter_61(arg0, arg1) {
264
264
  }
265
265
 
266
266
  function __wbg_adapter_64(arg0, arg1, arg2) {
267
- wasm.closure830_externref_shim(arg0, arg1, arg2);
267
+ wasm.closure843_externref_shim(arg0, arg1, arg2);
268
268
  }
269
269
 
270
270
  function __wbg_adapter_295(arg0, arg1, arg2, arg3) {
271
- wasm.closure989_externref_shim(arg0, arg1, arg2, arg3);
271
+ wasm.closure1002_externref_shim(arg0, arg1, arg2, arg3);
272
272
  }
273
273
 
274
274
  const __wbindgen_enum_ReadableStreamReaderMode = ["byob"];
@@ -304,6 +304,17 @@ export class Client {
304
304
  const ptr = this.__destroy_into_raw();
305
305
  wasm.__wbg_client_free(ptr, 0);
306
306
  }
307
+ /**
308
+ * @param {DirEnum} parent
309
+ * @param {string} name
310
+ * @returns {Promise<Dir>}
311
+ */
312
+ createDir(parent, name) {
313
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
314
+ const len0 = WASM_VECTOR_LEN;
315
+ const ret = wasm.client_createDir(this.__wbg_ptr, parent, ptr0, len0);
316
+ return ret;
317
+ }
307
318
  /**
308
319
  * @param {DirEnum} dir
309
320
  * @param {string} nameOrUuid
@@ -316,56 +327,52 @@ export class Client {
316
327
  return ret;
317
328
  }
318
329
  /**
319
- * @param {DirEnum} dir
320
- * @returns {[Dir[], File[]]}
330
+ * @param {Dir} dir
331
+ * @returns {Promise<Dir>}
321
332
  */
322
- listDir(dir) {
323
- const ret = wasm.client_listDir(this.__wbg_ptr, dir);
333
+ trashDir(dir) {
334
+ const ret = wasm.client_trashDir(this.__wbg_ptr, dir);
324
335
  return ret;
325
336
  }
326
337
  /**
327
- * @returns {Root}
338
+ * @param {Dir} dir
339
+ * @returns {Promise<void>}
328
340
  */
329
- root() {
330
- const ret = wasm.client_root(this.__wbg_ptr);
341
+ deleteDirPermanently(dir) {
342
+ const ret = wasm.client_deleteDirPermanently(this.__wbg_ptr, dir);
331
343
  return ret;
332
344
  }
333
345
  /**
334
346
  * @param {DirEnum} parent
335
347
  * @param {string} name
336
- * @returns {Promise<Dir>}
348
+ * @returns {Promise<void>}
337
349
  */
338
- createDir(parent, name) {
350
+ dirExists(parent, name) {
339
351
  const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
340
352
  const len0 = WASM_VECTOR_LEN;
341
- const ret = wasm.client_createDir(this.__wbg_ptr, parent, ptr0, len0);
353
+ const ret = wasm.client_dirExists(this.__wbg_ptr, parent, ptr0, len0);
342
354
  return ret;
343
355
  }
344
356
  /**
345
- * @param {Dir} dir
346
- * @returns {Promise<void>}
357
+ * @returns {Root}
347
358
  */
348
- deleteDirPermanently(dir) {
349
- const ret = wasm.client_deleteDirPermanently(this.__wbg_ptr, dir);
359
+ root() {
360
+ const ret = wasm.client_root(this.__wbg_ptr);
350
361
  return ret;
351
362
  }
352
363
  /**
353
- * @param {Dir} dir
354
- * @returns {Promise<Dir>}
364
+ * @param {DirEnum} dir
365
+ * @returns {[Dir[], File[]]}
355
366
  */
356
- trashDir(dir) {
357
- const ret = wasm.client_trashDir(this.__wbg_ptr, dir);
367
+ listDir(dir) {
368
+ const ret = wasm.client_listDir(this.__wbg_ptr, dir);
358
369
  return ret;
359
370
  }
360
371
  /**
361
- * @param {DirEnum} parent
362
- * @param {string} name
363
- * @returns {Promise<void>}
372
+ * @returns {StringifiedClient}
364
373
  */
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);
374
+ toStringified() {
375
+ const ret = wasm.client_toStringified(this.__wbg_ptr);
369
376
  return ret;
370
377
  }
371
378
  /**
@@ -377,11 +384,11 @@ export class Client {
377
384
  return ret;
378
385
  }
379
386
  /**
380
- * @param {UploadFileStreamParams} params
387
+ * @param {File} file
381
388
  * @returns {Promise<File>}
382
389
  */
383
- uploadFileFromReader(params) {
384
- const ret = wasm.client_uploadFileFromReader(this.__wbg_ptr, params);
390
+ trashFile(file) {
391
+ const ret = wasm.client_trashFile(this.__wbg_ptr, file);
385
392
  return ret;
386
393
  }
387
394
  /**
@@ -392,23 +399,12 @@ export class Client {
392
399
  const ret = wasm.client_deleteFilePermanently(this.__wbg_ptr, file);
393
400
  return ret;
394
401
  }
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);
404
- return ret;
405
- }
406
402
  /**
407
403
  * @param {File} file
408
- * @returns {Promise<File>}
404
+ * @returns {Promise<Uint8Array>}
409
405
  */
410
- trashFile(file) {
411
- const ret = wasm.client_trashFile(this.__wbg_ptr, file);
406
+ downloadFile(file) {
407
+ const ret = wasm.client_downloadFile(this.__wbg_ptr, file);
412
408
  return ret;
413
409
  }
414
410
  /**
@@ -420,18 +416,22 @@ export class Client {
420
416
  return ret;
421
417
  }
422
418
  /**
423
- * @param {File} file
424
- * @returns {Promise<Uint8Array>}
419
+ * @param {UploadFileStreamParams} params
420
+ * @returns {Promise<File>}
425
421
  */
426
- downloadFile(file) {
427
- const ret = wasm.client_downloadFile(this.__wbg_ptr, file);
422
+ uploadFileFromReader(params) {
423
+ const ret = wasm.client_uploadFileFromReader(this.__wbg_ptr, params);
428
424
  return ret;
429
425
  }
430
426
  /**
431
- * @returns {StringifiedClient}
427
+ * @param {Uint8Array} data
428
+ * @param {UploadFileParams} params
429
+ * @returns {Promise<File>}
432
430
  */
433
- toStringified() {
434
- const ret = wasm.client_toStringified(this.__wbg_ptr);
431
+ uploadFile(data, params) {
432
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
433
+ const len0 = WASM_VECTOR_LEN;
434
+ const ret = wasm.client_uploadFile(this.__wbg_ptr, ptr0, len0, params);
435
435
  return ret;
436
436
  }
437
437
  }
@@ -1245,18 +1245,18 @@ export function __wbindgen_cb_drop(arg0) {
1245
1245
  return ret;
1246
1246
  };
1247
1247
 
1248
- export function __wbindgen_closure_wrapper1729(arg0, arg1, arg2) {
1249
- const ret = makeMutClosure(arg0, arg1, 726, __wbg_adapter_58);
1248
+ export function __wbindgen_closure_wrapper1741(arg0, arg1, arg2) {
1249
+ const ret = makeMutClosure(arg0, arg1, 739, __wbg_adapter_58);
1250
1250
  return ret;
1251
1251
  };
1252
1252
 
1253
- export function __wbindgen_closure_wrapper1966(arg0, arg1, arg2) {
1254
- const ret = makeMutClosure(arg0, arg1, 791, __wbg_adapter_61);
1253
+ export function __wbindgen_closure_wrapper1980(arg0, arg1, arg2) {
1254
+ const ret = makeMutClosure(arg0, arg1, 804, __wbg_adapter_61);
1255
1255
  return ret;
1256
1256
  };
1257
1257
 
1258
- export function __wbindgen_closure_wrapper2082(arg0, arg1, arg2) {
1259
- const ret = makeMutClosure(arg0, arg1, 831, __wbg_adapter_64);
1258
+ export function __wbindgen_closure_wrapper2096(arg0, arg1, arg2) {
1259
+ const ret = makeMutClosure(arg0, arg1, 844, __wbg_adapter_64);
1260
1260
  return ret;
1261
1261
  };
1262
1262
 
Binary file
@@ -1,25 +1,25 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
+ export const fromStringified: (a: any) => [number, number, number];
4
5
  export const main_js: () => void;
5
6
  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
7
  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
8
  export const client_listDir: (a: number, b: any) => any;
12
9
  export const client_root: (a: number) => any;
10
+ export const client_findItemInDir: (a: number, b: any, c: number, d: number) => any;
11
+ export const client_createDir: (a: number, b: any, c: number, d: number) => any;
13
12
  export const client_deleteDirPermanently: (a: number, b: any) => any;
13
+ export const client_dirExists: (a: number, b: any, c: number, d: number) => any;
14
+ export const __wbg_client_free: (a: number, b: number) => void;
15
+ export const client_toStringified: (a: number) => any;
14
16
  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
17
  export const client_deleteFilePermanently: (a: number, b: any) => any;
18
+ export const client_downloadFileToWriter: (a: number, b: any) => any;
18
19
  export const client_uploadFileFromReader: (a: number, b: any) => any;
19
20
  export const client_downloadFile: (a: number, b: any) => any;
20
21
  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_trashFile: (a: number, b: any) => 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 closure843_externref_shim: (a: number, b: number, c: any) => void;
47
+ export const closure1002_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.3",
4
4
  "description": "Filen WASM SDK using filen-sdk-rs",
5
5
  "type": "module",
6
6
  "scripts": {