@atlaskit/media-client 33.3.2 → 33.4.0
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/CHANGELOG.md +9 -0
- package/dist/cjs/client/file-fetcher/index.js +213 -180
- package/dist/cjs/client/media-client.js +1 -2
- package/dist/cjs/client/media-store/MediaStore.js +233 -130
- package/dist/cjs/models/document.js +1 -0
- package/dist/cjs/utils/hashing/hasherCreator.js +1 -2
- package/dist/cjs/utils/hashing/simpleHasher.js +1 -2
- package/dist/es2019/client/file-fetcher/index.js +20 -0
- package/dist/es2019/client/media-store/MediaStore.js +57 -0
- package/dist/es2019/models/document.js +0 -0
- package/dist/esm/client/file-fetcher/index.js +213 -180
- package/dist/esm/client/media-store/MediaStore.js +233 -130
- package/dist/esm/models/document.js +0 -0
- package/dist/types/client/file-fetcher/index.d.ts +3 -1
- package/dist/types/client/media-store/MediaStore.d.ts +4 -0
- package/dist/types/client/media-store/types.d.ts +9 -0
- package/dist/types/models/document.d.ts +54 -0
- package/dist/types-ts4.5/client/file-fetcher/index.d.ts +3 -1
- package/dist/types-ts4.5/client/media-store/MediaStore.d.ts +4 -0
- package/dist/types-ts4.5/client/media-store/types.d.ts +9 -0
- package/dist/types-ts4.5/models/document.d.ts +54 -0
- package/package.json +2 -2
|
@@ -123,6 +123,40 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
123
123
|
return _ref3.apply(this, arguments);
|
|
124
124
|
};
|
|
125
125
|
}());
|
|
126
|
+
(0, _defineProperty2.default)(this, "deleteArtifact", /*#__PURE__*/function () {
|
|
127
|
+
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(id, params, collectionName, traceContext) {
|
|
128
|
+
var metadata, authContext, options;
|
|
129
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
130
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
131
|
+
case 0:
|
|
132
|
+
metadata = {
|
|
133
|
+
method: 'DELETE',
|
|
134
|
+
endpoint: '/file/{fileId}/artifact/{artifactName}'
|
|
135
|
+
};
|
|
136
|
+
authContext = {
|
|
137
|
+
collectionName: collectionName,
|
|
138
|
+
access: [{
|
|
139
|
+
type: 'file',
|
|
140
|
+
id: id,
|
|
141
|
+
actions: ['update']
|
|
142
|
+
}]
|
|
143
|
+
};
|
|
144
|
+
options = _objectSpread(_objectSpread({}, metadata), {}, {
|
|
145
|
+
authContext: authContext,
|
|
146
|
+
traceContext: traceContext
|
|
147
|
+
});
|
|
148
|
+
_context3.next = 5;
|
|
149
|
+
return _this.request("/file/".concat(id, "/artifact/").concat(params.artifactName), options);
|
|
150
|
+
case 5:
|
|
151
|
+
case "end":
|
|
152
|
+
return _context3.stop();
|
|
153
|
+
}
|
|
154
|
+
}, _callee3);
|
|
155
|
+
}));
|
|
156
|
+
return function (_x9, _x0, _x1, _x10) {
|
|
157
|
+
return _ref4.apply(this, arguments);
|
|
158
|
+
};
|
|
159
|
+
}());
|
|
126
160
|
(0, _defineProperty2.default)(this, "resolveAuth", function (authContext) {
|
|
127
161
|
return (0, _resolveAuth.resolveAuth)(_this.config.authProvider, authContext, _this.config.authProviderTimeout);
|
|
128
162
|
});
|
|
@@ -135,10 +169,10 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
135
169
|
return (0, _createClass2.default)(MediaStore, [{
|
|
136
170
|
key: "removeCollectionFile",
|
|
137
171
|
value: function () {
|
|
138
|
-
var _removeCollectionFile = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
172
|
+
var _removeCollectionFile = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(id, collectionName, occurrenceKey, traceContext) {
|
|
139
173
|
var metadata, body, options;
|
|
140
|
-
return _regenerator.default.wrap(function
|
|
141
|
-
while (1) switch (
|
|
174
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
175
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
142
176
|
case 0:
|
|
143
177
|
metadata = {
|
|
144
178
|
method: 'PUT',
|
|
@@ -165,15 +199,15 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
165
199
|
body: JSON.stringify(body),
|
|
166
200
|
traceContext: traceContext
|
|
167
201
|
});
|
|
168
|
-
|
|
202
|
+
_context4.next = 5;
|
|
169
203
|
return this.request("/collection/".concat(collectionName), options);
|
|
170
204
|
case 5:
|
|
171
205
|
case "end":
|
|
172
|
-
return
|
|
206
|
+
return _context4.stop();
|
|
173
207
|
}
|
|
174
|
-
},
|
|
208
|
+
}, _callee4, this);
|
|
175
209
|
}));
|
|
176
|
-
function removeCollectionFile(
|
|
210
|
+
function removeCollectionFile(_x11, _x12, _x13, _x14) {
|
|
177
211
|
return _removeCollectionFile.apply(this, arguments);
|
|
178
212
|
}
|
|
179
213
|
return removeCollectionFile;
|
|
@@ -206,10 +240,10 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
206
240
|
}, {
|
|
207
241
|
key: "uploadChunk",
|
|
208
242
|
value: function () {
|
|
209
|
-
var _uploadChunk = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
243
|
+
var _uploadChunk = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(etag, blob, uploadId, partNumber, collectionName, traceContext) {
|
|
210
244
|
var metadata, options;
|
|
211
|
-
return _regenerator.default.wrap(function
|
|
212
|
-
while (1) switch (
|
|
245
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
246
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
213
247
|
case 0:
|
|
214
248
|
metadata = {
|
|
215
249
|
method: 'PUT',
|
|
@@ -226,15 +260,15 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
226
260
|
body: blob,
|
|
227
261
|
traceContext: traceContext
|
|
228
262
|
});
|
|
229
|
-
|
|
263
|
+
_context5.next = 4;
|
|
230
264
|
return this.request("/chunk/".concat(etag), options);
|
|
231
265
|
case 4:
|
|
232
266
|
case "end":
|
|
233
|
-
return
|
|
267
|
+
return _context5.stop();
|
|
234
268
|
}
|
|
235
|
-
},
|
|
269
|
+
}, _callee5, this);
|
|
236
270
|
}));
|
|
237
|
-
function uploadChunk(
|
|
271
|
+
function uploadChunk(_x15, _x16, _x17, _x18, _x19, _x20) {
|
|
238
272
|
return _uploadChunk.apply(this, arguments);
|
|
239
273
|
}
|
|
240
274
|
return uploadChunk;
|
|
@@ -276,17 +310,17 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
276
310
|
}, {
|
|
277
311
|
key: "touchFiles",
|
|
278
312
|
value: function () {
|
|
279
|
-
var _touchFiles = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
313
|
+
var _touchFiles = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(body) {
|
|
280
314
|
var params,
|
|
281
315
|
traceContext,
|
|
282
316
|
metadata,
|
|
283
317
|
options,
|
|
284
|
-
|
|
285
|
-
return _regenerator.default.wrap(function
|
|
286
|
-
while (1) switch (
|
|
318
|
+
_args6 = arguments;
|
|
319
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
320
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
287
321
|
case 0:
|
|
288
|
-
params =
|
|
289
|
-
traceContext =
|
|
322
|
+
params = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
|
|
323
|
+
traceContext = _args6.length > 2 ? _args6[2] : undefined;
|
|
290
324
|
metadata = {
|
|
291
325
|
method: 'POST',
|
|
292
326
|
endpoint: '/upload/createWithFiles'
|
|
@@ -302,14 +336,14 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
302
336
|
hashAlgorithm: this._chunkHashAlgorithm
|
|
303
337
|
}
|
|
304
338
|
});
|
|
305
|
-
return
|
|
339
|
+
return _context6.abrupt("return", this.request('/upload/createWithFiles', options).then((0, _helpers.createMapResponseToJson)(metadata)));
|
|
306
340
|
case 5:
|
|
307
341
|
case "end":
|
|
308
|
-
return
|
|
342
|
+
return _context6.stop();
|
|
309
343
|
}
|
|
310
|
-
},
|
|
344
|
+
}, _callee6, this);
|
|
311
345
|
}));
|
|
312
|
-
function touchFiles(
|
|
346
|
+
function touchFiles(_x21) {
|
|
313
347
|
return _touchFiles.apply(this, arguments);
|
|
314
348
|
}
|
|
315
349
|
return touchFiles;
|
|
@@ -335,26 +369,26 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
335
369
|
}, {
|
|
336
370
|
key: "getFileImageURL",
|
|
337
371
|
value: function () {
|
|
338
|
-
var _getFileImageURL = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
339
|
-
var
|
|
340
|
-
return _regenerator.default.wrap(function
|
|
341
|
-
while (1) switch (
|
|
372
|
+
var _getFileImageURL = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(id, params) {
|
|
373
|
+
var _ref5, collectionName, auth;
|
|
374
|
+
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
375
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
342
376
|
case 0:
|
|
343
|
-
|
|
344
|
-
|
|
377
|
+
_ref5 = params || {}, collectionName = _ref5.collection;
|
|
378
|
+
_context7.next = 3;
|
|
345
379
|
return this.resolveAuth({
|
|
346
380
|
collectionName: collectionName
|
|
347
381
|
});
|
|
348
382
|
case 3:
|
|
349
|
-
auth =
|
|
350
|
-
return
|
|
383
|
+
auth = _context7.sent;
|
|
384
|
+
return _context7.abrupt("return", this.createFileImageURL(id, auth, params));
|
|
351
385
|
case 5:
|
|
352
386
|
case "end":
|
|
353
|
-
return
|
|
387
|
+
return _context7.stop();
|
|
354
388
|
}
|
|
355
|
-
},
|
|
389
|
+
}, _callee7, this);
|
|
356
390
|
}));
|
|
357
|
-
function getFileImageURL(
|
|
391
|
+
function getFileImageURL(_x22, _x23) {
|
|
358
392
|
return _getFileImageURL.apply(this, arguments);
|
|
359
393
|
}
|
|
360
394
|
return getFileImageURL;
|
|
@@ -378,17 +412,17 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
378
412
|
}, {
|
|
379
413
|
key: "getFileBinary",
|
|
380
414
|
value: function () {
|
|
381
|
-
var _getFileBinary = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
415
|
+
var _getFileBinary = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(id, collectionName, abortController) {
|
|
382
416
|
var maxAge,
|
|
383
417
|
headers,
|
|
384
418
|
binaryEndpoint,
|
|
385
419
|
metadata,
|
|
386
420
|
options,
|
|
387
|
-
|
|
388
|
-
return _regenerator.default.wrap(function
|
|
389
|
-
while (1) switch (
|
|
421
|
+
_args8 = arguments;
|
|
422
|
+
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
423
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
390
424
|
case 0:
|
|
391
|
-
maxAge =
|
|
425
|
+
maxAge = _args8.length > 3 && _args8[3] !== undefined ? _args8[3] : _constants.FILE_CACHE_MAX_AGE;
|
|
392
426
|
headers = {};
|
|
393
427
|
binaryEndpoint = cdnFeatureFlag('binary');
|
|
394
428
|
metadata = {
|
|
@@ -405,14 +439,14 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
405
439
|
'max-age': "".concat(maxAge)
|
|
406
440
|
}
|
|
407
441
|
});
|
|
408
|
-
return
|
|
442
|
+
return _context8.abrupt("return", this.request("/file/".concat(id, "/").concat(binaryEndpoint), options, abortController, true).then((0, _helpers.createMapResponseToBlob)(metadata)));
|
|
409
443
|
case 6:
|
|
410
444
|
case "end":
|
|
411
|
-
return
|
|
445
|
+
return _context8.stop();
|
|
412
446
|
}
|
|
413
|
-
},
|
|
447
|
+
}, _callee8, this);
|
|
414
448
|
}));
|
|
415
|
-
function getFileBinary(
|
|
449
|
+
function getFileBinary(_x24, _x25, _x26) {
|
|
416
450
|
return _getFileBinary.apply(this, arguments);
|
|
417
451
|
}
|
|
418
452
|
return getFileBinary;
|
|
@@ -420,22 +454,22 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
420
454
|
}, {
|
|
421
455
|
key: "getFileBinaryURL",
|
|
422
456
|
value: function () {
|
|
423
|
-
var _getFileBinaryURL = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
457
|
+
var _getFileBinaryURL = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(id, collectionName) {
|
|
424
458
|
var maxAge,
|
|
425
459
|
auth,
|
|
426
460
|
options,
|
|
427
461
|
binaryEndpoint,
|
|
428
|
-
|
|
429
|
-
return _regenerator.default.wrap(function
|
|
430
|
-
while (1) switch (
|
|
462
|
+
_args9 = arguments;
|
|
463
|
+
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
464
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
431
465
|
case 0:
|
|
432
|
-
maxAge =
|
|
433
|
-
|
|
466
|
+
maxAge = _args9.length > 2 && _args9[2] !== undefined ? _args9[2] : _constants.FILE_CACHE_MAX_AGE;
|
|
467
|
+
_context9.next = 3;
|
|
434
468
|
return this.resolveAuth({
|
|
435
469
|
collectionName: collectionName
|
|
436
470
|
});
|
|
437
471
|
case 3:
|
|
438
|
-
auth =
|
|
472
|
+
auth = _context9.sent;
|
|
439
473
|
options = {
|
|
440
474
|
params: {
|
|
441
475
|
dl: true,
|
|
@@ -445,14 +479,14 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
445
479
|
auth: auth
|
|
446
480
|
};
|
|
447
481
|
binaryEndpoint = cdnFeatureFlag('binary');
|
|
448
|
-
return
|
|
482
|
+
return _context9.abrupt("return", (0, _mediaCdn.mapToMediaCdnUrl)((0, _helpers.createUrl)("".concat(auth.baseUrl, "/file/").concat(id, "/").concat(binaryEndpoint), options), auth.token));
|
|
449
483
|
case 7:
|
|
450
484
|
case "end":
|
|
451
|
-
return
|
|
485
|
+
return _context9.stop();
|
|
452
486
|
}
|
|
453
|
-
},
|
|
487
|
+
}, _callee9, this);
|
|
454
488
|
}));
|
|
455
|
-
function getFileBinaryURL(
|
|
489
|
+
function getFileBinaryURL(_x27, _x28) {
|
|
456
490
|
return _getFileBinaryURL.apply(this, arguments);
|
|
457
491
|
}
|
|
458
492
|
return getFileBinaryURL;
|
|
@@ -460,16 +494,16 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
460
494
|
}, {
|
|
461
495
|
key: "getArtifactURL",
|
|
462
496
|
value: function () {
|
|
463
|
-
var _getArtifactURL = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
497
|
+
var _getArtifactURL = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee0(artifacts, artifactName, collectionName) {
|
|
464
498
|
var maxAge,
|
|
465
499
|
artifactUrl,
|
|
466
500
|
auth,
|
|
467
501
|
options,
|
|
468
|
-
|
|
469
|
-
return _regenerator.default.wrap(function
|
|
470
|
-
while (1) switch (
|
|
502
|
+
_args0 = arguments;
|
|
503
|
+
return _regenerator.default.wrap(function _callee0$(_context0) {
|
|
504
|
+
while (1) switch (_context0.prev = _context0.next) {
|
|
471
505
|
case 0:
|
|
472
|
-
maxAge =
|
|
506
|
+
maxAge = _args0.length > 3 && _args0[3] !== undefined ? _args0[3] : _constants.FILE_CACHE_MAX_AGE;
|
|
473
507
|
// ----- WARNING ----------
|
|
474
508
|
// DO NOT USE!!!!!
|
|
475
509
|
// artifact.cdnUrl fails in Jira.
|
|
@@ -484,17 +518,17 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
484
518
|
} */
|
|
485
519
|
artifactUrl = (0, _artifacts.getArtifactUrl)(artifacts, artifactName);
|
|
486
520
|
if (artifactUrl) {
|
|
487
|
-
|
|
521
|
+
_context0.next = 4;
|
|
488
522
|
break;
|
|
489
523
|
}
|
|
490
524
|
throw new Error("artifact ".concat(artifactName, " not found"));
|
|
491
525
|
case 4:
|
|
492
|
-
|
|
526
|
+
_context0.next = 6;
|
|
493
527
|
return this.resolveAuth({
|
|
494
528
|
collectionName: collectionName
|
|
495
529
|
});
|
|
496
530
|
case 6:
|
|
497
|
-
auth =
|
|
531
|
+
auth = _context0.sent;
|
|
498
532
|
options = {
|
|
499
533
|
params: {
|
|
500
534
|
collection: collectionName,
|
|
@@ -502,14 +536,14 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
502
536
|
},
|
|
503
537
|
auth: auth
|
|
504
538
|
};
|
|
505
|
-
return
|
|
539
|
+
return _context0.abrupt("return", (0, _helpers.createUrl)((0, _mediaCdn.mapToMediaCdnUrl)(artifactUrl, auth.token), options));
|
|
506
540
|
case 9:
|
|
507
541
|
case "end":
|
|
508
|
-
return
|
|
542
|
+
return _context0.stop();
|
|
509
543
|
}
|
|
510
|
-
},
|
|
544
|
+
}, _callee0, this);
|
|
511
545
|
}));
|
|
512
|
-
function getArtifactURL(
|
|
546
|
+
function getArtifactURL(_x29, _x30, _x31) {
|
|
513
547
|
return _getArtifactURL.apply(this, arguments);
|
|
514
548
|
}
|
|
515
549
|
return getArtifactURL;
|
|
@@ -517,10 +551,10 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
517
551
|
}, {
|
|
518
552
|
key: "getImage",
|
|
519
553
|
value: function () {
|
|
520
|
-
var _getImage = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
554
|
+
var _getImage = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee1(id, params, controller, fetchMaxRes, traceContext) {
|
|
521
555
|
var isWebpSupported, headers, imageEndpoint, metadata, options;
|
|
522
|
-
return _regenerator.default.wrap(function
|
|
523
|
-
while (1) switch (
|
|
556
|
+
return _regenerator.default.wrap(function _callee1$(_context1) {
|
|
557
|
+
while (1) switch (_context1.prev = _context1.next) {
|
|
524
558
|
case 0:
|
|
525
559
|
// TODO add checkWebpSupport() back https://product-fabric.atlassian.net/browse/MPT-584
|
|
526
560
|
isWebpSupported = false;
|
|
@@ -542,14 +576,14 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
542
576
|
traceContext: traceContext,
|
|
543
577
|
addMediaClientParam: true
|
|
544
578
|
});
|
|
545
|
-
return
|
|
579
|
+
return _context1.abrupt("return", this.request("/file/".concat(id, "/").concat(imageEndpoint), options, controller, true).then((0, _helpers.createMapResponseToBlob)(metadata)));
|
|
546
580
|
case 7:
|
|
547
581
|
case "end":
|
|
548
|
-
return
|
|
582
|
+
return _context1.stop();
|
|
549
583
|
}
|
|
550
|
-
},
|
|
584
|
+
}, _callee1, this);
|
|
551
585
|
}));
|
|
552
|
-
function getImage(
|
|
586
|
+
function getImage(_x32, _x33, _x34, _x35, _x36) {
|
|
553
587
|
return _getImage.apply(this, arguments);
|
|
554
588
|
}
|
|
555
589
|
return getImage;
|
|
@@ -557,10 +591,10 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
557
591
|
}, {
|
|
558
592
|
key: "getItems",
|
|
559
593
|
value: function () {
|
|
560
|
-
var _getItems = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
594
|
+
var _getItems = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(ids, collectionName, traceContext, includeHashForDuplicateFiles) {
|
|
561
595
|
var descriptors, metadata, options;
|
|
562
|
-
return _regenerator.default.wrap(function
|
|
563
|
-
while (1) switch (
|
|
596
|
+
return _regenerator.default.wrap(function _callee10$(_context10) {
|
|
597
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
564
598
|
case 0:
|
|
565
599
|
descriptors = ids.map(function (id) {
|
|
566
600
|
return {
|
|
@@ -584,14 +618,14 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
584
618
|
}),
|
|
585
619
|
traceContext: traceContext
|
|
586
620
|
});
|
|
587
|
-
return
|
|
621
|
+
return _context10.abrupt("return", this.request('/items', options).then((0, _helpers.createMapResponseToJson)(metadata)));
|
|
588
622
|
case 4:
|
|
589
623
|
case "end":
|
|
590
|
-
return
|
|
624
|
+
return _context10.stop();
|
|
591
625
|
}
|
|
592
|
-
},
|
|
626
|
+
}, _callee10, this);
|
|
593
627
|
}));
|
|
594
|
-
function getItems(
|
|
628
|
+
function getItems(_x37, _x38, _x39, _x40) {
|
|
595
629
|
return _getItems.apply(this, arguments);
|
|
596
630
|
}
|
|
597
631
|
return getItems;
|
|
@@ -599,10 +633,10 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
599
633
|
}, {
|
|
600
634
|
key: "getImageMetadata",
|
|
601
635
|
value: function () {
|
|
602
|
-
var _getImageMetadata = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
636
|
+
var _getImageMetadata = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(id, params, traceContext) {
|
|
603
637
|
var metadata, options;
|
|
604
|
-
return _regenerator.default.wrap(function
|
|
605
|
-
while (1) switch (
|
|
638
|
+
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
639
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
606
640
|
case 0:
|
|
607
641
|
metadata = {
|
|
608
642
|
method: 'GET',
|
|
@@ -615,25 +649,94 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
615
649
|
params: params,
|
|
616
650
|
traceContext: traceContext
|
|
617
651
|
});
|
|
618
|
-
return
|
|
652
|
+
return _context11.abrupt("return", this.request("/file/".concat(id, "/image/metadata"), options).then((0, _helpers.createMapResponseToJson)(metadata)));
|
|
619
653
|
case 3:
|
|
620
654
|
case "end":
|
|
621
|
-
return
|
|
655
|
+
return _context11.stop();
|
|
622
656
|
}
|
|
623
|
-
},
|
|
657
|
+
}, _callee11, this);
|
|
624
658
|
}));
|
|
625
|
-
function getImageMetadata(
|
|
659
|
+
function getImageMetadata(_x41, _x42, _x43) {
|
|
626
660
|
return _getImageMetadata.apply(this, arguments);
|
|
627
661
|
}
|
|
628
662
|
return getImageMetadata;
|
|
629
663
|
}()
|
|
630
664
|
}, {
|
|
631
|
-
key: "
|
|
665
|
+
key: "getDocumentContent",
|
|
632
666
|
value: function () {
|
|
633
|
-
var
|
|
634
|
-
var metadata,
|
|
667
|
+
var _getDocumentContent = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(id, options) {
|
|
668
|
+
var metadata, requestOptions;
|
|
669
|
+
return _regenerator.default.wrap(function _callee12$(_context12) {
|
|
670
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
671
|
+
case 0:
|
|
672
|
+
metadata = {
|
|
673
|
+
method: 'GET',
|
|
674
|
+
endpoint: '/file/{fileId}/document/contents'
|
|
675
|
+
};
|
|
676
|
+
requestOptions = _objectSpread(_objectSpread({}, metadata), {}, {
|
|
677
|
+
authContext: {
|
|
678
|
+
collectionName: options.collectionName
|
|
679
|
+
},
|
|
680
|
+
params: {
|
|
681
|
+
pageStart: options.pageStart,
|
|
682
|
+
pageEnd: options.pageEnd,
|
|
683
|
+
'max-age': _constants.FILE_CACHE_MAX_AGE
|
|
684
|
+
}
|
|
685
|
+
});
|
|
686
|
+
return _context12.abrupt("return", this.request("/file/".concat(id, "/document/contents"), requestOptions).then((0, _helpers.createMapResponseToJson)(metadata)));
|
|
687
|
+
case 3:
|
|
688
|
+
case "end":
|
|
689
|
+
return _context12.stop();
|
|
690
|
+
}
|
|
691
|
+
}, _callee12, this);
|
|
692
|
+
}));
|
|
693
|
+
function getDocumentContent(_x44, _x45) {
|
|
694
|
+
return _getDocumentContent.apply(this, arguments);
|
|
695
|
+
}
|
|
696
|
+
return getDocumentContent;
|
|
697
|
+
}()
|
|
698
|
+
}, {
|
|
699
|
+
key: "getDocumentPageImage",
|
|
700
|
+
value: function () {
|
|
701
|
+
var _getDocumentPageImage = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(id, options) {
|
|
702
|
+
var endpoint, metadata, requestOptions;
|
|
635
703
|
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
636
704
|
while (1) switch (_context13.prev = _context13.next) {
|
|
705
|
+
case 0:
|
|
706
|
+
endpoint = cdnFeatureFlag('page');
|
|
707
|
+
metadata = {
|
|
708
|
+
method: 'GET',
|
|
709
|
+
endpoint: "/file/{fileId}/document/".concat(endpoint)
|
|
710
|
+
};
|
|
711
|
+
requestOptions = _objectSpread(_objectSpread({}, metadata), {}, {
|
|
712
|
+
authContext: {
|
|
713
|
+
collectionName: options.collectionName
|
|
714
|
+
},
|
|
715
|
+
params: {
|
|
716
|
+
page: options.page,
|
|
717
|
+
zoom: options.zoom,
|
|
718
|
+
'max-age': _constants.FILE_CACHE_MAX_AGE
|
|
719
|
+
}
|
|
720
|
+
});
|
|
721
|
+
return _context13.abrupt("return", this.request("/file/".concat(id, "/document/").concat(endpoint), requestOptions).then((0, _helpers.createMapResponseToBlob)(metadata)));
|
|
722
|
+
case 4:
|
|
723
|
+
case "end":
|
|
724
|
+
return _context13.stop();
|
|
725
|
+
}
|
|
726
|
+
}, _callee13, this);
|
|
727
|
+
}));
|
|
728
|
+
function getDocumentPageImage(_x46, _x47) {
|
|
729
|
+
return _getDocumentPageImage.apply(this, arguments);
|
|
730
|
+
}
|
|
731
|
+
return getDocumentPageImage;
|
|
732
|
+
}()
|
|
733
|
+
}, {
|
|
734
|
+
key: "appendChunksToUpload",
|
|
735
|
+
value: function () {
|
|
736
|
+
var _appendChunksToUpload = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(uploadId, body, collectionName, traceContext) {
|
|
737
|
+
var metadata, options;
|
|
738
|
+
return _regenerator.default.wrap(function _callee14$(_context14) {
|
|
739
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
637
740
|
case 0:
|
|
638
741
|
metadata = {
|
|
639
742
|
method: 'PUT',
|
|
@@ -647,15 +750,15 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
647
750
|
body: JSON.stringify(body),
|
|
648
751
|
traceContext: traceContext
|
|
649
752
|
});
|
|
650
|
-
|
|
753
|
+
_context14.next = 4;
|
|
651
754
|
return this.request("/upload/".concat(uploadId, "/chunks"), options);
|
|
652
755
|
case 4:
|
|
653
756
|
case "end":
|
|
654
|
-
return
|
|
757
|
+
return _context14.stop();
|
|
655
758
|
}
|
|
656
|
-
},
|
|
759
|
+
}, _callee14, this);
|
|
657
760
|
}));
|
|
658
|
-
function appendChunksToUpload(
|
|
761
|
+
function appendChunksToUpload(_x48, _x49, _x50, _x51) {
|
|
659
762
|
return _appendChunksToUpload.apply(this, arguments);
|
|
660
763
|
}
|
|
661
764
|
return appendChunksToUpload;
|
|
@@ -712,10 +815,10 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
712
815
|
}, {
|
|
713
816
|
key: "registerCopyIntents",
|
|
714
817
|
value: function () {
|
|
715
|
-
var _registerCopyIntents = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
818
|
+
var _registerCopyIntents = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(files, traceContext, resolvedAuth) {
|
|
716
819
|
var metadata, options;
|
|
717
|
-
return _regenerator.default.wrap(function
|
|
718
|
-
while (1) switch (
|
|
820
|
+
return _regenerator.default.wrap(function _callee15$(_context15) {
|
|
821
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
719
822
|
case 0:
|
|
720
823
|
metadata = {
|
|
721
824
|
method: 'POST',
|
|
@@ -729,15 +832,15 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
729
832
|
traceContext: traceContext,
|
|
730
833
|
resolvedAuth: resolvedAuth
|
|
731
834
|
});
|
|
732
|
-
|
|
835
|
+
_context15.next = 4;
|
|
733
836
|
return this.request('/file/copy/intents', options);
|
|
734
837
|
case 4:
|
|
735
838
|
case "end":
|
|
736
|
-
return
|
|
839
|
+
return _context15.stop();
|
|
737
840
|
}
|
|
738
|
-
},
|
|
841
|
+
}, _callee15, this);
|
|
739
842
|
}));
|
|
740
|
-
function registerCopyIntents(
|
|
843
|
+
function registerCopyIntents(_x52, _x53, _x54) {
|
|
741
844
|
return _registerCopyIntents.apply(this, arguments);
|
|
742
845
|
}
|
|
743
846
|
return registerCopyIntents;
|
|
@@ -745,7 +848,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
745
848
|
}, {
|
|
746
849
|
key: "request",
|
|
747
850
|
value: function () {
|
|
748
|
-
var _request2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
851
|
+
var _request2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16(path) {
|
|
749
852
|
var options,
|
|
750
853
|
controller,
|
|
751
854
|
useMediaCdn,
|
|
@@ -765,32 +868,32 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
765
868
|
extendedParams,
|
|
766
869
|
url,
|
|
767
870
|
response,
|
|
768
|
-
|
|
769
|
-
return _regenerator.default.wrap(function
|
|
770
|
-
while (1) switch (
|
|
871
|
+
_args16 = arguments;
|
|
872
|
+
return _regenerator.default.wrap(function _callee16$(_context16) {
|
|
873
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
771
874
|
case 0:
|
|
772
|
-
options =
|
|
875
|
+
options = _args16.length > 1 && _args16[1] !== undefined ? _args16[1] : {
|
|
773
876
|
method: 'GET',
|
|
774
877
|
endpoint: undefined,
|
|
775
878
|
authContext: {}
|
|
776
879
|
};
|
|
777
|
-
controller =
|
|
778
|
-
useMediaCdn =
|
|
880
|
+
controller = _args16.length > 2 ? _args16[2] : undefined;
|
|
881
|
+
useMediaCdn = _args16.length > 3 ? _args16[3] : undefined;
|
|
779
882
|
method = options.method, endpoint = options.endpoint, authContext = options.authContext, params = options.params, headers = options.headers, body = options.body, clientOptions = options.clientOptions, traceContext = options.traceContext, addMediaClientParam = options.addMediaClientParam, resolvedAuth = options.resolvedAuth;
|
|
780
883
|
if (!(resolvedAuth !== null && resolvedAuth !== void 0)) {
|
|
781
|
-
|
|
884
|
+
_context16.next = 8;
|
|
782
885
|
break;
|
|
783
886
|
}
|
|
784
|
-
|
|
785
|
-
|
|
887
|
+
_context16.t0 = resolvedAuth;
|
|
888
|
+
_context16.next = 11;
|
|
786
889
|
break;
|
|
787
890
|
case 8:
|
|
788
|
-
|
|
891
|
+
_context16.next = 10;
|
|
789
892
|
return this.resolveAuth(authContext);
|
|
790
893
|
case 10:
|
|
791
|
-
|
|
894
|
+
_context16.t0 = _context16.sent;
|
|
792
895
|
case 11:
|
|
793
|
-
auth =
|
|
896
|
+
auth = _context16.t0;
|
|
794
897
|
clientId = (0, _mediaCore.isClientBasedAuth)(auth) ? auth.clientId : undefined;
|
|
795
898
|
extendedTraceContext = (0, _helpers.extendTraceContext)(traceContext);
|
|
796
899
|
extendedParams = addMediaClientParam ? _objectSpread(_objectSpread({}, params), {}, {
|
|
@@ -800,7 +903,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
800
903
|
if (useMediaCdn) {
|
|
801
904
|
url = (0, _mediaCdn.mapToMediaCdnUrl)(url, auth.token);
|
|
802
905
|
}
|
|
803
|
-
|
|
906
|
+
_context16.next = 19;
|
|
804
907
|
return (0, _request3.request)(url, {
|
|
805
908
|
method: method,
|
|
806
909
|
endpoint: endpoint,
|
|
@@ -812,17 +915,17 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
812
915
|
traceContext: extendedTraceContext
|
|
813
916
|
}, controller);
|
|
814
917
|
case 19:
|
|
815
|
-
response =
|
|
918
|
+
response = _context16.sent;
|
|
816
919
|
setKeyValueInSessionStorage(MEDIA_API_REGION, response.headers.get('x-media-region'));
|
|
817
920
|
setKeyValueInSessionStorage(MEDIA_API_ENVIRONMENT, response.headers.get('x-media-env'));
|
|
818
|
-
return
|
|
921
|
+
return _context16.abrupt("return", response);
|
|
819
922
|
case 23:
|
|
820
923
|
case "end":
|
|
821
|
-
return
|
|
924
|
+
return _context16.stop();
|
|
822
925
|
}
|
|
823
|
-
},
|
|
926
|
+
}, _callee16, this);
|
|
824
927
|
}));
|
|
825
|
-
function request(
|
|
928
|
+
function request(_x55) {
|
|
826
929
|
return _request2.apply(this, arguments);
|
|
827
930
|
}
|
|
828
931
|
return request;
|
|
@@ -830,16 +933,16 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
830
933
|
}, {
|
|
831
934
|
key: "testUrl",
|
|
832
935
|
value: function () {
|
|
833
|
-
var _testUrl = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
936
|
+
var _testUrl = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(url) {
|
|
834
937
|
var options,
|
|
835
938
|
traceContext,
|
|
836
|
-
|
|
837
|
-
return _regenerator.default.wrap(function
|
|
838
|
-
while (1) switch (
|
|
939
|
+
_args17 = arguments;
|
|
940
|
+
return _regenerator.default.wrap(function _callee17$(_context17) {
|
|
941
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
839
942
|
case 0:
|
|
840
|
-
options =
|
|
943
|
+
options = _args17.length > 1 && _args17[1] !== undefined ? _args17[1] : {};
|
|
841
944
|
traceContext = options.traceContext;
|
|
842
|
-
|
|
945
|
+
_context17.next = 4;
|
|
843
946
|
return (0, _request3.request)(url, {
|
|
844
947
|
method: 'HEAD',
|
|
845
948
|
traceContext: (0, _helpers.extendTraceContext)(traceContext),
|
|
@@ -851,11 +954,11 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
851
954
|
});
|
|
852
955
|
case 4:
|
|
853
956
|
case "end":
|
|
854
|
-
return
|
|
957
|
+
return _context17.stop();
|
|
855
958
|
}
|
|
856
|
-
},
|
|
959
|
+
}, _callee17);
|
|
857
960
|
}));
|
|
858
|
-
function testUrl(
|
|
961
|
+
function testUrl(_x56) {
|
|
859
962
|
return _testUrl.apply(this, arguments);
|
|
860
963
|
}
|
|
861
964
|
return testUrl;
|