@filen/sdk-rs 0.3.4 → 0.3.6

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,47 +1,14 @@
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
  *
9
9
  * *This API requires the following crate features to be activated: `ReadableStreamType`*
10
10
  */
11
11
  type ReadableStreamType = "bytes";
12
- export interface StringifiedClient {
13
- email: string;
14
- rootUuid: string;
15
- authInfo: string;
16
- privateKey: string;
17
- apiKey: string;
18
- authVersion: number;
19
- }
20
-
21
- export interface DecryptedFileMeta {
22
- name: string;
23
- mime: string;
24
- created?: bigint;
25
- modified: bigint;
26
- hash?: Uint8Array;
27
- size: bigint;
28
- key: string;
29
- version: FileEncryptionVersion;
30
- }
31
-
32
- export interface File {
33
- uuid: UuidStr;
34
- meta?: DecryptedFileMeta;
35
- parent: ParentUuid;
36
- size: bigint;
37
- favorited: boolean;
38
- region: string;
39
- bucket: string;
40
- chunks: bigint;
41
- }
42
-
43
- export type AbortSignal = AbortSignal;
44
-
45
12
  export interface UploadFileParams {
46
13
  parent: DirEnum;
47
14
  name: string;
@@ -51,37 +18,36 @@ export interface UploadFileParams {
51
18
  abortSignal?: AbortSignal;
52
19
  }
53
20
 
54
- export interface UploadFileStreamParams extends UploadFileParams {
55
- reader: ReadableStream<Uint8Array>;
56
- known_size: bigint | undefined;
57
- progress?: (bytes: bigint) => void;
21
+ export interface DownloadFileToZipParams {
22
+ items: Item[];
23
+ writer: WritableStream<Uint8Array>;
24
+ progress?: (bytesWritten: bigint, totalBytes: bigint, itemsProcessed: bigint, totalItems: bigint) => void;
25
+ abortSignal?: AbortSignal;
58
26
  }
59
27
 
60
28
  export interface DownloadFileStreamParams {
61
29
  file: File;
62
30
  writer: WritableStream<Uint8Array>;
63
31
  progress?: (bytes: bigint) => void;
64
- abort_signal?: AbortSignal;
32
+ abortSignal?: AbortSignal;
33
+ start?: bigint | undefined;
34
+ end?: bigint | undefined;
65
35
  }
66
36
 
67
- export interface DownloadFileToZipParams {
68
- items: Item[];
69
- writer: WritableStream<Uint8Array>;
37
+ export interface UploadFileStreamParams extends UploadFileParams {
38
+ reader: ReadableStream<Uint8Array>;
39
+ knownSize: bigint | undefined;
70
40
  progress?: (bytes: bigint) => void;
71
- abort_signal?: AbortSignal;
72
41
  }
73
42
 
43
+ export type AbortSignal = AbortSignal;
44
+
74
45
  export interface Root {
75
46
  uuid: UuidStr;
76
47
  }
77
48
 
78
49
  export type DirEnum = Dir | Root;
79
50
 
80
- export interface DecryptedDirMeta {
81
- name: string;
82
- created?: bigint;
83
- }
84
-
85
51
  export interface Dir {
86
52
  uuid: UuidStr;
87
53
  parent: ParentUuid;
@@ -90,10 +56,48 @@ export interface Dir {
90
56
  meta?: DecryptedDirMeta;
91
57
  }
92
58
 
59
+ export interface DecryptedDirMeta {
60
+ name: string;
61
+ created?: bigint;
62
+ }
63
+
93
64
  export type NonRootObject = ({ type: "dir" } & Dir) | ({ type: "file" } & File);
94
65
 
66
+ export interface StringifiedClient {
67
+ email: string;
68
+ rootUuid: string;
69
+ authInfo: string;
70
+ privateKey: string;
71
+ apiKey: string;
72
+ authVersion: number;
73
+ maxParallelRequests?: bigint;
74
+ maxIoMemoryUsage?: bigint;
75
+ }
76
+
95
77
  export type Item = File | Dir | Root;
96
78
 
79
+ export interface File {
80
+ uuid: UuidStr;
81
+ meta?: DecryptedFileMeta;
82
+ parent: ParentUuid;
83
+ size: bigint;
84
+ favorited: boolean;
85
+ region: string;
86
+ bucket: string;
87
+ chunks: bigint;
88
+ }
89
+
90
+ export interface DecryptedFileMeta {
91
+ name: string;
92
+ mime: string;
93
+ created?: bigint;
94
+ modified: bigint;
95
+ hash?: Uint8Array;
96
+ size: bigint;
97
+ key: string;
98
+ version: FileEncryptionVersion;
99
+ }
100
+
97
101
  export type ParentUuid = UuidStr | "trash" | "recents" | "favorites" | "links";
98
102
 
99
103
  export type FileEncryptionVersion = 1 | 2 | 3;
@@ -103,21 +107,21 @@ export type UuidStr = string;
103
107
  export class Client {
104
108
  private constructor();
105
109
  free(): void;
110
+ listDir(dir: DirEnum): Promise<[Dir[], File[]]>;
111
+ createDir(parent: DirEnum, name: string): Promise<Dir>;
112
+ deleteDirPermanently(dir: Dir): Promise<void>;
113
+ root(): Root;
114
+ trashDir(dir: Dir): Promise<Dir>;
115
+ findItemInDir(dir: DirEnum, nameOrUuid: string): Promise<NonRootObject | undefined>;
116
+ dirExists(parent: DirEnum, name: string): Promise<void>;
106
117
  toStringified(): StringifiedClient;
107
118
  downloadItemsToZip(params: DownloadFileToZipParams): Promise<void>;
119
+ uploadFile(data: Uint8Array, params: UploadFileParams): Promise<File>;
108
120
  downloadFileToWriter(params: DownloadFileStreamParams): Promise<void>;
109
- trashFile(file: File): Promise<File>;
121
+ deleteFilePermanently(file: File): Promise<void>;
110
122
  downloadFile(file: File): Promise<Uint8Array>;
111
123
  uploadFileFromReader(params: UploadFileStreamParams): Promise<File>;
112
- deleteFilePermanently(file: File): Promise<void>;
113
- uploadFile(data: Uint8Array, params: UploadFileParams): Promise<File>;
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>;
124
+ trashFile(file: File): Promise<File>;
121
125
  }
122
126
  export class IntoUnderlyingByteSource {
123
127
  private constructor();
@@ -141,3 +145,75 @@ export class IntoUnderlyingSource {
141
145
  cancel(): void;
142
146
  pull(controller: ReadableStreamDefaultController): Promise<any>;
143
147
  }
148
+
149
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
150
+
151
+ export interface InitOutput {
152
+ readonly memory: WebAssembly.Memory;
153
+ readonly client_listDir: (a: number, b: any) => any;
154
+ readonly client_trashDir: (a: number, b: any) => any;
155
+ readonly client_dirExists: (a: number, b: any, c: number, d: number) => any;
156
+ readonly client_deleteDirPermanently: (a: number, b: any) => any;
157
+ readonly client_createDir: (a: number, b: any, c: number, d: number) => any;
158
+ readonly client_root: (a: number) => any;
159
+ readonly client_findItemInDir: (a: number, b: any, c: number, d: number) => any;
160
+ readonly client_toStringified: (a: number) => any;
161
+ readonly __wbg_client_free: (a: number, b: number) => void;
162
+ readonly client_downloadItemsToZip: (a: number, b: any) => any;
163
+ readonly main_js: () => void;
164
+ readonly fromStringified: (a: any) => [number, number, number];
165
+ readonly login: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
166
+ readonly client_downloadFile: (a: number, b: any) => any;
167
+ readonly client_downloadFileToWriter: (a: number, b: any) => any;
168
+ readonly client_deleteFilePermanently: (a: number, b: any) => any;
169
+ readonly client_trashFile: (a: number, b: any) => any;
170
+ readonly client_uploadFile: (a: number, b: number, c: number, d: any) => any;
171
+ readonly client_uploadFileFromReader: (a: number, b: any) => any;
172
+ readonly __wbg_intounderlyingsource_free: (a: number, b: number) => void;
173
+ readonly intounderlyingsource_cancel: (a: number) => void;
174
+ readonly intounderlyingsource_pull: (a: number, b: any) => any;
175
+ readonly __wbg_intounderlyingsink_free: (a: number, b: number) => void;
176
+ readonly intounderlyingsink_abort: (a: number, b: any) => any;
177
+ readonly intounderlyingsink_write: (a: number, b: any) => any;
178
+ readonly intounderlyingsink_close: (a: number) => any;
179
+ readonly __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
180
+ readonly intounderlyingbytesource_pull: (a: number, b: any) => any;
181
+ readonly intounderlyingbytesource_type: (a: number) => number;
182
+ readonly intounderlyingbytesource_start: (a: number, b: any) => void;
183
+ readonly intounderlyingbytesource_cancel: (a: number) => void;
184
+ readonly intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number;
185
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
186
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
187
+ readonly __wbindgen_exn_store: (a: number) => void;
188
+ readonly __externref_table_alloc: () => number;
189
+ readonly __wbindgen_export_4: WebAssembly.Table;
190
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
191
+ readonly __wbindgen_export_6: WebAssembly.Table;
192
+ readonly __externref_table_dealloc: (a: number) => void;
193
+ readonly _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h1ad07d0627257b45: (a: number, b: number) => void;
194
+ readonly _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h96ccbfe273ba439a: (a: number, b: number) => void;
195
+ readonly closure787_externref_shim: (a: number, b: number, c: any) => void;
196
+ readonly closure945_externref_shim: (a: number, b: number, c: any, d: any) => void;
197
+ readonly __wbindgen_start: () => void;
198
+ }
199
+
200
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
201
+ /**
202
+ * Instantiates the given `module`, which can either be bytes or
203
+ * a precompiled `WebAssembly.Module`.
204
+ *
205
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
206
+ *
207
+ * @returns {InitOutput}
208
+ */
209
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
210
+
211
+ /**
212
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
213
+ * for everything else, calls `WebAssembly.instantiate` directly.
214
+ *
215
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
216
+ *
217
+ * @returns {Promise<InitOutput>}
218
+ */
219
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;