@internxt/sdk 1.4.79 → 1.6.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.
Files changed (64) hide show
  1. package/dist/auth/index.d.ts +5 -0
  2. package/dist/auth/index.js +80 -12
  3. package/dist/auth/types.d.ts +17 -4
  4. package/dist/drive/backups/index.js +3 -3
  5. package/dist/drive/index.js +5 -1
  6. package/dist/drive/payments/index.d.ts +30 -17
  7. package/dist/drive/payments/index.js +78 -25
  8. package/dist/drive/payments/types.d.ts +67 -1
  9. package/dist/drive/payments/types.js +11 -6
  10. package/dist/drive/referrals/index.js +5 -1
  11. package/dist/drive/referrals/types.js +2 -2
  12. package/dist/drive/share/index.d.ts +1 -1
  13. package/dist/drive/share/index.js +49 -44
  14. package/dist/drive/share/types.d.ts +31 -29
  15. package/dist/drive/storage/index.d.ts +130 -10
  16. package/dist/drive/storage/index.js +253 -53
  17. package/dist/drive/storage/types.d.ts +107 -21
  18. package/dist/drive/storage/types.js +2 -2
  19. package/dist/drive/trash/index.d.ts +22 -2
  20. package/dist/drive/trash/index.js +44 -9
  21. package/dist/drive/trash/types.d.ts +9 -0
  22. package/dist/drive/users/index.d.ts +30 -3
  23. package/dist/drive/users/index.js +40 -6
  24. package/dist/drive/users/types.d.ts +16 -6
  25. package/dist/index.d.ts +3 -2
  26. package/dist/index.js +12 -7
  27. package/dist/network/download.js +5 -5
  28. package/dist/network/errors/codes.d.ts +1 -1
  29. package/dist/network/errors/context.d.ts +4 -4
  30. package/dist/network/errors/context.js +2 -2
  31. package/dist/network/errors/download.js +5 -1
  32. package/dist/network/errors/index.js +5 -1
  33. package/dist/network/errors/upload.js +5 -1
  34. package/dist/network/index.d.ts +2 -3
  35. package/dist/network/index.js +14 -9
  36. package/dist/network/types.d.ts +16 -16
  37. package/dist/network/types.js +2 -2
  38. package/dist/network/upload.js +8 -9
  39. package/dist/photos/devices/index.js +8 -8
  40. package/dist/photos/index.js +5 -1
  41. package/dist/photos/photos/index.js +26 -26
  42. package/dist/photos/shares/index.js +3 -3
  43. package/dist/photos/types.d.ts +14 -14
  44. package/dist/photos/types.js +3 -3
  45. package/dist/photos/users/index.js +2 -2
  46. package/dist/shared/headers/index.d.ts +9 -6
  47. package/dist/shared/headers/index.js +27 -18
  48. package/dist/shared/http/client.d.ts +1 -1
  49. package/dist/shared/http/client.js +4 -13
  50. package/dist/shared/http/types.d.ts +4 -4
  51. package/dist/shared/index.js +5 -1
  52. package/dist/shared/types/apiConnection.d.ts +2 -1
  53. package/dist/shared/types/appsumo.js +1 -1
  54. package/dist/shared/types/errors.d.ts +2 -1
  55. package/dist/shared/types/errors.js +2 -1
  56. package/dist/shared/types/userSettings.d.ts +17 -1
  57. package/dist/utils.js +2 -3
  58. package/dist/workspaces/index.d.ts +176 -0
  59. package/dist/workspaces/index.js +419 -0
  60. package/dist/workspaces/index.test.d.ts +1 -0
  61. package/dist/workspaces/index.test.js +908 -0
  62. package/dist/workspaces/types.d.ts +294 -0
  63. package/dist/workspaces/types.js +2 -0
  64. package/package.json +13 -13
@@ -13,12 +13,13 @@ export interface DriveFolderData {
13
13
  plain_name: string;
14
14
  parentId: number | null;
15
15
  parent_id: number | null;
16
+ parentUuid: string;
16
17
  updatedAt: string;
17
18
  userId: number;
18
19
  user_id: number;
20
+ uuid: string;
19
21
  }
20
22
  export interface DriveFileData {
21
- uuid: string;
22
23
  bucket: string;
23
24
  createdAt: string;
24
25
  created_at: string;
@@ -28,15 +29,23 @@ export interface DriveFileData {
28
29
  fileId: string;
29
30
  folderId: number;
30
31
  folder_id: number;
32
+ folderUuid: string;
31
33
  id: number;
32
34
  name: string;
33
- plain_name: string;
35
+ plain_name: string | null;
36
+ plainName?: string | null;
34
37
  size: number;
35
38
  type: string;
36
39
  updatedAt: string;
37
40
  status: string;
38
41
  thumbnails: Array<Thumbnail>;
39
42
  currentThumbnail: Thumbnail | null;
43
+ shares?: Array<ShareLink>;
44
+ sharings?: {
45
+ type: string;
46
+ id: string;
47
+ }[];
48
+ uuid: string;
40
49
  }
41
50
  export interface Thumbnail {
42
51
  id: number;
@@ -67,6 +76,7 @@ export interface FolderChild {
67
76
  userId: number;
68
77
  user_id: number;
69
78
  uuid: string;
79
+ plainName?: string;
70
80
  }
71
81
  export interface FetchFolderContentResponse {
72
82
  bucket: string;
@@ -95,6 +105,7 @@ export interface FileMeta {
95
105
  fileId: string;
96
106
  folderId: number;
97
107
  folder_id: number;
108
+ folderUuid: string;
98
109
  id: number;
99
110
  name: string;
100
111
  plain_name: string | null;
@@ -106,7 +117,7 @@ export interface FileMeta {
106
117
  thumbnails: Array<Thumbnail>;
107
118
  currentThumbnail: Thumbnail | null;
108
119
  shares?: Array<ShareLink>;
109
- uuid?: string;
120
+ uuid: string;
110
121
  }
111
122
  export interface ShareLink {
112
123
  id: string;
@@ -241,6 +252,16 @@ export interface FileEntry {
241
252
  folder_id: number;
242
253
  encrypt_version: EncryptionVersion;
243
254
  }
255
+ export interface FileEntryByUuid {
256
+ id: string;
257
+ type: string;
258
+ size: number;
259
+ name: string;
260
+ plain_name: string;
261
+ bucket: string;
262
+ folder_id: string;
263
+ encrypt_version: EncryptionVersion;
264
+ }
244
265
  export interface ThumbnailEntry {
245
266
  file_id: number;
246
267
  max_width: number;
@@ -255,15 +276,28 @@ export interface CreateFolderPayload {
255
276
  parentFolderId: number;
256
277
  folderName: string;
257
278
  }
279
+ export interface CreateFolderByUuidPayload {
280
+ plainName: string;
281
+ parentFolderUuid: string;
282
+ }
258
283
  export interface CreateFolderResponse {
259
- bucket: string;
260
284
  id: number;
261
- name: string;
262
- plain_name: string;
263
285
  parentId: number;
264
- createdAt: string;
265
- updatedAt: string;
286
+ parentUuid: string;
287
+ name: string;
288
+ bucket: string | null;
266
289
  userId: number;
290
+ encryptVersion: string | null;
291
+ deleted: boolean;
292
+ deletedAt: Date | null;
293
+ createdAt: Date;
294
+ updatedAt: Date;
295
+ uuid: string;
296
+ plainName: string;
297
+ removed: boolean;
298
+ removedAt: Date | null;
299
+ creationTime: Date;
300
+ modificationTime: Date;
267
301
  }
268
302
  export interface MoveFolderPayload {
269
303
  folderId: number;
@@ -313,7 +347,7 @@ export interface MoveFileResponse {
313
347
  destination: number;
314
348
  moved: boolean;
315
349
  }
316
- export declare type UsageResponse = {
350
+ export type UsageResponse = {
317
351
  _id: string;
318
352
  } & {
319
353
  [k in 'drive' | 'backups' | 'total']: number;
@@ -369,26 +403,78 @@ export interface FolderAncestor {
369
403
  uuid: string;
370
404
  }
371
405
  export interface FolderMeta {
372
- bucket: null | string;
373
- createdAt: string;
374
- deleted: boolean;
375
- deletedAt: null | string;
376
- encryptVersion: null | string;
377
406
  id: number;
407
+ uuid: string;
378
408
  name: string;
379
- parent: null | string;
380
- parentId: number;
409
+ plain_name: string;
381
410
  plainName: string;
411
+ bucket: string | null;
412
+ parent_id: number | null;
413
+ parentId: number | null;
414
+ parent_uuid: string | null;
415
+ parentUuid: string | null;
416
+ parent: string | null;
417
+ created_at: string;
418
+ createdAt: string;
419
+ updated_at: string;
420
+ updatedAt: string;
421
+ user: string | null;
422
+ user_id: number;
423
+ userId: number;
424
+ encrypt_version: string | null;
425
+ encryptVersion: string | null;
426
+ deleted: boolean;
427
+ deleted_at: string | null;
428
+ deletedAt: string | null;
382
429
  removed: boolean;
383
- removedAt: null | string;
430
+ removed_at: string | null;
431
+ removedAt: string | null;
384
432
  size: number;
385
433
  type: string;
386
- updatedAt: string;
387
- user: null | string;
388
- userId: number;
389
- uuid: string;
434
+ creation_time: string;
435
+ modification_time: string;
390
436
  }
391
437
  export interface ReplaceFile {
392
438
  fileId: string;
393
439
  size: number;
394
440
  }
441
+ export interface FolderTree {
442
+ id: number;
443
+ bucket: string | null;
444
+ children: FolderTree[];
445
+ encrypt_version: string;
446
+ files: DriveFileData[];
447
+ name: string;
448
+ plainName: string;
449
+ parentId: number;
450
+ userId: number;
451
+ uuid: string;
452
+ parentUuid: string;
453
+ createdAt: string;
454
+ updatedAt: string;
455
+ size: number;
456
+ type: string;
457
+ deleted: boolean;
458
+ removed: boolean;
459
+ }
460
+ export interface FolderTreeResponse {
461
+ tree: FolderTree;
462
+ }
463
+ export interface CheckDuplicatedFilesPayload {
464
+ folderUuid: string;
465
+ filesList: FileStructure[];
466
+ }
467
+ export interface FileStructure {
468
+ plainName: string;
469
+ type: string;
470
+ }
471
+ export interface CheckDuplicatedFilesResponse {
472
+ existentFiles: DriveFileData[];
473
+ }
474
+ export interface CheckDuplicatedFolderPayload {
475
+ folderUuid: string;
476
+ folderNamesList: string[];
477
+ }
478
+ export interface CheckDuplicatedFoldersResponse {
479
+ existentFolders: DriveFolderData[];
480
+ }
@@ -6,8 +6,8 @@ var FileStatus;
6
6
  FileStatus["EXISTS"] = "EXISTS";
7
7
  FileStatus["TRASHED"] = "TRASHED";
8
8
  FileStatus["DELETED"] = "DELETED";
9
- })(FileStatus = exports.FileStatus || (exports.FileStatus = {}));
9
+ })(FileStatus || (exports.FileStatus = FileStatus = {}));
10
10
  var EncryptionVersion;
11
11
  (function (EncryptionVersion) {
12
12
  EncryptionVersion["Aes03"] = "03-aes";
13
- })(EncryptionVersion = exports.EncryptionVersion || (exports.EncryptionVersion = {}));
13
+ })(EncryptionVersion || (exports.EncryptionVersion = EncryptionVersion = {}));
@@ -1,6 +1,6 @@
1
- import { AddItemsToTrashPayload, DeleteFilePayload, DeleteItemsPermanentlyPayload } from './types';
2
- import { FetchFolderContentResponse, FetchTrashContentResponse } from '../storage/types';
3
1
  import { ApiSecurity, ApiUrl, AppDetails } from '../../shared';
2
+ import { FetchFolderContentResponse, FetchTrashContentResponse } from '../storage/types';
3
+ import { AddItemsToTrashPayload, DeleteFilePayload, DeleteItemsPermanentlyByUUIDPayload, DeleteItemsPermanentlyPayload } from './types';
4
4
  export * as TrashTypes from './types';
5
5
  export declare class Trash {
6
6
  private readonly client;
@@ -33,6 +33,19 @@ export declare class Trash {
33
33
  * @returns {Promise<FetchTrashContentResponse>} - A promise that resolves with the paginated list of trashed content.
34
34
  */
35
35
  getTrashedFilesPaginated(limit: number, offset: number | undefined, type: 'files' | 'folders', root: boolean, folderId?: number): Promise<FetchTrashContentResponse>;
36
+ /**
37
+ * Retrieves a sorted list of trashed files or folders.
38
+ * @param {number} limit - The number of items to retrieve per page.
39
+ * @param {number} [offset=0] - The number of items to skip before beginning to return items.
40
+ * @param {'files' | 'folders'} type - The type of content to retrieve.
41
+ * @param {boolean} root - A boolean indicating whether to retrieve content from the root folder.
42
+ * If is not true it has to get a folderId in order to obtain the items or given folderId
43
+ * @param {'plainName' | 'date'} [sort] - The ID of the folder to retrieve content from.
44
+ * @param {'ASC' | 'DESC'} [order] - The ID of the folder to retrieve content from.
45
+ * @param {number} [folderId] - The ID of the folder to retrieve content from.
46
+ * @returns {Promise<FetchTrashContentResponse>} - A promise that resolves with the paginated list of trashed content.
47
+ */
48
+ getTrashedItemsSorted(limit: number, offset: number | undefined, type: 'files' | 'folders', root: boolean, sort: 'plainName' | 'updatedAt', order: 'ASC' | 'DESC', folderId?: number): Promise<FetchTrashContentResponse>;
36
49
  /**
37
50
  * Add Items to Trash
38
51
  * @param payload
@@ -47,6 +60,13 @@ export declare class Trash {
47
60
  * @param payload
48
61
  */
49
62
  deleteItemsPermanently(payload: DeleteItemsPermanentlyPayload): Promise<unknown>;
63
+ /**
64
+ * Deletes trashed items permanently by UUID.
65
+ *
66
+ * @param {DeleteItemsPermanentlyByUUIDPayload} payload - The payload containing the items to be deleted.
67
+ * @return {Promise<void>} A promise that resolves when the items are deleted permanently.
68
+ */
69
+ deleteItemsPermanentlyByUUID(payload: DeleteItemsPermanentlyByUUIDPayload): Promise<unknown>;
50
70
  /**
51
71
  * Returns the needed headers for the module requests
52
72
  * @private
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -28,12 +32,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
28
32
  });
29
33
  };
30
34
  var __generator = (this && this.__generator) || function (thisArg, body) {
31
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
32
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
35
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
36
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
33
37
  function verb(n) { return function (v) { return step([n, v]); }; }
34
38
  function step(op) {
35
39
  if (f) throw new TypeError("Generator is already executing.");
36
- while (_) try {
40
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
37
41
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
38
42
  if (y = 0, t) op = [op[0] & 2, t.value];
39
43
  switch (op[0]) {
@@ -75,7 +79,7 @@ var Trash = /** @class */ (function () {
75
79
  Trash.prototype.deleteFolder = function (folderId) {
76
80
  return __awaiter(this, void 0, void 0, function () {
77
81
  return __generator(this, function (_a) {
78
- return [2 /*return*/, this.client.delete("/storage/folder/" + folderId, this.headers())];
82
+ return [2 /*return*/, this.client.delete("/storage/folder/".concat(folderId), this.headers())];
79
83
  });
80
84
  });
81
85
  };
@@ -86,7 +90,7 @@ var Trash = /** @class */ (function () {
86
90
  Trash.prototype.deleteFile = function (payload) {
87
91
  return __awaiter(this, void 0, void 0, function () {
88
92
  return __generator(this, function (_a) {
89
- return [2 /*return*/, this.client.delete("/storage/folder/" + payload.folderId + "/file/" + payload.fileId, this.headers())];
93
+ return [2 /*return*/, this.client.delete("/storage/folder/".concat(payload.folderId, "/file/").concat(payload.fileId), this.headers())];
90
94
  });
91
95
  });
92
96
  };
@@ -109,8 +113,28 @@ var Trash = /** @class */ (function () {
109
113
  Trash.prototype.getTrashedFilesPaginated = function (limit, offset, type, root, folderId) {
110
114
  if (offset === void 0) { offset = 0; }
111
115
  var endpoint = '/storage/trash/paginated';
112
- var folderIdQuery = folderId !== undefined ? "folderId=" + folderId + "&" : '';
113
- var url = endpoint + "?" + folderIdQuery + "limit=" + limit + "&offset=" + offset + "&type=" + type + "&root=" + root;
116
+ var folderIdQuery = folderId !== undefined ? "folderId=".concat(folderId, "&") : '';
117
+ var url = "".concat(endpoint, "?").concat(folderIdQuery, "limit=").concat(limit, "&offset=").concat(offset, "&type=").concat(type, "&root=").concat(root);
118
+ return this.client.get(url, this.headers());
119
+ };
120
+ /**
121
+ * Retrieves a sorted list of trashed files or folders.
122
+ * @param {number} limit - The number of items to retrieve per page.
123
+ * @param {number} [offset=0] - The number of items to skip before beginning to return items.
124
+ * @param {'files' | 'folders'} type - The type of content to retrieve.
125
+ * @param {boolean} root - A boolean indicating whether to retrieve content from the root folder.
126
+ * If is not true it has to get a folderId in order to obtain the items or given folderId
127
+ * @param {'plainName' | 'date'} [sort] - The ID of the folder to retrieve content from.
128
+ * @param {'ASC' | 'DESC'} [order] - The ID of the folder to retrieve content from.
129
+ * @param {number} [folderId] - The ID of the folder to retrieve content from.
130
+ * @returns {Promise<FetchTrashContentResponse>} - A promise that resolves with the paginated list of trashed content.
131
+ */
132
+ Trash.prototype.getTrashedItemsSorted = function (limit, offset, type, root, sort, order, folderId) {
133
+ if (offset === void 0) { offset = 0; }
134
+ var endpoint = '/storage/trash/paginated';
135
+ var folderIdQuery = folderId !== undefined ? "folderId=".concat(folderId, "&") : '';
136
+ var params = "limit=".concat(limit, "&offset=").concat(offset, "&type=").concat(type, "&root=").concat(root, "&sort=").concat(sort, "&order=").concat(order);
137
+ var url = "".concat(endpoint, "?").concat(folderIdQuery).concat(params);
114
138
  return this.client.get(url, this.headers());
115
139
  };
116
140
  /**
@@ -137,12 +161,23 @@ var Trash = /** @class */ (function () {
137
161
  items: payload.items,
138
162
  });
139
163
  };
164
+ /**
165
+ * Deletes trashed items permanently by UUID.
166
+ *
167
+ * @param {DeleteItemsPermanentlyByUUIDPayload} payload - The payload containing the items to be deleted.
168
+ * @return {Promise<void>} A promise that resolves when the items are deleted permanently.
169
+ */
170
+ Trash.prototype.deleteItemsPermanentlyByUUID = function (payload) {
171
+ return this.client.delete('/storage/trash', this.headers(), {
172
+ items: payload.items,
173
+ });
174
+ };
140
175
  /**
141
176
  * Returns the needed headers for the module requests
142
177
  * @private
143
178
  */
144
179
  Trash.prototype.headers = function () {
145
- return (0, headers_1.headersWithToken)(this.appDetails.clientName, this.appDetails.clientVersion, this.apiSecurity.token);
180
+ return (0, headers_1.headersWithToken)(this.appDetails.clientName, this.appDetails.clientVersion, this.apiSecurity.token, this.apiSecurity.workspaceToken);
146
181
  };
147
182
  return Trash;
148
183
  }());
@@ -18,3 +18,12 @@ export interface DeleteItemsPermanentlyPayload {
18
18
  type: 'file';
19
19
  }>;
20
20
  }
21
+ export interface DeleteItemsPermanentlyByUUIDPayload {
22
+ items: Array<{
23
+ uuid: string;
24
+ type: 'folder';
25
+ } | {
26
+ uuid: string;
27
+ type: 'file';
28
+ }>;
29
+ }
@@ -1,6 +1,6 @@
1
1
  import { ApiSecurity, ApiUrl, AppDetails } from '../../shared';
2
- import { ChangePasswordPayload, CheckChangeEmailExpirationResponse, FriendInvite, InitializeUserResponse, PreCreateUserResponse, UpdateProfilePayload, UserPublicKeyResponse, VerifyEmailChangeResponse } from './types';
3
2
  import { UserSettings } from '../../shared/types/userSettings';
3
+ import { ChangePasswordPayload, ChangePasswordPayloadNew, CheckChangeEmailExpirationResponse, FriendInvite, InitializeUserResponse, PreCreateUserResponse, UpdateProfilePayload, UserPublicKeyResponse, VerifyEmailChangeResponse } from './types';
4
4
  export * as UserTypes from './types';
5
5
  export declare class Users {
6
6
  private readonly client;
@@ -27,12 +27,39 @@ export declare class Users {
27
27
  token: string;
28
28
  }>;
29
29
  /**
30
- * Updates the authentication credentials and invalidates previous tokens
30
+ * Retrieves the user data for a specific user identified by the uuid.
31
+ *
32
+ * @param {string} params.userUuid - The UUID of the user.
33
+ * @return {Promise<Object>} A promise that resolves to an object containing the user data.
34
+ * The object has the following properties:
35
+ * - `newToken` (string): The new token of the user.
36
+ * - `oldToken` (string): The old drive token of the user.
37
+ * - `user` (UserSettings): The user data.
38
+ */
39
+ getUserData({ userUuid }: {
40
+ userUuid: string;
41
+ }): Promise<{
42
+ newToken: string;
43
+ oldToken: string;
44
+ user: UserSettings;
45
+ }>;
46
+ /**
47
+ * Updates the authentication credentials and invalidates previous tokens (Legacy backend (drive-server))
48
+ * @param payload
49
+ *
50
+ * @returns {Promise<{token: string, newToken: string}>} A promise that returns new tokens for this user.
51
+ */
52
+ changePasswordLegacy(payload: ChangePasswordPayload): Promise<{
53
+ token: string;
54
+ newToken: string;
55
+ }>;
56
+ /**
57
+ * Updates the authentication credentials and invalidates previous tokens (New backend (drive-server-wip))
31
58
  * @param payload
32
59
  *
33
60
  * @returns {Promise<{token: string, newToken: string}>} A promise that returns new tokens for this user.
34
61
  */
35
- changePassword(payload: ChangePasswordPayload): Promise<{
62
+ changePassword(payload: ChangePasswordPayloadNew): Promise<{
36
63
  token: string;
37
64
  newToken: string;
38
65
  }>;
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -63,12 +67,26 @@ var Users = /** @class */ (function () {
63
67
  return this.client.get('/user/refresh', this.headers());
64
68
  };
65
69
  /**
66
- * Updates the authentication credentials and invalidates previous tokens
70
+ * Retrieves the user data for a specific user identified by the uuid.
71
+ *
72
+ * @param {string} params.userUuid - The UUID of the user.
73
+ * @return {Promise<Object>} A promise that resolves to an object containing the user data.
74
+ * The object has the following properties:
75
+ * - `newToken` (string): The new token of the user.
76
+ * - `oldToken` (string): The old drive token of the user.
77
+ * - `user` (UserSettings): The user data.
78
+ */
79
+ Users.prototype.getUserData = function (_a) {
80
+ var userUuid = _a.userUuid;
81
+ return this.client.get("/users/c/".concat(userUuid), this.headers());
82
+ };
83
+ /**
84
+ * Updates the authentication credentials and invalidates previous tokens (Legacy backend (drive-server))
67
85
  * @param payload
68
86
  *
69
87
  * @returns {Promise<{token: string, newToken: string}>} A promise that returns new tokens for this user.
70
88
  */
71
- Users.prototype.changePassword = function (payload) {
89
+ Users.prototype.changePasswordLegacy = function (payload) {
72
90
  return this.client.patch('/user/password', {
73
91
  currentPassword: payload.currentEncryptedPassword,
74
92
  newPassword: payload.newEncryptedPassword,
@@ -77,6 +95,22 @@ var Users = /** @class */ (function () {
77
95
  privateKey: payload.encryptedPrivateKey,
78
96
  }, this.headers());
79
97
  };
98
+ /**
99
+ * Updates the authentication credentials and invalidates previous tokens (New backend (drive-server-wip))
100
+ * @param payload
101
+ *
102
+ * @returns {Promise<{token: string, newToken: string}>} A promise that returns new tokens for this user.
103
+ */
104
+ Users.prototype.changePassword = function (payload) {
105
+ return this.client.patch('/users/password', {
106
+ currentPassword: payload.currentEncryptedPassword,
107
+ newPassword: payload.newEncryptedPassword,
108
+ newSalt: payload.newEncryptedSalt,
109
+ mnemonic: payload.encryptedMnemonic,
110
+ privateKey: payload.encryptedPrivateKey,
111
+ encryptVersion: payload.encryptVersion,
112
+ }, this.headers());
113
+ };
80
114
  /**
81
115
  * Pre registers an email
82
116
  * @param email
@@ -147,7 +181,7 @@ var Users = /** @class */ (function () {
147
181
  * @returns {Promise<VerifyEmailChangeResponse>}
148
182
  */
149
183
  Users.prototype.verifyEmailChange = function (encryptedAttemptChangeEmailId) {
150
- return this.client.post("users/attempt-change-email/" + encryptedAttemptChangeEmailId + "/accept", {}, this.headers());
184
+ return this.client.post("users/attempt-change-email/".concat(encryptedAttemptChangeEmailId, "/accept"), {}, this.headers());
151
185
  };
152
186
  /**
153
187
  * Check if user email change verification link is expired
@@ -157,14 +191,14 @@ var Users = /** @class */ (function () {
157
191
  * @returns {Promise<CheckChangeEmailExpirationResponse>}
158
192
  */
159
193
  Users.prototype.checkChangeEmailExpiration = function (encryptedAttemptChangeEmailId) {
160
- return this.client.get("users/attempt-change-email/" + encryptedAttemptChangeEmailId + "/verify-expiration", this.headers());
194
+ return this.client.get("users/attempt-change-email/".concat(encryptedAttemptChangeEmailId, "/verify-expiration"), this.headers());
161
195
  };
162
196
  /**
163
197
  * Get public key of given email
164
198
  */
165
199
  Users.prototype.getPublicKeyByEmail = function (_a) {
166
200
  var email = _a.email;
167
- return this.client.get("/users/public-key/" + email, this.headers());
201
+ return this.client.get("/users/public-key/".concat(email), this.headers());
168
202
  };
169
203
  Users.prototype.headers = function () {
170
204
  return (0, headers_1.headersWithToken)(this.appDetails.clientName, this.appDetails.clientVersion, this.apiSecurity.token);
@@ -12,24 +12,34 @@ export interface ChangePasswordPayload {
12
12
  encryptedMnemonic: string;
13
13
  encryptedPrivateKey: string;
14
14
  }
15
- export declare type UpdateProfilePayload = Partial<Pick<UserSettings, 'name' | 'lastname'>>;
16
- export declare type PreCreateUserResponse = {
15
+ export interface ChangePasswordPayloadNew {
16
+ currentEncryptedPassword: string;
17
+ newEncryptedPassword: string;
18
+ newEncryptedSalt: string;
19
+ encryptedMnemonic: string;
20
+ encryptedPrivateKey: string;
21
+ encryptVersion: string;
22
+ }
23
+ export type UpdateProfilePayload = Partial<Pick<UserSettings, 'name' | 'lastname'>>;
24
+ export type PreCreateUserResponse = {
17
25
  publicKey: string;
26
+ publicKyberKey: string;
18
27
  user: {
19
28
  uuid: UUID;
20
29
  email: string;
21
30
  };
22
31
  };
23
- export declare type FriendInvite = {
32
+ export type FriendInvite = {
24
33
  guestEmail: string;
25
34
  host: number;
26
35
  accepted: boolean;
27
36
  id: number;
28
37
  };
29
- export declare type UserPublicKeyResponse = {
38
+ export type UserPublicKeyResponse = {
30
39
  publicKey: string;
40
+ publicKyberKey: string;
31
41
  };
32
- export declare type VerifyEmailChangeResponse = {
42
+ export type VerifyEmailChangeResponse = {
33
43
  oldEmail: string;
34
44
  newEmail: string;
35
45
  newAuthentication: {
@@ -38,6 +48,6 @@ export declare type VerifyEmailChangeResponse = {
38
48
  newToken: string;
39
49
  };
40
50
  };
41
- export declare type CheckChangeEmailExpirationResponse = {
51
+ export type CheckChangeEmailExpirationResponse = {
42
52
  isExpired: boolean;
43
53
  };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- export * as photos from './photos';
2
1
  export * from './auth';
3
2
  export * as Drive from './drive';
4
- export * as Shared from './shared';
5
3
  export * as Network from './network';
4
+ export * as photos from './photos';
5
+ export * as Shared from './shared';
6
+ export * as Workspaces from './workspaces';
package/dist/index.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -11,6 +15,9 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
11
15
  }) : function(o, v) {
12
16
  o["default"] = v;
13
17
  });
18
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
19
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
20
+ };
14
21
  var __importStar = (this && this.__importStar) || function (mod) {
15
22
  if (mod && mod.__esModule) return mod;
16
23
  var result = {};
@@ -18,13 +25,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
18
25
  __setModuleDefault(result, mod);
19
26
  return result;
20
27
  };
21
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
22
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
23
- };
24
28
  Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.Network = exports.Shared = exports.Drive = exports.photos = void 0;
26
- exports.photos = __importStar(require("./photos"));
29
+ exports.Workspaces = exports.Shared = exports.photos = exports.Network = exports.Drive = void 0;
27
30
  __exportStar(require("./auth"), exports);
28
31
  exports.Drive = __importStar(require("./drive"));
29
- exports.Shared = __importStar(require("./shared"));
30
32
  exports.Network = __importStar(require("./network"));
33
+ exports.photos = __importStar(require("./photos"));
34
+ exports.Shared = __importStar(require("./shared"));
35
+ exports.Workspaces = __importStar(require("./workspaces"));
@@ -24,12 +24,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
24
24
  });
25
25
  };
26
26
  var __generator = (this && this.__generator) || function (thisArg, body) {
27
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
27
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
28
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
29
  function verb(n) { return function (v) { return step([n, v]); }; }
30
30
  function step(op) {
31
31
  if (f) throw new TypeError("Generator is already executing.");
32
- while (_) try {
32
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
33
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
34
  if (y = 0, t) op = [op[0] & 2, t.value];
35
35
  switch (op[0]) {
@@ -51,7 +51,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
51
51
  }
52
52
  };
53
53
  Object.defineProperty(exports, "__esModule", { value: true });
54
- exports.downloadFile = exports.FileVersionOneError = void 0;
54
+ exports.FileVersionOneError = void 0;
55
+ exports.downloadFile = downloadFile;
55
56
  var errors_1 = require("./errors");
56
57
  var types_1 = require("./types");
57
58
  var FileVersionOneError = /** @class */ (function (_super) {
@@ -120,4 +121,3 @@ function downloadFile(fileId, bucketId, mnemonic, network, crypto, toBinaryData,
120
121
  });
121
122
  });
122
123
  }
123
- exports.downloadFile = downloadFile;
@@ -11,7 +11,7 @@ declare enum UploadErrorCode {
11
11
  declare enum DownloadErrorCode {
12
12
  InvalidMnemonic = 12100
13
13
  }
14
- declare type NetworkErrorCode = UploadErrorCode | DownloadErrorCode;
14
+ type NetworkErrorCode = UploadErrorCode | DownloadErrorCode;
15
15
  export declare class CodeError extends Error {
16
16
  code: NetworkErrorCode;
17
17
  message: string;