@atlaskit/media-client 21.0.0 → 21.1.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 (62) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/client/file-fetcher/error.js +4 -4
  3. package/dist/cjs/client/file-fetcher/index.js +283 -297
  4. package/dist/cjs/client/media-client.js +42 -48
  5. package/dist/cjs/client/media-store/index.js +389 -310
  6. package/dist/cjs/client/media-store/resolveAuth.js +33 -36
  7. package/dist/cjs/client/stargate-client.js +17 -20
  8. package/dist/cjs/index.js +6 -0
  9. package/dist/cjs/models/media.js +4 -4
  10. package/dist/cjs/uploader/error.js +4 -4
  11. package/dist/cjs/uploader/index.js +97 -108
  12. package/dist/cjs/utils/convertBase64ToBlob.js +2 -2
  13. package/dist/cjs/utils/createFileDataLoader.js +68 -73
  14. package/dist/cjs/utils/getDimensionsFromBlob.js +26 -29
  15. package/dist/cjs/utils/getVideoDimensionsFromBlob.js +27 -30
  16. package/dist/cjs/utils/hashing/hasherCreator.js +35 -37
  17. package/dist/cjs/utils/mobileUpload/error.js +4 -4
  18. package/dist/cjs/utils/mobileUpload/helpers.js +44 -47
  19. package/dist/cjs/utils/mobileUpload/stateMachine/index.js +17 -20
  20. package/dist/cjs/utils/parseJwt.js +52 -0
  21. package/dist/cjs/utils/polling/index.js +43 -46
  22. package/dist/cjs/utils/request/errors.js +9 -9
  23. package/dist/cjs/utils/request/helpers.js +154 -167
  24. package/dist/cjs/utils/request/index.js +27 -30
  25. package/dist/cjs/utils/shouldFetchRemoteFileStates.js +42 -45
  26. package/dist/cjs/version.json +1 -1
  27. package/dist/es2019/client/file-fetcher/index.js +1 -3
  28. package/dist/es2019/client/media-store/index.js +58 -6
  29. package/dist/es2019/index.js +1 -1
  30. package/dist/es2019/models/media.js +3 -3
  31. package/dist/es2019/utils/parseJwt.js +46 -0
  32. package/dist/es2019/version.json +1 -1
  33. package/dist/esm/client/file-fetcher/error.js +4 -4
  34. package/dist/esm/client/file-fetcher/index.js +282 -296
  35. package/dist/esm/client/media-client.js +40 -47
  36. package/dist/esm/client/media-store/index.js +389 -310
  37. package/dist/esm/client/media-store/resolveAuth.js +33 -36
  38. package/dist/esm/client/stargate-client.js +17 -20
  39. package/dist/esm/index.js +1 -1
  40. package/dist/esm/models/media.js +3 -3
  41. package/dist/esm/uploader/error.js +4 -4
  42. package/dist/esm/uploader/index.js +97 -108
  43. package/dist/esm/utils/convertBase64ToBlob.js +2 -2
  44. package/dist/esm/utils/createFileDataLoader.js +68 -73
  45. package/dist/esm/utils/getDimensionsFromBlob.js +26 -29
  46. package/dist/esm/utils/getVideoDimensionsFromBlob.js +27 -30
  47. package/dist/esm/utils/hashing/hasherCreator.js +31 -34
  48. package/dist/esm/utils/mobileUpload/error.js +4 -4
  49. package/dist/esm/utils/mobileUpload/helpers.js +44 -47
  50. package/dist/esm/utils/mobileUpload/stateMachine/index.js +17 -20
  51. package/dist/esm/utils/parseJwt.js +46 -0
  52. package/dist/esm/utils/polling/index.js +43 -46
  53. package/dist/esm/utils/request/errors.js +9 -9
  54. package/dist/esm/utils/request/helpers.js +154 -167
  55. package/dist/esm/utils/request/index.js +27 -30
  56. package/dist/esm/utils/shouldFetchRemoteFileStates.js +42 -45
  57. package/dist/esm/version.json +1 -1
  58. package/dist/types/client/media-store/index.d.ts +15 -0
  59. package/dist/types/index.d.ts +1 -1
  60. package/dist/types/utils/parseJwt.d.ts +1 -0
  61. package/package.json +2 -2
  62. package/report.api.md +31 -0
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
@@ -25,6 +24,7 @@ exports.mapResponseToBlob = mapResponseToBlob;
25
24
  exports.mapResponseToJson = mapResponseToJson;
26
25
  exports.mapResponseToVoid = mapResponseToVoid;
27
26
  exports.waitPromise = waitPromise;
27
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
28
28
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
29
29
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
30
30
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
@@ -32,7 +32,6 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
32
32
  var _mediaCore = require("@atlaskit/media-core");
33
33
  var _authQueryParameters = require("../../models/auth-query-parameters");
34
34
  var _errors = require("./errors");
35
- 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; }
36
35
  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; }
37
36
  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) { (0, _defineProperty2.default)(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; }
38
37
  function clientTimeoutPromise(timeout) {
@@ -120,28 +119,26 @@ function mapResponseToJson(_x) {
120
119
  * TODO: https://product-fabric.atlassian.net/browse/BMPT-1354
121
120
  */
122
121
  function _mapResponseToJson() {
123
- _mapResponseToJson = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(response) {
124
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
125
- while (1) {
126
- switch (_context3.prev = _context3.next) {
127
- case 0:
128
- // eslint-disable-next-line no-console
129
- console.warn('Helper is deprecated and will be remove in the next major version');
130
- _context3.prev = 1;
131
- _context3.next = 4;
132
- return response.json();
133
- case 4:
134
- return _context3.abrupt("return", _context3.sent);
135
- case 7:
136
- _context3.prev = 7;
137
- _context3.t0 = _context3["catch"](1);
138
- throw new _errors.RequestError('serverInvalidBody', {
139
- statusCode: response.status
140
- }, _context3.t0 instanceof Error ? _context3.t0 : undefined);
141
- case 10:
142
- case "end":
143
- return _context3.stop();
144
- }
122
+ _mapResponseToJson = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(response) {
123
+ return _regenerator.default.wrap(function _callee3$(_context3) {
124
+ while (1) switch (_context3.prev = _context3.next) {
125
+ case 0:
126
+ // eslint-disable-next-line no-console
127
+ console.warn('Helper is deprecated and will be remove in the next major version');
128
+ _context3.prev = 1;
129
+ _context3.next = 4;
130
+ return response.json();
131
+ case 4:
132
+ return _context3.abrupt("return", _context3.sent);
133
+ case 7:
134
+ _context3.prev = 7;
135
+ _context3.t0 = _context3["catch"](1);
136
+ throw new _errors.RequestError('serverInvalidBody', {
137
+ statusCode: response.status
138
+ }, _context3.t0 instanceof Error ? _context3.t0 : undefined);
139
+ case 10:
140
+ case "end":
141
+ return _context3.stop();
145
142
  }
146
143
  }, _callee3, null, [[1, 7]]);
147
144
  }));
@@ -155,28 +152,26 @@ function mapResponseToBlob(_x2) {
155
152
  * TODO: https://product-fabric.atlassian.net/browse/BMPT-1354
156
153
  */
157
154
  function _mapResponseToBlob() {
158
- _mapResponseToBlob = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(response) {
159
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
160
- while (1) {
161
- switch (_context4.prev = _context4.next) {
162
- case 0:
163
- // eslint-disable-next-line no-console
164
- console.warn('Helper is deprecated and will be remove in the next major version');
165
- _context4.prev = 1;
166
- _context4.next = 4;
167
- return response.blob();
168
- case 4:
169
- return _context4.abrupt("return", _context4.sent);
170
- case 7:
171
- _context4.prev = 7;
172
- _context4.t0 = _context4["catch"](1);
173
- throw new _errors.RequestError('serverInvalidBody', {
174
- statusCode: response.status
175
- }, _context4.t0 instanceof Error ? _context4.t0 : undefined);
176
- case 10:
177
- case "end":
178
- return _context4.stop();
179
- }
155
+ _mapResponseToBlob = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(response) {
156
+ return _regenerator.default.wrap(function _callee4$(_context4) {
157
+ while (1) switch (_context4.prev = _context4.next) {
158
+ case 0:
159
+ // eslint-disable-next-line no-console
160
+ console.warn('Helper is deprecated and will be remove in the next major version');
161
+ _context4.prev = 1;
162
+ _context4.next = 4;
163
+ return response.blob();
164
+ case 4:
165
+ return _context4.abrupt("return", _context4.sent);
166
+ case 7:
167
+ _context4.prev = 7;
168
+ _context4.t0 = _context4["catch"](1);
169
+ throw new _errors.RequestError('serverInvalidBody', {
170
+ statusCode: response.status
171
+ }, _context4.t0 instanceof Error ? _context4.t0 : undefined);
172
+ case 10:
173
+ case "end":
174
+ return _context4.stop();
180
175
  }
181
176
  }, _callee4, null, [[1, 7]]);
182
177
  }));
@@ -189,26 +184,24 @@ function mapResponseToVoid() {
189
184
  }
190
185
  function createMapResponseToJson(metadata) {
191
186
  return /*#__PURE__*/function () {
192
- var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(response) {
193
- return _regeneratorRuntime().wrap(function _callee$(_context) {
194
- while (1) {
195
- switch (_context.prev = _context.next) {
196
- case 0:
197
- _context.prev = 0;
198
- _context.next = 3;
199
- return response.json();
200
- case 3:
201
- return _context.abrupt("return", _context.sent);
202
- case 6:
203
- _context.prev = 6;
204
- _context.t0 = _context["catch"](0);
205
- throw new _errors.RequestError('serverInvalidBody', _objectSpread(_objectSpread(_objectSpread({}, metadata), extractMediaHeaders(response)), {}, {
206
- statusCode: response.status
207
- }), _context.t0 instanceof Error ? _context.t0 : undefined);
208
- case 9:
209
- case "end":
210
- return _context.stop();
211
- }
187
+ var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(response) {
188
+ return _regenerator.default.wrap(function _callee$(_context) {
189
+ while (1) switch (_context.prev = _context.next) {
190
+ case 0:
191
+ _context.prev = 0;
192
+ _context.next = 3;
193
+ return response.json();
194
+ case 3:
195
+ return _context.abrupt("return", _context.sent);
196
+ case 6:
197
+ _context.prev = 6;
198
+ _context.t0 = _context["catch"](0);
199
+ throw new _errors.RequestError('serverInvalidBody', _objectSpread(_objectSpread(_objectSpread({}, metadata), extractMediaHeaders(response)), {}, {
200
+ statusCode: response.status
201
+ }), _context.t0 instanceof Error ? _context.t0 : undefined);
202
+ case 9:
203
+ case "end":
204
+ return _context.stop();
212
205
  }
213
206
  }, _callee, null, [[0, 6]]);
214
207
  }));
@@ -219,26 +212,24 @@ function createMapResponseToJson(metadata) {
219
212
  }
220
213
  function createMapResponseToBlob(metadata) {
221
214
  return /*#__PURE__*/function () {
222
- var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(response) {
223
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
224
- while (1) {
225
- switch (_context2.prev = _context2.next) {
226
- case 0:
227
- _context2.prev = 0;
228
- _context2.next = 3;
229
- return response.blob();
230
- case 3:
231
- return _context2.abrupt("return", _context2.sent);
232
- case 6:
233
- _context2.prev = 6;
234
- _context2.t0 = _context2["catch"](0);
235
- throw new _errors.RequestError('serverInvalidBody', _objectSpread(_objectSpread(_objectSpread({}, metadata), extractMediaHeaders(response)), {}, {
236
- statusCode: response.status
237
- }), _context2.t0 instanceof Error ? _context2.t0 : undefined);
238
- case 9:
239
- case "end":
240
- return _context2.stop();
241
- }
215
+ var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(response) {
216
+ return _regenerator.default.wrap(function _callee2$(_context2) {
217
+ while (1) switch (_context2.prev = _context2.next) {
218
+ case 0:
219
+ _context2.prev = 0;
220
+ _context2.next = 3;
221
+ return response.blob();
222
+ case 3:
223
+ return _context2.abrupt("return", _context2.sent);
224
+ case 6:
225
+ _context2.prev = 6;
226
+ _context2.t0 = _context2["catch"](0);
227
+ throw new _errors.RequestError('serverInvalidBody', _objectSpread(_objectSpread(_objectSpread({}, metadata), extractMediaHeaders(response)), {}, {
228
+ statusCode: response.status
229
+ }), _context2.t0 instanceof Error ? _context2.t0 : undefined);
230
+ case 9:
231
+ case "end":
232
+ return _context2.stop();
242
233
  }
243
234
  }, _callee2, null, [[0, 6]]);
244
235
  }));
@@ -265,7 +256,7 @@ function fetchRetry(_x5, _x6) {
265
256
  return _fetchRetry.apply(this, arguments);
266
257
  }
267
258
  function _fetchRetry() {
268
- _fetchRetry = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(functionToRetry, metadata) {
259
+ _fetchRetry = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(functionToRetry, metadata) {
269
260
  var overwriteOptions,
270
261
  options,
271
262
  startTimeoutInMs,
@@ -276,88 +267,84 @@ function _fetchRetry() {
276
267
  lastError,
277
268
  waitAndBumpTimeout,
278
269
  _args6 = arguments;
279
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
280
- while (1) {
281
- switch (_context6.prev = _context6.next) {
282
- case 0:
283
- overwriteOptions = _args6.length > 2 && _args6[2] !== undefined ? _args6[2] : {};
284
- options = _objectSpread(_objectSpread({}, DEFAULT_RETRY_OPTIONS), overwriteOptions);
285
- startTimeoutInMs = options.startTimeoutInMs, maxAttempts = options.maxAttempts, factor = options.factor;
286
- attempts = 0;
287
- timeoutInMs = startTimeoutInMs;
288
- waitAndBumpTimeout = /*#__PURE__*/function () {
289
- var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
290
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
291
- while (1) {
292
- switch (_context5.prev = _context5.next) {
293
- case 0:
294
- _context5.next = 2;
295
- return waitPromise(timeoutInMs);
296
- case 2:
297
- timeoutInMs *= factor;
298
- attempts += 1;
299
- case 4:
300
- case "end":
301
- return _context5.stop();
302
- }
303
- }
304
- }, _callee5);
305
- }));
306
- return function waitAndBumpTimeout() {
307
- return _ref7.apply(this, arguments);
308
- };
309
- }();
310
- case 6:
311
- if (!(attempts < maxAttempts)) {
312
- _context6.next = 24;
313
- break;
314
- }
315
- _context6.prev = 7;
316
- _context6.next = 10;
317
- return functionToRetry();
318
- case 10:
319
- return _context6.abrupt("return", _context6.sent);
320
- case 13:
321
- _context6.prev = 13;
322
- _context6.t0 = _context6["catch"](7);
323
- lastError = _context6.t0;
270
+ return _regenerator.default.wrap(function _callee6$(_context6) {
271
+ while (1) switch (_context6.prev = _context6.next) {
272
+ case 0:
273
+ overwriteOptions = _args6.length > 2 && _args6[2] !== undefined ? _args6[2] : {};
274
+ options = _objectSpread(_objectSpread({}, DEFAULT_RETRY_OPTIONS), overwriteOptions);
275
+ startTimeoutInMs = options.startTimeoutInMs, maxAttempts = options.maxAttempts, factor = options.factor;
276
+ attempts = 0;
277
+ timeoutInMs = startTimeoutInMs;
278
+ waitAndBumpTimeout = /*#__PURE__*/function () {
279
+ var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
280
+ return _regenerator.default.wrap(function _callee5$(_context5) {
281
+ while (1) switch (_context5.prev = _context5.next) {
282
+ case 0:
283
+ _context5.next = 2;
284
+ return waitPromise(timeoutInMs);
285
+ case 2:
286
+ timeoutInMs *= factor;
287
+ attempts += 1;
288
+ case 4:
289
+ case "end":
290
+ return _context5.stop();
291
+ }
292
+ }, _callee5);
293
+ }));
294
+ return function waitAndBumpTimeout() {
295
+ return _ref7.apply(this, arguments);
296
+ };
297
+ }();
298
+ case 6:
299
+ if (!(attempts < maxAttempts)) {
300
+ _context6.next = 24;
301
+ break;
302
+ }
303
+ _context6.prev = 7;
304
+ _context6.next = 10;
305
+ return functionToRetry();
306
+ case 10:
307
+ return _context6.abrupt("return", _context6.sent);
308
+ case 13:
309
+ _context6.prev = 13;
310
+ _context6.t0 = _context6["catch"](7);
311
+ lastError = _context6.t0;
324
312
 
325
- // don't retry if request was aborted by user
326
- if (!isAbortedRequestError(_context6.t0)) {
327
- _context6.next = 18;
328
- break;
329
- }
330
- throw new _errors.RequestError('clientAbortedRequest', metadata, _context6.t0);
331
- case 18:
332
- if (!(!isFetchNetworkError(_context6.t0) && !(0, _errors.isRequestError)(_context6.t0) || (0, _errors.isRequestError)(_context6.t0) && (!_context6.t0.metadata || !_context6.t0.metadata.statusCode || _context6.t0.metadata.statusCode < 500))) {
333
- _context6.next = 20;
334
- break;
335
- }
336
- throw _context6.t0;
337
- case 20:
338
- _context6.next = 22;
339
- return waitAndBumpTimeout();
340
- case 22:
341
- _context6.next = 6;
313
+ // don't retry if request was aborted by user
314
+ if (!isAbortedRequestError(_context6.t0)) {
315
+ _context6.next = 18;
342
316
  break;
343
- case 24:
344
- if (!(0, _errors.isRequestError)(lastError)) {
345
- _context6.next = 26;
346
- break;
347
- }
348
- throw cloneRequestError(lastError, {
349
- attempts: attempts,
350
- clientExhaustedRetries: true
351
- });
352
- case 26:
353
- throw new _errors.RequestError('serverUnexpectedError', _objectSpread(_objectSpread({}, metadata), {}, {
354
- attempts: attempts,
355
- clientExhaustedRetries: true
356
- }), lastError);
357
- case 27:
358
- case "end":
359
- return _context6.stop();
360
- }
317
+ }
318
+ throw new _errors.RequestError('clientAbortedRequest', metadata, _context6.t0);
319
+ case 18:
320
+ if (!(!isFetchNetworkError(_context6.t0) && !(0, _errors.isRequestError)(_context6.t0) || (0, _errors.isRequestError)(_context6.t0) && (!_context6.t0.metadata || !_context6.t0.metadata.statusCode || _context6.t0.metadata.statusCode < 500))) {
321
+ _context6.next = 20;
322
+ break;
323
+ }
324
+ throw _context6.t0;
325
+ case 20:
326
+ _context6.next = 22;
327
+ return waitAndBumpTimeout();
328
+ case 22:
329
+ _context6.next = 6;
330
+ break;
331
+ case 24:
332
+ if (!(0, _errors.isRequestError)(lastError)) {
333
+ _context6.next = 26;
334
+ break;
335
+ }
336
+ throw cloneRequestError(lastError, {
337
+ attempts: attempts,
338
+ clientExhaustedRetries: true
339
+ });
340
+ case 26:
341
+ throw new _errors.RequestError('serverUnexpectedError', _objectSpread(_objectSpread({}, metadata), {}, {
342
+ attempts: attempts,
343
+ clientExhaustedRetries: true
344
+ }), lastError);
345
+ case 27:
346
+ case "end":
347
+ return _context6.stop();
361
348
  }
362
349
  }, _callee6, null, [[7, 13]]);
363
350
  }));
@@ -23,16 +23,15 @@ Object.defineProperty(exports, "isRequestError", {
23
23
  }
24
24
  });
25
25
  exports.request = request;
26
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
26
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
27
27
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
28
28
  var _errors = require("./errors");
29
29
  var _helpers = require("./helpers");
30
- 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" == (0, _typeof2.default)(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; }
31
30
  function request(_x) {
32
31
  return _request.apply(this, arguments);
33
32
  }
34
33
  function _request() {
35
- _request = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(url) {
34
+ _request = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(url) {
36
35
  var options,
37
36
  controller,
38
37
  _options$method,
@@ -49,34 +48,32 @@ function _request() {
49
48
  metadata,
50
49
  doFetch,
51
50
  _args = arguments;
52
- return _regeneratorRuntime().wrap(function _callee$(_context) {
53
- while (1) {
54
- switch (_context.prev = _context.next) {
55
- case 0:
56
- options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
57
- controller = _args.length > 2 ? _args[2] : undefined;
58
- _options$method = options.method, method = _options$method === void 0 ? 'GET' : _options$method, endpoint = options.endpoint, auth = options.auth, params = options.params, headers = options.headers, body = options.body, _options$clientOption = options.clientOptions, clientOptions = _options$clientOption === void 0 ? {} : _options$clientOption, traceContext = options.traceContext;
59
- retryOptions = clientOptions.retryOptions;
60
- metadata = {
51
+ return _regenerator.default.wrap(function _callee$(_context) {
52
+ while (1) switch (_context.prev = _context.next) {
53
+ case 0:
54
+ options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
55
+ controller = _args.length > 2 ? _args[2] : undefined;
56
+ _options$method = options.method, method = _options$method === void 0 ? 'GET' : _options$method, endpoint = options.endpoint, auth = options.auth, params = options.params, headers = options.headers, body = options.body, _options$clientOption = options.clientOptions, clientOptions = _options$clientOption === void 0 ? {} : _options$clientOption, traceContext = options.traceContext;
57
+ retryOptions = clientOptions.retryOptions;
58
+ metadata = {
59
+ method: method,
60
+ endpoint: endpoint,
61
+ traceContext: traceContext
62
+ }; // TODO BMPT-918: add client timeout feature behing a FF (using clientOptions.clientTimeout + Promise.race)
63
+ doFetch = function doFetch() {
64
+ return fetch((0, _helpers.createUrl)(url, {
65
+ params: params
66
+ }), {
61
67
  method: method,
62
- endpoint: endpoint,
63
- traceContext: traceContext
64
- }; // TODO BMPT-918: add client timeout feature behing a FF (using clientOptions.clientTimeout + Promise.race)
65
- doFetch = function doFetch() {
66
- return fetch((0, _helpers.createUrl)(url, {
67
- params: params
68
- }), {
69
- method: method,
70
- body: body,
71
- headers: (0, _helpers.extendHeaders)(headers, auth, traceContext),
72
- signal: controller && controller.signal
73
- }).then((0, _helpers.createProcessFetchResponse)(metadata));
74
- };
75
- return _context.abrupt("return", (0, _helpers.fetchRetry)(doFetch, metadata, retryOptions));
76
- case 7:
77
- case "end":
78
- return _context.stop();
79
- }
68
+ body: body,
69
+ headers: (0, _helpers.extendHeaders)(headers, auth, traceContext),
70
+ signal: controller && controller.signal
71
+ }).then((0, _helpers.createProcessFetchResponse)(metadata));
72
+ };
73
+ return _context.abrupt("return", (0, _helpers.fetchRetry)(doFetch, metadata, retryOptions));
74
+ case 7:
75
+ case "end":
76
+ return _context.stop();
80
77
  }
81
78
  }, _callee);
82
79
  }));