@atlaskit/media-client 26.2.2 → 26.3.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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/media-client
2
2
 
3
+ ## 26.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#87494](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/87494) [`050f1e462e17`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/050f1e462e17) - Added Get Binary endpoint to Media API class
8
+
9
+ ## 26.2.3
10
+
11
+ ### Patch Changes
12
+
13
+ - [#86762](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/86762) [`f3d1602fa574`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f3d1602fa574) - CXP-2655 Implemented a change to an endpoint for Mocked Media API
14
+
3
15
  ## 26.2.2
4
16
 
5
17
  ### Patch Changes
@@ -293,23 +293,62 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
293
293
  return (0, _helpers.createUrl)("".concat(auth.baseUrl, "/file/").concat(id, "/image"), options);
294
294
  }
295
295
  }, {
296
- key: "getFileBinaryURL",
296
+ key: "getFileBinary",
297
297
  value: function () {
298
- var _getFileBinaryURL = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(id, collectionName) {
298
+ var _getFileBinary = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(id, collectionName) {
299
299
  var maxAge,
300
- auth,
300
+ headers,
301
+ metadata,
301
302
  options,
302
303
  _args5 = arguments;
303
304
  return _regenerator.default.wrap(function _callee5$(_context5) {
304
305
  while (1) switch (_context5.prev = _context5.next) {
305
306
  case 0:
306
307
  maxAge = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : _constants.FILE_CACHE_MAX_AGE;
307
- _context5.next = 3;
308
+ headers = {};
309
+ metadata = {
310
+ method: 'GET',
311
+ endpoint: '/file/{fileId}/binary'
312
+ };
313
+ options = _objectSpread(_objectSpread({}, metadata), {}, {
314
+ authContext: {
315
+ collectionName: collectionName
316
+ },
317
+ headers: headers,
318
+ params: {
319
+ 'max-age': "".concat(maxAge)
320
+ }
321
+ });
322
+ return _context5.abrupt("return", this.request("/file/".concat(id, "/binary"), options).then((0, _helpers.createMapResponseToBlob)(metadata)));
323
+ case 5:
324
+ case "end":
325
+ return _context5.stop();
326
+ }
327
+ }, _callee5, this);
328
+ }));
329
+ function getFileBinary(_x14, _x15) {
330
+ return _getFileBinary.apply(this, arguments);
331
+ }
332
+ return getFileBinary;
333
+ }()
334
+ }, {
335
+ key: "getFileBinaryURL",
336
+ value: function () {
337
+ var _getFileBinaryURL = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(id, collectionName) {
338
+ var maxAge,
339
+ auth,
340
+ options,
341
+ _args6 = arguments;
342
+ return _regenerator.default.wrap(function _callee6$(_context6) {
343
+ while (1) switch (_context6.prev = _context6.next) {
344
+ case 0:
345
+ maxAge = _args6.length > 2 && _args6[2] !== undefined ? _args6[2] : _constants.FILE_CACHE_MAX_AGE;
346
+ _context6.next = 3;
308
347
  return this.resolveAuth({
309
348
  collectionName: collectionName
310
349
  });
311
350
  case 3:
312
- auth = _context5.sent;
351
+ auth = _context6.sent;
313
352
  options = {
314
353
  params: {
315
354
  dl: true,
@@ -318,14 +357,14 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
318
357
  },
319
358
  auth: auth
320
359
  };
321
- return _context5.abrupt("return", (0, _helpers.createUrl)("".concat(auth.baseUrl, "/file/").concat(id, "/binary"), options));
360
+ return _context6.abrupt("return", (0, _helpers.createUrl)("".concat(auth.baseUrl, "/file/").concat(id, "/binary"), options));
322
361
  case 6:
323
362
  case "end":
324
- return _context5.stop();
363
+ return _context6.stop();
325
364
  }
326
- }, _callee5, this);
365
+ }, _callee6, this);
327
366
  }));
328
- function getFileBinaryURL(_x14, _x15) {
367
+ function getFileBinaryURL(_x16, _x17) {
329
368
  return _getFileBinaryURL.apply(this, arguments);
330
369
  }
331
370
  return getFileBinaryURL;
@@ -333,24 +372,24 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
333
372
  }, {
334
373
  key: "getArtifactURL",
335
374
  value: function () {
336
- var _getArtifactURL = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(artifacts, artifactName, collectionName) {
375
+ var _getArtifactURL = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(artifacts, artifactName, collectionName) {
337
376
  var artifactUrl, auth, options;
338
- return _regenerator.default.wrap(function _callee6$(_context6) {
339
- while (1) switch (_context6.prev = _context6.next) {
377
+ return _regenerator.default.wrap(function _callee7$(_context7) {
378
+ while (1) switch (_context7.prev = _context7.next) {
340
379
  case 0:
341
380
  artifactUrl = (0, _artifacts.getArtifactUrl)(artifacts, artifactName);
342
381
  if (artifactUrl) {
343
- _context6.next = 3;
382
+ _context7.next = 3;
344
383
  break;
345
384
  }
346
385
  throw new Error("artifact ".concat(artifactName, " not found"));
347
386
  case 3:
348
- _context6.next = 5;
387
+ _context7.next = 5;
349
388
  return this.resolveAuth({
350
389
  collectionName: collectionName
351
390
  });
352
391
  case 5:
353
- auth = _context6.sent;
392
+ auth = _context7.sent;
354
393
  options = {
355
394
  params: {
356
395
  collection: collectionName,
@@ -358,14 +397,14 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
358
397
  },
359
398
  auth: auth
360
399
  };
361
- return _context6.abrupt("return", (0, _helpers.createUrl)("".concat(auth.baseUrl).concat(artifactUrl), options));
400
+ return _context7.abrupt("return", (0, _helpers.createUrl)("".concat(auth.baseUrl).concat(artifactUrl), options));
362
401
  case 8:
363
402
  case "end":
364
- return _context6.stop();
403
+ return _context7.stop();
365
404
  }
366
- }, _callee6, this);
405
+ }, _callee7, this);
367
406
  }));
368
- function getArtifactURL(_x16, _x17, _x18) {
407
+ function getArtifactURL(_x18, _x19, _x20) {
369
408
  return _getArtifactURL.apply(this, arguments);
370
409
  }
371
410
  return getArtifactURL;
@@ -373,10 +412,10 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
373
412
  }, {
374
413
  key: "getImage",
375
414
  value: function () {
376
- var _getImage = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(id, params, controller, fetchMaxRes, traceContext) {
415
+ var _getImage = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(id, params, controller, fetchMaxRes, traceContext) {
377
416
  var isWebpSupported, headers, metadata, options;
378
- return _regenerator.default.wrap(function _callee7$(_context7) {
379
- while (1) switch (_context7.prev = _context7.next) {
417
+ return _regenerator.default.wrap(function _callee8$(_context8) {
418
+ while (1) switch (_context8.prev = _context8.next) {
380
419
  case 0:
381
420
  // TODO add checkWebpSupport() back https://product-fabric.atlassian.net/browse/MPT-584
382
421
  isWebpSupported = false;
@@ -396,14 +435,14 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
396
435
  headers: headers,
397
436
  traceContext: traceContext
398
437
  });
399
- return _context7.abrupt("return", this.request("/file/".concat(id, "/image"), options, controller).then((0, _helpers.createMapResponseToBlob)(metadata)));
438
+ return _context8.abrupt("return", this.request("/file/".concat(id, "/image"), options, controller).then((0, _helpers.createMapResponseToBlob)(metadata)));
400
439
  case 6:
401
440
  case "end":
402
- return _context7.stop();
441
+ return _context8.stop();
403
442
  }
404
- }, _callee7, this);
443
+ }, _callee8, this);
405
444
  }));
406
- function getImage(_x19, _x20, _x21, _x22, _x23) {
445
+ function getImage(_x21, _x22, _x23, _x24, _x25) {
407
446
  return _getImage.apply(this, arguments);
408
447
  }
409
448
  return getImage;
@@ -411,10 +450,10 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
411
450
  }, {
412
451
  key: "getItems",
413
452
  value: function () {
414
- var _getItems = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(ids, collectionName, traceContext) {
453
+ var _getItems = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(ids, collectionName, traceContext) {
415
454
  var descriptors, metadata, options;
416
- return _regenerator.default.wrap(function _callee8$(_context8) {
417
- while (1) switch (_context8.prev = _context8.next) {
455
+ return _regenerator.default.wrap(function _callee9$(_context9) {
456
+ while (1) switch (_context9.prev = _context9.next) {
418
457
  case 0:
419
458
  descriptors = ids.map(function (id) {
420
459
  return {
@@ -437,14 +476,14 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
437
476
  }),
438
477
  traceContext: traceContext
439
478
  });
440
- return _context8.abrupt("return", this.request('/items', options).then((0, _helpers.createMapResponseToJson)(metadata)));
479
+ return _context9.abrupt("return", this.request('/items', options).then((0, _helpers.createMapResponseToJson)(metadata)));
441
480
  case 4:
442
481
  case "end":
443
- return _context8.stop();
482
+ return _context9.stop();
444
483
  }
445
- }, _callee8, this);
484
+ }, _callee9, this);
446
485
  }));
447
- function getItems(_x24, _x25, _x26) {
486
+ function getItems(_x26, _x27, _x28) {
448
487
  return _getItems.apply(this, arguments);
449
488
  }
450
489
  return getItems;
@@ -452,10 +491,10 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
452
491
  }, {
453
492
  key: "getImageMetadata",
454
493
  value: function () {
455
- var _getImageMetadata = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(id, params, traceContext) {
494
+ var _getImageMetadata = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(id, params, traceContext) {
456
495
  var metadata, options;
457
- return _regenerator.default.wrap(function _callee9$(_context9) {
458
- while (1) switch (_context9.prev = _context9.next) {
496
+ return _regenerator.default.wrap(function _callee10$(_context10) {
497
+ while (1) switch (_context10.prev = _context10.next) {
459
498
  case 0:
460
499
  metadata = {
461
500
  method: 'GET',
@@ -468,14 +507,14 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
468
507
  params: params,
469
508
  traceContext: traceContext
470
509
  });
471
- return _context9.abrupt("return", this.request("/file/".concat(id, "/image/metadata"), options).then((0, _helpers.createMapResponseToJson)(metadata)));
510
+ return _context10.abrupt("return", this.request("/file/".concat(id, "/image/metadata"), options).then((0, _helpers.createMapResponseToJson)(metadata)));
472
511
  case 3:
473
512
  case "end":
474
- return _context9.stop();
513
+ return _context10.stop();
475
514
  }
476
- }, _callee9, this);
515
+ }, _callee10, this);
477
516
  }));
478
- function getImageMetadata(_x27, _x28, _x29) {
517
+ function getImageMetadata(_x29, _x30, _x31) {
479
518
  return _getImageMetadata.apply(this, arguments);
480
519
  }
481
520
  return getImageMetadata;
@@ -483,10 +522,10 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
483
522
  }, {
484
523
  key: "appendChunksToUpload",
485
524
  value: function () {
486
- var _appendChunksToUpload = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(uploadId, body, collectionName, traceContext) {
525
+ var _appendChunksToUpload = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(uploadId, body, collectionName, traceContext) {
487
526
  var metadata, options;
488
- return _regenerator.default.wrap(function _callee10$(_context10) {
489
- while (1) switch (_context10.prev = _context10.next) {
527
+ return _regenerator.default.wrap(function _callee11$(_context11) {
528
+ while (1) switch (_context11.prev = _context11.next) {
490
529
  case 0:
491
530
  metadata = {
492
531
  method: 'PUT',
@@ -500,15 +539,15 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
500
539
  body: JSON.stringify(body),
501
540
  traceContext: traceContext
502
541
  });
503
- _context10.next = 4;
542
+ _context11.next = 4;
504
543
  return this.request("/upload/".concat(uploadId, "/chunks"), options);
505
544
  case 4:
506
545
  case "end":
507
- return _context10.stop();
546
+ return _context11.stop();
508
547
  }
509
- }, _callee10, this);
548
+ }, _callee11, this);
510
549
  }));
511
- function appendChunksToUpload(_x30, _x31, _x32, _x33) {
550
+ function appendChunksToUpload(_x32, _x33, _x34, _x35) {
512
551
  return _appendChunksToUpload.apply(this, arguments);
513
552
  }
514
553
  return appendChunksToUpload;
@@ -537,7 +576,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
537
576
  }, {
538
577
  key: "request",
539
578
  value: function () {
540
- var _request2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(path) {
579
+ var _request2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(path) {
541
580
  var options,
542
581
  controller,
543
582
  method,
@@ -551,25 +590,25 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
551
590
  auth,
552
591
  extendedTraceContext,
553
592
  response,
554
- _args11 = arguments;
555
- return _regenerator.default.wrap(function _callee11$(_context11) {
556
- while (1) switch (_context11.prev = _context11.next) {
593
+ _args12 = arguments;
594
+ return _regenerator.default.wrap(function _callee12$(_context12) {
595
+ while (1) switch (_context12.prev = _context12.next) {
557
596
  case 0:
558
- options = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] : {
597
+ options = _args12.length > 1 && _args12[1] !== undefined ? _args12[1] : {
559
598
  method: 'GET',
560
599
  endpoint: undefined,
561
600
  authContext: {}
562
601
  };
563
- controller = _args11.length > 2 ? _args11[2] : undefined;
602
+ controller = _args12.length > 2 ? _args12[2] : undefined;
564
603
  method = options.method, endpoint = options.endpoint, authContext = options.authContext, params = options.params, headers = options.headers, body = options.body, clientOptions = options.clientOptions, traceContext = options.traceContext;
565
- _context11.next = 5;
604
+ _context12.next = 5;
566
605
  return this.resolveAuth(authContext);
567
606
  case 5:
568
- auth = _context11.sent;
607
+ auth = _context12.sent;
569
608
  extendedTraceContext = traceContext ? _objectSpread(_objectSpread({}, traceContext), {}, {
570
609
  spanId: (traceContext === null || traceContext === void 0 ? void 0 : traceContext.spanId) || (0, _mediaCommon.getRandomHex)(8)
571
610
  }) : undefined;
572
- _context11.next = 9;
611
+ _context12.next = 9;
573
612
  return (0, _request3.request)("".concat(auth.baseUrl).concat(path), {
574
613
  method: method,
575
614
  endpoint: endpoint,
@@ -581,17 +620,17 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
581
620
  traceContext: extendedTraceContext
582
621
  }, controller);
583
622
  case 9:
584
- response = _context11.sent;
623
+ response = _context12.sent;
585
624
  setKeyValueInSessionStorage(MEDIA_API_REGION, response.headers.get('x-media-region'));
586
625
  setKeyValueInSessionStorage(MEDIA_API_ENVIRONMENT, response.headers.get('x-media-env'));
587
- return _context11.abrupt("return", response);
626
+ return _context12.abrupt("return", response);
588
627
  case 13:
589
628
  case "end":
590
- return _context11.stop();
629
+ return _context12.stop();
591
630
  }
592
- }, _callee11, this);
631
+ }, _callee12, this);
593
632
  }));
594
- function request(_x34) {
633
+ function request(_x36) {
595
634
  return _request2.apply(this, arguments);
596
635
  }
597
636
  return request;
@@ -190,20 +190,19 @@ var getMediaApi = function getMediaApi(_ref) {
190
190
  // URL ENDPOINTS
191
191
  // --------------------------------------------------------
192
192
 
193
- // TODO
194
193
  getFileImageURL: function () {
195
- var _getFileImageURL = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
194
+ var _getFileImageURL = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(id) {
196
195
  return _regenerator.default.wrap(function _callee9$(_context9) {
197
196
  while (1) switch (_context9.prev = _context9.next) {
198
197
  case 0:
199
- throw new Error('500 - MockedMediaApi.getFileImageURL: method not implemented');
198
+ return _context9.abrupt("return", "image-url-".concat(id));
200
199
  case 1:
201
200
  case "end":
202
201
  return _context9.stop();
203
202
  }
204
203
  }, _callee9);
205
204
  }));
206
- function getFileImageURL() {
205
+ function getFileImageURL(_x9) {
207
206
  return _getFileImageURL.apply(this, arguments);
208
207
  }
209
208
  return getFileImageURL;
@@ -237,7 +236,7 @@ var getMediaApi = function getMediaApi(_ref) {
237
236
  }
238
237
  }, _callee10);
239
238
  }));
240
- function getFileBinaryURL(_x9) {
239
+ function getFileBinaryURL(_x10) {
241
240
  return _getFileBinaryURL.apply(this, arguments);
242
241
  }
243
242
  return getFileBinaryURL;
@@ -263,7 +262,7 @@ var getMediaApi = function getMediaApi(_ref) {
263
262
  }
264
263
  }, _callee11);
265
264
  }));
266
- function getArtifactURL(_x10, _x11) {
265
+ function getArtifactURL(_x11, _x12) {
267
266
  return _getArtifactURL.apply(this, arguments);
268
267
  }
269
268
  return getArtifactURL;
@@ -297,54 +296,79 @@ var getMediaApi = function getMediaApi(_ref) {
297
296
  }
298
297
  }, _callee12);
299
298
  }));
300
- function getImage(_x12) {
299
+ function getImage(_x13) {
301
300
  return _getImage.apply(this, arguments);
302
301
  }
303
302
  return getImage;
304
303
  }(),
304
+ getFileBinary: function () {
305
+ var _getFileBinary = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(fileId) {
306
+ var fileItem;
307
+ return _regenerator.default.wrap(function _callee13$(_context13) {
308
+ while (1) switch (_context13.prev = _context13.next) {
309
+ case 0:
310
+ fileItem = getItem(fileId);
311
+ if (fileItem) {
312
+ _context13.next = 3;
313
+ break;
314
+ }
315
+ throw new Error('404 - MockedMediaApi.getFileBinary: file not found');
316
+ case 3:
317
+ return _context13.abrupt("return", new Blob());
318
+ case 4:
319
+ case "end":
320
+ return _context13.stop();
321
+ }
322
+ }, _callee13);
323
+ }));
324
+ function getFileBinary(_x14) {
325
+ return _getFileBinary.apply(this, arguments);
326
+ }
327
+ return getFileBinary;
328
+ }(),
305
329
  // --------------------------------------------------------
306
330
  // OTHER ENDPOINTS
307
331
  // --------------------------------------------------------
308
332
 
309
333
  // TODO
310
334
  copyFileWithToken: function () {
311
- var _copyFileWithToken = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(body) {
335
+ var _copyFileWithToken = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(body) {
312
336
  var fileId, fileItem;
313
- return _regenerator.default.wrap(function _callee13$(_context13) {
314
- while (1) switch (_context13.prev = _context13.next) {
337
+ return _regenerator.default.wrap(function _callee14$(_context14) {
338
+ while (1) switch (_context14.prev = _context14.next) {
315
339
  case 0:
316
340
  fileId = body.sourceFile.id;
317
341
  fileItem = getItem(fileId);
318
342
  if (fileItem) {
319
- _context13.next = 4;
343
+ _context14.next = 4;
320
344
  break;
321
345
  }
322
346
  throw new Error('404 - MockedMediaApi.copyFileWithToken: file not found');
323
347
  case 4:
324
- return _context13.abrupt("return", {
348
+ return _context14.abrupt("return", {
325
349
  data: (0, _helpers.getMediaFile)(fileItem)
326
350
  });
327
351
  case 5:
328
352
  case "end":
329
- return _context13.stop();
353
+ return _context14.stop();
330
354
  }
331
- }, _callee13);
355
+ }, _callee14);
332
356
  }));
333
- function copyFileWithToken(_x13) {
357
+ function copyFileWithToken(_x15) {
334
358
  return _copyFileWithToken.apply(this, arguments);
335
359
  }
336
360
  return copyFileWithToken;
337
361
  }(),
338
362
  // TODO
339
363
  removeCollectionFile: function () {
340
- var _removeCollectionFile = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14() {
341
- return _regenerator.default.wrap(function _callee14$(_context14) {
342
- while (1) switch (_context14.prev = _context14.next) {
364
+ var _removeCollectionFile = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15() {
365
+ return _regenerator.default.wrap(function _callee15$(_context15) {
366
+ while (1) switch (_context15.prev = _context15.next) {
343
367
  case 0:
344
368
  case "end":
345
- return _context14.stop();
369
+ return _context15.stop();
346
370
  }
347
- }, _callee14);
371
+ }, _callee15);
348
372
  }));
349
373
  function removeCollectionFile() {
350
374
  return _removeCollectionFile.apply(this, arguments);
@@ -355,16 +379,16 @@ var getMediaApi = function getMediaApi(_ref) {
355
379
  // OTHER ENDPOINTS
356
380
  // --------------------------------------------------------
357
381
  request: function () {
358
- var _request = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15() {
359
- return _regenerator.default.wrap(function _callee15$(_context15) {
360
- while (1) switch (_context15.prev = _context15.next) {
382
+ var _request = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
383
+ return _regenerator.default.wrap(function _callee16$(_context16) {
384
+ while (1) switch (_context16.prev = _context16.next) {
361
385
  case 0:
362
- return _context15.abrupt("return", new Response());
386
+ return _context16.abrupt("return", new Response());
363
387
  case 1:
364
388
  case "end":
365
- return _context15.stop();
389
+ return _context16.stop();
366
390
  }
367
- }, _callee15);
391
+ }, _callee16);
368
392
  }));
369
393
  function request() {
370
394
  return _request.apply(this, arguments);
@@ -372,20 +396,20 @@ var getMediaApi = function getMediaApi(_ref) {
372
396
  return request;
373
397
  }(),
374
398
  resolveAuth: function () {
375
- var _resolveAuth = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
376
- return _regenerator.default.wrap(function _callee16$(_context16) {
377
- while (1) switch (_context16.prev = _context16.next) {
399
+ var _resolveAuth = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17() {
400
+ return _regenerator.default.wrap(function _callee17$(_context17) {
401
+ while (1) switch (_context17.prev = _context17.next) {
378
402
  case 0:
379
- return _context16.abrupt("return", {
403
+ return _context17.abrupt("return", {
380
404
  asapIssuer: '',
381
405
  token: '',
382
406
  baseUrl: ''
383
407
  });
384
408
  case 1:
385
409
  case "end":
386
- return _context16.stop();
410
+ return _context17.stop();
387
411
  }
388
- }, _callee16);
412
+ }, _callee17);
389
413
  }));
390
414
  function resolveAuth() {
391
415
  return _resolveAuth.apply(this, arguments);
@@ -186,6 +186,24 @@ export class MediaStore {
186
186
  };
187
187
  return createUrl(`${auth.baseUrl}/file/${id}/image`, options);
188
188
  }
189
+ async getFileBinary(id, collectionName, maxAge = FILE_CACHE_MAX_AGE) {
190
+ const headers = {};
191
+ const metadata = {
192
+ method: 'GET',
193
+ endpoint: '/file/{fileId}/binary'
194
+ };
195
+ const options = {
196
+ ...metadata,
197
+ authContext: {
198
+ collectionName
199
+ },
200
+ headers,
201
+ params: {
202
+ 'max-age': `${maxAge}`
203
+ }
204
+ };
205
+ return this.request(`/file/${id}/binary`, options).then(createMapResponseToBlob(metadata));
206
+ }
189
207
  async getFileBinaryURL(id, collectionName, maxAge = FILE_CACHE_MAX_AGE) {
190
208
  const auth = await this.resolveAuth({
191
209
  collectionName
@@ -61,9 +61,8 @@ const getMediaApi = ({
61
61
  // URL ENDPOINTS
62
62
  // --------------------------------------------------------
63
63
 
64
- // TODO
65
- getFileImageURL: async () => {
66
- throw new Error('500 - MockedMediaApi.getFileImageURL: method not implemented');
64
+ getFileImageURL: async id => {
65
+ return `image-url-${id}`;
67
66
  },
68
67
  getFileImageURLSync: id => {
69
68
  return `image-url-sync-${id}`;
@@ -102,6 +101,13 @@ const getMediaApi = ({
102
101
  // Empty Blob. Might have to change for a real one if TLR loads the image
103
102
  return new Blob();
104
103
  },
104
+ getFileBinary: async fileId => {
105
+ const fileItem = getItem(fileId);
106
+ if (!fileItem) {
107
+ throw new Error('404 - MockedMediaApi.getFileBinary: file not found');
108
+ }
109
+ return new Blob();
110
+ },
105
111
  // --------------------------------------------------------
106
112
  // OTHER ENDPOINTS
107
113
  // --------------------------------------------------------
@@ -286,23 +286,62 @@ export var MediaStore = /*#__PURE__*/function () {
286
286
  return createUrl("".concat(auth.baseUrl, "/file/").concat(id, "/image"), options);
287
287
  }
288
288
  }, {
289
- key: "getFileBinaryURL",
289
+ key: "getFileBinary",
290
290
  value: function () {
291
- var _getFileBinaryURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(id, collectionName) {
291
+ var _getFileBinary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(id, collectionName) {
292
292
  var maxAge,
293
- auth,
293
+ headers,
294
+ metadata,
294
295
  options,
295
296
  _args5 = arguments;
296
297
  return _regeneratorRuntime.wrap(function _callee5$(_context5) {
297
298
  while (1) switch (_context5.prev = _context5.next) {
298
299
  case 0:
299
300
  maxAge = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : FILE_CACHE_MAX_AGE;
300
- _context5.next = 3;
301
+ headers = {};
302
+ metadata = {
303
+ method: 'GET',
304
+ endpoint: '/file/{fileId}/binary'
305
+ };
306
+ options = _objectSpread(_objectSpread({}, metadata), {}, {
307
+ authContext: {
308
+ collectionName: collectionName
309
+ },
310
+ headers: headers,
311
+ params: {
312
+ 'max-age': "".concat(maxAge)
313
+ }
314
+ });
315
+ return _context5.abrupt("return", this.request("/file/".concat(id, "/binary"), options).then(createMapResponseToBlob(metadata)));
316
+ case 5:
317
+ case "end":
318
+ return _context5.stop();
319
+ }
320
+ }, _callee5, this);
321
+ }));
322
+ function getFileBinary(_x14, _x15) {
323
+ return _getFileBinary.apply(this, arguments);
324
+ }
325
+ return getFileBinary;
326
+ }()
327
+ }, {
328
+ key: "getFileBinaryURL",
329
+ value: function () {
330
+ var _getFileBinaryURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(id, collectionName) {
331
+ var maxAge,
332
+ auth,
333
+ options,
334
+ _args6 = arguments;
335
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
336
+ while (1) switch (_context6.prev = _context6.next) {
337
+ case 0:
338
+ maxAge = _args6.length > 2 && _args6[2] !== undefined ? _args6[2] : FILE_CACHE_MAX_AGE;
339
+ _context6.next = 3;
301
340
  return this.resolveAuth({
302
341
  collectionName: collectionName
303
342
  });
304
343
  case 3:
305
- auth = _context5.sent;
344
+ auth = _context6.sent;
306
345
  options = {
307
346
  params: {
308
347
  dl: true,
@@ -311,14 +350,14 @@ export var MediaStore = /*#__PURE__*/function () {
311
350
  },
312
351
  auth: auth
313
352
  };
314
- return _context5.abrupt("return", createUrl("".concat(auth.baseUrl, "/file/").concat(id, "/binary"), options));
353
+ return _context6.abrupt("return", createUrl("".concat(auth.baseUrl, "/file/").concat(id, "/binary"), options));
315
354
  case 6:
316
355
  case "end":
317
- return _context5.stop();
356
+ return _context6.stop();
318
357
  }
319
- }, _callee5, this);
358
+ }, _callee6, this);
320
359
  }));
321
- function getFileBinaryURL(_x14, _x15) {
360
+ function getFileBinaryURL(_x16, _x17) {
322
361
  return _getFileBinaryURL.apply(this, arguments);
323
362
  }
324
363
  return getFileBinaryURL;
@@ -326,24 +365,24 @@ export var MediaStore = /*#__PURE__*/function () {
326
365
  }, {
327
366
  key: "getArtifactURL",
328
367
  value: function () {
329
- var _getArtifactURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(artifacts, artifactName, collectionName) {
368
+ var _getArtifactURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(artifacts, artifactName, collectionName) {
330
369
  var artifactUrl, auth, options;
331
- return _regeneratorRuntime.wrap(function _callee6$(_context6) {
332
- while (1) switch (_context6.prev = _context6.next) {
370
+ return _regeneratorRuntime.wrap(function _callee7$(_context7) {
371
+ while (1) switch (_context7.prev = _context7.next) {
333
372
  case 0:
334
373
  artifactUrl = getArtifactUrl(artifacts, artifactName);
335
374
  if (artifactUrl) {
336
- _context6.next = 3;
375
+ _context7.next = 3;
337
376
  break;
338
377
  }
339
378
  throw new Error("artifact ".concat(artifactName, " not found"));
340
379
  case 3:
341
- _context6.next = 5;
380
+ _context7.next = 5;
342
381
  return this.resolveAuth({
343
382
  collectionName: collectionName
344
383
  });
345
384
  case 5:
346
- auth = _context6.sent;
385
+ auth = _context7.sent;
347
386
  options = {
348
387
  params: {
349
388
  collection: collectionName,
@@ -351,14 +390,14 @@ export var MediaStore = /*#__PURE__*/function () {
351
390
  },
352
391
  auth: auth
353
392
  };
354
- return _context6.abrupt("return", createUrl("".concat(auth.baseUrl).concat(artifactUrl), options));
393
+ return _context7.abrupt("return", createUrl("".concat(auth.baseUrl).concat(artifactUrl), options));
355
394
  case 8:
356
395
  case "end":
357
- return _context6.stop();
396
+ return _context7.stop();
358
397
  }
359
- }, _callee6, this);
398
+ }, _callee7, this);
360
399
  }));
361
- function getArtifactURL(_x16, _x17, _x18) {
400
+ function getArtifactURL(_x18, _x19, _x20) {
362
401
  return _getArtifactURL.apply(this, arguments);
363
402
  }
364
403
  return getArtifactURL;
@@ -366,10 +405,10 @@ export var MediaStore = /*#__PURE__*/function () {
366
405
  }, {
367
406
  key: "getImage",
368
407
  value: function () {
369
- var _getImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(id, params, controller, fetchMaxRes, traceContext) {
408
+ var _getImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(id, params, controller, fetchMaxRes, traceContext) {
370
409
  var isWebpSupported, headers, metadata, options;
371
- return _regeneratorRuntime.wrap(function _callee7$(_context7) {
372
- while (1) switch (_context7.prev = _context7.next) {
410
+ return _regeneratorRuntime.wrap(function _callee8$(_context8) {
411
+ while (1) switch (_context8.prev = _context8.next) {
373
412
  case 0:
374
413
  // TODO add checkWebpSupport() back https://product-fabric.atlassian.net/browse/MPT-584
375
414
  isWebpSupported = false;
@@ -389,14 +428,14 @@ export var MediaStore = /*#__PURE__*/function () {
389
428
  headers: headers,
390
429
  traceContext: traceContext
391
430
  });
392
- return _context7.abrupt("return", this.request("/file/".concat(id, "/image"), options, controller).then(createMapResponseToBlob(metadata)));
431
+ return _context8.abrupt("return", this.request("/file/".concat(id, "/image"), options, controller).then(createMapResponseToBlob(metadata)));
393
432
  case 6:
394
433
  case "end":
395
- return _context7.stop();
434
+ return _context8.stop();
396
435
  }
397
- }, _callee7, this);
436
+ }, _callee8, this);
398
437
  }));
399
- function getImage(_x19, _x20, _x21, _x22, _x23) {
438
+ function getImage(_x21, _x22, _x23, _x24, _x25) {
400
439
  return _getImage.apply(this, arguments);
401
440
  }
402
441
  return getImage;
@@ -404,10 +443,10 @@ export var MediaStore = /*#__PURE__*/function () {
404
443
  }, {
405
444
  key: "getItems",
406
445
  value: function () {
407
- var _getItems = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(ids, collectionName, traceContext) {
446
+ var _getItems = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(ids, collectionName, traceContext) {
408
447
  var descriptors, metadata, options;
409
- return _regeneratorRuntime.wrap(function _callee8$(_context8) {
410
- while (1) switch (_context8.prev = _context8.next) {
448
+ return _regeneratorRuntime.wrap(function _callee9$(_context9) {
449
+ while (1) switch (_context9.prev = _context9.next) {
411
450
  case 0:
412
451
  descriptors = ids.map(function (id) {
413
452
  return {
@@ -430,14 +469,14 @@ export var MediaStore = /*#__PURE__*/function () {
430
469
  }),
431
470
  traceContext: traceContext
432
471
  });
433
- return _context8.abrupt("return", this.request('/items', options).then(createMapResponseToJson(metadata)));
472
+ return _context9.abrupt("return", this.request('/items', options).then(createMapResponseToJson(metadata)));
434
473
  case 4:
435
474
  case "end":
436
- return _context8.stop();
475
+ return _context9.stop();
437
476
  }
438
- }, _callee8, this);
477
+ }, _callee9, this);
439
478
  }));
440
- function getItems(_x24, _x25, _x26) {
479
+ function getItems(_x26, _x27, _x28) {
441
480
  return _getItems.apply(this, arguments);
442
481
  }
443
482
  return getItems;
@@ -445,10 +484,10 @@ export var MediaStore = /*#__PURE__*/function () {
445
484
  }, {
446
485
  key: "getImageMetadata",
447
486
  value: function () {
448
- var _getImageMetadata = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(id, params, traceContext) {
487
+ var _getImageMetadata = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(id, params, traceContext) {
449
488
  var metadata, options;
450
- return _regeneratorRuntime.wrap(function _callee9$(_context9) {
451
- while (1) switch (_context9.prev = _context9.next) {
489
+ return _regeneratorRuntime.wrap(function _callee10$(_context10) {
490
+ while (1) switch (_context10.prev = _context10.next) {
452
491
  case 0:
453
492
  metadata = {
454
493
  method: 'GET',
@@ -461,14 +500,14 @@ export var MediaStore = /*#__PURE__*/function () {
461
500
  params: params,
462
501
  traceContext: traceContext
463
502
  });
464
- return _context9.abrupt("return", this.request("/file/".concat(id, "/image/metadata"), options).then(createMapResponseToJson(metadata)));
503
+ return _context10.abrupt("return", this.request("/file/".concat(id, "/image/metadata"), options).then(createMapResponseToJson(metadata)));
465
504
  case 3:
466
505
  case "end":
467
- return _context9.stop();
506
+ return _context10.stop();
468
507
  }
469
- }, _callee9, this);
508
+ }, _callee10, this);
470
509
  }));
471
- function getImageMetadata(_x27, _x28, _x29) {
510
+ function getImageMetadata(_x29, _x30, _x31) {
472
511
  return _getImageMetadata.apply(this, arguments);
473
512
  }
474
513
  return getImageMetadata;
@@ -476,10 +515,10 @@ export var MediaStore = /*#__PURE__*/function () {
476
515
  }, {
477
516
  key: "appendChunksToUpload",
478
517
  value: function () {
479
- var _appendChunksToUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(uploadId, body, collectionName, traceContext) {
518
+ var _appendChunksToUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(uploadId, body, collectionName, traceContext) {
480
519
  var metadata, options;
481
- return _regeneratorRuntime.wrap(function _callee10$(_context10) {
482
- while (1) switch (_context10.prev = _context10.next) {
520
+ return _regeneratorRuntime.wrap(function _callee11$(_context11) {
521
+ while (1) switch (_context11.prev = _context11.next) {
483
522
  case 0:
484
523
  metadata = {
485
524
  method: 'PUT',
@@ -493,15 +532,15 @@ export var MediaStore = /*#__PURE__*/function () {
493
532
  body: JSON.stringify(body),
494
533
  traceContext: traceContext
495
534
  });
496
- _context10.next = 4;
535
+ _context11.next = 4;
497
536
  return this.request("/upload/".concat(uploadId, "/chunks"), options);
498
537
  case 4:
499
538
  case "end":
500
- return _context10.stop();
539
+ return _context11.stop();
501
540
  }
502
- }, _callee10, this);
541
+ }, _callee11, this);
503
542
  }));
504
- function appendChunksToUpload(_x30, _x31, _x32, _x33) {
543
+ function appendChunksToUpload(_x32, _x33, _x34, _x35) {
505
544
  return _appendChunksToUpload.apply(this, arguments);
506
545
  }
507
546
  return appendChunksToUpload;
@@ -530,7 +569,7 @@ export var MediaStore = /*#__PURE__*/function () {
530
569
  }, {
531
570
  key: "request",
532
571
  value: function () {
533
- var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(path) {
572
+ var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(path) {
534
573
  var options,
535
574
  controller,
536
575
  method,
@@ -544,25 +583,25 @@ export var MediaStore = /*#__PURE__*/function () {
544
583
  auth,
545
584
  extendedTraceContext,
546
585
  response,
547
- _args11 = arguments;
548
- return _regeneratorRuntime.wrap(function _callee11$(_context11) {
549
- while (1) switch (_context11.prev = _context11.next) {
586
+ _args12 = arguments;
587
+ return _regeneratorRuntime.wrap(function _callee12$(_context12) {
588
+ while (1) switch (_context12.prev = _context12.next) {
550
589
  case 0:
551
- options = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] : {
590
+ options = _args12.length > 1 && _args12[1] !== undefined ? _args12[1] : {
552
591
  method: 'GET',
553
592
  endpoint: undefined,
554
593
  authContext: {}
555
594
  };
556
- controller = _args11.length > 2 ? _args11[2] : undefined;
595
+ controller = _args12.length > 2 ? _args12[2] : undefined;
557
596
  method = options.method, endpoint = options.endpoint, authContext = options.authContext, params = options.params, headers = options.headers, body = options.body, clientOptions = options.clientOptions, traceContext = options.traceContext;
558
- _context11.next = 5;
597
+ _context12.next = 5;
559
598
  return this.resolveAuth(authContext);
560
599
  case 5:
561
- auth = _context11.sent;
600
+ auth = _context12.sent;
562
601
  extendedTraceContext = traceContext ? _objectSpread(_objectSpread({}, traceContext), {}, {
563
602
  spanId: (traceContext === null || traceContext === void 0 ? void 0 : traceContext.spanId) || getRandomHex(8)
564
603
  }) : undefined;
565
- _context11.next = 9;
604
+ _context12.next = 9;
566
605
  return _request("".concat(auth.baseUrl).concat(path), {
567
606
  method: method,
568
607
  endpoint: endpoint,
@@ -574,17 +613,17 @@ export var MediaStore = /*#__PURE__*/function () {
574
613
  traceContext: extendedTraceContext
575
614
  }, controller);
576
615
  case 9:
577
- response = _context11.sent;
616
+ response = _context12.sent;
578
617
  setKeyValueInSessionStorage(MEDIA_API_REGION, response.headers.get('x-media-region'));
579
618
  setKeyValueInSessionStorage(MEDIA_API_ENVIRONMENT, response.headers.get('x-media-env'));
580
- return _context11.abrupt("return", response);
619
+ return _context12.abrupt("return", response);
581
620
  case 13:
582
621
  case "end":
583
- return _context11.stop();
622
+ return _context12.stop();
584
623
  }
585
- }, _callee11, this);
624
+ }, _callee12, this);
586
625
  }));
587
- function request(_x34) {
626
+ function request(_x36) {
588
627
  return _request2.apply(this, arguments);
589
628
  }
590
629
  return request;
@@ -183,20 +183,19 @@ var getMediaApi = function getMediaApi(_ref) {
183
183
  // URL ENDPOINTS
184
184
  // --------------------------------------------------------
185
185
 
186
- // TODO
187
186
  getFileImageURL: function () {
188
- var _getFileImageURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
187
+ var _getFileImageURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(id) {
189
188
  return _regeneratorRuntime.wrap(function _callee9$(_context9) {
190
189
  while (1) switch (_context9.prev = _context9.next) {
191
190
  case 0:
192
- throw new Error('500 - MockedMediaApi.getFileImageURL: method not implemented');
191
+ return _context9.abrupt("return", "image-url-".concat(id));
193
192
  case 1:
194
193
  case "end":
195
194
  return _context9.stop();
196
195
  }
197
196
  }, _callee9);
198
197
  }));
199
- function getFileImageURL() {
198
+ function getFileImageURL(_x9) {
200
199
  return _getFileImageURL.apply(this, arguments);
201
200
  }
202
201
  return getFileImageURL;
@@ -230,7 +229,7 @@ var getMediaApi = function getMediaApi(_ref) {
230
229
  }
231
230
  }, _callee10);
232
231
  }));
233
- function getFileBinaryURL(_x9) {
232
+ function getFileBinaryURL(_x10) {
234
233
  return _getFileBinaryURL.apply(this, arguments);
235
234
  }
236
235
  return getFileBinaryURL;
@@ -256,7 +255,7 @@ var getMediaApi = function getMediaApi(_ref) {
256
255
  }
257
256
  }, _callee11);
258
257
  }));
259
- function getArtifactURL(_x10, _x11) {
258
+ function getArtifactURL(_x11, _x12) {
260
259
  return _getArtifactURL.apply(this, arguments);
261
260
  }
262
261
  return getArtifactURL;
@@ -290,54 +289,79 @@ var getMediaApi = function getMediaApi(_ref) {
290
289
  }
291
290
  }, _callee12);
292
291
  }));
293
- function getImage(_x12) {
292
+ function getImage(_x13) {
294
293
  return _getImage.apply(this, arguments);
295
294
  }
296
295
  return getImage;
297
296
  }(),
297
+ getFileBinary: function () {
298
+ var _getFileBinary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(fileId) {
299
+ var fileItem;
300
+ return _regeneratorRuntime.wrap(function _callee13$(_context13) {
301
+ while (1) switch (_context13.prev = _context13.next) {
302
+ case 0:
303
+ fileItem = getItem(fileId);
304
+ if (fileItem) {
305
+ _context13.next = 3;
306
+ break;
307
+ }
308
+ throw new Error('404 - MockedMediaApi.getFileBinary: file not found');
309
+ case 3:
310
+ return _context13.abrupt("return", new Blob());
311
+ case 4:
312
+ case "end":
313
+ return _context13.stop();
314
+ }
315
+ }, _callee13);
316
+ }));
317
+ function getFileBinary(_x14) {
318
+ return _getFileBinary.apply(this, arguments);
319
+ }
320
+ return getFileBinary;
321
+ }(),
298
322
  // --------------------------------------------------------
299
323
  // OTHER ENDPOINTS
300
324
  // --------------------------------------------------------
301
325
 
302
326
  // TODO
303
327
  copyFileWithToken: function () {
304
- var _copyFileWithToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(body) {
328
+ var _copyFileWithToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(body) {
305
329
  var fileId, fileItem;
306
- return _regeneratorRuntime.wrap(function _callee13$(_context13) {
307
- while (1) switch (_context13.prev = _context13.next) {
330
+ return _regeneratorRuntime.wrap(function _callee14$(_context14) {
331
+ while (1) switch (_context14.prev = _context14.next) {
308
332
  case 0:
309
333
  fileId = body.sourceFile.id;
310
334
  fileItem = getItem(fileId);
311
335
  if (fileItem) {
312
- _context13.next = 4;
336
+ _context14.next = 4;
313
337
  break;
314
338
  }
315
339
  throw new Error('404 - MockedMediaApi.copyFileWithToken: file not found');
316
340
  case 4:
317
- return _context13.abrupt("return", {
341
+ return _context14.abrupt("return", {
318
342
  data: getMediaFile(fileItem)
319
343
  });
320
344
  case 5:
321
345
  case "end":
322
- return _context13.stop();
346
+ return _context14.stop();
323
347
  }
324
- }, _callee13);
348
+ }, _callee14);
325
349
  }));
326
- function copyFileWithToken(_x13) {
350
+ function copyFileWithToken(_x15) {
327
351
  return _copyFileWithToken.apply(this, arguments);
328
352
  }
329
353
  return copyFileWithToken;
330
354
  }(),
331
355
  // TODO
332
356
  removeCollectionFile: function () {
333
- var _removeCollectionFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
334
- return _regeneratorRuntime.wrap(function _callee14$(_context14) {
335
- while (1) switch (_context14.prev = _context14.next) {
357
+ var _removeCollectionFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15() {
358
+ return _regeneratorRuntime.wrap(function _callee15$(_context15) {
359
+ while (1) switch (_context15.prev = _context15.next) {
336
360
  case 0:
337
361
  case "end":
338
- return _context14.stop();
362
+ return _context15.stop();
339
363
  }
340
- }, _callee14);
364
+ }, _callee15);
341
365
  }));
342
366
  function removeCollectionFile() {
343
367
  return _removeCollectionFile.apply(this, arguments);
@@ -348,16 +372,16 @@ var getMediaApi = function getMediaApi(_ref) {
348
372
  // OTHER ENDPOINTS
349
373
  // --------------------------------------------------------
350
374
  request: function () {
351
- var _request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15() {
352
- return _regeneratorRuntime.wrap(function _callee15$(_context15) {
353
- while (1) switch (_context15.prev = _context15.next) {
375
+ var _request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16() {
376
+ return _regeneratorRuntime.wrap(function _callee16$(_context16) {
377
+ while (1) switch (_context16.prev = _context16.next) {
354
378
  case 0:
355
- return _context15.abrupt("return", new Response());
379
+ return _context16.abrupt("return", new Response());
356
380
  case 1:
357
381
  case "end":
358
- return _context15.stop();
382
+ return _context16.stop();
359
383
  }
360
- }, _callee15);
384
+ }, _callee16);
361
385
  }));
362
386
  function request() {
363
387
  return _request.apply(this, arguments);
@@ -365,20 +389,20 @@ var getMediaApi = function getMediaApi(_ref) {
365
389
  return request;
366
390
  }(),
367
391
  resolveAuth: function () {
368
- var _resolveAuth = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16() {
369
- return _regeneratorRuntime.wrap(function _callee16$(_context16) {
370
- while (1) switch (_context16.prev = _context16.next) {
392
+ var _resolveAuth = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17() {
393
+ return _regeneratorRuntime.wrap(function _callee17$(_context17) {
394
+ while (1) switch (_context17.prev = _context17.next) {
371
395
  case 0:
372
- return _context16.abrupt("return", {
396
+ return _context17.abrupt("return", {
373
397
  asapIssuer: '',
374
398
  token: '',
375
399
  baseUrl: ''
376
400
  });
377
401
  case 1:
378
402
  case "end":
379
- return _context16.stop();
403
+ return _context17.stop();
380
404
  }
381
- }, _callee16);
405
+ }, _callee17);
382
406
  }));
383
407
  function resolveAuth() {
384
408
  return _resolveAuth.apply(this, arguments);
@@ -18,6 +18,7 @@ export declare class MediaStore implements MediaApi {
18
18
  getFileImageURL(id: string, params?: MediaStoreGetFileImageParams): Promise<string>;
19
19
  getFileImageURLSync(id: string, params?: MediaStoreGetFileImageParams): string;
20
20
  private createFileImageURL;
21
+ getFileBinary(id: string, collectionName?: string, maxAge?: number): Promise<Blob>;
21
22
  getFileBinaryURL(id: string, collectionName?: string, maxAge?: number): Promise<string>;
22
23
  getArtifactURL(artifacts: MediaFileArtifacts, artifactName: keyof MediaFileArtifacts, collectionName?: string): Promise<string>;
23
24
  getImage(id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean, traceContext?: MediaTraceContext): Promise<Blob>;
@@ -147,6 +147,7 @@ export interface MediaApi {
147
147
  getFile: (fileId: string, params: MediaStoreGetFileParams, traceContext?: MediaTraceContext) => Promise<MediaStoreResponse<MediaFile>>;
148
148
  getFileImageURL: (id: string, params?: MediaStoreGetFileImageParams) => Promise<string>;
149
149
  getFileImageURLSync: (id: string, params?: MediaStoreGetFileImageParams) => string;
150
+ getFileBinary: (id: string, collectionName?: string) => Promise<Blob>;
150
151
  getFileBinaryURL: (id: string, collectionName?: string) => Promise<string>;
151
152
  getArtifactURL: (artifacts: MediaFileArtifacts, artifactName: keyof MediaFileArtifacts, collectionName?: string) => Promise<string>;
152
153
  getImage: (id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean, traceContext?: MediaTraceContext) => Promise<Blob>;
@@ -18,6 +18,7 @@ export declare class MediaStore implements MediaApi {
18
18
  getFileImageURL(id: string, params?: MediaStoreGetFileImageParams): Promise<string>;
19
19
  getFileImageURLSync(id: string, params?: MediaStoreGetFileImageParams): string;
20
20
  private createFileImageURL;
21
+ getFileBinary(id: string, collectionName?: string, maxAge?: number): Promise<Blob>;
21
22
  getFileBinaryURL(id: string, collectionName?: string, maxAge?: number): Promise<string>;
22
23
  getArtifactURL(artifacts: MediaFileArtifacts, artifactName: keyof MediaFileArtifacts, collectionName?: string): Promise<string>;
23
24
  getImage(id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean, traceContext?: MediaTraceContext): Promise<Blob>;
@@ -147,6 +147,7 @@ export interface MediaApi {
147
147
  getFile: (fileId: string, params: MediaStoreGetFileParams, traceContext?: MediaTraceContext) => Promise<MediaStoreResponse<MediaFile>>;
148
148
  getFileImageURL: (id: string, params?: MediaStoreGetFileImageParams) => Promise<string>;
149
149
  getFileImageURLSync: (id: string, params?: MediaStoreGetFileImageParams) => string;
150
+ getFileBinary: (id: string, collectionName?: string) => Promise<Blob>;
150
151
  getFileBinaryURL: (id: string, collectionName?: string) => Promise<string>;
151
152
  getArtifactURL: (artifacts: MediaFileArtifacts, artifactName: keyof MediaFileArtifacts, collectionName?: string) => Promise<string>;
152
153
  getImage: (id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean, traceContext?: MediaTraceContext) => Promise<Blob>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-client",
3
- "version": "26.2.2",
3
+ "version": "26.3.0",
4
4
  "description": "Media API Web Client Library",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -59,7 +59,7 @@
59
59
  "@atlaskit/media-core": "^34.2.0",
60
60
  "@atlaskit/media-state": "^1.0.0",
61
61
  "@atlaskit/ssr": "*",
62
- "@atlaskit/tokens": "^1.42.0",
62
+ "@atlaskit/tokens": "^1.43.0",
63
63
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
64
64
  "@emotion/react": "^11.7.1",
65
65
  "@types/deep-equal": "^1.0.1",