@atlaskit/media-client 33.3.2 → 33.4.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 +9 -0
- package/dist/cjs/client/file-fetcher/index.js +213 -180
- package/dist/cjs/client/media-client.js +1 -2
- package/dist/cjs/client/media-store/MediaStore.js +233 -130
- package/dist/cjs/models/document.js +1 -0
- package/dist/cjs/utils/hashing/hasherCreator.js +1 -2
- package/dist/cjs/utils/hashing/simpleHasher.js +1 -2
- package/dist/es2019/client/file-fetcher/index.js +20 -0
- package/dist/es2019/client/media-store/MediaStore.js +57 -0
- package/dist/es2019/models/document.js +0 -0
- package/dist/esm/client/file-fetcher/index.js +213 -180
- package/dist/esm/client/media-store/MediaStore.js +233 -130
- package/dist/esm/models/document.js +0 -0
- package/dist/types/client/file-fetcher/index.d.ts +3 -1
- package/dist/types/client/media-store/MediaStore.d.ts +4 -0
- package/dist/types/client/media-store/types.d.ts +9 -0
- package/dist/types/models/document.d.ts +54 -0
- package/dist/types-ts4.5/client/file-fetcher/index.d.ts +3 -1
- package/dist/types-ts4.5/client/media-store/MediaStore.d.ts +4 -0
- package/dist/types-ts4.5/client/media-store/types.d.ts +9 -0
- package/dist/types-ts4.5/models/document.d.ts +54 -0
- package/package.json +2 -2
|
@@ -117,6 +117,40 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
117
117
|
return _ref3.apply(this, arguments);
|
|
118
118
|
};
|
|
119
119
|
}());
|
|
120
|
+
_defineProperty(this, "deleteArtifact", /*#__PURE__*/function () {
|
|
121
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(id, params, collectionName, traceContext) {
|
|
122
|
+
var metadata, authContext, options;
|
|
123
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
124
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
125
|
+
case 0:
|
|
126
|
+
metadata = {
|
|
127
|
+
method: 'DELETE',
|
|
128
|
+
endpoint: '/file/{fileId}/artifact/{artifactName}'
|
|
129
|
+
};
|
|
130
|
+
authContext = {
|
|
131
|
+
collectionName: collectionName,
|
|
132
|
+
access: [{
|
|
133
|
+
type: 'file',
|
|
134
|
+
id: id,
|
|
135
|
+
actions: ['update']
|
|
136
|
+
}]
|
|
137
|
+
};
|
|
138
|
+
options = _objectSpread(_objectSpread({}, metadata), {}, {
|
|
139
|
+
authContext: authContext,
|
|
140
|
+
traceContext: traceContext
|
|
141
|
+
});
|
|
142
|
+
_context3.next = 5;
|
|
143
|
+
return _this.request("/file/".concat(id, "/artifact/").concat(params.artifactName), options);
|
|
144
|
+
case 5:
|
|
145
|
+
case "end":
|
|
146
|
+
return _context3.stop();
|
|
147
|
+
}
|
|
148
|
+
}, _callee3);
|
|
149
|
+
}));
|
|
150
|
+
return function (_x9, _x0, _x1, _x10) {
|
|
151
|
+
return _ref4.apply(this, arguments);
|
|
152
|
+
};
|
|
153
|
+
}());
|
|
120
154
|
_defineProperty(this, "resolveAuth", function (authContext) {
|
|
121
155
|
return resolveAuth(_this.config.authProvider, authContext, _this.config.authProviderTimeout);
|
|
122
156
|
});
|
|
@@ -129,10 +163,10 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
129
163
|
return _createClass(MediaStore, [{
|
|
130
164
|
key: "removeCollectionFile",
|
|
131
165
|
value: function () {
|
|
132
|
-
var _removeCollectionFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
166
|
+
var _removeCollectionFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(id, collectionName, occurrenceKey, traceContext) {
|
|
133
167
|
var metadata, body, options;
|
|
134
|
-
return _regeneratorRuntime.wrap(function
|
|
135
|
-
while (1) switch (
|
|
168
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
169
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
136
170
|
case 0:
|
|
137
171
|
metadata = {
|
|
138
172
|
method: 'PUT',
|
|
@@ -159,15 +193,15 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
159
193
|
body: JSON.stringify(body),
|
|
160
194
|
traceContext: traceContext
|
|
161
195
|
});
|
|
162
|
-
|
|
196
|
+
_context4.next = 5;
|
|
163
197
|
return this.request("/collection/".concat(collectionName), options);
|
|
164
198
|
case 5:
|
|
165
199
|
case "end":
|
|
166
|
-
return
|
|
200
|
+
return _context4.stop();
|
|
167
201
|
}
|
|
168
|
-
},
|
|
202
|
+
}, _callee4, this);
|
|
169
203
|
}));
|
|
170
|
-
function removeCollectionFile(
|
|
204
|
+
function removeCollectionFile(_x11, _x12, _x13, _x14) {
|
|
171
205
|
return _removeCollectionFile.apply(this, arguments);
|
|
172
206
|
}
|
|
173
207
|
return removeCollectionFile;
|
|
@@ -200,10 +234,10 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
200
234
|
}, {
|
|
201
235
|
key: "uploadChunk",
|
|
202
236
|
value: function () {
|
|
203
|
-
var _uploadChunk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
237
|
+
var _uploadChunk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(etag, blob, uploadId, partNumber, collectionName, traceContext) {
|
|
204
238
|
var metadata, options;
|
|
205
|
-
return _regeneratorRuntime.wrap(function
|
|
206
|
-
while (1) switch (
|
|
239
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
240
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
207
241
|
case 0:
|
|
208
242
|
metadata = {
|
|
209
243
|
method: 'PUT',
|
|
@@ -220,15 +254,15 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
220
254
|
body: blob,
|
|
221
255
|
traceContext: traceContext
|
|
222
256
|
});
|
|
223
|
-
|
|
257
|
+
_context5.next = 4;
|
|
224
258
|
return this.request("/chunk/".concat(etag), options);
|
|
225
259
|
case 4:
|
|
226
260
|
case "end":
|
|
227
|
-
return
|
|
261
|
+
return _context5.stop();
|
|
228
262
|
}
|
|
229
|
-
},
|
|
263
|
+
}, _callee5, this);
|
|
230
264
|
}));
|
|
231
|
-
function uploadChunk(
|
|
265
|
+
function uploadChunk(_x15, _x16, _x17, _x18, _x19, _x20) {
|
|
232
266
|
return _uploadChunk.apply(this, arguments);
|
|
233
267
|
}
|
|
234
268
|
return uploadChunk;
|
|
@@ -270,17 +304,17 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
270
304
|
}, {
|
|
271
305
|
key: "touchFiles",
|
|
272
306
|
value: function () {
|
|
273
|
-
var _touchFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
307
|
+
var _touchFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(body) {
|
|
274
308
|
var params,
|
|
275
309
|
traceContext,
|
|
276
310
|
metadata,
|
|
277
311
|
options,
|
|
278
|
-
|
|
279
|
-
return _regeneratorRuntime.wrap(function
|
|
280
|
-
while (1) switch (
|
|
312
|
+
_args6 = arguments;
|
|
313
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
314
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
281
315
|
case 0:
|
|
282
|
-
params =
|
|
283
|
-
traceContext =
|
|
316
|
+
params = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
|
|
317
|
+
traceContext = _args6.length > 2 ? _args6[2] : undefined;
|
|
284
318
|
metadata = {
|
|
285
319
|
method: 'POST',
|
|
286
320
|
endpoint: '/upload/createWithFiles'
|
|
@@ -296,14 +330,14 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
296
330
|
hashAlgorithm: this._chunkHashAlgorithm
|
|
297
331
|
}
|
|
298
332
|
});
|
|
299
|
-
return
|
|
333
|
+
return _context6.abrupt("return", this.request('/upload/createWithFiles', options).then(createMapResponseToJson(metadata)));
|
|
300
334
|
case 5:
|
|
301
335
|
case "end":
|
|
302
|
-
return
|
|
336
|
+
return _context6.stop();
|
|
303
337
|
}
|
|
304
|
-
},
|
|
338
|
+
}, _callee6, this);
|
|
305
339
|
}));
|
|
306
|
-
function touchFiles(
|
|
340
|
+
function touchFiles(_x21) {
|
|
307
341
|
return _touchFiles.apply(this, arguments);
|
|
308
342
|
}
|
|
309
343
|
return touchFiles;
|
|
@@ -329,26 +363,26 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
329
363
|
}, {
|
|
330
364
|
key: "getFileImageURL",
|
|
331
365
|
value: function () {
|
|
332
|
-
var _getFileImageURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
333
|
-
var
|
|
334
|
-
return _regeneratorRuntime.wrap(function
|
|
335
|
-
while (1) switch (
|
|
366
|
+
var _getFileImageURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(id, params) {
|
|
367
|
+
var _ref5, collectionName, auth;
|
|
368
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
369
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
336
370
|
case 0:
|
|
337
|
-
|
|
338
|
-
|
|
371
|
+
_ref5 = params || {}, collectionName = _ref5.collection;
|
|
372
|
+
_context7.next = 3;
|
|
339
373
|
return this.resolveAuth({
|
|
340
374
|
collectionName: collectionName
|
|
341
375
|
});
|
|
342
376
|
case 3:
|
|
343
|
-
auth =
|
|
344
|
-
return
|
|
377
|
+
auth = _context7.sent;
|
|
378
|
+
return _context7.abrupt("return", this.createFileImageURL(id, auth, params));
|
|
345
379
|
case 5:
|
|
346
380
|
case "end":
|
|
347
|
-
return
|
|
381
|
+
return _context7.stop();
|
|
348
382
|
}
|
|
349
|
-
},
|
|
383
|
+
}, _callee7, this);
|
|
350
384
|
}));
|
|
351
|
-
function getFileImageURL(
|
|
385
|
+
function getFileImageURL(_x22, _x23) {
|
|
352
386
|
return _getFileImageURL.apply(this, arguments);
|
|
353
387
|
}
|
|
354
388
|
return getFileImageURL;
|
|
@@ -372,17 +406,17 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
372
406
|
}, {
|
|
373
407
|
key: "getFileBinary",
|
|
374
408
|
value: function () {
|
|
375
|
-
var _getFileBinary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
409
|
+
var _getFileBinary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(id, collectionName, abortController) {
|
|
376
410
|
var maxAge,
|
|
377
411
|
headers,
|
|
378
412
|
binaryEndpoint,
|
|
379
413
|
metadata,
|
|
380
414
|
options,
|
|
381
|
-
|
|
382
|
-
return _regeneratorRuntime.wrap(function
|
|
383
|
-
while (1) switch (
|
|
415
|
+
_args8 = arguments;
|
|
416
|
+
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
417
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
384
418
|
case 0:
|
|
385
|
-
maxAge =
|
|
419
|
+
maxAge = _args8.length > 3 && _args8[3] !== undefined ? _args8[3] : FILE_CACHE_MAX_AGE;
|
|
386
420
|
headers = {};
|
|
387
421
|
binaryEndpoint = cdnFeatureFlag('binary');
|
|
388
422
|
metadata = {
|
|
@@ -399,14 +433,14 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
399
433
|
'max-age': "".concat(maxAge)
|
|
400
434
|
}
|
|
401
435
|
});
|
|
402
|
-
return
|
|
436
|
+
return _context8.abrupt("return", this.request("/file/".concat(id, "/").concat(binaryEndpoint), options, abortController, true).then(createMapResponseToBlob(metadata)));
|
|
403
437
|
case 6:
|
|
404
438
|
case "end":
|
|
405
|
-
return
|
|
439
|
+
return _context8.stop();
|
|
406
440
|
}
|
|
407
|
-
},
|
|
441
|
+
}, _callee8, this);
|
|
408
442
|
}));
|
|
409
|
-
function getFileBinary(
|
|
443
|
+
function getFileBinary(_x24, _x25, _x26) {
|
|
410
444
|
return _getFileBinary.apply(this, arguments);
|
|
411
445
|
}
|
|
412
446
|
return getFileBinary;
|
|
@@ -414,22 +448,22 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
414
448
|
}, {
|
|
415
449
|
key: "getFileBinaryURL",
|
|
416
450
|
value: function () {
|
|
417
|
-
var _getFileBinaryURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
451
|
+
var _getFileBinaryURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(id, collectionName) {
|
|
418
452
|
var maxAge,
|
|
419
453
|
auth,
|
|
420
454
|
options,
|
|
421
455
|
binaryEndpoint,
|
|
422
|
-
|
|
423
|
-
return _regeneratorRuntime.wrap(function
|
|
424
|
-
while (1) switch (
|
|
456
|
+
_args9 = arguments;
|
|
457
|
+
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
458
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
425
459
|
case 0:
|
|
426
|
-
maxAge =
|
|
427
|
-
|
|
460
|
+
maxAge = _args9.length > 2 && _args9[2] !== undefined ? _args9[2] : FILE_CACHE_MAX_AGE;
|
|
461
|
+
_context9.next = 3;
|
|
428
462
|
return this.resolveAuth({
|
|
429
463
|
collectionName: collectionName
|
|
430
464
|
});
|
|
431
465
|
case 3:
|
|
432
|
-
auth =
|
|
466
|
+
auth = _context9.sent;
|
|
433
467
|
options = {
|
|
434
468
|
params: {
|
|
435
469
|
dl: true,
|
|
@@ -439,14 +473,14 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
439
473
|
auth: auth
|
|
440
474
|
};
|
|
441
475
|
binaryEndpoint = cdnFeatureFlag('binary');
|
|
442
|
-
return
|
|
476
|
+
return _context9.abrupt("return", mapToMediaCdnUrl(createUrl("".concat(auth.baseUrl, "/file/").concat(id, "/").concat(binaryEndpoint), options), auth.token));
|
|
443
477
|
case 7:
|
|
444
478
|
case "end":
|
|
445
|
-
return
|
|
479
|
+
return _context9.stop();
|
|
446
480
|
}
|
|
447
|
-
},
|
|
481
|
+
}, _callee9, this);
|
|
448
482
|
}));
|
|
449
|
-
function getFileBinaryURL(
|
|
483
|
+
function getFileBinaryURL(_x27, _x28) {
|
|
450
484
|
return _getFileBinaryURL.apply(this, arguments);
|
|
451
485
|
}
|
|
452
486
|
return getFileBinaryURL;
|
|
@@ -454,16 +488,16 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
454
488
|
}, {
|
|
455
489
|
key: "getArtifactURL",
|
|
456
490
|
value: function () {
|
|
457
|
-
var _getArtifactURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
491
|
+
var _getArtifactURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee0(artifacts, artifactName, collectionName) {
|
|
458
492
|
var maxAge,
|
|
459
493
|
artifactUrl,
|
|
460
494
|
auth,
|
|
461
495
|
options,
|
|
462
|
-
|
|
463
|
-
return _regeneratorRuntime.wrap(function
|
|
464
|
-
while (1) switch (
|
|
496
|
+
_args0 = arguments;
|
|
497
|
+
return _regeneratorRuntime.wrap(function _callee0$(_context0) {
|
|
498
|
+
while (1) switch (_context0.prev = _context0.next) {
|
|
465
499
|
case 0:
|
|
466
|
-
maxAge =
|
|
500
|
+
maxAge = _args0.length > 3 && _args0[3] !== undefined ? _args0[3] : FILE_CACHE_MAX_AGE;
|
|
467
501
|
// ----- WARNING ----------
|
|
468
502
|
// DO NOT USE!!!!!
|
|
469
503
|
// artifact.cdnUrl fails in Jira.
|
|
@@ -478,17 +512,17 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
478
512
|
} */
|
|
479
513
|
artifactUrl = getArtifactUrl(artifacts, artifactName);
|
|
480
514
|
if (artifactUrl) {
|
|
481
|
-
|
|
515
|
+
_context0.next = 4;
|
|
482
516
|
break;
|
|
483
517
|
}
|
|
484
518
|
throw new Error("artifact ".concat(artifactName, " not found"));
|
|
485
519
|
case 4:
|
|
486
|
-
|
|
520
|
+
_context0.next = 6;
|
|
487
521
|
return this.resolveAuth({
|
|
488
522
|
collectionName: collectionName
|
|
489
523
|
});
|
|
490
524
|
case 6:
|
|
491
|
-
auth =
|
|
525
|
+
auth = _context0.sent;
|
|
492
526
|
options = {
|
|
493
527
|
params: {
|
|
494
528
|
collection: collectionName,
|
|
@@ -496,14 +530,14 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
496
530
|
},
|
|
497
531
|
auth: auth
|
|
498
532
|
};
|
|
499
|
-
return
|
|
533
|
+
return _context0.abrupt("return", createUrl(mapToMediaCdnUrl(artifactUrl, auth.token), options));
|
|
500
534
|
case 9:
|
|
501
535
|
case "end":
|
|
502
|
-
return
|
|
536
|
+
return _context0.stop();
|
|
503
537
|
}
|
|
504
|
-
},
|
|
538
|
+
}, _callee0, this);
|
|
505
539
|
}));
|
|
506
|
-
function getArtifactURL(
|
|
540
|
+
function getArtifactURL(_x29, _x30, _x31) {
|
|
507
541
|
return _getArtifactURL.apply(this, arguments);
|
|
508
542
|
}
|
|
509
543
|
return getArtifactURL;
|
|
@@ -511,10 +545,10 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
511
545
|
}, {
|
|
512
546
|
key: "getImage",
|
|
513
547
|
value: function () {
|
|
514
|
-
var _getImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
548
|
+
var _getImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee1(id, params, controller, fetchMaxRes, traceContext) {
|
|
515
549
|
var isWebpSupported, headers, imageEndpoint, metadata, options;
|
|
516
|
-
return _regeneratorRuntime.wrap(function
|
|
517
|
-
while (1) switch (
|
|
550
|
+
return _regeneratorRuntime.wrap(function _callee1$(_context1) {
|
|
551
|
+
while (1) switch (_context1.prev = _context1.next) {
|
|
518
552
|
case 0:
|
|
519
553
|
// TODO add checkWebpSupport() back https://product-fabric.atlassian.net/browse/MPT-584
|
|
520
554
|
isWebpSupported = false;
|
|
@@ -536,14 +570,14 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
536
570
|
traceContext: traceContext,
|
|
537
571
|
addMediaClientParam: true
|
|
538
572
|
});
|
|
539
|
-
return
|
|
573
|
+
return _context1.abrupt("return", this.request("/file/".concat(id, "/").concat(imageEndpoint), options, controller, true).then(createMapResponseToBlob(metadata)));
|
|
540
574
|
case 7:
|
|
541
575
|
case "end":
|
|
542
|
-
return
|
|
576
|
+
return _context1.stop();
|
|
543
577
|
}
|
|
544
|
-
},
|
|
578
|
+
}, _callee1, this);
|
|
545
579
|
}));
|
|
546
|
-
function getImage(
|
|
580
|
+
function getImage(_x32, _x33, _x34, _x35, _x36) {
|
|
547
581
|
return _getImage.apply(this, arguments);
|
|
548
582
|
}
|
|
549
583
|
return getImage;
|
|
@@ -551,10 +585,10 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
551
585
|
}, {
|
|
552
586
|
key: "getItems",
|
|
553
587
|
value: function () {
|
|
554
|
-
var _getItems = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
588
|
+
var _getItems = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(ids, collectionName, traceContext, includeHashForDuplicateFiles) {
|
|
555
589
|
var descriptors, metadata, options;
|
|
556
|
-
return _regeneratorRuntime.wrap(function
|
|
557
|
-
while (1) switch (
|
|
590
|
+
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
591
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
558
592
|
case 0:
|
|
559
593
|
descriptors = ids.map(function (id) {
|
|
560
594
|
return {
|
|
@@ -578,14 +612,14 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
578
612
|
}),
|
|
579
613
|
traceContext: traceContext
|
|
580
614
|
});
|
|
581
|
-
return
|
|
615
|
+
return _context10.abrupt("return", this.request('/items', options).then(createMapResponseToJson(metadata)));
|
|
582
616
|
case 4:
|
|
583
617
|
case "end":
|
|
584
|
-
return
|
|
618
|
+
return _context10.stop();
|
|
585
619
|
}
|
|
586
|
-
},
|
|
620
|
+
}, _callee10, this);
|
|
587
621
|
}));
|
|
588
|
-
function getItems(
|
|
622
|
+
function getItems(_x37, _x38, _x39, _x40) {
|
|
589
623
|
return _getItems.apply(this, arguments);
|
|
590
624
|
}
|
|
591
625
|
return getItems;
|
|
@@ -593,10 +627,10 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
593
627
|
}, {
|
|
594
628
|
key: "getImageMetadata",
|
|
595
629
|
value: function () {
|
|
596
|
-
var _getImageMetadata = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
630
|
+
var _getImageMetadata = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(id, params, traceContext) {
|
|
597
631
|
var metadata, options;
|
|
598
|
-
return _regeneratorRuntime.wrap(function
|
|
599
|
-
while (1) switch (
|
|
632
|
+
return _regeneratorRuntime.wrap(function _callee11$(_context11) {
|
|
633
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
600
634
|
case 0:
|
|
601
635
|
metadata = {
|
|
602
636
|
method: 'GET',
|
|
@@ -609,25 +643,94 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
609
643
|
params: params,
|
|
610
644
|
traceContext: traceContext
|
|
611
645
|
});
|
|
612
|
-
return
|
|
646
|
+
return _context11.abrupt("return", this.request("/file/".concat(id, "/image/metadata"), options).then(createMapResponseToJson(metadata)));
|
|
613
647
|
case 3:
|
|
614
648
|
case "end":
|
|
615
|
-
return
|
|
649
|
+
return _context11.stop();
|
|
616
650
|
}
|
|
617
|
-
},
|
|
651
|
+
}, _callee11, this);
|
|
618
652
|
}));
|
|
619
|
-
function getImageMetadata(
|
|
653
|
+
function getImageMetadata(_x41, _x42, _x43) {
|
|
620
654
|
return _getImageMetadata.apply(this, arguments);
|
|
621
655
|
}
|
|
622
656
|
return getImageMetadata;
|
|
623
657
|
}()
|
|
624
658
|
}, {
|
|
625
|
-
key: "
|
|
659
|
+
key: "getDocumentContent",
|
|
626
660
|
value: function () {
|
|
627
|
-
var
|
|
628
|
-
var metadata,
|
|
661
|
+
var _getDocumentContent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(id, options) {
|
|
662
|
+
var metadata, requestOptions;
|
|
663
|
+
return _regeneratorRuntime.wrap(function _callee12$(_context12) {
|
|
664
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
665
|
+
case 0:
|
|
666
|
+
metadata = {
|
|
667
|
+
method: 'GET',
|
|
668
|
+
endpoint: '/file/{fileId}/document/contents'
|
|
669
|
+
};
|
|
670
|
+
requestOptions = _objectSpread(_objectSpread({}, metadata), {}, {
|
|
671
|
+
authContext: {
|
|
672
|
+
collectionName: options.collectionName
|
|
673
|
+
},
|
|
674
|
+
params: {
|
|
675
|
+
pageStart: options.pageStart,
|
|
676
|
+
pageEnd: options.pageEnd,
|
|
677
|
+
'max-age': FILE_CACHE_MAX_AGE
|
|
678
|
+
}
|
|
679
|
+
});
|
|
680
|
+
return _context12.abrupt("return", this.request("/file/".concat(id, "/document/contents"), requestOptions).then(createMapResponseToJson(metadata)));
|
|
681
|
+
case 3:
|
|
682
|
+
case "end":
|
|
683
|
+
return _context12.stop();
|
|
684
|
+
}
|
|
685
|
+
}, _callee12, this);
|
|
686
|
+
}));
|
|
687
|
+
function getDocumentContent(_x44, _x45) {
|
|
688
|
+
return _getDocumentContent.apply(this, arguments);
|
|
689
|
+
}
|
|
690
|
+
return getDocumentContent;
|
|
691
|
+
}()
|
|
692
|
+
}, {
|
|
693
|
+
key: "getDocumentPageImage",
|
|
694
|
+
value: function () {
|
|
695
|
+
var _getDocumentPageImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(id, options) {
|
|
696
|
+
var endpoint, metadata, requestOptions;
|
|
629
697
|
return _regeneratorRuntime.wrap(function _callee13$(_context13) {
|
|
630
698
|
while (1) switch (_context13.prev = _context13.next) {
|
|
699
|
+
case 0:
|
|
700
|
+
endpoint = cdnFeatureFlag('page');
|
|
701
|
+
metadata = {
|
|
702
|
+
method: 'GET',
|
|
703
|
+
endpoint: "/file/{fileId}/document/".concat(endpoint)
|
|
704
|
+
};
|
|
705
|
+
requestOptions = _objectSpread(_objectSpread({}, metadata), {}, {
|
|
706
|
+
authContext: {
|
|
707
|
+
collectionName: options.collectionName
|
|
708
|
+
},
|
|
709
|
+
params: {
|
|
710
|
+
page: options.page,
|
|
711
|
+
zoom: options.zoom,
|
|
712
|
+
'max-age': FILE_CACHE_MAX_AGE
|
|
713
|
+
}
|
|
714
|
+
});
|
|
715
|
+
return _context13.abrupt("return", this.request("/file/".concat(id, "/document/").concat(endpoint), requestOptions).then(createMapResponseToBlob(metadata)));
|
|
716
|
+
case 4:
|
|
717
|
+
case "end":
|
|
718
|
+
return _context13.stop();
|
|
719
|
+
}
|
|
720
|
+
}, _callee13, this);
|
|
721
|
+
}));
|
|
722
|
+
function getDocumentPageImage(_x46, _x47) {
|
|
723
|
+
return _getDocumentPageImage.apply(this, arguments);
|
|
724
|
+
}
|
|
725
|
+
return getDocumentPageImage;
|
|
726
|
+
}()
|
|
727
|
+
}, {
|
|
728
|
+
key: "appendChunksToUpload",
|
|
729
|
+
value: function () {
|
|
730
|
+
var _appendChunksToUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(uploadId, body, collectionName, traceContext) {
|
|
731
|
+
var metadata, options;
|
|
732
|
+
return _regeneratorRuntime.wrap(function _callee14$(_context14) {
|
|
733
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
631
734
|
case 0:
|
|
632
735
|
metadata = {
|
|
633
736
|
method: 'PUT',
|
|
@@ -641,15 +744,15 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
641
744
|
body: JSON.stringify(body),
|
|
642
745
|
traceContext: traceContext
|
|
643
746
|
});
|
|
644
|
-
|
|
747
|
+
_context14.next = 4;
|
|
645
748
|
return this.request("/upload/".concat(uploadId, "/chunks"), options);
|
|
646
749
|
case 4:
|
|
647
750
|
case "end":
|
|
648
|
-
return
|
|
751
|
+
return _context14.stop();
|
|
649
752
|
}
|
|
650
|
-
},
|
|
753
|
+
}, _callee14, this);
|
|
651
754
|
}));
|
|
652
|
-
function appendChunksToUpload(
|
|
755
|
+
function appendChunksToUpload(_x48, _x49, _x50, _x51) {
|
|
653
756
|
return _appendChunksToUpload.apply(this, arguments);
|
|
654
757
|
}
|
|
655
758
|
return appendChunksToUpload;
|
|
@@ -706,10 +809,10 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
706
809
|
}, {
|
|
707
810
|
key: "registerCopyIntents",
|
|
708
811
|
value: function () {
|
|
709
|
-
var _registerCopyIntents = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
812
|
+
var _registerCopyIntents = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(files, traceContext, resolvedAuth) {
|
|
710
813
|
var metadata, options;
|
|
711
|
-
return _regeneratorRuntime.wrap(function
|
|
712
|
-
while (1) switch (
|
|
814
|
+
return _regeneratorRuntime.wrap(function _callee15$(_context15) {
|
|
815
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
713
816
|
case 0:
|
|
714
817
|
metadata = {
|
|
715
818
|
method: 'POST',
|
|
@@ -723,15 +826,15 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
723
826
|
traceContext: traceContext,
|
|
724
827
|
resolvedAuth: resolvedAuth
|
|
725
828
|
});
|
|
726
|
-
|
|
829
|
+
_context15.next = 4;
|
|
727
830
|
return this.request('/file/copy/intents', options);
|
|
728
831
|
case 4:
|
|
729
832
|
case "end":
|
|
730
|
-
return
|
|
833
|
+
return _context15.stop();
|
|
731
834
|
}
|
|
732
|
-
},
|
|
835
|
+
}, _callee15, this);
|
|
733
836
|
}));
|
|
734
|
-
function registerCopyIntents(
|
|
837
|
+
function registerCopyIntents(_x52, _x53, _x54) {
|
|
735
838
|
return _registerCopyIntents.apply(this, arguments);
|
|
736
839
|
}
|
|
737
840
|
return registerCopyIntents;
|
|
@@ -739,7 +842,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
739
842
|
}, {
|
|
740
843
|
key: "request",
|
|
741
844
|
value: function () {
|
|
742
|
-
var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
845
|
+
var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(path) {
|
|
743
846
|
var options,
|
|
744
847
|
controller,
|
|
745
848
|
useMediaCdn,
|
|
@@ -759,32 +862,32 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
759
862
|
extendedParams,
|
|
760
863
|
url,
|
|
761
864
|
response,
|
|
762
|
-
|
|
763
|
-
return _regeneratorRuntime.wrap(function
|
|
764
|
-
while (1) switch (
|
|
865
|
+
_args16 = arguments;
|
|
866
|
+
return _regeneratorRuntime.wrap(function _callee16$(_context16) {
|
|
867
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
765
868
|
case 0:
|
|
766
|
-
options =
|
|
869
|
+
options = _args16.length > 1 && _args16[1] !== undefined ? _args16[1] : {
|
|
767
870
|
method: 'GET',
|
|
768
871
|
endpoint: undefined,
|
|
769
872
|
authContext: {}
|
|
770
873
|
};
|
|
771
|
-
controller =
|
|
772
|
-
useMediaCdn =
|
|
874
|
+
controller = _args16.length > 2 ? _args16[2] : undefined;
|
|
875
|
+
useMediaCdn = _args16.length > 3 ? _args16[3] : undefined;
|
|
773
876
|
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;
|
|
774
877
|
if (!(resolvedAuth !== null && resolvedAuth !== void 0)) {
|
|
775
|
-
|
|
878
|
+
_context16.next = 8;
|
|
776
879
|
break;
|
|
777
880
|
}
|
|
778
|
-
|
|
779
|
-
|
|
881
|
+
_context16.t0 = resolvedAuth;
|
|
882
|
+
_context16.next = 11;
|
|
780
883
|
break;
|
|
781
884
|
case 8:
|
|
782
|
-
|
|
885
|
+
_context16.next = 10;
|
|
783
886
|
return this.resolveAuth(authContext);
|
|
784
887
|
case 10:
|
|
785
|
-
|
|
888
|
+
_context16.t0 = _context16.sent;
|
|
786
889
|
case 11:
|
|
787
|
-
auth =
|
|
890
|
+
auth = _context16.t0;
|
|
788
891
|
clientId = isClientBasedAuth(auth) ? auth.clientId : undefined;
|
|
789
892
|
extendedTraceContext = extendTraceContext(traceContext);
|
|
790
893
|
extendedParams = addMediaClientParam ? _objectSpread(_objectSpread({}, params), {}, {
|
|
@@ -794,7 +897,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
794
897
|
if (useMediaCdn) {
|
|
795
898
|
url = mapToMediaCdnUrl(url, auth.token);
|
|
796
899
|
}
|
|
797
|
-
|
|
900
|
+
_context16.next = 19;
|
|
798
901
|
return _request(url, {
|
|
799
902
|
method: method,
|
|
800
903
|
endpoint: endpoint,
|
|
@@ -806,17 +909,17 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
806
909
|
traceContext: extendedTraceContext
|
|
807
910
|
}, controller);
|
|
808
911
|
case 19:
|
|
809
|
-
response =
|
|
912
|
+
response = _context16.sent;
|
|
810
913
|
setKeyValueInSessionStorage(MEDIA_API_REGION, response.headers.get('x-media-region'));
|
|
811
914
|
setKeyValueInSessionStorage(MEDIA_API_ENVIRONMENT, response.headers.get('x-media-env'));
|
|
812
|
-
return
|
|
915
|
+
return _context16.abrupt("return", response);
|
|
813
916
|
case 23:
|
|
814
917
|
case "end":
|
|
815
|
-
return
|
|
918
|
+
return _context16.stop();
|
|
816
919
|
}
|
|
817
|
-
},
|
|
920
|
+
}, _callee16, this);
|
|
818
921
|
}));
|
|
819
|
-
function request(
|
|
922
|
+
function request(_x55) {
|
|
820
923
|
return _request2.apply(this, arguments);
|
|
821
924
|
}
|
|
822
925
|
return request;
|
|
@@ -824,16 +927,16 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
824
927
|
}, {
|
|
825
928
|
key: "testUrl",
|
|
826
929
|
value: function () {
|
|
827
|
-
var _testUrl = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
930
|
+
var _testUrl = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(url) {
|
|
828
931
|
var options,
|
|
829
932
|
traceContext,
|
|
830
|
-
|
|
831
|
-
return _regeneratorRuntime.wrap(function
|
|
832
|
-
while (1) switch (
|
|
933
|
+
_args17 = arguments;
|
|
934
|
+
return _regeneratorRuntime.wrap(function _callee17$(_context17) {
|
|
935
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
833
936
|
case 0:
|
|
834
|
-
options =
|
|
937
|
+
options = _args17.length > 1 && _args17[1] !== undefined ? _args17[1] : {};
|
|
835
938
|
traceContext = options.traceContext;
|
|
836
|
-
|
|
939
|
+
_context17.next = 4;
|
|
837
940
|
return _request(url, {
|
|
838
941
|
method: 'HEAD',
|
|
839
942
|
traceContext: extendTraceContext(traceContext),
|
|
@@ -845,11 +948,11 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
845
948
|
});
|
|
846
949
|
case 4:
|
|
847
950
|
case "end":
|
|
848
|
-
return
|
|
951
|
+
return _context17.stop();
|
|
849
952
|
}
|
|
850
|
-
},
|
|
953
|
+
}, _callee17);
|
|
851
954
|
}));
|
|
852
|
-
function testUrl(
|
|
955
|
+
function testUrl(_x56) {
|
|
853
956
|
return _testUrl.apply(this, arguments);
|
|
854
957
|
}
|
|
855
958
|
return testUrl;
|