@atlaskit/media-client 29.1.0 → 31.0.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 +39 -0
- package/dist/cjs/client/file-fetcher/error.js +12 -10
- package/dist/cjs/client/file-fetcher/index.js +54 -61
- package/dist/cjs/client/media-store/error.js +4 -5
- package/dist/cjs/index.js +18 -0
- package/dist/cjs/models/errors/index.js +68 -5
- package/dist/cjs/models/errors/types.js +5 -1
- package/dist/cjs/models/file-state.js +4 -1
- package/dist/cjs/uploader/error.js +11 -9
- package/dist/cjs/uploader/index.js +2 -1
- package/dist/cjs/utils/mobileUpload/error.js +12 -10
- package/dist/cjs/utils/mobileUpload/helpers.js +4 -2
- package/dist/cjs/utils/polling/errors.js +6 -7
- package/dist/cjs/utils/polling/index.js +6 -2
- package/dist/cjs/utils/request/errors.js +4 -6
- package/dist/cjs/utils/request/helpers.js +8 -3
- package/dist/es2019/client/file-fetcher/error.js +10 -7
- package/dist/es2019/client/file-fetcher/index.js +36 -48
- package/dist/es2019/client/media-store/error.js +4 -3
- package/dist/es2019/index.js +2 -2
- package/dist/es2019/models/errors/index.js +62 -5
- package/dist/es2019/models/errors/types.js +1 -0
- package/dist/es2019/models/file-state.js +1 -0
- package/dist/es2019/uploader/error.js +10 -7
- package/dist/es2019/uploader/index.js +2 -1
- package/dist/es2019/utils/mobileUpload/error.js +10 -7
- package/dist/es2019/utils/mobileUpload/helpers.js +4 -2
- package/dist/es2019/utils/polling/errors.js +8 -5
- package/dist/es2019/utils/polling/index.js +6 -2
- package/dist/es2019/utils/request/errors.js +4 -4
- package/dist/es2019/utils/request/helpers.js +8 -3
- package/dist/esm/client/file-fetcher/error.js +12 -10
- package/dist/esm/client/file-fetcher/index.js +55 -62
- package/dist/esm/client/media-store/error.js +4 -5
- package/dist/esm/index.js +2 -2
- package/dist/esm/models/errors/index.js +67 -4
- package/dist/esm/models/errors/types.js +1 -0
- package/dist/esm/models/file-state.js +3 -0
- package/dist/esm/uploader/error.js +11 -9
- package/dist/esm/uploader/index.js +2 -1
- package/dist/esm/utils/mobileUpload/error.js +12 -10
- package/dist/esm/utils/mobileUpload/helpers.js +4 -2
- package/dist/esm/utils/polling/errors.js +6 -7
- package/dist/esm/utils/polling/index.js +6 -2
- package/dist/esm/utils/request/errors.js +4 -6
- package/dist/esm/utils/request/helpers.js +8 -3
- package/dist/types/client/file-fetcher/error.d.ts +9 -12
- package/dist/types/client/media-store/error.d.ts +3 -4
- package/dist/types/index.d.ts +2 -2
- package/dist/types/models/errors/index.d.ts +17 -4
- package/dist/types/models/errors/types.d.ts +7 -0
- package/dist/types/models/file-state.d.ts +2 -0
- package/dist/types/uploader/error.d.ts +8 -10
- package/dist/types/utils/mobileUpload/error.d.ts +9 -12
- package/dist/types/utils/polling/errors.d.ts +4 -5
- package/dist/types/utils/polling/types.d.ts +3 -0
- package/dist/types/utils/request/errors.d.ts +3 -5
- package/dist/types-ts4.5/client/file-fetcher/error.d.ts +9 -12
- package/dist/types-ts4.5/client/media-store/error.d.ts +3 -4
- package/dist/types-ts4.5/index.d.ts +2 -2
- package/dist/types-ts4.5/models/errors/index.d.ts +17 -4
- package/dist/types-ts4.5/models/errors/types.d.ts +7 -0
- package/dist/types-ts4.5/models/file-state.d.ts +2 -0
- package/dist/types-ts4.5/uploader/error.d.ts +8 -10
- package/dist/types-ts4.5/utils/mobileUpload/error.d.ts +9 -12
- package/dist/types-ts4.5/utils/polling/errors.d.ts +4 -5
- package/dist/types-ts4.5/utils/polling/types.d.ts +3 -0
- package/dist/types-ts4.5/utils/request/errors.d.ts +3 -5
- package/package.json +3 -3
package/dist/types/index.d.ts
CHANGED
|
@@ -6,9 +6,9 @@ export type { MediaItemType, FileItem, FileProcessingStatus, MediaArtifact, Arti
|
|
|
6
6
|
export { isPreviewableType } from './models/media';
|
|
7
7
|
export type { MediaFileProcessingStatus, MediaType, MediaFile, MediaRepresentations, MediaItemDetails, MediaUpload, } from './models/media';
|
|
8
8
|
export { getArtifactUrl } from './models/artifacts';
|
|
9
|
-
export { isMediaClientError, getMediaClientErrorReason } from './models/errors';
|
|
9
|
+
export { isMediaClientError, getMediaClientErrorReason, isCommonMediaClientError, toCommonMediaClientError, } from './models/errors';
|
|
10
10
|
export type { MediaClientError, MediaClientErrorReason, MediaClientErrorAttributes, } from './models/errors';
|
|
11
|
-
export { isUploadingFileState, isProcessingFileState, isProcessedFileState, isErrorFileState, isPreviewableFileState, isFinalFileState, isImageRepresentationReady, mapMediaFileToFileState, mapMediaItemToFileState, } from './models/file-state';
|
|
11
|
+
export { isUploadingFileState, isProcessingFileState, isProcessedFileState, isErrorFileState, isPreviewableFileState, isFinalFileState, isImageRepresentationReady, isNonErrorFinalFileState, mapMediaFileToFileState, mapMediaItemToFileState, } from './models/file-state';
|
|
12
12
|
export type { FileStatus, PreviewOptions, GetFileOptions, NonErrorFileState, PreviewableFileState, } from './models/file-state';
|
|
13
13
|
export type { FileState, FilePreview, ErrorFileState, UploadingFileState, ProcessingFileState, ProcessedFileState, ProcessingFailedState, MediaFileArtifact, MediaFileArtifacts, } from '@atlaskit/media-state';
|
|
14
14
|
export type { MobileUpload, MobileUploadStartEvent, MobileUploadProgressEvent, MobileUploadEndEvent, MobileUploadErrorEvent, } from './models/mobile-upload';
|
|
@@ -1,11 +1,24 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { ErrorFileState } from '@atlaskit/media-state';
|
|
2
|
+
import type { MediaClientError, MediaClientErrorAttributes, MediaClientErrorReason, MediaClientErrorMetadata } from './types';
|
|
2
3
|
export type { MediaClientError, MediaClientErrorReason, MediaClientErrorAttributes } from './types';
|
|
3
4
|
export { isMediaClientError, getMediaClientErrorReason } from './helpers';
|
|
4
5
|
/**
|
|
5
6
|
* Base class for media errors
|
|
6
7
|
*/
|
|
7
|
-
export declare abstract class BaseMediaClientError<Attributes extends MediaClientErrorAttributes> extends Error implements MediaClientError<Attributes> {
|
|
8
|
-
readonly
|
|
9
|
-
|
|
8
|
+
export declare abstract class BaseMediaClientError<Reason extends MediaClientErrorReason, Metadata extends MediaClientErrorMetadata | undefined, InnerError extends Error | undefined, Attributes extends MediaClientErrorAttributes> extends Error implements MediaClientError<Attributes> {
|
|
9
|
+
readonly reason: Reason;
|
|
10
|
+
readonly metadata: Metadata;
|
|
11
|
+
readonly innerError: InnerError;
|
|
12
|
+
constructor(reason: Reason, metadata: Metadata, innerError: InnerError);
|
|
10
13
|
abstract get attributes(): Attributes;
|
|
11
14
|
}
|
|
15
|
+
/** Generic Media Client Erorr. All errors extending BaseMediaClientError match CommonMediaClientError attributes. Used to deserialize ErrorFileState */
|
|
16
|
+
export declare class CommonMediaClientError extends BaseMediaClientError<MediaClientErrorReason, MediaClientErrorMetadata | undefined, Error | undefined, MediaClientErrorAttributes> {
|
|
17
|
+
constructor(reason: MediaClientErrorReason, metadata?: MediaClientErrorMetadata, innerError?: Error);
|
|
18
|
+
get attributes(): MediaClientErrorAttributes;
|
|
19
|
+
}
|
|
20
|
+
export declare function isCommonMediaClientError(error: any): error is BaseMediaClientError<MediaClientErrorReason, MediaClientErrorMetadata | undefined, Error | undefined, MediaClientErrorAttributes>;
|
|
21
|
+
/** Deserializer ErrorFileState -> CommonMediaClientError */
|
|
22
|
+
export declare const toCommonMediaClientError: (errorFileState: ErrorFileState) => CommonMediaClientError;
|
|
23
|
+
/** Serializer CommonMediaClientError -> ErrorFileState */
|
|
24
|
+
export declare const fromCommonMediaClientError: (id: string, occurrenceKey: string | undefined, error: CommonMediaClientError) => ErrorFileState;
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
+
import { type MediaTraceContext } from '@atlaskit/media-common';
|
|
2
|
+
export interface SerializableObject {
|
|
3
|
+
[key: string]: string | number | boolean | null | undefined | SerializableObject;
|
|
4
|
+
}
|
|
1
5
|
export type MediaClientErrorReason = 'clientOffline' | 'clientAbortedRequest' | 'clientTimeoutRequest' | 'serverInvalidBody' | 'serverBadRequest' | 'serverUnauthorized' | 'serverForbidden' | 'serverNotFound' | 'serverRateLimited' | 'serverInternalError' | 'serverBadGateway' | 'serverUnexpectedError' | 'failedAuthProvider' | 'tokenExpired' | 'missingInitialAuth' | 'emptyAuth' | 'authProviderTimedOut' | 'invalidFileId' | 'emptyItems' | 'zeroVersionFile' | 'emptyFileName' | 'pollingMaxAttemptsExceeded' | 'fileSizeExceedsLimit' | 'deprecatedEndpoint';
|
|
6
|
+
export type MediaClientErrorMetadata = SerializableObject & {
|
|
7
|
+
traceContext?: MediaTraceContext;
|
|
8
|
+
};
|
|
2
9
|
export interface MediaClientErrorAttributes {
|
|
3
10
|
reason: MediaClientErrorReason;
|
|
4
11
|
}
|
|
@@ -10,6 +10,7 @@ export interface GetFileOptions {
|
|
|
10
10
|
collectionName?: string;
|
|
11
11
|
occurrenceKey?: string;
|
|
12
12
|
includeHashForDuplicateFiles?: boolean;
|
|
13
|
+
forceRefresh?: boolean;
|
|
13
14
|
}
|
|
14
15
|
export interface PreviewableFileState {
|
|
15
16
|
preview: FilePreview | Promise<FilePreview>;
|
|
@@ -21,6 +22,7 @@ export declare const isProcessedFileState: (fileState: FileState) => fileState i
|
|
|
21
22
|
export declare const isErrorFileState: (fileState: FileState) => fileState is ErrorFileState;
|
|
22
23
|
export declare const isPreviewableFileState: (fileState: FileState) => fileState is (UploadingFileState | ProcessingFileState | ProcessedFileState | ProcessingFailedState) & PreviewableFileState;
|
|
23
24
|
export declare const isFinalFileState: (fileState: FileState) => fileState is ProcessedFileState | ErrorFileState | ProcessingFailedState;
|
|
25
|
+
export declare const isNonErrorFinalFileState: (fileState: FileState) => fileState is ProcessedFileState | ProcessingFailedState;
|
|
24
26
|
export declare const isImageRepresentationReady: (fileState: FileState) => boolean;
|
|
25
27
|
export declare const mapMediaFileToFileState: (mediaFile: MediaStoreResponse<MediaFile>) => FileState;
|
|
26
28
|
export declare const mapMediaItemToFileState: (id: string, item: MediaItemDetails) => FileState;
|
|
@@ -8,17 +8,15 @@ export type UploaderErrorAttributes = {
|
|
|
8
8
|
readonly occurrenceKey?: string;
|
|
9
9
|
};
|
|
10
10
|
};
|
|
11
|
-
export
|
|
12
|
-
readonly reason: UploaderErrorReason;
|
|
11
|
+
export type UploaderErrorMetadata = {
|
|
13
12
|
readonly id: string;
|
|
14
|
-
readonly
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
} | undefined);
|
|
13
|
+
readonly collectionName?: string;
|
|
14
|
+
readonly occurrenceKey?: string;
|
|
15
|
+
};
|
|
16
|
+
export declare class UploaderError extends BaseMediaClientError<UploaderErrorReason, UploaderErrorMetadata, undefined, UploaderErrorAttributes> {
|
|
17
|
+
readonly id: string;
|
|
18
|
+
constructor(reason: UploaderErrorReason, metadata: UploaderErrorMetadata);
|
|
19
|
+
/** Will be deprecated. Use the properties `reason` and `metadata` instead */
|
|
22
20
|
get attributes(): {
|
|
23
21
|
reason: "fileSizeExceedsLimit";
|
|
24
22
|
id: string;
|
|
@@ -10,19 +10,16 @@ export type MobileUploadErrorAttributes = {
|
|
|
10
10
|
readonly traceContext?: MediaTraceContext;
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
|
-
export
|
|
14
|
-
readonly reason: MobileUploadErrorReason;
|
|
13
|
+
export type MobileUploadErrorMetadata = {
|
|
15
14
|
readonly id: string;
|
|
16
|
-
readonly
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
readonly traceContext?: MediaTraceContext | undefined;
|
|
25
|
-
} | undefined);
|
|
15
|
+
readonly collectionName?: string;
|
|
16
|
+
readonly occurrenceKey?: string;
|
|
17
|
+
readonly traceContext?: MediaTraceContext;
|
|
18
|
+
};
|
|
19
|
+
export declare class MobileUploadError extends BaseMediaClientError<MobileUploadErrorReason, MobileUploadErrorMetadata, undefined, MobileUploadErrorAttributes> {
|
|
20
|
+
readonly id: string;
|
|
21
|
+
constructor(reason: MobileUploadErrorReason, metadata: MobileUploadErrorMetadata);
|
|
22
|
+
/** Will be deprecated. Use the properties `reason` and `metadata` instead */
|
|
26
23
|
get attributes(): {
|
|
27
24
|
reason: MobileUploadErrorReason;
|
|
28
25
|
id: string;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { BaseMediaClientError } from '../../models/errors';
|
|
2
|
-
import { type PollingErrorReason, type PollingErrorAttributes } from './types';
|
|
3
|
-
export declare class PollingError extends BaseMediaClientError<PollingErrorAttributes> {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
constructor(reason: PollingErrorReason, attempts: number);
|
|
2
|
+
import { type PollingErrorReason, type PollingErrorAttributes, type PollingErrorMetadata } from './types';
|
|
3
|
+
export declare class PollingError extends BaseMediaClientError<PollingErrorReason, PollingErrorMetadata, undefined, PollingErrorAttributes> {
|
|
4
|
+
constructor(reason: PollingErrorReason, metadata: PollingErrorMetadata);
|
|
5
|
+
/** Will be deprecated. Use the properties `reason` and `metadata` instead */
|
|
7
6
|
get attributes(): {
|
|
8
7
|
reason: "pollingMaxAttemptsExceeded";
|
|
9
8
|
attempts: number;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export type Executor = () => Promise<void>;
|
|
2
2
|
export type PollingErrorReason = 'pollingMaxAttemptsExceeded';
|
|
3
|
+
export type PollingErrorMetadata = {
|
|
4
|
+
attempts: number;
|
|
5
|
+
};
|
|
3
6
|
export type PollingErrorAttributes = {
|
|
4
7
|
readonly reason: PollingErrorReason;
|
|
5
8
|
readonly attempts: number;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { BaseMediaClientError } from '../../models/errors';
|
|
2
2
|
import { type RequestErrorReason, type RequestErrorMetadata, type RequestErrorAttributes } from './types';
|
|
3
|
-
export declare class RequestError extends BaseMediaClientError<RequestErrorAttributes> {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
readonly innerError?: Error | undefined;
|
|
7
|
-
constructor(reason: RequestErrorReason, metadata?: RequestErrorMetadata | undefined, innerError?: Error | undefined);
|
|
3
|
+
export declare class RequestError extends BaseMediaClientError<RequestErrorReason, RequestErrorMetadata | undefined, Error | undefined, RequestErrorAttributes> {
|
|
4
|
+
constructor(reason: RequestErrorReason, metadata?: RequestErrorMetadata, innerError?: Error);
|
|
5
|
+
/** Will be deprecated. Use the properties `reason` and `metadata` instead */
|
|
8
6
|
get attributes(): {
|
|
9
7
|
reason: RequestErrorReason;
|
|
10
8
|
method: import("./types").RequestMethod | undefined;
|
|
@@ -10,19 +10,16 @@ export type FileFetcherErrorAttributes = {
|
|
|
10
10
|
readonly traceContext?: MediaTraceContext;
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
|
-
export
|
|
14
|
-
readonly reason: FileFetcherErrorReason;
|
|
13
|
+
export type FileFetcherErrorMetadata = {
|
|
15
14
|
readonly id: string;
|
|
16
|
-
readonly
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
readonly traceContext?: MediaTraceContext | undefined;
|
|
25
|
-
} | undefined);
|
|
15
|
+
readonly collectionName?: string;
|
|
16
|
+
readonly occurrenceKey?: string;
|
|
17
|
+
readonly traceContext?: MediaTraceContext;
|
|
18
|
+
};
|
|
19
|
+
export declare class FileFetcherError extends BaseMediaClientError<FileFetcherErrorReason, FileFetcherErrorMetadata, undefined, FileFetcherErrorAttributes> {
|
|
20
|
+
readonly id: string;
|
|
21
|
+
constructor(reason: FileFetcherErrorReason, metadata: FileFetcherErrorMetadata);
|
|
22
|
+
/** Will be deprecated. Use the properties `reason` and `metadata` instead */
|
|
26
23
|
get attributes(): {
|
|
27
24
|
metadata?: {
|
|
28
25
|
traceContext: MediaTraceContext;
|
|
@@ -4,10 +4,9 @@ export type MediaStoreErrorAttributes = {
|
|
|
4
4
|
readonly reason: MediaStoreErrorReason;
|
|
5
5
|
readonly innerError?: Error;
|
|
6
6
|
};
|
|
7
|
-
export declare class MediaStoreError extends BaseMediaClientError<MediaStoreErrorAttributes> {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
constructor(reason: MediaStoreErrorReason, innerError?: Error | undefined);
|
|
7
|
+
export declare class MediaStoreError extends BaseMediaClientError<MediaStoreErrorReason, undefined, Error | undefined, MediaStoreErrorAttributes> {
|
|
8
|
+
constructor(reason: MediaStoreErrorReason, innerError?: Error);
|
|
9
|
+
/** Will be deprecated. Use the properties `reason` and `metadata` instead */
|
|
11
10
|
get attributes(): {
|
|
12
11
|
reason: MediaStoreErrorReason;
|
|
13
12
|
innerError: Error | undefined;
|
|
@@ -6,9 +6,9 @@ export type { MediaItemType, FileItem, FileProcessingStatus, MediaArtifact, Arti
|
|
|
6
6
|
export { isPreviewableType } from './models/media';
|
|
7
7
|
export type { MediaFileProcessingStatus, MediaType, MediaFile, MediaRepresentations, MediaItemDetails, MediaUpload, } from './models/media';
|
|
8
8
|
export { getArtifactUrl } from './models/artifacts';
|
|
9
|
-
export { isMediaClientError, getMediaClientErrorReason } from './models/errors';
|
|
9
|
+
export { isMediaClientError, getMediaClientErrorReason, isCommonMediaClientError, toCommonMediaClientError, } from './models/errors';
|
|
10
10
|
export type { MediaClientError, MediaClientErrorReason, MediaClientErrorAttributes, } from './models/errors';
|
|
11
|
-
export { isUploadingFileState, isProcessingFileState, isProcessedFileState, isErrorFileState, isPreviewableFileState, isFinalFileState, isImageRepresentationReady, mapMediaFileToFileState, mapMediaItemToFileState, } from './models/file-state';
|
|
11
|
+
export { isUploadingFileState, isProcessingFileState, isProcessedFileState, isErrorFileState, isPreviewableFileState, isFinalFileState, isImageRepresentationReady, isNonErrorFinalFileState, mapMediaFileToFileState, mapMediaItemToFileState, } from './models/file-state';
|
|
12
12
|
export type { FileStatus, PreviewOptions, GetFileOptions, NonErrorFileState, PreviewableFileState, } from './models/file-state';
|
|
13
13
|
export type { FileState, FilePreview, ErrorFileState, UploadingFileState, ProcessingFileState, ProcessedFileState, ProcessingFailedState, MediaFileArtifact, MediaFileArtifacts, } from '@atlaskit/media-state';
|
|
14
14
|
export type { MobileUpload, MobileUploadStartEvent, MobileUploadProgressEvent, MobileUploadEndEvent, MobileUploadErrorEvent, } from './models/mobile-upload';
|
|
@@ -1,11 +1,24 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { ErrorFileState } from '@atlaskit/media-state';
|
|
2
|
+
import type { MediaClientError, MediaClientErrorAttributes, MediaClientErrorReason, MediaClientErrorMetadata } from './types';
|
|
2
3
|
export type { MediaClientError, MediaClientErrorReason, MediaClientErrorAttributes } from './types';
|
|
3
4
|
export { isMediaClientError, getMediaClientErrorReason } from './helpers';
|
|
4
5
|
/**
|
|
5
6
|
* Base class for media errors
|
|
6
7
|
*/
|
|
7
|
-
export declare abstract class BaseMediaClientError<Attributes extends MediaClientErrorAttributes> extends Error implements MediaClientError<Attributes> {
|
|
8
|
-
readonly
|
|
9
|
-
|
|
8
|
+
export declare abstract class BaseMediaClientError<Reason extends MediaClientErrorReason, Metadata extends MediaClientErrorMetadata | undefined, InnerError extends Error | undefined, Attributes extends MediaClientErrorAttributes> extends Error implements MediaClientError<Attributes> {
|
|
9
|
+
readonly reason: Reason;
|
|
10
|
+
readonly metadata: Metadata;
|
|
11
|
+
readonly innerError: InnerError;
|
|
12
|
+
constructor(reason: Reason, metadata: Metadata, innerError: InnerError);
|
|
10
13
|
abstract get attributes(): Attributes;
|
|
11
14
|
}
|
|
15
|
+
/** Generic Media Client Erorr. All errors extending BaseMediaClientError match CommonMediaClientError attributes. Used to deserialize ErrorFileState */
|
|
16
|
+
export declare class CommonMediaClientError extends BaseMediaClientError<MediaClientErrorReason, MediaClientErrorMetadata | undefined, Error | undefined, MediaClientErrorAttributes> {
|
|
17
|
+
constructor(reason: MediaClientErrorReason, metadata?: MediaClientErrorMetadata, innerError?: Error);
|
|
18
|
+
get attributes(): MediaClientErrorAttributes;
|
|
19
|
+
}
|
|
20
|
+
export declare function isCommonMediaClientError(error: any): error is BaseMediaClientError<MediaClientErrorReason, MediaClientErrorMetadata | undefined, Error | undefined, MediaClientErrorAttributes>;
|
|
21
|
+
/** Deserializer ErrorFileState -> CommonMediaClientError */
|
|
22
|
+
export declare const toCommonMediaClientError: (errorFileState: ErrorFileState) => CommonMediaClientError;
|
|
23
|
+
/** Serializer CommonMediaClientError -> ErrorFileState */
|
|
24
|
+
export declare const fromCommonMediaClientError: (id: string, occurrenceKey: string | undefined, error: CommonMediaClientError) => ErrorFileState;
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
+
import { type MediaTraceContext } from '@atlaskit/media-common';
|
|
2
|
+
export interface SerializableObject {
|
|
3
|
+
[key: string]: string | number | boolean | null | undefined | SerializableObject;
|
|
4
|
+
}
|
|
1
5
|
export type MediaClientErrorReason = 'clientOffline' | 'clientAbortedRequest' | 'clientTimeoutRequest' | 'serverInvalidBody' | 'serverBadRequest' | 'serverUnauthorized' | 'serverForbidden' | 'serverNotFound' | 'serverRateLimited' | 'serverInternalError' | 'serverBadGateway' | 'serverUnexpectedError' | 'failedAuthProvider' | 'tokenExpired' | 'missingInitialAuth' | 'emptyAuth' | 'authProviderTimedOut' | 'invalidFileId' | 'emptyItems' | 'zeroVersionFile' | 'emptyFileName' | 'pollingMaxAttemptsExceeded' | 'fileSizeExceedsLimit' | 'deprecatedEndpoint';
|
|
6
|
+
export type MediaClientErrorMetadata = SerializableObject & {
|
|
7
|
+
traceContext?: MediaTraceContext;
|
|
8
|
+
};
|
|
2
9
|
export interface MediaClientErrorAttributes {
|
|
3
10
|
reason: MediaClientErrorReason;
|
|
4
11
|
}
|
|
@@ -10,6 +10,7 @@ export interface GetFileOptions {
|
|
|
10
10
|
collectionName?: string;
|
|
11
11
|
occurrenceKey?: string;
|
|
12
12
|
includeHashForDuplicateFiles?: boolean;
|
|
13
|
+
forceRefresh?: boolean;
|
|
13
14
|
}
|
|
14
15
|
export interface PreviewableFileState {
|
|
15
16
|
preview: FilePreview | Promise<FilePreview>;
|
|
@@ -21,6 +22,7 @@ export declare const isProcessedFileState: (fileState: FileState) => fileState i
|
|
|
21
22
|
export declare const isErrorFileState: (fileState: FileState) => fileState is ErrorFileState;
|
|
22
23
|
export declare const isPreviewableFileState: (fileState: FileState) => fileState is (UploadingFileState | ProcessingFileState | ProcessedFileState | ProcessingFailedState) & PreviewableFileState;
|
|
23
24
|
export declare const isFinalFileState: (fileState: FileState) => fileState is ProcessedFileState | ErrorFileState | ProcessingFailedState;
|
|
25
|
+
export declare const isNonErrorFinalFileState: (fileState: FileState) => fileState is ProcessedFileState | ProcessingFailedState;
|
|
24
26
|
export declare const isImageRepresentationReady: (fileState: FileState) => boolean;
|
|
25
27
|
export declare const mapMediaFileToFileState: (mediaFile: MediaStoreResponse<MediaFile>) => FileState;
|
|
26
28
|
export declare const mapMediaItemToFileState: (id: string, item: MediaItemDetails) => FileState;
|
|
@@ -8,17 +8,15 @@ export type UploaderErrorAttributes = {
|
|
|
8
8
|
readonly occurrenceKey?: string;
|
|
9
9
|
};
|
|
10
10
|
};
|
|
11
|
-
export
|
|
12
|
-
readonly reason: UploaderErrorReason;
|
|
11
|
+
export type UploaderErrorMetadata = {
|
|
13
12
|
readonly id: string;
|
|
14
|
-
readonly
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
} | undefined);
|
|
13
|
+
readonly collectionName?: string;
|
|
14
|
+
readonly occurrenceKey?: string;
|
|
15
|
+
};
|
|
16
|
+
export declare class UploaderError extends BaseMediaClientError<UploaderErrorReason, UploaderErrorMetadata, undefined, UploaderErrorAttributes> {
|
|
17
|
+
readonly id: string;
|
|
18
|
+
constructor(reason: UploaderErrorReason, metadata: UploaderErrorMetadata);
|
|
19
|
+
/** Will be deprecated. Use the properties `reason` and `metadata` instead */
|
|
22
20
|
get attributes(): {
|
|
23
21
|
reason: "fileSizeExceedsLimit";
|
|
24
22
|
id: string;
|
|
@@ -10,19 +10,16 @@ export type MobileUploadErrorAttributes = {
|
|
|
10
10
|
readonly traceContext?: MediaTraceContext;
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
|
-
export
|
|
14
|
-
readonly reason: MobileUploadErrorReason;
|
|
13
|
+
export type MobileUploadErrorMetadata = {
|
|
15
14
|
readonly id: string;
|
|
16
|
-
readonly
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
readonly traceContext?: MediaTraceContext | undefined;
|
|
25
|
-
} | undefined);
|
|
15
|
+
readonly collectionName?: string;
|
|
16
|
+
readonly occurrenceKey?: string;
|
|
17
|
+
readonly traceContext?: MediaTraceContext;
|
|
18
|
+
};
|
|
19
|
+
export declare class MobileUploadError extends BaseMediaClientError<MobileUploadErrorReason, MobileUploadErrorMetadata, undefined, MobileUploadErrorAttributes> {
|
|
20
|
+
readonly id: string;
|
|
21
|
+
constructor(reason: MobileUploadErrorReason, metadata: MobileUploadErrorMetadata);
|
|
22
|
+
/** Will be deprecated. Use the properties `reason` and `metadata` instead */
|
|
26
23
|
get attributes(): {
|
|
27
24
|
reason: MobileUploadErrorReason;
|
|
28
25
|
id: string;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { BaseMediaClientError } from '../../models/errors';
|
|
2
|
-
import { type PollingErrorReason, type PollingErrorAttributes } from './types';
|
|
3
|
-
export declare class PollingError extends BaseMediaClientError<PollingErrorAttributes> {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
constructor(reason: PollingErrorReason, attempts: number);
|
|
2
|
+
import { type PollingErrorReason, type PollingErrorAttributes, type PollingErrorMetadata } from './types';
|
|
3
|
+
export declare class PollingError extends BaseMediaClientError<PollingErrorReason, PollingErrorMetadata, undefined, PollingErrorAttributes> {
|
|
4
|
+
constructor(reason: PollingErrorReason, metadata: PollingErrorMetadata);
|
|
5
|
+
/** Will be deprecated. Use the properties `reason` and `metadata` instead */
|
|
7
6
|
get attributes(): {
|
|
8
7
|
reason: "pollingMaxAttemptsExceeded";
|
|
9
8
|
attempts: number;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export type Executor = () => Promise<void>;
|
|
2
2
|
export type PollingErrorReason = 'pollingMaxAttemptsExceeded';
|
|
3
|
+
export type PollingErrorMetadata = {
|
|
4
|
+
attempts: number;
|
|
5
|
+
};
|
|
3
6
|
export type PollingErrorAttributes = {
|
|
4
7
|
readonly reason: PollingErrorReason;
|
|
5
8
|
readonly attempts: number;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { BaseMediaClientError } from '../../models/errors';
|
|
2
2
|
import { type RequestErrorReason, type RequestErrorMetadata, type RequestErrorAttributes } from './types';
|
|
3
|
-
export declare class RequestError extends BaseMediaClientError<RequestErrorAttributes> {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
readonly innerError?: Error | undefined;
|
|
7
|
-
constructor(reason: RequestErrorReason, metadata?: RequestErrorMetadata | undefined, innerError?: Error | undefined);
|
|
3
|
+
export declare class RequestError extends BaseMediaClientError<RequestErrorReason, RequestErrorMetadata | undefined, Error | undefined, RequestErrorAttributes> {
|
|
4
|
+
constructor(reason: RequestErrorReason, metadata?: RequestErrorMetadata, innerError?: Error);
|
|
5
|
+
/** Will be deprecated. Use the properties `reason` and `metadata` instead */
|
|
8
6
|
get attributes(): {
|
|
9
7
|
reason: RequestErrorReason;
|
|
10
8
|
method: import("./types").RequestMethod | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-client",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "31.0.0",
|
|
4
4
|
"description": "Media API Web Client Library",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -55,9 +55,9 @@
|
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@atlaskit/media-core": "^34.4.0",
|
|
58
|
-
"@atlaskit/media-state": "^1.
|
|
58
|
+
"@atlaskit/media-state": "^1.5.0",
|
|
59
59
|
"@atlaskit/ssr": "*",
|
|
60
|
-
"@atlaskit/tokens": "^3.
|
|
60
|
+
"@atlaskit/tokens": "^3.2.0",
|
|
61
61
|
"@atlassian/feature-flags-test-utils": "0.2.3",
|
|
62
62
|
"@emotion/react": "^11.7.1",
|
|
63
63
|
"@types/deep-equal": "^1.0.1",
|