@atlaskit/media-client 36.2.2 → 36.3.1
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 +17 -0
- package/artifacts/package.json +15 -0
- package/check-webp-support/package.json +15 -0
- package/create-media-subject/package.json +15 -0
- package/dist/cjs/client/file-fetcher/index.js +166 -165
- package/dist/cjs/client/media-client.js +14 -14
- package/dist/cjs/client/media-store/MediaStore.js +79 -78
- package/dist/cjs/client/media-store/resolveAuth.js +20 -19
- package/dist/cjs/client/stargate-client.js +4 -4
- package/dist/cjs/uploader/index.js +28 -35
- package/dist/cjs/utils/createCopyIntentRegisterationBatcher.js +16 -16
- package/dist/cjs/utils/createFileDataLoader.js +16 -16
- package/dist/cjs/utils/getDimensionsFromBlob.js +15 -15
- package/dist/cjs/utils/getVideoDimensionsFromBlob.js +1 -1
- package/dist/cjs/utils/hashing/hasherCreator.js +18 -18
- package/dist/cjs/utils/mobileUpload/helpers.js +15 -15
- package/dist/cjs/utils/mobileUpload/stateMachine/index.js +4 -4
- package/dist/cjs/utils/polling/index.js +18 -18
- package/dist/cjs/utils/request/helpers.js +52 -49
- package/dist/cjs/utils/request/index.js +17 -16
- package/dist/cjs/utils/shouldFetchRemoteFileStates.js +18 -18
- package/dist/esm/client/file-fetcher/index.js +166 -165
- package/dist/esm/client/media-client.js +14 -14
- package/dist/esm/client/media-store/MediaStore.js +79 -78
- package/dist/esm/client/media-store/resolveAuth.js +20 -19
- package/dist/esm/client/stargate-client.js +4 -4
- package/dist/esm/uploader/index.js +28 -35
- package/dist/esm/utils/createCopyIntentRegisterationBatcher.js +16 -16
- package/dist/esm/utils/createFileDataLoader.js +16 -16
- package/dist/esm/utils/getDimensionsFromBlob.js +15 -15
- package/dist/esm/utils/getVideoDimensionsFromBlob.js +1 -1
- package/dist/esm/utils/hashing/hasherCreator.js +17 -17
- package/dist/esm/utils/mobileUpload/helpers.js +15 -15
- package/dist/esm/utils/mobileUpload/stateMachine/index.js +4 -4
- package/dist/esm/utils/polling/index.js +18 -18
- package/dist/esm/utils/request/helpers.js +52 -49
- package/dist/esm/utils/request/index.js +17 -16
- package/dist/esm/utils/shouldFetchRemoteFileStates.js +18 -18
- package/error/package.json +15 -0
- package/errors/helpers/package.json +15 -0
- package/errors/package.json +15 -0
- package/errors/types/package.json +15 -0
- package/events/package.json +15 -0
- package/file-fetcher/error/package.json +15 -0
- package/file-fetcher/package.json +15 -0
- package/file-state/package.json +15 -0
- package/file-streams-cache/package.json +15 -0
- package/from-observable/package.json +15 -0
- package/get-dimensions-from-blob/package.json +15 -0
- package/global-media-event-emitter/package.json +15 -0
- package/identifier/package.json +15 -0
- package/image-resize-mode-to-file-image-mode/package.json +15 -0
- package/item/package.json +15 -0
- package/media/package.json +15 -0
- package/media-client/package.json +15 -0
- package/media-store/package.json +15 -0
- package/media-store/types/package.json +15 -0
- package/media-subscribable/types/package.json +15 -0
- package/mobile-upload/package.json +15 -0
- package/package.json +3 -3
- package/polling/errors/package.json +15 -0
- package/polling/package.json +15 -0
- package/polling/types/package.json +15 -0
- package/request/errors/package.json +15 -0
- package/request/helpers/package.json +15 -0
- package/request/package.json +15 -0
- package/request/types/package.json +15 -0
- package/stargate-client/package.json +15 -0
- package/upload-controller/package.json +15 -0
- package/uploader/package.json +15 -0
- package/url/package.json +15 -0
|
@@ -67,7 +67,7 @@ var MediaClient = exports.MediaClient = /*#__PURE__*/function () {
|
|
|
67
67
|
key: "getClientId",
|
|
68
68
|
value: function () {
|
|
69
69
|
var _getClientId = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(collectionName) {
|
|
70
|
-
return _regenerator.default.wrap(function
|
|
70
|
+
return _regenerator.default.wrap(function (_context) {
|
|
71
71
|
while (1) switch (_context.prev = _context.next) {
|
|
72
72
|
case 0:
|
|
73
73
|
return _context.abrupt("return", this.mediaStore.getClientId(collectionName));
|
|
@@ -91,14 +91,14 @@ var MediaClient = exports.MediaClient = /*#__PURE__*/function () {
|
|
|
91
91
|
key: "getImageMetadata",
|
|
92
92
|
value: function () {
|
|
93
93
|
var _getImageMetadata = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(id, params) {
|
|
94
|
-
return _regenerator.default.wrap(function
|
|
94
|
+
return _regenerator.default.wrap(function (_context2) {
|
|
95
95
|
while (1) switch (_context2.prev = _context2.next) {
|
|
96
96
|
case 0:
|
|
97
|
-
_context2.next =
|
|
97
|
+
_context2.next = 1;
|
|
98
98
|
return this.mediaStore.getImageMetadata(id, params);
|
|
99
|
-
case
|
|
99
|
+
case 1:
|
|
100
100
|
return _context2.abrupt("return", _context2.sent.metadata);
|
|
101
|
-
case
|
|
101
|
+
case 2:
|
|
102
102
|
case "end":
|
|
103
103
|
return _context2.stop();
|
|
104
104
|
}
|
|
@@ -114,24 +114,24 @@ var MediaClient = exports.MediaClient = /*#__PURE__*/function () {
|
|
|
114
114
|
value: function () {
|
|
115
115
|
var _mobileUploadPromise = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
116
116
|
var module;
|
|
117
|
-
return _regenerator.default.wrap(function
|
|
117
|
+
return _regenerator.default.wrap(function (_context3) {
|
|
118
118
|
while (1) switch (_context3.prev = _context3.next) {
|
|
119
119
|
case 0:
|
|
120
120
|
if (!this.mobileUpload) {
|
|
121
|
-
_context3.next =
|
|
121
|
+
_context3.next = 1;
|
|
122
122
|
break;
|
|
123
123
|
}
|
|
124
124
|
return _context3.abrupt("return", this.mobileUpload);
|
|
125
|
-
case
|
|
126
|
-
_context3.next =
|
|
125
|
+
case 1:
|
|
126
|
+
_context3.next = 2;
|
|
127
127
|
return Promise.resolve().then(function () {
|
|
128
128
|
return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_media-client-mobile-upload" */'./mobile-upload'));
|
|
129
129
|
});
|
|
130
|
-
case
|
|
130
|
+
case 2:
|
|
131
131
|
module = _context3.sent;
|
|
132
132
|
this.mobileUpload = new module.MobileUploadImpl(this.mediaStore, this.store);
|
|
133
133
|
return _context3.abrupt("return", this.mobileUpload);
|
|
134
|
-
case
|
|
134
|
+
case 3:
|
|
135
135
|
case "end":
|
|
136
136
|
return _context3.stop();
|
|
137
137
|
}
|
|
@@ -146,12 +146,12 @@ var MediaClient = exports.MediaClient = /*#__PURE__*/function () {
|
|
|
146
146
|
key: "removeFileFromCollection",
|
|
147
147
|
value: function () {
|
|
148
148
|
var _removeFileFromCollection = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(id, collectionName, occurrenceKey, traceContext) {
|
|
149
|
-
return _regenerator.default.wrap(function
|
|
149
|
+
return _regenerator.default.wrap(function (_context4) {
|
|
150
150
|
while (1) switch (_context4.prev = _context4.next) {
|
|
151
151
|
case 0:
|
|
152
|
-
_context4.next =
|
|
152
|
+
_context4.next = 1;
|
|
153
153
|
return this.mediaStore.removeCollectionFile(id, collectionName, occurrenceKey, traceContext);
|
|
154
|
-
case
|
|
154
|
+
case 1:
|
|
155
155
|
case "end":
|
|
156
156
|
return _context4.stop();
|
|
157
157
|
}
|
|
@@ -57,7 +57,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
57
57
|
(0, _defineProperty2.default)(this, "getArtifactBinary", /*#__PURE__*/function () {
|
|
58
58
|
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(artifacts, artifactName, _ref) {
|
|
59
59
|
var collectionName, abortController, _ref$maxAge, maxAge, traceContext, metadata, extendedTraceContext, options, artifactUrl;
|
|
60
|
-
return _regenerator.default.wrap(function
|
|
60
|
+
return _regenerator.default.wrap(function (_context) {
|
|
61
61
|
while (1) switch (_context.prev = _context.next) {
|
|
62
62
|
case 0:
|
|
63
63
|
collectionName = _ref.collectionName, abortController = _ref.abortController, _ref$maxAge = _ref.maxAge, maxAge = _ref$maxAge === void 0 ? _constants.FILE_CACHE_MAX_AGE : _ref$maxAge, traceContext = _ref.traceContext;
|
|
@@ -69,12 +69,12 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
69
69
|
options = _objectSpread(_objectSpread({}, metadata), {}, {
|
|
70
70
|
traceContext: extendedTraceContext
|
|
71
71
|
});
|
|
72
|
-
_context.next =
|
|
72
|
+
_context.next = 1;
|
|
73
73
|
return _this.getArtifactURL(artifacts, artifactName, collectionName, maxAge);
|
|
74
|
-
case
|
|
74
|
+
case 1:
|
|
75
75
|
artifactUrl = _context.sent;
|
|
76
76
|
return _context.abrupt("return", (0, _request3.request)(artifactUrl, options, abortController).then((0, _helpers.createMapResponseToBlob)(metadata)));
|
|
77
|
-
case
|
|
77
|
+
case 2:
|
|
78
78
|
case "end":
|
|
79
79
|
return _context.stop();
|
|
80
80
|
}
|
|
@@ -87,7 +87,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
87
87
|
(0, _defineProperty2.default)(this, "uploadArtifact", /*#__PURE__*/function () {
|
|
88
88
|
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(id, file, params, collectionName, traceContext) {
|
|
89
89
|
var metadata, headers, extendedParams, authContext, options;
|
|
90
|
-
return _regenerator.default.wrap(function
|
|
90
|
+
return _regenerator.default.wrap(function (_context2) {
|
|
91
91
|
while (1) switch (_context2.prev = _context2.next) {
|
|
92
92
|
case 0:
|
|
93
93
|
metadata = {
|
|
@@ -118,7 +118,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
118
118
|
traceContext: traceContext
|
|
119
119
|
});
|
|
120
120
|
return _context2.abrupt("return", _this.request("/file/".concat(id, "/artifact/binary"), options).then((0, _helpers.createMapResponseToJson)(metadata)));
|
|
121
|
-
case
|
|
121
|
+
case 1:
|
|
122
122
|
case "end":
|
|
123
123
|
return _context2.stop();
|
|
124
124
|
}
|
|
@@ -131,7 +131,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
131
131
|
(0, _defineProperty2.default)(this, "deleteArtifact", /*#__PURE__*/function () {
|
|
132
132
|
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(id, artifactName, collectionName, traceContext) {
|
|
133
133
|
var metadata, authContext, options;
|
|
134
|
-
return _regenerator.default.wrap(function
|
|
134
|
+
return _regenerator.default.wrap(function (_context3) {
|
|
135
135
|
while (1) switch (_context3.prev = _context3.next) {
|
|
136
136
|
case 0:
|
|
137
137
|
metadata = {
|
|
@@ -153,9 +153,9 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
153
153
|
collection: collectionName
|
|
154
154
|
}
|
|
155
155
|
});
|
|
156
|
-
_context3.next =
|
|
156
|
+
_context3.next = 1;
|
|
157
157
|
return _this.request("/file/".concat(id, "/artifact/").concat(artifactName), options);
|
|
158
|
-
case
|
|
158
|
+
case 1:
|
|
159
159
|
case "end":
|
|
160
160
|
return _context3.stop();
|
|
161
161
|
}
|
|
@@ -179,17 +179,17 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
179
179
|
value: function () {
|
|
180
180
|
var _getClientId = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(collectionName) {
|
|
181
181
|
var auth;
|
|
182
|
-
return _regenerator.default.wrap(function
|
|
182
|
+
return _regenerator.default.wrap(function (_context4) {
|
|
183
183
|
while (1) switch (_context4.prev = _context4.next) {
|
|
184
184
|
case 0:
|
|
185
|
-
_context4.next =
|
|
185
|
+
_context4.next = 1;
|
|
186
186
|
return this.resolveAuth({
|
|
187
187
|
collectionName: collectionName
|
|
188
188
|
});
|
|
189
|
-
case
|
|
189
|
+
case 1:
|
|
190
190
|
auth = _context4.sent;
|
|
191
191
|
return _context4.abrupt("return", MediaStore.extractClientIdFromAuth(auth));
|
|
192
|
-
case
|
|
192
|
+
case 2:
|
|
193
193
|
case "end":
|
|
194
194
|
return _context4.stop();
|
|
195
195
|
}
|
|
@@ -216,7 +216,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
216
216
|
value: function () {
|
|
217
217
|
var _removeCollectionFile = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(id, collectionName, occurrenceKey, traceContext) {
|
|
218
218
|
var metadata, body, options;
|
|
219
|
-
return _regenerator.default.wrap(function
|
|
219
|
+
return _regenerator.default.wrap(function (_context5) {
|
|
220
220
|
while (1) switch (_context5.prev = _context5.next) {
|
|
221
221
|
case 0:
|
|
222
222
|
metadata = {
|
|
@@ -244,9 +244,9 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
244
244
|
body: JSON.stringify(body),
|
|
245
245
|
traceContext: traceContext
|
|
246
246
|
});
|
|
247
|
-
_context5.next =
|
|
247
|
+
_context5.next = 1;
|
|
248
248
|
return this.request("/collection/".concat(collectionName), options);
|
|
249
|
-
case
|
|
249
|
+
case 1:
|
|
250
250
|
case "end":
|
|
251
251
|
return _context5.stop();
|
|
252
252
|
}
|
|
@@ -287,7 +287,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
287
287
|
value: function () {
|
|
288
288
|
var _uploadChunk = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(etag, blob, uploadId, partNumber, collectionName, traceContext) {
|
|
289
289
|
var metadata, options;
|
|
290
|
-
return _regenerator.default.wrap(function
|
|
290
|
+
return _regenerator.default.wrap(function (_context6) {
|
|
291
291
|
while (1) switch (_context6.prev = _context6.next) {
|
|
292
292
|
case 0:
|
|
293
293
|
metadata = {
|
|
@@ -305,9 +305,9 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
305
305
|
body: blob,
|
|
306
306
|
traceContext: traceContext
|
|
307
307
|
});
|
|
308
|
-
_context6.next =
|
|
308
|
+
_context6.next = 1;
|
|
309
309
|
return this.request("/chunk/".concat(etag), options);
|
|
310
|
-
case
|
|
310
|
+
case 1:
|
|
311
311
|
case "end":
|
|
312
312
|
return _context6.stop();
|
|
313
313
|
}
|
|
@@ -361,7 +361,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
361
361
|
metadata,
|
|
362
362
|
options,
|
|
363
363
|
_args7 = arguments;
|
|
364
|
-
return _regenerator.default.wrap(function
|
|
364
|
+
return _regenerator.default.wrap(function (_context7) {
|
|
365
365
|
while (1) switch (_context7.prev = _context7.next) {
|
|
366
366
|
case 0:
|
|
367
367
|
params = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : {};
|
|
@@ -382,7 +382,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
382
382
|
}
|
|
383
383
|
});
|
|
384
384
|
return _context7.abrupt("return", this.request('/upload/createWithFiles', options).then((0, _helpers.createMapResponseToJson)(metadata)));
|
|
385
|
-
case
|
|
385
|
+
case 1:
|
|
386
386
|
case "end":
|
|
387
387
|
return _context7.stop();
|
|
388
388
|
}
|
|
@@ -416,18 +416,18 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
416
416
|
value: function () {
|
|
417
417
|
var _getFileImageURL = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(id, params) {
|
|
418
418
|
var _ref5, collectionName, auth;
|
|
419
|
-
return _regenerator.default.wrap(function
|
|
419
|
+
return _regenerator.default.wrap(function (_context8) {
|
|
420
420
|
while (1) switch (_context8.prev = _context8.next) {
|
|
421
421
|
case 0:
|
|
422
422
|
_ref5 = params || {}, collectionName = _ref5.collection;
|
|
423
|
-
_context8.next =
|
|
423
|
+
_context8.next = 1;
|
|
424
424
|
return this.resolveAuth({
|
|
425
425
|
collectionName: collectionName
|
|
426
426
|
});
|
|
427
|
-
case
|
|
427
|
+
case 1:
|
|
428
428
|
auth = _context8.sent;
|
|
429
429
|
return _context8.abrupt("return", this.createFileImageURL(id, auth, params));
|
|
430
|
-
case
|
|
430
|
+
case 2:
|
|
431
431
|
case "end":
|
|
432
432
|
return _context8.stop();
|
|
433
433
|
}
|
|
@@ -470,7 +470,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
470
470
|
metadata,
|
|
471
471
|
options,
|
|
472
472
|
_args9 = arguments;
|
|
473
|
-
return _regenerator.default.wrap(function
|
|
473
|
+
return _regenerator.default.wrap(function (_context9) {
|
|
474
474
|
while (1) switch (_context9.prev = _context9.next) {
|
|
475
475
|
case 0:
|
|
476
476
|
maxAge = _args9.length > 3 && _args9[3] !== undefined ? _args9[3] : _constants.FILE_CACHE_MAX_AGE;
|
|
@@ -491,7 +491,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
491
491
|
}
|
|
492
492
|
});
|
|
493
493
|
return _context9.abrupt("return", this.request("/file/".concat(id, "/").concat(binaryEndpoint), options, abortController, true).then((0, _helpers.createMapResponseToBlob)(metadata)));
|
|
494
|
-
case
|
|
494
|
+
case 1:
|
|
495
495
|
case "end":
|
|
496
496
|
return _context9.stop();
|
|
497
497
|
}
|
|
@@ -511,15 +511,15 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
511
511
|
options,
|
|
512
512
|
binaryEndpoint,
|
|
513
513
|
_args0 = arguments;
|
|
514
|
-
return _regenerator.default.wrap(function
|
|
514
|
+
return _regenerator.default.wrap(function (_context0) {
|
|
515
515
|
while (1) switch (_context0.prev = _context0.next) {
|
|
516
516
|
case 0:
|
|
517
517
|
maxAge = _args0.length > 2 && _args0[2] !== undefined ? _args0[2] : _constants.FILE_CACHE_MAX_AGE;
|
|
518
|
-
_context0.next =
|
|
518
|
+
_context0.next = 1;
|
|
519
519
|
return this.resolveAuth({
|
|
520
520
|
collectionName: collectionName
|
|
521
521
|
});
|
|
522
|
-
case
|
|
522
|
+
case 1:
|
|
523
523
|
auth = _context0.sent;
|
|
524
524
|
options = {
|
|
525
525
|
params: {
|
|
@@ -531,13 +531,13 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
531
531
|
};
|
|
532
532
|
binaryEndpoint = cdnFeatureFlag('binary');
|
|
533
533
|
if (!(0, _pathBasedUrl.isPathBasedEnabled)()) {
|
|
534
|
-
_context0.next =
|
|
534
|
+
_context0.next = 2;
|
|
535
535
|
break;
|
|
536
536
|
}
|
|
537
537
|
return _context0.abrupt("return", (0, _pathBasedUrl.mapToPathBasedUrl)((0, _helpers.createUrl)("".concat(auth.baseUrl, "/file/").concat(id, "/").concat(binaryEndpoint), options)));
|
|
538
|
-
case
|
|
538
|
+
case 2:
|
|
539
539
|
return _context0.abrupt("return", (0, _mediaCdn.mapToMediaCdnUrl)((0, _helpers.createUrl)("".concat(auth.baseUrl, "/file/").concat(id, "/").concat(binaryEndpoint), options), auth.token));
|
|
540
|
-
case
|
|
540
|
+
case 3:
|
|
541
541
|
case "end":
|
|
542
542
|
return _context0.stop();
|
|
543
543
|
}
|
|
@@ -558,7 +558,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
558
558
|
options,
|
|
559
559
|
url,
|
|
560
560
|
_args1 = arguments;
|
|
561
|
-
return _regenerator.default.wrap(function
|
|
561
|
+
return _regenerator.default.wrap(function (_context1) {
|
|
562
562
|
while (1) switch (_context1.prev = _context1.next) {
|
|
563
563
|
case 0:
|
|
564
564
|
maxAge = _args1.length > 3 && _args1[3] !== undefined ? _args1[3] : _constants.FILE_CACHE_MAX_AGE;
|
|
@@ -576,16 +576,16 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
576
576
|
} */
|
|
577
577
|
artifactUrl = (0, _artifacts.getArtifactUrl)(artifacts, artifactName);
|
|
578
578
|
if (artifactUrl) {
|
|
579
|
-
_context1.next =
|
|
579
|
+
_context1.next = 1;
|
|
580
580
|
break;
|
|
581
581
|
}
|
|
582
582
|
throw new Error("artifact ".concat(artifactName, " not found"));
|
|
583
|
-
case
|
|
584
|
-
_context1.next =
|
|
583
|
+
case 1:
|
|
584
|
+
_context1.next = 2;
|
|
585
585
|
return this.resolveAuth({
|
|
586
586
|
collectionName: collectionName
|
|
587
587
|
});
|
|
588
|
-
case
|
|
588
|
+
case 2:
|
|
589
589
|
auth = _context1.sent;
|
|
590
590
|
options = {
|
|
591
591
|
params: {
|
|
@@ -596,13 +596,13 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
596
596
|
};
|
|
597
597
|
url = (0, _mediaCdn.mapToMediaCdnUrl)((0, _helpers.createUrl)("".concat(auth.baseUrl).concat(artifactUrl), options), auth.token);
|
|
598
598
|
if (!(0, _pathBasedUrl.isPathBasedEnabled)()) {
|
|
599
|
-
_context1.next =
|
|
599
|
+
_context1.next = 3;
|
|
600
600
|
break;
|
|
601
601
|
}
|
|
602
602
|
return _context1.abrupt("return", (0, _pathBasedUrl.mapToPathBasedUrl)(url));
|
|
603
|
-
case
|
|
603
|
+
case 3:
|
|
604
604
|
return _context1.abrupt("return", url);
|
|
605
|
-
case
|
|
605
|
+
case 4:
|
|
606
606
|
case "end":
|
|
607
607
|
return _context1.stop();
|
|
608
608
|
}
|
|
@@ -618,7 +618,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
618
618
|
value: function () {
|
|
619
619
|
var _getImage = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(id, params, controller, fetchMaxRes, traceContext) {
|
|
620
620
|
var isWebpSupported, headers, imageEndpoint, metadata, wmvParams, authOptions, auth, wmv, options;
|
|
621
|
-
return _regenerator.default.wrap(function
|
|
621
|
+
return _regenerator.default.wrap(function (_context10) {
|
|
622
622
|
while (1) switch (_context10.prev = _context10.next) {
|
|
623
623
|
case 0:
|
|
624
624
|
// TODO add checkWebpSupport() back https://product-fabric.atlassian.net/browse/MPT-584
|
|
@@ -639,12 +639,12 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
639
639
|
}
|
|
640
640
|
};
|
|
641
641
|
if (!(0, _platformFeatureFlags.fg)('confluence_watermark_admin_ui')) {
|
|
642
|
-
_context10.next =
|
|
642
|
+
_context10.next = 2;
|
|
643
643
|
break;
|
|
644
644
|
}
|
|
645
|
-
_context10.next =
|
|
645
|
+
_context10.next = 1;
|
|
646
646
|
return this.resolveAuth(authOptions.authContext);
|
|
647
|
-
case
|
|
647
|
+
case 1:
|
|
648
648
|
auth = _context10.sent;
|
|
649
649
|
wmv = (0, _watermarkVersion.getWatermarkVersionFromToken)(auth.token);
|
|
650
650
|
if (wmv) {
|
|
@@ -655,7 +655,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
655
655
|
authOptions = {
|
|
656
656
|
resolvedAuth: auth
|
|
657
657
|
};
|
|
658
|
-
case
|
|
658
|
+
case 2:
|
|
659
659
|
options = _objectSpread(_objectSpread(_objectSpread({}, metadata), authOptions), {}, {
|
|
660
660
|
params: _objectSpread(_objectSpread({}, extendImageParams(params, fetchMaxRes)), wmvParams),
|
|
661
661
|
headers: headers,
|
|
@@ -663,7 +663,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
663
663
|
addMediaClientParam: true
|
|
664
664
|
});
|
|
665
665
|
return _context10.abrupt("return", this.request("/file/".concat(id, "/").concat(imageEndpoint), options, controller, true).then((0, _helpers.createMapResponseToBlob)(metadata)));
|
|
666
|
-
case
|
|
666
|
+
case 3:
|
|
667
667
|
case "end":
|
|
668
668
|
return _context10.stop();
|
|
669
669
|
}
|
|
@@ -679,7 +679,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
679
679
|
value: function () {
|
|
680
680
|
var _getItems = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(ids, collectionName, traceContext, includeHashForDuplicateFiles) {
|
|
681
681
|
var descriptors, metadata, options;
|
|
682
|
-
return _regenerator.default.wrap(function
|
|
682
|
+
return _regenerator.default.wrap(function (_context11) {
|
|
683
683
|
while (1) switch (_context11.prev = _context11.next) {
|
|
684
684
|
case 0:
|
|
685
685
|
descriptors = ids.map(function (id) {
|
|
@@ -705,7 +705,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
705
705
|
traceContext: traceContext
|
|
706
706
|
});
|
|
707
707
|
return _context11.abrupt("return", this.request('/items', options).then((0, _helpers.createMapResponseToJson)(metadata)));
|
|
708
|
-
case
|
|
708
|
+
case 1:
|
|
709
709
|
case "end":
|
|
710
710
|
return _context11.stop();
|
|
711
711
|
}
|
|
@@ -721,7 +721,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
721
721
|
value: function () {
|
|
722
722
|
var _getImageMetadata = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(id, params, traceContext) {
|
|
723
723
|
var metadata, options;
|
|
724
|
-
return _regenerator.default.wrap(function
|
|
724
|
+
return _regenerator.default.wrap(function (_context12) {
|
|
725
725
|
while (1) switch (_context12.prev = _context12.next) {
|
|
726
726
|
case 0:
|
|
727
727
|
metadata = {
|
|
@@ -736,7 +736,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
736
736
|
traceContext: traceContext
|
|
737
737
|
});
|
|
738
738
|
return _context12.abrupt("return", this.request("/file/".concat(id, "/image/metadata"), options).then((0, _helpers.createMapResponseToJson)(metadata)));
|
|
739
|
-
case
|
|
739
|
+
case 1:
|
|
740
740
|
case "end":
|
|
741
741
|
return _context12.stop();
|
|
742
742
|
}
|
|
@@ -752,7 +752,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
752
752
|
value: function () {
|
|
753
753
|
var _getDocumentContent = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(id, options, traceContext) {
|
|
754
754
|
var shouldCache, endpoint, metadata, headers, requestOptions;
|
|
755
|
-
return _regenerator.default.wrap(function
|
|
755
|
+
return _regenerator.default.wrap(function (_context13) {
|
|
756
756
|
while (1) switch (_context13.prev = _context13.next) {
|
|
757
757
|
case 0:
|
|
758
758
|
// when requesting for password protected document don't use CDN as it won't forward headers
|
|
@@ -781,7 +781,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
781
781
|
traceContext: traceContext
|
|
782
782
|
});
|
|
783
783
|
return _context13.abrupt("return", this.request("/file/".concat(id, "/document/").concat(endpoint), requestOptions).then((0, _helpers.createMapResponseToJson)(metadata)));
|
|
784
|
-
case
|
|
784
|
+
case 1:
|
|
785
785
|
case "end":
|
|
786
786
|
return _context13.stop();
|
|
787
787
|
}
|
|
@@ -797,7 +797,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
797
797
|
value: function () {
|
|
798
798
|
var _getDocumentPageImage = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(id, options, traceContext) {
|
|
799
799
|
var shouldCache, endpoint, metadata, headers, requestOptions;
|
|
800
|
-
return _regenerator.default.wrap(function
|
|
800
|
+
return _regenerator.default.wrap(function (_context14) {
|
|
801
801
|
while (1) switch (_context14.prev = _context14.next) {
|
|
802
802
|
case 0:
|
|
803
803
|
// when requesting for password protected document don't use CDN as it won't forward headers
|
|
@@ -826,7 +826,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
826
826
|
traceContext: traceContext
|
|
827
827
|
});
|
|
828
828
|
return _context14.abrupt("return", this.request("/file/".concat(id, "/document/").concat(endpoint), requestOptions).then((0, _helpers.createMapResponseToBlob)(metadata)));
|
|
829
|
-
case
|
|
829
|
+
case 1:
|
|
830
830
|
case "end":
|
|
831
831
|
return _context14.stop();
|
|
832
832
|
}
|
|
@@ -842,7 +842,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
842
842
|
value: function () {
|
|
843
843
|
var _appendChunksToUpload = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(uploadId, body, collectionName, traceContext, options) {
|
|
844
844
|
var metadata, headers, requestOptions;
|
|
845
|
-
return _regenerator.default.wrap(function
|
|
845
|
+
return _regenerator.default.wrap(function (_context15) {
|
|
846
846
|
while (1) switch (_context15.prev = _context15.next) {
|
|
847
847
|
case 0:
|
|
848
848
|
metadata = {
|
|
@@ -861,9 +861,9 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
861
861
|
body: JSON.stringify(body),
|
|
862
862
|
traceContext: traceContext
|
|
863
863
|
});
|
|
864
|
-
_context15.next =
|
|
864
|
+
_context15.next = 1;
|
|
865
865
|
return this.request("/upload/".concat(uploadId, "/chunks"), requestOptions);
|
|
866
|
-
case
|
|
866
|
+
case 1:
|
|
867
867
|
case "end":
|
|
868
868
|
return _context15.stop();
|
|
869
869
|
}
|
|
@@ -929,7 +929,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
929
929
|
value: function () {
|
|
930
930
|
var _registerCopyIntents = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16(files, traceContext, resolvedAuth) {
|
|
931
931
|
var metadata, options;
|
|
932
|
-
return _regenerator.default.wrap(function
|
|
932
|
+
return _regenerator.default.wrap(function (_context16) {
|
|
933
933
|
while (1) switch (_context16.prev = _context16.next) {
|
|
934
934
|
case 0:
|
|
935
935
|
metadata = {
|
|
@@ -944,9 +944,9 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
944
944
|
traceContext: traceContext,
|
|
945
945
|
resolvedAuth: resolvedAuth
|
|
946
946
|
});
|
|
947
|
-
_context16.next =
|
|
947
|
+
_context16.next = 1;
|
|
948
948
|
return this.request('/file/copy/intents', options);
|
|
949
|
-
case
|
|
949
|
+
case 1:
|
|
950
950
|
case "end":
|
|
951
951
|
return _context16.stop();
|
|
952
952
|
}
|
|
@@ -980,8 +980,9 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
980
980
|
extendedParams,
|
|
981
981
|
url,
|
|
982
982
|
response,
|
|
983
|
-
_args17 = arguments
|
|
984
|
-
|
|
983
|
+
_args17 = arguments,
|
|
984
|
+
_t;
|
|
985
|
+
return _regenerator.default.wrap(function (_context17) {
|
|
985
986
|
while (1) switch (_context17.prev = _context17.next) {
|
|
986
987
|
case 0:
|
|
987
988
|
options = _args17.length > 1 && _args17[1] !== undefined ? _args17[1] : {
|
|
@@ -993,19 +994,19 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
993
994
|
useMediaCdn = _args17.length > 3 ? _args17[3] : undefined;
|
|
994
995
|
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;
|
|
995
996
|
if (!(resolvedAuth !== null && resolvedAuth !== void 0)) {
|
|
996
|
-
_context17.next =
|
|
997
|
+
_context17.next = 1;
|
|
997
998
|
break;
|
|
998
999
|
}
|
|
999
|
-
|
|
1000
|
-
_context17.next =
|
|
1000
|
+
_t = resolvedAuth;
|
|
1001
|
+
_context17.next = 3;
|
|
1001
1002
|
break;
|
|
1002
|
-
case
|
|
1003
|
-
_context17.next =
|
|
1003
|
+
case 1:
|
|
1004
|
+
_context17.next = 2;
|
|
1004
1005
|
return this.resolveAuth(authContext);
|
|
1005
|
-
case
|
|
1006
|
-
|
|
1007
|
-
case
|
|
1008
|
-
auth =
|
|
1006
|
+
case 2:
|
|
1007
|
+
_t = _context17.sent;
|
|
1008
|
+
case 3:
|
|
1009
|
+
auth = _t;
|
|
1009
1010
|
clientId = (0, _mediaCore.isClientBasedAuth)(auth) ? auth.clientId : undefined;
|
|
1010
1011
|
extendedTraceContext = (0, _helpers.extendTraceContext)(traceContext);
|
|
1011
1012
|
extendedParams = addMediaClientParam ? _objectSpread(_objectSpread({}, params), {}, {
|
|
@@ -1018,7 +1019,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
1018
1019
|
if ((0, _pathBasedUrl.isPathBasedEnabled)()) {
|
|
1019
1020
|
url = (0, _pathBasedUrl.mapToPathBasedUrl)(url);
|
|
1020
1021
|
}
|
|
1021
|
-
_context17.next =
|
|
1022
|
+
_context17.next = 4;
|
|
1022
1023
|
return (0, _request3.request)(url, {
|
|
1023
1024
|
method: method,
|
|
1024
1025
|
endpoint: endpoint,
|
|
@@ -1029,12 +1030,12 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
1029
1030
|
clientOptions: clientOptions,
|
|
1030
1031
|
traceContext: extendedTraceContext
|
|
1031
1032
|
}, controller);
|
|
1032
|
-
case
|
|
1033
|
+
case 4:
|
|
1033
1034
|
response = _context17.sent;
|
|
1034
1035
|
setKeyValueInSessionStorage(MEDIA_API_REGION, response.headers.get('x-media-region'));
|
|
1035
1036
|
setKeyValueInSessionStorage(MEDIA_API_ENVIRONMENT, response.headers.get('x-media-env'));
|
|
1036
1037
|
return _context17.abrupt("return", response);
|
|
1037
|
-
case
|
|
1038
|
+
case 5:
|
|
1038
1039
|
case "end":
|
|
1039
1040
|
return _context17.stop();
|
|
1040
1041
|
}
|
|
@@ -1052,12 +1053,12 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
1052
1053
|
var options,
|
|
1053
1054
|
traceContext,
|
|
1054
1055
|
_args18 = arguments;
|
|
1055
|
-
return _regenerator.default.wrap(function
|
|
1056
|
+
return _regenerator.default.wrap(function (_context18) {
|
|
1056
1057
|
while (1) switch (_context18.prev = _context18.next) {
|
|
1057
1058
|
case 0:
|
|
1058
1059
|
options = _args18.length > 1 && _args18[1] !== undefined ? _args18[1] : {};
|
|
1059
1060
|
traceContext = options.traceContext;
|
|
1060
|
-
_context18.next =
|
|
1061
|
+
_context18.next = 1;
|
|
1061
1062
|
return (0, _request3.request)(url, {
|
|
1062
1063
|
method: 'HEAD',
|
|
1063
1064
|
traceContext: (0, _helpers.extendTraceContext)(traceContext),
|
|
@@ -1067,7 +1068,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
1067
1068
|
}
|
|
1068
1069
|
}
|
|
1069
1070
|
});
|
|
1070
|
-
case
|
|
1071
|
+
case 1:
|
|
1071
1072
|
case "end":
|
|
1072
1073
|
return _context18.stop();
|
|
1073
1074
|
}
|
|
@@ -19,8 +19,9 @@ var resolveAuth = exports.resolveAuth = /*#__PURE__*/function () {
|
|
|
19
19
|
eventEmitted,
|
|
20
20
|
authProviderPromise,
|
|
21
21
|
auth,
|
|
22
|
-
_args = arguments
|
|
23
|
-
|
|
22
|
+
_args = arguments,
|
|
23
|
+
_t;
|
|
24
|
+
return _regenerator.default.wrap(function (_context) {
|
|
24
25
|
while (1) switch (_context.prev = _context.next) {
|
|
25
26
|
case 0:
|
|
26
27
|
authProviderTimeout = _args.length > 2 && _args[2] !== undefined ? _args[2] : DEFAULT_AUTH_PROVIDER_TIMEOUT;
|
|
@@ -57,41 +58,41 @@ var resolveAuth = exports.resolveAuth = /*#__PURE__*/function () {
|
|
|
57
58
|
});
|
|
58
59
|
throw error;
|
|
59
60
|
}) : authProvider(authContext); // Original behavior when FG off
|
|
60
|
-
_context.prev =
|
|
61
|
-
_context.next =
|
|
61
|
+
_context.prev = 1;
|
|
62
|
+
_context.next = 2;
|
|
62
63
|
return Promise.race([authProviderPromise, (0, _setTimeoutPromise.rejectTimeout)(authProviderTimeout, new _error.MediaStoreError('authProviderTimedOut'))]);
|
|
63
|
-
case
|
|
64
|
+
case 2:
|
|
64
65
|
auth = _context.sent;
|
|
65
|
-
_context.next =
|
|
66
|
+
_context.next = 5;
|
|
66
67
|
break;
|
|
67
|
-
case
|
|
68
|
-
_context.prev =
|
|
69
|
-
|
|
68
|
+
case 3:
|
|
69
|
+
_context.prev = 3;
|
|
70
|
+
_t = _context["catch"](1);
|
|
70
71
|
// Mark as emitted so late arrivals are handled correctly by .then()/.catch()
|
|
71
72
|
if (!eventEmitted && (0, _platformFeatureFlags.fg)('platform_media_auth_provider_analytics')) {
|
|
72
73
|
eventEmitted = true;
|
|
73
74
|
}
|
|
74
75
|
// PRESERVE ORIGINAL ERROR HANDLING
|
|
75
|
-
if (!(
|
|
76
|
-
_context.next =
|
|
76
|
+
if (!(_t instanceof _error.MediaStoreError)) {
|
|
77
|
+
_context.next = 4;
|
|
77
78
|
break;
|
|
78
79
|
}
|
|
79
|
-
throw
|
|
80
|
-
case
|
|
81
|
-
throw new _error.MediaStoreError('failedAuthProvider',
|
|
82
|
-
case
|
|
80
|
+
throw _t;
|
|
81
|
+
case 4:
|
|
82
|
+
throw new _error.MediaStoreError('failedAuthProvider', _t instanceof Error ? _t : undefined);
|
|
83
|
+
case 5:
|
|
83
84
|
if (auth) {
|
|
84
|
-
_context.next =
|
|
85
|
+
_context.next = 6;
|
|
85
86
|
break;
|
|
86
87
|
}
|
|
87
88
|
throw new _error.MediaStoreError('emptyAuth');
|
|
88
|
-
case
|
|
89
|
+
case 6:
|
|
89
90
|
return _context.abrupt("return", auth);
|
|
90
|
-
case
|
|
91
|
+
case 7:
|
|
91
92
|
case "end":
|
|
92
93
|
return _context.stop();
|
|
93
94
|
}
|
|
94
|
-
}, _callee, null, [[
|
|
95
|
+
}, _callee, null, [[1, 3]]);
|
|
95
96
|
}));
|
|
96
97
|
return function resolveAuth(_x, _x2) {
|
|
97
98
|
return _ref.apply(this, arguments);
|