@filen/sdk-rs 0.3.6 → 0.3.8

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,21 +1,80 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- export function main_js(): void;
4
- export function login(email: string, password: string, twoFactorCode?: string | null): Promise<Client>;
5
3
  export function fromStringified(serialized: StringifiedClient): Client;
4
+ export function login(email: string, password: string, twoFactorCode?: string | null): Promise<Client>;
5
+ export function main_js(): void;
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 UploadFileParams {
13
- parent: DirEnum;
12
+ export interface Root {
13
+ uuid: UuidStr;
14
+ }
15
+
16
+ export type DirWithMetaEnum = Dir | RootWithMeta;
17
+
18
+ export interface Dir {
19
+ uuid: UuidStr;
20
+ parent: ParentUuid;
21
+ color?: string;
22
+ favorited: boolean;
23
+ meta?: DecryptedDirMeta;
24
+ }
25
+
26
+ export interface RootWithMeta {
27
+ uuid: UuidStr;
28
+ color?: string;
29
+ meta?: DecryptedDirMeta;
30
+ }
31
+
32
+ export interface DecryptedDirMeta {
14
33
  name: string;
15
34
  created?: bigint;
16
- modified?: bigint;
17
- mime?: string | undefined;
18
- abortSignal?: AbortSignal;
35
+ }
36
+
37
+ export type AnyDirEnum = Dir | RootWithMeta | Root;
38
+
39
+ export type DirEnum = Dir | Root;
40
+
41
+ export interface SharedDir {
42
+ dir: DirWithMetaEnum;
43
+ sharingRole: SharingRole;
44
+ writeAccess: boolean;
45
+ }
46
+
47
+ export interface Contact {
48
+ uuid: UuidStr;
49
+ userId: bigint;
50
+ email: string;
51
+ avatar?: string;
52
+ nickName: string;
53
+ lastActive: DateTime<Utc>;
54
+ timestamp: DateTime<Utc>;
55
+ }
56
+
57
+ export interface ContactRequestOut {
58
+ uuid: UuidStr;
59
+ email: string;
60
+ avatar?: string;
61
+ nickName: string;
62
+ }
63
+
64
+ export interface ContactRequestIn {
65
+ uuid: UuidStr;
66
+ userId: bigint;
67
+ email: string;
68
+ avatar?: string;
69
+ nickName: string;
70
+ }
71
+
72
+ export type NonRootObject = ({ type: "dir" } & Dir) | ({ type: "file" } & File);
73
+
74
+ export interface DirSizeResponse {
75
+ size: bigint;
76
+ files: bigint;
77
+ dirs: bigint;
19
78
  }
20
79
 
21
80
  export interface DownloadFileToZipParams {
@@ -25,13 +84,24 @@ export interface DownloadFileToZipParams {
25
84
  abortSignal?: AbortSignal;
26
85
  }
27
86
 
87
+ export interface UploadFileParams {
88
+ parent: DirEnum;
89
+ name: string;
90
+ created?: bigint;
91
+ modified?: bigint;
92
+ mime?: string;
93
+ abortSignal?: AbortSignal;
94
+ }
95
+
96
+ export type AbortSignal = AbortSignal;
97
+
28
98
  export interface DownloadFileStreamParams {
29
- file: File;
99
+ file: FileEnum;
30
100
  writer: WritableStream<Uint8Array>;
31
101
  progress?: (bytes: bigint) => void;
32
102
  abortSignal?: AbortSignal;
33
- start?: bigint | undefined;
34
- end?: bigint | undefined;
103
+ start?: bigint;
104
+ end?: bigint;
35
105
  }
36
106
 
37
107
  export interface UploadFileStreamParams extends UploadFileParams {
@@ -40,51 +110,31 @@ export interface UploadFileStreamParams extends UploadFileParams {
40
110
  progress?: (bytes: bigint) => void;
41
111
  }
42
112
 
43
- export type AbortSignal = AbortSignal;
44
-
45
- export interface Root {
46
- uuid: UuidStr;
47
- }
48
-
49
- export type DirEnum = Dir | Root;
50
-
51
- export interface Dir {
113
+ export interface File {
52
114
  uuid: UuidStr;
115
+ meta?: DecryptedFileMeta;
53
116
  parent: ParentUuid;
54
- color?: string;
117
+ size: bigint;
55
118
  favorited: boolean;
56
- meta?: DecryptedDirMeta;
57
- }
58
-
59
- export interface DecryptedDirMeta {
60
- name: string;
61
- created?: bigint;
119
+ region: string;
120
+ bucket: string;
121
+ chunks: bigint;
62
122
  }
63
123
 
64
- export type NonRootObject = ({ type: "dir" } & Dir) | ({ type: "file" } & File);
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;
124
+ export interface SharedFile {
125
+ file: RootFile;
126
+ sharingRole: SharingRole;
75
127
  }
76
128
 
77
- export type Item = File | Dir | Root;
129
+ export type FileEnum = File | RootFile;
78
130
 
79
- export interface File {
131
+ export interface RootFile {
80
132
  uuid: UuidStr;
81
- meta?: DecryptedFileMeta;
82
- parent: ParentUuid;
83
- size: bigint;
84
- favorited: boolean;
133
+ size: number;
134
+ chunks: number;
85
135
  region: string;
86
136
  bucket: string;
87
- chunks: bigint;
137
+ meta?: DecryptedDirMeta;
88
138
  }
89
139
 
90
140
  export interface DecryptedFileMeta {
@@ -98,30 +148,95 @@ export interface DecryptedFileMeta {
98
148
  version: FileEncryptionVersion;
99
149
  }
100
150
 
151
+ export type Item = File | RootFile | Dir | RootWithMeta | Root;
152
+
153
+ export interface User {
154
+ email: string;
155
+ publicKey: Uint8Array;
156
+ id: bigint;
157
+ }
158
+
159
+ export interface DirPublicLink {
160
+ linkUuid: UuidStr;
161
+ linkKey?: MetaKey;
162
+ password?: string | Uint8Array;
163
+ expiration: PublicLinkExpiration;
164
+ enableDownload: boolean;
165
+ salt?: Uint8Array;
166
+ }
167
+
168
+ export interface FilePublicLink {
169
+ linkUuid: UuidStr;
170
+ password?: string | Uint8Array;
171
+ expiration: PublicLinkExpiration;
172
+ downloadable: boolean;
173
+ salt: Uint8Array;
174
+ }
175
+
176
+ export interface StringifiedClient {
177
+ email: string;
178
+ rootUuid: string;
179
+ authInfo: string;
180
+ privateKey: string;
181
+ apiKey: string;
182
+ authVersion: number;
183
+ maxParallelRequests?: number;
184
+ maxIoMemoryUsage?: number;
185
+ }
186
+
101
187
  export type ParentUuid = UuidStr | "trash" | "recents" | "favorites" | "links";
102
188
 
103
- export type FileEncryptionVersion = 1 | 2 | 3;
189
+ export type PublicLinkExpiration = "never" | "1h" | "6h" | "1d" | "3d" | "7d" | "14d" | "30d";
104
190
 
105
191
  export type UuidStr = string;
106
192
 
193
+ export type FileEncryptionVersion = 1 | 2 | 3;
194
+
107
195
  export class Client {
108
196
  private constructor();
109
197
  free(): void;
198
+ listOutgoingContactRequests(): Promise<ContactRequestOut[]>;
199
+ getFileLinkStatus(file: File): Promise<FilePublicLink | undefined>;
200
+ denyContactRequest(contact_uuid: string): Promise<void>;
201
+ getContacts(): Promise<Contact[]>;
202
+ listOutShared(dir?: DirWithMetaEnum | null, user?: User | null): Promise<[SharedDirectory[], SharedFile[]]>;
203
+ deleteContact(contact_uuid: string): Promise<void>;
204
+ removeDirLink(link: DirPublicLink): Promise<void>;
205
+ listInShared(dir?: DirWithMetaEnum | null): Promise<[SharedDirectory[], SharedFile[]]>;
206
+ publicLinkDir(dir: Dir): Promise<DirPublicLink>;
207
+ shareFile(file: File, user: User): Promise<void>;
208
+ updateFileLink(file: File, link: FilePublicLink): Promise<void>;
209
+ makeUserFromContact(contact: Contact): Promise<User>;
210
+ updateDirLink(dir: Dir, link: DirPublicLink): Promise<void>;
211
+ removeSharedLinkIn(link_uuid: string): Promise<void>;
212
+ publicLinkFile(file: File): Promise<FilePublicLink>;
213
+ getDirLinkStatus(dir: Dir): Promise<DirPublicLink | undefined>;
214
+ listIncomingContactRequests(): Promise<ContactRequestIn[]>;
215
+ shareDir(dir: Dir, user: User): Promise<void>;
216
+ removeSharedLinkOut(link_uuid: string, receiver_id: bigint): Promise<void>;
217
+ listLinkedDir(dir: DirWithMetaEnum, link: DirPublicLink): Promise<[Dir[], File[]]>;
218
+ sendContactRequest(email: string): Promise<string>;
219
+ acceptContactRequest(contact_uuid: string): Promise<string>;
220
+ cancelContactRequest(contact_uuid: string): Promise<void>;
221
+ deleteFilePermanently(file: File): Promise<void>;
222
+ trashFile(file: File): Promise<File>;
223
+ downloadFile(file: FileEnum): Promise<Uint8Array>;
224
+ downloadFileToWriter(params: DownloadFileStreamParams): Promise<void>;
225
+ uploadFileFromReader(params: UploadFileStreamParams): Promise<File>;
226
+ uploadFile(data: Uint8Array, params: UploadFileParams): Promise<File>;
227
+ downloadItemsToZip(params: DownloadFileToZipParams): Promise<void>;
110
228
  listDir(dir: DirEnum): Promise<[Dir[], File[]]>;
111
- createDir(parent: DirEnum, name: string): Promise<Dir>;
229
+ listFavorites(): Promise<[Dir[], File[]]>;
230
+ listRecents(): Promise<[Dir[], File[]]>;
231
+ trashDir(dir: Dir): Promise<Dir>;
112
232
  deleteDirPermanently(dir: Dir): Promise<void>;
233
+ createDir(parent: DirEnum, name: string): Promise<Dir>;
234
+ dirExists(parent: AnyDirEnum, name: string): Promise<void>;
235
+ findItemInDir(dir: AnyDirEnum, nameOrUuid: string): Promise<NonRootObject | undefined>;
113
236
  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>;
237
+ getDirSize(dir: Dir): Promise<DirSizeResponse>;
238
+ listDirRecursive(dir: DirEnum): Promise<[Dir[], File[]]>;
117
239
  toStringified(): StringifiedClient;
118
- downloadItemsToZip(params: DownloadFileToZipParams): Promise<void>;
119
- uploadFile(data: Uint8Array, params: UploadFileParams): Promise<File>;
120
- downloadFileToWriter(params: DownloadFileStreamParams): Promise<void>;
121
- deleteFilePermanently(file: File): Promise<void>;
122
- downloadFile(file: File): Promise<Uint8Array>;
123
- uploadFileFromReader(params: UploadFileStreamParams): Promise<File>;
124
- trashFile(file: File): Promise<File>;
125
240
  }
126
241
  export class IntoUnderlyingByteSource {
127
242
  private constructor();
@@ -150,25 +265,52 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
150
265
 
151
266
  export interface InitOutput {
152
267
  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;
268
+ readonly client_listIncomingContactRequests: (a: number) => any;
269
+ readonly client_getContacts: (a: number) => any;
270
+ readonly client_removeSharedLinkIn: (a: number, b: number, c: number) => any;
271
+ readonly client_publicLinkFile: (a: number, b: any) => any;
272
+ readonly client_removeSharedLinkOut: (a: number, b: number, c: number, d: bigint) => any;
273
+ readonly client_sendContactRequest: (a: number, b: number, c: number) => any;
274
+ readonly client_listOutShared: (a: number, b: number, c: number) => any;
275
+ readonly client_cancelContactRequest: (a: number, b: number, c: number) => any;
276
+ readonly client_makeUserFromContact: (a: number, b: any) => any;
277
+ readonly client_removeDirLink: (a: number, b: any) => any;
278
+ readonly client_updateFileLink: (a: number, b: any, c: any) => any;
279
+ readonly client_deleteContact: (a: number, b: number, c: number) => any;
280
+ readonly client_shareDir: (a: number, b: any, c: any) => any;
281
+ readonly client_acceptContactRequest: (a: number, b: number, c: number) => any;
282
+ readonly client_listLinkedDir: (a: number, b: any, c: any) => any;
283
+ readonly client_getFileLinkStatus: (a: number, b: any) => any;
284
+ readonly client_shareFile: (a: number, b: any, c: any) => any;
285
+ readonly client_denyContactRequest: (a: number, b: number, c: number) => any;
286
+ readonly client_publicLinkDir: (a: number, b: any) => any;
287
+ readonly client_listOutgoingContactRequests: (a: number) => any;
288
+ readonly client_getDirLinkStatus: (a: number, b: any) => any;
289
+ readonly client_updateDirLink: (a: number, b: any, c: any) => any;
290
+ readonly client_listInShared: (a: number, b: number) => any;
291
+ readonly login: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
163
292
  readonly main_js: () => void;
164
293
  readonly fromStringified: (a: any) => [number, number, number];
165
- readonly login: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
166
294
  readonly client_downloadFile: (a: number, b: any) => any;
167
- readonly client_downloadFileToWriter: (a: number, b: any) => any;
168
295
  readonly client_deleteFilePermanently: (a: number, b: any) => any;
169
296
  readonly client_trashFile: (a: number, b: any) => any;
170
- readonly client_uploadFile: (a: number, b: number, c: number, d: any) => any;
171
297
  readonly client_uploadFileFromReader: (a: number, b: any) => any;
298
+ readonly client_uploadFile: (a: number, b: number, c: number, d: any) => any;
299
+ readonly client_downloadFileToWriter: (a: number, b: any) => any;
300
+ readonly client_downloadItemsToZip: (a: number, b: any) => any;
301
+ readonly client_trashDir: (a: number, b: any) => any;
302
+ readonly client_findItemInDir: (a: number, b: any, c: number, d: number) => any;
303
+ readonly client_listRecents: (a: number) => any;
304
+ readonly client_listDir: (a: number, b: any) => any;
305
+ readonly client_dirExists: (a: number, b: any, c: number, d: number) => any;
306
+ readonly client_getDirSize: (a: number, b: any) => any;
307
+ readonly client_createDir: (a: number, b: any, c: number, d: number) => any;
308
+ readonly client_listFavorites: (a: number) => any;
309
+ readonly client_root: (a: number) => any;
310
+ readonly client_deleteDirPermanently: (a: number, b: any) => any;
311
+ readonly client_listDirRecursive: (a: number, b: any) => any;
312
+ readonly client_toStringified: (a: number) => any;
313
+ readonly __wbg_client_free: (a: number, b: number) => void;
172
314
  readonly __wbg_intounderlyingsource_free: (a: number, b: number) => void;
173
315
  readonly intounderlyingsource_cancel: (a: number) => void;
174
316
  readonly intounderlyingsource_pull: (a: number, b: any) => any;
@@ -192,8 +334,8 @@ export interface InitOutput {
192
334
  readonly __externref_table_dealloc: (a: number) => void;
193
335
  readonly _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h1ad07d0627257b45: (a: number, b: number) => void;
194
336
  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;
337
+ readonly closure937_externref_shim: (a: number, b: number, c: any) => void;
338
+ readonly closure1103_externref_shim: (a: number, b: number, c: any, d: any) => void;
197
339
  readonly __wbindgen_start: () => void;
198
340
  }
199
341
 
package/browser/sdk-rs.js CHANGED
@@ -203,8 +203,21 @@ function debugString(val) {
203
203
  return className;
204
204
  }
205
205
 
206
- export function main_js() {
207
- wasm.main_js();
206
+ function takeFromExternrefTable0(idx) {
207
+ const value = wasm.__wbindgen_export_4.get(idx);
208
+ wasm.__externref_table_dealloc(idx);
209
+ return value;
210
+ }
211
+ /**
212
+ * @param {StringifiedClient} serialized
213
+ * @returns {Client}
214
+ */
215
+ export function fromStringified(serialized) {
216
+ const ret = wasm.fromStringified(serialized);
217
+ if (ret[2]) {
218
+ throw takeFromExternrefTable0(ret[1]);
219
+ }
220
+ return Client.__wrap(ret[0]);
208
221
  }
209
222
 
210
223
  /**
@@ -224,21 +237,8 @@ export function login(email, password, twoFactorCode) {
224
237
  return ret;
225
238
  }
226
239
 
227
- function takeFromExternrefTable0(idx) {
228
- const value = wasm.__wbindgen_export_4.get(idx);
229
- wasm.__externref_table_dealloc(idx);
230
- return value;
231
- }
232
- /**
233
- * @param {StringifiedClient} serialized
234
- * @returns {Client}
235
- */
236
- export function fromStringified(serialized) {
237
- const ret = wasm.fromStringified(serialized);
238
- if (ret[2]) {
239
- throw takeFromExternrefTable0(ret[1]);
240
- }
241
- return Client.__wrap(ret[0]);
240
+ export function main_js() {
241
+ wasm.main_js();
242
242
  }
243
243
 
244
244
  function passArray8ToWasm0(arg, malloc) {
@@ -256,11 +256,11 @@ function __wbg_adapter_63(arg0, arg1) {
256
256
  }
257
257
 
258
258
  function __wbg_adapter_66(arg0, arg1, arg2) {
259
- wasm.closure787_externref_shim(arg0, arg1, arg2);
259
+ wasm.closure937_externref_shim(arg0, arg1, arg2);
260
260
  }
261
261
 
262
- function __wbg_adapter_305(arg0, arg1, arg2, arg3) {
263
- wasm.closure945_externref_shim(arg0, arg1, arg2, arg3);
262
+ function __wbg_adapter_334(arg0, arg1, arg2, arg3) {
263
+ wasm.closure1103_externref_shim(arg0, arg1, arg2, arg3);
264
264
  }
265
265
 
266
266
  const __wbindgen_enum_ReadableStreamReaderMode = ["byob"];
@@ -297,101 +297,205 @@ export class Client {
297
297
  wasm.__wbg_client_free(ptr, 0);
298
298
  }
299
299
  /**
300
- * @param {DirEnum} dir
301
- * @returns {[Dir[], File[]]}
300
+ * @returns {ContactRequestOut[]}
302
301
  */
303
- listDir(dir) {
304
- const ret = wasm.client_listDir(this.__wbg_ptr, dir);
302
+ listOutgoingContactRequests() {
303
+ const ret = wasm.client_listOutgoingContactRequests(this.__wbg_ptr);
305
304
  return ret;
306
305
  }
307
306
  /**
308
- * @param {DirEnum} parent
309
- * @param {string} name
310
- * @returns {Promise<Dir>}
307
+ * @param {File} file
308
+ * @returns {Promise<FilePublicLink | undefined>}
311
309
  */
312
- createDir(parent, name) {
313
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
310
+ getFileLinkStatus(file) {
311
+ const ret = wasm.client_getFileLinkStatus(this.__wbg_ptr, file);
312
+ return ret;
313
+ }
314
+ /**
315
+ * @param {string} contact_uuid
316
+ * @returns {Promise<void>}
317
+ */
318
+ denyContactRequest(contact_uuid) {
319
+ const ptr0 = passStringToWasm0(contact_uuid, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
314
320
  const len0 = WASM_VECTOR_LEN;
315
- const ret = wasm.client_createDir(this.__wbg_ptr, parent, ptr0, len0);
321
+ const ret = wasm.client_denyContactRequest(this.__wbg_ptr, ptr0, len0);
322
+ return ret;
323
+ }
324
+ /**
325
+ * @returns {Contact[]}
326
+ */
327
+ getContacts() {
328
+ const ret = wasm.client_getContacts(this.__wbg_ptr);
329
+ return ret;
330
+ }
331
+ /**
332
+ * @param {DirWithMetaEnum | null} [dir]
333
+ * @param {User | null} [user]
334
+ * @returns {[SharedDirectory[], SharedFile[]]}
335
+ */
336
+ listOutShared(dir, user) {
337
+ const ret = wasm.client_listOutShared(this.__wbg_ptr, isLikeNone(dir) ? 0 : addToExternrefTable0(dir), isLikeNone(user) ? 0 : addToExternrefTable0(user));
338
+ return ret;
339
+ }
340
+ /**
341
+ * @param {string} contact_uuid
342
+ * @returns {Promise<void>}
343
+ */
344
+ deleteContact(contact_uuid) {
345
+ const ptr0 = passStringToWasm0(contact_uuid, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
346
+ const len0 = WASM_VECTOR_LEN;
347
+ const ret = wasm.client_deleteContact(this.__wbg_ptr, ptr0, len0);
348
+ return ret;
349
+ }
350
+ /**
351
+ * @param {DirPublicLink} link
352
+ * @returns {Promise<void>}
353
+ */
354
+ removeDirLink(link) {
355
+ const ret = wasm.client_removeDirLink(this.__wbg_ptr, link);
356
+ return ret;
357
+ }
358
+ /**
359
+ * @param {DirWithMetaEnum | null} [dir]
360
+ * @returns {[SharedDirectory[], SharedFile[]]}
361
+ */
362
+ listInShared(dir) {
363
+ const ret = wasm.client_listInShared(this.__wbg_ptr, isLikeNone(dir) ? 0 : addToExternrefTable0(dir));
316
364
  return ret;
317
365
  }
318
366
  /**
319
367
  * @param {Dir} dir
368
+ * @returns {Promise<DirPublicLink>}
369
+ */
370
+ publicLinkDir(dir) {
371
+ const ret = wasm.client_publicLinkDir(this.__wbg_ptr, dir);
372
+ return ret;
373
+ }
374
+ /**
375
+ * @param {File} file
376
+ * @param {User} user
320
377
  * @returns {Promise<void>}
321
378
  */
322
- deleteDirPermanently(dir) {
323
- const ret = wasm.client_deleteDirPermanently(this.__wbg_ptr, dir);
379
+ shareFile(file, user) {
380
+ const ret = wasm.client_shareFile(this.__wbg_ptr, file, user);
324
381
  return ret;
325
382
  }
326
383
  /**
327
- * @returns {Root}
384
+ * @param {File} file
385
+ * @param {FilePublicLink} link
386
+ * @returns {Promise<void>}
328
387
  */
329
- root() {
330
- const ret = wasm.client_root(this.__wbg_ptr);
388
+ updateFileLink(file, link) {
389
+ const ret = wasm.client_updateFileLink(this.__wbg_ptr, file, link);
390
+ return ret;
391
+ }
392
+ /**
393
+ * @param {Contact} contact
394
+ * @returns {Promise<User>}
395
+ */
396
+ makeUserFromContact(contact) {
397
+ const ret = wasm.client_makeUserFromContact(this.__wbg_ptr, contact);
331
398
  return ret;
332
399
  }
333
400
  /**
334
401
  * @param {Dir} dir
335
- * @returns {Promise<Dir>}
402
+ * @param {DirPublicLink} link
403
+ * @returns {Promise<void>}
336
404
  */
337
- trashDir(dir) {
338
- const ret = wasm.client_trashDir(this.__wbg_ptr, dir);
405
+ updateDirLink(dir, link) {
406
+ const ret = wasm.client_updateDirLink(this.__wbg_ptr, dir, link);
339
407
  return ret;
340
408
  }
341
409
  /**
342
- * @param {DirEnum} dir
343
- * @param {string} nameOrUuid
344
- * @returns {Promise<NonRootObject | undefined>}
410
+ * @param {string} link_uuid
411
+ * @returns {Promise<void>}
345
412
  */
346
- findItemInDir(dir, nameOrUuid) {
347
- const ptr0 = passStringToWasm0(nameOrUuid, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
413
+ removeSharedLinkIn(link_uuid) {
414
+ const ptr0 = passStringToWasm0(link_uuid, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
348
415
  const len0 = WASM_VECTOR_LEN;
349
- const ret = wasm.client_findItemInDir(this.__wbg_ptr, dir, ptr0, len0);
416
+ const ret = wasm.client_removeSharedLinkIn(this.__wbg_ptr, ptr0, len0);
350
417
  return ret;
351
418
  }
352
419
  /**
353
- * @param {DirEnum} parent
354
- * @param {string} name
420
+ * @param {File} file
421
+ * @returns {Promise<FilePublicLink>}
422
+ */
423
+ publicLinkFile(file) {
424
+ const ret = wasm.client_publicLinkFile(this.__wbg_ptr, file);
425
+ return ret;
426
+ }
427
+ /**
428
+ * @param {Dir} dir
429
+ * @returns {Promise<DirPublicLink | undefined>}
430
+ */
431
+ getDirLinkStatus(dir) {
432
+ const ret = wasm.client_getDirLinkStatus(this.__wbg_ptr, dir);
433
+ return ret;
434
+ }
435
+ /**
436
+ * @returns {ContactRequestIn[]}
437
+ */
438
+ listIncomingContactRequests() {
439
+ const ret = wasm.client_listIncomingContactRequests(this.__wbg_ptr);
440
+ return ret;
441
+ }
442
+ /**
443
+ * @param {Dir} dir
444
+ * @param {User} user
355
445
  * @returns {Promise<void>}
356
446
  */
357
- dirExists(parent, name) {
358
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
447
+ shareDir(dir, user) {
448
+ const ret = wasm.client_shareDir(this.__wbg_ptr, dir, user);
449
+ return ret;
450
+ }
451
+ /**
452
+ * @param {string} link_uuid
453
+ * @param {bigint} receiver_id
454
+ * @returns {Promise<void>}
455
+ */
456
+ removeSharedLinkOut(link_uuid, receiver_id) {
457
+ const ptr0 = passStringToWasm0(link_uuid, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
359
458
  const len0 = WASM_VECTOR_LEN;
360
- const ret = wasm.client_dirExists(this.__wbg_ptr, parent, ptr0, len0);
459
+ const ret = wasm.client_removeSharedLinkOut(this.__wbg_ptr, ptr0, len0, receiver_id);
361
460
  return ret;
362
461
  }
363
462
  /**
364
- * @returns {StringifiedClient}
463
+ * @param {DirWithMetaEnum} dir
464
+ * @param {DirPublicLink} link
465
+ * @returns {[Dir[], File[]]}
365
466
  */
366
- toStringified() {
367
- const ret = wasm.client_toStringified(this.__wbg_ptr);
467
+ listLinkedDir(dir, link) {
468
+ const ret = wasm.client_listLinkedDir(this.__wbg_ptr, dir, link);
368
469
  return ret;
369
470
  }
370
471
  /**
371
- * @param {DownloadFileToZipParams} params
372
- * @returns {Promise<void>}
472
+ * @param {string} email
473
+ * @returns {Promise<string>}
373
474
  */
374
- downloadItemsToZip(params) {
375
- const ret = wasm.client_downloadItemsToZip(this.__wbg_ptr, params);
475
+ sendContactRequest(email) {
476
+ const ptr0 = passStringToWasm0(email, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
477
+ const len0 = WASM_VECTOR_LEN;
478
+ const ret = wasm.client_sendContactRequest(this.__wbg_ptr, ptr0, len0);
376
479
  return ret;
377
480
  }
378
481
  /**
379
- * @param {Uint8Array} data
380
- * @param {UploadFileParams} params
381
- * @returns {Promise<File>}
482
+ * @param {string} contact_uuid
483
+ * @returns {Promise<string>}
382
484
  */
383
- uploadFile(data, params) {
384
- const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
485
+ acceptContactRequest(contact_uuid) {
486
+ const ptr0 = passStringToWasm0(contact_uuid, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
385
487
  const len0 = WASM_VECTOR_LEN;
386
- const ret = wasm.client_uploadFile(this.__wbg_ptr, ptr0, len0, params);
488
+ const ret = wasm.client_acceptContactRequest(this.__wbg_ptr, ptr0, len0);
387
489
  return ret;
388
490
  }
389
491
  /**
390
- * @param {DownloadFileStreamParams} params
492
+ * @param {string} contact_uuid
391
493
  * @returns {Promise<void>}
392
494
  */
393
- downloadFileToWriter(params) {
394
- const ret = wasm.client_downloadFileToWriter(this.__wbg_ptr, params);
495
+ cancelContactRequest(contact_uuid) {
496
+ const ptr0 = passStringToWasm0(contact_uuid, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
497
+ const len0 = WASM_VECTOR_LEN;
498
+ const ret = wasm.client_cancelContactRequest(this.__wbg_ptr, ptr0, len0);
395
499
  return ret;
396
500
  }
397
501
  /**
@@ -404,12 +508,28 @@ export class Client {
404
508
  }
405
509
  /**
406
510
  * @param {File} file
511
+ * @returns {Promise<File>}
512
+ */
513
+ trashFile(file) {
514
+ const ret = wasm.client_trashFile(this.__wbg_ptr, file);
515
+ return ret;
516
+ }
517
+ /**
518
+ * @param {FileEnum} file
407
519
  * @returns {Promise<Uint8Array>}
408
520
  */
409
521
  downloadFile(file) {
410
522
  const ret = wasm.client_downloadFile(this.__wbg_ptr, file);
411
523
  return ret;
412
524
  }
525
+ /**
526
+ * @param {DownloadFileStreamParams} params
527
+ * @returns {Promise<void>}
528
+ */
529
+ downloadFileToWriter(params) {
530
+ const ret = wasm.client_downloadFileToWriter(this.__wbg_ptr, params);
531
+ return ret;
532
+ }
413
533
  /**
414
534
  * @param {UploadFileStreamParams} params
415
535
  * @returns {Promise<File>}
@@ -419,11 +539,123 @@ export class Client {
419
539
  return ret;
420
540
  }
421
541
  /**
422
- * @param {File} file
542
+ * @param {Uint8Array} data
543
+ * @param {UploadFileParams} params
423
544
  * @returns {Promise<File>}
424
545
  */
425
- trashFile(file) {
426
- const ret = wasm.client_trashFile(this.__wbg_ptr, file);
546
+ uploadFile(data, params) {
547
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
548
+ const len0 = WASM_VECTOR_LEN;
549
+ const ret = wasm.client_uploadFile(this.__wbg_ptr, ptr0, len0, params);
550
+ return ret;
551
+ }
552
+ /**
553
+ * @param {DownloadFileToZipParams} params
554
+ * @returns {Promise<void>}
555
+ */
556
+ downloadItemsToZip(params) {
557
+ const ret = wasm.client_downloadItemsToZip(this.__wbg_ptr, params);
558
+ return ret;
559
+ }
560
+ /**
561
+ * @param {DirEnum} dir
562
+ * @returns {[Dir[], File[]]}
563
+ */
564
+ listDir(dir) {
565
+ const ret = wasm.client_listDir(this.__wbg_ptr, dir);
566
+ return ret;
567
+ }
568
+ /**
569
+ * @returns {[Dir[], File[]]}
570
+ */
571
+ listFavorites() {
572
+ const ret = wasm.client_listFavorites(this.__wbg_ptr);
573
+ return ret;
574
+ }
575
+ /**
576
+ * @returns {[Dir[], File[]]}
577
+ */
578
+ listRecents() {
579
+ const ret = wasm.client_listRecents(this.__wbg_ptr);
580
+ return ret;
581
+ }
582
+ /**
583
+ * @param {Dir} dir
584
+ * @returns {Promise<Dir>}
585
+ */
586
+ trashDir(dir) {
587
+ const ret = wasm.client_trashDir(this.__wbg_ptr, dir);
588
+ return ret;
589
+ }
590
+ /**
591
+ * @param {Dir} dir
592
+ * @returns {Promise<void>}
593
+ */
594
+ deleteDirPermanently(dir) {
595
+ const ret = wasm.client_deleteDirPermanently(this.__wbg_ptr, dir);
596
+ return ret;
597
+ }
598
+ /**
599
+ * @param {DirEnum} parent
600
+ * @param {string} name
601
+ * @returns {Promise<Dir>}
602
+ */
603
+ createDir(parent, name) {
604
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
605
+ const len0 = WASM_VECTOR_LEN;
606
+ const ret = wasm.client_createDir(this.__wbg_ptr, parent, ptr0, len0);
607
+ return ret;
608
+ }
609
+ /**
610
+ * @param {AnyDirEnum} parent
611
+ * @param {string} name
612
+ * @returns {Promise<void>}
613
+ */
614
+ dirExists(parent, name) {
615
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
616
+ const len0 = WASM_VECTOR_LEN;
617
+ const ret = wasm.client_dirExists(this.__wbg_ptr, parent, ptr0, len0);
618
+ return ret;
619
+ }
620
+ /**
621
+ * @param {AnyDirEnum} dir
622
+ * @param {string} nameOrUuid
623
+ * @returns {Promise<NonRootObject | undefined>}
624
+ */
625
+ findItemInDir(dir, nameOrUuid) {
626
+ const ptr0 = passStringToWasm0(nameOrUuid, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
627
+ const len0 = WASM_VECTOR_LEN;
628
+ const ret = wasm.client_findItemInDir(this.__wbg_ptr, dir, ptr0, len0);
629
+ return ret;
630
+ }
631
+ /**
632
+ * @returns {Root}
633
+ */
634
+ root() {
635
+ const ret = wasm.client_root(this.__wbg_ptr);
636
+ return ret;
637
+ }
638
+ /**
639
+ * @param {Dir} dir
640
+ * @returns {Promise<DirSizeResponse>}
641
+ */
642
+ getDirSize(dir) {
643
+ const ret = wasm.client_getDirSize(this.__wbg_ptr, dir);
644
+ return ret;
645
+ }
646
+ /**
647
+ * @param {DirEnum} dir
648
+ * @returns {[Dir[], File[]]}
649
+ */
650
+ listDirRecursive(dir) {
651
+ const ret = wasm.client_listDirRecursive(this.__wbg_ptr, dir);
652
+ return ret;
653
+ }
654
+ /**
655
+ * @returns {StringifiedClient}
656
+ */
657
+ toStringified() {
658
+ const ret = wasm.client_toStringified(this.__wbg_ptr);
427
659
  return ret;
428
660
  }
429
661
  }
@@ -644,7 +876,7 @@ function __wbg_get_imports() {
644
876
  const ret = arg0.call(arg1, arg2);
645
877
  return ret;
646
878
  }, arguments) };
647
- imports.wbg.__wbg_call_d84d05895a78e182 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
879
+ imports.wbg.__wbg_call_efbfaf560bee7c99 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
648
880
  const ret = arg0.call(arg1, arg2, arg3, arg4, arg5);
649
881
  return ret;
650
882
  }, arguments) };
@@ -721,6 +953,10 @@ function __wbg_get_imports() {
721
953
  const ret = arg0.fetch(arg1);
722
954
  return ret;
723
955
  };
956
+ imports.wbg.__wbg_from_2a5d3e218e67aa85 = function(arg0) {
957
+ const ret = Array.from(arg0);
958
+ return ret;
959
+ };
724
960
  imports.wbg.__wbg_getRandomValues_3c9c0d586e575a16 = function() { return handleError(function (arg0, arg1) {
725
961
  globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
726
962
  }, arguments) };
@@ -886,7 +1122,7 @@ function __wbg_get_imports() {
886
1122
  const a = state0.a;
887
1123
  state0.a = 0;
888
1124
  try {
889
- return __wbg_adapter_305(a, state0.b, arg0, arg1);
1125
+ return __wbg_adapter_334(a, state0.b, arg0, arg1);
890
1126
  } finally {
891
1127
  state0.a = a;
892
1128
  }
@@ -1164,16 +1400,16 @@ function __wbg_get_imports() {
1164
1400
  const ret = false;
1165
1401
  return ret;
1166
1402
  };
1167
- imports.wbg.__wbindgen_closure_wrapper1724 = function(arg0, arg1, arg2) {
1168
- const ret = makeMutClosure(arg0, arg1, 683, __wbg_adapter_60);
1403
+ imports.wbg.__wbindgen_closure_wrapper2281 = function(arg0, arg1, arg2) {
1404
+ const ret = makeMutClosure(arg0, arg1, 834, __wbg_adapter_60);
1169
1405
  return ret;
1170
1406
  };
1171
- imports.wbg.__wbindgen_closure_wrapper1972 = function(arg0, arg1, arg2) {
1172
- const ret = makeMutClosure(arg0, arg1, 748, __wbg_adapter_63);
1407
+ imports.wbg.__wbindgen_closure_wrapper2502 = function(arg0, arg1, arg2) {
1408
+ const ret = makeMutClosure(arg0, arg1, 898, __wbg_adapter_63);
1173
1409
  return ret;
1174
1410
  };
1175
- imports.wbg.__wbindgen_closure_wrapper2088 = function(arg0, arg1, arg2) {
1176
- const ret = makeMutClosure(arg0, arg1, 788, __wbg_adapter_66);
1411
+ imports.wbg.__wbindgen_closure_wrapper2618 = function(arg0, arg1, arg2) {
1412
+ const ret = makeMutClosure(arg0, arg1, 938, __wbg_adapter_66);
1177
1413
  return ret;
1178
1414
  };
1179
1415
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
Binary file
@@ -1,25 +1,52 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export const client_listDir: (a: number, b: any) => any;
5
- export const client_trashDir: (a: number, b: any) => any;
6
- export const client_dirExists: (a: number, b: any, c: number, d: number) => any;
7
- export const client_deleteDirPermanently: (a: number, b: any) => any;
8
- export const client_createDir: (a: number, b: any, c: number, d: number) => any;
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_toStringified: (a: number) => any;
12
- export const __wbg_client_free: (a: number, b: number) => void;
13
- export const client_downloadItemsToZip: (a: number, b: any) => any;
4
+ export const client_listIncomingContactRequests: (a: number) => any;
5
+ export const client_getContacts: (a: number) => any;
6
+ export const client_removeSharedLinkIn: (a: number, b: number, c: number) => any;
7
+ export const client_publicLinkFile: (a: number, b: any) => any;
8
+ export const client_removeSharedLinkOut: (a: number, b: number, c: number, d: bigint) => any;
9
+ export const client_sendContactRequest: (a: number, b: number, c: number) => any;
10
+ export const client_listOutShared: (a: number, b: number, c: number) => any;
11
+ export const client_cancelContactRequest: (a: number, b: number, c: number) => any;
12
+ export const client_makeUserFromContact: (a: number, b: any) => any;
13
+ export const client_removeDirLink: (a: number, b: any) => any;
14
+ export const client_updateFileLink: (a: number, b: any, c: any) => any;
15
+ export const client_deleteContact: (a: number, b: number, c: number) => any;
16
+ export const client_shareDir: (a: number, b: any, c: any) => any;
17
+ export const client_acceptContactRequest: (a: number, b: number, c: number) => any;
18
+ export const client_listLinkedDir: (a: number, b: any, c: any) => any;
19
+ export const client_getFileLinkStatus: (a: number, b: any) => any;
20
+ export const client_shareFile: (a: number, b: any, c: any) => any;
21
+ export const client_denyContactRequest: (a: number, b: number, c: number) => any;
22
+ export const client_publicLinkDir: (a: number, b: any) => any;
23
+ export const client_listOutgoingContactRequests: (a: number) => any;
24
+ export const client_getDirLinkStatus: (a: number, b: any) => any;
25
+ export const client_updateDirLink: (a: number, b: any, c: any) => any;
26
+ export const client_listInShared: (a: number, b: number) => any;
27
+ export const login: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
14
28
  export const main_js: () => void;
15
29
  export const fromStringified: (a: any) => [number, number, number];
16
- export const login: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
17
30
  export const client_downloadFile: (a: number, b: any) => any;
18
- export const client_downloadFileToWriter: (a: number, b: any) => any;
19
31
  export const client_deleteFilePermanently: (a: number, b: any) => any;
20
32
  export const client_trashFile: (a: number, b: any) => any;
21
- export const client_uploadFile: (a: number, b: number, c: number, d: any) => any;
22
33
  export const client_uploadFileFromReader: (a: number, b: any) => any;
34
+ export const client_uploadFile: (a: number, b: number, c: number, d: any) => any;
35
+ export const client_downloadFileToWriter: (a: number, b: any) => any;
36
+ export const client_downloadItemsToZip: (a: number, b: any) => any;
37
+ export const client_trashDir: (a: number, b: any) => any;
38
+ export const client_findItemInDir: (a: number, b: any, c: number, d: number) => any;
39
+ export const client_listRecents: (a: number) => any;
40
+ export const client_listDir: (a: number, b: any) => any;
41
+ export const client_dirExists: (a: number, b: any, c: number, d: number) => any;
42
+ export const client_getDirSize: (a: number, b: any) => any;
43
+ export const client_createDir: (a: number, b: any, c: number, d: number) => any;
44
+ export const client_listFavorites: (a: number) => any;
45
+ export const client_root: (a: number) => any;
46
+ export const client_deleteDirPermanently: (a: number, b: any) => any;
47
+ export const client_listDirRecursive: (a: number, b: any) => any;
48
+ export const client_toStringified: (a: number) => any;
49
+ export const __wbg_client_free: (a: number, b: number) => void;
23
50
  export const __wbg_intounderlyingsource_free: (a: number, b: number) => void;
24
51
  export const intounderlyingsource_cancel: (a: number) => void;
25
52
  export const intounderlyingsource_pull: (a: number, b: any) => any;
@@ -43,6 +70,6 @@ export const __wbindgen_export_6: WebAssembly.Table;
43
70
  export const __externref_table_dealloc: (a: number) => void;
44
71
  export const _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h1ad07d0627257b45: (a: number, b: number) => void;
45
72
  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 closure787_externref_shim: (a: number, b: number, c: any) => void;
47
- export const closure945_externref_shim: (a: number, b: number, c: any, d: any) => void;
73
+ export const closure937_externref_shim: (a: number, b: number, c: any) => void;
74
+ export const closure1103_externref_shim: (a: number, b: number, c: any, d: any) => void;
48
75
  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.6",
3
+ "version": "0.3.8",
4
4
  "description": "Filen WASM SDK using filen-sdk-rs",
5
5
  "type": "module",
6
6
  "scripts": {