@atlaskit/media-test-helpers 31.0.0 → 32.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 (72) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/cjs/authProvider.js +25 -27
  3. package/dist/cjs/await-error.js +17 -19
  4. package/dist/cjs/docs-content-tabs.js +1 -0
  5. package/dist/cjs/fakeMediaClient.js +0 -5
  6. package/dist/cjs/fileStateFactory/{createFileState.js → factory/createFileState.js} +8 -15
  7. package/dist/cjs/fileStateFactory/{factory.js → factory/factory.js} +34 -25
  8. package/dist/cjs/fileStateFactory/factory/index.js +38 -0
  9. package/dist/cjs/fileStateFactory/fileSimulation/fileSimulation.js +89 -0
  10. package/dist/cjs/fileStateFactory/fileSimulation/index.js +79 -0
  11. package/dist/cjs/fileStateFactory/fileSimulation/simulations.js +399 -0
  12. package/dist/cjs/fileStateFactory/index.js +76 -4
  13. package/dist/cjs/getAuthFromContextProvider.js +21 -23
  14. package/dist/cjs/index.js +72 -0
  15. package/dist/cjs/mediaPickerAuthProvider.js +22 -24
  16. package/dist/cjs/mocks/database/collection-item.js +5 -0
  17. package/dist/cjs/mocks/database/index.js +6 -0
  18. package/dist/cjs/mocks/routers/api-router.js +92 -98
  19. package/dist/cjs/story-list.js +1 -1
  20. package/dist/cjs/utils/logging.js +4 -4
  21. package/dist/cjs/version.json +1 -1
  22. package/dist/cjs/waitUntil.js +19 -21
  23. package/dist/es2019/fakeMediaClient.js +0 -5
  24. package/dist/es2019/fileStateFactory/{createFileState.js → factory/createFileState.js} +8 -17
  25. package/dist/es2019/fileStateFactory/{factory.js → factory/factory.js} +12 -2
  26. package/dist/es2019/fileStateFactory/factory/index.js +3 -0
  27. package/dist/es2019/fileStateFactory/fileSimulation/fileSimulation.js +63 -0
  28. package/dist/es2019/fileStateFactory/fileSimulation/index.js +2 -0
  29. package/dist/es2019/fileStateFactory/fileSimulation/simulations.js +148 -0
  30. package/dist/es2019/fileStateFactory/index.js +4 -2
  31. package/dist/es2019/index.js +5 -1
  32. package/dist/es2019/mocks/database/collection-item.js +1 -0
  33. package/dist/es2019/mocks/database/index.js +1 -1
  34. package/dist/es2019/mocks/routers/api-router.js +3 -3
  35. package/dist/es2019/utils/logging.js +3 -3
  36. package/dist/es2019/version.json +1 -1
  37. package/dist/esm/authProvider.js +25 -27
  38. package/dist/esm/await-error.js +17 -19
  39. package/dist/esm/fakeMediaClient.js +0 -5
  40. package/dist/esm/fileStateFactory/{createFileState.js → factory/createFileState.js} +8 -15
  41. package/dist/esm/fileStateFactory/{factory.js → factory/factory.js} +34 -25
  42. package/dist/esm/fileStateFactory/factory/index.js +3 -0
  43. package/dist/esm/fileStateFactory/fileSimulation/fileSimulation.js +81 -0
  44. package/dist/esm/fileStateFactory/fileSimulation/index.js +2 -0
  45. package/dist/esm/fileStateFactory/fileSimulation/simulations.js +382 -0
  46. package/dist/esm/fileStateFactory/index.js +4 -2
  47. package/dist/esm/getAuthFromContextProvider.js +21 -23
  48. package/dist/esm/index.js +5 -1
  49. package/dist/esm/mediaPickerAuthProvider.js +22 -24
  50. package/dist/esm/mocks/database/collection-item.js +3 -0
  51. package/dist/esm/mocks/database/index.js +1 -1
  52. package/dist/esm/mocks/routers/api-router.js +93 -99
  53. package/dist/esm/utils/logging.js +3 -3
  54. package/dist/esm/version.json +1 -1
  55. package/dist/esm/waitUntil.js +19 -21
  56. package/dist/types/fileStateFactory/{factory.d.ts → factory/factory.d.ts} +3 -0
  57. package/dist/types/fileStateFactory/factory/index.d.ts +4 -0
  58. package/dist/types/fileStateFactory/fileSimulation/fileSimulation.d.ts +18 -0
  59. package/dist/types/fileStateFactory/fileSimulation/index.d.ts +4 -0
  60. package/dist/types/fileStateFactory/fileSimulation/simulations.d.ts +35 -0
  61. package/dist/types/fileStateFactory/index.d.ts +7 -3
  62. package/dist/types/index.d.ts +2 -2
  63. package/dist/types/mocks/database/collection-item.d.ts +13 -1
  64. package/dist/types/mocks/database/collection.d.ts +4 -1
  65. package/dist/types/mocks/database/index.d.ts +2 -2
  66. package/package.json +4 -3
  67. package/report.api.md +90 -0
  68. /package/dist/cjs/fileStateFactory/{helpers.js → factory/helpers.js} +0 -0
  69. /package/dist/es2019/fileStateFactory/{helpers.js → factory/helpers.js} +0 -0
  70. /package/dist/esm/fileStateFactory/{helpers.js → factory/helpers.js} +0 -0
  71. /package/dist/types/fileStateFactory/{createFileState.d.ts → factory/createFileState.d.ts} +0 -0
  72. /package/dist/types/fileStateFactory/{helpers.d.ts → factory/helpers.d.ts} +0 -0
@@ -0,0 +1,382 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
+ import { sleep } from '../../nextTick';
4
+ var speed = 1500;
5
+ /**
6
+ * Normal File Flow
7
+ */
8
+
9
+ export var simulateProcessed = function simulateProcessed() {
10
+ var withRemotePreview = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
11
+ return {
12
+ simulation: function () {
13
+ var _simulation = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(factory) {
14
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
15
+ while (1) switch (_context.prev = _context.next) {
16
+ case 0:
17
+ _context.next = 2;
18
+ return sleep(speed);
19
+ case 2:
20
+ factory.next('processed', {
21
+ withRemotePreview: withRemotePreview
22
+ });
23
+ case 3:
24
+ case "end":
25
+ return _context.stop();
26
+ }
27
+ }, _callee);
28
+ }));
29
+ function simulation(_x) {
30
+ return _simulation.apply(this, arguments);
31
+ }
32
+ return simulation;
33
+ }(),
34
+ description: "File state is processed ".concat(withRemotePreview ? 'with' : 'without', " remote preview")
35
+ };
36
+ };
37
+ export var simulateProcessing = function simulateProcessing() {
38
+ var suceeded = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
39
+ var withRemotePreview = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
40
+ return {
41
+ description: "File is processing, then ".concat(suceeded ? 'succeeds' : 'fails', " ").concat(withRemotePreview ? 'with' : 'without', " remote preview"),
42
+ simulation: function () {
43
+ var _simulation2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(factory) {
44
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
45
+ while (1) switch (_context2.prev = _context2.next) {
46
+ case 0:
47
+ _context2.next = 2;
48
+ return sleep(speed);
49
+ case 2:
50
+ factory.next('processing');
51
+ _context2.next = 5;
52
+ return sleep(speed);
53
+ case 5:
54
+ factory.next('processing');
55
+ _context2.next = 8;
56
+ return sleep(speed * 0.5);
57
+ case 8:
58
+ if (!suceeded) {
59
+ factory.next('failed-processing', {
60
+ withRemotePreview: withRemotePreview
61
+ });
62
+ } else {
63
+ factory.next('processed', {
64
+ withRemotePreview: withRemotePreview
65
+ });
66
+ }
67
+ case 9:
68
+ case "end":
69
+ return _context2.stop();
70
+ }
71
+ }, _callee2);
72
+ }));
73
+ function simulation(_x2) {
74
+ return _simulation2.apply(this, arguments);
75
+ }
76
+ return simulation;
77
+ }()
78
+ };
79
+ };
80
+ export var simulateImmediateFailProcessing = function simulateImmediateFailProcessing() {
81
+ return {
82
+ description: 'The first sate is failed-processing with no preview',
83
+ simulation: function () {
84
+ var _simulation3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(factory) {
85
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
86
+ while (1) switch (_context3.prev = _context3.next) {
87
+ case 0:
88
+ _context3.next = 2;
89
+ return sleep(speed);
90
+ case 2:
91
+ factory.next('failed-processing');
92
+ case 3:
93
+ case "end":
94
+ return _context3.stop();
95
+ }
96
+ }, _callee3);
97
+ }));
98
+ function simulation(_x3) {
99
+ return _simulation3.apply(this, arguments);
100
+ }
101
+ return simulation;
102
+ }()
103
+ };
104
+ };
105
+ export var simulateUpload = function simulateUpload(withLocalPreview) {
106
+ var suceeded = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
107
+ return {
108
+ description: '',
109
+ simulation: function () {
110
+ var _simulation4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(factory) {
111
+ var chunks, chunkUploadDelay, processingTime, uploadUpTo, index;
112
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
113
+ while (1) switch (_context4.prev = _context4.next) {
114
+ case 0:
115
+ chunks = 3;
116
+ chunkUploadDelay = 500;
117
+ processingTime = speed;
118
+ _context4.next = 5;
119
+ return sleep(speed);
120
+ case 5:
121
+ factory.next('uploading', {
122
+ withLocalPreview: withLocalPreview
123
+ });
124
+ uploadUpTo = !suceeded ? chunks / 2 : chunks;
125
+ index = 0;
126
+ case 8:
127
+ if (!(index <= uploadUpTo)) {
128
+ _context4.next = 15;
129
+ break;
130
+ }
131
+ factory.next('uploading', {
132
+ uploadProgress: index / chunks,
133
+ withLocalPreview: withLocalPreview
134
+ });
135
+ _context4.next = 12;
136
+ return sleep(chunkUploadDelay);
137
+ case 12:
138
+ index++;
139
+ _context4.next = 8;
140
+ break;
141
+ case 15:
142
+ if (!suceeded) {
143
+ factory.error(new Error('some-error'));
144
+ }
145
+ factory.next('processing', {
146
+ withLocalPreview: withLocalPreview
147
+ });
148
+ _context4.next = 19;
149
+ return sleep(processingTime);
150
+ case 19:
151
+ factory.next('processed', {
152
+ withLocalPreview: withLocalPreview
153
+ });
154
+ case 20:
155
+ case "end":
156
+ return _context4.stop();
157
+ }
158
+ }, _callee4);
159
+ }));
160
+ function simulation(_x4) {
161
+ return _simulation4.apply(this, arguments);
162
+ }
163
+ return simulation;
164
+ }()
165
+ };
166
+ };
167
+ export var simulateErrorState = function simulateErrorState() {
168
+ return {
169
+ description: 'File state is error',
170
+ simulation: function () {
171
+ var _simulation5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(factory) {
172
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
173
+ while (1) switch (_context5.prev = _context5.next) {
174
+ case 0:
175
+ _context5.next = 2;
176
+ return sleep(speed);
177
+ case 2:
178
+ factory.next('error');
179
+ case 3:
180
+ case "end":
181
+ return _context5.stop();
182
+ }
183
+ }, _callee5);
184
+ }));
185
+ function simulation(_x5) {
186
+ return _simulation5.apply(this, arguments);
187
+ }
188
+ return simulation;
189
+ }()
190
+ };
191
+ };
192
+ export var simulateError = function simulateError() {
193
+ return {
194
+ description: 'Subscription throws an error through the observer',
195
+ simulation: function () {
196
+ var _simulation6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(factory) {
197
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
198
+ while (1) switch (_context6.prev = _context6.next) {
199
+ case 0:
200
+ _context6.next = 2;
201
+ return sleep(speed);
202
+ case 2:
203
+ factory.error(new Error('error thrown from client'));
204
+ case 3:
205
+ case "end":
206
+ return _context6.stop();
207
+ }
208
+ }, _callee6);
209
+ }));
210
+ function simulation(_x6) {
211
+ return _simulation6.apply(this, arguments);
212
+ }
213
+ return simulation;
214
+ }()
215
+ };
216
+ };
217
+
218
+ /**
219
+ * Rare Cases
220
+ */
221
+
222
+ export var simulateManyProcessed = function simulateManyProcessed() {
223
+ var withRemotePreview = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
224
+ return {
225
+ description: '',
226
+ simulation: function () {
227
+ var _simulation7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(factory) {
228
+ return _regeneratorRuntime.wrap(function _callee7$(_context7) {
229
+ while (1) switch (_context7.prev = _context7.next) {
230
+ case 0:
231
+ _context7.next = 2;
232
+ return sleep(speed);
233
+ case 2:
234
+ factory.next('processed', {
235
+ withRemotePreview: withRemotePreview
236
+ });
237
+ _context7.next = 5;
238
+ return sleep(speed);
239
+ case 5:
240
+ factory.next('processed', {
241
+ withRemotePreview: withRemotePreview
242
+ });
243
+ _context7.next = 8;
244
+ return sleep(speed);
245
+ case 8:
246
+ factory.next('processed', {
247
+ withRemotePreview: withRemotePreview
248
+ });
249
+ case 9:
250
+ case "end":
251
+ return _context7.stop();
252
+ }
253
+ }, _callee7);
254
+ }));
255
+ function simulation(_x7) {
256
+ return _simulation7.apply(this, arguments);
257
+ }
258
+ return simulation;
259
+ }()
260
+ };
261
+ };
262
+ export var simulateEmptyDetails = function simulateEmptyDetails() {
263
+ return {
264
+ description: 'Incomplete uploads return empty file details and a processing status pending',
265
+ simulation: function () {
266
+ var _simulation8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(factory) {
267
+ var emptyDetails;
268
+ return _regeneratorRuntime.wrap(function _callee8$(_context8) {
269
+ while (1) switch (_context8.prev = _context8.next) {
270
+ case 0:
271
+ emptyDetails = {
272
+ createdAt: 1630986510989
273
+ };
274
+ _context8.next = 3;
275
+ return sleep(speed);
276
+ case 3:
277
+ factory.next('processing', {
278
+ fileDetails: emptyDetails
279
+ });
280
+ case 4:
281
+ case "end":
282
+ return _context8.stop();
283
+ }
284
+ }, _callee8);
285
+ }));
286
+ function simulation(_x8) {
287
+ return _simulation8.apply(this, arguments);
288
+ }
289
+ return simulation;
290
+ }()
291
+ };
292
+ };
293
+ export var simulateUpdateFileId = function simulateUpdateFileId() {
294
+ return {
295
+ description: 'First File Id: video with processing issue. Next File Id: PDF sucessfully processed',
296
+ simulation: function () {
297
+ var _simulation9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(factory, _ref) {
298
+ var updateIdentifier;
299
+ return _regeneratorRuntime.wrap(function _callee9$(_context9) {
300
+ while (1) switch (_context9.prev = _context9.next) {
301
+ case 0:
302
+ updateIdentifier = _ref.updateIdentifier;
303
+ _context9.next = 3;
304
+ return sleep(speed);
305
+ case 3:
306
+ factory.next('failed-processing');
307
+ _context9.next = 6;
308
+ return sleep(speed);
309
+ case 6:
310
+ updateIdentifier('doc');
311
+ _context9.next = 9;
312
+ return sleep(speed);
313
+ case 9:
314
+ factory.next('processing');
315
+ _context9.next = 12;
316
+ return sleep(speed);
317
+ case 12:
318
+ factory.next('processed');
319
+ case 13:
320
+ case "end":
321
+ return _context9.stop();
322
+ }
323
+ }, _callee9);
324
+ }));
325
+ function simulation(_x9, _x10) {
326
+ return _simulation9.apply(this, arguments);
327
+ }
328
+ return simulation;
329
+ }()
330
+ };
331
+ };
332
+ export var simulateAlwaysLoading = function simulateAlwaysLoading() {
333
+ return {
334
+ description: 'File state never fetched',
335
+ simulation: function () {
336
+ var _simulation10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10() {
337
+ return _regeneratorRuntime.wrap(function _callee10$(_context10) {
338
+ while (1) switch (_context10.prev = _context10.next) {
339
+ case 0:
340
+ case "end":
341
+ return _context10.stop();
342
+ }
343
+ }, _callee10);
344
+ }));
345
+ function simulation() {
346
+ return _simulation10.apply(this, arguments);
347
+ }
348
+ return simulation;
349
+ }()
350
+ };
351
+ };
352
+ export var simulateAlwaysProcessing = function simulateAlwaysProcessing() {
353
+ return {
354
+ description: 'File state is permanently processing',
355
+ simulation: function () {
356
+ var _simulation11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(factory) {
357
+ return _regeneratorRuntime.wrap(function _callee11$(_context11) {
358
+ while (1) switch (_context11.prev = _context11.next) {
359
+ case 0:
360
+ _context11.next = 2;
361
+ return sleep(speed);
362
+ case 2:
363
+ factory.next('processing');
364
+ _context11.next = 5;
365
+ return sleep(speed);
366
+ case 5:
367
+ factory.next('processing');
368
+ _context11.next = 8;
369
+ return sleep(speed * 0.5);
370
+ case 8:
371
+ case "end":
372
+ return _context11.stop();
373
+ }
374
+ }, _callee11);
375
+ }));
376
+ function simulation(_x11) {
377
+ return _simulation11.apply(this, arguments);
378
+ }
379
+ return simulation;
380
+ }()
381
+ };
382
+ };
@@ -1,3 +1,5 @@
1
1
  export { FileStateFactory, MediaClientMock } from './factory';
2
- export { createIdentifier, createFileDetails } from './helpers';
3
- export { createFileState } from './createFileState';
2
+ export { createIdentifier, createFileDetails } from './factory';
3
+ export { createFileState } from './factory/createFileState';
4
+ export { useRunSimulation } from './fileSimulation';
5
+ export { simulateProcessed, simulateProcessing, simulateImmediateFailProcessing, simulateUpload, simulateError, simulateErrorState, simulateManyProcessed, simulateEmptyDetails, simulateUpdateFileId, simulateAlwaysLoading, simulateAlwaysProcessing } from './fileSimulation';
@@ -14,29 +14,27 @@ export var getAuthFromContextProvider = /*#__PURE__*/function () {
14
14
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
15
15
  var url, body, headers, response;
16
16
  return _regeneratorRuntime.wrap(function _callee$(_context) {
17
- while (1) {
18
- switch (_context.prev = _context.next) {
19
- case 0:
20
- url = 'https://media-playground.dev.atl-paas.net/token/tenant?environment=asap';
21
- body = JSON.stringify({
22
- access: access
23
- });
24
- headers = new Headers();
25
- headers.append('Content-Type', 'application/json; charset=utf-8');
26
- headers.append('Accept', 'text/plain, */*; q=0.01');
27
- _context.next = 7;
28
- return fetch(url, {
29
- method: 'POST',
30
- body: body,
31
- headers: headers
32
- });
33
- case 7:
34
- response = _context.sent;
35
- return _context.abrupt("return", response.json());
36
- case 9:
37
- case "end":
38
- return _context.stop();
39
- }
17
+ while (1) switch (_context.prev = _context.next) {
18
+ case 0:
19
+ url = 'https://media-playground.dev.atl-paas.net/token/tenant?environment=asap';
20
+ body = JSON.stringify({
21
+ access: access
22
+ });
23
+ headers = new Headers();
24
+ headers.append('Content-Type', 'application/json; charset=utf-8');
25
+ headers.append('Accept', 'text/plain, */*; q=0.01');
26
+ _context.next = 7;
27
+ return fetch(url, {
28
+ method: 'POST',
29
+ body: body,
30
+ headers: headers
31
+ });
32
+ case 7:
33
+ response = _context.sent;
34
+ return _context.abrupt("return", response.json());
35
+ case 9:
36
+ case "end":
37
+ return _context.stop();
40
38
  }
41
39
  }, _callee);
42
40
  }));
package/dist/esm/index.js CHANGED
@@ -37,5 +37,9 @@ export { dataURItoBlob } from './mockData/utils';
37
37
  export { mapDataUriToBlob } from './utils/index';
38
38
  export { createPollingMaxAttemptsError, createRateLimitedError, createMediaStoreError } from './mediaClientErrors';
39
39
  export { default as FeatureFlagsWrapper } from './featureFlagsWrapper';
40
- export { FileStateFactory, MediaClientMock, createIdentifier, createFileDetails, createFileState } from './fileStateFactory';
40
+ export {
41
+ // Simulation tools
42
+ FileStateFactory, MediaClientMock, createIdentifier, createFileDetails, createFileState, useRunSimulation,
43
+ // Predefined simulations
44
+ simulateProcessed, simulateProcessing, simulateImmediateFailProcessing, simulateUpload, simulateError, simulateErrorState, simulateManyProcessed, simulateEmptyDetails, simulateUpdateFileId, simulateAlwaysLoading, simulateAlwaysProcessing } from './fileStateFactory';
41
45
  export { DocsContentTabs } from './docs-content-tabs';
@@ -31,30 +31,28 @@ var requestAuthProvider = /*#__PURE__*/function () {
31
31
  response,
32
32
  _args = arguments;
33
33
  return _regeneratorRuntime.wrap(function _callee$(_context) {
34
- while (1) {
35
- switch (_context.prev = _context.next) {
36
- case 0:
37
- env = _args.length > 2 && _args[2] !== undefined ? _args[2] : 'dev';
38
- url = "https://media-playground.".concat(env, ".atl-paas.net/token/tenant?environment=").concat(authEnvironment);
39
- body = JSON.stringify({
40
- access: accessUrns[collectionName] || {}
41
- });
42
- headers = new Headers();
43
- headers.append('Content-Type', 'application/json; charset=utf-8');
44
- headers.append('Accept', 'text/plain, */*; q=0.01');
45
- _context.next = 8;
46
- return fetch(url, {
47
- method: 'POST',
48
- body: body,
49
- headers: headers
50
- });
51
- case 8:
52
- response = _context.sent;
53
- return _context.abrupt("return", response.json());
54
- case 10:
55
- case "end":
56
- return _context.stop();
57
- }
34
+ while (1) switch (_context.prev = _context.next) {
35
+ case 0:
36
+ env = _args.length > 2 && _args[2] !== undefined ? _args[2] : 'dev';
37
+ url = "https://media-playground.".concat(env, ".atl-paas.net/token/tenant?environment=").concat(authEnvironment);
38
+ body = JSON.stringify({
39
+ access: accessUrns[collectionName] || {}
40
+ });
41
+ headers = new Headers();
42
+ headers.append('Content-Type', 'application/json; charset=utf-8');
43
+ headers.append('Accept', 'text/plain, */*; q=0.01');
44
+ _context.next = 8;
45
+ return fetch(url, {
46
+ method: 'POST',
47
+ body: body,
48
+ headers: headers
49
+ });
50
+ case 8:
51
+ response = _context.sent;
52
+ return _context.abrupt("return", response.json());
53
+ case 10:
54
+ case "end":
55
+ return _context.stop();
58
56
  }
59
57
  }, _callee);
60
58
  }));
@@ -1,6 +1,9 @@
1
1
  import * as uuid from 'uuid';
2
2
  import { getHackerNoun, getPastDate, fakeImage, getFakeFileName, getTextFileType } from '../../utils/mockData';
3
3
  import { mapDataUriToBlob } from '../../utils';
4
+ export var isMediaItemDetails = function isMediaItemDetails(mediaCollectionItem) {
5
+ return !!mediaCollectionItem['mediaType'] && !!mediaCollectionItem['mimeType'] && !!mediaCollectionItem['processingStatus'];
6
+ };
4
7
  export function createEmptyCollectionItem(_ref) {
5
8
  var id = _ref.id,
6
9
  collectionName = _ref.collectionName,
@@ -8,7 +8,7 @@ import { defaultBaseUrl } from '../../mediaClientProvider';
8
8
  import { defaultCollectionName } from '../../collectionNames';
9
9
  import { RECENTS_COLLECTION } from '@atlaskit/media-client/constants';
10
10
  export { createCollection } from './collection';
11
- export { createCollectionItem, createEmptyCollectionItem } from './collection-item';
11
+ export { createCollectionItem, createEmptyCollectionItem, isMediaItemDetails } from './collection-item';
12
12
  export var tenantAuth = {
13
13
  clientId: uuidV4(),
14
14
  token: 'some-tenant-token',