@atlaskit/media-client 36.3.0 → 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 +10 -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/package.json +3 -3
|
@@ -58,7 +58,7 @@ export var MediaClient = /*#__PURE__*/function () {
|
|
|
58
58
|
key: "getClientId",
|
|
59
59
|
value: function () {
|
|
60
60
|
var _getClientId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(collectionName) {
|
|
61
|
-
return _regeneratorRuntime.wrap(function
|
|
61
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
62
62
|
while (1) switch (_context.prev = _context.next) {
|
|
63
63
|
case 0:
|
|
64
64
|
return _context.abrupt("return", this.mediaStore.getClientId(collectionName));
|
|
@@ -82,14 +82,14 @@ export var MediaClient = /*#__PURE__*/function () {
|
|
|
82
82
|
key: "getImageMetadata",
|
|
83
83
|
value: function () {
|
|
84
84
|
var _getImageMetadata = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(id, params) {
|
|
85
|
-
return _regeneratorRuntime.wrap(function
|
|
85
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
86
86
|
while (1) switch (_context2.prev = _context2.next) {
|
|
87
87
|
case 0:
|
|
88
|
-
_context2.next =
|
|
88
|
+
_context2.next = 1;
|
|
89
89
|
return this.mediaStore.getImageMetadata(id, params);
|
|
90
|
-
case
|
|
90
|
+
case 1:
|
|
91
91
|
return _context2.abrupt("return", _context2.sent.metadata);
|
|
92
|
-
case
|
|
92
|
+
case 2:
|
|
93
93
|
case "end":
|
|
94
94
|
return _context2.stop();
|
|
95
95
|
}
|
|
@@ -105,22 +105,22 @@ export var MediaClient = /*#__PURE__*/function () {
|
|
|
105
105
|
value: function () {
|
|
106
106
|
var _mobileUploadPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
107
107
|
var module;
|
|
108
|
-
return _regeneratorRuntime.wrap(function
|
|
108
|
+
return _regeneratorRuntime.wrap(function (_context3) {
|
|
109
109
|
while (1) switch (_context3.prev = _context3.next) {
|
|
110
110
|
case 0:
|
|
111
111
|
if (!this.mobileUpload) {
|
|
112
|
-
_context3.next =
|
|
112
|
+
_context3.next = 1;
|
|
113
113
|
break;
|
|
114
114
|
}
|
|
115
115
|
return _context3.abrupt("return", this.mobileUpload);
|
|
116
|
-
case
|
|
117
|
-
_context3.next =
|
|
116
|
+
case 1:
|
|
117
|
+
_context3.next = 2;
|
|
118
118
|
return import( /* webpackChunkName: "@atlaskit-internal_media-client-mobile-upload" */'./mobile-upload');
|
|
119
|
-
case
|
|
119
|
+
case 2:
|
|
120
120
|
module = _context3.sent;
|
|
121
121
|
this.mobileUpload = new module.MobileUploadImpl(this.mediaStore, this.store);
|
|
122
122
|
return _context3.abrupt("return", this.mobileUpload);
|
|
123
|
-
case
|
|
123
|
+
case 3:
|
|
124
124
|
case "end":
|
|
125
125
|
return _context3.stop();
|
|
126
126
|
}
|
|
@@ -135,12 +135,12 @@ export var MediaClient = /*#__PURE__*/function () {
|
|
|
135
135
|
key: "removeFileFromCollection",
|
|
136
136
|
value: function () {
|
|
137
137
|
var _removeFileFromCollection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(id, collectionName, occurrenceKey, traceContext) {
|
|
138
|
-
return _regeneratorRuntime.wrap(function
|
|
138
|
+
return _regeneratorRuntime.wrap(function (_context4) {
|
|
139
139
|
while (1) switch (_context4.prev = _context4.next) {
|
|
140
140
|
case 0:
|
|
141
|
-
_context4.next =
|
|
141
|
+
_context4.next = 1;
|
|
142
142
|
return this.mediaStore.removeCollectionFile(id, collectionName, occurrenceKey, traceContext);
|
|
143
|
-
case
|
|
143
|
+
case 1:
|
|
144
144
|
case "end":
|
|
145
145
|
return _context4.stop();
|
|
146
146
|
}
|
|
@@ -51,7 +51,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
51
51
|
_defineProperty(this, "getArtifactBinary", /*#__PURE__*/function () {
|
|
52
52
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(artifacts, artifactName, _ref) {
|
|
53
53
|
var collectionName, abortController, _ref$maxAge, maxAge, traceContext, metadata, extendedTraceContext, options, artifactUrl;
|
|
54
|
-
return _regeneratorRuntime.wrap(function
|
|
54
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
55
55
|
while (1) switch (_context.prev = _context.next) {
|
|
56
56
|
case 0:
|
|
57
57
|
collectionName = _ref.collectionName, abortController = _ref.abortController, _ref$maxAge = _ref.maxAge, maxAge = _ref$maxAge === void 0 ? FILE_CACHE_MAX_AGE : _ref$maxAge, traceContext = _ref.traceContext;
|
|
@@ -63,12 +63,12 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
63
63
|
options = _objectSpread(_objectSpread({}, metadata), {}, {
|
|
64
64
|
traceContext: extendedTraceContext
|
|
65
65
|
});
|
|
66
|
-
_context.next =
|
|
66
|
+
_context.next = 1;
|
|
67
67
|
return _this.getArtifactURL(artifacts, artifactName, collectionName, maxAge);
|
|
68
|
-
case
|
|
68
|
+
case 1:
|
|
69
69
|
artifactUrl = _context.sent;
|
|
70
70
|
return _context.abrupt("return", _request(artifactUrl, options, abortController).then(createMapResponseToBlob(metadata)));
|
|
71
|
-
case
|
|
71
|
+
case 2:
|
|
72
72
|
case "end":
|
|
73
73
|
return _context.stop();
|
|
74
74
|
}
|
|
@@ -81,7 +81,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
81
81
|
_defineProperty(this, "uploadArtifact", /*#__PURE__*/function () {
|
|
82
82
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(id, file, params, collectionName, traceContext) {
|
|
83
83
|
var metadata, headers, extendedParams, authContext, options;
|
|
84
|
-
return _regeneratorRuntime.wrap(function
|
|
84
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
85
85
|
while (1) switch (_context2.prev = _context2.next) {
|
|
86
86
|
case 0:
|
|
87
87
|
metadata = {
|
|
@@ -112,7 +112,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
112
112
|
traceContext: traceContext
|
|
113
113
|
});
|
|
114
114
|
return _context2.abrupt("return", _this.request("/file/".concat(id, "/artifact/binary"), options).then(createMapResponseToJson(metadata)));
|
|
115
|
-
case
|
|
115
|
+
case 1:
|
|
116
116
|
case "end":
|
|
117
117
|
return _context2.stop();
|
|
118
118
|
}
|
|
@@ -125,7 +125,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
125
125
|
_defineProperty(this, "deleteArtifact", /*#__PURE__*/function () {
|
|
126
126
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(id, artifactName, collectionName, traceContext) {
|
|
127
127
|
var metadata, authContext, options;
|
|
128
|
-
return _regeneratorRuntime.wrap(function
|
|
128
|
+
return _regeneratorRuntime.wrap(function (_context3) {
|
|
129
129
|
while (1) switch (_context3.prev = _context3.next) {
|
|
130
130
|
case 0:
|
|
131
131
|
metadata = {
|
|
@@ -147,9 +147,9 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
147
147
|
collection: collectionName
|
|
148
148
|
}
|
|
149
149
|
});
|
|
150
|
-
_context3.next =
|
|
150
|
+
_context3.next = 1;
|
|
151
151
|
return _this.request("/file/".concat(id, "/artifact/").concat(artifactName), options);
|
|
152
|
-
case
|
|
152
|
+
case 1:
|
|
153
153
|
case "end":
|
|
154
154
|
return _context3.stop();
|
|
155
155
|
}
|
|
@@ -173,17 +173,17 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
173
173
|
value: function () {
|
|
174
174
|
var _getClientId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(collectionName) {
|
|
175
175
|
var auth;
|
|
176
|
-
return _regeneratorRuntime.wrap(function
|
|
176
|
+
return _regeneratorRuntime.wrap(function (_context4) {
|
|
177
177
|
while (1) switch (_context4.prev = _context4.next) {
|
|
178
178
|
case 0:
|
|
179
|
-
_context4.next =
|
|
179
|
+
_context4.next = 1;
|
|
180
180
|
return this.resolveAuth({
|
|
181
181
|
collectionName: collectionName
|
|
182
182
|
});
|
|
183
|
-
case
|
|
183
|
+
case 1:
|
|
184
184
|
auth = _context4.sent;
|
|
185
185
|
return _context4.abrupt("return", MediaStore.extractClientIdFromAuth(auth));
|
|
186
|
-
case
|
|
186
|
+
case 2:
|
|
187
187
|
case "end":
|
|
188
188
|
return _context4.stop();
|
|
189
189
|
}
|
|
@@ -210,7 +210,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
210
210
|
value: function () {
|
|
211
211
|
var _removeCollectionFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(id, collectionName, occurrenceKey, traceContext) {
|
|
212
212
|
var metadata, body, options;
|
|
213
|
-
return _regeneratorRuntime.wrap(function
|
|
213
|
+
return _regeneratorRuntime.wrap(function (_context5) {
|
|
214
214
|
while (1) switch (_context5.prev = _context5.next) {
|
|
215
215
|
case 0:
|
|
216
216
|
metadata = {
|
|
@@ -238,9 +238,9 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
238
238
|
body: JSON.stringify(body),
|
|
239
239
|
traceContext: traceContext
|
|
240
240
|
});
|
|
241
|
-
_context5.next =
|
|
241
|
+
_context5.next = 1;
|
|
242
242
|
return this.request("/collection/".concat(collectionName), options);
|
|
243
|
-
case
|
|
243
|
+
case 1:
|
|
244
244
|
case "end":
|
|
245
245
|
return _context5.stop();
|
|
246
246
|
}
|
|
@@ -281,7 +281,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
281
281
|
value: function () {
|
|
282
282
|
var _uploadChunk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(etag, blob, uploadId, partNumber, collectionName, traceContext) {
|
|
283
283
|
var metadata, options;
|
|
284
|
-
return _regeneratorRuntime.wrap(function
|
|
284
|
+
return _regeneratorRuntime.wrap(function (_context6) {
|
|
285
285
|
while (1) switch (_context6.prev = _context6.next) {
|
|
286
286
|
case 0:
|
|
287
287
|
metadata = {
|
|
@@ -299,9 +299,9 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
299
299
|
body: blob,
|
|
300
300
|
traceContext: traceContext
|
|
301
301
|
});
|
|
302
|
-
_context6.next =
|
|
302
|
+
_context6.next = 1;
|
|
303
303
|
return this.request("/chunk/".concat(etag), options);
|
|
304
|
-
case
|
|
304
|
+
case 1:
|
|
305
305
|
case "end":
|
|
306
306
|
return _context6.stop();
|
|
307
307
|
}
|
|
@@ -355,7 +355,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
355
355
|
metadata,
|
|
356
356
|
options,
|
|
357
357
|
_args7 = arguments;
|
|
358
|
-
return _regeneratorRuntime.wrap(function
|
|
358
|
+
return _regeneratorRuntime.wrap(function (_context7) {
|
|
359
359
|
while (1) switch (_context7.prev = _context7.next) {
|
|
360
360
|
case 0:
|
|
361
361
|
params = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : {};
|
|
@@ -376,7 +376,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
376
376
|
}
|
|
377
377
|
});
|
|
378
378
|
return _context7.abrupt("return", this.request('/upload/createWithFiles', options).then(createMapResponseToJson(metadata)));
|
|
379
|
-
case
|
|
379
|
+
case 1:
|
|
380
380
|
case "end":
|
|
381
381
|
return _context7.stop();
|
|
382
382
|
}
|
|
@@ -410,18 +410,18 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
410
410
|
value: function () {
|
|
411
411
|
var _getFileImageURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(id, params) {
|
|
412
412
|
var _ref5, collectionName, auth;
|
|
413
|
-
return _regeneratorRuntime.wrap(function
|
|
413
|
+
return _regeneratorRuntime.wrap(function (_context8) {
|
|
414
414
|
while (1) switch (_context8.prev = _context8.next) {
|
|
415
415
|
case 0:
|
|
416
416
|
_ref5 = params || {}, collectionName = _ref5.collection;
|
|
417
|
-
_context8.next =
|
|
417
|
+
_context8.next = 1;
|
|
418
418
|
return this.resolveAuth({
|
|
419
419
|
collectionName: collectionName
|
|
420
420
|
});
|
|
421
|
-
case
|
|
421
|
+
case 1:
|
|
422
422
|
auth = _context8.sent;
|
|
423
423
|
return _context8.abrupt("return", this.createFileImageURL(id, auth, params));
|
|
424
|
-
case
|
|
424
|
+
case 2:
|
|
425
425
|
case "end":
|
|
426
426
|
return _context8.stop();
|
|
427
427
|
}
|
|
@@ -464,7 +464,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
464
464
|
metadata,
|
|
465
465
|
options,
|
|
466
466
|
_args9 = arguments;
|
|
467
|
-
return _regeneratorRuntime.wrap(function
|
|
467
|
+
return _regeneratorRuntime.wrap(function (_context9) {
|
|
468
468
|
while (1) switch (_context9.prev = _context9.next) {
|
|
469
469
|
case 0:
|
|
470
470
|
maxAge = _args9.length > 3 && _args9[3] !== undefined ? _args9[3] : FILE_CACHE_MAX_AGE;
|
|
@@ -485,7 +485,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
485
485
|
}
|
|
486
486
|
});
|
|
487
487
|
return _context9.abrupt("return", this.request("/file/".concat(id, "/").concat(binaryEndpoint), options, abortController, true).then(createMapResponseToBlob(metadata)));
|
|
488
|
-
case
|
|
488
|
+
case 1:
|
|
489
489
|
case "end":
|
|
490
490
|
return _context9.stop();
|
|
491
491
|
}
|
|
@@ -505,15 +505,15 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
505
505
|
options,
|
|
506
506
|
binaryEndpoint,
|
|
507
507
|
_args0 = arguments;
|
|
508
|
-
return _regeneratorRuntime.wrap(function
|
|
508
|
+
return _regeneratorRuntime.wrap(function (_context0) {
|
|
509
509
|
while (1) switch (_context0.prev = _context0.next) {
|
|
510
510
|
case 0:
|
|
511
511
|
maxAge = _args0.length > 2 && _args0[2] !== undefined ? _args0[2] : FILE_CACHE_MAX_AGE;
|
|
512
|
-
_context0.next =
|
|
512
|
+
_context0.next = 1;
|
|
513
513
|
return this.resolveAuth({
|
|
514
514
|
collectionName: collectionName
|
|
515
515
|
});
|
|
516
|
-
case
|
|
516
|
+
case 1:
|
|
517
517
|
auth = _context0.sent;
|
|
518
518
|
options = {
|
|
519
519
|
params: {
|
|
@@ -525,13 +525,13 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
525
525
|
};
|
|
526
526
|
binaryEndpoint = cdnFeatureFlag('binary');
|
|
527
527
|
if (!isPathBasedEnabled()) {
|
|
528
|
-
_context0.next =
|
|
528
|
+
_context0.next = 2;
|
|
529
529
|
break;
|
|
530
530
|
}
|
|
531
531
|
return _context0.abrupt("return", mapToPathBasedUrl(createUrl("".concat(auth.baseUrl, "/file/").concat(id, "/").concat(binaryEndpoint), options)));
|
|
532
|
-
case
|
|
532
|
+
case 2:
|
|
533
533
|
return _context0.abrupt("return", mapToMediaCdnUrl(createUrl("".concat(auth.baseUrl, "/file/").concat(id, "/").concat(binaryEndpoint), options), auth.token));
|
|
534
|
-
case
|
|
534
|
+
case 3:
|
|
535
535
|
case "end":
|
|
536
536
|
return _context0.stop();
|
|
537
537
|
}
|
|
@@ -552,7 +552,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
552
552
|
options,
|
|
553
553
|
url,
|
|
554
554
|
_args1 = arguments;
|
|
555
|
-
return _regeneratorRuntime.wrap(function
|
|
555
|
+
return _regeneratorRuntime.wrap(function (_context1) {
|
|
556
556
|
while (1) switch (_context1.prev = _context1.next) {
|
|
557
557
|
case 0:
|
|
558
558
|
maxAge = _args1.length > 3 && _args1[3] !== undefined ? _args1[3] : FILE_CACHE_MAX_AGE;
|
|
@@ -570,16 +570,16 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
570
570
|
} */
|
|
571
571
|
artifactUrl = getArtifactUrl(artifacts, artifactName);
|
|
572
572
|
if (artifactUrl) {
|
|
573
|
-
_context1.next =
|
|
573
|
+
_context1.next = 1;
|
|
574
574
|
break;
|
|
575
575
|
}
|
|
576
576
|
throw new Error("artifact ".concat(artifactName, " not found"));
|
|
577
|
-
case
|
|
578
|
-
_context1.next =
|
|
577
|
+
case 1:
|
|
578
|
+
_context1.next = 2;
|
|
579
579
|
return this.resolveAuth({
|
|
580
580
|
collectionName: collectionName
|
|
581
581
|
});
|
|
582
|
-
case
|
|
582
|
+
case 2:
|
|
583
583
|
auth = _context1.sent;
|
|
584
584
|
options = {
|
|
585
585
|
params: {
|
|
@@ -590,13 +590,13 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
590
590
|
};
|
|
591
591
|
url = mapToMediaCdnUrl(createUrl("".concat(auth.baseUrl).concat(artifactUrl), options), auth.token);
|
|
592
592
|
if (!isPathBasedEnabled()) {
|
|
593
|
-
_context1.next =
|
|
593
|
+
_context1.next = 3;
|
|
594
594
|
break;
|
|
595
595
|
}
|
|
596
596
|
return _context1.abrupt("return", mapToPathBasedUrl(url));
|
|
597
|
-
case
|
|
597
|
+
case 3:
|
|
598
598
|
return _context1.abrupt("return", url);
|
|
599
|
-
case
|
|
599
|
+
case 4:
|
|
600
600
|
case "end":
|
|
601
601
|
return _context1.stop();
|
|
602
602
|
}
|
|
@@ -612,7 +612,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
612
612
|
value: function () {
|
|
613
613
|
var _getImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(id, params, controller, fetchMaxRes, traceContext) {
|
|
614
614
|
var isWebpSupported, headers, imageEndpoint, metadata, wmvParams, authOptions, auth, wmv, options;
|
|
615
|
-
return _regeneratorRuntime.wrap(function
|
|
615
|
+
return _regeneratorRuntime.wrap(function (_context10) {
|
|
616
616
|
while (1) switch (_context10.prev = _context10.next) {
|
|
617
617
|
case 0:
|
|
618
618
|
// TODO add checkWebpSupport() back https://product-fabric.atlassian.net/browse/MPT-584
|
|
@@ -633,12 +633,12 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
633
633
|
}
|
|
634
634
|
};
|
|
635
635
|
if (!fg('confluence_watermark_admin_ui')) {
|
|
636
|
-
_context10.next =
|
|
636
|
+
_context10.next = 2;
|
|
637
637
|
break;
|
|
638
638
|
}
|
|
639
|
-
_context10.next =
|
|
639
|
+
_context10.next = 1;
|
|
640
640
|
return this.resolveAuth(authOptions.authContext);
|
|
641
|
-
case
|
|
641
|
+
case 1:
|
|
642
642
|
auth = _context10.sent;
|
|
643
643
|
wmv = getWatermarkVersionFromToken(auth.token);
|
|
644
644
|
if (wmv) {
|
|
@@ -649,7 +649,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
649
649
|
authOptions = {
|
|
650
650
|
resolvedAuth: auth
|
|
651
651
|
};
|
|
652
|
-
case
|
|
652
|
+
case 2:
|
|
653
653
|
options = _objectSpread(_objectSpread(_objectSpread({}, metadata), authOptions), {}, {
|
|
654
654
|
params: _objectSpread(_objectSpread({}, extendImageParams(params, fetchMaxRes)), wmvParams),
|
|
655
655
|
headers: headers,
|
|
@@ -657,7 +657,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
657
657
|
addMediaClientParam: true
|
|
658
658
|
});
|
|
659
659
|
return _context10.abrupt("return", this.request("/file/".concat(id, "/").concat(imageEndpoint), options, controller, true).then(createMapResponseToBlob(metadata)));
|
|
660
|
-
case
|
|
660
|
+
case 3:
|
|
661
661
|
case "end":
|
|
662
662
|
return _context10.stop();
|
|
663
663
|
}
|
|
@@ -673,7 +673,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
673
673
|
value: function () {
|
|
674
674
|
var _getItems = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(ids, collectionName, traceContext, includeHashForDuplicateFiles) {
|
|
675
675
|
var descriptors, metadata, options;
|
|
676
|
-
return _regeneratorRuntime.wrap(function
|
|
676
|
+
return _regeneratorRuntime.wrap(function (_context11) {
|
|
677
677
|
while (1) switch (_context11.prev = _context11.next) {
|
|
678
678
|
case 0:
|
|
679
679
|
descriptors = ids.map(function (id) {
|
|
@@ -699,7 +699,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
699
699
|
traceContext: traceContext
|
|
700
700
|
});
|
|
701
701
|
return _context11.abrupt("return", this.request('/items', options).then(createMapResponseToJson(metadata)));
|
|
702
|
-
case
|
|
702
|
+
case 1:
|
|
703
703
|
case "end":
|
|
704
704
|
return _context11.stop();
|
|
705
705
|
}
|
|
@@ -715,7 +715,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
715
715
|
value: function () {
|
|
716
716
|
var _getImageMetadata = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(id, params, traceContext) {
|
|
717
717
|
var metadata, options;
|
|
718
|
-
return _regeneratorRuntime.wrap(function
|
|
718
|
+
return _regeneratorRuntime.wrap(function (_context12) {
|
|
719
719
|
while (1) switch (_context12.prev = _context12.next) {
|
|
720
720
|
case 0:
|
|
721
721
|
metadata = {
|
|
@@ -730,7 +730,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
730
730
|
traceContext: traceContext
|
|
731
731
|
});
|
|
732
732
|
return _context12.abrupt("return", this.request("/file/".concat(id, "/image/metadata"), options).then(createMapResponseToJson(metadata)));
|
|
733
|
-
case
|
|
733
|
+
case 1:
|
|
734
734
|
case "end":
|
|
735
735
|
return _context12.stop();
|
|
736
736
|
}
|
|
@@ -746,7 +746,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
746
746
|
value: function () {
|
|
747
747
|
var _getDocumentContent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(id, options, traceContext) {
|
|
748
748
|
var shouldCache, endpoint, metadata, headers, requestOptions;
|
|
749
|
-
return _regeneratorRuntime.wrap(function
|
|
749
|
+
return _regeneratorRuntime.wrap(function (_context13) {
|
|
750
750
|
while (1) switch (_context13.prev = _context13.next) {
|
|
751
751
|
case 0:
|
|
752
752
|
// when requesting for password protected document don't use CDN as it won't forward headers
|
|
@@ -775,7 +775,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
775
775
|
traceContext: traceContext
|
|
776
776
|
});
|
|
777
777
|
return _context13.abrupt("return", this.request("/file/".concat(id, "/document/").concat(endpoint), requestOptions).then(createMapResponseToJson(metadata)));
|
|
778
|
-
case
|
|
778
|
+
case 1:
|
|
779
779
|
case "end":
|
|
780
780
|
return _context13.stop();
|
|
781
781
|
}
|
|
@@ -791,7 +791,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
791
791
|
value: function () {
|
|
792
792
|
var _getDocumentPageImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(id, options, traceContext) {
|
|
793
793
|
var shouldCache, endpoint, metadata, headers, requestOptions;
|
|
794
|
-
return _regeneratorRuntime.wrap(function
|
|
794
|
+
return _regeneratorRuntime.wrap(function (_context14) {
|
|
795
795
|
while (1) switch (_context14.prev = _context14.next) {
|
|
796
796
|
case 0:
|
|
797
797
|
// when requesting for password protected document don't use CDN as it won't forward headers
|
|
@@ -820,7 +820,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
820
820
|
traceContext: traceContext
|
|
821
821
|
});
|
|
822
822
|
return _context14.abrupt("return", this.request("/file/".concat(id, "/document/").concat(endpoint), requestOptions).then(createMapResponseToBlob(metadata)));
|
|
823
|
-
case
|
|
823
|
+
case 1:
|
|
824
824
|
case "end":
|
|
825
825
|
return _context14.stop();
|
|
826
826
|
}
|
|
@@ -836,7 +836,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
836
836
|
value: function () {
|
|
837
837
|
var _appendChunksToUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(uploadId, body, collectionName, traceContext, options) {
|
|
838
838
|
var metadata, headers, requestOptions;
|
|
839
|
-
return _regeneratorRuntime.wrap(function
|
|
839
|
+
return _regeneratorRuntime.wrap(function (_context15) {
|
|
840
840
|
while (1) switch (_context15.prev = _context15.next) {
|
|
841
841
|
case 0:
|
|
842
842
|
metadata = {
|
|
@@ -855,9 +855,9 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
855
855
|
body: JSON.stringify(body),
|
|
856
856
|
traceContext: traceContext
|
|
857
857
|
});
|
|
858
|
-
_context15.next =
|
|
858
|
+
_context15.next = 1;
|
|
859
859
|
return this.request("/upload/".concat(uploadId, "/chunks"), requestOptions);
|
|
860
|
-
case
|
|
860
|
+
case 1:
|
|
861
861
|
case "end":
|
|
862
862
|
return _context15.stop();
|
|
863
863
|
}
|
|
@@ -923,7 +923,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
923
923
|
value: function () {
|
|
924
924
|
var _registerCopyIntents = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(files, traceContext, resolvedAuth) {
|
|
925
925
|
var metadata, options;
|
|
926
|
-
return _regeneratorRuntime.wrap(function
|
|
926
|
+
return _regeneratorRuntime.wrap(function (_context16) {
|
|
927
927
|
while (1) switch (_context16.prev = _context16.next) {
|
|
928
928
|
case 0:
|
|
929
929
|
metadata = {
|
|
@@ -938,9 +938,9 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
938
938
|
traceContext: traceContext,
|
|
939
939
|
resolvedAuth: resolvedAuth
|
|
940
940
|
});
|
|
941
|
-
_context16.next =
|
|
941
|
+
_context16.next = 1;
|
|
942
942
|
return this.request('/file/copy/intents', options);
|
|
943
|
-
case
|
|
943
|
+
case 1:
|
|
944
944
|
case "end":
|
|
945
945
|
return _context16.stop();
|
|
946
946
|
}
|
|
@@ -974,8 +974,9 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
974
974
|
extendedParams,
|
|
975
975
|
url,
|
|
976
976
|
response,
|
|
977
|
-
_args17 = arguments
|
|
978
|
-
|
|
977
|
+
_args17 = arguments,
|
|
978
|
+
_t;
|
|
979
|
+
return _regeneratorRuntime.wrap(function (_context17) {
|
|
979
980
|
while (1) switch (_context17.prev = _context17.next) {
|
|
980
981
|
case 0:
|
|
981
982
|
options = _args17.length > 1 && _args17[1] !== undefined ? _args17[1] : {
|
|
@@ -987,19 +988,19 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
987
988
|
useMediaCdn = _args17.length > 3 ? _args17[3] : undefined;
|
|
988
989
|
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;
|
|
989
990
|
if (!(resolvedAuth !== null && resolvedAuth !== void 0)) {
|
|
990
|
-
_context17.next =
|
|
991
|
+
_context17.next = 1;
|
|
991
992
|
break;
|
|
992
993
|
}
|
|
993
|
-
|
|
994
|
-
_context17.next =
|
|
994
|
+
_t = resolvedAuth;
|
|
995
|
+
_context17.next = 3;
|
|
995
996
|
break;
|
|
996
|
-
case
|
|
997
|
-
_context17.next =
|
|
997
|
+
case 1:
|
|
998
|
+
_context17.next = 2;
|
|
998
999
|
return this.resolveAuth(authContext);
|
|
999
|
-
case
|
|
1000
|
-
|
|
1001
|
-
case
|
|
1002
|
-
auth =
|
|
1000
|
+
case 2:
|
|
1001
|
+
_t = _context17.sent;
|
|
1002
|
+
case 3:
|
|
1003
|
+
auth = _t;
|
|
1003
1004
|
clientId = isClientBasedAuth(auth) ? auth.clientId : undefined;
|
|
1004
1005
|
extendedTraceContext = extendTraceContext(traceContext);
|
|
1005
1006
|
extendedParams = addMediaClientParam ? _objectSpread(_objectSpread({}, params), {}, {
|
|
@@ -1012,7 +1013,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
1012
1013
|
if (isPathBasedEnabled()) {
|
|
1013
1014
|
url = mapToPathBasedUrl(url);
|
|
1014
1015
|
}
|
|
1015
|
-
_context17.next =
|
|
1016
|
+
_context17.next = 4;
|
|
1016
1017
|
return _request(url, {
|
|
1017
1018
|
method: method,
|
|
1018
1019
|
endpoint: endpoint,
|
|
@@ -1023,12 +1024,12 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
1023
1024
|
clientOptions: clientOptions,
|
|
1024
1025
|
traceContext: extendedTraceContext
|
|
1025
1026
|
}, controller);
|
|
1026
|
-
case
|
|
1027
|
+
case 4:
|
|
1027
1028
|
response = _context17.sent;
|
|
1028
1029
|
setKeyValueInSessionStorage(MEDIA_API_REGION, response.headers.get('x-media-region'));
|
|
1029
1030
|
setKeyValueInSessionStorage(MEDIA_API_ENVIRONMENT, response.headers.get('x-media-env'));
|
|
1030
1031
|
return _context17.abrupt("return", response);
|
|
1031
|
-
case
|
|
1032
|
+
case 5:
|
|
1032
1033
|
case "end":
|
|
1033
1034
|
return _context17.stop();
|
|
1034
1035
|
}
|
|
@@ -1046,12 +1047,12 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
1046
1047
|
var options,
|
|
1047
1048
|
traceContext,
|
|
1048
1049
|
_args18 = arguments;
|
|
1049
|
-
return _regeneratorRuntime.wrap(function
|
|
1050
|
+
return _regeneratorRuntime.wrap(function (_context18) {
|
|
1050
1051
|
while (1) switch (_context18.prev = _context18.next) {
|
|
1051
1052
|
case 0:
|
|
1052
1053
|
options = _args18.length > 1 && _args18[1] !== undefined ? _args18[1] : {};
|
|
1053
1054
|
traceContext = options.traceContext;
|
|
1054
|
-
_context18.next =
|
|
1055
|
+
_context18.next = 1;
|
|
1055
1056
|
return _request(url, {
|
|
1056
1057
|
method: 'HEAD',
|
|
1057
1058
|
traceContext: extendTraceContext(traceContext),
|
|
@@ -1061,7 +1062,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
1061
1062
|
}
|
|
1062
1063
|
}
|
|
1063
1064
|
});
|
|
1064
|
-
case
|
|
1065
|
+
case 1:
|
|
1065
1066
|
case "end":
|
|
1066
1067
|
return _context18.stop();
|
|
1067
1068
|
}
|
|
@@ -12,8 +12,9 @@ export var resolveAuth = /*#__PURE__*/function () {
|
|
|
12
12
|
eventEmitted,
|
|
13
13
|
authProviderPromise,
|
|
14
14
|
auth,
|
|
15
|
-
_args = arguments
|
|
16
|
-
|
|
15
|
+
_args = arguments,
|
|
16
|
+
_t;
|
|
17
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
17
18
|
while (1) switch (_context.prev = _context.next) {
|
|
18
19
|
case 0:
|
|
19
20
|
authProviderTimeout = _args.length > 2 && _args[2] !== undefined ? _args[2] : DEFAULT_AUTH_PROVIDER_TIMEOUT;
|
|
@@ -50,41 +51,41 @@ export var resolveAuth = /*#__PURE__*/function () {
|
|
|
50
51
|
});
|
|
51
52
|
throw error;
|
|
52
53
|
}) : authProvider(authContext); // Original behavior when FG off
|
|
53
|
-
_context.prev =
|
|
54
|
-
_context.next =
|
|
54
|
+
_context.prev = 1;
|
|
55
|
+
_context.next = 2;
|
|
55
56
|
return Promise.race([authProviderPromise, rejectTimeout(authProviderTimeout, new MediaStoreError('authProviderTimedOut'))]);
|
|
56
|
-
case
|
|
57
|
+
case 2:
|
|
57
58
|
auth = _context.sent;
|
|
58
|
-
_context.next =
|
|
59
|
+
_context.next = 5;
|
|
59
60
|
break;
|
|
60
|
-
case
|
|
61
|
-
_context.prev =
|
|
62
|
-
|
|
61
|
+
case 3:
|
|
62
|
+
_context.prev = 3;
|
|
63
|
+
_t = _context["catch"](1);
|
|
63
64
|
// Mark as emitted so late arrivals are handled correctly by .then()/.catch()
|
|
64
65
|
if (!eventEmitted && fg('platform_media_auth_provider_analytics')) {
|
|
65
66
|
eventEmitted = true;
|
|
66
67
|
}
|
|
67
68
|
// PRESERVE ORIGINAL ERROR HANDLING
|
|
68
|
-
if (!(
|
|
69
|
-
_context.next =
|
|
69
|
+
if (!(_t instanceof MediaStoreError)) {
|
|
70
|
+
_context.next = 4;
|
|
70
71
|
break;
|
|
71
72
|
}
|
|
72
|
-
throw
|
|
73
|
-
case
|
|
74
|
-
throw new MediaStoreError('failedAuthProvider',
|
|
75
|
-
case
|
|
73
|
+
throw _t;
|
|
74
|
+
case 4:
|
|
75
|
+
throw new MediaStoreError('failedAuthProvider', _t instanceof Error ? _t : undefined);
|
|
76
|
+
case 5:
|
|
76
77
|
if (auth) {
|
|
77
|
-
_context.next =
|
|
78
|
+
_context.next = 6;
|
|
78
79
|
break;
|
|
79
80
|
}
|
|
80
81
|
throw new MediaStoreError('emptyAuth');
|
|
81
|
-
case
|
|
82
|
+
case 6:
|
|
82
83
|
return _context.abrupt("return", auth);
|
|
83
|
-
case
|
|
84
|
+
case 7:
|
|
84
85
|
case "end":
|
|
85
86
|
return _context.stop();
|
|
86
87
|
}
|
|
87
|
-
}, _callee, null, [[
|
|
88
|
+
}, _callee, null, [[1, 3]]);
|
|
88
89
|
}));
|
|
89
90
|
return function resolveAuth(_x, _x2) {
|
|
90
91
|
return _ref.apply(this, arguments);
|