@atlaskit/media-client 17.1.3 → 17.1.4
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 +0 -20
- package/constants/package.json +1 -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 +70 -44
- package/dist/cjs/client/media-store/resolveAuth.js +1 -1
- package/dist/cjs/index.js +6 -0
- package/dist/cjs/uploader/index.js +22 -20
- package/dist/cjs/utils/request/helpers.js +50 -26
- package/dist/cjs/utils/request/index.js +3 -2
- package/dist/cjs/version.json +1 -1
- 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 +52 -35
- package/dist/es2019/client/media-store/resolveAuth.js +1 -1
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/uploader/index.js +14 -14
- package/dist/es2019/utils/request/helpers.js +33 -12
- package/dist/es2019/utils/request/index.js +4 -3
- package/dist/es2019/version.json +1 -1
- 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 +71 -45
- package/dist/esm/client/media-store/resolveAuth.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/uploader/index.js +23 -21
- package/dist/esm/utils/request/helpers.js +45 -24
- package/dist/esm/utils/request/index.js +4 -3
- package/dist/esm/version.json +1 -1
- package/dist/types/client/file-fetcher/index.d.ts +9 -8
- package/dist/types/client/media-client.d.ts +2 -1
- package/dist/types/client/media-store/index.d.ts +15 -14
- package/dist/types/index.d.ts +3 -3
- package/dist/types/uploader/index.d.ts +2 -1
- package/dist/types/utils/request/helpers.d.ts +11 -3
- package/dist/types/utils/request/types.d.ts +5 -0
- package/package.json +5 -12
- 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 -167
- 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 -90
- 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 -6
- 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
|
@@ -89,7 +89,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
89
89
|
(0, _createClass2.default)(MediaStore, [{
|
|
90
90
|
key: "getCollectionItems",
|
|
91
91
|
value: function () {
|
|
92
|
-
var _getCollectionItems = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(collectionName, params) {
|
|
92
|
+
var _getCollectionItems = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(collectionName, params, traceContext) {
|
|
93
93
|
var metadata, options, response, _yield$createMapRespo, _yield$createMapRespo2, contents, nextInclusiveStartKey, contentsWithoutEmptyFiles;
|
|
94
94
|
|
|
95
95
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
@@ -107,7 +107,8 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
107
107
|
params: _objectSpread(_objectSpread({}, defaultGetCollectionItems), params),
|
|
108
108
|
headers: {
|
|
109
109
|
Accept: 'application/json'
|
|
110
|
-
}
|
|
110
|
+
},
|
|
111
|
+
traceContext: traceContext
|
|
111
112
|
});
|
|
112
113
|
_context.next = 4;
|
|
113
114
|
return this.request("/collection/".concat(collectionName, "/items"), options);
|
|
@@ -142,7 +143,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
142
143
|
}, _callee, this);
|
|
143
144
|
}));
|
|
144
145
|
|
|
145
|
-
function getCollectionItems(_x, _x2) {
|
|
146
|
+
function getCollectionItems(_x, _x2, _x3) {
|
|
146
147
|
return _getCollectionItems.apply(this, arguments);
|
|
147
148
|
}
|
|
148
149
|
|
|
@@ -151,7 +152,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
151
152
|
}, {
|
|
152
153
|
key: "removeCollectionFile",
|
|
153
154
|
value: function () {
|
|
154
|
-
var _removeCollectionFile = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(id, collectionName, occurrenceKey) {
|
|
155
|
+
var _removeCollectionFile = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(id, collectionName, occurrenceKey, traceContext) {
|
|
155
156
|
var metadata, body, options;
|
|
156
157
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
157
158
|
while (1) {
|
|
@@ -179,7 +180,8 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
179
180
|
Accept: 'application/json',
|
|
180
181
|
'Content-Type': 'application/json'
|
|
181
182
|
},
|
|
182
|
-
body: JSON.stringify(body)
|
|
183
|
+
body: JSON.stringify(body),
|
|
184
|
+
traceContext: traceContext
|
|
183
185
|
});
|
|
184
186
|
_context2.next = 5;
|
|
185
187
|
return this.request("/collection/".concat(collectionName), options);
|
|
@@ -192,7 +194,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
192
194
|
}, _callee2, this);
|
|
193
195
|
}));
|
|
194
196
|
|
|
195
|
-
function removeCollectionFile(
|
|
197
|
+
function removeCollectionFile(_x4, _x5, _x6, _x7) {
|
|
196
198
|
return _removeCollectionFile.apply(this, arguments);
|
|
197
199
|
}
|
|
198
200
|
|
|
@@ -203,6 +205,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
203
205
|
value: function createUpload() {
|
|
204
206
|
var createUpTo = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
|
205
207
|
var collectionName = arguments.length > 1 ? arguments[1] : undefined;
|
|
208
|
+
var traceContext = arguments.length > 2 ? arguments[2] : undefined;
|
|
206
209
|
var metadata = {
|
|
207
210
|
method: 'POST',
|
|
208
211
|
endpoint: '/upload'
|
|
@@ -217,7 +220,8 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
217
220
|
},
|
|
218
221
|
headers: {
|
|
219
222
|
Accept: 'application/json'
|
|
220
|
-
}
|
|
223
|
+
},
|
|
224
|
+
traceContext: traceContext
|
|
221
225
|
});
|
|
222
226
|
|
|
223
227
|
return this.request("/upload", options).then((0, _helpers.createMapResponseToJson)(metadata));
|
|
@@ -230,6 +234,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
230
234
|
collectionName,
|
|
231
235
|
uploadId,
|
|
232
236
|
partNumber,
|
|
237
|
+
traceContext,
|
|
233
238
|
metadata,
|
|
234
239
|
options,
|
|
235
240
|
_args3 = arguments;
|
|
@@ -239,6 +244,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
239
244
|
switch (_context3.prev = _context3.next) {
|
|
240
245
|
case 0:
|
|
241
246
|
_ref = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : {}, collectionName = _ref.collectionName, uploadId = _ref.uploadId, partNumber = _ref.partNumber;
|
|
247
|
+
traceContext = _args3.length > 3 ? _args3[3] : undefined;
|
|
242
248
|
metadata = {
|
|
243
249
|
method: 'PUT',
|
|
244
250
|
endpoint: '/chunk/{etag}'
|
|
@@ -251,12 +257,13 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
251
257
|
authContext: {
|
|
252
258
|
collectionName: collectionName
|
|
253
259
|
},
|
|
254
|
-
body: blob
|
|
260
|
+
body: blob,
|
|
261
|
+
traceContext: traceContext
|
|
255
262
|
});
|
|
256
|
-
_context3.next =
|
|
263
|
+
_context3.next = 6;
|
|
257
264
|
return this.request("/chunk/".concat(etag), options);
|
|
258
265
|
|
|
259
|
-
case
|
|
266
|
+
case 6:
|
|
260
267
|
case "end":
|
|
261
268
|
return _context3.stop();
|
|
262
269
|
}
|
|
@@ -264,7 +271,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
264
271
|
}, _callee3, this);
|
|
265
272
|
}));
|
|
266
273
|
|
|
267
|
-
function uploadChunk(
|
|
274
|
+
function uploadChunk(_x8, _x9) {
|
|
268
275
|
return _uploadChunk.apply(this, arguments);
|
|
269
276
|
}
|
|
270
277
|
|
|
@@ -277,6 +284,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
277
284
|
collectionName = _ref2.collectionName,
|
|
278
285
|
uploadId = _ref2.uploadId;
|
|
279
286
|
|
|
287
|
+
var traceContext = arguments.length > 2 ? arguments[2] : undefined;
|
|
280
288
|
var metadata = {
|
|
281
289
|
method: 'POST',
|
|
282
290
|
endpoint: '/chunk/probe'
|
|
@@ -292,7 +300,8 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
292
300
|
headers: jsonHeaders,
|
|
293
301
|
body: JSON.stringify({
|
|
294
302
|
chunks: chunks
|
|
295
|
-
})
|
|
303
|
+
}),
|
|
304
|
+
traceContext: traceContext
|
|
296
305
|
});
|
|
297
306
|
|
|
298
307
|
return this.request("/chunk/probe", options).then((0, _helpers.createMapResponseToJson)(metadata));
|
|
@@ -301,6 +310,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
301
310
|
key: "createFileFromUpload",
|
|
302
311
|
value: function createFileFromUpload(body) {
|
|
303
312
|
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
313
|
+
var traceContext = arguments.length > 2 ? arguments[2] : undefined;
|
|
304
314
|
var metadata = {
|
|
305
315
|
method: 'POST',
|
|
306
316
|
endpoint: '/file/upload'
|
|
@@ -312,7 +322,8 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
312
322
|
},
|
|
313
323
|
params: params,
|
|
314
324
|
headers: jsonHeaders,
|
|
315
|
-
body: JSON.stringify(body)
|
|
325
|
+
body: JSON.stringify(body),
|
|
326
|
+
traceContext: traceContext
|
|
316
327
|
});
|
|
317
328
|
|
|
318
329
|
return this.request('/file/upload', options).then((0, _helpers.createMapResponseToJson)(metadata));
|
|
@@ -321,6 +332,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
321
332
|
key: "touchFiles",
|
|
322
333
|
value: function touchFiles(body) {
|
|
323
334
|
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
335
|
+
var traceContext = arguments.length > 2 ? arguments[2] : undefined;
|
|
324
336
|
var metadata = {
|
|
325
337
|
method: 'POST',
|
|
326
338
|
endpoint: '/upload/createWithFiles'
|
|
@@ -331,7 +343,8 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
331
343
|
collectionName: params.collection
|
|
332
344
|
},
|
|
333
345
|
headers: jsonHeaders,
|
|
334
|
-
body: JSON.stringify(body)
|
|
346
|
+
body: JSON.stringify(body),
|
|
347
|
+
traceContext: traceContext
|
|
335
348
|
});
|
|
336
349
|
|
|
337
350
|
return this.request('/upload/createWithFiles', options).then((0, _helpers.createMapResponseToJson)(metadata));
|
|
@@ -340,6 +353,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
340
353
|
key: "getFile",
|
|
341
354
|
value: function getFile(fileId) {
|
|
342
355
|
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
356
|
+
var traceContext = arguments.length > 2 ? arguments[2] : undefined;
|
|
343
357
|
var metadata = {
|
|
344
358
|
method: 'GET',
|
|
345
359
|
endpoint: '/file/{fileId}'
|
|
@@ -349,7 +363,8 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
349
363
|
authContext: {
|
|
350
364
|
collectionName: params.collection
|
|
351
365
|
},
|
|
352
|
-
params: params
|
|
366
|
+
params: params,
|
|
367
|
+
traceContext: traceContext
|
|
353
368
|
});
|
|
354
369
|
|
|
355
370
|
return this.request("/file/".concat(fileId), options).then((0, _helpers.createMapResponseToJson)(metadata));
|
|
@@ -382,12 +397,13 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
382
397
|
}, _callee4, this);
|
|
383
398
|
}));
|
|
384
399
|
|
|
385
|
-
function getFileImageURL(
|
|
400
|
+
function getFileImageURL(_x10, _x11) {
|
|
386
401
|
return _getFileImageURL.apply(this, arguments);
|
|
387
402
|
}
|
|
388
403
|
|
|
389
404
|
return getFileImageURL;
|
|
390
|
-
}()
|
|
405
|
+
}() // TODO Create ticket in case Trace Id can be supported through query params
|
|
406
|
+
|
|
391
407
|
}, {
|
|
392
408
|
key: "getFileImageURLSync",
|
|
393
409
|
value: function getFileImageURLSync(id, params) {
|
|
@@ -437,7 +453,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
437
453
|
}, _callee5, this);
|
|
438
454
|
}));
|
|
439
455
|
|
|
440
|
-
function getFileBinaryURL(
|
|
456
|
+
function getFileBinaryURL(_x12, _x13) {
|
|
441
457
|
return _getFileBinaryURL.apply(this, arguments);
|
|
442
458
|
}
|
|
443
459
|
|
|
@@ -486,7 +502,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
486
502
|
}, _callee6, this);
|
|
487
503
|
}));
|
|
488
504
|
|
|
489
|
-
function getArtifactURL(
|
|
505
|
+
function getArtifactURL(_x14, _x15, _x16) {
|
|
490
506
|
return _getArtifactURL.apply(this, arguments);
|
|
491
507
|
}
|
|
492
508
|
|
|
@@ -495,7 +511,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
495
511
|
}, {
|
|
496
512
|
key: "getImage",
|
|
497
513
|
value: function () {
|
|
498
|
-
var _getImage = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(id, params, controller, fetchMaxRes) {
|
|
514
|
+
var _getImage = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(id, params, controller, fetchMaxRes, traceContext) {
|
|
499
515
|
var isWebpSupported, headers, metadata, options;
|
|
500
516
|
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
501
517
|
while (1) {
|
|
@@ -503,11 +519,10 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
503
519
|
case 0:
|
|
504
520
|
// TODO add checkWebpSupport() back https://product-fabric.atlassian.net/browse/MPT-584
|
|
505
521
|
isWebpSupported = false;
|
|
522
|
+
headers = {};
|
|
506
523
|
|
|
507
524
|
if (isWebpSupported) {
|
|
508
|
-
headers =
|
|
509
|
-
accept: 'image/webp,image/*,*/*;q=0.8'
|
|
510
|
-
};
|
|
525
|
+
headers.accept = 'image/webp,image/*,*/*;q=0.8';
|
|
511
526
|
}
|
|
512
527
|
|
|
513
528
|
metadata = {
|
|
@@ -519,11 +534,12 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
519
534
|
collectionName: params && params.collection
|
|
520
535
|
},
|
|
521
536
|
params: extendImageParams(params, fetchMaxRes),
|
|
522
|
-
headers: headers
|
|
537
|
+
headers: headers,
|
|
538
|
+
traceContext: traceContext
|
|
523
539
|
});
|
|
524
540
|
return _context7.abrupt("return", this.request("/file/".concat(id, "/image"), options, controller).then((0, _helpers.createMapResponseToBlob)(metadata)));
|
|
525
541
|
|
|
526
|
-
case
|
|
542
|
+
case 6:
|
|
527
543
|
case "end":
|
|
528
544
|
return _context7.stop();
|
|
529
545
|
}
|
|
@@ -531,7 +547,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
531
547
|
}, _callee7, this);
|
|
532
548
|
}));
|
|
533
549
|
|
|
534
|
-
function getImage(
|
|
550
|
+
function getImage(_x17, _x18, _x19, _x20, _x21) {
|
|
535
551
|
return _getImage.apply(this, arguments);
|
|
536
552
|
}
|
|
537
553
|
|
|
@@ -540,7 +556,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
540
556
|
}, {
|
|
541
557
|
key: "getItems",
|
|
542
558
|
value: function () {
|
|
543
|
-
var _getItems = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(ids, collectionName) {
|
|
559
|
+
var _getItems = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(ids, collectionName, traceContext) {
|
|
544
560
|
var descriptors, metadata, options;
|
|
545
561
|
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
546
562
|
while (1) {
|
|
@@ -564,7 +580,8 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
564
580
|
headers: jsonHeaders,
|
|
565
581
|
body: JSON.stringify({
|
|
566
582
|
descriptors: descriptors
|
|
567
|
-
})
|
|
583
|
+
}),
|
|
584
|
+
traceContext: traceContext
|
|
568
585
|
});
|
|
569
586
|
return _context8.abrupt("return", this.request('/items', options).then((0, _helpers.createMapResponseToJson)(metadata)));
|
|
570
587
|
|
|
@@ -576,7 +593,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
576
593
|
}, _callee8, this);
|
|
577
594
|
}));
|
|
578
595
|
|
|
579
|
-
function getItems(
|
|
596
|
+
function getItems(_x22, _x23, _x24) {
|
|
580
597
|
return _getItems.apply(this, arguments);
|
|
581
598
|
}
|
|
582
599
|
|
|
@@ -585,7 +602,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
585
602
|
}, {
|
|
586
603
|
key: "getImageMetadata",
|
|
587
604
|
value: function () {
|
|
588
|
-
var _getImageMetadata = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(id, params) {
|
|
605
|
+
var _getImageMetadata = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(id, params, traceContext) {
|
|
589
606
|
var metadata, options;
|
|
590
607
|
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
591
608
|
while (1) {
|
|
@@ -599,7 +616,8 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
599
616
|
authContext: {
|
|
600
617
|
collectionName: params && params.collection
|
|
601
618
|
},
|
|
602
|
-
params: params
|
|
619
|
+
params: params,
|
|
620
|
+
traceContext: traceContext
|
|
603
621
|
});
|
|
604
622
|
return _context9.abrupt("return", this.request("/file/".concat(id, "/image/metadata"), options).then((0, _helpers.createMapResponseToJson)(metadata)));
|
|
605
623
|
|
|
@@ -611,7 +629,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
611
629
|
}, _callee9, this);
|
|
612
630
|
}));
|
|
613
631
|
|
|
614
|
-
function getImageMetadata(
|
|
632
|
+
function getImageMetadata(_x25, _x26, _x27) {
|
|
615
633
|
return _getImageMetadata.apply(this, arguments);
|
|
616
634
|
}
|
|
617
635
|
|
|
@@ -620,7 +638,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
620
638
|
}, {
|
|
621
639
|
key: "appendChunksToUpload",
|
|
622
640
|
value: function () {
|
|
623
|
-
var _appendChunksToUpload = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(uploadId, body, collectionName) {
|
|
641
|
+
var _appendChunksToUpload = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(uploadId, body, collectionName, traceContext) {
|
|
624
642
|
var metadata, options;
|
|
625
643
|
return _regenerator.default.wrap(function _callee10$(_context10) {
|
|
626
644
|
while (1) {
|
|
@@ -635,7 +653,8 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
635
653
|
collectionName: collectionName
|
|
636
654
|
},
|
|
637
655
|
headers: jsonHeaders,
|
|
638
|
-
body: JSON.stringify(body)
|
|
656
|
+
body: JSON.stringify(body),
|
|
657
|
+
traceContext: traceContext
|
|
639
658
|
});
|
|
640
659
|
_context10.next = 4;
|
|
641
660
|
return this.request("/upload/".concat(uploadId, "/chunks"), options);
|
|
@@ -648,7 +667,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
648
667
|
}, _callee10, this);
|
|
649
668
|
}));
|
|
650
669
|
|
|
651
|
-
function appendChunksToUpload(
|
|
670
|
+
function appendChunksToUpload(_x28, _x29, _x30, _x31) {
|
|
652
671
|
return _appendChunksToUpload.apply(this, arguments);
|
|
653
672
|
}
|
|
654
673
|
|
|
@@ -656,7 +675,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
656
675
|
}()
|
|
657
676
|
}, {
|
|
658
677
|
key: "copyFileWithToken",
|
|
659
|
-
value: function copyFileWithToken(body, params) {
|
|
678
|
+
value: function copyFileWithToken(body, params, traceContext) {
|
|
660
679
|
var metadata = {
|
|
661
680
|
method: 'POST',
|
|
662
681
|
endpoint: '/file/copy/withToken'
|
|
@@ -670,8 +689,9 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
670
689
|
params: params,
|
|
671
690
|
// Contains collection name to write to
|
|
672
691
|
headers: jsonHeaders,
|
|
673
|
-
body: JSON.stringify(body)
|
|
674
|
-
|
|
692
|
+
body: JSON.stringify(body),
|
|
693
|
+
// Contains collection name to read from
|
|
694
|
+
traceContext: traceContext
|
|
675
695
|
});
|
|
676
696
|
|
|
677
697
|
return this.request('/file/copy/withToken', options).then((0, _helpers.createMapResponseToJson)(metadata));
|
|
@@ -689,7 +709,9 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
689
709
|
headers,
|
|
690
710
|
body,
|
|
691
711
|
clientOptions,
|
|
712
|
+
traceContext,
|
|
692
713
|
auth,
|
|
714
|
+
extendedTraceContext,
|
|
693
715
|
response,
|
|
694
716
|
_args11 = arguments;
|
|
695
717
|
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
@@ -702,13 +724,16 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
702
724
|
authContext: {}
|
|
703
725
|
};
|
|
704
726
|
controller = _args11.length > 2 ? _args11[2] : undefined;
|
|
705
|
-
method = options.method, endpoint = options.endpoint, authContext = options.authContext, params = options.params, headers = options.headers, body = options.body, clientOptions = options.clientOptions;
|
|
727
|
+
method = options.method, endpoint = options.endpoint, authContext = options.authContext, params = options.params, headers = options.headers, body = options.body, clientOptions = options.clientOptions, traceContext = options.traceContext;
|
|
706
728
|
_context11.next = 5;
|
|
707
729
|
return this.resolveAuth(authContext);
|
|
708
730
|
|
|
709
731
|
case 5:
|
|
710
732
|
auth = _context11.sent;
|
|
711
|
-
|
|
733
|
+
extendedTraceContext = traceContext ? _objectSpread(_objectSpread({}, traceContext), {}, {
|
|
734
|
+
spanId: (traceContext === null || traceContext === void 0 ? void 0 : traceContext.spanId) || (0, _helpers.getRandomHex)(16)
|
|
735
|
+
}) : undefined;
|
|
736
|
+
_context11.next = 9;
|
|
712
737
|
return (0, _request3.request)("".concat(auth.baseUrl).concat(path), {
|
|
713
738
|
method: method,
|
|
714
739
|
endpoint: endpoint,
|
|
@@ -716,16 +741,17 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
716
741
|
params: params,
|
|
717
742
|
headers: headers,
|
|
718
743
|
body: body,
|
|
719
|
-
clientOptions: clientOptions
|
|
744
|
+
clientOptions: clientOptions,
|
|
745
|
+
traceContext: extendedTraceContext
|
|
720
746
|
}, controller);
|
|
721
747
|
|
|
722
|
-
case
|
|
748
|
+
case 9:
|
|
723
749
|
response = _context11.sent;
|
|
724
750
|
setKeyValueInSessionStorage(MEDIA_API_REGION, response.headers.get('x-media-region'));
|
|
725
751
|
setKeyValueInSessionStorage(MEDIA_API_ENVIRONMENT, response.headers.get('x-media-env'));
|
|
726
752
|
return _context11.abrupt("return", response);
|
|
727
753
|
|
|
728
|
-
case
|
|
754
|
+
case 13:
|
|
729
755
|
case "end":
|
|
730
756
|
return _context11.stop();
|
|
731
757
|
}
|
|
@@ -733,7 +759,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
733
759
|
}, _callee11, this);
|
|
734
760
|
}));
|
|
735
761
|
|
|
736
|
-
function request(
|
|
762
|
+
function request(_x32) {
|
|
737
763
|
return _request2.apply(this, arguments);
|
|
738
764
|
}
|
|
739
765
|
|
|
@@ -49,7 +49,7 @@ var resolveAuth = /*#__PURE__*/function () {
|
|
|
49
49
|
throw _context.t0;
|
|
50
50
|
|
|
51
51
|
case 11:
|
|
52
|
-
throw new _error.MediaStoreError('failedAuthProvider', _context.t0
|
|
52
|
+
throw new _error.MediaStoreError('failedAuthProvider', _context.t0);
|
|
53
53
|
|
|
54
54
|
case 12:
|
|
55
55
|
if (auth) {
|
package/dist/cjs/index.js
CHANGED
|
@@ -160,6 +160,12 @@ Object.defineProperty(exports, "getMediaRegion", {
|
|
|
160
160
|
}
|
|
161
161
|
});
|
|
162
162
|
exports.getMediaTypeFromMimeType = void 0;
|
|
163
|
+
Object.defineProperty(exports, "getRandomHex", {
|
|
164
|
+
enumerable: true,
|
|
165
|
+
get: function get() {
|
|
166
|
+
return _helpers.getRandomHex;
|
|
167
|
+
}
|
|
168
|
+
});
|
|
163
169
|
Object.defineProperty(exports, "globalMediaEventEmitter", {
|
|
164
170
|
enumerable: true,
|
|
165
171
|
get: function get() {
|
|
@@ -60,7 +60,7 @@ var hashingFunction = /*#__PURE__*/function () {
|
|
|
60
60
|
};
|
|
61
61
|
}();
|
|
62
62
|
|
|
63
|
-
var createProbingFunction = function createProbingFunction(store, deferredUploadId, collectionName) {
|
|
63
|
+
var createProbingFunction = function createProbingFunction(store, deferredUploadId, collectionName, traceContext) {
|
|
64
64
|
return /*#__PURE__*/function () {
|
|
65
65
|
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(chunks) {
|
|
66
66
|
var response, results;
|
|
@@ -94,17 +94,18 @@ var createProbingFunction = function createProbingFunction(store, deferredUpload
|
|
|
94
94
|
collectionName: _context2.t2,
|
|
95
95
|
uploadId: _context2.t4
|
|
96
96
|
};
|
|
97
|
-
_context2.
|
|
98
|
-
|
|
97
|
+
_context2.t6 = traceContext;
|
|
98
|
+
_context2.next = 15;
|
|
99
|
+
return _context2.t0.probeChunks.call(_context2.t0, _context2.t1, _context2.t5, _context2.t6);
|
|
99
100
|
|
|
100
|
-
case
|
|
101
|
+
case 15:
|
|
101
102
|
response = _context2.sent;
|
|
102
103
|
results = response.data.results;
|
|
103
104
|
return _context2.abrupt("return", Object.values(results).map(function (result) {
|
|
104
105
|
return result.exists;
|
|
105
106
|
}));
|
|
106
107
|
|
|
107
|
-
case
|
|
108
|
+
case 18:
|
|
108
109
|
case "end":
|
|
109
110
|
return _context2.stop();
|
|
110
111
|
}
|
|
@@ -118,7 +119,7 @@ var createProbingFunction = function createProbingFunction(store, deferredUpload
|
|
|
118
119
|
}();
|
|
119
120
|
};
|
|
120
121
|
|
|
121
|
-
var createUploadingFunction = function createUploadingFunction(store, deferredUploadId, collectionName) {
|
|
122
|
+
var createUploadingFunction = function createUploadingFunction(store, deferredUploadId, collectionName, traceContext) {
|
|
122
123
|
return /*#__PURE__*/function () {
|
|
123
124
|
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(chunk) {
|
|
124
125
|
var options;
|
|
@@ -152,7 +153,7 @@ var createUploadingFunction = function createUploadingFunction(store, deferredUp
|
|
|
152
153
|
_context3.next = 12;
|
|
153
154
|
return store.uploadChunk(chunk.hash, chunk.blob, _objectSpread({
|
|
154
155
|
collectionName: collectionName
|
|
155
|
-
}, options));
|
|
156
|
+
}, options), traceContext);
|
|
156
157
|
|
|
157
158
|
case 12:
|
|
158
159
|
return _context3.abrupt("return", _context3.sent);
|
|
@@ -171,7 +172,7 @@ var createUploadingFunction = function createUploadingFunction(store, deferredUp
|
|
|
171
172
|
}();
|
|
172
173
|
};
|
|
173
174
|
|
|
174
|
-
var createProcessingFunction = function createProcessingFunction(store, deferredUploadId, collection) {
|
|
175
|
+
var createProcessingFunction = function createProcessingFunction(store, deferredUploadId, collection, traceContext) {
|
|
175
176
|
var offset = 0;
|
|
176
177
|
return /*#__PURE__*/function () {
|
|
177
178
|
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(chunks) {
|
|
@@ -190,13 +191,14 @@ var createProcessingFunction = function createProcessingFunction(store, deferred
|
|
|
190
191
|
offset: offset
|
|
191
192
|
};
|
|
192
193
|
_context4.t3 = collection;
|
|
193
|
-
_context4.
|
|
194
|
-
|
|
194
|
+
_context4.t4 = traceContext;
|
|
195
|
+
_context4.next = 9;
|
|
196
|
+
return _context4.t0.appendChunksToUpload.call(_context4.t0, _context4.t1, _context4.t2, _context4.t3, _context4.t4);
|
|
195
197
|
|
|
196
|
-
case
|
|
198
|
+
case 9:
|
|
197
199
|
offset += chunks.length;
|
|
198
200
|
|
|
199
|
-
case
|
|
201
|
+
case 10:
|
|
200
202
|
case "end":
|
|
201
203
|
return _context4.stop();
|
|
202
204
|
}
|
|
@@ -211,7 +213,7 @@ var createProcessingFunction = function createProcessingFunction(store, deferred
|
|
|
211
213
|
};
|
|
212
214
|
|
|
213
215
|
var createFileFromUpload = /*#__PURE__*/function () {
|
|
214
|
-
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(file, store, uploadableFileUpfrontIds, uploadId) {
|
|
216
|
+
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(file, store, uploadableFileUpfrontIds, uploadId, traceContext) {
|
|
215
217
|
var collection, name, mimeType, id, occurrenceKey;
|
|
216
218
|
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
217
219
|
while (1) {
|
|
@@ -227,7 +229,7 @@ var createFileFromUpload = /*#__PURE__*/function () {
|
|
|
227
229
|
occurrenceKey: occurrenceKey,
|
|
228
230
|
collection: collection,
|
|
229
231
|
replaceFileId: id
|
|
230
|
-
}));
|
|
232
|
+
}, traceContext));
|
|
231
233
|
|
|
232
234
|
case 3:
|
|
233
235
|
case "end":
|
|
@@ -237,12 +239,12 @@ var createFileFromUpload = /*#__PURE__*/function () {
|
|
|
237
239
|
}, _callee5);
|
|
238
240
|
}));
|
|
239
241
|
|
|
240
|
-
return function createFileFromUpload(_x5, _x6, _x7, _x8) {
|
|
242
|
+
return function createFileFromUpload(_x5, _x6, _x7, _x8, _x9) {
|
|
241
243
|
return _ref5.apply(this, arguments);
|
|
242
244
|
};
|
|
243
245
|
}();
|
|
244
246
|
|
|
245
|
-
var uploadFile = function uploadFile(file, store, uploadableFileUpfrontIds, callbacks) {
|
|
247
|
+
var uploadFile = function uploadFile(file, store, uploadableFileUpfrontIds, callbacks, traceContext) {
|
|
246
248
|
var content = file.content,
|
|
247
249
|
collection = file.collection;
|
|
248
250
|
var deferredUploadId = uploadableFileUpfrontIds.deferredUploadId,
|
|
@@ -275,10 +277,10 @@ var uploadFile = function uploadFile(file, store, uploadableFileUpfrontIds, call
|
|
|
275
277
|
probingBatchSize: 100,
|
|
276
278
|
chunkSize: chunkSize,
|
|
277
279
|
uploadingConcurrency: 3,
|
|
278
|
-
uploadingFunction: createUploadingFunction(store, deferredUploadId, collection),
|
|
279
|
-
probingFunction: createProbingFunction(store, deferredUploadId, collection),
|
|
280
|
+
uploadingFunction: createUploadingFunction(store, deferredUploadId, collection, traceContext),
|
|
281
|
+
probingFunction: createProbingFunction(store, deferredUploadId, collection, traceContext),
|
|
280
282
|
processingBatchSize: _constants.PROCESSING_BATCH_SIZE,
|
|
281
|
-
processingFunction: createProcessingFunction(store, deferredUploadId, collection)
|
|
283
|
+
processingFunction: createProcessingFunction(store, deferredUploadId, collection, traceContext)
|
|
282
284
|
}, {
|
|
283
285
|
onProgress: function onProgress(progress) {
|
|
284
286
|
if (callbacks) {
|
|
@@ -291,7 +293,7 @@ var uploadFile = function uploadFile(file, store, uploadableFileUpfrontIds, call
|
|
|
291
293
|
|
|
292
294
|
var subscription = (0, _from.from)(deferredUploadId).pipe((0, _concatMap.concatMap)(function (uploadId) {
|
|
293
295
|
return chunkinatorObservable.pipe((0, _concatMap.concatMap)(function () {
|
|
294
|
-
return (0, _from.from)(createFileFromUpload(file, store, uploadableFileUpfrontIds, uploadId));
|
|
296
|
+
return (0, _from.from)(createFileFromUpload(file, store, uploadableFileUpfrontIds, uploadId, traceContext));
|
|
295
297
|
}));
|
|
296
298
|
})).subscribe({
|
|
297
299
|
error: function error(err) {
|