@atlaskit/media-client 35.0.0 → 35.2.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 +20 -0
- package/dist/cjs/models/file-state.js +4 -2
- package/dist/cjs/utils/mediaCdn.js +7 -0
- package/dist/es2019/models/file-state.js +4 -2
- package/dist/es2019/utils/mediaCdn.js +7 -0
- package/dist/esm/models/file-state.js +4 -2
- package/dist/esm/utils/mediaCdn.js +7 -0
- package/dist/types/models/media.d.ts +5 -0
- package/dist/types-ts4.5/models/media.d.ts +5 -0
- package/package.json +8 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/media-client
|
|
2
2
|
|
|
3
|
+
## 35.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#188575](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/188575)
|
|
8
|
+
[`f5ac80e740159`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f5ac80e740159) -
|
|
9
|
+
Add feature flag and logic that disable CDN delivery for requests from Isolated Cloud
|
|
10
|
+
|
|
11
|
+
## 35.1.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [#185135](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/185135)
|
|
16
|
+
[`3d2527a53b492`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3d2527a53b492) -
|
|
17
|
+
Add media metadata fields to relevant types/mappings
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
|
|
3
23
|
## 35.0.0
|
|
4
24
|
|
|
5
25
|
### Major Changes
|
|
@@ -55,7 +55,8 @@ var mapMediaFileToFileState = exports.mapMediaFileToFileState = function mapMedi
|
|
|
55
55
|
createdAt = _mediaFile$data.createdAt,
|
|
56
56
|
metadataTraceContext = _mediaFile$data.metadataTraceContext,
|
|
57
57
|
hash = _mediaFile$data.hash,
|
|
58
|
-
abuseClassification = _mediaFile$data.abuseClassification
|
|
58
|
+
abuseClassification = _mediaFile$data.abuseClassification,
|
|
59
|
+
mediaMetadata = _mediaFile$data.mediaMetadata;
|
|
59
60
|
var baseState = {
|
|
60
61
|
id: id,
|
|
61
62
|
name: name,
|
|
@@ -67,7 +68,8 @@ var mapMediaFileToFileState = exports.mapMediaFileToFileState = function mapMedi
|
|
|
67
68
|
createdAt: createdAt,
|
|
68
69
|
hash: hash,
|
|
69
70
|
metadataTraceContext: metadataTraceContext,
|
|
70
|
-
abuseClassification: abuseClassification
|
|
71
|
+
abuseClassification: abuseClassification,
|
|
72
|
+
mediaMetadata: mediaMetadata
|
|
71
73
|
};
|
|
72
74
|
switch (processingStatus) {
|
|
73
75
|
case 'pending':
|
|
@@ -7,6 +7,7 @@ exports.MEDIA_CDN_MAP = void 0;
|
|
|
7
7
|
exports.mapToMediaCdnUrl = mapToMediaCdnUrl;
|
|
8
8
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
9
9
|
var _isCommercial = require("./isCommercial");
|
|
10
|
+
var _atlassianContext = require("@atlaskit/atlassian-context");
|
|
10
11
|
var MEDIA_CDN_MAP = exports.MEDIA_CDN_MAP = {
|
|
11
12
|
'api.media.atlassian.com': 'media-cdn.atlassian.com',
|
|
12
13
|
'media.staging.atl-paas.net': 'media-cdn.stg.atlassian.com'
|
|
@@ -22,6 +23,12 @@ function mapToMediaCdnUrl(url, token) {
|
|
|
22
23
|
if (!(0, _isCommercial.isCommercial)() || tokenLength > MEDIA_TOKEN_LENGTH_LIMIT) {
|
|
23
24
|
return url;
|
|
24
25
|
}
|
|
26
|
+
if ((0, _platformFeatureFlags.fg)('platform_disable_isolated_cloud_media_cdn_delivery')) {
|
|
27
|
+
if ((0, _atlassianContext.isIsolatedCloud)()) {
|
|
28
|
+
return url;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
25
32
|
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
26
33
|
if ((0, _platformFeatureFlags.fg)('platform_media_cdn_delivery') && (0, _platformFeatureFlags.fg)('platform_media_cdn_single_host')) {
|
|
27
34
|
try {
|
|
@@ -29,7 +29,8 @@ export const mapMediaFileToFileState = mediaFile => {
|
|
|
29
29
|
createdAt,
|
|
30
30
|
metadataTraceContext,
|
|
31
31
|
hash,
|
|
32
|
-
abuseClassification
|
|
32
|
+
abuseClassification,
|
|
33
|
+
mediaMetadata
|
|
33
34
|
} = mediaFile.data;
|
|
34
35
|
const baseState = {
|
|
35
36
|
id,
|
|
@@ -42,7 +43,8 @@ export const mapMediaFileToFileState = mediaFile => {
|
|
|
42
43
|
createdAt,
|
|
43
44
|
hash,
|
|
44
45
|
metadataTraceContext,
|
|
45
|
-
abuseClassification
|
|
46
|
+
abuseClassification,
|
|
47
|
+
mediaMetadata
|
|
46
48
|
};
|
|
47
49
|
switch (processingStatus) {
|
|
48
50
|
case 'pending':
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
2
|
import { isCommercial } from './isCommercial';
|
|
3
|
+
import { isIsolatedCloud } from '@atlaskit/atlassian-context';
|
|
3
4
|
export const MEDIA_CDN_MAP = {
|
|
4
5
|
'api.media.atlassian.com': 'media-cdn.atlassian.com',
|
|
5
6
|
'media.staging.atl-paas.net': 'media-cdn.stg.atlassian.com'
|
|
@@ -15,6 +16,12 @@ export function mapToMediaCdnUrl(url, token) {
|
|
|
15
16
|
if (!isCommercial() || tokenLength > MEDIA_TOKEN_LENGTH_LIMIT) {
|
|
16
17
|
return url;
|
|
17
18
|
}
|
|
19
|
+
if (fg('platform_disable_isolated_cloud_media_cdn_delivery')) {
|
|
20
|
+
if (isIsolatedCloud()) {
|
|
21
|
+
return url;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
18
25
|
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
19
26
|
if (fg('platform_media_cdn_delivery') && fg('platform_media_cdn_single_host')) {
|
|
20
27
|
try {
|
|
@@ -48,7 +48,8 @@ export var mapMediaFileToFileState = function mapMediaFileToFileState(mediaFile)
|
|
|
48
48
|
createdAt = _mediaFile$data.createdAt,
|
|
49
49
|
metadataTraceContext = _mediaFile$data.metadataTraceContext,
|
|
50
50
|
hash = _mediaFile$data.hash,
|
|
51
|
-
abuseClassification = _mediaFile$data.abuseClassification
|
|
51
|
+
abuseClassification = _mediaFile$data.abuseClassification,
|
|
52
|
+
mediaMetadata = _mediaFile$data.mediaMetadata;
|
|
52
53
|
var baseState = {
|
|
53
54
|
id: id,
|
|
54
55
|
name: name,
|
|
@@ -60,7 +61,8 @@ export var mapMediaFileToFileState = function mapMediaFileToFileState(mediaFile)
|
|
|
60
61
|
createdAt: createdAt,
|
|
61
62
|
hash: hash,
|
|
62
63
|
metadataTraceContext: metadataTraceContext,
|
|
63
|
-
abuseClassification: abuseClassification
|
|
64
|
+
abuseClassification: abuseClassification,
|
|
65
|
+
mediaMetadata: mediaMetadata
|
|
64
66
|
};
|
|
65
67
|
switch (processingStatus) {
|
|
66
68
|
case 'pending':
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
2
|
import { isCommercial } from './isCommercial';
|
|
3
|
+
import { isIsolatedCloud } from '@atlaskit/atlassian-context';
|
|
3
4
|
export var MEDIA_CDN_MAP = {
|
|
4
5
|
'api.media.atlassian.com': 'media-cdn.atlassian.com',
|
|
5
6
|
'media.staging.atl-paas.net': 'media-cdn.stg.atlassian.com'
|
|
@@ -15,6 +16,12 @@ export function mapToMediaCdnUrl(url, token) {
|
|
|
15
16
|
if (!isCommercial() || tokenLength > MEDIA_TOKEN_LENGTH_LIMIT) {
|
|
16
17
|
return url;
|
|
17
18
|
}
|
|
19
|
+
if (fg('platform_disable_isolated_cloud_media_cdn_delivery')) {
|
|
20
|
+
if (isIsolatedCloud()) {
|
|
21
|
+
return url;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
18
25
|
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
19
26
|
if (fg('platform_media_cdn_delivery') && fg('platform_media_cdn_single_host')) {
|
|
20
27
|
try {
|
|
@@ -7,6 +7,9 @@ export type AbuseClassification = {
|
|
|
7
7
|
classification: 'ABHORRENT' | 'MALICIOUS' | 'ILLICIT' | 'COPYRIGHT';
|
|
8
8
|
confidence: 'HIGH' | 'MEDIUM' | 'LOW' | 'SYNTHETIC';
|
|
9
9
|
};
|
|
10
|
+
export type FileMediaMetadata = {
|
|
11
|
+
duration?: number;
|
|
12
|
+
};
|
|
10
13
|
export type MediaFile = {
|
|
11
14
|
readonly id: string;
|
|
12
15
|
readonly mediaType: MediaType;
|
|
@@ -20,6 +23,7 @@ export type MediaFile = {
|
|
|
20
23
|
readonly hash?: string;
|
|
21
24
|
readonly metadataTraceContext?: MediaTraceContext;
|
|
22
25
|
readonly abuseClassification?: AbuseClassification;
|
|
26
|
+
readonly mediaMetadata?: FileMediaMetadata;
|
|
23
27
|
};
|
|
24
28
|
export type MediaItemDetails = {
|
|
25
29
|
readonly mediaType: MediaType;
|
|
@@ -33,6 +37,7 @@ export type MediaItemDetails = {
|
|
|
33
37
|
readonly hash?: string;
|
|
34
38
|
readonly metadataTraceContext?: MediaTraceContext;
|
|
35
39
|
readonly abuseClassification?: AbuseClassification;
|
|
40
|
+
readonly mediaMetadata?: FileMediaMetadata;
|
|
36
41
|
};
|
|
37
42
|
export type NotFoundMediaItemDetails = {
|
|
38
43
|
readonly id: string;
|
|
@@ -7,6 +7,9 @@ export type AbuseClassification = {
|
|
|
7
7
|
classification: 'ABHORRENT' | 'MALICIOUS' | 'ILLICIT' | 'COPYRIGHT';
|
|
8
8
|
confidence: 'HIGH' | 'MEDIUM' | 'LOW' | 'SYNTHETIC';
|
|
9
9
|
};
|
|
10
|
+
export type FileMediaMetadata = {
|
|
11
|
+
duration?: number;
|
|
12
|
+
};
|
|
10
13
|
export type MediaFile = {
|
|
11
14
|
readonly id: string;
|
|
12
15
|
readonly mediaType: MediaType;
|
|
@@ -20,6 +23,7 @@ export type MediaFile = {
|
|
|
20
23
|
readonly hash?: string;
|
|
21
24
|
readonly metadataTraceContext?: MediaTraceContext;
|
|
22
25
|
readonly abuseClassification?: AbuseClassification;
|
|
26
|
+
readonly mediaMetadata?: FileMediaMetadata;
|
|
23
27
|
};
|
|
24
28
|
export type MediaItemDetails = {
|
|
25
29
|
readonly mediaType: MediaType;
|
|
@@ -33,6 +37,7 @@ export type MediaItemDetails = {
|
|
|
33
37
|
readonly hash?: string;
|
|
34
38
|
readonly metadataTraceContext?: MediaTraceContext;
|
|
35
39
|
readonly abuseClassification?: AbuseClassification;
|
|
40
|
+
readonly mediaMetadata?: FileMediaMetadata;
|
|
36
41
|
};
|
|
37
42
|
export type NotFoundMediaItemDetails = {
|
|
38
43
|
readonly id: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-client",
|
|
3
|
-
"version": "35.
|
|
3
|
+
"version": "35.2.0",
|
|
4
4
|
"description": "Media API Web Client Library",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
+
"@atlaskit/atlassian-context": "^0.3.0",
|
|
37
38
|
"@atlaskit/chunkinator": "^7.0.0",
|
|
38
39
|
"@atlaskit/media-common": "^12.3.0",
|
|
39
40
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
@@ -51,13 +52,13 @@
|
|
|
51
52
|
},
|
|
52
53
|
"peerDependencies": {
|
|
53
54
|
"@atlaskit/media-core": "^37.0.0",
|
|
54
|
-
"@atlaskit/media-state": "^1.
|
|
55
|
+
"@atlaskit/media-state": "^1.8.0"
|
|
55
56
|
},
|
|
56
57
|
"devDependencies": {
|
|
57
58
|
"@atlaskit/media-core": "^37.0.0",
|
|
58
|
-
"@atlaskit/media-state": "^1.
|
|
59
|
+
"@atlaskit/media-state": "^1.8.0",
|
|
59
60
|
"@atlaskit/ssr": "workspace:^",
|
|
60
|
-
"@atlaskit/tokens": "^5.
|
|
61
|
+
"@atlaskit/tokens": "^5.6.0",
|
|
61
62
|
"@atlassian/feature-flags-test-utils": "^0.3.0",
|
|
62
63
|
"@emotion/react": "^11.7.1",
|
|
63
64
|
"@types/deep-equal": "^1.0.1",
|
|
@@ -86,6 +87,9 @@
|
|
|
86
87
|
},
|
|
87
88
|
"platform_media_cdn_delivery": {
|
|
88
89
|
"type": "boolean"
|
|
90
|
+
},
|
|
91
|
+
"platform_disable_isolated_cloud_media_cdn_delivery": {
|
|
92
|
+
"type": "boolean"
|
|
89
93
|
}
|
|
90
94
|
}
|
|
91
95
|
}
|