@atlaskit/media-client 22.0.0 → 22.0.2
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 +14 -0
- package/constants/package.json +2 -2
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/client/events.d.ts +3 -3
- package/dist/types/client/file-fetcher/error.d.ts +2 -2
- package/dist/types/client/file-fetcher/index.d.ts +1 -1
- package/dist/types/client/media-store/error.d.ts +2 -2
- package/dist/types/client/media-store/index.d.ts +15 -15
- package/dist/types/client/media-store/resolveAuth.d.ts +2 -2
- package/dist/types/identifier.d.ts +1 -1
- package/dist/types/models/artifacts.d.ts +1 -1
- package/dist/types/models/auth-headers.d.ts +1 -1
- package/dist/types/models/auth-query-parameters.d.ts +1 -1
- package/dist/types/models/errors/types.d.ts +1 -1
- package/dist/types/models/file-state.d.ts +4 -4
- package/dist/types/models/item.d.ts +3 -3
- package/dist/types/models/media.d.ts +7 -7
- package/dist/types/models/mobile-upload.d.ts +4 -4
- package/dist/types/upload-controller.d.ts +1 -1
- package/dist/types/uploader/error.d.ts +2 -2
- package/dist/types/uploader/index.d.ts +4 -4
- package/dist/types/utils/createFileDataLoader.d.ts +4 -4
- package/dist/types/utils/getDimensionsFromBlob.d.ts +1 -1
- package/dist/types/utils/getImageDimensionsFromBlob.d.ts +1 -1
- package/dist/types/utils/imageResizeModeToFileImageMode.d.ts +2 -2
- package/dist/types/utils/mediaSubscribable/types.d.ts +7 -7
- package/dist/types/utils/mobileUpload/error.d.ts +2 -2
- package/dist/types/utils/mobileUpload/helpers.d.ts +1 -1
- package/dist/types/utils/mobileUpload/stateMachine/index.d.ts +1 -1
- package/dist/types/utils/mobileUpload/stateMachine/types.d.ts +5 -5
- package/dist/types/utils/overrideMediaTypeIfUnknown.d.ts +1 -1
- package/dist/types/utils/polling/types.d.ts +3 -3
- package/dist/types/utils/request/types.d.ts +11 -11
- package/dist/types/utils/with-media-client-hoc.d.ts +3 -3
- package/dist/types-ts4.5/client/__mocks__/collection-fetcher.d.ts +8 -0
- package/dist/types-ts4.5/client/__mocks__/file-fetcher.d.ts +10 -0
- package/dist/types-ts4.5/client/__mocks__/media-client.d.ts +11 -0
- package/dist/types-ts4.5/client/events.d.ts +14 -0
- package/dist/types-ts4.5/client/file-fetcher/error.d.ts +29 -0
- package/dist/types-ts4.5/client/file-fetcher/index.d.ts +61 -0
- package/dist/types-ts4.5/client/media-client.d.ts +27 -0
- package/dist/types-ts4.5/client/media-store/error.d.ts +16 -0
- package/dist/types-ts4.5/client/media-store/index.d.ts +170 -0
- package/dist/types-ts4.5/client/media-store/resolveAuth.d.ts +4 -0
- package/dist/types-ts4.5/client/mobile-upload.d.ts +11 -0
- package/dist/types-ts4.5/client/stargate-client.d.ts +15 -0
- package/dist/types-ts4.5/constants.d.ts +6 -0
- package/dist/types-ts4.5/file-streams-cache.d.ts +15 -0
- package/dist/types-ts4.5/globalMediaEventEmitter.d.ts +6 -0
- package/dist/types-ts4.5/identifier.d.ts +15 -0
- package/dist/types-ts4.5/index.d.ts +87 -0
- package/dist/types-ts4.5/models/artifacts.d.ts +12 -0
- package/dist/types-ts4.5/models/auth-headers.d.ts +11 -0
- package/dist/types-ts4.5/models/auth-query-parameters.d.ts +11 -0
- package/dist/types-ts4.5/models/errors/helpers.d.ts +6 -0
- package/dist/types-ts4.5/models/errors/index.d.ts +11 -0
- package/dist/types-ts4.5/models/errors/types.d.ts +15 -0
- package/dist/types-ts4.5/models/file-state.d.ts +94 -0
- package/dist/types-ts4.5/models/item.d.ts +25 -0
- package/dist/types-ts4.5/models/media.d.ts +48 -0
- package/dist/types-ts4.5/models/mobile-upload.d.ts +28 -0
- package/dist/types-ts4.5/upload-controller.d.ts +7 -0
- package/dist/types-ts4.5/uploader/calculateChunkSize.d.ts +11 -0
- package/dist/types-ts4.5/uploader/error.d.ts +29 -0
- package/dist/types-ts4.5/uploader/index.d.ts +22 -0
- package/dist/types-ts4.5/utils/checkWebpSupport.d.ts +1 -0
- package/dist/types-ts4.5/utils/convertBase64ToBlob.d.ts +1 -0
- package/dist/types-ts4.5/utils/createFileDataLoader.d.ts +30 -0
- package/dist/types-ts4.5/utils/createMediaSubject.d.ts +3 -0
- package/dist/types-ts4.5/utils/detectEmptyFile.d.ts +16 -0
- package/dist/types-ts4.5/utils/getDimensionsFromBlob.d.ts +6 -0
- package/dist/types-ts4.5/utils/getImageDimensionsFromBlob.d.ts +5 -0
- package/dist/types-ts4.5/utils/getMediaTypeFromUploadableFile.d.ts +3 -0
- package/dist/types-ts4.5/utils/getVideoDimensionsFromBlob.d.ts +5 -0
- package/dist/types-ts4.5/utils/hashing/hasher.d.ts +3 -0
- package/dist/types-ts4.5/utils/hashing/hasherCreator.d.ts +3 -0
- package/dist/types-ts4.5/utils/hashing/simpleHasher.d.ts +4 -0
- package/dist/types-ts4.5/utils/hashing/workerHasher.d.ts +16 -0
- package/dist/types-ts4.5/utils/imageResizeModeToFileImageMode.d.ts +3 -0
- package/dist/types-ts4.5/utils/isImageRemote.d.ts +1 -0
- package/dist/types-ts4.5/utils/mediaSubscribable/fromObservable.d.ts +5 -0
- package/dist/types-ts4.5/utils/mediaSubscribable/index.d.ts +3 -0
- package/dist/types-ts4.5/utils/mediaSubscribable/toPromise.d.ts +10 -0
- package/dist/types-ts4.5/utils/mediaSubscribable/types.d.ts +17 -0
- package/dist/types-ts4.5/utils/mobileUpload/error.d.ts +29 -0
- package/dist/types-ts4.5/utils/mobileUpload/helpers.d.ts +8 -0
- package/dist/types-ts4.5/utils/mobileUpload/index.d.ts +5 -0
- package/dist/types-ts4.5/utils/mobileUpload/servicesCache.d.ts +4 -0
- package/dist/types-ts4.5/utils/mobileUpload/stateMachine/index.d.ts +7 -0
- package/dist/types-ts4.5/utils/mobileUpload/stateMachine/states/error.d.ts +3 -0
- package/dist/types-ts4.5/utils/mobileUpload/stateMachine/states/processed.d.ts +3 -0
- package/dist/types-ts4.5/utils/mobileUpload/stateMachine/states/processing.d.ts +3 -0
- package/dist/types-ts4.5/utils/mobileUpload/stateMachine/states/processingFailed.d.ts +3 -0
- package/dist/types-ts4.5/utils/mobileUpload/stateMachine/states/uploading.d.ts +3 -0
- package/dist/types-ts4.5/utils/mobileUpload/stateMachine/types.d.ts +69 -0
- package/dist/types-ts4.5/utils/overrideMediaTypeIfUnknown.d.ts +5 -0
- package/dist/types-ts4.5/utils/parseJwt.d.ts +1 -0
- package/dist/types-ts4.5/utils/polling/errors.d.ts +12 -0
- package/dist/types-ts4.5/utils/polling/index.d.ts +33 -0
- package/dist/types-ts4.5/utils/polling/types.d.ts +7 -0
- package/dist/types-ts4.5/utils/request/errors.d.ts +20 -0
- package/dist/types-ts4.5/utils/request/helpers.d.ts +46 -0
- package/dist/types-ts4.5/utils/request/index.d.ts +5 -0
- package/dist/types-ts4.5/utils/request/types.d.ts +46 -0
- package/dist/types-ts4.5/utils/safeUnsubscribe.d.ts +2 -0
- package/dist/types-ts4.5/utils/setTimeoutPromise.d.ts +2 -0
- package/dist/types-ts4.5/utils/shouldFetchRemoteFileStates.d.ts +16 -0
- package/dist/types-ts4.5/utils/url.d.ts +17 -0
- package/dist/types-ts4.5/utils/with-media-client-hoc.d.ts +16 -0
- package/package.json +13 -5
- package/report.api.md +7 -7
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import { Auth } from '@atlaskit/media-core';
|
|
2
2
|
import type { MediaTraceContext } from '@atlaskit/media-common';
|
|
3
|
-
export
|
|
4
|
-
export
|
|
3
|
+
export type RequestMethod = 'GET' | 'POST' | 'PUT' | 'DELETE';
|
|
4
|
+
export type RequestParams = {
|
|
5
5
|
[key: string]: any;
|
|
6
6
|
};
|
|
7
|
-
export
|
|
7
|
+
export type RequestHeaders = {
|
|
8
8
|
[key: string]: string;
|
|
9
9
|
};
|
|
10
|
-
export
|
|
10
|
+
export type RetryOptions = {
|
|
11
11
|
readonly startTimeoutInMs: number;
|
|
12
12
|
readonly maxAttempts: number;
|
|
13
13
|
readonly factor: number;
|
|
14
14
|
};
|
|
15
|
-
export
|
|
15
|
+
export type ClientOptions = {
|
|
16
16
|
readonly retryOptions?: Partial<RetryOptions>;
|
|
17
17
|
readonly clientTimeout?: number;
|
|
18
18
|
};
|
|
19
|
-
export
|
|
19
|
+
export type RequestMetadata = {
|
|
20
20
|
readonly method?: RequestMethod;
|
|
21
21
|
readonly endpoint?: string;
|
|
22
22
|
readonly mediaRegion?: string;
|
|
23
23
|
readonly mediaEnv?: string;
|
|
24
24
|
readonly traceContext?: MediaTraceContext;
|
|
25
25
|
};
|
|
26
|
-
export
|
|
26
|
+
export type RequestOptions = RequestMetadata & {
|
|
27
27
|
readonly auth?: Auth;
|
|
28
28
|
readonly traceContext?: Required<MediaTraceContext>;
|
|
29
29
|
readonly params?: RequestParams;
|
|
@@ -31,16 +31,16 @@ export declare type RequestOptions = RequestMetadata & {
|
|
|
31
31
|
readonly body?: any;
|
|
32
32
|
readonly clientOptions?: ClientOptions;
|
|
33
33
|
};
|
|
34
|
-
export
|
|
34
|
+
export type CreateUrlOptions = {
|
|
35
35
|
readonly params?: RequestParams;
|
|
36
36
|
readonly auth?: Auth;
|
|
37
37
|
};
|
|
38
|
-
export
|
|
39
|
-
export
|
|
38
|
+
export type RequestErrorReason = 'clientOffline' | 'clientAbortedRequest' | 'clientTimeoutRequest' | 'serverInvalidBody' | 'serverBadRequest' | 'serverUnauthorized' | 'serverForbidden' | 'serverNotFound' | 'serverRateLimited' | 'serverInternalError' | 'serverBadGateway' | 'serverUnexpectedError';
|
|
39
|
+
export type RequestErrorMetadata = RequestMetadata & {
|
|
40
40
|
readonly attempts?: number;
|
|
41
41
|
readonly clientExhaustedRetries?: boolean;
|
|
42
42
|
readonly statusCode?: number;
|
|
43
43
|
};
|
|
44
|
-
export
|
|
44
|
+
export type RequestErrorAttributes = RequestErrorMetadata & {
|
|
45
45
|
readonly reason: RequestErrorReason;
|
|
46
46
|
};
|
|
@@ -10,7 +10,7 @@ export interface WithMediaClient {
|
|
|
10
10
|
mediaClient: MediaClient;
|
|
11
11
|
identifier?: Identifier;
|
|
12
12
|
}
|
|
13
|
-
export declare const getMediaClient: (mediaClientConfig: MediaClientConfig, featureFlags?: MediaFeatureFlags
|
|
14
|
-
export
|
|
15
|
-
export
|
|
13
|
+
export declare const getMediaClient: (mediaClientConfig: MediaClientConfig, featureFlags?: MediaFeatureFlags) => MediaClient;
|
|
14
|
+
export type WithMediaClientConfigProps<P extends WithMediaClient> = Omit<P, 'mediaClient'> & WithMediaClientConfig;
|
|
15
|
+
export type WithMediaClientFunction = <P extends WithMediaClient>(Component: React.ComponentType<P>, featureFlags?: MediaFeatureFlags) => React.ComponentType<WithMediaClientConfigProps<P>>;
|
|
16
16
|
export declare const withMediaClient: WithMediaClientFunction;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="jest" />
|
|
2
|
+
export declare class FileFetcher {
|
|
3
|
+
constructor();
|
|
4
|
+
getFileState: jest.Mock<any, any>;
|
|
5
|
+
getCurrentState: jest.Mock<any, any>;
|
|
6
|
+
getArtifactURL: jest.Mock<any, any>;
|
|
7
|
+
touchFiles: jest.Mock<any, any>;
|
|
8
|
+
upload: jest.Mock<any, any>;
|
|
9
|
+
downloadBinary: jest.Mock<any, any>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="jest" />
|
|
2
|
+
import { MediaClientConfig } from '@atlaskit/media-core';
|
|
3
|
+
import { FileFetcher } from '../file-fetcher';
|
|
4
|
+
export declare class MediaClient {
|
|
5
|
+
readonly config: MediaClientConfig;
|
|
6
|
+
readonly file: FileFetcher;
|
|
7
|
+
constructor(config: MediaClientConfig);
|
|
8
|
+
getImage: jest.Mock<any, any>;
|
|
9
|
+
getImageUrl: jest.Mock<any, any>;
|
|
10
|
+
getImageMetadata: jest.Mock<any, any>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FileState } from '../models/file-state';
|
|
2
|
+
export type EventPayloadMap<P> = {
|
|
3
|
+
readonly [event: string]: P;
|
|
4
|
+
};
|
|
5
|
+
export type EventPayloadListener<M extends EventPayloadMap<P>, E extends keyof M, P = any> = (payload: M[E]) => void;
|
|
6
|
+
export interface MediaViewedEventPayload {
|
|
7
|
+
fileId: string;
|
|
8
|
+
viewingLevel: 'minimal' | 'full' | 'download';
|
|
9
|
+
isUserCollection?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export type UploadEventPayloadMap = {
|
|
12
|
+
'file-added': FileState;
|
|
13
|
+
'media-viewed': MediaViewedEventPayload;
|
|
14
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { BaseMediaClientError } from '../../models/errors';
|
|
2
|
+
export type FileFetcherErrorReason = 'invalidFileId' | 'emptyItems' | 'zeroVersionFile';
|
|
3
|
+
export type FileFetcherErrorAttributes = {
|
|
4
|
+
readonly reason: FileFetcherErrorReason;
|
|
5
|
+
readonly id: string;
|
|
6
|
+
readonly metadata?: {
|
|
7
|
+
readonly collectionName?: string;
|
|
8
|
+
readonly occurrenceKey?: string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export declare class FileFetcherError extends BaseMediaClientError<FileFetcherErrorAttributes> {
|
|
12
|
+
readonly reason: FileFetcherErrorReason;
|
|
13
|
+
readonly id: string;
|
|
14
|
+
readonly metadata?: {
|
|
15
|
+
readonly collectionName?: string | undefined;
|
|
16
|
+
readonly occurrenceKey?: string | undefined;
|
|
17
|
+
} | undefined;
|
|
18
|
+
constructor(reason: FileFetcherErrorReason, id: string, metadata?: {
|
|
19
|
+
readonly collectionName?: string | undefined;
|
|
20
|
+
readonly occurrenceKey?: string | undefined;
|
|
21
|
+
} | undefined);
|
|
22
|
+
get attributes(): {
|
|
23
|
+
reason: FileFetcherErrorReason;
|
|
24
|
+
id: string;
|
|
25
|
+
collectionName: string | undefined;
|
|
26
|
+
occurrenceKey: string | undefined;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export declare function isFileFetcherError(err: Error): err is FileFetcherError;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import 'setimmediate';
|
|
2
|
+
import { AuthProvider } from '@atlaskit/media-core';
|
|
3
|
+
import { MediaStore, MediaStoreCopyFileWithTokenParams, TouchedFiles, TouchFileDescriptor } from '../media-store';
|
|
4
|
+
import { FilePreview, FileState, GetFileOptions } from '../../models/file-state';
|
|
5
|
+
import { MediaFile } from '../../models/media';
|
|
6
|
+
import { UploadableFile, UploadableFileUpfrontIds } from '../../uploader';
|
|
7
|
+
import { MediaFileArtifacts } from '../../models/artifacts';
|
|
8
|
+
import { UploadController } from '../../upload-controller';
|
|
9
|
+
import { MediaSubscribable } from '../../utils/mediaSubscribable';
|
|
10
|
+
import { Dimensions } from '../../utils/getDimensionsFromBlob';
|
|
11
|
+
import { MediaFeatureFlags, MediaTraceContext } from '@atlaskit/media-common';
|
|
12
|
+
export type { FileFetcherErrorAttributes, FileFetcherErrorReason, } from './error';
|
|
13
|
+
export { isFileFetcherError, FileFetcherError } from './error';
|
|
14
|
+
export interface CopySourceFile {
|
|
15
|
+
id: string;
|
|
16
|
+
collection?: string;
|
|
17
|
+
authProvider: AuthProvider;
|
|
18
|
+
}
|
|
19
|
+
export interface CopyDestination extends MediaStoreCopyFileWithTokenParams {
|
|
20
|
+
authProvider: AuthProvider;
|
|
21
|
+
mediaStore?: MediaStore;
|
|
22
|
+
}
|
|
23
|
+
export interface CopyFileOptions {
|
|
24
|
+
preview?: FilePreview | Promise<FilePreview>;
|
|
25
|
+
mimeType?: string;
|
|
26
|
+
}
|
|
27
|
+
export type ExternalUploadPayload = {
|
|
28
|
+
uploadableFileUpfrontIds: UploadableFileUpfrontIds;
|
|
29
|
+
dimensions: Dimensions;
|
|
30
|
+
};
|
|
31
|
+
export interface FileFetcher {
|
|
32
|
+
getFileState(id: string, options?: GetFileOptions): MediaSubscribable;
|
|
33
|
+
getArtifactURL(artifacts: MediaFileArtifacts, artifactName: keyof MediaFileArtifacts, collectionName?: string): Promise<string>;
|
|
34
|
+
touchFiles(descriptors: TouchFileDescriptor[], collection?: string, traceContext?: MediaTraceContext): Promise<TouchedFiles>;
|
|
35
|
+
upload(file: UploadableFile, controller?: UploadController, uploadableFileUpfrontIds?: UploadableFileUpfrontIds, traceContext?: MediaTraceContext, featureFlags?: MediaFeatureFlags): MediaSubscribable;
|
|
36
|
+
uploadExternal(url: string, collection?: string, traceContext?: MediaTraceContext): Promise<ExternalUploadPayload>;
|
|
37
|
+
downloadBinary(id: string, name?: string, collectionName?: string): Promise<void>;
|
|
38
|
+
getCurrentState(id: string, options?: GetFileOptions): Promise<FileState>;
|
|
39
|
+
copyFile(source: CopySourceFile, destination: CopyDestination, options?: CopyFileOptions, traceContext?: MediaTraceContext): Promise<MediaFile>;
|
|
40
|
+
getFileBinaryURL(id: string, collectionName?: string): Promise<string>;
|
|
41
|
+
}
|
|
42
|
+
export declare class FileFetcherImpl implements FileFetcher {
|
|
43
|
+
private readonly mediaStore;
|
|
44
|
+
private readonly featureFlags?;
|
|
45
|
+
private readonly dataloader;
|
|
46
|
+
constructor(mediaStore: MediaStore, featureFlags?: MediaFeatureFlags | undefined);
|
|
47
|
+
getFileState(id: string, options?: GetFileOptions): MediaSubscribable;
|
|
48
|
+
getCurrentState(id: string, options?: GetFileOptions): Promise<FileState>;
|
|
49
|
+
getArtifactURL(artifacts: MediaFileArtifacts, artifactName: keyof MediaFileArtifacts, collectionName?: string): Promise<string>;
|
|
50
|
+
getFileBinaryURL(id: string, collectionName?: string): Promise<string>;
|
|
51
|
+
private createDownloadFileStream;
|
|
52
|
+
touchFiles(descriptors: TouchFileDescriptor[], collection?: string, traceContext?: MediaTraceContext): Promise<TouchedFiles>;
|
|
53
|
+
private generateUploadableFileUpfrontIds;
|
|
54
|
+
uploadExternal(url: string, collection?: string, traceContext?: MediaTraceContext): Promise<ExternalUploadPayload>;
|
|
55
|
+
private getUploadingFileStateBase;
|
|
56
|
+
private uploadAwlaysPullFileStates;
|
|
57
|
+
private uploadConditionallyPullFileStates;
|
|
58
|
+
upload(file: UploadableFile, controller?: UploadController, uploadableFileUpfrontIds?: UploadableFileUpfrontIds, traceContext?: MediaTraceContext, featureFlags?: MediaFeatureFlags): MediaSubscribable;
|
|
59
|
+
downloadBinary(id: string, name?: string, collectionName?: string): Promise<void>;
|
|
60
|
+
copyFile(source: CopySourceFile, destination: CopyDestination, options?: CopyFileOptions, traceContext?: MediaTraceContext): Promise<MediaFile>;
|
|
61
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { MediaClientConfig } from '@atlaskit/media-core';
|
|
2
|
+
import { MediaFeatureFlags, MediaTraceContext } from '@atlaskit/media-common';
|
|
3
|
+
import { MediaStore, MediaStoreGetFileImageParams, ImageMetadata } from './media-store';
|
|
4
|
+
import { FileFetcher } from './file-fetcher';
|
|
5
|
+
import { UploadEventPayloadMap, EventPayloadListener } from './events';
|
|
6
|
+
import { StargateClient } from './stargate-client';
|
|
7
|
+
import { MobileUpload } from '../models/mobile-upload';
|
|
8
|
+
export declare class MediaClient {
|
|
9
|
+
readonly mediaClientConfig: MediaClientConfig;
|
|
10
|
+
readonly featureFlags?: MediaFeatureFlags | undefined;
|
|
11
|
+
readonly mediaStore: MediaStore;
|
|
12
|
+
readonly file: FileFetcher;
|
|
13
|
+
readonly stargate: StargateClient;
|
|
14
|
+
private readonly eventEmitter;
|
|
15
|
+
private mobileUpload?;
|
|
16
|
+
readonly config: MediaClientConfig;
|
|
17
|
+
constructor(mediaClientConfig: MediaClientConfig, featureFlags?: MediaFeatureFlags | undefined);
|
|
18
|
+
getImage(id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean, traceContext?: MediaTraceContext): Promise<Blob>;
|
|
19
|
+
getImageUrl(id: string, params?: MediaStoreGetFileImageParams): Promise<string>;
|
|
20
|
+
getImageUrlSync(id: string, params?: MediaStoreGetFileImageParams): string;
|
|
21
|
+
getImageMetadata(id: string, params?: MediaStoreGetFileImageParams): Promise<ImageMetadata>;
|
|
22
|
+
mobileUploadPromise(): Promise<MobileUpload>;
|
|
23
|
+
removeFileFromCollection(id: string, collectionName: string, occurrenceKey?: string, traceContext?: MediaTraceContext): Promise<void>;
|
|
24
|
+
on<E extends keyof UploadEventPayloadMap>(event: E, listener: EventPayloadListener<UploadEventPayloadMap, E>): void;
|
|
25
|
+
off<E extends keyof UploadEventPayloadMap>(event: E, listener: EventPayloadListener<UploadEventPayloadMap, E>): void;
|
|
26
|
+
emit<E extends keyof UploadEventPayloadMap>(event: E, payload: UploadEventPayloadMap[E]): boolean;
|
|
27
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseMediaClientError } from '../../models/errors';
|
|
2
|
+
export type MediaStoreErrorReason = 'failedAuthProvider' | 'tokenExpired' | 'missingInitialAuth' | 'emptyAuth' | 'authProviderTimedOut';
|
|
3
|
+
export type MediaStoreErrorAttributes = {
|
|
4
|
+
readonly reason: MediaStoreErrorReason;
|
|
5
|
+
readonly innerError?: Error;
|
|
6
|
+
};
|
|
7
|
+
export declare class MediaStoreError extends BaseMediaClientError<MediaStoreErrorAttributes> {
|
|
8
|
+
readonly reason: MediaStoreErrorReason;
|
|
9
|
+
readonly innerError?: Error | undefined;
|
|
10
|
+
constructor(reason: MediaStoreErrorReason, innerError?: Error | undefined);
|
|
11
|
+
get attributes(): {
|
|
12
|
+
reason: MediaStoreErrorReason;
|
|
13
|
+
innerError: Error | undefined;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export declare function isMediaStoreError(err: Error): err is MediaStoreError;
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { AsapBasedAuth, AuthContext, ClientAltBasedAuth, MediaApiConfig, Auth } from '@atlaskit/media-core';
|
|
2
|
+
import { MediaFeatureFlags, MediaTraceContext } from '@atlaskit/media-common';
|
|
3
|
+
import { MediaFileArtifacts } from '../../models/artifacts';
|
|
4
|
+
import { MediaChunksProbe, MediaItemDetails, MediaFile, MediaUpload } from '../../models/media';
|
|
5
|
+
import { ClientOptions, RequestHeaders, RequestMethod, RequestParams, RequestMetadata } from '../../utils/request/types';
|
|
6
|
+
export type { MediaStoreErrorReason, MediaStoreErrorAttributes } from './error';
|
|
7
|
+
export { MediaStoreError, isMediaStoreError } from './error';
|
|
8
|
+
export declare class MediaStore {
|
|
9
|
+
private readonly config;
|
|
10
|
+
readonly featureFlags?: MediaFeatureFlags | undefined;
|
|
11
|
+
constructor(config: MediaApiConfig, featureFlags?: MediaFeatureFlags | undefined);
|
|
12
|
+
removeCollectionFile(id: string, collectionName: string, occurrenceKey?: string, traceContext?: MediaTraceContext): Promise<void>;
|
|
13
|
+
createUpload(createUpTo?: number, collectionName?: string, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaUpload[]>>;
|
|
14
|
+
uploadChunk(etag: string, blob: Blob, uploadId: string, partNumber: number, collectionName?: string, traceContext?: MediaTraceContext): Promise<void>;
|
|
15
|
+
probeChunks(chunks: string[], uploadId: string, collectionName?: string, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaChunksProbe>>;
|
|
16
|
+
createFileFromUpload(body: MediaStoreCreateFileFromUploadBody, params?: MediaStoreCreateFileFromUploadParams, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaFile>>;
|
|
17
|
+
getRejectedResponseFromDescriptor(descriptor: TouchFileDescriptor, limit: number): RejectedTouchFile;
|
|
18
|
+
touchFiles(body: MediaStoreTouchFileBody, params?: MediaStoreTouchFileParams, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<TouchedFiles>>;
|
|
19
|
+
getFile(fileId: string, params?: MediaStoreGetFileParams, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaFile>>;
|
|
20
|
+
getFileImageURL(id: string, params?: MediaStoreGetFileImageParams): Promise<string>;
|
|
21
|
+
getFileImageURLSync(id: string, params?: MediaStoreGetFileImageParams): string;
|
|
22
|
+
private createFileImageURL;
|
|
23
|
+
getFileBinaryURL(id: string, collectionName?: string): Promise<string>;
|
|
24
|
+
getArtifactURL(artifacts: MediaFileArtifacts, artifactName: keyof MediaFileArtifacts, collectionName?: string): Promise<string>;
|
|
25
|
+
getImage(id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean, traceContext?: MediaTraceContext): Promise<Blob>;
|
|
26
|
+
getItems(ids: string[], collectionName?: string, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<ItemsPayload>>;
|
|
27
|
+
getImageMetadata(id: string, params?: MediaStoreGetFileImageParams, traceContext?: MediaTraceContext): Promise<{
|
|
28
|
+
metadata: ImageMetadata;
|
|
29
|
+
}>;
|
|
30
|
+
appendChunksToUpload(uploadId: string, body: AppendChunksToUploadRequestBody, collectionName?: string, traceContext?: MediaTraceContext): Promise<void>;
|
|
31
|
+
copyFileWithToken(body: MediaStoreCopyFileWithTokenBody, params: MediaStoreCopyFileWithTokenParams, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaFile>>;
|
|
32
|
+
request(path: string, options?: MediaStoreRequestOptions, controller?: AbortController): Promise<Response>;
|
|
33
|
+
resolveAuth: (authContext?: AuthContext) => Promise<Auth>;
|
|
34
|
+
resolveInitialAuth: () => Auth;
|
|
35
|
+
}
|
|
36
|
+
export declare const getMediaEnvironment: () => string | undefined;
|
|
37
|
+
export declare const getMediaRegion: () => string | undefined;
|
|
38
|
+
export interface ResponseFileItem {
|
|
39
|
+
id: string;
|
|
40
|
+
type: 'file';
|
|
41
|
+
details: MediaItemDetails;
|
|
42
|
+
collection?: string;
|
|
43
|
+
metadataTraceContext?: MediaTraceContext;
|
|
44
|
+
}
|
|
45
|
+
export interface ItemsPayload {
|
|
46
|
+
items: ResponseFileItem[];
|
|
47
|
+
}
|
|
48
|
+
export type ImageMetadataArtifact = {
|
|
49
|
+
url?: string;
|
|
50
|
+
width?: number;
|
|
51
|
+
height?: number;
|
|
52
|
+
size?: number;
|
|
53
|
+
};
|
|
54
|
+
export interface ImageMetadata {
|
|
55
|
+
pending: boolean;
|
|
56
|
+
preview?: ImageMetadataArtifact;
|
|
57
|
+
original?: ImageMetadataArtifact;
|
|
58
|
+
}
|
|
59
|
+
export interface MediaStoreResponse<Data> {
|
|
60
|
+
readonly data: Data;
|
|
61
|
+
}
|
|
62
|
+
export type MediaStoreRequestOptions = RequestMetadata & {
|
|
63
|
+
readonly method?: RequestMethod;
|
|
64
|
+
readonly authContext?: AuthContext;
|
|
65
|
+
readonly params?: RequestParams;
|
|
66
|
+
readonly headers?: RequestHeaders;
|
|
67
|
+
readonly body?: any;
|
|
68
|
+
readonly clientOptions?: ClientOptions;
|
|
69
|
+
readonly traceContext?: MediaTraceContext;
|
|
70
|
+
readonly resolvedAuth?: Auth;
|
|
71
|
+
};
|
|
72
|
+
export type MediaStoreCreateFileFromUploadParams = {
|
|
73
|
+
readonly collection?: string;
|
|
74
|
+
readonly occurrenceKey?: string;
|
|
75
|
+
readonly expireAfter?: number;
|
|
76
|
+
readonly replaceFileId?: string;
|
|
77
|
+
readonly skipConversions?: boolean;
|
|
78
|
+
};
|
|
79
|
+
export type MediaStoreCreateFileParams = {
|
|
80
|
+
readonly occurrenceKey?: string;
|
|
81
|
+
readonly collection?: string;
|
|
82
|
+
};
|
|
83
|
+
export interface MediaStoreTouchFileParams {
|
|
84
|
+
readonly collection?: string;
|
|
85
|
+
}
|
|
86
|
+
export interface TouchFileDescriptor {
|
|
87
|
+
fileId: string;
|
|
88
|
+
collection?: string;
|
|
89
|
+
occurrenceKey?: string;
|
|
90
|
+
expireAfter?: number;
|
|
91
|
+
deletable?: boolean;
|
|
92
|
+
size?: number;
|
|
93
|
+
}
|
|
94
|
+
export interface MediaStoreTouchFileBody {
|
|
95
|
+
descriptors: TouchFileDescriptor[];
|
|
96
|
+
}
|
|
97
|
+
export type MediaStoreCreateFileFromBinaryParams = {
|
|
98
|
+
readonly replaceFileId?: string;
|
|
99
|
+
readonly collection?: string;
|
|
100
|
+
readonly occurrenceKey?: string;
|
|
101
|
+
readonly expireAfter?: number;
|
|
102
|
+
readonly skipConversions?: boolean;
|
|
103
|
+
readonly name?: string;
|
|
104
|
+
};
|
|
105
|
+
export type MediaStoreCreateFileFromUploadConditions = {
|
|
106
|
+
readonly hash: string;
|
|
107
|
+
readonly size: number;
|
|
108
|
+
};
|
|
109
|
+
export type MediaStoreCreateFileFromUploadBody = {
|
|
110
|
+
readonly uploadId: string;
|
|
111
|
+
readonly name?: string;
|
|
112
|
+
readonly mimeType?: string;
|
|
113
|
+
readonly conditions?: MediaStoreCreateFileFromUploadConditions;
|
|
114
|
+
};
|
|
115
|
+
export type MediaStoreGetFileParams = {
|
|
116
|
+
readonly version?: number;
|
|
117
|
+
readonly collection?: string;
|
|
118
|
+
};
|
|
119
|
+
export type MediaStoreGetFileImageParams = {
|
|
120
|
+
readonly allowAnimated?: boolean;
|
|
121
|
+
readonly version?: number;
|
|
122
|
+
readonly collection?: string;
|
|
123
|
+
readonly width?: number;
|
|
124
|
+
readonly height?: number;
|
|
125
|
+
readonly mode?: 'fit' | 'full-fit' | 'crop';
|
|
126
|
+
readonly upscale?: boolean;
|
|
127
|
+
readonly 'max-age'?: number;
|
|
128
|
+
};
|
|
129
|
+
export interface SourceFile {
|
|
130
|
+
id: string;
|
|
131
|
+
owner: ClientAltBasedAuth | AsapBasedAuth;
|
|
132
|
+
collection?: string;
|
|
133
|
+
version?: number;
|
|
134
|
+
}
|
|
135
|
+
export type MediaStoreCopyFileWithTokenBody = {
|
|
136
|
+
sourceFile: SourceFile;
|
|
137
|
+
};
|
|
138
|
+
export type MediaStoreCopyFileWithTokenParams = {
|
|
139
|
+
readonly collection?: string;
|
|
140
|
+
readonly replaceFileId?: string;
|
|
141
|
+
readonly occurrenceKey?: string;
|
|
142
|
+
};
|
|
143
|
+
export type AppendChunksToUploadRequestBody = {
|
|
144
|
+
readonly chunks: string[];
|
|
145
|
+
readonly hash?: string;
|
|
146
|
+
readonly offset?: number;
|
|
147
|
+
};
|
|
148
|
+
export interface CreatedTouchedFile {
|
|
149
|
+
fileId: string;
|
|
150
|
+
uploadId: string;
|
|
151
|
+
}
|
|
152
|
+
export interface RejectedTouchFile {
|
|
153
|
+
fileId: string;
|
|
154
|
+
error: RejectionError;
|
|
155
|
+
}
|
|
156
|
+
export type RejectionError = {
|
|
157
|
+
code: 'ExceedMaxFileSizeLimit';
|
|
158
|
+
title: string;
|
|
159
|
+
href: string;
|
|
160
|
+
limit: number;
|
|
161
|
+
size: number;
|
|
162
|
+
};
|
|
163
|
+
export type TouchedFiles = {
|
|
164
|
+
created: CreatedTouchedFile[];
|
|
165
|
+
rejected: RejectedTouchFile[];
|
|
166
|
+
};
|
|
167
|
+
export interface EmptyFile {
|
|
168
|
+
readonly id: string;
|
|
169
|
+
readonly createdAt: number;
|
|
170
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Auth, AuthContext, AuthProvider } from '@atlaskit/media-core';
|
|
2
|
+
export declare const DEFAULT_AUTH_PROVIDER_TIMEOUT = 10000;
|
|
3
|
+
export declare const resolveAuth: (authProvider: AuthProvider, authContext?: AuthContext, authProviderTimeout?: number) => Promise<Auth>;
|
|
4
|
+
export declare const resolveInitialAuth: (auth?: Auth) => Auth;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { MobileUpload, MobileUploadStartEvent, MobileUploadProgressEvent, MobileUploadEndEvent, MobileUploadErrorEvent } from '../models/mobile-upload';
|
|
2
|
+
import { MediaStore } from './media-store';
|
|
3
|
+
export declare class MobileUploadImpl implements MobileUpload {
|
|
4
|
+
private readonly dataloader;
|
|
5
|
+
private readonly servicesCache;
|
|
6
|
+
constructor(mediaStore: MediaStore);
|
|
7
|
+
notifyUploadStart(event: MobileUploadStartEvent): void;
|
|
8
|
+
notifyUploadProgress(event: MobileUploadProgressEvent): void;
|
|
9
|
+
notifyUploadEnd(event: MobileUploadEndEvent): void;
|
|
10
|
+
notifyUploadError(event: MobileUploadErrorEvent): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface EdgeData {
|
|
2
|
+
data: {
|
|
3
|
+
clientId: string;
|
|
4
|
+
token: string;
|
|
5
|
+
baseUrl: string;
|
|
6
|
+
expiresIn: number;
|
|
7
|
+
iat: number;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export declare class StargateClient {
|
|
11
|
+
private baseUrl;
|
|
12
|
+
constructor(baseUrl: string | undefined);
|
|
13
|
+
fetchToken(clientId: string): Promise<EdgeData>;
|
|
14
|
+
isTokenExpired(token: EdgeData): boolean;
|
|
15
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const RECENTS_COLLECTION = "recents";
|
|
2
|
+
export declare const FILE_CACHE_MAX_AGE: number;
|
|
3
|
+
export declare const MAX_RESOLUTION = 4096;
|
|
4
|
+
export declare const CHUNK_SIZE: number;
|
|
5
|
+
export declare const PROCESSING_BATCH_SIZE = 1000;
|
|
6
|
+
export declare const MAX_UPLOAD_FILE_SIZE: number;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { LRUMap } from 'lru_map';
|
|
2
|
+
import { ReplaySubject } from 'rxjs/ReplaySubject';
|
|
3
|
+
import { FileState } from './models/file-state';
|
|
4
|
+
export declare class StreamsCache<T> {
|
|
5
|
+
private readonly streams;
|
|
6
|
+
constructor(streams: LRUMap<string, ReplaySubject<T>>);
|
|
7
|
+
has(id: string): boolean;
|
|
8
|
+
set(id: string, stream: ReplaySubject<T>): void;
|
|
9
|
+
get(id: string): ReplaySubject<T> | undefined;
|
|
10
|
+
getOrInsert(id: string, callback: () => ReplaySubject<T>): ReplaySubject<T>;
|
|
11
|
+
removeAll(): void;
|
|
12
|
+
remove(id: string): void;
|
|
13
|
+
get size(): number;
|
|
14
|
+
}
|
|
15
|
+
export declare const getFileStreamsCache: () => StreamsCache<FileState>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { UploadEventPayloadMap, EventPayloadListener } from './client/events';
|
|
2
|
+
export declare const globalMediaEventEmitter: {
|
|
3
|
+
on<E extends keyof UploadEventPayloadMap>(event: E, listener: EventPayloadListener<UploadEventPayloadMap, E, any>): void;
|
|
4
|
+
off<E_1 extends keyof UploadEventPayloadMap>(event: E_1, listener: EventPayloadListener<UploadEventPayloadMap, E_1, any>): void;
|
|
5
|
+
emit<E_2 extends keyof UploadEventPayloadMap>(event: E_2, payload: UploadEventPayloadMap[E_2]): boolean | undefined;
|
|
6
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type Identifier = FileIdentifier | ExternalImageIdentifier;
|
|
2
|
+
export interface FileIdentifier {
|
|
3
|
+
readonly mediaItemType: 'file';
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly occurrenceKey?: string;
|
|
6
|
+
readonly collectionName?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ExternalImageIdentifier {
|
|
9
|
+
readonly mediaItemType: 'external-image';
|
|
10
|
+
readonly dataURI: string;
|
|
11
|
+
readonly name?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const isFileIdentifier: (identifier: Identifier) => identifier is FileIdentifier;
|
|
14
|
+
export declare const isExternalImageIdentifier: (identifier: Identifier) => identifier is ExternalImageIdentifier;
|
|
15
|
+
export declare const isDifferentIdentifier: (a: Identifier, b: Identifier) => boolean;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
export { MediaStore, MediaStoreError, isMediaStoreError, getMediaEnvironment, getMediaRegion, } from './client/media-store';
|
|
2
|
+
export type { ResponseFileItem, ItemsPayload, ImageMetadataArtifact, ImageMetadata, MediaStoreResponse, MediaStoreRequestOptions, MediaStoreCreateFileFromUploadParams, MediaStoreCreateFileParams, MediaStoreTouchFileParams, TouchFileDescriptor, MediaStoreTouchFileBody, MediaStoreCreateFileFromBinaryParams, MediaStoreCreateFileFromUploadConditions, MediaStoreCreateFileFromUploadBody, MediaStoreGetFileParams, MediaStoreGetFileImageParams, SourceFile, MediaStoreCopyFileWithTokenBody, MediaStoreCopyFileWithTokenParams, AppendChunksToUploadRequestBody, CreatedTouchedFile, TouchedFiles, EmptyFile, MediaStoreErrorReason, MediaStoreErrorAttributes, } from './client/media-store';
|
|
3
|
+
export { UploadController } from './upload-controller';
|
|
4
|
+
export type { AbortFunction } from './upload-controller';
|
|
5
|
+
export type { MediaItemType, FileItem, FileProcessingStatus, MediaArtifact, Artifacts, FileDetails, } from './models/item';
|
|
6
|
+
export { isPreviewableType } from './models/media';
|
|
7
|
+
export type { MediaFileProcessingStatus, MediaType, MediaFile, MediaRepresentations, MediaItemDetails, MediaUpload, MediaChunksProbe, } from './models/media';
|
|
8
|
+
export { getArtifactUrl } from './models/artifacts';
|
|
9
|
+
export type { MediaFileArtifact, MediaFileArtifacts } from './models/artifacts';
|
|
10
|
+
export { isMediaClientError, getMediaClientErrorReason } from './models/errors';
|
|
11
|
+
export type { MediaClientError, MediaClientErrorReason, MediaClientErrorAttributes, } from './models/errors';
|
|
12
|
+
export { isUploadingFileState, isProcessingFileState, isProcessedFileState, isErrorFileState, isPreviewableFileState, isFinalFileState, isImageRepresentationReady, mapMediaFileToFileState, mapMediaItemToFileState, } from './models/file-state';
|
|
13
|
+
export type { FileStatus, FilePreview, PreviewOptions, GetFileOptions, UploadingFileState, ProcessingFileState, ProcessedFileState, ProcessingFailedState, ErrorFileState, NonErrorFileState, PreviewableFileState, FileState, } from './models/file-state';
|
|
14
|
+
export type { MobileUpload, MobileUploadStartEvent, MobileUploadProgressEvent, MobileUploadEndEvent, MobileUploadErrorEvent, } from './models/mobile-upload';
|
|
15
|
+
export { uploadFile } from './uploader';
|
|
16
|
+
export type { UploadableFile, UploadableFileUpfrontIds, UploadFileCallbacks, UploadFileResult, } from './uploader';
|
|
17
|
+
export { request, RequestError, isRequestError, isRateLimitedError, } from './utils/request';
|
|
18
|
+
export type { RequestErrorReason, RequestErrorMetadata, RequestErrorAttributes, } from './utils/request';
|
|
19
|
+
export { isAbortedRequestError, mapResponseToJson, mapResponseToBlob, mapResponseToVoid, createUrl, } from './utils/request/helpers';
|
|
20
|
+
export { PollingFunction } from './utils/polling';
|
|
21
|
+
export { isPollingError, PollingError } from './utils/polling/errors';
|
|
22
|
+
export type { Executor, PollingErrorAttributes, PollingErrorReason, } from './utils/polling/types';
|
|
23
|
+
export type { RequestMethod, RequestParams, RequestHeaders, RetryOptions, ClientOptions, RequestMetadata, RequestOptions, CreateUrlOptions, } from './utils/request/types';
|
|
24
|
+
export type { ImageResizeMode } from './utils/imageResizeModeToFileImageMode';
|
|
25
|
+
export { imageResizeModeToFileImageMode } from './utils/imageResizeModeToFileImageMode';
|
|
26
|
+
export { FileFetcherImpl, FileFetcherError, isFileFetcherError, } from './client/file-fetcher';
|
|
27
|
+
export type { CopySourceFile, CopyDestination, CopyFileOptions, FileFetcher, FileFetcherErrorAttributes, FileFetcherErrorReason, } from './client/file-fetcher';
|
|
28
|
+
export { MediaClient } from './client/media-client';
|
|
29
|
+
export { StargateClient } from './client/stargate-client';
|
|
30
|
+
export type { EdgeData } from './client/stargate-client';
|
|
31
|
+
export { isImageRemote } from './utils/isImageRemote';
|
|
32
|
+
export { checkWebpSupport } from './utils/checkWebpSupport';
|
|
33
|
+
export { getDimensionsFromBlob } from './utils/getDimensionsFromBlob';
|
|
34
|
+
export type { Dimensions } from './utils/getDimensionsFromBlob';
|
|
35
|
+
export { createMediaSubject } from './utils/createMediaSubject';
|
|
36
|
+
export { safeUnsubscribe } from './utils/safeUnsubscribe';
|
|
37
|
+
export { isFileIdentifier, isExternalImageIdentifier, isDifferentIdentifier, } from './identifier';
|
|
38
|
+
export type { Identifier, FileIdentifier, ExternalImageIdentifier, } from './identifier';
|
|
39
|
+
export type { EventPayloadListener, UploadEventPayloadMap, MediaViewedEventPayload, } from './client/events';
|
|
40
|
+
export { withMediaClient, getMediaClient } from './utils/with-media-client-hoc';
|
|
41
|
+
export type { WithMediaClientConfig, WithMediaClientConfigProps, WithMediaClientFunction, WithMediaClient, } from './utils/with-media-client-hoc';
|
|
42
|
+
export { globalMediaEventEmitter } from './globalMediaEventEmitter';
|
|
43
|
+
export { isMediaBlobUrl, getAttrsFromUrl, addFileAttrsToUrl, objectToQueryString, } from './utils/url';
|
|
44
|
+
export type { MediaBlobUrlAttrs } from './utils/url';
|
|
45
|
+
export { createMediaSubscribable, fromObservable, } from './utils/mediaSubscribable';
|
|
46
|
+
export type { MediaSubscribable, MediaSubscription, MediaObserver, } from './utils/mediaSubscribable';
|
|
47
|
+
export { RECENTS_COLLECTION, MAX_RESOLUTION } from './constants';
|
|
48
|
+
/**
|
|
49
|
+
* @deprecated This export will be removed. Please use one from @atlaskit/media-common or @atlaskit/media-common/mediaTypeUtils
|
|
50
|
+
*/
|
|
51
|
+
export declare const getMediaTypeFromMimeType: (mimeType: string) => import("@atlaskit/media-common").MediaType;
|
|
52
|
+
/**
|
|
53
|
+
* @deprecated This export will be removed. Please use one from @atlaskit/media-common or @atlaskit/media-common/mediaTypeUtils
|
|
54
|
+
*/
|
|
55
|
+
export declare const isImageMimeTypeSupportedByBrowser: (mimeType: string) => boolean;
|
|
56
|
+
/**
|
|
57
|
+
* @deprecated This export will be removed. Please use one from @atlaskit/media-common or @atlaskit/media-common/mediaTypeUtils
|
|
58
|
+
*/
|
|
59
|
+
export declare const isDocumentMimeTypeSupportedByBrowser: (mimeType: string) => boolean;
|
|
60
|
+
/**
|
|
61
|
+
* @deprecated This export will be removed. Please use one from @atlaskit/media-common or @atlaskit/media-common/mediaTypeUtils
|
|
62
|
+
*/
|
|
63
|
+
export declare const isMimeTypeSupportedByBrowser: (mimeType: string) => boolean;
|
|
64
|
+
/**
|
|
65
|
+
* @deprecated This export will be removed. Please use one from @atlaskit/media-common or @atlaskit/media-common/mediaTypeUtils
|
|
66
|
+
*/
|
|
67
|
+
export declare const isImageMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
68
|
+
/**
|
|
69
|
+
* @deprecated This export will be removed. Please use one from @atlaskit/media-common or @atlaskit/media-common/mediaTypeUtils
|
|
70
|
+
*/
|
|
71
|
+
export declare const isDocumentMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
72
|
+
/**
|
|
73
|
+
* @deprecated This export will be removed. Please use one from @atlaskit/media-common or @atlaskit/media-common/mediaTypeUtils
|
|
74
|
+
*/
|
|
75
|
+
export declare const isAudioMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
76
|
+
/**
|
|
77
|
+
* @deprecated This export will be removed. Please use one from @atlaskit/media-common or @atlaskit/media-common/mediaTypeUtils
|
|
78
|
+
*/
|
|
79
|
+
export declare const isVideoMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
80
|
+
/**
|
|
81
|
+
* @deprecated This export will be removed. Please use one from @atlaskit/media-common or @atlaskit/media-common/mediaTypeUtils
|
|
82
|
+
*/
|
|
83
|
+
export declare const isUnknownMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
84
|
+
/**
|
|
85
|
+
* @deprecated This export will be removed. Please use one from @atlaskit/media-common or @atlaskit/media-common/mediaTypeUtils
|
|
86
|
+
*/
|
|
87
|
+
export declare const isMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { MediaFileProcessingStatus } from './media';
|
|
2
|
+
export type MediaFileArtifact = {
|
|
3
|
+
readonly url: string;
|
|
4
|
+
readonly processingStatus: MediaFileProcessingStatus;
|
|
5
|
+
};
|
|
6
|
+
export interface MediaFileArtifacts {
|
|
7
|
+
'video_1280.mp4'?: MediaFileArtifact;
|
|
8
|
+
'video_640.mp4'?: MediaFileArtifact;
|
|
9
|
+
'document.pdf'?: MediaFileArtifact;
|
|
10
|
+
'audio.mp3'?: MediaFileArtifact;
|
|
11
|
+
}
|
|
12
|
+
export declare const getArtifactUrl: (artifacts: MediaFileArtifacts, prop: keyof MediaFileArtifacts) => string | undefined;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Auth } from '@atlaskit/media-core';
|
|
2
|
+
export interface ClientBasedAuthHeaders {
|
|
3
|
+
readonly 'X-Client-Id': string;
|
|
4
|
+
readonly Authorization: string;
|
|
5
|
+
}
|
|
6
|
+
export interface AsapBasedAuthHeaders {
|
|
7
|
+
readonly 'X-Issuer': string;
|
|
8
|
+
readonly Authorization: string;
|
|
9
|
+
}
|
|
10
|
+
export type AuthHeaders = ClientBasedAuthHeaders | AsapBasedAuthHeaders;
|
|
11
|
+
export declare function mapAuthToAuthHeaders(auth: Auth): AuthHeaders;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Auth } from '@atlaskit/media-core';
|
|
2
|
+
export interface ClientBasedQueryParameters {
|
|
3
|
+
readonly client: string;
|
|
4
|
+
readonly token: string;
|
|
5
|
+
}
|
|
6
|
+
export interface AsapBasedQueryParameters {
|
|
7
|
+
readonly issuer: string;
|
|
8
|
+
readonly token: string;
|
|
9
|
+
}
|
|
10
|
+
export type AuthQueryParameters = ClientBasedQueryParameters | AsapBasedQueryParameters;
|
|
11
|
+
export declare function mapAuthToQueryParameters(auth: Auth): AuthQueryParameters;
|