@atlaskit/media-client 18.1.0 → 19.1.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 +23 -0
- package/dist/cjs/client/collection-fetcher.js +8 -8
- package/dist/cjs/client/file-fetcher/index.js +40 -36
- package/dist/cjs/client/media-client.js +2 -2
- package/dist/cjs/client/media-store/index.js +69 -52
- package/dist/cjs/models/file-state.js +4 -2
- package/dist/cjs/uploader/index.js +40 -70
- package/dist/cjs/utils/createFileDataLoader.js +32 -15
- package/dist/cjs/utils/request/helpers.js +39 -22
- package/dist/cjs/utils/request/index.js +5 -3
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/client/collection-fetcher.js +6 -6
- package/dist/es2019/client/file-fetcher/index.js +16 -14
- package/dist/es2019/client/media-client.js +2 -2
- package/dist/es2019/client/media-store/index.js +50 -41
- package/dist/es2019/models/file-state.js +4 -2
- package/dist/es2019/uploader/index.js +17 -21
- package/dist/es2019/utils/createFileDataLoader.js +13 -3
- package/dist/es2019/utils/request/helpers.js +26 -8
- package/dist/es2019/utils/request/index.js +6 -4
- package/dist/es2019/version.json +1 -1
- package/dist/esm/client/collection-fetcher.js +8 -8
- package/dist/esm/client/file-fetcher/index.js +40 -36
- package/dist/esm/client/media-client.js +2 -2
- package/dist/esm/client/media-store/index.js +68 -50
- package/dist/esm/models/file-state.js +4 -2
- package/dist/esm/uploader/index.js +40 -69
- package/dist/esm/utils/createFileDataLoader.js +31 -13
- package/dist/esm/utils/request/helpers.js +36 -20
- package/dist/esm/utils/request/index.js +6 -4
- package/dist/esm/version.json +1 -1
- package/dist/types/client/collection-fetcher.d.ts +4 -3
- package/dist/types/client/file-fetcher/index.d.ts +9 -8
- package/dist/types/client/media-client.d.ts +2 -2
- package/dist/types/client/media-store/index.d.ts +16 -21
- package/dist/types/models/file-state.d.ts +9 -6
- package/dist/types/models/media.d.ts +3 -1
- package/dist/types/uploader/index.d.ts +2 -1
- package/dist/types/utils/request/helpers.d.ts +10 -2
- package/dist/types/utils/request/types.d.ts +3 -0
- package/package.json +7 -15
- package/report.api.md +116 -75
- package/dist/types-ts4.0/client/__mocks__/collection-fetcher.d.ts +0 -8
- package/dist/types-ts4.0/client/__mocks__/file-fetcher.d.ts +0 -10
- package/dist/types-ts4.0/client/__mocks__/media-client.d.ts +0 -13
- package/dist/types-ts4.0/client/collection-fetcher.d.ts +0 -35
- package/dist/types-ts4.0/client/events.d.ts +0 -14
- package/dist/types-ts4.0/client/file-fetcher/error.d.ts +0 -29
- package/dist/types-ts4.0/client/file-fetcher/index.d.ts +0 -56
- package/dist/types-ts4.0/client/media-client.d.ts +0 -28
- package/dist/types-ts4.0/client/media-store/error.d.ts +0 -16
- package/dist/types-ts4.0/client/media-store/index.d.ts +0 -174
- package/dist/types-ts4.0/client/media-store/resolveAuth.d.ts +0 -4
- package/dist/types-ts4.0/client/mobile-upload.d.ts +0 -11
- package/dist/types-ts4.0/client/stargate-client.d.ts +0 -15
- package/dist/types-ts4.0/constants.d.ts +0 -6
- package/dist/types-ts4.0/file-streams-cache.d.ts +0 -15
- package/dist/types-ts4.0/globalMediaEventEmitter.d.ts +0 -6
- package/dist/types-ts4.0/identifier.d.ts +0 -15
- package/dist/types-ts4.0/index.d.ts +0 -89
- package/dist/types-ts4.0/models/artifacts.d.ts +0 -12
- package/dist/types-ts4.0/models/auth-headers.d.ts +0 -11
- package/dist/types-ts4.0/models/auth-query-parameters.d.ts +0 -11
- package/dist/types-ts4.0/models/errors/helpers.d.ts +0 -6
- package/dist/types-ts4.0/models/errors/index.d.ts +0 -11
- package/dist/types-ts4.0/models/errors/types.d.ts +0 -15
- package/dist/types-ts4.0/models/file-state.d.ts +0 -91
- package/dist/types-ts4.0/models/item.d.ts +0 -25
- package/dist/types-ts4.0/models/media-subscribable.d.ts +0 -3
- package/dist/types-ts4.0/models/media.d.ts +0 -66
- package/dist/types-ts4.0/models/mobile-upload.d.ts +0 -28
- package/dist/types-ts4.0/upload-controller.d.ts +0 -7
- package/dist/types-ts4.0/uploader/calculateChunkSize.d.ts +0 -11
- package/dist/types-ts4.0/uploader/error.d.ts +0 -29
- package/dist/types-ts4.0/uploader/index.d.ts +0 -21
- package/dist/types-ts4.0/utils/checkWebpSupport.d.ts +0 -1
- package/dist/types-ts4.0/utils/convertBase64ToBlob.d.ts +0 -1
- package/dist/types-ts4.0/utils/createFileDataLoader.d.ts +0 -30
- package/dist/types-ts4.0/utils/createMediaSubject.d.ts +0 -3
- package/dist/types-ts4.0/utils/detectEmptyFile.d.ts +0 -16
- package/dist/types-ts4.0/utils/getDimensionsFromBlob.d.ts +0 -6
- package/dist/types-ts4.0/utils/getImageDimensionsFromBlob.d.ts +0 -5
- package/dist/types-ts4.0/utils/getMediaTypeFromUploadableFile.d.ts +0 -3
- package/dist/types-ts4.0/utils/getVideoDimensionsFromBlob.d.ts +0 -5
- package/dist/types-ts4.0/utils/hashing/hasher.d.ts +0 -3
- package/dist/types-ts4.0/utils/hashing/hasherCreator.d.ts +0 -3
- package/dist/types-ts4.0/utils/hashing/simpleHasher.d.ts +0 -4
- package/dist/types-ts4.0/utils/hashing/workerHasher.d.ts +0 -16
- package/dist/types-ts4.0/utils/imageResizeModeToFileImageMode.d.ts +0 -3
- package/dist/types-ts4.0/utils/isImageRemote.d.ts +0 -1
- package/dist/types-ts4.0/utils/mediaSubscribable/fromObservable.d.ts +0 -5
- package/dist/types-ts4.0/utils/mediaSubscribable/index.d.ts +0 -3
- package/dist/types-ts4.0/utils/mediaSubscribable/toPromise.d.ts +0 -10
- package/dist/types-ts4.0/utils/mediaSubscribable/types.d.ts +0 -16
- package/dist/types-ts4.0/utils/mobileUpload/error.d.ts +0 -29
- package/dist/types-ts4.0/utils/mobileUpload/helpers.d.ts +0 -8
- package/dist/types-ts4.0/utils/mobileUpload/index.d.ts +0 -5
- package/dist/types-ts4.0/utils/mobileUpload/servicesCache.d.ts +0 -4
- package/dist/types-ts4.0/utils/mobileUpload/stateMachine/index.d.ts +0 -7
- package/dist/types-ts4.0/utils/mobileUpload/stateMachine/states/error.d.ts +0 -3
- package/dist/types-ts4.0/utils/mobileUpload/stateMachine/states/processed.d.ts +0 -3
- package/dist/types-ts4.0/utils/mobileUpload/stateMachine/states/processing.d.ts +0 -3
- package/dist/types-ts4.0/utils/mobileUpload/stateMachine/states/processingFailed.d.ts +0 -3
- package/dist/types-ts4.0/utils/mobileUpload/stateMachine/states/uploading.d.ts +0 -3
- package/dist/types-ts4.0/utils/mobileUpload/stateMachine/types.d.ts +0 -69
- package/dist/types-ts4.0/utils/overrideMediaTypeIfUnknown.d.ts +0 -5
- package/dist/types-ts4.0/utils/polling/errors.d.ts +0 -12
- package/dist/types-ts4.0/utils/polling/index.d.ts +0 -33
- package/dist/types-ts4.0/utils/polling/types.d.ts +0 -7
- package/dist/types-ts4.0/utils/request/errors.d.ts +0 -20
- package/dist/types-ts4.0/utils/request/helpers.d.ts +0 -38
- package/dist/types-ts4.0/utils/request/index.d.ts +0 -5
- package/dist/types-ts4.0/utils/request/types.d.ts +0 -43
- package/dist/types-ts4.0/utils/safeUnsubscribe.d.ts +0 -2
- package/dist/types-ts4.0/utils/setTimeoutPromise.d.ts +0 -2
- package/dist/types-ts4.0/utils/shouldFetchRemoteFileStates.d.ts +0 -16
- package/dist/types-ts4.0/utils/url.d.ts +0 -17
- package/dist/types-ts4.0/utils/with-media-client-hoc.d.ts +0 -16
|
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "MediaStoreError", {
|
|
|
12
12
|
return _error.MediaStoreError;
|
|
13
13
|
}
|
|
14
14
|
});
|
|
15
|
-
exports.getMediaRegion = exports.getMediaEnvironment =
|
|
15
|
+
exports.getMediaRegion = exports.getMediaEnvironment = void 0;
|
|
16
16
|
Object.defineProperty(exports, "isMediaStoreError", {
|
|
17
17
|
enumerable: true,
|
|
18
18
|
get: function get() {
|
|
@@ -72,14 +72,6 @@ var jsonHeaders = {
|
|
|
72
72
|
Accept: 'application/json',
|
|
73
73
|
'Content-Type': 'application/json'
|
|
74
74
|
};
|
|
75
|
-
var ZipkinHeaderKeys = {
|
|
76
|
-
traceId: 'x-b3-traceid',
|
|
77
|
-
spanId: 'x-b3-spanid',
|
|
78
|
-
parentSpanId: 'x-b3-parentspanid',
|
|
79
|
-
sampled: 'x-b3-sampled',
|
|
80
|
-
flags: 'x-b3-flags'
|
|
81
|
-
};
|
|
82
|
-
exports.ZipkinHeaderKeys = ZipkinHeaderKeys;
|
|
83
75
|
|
|
84
76
|
var MediaStore = /*#__PURE__*/function () {
|
|
85
77
|
function MediaStore(config, featureFlags) {
|
|
@@ -99,7 +91,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
99
91
|
(0, _createClass2.default)(MediaStore, [{
|
|
100
92
|
key: "getCollectionItems",
|
|
101
93
|
value: function () {
|
|
102
|
-
var _getCollectionItems = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(collectionName, params) {
|
|
94
|
+
var _getCollectionItems = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(collectionName, params, traceContext) {
|
|
103
95
|
var metadata, options, response, _yield$createMapRespo, _yield$createMapRespo2, contents, nextInclusiveStartKey, contentsWithoutEmptyFiles;
|
|
104
96
|
|
|
105
97
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
@@ -117,7 +109,8 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
117
109
|
params: _objectSpread(_objectSpread({}, defaultGetCollectionItems), params),
|
|
118
110
|
headers: {
|
|
119
111
|
Accept: 'application/json'
|
|
120
|
-
}
|
|
112
|
+
},
|
|
113
|
+
traceContext: traceContext
|
|
121
114
|
});
|
|
122
115
|
_context.next = 4;
|
|
123
116
|
return this.request("/collection/".concat(collectionName, "/items"), options);
|
|
@@ -152,7 +145,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
152
145
|
}, _callee, this);
|
|
153
146
|
}));
|
|
154
147
|
|
|
155
|
-
function getCollectionItems(_x, _x2) {
|
|
148
|
+
function getCollectionItems(_x, _x2, _x3) {
|
|
156
149
|
return _getCollectionItems.apply(this, arguments);
|
|
157
150
|
}
|
|
158
151
|
|
|
@@ -161,7 +154,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
161
154
|
}, {
|
|
162
155
|
key: "removeCollectionFile",
|
|
163
156
|
value: function () {
|
|
164
|
-
var _removeCollectionFile = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(id, collectionName, occurrenceKey) {
|
|
157
|
+
var _removeCollectionFile = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(id, collectionName, occurrenceKey, traceContext) {
|
|
165
158
|
var metadata, body, options;
|
|
166
159
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
167
160
|
while (1) {
|
|
@@ -189,7 +182,8 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
189
182
|
Accept: 'application/json',
|
|
190
183
|
'Content-Type': 'application/json'
|
|
191
184
|
},
|
|
192
|
-
body: JSON.stringify(body)
|
|
185
|
+
body: JSON.stringify(body),
|
|
186
|
+
traceContext: traceContext
|
|
193
187
|
});
|
|
194
188
|
_context2.next = 5;
|
|
195
189
|
return this.request("/collection/".concat(collectionName), options);
|
|
@@ -202,7 +196,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
202
196
|
}, _callee2, this);
|
|
203
197
|
}));
|
|
204
198
|
|
|
205
|
-
function removeCollectionFile(
|
|
199
|
+
function removeCollectionFile(_x4, _x5, _x6, _x7) {
|
|
206
200
|
return _removeCollectionFile.apply(this, arguments);
|
|
207
201
|
}
|
|
208
202
|
|
|
@@ -213,6 +207,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
213
207
|
value: function createUpload() {
|
|
214
208
|
var createUpTo = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
|
215
209
|
var collectionName = arguments.length > 1 ? arguments[1] : undefined;
|
|
210
|
+
var traceContext = arguments.length > 2 ? arguments[2] : undefined;
|
|
216
211
|
var metadata = {
|
|
217
212
|
method: 'POST',
|
|
218
213
|
endpoint: '/upload'
|
|
@@ -227,7 +222,8 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
227
222
|
},
|
|
228
223
|
headers: {
|
|
229
224
|
Accept: 'application/json'
|
|
230
|
-
}
|
|
225
|
+
},
|
|
226
|
+
traceContext: traceContext
|
|
231
227
|
});
|
|
232
228
|
|
|
233
229
|
return this.request("/upload", options).then((0, _helpers.createMapResponseToJson)(metadata));
|
|
@@ -240,6 +236,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
240
236
|
collectionName,
|
|
241
237
|
uploadId,
|
|
242
238
|
partNumber,
|
|
239
|
+
traceContext,
|
|
243
240
|
metadata,
|
|
244
241
|
options,
|
|
245
242
|
_args3 = arguments;
|
|
@@ -249,6 +246,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
249
246
|
switch (_context3.prev = _context3.next) {
|
|
250
247
|
case 0:
|
|
251
248
|
_ref = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : {}, collectionName = _ref.collectionName, uploadId = _ref.uploadId, partNumber = _ref.partNumber;
|
|
249
|
+
traceContext = _args3.length > 3 ? _args3[3] : undefined;
|
|
252
250
|
metadata = {
|
|
253
251
|
method: 'PUT',
|
|
254
252
|
endpoint: '/chunk/{etag}'
|
|
@@ -261,12 +259,13 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
261
259
|
authContext: {
|
|
262
260
|
collectionName: collectionName
|
|
263
261
|
},
|
|
264
|
-
body: blob
|
|
262
|
+
body: blob,
|
|
263
|
+
traceContext: traceContext
|
|
265
264
|
});
|
|
266
|
-
_context3.next =
|
|
265
|
+
_context3.next = 6;
|
|
267
266
|
return this.request("/chunk/".concat(etag), options);
|
|
268
267
|
|
|
269
|
-
case
|
|
268
|
+
case 6:
|
|
270
269
|
case "end":
|
|
271
270
|
return _context3.stop();
|
|
272
271
|
}
|
|
@@ -274,7 +273,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
274
273
|
}, _callee3, this);
|
|
275
274
|
}));
|
|
276
275
|
|
|
277
|
-
function uploadChunk(
|
|
276
|
+
function uploadChunk(_x8, _x9) {
|
|
278
277
|
return _uploadChunk.apply(this, arguments);
|
|
279
278
|
}
|
|
280
279
|
|
|
@@ -287,6 +286,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
287
286
|
collectionName = _ref2.collectionName,
|
|
288
287
|
uploadId = _ref2.uploadId;
|
|
289
288
|
|
|
289
|
+
var traceContext = arguments.length > 2 ? arguments[2] : undefined;
|
|
290
290
|
var metadata = {
|
|
291
291
|
method: 'POST',
|
|
292
292
|
endpoint: '/chunk/probe'
|
|
@@ -302,7 +302,8 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
302
302
|
headers: jsonHeaders,
|
|
303
303
|
body: JSON.stringify({
|
|
304
304
|
chunks: chunks
|
|
305
|
-
})
|
|
305
|
+
}),
|
|
306
|
+
traceContext: traceContext
|
|
306
307
|
});
|
|
307
308
|
|
|
308
309
|
return this.request("/chunk/probe", options).then((0, _helpers.createMapResponseToJson)(metadata));
|
|
@@ -311,6 +312,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
311
312
|
key: "createFileFromUpload",
|
|
312
313
|
value: function createFileFromUpload(body) {
|
|
313
314
|
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
315
|
+
var traceContext = arguments.length > 2 ? arguments[2] : undefined;
|
|
314
316
|
var metadata = {
|
|
315
317
|
method: 'POST',
|
|
316
318
|
endpoint: '/file/upload'
|
|
@@ -322,7 +324,8 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
322
324
|
},
|
|
323
325
|
params: params,
|
|
324
326
|
headers: jsonHeaders,
|
|
325
|
-
body: JSON.stringify(body)
|
|
327
|
+
body: JSON.stringify(body),
|
|
328
|
+
traceContext: traceContext
|
|
326
329
|
});
|
|
327
330
|
|
|
328
331
|
return this.request('/file/upload', options).then((0, _helpers.createMapResponseToJson)(metadata));
|
|
@@ -331,6 +334,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
331
334
|
key: "touchFiles",
|
|
332
335
|
value: function touchFiles(body) {
|
|
333
336
|
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
337
|
+
var traceContext = arguments.length > 2 ? arguments[2] : undefined;
|
|
334
338
|
var metadata = {
|
|
335
339
|
method: 'POST',
|
|
336
340
|
endpoint: '/upload/createWithFiles'
|
|
@@ -341,7 +345,8 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
341
345
|
collectionName: params.collection
|
|
342
346
|
},
|
|
343
347
|
headers: jsonHeaders,
|
|
344
|
-
body: JSON.stringify(body)
|
|
348
|
+
body: JSON.stringify(body),
|
|
349
|
+
traceContext: traceContext
|
|
345
350
|
});
|
|
346
351
|
|
|
347
352
|
return this.request('/upload/createWithFiles', options).then((0, _helpers.createMapResponseToJson)(metadata));
|
|
@@ -350,6 +355,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
350
355
|
key: "getFile",
|
|
351
356
|
value: function getFile(fileId) {
|
|
352
357
|
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
358
|
+
var traceContext = arguments.length > 2 ? arguments[2] : undefined;
|
|
353
359
|
var metadata = {
|
|
354
360
|
method: 'GET',
|
|
355
361
|
endpoint: '/file/{fileId}'
|
|
@@ -359,7 +365,8 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
359
365
|
authContext: {
|
|
360
366
|
collectionName: params.collection
|
|
361
367
|
},
|
|
362
|
-
params: params
|
|
368
|
+
params: params,
|
|
369
|
+
traceContext: traceContext
|
|
363
370
|
});
|
|
364
371
|
|
|
365
372
|
return this.request("/file/".concat(fileId), options).then((0, _helpers.createMapResponseToJson)(metadata));
|
|
@@ -392,12 +399,13 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
392
399
|
}, _callee4, this);
|
|
393
400
|
}));
|
|
394
401
|
|
|
395
|
-
function getFileImageURL(
|
|
402
|
+
function getFileImageURL(_x10, _x11) {
|
|
396
403
|
return _getFileImageURL.apply(this, arguments);
|
|
397
404
|
}
|
|
398
405
|
|
|
399
406
|
return getFileImageURL;
|
|
400
|
-
}()
|
|
407
|
+
}() // TODO Create ticket in case Trace Id can be supported through query params
|
|
408
|
+
|
|
401
409
|
}, {
|
|
402
410
|
key: "getFileImageURLSync",
|
|
403
411
|
value: function getFileImageURLSync(id, params) {
|
|
@@ -447,7 +455,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
447
455
|
}, _callee5, this);
|
|
448
456
|
}));
|
|
449
457
|
|
|
450
|
-
function getFileBinaryURL(
|
|
458
|
+
function getFileBinaryURL(_x12, _x13) {
|
|
451
459
|
return _getFileBinaryURL.apply(this, arguments);
|
|
452
460
|
}
|
|
453
461
|
|
|
@@ -496,7 +504,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
496
504
|
}, _callee6, this);
|
|
497
505
|
}));
|
|
498
506
|
|
|
499
|
-
function getArtifactURL(
|
|
507
|
+
function getArtifactURL(_x14, _x15, _x16) {
|
|
500
508
|
return _getArtifactURL.apply(this, arguments);
|
|
501
509
|
}
|
|
502
510
|
|
|
@@ -505,9 +513,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
505
513
|
}, {
|
|
506
514
|
key: "getImage",
|
|
507
515
|
value: function () {
|
|
508
|
-
var _getImage = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(id, params, controller, fetchMaxRes,
|
|
509
|
-
var _ref4;
|
|
510
|
-
|
|
516
|
+
var _getImage = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(id, params, controller, fetchMaxRes, traceContext) {
|
|
511
517
|
var isWebpSupported, headers, metadata, options;
|
|
512
518
|
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
513
519
|
while (1) {
|
|
@@ -515,7 +521,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
515
521
|
case 0:
|
|
516
522
|
// TODO add checkWebpSupport() back https://product-fabric.atlassian.net/browse/MPT-584
|
|
517
523
|
isWebpSupported = false;
|
|
518
|
-
headers =
|
|
524
|
+
headers = {};
|
|
519
525
|
|
|
520
526
|
if (isWebpSupported) {
|
|
521
527
|
headers.accept = 'image/webp,image/*,*/*;q=0.8';
|
|
@@ -530,7 +536,8 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
530
536
|
collectionName: params && params.collection
|
|
531
537
|
},
|
|
532
538
|
params: extendImageParams(params, fetchMaxRes),
|
|
533
|
-
headers: headers
|
|
539
|
+
headers: headers,
|
|
540
|
+
traceContext: traceContext
|
|
534
541
|
});
|
|
535
542
|
return _context7.abrupt("return", this.request("/file/".concat(id, "/image"), options, controller).then((0, _helpers.createMapResponseToBlob)(metadata)));
|
|
536
543
|
|
|
@@ -542,7 +549,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
542
549
|
}, _callee7, this);
|
|
543
550
|
}));
|
|
544
551
|
|
|
545
|
-
function getImage(
|
|
552
|
+
function getImage(_x17, _x18, _x19, _x20, _x21) {
|
|
546
553
|
return _getImage.apply(this, arguments);
|
|
547
554
|
}
|
|
548
555
|
|
|
@@ -551,7 +558,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
551
558
|
}, {
|
|
552
559
|
key: "getItems",
|
|
553
560
|
value: function () {
|
|
554
|
-
var _getItems = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(ids, collectionName) {
|
|
561
|
+
var _getItems = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(ids, collectionName, traceContext) {
|
|
555
562
|
var descriptors, metadata, options;
|
|
556
563
|
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
557
564
|
while (1) {
|
|
@@ -575,7 +582,8 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
575
582
|
headers: jsonHeaders,
|
|
576
583
|
body: JSON.stringify({
|
|
577
584
|
descriptors: descriptors
|
|
578
|
-
})
|
|
585
|
+
}),
|
|
586
|
+
traceContext: traceContext
|
|
579
587
|
});
|
|
580
588
|
return _context8.abrupt("return", this.request('/items', options).then((0, _helpers.createMapResponseToJson)(metadata)));
|
|
581
589
|
|
|
@@ -587,7 +595,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
587
595
|
}, _callee8, this);
|
|
588
596
|
}));
|
|
589
597
|
|
|
590
|
-
function getItems(
|
|
598
|
+
function getItems(_x22, _x23, _x24) {
|
|
591
599
|
return _getItems.apply(this, arguments);
|
|
592
600
|
}
|
|
593
601
|
|
|
@@ -596,7 +604,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
596
604
|
}, {
|
|
597
605
|
key: "getImageMetadata",
|
|
598
606
|
value: function () {
|
|
599
|
-
var _getImageMetadata = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(id, params) {
|
|
607
|
+
var _getImageMetadata = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(id, params, traceContext) {
|
|
600
608
|
var metadata, options;
|
|
601
609
|
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
602
610
|
while (1) {
|
|
@@ -610,7 +618,8 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
610
618
|
authContext: {
|
|
611
619
|
collectionName: params && params.collection
|
|
612
620
|
},
|
|
613
|
-
params: params
|
|
621
|
+
params: params,
|
|
622
|
+
traceContext: traceContext
|
|
614
623
|
});
|
|
615
624
|
return _context9.abrupt("return", this.request("/file/".concat(id, "/image/metadata"), options).then((0, _helpers.createMapResponseToJson)(metadata)));
|
|
616
625
|
|
|
@@ -622,7 +631,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
622
631
|
}, _callee9, this);
|
|
623
632
|
}));
|
|
624
633
|
|
|
625
|
-
function getImageMetadata(
|
|
634
|
+
function getImageMetadata(_x25, _x26, _x27) {
|
|
626
635
|
return _getImageMetadata.apply(this, arguments);
|
|
627
636
|
}
|
|
628
637
|
|
|
@@ -631,7 +640,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
631
640
|
}, {
|
|
632
641
|
key: "appendChunksToUpload",
|
|
633
642
|
value: function () {
|
|
634
|
-
var _appendChunksToUpload = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(uploadId, body, collectionName) {
|
|
643
|
+
var _appendChunksToUpload = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(uploadId, body, collectionName, traceContext) {
|
|
635
644
|
var metadata, options;
|
|
636
645
|
return _regenerator.default.wrap(function _callee10$(_context10) {
|
|
637
646
|
while (1) {
|
|
@@ -646,7 +655,8 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
646
655
|
collectionName: collectionName
|
|
647
656
|
},
|
|
648
657
|
headers: jsonHeaders,
|
|
649
|
-
body: JSON.stringify(body)
|
|
658
|
+
body: JSON.stringify(body),
|
|
659
|
+
traceContext: traceContext
|
|
650
660
|
});
|
|
651
661
|
_context10.next = 4;
|
|
652
662
|
return this.request("/upload/".concat(uploadId, "/chunks"), options);
|
|
@@ -659,7 +669,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
659
669
|
}, _callee10, this);
|
|
660
670
|
}));
|
|
661
671
|
|
|
662
|
-
function appendChunksToUpload(
|
|
672
|
+
function appendChunksToUpload(_x28, _x29, _x30, _x31) {
|
|
663
673
|
return _appendChunksToUpload.apply(this, arguments);
|
|
664
674
|
}
|
|
665
675
|
|
|
@@ -667,7 +677,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
667
677
|
}()
|
|
668
678
|
}, {
|
|
669
679
|
key: "copyFileWithToken",
|
|
670
|
-
value: function copyFileWithToken(body, params) {
|
|
680
|
+
value: function copyFileWithToken(body, params, traceContext) {
|
|
671
681
|
var metadata = {
|
|
672
682
|
method: 'POST',
|
|
673
683
|
endpoint: '/file/copy/withToken'
|
|
@@ -681,8 +691,9 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
681
691
|
params: params,
|
|
682
692
|
// Contains collection name to write to
|
|
683
693
|
headers: jsonHeaders,
|
|
684
|
-
body: JSON.stringify(body)
|
|
685
|
-
|
|
694
|
+
body: JSON.stringify(body),
|
|
695
|
+
// Contains collection name to read from
|
|
696
|
+
traceContext: traceContext
|
|
686
697
|
});
|
|
687
698
|
|
|
688
699
|
return this.request('/file/copy/withToken', options).then((0, _helpers.createMapResponseToJson)(metadata));
|
|
@@ -700,7 +711,9 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
700
711
|
headers,
|
|
701
712
|
body,
|
|
702
713
|
clientOptions,
|
|
714
|
+
traceContext,
|
|
703
715
|
auth,
|
|
716
|
+
extendedTraceContext,
|
|
704
717
|
response,
|
|
705
718
|
_args11 = arguments;
|
|
706
719
|
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
@@ -713,13 +726,16 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
713
726
|
authContext: {}
|
|
714
727
|
};
|
|
715
728
|
controller = _args11.length > 2 ? _args11[2] : undefined;
|
|
716
|
-
method = options.method, endpoint = options.endpoint, authContext = options.authContext, params = options.params, headers = options.headers, body = options.body, clientOptions = options.clientOptions;
|
|
729
|
+
method = options.method, endpoint = options.endpoint, authContext = options.authContext, params = options.params, headers = options.headers, body = options.body, clientOptions = options.clientOptions, traceContext = options.traceContext;
|
|
717
730
|
_context11.next = 5;
|
|
718
731
|
return this.resolveAuth(authContext);
|
|
719
732
|
|
|
720
733
|
case 5:
|
|
721
734
|
auth = _context11.sent;
|
|
722
|
-
|
|
735
|
+
extendedTraceContext = traceContext ? _objectSpread(_objectSpread({}, traceContext), {}, {
|
|
736
|
+
spanId: (traceContext === null || traceContext === void 0 ? void 0 : traceContext.spanId) || (0, _mediaCommon.getRandomHex)(8)
|
|
737
|
+
}) : undefined;
|
|
738
|
+
_context11.next = 9;
|
|
723
739
|
return (0, _request3.request)("".concat(auth.baseUrl).concat(path), {
|
|
724
740
|
method: method,
|
|
725
741
|
endpoint: endpoint,
|
|
@@ -727,16 +743,17 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
727
743
|
params: params,
|
|
728
744
|
headers: headers,
|
|
729
745
|
body: body,
|
|
730
|
-
clientOptions: clientOptions
|
|
746
|
+
clientOptions: clientOptions,
|
|
747
|
+
traceContext: extendedTraceContext
|
|
731
748
|
}, controller);
|
|
732
749
|
|
|
733
|
-
case
|
|
750
|
+
case 9:
|
|
734
751
|
response = _context11.sent;
|
|
735
752
|
setKeyValueInSessionStorage(MEDIA_API_REGION, response.headers.get('x-media-region'));
|
|
736
753
|
setKeyValueInSessionStorage(MEDIA_API_ENVIRONMENT, response.headers.get('x-media-env'));
|
|
737
754
|
return _context11.abrupt("return", response);
|
|
738
755
|
|
|
739
|
-
case
|
|
756
|
+
case 13:
|
|
740
757
|
case "end":
|
|
741
758
|
return _context11.stop();
|
|
742
759
|
}
|
|
@@ -744,7 +761,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
744
761
|
}, _callee11, this);
|
|
745
762
|
}));
|
|
746
763
|
|
|
747
|
-
function request(
|
|
764
|
+
function request(_x32) {
|
|
748
765
|
return _request2.apply(this, arguments);
|
|
749
766
|
}
|
|
750
767
|
|
|
@@ -73,7 +73,8 @@ var mapMediaFileToFileState = function mapMediaFileToFileState(mediaFile) {
|
|
|
73
73
|
mediaType = _mediaFile$data.mediaType,
|
|
74
74
|
mimeType = _mediaFile$data.mimeType,
|
|
75
75
|
representations = _mediaFile$data.representations,
|
|
76
|
-
createdAt = _mediaFile$data.createdAt
|
|
76
|
+
createdAt = _mediaFile$data.createdAt,
|
|
77
|
+
metadataTraceContext = _mediaFile$data.metadataTraceContext;
|
|
77
78
|
var baseState = {
|
|
78
79
|
id: id,
|
|
79
80
|
name: name,
|
|
@@ -82,7 +83,8 @@ var mapMediaFileToFileState = function mapMediaFileToFileState(mediaFile) {
|
|
|
82
83
|
mimeType: mimeType,
|
|
83
84
|
artifacts: artifacts,
|
|
84
85
|
representations: representations,
|
|
85
|
-
createdAt: createdAt
|
|
86
|
+
createdAt: createdAt,
|
|
87
|
+
metadataTraceContext: metadataTraceContext
|
|
86
88
|
};
|
|
87
89
|
|
|
88
90
|
switch (processingStatus) {
|