@atlaskit/media-client 17.1.3 → 18.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 +22 -0
- package/dist/cjs/client/media-client.js +2 -2
- package/dist/cjs/client/media-store/index.js +22 -11
- package/dist/cjs/client/mobile-upload.js +1 -1
- package/dist/cjs/file-streams-cache.js +2 -2
- package/dist/cjs/index.js +0 -9
- package/dist/cjs/utils/getVideoDimensionsFromBlob.js +23 -19
- package/dist/cjs/utils/mobileUpload/servicesCache.js +2 -2
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/client/media-client.js +2 -2
- package/dist/es2019/client/media-store/index.js +14 -5
- package/dist/es2019/client/mobile-upload.js +1 -1
- package/dist/es2019/file-streams-cache.js +2 -2
- package/dist/es2019/index.js +0 -2
- package/dist/es2019/utils/getVideoDimensionsFromBlob.js +21 -7
- package/dist/es2019/utils/mobileUpload/servicesCache.js +2 -2
- package/dist/es2019/version.json +1 -1
- package/dist/esm/client/media-client.js +2 -2
- package/dist/esm/client/media-store/index.js +19 -10
- package/dist/esm/client/mobile-upload.js +1 -1
- package/dist/esm/file-streams-cache.js +2 -2
- package/dist/esm/index.js +0 -2
- package/dist/esm/utils/getVideoDimensionsFromBlob.js +21 -16
- package/dist/esm/utils/mobileUpload/servicesCache.js +2 -2
- package/dist/esm/version.json +1 -1
- package/dist/types/client/media-client.d.ts +1 -1
- package/dist/types/client/media-store/index.d.ts +8 -1
- package/dist/types/file-streams-cache.d.ts +2 -2
- package/dist/types/index.d.ts +0 -1
- package/dist/types/utils/getVideoDimensionsFromBlob.d.ts +3 -4
- package/dist/types/utils/mobileUpload/servicesCache.d.ts +2 -2
- package/dist/types/utils/request/helpers.d.ts +1 -1
- package/dist/types-ts4.0/client/media-client.d.ts +1 -1
- package/dist/types-ts4.0/client/media-store/index.d.ts +8 -1
- package/dist/types-ts4.0/file-streams-cache.d.ts +2 -2
- package/dist/types-ts4.0/index.d.ts +0 -1
- package/dist/types-ts4.0/utils/getVideoDimensionsFromBlob.d.ts +3 -4
- package/dist/types-ts4.0/utils/mobileUpload/servicesCache.d.ts +2 -2
- package/dist/types-ts4.0/utils/request/helpers.d.ts +1 -1
- package/example-helpers/styles.ts +9 -8
- package/package.json +14 -12
- package/report.api.md +807 -517
|
@@ -5,6 +5,13 @@ import { MediaChunksProbe, MediaCollectionItemFullDetails, MediaCollectionItems,
|
|
|
5
5
|
import { ClientOptions, RequestHeaders, RequestMethod, RequestParams, RequestMetadata } from '../../utils/request/types';
|
|
6
6
|
export type { MediaStoreErrorReason, MediaStoreErrorAttributes } from './error';
|
|
7
7
|
export { MediaStoreError, isMediaStoreError } from './error';
|
|
8
|
+
export declare const ZipkinHeaderKeys: {
|
|
9
|
+
traceId: string;
|
|
10
|
+
spanId: string;
|
|
11
|
+
parentSpanId: string;
|
|
12
|
+
sampled: string;
|
|
13
|
+
flags: string;
|
|
14
|
+
};
|
|
8
15
|
export declare class MediaStore {
|
|
9
16
|
private readonly config;
|
|
10
17
|
readonly featureFlags?: MediaFeatureFlags | undefined;
|
|
@@ -29,7 +36,7 @@ export declare class MediaStore {
|
|
|
29
36
|
private createFileImageURL;
|
|
30
37
|
getFileBinaryURL(id: string, collectionName?: string): Promise<string>;
|
|
31
38
|
getArtifactURL(artifacts: MediaFileArtifacts, artifactName: keyof MediaFileArtifacts, collectionName?: string): Promise<string>;
|
|
32
|
-
getImage(id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean): Promise<Blob>;
|
|
39
|
+
getImage(id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean, traceId?: string): Promise<Blob>;
|
|
33
40
|
getItems(ids: string[], collectionName?: string): Promise<MediaStoreResponse<ItemsPayload>>;
|
|
34
41
|
getImageMetadata(id: string, params?: MediaStoreGetFileImageParams): Promise<{
|
|
35
42
|
metadata: ImageMetadata;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LRUMap } from 'lru_map';
|
|
2
2
|
import { ReplaySubject } from 'rxjs/ReplaySubject';
|
|
3
3
|
import { FileState } from './models/file-state';
|
|
4
4
|
export declare class StreamsCache<T> {
|
|
5
5
|
private readonly streams;
|
|
6
|
-
constructor(streams:
|
|
6
|
+
constructor(streams: LRUMap<string, ReplaySubject<T>>);
|
|
7
7
|
has(id: string): boolean;
|
|
8
8
|
set(id: string, stream: ReplaySubject<T>): void;
|
|
9
9
|
get(id: string): ReplaySubject<T> | undefined;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -13,7 +13,6 @@ export type { MediaClientError, MediaClientErrorReason, MediaClientErrorAttribut
|
|
|
13
13
|
export { isUploadingFileState, isProcessingFileState, isProcessedFileState, isErrorFileState, isPreviewableFileState, isFinalFileState, isImageRepresentationReady, mapMediaFileToFileState, mapMediaItemToFileState, } from './models/file-state';
|
|
14
14
|
export type { FileStatus, FilePreview, PreviewOptions, GetFileOptions, UploadingFileState, ProcessingFileState, ProcessedFileState, ProcessingFailedState, ErrorFileState, NonErrorFileState, PreviewableFileState, FileState, } from './models/file-state';
|
|
15
15
|
export type { MobileUpload, MobileUploadStartEvent, MobileUploadProgressEvent, MobileUploadEndEvent, MobileUploadErrorEvent, } from './models/mobile-upload';
|
|
16
|
-
export { StreamsCache } from './file-streams-cache';
|
|
17
16
|
export { uploadFile } from './uploader';
|
|
18
17
|
export type { UploadableFile, UploadableFileUpfrontIds, UploadFileCallbacks, UploadFileResult, } from './uploader';
|
|
19
18
|
export { request, RequestError, isRequestError, isRateLimitedError, } from './utils/request';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
export declare type Dimensions = {
|
|
1
|
+
export interface Dimensions {
|
|
3
2
|
width: number;
|
|
4
3
|
height: number;
|
|
5
|
-
}
|
|
6
|
-
export declare const getVideoDimensionsFromBlob: (blob: Blob
|
|
4
|
+
}
|
|
5
|
+
export declare const getVideoDimensionsFromBlob: (blob: Blob) => Promise<Dimensions>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LRUMap } from 'lru_map';
|
|
2
2
|
import { Interpreter } from 'xstate';
|
|
3
3
|
import { StateMachineContext, StateMachineEvent, StateMachineTypestate } from './stateMachine/types';
|
|
4
|
-
export declare function createServicesCache():
|
|
4
|
+
export declare function createServicesCache(): LRUMap<string, Interpreter<StateMachineContext, any, StateMachineEvent, StateMachineTypestate>>;
|
|
@@ -8,7 +8,7 @@ export declare function isFetchNetworkError(err: any): err is TypeError;
|
|
|
8
8
|
export declare function isRateLimitedError(error: Error | undefined): boolean;
|
|
9
9
|
export declare function mapAuthToRequestHeaders(auth: Auth): RequestHeaders;
|
|
10
10
|
export declare function createUrl(url: string, { params, auth }: CreateUrlOptions): string;
|
|
11
|
-
export declare function withAuth(auth?: Auth): (headers?: RequestHeaders | undefined) =>
|
|
11
|
+
export declare function withAuth(auth?: Auth): (headers?: RequestHeaders | undefined) => Record<string, string> | undefined;
|
|
12
12
|
/**
|
|
13
13
|
* @deprecated Helper is deprecated and will be removed in the next major version.
|
|
14
14
|
* TODO: https://product-fabric.atlassian.net/browse/BMPT-1354
|
|
@@ -17,7 +17,7 @@ export declare class MediaClient {
|
|
|
17
17
|
private mobileUpload?;
|
|
18
18
|
readonly config: MediaClientConfig;
|
|
19
19
|
constructor(mediaClientConfig: MediaClientConfig, featureFlags?: MediaFeatureFlags | undefined);
|
|
20
|
-
getImage(id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean): Promise<Blob>;
|
|
20
|
+
getImage(id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean, traceId?: string): Promise<Blob>;
|
|
21
21
|
getImageUrl(id: string, params?: MediaStoreGetFileImageParams): Promise<string>;
|
|
22
22
|
getImageUrlSync(id: string, params?: MediaStoreGetFileImageParams): string;
|
|
23
23
|
getImageMetadata(id: string, params?: MediaStoreGetFileImageParams): Promise<ImageMetadata>;
|
|
@@ -5,6 +5,13 @@ import { MediaChunksProbe, MediaCollectionItemFullDetails, MediaCollectionItems,
|
|
|
5
5
|
import { ClientOptions, RequestHeaders, RequestMethod, RequestParams, RequestMetadata } from '../../utils/request/types';
|
|
6
6
|
export type { MediaStoreErrorReason, MediaStoreErrorAttributes } from './error';
|
|
7
7
|
export { MediaStoreError, isMediaStoreError } from './error';
|
|
8
|
+
export declare const ZipkinHeaderKeys: {
|
|
9
|
+
traceId: string;
|
|
10
|
+
spanId: string;
|
|
11
|
+
parentSpanId: string;
|
|
12
|
+
sampled: string;
|
|
13
|
+
flags: string;
|
|
14
|
+
};
|
|
8
15
|
export declare class MediaStore {
|
|
9
16
|
private readonly config;
|
|
10
17
|
readonly featureFlags?: MediaFeatureFlags | undefined;
|
|
@@ -29,7 +36,7 @@ export declare class MediaStore {
|
|
|
29
36
|
private createFileImageURL;
|
|
30
37
|
getFileBinaryURL(id: string, collectionName?: string): Promise<string>;
|
|
31
38
|
getArtifactURL(artifacts: MediaFileArtifacts, artifactName: keyof MediaFileArtifacts, collectionName?: string): Promise<string>;
|
|
32
|
-
getImage(id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean): Promise<Blob>;
|
|
39
|
+
getImage(id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean, traceId?: string): Promise<Blob>;
|
|
33
40
|
getItems(ids: string[], collectionName?: string): Promise<MediaStoreResponse<ItemsPayload>>;
|
|
34
41
|
getImageMetadata(id: string, params?: MediaStoreGetFileImageParams): Promise<{
|
|
35
42
|
metadata: ImageMetadata;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LRUMap } from 'lru_map';
|
|
2
2
|
import { ReplaySubject } from 'rxjs/ReplaySubject';
|
|
3
3
|
import { FileState } from './models/file-state';
|
|
4
4
|
export declare class StreamsCache<T> {
|
|
5
5
|
private readonly streams;
|
|
6
|
-
constructor(streams:
|
|
6
|
+
constructor(streams: LRUMap<string, ReplaySubject<T>>);
|
|
7
7
|
has(id: string): boolean;
|
|
8
8
|
set(id: string, stream: ReplaySubject<T>): void;
|
|
9
9
|
get(id: string): ReplaySubject<T> | undefined;
|
|
@@ -13,7 +13,6 @@ export type { MediaClientError, MediaClientErrorReason, MediaClientErrorAttribut
|
|
|
13
13
|
export { isUploadingFileState, isProcessingFileState, isProcessedFileState, isErrorFileState, isPreviewableFileState, isFinalFileState, isImageRepresentationReady, mapMediaFileToFileState, mapMediaItemToFileState, } from './models/file-state';
|
|
14
14
|
export type { FileStatus, FilePreview, PreviewOptions, GetFileOptions, UploadingFileState, ProcessingFileState, ProcessedFileState, ProcessingFailedState, ErrorFileState, NonErrorFileState, PreviewableFileState, FileState, } from './models/file-state';
|
|
15
15
|
export type { MobileUpload, MobileUploadStartEvent, MobileUploadProgressEvent, MobileUploadEndEvent, MobileUploadErrorEvent, } from './models/mobile-upload';
|
|
16
|
-
export { StreamsCache } from './file-streams-cache';
|
|
17
16
|
export { uploadFile } from './uploader';
|
|
18
17
|
export type { UploadableFile, UploadableFileUpfrontIds, UploadFileCallbacks, UploadFileResult, } from './uploader';
|
|
19
18
|
export { request, RequestError, isRequestError, isRateLimitedError, } from './utils/request';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
export declare type Dimensions = {
|
|
1
|
+
export interface Dimensions {
|
|
3
2
|
width: number;
|
|
4
3
|
height: number;
|
|
5
|
-
}
|
|
6
|
-
export declare const getVideoDimensionsFromBlob: (blob: Blob
|
|
4
|
+
}
|
|
5
|
+
export declare const getVideoDimensionsFromBlob: (blob: Blob) => Promise<Dimensions>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LRUMap } from 'lru_map';
|
|
2
2
|
import { Interpreter } from 'xstate';
|
|
3
3
|
import { StateMachineContext, StateMachineEvent, StateMachineTypestate } from './stateMachine/types';
|
|
4
|
-
export declare function createServicesCache():
|
|
4
|
+
export declare function createServicesCache(): LRUMap<string, Interpreter<StateMachineContext, any, StateMachineEvent, StateMachineTypestate>>;
|
|
@@ -8,7 +8,7 @@ export declare function isFetchNetworkError(err: any): err is TypeError;
|
|
|
8
8
|
export declare function isRateLimitedError(error: Error | undefined): boolean;
|
|
9
9
|
export declare function mapAuthToRequestHeaders(auth: Auth): RequestHeaders;
|
|
10
10
|
export declare function createUrl(url: string, { params, auth }: CreateUrlOptions): string;
|
|
11
|
-
export declare function withAuth(auth?: Auth): (headers?: RequestHeaders | undefined) =>
|
|
11
|
+
export declare function withAuth(auth?: Auth): (headers?: RequestHeaders | undefined) => Record<string, string> | undefined;
|
|
12
12
|
/**
|
|
13
13
|
* @deprecated Helper is deprecated and will be removed in the next major version.
|
|
14
14
|
* TODO: https://product-fabric.atlassian.net/browse/BMPT-1354
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { token } from '@atlaskit/tokens';
|
|
1
2
|
import { css } from '@emotion/react';
|
|
2
3
|
import { FileStatus } from '../src';
|
|
3
4
|
|
|
@@ -29,11 +30,11 @@ export interface FilesWrapperProps {
|
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
const statusColorMap: { [key in FileStatus]: string } = {
|
|
32
|
-
uploading: 'cornflowerblue',
|
|
33
|
-
processing: 'peachpuff',
|
|
34
|
-
processed: 'darkseagreen',
|
|
35
|
-
error: 'indianred',
|
|
36
|
-
'failed-processing': 'indianred',
|
|
33
|
+
uploading: token('color.background.accent.blue.subtle', 'cornflowerblue'),
|
|
34
|
+
processing: token('color.background.accent.orange.subtler', 'peachpuff'),
|
|
35
|
+
processed: token('color.background.accent.green.subtle', 'darkseagreen'),
|
|
36
|
+
error: token('color.background.accent.red.subtle', 'indianred'),
|
|
37
|
+
'failed-processing': token('color.background.accent.red.subtle', 'indianred'),
|
|
37
38
|
};
|
|
38
39
|
|
|
39
40
|
export const fileWrapperStyles = (status: FileStatus) => css`
|
|
@@ -47,11 +48,11 @@ export const fileWrapperStyles = (status: FileStatus) => css`
|
|
|
47
48
|
export const cardsWrapperStyles = css`
|
|
48
49
|
width: 900px;
|
|
49
50
|
padding: 10px;
|
|
50
|
-
border-right: 1px solid #ccc;
|
|
51
|
+
border-right: 1px solid ${token('color.border', '#ccc')};
|
|
51
52
|
|
|
52
53
|
h1 {
|
|
53
54
|
text-align: center;
|
|
54
|
-
border-bottom: 1px solid #ccc;
|
|
55
|
+
border-bottom: 1px solid ${token('color.border', '#ccc')};
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
> div {
|
|
@@ -68,7 +69,7 @@ export const headerStyles = css`
|
|
|
68
69
|
`;
|
|
69
70
|
|
|
70
71
|
export const fileStateWrapperStyles = css`
|
|
71
|
-
border: 1px solid;
|
|
72
|
+
border: 1px solid ${token('color.border', '#ccc')};
|
|
72
73
|
margin: 10px;
|
|
73
74
|
padding: 10px;
|
|
74
75
|
width: 500px;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-client",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "18.1.0",
|
|
4
4
|
"description": "Media API Web Client Library",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
"typesVersions": {
|
|
16
16
|
">=4.0 <4.5": {
|
|
17
17
|
"*": [
|
|
18
|
-
"dist/types-ts4.0/*"
|
|
18
|
+
"dist/types-ts4.0/*",
|
|
19
|
+
"dist/types-ts4.0/index.d.ts"
|
|
19
20
|
]
|
|
20
21
|
}
|
|
21
22
|
},
|
|
@@ -35,32 +36,32 @@
|
|
|
35
36
|
},
|
|
36
37
|
"dependencies": {
|
|
37
38
|
"@atlaskit/chunkinator": "^4.1.0",
|
|
38
|
-
"@atlaskit/media-common": "^2.
|
|
39
|
+
"@atlaskit/media-common": "^2.17.0",
|
|
39
40
|
"@babel/runtime": "^7.0.0",
|
|
40
41
|
"dataloader": "^2.0.0",
|
|
41
42
|
"deep-equal": "^1.0.1",
|
|
42
43
|
"eventemitter2": "^4.1.0",
|
|
43
|
-
"
|
|
44
|
+
"lru_map": "^0.4.1",
|
|
44
45
|
"rusha": "^0.8.13",
|
|
45
46
|
"rxjs": "^5.5.0",
|
|
46
47
|
"setimmediate": "^1.0.5",
|
|
47
48
|
"uuid": "^3.1.0",
|
|
48
49
|
"uuid-validate": "^0.0.3",
|
|
49
|
-
"video-snapshot": "^1.0.11",
|
|
50
50
|
"xstate": "^4.20.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"@atlaskit/media-core": "^
|
|
53
|
+
"@atlaskit/media-core": "^34.0.0",
|
|
54
54
|
"@emotion/react": "^11.7.1",
|
|
55
55
|
"react": "^16.8.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@atlaskit/button": "^16.
|
|
58
|
+
"@atlaskit/button": "^16.4.0",
|
|
59
59
|
"@atlaskit/docs": "*",
|
|
60
|
-
"@atlaskit/media-card": "^74.
|
|
61
|
-
"@atlaskit/media-core": "^
|
|
60
|
+
"@atlaskit/media-card": "^74.2.0",
|
|
61
|
+
"@atlaskit/media-core": "^34.0.0",
|
|
62
62
|
"@atlaskit/media-test-helpers": "^30.0.0",
|
|
63
63
|
"@atlaskit/ssr": "*",
|
|
64
|
+
"@atlaskit/tokens": "^0.10.20",
|
|
64
65
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
65
66
|
"@emotion/react": "^11.7.1",
|
|
66
67
|
"@types/deep-equal": "^1.0.1",
|
|
@@ -71,14 +72,15 @@
|
|
|
71
72
|
"react-dom": "^16.8.0",
|
|
72
73
|
"typescript": "4.5.5"
|
|
73
74
|
},
|
|
74
|
-
"resolutions": {
|
|
75
|
-
"lru-fast": "0.2.2"
|
|
76
|
-
},
|
|
75
|
+
"resolutions": {},
|
|
77
76
|
"techstack": {
|
|
78
77
|
"@atlassian/frontend": {
|
|
79
78
|
"circular-dependencies": [
|
|
80
79
|
"file-level"
|
|
81
80
|
]
|
|
81
|
+
},
|
|
82
|
+
"@repo/internal": {
|
|
83
|
+
"theming": "tokens"
|
|
82
84
|
}
|
|
83
85
|
},
|
|
84
86
|
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
|