@atlaskit/media-client 25.1.0 → 26.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 (31) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/cjs/client/media-store/MediaStore.js +0 -22
  3. package/dist/cjs/test-helpers/MockedMediaApi/MockedMediaApi.js +101 -118
  4. package/dist/cjs/test-helpers/MockedMediaApi/helpers.js +2 -2
  5. package/dist/cjs/uploader/index.js +36 -72
  6. package/dist/es2019/client/media-store/MediaStore.js +0 -21
  7. package/dist/es2019/test-helpers/MockedMediaApi/MockedMediaApi.js +13 -16
  8. package/dist/es2019/test-helpers/MockedMediaApi/helpers.js +2 -2
  9. package/dist/es2019/uploader/index.js +0 -7
  10. package/dist/esm/client/media-store/MediaStore.js +0 -22
  11. package/dist/esm/test-helpers/MockedMediaApi/MockedMediaApi.js +101 -118
  12. package/dist/esm/test-helpers/MockedMediaApi/helpers.js +2 -2
  13. package/dist/esm/uploader/index.js +36 -72
  14. package/dist/types/client/media-store/MediaStore.d.ts +1 -2
  15. package/dist/types/client/media-store/types.d.ts +1 -2
  16. package/dist/types/index.d.ts +2 -2
  17. package/dist/types/models/media.d.ts +0 -7
  18. package/dist/types/test-helpers/MockedMediaApi/MockedMediaApi.d.ts +5 -5
  19. package/dist/types/test-helpers/MockedMediaApi/helpers.d.ts +1 -1
  20. package/dist/types/test-helpers/MockedMediaApi/index.d.ts +1 -1
  21. package/dist/types/test-helpers/index.d.ts +1 -1
  22. package/dist/types-ts4.5/client/media-store/MediaStore.d.ts +1 -2
  23. package/dist/types-ts4.5/client/media-store/types.d.ts +1 -2
  24. package/dist/types-ts4.5/index.d.ts +2 -2
  25. package/dist/types-ts4.5/models/media.d.ts +0 -7
  26. package/dist/types-ts4.5/test-helpers/MockedMediaApi/MockedMediaApi.d.ts +5 -5
  27. package/dist/types-ts4.5/test-helpers/MockedMediaApi/helpers.d.ts +1 -1
  28. package/dist/types-ts4.5/test-helpers/MockedMediaApi/index.d.ts +1 -1
  29. package/dist/types-ts4.5/test-helpers/index.d.ts +1 -1
  30. package/package.json +3 -3
  31. package/tmp/api-report-tmp.d.ts +0 -1199
@@ -2,7 +2,7 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _regeneratorRuntime from "@babel/runtime/regenerator";
3
3
  import { getMediaFile, normaliseInput } from './helpers';
4
4
  var getMediaApi = function getMediaApi(_ref) {
5
- var getFileItem = _ref.getFileItem;
5
+ var getItem = _ref.getItem;
6
6
  return {
7
7
  // --------------------------------------------------------
8
8
  // UPLOAD ENDPOINTS - None is supported
@@ -27,51 +27,34 @@ var getMediaApi = function getMediaApi(_ref) {
27
27
  }
28
28
  return touchFiles;
29
29
  }(),
30
- probeChunks: function () {
31
- var _probeChunks = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
30
+ uploadChunk: function () {
31
+ var _uploadChunk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_etag, _blob, uploadId) {
32
32
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
33
33
  while (1) switch (_context2.prev = _context2.next) {
34
34
  case 0:
35
- throw new Error('500 - MockedMediaApi.probeChunks: method not implemented');
35
+ throw new Error('500 - MockedMediaApi.uploadChunk: method not implemented');
36
36
  case 1:
37
37
  case "end":
38
38
  return _context2.stop();
39
39
  }
40
40
  }, _callee2);
41
41
  }));
42
- function probeChunks() {
43
- return _probeChunks.apply(this, arguments);
44
- }
45
- return probeChunks;
46
- }(),
47
- uploadChunk: function () {
48
- var _uploadChunk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_etag, _blob, uploadId) {
49
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
50
- while (1) switch (_context3.prev = _context3.next) {
51
- case 0:
52
- throw new Error('500 - MockedMediaApi.uploadChunk: method not implemented');
53
- case 1:
54
- case "end":
55
- return _context3.stop();
56
- }
57
- }, _callee3);
58
- }));
59
42
  function uploadChunk(_x2, _x3, _x4) {
60
43
  return _uploadChunk.apply(this, arguments);
61
44
  }
62
45
  return uploadChunk;
63
46
  }(),
64
47
  appendChunksToUpload: function () {
65
- var _appendChunksToUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
66
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
67
- while (1) switch (_context4.prev = _context4.next) {
48
+ var _appendChunksToUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
49
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
50
+ while (1) switch (_context3.prev = _context3.next) {
68
51
  case 0:
69
52
  throw new Error('500 - MockedMediaApi.appendChunksToUpload: method not implemented');
70
53
  case 1:
71
54
  case "end":
72
- return _context4.stop();
55
+ return _context3.stop();
73
56
  }
74
- }, _callee4);
57
+ }, _callee3);
75
58
  }));
76
59
  function appendChunksToUpload() {
77
60
  return _appendChunksToUpload.apply(this, arguments);
@@ -79,19 +62,19 @@ var getMediaApi = function getMediaApi(_ref) {
79
62
  return appendChunksToUpload;
80
63
  }(),
81
64
  createFileFromUpload: function () {
82
- var _createFileFromUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref3, _ref4) {
65
+ var _createFileFromUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref3, _ref4) {
83
66
  var uploadId, collection;
84
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
85
- while (1) switch (_context5.prev = _context5.next) {
67
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
68
+ while (1) switch (_context4.prev = _context4.next) {
86
69
  case 0:
87
70
  uploadId = _ref3.uploadId;
88
71
  collection = _ref4.collection;
89
72
  throw new Error('500 - MockedMediaApi.createFileFromUpload: method not implemented');
90
73
  case 3:
91
74
  case "end":
92
- return _context5.stop();
75
+ return _context4.stop();
93
76
  }
94
- }, _callee5);
77
+ }, _callee4);
95
78
  }));
96
79
  function createFileFromUpload(_x5, _x6) {
97
80
  return _createFileFromUpload.apply(this, arguments);
@@ -100,16 +83,16 @@ var getMediaApi = function getMediaApi(_ref) {
100
83
  }(),
101
84
  // Used by Media Picker as a fallback for conflicted file Ids
102
85
  createUpload: function () {
103
- var _createUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
104
- return _regeneratorRuntime.wrap(function _callee6$(_context6) {
105
- while (1) switch (_context6.prev = _context6.next) {
86
+ var _createUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
87
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
88
+ while (1) switch (_context5.prev = _context5.next) {
106
89
  case 0:
107
90
  throw new Error('500 - MockedMediaApi.createUpload: method not implemented');
108
91
  case 1:
109
92
  case "end":
110
- return _context6.stop();
93
+ return _context5.stop();
111
94
  }
112
- }, _callee6);
95
+ }, _callee5);
113
96
  }));
114
97
  function createUpload() {
115
98
  return _createUpload.apply(this, arguments);
@@ -125,26 +108,26 @@ var getMediaApi = function getMediaApi(_ref) {
125
108
  // --------------------------------------------------------
126
109
 
127
110
  getFile: function () {
128
- var _getFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(fileId) {
111
+ var _getFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(fileId) {
129
112
  var fileItem;
130
- return _regeneratorRuntime.wrap(function _callee7$(_context7) {
131
- while (1) switch (_context7.prev = _context7.next) {
113
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
114
+ while (1) switch (_context6.prev = _context6.next) {
132
115
  case 0:
133
- fileItem = getFileItem(fileId);
116
+ fileItem = getItem(fileId);
134
117
  if (fileItem) {
135
- _context7.next = 3;
118
+ _context6.next = 3;
136
119
  break;
137
120
  }
138
121
  throw new Error('404 - MockedMediaApi.getFile: file not found');
139
122
  case 3:
140
- return _context7.abrupt("return", {
123
+ return _context6.abrupt("return", {
141
124
  data: getMediaFile(fileItem)
142
125
  });
143
126
  case 4:
144
127
  case "end":
145
- return _context7.stop();
128
+ return _context6.stop();
146
129
  }
147
- }, _callee7);
130
+ }, _callee6);
148
131
  }));
149
132
  function getFile(_x7) {
150
133
  return _getFile.apply(this, arguments);
@@ -152,26 +135,26 @@ var getMediaApi = function getMediaApi(_ref) {
152
135
  return getFile;
153
136
  }(),
154
137
  getItems: function () {
155
- var _getItems = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(ids) {
138
+ var _getItems = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(ids) {
156
139
  var items;
157
- return _regeneratorRuntime.wrap(function _callee8$(_context8) {
158
- while (1) switch (_context8.prev = _context8.next) {
140
+ return _regeneratorRuntime.wrap(function _callee7$(_context7) {
141
+ while (1) switch (_context7.prev = _context7.next) {
159
142
  case 0:
160
143
  items = ids.map(function (id) {
161
- return getFileItem(id);
144
+ return getItem(id);
162
145
  }).filter(function (fileState) {
163
146
  return !!fileState;
164
147
  });
165
- return _context8.abrupt("return", {
148
+ return _context7.abrupt("return", {
166
149
  data: {
167
150
  items: items
168
151
  }
169
152
  });
170
153
  case 2:
171
154
  case "end":
172
- return _context8.stop();
155
+ return _context7.stop();
173
156
  }
174
- }, _callee8);
157
+ }, _callee7);
175
158
  }));
176
159
  function getItems(_x8) {
177
160
  return _getItems.apply(this, arguments);
@@ -180,16 +163,16 @@ var getMediaApi = function getMediaApi(_ref) {
180
163
  }(),
181
164
  // TODO
182
165
  getImageMetadata: function () {
183
- var _getImageMetadata = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
184
- return _regeneratorRuntime.wrap(function _callee9$(_context9) {
185
- while (1) switch (_context9.prev = _context9.next) {
166
+ var _getImageMetadata = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
167
+ return _regeneratorRuntime.wrap(function _callee8$(_context8) {
168
+ while (1) switch (_context8.prev = _context8.next) {
186
169
  case 0:
187
170
  throw new Error('500 - MockedMediaApi.getImageMetadata: method not implemented');
188
171
  case 1:
189
172
  case "end":
190
- return _context9.stop();
173
+ return _context8.stop();
191
174
  }
192
- }, _callee9);
175
+ }, _callee8);
193
176
  }));
194
177
  function getImageMetadata() {
195
178
  return _getImageMetadata.apply(this, arguments);
@@ -202,16 +185,16 @@ var getMediaApi = function getMediaApi(_ref) {
202
185
 
203
186
  // TODO
204
187
  getFileImageURL: function () {
205
- var _getFileImageURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10() {
206
- return _regeneratorRuntime.wrap(function _callee10$(_context10) {
207
- while (1) switch (_context10.prev = _context10.next) {
188
+ var _getFileImageURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
189
+ return _regeneratorRuntime.wrap(function _callee9$(_context9) {
190
+ while (1) switch (_context9.prev = _context9.next) {
208
191
  case 0:
209
192
  throw new Error('500 - MockedMediaApi.getFileImageURL: method not implemented');
210
193
  case 1:
211
194
  case "end":
212
- return _context10.stop();
195
+ return _context9.stop();
213
196
  }
214
- }, _callee10);
197
+ }, _callee9);
215
198
  }));
216
199
  function getFileImageURL() {
217
200
  return _getFileImageURL.apply(this, arguments);
@@ -223,30 +206,30 @@ var getMediaApi = function getMediaApi(_ref) {
223
206
  throw new Error('500 - MockedMediaApi.getFileImageURLSync: method not implemented');
224
207
  },
225
208
  getFileBinaryURL: function () {
226
- var _getFileBinaryURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(id) {
209
+ var _getFileBinaryURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(id) {
227
210
  var fileItem;
228
- return _regeneratorRuntime.wrap(function _callee11$(_context11) {
229
- while (1) switch (_context11.prev = _context11.next) {
211
+ return _regeneratorRuntime.wrap(function _callee10$(_context10) {
212
+ while (1) switch (_context10.prev = _context10.next) {
230
213
  case 0:
231
- fileItem = getFileItem(id);
214
+ fileItem = getItem(id);
232
215
  if (fileItem) {
233
- _context11.next = 3;
216
+ _context10.next = 3;
234
217
  break;
235
218
  }
236
219
  throw new Error('404 - MockedMediaApi.getFileBinaryURL: file not found');
237
220
  case 3:
238
221
  if (!(fileItem.details.size === 0)) {
239
- _context11.next = 5;
222
+ _context10.next = 5;
240
223
  break;
241
224
  }
242
225
  throw new Error('404 - MockedMediaApi.getFileBinaryURL: file is empty');
243
226
  case 5:
244
- return _context11.abrupt("return", "/file/".concat(id, "/binary"));
227
+ return _context10.abrupt("return", "/file/".concat(id, "/binary"));
245
228
  case 6:
246
229
  case "end":
247
- return _context11.stop();
230
+ return _context10.stop();
248
231
  }
249
- }, _callee11);
232
+ }, _callee10);
250
233
  }));
251
234
  function getFileBinaryURL(_x9) {
252
235
  return _getFileBinaryURL.apply(this, arguments);
@@ -254,25 +237,25 @@ var getMediaApi = function getMediaApi(_ref) {
254
237
  return getFileBinaryURL;
255
238
  }(),
256
239
  getArtifactURL: function () {
257
- var _getArtifactURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(artifacts, artifactName) {
240
+ var _getArtifactURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(artifacts, artifactName) {
258
241
  var _artifacts$artifactNa;
259
242
  var artifactUrl;
260
- return _regeneratorRuntime.wrap(function _callee12$(_context12) {
261
- while (1) switch (_context12.prev = _context12.next) {
243
+ return _regeneratorRuntime.wrap(function _callee11$(_context11) {
244
+ while (1) switch (_context11.prev = _context11.next) {
262
245
  case 0:
263
246
  artifactUrl = (_artifacts$artifactNa = artifacts[artifactName]) === null || _artifacts$artifactNa === void 0 ? void 0 : _artifacts$artifactNa.url;
264
247
  if (artifactUrl) {
265
- _context12.next = 3;
248
+ _context11.next = 3;
266
249
  break;
267
250
  }
268
251
  throw new Error("404 - MockedMediaApi.getArtifactURL: artifact ".concat(artifactName, " not found"));
269
252
  case 3:
270
- return _context12.abrupt("return", artifactUrl);
253
+ return _context11.abrupt("return", artifactUrl);
271
254
  case 4:
272
255
  case "end":
273
- return _context12.stop();
256
+ return _context11.stop();
274
257
  }
275
- }, _callee12);
258
+ }, _callee11);
276
259
  }));
277
260
  function getArtifactURL(_x10, _x11) {
278
261
  return _getArtifactURL.apply(this, arguments);
@@ -283,30 +266,30 @@ var getMediaApi = function getMediaApi(_ref) {
283
266
  // BINARY ENDPOINTS
284
267
  // --------------------------------------------------------
285
268
  getImage: function () {
286
- var _getImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(fileId) {
269
+ var _getImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(fileId) {
287
270
  var fileItem;
288
- return _regeneratorRuntime.wrap(function _callee13$(_context13) {
289
- while (1) switch (_context13.prev = _context13.next) {
271
+ return _regeneratorRuntime.wrap(function _callee12$(_context12) {
272
+ while (1) switch (_context12.prev = _context12.next) {
290
273
  case 0:
291
- fileItem = getFileItem(fileId);
274
+ fileItem = getItem(fileId);
292
275
  if (fileItem) {
293
- _context13.next = 3;
276
+ _context12.next = 3;
294
277
  break;
295
278
  }
296
279
  throw new Error('404 - MockedMediaApi.getImage: file not found');
297
280
  case 3:
298
281
  if (fileItem.details.representations.image) {
299
- _context13.next = 5;
282
+ _context12.next = 5;
300
283
  break;
301
284
  }
302
285
  throw new Error('404 - MockedMediaApi.getImage: image not found');
303
286
  case 5:
304
- return _context13.abrupt("return", new Blob());
287
+ return _context12.abrupt("return", new Blob());
305
288
  case 6:
306
289
  case "end":
307
- return _context13.stop();
290
+ return _context12.stop();
308
291
  }
309
- }, _callee13);
292
+ }, _callee12);
310
293
  }));
311
294
  function getImage(_x12) {
312
295
  return _getImage.apply(this, arguments);
@@ -319,27 +302,27 @@ var getMediaApi = function getMediaApi(_ref) {
319
302
 
320
303
  // TODO
321
304
  copyFileWithToken: function () {
322
- var _copyFileWithToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(body) {
305
+ var _copyFileWithToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(body) {
323
306
  var fileId, fileItem;
324
- return _regeneratorRuntime.wrap(function _callee14$(_context14) {
325
- while (1) switch (_context14.prev = _context14.next) {
307
+ return _regeneratorRuntime.wrap(function _callee13$(_context13) {
308
+ while (1) switch (_context13.prev = _context13.next) {
326
309
  case 0:
327
310
  fileId = body.sourceFile.id;
328
- fileItem = getFileItem(fileId);
311
+ fileItem = getItem(fileId);
329
312
  if (fileItem) {
330
- _context14.next = 4;
313
+ _context13.next = 4;
331
314
  break;
332
315
  }
333
316
  throw new Error('404 - MockedMediaApi.copyFileWithToken: file not found');
334
317
  case 4:
335
- return _context14.abrupt("return", {
318
+ return _context13.abrupt("return", {
336
319
  data: getMediaFile(fileItem)
337
320
  });
338
321
  case 5:
339
322
  case "end":
340
- return _context14.stop();
323
+ return _context13.stop();
341
324
  }
342
- }, _callee14);
325
+ }, _callee13);
343
326
  }));
344
327
  function copyFileWithToken(_x13) {
345
328
  return _copyFileWithToken.apply(this, arguments);
@@ -348,14 +331,14 @@ var getMediaApi = function getMediaApi(_ref) {
348
331
  }(),
349
332
  // TODO
350
333
  removeCollectionFile: function () {
351
- var _removeCollectionFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15() {
352
- return _regeneratorRuntime.wrap(function _callee15$(_context15) {
353
- while (1) switch (_context15.prev = _context15.next) {
334
+ var _removeCollectionFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
335
+ return _regeneratorRuntime.wrap(function _callee14$(_context14) {
336
+ while (1) switch (_context14.prev = _context14.next) {
354
337
  case 0:
355
338
  case "end":
356
- return _context15.stop();
339
+ return _context14.stop();
357
340
  }
358
- }, _callee15);
341
+ }, _callee14);
359
342
  }));
360
343
  function removeCollectionFile() {
361
344
  return _removeCollectionFile.apply(this, arguments);
@@ -366,16 +349,16 @@ var getMediaApi = function getMediaApi(_ref) {
366
349
  // OTHER ENDPOINTS
367
350
  // --------------------------------------------------------
368
351
  request: function () {
369
- var _request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16() {
370
- return _regeneratorRuntime.wrap(function _callee16$(_context16) {
371
- while (1) switch (_context16.prev = _context16.next) {
352
+ var _request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15() {
353
+ return _regeneratorRuntime.wrap(function _callee15$(_context15) {
354
+ while (1) switch (_context15.prev = _context15.next) {
372
355
  case 0:
373
- return _context16.abrupt("return", new Response());
356
+ return _context15.abrupt("return", new Response());
374
357
  case 1:
375
358
  case "end":
376
- return _context16.stop();
359
+ return _context15.stop();
377
360
  }
378
- }, _callee16);
361
+ }, _callee15);
379
362
  }));
380
363
  function request() {
381
364
  return _request.apply(this, arguments);
@@ -383,20 +366,20 @@ var getMediaApi = function getMediaApi(_ref) {
383
366
  return request;
384
367
  }(),
385
368
  resolveAuth: function () {
386
- var _resolveAuth = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17() {
387
- return _regeneratorRuntime.wrap(function _callee17$(_context17) {
388
- while (1) switch (_context17.prev = _context17.next) {
369
+ var _resolveAuth = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16() {
370
+ return _regeneratorRuntime.wrap(function _callee16$(_context16) {
371
+ while (1) switch (_context16.prev = _context16.next) {
389
372
  case 0:
390
- return _context17.abrupt("return", {
373
+ return _context16.abrupt("return", {
391
374
  asapIssuer: '',
392
375
  token: '',
393
376
  baseUrl: ''
394
377
  });
395
378
  case 1:
396
379
  case "end":
397
- return _context17.stop();
380
+ return _context16.stop();
398
381
  }
399
- }, _callee17);
382
+ }, _callee16);
400
383
  }));
401
384
  function resolveAuth() {
402
385
  return _resolveAuth.apply(this, arguments);
@@ -418,25 +401,25 @@ var getMediaApi = function getMediaApi(_ref) {
418
401
  */
419
402
  export var createMockedMediaApi = function createMockedMediaApi(initialFileItems) {
420
403
  var storedFileItems = new Map();
421
- var getFileItem = function getFileItem(fileId) {
404
+ var getItem = function getItem(fileId) {
422
405
  return storedFileItems.get(fileId);
423
406
  };
424
- var setFileItems = function setFileItems(fileItems) {
407
+ var setItems = function setItems(fileItems) {
425
408
  var normalised = normaliseInput(fileItems);
426
409
  normalised.forEach(function (fileItem) {
427
410
  return storedFileItems.set(fileItem.id, fileItem);
428
411
  });
429
412
  };
430
413
  if (initialFileItems) {
431
- setFileItems(initialFileItems);
414
+ setItems(initialFileItems);
432
415
  }
433
416
  var mediaApi = getMediaApi({
434
- setFileItems: setFileItems,
435
- getFileItem: getFileItem
417
+ setItems: setItems,
418
+ getItem: getItem
436
419
  });
437
420
  return {
438
- setFileItems: setFileItems,
439
- getFileItem: getFileItem,
421
+ setItems: setItems,
422
+ getItem: getItem,
440
423
  mediaApi: mediaApi
441
424
  };
442
425
  };
@@ -138,7 +138,7 @@ export var createFileState = function createFileState(_ref3) {
138
138
  representations: representations
139
139
  };
140
140
  };
141
- export var createUploadingFileState = function createUploadingFileState(_ref4, progress) {
141
+ export var createUploadingFileState = function createUploadingFileState(_ref4, progress, binary) {
142
142
  var id = _ref4.id,
143
143
  _ref4$details = _ref4.details,
144
144
  name = _ref4$details.name,
@@ -156,7 +156,7 @@ export var createUploadingFileState = function createUploadingFileState(_ref4, p
156
156
  mimeType: mimeType,
157
157
  createdAt: createdAt,
158
158
  preview: {
159
- value: new Blob(['some-content'], {
159
+ value: binary || new Blob(['some-content'], {
160
160
  type: mimeType
161
161
  })
162
162
  }