@atlaskit/media-client 39.2.6 → 39.3.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 +25 -0
- package/dist/cjs/client/file-fetcher/index.js +1 -2
- package/dist/cjs/client/media-client.js +45 -26
- package/dist/cjs/client/media-store/MediaStore.js +117 -78
- package/dist/es2019/client/file-fetcher/index.js +1 -2
- package/dist/es2019/client/media-client.js +5 -2
- package/dist/es2019/client/media-store/MediaStore.js +16 -1
- package/dist/esm/client/file-fetcher/index.js +1 -2
- package/dist/esm/client/media-client.js +45 -26
- package/dist/esm/client/media-store/MediaStore.js +117 -78
- package/dist/types/client/media-client.d.ts +3 -1
- package/dist/types/client/media-store/MediaStore.d.ts +8 -1
- package/dist/types/client/media-store/types.d.ts +1 -1
- package/is-error-file-state/package.json +8 -0
- package/is-file-identifier/package.json +8 -0
- package/is-image-representation-ready/package.json +8 -0
- package/package.json +3 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @atlaskit/media-client
|
|
2
2
|
|
|
3
|
+
## 39.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`c570c6f9b75f7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c570c6f9b75f7) -
|
|
8
|
+
`getImage` takes an optional `clientOptions` argument after `traceContext`, so a caller can set
|
|
9
|
+
retry options for one request. `preloadMediaViewer` uses it to make a single attempt.
|
|
10
|
+
- [`c570c6f9b75f7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c570c6f9b75f7) -
|
|
11
|
+
Add `getImageWatermarkVersion(collectionName)` to `MediaClient`. It resolves the watermark version
|
|
12
|
+
`getImage` sends as `wmv`, or `undefined` when it sends none, so a caller that reuses an image
|
|
13
|
+
fetched earlier can tell whether the watermark config has changed since. `preloadMediaViewer` uses
|
|
14
|
+
it to key its warm-ups.
|
|
15
|
+
- [`c570c6f9b75f7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c570c6f9b75f7) -
|
|
16
|
+
Add `is-file-identifier`, `is-error-file-state` and `is-image-representation-ready` subpath
|
|
17
|
+
exports for `isFileIdentifier`, `isErrorFileState` and `isImageRepresentationReady`, so consumers
|
|
18
|
+
can import them without the package barrel.
|
|
19
|
+
|
|
20
|
+
## 39.2.7
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- [`c33f58ae5e045`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c33f58ae5e045) -
|
|
25
|
+
Clean up experiment cc_maui_polish_changes_batch_8. Anonymized Rovo image uploads now always get a
|
|
26
|
+
MIME-derived file extension.
|
|
27
|
+
|
|
3
28
|
## 39.2.6
|
|
4
29
|
|
|
5
30
|
### Patch Changes
|
|
@@ -32,7 +32,6 @@ var _isValidUuid = require("@atlaskit/media-common/isValidUuid");
|
|
|
32
32
|
var _mediaTypeUtils = require("@atlaskit/media-common/mediaTypeUtils");
|
|
33
33
|
var _authToOwner = require("@atlaskit/media-core/auth-to-owner");
|
|
34
34
|
var _mediaStore = require("@atlaskit/media-state/media-store");
|
|
35
|
-
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
36
35
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
37
36
|
var _constants = require("../../constants");
|
|
38
37
|
var _fileStreamsCache = require("../../file-streams-cache");
|
|
@@ -677,7 +676,7 @@ var FileFetcherImpl = exports.FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
677
676
|
return _context9.abrupt("return", reject('Could not download remote file'));
|
|
678
677
|
case 2:
|
|
679
678
|
type = blob.type, size = blob.size;
|
|
680
|
-
extensionAllowed = anonymizeFilename
|
|
679
|
+
extensionAllowed = anonymizeFilename || (0, _fg.fg)('platform_media_unique_external_upload_name');
|
|
681
680
|
_splitExtension3 = splitExtension(initialName), _splitExtension4 = (0, _slicedToArray2.default)(_splitExtension3, 2), existingExtension = _splitExtension4[1];
|
|
682
681
|
extension = extensionAllowed && !existingExtension ? (0, _mime.getExtension)(type) : undefined;
|
|
683
682
|
name = extension ? "".concat(initialName, ".").concat(extension) : initialName;
|
|
@@ -50,8 +50,8 @@ var MediaClient = exports.MediaClient = /*#__PURE__*/function () {
|
|
|
50
50
|
}
|
|
51
51
|
}, {
|
|
52
52
|
key: "getImage",
|
|
53
|
-
value: function getImage(id, params, controller, fetchMaxRes, traceContext) {
|
|
54
|
-
return this.mediaStore.getImage(id, params, controller, fetchMaxRes, traceContext);
|
|
53
|
+
value: function getImage(id, params, controller, fetchMaxRes, traceContext, clientOptions) {
|
|
54
|
+
return this.mediaStore.getImage(id, params, controller, fetchMaxRes, traceContext, clientOptions);
|
|
55
55
|
}
|
|
56
56
|
}, {
|
|
57
57
|
key: "getImageUrl",
|
|
@@ -88,23 +88,42 @@ var MediaClient = exports.MediaClient = /*#__PURE__*/function () {
|
|
|
88
88
|
return this.mediaStore.getClientIdSync();
|
|
89
89
|
}
|
|
90
90
|
}, {
|
|
91
|
-
key: "
|
|
91
|
+
key: "getImageWatermarkVersion",
|
|
92
92
|
value: function () {
|
|
93
|
-
var
|
|
93
|
+
var _getImageWatermarkVersion = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(collectionName) {
|
|
94
94
|
return _regenerator.default.wrap(function (_context2) {
|
|
95
95
|
while (1) switch (_context2.prev = _context2.next) {
|
|
96
96
|
case 0:
|
|
97
|
-
_context2.
|
|
98
|
-
return this.mediaStore.getImageMetadata(id, params);
|
|
97
|
+
return _context2.abrupt("return", this.mediaStore.getImageWatermarkVersion(collectionName));
|
|
99
98
|
case 1:
|
|
100
|
-
return _context2.abrupt("return", _context2.sent.metadata);
|
|
101
|
-
case 2:
|
|
102
99
|
case "end":
|
|
103
100
|
return _context2.stop();
|
|
104
101
|
}
|
|
105
102
|
}, _callee2, this);
|
|
106
103
|
}));
|
|
107
|
-
function
|
|
104
|
+
function getImageWatermarkVersion(_x2) {
|
|
105
|
+
return _getImageWatermarkVersion.apply(this, arguments);
|
|
106
|
+
}
|
|
107
|
+
return getImageWatermarkVersion;
|
|
108
|
+
}()
|
|
109
|
+
}, {
|
|
110
|
+
key: "getImageMetadata",
|
|
111
|
+
value: function () {
|
|
112
|
+
var _getImageMetadata = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(id, params) {
|
|
113
|
+
return _regenerator.default.wrap(function (_context3) {
|
|
114
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
115
|
+
case 0:
|
|
116
|
+
_context3.next = 1;
|
|
117
|
+
return this.mediaStore.getImageMetadata(id, params);
|
|
118
|
+
case 1:
|
|
119
|
+
return _context3.abrupt("return", _context3.sent.metadata);
|
|
120
|
+
case 2:
|
|
121
|
+
case "end":
|
|
122
|
+
return _context3.stop();
|
|
123
|
+
}
|
|
124
|
+
}, _callee3, this);
|
|
125
|
+
}));
|
|
126
|
+
function getImageMetadata(_x3, _x4) {
|
|
108
127
|
return _getImageMetadata.apply(this, arguments);
|
|
109
128
|
}
|
|
110
129
|
return getImageMetadata;
|
|
@@ -112,30 +131,30 @@ var MediaClient = exports.MediaClient = /*#__PURE__*/function () {
|
|
|
112
131
|
}, {
|
|
113
132
|
key: "mobileUploadPromise",
|
|
114
133
|
value: function () {
|
|
115
|
-
var _mobileUploadPromise = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
134
|
+
var _mobileUploadPromise = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
116
135
|
var module;
|
|
117
|
-
return _regenerator.default.wrap(function (
|
|
118
|
-
while (1) switch (
|
|
136
|
+
return _regenerator.default.wrap(function (_context4) {
|
|
137
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
119
138
|
case 0:
|
|
120
139
|
if (!this.mobileUpload) {
|
|
121
|
-
|
|
140
|
+
_context4.next = 1;
|
|
122
141
|
break;
|
|
123
142
|
}
|
|
124
|
-
return
|
|
143
|
+
return _context4.abrupt("return", this.mobileUpload);
|
|
125
144
|
case 1:
|
|
126
|
-
|
|
145
|
+
_context4.next = 2;
|
|
127
146
|
return Promise.resolve().then(function () {
|
|
128
147
|
return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_media-client-mobile-upload" */'./mobile-upload'));
|
|
129
148
|
});
|
|
130
149
|
case 2:
|
|
131
|
-
module =
|
|
150
|
+
module = _context4.sent;
|
|
132
151
|
this.mobileUpload = new module.MobileUploadImpl(this.mediaStore, this.store);
|
|
133
|
-
return
|
|
152
|
+
return _context4.abrupt("return", this.mobileUpload);
|
|
134
153
|
case 3:
|
|
135
154
|
case "end":
|
|
136
|
-
return
|
|
155
|
+
return _context4.stop();
|
|
137
156
|
}
|
|
138
|
-
},
|
|
157
|
+
}, _callee4, this);
|
|
139
158
|
}));
|
|
140
159
|
function mobileUploadPromise() {
|
|
141
160
|
return _mobileUploadPromise.apply(this, arguments);
|
|
@@ -145,19 +164,19 @@ var MediaClient = exports.MediaClient = /*#__PURE__*/function () {
|
|
|
145
164
|
}, {
|
|
146
165
|
key: "removeFileFromCollection",
|
|
147
166
|
value: function () {
|
|
148
|
-
var _removeFileFromCollection = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
149
|
-
return _regenerator.default.wrap(function (
|
|
150
|
-
while (1) switch (
|
|
167
|
+
var _removeFileFromCollection = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(id, collectionName, occurrenceKey, traceContext) {
|
|
168
|
+
return _regenerator.default.wrap(function (_context5) {
|
|
169
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
151
170
|
case 0:
|
|
152
|
-
|
|
171
|
+
_context5.next = 1;
|
|
153
172
|
return this.mediaStore.removeCollectionFile(id, collectionName, occurrenceKey, traceContext);
|
|
154
173
|
case 1:
|
|
155
174
|
case "end":
|
|
156
|
-
return
|
|
175
|
+
return _context5.stop();
|
|
157
176
|
}
|
|
158
|
-
},
|
|
177
|
+
}, _callee5, this);
|
|
159
178
|
}));
|
|
160
|
-
function removeFileFromCollection(
|
|
179
|
+
function removeFileFromCollection(_x5, _x6, _x7, _x8) {
|
|
161
180
|
return _removeFileFromCollection.apply(this, arguments);
|
|
162
181
|
}
|
|
163
182
|
return removeFileFromCollection;
|
|
@@ -641,13 +641,51 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
641
641
|
}
|
|
642
642
|
return getArtifactURL;
|
|
643
643
|
}()
|
|
644
|
+
}, {
|
|
645
|
+
key: "getImageWatermarkVersion",
|
|
646
|
+
value: (
|
|
647
|
+
/**
|
|
648
|
+
* The watermark version `getImage` sends as `wmv` for `collectionName`, or
|
|
649
|
+
* `undefined` when it sends none. A caller that reuses an image fetched earlier can
|
|
650
|
+
* compare it to tell whether the watermark config has changed since.
|
|
651
|
+
*/
|
|
652
|
+
function () {
|
|
653
|
+
var _getImageWatermarkVersion = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(collectionName) {
|
|
654
|
+
var auth;
|
|
655
|
+
return _regenerator.default.wrap(function (_context10) {
|
|
656
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
657
|
+
case 0:
|
|
658
|
+
if ((0, _fg.fg)('confluence_watermark_admin_ui')) {
|
|
659
|
+
_context10.next = 1;
|
|
660
|
+
break;
|
|
661
|
+
}
|
|
662
|
+
return _context10.abrupt("return", undefined);
|
|
663
|
+
case 1:
|
|
664
|
+
_context10.next = 2;
|
|
665
|
+
return this.resolveAuth({
|
|
666
|
+
collectionName: collectionName
|
|
667
|
+
});
|
|
668
|
+
case 2:
|
|
669
|
+
auth = _context10.sent;
|
|
670
|
+
return _context10.abrupt("return", (0, _watermarkVersion.getWatermarkVersionFromToken)(auth.token));
|
|
671
|
+
case 3:
|
|
672
|
+
case "end":
|
|
673
|
+
return _context10.stop();
|
|
674
|
+
}
|
|
675
|
+
}, _callee10, this);
|
|
676
|
+
}));
|
|
677
|
+
function getImageWatermarkVersion(_x33) {
|
|
678
|
+
return _getImageWatermarkVersion.apply(this, arguments);
|
|
679
|
+
}
|
|
680
|
+
return getImageWatermarkVersion;
|
|
681
|
+
}())
|
|
644
682
|
}, {
|
|
645
683
|
key: "getImage",
|
|
646
684
|
value: function () {
|
|
647
|
-
var _getImage = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
685
|
+
var _getImage = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(id, params, controller, fetchMaxRes, traceContext, clientOptions) {
|
|
648
686
|
var isWebpSupported, headers, imageEndpoint, metadata, wmvParams, authOptions, auth, wmv, options;
|
|
649
|
-
return _regenerator.default.wrap(function (
|
|
650
|
-
while (1) switch (
|
|
687
|
+
return _regenerator.default.wrap(function (_context11) {
|
|
688
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
651
689
|
case 0:
|
|
652
690
|
// TODO add checkWebpSupport() back https://product-fabric.atlassian.net/browse/MPT-584
|
|
653
691
|
isWebpSupported = false;
|
|
@@ -667,13 +705,13 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
667
705
|
}
|
|
668
706
|
};
|
|
669
707
|
if (!(0, _fg.fg)('confluence_watermark_admin_ui')) {
|
|
670
|
-
|
|
708
|
+
_context11.next = 2;
|
|
671
709
|
break;
|
|
672
710
|
}
|
|
673
|
-
|
|
711
|
+
_context11.next = 1;
|
|
674
712
|
return this.resolveAuth(authOptions.authContext);
|
|
675
713
|
case 1:
|
|
676
|
-
auth =
|
|
714
|
+
auth = _context11.sent;
|
|
677
715
|
wmv = (0, _watermarkVersion.getWatermarkVersionFromToken)(auth.token);
|
|
678
716
|
if (wmv) {
|
|
679
717
|
wmvParams = {
|
|
@@ -688,16 +726,17 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
688
726
|
params: _objectSpread(_objectSpread({}, (0, _extendImageParams.extendImageParams)(params, fetchMaxRes)), wmvParams),
|
|
689
727
|
headers: headers,
|
|
690
728
|
traceContext: traceContext,
|
|
729
|
+
clientOptions: clientOptions,
|
|
691
730
|
addMediaClientParam: true
|
|
692
731
|
});
|
|
693
|
-
return
|
|
732
|
+
return _context11.abrupt("return", this.request("/file/".concat(id, "/").concat(imageEndpoint), options, controller, true).then((0, _createMapResponseToBlob.createMapResponseToBlob)(metadata)));
|
|
694
733
|
case 3:
|
|
695
734
|
case "end":
|
|
696
|
-
return
|
|
735
|
+
return _context11.stop();
|
|
697
736
|
}
|
|
698
|
-
},
|
|
737
|
+
}, _callee11, this);
|
|
699
738
|
}));
|
|
700
|
-
function getImage(
|
|
739
|
+
function getImage(_x34, _x35, _x36, _x37, _x38, _x39) {
|
|
701
740
|
return _getImage.apply(this, arguments);
|
|
702
741
|
}
|
|
703
742
|
return getImage;
|
|
@@ -705,10 +744,10 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
705
744
|
}, {
|
|
706
745
|
key: "getItems",
|
|
707
746
|
value: function () {
|
|
708
|
-
var _getItems = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
747
|
+
var _getItems = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(ids, collectionName, traceContext, includeHashForDuplicateFiles) {
|
|
709
748
|
var descriptors, metadata, options;
|
|
710
|
-
return _regenerator.default.wrap(function (
|
|
711
|
-
while (1) switch (
|
|
749
|
+
return _regenerator.default.wrap(function (_context12) {
|
|
750
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
712
751
|
case 0:
|
|
713
752
|
descriptors = ids.map(function (id) {
|
|
714
753
|
return {
|
|
@@ -732,14 +771,14 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
732
771
|
}),
|
|
733
772
|
traceContext: traceContext
|
|
734
773
|
});
|
|
735
|
-
return
|
|
774
|
+
return _context12.abrupt("return", this.request('/items', options).then((0, _createMapResponseToJson.createMapResponseToJson)(metadata)));
|
|
736
775
|
case 1:
|
|
737
776
|
case "end":
|
|
738
|
-
return
|
|
777
|
+
return _context12.stop();
|
|
739
778
|
}
|
|
740
|
-
},
|
|
779
|
+
}, _callee12, this);
|
|
741
780
|
}));
|
|
742
|
-
function getItems(
|
|
781
|
+
function getItems(_x40, _x41, _x42, _x43) {
|
|
743
782
|
return _getItems.apply(this, arguments);
|
|
744
783
|
}
|
|
745
784
|
return getItems;
|
|
@@ -747,10 +786,10 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
747
786
|
}, {
|
|
748
787
|
key: "getImageMetadata",
|
|
749
788
|
value: function () {
|
|
750
|
-
var _getImageMetadata = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
789
|
+
var _getImageMetadata = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(id, params, traceContext) {
|
|
751
790
|
var metadata, options;
|
|
752
|
-
return _regenerator.default.wrap(function (
|
|
753
|
-
while (1) switch (
|
|
791
|
+
return _regenerator.default.wrap(function (_context13) {
|
|
792
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
754
793
|
case 0:
|
|
755
794
|
metadata = {
|
|
756
795
|
method: 'GET',
|
|
@@ -763,14 +802,14 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
763
802
|
params: params,
|
|
764
803
|
traceContext: traceContext
|
|
765
804
|
});
|
|
766
|
-
return
|
|
805
|
+
return _context13.abrupt("return", this.request("/file/".concat(id, "/image/metadata"), options).then((0, _createMapResponseToJson.createMapResponseToJson)(metadata)));
|
|
767
806
|
case 1:
|
|
768
807
|
case "end":
|
|
769
|
-
return
|
|
808
|
+
return _context13.stop();
|
|
770
809
|
}
|
|
771
|
-
},
|
|
810
|
+
}, _callee13, this);
|
|
772
811
|
}));
|
|
773
|
-
function getImageMetadata(
|
|
812
|
+
function getImageMetadata(_x44, _x45, _x46) {
|
|
774
813
|
return _getImageMetadata.apply(this, arguments);
|
|
775
814
|
}
|
|
776
815
|
return getImageMetadata;
|
|
@@ -778,10 +817,10 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
778
817
|
}, {
|
|
779
818
|
key: "getDocumentContent",
|
|
780
819
|
value: function () {
|
|
781
|
-
var _getDocumentContent = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
820
|
+
var _getDocumentContent = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(id, options, traceContext) {
|
|
782
821
|
var shouldCache, endpoint, metadata, headers, requestOptions;
|
|
783
|
-
return _regenerator.default.wrap(function (
|
|
784
|
-
while (1) switch (
|
|
822
|
+
return _regenerator.default.wrap(function (_context14) {
|
|
823
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
785
824
|
case 0:
|
|
786
825
|
// when requesting for password protected document don't use CDN as it won't forward headers
|
|
787
826
|
// this is deliberate to avoid caching Password protected files
|
|
@@ -808,14 +847,14 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
808
847
|
},
|
|
809
848
|
traceContext: traceContext
|
|
810
849
|
});
|
|
811
|
-
return
|
|
850
|
+
return _context14.abrupt("return", this.request("/file/".concat(id, "/document/").concat(endpoint), requestOptions).then((0, _createMapResponseToJson.createMapResponseToJson)(metadata)));
|
|
812
851
|
case 1:
|
|
813
852
|
case "end":
|
|
814
|
-
return
|
|
853
|
+
return _context14.stop();
|
|
815
854
|
}
|
|
816
|
-
},
|
|
855
|
+
}, _callee14, this);
|
|
817
856
|
}));
|
|
818
|
-
function getDocumentContent(
|
|
857
|
+
function getDocumentContent(_x47, _x48, _x49) {
|
|
819
858
|
return _getDocumentContent.apply(this, arguments);
|
|
820
859
|
}
|
|
821
860
|
return getDocumentContent;
|
|
@@ -823,10 +862,10 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
823
862
|
}, {
|
|
824
863
|
key: "getDocumentPageImage",
|
|
825
864
|
value: function () {
|
|
826
|
-
var _getDocumentPageImage = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
865
|
+
var _getDocumentPageImage = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(id, options, traceContext) {
|
|
827
866
|
var shouldCache, endpoint, metadata, headers, requestOptions;
|
|
828
|
-
return _regenerator.default.wrap(function (
|
|
829
|
-
while (1) switch (
|
|
867
|
+
return _regenerator.default.wrap(function (_context15) {
|
|
868
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
830
869
|
case 0:
|
|
831
870
|
// when requesting for password protected document don't use CDN as it won't forward headers
|
|
832
871
|
// this is deliberate to avoid caching Password protected files
|
|
@@ -853,14 +892,14 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
853
892
|
},
|
|
854
893
|
traceContext: traceContext
|
|
855
894
|
});
|
|
856
|
-
return
|
|
895
|
+
return _context15.abrupt("return", this.request("/file/".concat(id, "/document/").concat(endpoint), requestOptions).then((0, _createMapResponseToBlob.createMapResponseToBlob)(metadata)));
|
|
857
896
|
case 1:
|
|
858
897
|
case "end":
|
|
859
|
-
return
|
|
898
|
+
return _context15.stop();
|
|
860
899
|
}
|
|
861
|
-
},
|
|
900
|
+
}, _callee15, this);
|
|
862
901
|
}));
|
|
863
|
-
function getDocumentPageImage(
|
|
902
|
+
function getDocumentPageImage(_x50, _x51, _x52) {
|
|
864
903
|
return _getDocumentPageImage.apply(this, arguments);
|
|
865
904
|
}
|
|
866
905
|
return getDocumentPageImage;
|
|
@@ -868,10 +907,10 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
868
907
|
}, {
|
|
869
908
|
key: "appendChunksToUpload",
|
|
870
909
|
value: function () {
|
|
871
|
-
var _appendChunksToUpload = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
910
|
+
var _appendChunksToUpload = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16(uploadId, body, collectionName, traceContext, options) {
|
|
872
911
|
var metadata, headers, requestOptions;
|
|
873
|
-
return _regenerator.default.wrap(function (
|
|
874
|
-
while (1) switch (
|
|
912
|
+
return _regenerator.default.wrap(function (_context16) {
|
|
913
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
875
914
|
case 0:
|
|
876
915
|
metadata = {
|
|
877
916
|
method: 'PUT',
|
|
@@ -889,15 +928,15 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
889
928
|
body: JSON.stringify(body),
|
|
890
929
|
traceContext: traceContext
|
|
891
930
|
});
|
|
892
|
-
|
|
931
|
+
_context16.next = 1;
|
|
893
932
|
return this.request("/upload/".concat(uploadId, "/chunks"), requestOptions);
|
|
894
933
|
case 1:
|
|
895
934
|
case "end":
|
|
896
|
-
return
|
|
935
|
+
return _context16.stop();
|
|
897
936
|
}
|
|
898
|
-
},
|
|
937
|
+
}, _callee16, this);
|
|
899
938
|
}));
|
|
900
|
-
function appendChunksToUpload(
|
|
939
|
+
function appendChunksToUpload(_x53, _x54, _x55, _x56, _x57) {
|
|
901
940
|
return _appendChunksToUpload.apply(this, arguments);
|
|
902
941
|
}
|
|
903
942
|
return appendChunksToUpload;
|
|
@@ -955,10 +994,10 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
955
994
|
}, {
|
|
956
995
|
key: "registerCopyIntents",
|
|
957
996
|
value: function () {
|
|
958
|
-
var _registerCopyIntents = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
997
|
+
var _registerCopyIntents = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(files, traceContext, resolvedAuth) {
|
|
959
998
|
var metadata, options;
|
|
960
|
-
return _regenerator.default.wrap(function (
|
|
961
|
-
while (1) switch (
|
|
999
|
+
return _regenerator.default.wrap(function (_context17) {
|
|
1000
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
962
1001
|
case 0:
|
|
963
1002
|
metadata = {
|
|
964
1003
|
method: 'POST',
|
|
@@ -972,15 +1011,15 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
972
1011
|
traceContext: traceContext,
|
|
973
1012
|
resolvedAuth: resolvedAuth
|
|
974
1013
|
});
|
|
975
|
-
|
|
1014
|
+
_context17.next = 1;
|
|
976
1015
|
return this.request('/file/copy/intents', options);
|
|
977
1016
|
case 1:
|
|
978
1017
|
case "end":
|
|
979
|
-
return
|
|
1018
|
+
return _context17.stop();
|
|
980
1019
|
}
|
|
981
|
-
},
|
|
1020
|
+
}, _callee17, this);
|
|
982
1021
|
}));
|
|
983
|
-
function registerCopyIntents(
|
|
1022
|
+
function registerCopyIntents(_x58, _x59, _x60) {
|
|
984
1023
|
return _registerCopyIntents.apply(this, arguments);
|
|
985
1024
|
}
|
|
986
1025
|
return registerCopyIntents;
|
|
@@ -988,7 +1027,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
988
1027
|
}, {
|
|
989
1028
|
key: "request",
|
|
990
1029
|
value: function () {
|
|
991
|
-
var _request2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1030
|
+
var _request2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(path) {
|
|
992
1031
|
var options,
|
|
993
1032
|
controller,
|
|
994
1033
|
useMediaCdn,
|
|
@@ -1008,31 +1047,31 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
1008
1047
|
extendedParams,
|
|
1009
1048
|
url,
|
|
1010
1049
|
response,
|
|
1011
|
-
|
|
1050
|
+
_args18 = arguments,
|
|
1012
1051
|
_t;
|
|
1013
|
-
return _regenerator.default.wrap(function (
|
|
1014
|
-
while (1) switch (
|
|
1052
|
+
return _regenerator.default.wrap(function (_context18) {
|
|
1053
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1015
1054
|
case 0:
|
|
1016
|
-
options =
|
|
1055
|
+
options = _args18.length > 1 && _args18[1] !== undefined ? _args18[1] : {
|
|
1017
1056
|
method: 'GET',
|
|
1018
1057
|
endpoint: undefined,
|
|
1019
1058
|
authContext: {}
|
|
1020
1059
|
};
|
|
1021
|
-
controller =
|
|
1022
|
-
useMediaCdn =
|
|
1060
|
+
controller = _args18.length > 2 ? _args18[2] : undefined;
|
|
1061
|
+
useMediaCdn = _args18.length > 3 ? _args18[3] : undefined;
|
|
1023
1062
|
method = options.method, endpoint = options.endpoint, authContext = options.authContext, params = options.params, headers = options.headers, body = options.body, clientOptions = options.clientOptions, traceContext = options.traceContext, addMediaClientParam = options.addMediaClientParam, resolvedAuth = options.resolvedAuth;
|
|
1024
1063
|
if (!(resolvedAuth !== null && resolvedAuth !== void 0)) {
|
|
1025
|
-
|
|
1064
|
+
_context18.next = 1;
|
|
1026
1065
|
break;
|
|
1027
1066
|
}
|
|
1028
1067
|
_t = resolvedAuth;
|
|
1029
|
-
|
|
1068
|
+
_context18.next = 3;
|
|
1030
1069
|
break;
|
|
1031
1070
|
case 1:
|
|
1032
|
-
|
|
1071
|
+
_context18.next = 2;
|
|
1033
1072
|
return this.resolveAuth(authContext);
|
|
1034
1073
|
case 2:
|
|
1035
|
-
_t =
|
|
1074
|
+
_t = _context18.sent;
|
|
1036
1075
|
case 3:
|
|
1037
1076
|
auth = _t;
|
|
1038
1077
|
clientId = (0, _isClientBasedAuth.isClientBasedAuth)(auth) ? auth.clientId : undefined;
|
|
@@ -1047,7 +1086,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
1047
1086
|
if ((0, _isPathBasedEnabled.isPathBasedEnabled)()) {
|
|
1048
1087
|
url = (0, _mapToPathBasedUrl.mapToPathBasedUrl)(url);
|
|
1049
1088
|
}
|
|
1050
|
-
|
|
1089
|
+
_context18.next = 4;
|
|
1051
1090
|
return (0, _request3.request)(url, {
|
|
1052
1091
|
method: method,
|
|
1053
1092
|
endpoint: endpoint,
|
|
@@ -1059,17 +1098,17 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
1059
1098
|
traceContext: extendedTraceContext
|
|
1060
1099
|
}, controller);
|
|
1061
1100
|
case 4:
|
|
1062
|
-
response =
|
|
1101
|
+
response = _context18.sent;
|
|
1063
1102
|
(0, _setKeyValueInSessionStorage.setKeyValueInSessionStorage)(MEDIA_API_REGION, response.headers.get('x-media-region'));
|
|
1064
1103
|
(0, _setKeyValueInSessionStorage.setKeyValueInSessionStorage)(MEDIA_API_ENVIRONMENT, response.headers.get('x-media-env'));
|
|
1065
|
-
return
|
|
1104
|
+
return _context18.abrupt("return", response);
|
|
1066
1105
|
case 5:
|
|
1067
1106
|
case "end":
|
|
1068
|
-
return
|
|
1107
|
+
return _context18.stop();
|
|
1069
1108
|
}
|
|
1070
|
-
},
|
|
1109
|
+
}, _callee18, this);
|
|
1071
1110
|
}));
|
|
1072
|
-
function request(
|
|
1111
|
+
function request(_x61) {
|
|
1073
1112
|
return _request2.apply(this, arguments);
|
|
1074
1113
|
}
|
|
1075
1114
|
return request;
|
|
@@ -1077,16 +1116,16 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
1077
1116
|
}, {
|
|
1078
1117
|
key: "testUrl",
|
|
1079
1118
|
value: function () {
|
|
1080
|
-
var _testUrl = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1119
|
+
var _testUrl = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19(url) {
|
|
1081
1120
|
var options,
|
|
1082
1121
|
traceContext,
|
|
1083
|
-
|
|
1084
|
-
return _regenerator.default.wrap(function (
|
|
1085
|
-
while (1) switch (
|
|
1122
|
+
_args19 = arguments;
|
|
1123
|
+
return _regenerator.default.wrap(function (_context19) {
|
|
1124
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1086
1125
|
case 0:
|
|
1087
|
-
options =
|
|
1126
|
+
options = _args19.length > 1 && _args19[1] !== undefined ? _args19[1] : {};
|
|
1088
1127
|
traceContext = options.traceContext;
|
|
1089
|
-
|
|
1128
|
+
_context19.next = 1;
|
|
1090
1129
|
return (0, _request3.request)(url, {
|
|
1091
1130
|
method: 'HEAD',
|
|
1092
1131
|
traceContext: (0, _extendTraceContext.extendTraceContext)(traceContext),
|
|
@@ -1098,11 +1137,11 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
1098
1137
|
});
|
|
1099
1138
|
case 1:
|
|
1100
1139
|
case "end":
|
|
1101
|
-
return
|
|
1140
|
+
return _context19.stop();
|
|
1102
1141
|
}
|
|
1103
|
-
},
|
|
1142
|
+
}, _callee19);
|
|
1104
1143
|
}));
|
|
1105
|
-
function testUrl(
|
|
1144
|
+
function testUrl(_x62) {
|
|
1106
1145
|
return _testUrl.apply(this, arguments);
|
|
1107
1146
|
}
|
|
1108
1147
|
return testUrl;
|
|
@@ -11,7 +11,6 @@ import { isValidUuid } from '@atlaskit/media-common/isValidUuid';
|
|
|
11
11
|
import { getMediaTypeFromMimeType } from '@atlaskit/media-common/mediaTypeUtils';
|
|
12
12
|
import { authToOwner } from '@atlaskit/media-core/auth-to-owner';
|
|
13
13
|
import { mediaStore } from '@atlaskit/media-state/media-store';
|
|
14
|
-
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
15
14
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
16
15
|
import { RECENTS_COLLECTION } from '../../constants';
|
|
17
16
|
import { getFileStreamsCache } from '../../file-streams-cache';
|
|
@@ -439,7 +438,7 @@ export class FileFetcherImpl {
|
|
|
439
438
|
type,
|
|
440
439
|
size
|
|
441
440
|
} = blob;
|
|
442
|
-
const extensionAllowed = anonymizeFilename
|
|
441
|
+
const extensionAllowed = anonymizeFilename || fg('platform_media_unique_external_upload_name');
|
|
443
442
|
const [, existingExtension] = splitExtension(initialName);
|
|
444
443
|
const extension = extensionAllowed && !existingExtension ? getExtension(type) : undefined;
|
|
445
444
|
const name = extension ? `${initialName}.${extension}` : initialName;
|
|
@@ -30,8 +30,8 @@ export class MediaClient {
|
|
|
30
30
|
__DO_NOT_USE__getMediaStore() {
|
|
31
31
|
return this.store;
|
|
32
32
|
}
|
|
33
|
-
getImage(id, params, controller, fetchMaxRes, traceContext) {
|
|
34
|
-
return this.mediaStore.getImage(id, params, controller, fetchMaxRes, traceContext);
|
|
33
|
+
getImage(id, params, controller, fetchMaxRes, traceContext, clientOptions) {
|
|
34
|
+
return this.mediaStore.getImage(id, params, controller, fetchMaxRes, traceContext, clientOptions);
|
|
35
35
|
}
|
|
36
36
|
getImageUrl(id, params) {
|
|
37
37
|
return this.mediaStore.getFileImageURL(id, params);
|
|
@@ -45,6 +45,9 @@ export class MediaClient {
|
|
|
45
45
|
getClientIdSync() {
|
|
46
46
|
return this.mediaStore.getClientIdSync();
|
|
47
47
|
}
|
|
48
|
+
async getImageWatermarkVersion(collectionName) {
|
|
49
|
+
return this.mediaStore.getImageWatermarkVersion(collectionName);
|
|
50
|
+
}
|
|
48
51
|
async getImageMetadata(id, params) {
|
|
49
52
|
return (await this.mediaStore.getImageMetadata(id, params)).metadata;
|
|
50
53
|
}
|