@internxt/sdk 1.5.25 → 1.6.4
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 +127 -122
- package/dist/auth/index.js +378 -310
- package/dist/auth/types.d.ts +65 -54
- package/dist/auth/types.js +26 -26
- package/dist/drive/backups/index.d.ts +18 -18
- package/dist/drive/backups/index.js +40 -40
- package/dist/drive/backups/types.d.ts +27 -27
- package/dist/drive/backups/types.js +2 -2
- package/dist/drive/index.d.ts +7 -7
- package/dist/drive/index.js +23 -19
- package/dist/drive/payments/index.d.ts +66 -71
- package/dist/drive/payments/index.js +206 -208
- package/dist/drive/payments/types.d.ts +180 -176
- package/dist/drive/payments/types.js +37 -37
- package/dist/drive/referrals/index.d.ts +19 -19
- package/dist/drive/referrals/index.js +54 -50
- package/dist/drive/referrals/types.d.ts +21 -21
- package/dist/drive/referrals/types.js +18 -18
- package/dist/drive/share/index.d.ts +319 -319
- package/dist/drive/share/index.js +544 -540
- package/dist/drive/share/types.d.ts +360 -360
- package/dist/drive/share/types.js +2 -2
- package/dist/drive/storage/index.d.ts +315 -315
- package/dist/drive/storage/index.js +634 -630
- package/dist/drive/storage/types.d.ts +480 -473
- package/dist/drive/storage/types.js +13 -13
- package/dist/drive/trash/index.d.ts +75 -75
- package/dist/drive/trash/index.js +184 -180
- package/dist/drive/trash/types.d.ts +29 -29
- package/dist/drive/trash/types.js +2 -2
- package/dist/drive/users/index.d.ts +135 -135
- package/dist/drive/users/index.js +208 -204
- package/dist/drive/users/types.d.ts +53 -51
- package/dist/drive/users/types.js +2 -2
- package/dist/index.d.ts +6 -6
- package/dist/index.js +35 -31
- package/dist/network/download.d.ts +8 -8
- package/dist/network/download.js +123 -123
- package/dist/network/errors/codes.d.ts +24 -24
- package/dist/network/errors/codes.js +48 -48
- package/dist/network/errors/context.d.ts +35 -35
- package/dist/network/errors/context.js +39 -39
- package/dist/network/errors/download.d.ts +4 -4
- package/dist/network/errors/download.js +52 -48
- package/dist/network/errors/index.d.ts +3 -3
- package/dist/network/errors/index.js +19 -15
- package/dist/network/errors/upload.d.ts +13 -13
- package/dist/network/errors/upload.js +82 -78
- package/dist/network/index.d.ts +70 -70
- package/dist/network/index.js +315 -311
- package/dist/network/types.d.ts +102 -102
- package/dist/network/types.js +18 -18
- package/dist/network/upload.d.ts +4 -4
- package/dist/network/upload.js +158 -159
- package/dist/photos/devices/index.d.ts +10 -10
- package/dist/photos/devices/index.js +79 -79
- package/dist/photos/index.d.ts +17 -17
- package/dist/photos/index.js +56 -52
- package/dist/photos/photos/index.d.ts +60 -60
- package/dist/photos/photos/index.js +225 -225
- package/dist/photos/shares/index.d.ts +8 -8
- package/dist/photos/shares/index.js +34 -34
- package/dist/photos/types.d.ts +154 -154
- package/dist/photos/types.js +19 -19
- package/dist/photos/users/index.d.ts +7 -7
- package/dist/photos/users/index.js +46 -46
- package/dist/shared/headers/index.d.ts +21 -21
- package/dist/shared/headers/index.js +78 -79
- package/dist/shared/http/client.d.ts +85 -85
- package/dist/shared/http/client.js +172 -172
- package/dist/shared/http/types.d.ts +7 -7
- package/dist/shared/http/types.js +2 -2
- package/dist/shared/index.d.ts +1 -1
- package/dist/shared/index.js +17 -13
- package/dist/shared/types/apiConnection.d.ts +12 -12
- package/dist/shared/types/apiConnection.js +2 -2
- package/dist/shared/types/appsumo.d.ts +16 -16
- package/dist/shared/types/appsumo.js +12 -12
- package/dist/shared/types/errors.d.ts +5 -5
- package/dist/shared/types/errors.js +28 -28
- package/dist/shared/types/teams.d.ts +9 -9
- package/dist/shared/types/teams.js +2 -2
- package/dist/shared/types/userSettings.d.ts +43 -29
- package/dist/shared/types/userSettings.js +2 -2
- package/dist/utils.d.ts +3 -3
- package/dist/utils.js +24 -25
- package/dist/workspaces/index.d.ts +176 -176
- package/dist/workspaces/index.js +419 -415
- package/dist/workspaces/index.test.d.ts +1 -1
- package/dist/workspaces/index.test.js +908 -903
- package/dist/workspaces/types.d.ts +294 -291
- package/dist/workspaces/types.js +2 -2
- package/package.json +13 -13
|
@@ -1,630 +1,634 @@
|
|
|
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
|
-
};
|
|
13
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
Object.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
if (t[
|
|
61
|
-
_.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
exports
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
* @
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
* @param {
|
|
182
|
-
* @
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
if (
|
|
192
|
-
query.set('
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
*
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
* @param {
|
|
225
|
-
* @
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
var
|
|
237
|
-
var
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
*
|
|
246
|
-
*
|
|
247
|
-
* @param {
|
|
248
|
-
* @
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
var
|
|
260
|
-
var
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
*
|
|
269
|
-
*
|
|
270
|
-
* @param {
|
|
271
|
-
* @
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
var
|
|
283
|
-
var
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
*
|
|
292
|
-
*
|
|
293
|
-
* @param {
|
|
294
|
-
* @
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
var
|
|
306
|
-
var
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
*
|
|
387
|
-
*
|
|
388
|
-
* @
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
*
|
|
402
|
-
*
|
|
403
|
-
* @param {
|
|
404
|
-
* @
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
*
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
*
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
*
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
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
|
+
};
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
37
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
38
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
39
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
40
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
41
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
42
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
46
|
+
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);
|
|
47
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
48
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
49
|
+
function step(op) {
|
|
50
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
51
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
52
|
+
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;
|
|
53
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
54
|
+
switch (op[0]) {
|
|
55
|
+
case 0: case 1: t = op; break;
|
|
56
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
57
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
58
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
59
|
+
default:
|
|
60
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
61
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
62
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
63
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
64
|
+
if (t[2]) _.ops.pop();
|
|
65
|
+
_.trys.pop(); continue;
|
|
66
|
+
}
|
|
67
|
+
op = body.call(thisArg, _);
|
|
68
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
69
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
73
|
+
exports.Storage = exports.StorageTypes = void 0;
|
|
74
|
+
var headers_1 = require("../../shared/headers");
|
|
75
|
+
var client_1 = require("../../shared/http/client");
|
|
76
|
+
exports.StorageTypes = __importStar(require("./types"));
|
|
77
|
+
var Storage = /** @class */ (function () {
|
|
78
|
+
function Storage(apiUrl, appDetails, apiSecurity) {
|
|
79
|
+
this.client = client_1.HttpClient.create(apiUrl, apiSecurity.unauthorizedCallback);
|
|
80
|
+
this.appDetails = appDetails;
|
|
81
|
+
this.apiSecurity = apiSecurity;
|
|
82
|
+
}
|
|
83
|
+
Storage.client = function (apiUrl, appDetails, apiSecurity) {
|
|
84
|
+
return new Storage(apiUrl, appDetails, apiSecurity);
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Creates a new folder
|
|
88
|
+
* @param payload
|
|
89
|
+
*/
|
|
90
|
+
Storage.prototype.createFolder = function (payload) {
|
|
91
|
+
var _a = this.client.postCancellable('/storage/folder', {
|
|
92
|
+
parentFolderId: payload.parentFolderId,
|
|
93
|
+
folderName: payload.folderName,
|
|
94
|
+
}, this.headers()), promise = _a.promise, requestCanceler = _a.requestCanceler;
|
|
95
|
+
return [promise, requestCanceler];
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Creates a new folder
|
|
99
|
+
* @param payload
|
|
100
|
+
*/
|
|
101
|
+
Storage.prototype.createFolderByUuid = function (payload) {
|
|
102
|
+
var _a = this.client.postCancellable('/folders', {
|
|
103
|
+
plainName: payload.plainName,
|
|
104
|
+
parentFolderUuid: payload.parentFolderUuid,
|
|
105
|
+
}, this.headers()), promise = _a.promise, requestCanceler = _a.requestCanceler;
|
|
106
|
+
return [promise, requestCanceler];
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Moves a specific folder to a new location
|
|
110
|
+
* @param payload
|
|
111
|
+
*/
|
|
112
|
+
Storage.prototype.moveFolder = function (payload) {
|
|
113
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
114
|
+
return __generator(this, function (_a) {
|
|
115
|
+
return [2 /*return*/, this.client.post('/storage/move/folder', {
|
|
116
|
+
folderId: payload.folderId,
|
|
117
|
+
destination: payload.destinationFolderId,
|
|
118
|
+
}, this.headers())];
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Moves a specific folder to a new location
|
|
124
|
+
* @param payload
|
|
125
|
+
*/
|
|
126
|
+
Storage.prototype.moveFolderByUuid = function (payload) {
|
|
127
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
128
|
+
return __generator(this, function (_a) {
|
|
129
|
+
return [2 /*return*/, this.client.patch("/folders/".concat(payload.folderUuid), {
|
|
130
|
+
destinationFolder: payload.destinationFolderUuid,
|
|
131
|
+
}, this.headers())];
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* Updates the metadata of a folder
|
|
137
|
+
* @param payload
|
|
138
|
+
*/
|
|
139
|
+
Storage.prototype.updateFolder = function (payload) {
|
|
140
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
141
|
+
return __generator(this, function (_a) {
|
|
142
|
+
switch (_a.label) {
|
|
143
|
+
case 0: return [4 /*yield*/, this.client.post("/storage/folder/".concat(payload.folderId, "/meta"), {
|
|
144
|
+
metadata: payload.changes,
|
|
145
|
+
}, this.headers())];
|
|
146
|
+
case 1:
|
|
147
|
+
_a.sent();
|
|
148
|
+
return [2 /*return*/];
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
154
|
+
* Updates the name of a folder with the given UUID.
|
|
155
|
+
*
|
|
156
|
+
* @param {Object} payload - The payload containing the folder UUID and the new name.
|
|
157
|
+
* @param {string} payload.folderUuid - The UUID of the folder to update.
|
|
158
|
+
* @param {string} payload.name - The new name for the folder.
|
|
159
|
+
* @param {Token} [resourcesToken] - An optional token for authentication.
|
|
160
|
+
* @return {Promise<void>} A promise that resolves when the folder name is successfully updated.
|
|
161
|
+
*/
|
|
162
|
+
Storage.prototype.updateFolderNameWithUUID = function (payload, resourcesToken) {
|
|
163
|
+
var folderUuid = payload.folderUuid, name = payload.name;
|
|
164
|
+
return this.client.put("/folders/".concat(folderUuid, "/meta"), {
|
|
165
|
+
plainName: name,
|
|
166
|
+
}, (0, headers_1.addResourcesTokenToHeaders)(this.headers(), resourcesToken));
|
|
167
|
+
};
|
|
168
|
+
/**
|
|
169
|
+
* Fetches & returns the contents of a specific folder
|
|
170
|
+
* @param folderId
|
|
171
|
+
*/
|
|
172
|
+
Storage.prototype.getFolderContent = function (folderId, trash) {
|
|
173
|
+
if (trash === void 0) { trash = false; }
|
|
174
|
+
var query = trash ? '/?trash=true' : '';
|
|
175
|
+
var _a = this.client.getCancellable("/storage/v2/folder/".concat(folderId).concat(query), this.headers()), promise = _a.promise, requestCanceler = _a.requestCanceler;
|
|
176
|
+
return [promise, requestCanceler];
|
|
177
|
+
};
|
|
178
|
+
/**
|
|
179
|
+
* Fetches and returns the contents of a specific folder by its UUID.
|
|
180
|
+
*
|
|
181
|
+
* @param {string} folderUuid - The UUID of the folder.
|
|
182
|
+
* @param {boolean} [trash=false] - Whether to include trash items in the response.
|
|
183
|
+
* @param {boolean} [offset] - The position of the first file to return.
|
|
184
|
+
* @param {boolean} [limit] - The max number of files to be returned.
|
|
185
|
+
* @param {boolean} [workspacesToken] - Token for accessing workspaces.
|
|
186
|
+
* @return {[Promise<FetchFolderContentResponse>, RequestCanceler]} An array containing a promise to get the API response and a function to cancel the request.
|
|
187
|
+
*/
|
|
188
|
+
Storage.prototype.getFolderContentByUuid = function (_a) {
|
|
189
|
+
var folderUuid = _a.folderUuid, _b = _a.trash, trash = _b === void 0 ? false : _b, offset = _a.offset, limit = _a.limit, workspacesToken = _a.workspacesToken;
|
|
190
|
+
var query = new URLSearchParams();
|
|
191
|
+
if (offset !== undefined)
|
|
192
|
+
query.set('offset', String(offset));
|
|
193
|
+
if (limit !== undefined)
|
|
194
|
+
query.set('limit', String(limit));
|
|
195
|
+
if (trash)
|
|
196
|
+
query.set('trash', 'true');
|
|
197
|
+
var customHeaders = workspacesToken
|
|
198
|
+
? {
|
|
199
|
+
'x-internxt-workspace': workspacesToken,
|
|
200
|
+
}
|
|
201
|
+
: undefined;
|
|
202
|
+
var _c = this.client.getCancellable("/folders/content/".concat(folderUuid, "?").concat(query), this.headers(customHeaders)), promise = _c.promise, requestCanceler = _c.requestCanceler;
|
|
203
|
+
return [promise, requestCanceler];
|
|
204
|
+
};
|
|
205
|
+
/**
|
|
206
|
+
* Retrieves a file with the specified fileId along with the associated workspacesToken.
|
|
207
|
+
*
|
|
208
|
+
* @param {string} fileId - The ID of the file to retrieve.
|
|
209
|
+
* @param {string} [workspacesToken] - Token for accessing workspaces.
|
|
210
|
+
* @return {[Promise<FileMeta>, RequestCanceler]} A promise with FileMeta and a canceler for the request.
|
|
211
|
+
*/
|
|
212
|
+
Storage.prototype.getFile = function (fileId, workspacesToken) {
|
|
213
|
+
var customHeaders = workspacesToken
|
|
214
|
+
? {
|
|
215
|
+
'x-internxt-workspace': workspacesToken,
|
|
216
|
+
}
|
|
217
|
+
: undefined;
|
|
218
|
+
var _a = this.client.getCancellable("/files/".concat(fileId, "/meta"), this.headers(customHeaders)), promise = _a.promise, requestCanceler = _a.requestCanceler;
|
|
219
|
+
return [promise, requestCanceler];
|
|
220
|
+
};
|
|
221
|
+
/**
|
|
222
|
+
* Gets the files in a folder.
|
|
223
|
+
*
|
|
224
|
+
* @param {number} folderId - The ID of the folder.
|
|
225
|
+
* @param {number} [offset=0] - The position of the first file to return.
|
|
226
|
+
* @param {number} [limit=50] - The max number of files to be returned.
|
|
227
|
+
* @param {string} [sort=plainName] - The reference column to sort it.
|
|
228
|
+
* @param {string} [order=ASC] - The order to be followed.
|
|
229
|
+
* @returns {[Promise<FetchPaginatedFolderContentResponse>, RequestCanceler]} An array containing a promise to get the API response and a function to cancel the request.
|
|
230
|
+
*/
|
|
231
|
+
Storage.prototype.getFolderFiles = function (folderId, offset, limit, sort, order) {
|
|
232
|
+
if (offset === void 0) { offset = 0; }
|
|
233
|
+
if (limit === void 0) { limit = 50; }
|
|
234
|
+
if (sort === void 0) { sort = ''; }
|
|
235
|
+
if (order === void 0) { order = ''; }
|
|
236
|
+
var offsetQuery = "?offset=".concat(offset);
|
|
237
|
+
var limitQuery = "&limit=".concat(limit);
|
|
238
|
+
var sortQuery = sort !== '' ? "&sort=".concat(sort) : '';
|
|
239
|
+
var orderQuery = order !== '' ? "&order=".concat(order) : '';
|
|
240
|
+
var query = "".concat(offsetQuery).concat(limitQuery).concat(sortQuery).concat(orderQuery);
|
|
241
|
+
var _a = this.client.getCancellable("folders/".concat(folderId, "/files/").concat(query), this.headers()), promise = _a.promise, requestCanceler = _a.requestCanceler;
|
|
242
|
+
return [promise, requestCanceler];
|
|
243
|
+
};
|
|
244
|
+
/**
|
|
245
|
+
* Gets the files in a folder by its UUID.
|
|
246
|
+
*
|
|
247
|
+
* @param {UUID} folderUuid - The UUID of the folder.
|
|
248
|
+
* @param {number} [offset=0] - The position of the first file to return.
|
|
249
|
+
* @param {number} [limit=50] - The max number of files to be returned.
|
|
250
|
+
* @param {string} [sort=plainName] - The reference column to sort it.
|
|
251
|
+
* @param {string} [order=ASC] - The order to be followed.
|
|
252
|
+
* @returns {[Promise<FetchPaginatedFilesContent>, RequestCanceler]} An array containing a promise to get the API response and a function to cancel the request.
|
|
253
|
+
*/
|
|
254
|
+
Storage.prototype.getFolderFilesByUuid = function (folderUuid, offset, limit, sort, order) {
|
|
255
|
+
if (offset === void 0) { offset = 0; }
|
|
256
|
+
if (limit === void 0) { limit = 50; }
|
|
257
|
+
if (sort === void 0) { sort = ''; }
|
|
258
|
+
if (order === void 0) { order = ''; }
|
|
259
|
+
var offsetQuery = "?offset=".concat(offset);
|
|
260
|
+
var limitQuery = "&limit=".concat(limit);
|
|
261
|
+
var sortQuery = sort !== '' ? "&sort=".concat(sort) : '';
|
|
262
|
+
var orderQuery = order !== '' ? "&order=".concat(order) : '';
|
|
263
|
+
var query = "".concat(offsetQuery).concat(limitQuery).concat(sortQuery).concat(orderQuery);
|
|
264
|
+
var _a = this.client.getCancellable("folders/content/".concat(folderUuid, "/files/").concat(query), this.headers()), promise = _a.promise, requestCanceler = _a.requestCanceler;
|
|
265
|
+
return [promise, requestCanceler];
|
|
266
|
+
};
|
|
267
|
+
/**
|
|
268
|
+
* Gets the subfolders of a folder.
|
|
269
|
+
*
|
|
270
|
+
* @param {number} folderId - The ID of the folder.
|
|
271
|
+
* @param {number} [offset=0] - The position of the first subfolder to return.
|
|
272
|
+
* @param {number} [limit=50] - The max number of subfolders to return.
|
|
273
|
+
* @param {string} [sort=plainName] - The reference column to sort it.
|
|
274
|
+
* @param {string} [order=ASC] - The order to be followed.
|
|
275
|
+
* @returns {[Promise<FetchPaginatedFolderContentResponse>, RequestCanceler]} An array containing a promise to get the API response and a function to cancel the request.
|
|
276
|
+
*/
|
|
277
|
+
Storage.prototype.getFolderFolders = function (folderId, offset, limit, sort, order) {
|
|
278
|
+
if (offset === void 0) { offset = 0; }
|
|
279
|
+
if (limit === void 0) { limit = 50; }
|
|
280
|
+
if (sort === void 0) { sort = ''; }
|
|
281
|
+
if (order === void 0) { order = ''; }
|
|
282
|
+
var offsetQuery = "?offset=".concat(offset);
|
|
283
|
+
var limitQuery = "&limit=".concat(limit);
|
|
284
|
+
var sortQuery = sort !== '' ? "&sort=".concat(sort) : '';
|
|
285
|
+
var orderQuery = order !== '' ? "&order=".concat(order) : '';
|
|
286
|
+
var query = "".concat(offsetQuery).concat(limitQuery).concat(sortQuery).concat(orderQuery);
|
|
287
|
+
var _a = this.client.getCancellable("folders/".concat(folderId, "/folders/").concat(query), this.headers()), promise = _a.promise, requestCanceler = _a.requestCanceler;
|
|
288
|
+
return [promise, requestCanceler];
|
|
289
|
+
};
|
|
290
|
+
/**
|
|
291
|
+
* Gets the subfolders of a folder by its UUID.
|
|
292
|
+
*
|
|
293
|
+
* @param {UUID} folderUuid - The UUID of the folder.
|
|
294
|
+
* @param {number} [offset=0] - The position of the first subfolder to return.
|
|
295
|
+
* @param {number} [limit=50] - The max number of subfolders to return.
|
|
296
|
+
* @param {string} [sort=plainName] - The reference column to sort it.
|
|
297
|
+
* @param {string} [order=ASC] - The order to be followed.
|
|
298
|
+
* @returns {[Promise<FetchPaginatedFoldersContent>, RequestCanceler]} An array containing a promise to get the API response and a function to cancel the request.
|
|
299
|
+
*/
|
|
300
|
+
Storage.prototype.getFolderFoldersByUuid = function (folderUuid, offset, limit, sort, order) {
|
|
301
|
+
if (offset === void 0) { offset = 0; }
|
|
302
|
+
if (limit === void 0) { limit = 50; }
|
|
303
|
+
if (sort === void 0) { sort = ''; }
|
|
304
|
+
if (order === void 0) { order = ''; }
|
|
305
|
+
var offsetQuery = "?offset=".concat(offset);
|
|
306
|
+
var limitQuery = "&limit=".concat(limit);
|
|
307
|
+
var sortQuery = sort !== '' ? "&sort=".concat(sort) : '';
|
|
308
|
+
var orderQuery = order !== '' ? "&order=".concat(order) : '';
|
|
309
|
+
var query = "".concat(offsetQuery).concat(limitQuery).concat(sortQuery).concat(orderQuery);
|
|
310
|
+
var _a = this.client.getCancellable("folders/content/".concat(folderUuid, "/folders/").concat(query), this.headers()), promise = _a.promise, requestCanceler = _a.requestCanceler;
|
|
311
|
+
return [promise, requestCanceler];
|
|
312
|
+
};
|
|
313
|
+
/**
|
|
314
|
+
* Removes a specific folder from the centralized persistence
|
|
315
|
+
* @param folderId
|
|
316
|
+
*/
|
|
317
|
+
Storage.prototype.deleteFolder = function (folderId) {
|
|
318
|
+
return this.client.delete("/storage/folder/".concat(folderId), this.headers());
|
|
319
|
+
};
|
|
320
|
+
/**
|
|
321
|
+
* Returns the total size of a folder
|
|
322
|
+
* @param folderId
|
|
323
|
+
*/
|
|
324
|
+
Storage.prototype.getFolderSize = function (folderId) {
|
|
325
|
+
return this.client
|
|
326
|
+
.get("/storage/folder/size/".concat(folderId), this.headers())
|
|
327
|
+
.then(function (response) {
|
|
328
|
+
return response.size;
|
|
329
|
+
});
|
|
330
|
+
};
|
|
331
|
+
/**
|
|
332
|
+
* Creates a new file entry
|
|
333
|
+
* @param fileEntry
|
|
334
|
+
*/
|
|
335
|
+
Storage.prototype.createFileEntry = function (fileEntry, resourcesToken) {
|
|
336
|
+
return this.client.post('/storage/file', {
|
|
337
|
+
file: {
|
|
338
|
+
fileId: fileEntry.id,
|
|
339
|
+
type: fileEntry.type,
|
|
340
|
+
bucket: fileEntry.bucket,
|
|
341
|
+
size: fileEntry.size,
|
|
342
|
+
folder_id: fileEntry.folder_id,
|
|
343
|
+
name: fileEntry.name,
|
|
344
|
+
plain_name: fileEntry.plain_name,
|
|
345
|
+
encrypt_version: fileEntry.encrypt_version,
|
|
346
|
+
},
|
|
347
|
+
}, (0, headers_1.addResourcesTokenToHeaders)(this.headers(), resourcesToken));
|
|
348
|
+
};
|
|
349
|
+
/**
|
|
350
|
+
* Creates a new file entry
|
|
351
|
+
* @param fileEntry
|
|
352
|
+
*/
|
|
353
|
+
Storage.prototype.createFileEntryByUuid = function (fileEntry, resourcesToken) {
|
|
354
|
+
return this.client.post('/files', {
|
|
355
|
+
name: fileEntry.name,
|
|
356
|
+
bucket: fileEntry.bucket,
|
|
357
|
+
fileId: fileEntry.id,
|
|
358
|
+
encryptVersion: fileEntry.encrypt_version,
|
|
359
|
+
folderUuid: fileEntry.folder_id,
|
|
360
|
+
size: fileEntry.size,
|
|
361
|
+
plainName: fileEntry.plain_name,
|
|
362
|
+
type: fileEntry.type,
|
|
363
|
+
}, (0, headers_1.addResourcesTokenToHeaders)(this.headers(), resourcesToken));
|
|
364
|
+
};
|
|
365
|
+
/**
|
|
366
|
+
* Creates a new thumbnail entry
|
|
367
|
+
* @param thumbnailEntry
|
|
368
|
+
*/
|
|
369
|
+
Storage.prototype.createThumbnailEntry = function (thumbnailEntry, resourcesToken) {
|
|
370
|
+
return this.client.post('/storage/thumbnail', {
|
|
371
|
+
thumbnail: thumbnailEntry,
|
|
372
|
+
}, (0, headers_1.addResourcesTokenToHeaders)(this.headers(), resourcesToken));
|
|
373
|
+
};
|
|
374
|
+
/**
|
|
375
|
+
* Updates the details of a file entry
|
|
376
|
+
* @param payload
|
|
377
|
+
*/
|
|
378
|
+
Storage.prototype.updateFile = function (payload, resourcesToken) {
|
|
379
|
+
return this.client.post("/storage/file/".concat(payload.fileId, "/meta"), {
|
|
380
|
+
metadata: payload.metadata,
|
|
381
|
+
bucketId: payload.bucketId,
|
|
382
|
+
relativePath: payload.destinationPath,
|
|
383
|
+
}, (0, headers_1.addResourcesTokenToHeaders)(this.headers(), resourcesToken));
|
|
384
|
+
};
|
|
385
|
+
/**
|
|
386
|
+
* Updates the name of a file with the given UUID.
|
|
387
|
+
*
|
|
388
|
+
* @param {Object} payload - The payload containing the UUID and new name of the file.
|
|
389
|
+
* @param {string} payload.fileUuid - The UUID of the file.
|
|
390
|
+
* @param {string} payload.name - The new name of the file.
|
|
391
|
+
* @param {string} [resourcesToken] - The token for accessing resources.
|
|
392
|
+
* @return {Promise<void>} - A Promise that resolves when the file name is successfully updated.
|
|
393
|
+
*/
|
|
394
|
+
Storage.prototype.updateFileNameWithUUID = function (payload, resourcesToken) {
|
|
395
|
+
var fileUuid = payload.fileUuid, name = payload.name;
|
|
396
|
+
return this.client.put("/files/".concat(fileUuid, "/meta"), {
|
|
397
|
+
plainName: name,
|
|
398
|
+
}, (0, headers_1.addResourcesTokenToHeaders)(this.headers(), resourcesToken));
|
|
399
|
+
};
|
|
400
|
+
/**
|
|
401
|
+
* Updates the name and the type from a given file UUID.
|
|
402
|
+
*
|
|
403
|
+
* @param {Object} payload - The payload containing the UUID and the new properties of the file.
|
|
404
|
+
* @param {string} payload.fileUuid - The UUID of the file.
|
|
405
|
+
* @param {string} payload.name - The new name of the file.
|
|
406
|
+
* @param {string} payload.type - The new type of the file.
|
|
407
|
+
* @param {string} [resourcesToken] - The token for accessing resources.
|
|
408
|
+
* @return {Promise<void>} - A Promise that resolves when the file name is successfully updated.
|
|
409
|
+
*/
|
|
410
|
+
Storage.prototype.updateFileMetaByUUID = function (fileUuid, payload, resourcesToken) {
|
|
411
|
+
return this.client.put("/files/".concat(fileUuid, "/meta"), payload, (0, headers_1.addResourcesTokenToHeaders)(this.headers(), resourcesToken));
|
|
412
|
+
};
|
|
413
|
+
/**
|
|
414
|
+
* Deletes a specific file entry
|
|
415
|
+
* @param payload
|
|
416
|
+
*/
|
|
417
|
+
Storage.prototype.deleteFile = function (payload) {
|
|
418
|
+
return this.client.delete("/storage/folder/".concat(payload.folderId, "/file/").concat(payload.fileId), this.headers());
|
|
419
|
+
};
|
|
420
|
+
/**
|
|
421
|
+
* Updates the persisted path of a file entry
|
|
422
|
+
* @param payload
|
|
423
|
+
*/
|
|
424
|
+
Storage.prototype.moveFile = function (payload) {
|
|
425
|
+
return this.client.post('/storage/move/file', {
|
|
426
|
+
fileId: payload.fileId,
|
|
427
|
+
destination: payload.destination,
|
|
428
|
+
relativePath: payload.destinationPath,
|
|
429
|
+
bucketId: payload.bucketId,
|
|
430
|
+
}, this.headers());
|
|
431
|
+
};
|
|
432
|
+
/**
|
|
433
|
+
* Moves a specific file to a new location
|
|
434
|
+
* @param payload
|
|
435
|
+
*/
|
|
436
|
+
Storage.prototype.moveFileByUuid = function (payload) {
|
|
437
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
438
|
+
return __generator(this, function (_a) {
|
|
439
|
+
return [2 /*return*/, this.client.patch("/files/".concat(payload.fileUuid), {
|
|
440
|
+
destinationFolder: payload.destinationFolderUuid,
|
|
441
|
+
}, this.headers())];
|
|
442
|
+
});
|
|
443
|
+
});
|
|
444
|
+
};
|
|
445
|
+
/**
|
|
446
|
+
* Returns a list of the n most recent files
|
|
447
|
+
* @param limit
|
|
448
|
+
* @deprecated use `getRecentFilesV2` call instead.
|
|
449
|
+
*/
|
|
450
|
+
Storage.prototype.getRecentFiles = function (limit) {
|
|
451
|
+
return this.client.get("/storage/recents?limit=".concat(limit), this.headers());
|
|
452
|
+
};
|
|
453
|
+
/**
|
|
454
|
+
* Returns a list of the n most recent files
|
|
455
|
+
* @param limit
|
|
456
|
+
*/
|
|
457
|
+
Storage.prototype.getRecentFilesV2 = function (limit) {
|
|
458
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
459
|
+
return __generator(this, function (_a) {
|
|
460
|
+
return [2 /*return*/, this.client.get("/files/recents?limit=".concat(limit), this.headers())];
|
|
461
|
+
});
|
|
462
|
+
});
|
|
463
|
+
};
|
|
464
|
+
/**
|
|
465
|
+
* Returns a list of items in trash
|
|
466
|
+
*/
|
|
467
|
+
Storage.prototype.getTrash = function () {
|
|
468
|
+
var _a = this.client.getCancellable('/storage/trash', this.headers()), promise = _a.promise, requestCanceler = _a.requestCanceler;
|
|
469
|
+
return [promise, requestCanceler];
|
|
470
|
+
};
|
|
471
|
+
/**
|
|
472
|
+
* Add Items to Trash
|
|
473
|
+
* @param payload
|
|
474
|
+
*/
|
|
475
|
+
Storage.prototype.addItemsToTrash = function (payload) {
|
|
476
|
+
return this.client.post('/storage/trash/add', {
|
|
477
|
+
items: payload.items,
|
|
478
|
+
}, this.headers());
|
|
479
|
+
};
|
|
480
|
+
/**
|
|
481
|
+
* Returns a list of the n most recent files
|
|
482
|
+
* @param limit
|
|
483
|
+
*/
|
|
484
|
+
Storage.prototype.searchItemsByName = function (plain_name) {
|
|
485
|
+
return this.client.post('/users/search', { plain_name: plain_name }, this.headers());
|
|
486
|
+
};
|
|
487
|
+
/**
|
|
488
|
+
* Returns the current space usage of the user
|
|
489
|
+
*/
|
|
490
|
+
Storage.prototype.spaceUsage = function () {
|
|
491
|
+
return this.client.get('/usage', this.headers());
|
|
492
|
+
};
|
|
493
|
+
/**
|
|
494
|
+
* Returns the current space limit for the user
|
|
495
|
+
*/
|
|
496
|
+
Storage.prototype.spaceLimit = function () {
|
|
497
|
+
return this.client.get('/limit', this.headers());
|
|
498
|
+
};
|
|
499
|
+
/**
|
|
500
|
+
* Get global search items.
|
|
501
|
+
*
|
|
502
|
+
* @param {string} search - The name of the item.
|
|
503
|
+
* @param {string} workspaceId - The ID of the workspace (optional).
|
|
504
|
+
* @returns {[Promise<SearchResultData>, RequestCanceler]} An array containing a promise to get the API response and a function to cancel the request.
|
|
505
|
+
*/
|
|
506
|
+
Storage.prototype.getGlobalSearchItems = function (search, workspaceId) {
|
|
507
|
+
var _a = workspaceId
|
|
508
|
+
? this.client.getCancellable("workspaces/".concat(workspaceId, "/fuzzy/").concat(search), this.headers())
|
|
509
|
+
: this.client.getCancellable("fuzzy/".concat(search), this.headers()), promise = _a.promise, requestCanceler = _a.requestCanceler;
|
|
510
|
+
return [promise, requestCanceler];
|
|
511
|
+
};
|
|
512
|
+
/**
|
|
513
|
+
* Returns the needed headers for the module requests
|
|
514
|
+
* @private
|
|
515
|
+
*/
|
|
516
|
+
Storage.prototype.headers = function (customHeaders) {
|
|
517
|
+
var _a;
|
|
518
|
+
return (0, headers_1.headersWithToken)(this.appDetails.clientName, this.appDetails.clientVersion, this.apiSecurity.token, (_a = this.apiSecurity) === null || _a === void 0 ? void 0 : _a.workspaceToken, customHeaders);
|
|
519
|
+
};
|
|
520
|
+
/**
|
|
521
|
+
* Gets the ancestors of a given folder UUID
|
|
522
|
+
*
|
|
523
|
+
* @param {string} uuid - UUID of the folder.
|
|
524
|
+
* @param {boolean} [isShared=false] - Whether the folder is a shared item or not.
|
|
525
|
+
* @returns {Promise<FolderAncestor[]>} A promise that resolves with an array of ancestors of the given folder.
|
|
526
|
+
*/
|
|
527
|
+
Storage.prototype.getFolderAncestors = function (uuid, isShared) {
|
|
528
|
+
if (isShared === void 0) { isShared = false; }
|
|
529
|
+
return this.client.get("folders/".concat(uuid, "/ancestors?isSharedItem=").concat(isShared), this.headers());
|
|
530
|
+
};
|
|
531
|
+
/**
|
|
532
|
+
* Gets the meta of a given folder UUID
|
|
533
|
+
*
|
|
534
|
+
* @param {string} folderUUID - UUID of the folder.
|
|
535
|
+
* @returns {Promise<FolderMeta>}
|
|
536
|
+
*/
|
|
537
|
+
Storage.prototype.getFolderMeta = function (uuid, workspacesToken, resourcesToken) {
|
|
538
|
+
var customHeaders = workspacesToken
|
|
539
|
+
? {
|
|
540
|
+
'x-internxt-workspace': workspacesToken,
|
|
541
|
+
}
|
|
542
|
+
: undefined;
|
|
543
|
+
return this.client.get("folders/".concat(uuid, "/meta"), (0, headers_1.addResourcesTokenToHeaders)(this.headers(customHeaders), resourcesToken));
|
|
544
|
+
};
|
|
545
|
+
/**
|
|
546
|
+
* Gets the meta of a given folder Id
|
|
547
|
+
*
|
|
548
|
+
* @param {number} folderId - Id of the folder.
|
|
549
|
+
* @returns {Promise<FolderMeta>}
|
|
550
|
+
*/
|
|
551
|
+
Storage.prototype.getFolderMetaById = function (folderId) {
|
|
552
|
+
return this.client.get("folders/".concat(folderId, "/metadata"), this.headers());
|
|
553
|
+
};
|
|
554
|
+
/**
|
|
555
|
+
* Replaces a file with a new one.
|
|
556
|
+
*
|
|
557
|
+
* @param {string} uuid - UUID of the file.
|
|
558
|
+
* @param {ReplaceFile} payload
|
|
559
|
+
* @returns {Promise<DriveFileData>} - The replaced file data.
|
|
560
|
+
*/
|
|
561
|
+
Storage.prototype.replaceFile = function (uuid, payload) {
|
|
562
|
+
return this.client.put("/files/".concat(uuid), __assign({}, payload), this.headers());
|
|
563
|
+
};
|
|
564
|
+
/**
|
|
565
|
+
* Checks the size limit for a file.
|
|
566
|
+
*
|
|
567
|
+
* @param {number} size - The size of the file to check.
|
|
568
|
+
* @return {Promise<void>} - A promise that resolves when the size limit check is complete.
|
|
569
|
+
*/
|
|
570
|
+
Storage.prototype.checkSizeLimit = function (size) {
|
|
571
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
572
|
+
return __generator(this, function (_a) {
|
|
573
|
+
return [2 /*return*/, this.client.post('/files/check-size-limit', {
|
|
574
|
+
file: {
|
|
575
|
+
size: size,
|
|
576
|
+
},
|
|
577
|
+
}, this.headers())];
|
|
578
|
+
});
|
|
579
|
+
});
|
|
580
|
+
};
|
|
581
|
+
/**
|
|
582
|
+
* Retrieves the folder tree based on the UUID.
|
|
583
|
+
*
|
|
584
|
+
* @param {string} uuid - The UUID of the folder.
|
|
585
|
+
* @return {Promise<FolderTreeResponse>} The promise containing the folder tree response.
|
|
586
|
+
*/
|
|
587
|
+
Storage.prototype.getFolderTree = function (uuid) {
|
|
588
|
+
return this.client.get("/folders/".concat(uuid, "/tree"), this.headers());
|
|
589
|
+
};
|
|
590
|
+
/**
|
|
591
|
+
* Checks if the given files already exist in the given folder.
|
|
592
|
+
*
|
|
593
|
+
* @param {CheckDuplicatedFilesPayload} payload - Payload containing the folder UUID and the list of files to check.
|
|
594
|
+
* @return {Promise<CheckDuplicatedFilesResponse>} - Promise that contains the duplicated files in a list.
|
|
595
|
+
*/
|
|
596
|
+
Storage.prototype.checkDuplicatedFiles = function (_a) {
|
|
597
|
+
var folderUuid = _a.folderUuid, filesList = _a.filesList;
|
|
598
|
+
return this.client.post("/folders/content/".concat(folderUuid, "/files/existence"), {
|
|
599
|
+
files: filesList,
|
|
600
|
+
}, this.headers());
|
|
601
|
+
};
|
|
602
|
+
/**
|
|
603
|
+
* Checks if the given folders names already exist in the given folder
|
|
604
|
+
*
|
|
605
|
+
* @param {CheckDuplicatedFolderPayload} payload - Payload containing the folder UUID and the list of folders to check.
|
|
606
|
+
* @return {Promise<CheckDuplicatedFoldersResponse>} - Promise that contains the duplicated folders in a list.
|
|
607
|
+
*/
|
|
608
|
+
Storage.prototype.checkDuplicatedFolders = function (_a) {
|
|
609
|
+
var folderUuid = _a.folderUuid, folderNamesList = _a.folderNamesList;
|
|
610
|
+
return this.client.post("/folders/content/".concat(folderUuid, "/folders/existence"), {
|
|
611
|
+
plainNames: folderNamesList,
|
|
612
|
+
}, this.headers());
|
|
613
|
+
};
|
|
614
|
+
/**
|
|
615
|
+
* Gets the folder meta from a given path (e.g. "/folder1/folder2")
|
|
616
|
+
*
|
|
617
|
+
* @param {string} folderPath - The path of the folder.
|
|
618
|
+
* @returns {Promise<FolderMeta>} A promise that resolves the folder on that path.
|
|
619
|
+
*/
|
|
620
|
+
Storage.prototype.getFolderByPath = function (folderPath) {
|
|
621
|
+
return this.client.get("folders/meta?path=".concat(folderPath), this.headers());
|
|
622
|
+
};
|
|
623
|
+
/**
|
|
624
|
+
* Gets the file meta from a given path (e.g. "/folder1/folder2/file.png")
|
|
625
|
+
*
|
|
626
|
+
* @param {string} filePath - The path of the file.
|
|
627
|
+
* @returns {Promise<FileMeta>} A promise that resolves the file on that path.
|
|
628
|
+
*/
|
|
629
|
+
Storage.prototype.getFileByPath = function (filePath) {
|
|
630
|
+
return this.client.get("files/meta?path=".concat(filePath), this.headers());
|
|
631
|
+
};
|
|
632
|
+
return Storage;
|
|
633
|
+
}());
|
|
634
|
+
exports.Storage = Storage;
|