@atlaskit/media-test-helpers 33.0.25 → 33.0.26
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.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/media-test-helpers
|
|
2
2
|
|
|
3
|
+
## 33.0.26
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#60352](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/60352) [`ff9488b450dd`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ff9488b450dd) - WHAT: Media has removed the ability to probe for existing file chunks.
|
|
8
|
+
WHY: This is to support the work to deprecate SHA1 usage and make the Media Platform comply with FedRAMP moderate controls.
|
|
9
|
+
HOW: Remove any calls you have directly to probing, instead upload all files directly. If you upload files via MediaPicker no changes are required.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 33.0.25
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -246,84 +246,8 @@ function createApiRouter(isSlowServer, urlsReturnErrorsTo) {
|
|
|
246
246
|
});
|
|
247
247
|
return new _kakapo.KakapoResponse(201, undefined, {});
|
|
248
248
|
});
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
* Otherwise it recursively calls itself with a 10ms timeout until it is false.*/
|
|
252
|
-
function awaitUpload(_x3) {
|
|
253
|
-
return _awaitUpload.apply(this, arguments);
|
|
254
|
-
}
|
|
255
|
-
function _awaitUpload() {
|
|
256
|
-
_awaitUpload = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(resolver) {
|
|
257
|
-
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
258
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
259
|
-
case 0:
|
|
260
|
-
return _context3.abrupt("return", new Promise(function (resolve) {
|
|
261
|
-
if (window.mediaMockControlsBackdoor.shouldWaitUpload) {
|
|
262
|
-
setTimeout(function () {
|
|
263
|
-
return awaitUpload(resolver || resolve);
|
|
264
|
-
}, 10);
|
|
265
|
-
return;
|
|
266
|
-
}
|
|
267
|
-
if (resolver && !window.mediaMockControlsBackdoor.shouldWaitUpload) {
|
|
268
|
-
resolver();
|
|
269
|
-
}
|
|
270
|
-
resolve();
|
|
271
|
-
}));
|
|
272
|
-
case 1:
|
|
273
|
-
case "end":
|
|
274
|
-
return _context3.stop();
|
|
275
|
-
}
|
|
276
|
-
}, _callee3);
|
|
277
|
-
}));
|
|
278
|
-
return _awaitUpload.apply(this, arguments);
|
|
279
|
-
}
|
|
280
|
-
router.post('/chunk/probe', /*#__PURE__*/function () {
|
|
281
|
-
var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(_ref9, database) {
|
|
282
|
-
var body, _JSON$parse2, chunks, allChunks, existingChunks, nonExistingChunks;
|
|
283
|
-
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
284
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
285
|
-
case 0:
|
|
286
|
-
body = _ref9.body;
|
|
287
|
-
_JSON$parse2 = JSON.parse(body), chunks = _JSON$parse2.chunks;
|
|
288
|
-
allChunks = database.all('chunk');
|
|
289
|
-
existingChunks = [];
|
|
290
|
-
nonExistingChunks = [];
|
|
291
|
-
allChunks.forEach(function (_ref11) {
|
|
292
|
-
var id = _ref11.data.id;
|
|
293
|
-
if (chunks.indexOf(id) > -1) {
|
|
294
|
-
existingChunks.push(id);
|
|
295
|
-
} else {
|
|
296
|
-
nonExistingChunks.push(id);
|
|
297
|
-
}
|
|
298
|
-
});
|
|
299
|
-
_context2.next = 8;
|
|
300
|
-
return awaitUpload();
|
|
301
|
-
case 8:
|
|
302
|
-
return _context2.abrupt("return", {
|
|
303
|
-
data: {
|
|
304
|
-
results: [].concat((0, _toConsumableArray2.default)(existingChunks.map(function () {
|
|
305
|
-
return {
|
|
306
|
-
exists: true
|
|
307
|
-
};
|
|
308
|
-
})), (0, _toConsumableArray2.default)(nonExistingChunks.map(function () {
|
|
309
|
-
return {
|
|
310
|
-
exists: false
|
|
311
|
-
};
|
|
312
|
-
})))
|
|
313
|
-
}
|
|
314
|
-
});
|
|
315
|
-
case 9:
|
|
316
|
-
case "end":
|
|
317
|
-
return _context2.stop();
|
|
318
|
-
}
|
|
319
|
-
}, _callee2);
|
|
320
|
-
}));
|
|
321
|
-
return function (_x4, _x5) {
|
|
322
|
-
return _ref10.apply(this, arguments);
|
|
323
|
-
};
|
|
324
|
-
}());
|
|
325
|
-
router.post('/upload', function (_ref12, database) {
|
|
326
|
-
var query = _ref12.query;
|
|
249
|
+
router.post('/upload', function (_ref9, database) {
|
|
250
|
+
var query = _ref9.query;
|
|
327
251
|
var _query$createUpTo = query.createUpTo,
|
|
328
252
|
createUpTo = _query$createUpTo === void 0 ? '1' : _query$createUpTo;
|
|
329
253
|
var records = database.create('upload', Number.parseInt(createUpTo, 10));
|
|
@@ -334,12 +258,12 @@ function createApiRouter(isSlowServer, urlsReturnErrorsTo) {
|
|
|
334
258
|
data: data
|
|
335
259
|
};
|
|
336
260
|
});
|
|
337
|
-
router.put('/upload/:uploadId/chunks', function (
|
|
338
|
-
var params =
|
|
339
|
-
body =
|
|
261
|
+
router.put('/upload/:uploadId/chunks', function (_ref10, database) {
|
|
262
|
+
var params = _ref10.params,
|
|
263
|
+
body = _ref10.body;
|
|
340
264
|
var uploadId = params.uploadId;
|
|
341
|
-
var _JSON$
|
|
342
|
-
chunks = _JSON$
|
|
265
|
+
var _JSON$parse2 = JSON.parse(body),
|
|
266
|
+
chunks = _JSON$parse2.chunks;
|
|
343
267
|
var record = database.findOne('upload', {
|
|
344
268
|
id: uploadId
|
|
345
269
|
});
|
|
@@ -352,8 +276,8 @@ function createApiRouter(isSlowServer, urlsReturnErrorsTo) {
|
|
|
352
276
|
return new _kakapo.KakapoResponse(404, undefined, {});
|
|
353
277
|
}
|
|
354
278
|
});
|
|
355
|
-
router.post('/file', function (
|
|
356
|
-
var query =
|
|
279
|
+
router.post('/file', function (_ref11, database) {
|
|
280
|
+
var query = _ref11.query;
|
|
357
281
|
var collection = query.collection;
|
|
358
282
|
var item = (0, _database.createCollectionItem)({
|
|
359
283
|
collectionName: collection
|
|
@@ -366,15 +290,15 @@ function createApiRouter(isSlowServer, urlsReturnErrorsTo) {
|
|
|
366
290
|
}
|
|
367
291
|
}, {});
|
|
368
292
|
});
|
|
369
|
-
router.post('/file/upload', function (
|
|
370
|
-
var query =
|
|
371
|
-
body =
|
|
293
|
+
router.post('/file/upload', function (_ref12, database) {
|
|
294
|
+
var query = _ref12.query,
|
|
295
|
+
body = _ref12.body;
|
|
372
296
|
var collection = query.collection,
|
|
373
297
|
replaceFileId = query.replaceFileId;
|
|
374
|
-
var _JSON$
|
|
375
|
-
name = _JSON$
|
|
376
|
-
mimeType = _JSON$
|
|
377
|
-
uploadId = _JSON$
|
|
298
|
+
var _JSON$parse3 = JSON.parse(body),
|
|
299
|
+
name = _JSON$parse3.name,
|
|
300
|
+
mimeType = _JSON$parse3.mimeType,
|
|
301
|
+
uploadId = _JSON$parse3.uploadId;
|
|
378
302
|
var uploadRecord = database.findOne('upload', {
|
|
379
303
|
id: uploadId
|
|
380
304
|
});
|
|
@@ -428,9 +352,9 @@ function createApiRouter(isSlowServer, urlsReturnErrorsTo) {
|
|
|
428
352
|
})
|
|
429
353
|
};
|
|
430
354
|
});
|
|
431
|
-
router.get('/file/:fileId', function (
|
|
432
|
-
var params =
|
|
433
|
-
query =
|
|
355
|
+
router.get('/file/:fileId', function (_ref13, database) {
|
|
356
|
+
var params = _ref13.params,
|
|
357
|
+
query = _ref13.query;
|
|
434
358
|
var fileId = params.fileId;
|
|
435
359
|
var collection = query.collection;
|
|
436
360
|
var record = database.findOne('collectionItem', {
|
|
@@ -447,10 +371,10 @@ function createApiRouter(isSlowServer, urlsReturnErrorsTo) {
|
|
|
447
371
|
return new _kakapo.KakapoResponse(404, undefined, {});
|
|
448
372
|
}
|
|
449
373
|
});
|
|
450
|
-
router.post('/items', function (
|
|
451
|
-
var body =
|
|
452
|
-
var
|
|
453
|
-
descriptors =
|
|
374
|
+
router.post('/items', function (_ref14, database) {
|
|
375
|
+
var body = _ref14.body;
|
|
376
|
+
var _ref15 = JSON.parse(body),
|
|
377
|
+
descriptors = _ref15.descriptors;
|
|
454
378
|
var fileItems = descriptors.map(function (descriptor) {
|
|
455
379
|
var record = database.findOne('collectionItem', {
|
|
456
380
|
id: descriptor.id
|
|
@@ -478,8 +402,8 @@ function createApiRouter(isSlowServer, urlsReturnErrorsTo) {
|
|
|
478
402
|
router.post('/file/copy/withToken', function (request, database) {
|
|
479
403
|
var body = request.body,
|
|
480
404
|
query = request.query;
|
|
481
|
-
var _JSON$
|
|
482
|
-
sourceFile = _JSON$
|
|
405
|
+
var _JSON$parse4 = JSON.parse(body),
|
|
406
|
+
sourceFile = _JSON$parse4.sourceFile;
|
|
483
407
|
var destinationCollection = query.collection,
|
|
484
408
|
replaceFileId = query.replaceFileId,
|
|
485
409
|
occurrenceKey = query.occurrenceKey;
|
|
@@ -510,19 +434,19 @@ function createApiRouter(isSlowServer, urlsReturnErrorsTo) {
|
|
|
510
434
|
id = _sourceRecord$data.id,
|
|
511
435
|
details = _sourceRecord$data.details,
|
|
512
436
|
blob = _sourceRecord$data.blob;
|
|
513
|
-
var
|
|
514
|
-
|
|
515
|
-
name =
|
|
516
|
-
|
|
517
|
-
size =
|
|
518
|
-
|
|
519
|
-
mediaType =
|
|
520
|
-
|
|
521
|
-
mimeType =
|
|
522
|
-
|
|
523
|
-
processingStatus =
|
|
524
|
-
|
|
525
|
-
artifacts =
|
|
437
|
+
var _ref16 = (0, _database.isMediaItemDetails)(details) ? details : {},
|
|
438
|
+
_ref16$name = _ref16.name,
|
|
439
|
+
name = _ref16$name === void 0 ? (0, _mockData.getFakeFileName)(extension) : _ref16$name,
|
|
440
|
+
_ref16$size = _ref16.size,
|
|
441
|
+
size = _ref16$size === void 0 ? blob && blob.size || 0 : _ref16$size,
|
|
442
|
+
_ref16$mediaType = _ref16.mediaType,
|
|
443
|
+
mediaType = _ref16$mediaType === void 0 ? 'image' : _ref16$mediaType,
|
|
444
|
+
_ref16$mimeType = _ref16.mimeType,
|
|
445
|
+
mimeType = _ref16$mimeType === void 0 ? 'image/jpeg' : _ref16$mimeType,
|
|
446
|
+
_ref16$processingStat = _ref16.processingStatus,
|
|
447
|
+
processingStatus = _ref16$processingStat === void 0 ? 'succeeded' : _ref16$processingStat,
|
|
448
|
+
_ref16$artifacts = _ref16.artifacts,
|
|
449
|
+
artifacts = _ref16$artifacts === void 0 ? {
|
|
526
450
|
'thumb_320.jpg': {
|
|
527
451
|
url: "/file/".concat(id, "/artifact/thumb_320.jpg/binary"),
|
|
528
452
|
processingStatus: 'succeeded'
|
|
@@ -547,13 +471,13 @@ function createApiRouter(isSlowServer, urlsReturnErrorsTo) {
|
|
|
547
471
|
url: "/file/".concat(id, "/artifact/image.jpg/binary"),
|
|
548
472
|
processingStatus: 'succeeded'
|
|
549
473
|
}
|
|
550
|
-
} :
|
|
551
|
-
|
|
552
|
-
representations =
|
|
474
|
+
} : _ref16$artifacts,
|
|
475
|
+
_ref16$representation = _ref16.representations,
|
|
476
|
+
representations = _ref16$representation === void 0 ? {
|
|
553
477
|
image: {}
|
|
554
|
-
} :
|
|
555
|
-
|
|
556
|
-
createdAt =
|
|
478
|
+
} : _ref16$representation,
|
|
479
|
+
_ref16$createdAt = _ref16.createdAt,
|
|
480
|
+
createdAt = _ref16$createdAt === void 0 ? -1 : _ref16$createdAt;
|
|
557
481
|
database.update('collectionItem', existingRecord.id, {
|
|
558
482
|
id: replaceFileId,
|
|
559
483
|
insertedAt: sourceRecord.data.insertedAt,
|
|
@@ -579,8 +503,8 @@ function createApiRouter(isSlowServer, urlsReturnErrorsTo) {
|
|
|
579
503
|
return new _kakapo.KakapoResponse(404, undefined, {});
|
|
580
504
|
}
|
|
581
505
|
});
|
|
582
|
-
router.post('/upload/createWithFiles', function (
|
|
583
|
-
var body =
|
|
506
|
+
router.post('/upload/createWithFiles', function (_ref17, database) {
|
|
507
|
+
var body = _ref17.body;
|
|
584
508
|
var bodyJson = JSON.parse(body);
|
|
585
509
|
var descriptors = bodyJson.descriptors;
|
|
586
510
|
var created = descriptors.map(function (descriptor) {
|
|
@@ -219,52 +219,6 @@ export function createApiRouter(isSlowServer, urlsReturnErrorsTo) {
|
|
|
219
219
|
});
|
|
220
220
|
return new KakapoResponse(201, undefined, {});
|
|
221
221
|
});
|
|
222
|
-
|
|
223
|
-
/** This function waits for shouldWaitUpload to be false before it resolves the promise.
|
|
224
|
-
* Otherwise it recursively calls itself with a 10ms timeout until it is false.*/
|
|
225
|
-
async function awaitUpload(resolver) {
|
|
226
|
-
return new Promise(resolve => {
|
|
227
|
-
if (window.mediaMockControlsBackdoor.shouldWaitUpload) {
|
|
228
|
-
setTimeout(() => awaitUpload(resolver || resolve), 10);
|
|
229
|
-
return;
|
|
230
|
-
}
|
|
231
|
-
if (resolver && !window.mediaMockControlsBackdoor.shouldWaitUpload) {
|
|
232
|
-
resolver();
|
|
233
|
-
}
|
|
234
|
-
resolve();
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
router.post('/chunk/probe', async ({
|
|
238
|
-
body
|
|
239
|
-
}, database) => {
|
|
240
|
-
const {
|
|
241
|
-
chunks
|
|
242
|
-
} = JSON.parse(body);
|
|
243
|
-
const allChunks = database.all('chunk');
|
|
244
|
-
const existingChunks = [];
|
|
245
|
-
const nonExistingChunks = [];
|
|
246
|
-
allChunks.forEach(({
|
|
247
|
-
data: {
|
|
248
|
-
id
|
|
249
|
-
}
|
|
250
|
-
}) => {
|
|
251
|
-
if (chunks.indexOf(id) > -1) {
|
|
252
|
-
existingChunks.push(id);
|
|
253
|
-
} else {
|
|
254
|
-
nonExistingChunks.push(id);
|
|
255
|
-
}
|
|
256
|
-
});
|
|
257
|
-
await awaitUpload();
|
|
258
|
-
return {
|
|
259
|
-
data: {
|
|
260
|
-
results: [...existingChunks.map(() => ({
|
|
261
|
-
exists: true
|
|
262
|
-
})), ...nonExistingChunks.map(() => ({
|
|
263
|
-
exists: false
|
|
264
|
-
}))]
|
|
265
|
-
}
|
|
266
|
-
};
|
|
267
|
-
});
|
|
268
222
|
router.post('/upload', ({
|
|
269
223
|
query
|
|
270
224
|
}, database) => {
|
|
@@ -240,84 +240,8 @@ export function createApiRouter(isSlowServer, urlsReturnErrorsTo) {
|
|
|
240
240
|
});
|
|
241
241
|
return new KakapoResponse(201, undefined, {});
|
|
242
242
|
});
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
* Otherwise it recursively calls itself with a 10ms timeout until it is false.*/
|
|
246
|
-
function awaitUpload(_x3) {
|
|
247
|
-
return _awaitUpload.apply(this, arguments);
|
|
248
|
-
}
|
|
249
|
-
function _awaitUpload() {
|
|
250
|
-
_awaitUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(resolver) {
|
|
251
|
-
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
252
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
253
|
-
case 0:
|
|
254
|
-
return _context3.abrupt("return", new Promise(function (resolve) {
|
|
255
|
-
if (window.mediaMockControlsBackdoor.shouldWaitUpload) {
|
|
256
|
-
setTimeout(function () {
|
|
257
|
-
return awaitUpload(resolver || resolve);
|
|
258
|
-
}, 10);
|
|
259
|
-
return;
|
|
260
|
-
}
|
|
261
|
-
if (resolver && !window.mediaMockControlsBackdoor.shouldWaitUpload) {
|
|
262
|
-
resolver();
|
|
263
|
-
}
|
|
264
|
-
resolve();
|
|
265
|
-
}));
|
|
266
|
-
case 1:
|
|
267
|
-
case "end":
|
|
268
|
-
return _context3.stop();
|
|
269
|
-
}
|
|
270
|
-
}, _callee3);
|
|
271
|
-
}));
|
|
272
|
-
return _awaitUpload.apply(this, arguments);
|
|
273
|
-
}
|
|
274
|
-
router.post('/chunk/probe', /*#__PURE__*/function () {
|
|
275
|
-
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref9, database) {
|
|
276
|
-
var body, _JSON$parse2, chunks, allChunks, existingChunks, nonExistingChunks;
|
|
277
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
278
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
279
|
-
case 0:
|
|
280
|
-
body = _ref9.body;
|
|
281
|
-
_JSON$parse2 = JSON.parse(body), chunks = _JSON$parse2.chunks;
|
|
282
|
-
allChunks = database.all('chunk');
|
|
283
|
-
existingChunks = [];
|
|
284
|
-
nonExistingChunks = [];
|
|
285
|
-
allChunks.forEach(function (_ref11) {
|
|
286
|
-
var id = _ref11.data.id;
|
|
287
|
-
if (chunks.indexOf(id) > -1) {
|
|
288
|
-
existingChunks.push(id);
|
|
289
|
-
} else {
|
|
290
|
-
nonExistingChunks.push(id);
|
|
291
|
-
}
|
|
292
|
-
});
|
|
293
|
-
_context2.next = 8;
|
|
294
|
-
return awaitUpload();
|
|
295
|
-
case 8:
|
|
296
|
-
return _context2.abrupt("return", {
|
|
297
|
-
data: {
|
|
298
|
-
results: [].concat(_toConsumableArray(existingChunks.map(function () {
|
|
299
|
-
return {
|
|
300
|
-
exists: true
|
|
301
|
-
};
|
|
302
|
-
})), _toConsumableArray(nonExistingChunks.map(function () {
|
|
303
|
-
return {
|
|
304
|
-
exists: false
|
|
305
|
-
};
|
|
306
|
-
})))
|
|
307
|
-
}
|
|
308
|
-
});
|
|
309
|
-
case 9:
|
|
310
|
-
case "end":
|
|
311
|
-
return _context2.stop();
|
|
312
|
-
}
|
|
313
|
-
}, _callee2);
|
|
314
|
-
}));
|
|
315
|
-
return function (_x4, _x5) {
|
|
316
|
-
return _ref10.apply(this, arguments);
|
|
317
|
-
};
|
|
318
|
-
}());
|
|
319
|
-
router.post('/upload', function (_ref12, database) {
|
|
320
|
-
var query = _ref12.query;
|
|
243
|
+
router.post('/upload', function (_ref9, database) {
|
|
244
|
+
var query = _ref9.query;
|
|
321
245
|
var _query$createUpTo = query.createUpTo,
|
|
322
246
|
createUpTo = _query$createUpTo === void 0 ? '1' : _query$createUpTo;
|
|
323
247
|
var records = database.create('upload', Number.parseInt(createUpTo, 10));
|
|
@@ -328,12 +252,12 @@ export function createApiRouter(isSlowServer, urlsReturnErrorsTo) {
|
|
|
328
252
|
data: data
|
|
329
253
|
};
|
|
330
254
|
});
|
|
331
|
-
router.put('/upload/:uploadId/chunks', function (
|
|
332
|
-
var params =
|
|
333
|
-
body =
|
|
255
|
+
router.put('/upload/:uploadId/chunks', function (_ref10, database) {
|
|
256
|
+
var params = _ref10.params,
|
|
257
|
+
body = _ref10.body;
|
|
334
258
|
var uploadId = params.uploadId;
|
|
335
|
-
var _JSON$
|
|
336
|
-
chunks = _JSON$
|
|
259
|
+
var _JSON$parse2 = JSON.parse(body),
|
|
260
|
+
chunks = _JSON$parse2.chunks;
|
|
337
261
|
var record = database.findOne('upload', {
|
|
338
262
|
id: uploadId
|
|
339
263
|
});
|
|
@@ -346,8 +270,8 @@ export function createApiRouter(isSlowServer, urlsReturnErrorsTo) {
|
|
|
346
270
|
return new KakapoResponse(404, undefined, {});
|
|
347
271
|
}
|
|
348
272
|
});
|
|
349
|
-
router.post('/file', function (
|
|
350
|
-
var query =
|
|
273
|
+
router.post('/file', function (_ref11, database) {
|
|
274
|
+
var query = _ref11.query;
|
|
351
275
|
var collection = query.collection;
|
|
352
276
|
var item = createCollectionItem({
|
|
353
277
|
collectionName: collection
|
|
@@ -360,15 +284,15 @@ export function createApiRouter(isSlowServer, urlsReturnErrorsTo) {
|
|
|
360
284
|
}
|
|
361
285
|
}, {});
|
|
362
286
|
});
|
|
363
|
-
router.post('/file/upload', function (
|
|
364
|
-
var query =
|
|
365
|
-
body =
|
|
287
|
+
router.post('/file/upload', function (_ref12, database) {
|
|
288
|
+
var query = _ref12.query,
|
|
289
|
+
body = _ref12.body;
|
|
366
290
|
var collection = query.collection,
|
|
367
291
|
replaceFileId = query.replaceFileId;
|
|
368
|
-
var _JSON$
|
|
369
|
-
name = _JSON$
|
|
370
|
-
mimeType = _JSON$
|
|
371
|
-
uploadId = _JSON$
|
|
292
|
+
var _JSON$parse3 = JSON.parse(body),
|
|
293
|
+
name = _JSON$parse3.name,
|
|
294
|
+
mimeType = _JSON$parse3.mimeType,
|
|
295
|
+
uploadId = _JSON$parse3.uploadId;
|
|
372
296
|
var uploadRecord = database.findOne('upload', {
|
|
373
297
|
id: uploadId
|
|
374
298
|
});
|
|
@@ -422,9 +346,9 @@ export function createApiRouter(isSlowServer, urlsReturnErrorsTo) {
|
|
|
422
346
|
})
|
|
423
347
|
};
|
|
424
348
|
});
|
|
425
|
-
router.get('/file/:fileId', function (
|
|
426
|
-
var params =
|
|
427
|
-
query =
|
|
349
|
+
router.get('/file/:fileId', function (_ref13, database) {
|
|
350
|
+
var params = _ref13.params,
|
|
351
|
+
query = _ref13.query;
|
|
428
352
|
var fileId = params.fileId;
|
|
429
353
|
var collection = query.collection;
|
|
430
354
|
var record = database.findOne('collectionItem', {
|
|
@@ -441,10 +365,10 @@ export function createApiRouter(isSlowServer, urlsReturnErrorsTo) {
|
|
|
441
365
|
return new KakapoResponse(404, undefined, {});
|
|
442
366
|
}
|
|
443
367
|
});
|
|
444
|
-
router.post('/items', function (
|
|
445
|
-
var body =
|
|
446
|
-
var
|
|
447
|
-
descriptors =
|
|
368
|
+
router.post('/items', function (_ref14, database) {
|
|
369
|
+
var body = _ref14.body;
|
|
370
|
+
var _ref15 = JSON.parse(body),
|
|
371
|
+
descriptors = _ref15.descriptors;
|
|
448
372
|
var fileItems = descriptors.map(function (descriptor) {
|
|
449
373
|
var record = database.findOne('collectionItem', {
|
|
450
374
|
id: descriptor.id
|
|
@@ -472,8 +396,8 @@ export function createApiRouter(isSlowServer, urlsReturnErrorsTo) {
|
|
|
472
396
|
router.post('/file/copy/withToken', function (request, database) {
|
|
473
397
|
var body = request.body,
|
|
474
398
|
query = request.query;
|
|
475
|
-
var _JSON$
|
|
476
|
-
sourceFile = _JSON$
|
|
399
|
+
var _JSON$parse4 = JSON.parse(body),
|
|
400
|
+
sourceFile = _JSON$parse4.sourceFile;
|
|
477
401
|
var destinationCollection = query.collection,
|
|
478
402
|
replaceFileId = query.replaceFileId,
|
|
479
403
|
occurrenceKey = query.occurrenceKey;
|
|
@@ -504,19 +428,19 @@ export function createApiRouter(isSlowServer, urlsReturnErrorsTo) {
|
|
|
504
428
|
id = _sourceRecord$data.id,
|
|
505
429
|
details = _sourceRecord$data.details,
|
|
506
430
|
blob = _sourceRecord$data.blob;
|
|
507
|
-
var
|
|
508
|
-
|
|
509
|
-
name =
|
|
510
|
-
|
|
511
|
-
size =
|
|
512
|
-
|
|
513
|
-
mediaType =
|
|
514
|
-
|
|
515
|
-
mimeType =
|
|
516
|
-
|
|
517
|
-
processingStatus =
|
|
518
|
-
|
|
519
|
-
artifacts =
|
|
431
|
+
var _ref16 = isMediaItemDetails(details) ? details : {},
|
|
432
|
+
_ref16$name = _ref16.name,
|
|
433
|
+
name = _ref16$name === void 0 ? getFakeFileName(extension) : _ref16$name,
|
|
434
|
+
_ref16$size = _ref16.size,
|
|
435
|
+
size = _ref16$size === void 0 ? blob && blob.size || 0 : _ref16$size,
|
|
436
|
+
_ref16$mediaType = _ref16.mediaType,
|
|
437
|
+
mediaType = _ref16$mediaType === void 0 ? 'image' : _ref16$mediaType,
|
|
438
|
+
_ref16$mimeType = _ref16.mimeType,
|
|
439
|
+
mimeType = _ref16$mimeType === void 0 ? 'image/jpeg' : _ref16$mimeType,
|
|
440
|
+
_ref16$processingStat = _ref16.processingStatus,
|
|
441
|
+
processingStatus = _ref16$processingStat === void 0 ? 'succeeded' : _ref16$processingStat,
|
|
442
|
+
_ref16$artifacts = _ref16.artifacts,
|
|
443
|
+
artifacts = _ref16$artifacts === void 0 ? {
|
|
520
444
|
'thumb_320.jpg': {
|
|
521
445
|
url: "/file/".concat(id, "/artifact/thumb_320.jpg/binary"),
|
|
522
446
|
processingStatus: 'succeeded'
|
|
@@ -541,13 +465,13 @@ export function createApiRouter(isSlowServer, urlsReturnErrorsTo) {
|
|
|
541
465
|
url: "/file/".concat(id, "/artifact/image.jpg/binary"),
|
|
542
466
|
processingStatus: 'succeeded'
|
|
543
467
|
}
|
|
544
|
-
} :
|
|
545
|
-
|
|
546
|
-
representations =
|
|
468
|
+
} : _ref16$artifacts,
|
|
469
|
+
_ref16$representation = _ref16.representations,
|
|
470
|
+
representations = _ref16$representation === void 0 ? {
|
|
547
471
|
image: {}
|
|
548
|
-
} :
|
|
549
|
-
|
|
550
|
-
createdAt =
|
|
472
|
+
} : _ref16$representation,
|
|
473
|
+
_ref16$createdAt = _ref16.createdAt,
|
|
474
|
+
createdAt = _ref16$createdAt === void 0 ? -1 : _ref16$createdAt;
|
|
551
475
|
database.update('collectionItem', existingRecord.id, {
|
|
552
476
|
id: replaceFileId,
|
|
553
477
|
insertedAt: sourceRecord.data.insertedAt,
|
|
@@ -573,8 +497,8 @@ export function createApiRouter(isSlowServer, urlsReturnErrorsTo) {
|
|
|
573
497
|
return new KakapoResponse(404, undefined, {});
|
|
574
498
|
}
|
|
575
499
|
});
|
|
576
|
-
router.post('/upload/createWithFiles', function (
|
|
577
|
-
var body =
|
|
500
|
+
router.post('/upload/createWithFiles', function (_ref17, database) {
|
|
501
|
+
var body = _ref17.body;
|
|
578
502
|
var bodyJson = JSON.parse(body);
|
|
579
503
|
var descriptors = bodyJson.descriptors;
|
|
580
504
|
var created = descriptors.map(function (descriptor) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-test-helpers",
|
|
3
|
-
"version": "33.0.
|
|
3
|
+
"version": "33.0.26",
|
|
4
4
|
"description": "Collection of test helpers used in media component stories and specs",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -27,17 +27,17 @@
|
|
|
27
27
|
"releaseModel": "continuous"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@atlaskit/button": "^16.
|
|
30
|
+
"@atlaskit/button": "^16.18.0",
|
|
31
31
|
"@atlaskit/checkbox": "^13.0.0",
|
|
32
32
|
"@atlaskit/icon": "^22.0.0",
|
|
33
33
|
"@atlaskit/locale": "^2.6.0",
|
|
34
|
-
"@atlaskit/media-client": "^
|
|
34
|
+
"@atlaskit/media-client": "^26.0.0",
|
|
35
35
|
"@atlaskit/media-common": "^11.0.0",
|
|
36
36
|
"@atlaskit/media-ui": "^25.0.0",
|
|
37
37
|
"@atlaskit/popup": "^1.11.0",
|
|
38
38
|
"@atlaskit/tabs": "^14.0.0",
|
|
39
39
|
"@atlaskit/textfield": "^6.0.0",
|
|
40
|
-
"@atlaskit/tokens": "^1.
|
|
40
|
+
"@atlaskit/tokens": "^1.29.0",
|
|
41
41
|
"@atlaskit/tooltip": "^18.0.0",
|
|
42
42
|
"@atlaskit/ufo": "^0.2.0",
|
|
43
43
|
"@babel/runtime": "^7.0.0",
|