@atlaskit/media-client 26.2.3 → 27.0.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.
- package/CHANGELOG.md +1049 -682
- package/dist/cjs/client/file-fetcher/index.js +2 -1
- package/dist/cjs/client/media-store/MediaStore.js +100 -61
- package/dist/es2019/client/file-fetcher/index.js +2 -1
- package/dist/es2019/client/media-store/MediaStore.js +18 -0
- package/dist/esm/client/file-fetcher/index.js +2 -1
- package/dist/esm/client/media-store/MediaStore.js +100 -61
- package/dist/types/client/file-fetcher/index.d.ts +11 -11
- package/dist/types/client/media-store/MediaStore.d.ts +1 -0
- package/dist/types/client/media-store/types.d.ts +1 -0
- package/dist/types-ts4.5/client/file-fetcher/index.d.ts +11 -11
- package/dist/types-ts4.5/client/media-store/MediaStore.d.ts +1 -0
- package/dist/types-ts4.5/client/media-store/types.d.ts +1 -0
- package/example-helpers/styles.ts +73 -74
- package/package.json +11 -4
- package/dist/cjs/test-helpers/MockedMediaApi/MockedMediaApi.js +0 -430
- package/dist/cjs/test-helpers/MockedMediaApi/helpers.js +0 -184
- package/dist/cjs/test-helpers/MockedMediaApi/index.js +0 -55
- package/dist/cjs/test-helpers/_numbers.js +0 -9
- package/dist/cjs/test-helpers/authProvider.js +0 -70
- package/dist/cjs/test-helpers/collectionNames.js +0 -11
- package/dist/cjs/test-helpers/exampleMediaItems.js +0 -274
- package/dist/cjs/test-helpers/fakeMediaClient.js +0 -75
- package/dist/cjs/test-helpers/index.js +0 -422
- package/dist/cjs/test-helpers/mediaClientProvider.js +0 -54
- package/dist/cjs/test-helpers/mediaPickerAuthProvider.js +0 -92
- package/dist/es2019/test-helpers/MockedMediaApi/MockedMediaApi.js +0 -159
- package/dist/es2019/test-helpers/MockedMediaApi/helpers.js +0 -167
- package/dist/es2019/test-helpers/MockedMediaApi/index.js +0 -2
- package/dist/es2019/test-helpers/_numbers.js +0 -3
- package/dist/es2019/test-helpers/authProvider.js +0 -34
- package/dist/es2019/test-helpers/collectionNames.js +0 -5
- package/dist/es2019/test-helpers/exampleMediaItems.js +0 -268
- package/dist/es2019/test-helpers/fakeMediaClient.js +0 -63
- package/dist/es2019/test-helpers/index.js +0 -8
- package/dist/es2019/test-helpers/mediaClientProvider.js +0 -42
- package/dist/es2019/test-helpers/mediaPickerAuthProvider.js +0 -56
- package/dist/esm/test-helpers/MockedMediaApi/MockedMediaApi.js +0 -423
- package/dist/esm/test-helpers/MockedMediaApi/helpers.js +0 -177
- package/dist/esm/test-helpers/MockedMediaApi/index.js +0 -2
- package/dist/esm/test-helpers/_numbers.js +0 -3
- package/dist/esm/test-helpers/authProvider.js +0 -63
- package/dist/esm/test-helpers/collectionNames.js +0 -5
- package/dist/esm/test-helpers/exampleMediaItems.js +0 -268
- package/dist/esm/test-helpers/fakeMediaClient.js +0 -69
- package/dist/esm/test-helpers/index.js +0 -8
- package/dist/esm/test-helpers/mediaClientProvider.js +0 -48
- package/dist/esm/test-helpers/mediaPickerAuthProvider.js +0 -85
- package/dist/types/test-helpers/MockedMediaApi/MockedMediaApi.d.ts +0 -16
- package/dist/types/test-helpers/MockedMediaApi/helpers.d.ts +0 -23
- package/dist/types/test-helpers/MockedMediaApi/index.d.ts +0 -3
- package/dist/types/test-helpers/_numbers.d.ts +0 -1
- package/dist/types/test-helpers/authProvider.d.ts +0 -6
- package/dist/types/test-helpers/collectionNames.d.ts +0 -5
- package/dist/types/test-helpers/exampleMediaItems.d.ts +0 -53
- package/dist/types/test-helpers/fakeMediaClient.d.ts +0 -4
- package/dist/types/test-helpers/index.d.ts +0 -9
- package/dist/types/test-helpers/mediaClientProvider.d.ts +0 -23
- package/dist/types/test-helpers/mediaPickerAuthProvider.d.ts +0 -5
- package/dist/types-ts4.5/test-helpers/MockedMediaApi/MockedMediaApi.d.ts +0 -16
- package/dist/types-ts4.5/test-helpers/MockedMediaApi/helpers.d.ts +0 -23
- package/dist/types-ts4.5/test-helpers/MockedMediaApi/index.d.ts +0 -3
- package/dist/types-ts4.5/test-helpers/_numbers.d.ts +0 -1
- package/dist/types-ts4.5/test-helpers/authProvider.d.ts +0 -6
- package/dist/types-ts4.5/test-helpers/collectionNames.d.ts +0 -5
- package/dist/types-ts4.5/test-helpers/exampleMediaItems.d.ts +0 -53
- package/dist/types-ts4.5/test-helpers/fakeMediaClient.d.ts +0 -4
- package/dist/types-ts4.5/test-helpers/index.d.ts +0 -9
- package/dist/types-ts4.5/test-helpers/mediaClientProvider.d.ts +0 -23
- package/dist/types-ts4.5/test-helpers/mediaPickerAuthProvider.d.ts +0 -5
|
@@ -286,23 +286,62 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
286
286
|
return createUrl("".concat(auth.baseUrl, "/file/").concat(id, "/image"), options);
|
|
287
287
|
}
|
|
288
288
|
}, {
|
|
289
|
-
key: "
|
|
289
|
+
key: "getFileBinary",
|
|
290
290
|
value: function () {
|
|
291
|
-
var
|
|
291
|
+
var _getFileBinary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(id, collectionName) {
|
|
292
292
|
var maxAge,
|
|
293
|
-
|
|
293
|
+
headers,
|
|
294
|
+
metadata,
|
|
294
295
|
options,
|
|
295
296
|
_args5 = arguments;
|
|
296
297
|
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
297
298
|
while (1) switch (_context5.prev = _context5.next) {
|
|
298
299
|
case 0:
|
|
299
300
|
maxAge = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : FILE_CACHE_MAX_AGE;
|
|
300
|
-
|
|
301
|
+
headers = {};
|
|
302
|
+
metadata = {
|
|
303
|
+
method: 'GET',
|
|
304
|
+
endpoint: '/file/{fileId}/binary'
|
|
305
|
+
};
|
|
306
|
+
options = _objectSpread(_objectSpread({}, metadata), {}, {
|
|
307
|
+
authContext: {
|
|
308
|
+
collectionName: collectionName
|
|
309
|
+
},
|
|
310
|
+
headers: headers,
|
|
311
|
+
params: {
|
|
312
|
+
'max-age': "".concat(maxAge)
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
return _context5.abrupt("return", this.request("/file/".concat(id, "/binary"), options).then(createMapResponseToBlob(metadata)));
|
|
316
|
+
case 5:
|
|
317
|
+
case "end":
|
|
318
|
+
return _context5.stop();
|
|
319
|
+
}
|
|
320
|
+
}, _callee5, this);
|
|
321
|
+
}));
|
|
322
|
+
function getFileBinary(_x14, _x15) {
|
|
323
|
+
return _getFileBinary.apply(this, arguments);
|
|
324
|
+
}
|
|
325
|
+
return getFileBinary;
|
|
326
|
+
}()
|
|
327
|
+
}, {
|
|
328
|
+
key: "getFileBinaryURL",
|
|
329
|
+
value: function () {
|
|
330
|
+
var _getFileBinaryURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(id, collectionName) {
|
|
331
|
+
var maxAge,
|
|
332
|
+
auth,
|
|
333
|
+
options,
|
|
334
|
+
_args6 = arguments;
|
|
335
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
336
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
337
|
+
case 0:
|
|
338
|
+
maxAge = _args6.length > 2 && _args6[2] !== undefined ? _args6[2] : FILE_CACHE_MAX_AGE;
|
|
339
|
+
_context6.next = 3;
|
|
301
340
|
return this.resolveAuth({
|
|
302
341
|
collectionName: collectionName
|
|
303
342
|
});
|
|
304
343
|
case 3:
|
|
305
|
-
auth =
|
|
344
|
+
auth = _context6.sent;
|
|
306
345
|
options = {
|
|
307
346
|
params: {
|
|
308
347
|
dl: true,
|
|
@@ -311,14 +350,14 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
311
350
|
},
|
|
312
351
|
auth: auth
|
|
313
352
|
};
|
|
314
|
-
return
|
|
353
|
+
return _context6.abrupt("return", createUrl("".concat(auth.baseUrl, "/file/").concat(id, "/binary"), options));
|
|
315
354
|
case 6:
|
|
316
355
|
case "end":
|
|
317
|
-
return
|
|
356
|
+
return _context6.stop();
|
|
318
357
|
}
|
|
319
|
-
},
|
|
358
|
+
}, _callee6, this);
|
|
320
359
|
}));
|
|
321
|
-
function getFileBinaryURL(
|
|
360
|
+
function getFileBinaryURL(_x16, _x17) {
|
|
322
361
|
return _getFileBinaryURL.apply(this, arguments);
|
|
323
362
|
}
|
|
324
363
|
return getFileBinaryURL;
|
|
@@ -326,24 +365,24 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
326
365
|
}, {
|
|
327
366
|
key: "getArtifactURL",
|
|
328
367
|
value: function () {
|
|
329
|
-
var _getArtifactURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
368
|
+
var _getArtifactURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(artifacts, artifactName, collectionName) {
|
|
330
369
|
var artifactUrl, auth, options;
|
|
331
|
-
return _regeneratorRuntime.wrap(function
|
|
332
|
-
while (1) switch (
|
|
370
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
371
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
333
372
|
case 0:
|
|
334
373
|
artifactUrl = getArtifactUrl(artifacts, artifactName);
|
|
335
374
|
if (artifactUrl) {
|
|
336
|
-
|
|
375
|
+
_context7.next = 3;
|
|
337
376
|
break;
|
|
338
377
|
}
|
|
339
378
|
throw new Error("artifact ".concat(artifactName, " not found"));
|
|
340
379
|
case 3:
|
|
341
|
-
|
|
380
|
+
_context7.next = 5;
|
|
342
381
|
return this.resolveAuth({
|
|
343
382
|
collectionName: collectionName
|
|
344
383
|
});
|
|
345
384
|
case 5:
|
|
346
|
-
auth =
|
|
385
|
+
auth = _context7.sent;
|
|
347
386
|
options = {
|
|
348
387
|
params: {
|
|
349
388
|
collection: collectionName,
|
|
@@ -351,14 +390,14 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
351
390
|
},
|
|
352
391
|
auth: auth
|
|
353
392
|
};
|
|
354
|
-
return
|
|
393
|
+
return _context7.abrupt("return", createUrl("".concat(auth.baseUrl).concat(artifactUrl), options));
|
|
355
394
|
case 8:
|
|
356
395
|
case "end":
|
|
357
|
-
return
|
|
396
|
+
return _context7.stop();
|
|
358
397
|
}
|
|
359
|
-
},
|
|
398
|
+
}, _callee7, this);
|
|
360
399
|
}));
|
|
361
|
-
function getArtifactURL(
|
|
400
|
+
function getArtifactURL(_x18, _x19, _x20) {
|
|
362
401
|
return _getArtifactURL.apply(this, arguments);
|
|
363
402
|
}
|
|
364
403
|
return getArtifactURL;
|
|
@@ -366,10 +405,10 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
366
405
|
}, {
|
|
367
406
|
key: "getImage",
|
|
368
407
|
value: function () {
|
|
369
|
-
var _getImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
408
|
+
var _getImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(id, params, controller, fetchMaxRes, traceContext) {
|
|
370
409
|
var isWebpSupported, headers, metadata, options;
|
|
371
|
-
return _regeneratorRuntime.wrap(function
|
|
372
|
-
while (1) switch (
|
|
410
|
+
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
411
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
373
412
|
case 0:
|
|
374
413
|
// TODO add checkWebpSupport() back https://product-fabric.atlassian.net/browse/MPT-584
|
|
375
414
|
isWebpSupported = false;
|
|
@@ -389,14 +428,14 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
389
428
|
headers: headers,
|
|
390
429
|
traceContext: traceContext
|
|
391
430
|
});
|
|
392
|
-
return
|
|
431
|
+
return _context8.abrupt("return", this.request("/file/".concat(id, "/image"), options, controller).then(createMapResponseToBlob(metadata)));
|
|
393
432
|
case 6:
|
|
394
433
|
case "end":
|
|
395
|
-
return
|
|
434
|
+
return _context8.stop();
|
|
396
435
|
}
|
|
397
|
-
},
|
|
436
|
+
}, _callee8, this);
|
|
398
437
|
}));
|
|
399
|
-
function getImage(
|
|
438
|
+
function getImage(_x21, _x22, _x23, _x24, _x25) {
|
|
400
439
|
return _getImage.apply(this, arguments);
|
|
401
440
|
}
|
|
402
441
|
return getImage;
|
|
@@ -404,10 +443,10 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
404
443
|
}, {
|
|
405
444
|
key: "getItems",
|
|
406
445
|
value: function () {
|
|
407
|
-
var _getItems = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
446
|
+
var _getItems = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(ids, collectionName, traceContext) {
|
|
408
447
|
var descriptors, metadata, options;
|
|
409
|
-
return _regeneratorRuntime.wrap(function
|
|
410
|
-
while (1) switch (
|
|
448
|
+
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
449
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
411
450
|
case 0:
|
|
412
451
|
descriptors = ids.map(function (id) {
|
|
413
452
|
return {
|
|
@@ -430,14 +469,14 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
430
469
|
}),
|
|
431
470
|
traceContext: traceContext
|
|
432
471
|
});
|
|
433
|
-
return
|
|
472
|
+
return _context9.abrupt("return", this.request('/items', options).then(createMapResponseToJson(metadata)));
|
|
434
473
|
case 4:
|
|
435
474
|
case "end":
|
|
436
|
-
return
|
|
475
|
+
return _context9.stop();
|
|
437
476
|
}
|
|
438
|
-
},
|
|
477
|
+
}, _callee9, this);
|
|
439
478
|
}));
|
|
440
|
-
function getItems(
|
|
479
|
+
function getItems(_x26, _x27, _x28) {
|
|
441
480
|
return _getItems.apply(this, arguments);
|
|
442
481
|
}
|
|
443
482
|
return getItems;
|
|
@@ -445,10 +484,10 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
445
484
|
}, {
|
|
446
485
|
key: "getImageMetadata",
|
|
447
486
|
value: function () {
|
|
448
|
-
var _getImageMetadata = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
487
|
+
var _getImageMetadata = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(id, params, traceContext) {
|
|
449
488
|
var metadata, options;
|
|
450
|
-
return _regeneratorRuntime.wrap(function
|
|
451
|
-
while (1) switch (
|
|
489
|
+
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
490
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
452
491
|
case 0:
|
|
453
492
|
metadata = {
|
|
454
493
|
method: 'GET',
|
|
@@ -461,14 +500,14 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
461
500
|
params: params,
|
|
462
501
|
traceContext: traceContext
|
|
463
502
|
});
|
|
464
|
-
return
|
|
503
|
+
return _context10.abrupt("return", this.request("/file/".concat(id, "/image/metadata"), options).then(createMapResponseToJson(metadata)));
|
|
465
504
|
case 3:
|
|
466
505
|
case "end":
|
|
467
|
-
return
|
|
506
|
+
return _context10.stop();
|
|
468
507
|
}
|
|
469
|
-
},
|
|
508
|
+
}, _callee10, this);
|
|
470
509
|
}));
|
|
471
|
-
function getImageMetadata(
|
|
510
|
+
function getImageMetadata(_x29, _x30, _x31) {
|
|
472
511
|
return _getImageMetadata.apply(this, arguments);
|
|
473
512
|
}
|
|
474
513
|
return getImageMetadata;
|
|
@@ -476,10 +515,10 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
476
515
|
}, {
|
|
477
516
|
key: "appendChunksToUpload",
|
|
478
517
|
value: function () {
|
|
479
|
-
var _appendChunksToUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
518
|
+
var _appendChunksToUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(uploadId, body, collectionName, traceContext) {
|
|
480
519
|
var metadata, options;
|
|
481
|
-
return _regeneratorRuntime.wrap(function
|
|
482
|
-
while (1) switch (
|
|
520
|
+
return _regeneratorRuntime.wrap(function _callee11$(_context11) {
|
|
521
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
483
522
|
case 0:
|
|
484
523
|
metadata = {
|
|
485
524
|
method: 'PUT',
|
|
@@ -493,15 +532,15 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
493
532
|
body: JSON.stringify(body),
|
|
494
533
|
traceContext: traceContext
|
|
495
534
|
});
|
|
496
|
-
|
|
535
|
+
_context11.next = 4;
|
|
497
536
|
return this.request("/upload/".concat(uploadId, "/chunks"), options);
|
|
498
537
|
case 4:
|
|
499
538
|
case "end":
|
|
500
|
-
return
|
|
539
|
+
return _context11.stop();
|
|
501
540
|
}
|
|
502
|
-
},
|
|
541
|
+
}, _callee11, this);
|
|
503
542
|
}));
|
|
504
|
-
function appendChunksToUpload(
|
|
543
|
+
function appendChunksToUpload(_x32, _x33, _x34, _x35) {
|
|
505
544
|
return _appendChunksToUpload.apply(this, arguments);
|
|
506
545
|
}
|
|
507
546
|
return appendChunksToUpload;
|
|
@@ -530,7 +569,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
530
569
|
}, {
|
|
531
570
|
key: "request",
|
|
532
571
|
value: function () {
|
|
533
|
-
var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
572
|
+
var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(path) {
|
|
534
573
|
var options,
|
|
535
574
|
controller,
|
|
536
575
|
method,
|
|
@@ -544,25 +583,25 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
544
583
|
auth,
|
|
545
584
|
extendedTraceContext,
|
|
546
585
|
response,
|
|
547
|
-
|
|
548
|
-
return _regeneratorRuntime.wrap(function
|
|
549
|
-
while (1) switch (
|
|
586
|
+
_args12 = arguments;
|
|
587
|
+
return _regeneratorRuntime.wrap(function _callee12$(_context12) {
|
|
588
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
550
589
|
case 0:
|
|
551
|
-
options =
|
|
590
|
+
options = _args12.length > 1 && _args12[1] !== undefined ? _args12[1] : {
|
|
552
591
|
method: 'GET',
|
|
553
592
|
endpoint: undefined,
|
|
554
593
|
authContext: {}
|
|
555
594
|
};
|
|
556
|
-
controller =
|
|
595
|
+
controller = _args12.length > 2 ? _args12[2] : undefined;
|
|
557
596
|
method = options.method, endpoint = options.endpoint, authContext = options.authContext, params = options.params, headers = options.headers, body = options.body, clientOptions = options.clientOptions, traceContext = options.traceContext;
|
|
558
|
-
|
|
597
|
+
_context12.next = 5;
|
|
559
598
|
return this.resolveAuth(authContext);
|
|
560
599
|
case 5:
|
|
561
|
-
auth =
|
|
600
|
+
auth = _context12.sent;
|
|
562
601
|
extendedTraceContext = traceContext ? _objectSpread(_objectSpread({}, traceContext), {}, {
|
|
563
602
|
spanId: (traceContext === null || traceContext === void 0 ? void 0 : traceContext.spanId) || getRandomHex(8)
|
|
564
603
|
}) : undefined;
|
|
565
|
-
|
|
604
|
+
_context12.next = 9;
|
|
566
605
|
return _request("".concat(auth.baseUrl).concat(path), {
|
|
567
606
|
method: method,
|
|
568
607
|
endpoint: endpoint,
|
|
@@ -574,17 +613,17 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
574
613
|
traceContext: extendedTraceContext
|
|
575
614
|
}, controller);
|
|
576
615
|
case 9:
|
|
577
|
-
response =
|
|
616
|
+
response = _context12.sent;
|
|
578
617
|
setKeyValueInSessionStorage(MEDIA_API_REGION, response.headers.get('x-media-region'));
|
|
579
618
|
setKeyValueInSessionStorage(MEDIA_API_ENVIRONMENT, response.headers.get('x-media-env'));
|
|
580
|
-
return
|
|
619
|
+
return _context12.abrupt("return", response);
|
|
581
620
|
case 13:
|
|
582
621
|
case "end":
|
|
583
|
-
return
|
|
622
|
+
return _context12.stop();
|
|
584
623
|
}
|
|
585
|
-
},
|
|
624
|
+
}, _callee12, this);
|
|
586
625
|
}));
|
|
587
|
-
function request(
|
|
626
|
+
function request(_x36) {
|
|
588
627
|
return _request2.apply(this, arguments);
|
|
589
628
|
}
|
|
590
629
|
return request;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import 'setimmediate';
|
|
2
|
-
import { AuthProvider } from '@atlaskit/media-core';
|
|
3
|
-
import { MediaFileArtifacts } from '@atlaskit/media-state';
|
|
4
|
-
import { MediaStore as MediaApi, MediaStoreCopyFileWithTokenParams, TouchedFiles, TouchFileDescriptor } from '../media-store';
|
|
5
|
-
import { GetFileOptions } from '../../models/file-state';
|
|
6
|
-
import { MediaFile } from '../../models/media';
|
|
7
|
-
import { UploadableFile, UploadableFileUpfrontIds } from '../../uploader';
|
|
8
|
-
import { UploadController } from '../../upload-controller';
|
|
9
|
-
import { MediaSubscribable } from '../../utils/mediaSubscribable';
|
|
10
|
-
import { Dimensions } from '../../utils/getDimensionsFromBlob';
|
|
11
|
-
import { MediaTraceContext } from '@atlaskit/media-common';
|
|
12
|
-
import { FilePreview, FileState, MediaStore } from '@atlaskit/media-state';
|
|
2
|
+
import { type AuthProvider } from '@atlaskit/media-core';
|
|
3
|
+
import { type MediaFileArtifacts } from '@atlaskit/media-state';
|
|
4
|
+
import { MediaStore as MediaApi, type MediaStoreCopyFileWithTokenParams, type TouchedFiles, type TouchFileDescriptor } from '../media-store';
|
|
5
|
+
import { type GetFileOptions } from '../../models/file-state';
|
|
6
|
+
import { type MediaFile } from '../../models/media';
|
|
7
|
+
import { type UploadableFile, type UploadableFileUpfrontIds } from '../../uploader';
|
|
8
|
+
import { type UploadController } from '../../upload-controller';
|
|
9
|
+
import { type MediaSubscribable } from '../../utils/mediaSubscribable';
|
|
10
|
+
import { type Dimensions } from '../../utils/getDimensionsFromBlob';
|
|
11
|
+
import { type MediaTraceContext } from '@atlaskit/media-common';
|
|
12
|
+
import { type FilePreview, type FileState, type MediaStore } from '@atlaskit/media-state';
|
|
13
13
|
export type { FileFetcherErrorAttributes, FileFetcherErrorReason, } from './error';
|
|
14
14
|
export { isFileFetcherError, FileFetcherError } from './error';
|
|
15
15
|
export interface CopySourceFile {
|
|
@@ -18,6 +18,7 @@ export declare class MediaStore implements MediaApi {
|
|
|
18
18
|
getFileImageURL(id: string, params?: MediaStoreGetFileImageParams): Promise<string>;
|
|
19
19
|
getFileImageURLSync(id: string, params?: MediaStoreGetFileImageParams): string;
|
|
20
20
|
private createFileImageURL;
|
|
21
|
+
getFileBinary(id: string, collectionName?: string, maxAge?: number): Promise<Blob>;
|
|
21
22
|
getFileBinaryURL(id: string, collectionName?: string, maxAge?: number): Promise<string>;
|
|
22
23
|
getArtifactURL(artifacts: MediaFileArtifacts, artifactName: keyof MediaFileArtifacts, collectionName?: string): Promise<string>;
|
|
23
24
|
getImage(id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean, traceContext?: MediaTraceContext): Promise<Blob>;
|
|
@@ -147,6 +147,7 @@ export interface MediaApi {
|
|
|
147
147
|
getFile: (fileId: string, params: MediaStoreGetFileParams, traceContext?: MediaTraceContext) => Promise<MediaStoreResponse<MediaFile>>;
|
|
148
148
|
getFileImageURL: (id: string, params?: MediaStoreGetFileImageParams) => Promise<string>;
|
|
149
149
|
getFileImageURLSync: (id: string, params?: MediaStoreGetFileImageParams) => string;
|
|
150
|
+
getFileBinary: (id: string, collectionName?: string) => Promise<Blob>;
|
|
150
151
|
getFileBinaryURL: (id: string, collectionName?: string) => Promise<string>;
|
|
151
152
|
getArtifactURL: (artifacts: MediaFileArtifacts, artifactName: keyof MediaFileArtifacts, collectionName?: string) => Promise<string>;
|
|
152
153
|
getImage: (id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean, traceContext?: MediaTraceContext) => Promise<Blob>;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import 'setimmediate';
|
|
2
|
-
import { AuthProvider } from '@atlaskit/media-core';
|
|
3
|
-
import { MediaFileArtifacts } from '@atlaskit/media-state';
|
|
4
|
-
import { MediaStore as MediaApi, MediaStoreCopyFileWithTokenParams, TouchedFiles, TouchFileDescriptor } from '../media-store';
|
|
5
|
-
import { GetFileOptions } from '../../models/file-state';
|
|
6
|
-
import { MediaFile } from '../../models/media';
|
|
7
|
-
import { UploadableFile, UploadableFileUpfrontIds } from '../../uploader';
|
|
8
|
-
import { UploadController } from '../../upload-controller';
|
|
9
|
-
import { MediaSubscribable } from '../../utils/mediaSubscribable';
|
|
10
|
-
import { Dimensions } from '../../utils/getDimensionsFromBlob';
|
|
11
|
-
import { MediaTraceContext } from '@atlaskit/media-common';
|
|
12
|
-
import { FilePreview, FileState, MediaStore } from '@atlaskit/media-state';
|
|
2
|
+
import { type AuthProvider } from '@atlaskit/media-core';
|
|
3
|
+
import { type MediaFileArtifacts } from '@atlaskit/media-state';
|
|
4
|
+
import { MediaStore as MediaApi, type MediaStoreCopyFileWithTokenParams, type TouchedFiles, type TouchFileDescriptor } from '../media-store';
|
|
5
|
+
import { type GetFileOptions } from '../../models/file-state';
|
|
6
|
+
import { type MediaFile } from '../../models/media';
|
|
7
|
+
import { type UploadableFile, type UploadableFileUpfrontIds } from '../../uploader';
|
|
8
|
+
import { type UploadController } from '../../upload-controller';
|
|
9
|
+
import { type MediaSubscribable } from '../../utils/mediaSubscribable';
|
|
10
|
+
import { type Dimensions } from '../../utils/getDimensionsFromBlob';
|
|
11
|
+
import { type MediaTraceContext } from '@atlaskit/media-common';
|
|
12
|
+
import { type FilePreview, type FileState, type MediaStore } from '@atlaskit/media-state';
|
|
13
13
|
export type { FileFetcherErrorAttributes, FileFetcherErrorReason, } from './error';
|
|
14
14
|
export { isFileFetcherError, FileFetcherError } from './error';
|
|
15
15
|
export interface CopySourceFile {
|
|
@@ -18,6 +18,7 @@ export declare class MediaStore implements MediaApi {
|
|
|
18
18
|
getFileImageURL(id: string, params?: MediaStoreGetFileImageParams): Promise<string>;
|
|
19
19
|
getFileImageURLSync(id: string, params?: MediaStoreGetFileImageParams): string;
|
|
20
20
|
private createFileImageURL;
|
|
21
|
+
getFileBinary(id: string, collectionName?: string, maxAge?: number): Promise<Blob>;
|
|
21
22
|
getFileBinaryURL(id: string, collectionName?: string, maxAge?: number): Promise<string>;
|
|
22
23
|
getArtifactURL(artifacts: MediaFileArtifacts, artifactName: keyof MediaFileArtifacts, collectionName?: string): Promise<string>;
|
|
23
24
|
getImage(id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean, traceContext?: MediaTraceContext): Promise<Blob>;
|
|
@@ -147,6 +147,7 @@ export interface MediaApi {
|
|
|
147
147
|
getFile: (fileId: string, params: MediaStoreGetFileParams, traceContext?: MediaTraceContext) => Promise<MediaStoreResponse<MediaFile>>;
|
|
148
148
|
getFileImageURL: (id: string, params?: MediaStoreGetFileImageParams) => Promise<string>;
|
|
149
149
|
getFileImageURLSync: (id: string, params?: MediaStoreGetFileImageParams) => string;
|
|
150
|
+
getFileBinary: (id: string, collectionName?: string) => Promise<Blob>;
|
|
150
151
|
getFileBinaryURL: (id: string, collectionName?: string) => Promise<string>;
|
|
151
152
|
getArtifactURL: (artifacts: MediaFileArtifacts, artifactName: keyof MediaFileArtifacts, collectionName?: string) => Promise<string>;
|
|
152
153
|
getImage: (id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean, traceContext?: MediaTraceContext) => Promise<Blob>;
|
|
@@ -2,27 +2,27 @@ import { token } from '@atlaskit/tokens';
|
|
|
2
2
|
import { css } from '@emotion/react';
|
|
3
3
|
import { FileStatus } from '../src';
|
|
4
4
|
|
|
5
|
-
export const wrapperStyles = css
|
|
6
|
-
display: flex
|
|
7
|
-
|
|
5
|
+
export const wrapperStyles = css({
|
|
6
|
+
display: 'flex',
|
|
7
|
+
});
|
|
8
8
|
|
|
9
|
-
export const imagePreviewStyles = css
|
|
10
|
-
width: 300px
|
|
11
|
-
|
|
9
|
+
export const imagePreviewStyles = css({
|
|
10
|
+
width: '300px',
|
|
11
|
+
});
|
|
12
12
|
|
|
13
|
-
export const previewWrapperStyles = css
|
|
14
|
-
flex: 1
|
|
15
|
-
|
|
13
|
+
export const previewWrapperStyles = css({
|
|
14
|
+
flex: 1,
|
|
15
|
+
});
|
|
16
16
|
|
|
17
|
-
export const metadataWrapperStyles = css
|
|
18
|
-
width: 400px
|
|
19
|
-
overflow: scroll
|
|
20
|
-
flex: 1
|
|
21
|
-
|
|
17
|
+
export const metadataWrapperStyles = css({
|
|
18
|
+
width: '400px',
|
|
19
|
+
overflow: 'scroll',
|
|
20
|
+
flex: 1,
|
|
21
|
+
});
|
|
22
22
|
|
|
23
|
-
export const fileInputStyles = css
|
|
24
|
-
color: transparent
|
|
25
|
-
|
|
23
|
+
export const fileInputStyles = css({
|
|
24
|
+
color: 'transparent',
|
|
25
|
+
});
|
|
26
26
|
|
|
27
27
|
export interface FilesWrapperProps {
|
|
28
28
|
status: FileStatus;
|
|
@@ -38,68 +38,67 @@ const statusColorMap: { [key in FileStatus]: string } = {
|
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
41
|
-
export const fileWrapperStyles = (status: FileStatus) =>
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
41
|
+
export const fileWrapperStyles = (status: FileStatus) =>
|
|
42
|
+
css({
|
|
43
|
+
padding: '5px',
|
|
44
|
+
margin: '10px',
|
|
45
|
+
display: 'inline-block',
|
|
46
|
+
width: '315px',
|
|
47
|
+
backgroundColor: statusColorMap[status],
|
|
48
|
+
});
|
|
48
49
|
|
|
49
50
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
50
|
-
export const cardsWrapperStyles = css
|
|
51
|
-
width: 900px
|
|
52
|
-
padding: 10px
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
`;
|
|
51
|
+
export const cardsWrapperStyles = css({
|
|
52
|
+
width: '900px',
|
|
53
|
+
padding: '10px',
|
|
54
|
+
borderRight: `1px solid ${token('color.border', '#ccc')}`,
|
|
55
|
+
h1: {
|
|
56
|
+
textAlign: 'center',
|
|
57
|
+
borderBottom: `1px solid ${token('color.border', '#ccc')}`,
|
|
58
|
+
},
|
|
59
|
+
'> div': {
|
|
60
|
+
width: 'auto',
|
|
61
|
+
display: 'inline-block',
|
|
62
|
+
margin: '10px',
|
|
63
|
+
},
|
|
64
|
+
});
|
|
66
65
|
|
|
67
66
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
68
|
-
export const headerStyles = css
|
|
69
|
-
button {
|
|
70
|
-
margin: 5px
|
|
71
|
-
}
|
|
72
|
-
|
|
67
|
+
export const headerStyles = css({
|
|
68
|
+
button: {
|
|
69
|
+
margin: '5px',
|
|
70
|
+
},
|
|
71
|
+
});
|
|
73
72
|
|
|
74
73
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
75
|
-
export const fileStateWrapperStyles = css
|
|
76
|
-
border: 1px solid ${token('color.border', '#ccc')}
|
|
77
|
-
margin: 10px
|
|
78
|
-
padding: 10px
|
|
79
|
-
width: 500px
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
export const uploadTouchWrapperStyles = css
|
|
83
|
-
height: 100
|
|
84
|
-
width: 100
|
|
85
|
-
display: flex
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
74
|
+
export const fileStateWrapperStyles = css({
|
|
75
|
+
border: `1px solid ${token('color.border', '#ccc')}`,
|
|
76
|
+
margin: '10px',
|
|
77
|
+
padding: '10px',
|
|
78
|
+
width: '500px',
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
export const uploadTouchWrapperStyles = css({
|
|
82
|
+
height: '100%',
|
|
83
|
+
width: '100%',
|
|
84
|
+
display: 'flex',
|
|
85
|
+
flexDirection: 'column',
|
|
86
|
+
flexWrap: 'nowrap',
|
|
87
|
+
alignItems: 'center',
|
|
88
|
+
justifyContent: 'center',
|
|
89
|
+
alignContent: 'center',
|
|
90
|
+
});
|
|
92
91
|
|
|
93
92
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
94
|
-
export const rowStyles = css
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
> * {
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
export const responseStyles = css
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
93
|
+
export const rowStyles = css({
|
|
94
|
+
flexDirection: 'row',
|
|
95
|
+
justifyContent: 'center',
|
|
96
|
+
'> *': {
|
|
97
|
+
marginRight: '10px',
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
export const responseStyles = css({
|
|
102
|
+
fontFamily: 'monospace',
|
|
103
|
+
whiteSpace: 'pre',
|
|
104
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-client",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "27.0.0",
|
|
4
4
|
"description": "Media API Web Client Library",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -37,7 +37,8 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@atlaskit/chunkinator": "^6.0.0",
|
|
40
|
-
"@atlaskit/media-common": "^11.
|
|
40
|
+
"@atlaskit/media-common": "^11.2.0",
|
|
41
|
+
"@atlaskit/platform-feature-flags": "0.2.5",
|
|
41
42
|
"@babel/runtime": "^7.0.0",
|
|
42
43
|
"dataloader": "^2.0.0",
|
|
43
44
|
"deep-equal": "^1.0.1",
|
|
@@ -59,8 +60,9 @@
|
|
|
59
60
|
"@atlaskit/media-core": "^34.2.0",
|
|
60
61
|
"@atlaskit/media-state": "^1.0.0",
|
|
61
62
|
"@atlaskit/ssr": "*",
|
|
62
|
-
"@atlaskit/tokens": "^1.
|
|
63
|
+
"@atlaskit/tokens": "^1.45.0",
|
|
63
64
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
65
|
+
"@atlassian/feature-flags-test-utils": "0.2.1",
|
|
64
66
|
"@emotion/react": "^11.7.1",
|
|
65
67
|
"@types/deep-equal": "^1.0.1",
|
|
66
68
|
"@types/uuid-validate": "^0.0.2",
|
|
@@ -82,5 +84,10 @@
|
|
|
82
84
|
]
|
|
83
85
|
}
|
|
84
86
|
},
|
|
85
|
-
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
|
|
87
|
+
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1",
|
|
88
|
+
"platform-feature-flags": {
|
|
89
|
+
"platform.media-svg-rendering": {
|
|
90
|
+
"type": "boolean"
|
|
91
|
+
}
|
|
92
|
+
}
|
|
86
93
|
}
|