@atlaskit/media-client 36.3.0 → 36.3.1

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 (36) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/cjs/client/file-fetcher/index.js +166 -165
  3. package/dist/cjs/client/media-client.js +14 -14
  4. package/dist/cjs/client/media-store/MediaStore.js +79 -78
  5. package/dist/cjs/client/media-store/resolveAuth.js +20 -19
  6. package/dist/cjs/client/stargate-client.js +4 -4
  7. package/dist/cjs/uploader/index.js +28 -35
  8. package/dist/cjs/utils/createCopyIntentRegisterationBatcher.js +16 -16
  9. package/dist/cjs/utils/createFileDataLoader.js +16 -16
  10. package/dist/cjs/utils/getDimensionsFromBlob.js +15 -15
  11. package/dist/cjs/utils/getVideoDimensionsFromBlob.js +1 -1
  12. package/dist/cjs/utils/hashing/hasherCreator.js +18 -18
  13. package/dist/cjs/utils/mobileUpload/helpers.js +15 -15
  14. package/dist/cjs/utils/mobileUpload/stateMachine/index.js +4 -4
  15. package/dist/cjs/utils/polling/index.js +18 -18
  16. package/dist/cjs/utils/request/helpers.js +52 -49
  17. package/dist/cjs/utils/request/index.js +17 -16
  18. package/dist/cjs/utils/shouldFetchRemoteFileStates.js +18 -18
  19. package/dist/esm/client/file-fetcher/index.js +166 -165
  20. package/dist/esm/client/media-client.js +14 -14
  21. package/dist/esm/client/media-store/MediaStore.js +79 -78
  22. package/dist/esm/client/media-store/resolveAuth.js +20 -19
  23. package/dist/esm/client/stargate-client.js +4 -4
  24. package/dist/esm/uploader/index.js +28 -35
  25. package/dist/esm/utils/createCopyIntentRegisterationBatcher.js +16 -16
  26. package/dist/esm/utils/createFileDataLoader.js +16 -16
  27. package/dist/esm/utils/getDimensionsFromBlob.js +15 -15
  28. package/dist/esm/utils/getVideoDimensionsFromBlob.js +1 -1
  29. package/dist/esm/utils/hashing/hasherCreator.js +17 -17
  30. package/dist/esm/utils/mobileUpload/helpers.js +15 -15
  31. package/dist/esm/utils/mobileUpload/stateMachine/index.js +4 -4
  32. package/dist/esm/utils/polling/index.js +18 -18
  33. package/dist/esm/utils/request/helpers.js +52 -49
  34. package/dist/esm/utils/request/index.js +17 -16
  35. package/dist/esm/utils/shouldFetchRemoteFileStates.js +18 -18
  36. package/package.json +3 -3
@@ -11,19 +11,19 @@ export var StargateClient = /*#__PURE__*/function () {
11
11
  key: "fetchToken",
12
12
  value: function () {
13
13
  var _fetchToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(clientId) {
14
- return _regeneratorRuntime.wrap(function _callee$(_context) {
14
+ return _regeneratorRuntime.wrap(function (_context) {
15
15
  while (1) switch (_context.prev = _context.next) {
16
16
  case 0:
17
- _context.next = 2;
17
+ _context.next = 1;
18
18
  return fetch("".concat(this.baseUrl, "/media/auth/smartedge"), {
19
19
  credentials: 'include',
20
20
  headers: {
21
21
  'x-client-id': clientId
22
22
  }
23
23
  });
24
- case 2:
24
+ case 1:
25
25
  return _context.abrupt("return", _context.sent.json());
26
- case 3:
26
+ case 2:
27
27
  case "end":
28
28
  return _context.stop();
29
29
  }
@@ -13,15 +13,15 @@ import { calculateChunkSize, fileSizeError } from './calculateChunkSize';
13
13
  var _hashingFunction = /*#__PURE__*/function () {
14
14
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(blob, hashAlgorithm) {
15
15
  var hasher;
16
- return _regeneratorRuntime.wrap(function _callee$(_context) {
16
+ return _regeneratorRuntime.wrap(function (_context) {
17
17
  while (1) switch (_context.prev = _context.next) {
18
18
  case 0:
19
- _context.next = 2;
19
+ _context.next = 1;
20
20
  return createHasher(hashAlgorithm);
21
- case 2:
21
+ case 1:
22
22
  hasher = _context.sent;
23
23
  return _context.abrupt("return", hasher.hash(blob));
24
- case 4:
24
+ case 2:
25
25
  case "end":
26
26
  return _context.stop();
27
27
  }
@@ -34,24 +34,21 @@ var _hashingFunction = /*#__PURE__*/function () {
34
34
  var createUploadingFunction = function createUploadingFunction(store, deferredUploadId, collectionName, traceContext) {
35
35
  return /*#__PURE__*/function () {
36
36
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(chunk) {
37
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
37
+ var _t, _t2, _t3;
38
+ return _regeneratorRuntime.wrap(function (_context2) {
38
39
  while (1) switch (_context2.prev = _context2.next) {
39
40
  case 0:
40
- _context2.t0 = store;
41
- _context2.t1 = chunk.hash;
42
- _context2.t2 = chunk.blob;
43
- _context2.next = 5;
41
+ _t = store;
42
+ _t2 = chunk.hash;
43
+ _t3 = chunk.blob;
44
+ _context2.next = 1;
44
45
  return deferredUploadId;
45
- case 5:
46
- _context2.t3 = _context2.sent;
47
- _context2.t4 = chunk.partNumber;
48
- _context2.t5 = collectionName;
49
- _context2.t6 = traceContext;
50
- _context2.next = 11;
51
- return _context2.t0.uploadChunk.call(_context2.t0, _context2.t1, _context2.t2, _context2.t3, _context2.t4, _context2.t5, _context2.t6);
52
- case 11:
46
+ case 1:
47
+ _context2.next = 2;
48
+ return _t.uploadChunk.call(_t, _t2, _t3, _context2.sent, chunk.partNumber, collectionName, traceContext);
49
+ case 2:
53
50
  return _context2.abrupt("return", _context2.sent);
54
- case 12:
51
+ case 3:
55
52
  case "end":
56
53
  return _context2.stop();
57
54
  }
@@ -66,28 +63,24 @@ var createProcessingFunction = function createProcessingFunction(store, deferred
66
63
  var offset = 0;
67
64
  return /*#__PURE__*/function () {
68
65
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(chunks) {
69
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
66
+ var _t4;
67
+ return _regeneratorRuntime.wrap(function (_context3) {
70
68
  while (1) switch (_context3.prev = _context3.next) {
71
69
  case 0:
72
- _context3.t0 = store;
73
- _context3.next = 3;
70
+ _t4 = store;
71
+ _context3.next = 1;
74
72
  return deferredUploadId;
75
- case 3:
76
- _context3.t1 = _context3.sent;
77
- _context3.t2 = {
73
+ case 1:
74
+ _context3.next = 2;
75
+ return _t4.appendChunksToUpload.call(_t4, _context3.sent, {
78
76
  chunks: hashedChunks(chunks),
79
77
  offset: offset
80
- };
81
- _context3.t3 = collection;
82
- _context3.t4 = traceContext;
83
- _context3.t5 = {
78
+ }, collection, traceContext, {
84
79
  expectedFileSize: size
85
- };
86
- _context3.next = 10;
87
- return _context3.t0.appendChunksToUpload.call(_context3.t0, _context3.t1, _context3.t2, _context3.t3, _context3.t4, _context3.t5);
88
- case 10:
80
+ });
81
+ case 2:
89
82
  offset += chunks.length;
90
- case 11:
83
+ case 3:
91
84
  case "end":
92
85
  return _context3.stop();
93
86
  }
@@ -101,7 +94,7 @@ var createProcessingFunction = function createProcessingFunction(store, deferred
101
94
  var createFileFromUpload = /*#__PURE__*/function () {
102
95
  var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(file, store, uploadableFileUpfrontIds, uploadId, traceContext) {
103
96
  var collection, name, mimeType, id, occurrenceKey, body;
104
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
97
+ return _regeneratorRuntime.wrap(function (_context4) {
105
98
  while (1) switch (_context4.prev = _context4.next) {
106
99
  case 0:
107
100
  collection = file.collection, name = file.name, mimeType = file.mimeType;
@@ -123,7 +116,7 @@ var createFileFromUpload = /*#__PURE__*/function () {
123
116
  collection: collection,
124
117
  replaceFileId: id
125
118
  }, traceContext));
126
- case 4:
119
+ case 1:
127
120
  case "end":
128
121
  return _context4.stop();
129
122
  }
@@ -16,7 +16,7 @@ function createBatchCopyIntentRegisterationFunc(mediaStore) {
16
16
  return /*#__PURE__*/function () {
17
17
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(keys) {
18
18
  var keysByToken, items;
19
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
19
+ return _regeneratorRuntime.wrap(function (_context2) {
20
20
  while (1) switch (_context2.prev = _context2.next) {
21
21
  case 0:
22
22
  keysByToken = keys.reduce(function (acc, key) {
@@ -35,11 +35,11 @@ function createBatchCopyIntentRegisterationFunc(mediaStore) {
35
35
  return acc;
36
36
  }, {});
37
37
  items = [];
38
- _context2.next = 4;
38
+ _context2.next = 1;
39
39
  return Promise.all(Object.keys(keysByToken).map( /*#__PURE__*/function () {
40
40
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(batchKey) {
41
- var metadataTraceContext, files, resolvedAuth;
42
- return _regeneratorRuntime.wrap(function _callee$(_context) {
41
+ var metadataTraceContext, files, resolvedAuth, _t;
42
+ return _regeneratorRuntime.wrap(function (_context) {
43
43
  while (1) switch (_context.prev = _context.next) {
44
44
  case 0:
45
45
  metadataTraceContext = {
@@ -53,35 +53,35 @@ function createBatchCopyIntentRegisterationFunc(mediaStore) {
53
53
  };
54
54
  }); // given these are batched by the token the assumption is that they have the same details.
55
55
  resolvedAuth = keysByToken[batchKey][0].resolvedAuth;
56
- _context.prev = 3;
57
- _context.next = 6;
56
+ _context.prev = 1;
57
+ _context.next = 2;
58
58
  return mediaStore.registerCopyIntents(files, metadataTraceContext, resolvedAuth);
59
- case 6:
60
- _context.next = 11;
59
+ case 2:
60
+ _context.next = 4;
61
61
  break;
62
- case 8:
63
- _context.prev = 8;
64
- _context.t0 = _context["catch"](3);
62
+ case 3:
63
+ _context.prev = 3;
64
+ _t = _context["catch"](1);
65
65
  files.forEach(function (_ref4) {
66
66
  var id = _ref4.id,
67
67
  collection = _ref4.collection;
68
68
  items.push({
69
69
  id: id,
70
70
  collection: collection,
71
- error: _context.t0
71
+ error: _t
72
72
  });
73
73
  });
74
- case 11:
74
+ case 4:
75
75
  case "end":
76
76
  return _context.stop();
77
77
  }
78
- }, _callee, null, [[3, 8]]);
78
+ }, _callee, null, [[1, 3]]);
79
79
  }));
80
80
  return function (_x2) {
81
81
  return _ref3.apply(this, arguments);
82
82
  };
83
83
  }()));
84
- case 4:
84
+ case 1:
85
85
  return _context2.abrupt("return", keys.map(function (_ref5) {
86
86
  var _items$find;
87
87
  var id = _ref5.id,
@@ -90,7 +90,7 @@ function createBatchCopyIntentRegisterationFunc(mediaStore) {
90
90
  return item.id === id && item.collection === collectionName;
91
91
  })) === null || _items$find === void 0 ? void 0 : _items$find.error;
92
92
  }));
93
- case 5:
93
+ case 2:
94
94
  case "end":
95
95
  return _context2.stop();
96
96
  }
@@ -60,7 +60,7 @@ export function createBatchLoadingFunc(mediaStore) {
60
60
  return /*#__PURE__*/function () {
61
61
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(keys) {
62
62
  var nonCollectionName, includeHashByCollection, fileIdsByCollection, items;
63
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
63
+ return _regeneratorRuntime.wrap(function (_context2) {
64
64
  while (1) switch (_context2.prev = _context2.next) {
65
65
  case 0:
66
66
  nonCollectionName = '__media-single-file-collection__';
@@ -83,11 +83,11 @@ export function createBatchLoadingFunc(mediaStore) {
83
83
  return acc;
84
84
  }, {});
85
85
  items = [];
86
- _context2.next = 6;
86
+ _context2.next = 1;
87
87
  return Promise.all(Object.keys(fileIdsByCollection).map( /*#__PURE__*/function () {
88
88
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(collectionNameKey) {
89
- var metadataTraceContext, fileIds, includeHashForDuplicateFiles, collectionName, response, itemsWithMetadataTraceContext, itemsIds, fileIdsNotFound;
90
- return _regeneratorRuntime.wrap(function _callee$(_context) {
89
+ var metadataTraceContext, fileIds, includeHashForDuplicateFiles, collectionName, response, itemsWithMetadataTraceContext, itemsIds, fileIdsNotFound, _t;
90
+ return _regeneratorRuntime.wrap(function (_context) {
91
91
  while (1) switch (_context.prev = _context.next) {
92
92
  case 0:
93
93
  metadataTraceContext = {
@@ -97,10 +97,10 @@ export function createBatchLoadingFunc(mediaStore) {
97
97
  fileIds = fileIdsByCollection[collectionNameKey];
98
98
  includeHashForDuplicateFiles = includeHashByCollection[collectionNameKey];
99
99
  collectionName = collectionNameKey === nonCollectionName ? undefined : collectionNameKey;
100
- _context.prev = 4;
101
- _context.next = 7;
100
+ _context.prev = 1;
101
+ _context.next = 2;
102
102
  return mediaStore.getItems(fileIds, collectionName, metadataTraceContext, includeHashForDuplicateFiles);
103
- case 7:
103
+ case 2:
104
104
  response = _context.sent;
105
105
  itemsWithMetadataTraceContext = response.data.items.map(function (item) {
106
106
  return _objectSpread(_objectSpread({}, item), {}, {
@@ -124,31 +124,31 @@ export function createBatchLoadingFunc(mediaStore) {
124
124
  metadataTraceContext: metadataTraceContext
125
125
  });
126
126
  });
127
- _context.next = 18;
127
+ _context.next = 4;
128
128
  break;
129
- case 15:
130
- _context.prev = 15;
131
- _context.t0 = _context["catch"](4);
129
+ case 3:
130
+ _context.prev = 3;
131
+ _t = _context["catch"](1);
132
132
  fileIds.forEach(function (fileId) {
133
133
  items.push({
134
134
  id: fileId,
135
135
  collection: collectionName,
136
- error: _context.t0
136
+ error: _t
137
137
  });
138
138
  });
139
- case 18:
139
+ case 4:
140
140
  case "end":
141
141
  return _context.stop();
142
142
  }
143
- }, _callee, null, [[4, 15]]);
143
+ }, _callee, null, [[1, 3]]);
144
144
  }));
145
145
  return function (_x2) {
146
146
  return _ref2.apply(this, arguments);
147
147
  };
148
148
  }()));
149
- case 6:
149
+ case 1:
150
150
  return _context2.abrupt("return", getItemsFromKeys(keys, items));
151
- case 7:
151
+ case 2:
152
152
  case "end":
153
153
  return _context2.stop();
154
154
  }
@@ -4,33 +4,33 @@ import { getImageDimensionsFromBlob } from './getImageDimensionsFromBlob';
4
4
  import { getVideoDimensionsFromBlob } from './getVideoDimensionsFromBlob';
5
5
  export var getDimensionsFromBlob = /*#__PURE__*/function () {
6
6
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(mediaType, blob) {
7
- var url;
8
- return _regeneratorRuntime.wrap(function _callee$(_context) {
7
+ var url, _t;
8
+ return _regeneratorRuntime.wrap(function (_context) {
9
9
  while (1) switch (_context.prev = _context.next) {
10
10
  case 0:
11
- _context.t0 = mediaType;
12
- _context.next = _context.t0 === 'image' ? 3 : _context.t0 === 'video' ? 11 : 12;
11
+ _t = mediaType;
12
+ _context.next = _t === 'image' ? 1 : _t === 'video' ? 5 : 6;
13
13
  break;
14
- case 3:
14
+ case 1:
15
15
  url = URL.createObjectURL(blob);
16
- _context.prev = 4;
17
- _context.next = 7;
16
+ _context.prev = 2;
17
+ _context.next = 3;
18
18
  return getImageDimensionsFromBlob(url);
19
- case 7:
19
+ case 3:
20
20
  return _context.abrupt("return", _context.sent);
21
- case 8:
22
- _context.prev = 8;
21
+ case 4:
22
+ _context.prev = 4;
23
23
  URL.revokeObjectURL(url);
24
- return _context.finish(8);
25
- case 11:
24
+ return _context.finish(4);
25
+ case 5:
26
26
  return _context.abrupt("return", getVideoDimensionsFromBlob(blob));
27
- case 12:
27
+ case 6:
28
28
  throw new Error("Can't extract dimensions from ".concat(mediaType));
29
- case 13:
29
+ case 7:
30
30
  case "end":
31
31
  return _context.stop();
32
32
  }
33
- }, _callee, null, [[4,, 8, 11]]);
33
+ }, _callee, null, [[2,, 4, 5]]);
34
34
  }));
35
35
  return function getDimensionsFromBlob(_x, _x2) {
36
36
  return _ref.apply(this, arguments);
@@ -2,7 +2,7 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _regeneratorRuntime from "@babel/runtime/regenerator";
3
3
  export var getVideoDimensionsFromBlob = /*#__PURE__*/function () {
4
4
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(blob) {
5
- return _regeneratorRuntime.wrap(function _callee$(_context) {
5
+ return _regeneratorRuntime.wrap(function (_context) {
6
6
  while (1) switch (_context.prev = _context.next) {
7
7
  case 0:
8
8
  return _context.abrupt("return", new Promise(function (resolve, reject) {
@@ -9,46 +9,46 @@ export var destroyHashers = function destroyHashers() {
9
9
  };
10
10
  export var createHasher = /*#__PURE__*/function () {
11
11
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(algorithm) {
12
- var _yield$import, _SimpleHasher, _yield$import2, SimpleHasher;
13
- return _regeneratorRuntime.wrap(function _callee$(_context) {
12
+ var _yield$import, _SimpleHasher, _yield$import2, SimpleHasher, _t;
13
+ return _regeneratorRuntime.wrap(function (_context) {
14
14
  while (1) switch (_context.prev = _context.next) {
15
15
  case 0:
16
16
  _context.prev = 0;
17
17
  if (!(algorithm === ChunkHashAlgorithm.Sha256)) {
18
- _context.next = 9;
18
+ _context.next = 3;
19
19
  break;
20
20
  }
21
21
  if (sha256Hasher) {
22
- _context.next = 8;
22
+ _context.next = 2;
23
23
  break;
24
24
  }
25
- _context.next = 5;
25
+ _context.next = 1;
26
26
  return import('./sha256SimpleHasher');
27
- case 5:
27
+ case 1:
28
28
  _yield$import = _context.sent;
29
29
  _SimpleHasher = _yield$import.SimpleHasher;
30
30
  sha256Hasher = new _SimpleHasher();
31
- case 8:
31
+ case 2:
32
32
  return _context.abrupt("return", sha256Hasher);
33
- case 9:
34
- _context.next = 13;
33
+ case 3:
34
+ _context.next = 5;
35
35
  break;
36
- case 11:
37
- _context.prev = 11;
38
- _context.t0 = _context["catch"](0);
39
- case 13:
40
- _context.next = 15;
36
+ case 4:
37
+ _context.prev = 4;
38
+ _t = _context["catch"](0);
39
+ case 5:
40
+ _context.next = 6;
41
41
  return import('./simpleHasher');
42
- case 15:
42
+ case 6:
43
43
  _yield$import2 = _context.sent;
44
44
  SimpleHasher = _yield$import2.SimpleHasher;
45
45
  hasher = new SimpleHasher();
46
46
  return _context.abrupt("return", hasher);
47
- case 19:
47
+ case 7:
48
48
  case "end":
49
49
  return _context.stop();
50
50
  }
51
- }, _callee, null, [[0, 11]]);
51
+ }, _callee, null, [[0, 4]]);
52
52
  }));
53
53
  return function createHasher(_x) {
54
54
  return _ref.apply(this, arguments);
@@ -25,19 +25,19 @@ export var createMobileDownloadFileStream = function createMobileDownloadFileStr
25
25
  return subject.error(error);
26
26
  };
27
27
  poll.execute( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
28
- var response, fileState;
29
- return _regeneratorRuntime.wrap(function _callee$(_context) {
28
+ var response, fileState, _t;
29
+ return _regeneratorRuntime.wrap(function (_context) {
30
30
  while (1) switch (_context.prev = _context.next) {
31
31
  case 0:
32
- _context.next = 2;
32
+ _context.next = 1;
33
33
  return dataloader.load({
34
34
  id: id,
35
35
  collectionName: collectionName
36
36
  });
37
- case 2:
37
+ case 1:
38
38
  response = _context.sent;
39
39
  if (!isNotFoundMediaItemDetails(response)) {
40
- _context.next = 5;
40
+ _context.next = 2;
41
41
  break;
42
42
  }
43
43
  throw new MobileUploadError('emptyItems', {
@@ -46,9 +46,9 @@ export var createMobileDownloadFileStream = function createMobileDownloadFileStr
46
46
  occurrenceKey: occurrenceKey,
47
47
  traceContext: response.metadataTraceContext
48
48
  });
49
- case 5:
49
+ case 2:
50
50
  if (!isEmptyFile(response)) {
51
- _context.next = 7;
51
+ _context.next = 3;
52
52
  break;
53
53
  }
54
54
  throw new MobileUploadError('zeroVersionFile', {
@@ -57,20 +57,20 @@ export var createMobileDownloadFileStream = function createMobileDownloadFileStr
57
57
  occurrenceKey: occurrenceKey,
58
58
  traceContext: response.metadataTraceContext
59
59
  });
60
- case 7:
60
+ case 3:
61
61
  fileState = mapMediaItemToFileState(id, response);
62
62
  subject.next(fileState);
63
- _context.t0 = fileState.status;
64
- _context.next = _context.t0 === 'processing' ? 12 : _context.t0 === 'processed' ? 14 : 16;
63
+ _t = fileState.status;
64
+ _context.next = _t === 'processing' ? 4 : _t === 'processed' ? 5 : 6;
65
65
  break;
66
- case 12:
66
+ case 4:
67
67
  // the only case for continuing polling, otherwise this function is run once only
68
68
  poll.next();
69
- return _context.abrupt("break", 16);
70
- case 14:
69
+ return _context.abrupt("continue", 6);
70
+ case 5:
71
71
  subject.complete();
72
- return _context.abrupt("break", 16);
73
- case 16:
72
+ return _context.abrupt("continue", 6);
73
+ case 6:
74
74
  case "end":
75
75
  return _context.stop();
76
76
  }
@@ -31,19 +31,19 @@ export var createMobileUploadStateMachine = function createMobileUploadStateMach
31
31
  shouldFetchRemoteFileStates: function () {
32
32
  var _shouldFetchRemoteFileStates2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(ctx) {
33
33
  var currentFileState, mediaType, mimeType, preview;
34
- return _regeneratorRuntime.wrap(function _callee$(_context) {
34
+ return _regeneratorRuntime.wrap(function (_context) {
35
35
  while (1) switch (_context.prev = _context.next) {
36
36
  case 0:
37
37
  currentFileState = ctx.currentFileState;
38
38
  if (!isProcessingFileState(currentFileState)) {
39
- _context.next = 4;
39
+ _context.next = 1;
40
40
  break;
41
41
  }
42
42
  mediaType = currentFileState.mediaType, mimeType = currentFileState.mimeType, preview = currentFileState.preview;
43
43
  return _context.abrupt("return", _shouldFetchRemoteFileStates(mediaType, mimeType, preview));
44
- case 4:
44
+ case 1:
45
45
  return _context.abrupt("return", false);
46
- case 5:
46
+ case 2:
47
47
  case "end":
48
48
  return _context.stop();
49
49
  }
@@ -41,55 +41,55 @@ export var PollingFunction = /*#__PURE__*/function () {
41
41
  value: function () {
42
42
  var _execute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(executor) {
43
43
  var _this = this;
44
- var poll_maxAttempts;
45
- return _regeneratorRuntime.wrap(function _callee$(_context) {
44
+ var poll_maxAttempts, _t;
45
+ return _regeneratorRuntime.wrap(function (_context) {
46
46
  while (1) switch (_context.prev = _context.next) {
47
47
  case 0:
48
48
  poll_maxAttempts = this.options.poll_maxAttempts;
49
49
  if (!(poll_maxAttempts === 0)) {
50
- _context.next = 3;
50
+ _context.next = 1;
51
51
  break;
52
52
  }
53
53
  return _context.abrupt("return", this.fail(new PollingError('pollingMaxAttemptsExceeded', {
54
54
  attempts: this.attempt
55
55
  })));
56
- case 3:
57
- _context.prev = 3;
56
+ case 1:
57
+ _context.prev = 1;
58
58
  // executor must explicitly call this.next() for triggering next iteration (pull)
59
59
  this.shouldIterate = false;
60
- _context.next = 7;
60
+ _context.next = 2;
61
61
  return executor();
62
- case 7:
62
+ case 2:
63
63
  if (this.shouldIterate) {
64
- _context.next = 9;
64
+ _context.next = 3;
65
65
  break;
66
66
  }
67
67
  return _context.abrupt("return");
68
- case 9:
68
+ case 3:
69
69
  if (!(this.attempt >= poll_maxAttempts)) {
70
- _context.next = 11;
70
+ _context.next = 4;
71
71
  break;
72
72
  }
73
73
  return _context.abrupt("return", this.fail(new PollingError('pollingMaxAttemptsExceeded', {
74
74
  attempts: this.attempt
75
75
  })));
76
- case 11:
76
+ case 4:
77
77
  this.poll_intervalMs = this.getIntervalMsForIteration(this.attempt);
78
78
  this.attempt++;
79
79
  this.timeoutId = window.setTimeout(function () {
80
80
  return _this.execute(executor);
81
81
  }, this.poll_intervalMs);
82
- _context.next = 19;
82
+ _context.next = 6;
83
83
  break;
84
- case 16:
85
- _context.prev = 16;
86
- _context.t0 = _context["catch"](3);
87
- this.fail(_context.t0);
88
- case 19:
84
+ case 5:
85
+ _context.prev = 5;
86
+ _t = _context["catch"](1);
87
+ this.fail(_t);
88
+ case 6:
89
89
  case "end":
90
90
  return _context.stop();
91
91
  }
92
- }, _callee, this, [[3, 16]]);
92
+ }, _callee, this, [[1, 5]]);
93
93
  }));
94
94
  function execute(_x) {
95
95
  return _execute.apply(this, arguments);