@filen/sdk-rs 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+ export function from_serialized(serialized: StringifiedClient): FilenState;
3
4
  export function main_js(): void;
4
5
  export function login(email: string, password: string, two_factor_code?: string | null): Promise<FilenState>;
5
- export function from_serialized(serialized: StringifiedClient): FilenState;
6
6
  /**
7
7
  * Chroma subsampling format
8
8
  */
@@ -30,41 +30,24 @@ export enum ChromaSampling {
30
30
  * *This API requires the following crate features to be activated: `ReadableStreamType`*
31
31
  */
32
32
  type ReadableStreamType = "bytes";
33
- export interface File {
34
- uuid: UuidStr;
35
- meta?: DecryptedFileMeta;
36
- parent: ParentUuid;
37
- size: bigint;
38
- favorited: boolean;
39
- region: string;
40
- bucket: string;
41
- chunks: bigint;
42
- }
43
-
44
33
  export interface UploadFileStreamParams extends UploadFileParams {
45
34
  reader: ReadableStream<Uint8Array>;
46
35
  known_size?: bigint | undefined;
47
36
  progress?: (bytes: bigint) => void;
48
37
  }
49
38
 
50
- export interface UploadFileParams {
51
- parent: DirEnum;
52
- name: string;
53
- created?: bigint;
54
- modified?: bigint;
55
- mime?: string;
39
+ export interface Root {
40
+ uuid: UuidStr;
56
41
  }
57
42
 
43
+ export type NonRootObject = ({ type: "dir" } & Dir) | ({ type: "file" } & File);
44
+
58
45
  export interface DownloadFileStreamParams {
59
46
  file: File;
60
47
  writer: WritableStream<Uint8Array>;
61
48
  progress?: (bytes: bigint) => void;
62
49
  }
63
50
 
64
- export type DirEnum = Dir | Root;
65
-
66
- export type NonRootObject = ({ type: "dir" } & Dir) | ({ type: "file" } & File);
67
-
68
51
  export interface Dir {
69
52
  uuid: UuidStr;
70
53
  parent: ParentUuid;
@@ -78,6 +61,8 @@ export interface DecryptedDirMeta {
78
61
  created?: bigint;
79
62
  }
80
63
 
64
+ export type DirEnum = Dir | Root;
65
+
81
66
  export interface DecryptedFileMeta {
82
67
  name: string;
83
68
  mime: string;
@@ -89,8 +74,23 @@ export interface DecryptedFileMeta {
89
74
  version: FileEncryptionVersion;
90
75
  }
91
76
 
92
- export interface Root {
77
+ export interface UploadFileParams {
78
+ parent: DirEnum;
79
+ name: string;
80
+ created?: bigint;
81
+ modified?: bigint;
82
+ mime?: string;
83
+ }
84
+
85
+ export interface File {
93
86
  uuid: UuidStr;
87
+ meta?: DecryptedFileMeta;
88
+ parent: ParentUuid;
89
+ size: bigint;
90
+ favorited: boolean;
91
+ region: string;
92
+ bucket: string;
93
+ chunks: bigint;
94
94
  }
95
95
 
96
96
  export interface StringifiedClient {
@@ -106,19 +106,19 @@ export class FilenState {
106
106
  private constructor();
107
107
  free(): void;
108
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>;
112
- deleteDirPermanently(dir: Dir): Promise<void>;
113
109
  dirExists(parent: DirEnum, name: string): Promise<void>;
114
- createDir(parent: DirEnum, name: string): Promise<Dir>;
110
+ deleteDirPermanently(dir: Dir): Promise<void>;
115
111
  root(): Root;
112
+ listDir(dir: DirEnum): Promise<[Dir[], File[]]>;
113
+ trashDir(dir: DirEnum): Promise<void>;
114
+ createDir(parent: DirEnum, name: string): Promise<Dir>;
115
+ findItemInDir(dir: DirEnum, name_or_uuid: string): Promise<NonRootObject | undefined>;
116
+ downloadFile(file: File): Promise<Uint8Array>;
117
+ deleteFilePermanently(file: File): Promise<void>;
118
+ uploadFile(data: Uint8Array, params: UploadFileParams): Promise<File>;
116
119
  uploadFileStream(params: UploadFileStreamParams): Promise<File>;
117
120
  trashFile(file: File): Promise<void>;
118
- deleteFilePermanently(file: File): Promise<void>;
119
121
  downloadFileToWriter(params: DownloadFileStreamParams): Promise<void>;
120
- downloadFile(file: File): Promise<Uint8Array>;
121
- uploadFile(data: Uint8Array, params: UploadFileParams): Promise<File>;
122
122
  }
123
123
  export class IntoUnderlyingByteSource {
124
124
  private constructor();
@@ -221,6 +221,23 @@ function debugString(val) {
221
221
  return className;
222
222
  }
223
223
 
224
+ function takeFromExternrefTable0(idx) {
225
+ const value = wasm.__wbindgen_export_2.get(idx);
226
+ wasm.__externref_table_dealloc(idx);
227
+ return value;
228
+ }
229
+ /**
230
+ * @param {StringifiedClient} serialized
231
+ * @returns {FilenState}
232
+ */
233
+ export function from_serialized(serialized) {
234
+ const ret = wasm.from_serialized(serialized);
235
+ if (ret[2]) {
236
+ throw takeFromExternrefTable0(ret[1]);
237
+ }
238
+ return FilenState.__wrap(ret[0]);
239
+ }
240
+
224
241
  export function main_js() {
225
242
  wasm.main_js();
226
243
  }
@@ -242,23 +259,6 @@ export function login(email, password, two_factor_code) {
242
259
  return ret;
243
260
  }
244
261
 
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]);
260
- }
261
-
262
262
  function passArray8ToWasm0(arg, malloc) {
263
263
  const ptr = malloc(arg.length * 1, 1) >>> 0;
264
264
  getUint8ArrayMemory0().set(arg, ptr / 1);
@@ -343,49 +343,45 @@ export class FilenState {
343
343
  return ret;
344
344
  }
345
345
  /**
346
- * @param {DirEnum} dir
347
- * @param {string} name_or_uuid
348
- * @returns {Promise<NonRootObject | undefined>}
346
+ * @param {DirEnum} parent
347
+ * @param {string} name
348
+ * @returns {Promise<void>}
349
349
  */
350
- findItemInDir(dir, name_or_uuid) {
351
- const ptr0 = passStringToWasm0(name_or_uuid, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
350
+ dirExists(parent, name) {
351
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
352
352
  const len0 = WASM_VECTOR_LEN;
353
- const ret = wasm.filenstate_findItemInDir(this.__wbg_ptr, dir, ptr0, len0);
353
+ const ret = wasm.filenstate_dirExists(this.__wbg_ptr, parent, ptr0, len0);
354
354
  return ret;
355
355
  }
356
356
  /**
357
- * @param {DirEnum} dir
358
- * @returns {[DirEnum[], File[]]}
357
+ * @param {Dir} dir
358
+ * @returns {Promise<void>}
359
359
  */
360
- listDir(dir) {
361
- const ret = wasm.filenstate_listDir(this.__wbg_ptr, dir);
360
+ deleteDirPermanently(dir) {
361
+ const ret = wasm.filenstate_deleteDirPermanently(this.__wbg_ptr, dir);
362
362
  return ret;
363
363
  }
364
364
  /**
365
- * @param {DirEnum} dir
366
- * @returns {Promise<void>}
365
+ * @returns {Root}
367
366
  */
368
- trashDir(dir) {
369
- const ret = wasm.filenstate_trashDir(this.__wbg_ptr, dir);
367
+ root() {
368
+ const ret = wasm.filenstate_root(this.__wbg_ptr);
370
369
  return ret;
371
370
  }
372
371
  /**
373
- * @param {Dir} dir
374
- * @returns {Promise<void>}
372
+ * @param {DirEnum} dir
373
+ * @returns {[Dir[], File[]]}
375
374
  */
376
- deleteDirPermanently(dir) {
377
- const ret = wasm.filenstate_deleteDirPermanently(this.__wbg_ptr, dir);
375
+ listDir(dir) {
376
+ const ret = wasm.filenstate_listDir(this.__wbg_ptr, dir);
378
377
  return ret;
379
378
  }
380
379
  /**
381
- * @param {DirEnum} parent
382
- * @param {string} name
380
+ * @param {DirEnum} dir
383
381
  * @returns {Promise<void>}
384
382
  */
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);
383
+ trashDir(dir) {
384
+ const ret = wasm.filenstate_trashDir(this.__wbg_ptr, dir);
389
385
  return ret;
390
386
  }
391
387
  /**
@@ -400,61 +396,65 @@ export class FilenState {
400
396
  return ret;
401
397
  }
402
398
  /**
403
- * @returns {Root}
399
+ * @param {DirEnum} dir
400
+ * @param {string} name_or_uuid
401
+ * @returns {Promise<NonRootObject | undefined>}
404
402
  */
405
- root() {
406
- const ret = wasm.filenstate_root(this.__wbg_ptr);
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);
407
407
  return ret;
408
408
  }
409
409
  /**
410
- * @param {UploadFileStreamParams} params
411
- * @returns {Promise<File>}
410
+ * @param {File} file
411
+ * @returns {Promise<Uint8Array>}
412
412
  */
413
- uploadFileStream(params) {
414
- const ret = wasm.filenstate_uploadFileStream(this.__wbg_ptr, params);
413
+ downloadFile(file) {
414
+ const ret = wasm.filenstate_downloadFile(this.__wbg_ptr, file);
415
415
  return ret;
416
416
  }
417
417
  /**
418
418
  * @param {File} file
419
419
  * @returns {Promise<void>}
420
420
  */
421
- trashFile(file) {
422
- const ret = wasm.filenstate_trashFile(this.__wbg_ptr, file);
421
+ deleteFilePermanently(file) {
422
+ const ret = wasm.filenstate_deleteFilePermanently(this.__wbg_ptr, file);
423
423
  return ret;
424
424
  }
425
425
  /**
426
- * @param {File} file
427
- * @returns {Promise<void>}
426
+ * @param {Uint8Array} data
427
+ * @param {UploadFileParams} params
428
+ * @returns {Promise<File>}
428
429
  */
429
- deleteFilePermanently(file) {
430
- const ret = wasm.filenstate_deleteFilePermanently(this.__wbg_ptr, file);
430
+ uploadFile(data, params) {
431
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
432
+ const len0 = WASM_VECTOR_LEN;
433
+ const ret = wasm.filenstate_uploadFile(this.__wbg_ptr, ptr0, len0, params);
431
434
  return ret;
432
435
  }
433
436
  /**
434
- * @param {DownloadFileStreamParams} params
435
- * @returns {Promise<void>}
437
+ * @param {UploadFileStreamParams} params
438
+ * @returns {Promise<File>}
436
439
  */
437
- downloadFileToWriter(params) {
438
- const ret = wasm.filenstate_downloadFileToWriter(this.__wbg_ptr, params);
440
+ uploadFileStream(params) {
441
+ const ret = wasm.filenstate_uploadFileStream(this.__wbg_ptr, params);
439
442
  return ret;
440
443
  }
441
444
  /**
442
445
  * @param {File} file
443
- * @returns {Promise<Uint8Array>}
446
+ * @returns {Promise<void>}
444
447
  */
445
- downloadFile(file) {
446
- const ret = wasm.filenstate_downloadFile(this.__wbg_ptr, file);
448
+ trashFile(file) {
449
+ const ret = wasm.filenstate_trashFile(this.__wbg_ptr, file);
447
450
  return ret;
448
451
  }
449
452
  /**
450
- * @param {Uint8Array} data
451
- * @param {UploadFileParams} params
452
- * @returns {Promise<File>}
453
+ * @param {DownloadFileStreamParams} params
454
+ * @returns {Promise<void>}
453
455
  */
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);
456
+ downloadFileToWriter(params) {
457
+ const ret = wasm.filenstate_downloadFileToWriter(this.__wbg_ptr, params);
458
458
  return ret;
459
459
  }
460
460
  }
@@ -1277,18 +1277,18 @@ export function __wbindgen_cb_drop(arg0) {
1277
1277
  return ret;
1278
1278
  };
1279
1279
 
1280
- export function __wbindgen_closure_wrapper2409(arg0, arg1, arg2) {
1281
- const ret = makeMutClosure(arg0, arg1, 102, __wbg_adapter_61);
1280
+ export function __wbindgen_closure_wrapper230(arg0, arg1, arg2) {
1281
+ const ret = makeMutClosure(arg0, arg1, 110, __wbg_adapter_58);
1282
1282
  return ret;
1283
1283
  };
1284
1284
 
1285
- export function __wbindgen_closure_wrapper2706(arg0, arg1, arg2) {
1286
- const ret = makeMutClosure(arg0, arg1, 110, __wbg_adapter_61);
1285
+ export function __wbindgen_closure_wrapper2407(arg0, arg1, arg2) {
1286
+ const ret = makeMutClosure(arg0, arg1, 102, __wbg_adapter_61);
1287
1287
  return ret;
1288
1288
  };
1289
1289
 
1290
- export function __wbindgen_closure_wrapper472(arg0, arg1, arg2) {
1291
- const ret = makeMutClosure(arg0, arg1, 110, __wbg_adapter_58);
1290
+ export function __wbindgen_closure_wrapper2703(arg0, arg1, arg2) {
1291
+ const ret = makeMutClosure(arg0, arg1, 110, __wbg_adapter_61);
1292
1292
  return ret;
1293
1293
  };
1294
1294
 
Binary file
@@ -1,23 +1,23 @@
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
4
  export const login: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
7
- export const main_js: () => void;
5
+ export const from_serialized: (a: any) => [number, number, number];
8
6
  export const filenstate_serialize: (a: number) => any;
9
- export const filenstate_trashDir: (a: number, b: any) => any;
7
+ export const main_js: () => void;
8
+ export const __wbg_filenstate_free: (a: number, b: number) => void;
10
9
  export const filenstate_listDir: (a: number, b: any) => any;
11
10
  export const filenstate_createDir: (a: number, b: any, c: number, d: number) => any;
12
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;
13
14
  export const filenstate_findItemInDir: (a: number, b: any, c: number, d: number) => any;
14
15
  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
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;
18
19
  export const filenstate_trashFile: (a: number, b: any) => any;
19
20
  export const filenstate_deleteFilePermanently: (a: number, b: any) => any;
20
- export const filenstate_downloadFileToWriter: (a: number, b: any) => any;
21
21
  export const filenstate_uploadFile: (a: number, b: number, c: number, d: any) => any;
22
22
  export const intounderlyingbytesource_start: (a: number, b: any) => void;
23
23
  export const intounderlyingbytesource_type: (a: number) => number;
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.1",
4
4
  "description": "Filen WASM SDK using filen-sdk-rs",
5
5
  "type": "module",
6
6
  "scripts": {