@internxt/sdk 1.4.76 → 1.4.77
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.
- package/dist/auth/index.d.ts +42 -1
- package/dist/auth/index.js +82 -5
- package/dist/auth/types.d.ts +11 -0
- package/dist/drive/payments/index.d.ts +16 -3
- package/dist/drive/payments/index.js +66 -4
- package/dist/drive/payments/types.d.ts +10 -0
- package/dist/drive/referrals/index.js +2 -3
- package/dist/drive/share/index.d.ts +246 -1
- package/dist/drive/share/index.js +386 -3
- package/dist/drive/share/types.d.ts +280 -0
- package/dist/drive/storage/index.d.ts +107 -5
- package/dist/drive/storage/index.js +198 -7
- package/dist/drive/storage/types.d.ts +221 -1
- package/dist/drive/storage/types.js +7 -1
- package/dist/drive/trash/index.d.ts +13 -2
- package/dist/drive/trash/index.js +18 -1
- package/dist/drive/trash/types.d.ts +2 -1
- package/dist/drive/users/index.d.ts +44 -3
- package/dist/drive/users/index.js +53 -2
- package/dist/drive/users/types.d.ts +23 -1
- package/dist/shared/headers/index.d.ts +13 -40
- package/dist/shared/headers/index.js +12 -14
- package/dist/shared/http/client.d.ts +7 -0
- package/dist/shared/http/client.js +16 -1
- package/dist/shared/types/apiConnection.d.ts +0 -1
- package/package.json +1 -7
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
14
|
if (k2 === undefined) k2 = k;
|
|
4
15
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
@@ -93,6 +104,19 @@ var Storage = /** @class */ (function () {
|
|
|
93
104
|
});
|
|
94
105
|
});
|
|
95
106
|
};
|
|
107
|
+
/**
|
|
108
|
+
* Moves a specific folder to a new location
|
|
109
|
+
* @param payload
|
|
110
|
+
*/
|
|
111
|
+
Storage.prototype.moveFolderByUuid = function (payload) {
|
|
112
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
113
|
+
return __generator(this, function (_a) {
|
|
114
|
+
return [2 /*return*/, this.client.patch("/folders/" + payload.folderUuid, {
|
|
115
|
+
destinationFolder: payload.destinationFolderUuid,
|
|
116
|
+
}, this.headers())];
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
};
|
|
96
120
|
/**
|
|
97
121
|
* Updates the metadata of a folder
|
|
98
122
|
* @param payload
|
|
@@ -121,6 +145,106 @@ var Storage = /** @class */ (function () {
|
|
|
121
145
|
var _a = this.client.getCancellable("/storage/v2/folder/" + folderId + query, this.headers()), promise = _a.promise, requestCanceler = _a.requestCanceler;
|
|
122
146
|
return [promise, requestCanceler];
|
|
123
147
|
};
|
|
148
|
+
/**
|
|
149
|
+
* Returns metadata of a specific file
|
|
150
|
+
* @param fileId
|
|
151
|
+
*/
|
|
152
|
+
Storage.prototype.getFile = function (fileId) {
|
|
153
|
+
var _a = this.client.getCancellable("/files/" + fileId + "/meta", this.headers()), promise = _a.promise, requestCanceler = _a.requestCanceler;
|
|
154
|
+
return [promise, requestCanceler];
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* Gets the files in a folder.
|
|
158
|
+
*
|
|
159
|
+
* @param {number} folderId - The ID of the folder.
|
|
160
|
+
* @param {number} [offset=0] - The position of the first file to return.
|
|
161
|
+
* @param {number} [limit=50] - The max number of files to be returned.
|
|
162
|
+
* @param {string} [sort=plainName] - The reference column to sort it.
|
|
163
|
+
* @param {string} [order=ASC] - The order to be followed.
|
|
164
|
+
* @returns {[Promise<FetchPaginatedFolderContentResponse>, RequestCanceler]} An array containing a promise to get the API response and a function to cancel the request.
|
|
165
|
+
*/
|
|
166
|
+
Storage.prototype.getFolderFiles = function (folderId, offset, limit, sort, order) {
|
|
167
|
+
if (offset === void 0) { offset = 0; }
|
|
168
|
+
if (limit === void 0) { limit = 50; }
|
|
169
|
+
if (sort === void 0) { sort = ''; }
|
|
170
|
+
if (order === void 0) { order = ''; }
|
|
171
|
+
var offsetQuery = "?offset=" + offset;
|
|
172
|
+
var limitQuery = "&limit=" + limit;
|
|
173
|
+
var sortQuery = sort !== '' ? "&sort=" + sort : '';
|
|
174
|
+
var orderQuery = order !== '' ? "&order=" + order : '';
|
|
175
|
+
var query = "" + offsetQuery + limitQuery + sortQuery + orderQuery;
|
|
176
|
+
var _a = this.client.getCancellable("folders/" + folderId + "/files/" + query, this.headers()), promise = _a.promise, requestCanceler = _a.requestCanceler;
|
|
177
|
+
return [promise, requestCanceler];
|
|
178
|
+
};
|
|
179
|
+
/**
|
|
180
|
+
* Gets the files in a folder by its UUID.
|
|
181
|
+
*
|
|
182
|
+
* @param {UUID} folderUuid - The UUID of the folder.
|
|
183
|
+
* @param {number} [offset=0] - The position of the first file to return.
|
|
184
|
+
* @param {number} [limit=50] - The max number of files to be returned.
|
|
185
|
+
* @param {string} [sort=plainName] - The reference column to sort it.
|
|
186
|
+
* @param {string} [order=ASC] - The order to be followed.
|
|
187
|
+
* @returns {[Promise<FetchPaginatedFilesContent>, RequestCanceler]} An array containing a promise to get the API response and a function to cancel the request.
|
|
188
|
+
*/
|
|
189
|
+
Storage.prototype.getFolderFilesByUuid = function (folderUuid, offset, limit, sort, order) {
|
|
190
|
+
if (offset === void 0) { offset = 0; }
|
|
191
|
+
if (limit === void 0) { limit = 50; }
|
|
192
|
+
if (sort === void 0) { sort = ''; }
|
|
193
|
+
if (order === void 0) { order = ''; }
|
|
194
|
+
var offsetQuery = "?offset=" + offset;
|
|
195
|
+
var limitQuery = "&limit=" + limit;
|
|
196
|
+
var sortQuery = sort !== '' ? "&sort=" + sort : '';
|
|
197
|
+
var orderQuery = order !== '' ? "&order=" + order : '';
|
|
198
|
+
var query = "" + offsetQuery + limitQuery + sortQuery + orderQuery;
|
|
199
|
+
var _a = this.client.getCancellable("folders/content/" + folderUuid + "/files/" + query, this.headers()), promise = _a.promise, requestCanceler = _a.requestCanceler;
|
|
200
|
+
return [promise, requestCanceler];
|
|
201
|
+
};
|
|
202
|
+
/**
|
|
203
|
+
* Gets the subfolders of a folder.
|
|
204
|
+
*
|
|
205
|
+
* @param {number} folderId - The ID of the folder.
|
|
206
|
+
* @param {number} [offset=0] - The position of the first subfolder to return.
|
|
207
|
+
* @param {number} [limit=50] - The max number of subfolders to return.
|
|
208
|
+
* @param {string} [sort=plainName] - The reference column to sort it.
|
|
209
|
+
* @param {string} [order=ASC] - The order to be followed.
|
|
210
|
+
* @returns {[Promise<FetchPaginatedFolderContentResponse>, RequestCanceler]} An array containing a promise to get the API response and a function to cancel the request.
|
|
211
|
+
*/
|
|
212
|
+
Storage.prototype.getFolderFolders = function (folderId, offset, limit, sort, order) {
|
|
213
|
+
if (offset === void 0) { offset = 0; }
|
|
214
|
+
if (limit === void 0) { limit = 50; }
|
|
215
|
+
if (sort === void 0) { sort = ''; }
|
|
216
|
+
if (order === void 0) { order = ''; }
|
|
217
|
+
var offsetQuery = "?offset=" + offset;
|
|
218
|
+
var limitQuery = "&limit=" + limit;
|
|
219
|
+
var sortQuery = sort !== '' ? "&sort=" + sort : '';
|
|
220
|
+
var orderQuery = order !== '' ? "&order=" + order : '';
|
|
221
|
+
var query = "" + offsetQuery + limitQuery + sortQuery + orderQuery;
|
|
222
|
+
var _a = this.client.getCancellable("folders/" + folderId + "/folders/" + query, this.headers()), promise = _a.promise, requestCanceler = _a.requestCanceler;
|
|
223
|
+
return [promise, requestCanceler];
|
|
224
|
+
};
|
|
225
|
+
/**
|
|
226
|
+
* Gets the subfolders of a folder by its UUID.
|
|
227
|
+
*
|
|
228
|
+
* @param {UUID} folderUuid - The UUID of the folder.
|
|
229
|
+
* @param {number} [offset=0] - The position of the first subfolder to return.
|
|
230
|
+
* @param {number} [limit=50] - The max number of subfolders to return.
|
|
231
|
+
* @param {string} [sort=plainName] - The reference column to sort it.
|
|
232
|
+
* @param {string} [order=ASC] - The order to be followed.
|
|
233
|
+
* @returns {[Promise<FetchPaginatedFoldersContent>, RequestCanceler]} An array containing a promise to get the API response and a function to cancel the request.
|
|
234
|
+
*/
|
|
235
|
+
Storage.prototype.getFolderFoldersByUuid = function (folderUuid, offset, limit, sort, order) {
|
|
236
|
+
if (offset === void 0) { offset = 0; }
|
|
237
|
+
if (limit === void 0) { limit = 50; }
|
|
238
|
+
if (sort === void 0) { sort = ''; }
|
|
239
|
+
if (order === void 0) { order = ''; }
|
|
240
|
+
var offsetQuery = "?offset=" + offset;
|
|
241
|
+
var limitQuery = "&limit=" + limit;
|
|
242
|
+
var sortQuery = sort !== '' ? "&sort=" + sort : '';
|
|
243
|
+
var orderQuery = order !== '' ? "&order=" + order : '';
|
|
244
|
+
var query = "" + offsetQuery + limitQuery + sortQuery + orderQuery;
|
|
245
|
+
var _a = this.client.getCancellable("folders/content/" + folderUuid + "/folders/" + query, this.headers()), promise = _a.promise, requestCanceler = _a.requestCanceler;
|
|
246
|
+
return [promise, requestCanceler];
|
|
247
|
+
};
|
|
124
248
|
/**
|
|
125
249
|
* Removes a specific folder from the centralized persistence
|
|
126
250
|
* @param folderId
|
|
@@ -143,7 +267,7 @@ var Storage = /** @class */ (function () {
|
|
|
143
267
|
* Creates a new file entry
|
|
144
268
|
* @param fileEntry
|
|
145
269
|
*/
|
|
146
|
-
Storage.prototype.createFileEntry = function (fileEntry) {
|
|
270
|
+
Storage.prototype.createFileEntry = function (fileEntry, resourcesToken) {
|
|
147
271
|
return this.client.post('/storage/file', {
|
|
148
272
|
file: {
|
|
149
273
|
fileId: fileEntry.id,
|
|
@@ -155,27 +279,27 @@ var Storage = /** @class */ (function () {
|
|
|
155
279
|
plain_name: fileEntry.plain_name,
|
|
156
280
|
encrypt_version: fileEntry.encrypt_version,
|
|
157
281
|
},
|
|
158
|
-
}, this.headers());
|
|
282
|
+
}, (0, headers_1.addResourcesTokenToHeaders)(this.headers(), resourcesToken));
|
|
159
283
|
};
|
|
160
284
|
/**
|
|
161
285
|
* Creates a new thumbnail entry
|
|
162
286
|
* @param thumbnailEntry
|
|
163
287
|
*/
|
|
164
|
-
Storage.prototype.createThumbnailEntry = function (thumbnailEntry) {
|
|
288
|
+
Storage.prototype.createThumbnailEntry = function (thumbnailEntry, resourcesToken) {
|
|
165
289
|
return this.client.post('/storage/thumbnail', {
|
|
166
290
|
thumbnail: thumbnailEntry,
|
|
167
|
-
}, this.headers());
|
|
291
|
+
}, (0, headers_1.addResourcesTokenToHeaders)(this.headers(), resourcesToken));
|
|
168
292
|
};
|
|
169
293
|
/**
|
|
170
294
|
* Updates the details of a file entry
|
|
171
295
|
* @param payload
|
|
172
296
|
*/
|
|
173
|
-
Storage.prototype.updateFile = function (payload) {
|
|
297
|
+
Storage.prototype.updateFile = function (payload, resourcesToken) {
|
|
174
298
|
return this.client.post("/storage/file/" + payload.fileId + "/meta", {
|
|
175
299
|
metadata: payload.metadata,
|
|
176
300
|
bucketId: payload.bucketId,
|
|
177
301
|
relativePath: payload.destinationPath,
|
|
178
|
-
}, this.headers());
|
|
302
|
+
}, (0, headers_1.addResourcesTokenToHeaders)(this.headers(), resourcesToken));
|
|
179
303
|
};
|
|
180
304
|
/**
|
|
181
305
|
* Deletes a specific file entry
|
|
@@ -196,6 +320,19 @@ var Storage = /** @class */ (function () {
|
|
|
196
320
|
bucketId: payload.bucketId,
|
|
197
321
|
}, this.headers());
|
|
198
322
|
};
|
|
323
|
+
/**
|
|
324
|
+
* Moves a specific file to a new location
|
|
325
|
+
* @param payload
|
|
326
|
+
*/
|
|
327
|
+
Storage.prototype.moveFileByUuid = function (payload) {
|
|
328
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
329
|
+
return __generator(this, function (_a) {
|
|
330
|
+
return [2 /*return*/, this.client.patch("/files/" + payload.fileUuid, {
|
|
331
|
+
destinationFolder: payload.destinationFolderUuid,
|
|
332
|
+
}, this.headers())];
|
|
333
|
+
});
|
|
334
|
+
});
|
|
335
|
+
};
|
|
199
336
|
/**
|
|
200
337
|
* Returns a list of the n most recent files
|
|
201
338
|
* @param limit
|
|
@@ -219,6 +356,13 @@ var Storage = /** @class */ (function () {
|
|
|
219
356
|
items: payload.items,
|
|
220
357
|
}, this.headers());
|
|
221
358
|
};
|
|
359
|
+
/**
|
|
360
|
+
* Returns a list of the n most recent files
|
|
361
|
+
* @param limit
|
|
362
|
+
*/
|
|
363
|
+
Storage.prototype.searchItemsByName = function (plain_name) {
|
|
364
|
+
return this.client.post('/users/search', { plain_name: plain_name }, this.headers());
|
|
365
|
+
};
|
|
222
366
|
/**
|
|
223
367
|
* Returns the current space usage of the user
|
|
224
368
|
*/
|
|
@@ -231,12 +375,59 @@ var Storage = /** @class */ (function () {
|
|
|
231
375
|
Storage.prototype.spaceLimit = function () {
|
|
232
376
|
return this.client.get('/limit', this.headers());
|
|
233
377
|
};
|
|
378
|
+
/**
|
|
379
|
+
* Get global search items.
|
|
380
|
+
*
|
|
381
|
+
* @param {string} search - The name of the item.
|
|
382
|
+
* @returns {[Promise<SearchResultData>, RequestCanceler]} An array containing a promise to get the API response and a function to cancel the request.
|
|
383
|
+
*/
|
|
384
|
+
Storage.prototype.getGlobalSearchItems = function (search) {
|
|
385
|
+
var _a = this.client.getCancellable("fuzzy/" + search, this.headers()), promise = _a.promise, requestCanceler = _a.requestCanceler;
|
|
386
|
+
return [promise, requestCanceler];
|
|
387
|
+
};
|
|
234
388
|
/**
|
|
235
389
|
* Returns the needed headers for the module requests
|
|
236
390
|
* @private
|
|
237
391
|
*/
|
|
238
392
|
Storage.prototype.headers = function () {
|
|
239
|
-
return (0, headers_1.
|
|
393
|
+
return (0, headers_1.headersWithToken)(this.appDetails.clientName, this.appDetails.clientVersion, this.apiSecurity.token);
|
|
394
|
+
};
|
|
395
|
+
/**
|
|
396
|
+
* Gets the ancestors of a given folder UUID
|
|
397
|
+
*
|
|
398
|
+
* @param {string} folderUUID - UUID of the folder.
|
|
399
|
+
* @returns {Promise<FolderAncestor[]>}
|
|
400
|
+
*/
|
|
401
|
+
Storage.prototype.getFolderAncestors = function (uuid) {
|
|
402
|
+
return this.client.get("folders/" + uuid + "/ancestors", this.headers());
|
|
403
|
+
};
|
|
404
|
+
/**
|
|
405
|
+
* Gets the meta of a given folder UUID
|
|
406
|
+
*
|
|
407
|
+
* @param {string} folderUUID - UUID of the folder.
|
|
408
|
+
* @returns {Promise<FolderMeta>}
|
|
409
|
+
*/
|
|
410
|
+
Storage.prototype.getFolderMeta = function (uuid) {
|
|
411
|
+
return this.client.get("folders/" + uuid + "/meta", this.headers());
|
|
412
|
+
};
|
|
413
|
+
/**
|
|
414
|
+
* Gets the meta of a given folder Id
|
|
415
|
+
*
|
|
416
|
+
* @param {number} folderId - Id of the folder.
|
|
417
|
+
* @returns {Promise<FolderMeta>}
|
|
418
|
+
*/
|
|
419
|
+
Storage.prototype.getFolderMetaById = function (folderId) {
|
|
420
|
+
return this.client.get("folders/" + folderId + "/metadata", this.headers());
|
|
421
|
+
};
|
|
422
|
+
/**
|
|
423
|
+
* Replaces a file with a new one.
|
|
424
|
+
*
|
|
425
|
+
* @param {string} uuid - UUID of the file.
|
|
426
|
+
* @param {ReplaceFile} payload
|
|
427
|
+
* @returns {Promise<DriveFileData>} - The replaced file data.
|
|
428
|
+
*/
|
|
429
|
+
Storage.prototype.replaceFile = function (uuid, payload) {
|
|
430
|
+
return this.client.put("/files/" + uuid, __assign({}, payload), this.headers());
|
|
240
431
|
};
|
|
241
432
|
return Storage;
|
|
242
433
|
}());
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SharingMeta } from '../share/types';
|
|
1
2
|
export interface DriveFolderData {
|
|
2
3
|
id: number;
|
|
3
4
|
bucket: string | null;
|
|
@@ -17,6 +18,7 @@ export interface DriveFolderData {
|
|
|
17
18
|
user_id: number;
|
|
18
19
|
}
|
|
19
20
|
export interface DriveFileData {
|
|
21
|
+
uuid: string;
|
|
20
22
|
bucket: string;
|
|
21
23
|
createdAt: string;
|
|
22
24
|
created_at: string;
|
|
@@ -32,6 +34,7 @@ export interface DriveFileData {
|
|
|
32
34
|
size: number;
|
|
33
35
|
type: string;
|
|
34
36
|
updatedAt: string;
|
|
37
|
+
status: string;
|
|
35
38
|
thumbnails: Array<Thumbnail>;
|
|
36
39
|
currentThumbnail: Thumbnail | null;
|
|
37
40
|
}
|
|
@@ -63,6 +66,7 @@ export interface FolderChild {
|
|
|
63
66
|
updatedAt: string;
|
|
64
67
|
userId: number;
|
|
65
68
|
user_id: number;
|
|
69
|
+
uuid: string;
|
|
66
70
|
}
|
|
67
71
|
export interface FetchFolderContentResponse {
|
|
68
72
|
bucket: string;
|
|
@@ -81,6 +85,149 @@ export interface FetchFolderContentResponse {
|
|
|
81
85
|
userId: number;
|
|
82
86
|
user_id: number;
|
|
83
87
|
}
|
|
88
|
+
export interface FileMeta {
|
|
89
|
+
bucket: string;
|
|
90
|
+
createdAt: string;
|
|
91
|
+
created_at: string;
|
|
92
|
+
deleted: boolean;
|
|
93
|
+
deletedAt: null;
|
|
94
|
+
encrypt_version: string;
|
|
95
|
+
fileId: string;
|
|
96
|
+
folderId: number;
|
|
97
|
+
folder_id: number;
|
|
98
|
+
id: number;
|
|
99
|
+
name: string;
|
|
100
|
+
plain_name: string | null;
|
|
101
|
+
plainName?: string | null;
|
|
102
|
+
size: number;
|
|
103
|
+
type: string;
|
|
104
|
+
updatedAt: string;
|
|
105
|
+
status: string;
|
|
106
|
+
thumbnails: Array<Thumbnail>;
|
|
107
|
+
currentThumbnail: Thumbnail | null;
|
|
108
|
+
shares?: Array<ShareLink>;
|
|
109
|
+
uuid?: string;
|
|
110
|
+
}
|
|
111
|
+
export interface ShareLink {
|
|
112
|
+
id: string;
|
|
113
|
+
token: string;
|
|
114
|
+
mnemonic: string;
|
|
115
|
+
user: any;
|
|
116
|
+
item: any;
|
|
117
|
+
encryptionKey: string;
|
|
118
|
+
bucket: string;
|
|
119
|
+
itemToken: string;
|
|
120
|
+
isFolder: boolean;
|
|
121
|
+
views: number;
|
|
122
|
+
timesValid: number;
|
|
123
|
+
active: boolean;
|
|
124
|
+
createdAt: string;
|
|
125
|
+
updatedAt: string;
|
|
126
|
+
fileSize: number;
|
|
127
|
+
hashed_password: string | null;
|
|
128
|
+
code: string;
|
|
129
|
+
}
|
|
130
|
+
export interface FetchPaginatedFolderContentResponse {
|
|
131
|
+
result: {
|
|
132
|
+
bucket: string;
|
|
133
|
+
children: FolderChild[];
|
|
134
|
+
color: string;
|
|
135
|
+
createdAt: string;
|
|
136
|
+
encrypt_version: string;
|
|
137
|
+
files: DriveFileData[];
|
|
138
|
+
icon: string;
|
|
139
|
+
id: number;
|
|
140
|
+
name: string;
|
|
141
|
+
plain_name: string;
|
|
142
|
+
parentId: number;
|
|
143
|
+
parent_id: number;
|
|
144
|
+
updatedAt: string;
|
|
145
|
+
userId: number;
|
|
146
|
+
user_id: number;
|
|
147
|
+
type: string;
|
|
148
|
+
}[];
|
|
149
|
+
}
|
|
150
|
+
export declare enum FileStatus {
|
|
151
|
+
EXISTS = "EXISTS",
|
|
152
|
+
TRASHED = "TRASHED",
|
|
153
|
+
DELETED = "DELETED"
|
|
154
|
+
}
|
|
155
|
+
export interface FetchPaginatedFile {
|
|
156
|
+
id: number;
|
|
157
|
+
uuid: string;
|
|
158
|
+
fileId: string;
|
|
159
|
+
name: string;
|
|
160
|
+
type: string;
|
|
161
|
+
size: bigint;
|
|
162
|
+
bucket: string;
|
|
163
|
+
folderId: number;
|
|
164
|
+
folder?: any;
|
|
165
|
+
folderUuid: string;
|
|
166
|
+
encryptVersion: string;
|
|
167
|
+
deleted: boolean;
|
|
168
|
+
deletedAt: Date | null;
|
|
169
|
+
removed: boolean;
|
|
170
|
+
removedAt: Date | null;
|
|
171
|
+
userId: number;
|
|
172
|
+
user?: any;
|
|
173
|
+
modificationTime: Date;
|
|
174
|
+
plainName: string;
|
|
175
|
+
createdAt: Date;
|
|
176
|
+
updatedAt: Date;
|
|
177
|
+
status: FileStatus;
|
|
178
|
+
shares?: ShareLink[];
|
|
179
|
+
thumbnails?: Thumbnail[];
|
|
180
|
+
sharings?: SharingMeta[];
|
|
181
|
+
}
|
|
182
|
+
export interface FetchPaginatedFolder {
|
|
183
|
+
id: number;
|
|
184
|
+
parentId: number;
|
|
185
|
+
parentUuid: string;
|
|
186
|
+
parent?: any;
|
|
187
|
+
name: string;
|
|
188
|
+
bucket: string;
|
|
189
|
+
userId: number;
|
|
190
|
+
uuid: string;
|
|
191
|
+
user?: any;
|
|
192
|
+
plainName: string;
|
|
193
|
+
encryptVersion: string;
|
|
194
|
+
deleted: boolean;
|
|
195
|
+
removed: boolean;
|
|
196
|
+
deletedAt: Date | null;
|
|
197
|
+
createdAt: Date;
|
|
198
|
+
updatedAt: Date;
|
|
199
|
+
removedAt: Date | null;
|
|
200
|
+
sharings?: SharingMeta[];
|
|
201
|
+
}
|
|
202
|
+
export interface FetchPaginatedFilesContent {
|
|
203
|
+
files: FetchPaginatedFile[];
|
|
204
|
+
}
|
|
205
|
+
export interface FetchPaginatedFoldersContent {
|
|
206
|
+
folders: FetchPaginatedFolder[];
|
|
207
|
+
}
|
|
208
|
+
export interface FetchTrashContentResponse {
|
|
209
|
+
result: {
|
|
210
|
+
id: number;
|
|
211
|
+
fileId: string;
|
|
212
|
+
folderId: number;
|
|
213
|
+
folder: string | null;
|
|
214
|
+
name: string;
|
|
215
|
+
type: string;
|
|
216
|
+
size: string;
|
|
217
|
+
bucket: string;
|
|
218
|
+
encryptVersion: string;
|
|
219
|
+
deleted: boolean;
|
|
220
|
+
deletedAt: Date;
|
|
221
|
+
userId: number;
|
|
222
|
+
user: string | null;
|
|
223
|
+
modificationTime: Date;
|
|
224
|
+
createdAt: Date;
|
|
225
|
+
updatedAt: Date;
|
|
226
|
+
folderUuid: string | null;
|
|
227
|
+
uuid: string;
|
|
228
|
+
plainName: string;
|
|
229
|
+
}[];
|
|
230
|
+
}
|
|
84
231
|
export declare enum EncryptionVersion {
|
|
85
232
|
Aes03 = "03-aes"
|
|
86
233
|
}
|
|
@@ -122,6 +269,10 @@ export interface MoveFolderPayload {
|
|
|
122
269
|
folderId: number;
|
|
123
270
|
destinationFolderId: number;
|
|
124
271
|
}
|
|
272
|
+
export interface MoveFolderUuidPayload {
|
|
273
|
+
folderUuid: string;
|
|
274
|
+
destinationFolderUuid: string;
|
|
275
|
+
}
|
|
125
276
|
export interface MoveFolderResponse {
|
|
126
277
|
item: DriveFolderData;
|
|
127
278
|
destination: number;
|
|
@@ -153,6 +304,10 @@ export interface MoveFilePayload {
|
|
|
153
304
|
destinationPath: string;
|
|
154
305
|
bucketId: string;
|
|
155
306
|
}
|
|
307
|
+
export interface MoveFileUuidPayload {
|
|
308
|
+
fileUuid: string;
|
|
309
|
+
destinationFolderUuid: string;
|
|
310
|
+
}
|
|
156
311
|
export interface MoveFileResponse {
|
|
157
312
|
item: DriveFileData;
|
|
158
313
|
destination: number;
|
|
@@ -168,7 +323,72 @@ export interface FetchLimitResponse {
|
|
|
168
323
|
}
|
|
169
324
|
export interface AddItemsToTrashPayload {
|
|
170
325
|
items: Array<{
|
|
171
|
-
id
|
|
326
|
+
id?: string;
|
|
327
|
+
uuid?: string;
|
|
172
328
|
type: string;
|
|
173
329
|
}>;
|
|
174
330
|
}
|
|
331
|
+
export interface SearchResult {
|
|
332
|
+
id: string;
|
|
333
|
+
itemId: string;
|
|
334
|
+
itemType: string;
|
|
335
|
+
name: string;
|
|
336
|
+
rank: number;
|
|
337
|
+
similarity: number;
|
|
338
|
+
userId: string;
|
|
339
|
+
item: {
|
|
340
|
+
id: number;
|
|
341
|
+
bucket?: string;
|
|
342
|
+
fileId?: string;
|
|
343
|
+
plainName?: string;
|
|
344
|
+
size?: string;
|
|
345
|
+
type?: string;
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
export interface SearchResultData {
|
|
349
|
+
data: [SearchResult];
|
|
350
|
+
}
|
|
351
|
+
export interface FolderAncestor {
|
|
352
|
+
bucket: null | string;
|
|
353
|
+
createdAt: string;
|
|
354
|
+
deleted: boolean;
|
|
355
|
+
deletedAt: null | string;
|
|
356
|
+
encryptVersion: null | string;
|
|
357
|
+
id: number;
|
|
358
|
+
name: string;
|
|
359
|
+
parent: null | string;
|
|
360
|
+
parentId: number;
|
|
361
|
+
plainName: string;
|
|
362
|
+
removed: boolean;
|
|
363
|
+
removedAt: null | string;
|
|
364
|
+
size: number;
|
|
365
|
+
type: string;
|
|
366
|
+
updatedAt: string;
|
|
367
|
+
user: null | string;
|
|
368
|
+
userId: number;
|
|
369
|
+
uuid: string;
|
|
370
|
+
}
|
|
371
|
+
export interface FolderMeta {
|
|
372
|
+
bucket: null | string;
|
|
373
|
+
createdAt: string;
|
|
374
|
+
deleted: boolean;
|
|
375
|
+
deletedAt: null | string;
|
|
376
|
+
encryptVersion: null | string;
|
|
377
|
+
id: number;
|
|
378
|
+
name: string;
|
|
379
|
+
parent: null | string;
|
|
380
|
+
parentId: number;
|
|
381
|
+
plainName: string;
|
|
382
|
+
removed: boolean;
|
|
383
|
+
removedAt: null | string;
|
|
384
|
+
size: number;
|
|
385
|
+
type: string;
|
|
386
|
+
updatedAt: string;
|
|
387
|
+
user: null | string;
|
|
388
|
+
userId: number;
|
|
389
|
+
uuid: string;
|
|
390
|
+
}
|
|
391
|
+
export interface ReplaceFile {
|
|
392
|
+
fileId: string;
|
|
393
|
+
size: number;
|
|
394
|
+
}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EncryptionVersion = void 0;
|
|
3
|
+
exports.EncryptionVersion = exports.FileStatus = void 0;
|
|
4
|
+
var FileStatus;
|
|
5
|
+
(function (FileStatus) {
|
|
6
|
+
FileStatus["EXISTS"] = "EXISTS";
|
|
7
|
+
FileStatus["TRASHED"] = "TRASHED";
|
|
8
|
+
FileStatus["DELETED"] = "DELETED";
|
|
9
|
+
})(FileStatus = exports.FileStatus || (exports.FileStatus = {}));
|
|
4
10
|
var EncryptionVersion;
|
|
5
11
|
(function (EncryptionVersion) {
|
|
6
12
|
EncryptionVersion["Aes03"] = "03-aes";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AddItemsToTrashPayload, DeleteFilePayload, DeleteItemsPermanentlyPayload } from './types';
|
|
2
|
-
import { FetchFolderContentResponse } from '../storage/types';
|
|
2
|
+
import { FetchFolderContentResponse, FetchTrashContentResponse } from '../storage/types';
|
|
3
3
|
import { ApiSecurity, ApiUrl, AppDetails } from '../../shared';
|
|
4
4
|
export * as TrashTypes from './types';
|
|
5
5
|
export declare class Trash {
|
|
@@ -22,11 +22,22 @@ export declare class Trash {
|
|
|
22
22
|
* Returns a list of items in trash
|
|
23
23
|
*/
|
|
24
24
|
getTrash(): Promise<FetchFolderContentResponse>;
|
|
25
|
+
/**
|
|
26
|
+
* Retrieves a paginated list of trashed files or folders.
|
|
27
|
+
* @param {number} limit - The number of items to retrieve per page.
|
|
28
|
+
* @param {number} [offset=0] - The number of items to skip before beginning to return items.
|
|
29
|
+
* @param {'files' | 'folders'} type - The type of content to retrieve.
|
|
30
|
+
* @param {boolean} root - A boolean indicating whether to retrieve content from the root folder.
|
|
31
|
+
* If is not true it has to get a folderId in order to obtain the items or given folderId
|
|
32
|
+
* @param {number} [folderId] - The ID of the folder to retrieve content from.
|
|
33
|
+
* @returns {Promise<FetchTrashContentResponse>} - A promise that resolves with the paginated list of trashed content.
|
|
34
|
+
*/
|
|
35
|
+
getTrashedFilesPaginated(limit: number, offset: number | undefined, type: 'files' | 'folders', root: boolean, folderId?: number): Promise<FetchTrashContentResponse>;
|
|
25
36
|
/**
|
|
26
37
|
* Add Items to Trash
|
|
27
38
|
* @param payload
|
|
28
39
|
*/
|
|
29
|
-
addItemsToTrash(payload: AddItemsToTrashPayload): Promise<
|
|
40
|
+
addItemsToTrash(payload: AddItemsToTrashPayload): Promise<void>;
|
|
30
41
|
/**
|
|
31
42
|
* Removes all items from the trash
|
|
32
43
|
*/
|
|
@@ -96,6 +96,23 @@ var Trash = /** @class */ (function () {
|
|
|
96
96
|
Trash.prototype.getTrash = function () {
|
|
97
97
|
return this.client.get('/storage/trash', this.headers());
|
|
98
98
|
};
|
|
99
|
+
/**
|
|
100
|
+
* Retrieves a paginated list of trashed files or folders.
|
|
101
|
+
* @param {number} limit - The number of items to retrieve per page.
|
|
102
|
+
* @param {number} [offset=0] - The number of items to skip before beginning to return items.
|
|
103
|
+
* @param {'files' | 'folders'} type - The type of content to retrieve.
|
|
104
|
+
* @param {boolean} root - A boolean indicating whether to retrieve content from the root folder.
|
|
105
|
+
* If is not true it has to get a folderId in order to obtain the items or given folderId
|
|
106
|
+
* @param {number} [folderId] - The ID of the folder to retrieve content from.
|
|
107
|
+
* @returns {Promise<FetchTrashContentResponse>} - A promise that resolves with the paginated list of trashed content.
|
|
108
|
+
*/
|
|
109
|
+
Trash.prototype.getTrashedFilesPaginated = function (limit, offset, type, root, folderId) {
|
|
110
|
+
if (offset === void 0) { offset = 0; }
|
|
111
|
+
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;
|
|
114
|
+
return this.client.get(url, this.headers());
|
|
115
|
+
};
|
|
99
116
|
/**
|
|
100
117
|
* Add Items to Trash
|
|
101
118
|
* @param payload
|
|
@@ -125,7 +142,7 @@ var Trash = /** @class */ (function () {
|
|
|
125
142
|
* @private
|
|
126
143
|
*/
|
|
127
144
|
Trash.prototype.headers = function () {
|
|
128
|
-
return (0, headers_1.
|
|
145
|
+
return (0, headers_1.headersWithToken)(this.appDetails.clientName, this.appDetails.clientVersion, this.apiSecurity.token);
|
|
129
146
|
};
|
|
130
147
|
return Trash;
|
|
131
148
|
}());
|