@atlaskit/media-client 27.3.3 → 27.3.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 +8 -0
- package/dist/cjs/client/media-store/MediaStore.js +8 -18
- package/dist/cjs/models/artifacts.js +5 -5
- package/dist/es2019/client/media-store/MediaStore.js +7 -7
- package/dist/es2019/models/artifacts.js +6 -6
- package/dist/esm/client/media-store/MediaStore.js +9 -19
- package/dist/esm/models/artifacts.js +6 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/media-client
|
|
2
2
|
|
|
3
|
+
## 27.3.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#120529](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/120529)
|
|
8
|
+
[`dc8b7900f9d1b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/dc8b7900f9d1b) -
|
|
9
|
+
fix artifacts cdn url
|
|
10
|
+
|
|
3
11
|
## 27.3.3
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -291,7 +291,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
291
291
|
params: extendImageParams(params),
|
|
292
292
|
auth: auth
|
|
293
293
|
};
|
|
294
|
-
var imageEndpoint = (0, _platformFeatureFlags.
|
|
294
|
+
var imageEndpoint = (0, _platformFeatureFlags.fg)('platform.media-cdn-delivery') ? 'image/cdn' : 'image';
|
|
295
295
|
return (0, _helpers.createUrl)("".concat(auth.baseUrl, "/file/").concat(id, "/").concat(imageEndpoint), options);
|
|
296
296
|
}
|
|
297
297
|
}, {
|
|
@@ -309,7 +309,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
309
309
|
case 0:
|
|
310
310
|
maxAge = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : _constants.FILE_CACHE_MAX_AGE;
|
|
311
311
|
headers = {};
|
|
312
|
-
binaryEndpoint = (0, _platformFeatureFlags.
|
|
312
|
+
binaryEndpoint = (0, _platformFeatureFlags.fg)('platform.media-cdn-delivery') ? 'binary/cdn' : 'binary';
|
|
313
313
|
metadata = {
|
|
314
314
|
method: 'GET',
|
|
315
315
|
endpoint: "/file/{fileId}/".concat(binaryEndpoint)
|
|
@@ -363,7 +363,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
363
363
|
},
|
|
364
364
|
auth: auth
|
|
365
365
|
};
|
|
366
|
-
binaryEndpoint = (0, _platformFeatureFlags.
|
|
366
|
+
binaryEndpoint = (0, _platformFeatureFlags.fg)('platform.media-cdn-delivery') ? 'binary/cdn' : 'binary';
|
|
367
367
|
return _context6.abrupt("return", (0, _helpers.createUrl)("".concat(auth.baseUrl, "/file/").concat(id, "/").concat(binaryEndpoint), options));
|
|
368
368
|
case 7:
|
|
369
369
|
case "end":
|
|
@@ -391,22 +391,12 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
391
391
|
}
|
|
392
392
|
throw new Error("artifact ".concat(artifactName, " not found"));
|
|
393
393
|
case 3:
|
|
394
|
-
|
|
395
|
-
_context7.next = 9;
|
|
396
|
-
break;
|
|
397
|
-
}
|
|
398
|
-
_context7.next = 6;
|
|
394
|
+
_context7.next = 5;
|
|
399
395
|
return this.resolveAuth({
|
|
400
396
|
collectionName: collectionName
|
|
401
397
|
});
|
|
402
|
-
case
|
|
403
|
-
|
|
404
|
-
_context7.next = 10;
|
|
405
|
-
break;
|
|
406
|
-
case 9:
|
|
407
|
-
_context7.t0 = undefined;
|
|
408
|
-
case 10:
|
|
409
|
-
auth = _context7.t0;
|
|
398
|
+
case 5:
|
|
399
|
+
auth = _context7.sent;
|
|
410
400
|
options = {
|
|
411
401
|
params: {
|
|
412
402
|
collection: collectionName,
|
|
@@ -415,7 +405,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
415
405
|
auth: auth
|
|
416
406
|
};
|
|
417
407
|
return _context7.abrupt("return", (0, _helpers.createUrl)(artifactUrl, options));
|
|
418
|
-
case
|
|
408
|
+
case 8:
|
|
419
409
|
case "end":
|
|
420
410
|
return _context7.stop();
|
|
421
411
|
}
|
|
@@ -440,7 +430,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
440
430
|
if (isWebpSupported) {
|
|
441
431
|
headers.accept = 'image/webp,image/*,*/*;q=0.8';
|
|
442
432
|
}
|
|
443
|
-
imageEndpoint = (0, _platformFeatureFlags.
|
|
433
|
+
imageEndpoint = (0, _platformFeatureFlags.fg)('platform.media-cdn-delivery') ? 'image/cdn' : 'image';
|
|
444
434
|
metadata = {
|
|
445
435
|
method: 'GET',
|
|
446
436
|
endpoint: "/file/{fileId}/".concat(imageEndpoint)
|
|
@@ -6,10 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.getArtifactUrl = void 0;
|
|
7
7
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
8
8
|
var getArtifactUrl = exports.getArtifactUrl = function getArtifactUrl(artifacts, prop) {
|
|
9
|
-
var _artifacts$
|
|
10
|
-
if ((0, _platformFeatureFlags.
|
|
11
|
-
var _artifacts$prop
|
|
12
|
-
return ((_artifacts$prop = artifacts[prop]) === null || _artifacts$prop === void 0 ? void 0 : _artifacts$prop.
|
|
9
|
+
var _artifacts$prop2;
|
|
10
|
+
if ((0, _platformFeatureFlags.fg)('platform.media-cdn-delivery')) {
|
|
11
|
+
var _artifacts$prop;
|
|
12
|
+
return "".concat((_artifacts$prop = artifacts[prop]) === null || _artifacts$prop === void 0 ? void 0 : _artifacts$prop.url, "/cdn");
|
|
13
13
|
}
|
|
14
|
-
return (_artifacts$
|
|
14
|
+
return (_artifacts$prop2 = artifacts[prop]) === null || _artifacts$prop2 === void 0 ? void 0 : _artifacts$prop2.url;
|
|
15
15
|
};
|
|
@@ -6,7 +6,7 @@ import { request } from '../../utils/request';
|
|
|
6
6
|
import { createUrl, createMapResponseToJson, createMapResponseToBlob } from '../../utils/request/helpers';
|
|
7
7
|
import { resolveAuth, resolveInitialAuth } from './resolveAuth';
|
|
8
8
|
import { ChunkHashAlgorithm } from '@atlaskit/media-core';
|
|
9
|
-
import {
|
|
9
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
10
|
const MEDIA_API_REGION = 'media-api-region';
|
|
11
11
|
const MEDIA_API_ENVIRONMENT = 'media-api-environment';
|
|
12
12
|
const extendImageParams = (params, fetchMaxRes = false) => {
|
|
@@ -185,12 +185,12 @@ export class MediaStore {
|
|
|
185
185
|
params: extendImageParams(params),
|
|
186
186
|
auth
|
|
187
187
|
};
|
|
188
|
-
const imageEndpoint =
|
|
188
|
+
const imageEndpoint = fg('platform.media-cdn-delivery') ? 'image/cdn' : 'image';
|
|
189
189
|
return createUrl(`${auth.baseUrl}/file/${id}/${imageEndpoint}`, options);
|
|
190
190
|
}
|
|
191
191
|
async getFileBinary(id, collectionName, maxAge = FILE_CACHE_MAX_AGE) {
|
|
192
192
|
const headers = {};
|
|
193
|
-
const binaryEndpoint =
|
|
193
|
+
const binaryEndpoint = fg('platform.media-cdn-delivery') ? 'binary/cdn' : 'binary';
|
|
194
194
|
const metadata = {
|
|
195
195
|
method: 'GET',
|
|
196
196
|
endpoint: `/file/{fileId}/${binaryEndpoint}`
|
|
@@ -220,7 +220,7 @@ export class MediaStore {
|
|
|
220
220
|
},
|
|
221
221
|
auth
|
|
222
222
|
};
|
|
223
|
-
const binaryEndpoint =
|
|
223
|
+
const binaryEndpoint = fg('platform.media-cdn-delivery') ? 'binary/cdn' : 'binary';
|
|
224
224
|
return createUrl(`${auth.baseUrl}/file/${id}/${binaryEndpoint}`, options);
|
|
225
225
|
}
|
|
226
226
|
async getArtifactURL(artifacts, artifactName, collectionName) {
|
|
@@ -228,9 +228,9 @@ export class MediaStore {
|
|
|
228
228
|
if (!artifactUrl) {
|
|
229
229
|
throw new Error(`artifact ${artifactName} not found`);
|
|
230
230
|
}
|
|
231
|
-
const auth =
|
|
231
|
+
const auth = await this.resolveAuth({
|
|
232
232
|
collectionName
|
|
233
|
-
})
|
|
233
|
+
});
|
|
234
234
|
const options = {
|
|
235
235
|
params: {
|
|
236
236
|
collection: collectionName,
|
|
@@ -247,7 +247,7 @@ export class MediaStore {
|
|
|
247
247
|
if (isWebpSupported) {
|
|
248
248
|
headers.accept = 'image/webp,image/*,*/*;q=0.8';
|
|
249
249
|
}
|
|
250
|
-
const imageEndpoint =
|
|
250
|
+
const imageEndpoint = fg('platform.media-cdn-delivery') ? 'image/cdn' : 'image';
|
|
251
251
|
const metadata = {
|
|
252
252
|
method: 'GET',
|
|
253
253
|
endpoint: `/file/{fileId}/${imageEndpoint}`
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
2
|
export const getArtifactUrl = (artifacts, prop) => {
|
|
3
|
-
var _artifacts$
|
|
4
|
-
if (
|
|
5
|
-
var _artifacts$prop
|
|
6
|
-
return (
|
|
3
|
+
var _artifacts$prop2;
|
|
4
|
+
if (fg('platform.media-cdn-delivery')) {
|
|
5
|
+
var _artifacts$prop;
|
|
6
|
+
return `${(_artifacts$prop = artifacts[prop]) === null || _artifacts$prop === void 0 ? void 0 : _artifacts$prop.url}/cdn`;
|
|
7
7
|
}
|
|
8
|
-
return (_artifacts$
|
|
8
|
+
return (_artifacts$prop2 = artifacts[prop]) === null || _artifacts$prop2 === void 0 ? void 0 : _artifacts$prop2.url;
|
|
9
9
|
};
|
|
@@ -12,7 +12,7 @@ import { request as _request } from '../../utils/request';
|
|
|
12
12
|
import { createUrl, createMapResponseToJson, createMapResponseToBlob } from '../../utils/request/helpers';
|
|
13
13
|
import { resolveAuth, resolveInitialAuth } from './resolveAuth';
|
|
14
14
|
import { ChunkHashAlgorithm } from '@atlaskit/media-core';
|
|
15
|
-
import {
|
|
15
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
16
16
|
var MEDIA_API_REGION = 'media-api-region';
|
|
17
17
|
var MEDIA_API_ENVIRONMENT = 'media-api-environment';
|
|
18
18
|
var extendImageParams = function extendImageParams(params) {
|
|
@@ -284,7 +284,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
284
284
|
params: extendImageParams(params),
|
|
285
285
|
auth: auth
|
|
286
286
|
};
|
|
287
|
-
var imageEndpoint =
|
|
287
|
+
var imageEndpoint = fg('platform.media-cdn-delivery') ? 'image/cdn' : 'image';
|
|
288
288
|
return createUrl("".concat(auth.baseUrl, "/file/").concat(id, "/").concat(imageEndpoint), options);
|
|
289
289
|
}
|
|
290
290
|
}, {
|
|
@@ -302,7 +302,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
302
302
|
case 0:
|
|
303
303
|
maxAge = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : FILE_CACHE_MAX_AGE;
|
|
304
304
|
headers = {};
|
|
305
|
-
binaryEndpoint =
|
|
305
|
+
binaryEndpoint = fg('platform.media-cdn-delivery') ? 'binary/cdn' : 'binary';
|
|
306
306
|
metadata = {
|
|
307
307
|
method: 'GET',
|
|
308
308
|
endpoint: "/file/{fileId}/".concat(binaryEndpoint)
|
|
@@ -356,7 +356,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
356
356
|
},
|
|
357
357
|
auth: auth
|
|
358
358
|
};
|
|
359
|
-
binaryEndpoint =
|
|
359
|
+
binaryEndpoint = fg('platform.media-cdn-delivery') ? 'binary/cdn' : 'binary';
|
|
360
360
|
return _context6.abrupt("return", createUrl("".concat(auth.baseUrl, "/file/").concat(id, "/").concat(binaryEndpoint), options));
|
|
361
361
|
case 7:
|
|
362
362
|
case "end":
|
|
@@ -384,22 +384,12 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
384
384
|
}
|
|
385
385
|
throw new Error("artifact ".concat(artifactName, " not found"));
|
|
386
386
|
case 3:
|
|
387
|
-
|
|
388
|
-
_context7.next = 9;
|
|
389
|
-
break;
|
|
390
|
-
}
|
|
391
|
-
_context7.next = 6;
|
|
387
|
+
_context7.next = 5;
|
|
392
388
|
return this.resolveAuth({
|
|
393
389
|
collectionName: collectionName
|
|
394
390
|
});
|
|
395
|
-
case
|
|
396
|
-
|
|
397
|
-
_context7.next = 10;
|
|
398
|
-
break;
|
|
399
|
-
case 9:
|
|
400
|
-
_context7.t0 = undefined;
|
|
401
|
-
case 10:
|
|
402
|
-
auth = _context7.t0;
|
|
391
|
+
case 5:
|
|
392
|
+
auth = _context7.sent;
|
|
403
393
|
options = {
|
|
404
394
|
params: {
|
|
405
395
|
collection: collectionName,
|
|
@@ -408,7 +398,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
408
398
|
auth: auth
|
|
409
399
|
};
|
|
410
400
|
return _context7.abrupt("return", createUrl(artifactUrl, options));
|
|
411
|
-
case
|
|
401
|
+
case 8:
|
|
412
402
|
case "end":
|
|
413
403
|
return _context7.stop();
|
|
414
404
|
}
|
|
@@ -433,7 +423,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
433
423
|
if (isWebpSupported) {
|
|
434
424
|
headers.accept = 'image/webp,image/*,*/*;q=0.8';
|
|
435
425
|
}
|
|
436
|
-
imageEndpoint =
|
|
426
|
+
imageEndpoint = fg('platform.media-cdn-delivery') ? 'image/cdn' : 'image';
|
|
437
427
|
metadata = {
|
|
438
428
|
method: 'GET',
|
|
439
429
|
endpoint: "/file/{fileId}/".concat(imageEndpoint)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
2
|
export var getArtifactUrl = function getArtifactUrl(artifacts, prop) {
|
|
3
|
-
var _artifacts$
|
|
4
|
-
if (
|
|
5
|
-
var _artifacts$prop
|
|
6
|
-
return ((_artifacts$prop = artifacts[prop]) === null || _artifacts$prop === void 0 ? void 0 : _artifacts$prop.
|
|
3
|
+
var _artifacts$prop2;
|
|
4
|
+
if (fg('platform.media-cdn-delivery')) {
|
|
5
|
+
var _artifacts$prop;
|
|
6
|
+
return "".concat((_artifacts$prop = artifacts[prop]) === null || _artifacts$prop === void 0 ? void 0 : _artifacts$prop.url, "/cdn");
|
|
7
7
|
}
|
|
8
|
-
return (_artifacts$
|
|
8
|
+
return (_artifacts$prop2 = artifacts[prop]) === null || _artifacts$prop2 === void 0 ? void 0 : _artifacts$prop2.url;
|
|
9
9
|
};
|