@atlaskit/media-client 20.2.1 → 21.0.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.
Files changed (76) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/cjs/client/file-fetcher/index.js +15 -13
  3. package/dist/cjs/client/media-client.js +27 -7
  4. package/dist/cjs/client/media-store/index.js +86 -112
  5. package/dist/cjs/client/media-store/resolveAuth.js +4 -3
  6. package/dist/cjs/client/stargate-client.js +4 -3
  7. package/dist/cjs/index.js +0 -13
  8. package/dist/cjs/models/media.js +4 -5
  9. package/dist/cjs/uploader/index.js +14 -11
  10. package/dist/cjs/utils/createFileDataLoader.js +8 -6
  11. package/dist/cjs/utils/getDimensionsFromBlob.js +4 -3
  12. package/dist/cjs/utils/getVideoDimensionsFromBlob.js +4 -3
  13. package/dist/cjs/utils/hashing/hasherCreator.js +3 -3
  14. package/dist/cjs/utils/mediaSubscribable/fromObservable.js +2 -2
  15. package/dist/cjs/utils/mobileUpload/helpers.js +4 -3
  16. package/dist/cjs/utils/mobileUpload/stateMachine/index.js +4 -3
  17. package/dist/cjs/utils/polling/index.js +4 -3
  18. package/dist/cjs/utils/request/helpers.js +14 -13
  19. package/dist/cjs/utils/request/index.js +4 -3
  20. package/dist/cjs/utils/shouldFetchRemoteFileStates.js +4 -3
  21. package/dist/cjs/version.json +1 -1
  22. package/dist/es2019/client/media-client.js +3 -2
  23. package/dist/es2019/client/media-store/index.js +0 -9
  24. package/dist/es2019/index.js +1 -2
  25. package/dist/es2019/models/media.js +3 -1
  26. package/dist/es2019/uploader/index.js +3 -0
  27. package/dist/es2019/utils/mediaSubscribable/fromObservable.js +2 -2
  28. package/dist/es2019/utils/mediaSubscribable/toPromise.js +10 -12
  29. package/dist/es2019/version.json +1 -1
  30. package/dist/esm/client/file-fetcher/index.js +14 -13
  31. package/dist/esm/client/media-client.js +28 -7
  32. package/dist/esm/client/media-store/index.js +86 -112
  33. package/dist/esm/client/media-store/resolveAuth.js +4 -3
  34. package/dist/esm/client/stargate-client.js +4 -3
  35. package/dist/esm/index.js +1 -2
  36. package/dist/esm/models/media.js +3 -3
  37. package/dist/esm/uploader/index.js +15 -11
  38. package/dist/esm/utils/createFileDataLoader.js +6 -5
  39. package/dist/esm/utils/getDimensionsFromBlob.js +4 -3
  40. package/dist/esm/utils/getVideoDimensionsFromBlob.js +4 -3
  41. package/dist/esm/utils/hashing/hasherCreator.js +4 -3
  42. package/dist/esm/utils/mediaSubscribable/fromObservable.js +2 -2
  43. package/dist/esm/utils/mobileUpload/helpers.js +4 -3
  44. package/dist/esm/utils/mobileUpload/stateMachine/index.js +4 -3
  45. package/dist/esm/utils/polling/index.js +4 -3
  46. package/dist/esm/utils/request/helpers.js +14 -13
  47. package/dist/esm/utils/request/index.js +4 -3
  48. package/dist/esm/utils/shouldFetchRemoteFileStates.js +4 -3
  49. package/dist/esm/version.json +1 -1
  50. package/dist/types/client/__mocks__/media-client.d.ts +0 -2
  51. package/dist/types/client/file-fetcher/index.d.ts +4 -4
  52. package/dist/types/client/media-client.d.ts +1 -2
  53. package/dist/types/client/media-store/index.d.ts +2 -13
  54. package/dist/types/index.d.ts +3 -5
  55. package/dist/types/models/file-state.d.ts +2 -2
  56. package/dist/types/models/media.d.ts +1 -21
  57. package/dist/types/utils/createFileDataLoader.d.ts +2 -2
  58. package/dist/types/utils/createMediaSubject.d.ts +2 -2
  59. package/dist/types/utils/detectEmptyFile.d.ts +2 -2
  60. package/dist/types/utils/mediaSubscribable/fromObservable.d.ts +3 -3
  61. package/dist/types/utils/mediaSubscribable/toPromise.d.ts +2 -2
  62. package/dist/types/utils/mediaSubscribable/types.d.ts +9 -8
  63. package/package.json +2 -2
  64. package/report.api.md +46 -126
  65. package/dist/cjs/client/collection-fetcher.js +0 -98
  66. package/dist/cjs/models/media-subscribable.js +0 -5
  67. package/dist/cjs/utils/deprecatedEndpointError.js +0 -43
  68. package/dist/es2019/client/collection-fetcher.js +0 -38
  69. package/dist/es2019/models/media-subscribable.js +0 -1
  70. package/dist/es2019/utils/deprecatedEndpointError.js +0 -20
  71. package/dist/esm/client/collection-fetcher.js +0 -89
  72. package/dist/esm/models/media-subscribable.js +0 -1
  73. package/dist/esm/utils/deprecatedEndpointError.js +0 -34
  74. package/dist/types/client/collection-fetcher.d.ts +0 -42
  75. package/dist/types/models/media-subscribable.d.ts +0 -3
  76. package/dist/types/utils/deprecatedEndpointError.d.ts +0 -16
@@ -1,8 +1,9 @@
1
+ import _typeof from "@babel/runtime/helpers/typeof";
1
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
3
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
4
  import _createClass from "@babel/runtime/helpers/createClass";
4
5
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
5
- import _regeneratorRuntime from "@babel/runtime/regenerator";
6
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
6
7
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
7
8
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
8
9
  import { getRandomHex } from '@atlaskit/media-common';
@@ -11,7 +12,6 @@ import { getArtifactUrl } from '../../models/artifacts';
11
12
  import { request as _request } from '../../utils/request';
12
13
  import { createUrl, createMapResponseToJson, createMapResponseToBlob } from '../../utils/request/helpers';
13
14
  import { resolveAuth, resolveInitialAuth } from './resolveAuth';
14
- import { DeprecatedError } from '../../utils/deprecatedEndpointError';
15
15
  export { MediaStoreError, isMediaStoreError } from './error';
16
16
  var MEDIA_API_REGION = 'media-api-region';
17
17
  var MEDIA_API_ENVIRONMENT = 'media-api-environment';
@@ -44,40 +44,14 @@ export var MediaStore = /*#__PURE__*/function () {
44
44
  this.config = config;
45
45
  this.featureFlags = featureFlags;
46
46
  }
47
-
48
- /**
49
- * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-170 Internal documentation for deprecation (no external access)}
50
- * This method is no longer working. Will be removed in the next release
51
- */
52
47
  _createClass(MediaStore, [{
53
- key: "getCollectionItems",
54
- value: function () {
55
- var _getCollectionItems = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(collectionName, params, traceContext) {
56
- return _regeneratorRuntime.wrap(function _callee$(_context) {
57
- while (1) {
58
- switch (_context.prev = _context.next) {
59
- case 0:
60
- throw new DeprecatedError('collection/:name/items');
61
- case 1:
62
- case "end":
63
- return _context.stop();
64
- }
65
- }
66
- }, _callee);
67
- }));
68
- function getCollectionItems(_x, _x2, _x3) {
69
- return _getCollectionItems.apply(this, arguments);
70
- }
71
- return getCollectionItems;
72
- }()
73
- }, {
74
48
  key: "removeCollectionFile",
75
49
  value: function () {
76
- var _removeCollectionFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(id, collectionName, occurrenceKey, traceContext) {
50
+ var _removeCollectionFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(id, collectionName, occurrenceKey, traceContext) {
77
51
  var metadata, body, options;
78
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
52
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
79
53
  while (1) {
80
- switch (_context2.prev = _context2.next) {
54
+ switch (_context.prev = _context.next) {
81
55
  case 0:
82
56
  metadata = {
83
57
  method: 'PUT',
@@ -104,16 +78,16 @@ export var MediaStore = /*#__PURE__*/function () {
104
78
  body: JSON.stringify(body),
105
79
  traceContext: traceContext
106
80
  });
107
- _context2.next = 5;
81
+ _context.next = 5;
108
82
  return this.request("/collection/".concat(collectionName), options);
109
83
  case 5:
110
84
  case "end":
111
- return _context2.stop();
85
+ return _context.stop();
112
86
  }
113
87
  }
114
- }, _callee2, this);
88
+ }, _callee, this);
115
89
  }));
116
- function removeCollectionFile(_x4, _x5, _x6, _x7) {
90
+ function removeCollectionFile(_x, _x2, _x3, _x4) {
117
91
  return _removeCollectionFile.apply(this, arguments);
118
92
  }
119
93
  return removeCollectionFile;
@@ -145,11 +119,11 @@ export var MediaStore = /*#__PURE__*/function () {
145
119
  }, {
146
120
  key: "uploadChunk",
147
121
  value: function () {
148
- var _uploadChunk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(etag, blob, uploadId, partNumber, collectionName, traceContext) {
122
+ var _uploadChunk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(etag, blob, uploadId, partNumber, collectionName, traceContext) {
149
123
  var metadata, options;
150
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
124
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
151
125
  while (1) {
152
- switch (_context3.prev = _context3.next) {
126
+ switch (_context2.prev = _context2.next) {
153
127
  case 0:
154
128
  metadata = {
155
129
  method: 'PUT',
@@ -166,16 +140,16 @@ export var MediaStore = /*#__PURE__*/function () {
166
140
  body: blob,
167
141
  traceContext: traceContext
168
142
  });
169
- _context3.next = 4;
143
+ _context2.next = 4;
170
144
  return this.request("/chunk/".concat(etag), options);
171
145
  case 4:
172
146
  case "end":
173
- return _context3.stop();
147
+ return _context2.stop();
174
148
  }
175
149
  }
176
- }, _callee3, this);
150
+ }, _callee2, this);
177
151
  }));
178
- function uploadChunk(_x8, _x9, _x10, _x11, _x12, _x13) {
152
+ function uploadChunk(_x5, _x6, _x7, _x8, _x9, _x10) {
179
153
  return _uploadChunk.apply(this, arguments);
180
154
  }
181
155
  return uploadChunk;
@@ -262,28 +236,28 @@ export var MediaStore = /*#__PURE__*/function () {
262
236
  }, {
263
237
  key: "getFileImageURL",
264
238
  value: function () {
265
- var _getFileImageURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(id, params) {
239
+ var _getFileImageURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(id, params) {
266
240
  var _ref, collectionName, auth;
267
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
241
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
268
242
  while (1) {
269
- switch (_context4.prev = _context4.next) {
243
+ switch (_context3.prev = _context3.next) {
270
244
  case 0:
271
245
  _ref = params || {}, collectionName = _ref.collection;
272
- _context4.next = 3;
246
+ _context3.next = 3;
273
247
  return this.resolveAuth({
274
248
  collectionName: collectionName
275
249
  });
276
250
  case 3:
277
- auth = _context4.sent;
278
- return _context4.abrupt("return", this.createFileImageURL(id, auth, params));
251
+ auth = _context3.sent;
252
+ return _context3.abrupt("return", this.createFileImageURL(id, auth, params));
279
253
  case 5:
280
254
  case "end":
281
- return _context4.stop();
255
+ return _context3.stop();
282
256
  }
283
257
  }
284
- }, _callee4, this);
258
+ }, _callee3, this);
285
259
  }));
286
- function getFileImageURL(_x14, _x15) {
260
+ function getFileImageURL(_x11, _x12) {
287
261
  return _getFileImageURL.apply(this, arguments);
288
262
  }
289
263
  return getFileImageURL;
@@ -306,18 +280,18 @@ export var MediaStore = /*#__PURE__*/function () {
306
280
  }, {
307
281
  key: "getFileBinaryURL",
308
282
  value: function () {
309
- var _getFileBinaryURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(id, collectionName) {
283
+ var _getFileBinaryURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(id, collectionName) {
310
284
  var auth, options;
311
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
285
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
312
286
  while (1) {
313
- switch (_context5.prev = _context5.next) {
287
+ switch (_context4.prev = _context4.next) {
314
288
  case 0:
315
- _context5.next = 2;
289
+ _context4.next = 2;
316
290
  return this.resolveAuth({
317
291
  collectionName: collectionName
318
292
  });
319
293
  case 2:
320
- auth = _context5.sent;
294
+ auth = _context4.sent;
321
295
  options = {
322
296
  params: {
323
297
  dl: true,
@@ -326,15 +300,15 @@ export var MediaStore = /*#__PURE__*/function () {
326
300
  },
327
301
  auth: auth
328
302
  };
329
- return _context5.abrupt("return", createUrl("".concat(auth.baseUrl, "/file/").concat(id, "/binary"), options));
303
+ return _context4.abrupt("return", createUrl("".concat(auth.baseUrl, "/file/").concat(id, "/binary"), options));
330
304
  case 5:
331
305
  case "end":
332
- return _context5.stop();
306
+ return _context4.stop();
333
307
  }
334
308
  }
335
- }, _callee5, this);
309
+ }, _callee4, this);
336
310
  }));
337
- function getFileBinaryURL(_x16, _x17) {
311
+ function getFileBinaryURL(_x13, _x14) {
338
312
  return _getFileBinaryURL.apply(this, arguments);
339
313
  }
340
314
  return getFileBinaryURL;
@@ -342,25 +316,25 @@ export var MediaStore = /*#__PURE__*/function () {
342
316
  }, {
343
317
  key: "getArtifactURL",
344
318
  value: function () {
345
- var _getArtifactURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(artifacts, artifactName, collectionName) {
319
+ var _getArtifactURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(artifacts, artifactName, collectionName) {
346
320
  var artifactUrl, auth, options;
347
- return _regeneratorRuntime.wrap(function _callee6$(_context6) {
321
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
348
322
  while (1) {
349
- switch (_context6.prev = _context6.next) {
323
+ switch (_context5.prev = _context5.next) {
350
324
  case 0:
351
325
  artifactUrl = getArtifactUrl(artifacts, artifactName);
352
326
  if (artifactUrl) {
353
- _context6.next = 3;
327
+ _context5.next = 3;
354
328
  break;
355
329
  }
356
330
  throw new Error("artifact ".concat(artifactName, " not found"));
357
331
  case 3:
358
- _context6.next = 5;
332
+ _context5.next = 5;
359
333
  return this.resolveAuth({
360
334
  collectionName: collectionName
361
335
  });
362
336
  case 5:
363
- auth = _context6.sent;
337
+ auth = _context5.sent;
364
338
  options = {
365
339
  params: {
366
340
  collection: collectionName,
@@ -368,15 +342,15 @@ export var MediaStore = /*#__PURE__*/function () {
368
342
  },
369
343
  auth: auth
370
344
  };
371
- return _context6.abrupt("return", createUrl("".concat(auth.baseUrl).concat(artifactUrl), options));
345
+ return _context5.abrupt("return", createUrl("".concat(auth.baseUrl).concat(artifactUrl), options));
372
346
  case 8:
373
347
  case "end":
374
- return _context6.stop();
348
+ return _context5.stop();
375
349
  }
376
350
  }
377
- }, _callee6, this);
351
+ }, _callee5, this);
378
352
  }));
379
- function getArtifactURL(_x18, _x19, _x20) {
353
+ function getArtifactURL(_x15, _x16, _x17) {
380
354
  return _getArtifactURL.apply(this, arguments);
381
355
  }
382
356
  return getArtifactURL;
@@ -384,11 +358,11 @@ export var MediaStore = /*#__PURE__*/function () {
384
358
  }, {
385
359
  key: "getImage",
386
360
  value: function () {
387
- var _getImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(id, params, controller, fetchMaxRes, traceContext) {
361
+ var _getImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(id, params, controller, fetchMaxRes, traceContext) {
388
362
  var isWebpSupported, headers, metadata, options;
389
- return _regeneratorRuntime.wrap(function _callee7$(_context7) {
363
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
390
364
  while (1) {
391
- switch (_context7.prev = _context7.next) {
365
+ switch (_context6.prev = _context6.next) {
392
366
  case 0:
393
367
  // TODO add checkWebpSupport() back https://product-fabric.atlassian.net/browse/MPT-584
394
368
  isWebpSupported = false;
@@ -408,15 +382,15 @@ export var MediaStore = /*#__PURE__*/function () {
408
382
  headers: headers,
409
383
  traceContext: traceContext
410
384
  });
411
- return _context7.abrupt("return", this.request("/file/".concat(id, "/image"), options, controller).then(createMapResponseToBlob(metadata)));
385
+ return _context6.abrupt("return", this.request("/file/".concat(id, "/image"), options, controller).then(createMapResponseToBlob(metadata)));
412
386
  case 6:
413
387
  case "end":
414
- return _context7.stop();
388
+ return _context6.stop();
415
389
  }
416
390
  }
417
- }, _callee7, this);
391
+ }, _callee6, this);
418
392
  }));
419
- function getImage(_x21, _x22, _x23, _x24, _x25) {
393
+ function getImage(_x18, _x19, _x20, _x21, _x22) {
420
394
  return _getImage.apply(this, arguments);
421
395
  }
422
396
  return getImage;
@@ -424,11 +398,11 @@ export var MediaStore = /*#__PURE__*/function () {
424
398
  }, {
425
399
  key: "getItems",
426
400
  value: function () {
427
- var _getItems = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(ids, collectionName, traceContext) {
401
+ var _getItems = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(ids, collectionName, traceContext) {
428
402
  var descriptors, metadata, options;
429
- return _regeneratorRuntime.wrap(function _callee8$(_context8) {
403
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
430
404
  while (1) {
431
- switch (_context8.prev = _context8.next) {
405
+ switch (_context7.prev = _context7.next) {
432
406
  case 0:
433
407
  descriptors = ids.map(function (id) {
434
408
  return {
@@ -451,15 +425,15 @@ export var MediaStore = /*#__PURE__*/function () {
451
425
  }),
452
426
  traceContext: traceContext
453
427
  });
454
- return _context8.abrupt("return", this.request('/items', options).then(createMapResponseToJson(metadata)));
428
+ return _context7.abrupt("return", this.request('/items', options).then(createMapResponseToJson(metadata)));
455
429
  case 4:
456
430
  case "end":
457
- return _context8.stop();
431
+ return _context7.stop();
458
432
  }
459
433
  }
460
- }, _callee8, this);
434
+ }, _callee7, this);
461
435
  }));
462
- function getItems(_x26, _x27, _x28) {
436
+ function getItems(_x23, _x24, _x25) {
463
437
  return _getItems.apply(this, arguments);
464
438
  }
465
439
  return getItems;
@@ -467,11 +441,11 @@ export var MediaStore = /*#__PURE__*/function () {
467
441
  }, {
468
442
  key: "getImageMetadata",
469
443
  value: function () {
470
- var _getImageMetadata = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(id, params, traceContext) {
444
+ var _getImageMetadata = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(id, params, traceContext) {
471
445
  var metadata, options;
472
- return _regeneratorRuntime.wrap(function _callee9$(_context9) {
446
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
473
447
  while (1) {
474
- switch (_context9.prev = _context9.next) {
448
+ switch (_context8.prev = _context8.next) {
475
449
  case 0:
476
450
  metadata = {
477
451
  method: 'GET',
@@ -484,15 +458,15 @@ export var MediaStore = /*#__PURE__*/function () {
484
458
  params: params,
485
459
  traceContext: traceContext
486
460
  });
487
- return _context9.abrupt("return", this.request("/file/".concat(id, "/image/metadata"), options).then(createMapResponseToJson(metadata)));
461
+ return _context8.abrupt("return", this.request("/file/".concat(id, "/image/metadata"), options).then(createMapResponseToJson(metadata)));
488
462
  case 3:
489
463
  case "end":
490
- return _context9.stop();
464
+ return _context8.stop();
491
465
  }
492
466
  }
493
- }, _callee9, this);
467
+ }, _callee8, this);
494
468
  }));
495
- function getImageMetadata(_x29, _x30, _x31) {
469
+ function getImageMetadata(_x26, _x27, _x28) {
496
470
  return _getImageMetadata.apply(this, arguments);
497
471
  }
498
472
  return getImageMetadata;
@@ -500,11 +474,11 @@ export var MediaStore = /*#__PURE__*/function () {
500
474
  }, {
501
475
  key: "appendChunksToUpload",
502
476
  value: function () {
503
- var _appendChunksToUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(uploadId, body, collectionName, traceContext) {
477
+ var _appendChunksToUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(uploadId, body, collectionName, traceContext) {
504
478
  var metadata, options;
505
- return _regeneratorRuntime.wrap(function _callee10$(_context10) {
479
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
506
480
  while (1) {
507
- switch (_context10.prev = _context10.next) {
481
+ switch (_context9.prev = _context9.next) {
508
482
  case 0:
509
483
  metadata = {
510
484
  method: 'PUT',
@@ -518,16 +492,16 @@ export var MediaStore = /*#__PURE__*/function () {
518
492
  body: JSON.stringify(body),
519
493
  traceContext: traceContext
520
494
  });
521
- _context10.next = 4;
495
+ _context9.next = 4;
522
496
  return this.request("/upload/".concat(uploadId, "/chunks"), options);
523
497
  case 4:
524
498
  case "end":
525
- return _context10.stop();
499
+ return _context9.stop();
526
500
  }
527
501
  }
528
- }, _callee10, this);
502
+ }, _callee9, this);
529
503
  }));
530
- function appendChunksToUpload(_x32, _x33, _x34, _x35) {
504
+ function appendChunksToUpload(_x29, _x30, _x31, _x32) {
531
505
  return _appendChunksToUpload.apply(this, arguments);
532
506
  }
533
507
  return appendChunksToUpload;
@@ -556,7 +530,7 @@ export var MediaStore = /*#__PURE__*/function () {
556
530
  }, {
557
531
  key: "request",
558
532
  value: function () {
559
- var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(path) {
533
+ var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(path) {
560
534
  var options,
561
535
  controller,
562
536
  method,
@@ -570,26 +544,26 @@ export var MediaStore = /*#__PURE__*/function () {
570
544
  auth,
571
545
  extendedTraceContext,
572
546
  response,
573
- _args11 = arguments;
574
- return _regeneratorRuntime.wrap(function _callee11$(_context11) {
547
+ _args10 = arguments;
548
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
575
549
  while (1) {
576
- switch (_context11.prev = _context11.next) {
550
+ switch (_context10.prev = _context10.next) {
577
551
  case 0:
578
- options = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] : {
552
+ options = _args10.length > 1 && _args10[1] !== undefined ? _args10[1] : {
579
553
  method: 'GET',
580
554
  endpoint: undefined,
581
555
  authContext: {}
582
556
  };
583
- controller = _args11.length > 2 ? _args11[2] : undefined;
557
+ controller = _args10.length > 2 ? _args10[2] : undefined;
584
558
  method = options.method, endpoint = options.endpoint, authContext = options.authContext, params = options.params, headers = options.headers, body = options.body, clientOptions = options.clientOptions, traceContext = options.traceContext;
585
- _context11.next = 5;
559
+ _context10.next = 5;
586
560
  return this.resolveAuth(authContext);
587
561
  case 5:
588
- auth = _context11.sent;
562
+ auth = _context10.sent;
589
563
  extendedTraceContext = traceContext ? _objectSpread(_objectSpread({}, traceContext), {}, {
590
564
  spanId: (traceContext === null || traceContext === void 0 ? void 0 : traceContext.spanId) || getRandomHex(8)
591
565
  }) : undefined;
592
- _context11.next = 9;
566
+ _context10.next = 9;
593
567
  return _request("".concat(auth.baseUrl).concat(path), {
594
568
  method: method,
595
569
  endpoint: endpoint,
@@ -601,18 +575,18 @@ export var MediaStore = /*#__PURE__*/function () {
601
575
  traceContext: extendedTraceContext
602
576
  }, controller);
603
577
  case 9:
604
- response = _context11.sent;
578
+ response = _context10.sent;
605
579
  setKeyValueInSessionStorage(MEDIA_API_REGION, response.headers.get('x-media-region'));
606
580
  setKeyValueInSessionStorage(MEDIA_API_ENVIRONMENT, response.headers.get('x-media-env'));
607
- return _context11.abrupt("return", response);
581
+ return _context10.abrupt("return", response);
608
582
  case 13:
609
583
  case "end":
610
- return _context11.stop();
584
+ return _context10.stop();
611
585
  }
612
586
  }
613
- }, _callee11, this);
587
+ }, _callee10, this);
614
588
  }));
615
- function request(_x36) {
589
+ function request(_x33) {
616
590
  return _request2.apply(this, arguments);
617
591
  }
618
592
  return request;
@@ -1,14 +1,15 @@
1
+ import _typeof from "@babel/runtime/helpers/typeof";
1
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
- import _regeneratorRuntime from "@babel/runtime/regenerator";
3
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
3
4
  import { MediaStoreError } from './error';
4
5
  import { rejectTimeout } from '../../utils/setTimeoutPromise';
5
6
  export var DEFAULT_AUTH_PROVIDER_TIMEOUT = 10000;
6
7
  export var resolveAuth = /*#__PURE__*/function () {
7
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(authProvider, authContext) {
8
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(authProvider, authContext) {
8
9
  var authProviderTimeout,
9
10
  auth,
10
11
  _args = arguments;
11
- return _regeneratorRuntime.wrap(function _callee$(_context) {
12
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
12
13
  while (1) {
13
14
  switch (_context.prev = _context.next) {
14
15
  case 0:
@@ -1,7 +1,8 @@
1
+ import _typeof from "@babel/runtime/helpers/typeof";
1
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
3
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
4
  import _createClass from "@babel/runtime/helpers/createClass";
4
- import _regeneratorRuntime from "@babel/runtime/regenerator";
5
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
5
6
  export var StargateClient = /*#__PURE__*/function () {
6
7
  function StargateClient(baseUrl) {
7
8
  _classCallCheck(this, StargateClient);
@@ -10,8 +11,8 @@ export var StargateClient = /*#__PURE__*/function () {
10
11
  _createClass(StargateClient, [{
11
12
  key: "fetchToken",
12
13
  value: function () {
13
- var _fetchToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(clientId) {
14
- return _regeneratorRuntime.wrap(function _callee$(_context) {
14
+ var _fetchToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(clientId) {
15
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
15
16
  while (1) {
16
17
  switch (_context.prev = _context.next) {
17
18
  case 0:
package/dist/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export { MediaStore, MediaStoreError, isMediaStoreError, getMediaEnvironment, getMediaRegion } from './client/media-store';
2
2
  export { UploadController } from './upload-controller';
3
- export { isPreviewableType, isMediaCollectionItemFullDetails } from './models/media';
3
+ export { isPreviewableType } from './models/media';
4
4
  export { getArtifactUrl } from './models/artifacts';
5
5
  export { isMediaClientError, getMediaClientErrorReason } from './models/errors';
6
6
  export { isUploadingFileState, isProcessingFileState, isProcessedFileState, isErrorFileState, isPreviewableFileState, isFinalFileState, isImageRepresentationReady, mapMediaFileToFileState, mapMediaItemToFileState } from './models/file-state';
@@ -11,7 +11,6 @@ export { PollingFunction } from './utils/polling';
11
11
  export { isPollingError, PollingError } from './utils/polling/errors';
12
12
  export { imageResizeModeToFileImageMode } from './utils/imageResizeModeToFileImageMode';
13
13
  export { FileFetcherImpl, FileFetcherError, isFileFetcherError } from './client/file-fetcher';
14
- export { CollectionFetcher } from './client/collection-fetcher';
15
14
  export { MediaClient } from './client/media-client';
16
15
  export { StargateClient } from './client/stargate-client';
17
16
  export { isImageRemote } from './utils/isImageRemote';
@@ -1,4 +1,7 @@
1
1
  import { getMediaFeatureFlag } from '@atlaskit/media-common';
2
+
3
+ // Warning! You can't add new media file processing status!
4
+ // See packages/media/media-core/src/__tests__/cache-backward-compatibility.spec.ts
2
5
  export var isPreviewableType = function isPreviewableType(type, featureFlags) {
3
6
  // in classic experience, only audio/video/image are previewable
4
7
  var defaultPreviewableTypes = ['audio', 'video', 'image'];
@@ -9,9 +12,6 @@ export var isPreviewableType = function isPreviewableType(type, featureFlags) {
9
12
  }
10
13
  return defaultPreviewableTypes.indexOf(type) > -1;
11
14
  };
12
- export var isMediaCollectionItemFullDetails = function isMediaCollectionItemFullDetails(mediaCollectionItem) {
13
- return !!mediaCollectionItem['mediaType'] && !!mediaCollectionItem['mimeType'] && !!mediaCollectionItem['processingStatus'];
14
- };
15
15
  export var DATA_UNIT;
16
16
  (function (DATA_UNIT) {
17
17
  DATA_UNIT[DATA_UNIT["MB"] = 1048576] = "MB";