@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
@@ -1,8 +1,8 @@
1
- import { CreateFolderPayload, CreateFolderResponse, DeleteFilePayload, DriveFileData, FetchFolderContentResponse, FileEntry, MoveFilePayload, MoveFileResponse, MoveFolderPayload, MoveFolderResponse, UpdateFilePayload, UpdateFolderMetadataPayload, FetchLimitResponse, UsageResponse, AddItemsToTrashPayload, ThumbnailEntry, Thumbnail, FetchPaginatedFolderContentResponse, FileMeta, SearchResultData, FolderAncestor, FolderMeta, ReplaceFile, FetchPaginatedFilesContent, FetchPaginatedFoldersContent, MoveFolderUuidPayload, MoveFileUuidPayload } from './types';
1
+ import { Token } from '../../auth';
2
2
  import { ApiSecurity, ApiUrl, AppDetails } from '../../shared';
3
3
  import { RequestCanceler } from '../../shared/http/client';
4
- import { Token } from '../../auth';
5
4
  import { UUID } from '../../shared/types/userSettings';
5
+ import { AddItemsToTrashPayload, CheckDuplicatedFilesPayload, CheckDuplicatedFilesResponse, CheckDuplicatedFolderPayload, CheckDuplicatedFoldersResponse, CreateFolderByUuidPayload, CreateFolderPayload, CreateFolderResponse, DeleteFilePayload, DriveFileData, FetchFolderContentResponse, FetchLimitResponse, FetchPaginatedFilesContent, FetchPaginatedFolderContentResponse, FetchPaginatedFoldersContent, FileEntry, FileEntryByUuid, FileMeta, FolderAncestor, FolderMeta, FolderTreeResponse, MoveFilePayload, MoveFileResponse, MoveFileUuidPayload, MoveFolderPayload, MoveFolderResponse, MoveFolderUuidPayload, ReplaceFile, SearchResultData, Thumbnail, ThumbnailEntry, UpdateFilePayload, UpdateFolderMetadataPayload, UsageResponse } from './types';
6
6
  export * as StorageTypes from './types';
7
7
  export declare class Storage {
8
8
  private readonly client;
@@ -15,6 +15,11 @@ export declare class Storage {
15
15
  * @param payload
16
16
  */
17
17
  createFolder(payload: CreateFolderPayload): [Promise<CreateFolderResponse>, RequestCanceler];
18
+ /**
19
+ * Creates a new folder
20
+ * @param payload
21
+ */
22
+ createFolderByUuid(payload: CreateFolderByUuidPayload): [Promise<CreateFolderResponse>, RequestCanceler];
18
23
  /**
19
24
  * Moves a specific folder to a new location
20
25
  * @param payload
@@ -30,16 +35,49 @@ export declare class Storage {
30
35
  * @param payload
31
36
  */
32
37
  updateFolder(payload: UpdateFolderMetadataPayload): Promise<void>;
38
+ /**
39
+ * Updates the name of a folder with the given UUID.
40
+ *
41
+ * @param {Object} payload - The payload containing the folder UUID and the new name.
42
+ * @param {string} payload.folderUuid - The UUID of the folder to update.
43
+ * @param {string} payload.name - The new name for the folder.
44
+ * @param {Token} [resourcesToken] - An optional token for authentication.
45
+ * @return {Promise<void>} A promise that resolves when the folder name is successfully updated.
46
+ */
47
+ updateFolderNameWithUUID(payload: {
48
+ folderUuid: string;
49
+ name: string;
50
+ }, resourcesToken?: Token): Promise<void>;
33
51
  /**
34
52
  * Fetches & returns the contents of a specific folder
35
53
  * @param folderId
36
54
  */
37
55
  getFolderContent(folderId: number, trash?: boolean): [Promise<FetchFolderContentResponse>, RequestCanceler];
38
56
  /**
39
- * Returns metadata of a specific file
40
- * @param fileId
57
+ * Fetches and returns the contents of a specific folder by its UUID.
58
+ *
59
+ * @param {string} folderUuid - The UUID of the folder.
60
+ * @param {boolean} [trash=false] - Whether to include trash items in the response.
61
+ * @param {boolean} [offset] - The position of the first file to return.
62
+ * @param {boolean} [limit] - The max number of files to be returned.
63
+ * @param {boolean} [workspacesToken] - Token for accessing workspaces.
64
+ * @return {[Promise<FetchFolderContentResponse>, RequestCanceler]} An array containing a promise to get the API response and a function to cancel the request.
41
65
  */
42
- getFile(fileId: string): [Promise<FileMeta>, RequestCanceler];
66
+ getFolderContentByUuid({ folderUuid, trash, offset, limit, workspacesToken, }: {
67
+ folderUuid: string;
68
+ trash?: boolean;
69
+ limit?: number;
70
+ offset?: number;
71
+ workspacesToken?: string;
72
+ }): [Promise<FetchFolderContentResponse>, RequestCanceler];
73
+ /**
74
+ * Retrieves a file with the specified fileId along with the associated workspacesToken.
75
+ *
76
+ * @param {string} fileId - The ID of the file to retrieve.
77
+ * @param {string} [workspacesToken] - Token for accessing workspaces.
78
+ * @return {[Promise<FileMeta>, RequestCanceler]} A promise with FileMeta and a canceler for the request.
79
+ */
80
+ getFile(fileId: string, workspacesToken?: string): [Promise<FileMeta>, RequestCanceler];
43
81
  /**
44
82
  * Gets the files in a folder.
45
83
  *
@@ -99,6 +137,11 @@ export declare class Storage {
99
137
  * @param fileEntry
100
138
  */
101
139
  createFileEntry(fileEntry: FileEntry, resourcesToken?: Token): Promise<DriveFileData>;
140
+ /**
141
+ * Creates a new file entry
142
+ * @param fileEntry
143
+ */
144
+ createFileEntryByUuid(fileEntry: FileEntryByUuid, resourcesToken?: string): Promise<DriveFileData>;
102
145
  /**
103
146
  * Creates a new thumbnail entry
104
147
  * @param thumbnailEntry
@@ -109,6 +152,33 @@ export declare class Storage {
109
152
  * @param payload
110
153
  */
111
154
  updateFile(payload: UpdateFilePayload, resourcesToken?: Token): Promise<void>;
155
+ /**
156
+ * Updates the name of a file with the given UUID.
157
+ *
158
+ * @param {Object} payload - The payload containing the UUID and new name of the file.
159
+ * @param {string} payload.fileUuid - The UUID of the file.
160
+ * @param {string} payload.name - The new name of the file.
161
+ * @param {string} [resourcesToken] - The token for accessing resources.
162
+ * @return {Promise<void>} - A Promise that resolves when the file name is successfully updated.
163
+ */
164
+ updateFileNameWithUUID(payload: {
165
+ fileUuid: string;
166
+ name: string;
167
+ }, resourcesToken?: Token): Promise<void>;
168
+ /**
169
+ * Updates the name and the type from a given file UUID.
170
+ *
171
+ * @param {Object} payload - The payload containing the UUID and the new properties of the file.
172
+ * @param {string} payload.fileUuid - The UUID of the file.
173
+ * @param {string} payload.name - The new name of the file.
174
+ * @param {string} payload.type - The new type of the file.
175
+ * @param {string} [resourcesToken] - The token for accessing resources.
176
+ * @return {Promise<void>} - A Promise that resolves when the file name is successfully updated.
177
+ */
178
+ updateFileMetaByUUID(fileUuid: string, payload: {
179
+ plainName?: string;
180
+ type?: string | null;
181
+ }, resourcesToken?: Token): Promise<void>;
112
182
  /**
113
183
  * Deletes a specific file entry
114
184
  * @param payload
@@ -127,8 +197,14 @@ export declare class Storage {
127
197
  /**
128
198
  * Returns a list of the n most recent files
129
199
  * @param limit
200
+ * @deprecated use `getRecentFilesV2` call instead.
130
201
  */
131
202
  getRecentFiles(limit: number): Promise<DriveFileData[]>;
203
+ /**
204
+ * Returns a list of the n most recent files
205
+ * @param limit
206
+ */
207
+ getRecentFilesV2(limit: number): Promise<DriveFileData[]>;
132
208
  /**
133
209
  * Returns a list of items in trash
134
210
  */
@@ -155,9 +231,10 @@ export declare class Storage {
155
231
  * Get global search items.
156
232
  *
157
233
  * @param {string} search - The name of the item.
234
+ * @param {string} workspaceId - The ID of the workspace (optional).
158
235
  * @returns {[Promise<SearchResultData>, RequestCanceler]} An array containing a promise to get the API response and a function to cancel the request.
159
236
  */
160
- getGlobalSearchItems(search: string): [Promise<SearchResultData>, RequestCanceler];
237
+ getGlobalSearchItems(search: string, workspaceId?: string): [Promise<SearchResultData>, RequestCanceler];
161
238
  /**
162
239
  * Returns the needed headers for the module requests
163
240
  * @private
@@ -166,17 +243,18 @@ export declare class Storage {
166
243
  /**
167
244
  * Gets the ancestors of a given folder UUID
168
245
  *
169
- * @param {string} folderUUID - UUID of the folder.
170
- * @returns {Promise<FolderAncestor[]>}
246
+ * @param {string} uuid - UUID of the folder.
247
+ * @param {boolean} [isShared=false] - Whether the folder is a shared item or not.
248
+ * @returns {Promise<FolderAncestor[]>} A promise that resolves with an array of ancestors of the given folder.
171
249
  */
172
- getFolderAncestors(uuid: string): Promise<FolderAncestor[]>;
250
+ getFolderAncestors(uuid: string, isShared?: boolean): Promise<FolderAncestor[]>;
173
251
  /**
174
252
  * Gets the meta of a given folder UUID
175
253
  *
176
254
  * @param {string} folderUUID - UUID of the folder.
177
255
  * @returns {Promise<FolderMeta>}
178
256
  */
179
- getFolderMeta(uuid: string): Promise<FolderMeta>;
257
+ getFolderMeta(uuid: string, workspacesToken?: string, resourcesToken?: string): Promise<FolderMeta>;
180
258
  /**
181
259
  * Gets the meta of a given folder Id
182
260
  *
@@ -192,4 +270,46 @@ export declare class Storage {
192
270
  * @returns {Promise<DriveFileData>} - The replaced file data.
193
271
  */
194
272
  replaceFile(uuid: string, payload: ReplaceFile): Promise<DriveFileData>;
273
+ /**
274
+ * Checks the size limit for a file.
275
+ *
276
+ * @param {number} size - The size of the file to check.
277
+ * @return {Promise<void>} - A promise that resolves when the size limit check is complete.
278
+ */
279
+ checkSizeLimit(size: number): Promise<void>;
280
+ /**
281
+ * Retrieves the folder tree based on the UUID.
282
+ *
283
+ * @param {string} uuid - The UUID of the folder.
284
+ * @return {Promise<FolderTreeResponse>} The promise containing the folder tree response.
285
+ */
286
+ getFolderTree(uuid: string): Promise<FolderTreeResponse>;
287
+ /**
288
+ * Checks if the given files already exist in the given folder.
289
+ *
290
+ * @param {CheckDuplicatedFilesPayload} payload - Payload containing the folder UUID and the list of files to check.
291
+ * @return {Promise<CheckDuplicatedFilesResponse>} - Promise that contains the duplicated files in a list.
292
+ */
293
+ checkDuplicatedFiles({ folderUuid, filesList, }: CheckDuplicatedFilesPayload): Promise<CheckDuplicatedFilesResponse>;
294
+ /**
295
+ * Checks if the given folders names already exist in the given folder
296
+ *
297
+ * @param {CheckDuplicatedFolderPayload} payload - Payload containing the folder UUID and the list of folders to check.
298
+ * @return {Promise<CheckDuplicatedFoldersResponse>} - Promise that contains the duplicated folders in a list.
299
+ */
300
+ checkDuplicatedFolders({ folderUuid, folderNamesList, }: CheckDuplicatedFolderPayload): Promise<CheckDuplicatedFoldersResponse>;
301
+ /**
302
+ * Gets the folder meta from a given path (e.g. "/folder1/folder2")
303
+ *
304
+ * @param {string} folderPath - The path of the folder.
305
+ * @returns {Promise<FolderMeta>} A promise that resolves the folder on that path.
306
+ */
307
+ getFolderByPath(folderPath: string): Promise<FolderMeta>;
308
+ /**
309
+ * Gets the file meta from a given path (e.g. "/folder1/folder2/file.png")
310
+ *
311
+ * @param {string} filePath - The path of the file.
312
+ * @returns {Promise<FileMeta>} A promise that resolves the file on that path.
313
+ */
314
+ getFileByPath(filePath: string): Promise<FileMeta>;
195
315
  }