@atlaskit/media-client 34.1.0 → 34.2.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 +12 -0
- package/dist/cjs/client/media-store/MediaStore.js +36 -19
- package/dist/cjs/utils/request/helpers.js +4 -0
- package/dist/es2019/client/media-store/MediaStore.js +26 -9
- package/dist/es2019/utils/request/helpers.js +4 -0
- package/dist/esm/client/media-store/MediaStore.js +36 -19
- package/dist/esm/utils/request/helpers.js +4 -0
- package/dist/types/client/media-store/MediaStore.d.ts +2 -2
- package/dist/types/client/media-store/types.d.ts +2 -2
- package/dist/types/models/document.d.ts +3 -0
- package/dist/types/models/errors/types.d.ts +1 -1
- package/dist/types/utils/request/types.d.ts +1 -1
- package/dist/types-ts4.5/client/media-store/MediaStore.d.ts +2 -2
- package/dist/types-ts4.5/client/media-store/types.d.ts +2 -2
- package/dist/types-ts4.5/models/document.d.ts +3 -0
- package/dist/types-ts4.5/models/errors/types.d.ts +1 -1
- package/dist/types-ts4.5/utils/request/types.d.ts +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/media-client
|
|
2
2
|
|
|
3
|
+
## 34.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#177492](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/177492)
|
|
8
|
+
[`77d01c4bd4ead`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/77d01c4bd4ead) -
|
|
9
|
+
Added password option and traceContext for getting Media Document Contents and Page
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
3
15
|
## 34.1.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -665,35 +665,44 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
665
665
|
}, {
|
|
666
666
|
key: "getDocumentContent",
|
|
667
667
|
value: function () {
|
|
668
|
-
var _getDocumentContent = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(id, options) {
|
|
669
|
-
var endpoint, metadata, requestOptions;
|
|
668
|
+
var _getDocumentContent = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(id, options, traceContext) {
|
|
669
|
+
var shouldCache, endpoint, metadata, headers, requestOptions;
|
|
670
670
|
return _regenerator.default.wrap(function _callee12$(_context12) {
|
|
671
671
|
while (1) switch (_context12.prev = _context12.next) {
|
|
672
672
|
case 0:
|
|
673
|
-
|
|
673
|
+
// when requesting for password protected document don't use CDN as it won't forward headers
|
|
674
|
+
// this is deliberate to avoid caching Password protected files
|
|
675
|
+
// Note: this should be removed once endpoint implements server side Cache-Control headers
|
|
676
|
+
shouldCache = !options.password;
|
|
677
|
+
endpoint = shouldCache ? cdnFeatureFlag('contents') : 'contents';
|
|
674
678
|
metadata = {
|
|
675
679
|
method: 'GET',
|
|
676
680
|
endpoint: "/file/{fileId}/document/".concat(endpoint)
|
|
677
681
|
};
|
|
682
|
+
headers = options.password ? {
|
|
683
|
+
'x-document-authorization': "Basic ".concat(options.password)
|
|
684
|
+
} : {};
|
|
678
685
|
requestOptions = _objectSpread(_objectSpread({}, metadata), {}, {
|
|
679
686
|
authContext: {
|
|
680
687
|
collectionName: options.collectionName
|
|
681
688
|
},
|
|
689
|
+
headers: headers,
|
|
682
690
|
params: {
|
|
683
691
|
collection: options.collectionName,
|
|
684
692
|
pageStart: options.pageStart,
|
|
685
693
|
pageEnd: options.pageEnd,
|
|
686
|
-
'max-age': _constants.FILE_CACHE_MAX_AGE
|
|
687
|
-
}
|
|
694
|
+
'max-age': shouldCache ? _constants.FILE_CACHE_MAX_AGE : 0
|
|
695
|
+
},
|
|
696
|
+
traceContext: traceContext
|
|
688
697
|
});
|
|
689
698
|
return _context12.abrupt("return", this.request("/file/".concat(id, "/document/").concat(endpoint), requestOptions).then((0, _helpers.createMapResponseToJson)(metadata)));
|
|
690
|
-
case
|
|
699
|
+
case 6:
|
|
691
700
|
case "end":
|
|
692
701
|
return _context12.stop();
|
|
693
702
|
}
|
|
694
703
|
}, _callee12, this);
|
|
695
704
|
}));
|
|
696
|
-
function getDocumentContent(_x44, _x45) {
|
|
705
|
+
function getDocumentContent(_x44, _x45, _x46) {
|
|
697
706
|
return _getDocumentContent.apply(this, arguments);
|
|
698
707
|
}
|
|
699
708
|
return getDocumentContent;
|
|
@@ -701,36 +710,44 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
701
710
|
}, {
|
|
702
711
|
key: "getDocumentPageImage",
|
|
703
712
|
value: function () {
|
|
704
|
-
var _getDocumentPageImage = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(id, options) {
|
|
705
|
-
var endpoint, metadata, requestOptions;
|
|
713
|
+
var _getDocumentPageImage = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(id, options, traceContext) {
|
|
714
|
+
var shouldCache, endpoint, metadata, headers, requestOptions;
|
|
706
715
|
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
707
716
|
while (1) switch (_context13.prev = _context13.next) {
|
|
708
717
|
case 0:
|
|
709
|
-
//
|
|
710
|
-
|
|
718
|
+
// when requesting for password protected document don't use CDN as it won't forward headers
|
|
719
|
+
// this is deliberate to avoid caching Password protected files
|
|
720
|
+
// Note: this should be removed once endpoint implements server side Cache-Control headers
|
|
721
|
+
shouldCache = !options.password;
|
|
722
|
+
endpoint = shouldCache ? cdnFeatureFlag('page') : 'page';
|
|
711
723
|
metadata = {
|
|
712
724
|
method: 'GET',
|
|
713
725
|
endpoint: "/file/{fileId}/document/".concat(endpoint)
|
|
714
726
|
};
|
|
727
|
+
headers = options.password ? {
|
|
728
|
+
'x-document-authorization': "Basic ".concat(options.password)
|
|
729
|
+
} : {};
|
|
715
730
|
requestOptions = _objectSpread(_objectSpread({}, metadata), {}, {
|
|
716
731
|
authContext: {
|
|
717
732
|
collectionName: options.collectionName
|
|
718
733
|
},
|
|
734
|
+
headers: headers,
|
|
719
735
|
params: {
|
|
720
736
|
collection: options.collectionName,
|
|
721
737
|
page: options.page,
|
|
722
738
|
zoom: options.zoom,
|
|
723
|
-
'max-age': _constants.FILE_CACHE_MAX_AGE
|
|
724
|
-
}
|
|
739
|
+
'max-age': shouldCache ? _constants.FILE_CACHE_MAX_AGE : 0
|
|
740
|
+
},
|
|
741
|
+
traceContext: traceContext
|
|
725
742
|
});
|
|
726
743
|
return _context13.abrupt("return", this.request("/file/".concat(id, "/document/").concat(endpoint), requestOptions).then((0, _helpers.createMapResponseToBlob)(metadata)));
|
|
727
|
-
case
|
|
744
|
+
case 6:
|
|
728
745
|
case "end":
|
|
729
746
|
return _context13.stop();
|
|
730
747
|
}
|
|
731
748
|
}, _callee13, this);
|
|
732
749
|
}));
|
|
733
|
-
function getDocumentPageImage(
|
|
750
|
+
function getDocumentPageImage(_x47, _x48, _x49) {
|
|
734
751
|
return _getDocumentPageImage.apply(this, arguments);
|
|
735
752
|
}
|
|
736
753
|
return getDocumentPageImage;
|
|
@@ -763,7 +780,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
763
780
|
}
|
|
764
781
|
}, _callee14, this);
|
|
765
782
|
}));
|
|
766
|
-
function appendChunksToUpload(
|
|
783
|
+
function appendChunksToUpload(_x50, _x51, _x52, _x53) {
|
|
767
784
|
return _appendChunksToUpload.apply(this, arguments);
|
|
768
785
|
}
|
|
769
786
|
return appendChunksToUpload;
|
|
@@ -845,7 +862,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
845
862
|
}
|
|
846
863
|
}, _callee15, this);
|
|
847
864
|
}));
|
|
848
|
-
function registerCopyIntents(
|
|
865
|
+
function registerCopyIntents(_x54, _x55, _x56) {
|
|
849
866
|
return _registerCopyIntents.apply(this, arguments);
|
|
850
867
|
}
|
|
851
868
|
return registerCopyIntents;
|
|
@@ -930,7 +947,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
930
947
|
}
|
|
931
948
|
}, _callee16, this);
|
|
932
949
|
}));
|
|
933
|
-
function request(
|
|
950
|
+
function request(_x57) {
|
|
934
951
|
return _request2.apply(this, arguments);
|
|
935
952
|
}
|
|
936
953
|
return request;
|
|
@@ -963,7 +980,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
963
980
|
}
|
|
964
981
|
}, _callee17);
|
|
965
982
|
}));
|
|
966
|
-
function testUrl(
|
|
983
|
+
function testUrl(_x58) {
|
|
967
984
|
return _testUrl.apply(this, arguments);
|
|
968
985
|
}
|
|
969
986
|
return testUrl;
|
|
@@ -291,6 +291,10 @@ function createRequestErrorReason(statusCode) {
|
|
|
291
291
|
return 'serverForbidden';
|
|
292
292
|
case 404:
|
|
293
293
|
return 'serverNotFound';
|
|
294
|
+
case 422:
|
|
295
|
+
return 'serverUnprocessableEntity';
|
|
296
|
+
case 423:
|
|
297
|
+
return 'serverEntityLocked';
|
|
294
298
|
case 429:
|
|
295
299
|
return 'serverRateLimited';
|
|
296
300
|
case 500:
|
|
@@ -395,44 +395,61 @@ export class MediaStore {
|
|
|
395
395
|
};
|
|
396
396
|
return this.request(`/file/${id}/image/metadata`, options).then(createMapResponseToJson(metadata));
|
|
397
397
|
}
|
|
398
|
-
async getDocumentContent(id, options) {
|
|
399
|
-
|
|
398
|
+
async getDocumentContent(id, options, traceContext) {
|
|
399
|
+
// when requesting for password protected document don't use CDN as it won't forward headers
|
|
400
|
+
// this is deliberate to avoid caching Password protected files
|
|
401
|
+
// Note: this should be removed once endpoint implements server side Cache-Control headers
|
|
402
|
+
const shouldCache = !options.password;
|
|
403
|
+
const endpoint = shouldCache ? cdnFeatureFlag('contents') : 'contents';
|
|
400
404
|
const metadata = {
|
|
401
405
|
method: 'GET',
|
|
402
406
|
endpoint: `/file/{fileId}/document/${endpoint}`
|
|
403
407
|
};
|
|
408
|
+
const headers = options.password ? {
|
|
409
|
+
'x-document-authorization': `Basic ${options.password}`
|
|
410
|
+
} : {};
|
|
404
411
|
const requestOptions = {
|
|
405
412
|
...metadata,
|
|
406
413
|
authContext: {
|
|
407
414
|
collectionName: options.collectionName
|
|
408
415
|
},
|
|
416
|
+
headers,
|
|
409
417
|
params: {
|
|
410
418
|
collection: options.collectionName,
|
|
411
419
|
pageStart: options.pageStart,
|
|
412
420
|
pageEnd: options.pageEnd,
|
|
413
|
-
'max-age': FILE_CACHE_MAX_AGE
|
|
414
|
-
}
|
|
421
|
+
'max-age': shouldCache ? FILE_CACHE_MAX_AGE : 0
|
|
422
|
+
},
|
|
423
|
+
traceContext
|
|
415
424
|
};
|
|
416
425
|
return this.request(`/file/${id}/document/${endpoint}`, requestOptions).then(createMapResponseToJson(metadata));
|
|
417
426
|
}
|
|
418
|
-
async getDocumentPageImage(id, options) {
|
|
419
|
-
//
|
|
420
|
-
|
|
427
|
+
async getDocumentPageImage(id, options, traceContext) {
|
|
428
|
+
// when requesting for password protected document don't use CDN as it won't forward headers
|
|
429
|
+
// this is deliberate to avoid caching Password protected files
|
|
430
|
+
// Note: this should be removed once endpoint implements server side Cache-Control headers
|
|
431
|
+
const shouldCache = !options.password;
|
|
432
|
+
const endpoint = shouldCache ? cdnFeatureFlag('page') : 'page';
|
|
421
433
|
const metadata = {
|
|
422
434
|
method: 'GET',
|
|
423
435
|
endpoint: `/file/{fileId}/document/${endpoint}`
|
|
424
436
|
};
|
|
437
|
+
const headers = options.password ? {
|
|
438
|
+
'x-document-authorization': `Basic ${options.password}`
|
|
439
|
+
} : {};
|
|
425
440
|
const requestOptions = {
|
|
426
441
|
...metadata,
|
|
427
442
|
authContext: {
|
|
428
443
|
collectionName: options.collectionName
|
|
429
444
|
},
|
|
445
|
+
headers,
|
|
430
446
|
params: {
|
|
431
447
|
collection: options.collectionName,
|
|
432
448
|
page: options.page,
|
|
433
449
|
zoom: options.zoom,
|
|
434
|
-
'max-age': FILE_CACHE_MAX_AGE
|
|
435
|
-
}
|
|
450
|
+
'max-age': shouldCache ? FILE_CACHE_MAX_AGE : 0
|
|
451
|
+
},
|
|
452
|
+
traceContext
|
|
436
453
|
};
|
|
437
454
|
return this.request(`/file/${id}/document/${endpoint}`, requestOptions).then(createMapResponseToBlob(metadata));
|
|
438
455
|
}
|
|
@@ -184,6 +184,10 @@ export function createRequestErrorReason(statusCode) {
|
|
|
184
184
|
return 'serverForbidden';
|
|
185
185
|
case 404:
|
|
186
186
|
return 'serverNotFound';
|
|
187
|
+
case 422:
|
|
188
|
+
return 'serverUnprocessableEntity';
|
|
189
|
+
case 423:
|
|
190
|
+
return 'serverEntityLocked';
|
|
187
191
|
case 429:
|
|
188
192
|
return 'serverRateLimited';
|
|
189
193
|
case 500:
|
|
@@ -659,35 +659,44 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
659
659
|
}, {
|
|
660
660
|
key: "getDocumentContent",
|
|
661
661
|
value: function () {
|
|
662
|
-
var _getDocumentContent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(id, options) {
|
|
663
|
-
var endpoint, metadata, requestOptions;
|
|
662
|
+
var _getDocumentContent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(id, options, traceContext) {
|
|
663
|
+
var shouldCache, endpoint, metadata, headers, requestOptions;
|
|
664
664
|
return _regeneratorRuntime.wrap(function _callee12$(_context12) {
|
|
665
665
|
while (1) switch (_context12.prev = _context12.next) {
|
|
666
666
|
case 0:
|
|
667
|
-
|
|
667
|
+
// when requesting for password protected document don't use CDN as it won't forward headers
|
|
668
|
+
// this is deliberate to avoid caching Password protected files
|
|
669
|
+
// Note: this should be removed once endpoint implements server side Cache-Control headers
|
|
670
|
+
shouldCache = !options.password;
|
|
671
|
+
endpoint = shouldCache ? cdnFeatureFlag('contents') : 'contents';
|
|
668
672
|
metadata = {
|
|
669
673
|
method: 'GET',
|
|
670
674
|
endpoint: "/file/{fileId}/document/".concat(endpoint)
|
|
671
675
|
};
|
|
676
|
+
headers = options.password ? {
|
|
677
|
+
'x-document-authorization': "Basic ".concat(options.password)
|
|
678
|
+
} : {};
|
|
672
679
|
requestOptions = _objectSpread(_objectSpread({}, metadata), {}, {
|
|
673
680
|
authContext: {
|
|
674
681
|
collectionName: options.collectionName
|
|
675
682
|
},
|
|
683
|
+
headers: headers,
|
|
676
684
|
params: {
|
|
677
685
|
collection: options.collectionName,
|
|
678
686
|
pageStart: options.pageStart,
|
|
679
687
|
pageEnd: options.pageEnd,
|
|
680
|
-
'max-age': FILE_CACHE_MAX_AGE
|
|
681
|
-
}
|
|
688
|
+
'max-age': shouldCache ? FILE_CACHE_MAX_AGE : 0
|
|
689
|
+
},
|
|
690
|
+
traceContext: traceContext
|
|
682
691
|
});
|
|
683
692
|
return _context12.abrupt("return", this.request("/file/".concat(id, "/document/").concat(endpoint), requestOptions).then(createMapResponseToJson(metadata)));
|
|
684
|
-
case
|
|
693
|
+
case 6:
|
|
685
694
|
case "end":
|
|
686
695
|
return _context12.stop();
|
|
687
696
|
}
|
|
688
697
|
}, _callee12, this);
|
|
689
698
|
}));
|
|
690
|
-
function getDocumentContent(_x44, _x45) {
|
|
699
|
+
function getDocumentContent(_x44, _x45, _x46) {
|
|
691
700
|
return _getDocumentContent.apply(this, arguments);
|
|
692
701
|
}
|
|
693
702
|
return getDocumentContent;
|
|
@@ -695,36 +704,44 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
695
704
|
}, {
|
|
696
705
|
key: "getDocumentPageImage",
|
|
697
706
|
value: function () {
|
|
698
|
-
var _getDocumentPageImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(id, options) {
|
|
699
|
-
var endpoint, metadata, requestOptions;
|
|
707
|
+
var _getDocumentPageImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(id, options, traceContext) {
|
|
708
|
+
var shouldCache, endpoint, metadata, headers, requestOptions;
|
|
700
709
|
return _regeneratorRuntime.wrap(function _callee13$(_context13) {
|
|
701
710
|
while (1) switch (_context13.prev = _context13.next) {
|
|
702
711
|
case 0:
|
|
703
|
-
//
|
|
704
|
-
|
|
712
|
+
// when requesting for password protected document don't use CDN as it won't forward headers
|
|
713
|
+
// this is deliberate to avoid caching Password protected files
|
|
714
|
+
// Note: this should be removed once endpoint implements server side Cache-Control headers
|
|
715
|
+
shouldCache = !options.password;
|
|
716
|
+
endpoint = shouldCache ? cdnFeatureFlag('page') : 'page';
|
|
705
717
|
metadata = {
|
|
706
718
|
method: 'GET',
|
|
707
719
|
endpoint: "/file/{fileId}/document/".concat(endpoint)
|
|
708
720
|
};
|
|
721
|
+
headers = options.password ? {
|
|
722
|
+
'x-document-authorization': "Basic ".concat(options.password)
|
|
723
|
+
} : {};
|
|
709
724
|
requestOptions = _objectSpread(_objectSpread({}, metadata), {}, {
|
|
710
725
|
authContext: {
|
|
711
726
|
collectionName: options.collectionName
|
|
712
727
|
},
|
|
728
|
+
headers: headers,
|
|
713
729
|
params: {
|
|
714
730
|
collection: options.collectionName,
|
|
715
731
|
page: options.page,
|
|
716
732
|
zoom: options.zoom,
|
|
717
|
-
'max-age': FILE_CACHE_MAX_AGE
|
|
718
|
-
}
|
|
733
|
+
'max-age': shouldCache ? FILE_CACHE_MAX_AGE : 0
|
|
734
|
+
},
|
|
735
|
+
traceContext: traceContext
|
|
719
736
|
});
|
|
720
737
|
return _context13.abrupt("return", this.request("/file/".concat(id, "/document/").concat(endpoint), requestOptions).then(createMapResponseToBlob(metadata)));
|
|
721
|
-
case
|
|
738
|
+
case 6:
|
|
722
739
|
case "end":
|
|
723
740
|
return _context13.stop();
|
|
724
741
|
}
|
|
725
742
|
}, _callee13, this);
|
|
726
743
|
}));
|
|
727
|
-
function getDocumentPageImage(
|
|
744
|
+
function getDocumentPageImage(_x47, _x48, _x49) {
|
|
728
745
|
return _getDocumentPageImage.apply(this, arguments);
|
|
729
746
|
}
|
|
730
747
|
return getDocumentPageImage;
|
|
@@ -757,7 +774,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
757
774
|
}
|
|
758
775
|
}, _callee14, this);
|
|
759
776
|
}));
|
|
760
|
-
function appendChunksToUpload(
|
|
777
|
+
function appendChunksToUpload(_x50, _x51, _x52, _x53) {
|
|
761
778
|
return _appendChunksToUpload.apply(this, arguments);
|
|
762
779
|
}
|
|
763
780
|
return appendChunksToUpload;
|
|
@@ -839,7 +856,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
839
856
|
}
|
|
840
857
|
}, _callee15, this);
|
|
841
858
|
}));
|
|
842
|
-
function registerCopyIntents(
|
|
859
|
+
function registerCopyIntents(_x54, _x55, _x56) {
|
|
843
860
|
return _registerCopyIntents.apply(this, arguments);
|
|
844
861
|
}
|
|
845
862
|
return registerCopyIntents;
|
|
@@ -924,7 +941,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
924
941
|
}
|
|
925
942
|
}, _callee16, this);
|
|
926
943
|
}));
|
|
927
|
-
function request(
|
|
944
|
+
function request(_x57) {
|
|
928
945
|
return _request2.apply(this, arguments);
|
|
929
946
|
}
|
|
930
947
|
return request;
|
|
@@ -957,7 +974,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
957
974
|
}
|
|
958
975
|
}, _callee17);
|
|
959
976
|
}));
|
|
960
|
-
function testUrl(
|
|
977
|
+
function testUrl(_x58) {
|
|
961
978
|
return _testUrl.apply(this, arguments);
|
|
962
979
|
}
|
|
963
980
|
return testUrl;
|
|
@@ -267,6 +267,10 @@ export function createRequestErrorReason(statusCode) {
|
|
|
267
267
|
return 'serverForbidden';
|
|
268
268
|
case 404:
|
|
269
269
|
return 'serverNotFound';
|
|
270
|
+
case 422:
|
|
271
|
+
return 'serverUnprocessableEntity';
|
|
272
|
+
case 423:
|
|
273
|
+
return 'serverEntityLocked';
|
|
270
274
|
case 429:
|
|
271
275
|
return 'serverRateLimited';
|
|
272
276
|
case 500:
|
|
@@ -30,8 +30,8 @@ export declare class MediaStore implements MediaApi {
|
|
|
30
30
|
getImageMetadata(id: string, params?: MediaStoreGetFileImageParams, traceContext?: MediaTraceContext): Promise<{
|
|
31
31
|
metadata: ImageMetadata;
|
|
32
32
|
}>;
|
|
33
|
-
getDocumentContent(id: string, options: GetDocumentContentOptions): Promise<DocumentPageRangeContent>;
|
|
34
|
-
getDocumentPageImage(id: string, options: GetDocumentPageImage): Promise<Blob>;
|
|
33
|
+
getDocumentContent(id: string, options: GetDocumentContentOptions, traceContext?: MediaTraceContext): Promise<DocumentPageRangeContent>;
|
|
34
|
+
getDocumentPageImage(id: string, options: GetDocumentPageImage, traceContext?: MediaTraceContext): Promise<Blob>;
|
|
35
35
|
appendChunksToUpload(uploadId: string, body: AppendChunksToUploadRequestBody, collectionName?: string, traceContext?: MediaTraceContext): Promise<void>;
|
|
36
36
|
copyFileWithToken(body: MediaStoreCopyFileWithTokenBody, params: MediaStoreCopyFileWithTokenParams, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaFile>>;
|
|
37
37
|
copyFile(id: string, params: CopyFileParams, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaFile>>;
|
|
@@ -202,7 +202,7 @@ export interface MediaApi {
|
|
|
202
202
|
resolveAuth: (authContext?: AuthContext) => Promise<Auth>;
|
|
203
203
|
resolveInitialAuth: () => Auth;
|
|
204
204
|
/** @exprimental This is exprimental for the purposes of enabling the document viewer and not ready for external use, it is prone to breaking changes */
|
|
205
|
-
getDocumentContent(id: string, options: GetDocumentContentOptions): Promise<DocumentPageRangeContent>;
|
|
205
|
+
getDocumentContent(id: string, options: GetDocumentContentOptions, traceContext?: MediaTraceContext): Promise<DocumentPageRangeContent>;
|
|
206
206
|
/** @exprimental This is exprimental for the purposes of enabling the document viewer and not ready for external use, it is prone to breaking changes */
|
|
207
|
-
getDocumentPageImage(id: string, options: GetDocumentPageImage): Promise<Blob>;
|
|
207
|
+
getDocumentPageImage(id: string, options: GetDocumentPageImage, traceContext?: MediaTraceContext): Promise<Blob>;
|
|
208
208
|
}
|
|
@@ -69,6 +69,7 @@ export type DocumentPageContent = {
|
|
|
69
69
|
lines: readonly Line[];
|
|
70
70
|
annotations: DocumentAnnotations;
|
|
71
71
|
links: readonly DocumentLink[];
|
|
72
|
+
password?: string;
|
|
72
73
|
};
|
|
73
74
|
export type DocumentPageRangeContent = {
|
|
74
75
|
total_pages: number;
|
|
@@ -82,10 +83,12 @@ export type GetDocumentContentOptions = {
|
|
|
82
83
|
pageEnd: number;
|
|
83
84
|
collectionName?: string;
|
|
84
85
|
maxAge?: number;
|
|
86
|
+
password?: string;
|
|
85
87
|
};
|
|
86
88
|
export type GetDocumentPageImage = {
|
|
87
89
|
page: number;
|
|
88
90
|
zoom: number;
|
|
89
91
|
collectionName?: string;
|
|
90
92
|
maxAge?: number;
|
|
93
|
+
password?: string;
|
|
91
94
|
};
|
|
@@ -2,7 +2,7 @@ import { type MediaTraceContext } from '@atlaskit/media-common';
|
|
|
2
2
|
export interface SerializableObject {
|
|
3
3
|
[key: string]: string | number | boolean | null | undefined | SerializableObject;
|
|
4
4
|
}
|
|
5
|
-
export type MediaClientErrorReason = 'clientOffline' | 'clientAbortedRequest' | 'clientTimeoutRequest' | 'serverInvalidBody' | 'serverBadRequest' | 'serverUnauthorized' | 'serverForbidden' | 'serverNotFound' | 'serverRateLimited' | 'serverInternalError' | 'serverBadGateway' | 'serverUnexpectedError' | 'failedAuthProvider' | 'tokenExpired' | 'missingInitialAuth' | 'emptyAuth' | 'authProviderTimedOut' | 'invalidFileId' | 'emptyItems' | 'zeroVersionFile' | 'emptyFileName' | 'pollingMaxAttemptsExceeded' | 'fileSizeExceedsLimit' | 'deprecatedEndpoint';
|
|
5
|
+
export type MediaClientErrorReason = 'clientOffline' | 'clientAbortedRequest' | 'clientTimeoutRequest' | 'serverInvalidBody' | 'serverBadRequest' | 'serverUnauthorized' | 'serverForbidden' | 'serverNotFound' | 'serverRateLimited' | 'serverInternalError' | 'serverBadGateway' | 'serverUnexpectedError' | 'serverUnprocessableEntity' | 'serverEntityLocked' | 'failedAuthProvider' | 'tokenExpired' | 'missingInitialAuth' | 'emptyAuth' | 'authProviderTimedOut' | 'invalidFileId' | 'emptyItems' | 'zeroVersionFile' | 'emptyFileName' | 'pollingMaxAttemptsExceeded' | 'fileSizeExceedsLimit' | 'deprecatedEndpoint';
|
|
6
6
|
export type MediaClientErrorMetadata = SerializableObject & {
|
|
7
7
|
traceContext?: MediaTraceContext;
|
|
8
8
|
};
|
|
@@ -36,7 +36,7 @@ export type CreateUrlOptions = {
|
|
|
36
36
|
readonly params?: RequestParams;
|
|
37
37
|
readonly auth?: Auth;
|
|
38
38
|
};
|
|
39
|
-
export type RequestErrorReason = 'clientOffline' | 'clientAbortedRequest' | 'clientTimeoutRequest' | 'serverInvalidBody' | 'serverBadRequest' | 'serverUnauthorized' | 'serverForbidden' | 'serverNotFound' | 'serverRateLimited' | 'serverInternalError' | 'serverBadGateway' | 'serverUnexpectedError';
|
|
39
|
+
export type RequestErrorReason = 'clientOffline' | 'clientAbortedRequest' | 'clientTimeoutRequest' | 'serverInvalidBody' | 'serverBadRequest' | 'serverUnauthorized' | 'serverForbidden' | 'serverNotFound' | 'serverRateLimited' | 'serverInternalError' | 'serverBadGateway' | 'serverUnprocessableEntity' | 'serverEntityLocked' | 'serverUnexpectedError';
|
|
40
40
|
export type RequestErrorMetadata = RequestMetadata & {
|
|
41
41
|
readonly attempts?: number;
|
|
42
42
|
readonly clientExhaustedRetries?: boolean;
|
|
@@ -30,8 +30,8 @@ export declare class MediaStore implements MediaApi {
|
|
|
30
30
|
getImageMetadata(id: string, params?: MediaStoreGetFileImageParams, traceContext?: MediaTraceContext): Promise<{
|
|
31
31
|
metadata: ImageMetadata;
|
|
32
32
|
}>;
|
|
33
|
-
getDocumentContent(id: string, options: GetDocumentContentOptions): Promise<DocumentPageRangeContent>;
|
|
34
|
-
getDocumentPageImage(id: string, options: GetDocumentPageImage): Promise<Blob>;
|
|
33
|
+
getDocumentContent(id: string, options: GetDocumentContentOptions, traceContext?: MediaTraceContext): Promise<DocumentPageRangeContent>;
|
|
34
|
+
getDocumentPageImage(id: string, options: GetDocumentPageImage, traceContext?: MediaTraceContext): Promise<Blob>;
|
|
35
35
|
appendChunksToUpload(uploadId: string, body: AppendChunksToUploadRequestBody, collectionName?: string, traceContext?: MediaTraceContext): Promise<void>;
|
|
36
36
|
copyFileWithToken(body: MediaStoreCopyFileWithTokenBody, params: MediaStoreCopyFileWithTokenParams, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaFile>>;
|
|
37
37
|
copyFile(id: string, params: CopyFileParams, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaFile>>;
|
|
@@ -202,7 +202,7 @@ export interface MediaApi {
|
|
|
202
202
|
resolveAuth: (authContext?: AuthContext) => Promise<Auth>;
|
|
203
203
|
resolveInitialAuth: () => Auth;
|
|
204
204
|
/** @exprimental This is exprimental for the purposes of enabling the document viewer and not ready for external use, it is prone to breaking changes */
|
|
205
|
-
getDocumentContent(id: string, options: GetDocumentContentOptions): Promise<DocumentPageRangeContent>;
|
|
205
|
+
getDocumentContent(id: string, options: GetDocumentContentOptions, traceContext?: MediaTraceContext): Promise<DocumentPageRangeContent>;
|
|
206
206
|
/** @exprimental This is exprimental for the purposes of enabling the document viewer and not ready for external use, it is prone to breaking changes */
|
|
207
|
-
getDocumentPageImage(id: string, options: GetDocumentPageImage): Promise<Blob>;
|
|
207
|
+
getDocumentPageImage(id: string, options: GetDocumentPageImage, traceContext?: MediaTraceContext): Promise<Blob>;
|
|
208
208
|
}
|
|
@@ -69,6 +69,7 @@ export type DocumentPageContent = {
|
|
|
69
69
|
lines: readonly Line[];
|
|
70
70
|
annotations: DocumentAnnotations;
|
|
71
71
|
links: readonly DocumentLink[];
|
|
72
|
+
password?: string;
|
|
72
73
|
};
|
|
73
74
|
export type DocumentPageRangeContent = {
|
|
74
75
|
total_pages: number;
|
|
@@ -82,10 +83,12 @@ export type GetDocumentContentOptions = {
|
|
|
82
83
|
pageEnd: number;
|
|
83
84
|
collectionName?: string;
|
|
84
85
|
maxAge?: number;
|
|
86
|
+
password?: string;
|
|
85
87
|
};
|
|
86
88
|
export type GetDocumentPageImage = {
|
|
87
89
|
page: number;
|
|
88
90
|
zoom: number;
|
|
89
91
|
collectionName?: string;
|
|
90
92
|
maxAge?: number;
|
|
93
|
+
password?: string;
|
|
91
94
|
};
|
|
@@ -2,7 +2,7 @@ import { type MediaTraceContext } from '@atlaskit/media-common';
|
|
|
2
2
|
export interface SerializableObject {
|
|
3
3
|
[key: string]: string | number | boolean | null | undefined | SerializableObject;
|
|
4
4
|
}
|
|
5
|
-
export type MediaClientErrorReason = 'clientOffline' | 'clientAbortedRequest' | 'clientTimeoutRequest' | 'serverInvalidBody' | 'serverBadRequest' | 'serverUnauthorized' | 'serverForbidden' | 'serverNotFound' | 'serverRateLimited' | 'serverInternalError' | 'serverBadGateway' | 'serverUnexpectedError' | 'failedAuthProvider' | 'tokenExpired' | 'missingInitialAuth' | 'emptyAuth' | 'authProviderTimedOut' | 'invalidFileId' | 'emptyItems' | 'zeroVersionFile' | 'emptyFileName' | 'pollingMaxAttemptsExceeded' | 'fileSizeExceedsLimit' | 'deprecatedEndpoint';
|
|
5
|
+
export type MediaClientErrorReason = 'clientOffline' | 'clientAbortedRequest' | 'clientTimeoutRequest' | 'serverInvalidBody' | 'serverBadRequest' | 'serverUnauthorized' | 'serverForbidden' | 'serverNotFound' | 'serverRateLimited' | 'serverInternalError' | 'serverBadGateway' | 'serverUnexpectedError' | 'serverUnprocessableEntity' | 'serverEntityLocked' | 'failedAuthProvider' | 'tokenExpired' | 'missingInitialAuth' | 'emptyAuth' | 'authProviderTimedOut' | 'invalidFileId' | 'emptyItems' | 'zeroVersionFile' | 'emptyFileName' | 'pollingMaxAttemptsExceeded' | 'fileSizeExceedsLimit' | 'deprecatedEndpoint';
|
|
6
6
|
export type MediaClientErrorMetadata = SerializableObject & {
|
|
7
7
|
traceContext?: MediaTraceContext;
|
|
8
8
|
};
|
|
@@ -36,7 +36,7 @@ export type CreateUrlOptions = {
|
|
|
36
36
|
readonly params?: RequestParams;
|
|
37
37
|
readonly auth?: Auth;
|
|
38
38
|
};
|
|
39
|
-
export type RequestErrorReason = 'clientOffline' | 'clientAbortedRequest' | 'clientTimeoutRequest' | 'serverInvalidBody' | 'serverBadRequest' | 'serverUnauthorized' | 'serverForbidden' | 'serverNotFound' | 'serverRateLimited' | 'serverInternalError' | 'serverBadGateway' | 'serverUnexpectedError';
|
|
39
|
+
export type RequestErrorReason = 'clientOffline' | 'clientAbortedRequest' | 'clientTimeoutRequest' | 'serverInvalidBody' | 'serverBadRequest' | 'serverUnauthorized' | 'serverForbidden' | 'serverNotFound' | 'serverRateLimited' | 'serverInternalError' | 'serverBadGateway' | 'serverUnprocessableEntity' | 'serverEntityLocked' | 'serverUnexpectedError';
|
|
40
40
|
export type RequestErrorMetadata = RequestMetadata & {
|
|
41
41
|
readonly attempts?: number;
|
|
42
42
|
readonly clientExhaustedRetries?: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-client",
|
|
3
|
-
"version": "34.
|
|
3
|
+
"version": "34.2.0",
|
|
4
4
|
"description": "Media API Web Client Library",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@atlaskit/chunkinator": "^7.0.0",
|
|
38
|
-
"@atlaskit/media-common": "^12.
|
|
38
|
+
"@atlaskit/media-common": "^12.3.0",
|
|
39
39
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
40
40
|
"@babel/runtime": "^7.0.0",
|
|
41
41
|
"dataloader": "^2.1.0",
|