@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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/media-client
|
|
2
2
|
|
|
3
|
+
## 22.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`9d00501a414`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9d00501a414) - Ensure legacy types are published for TS 4.5-4.8
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
|
|
10
|
+
## 22.0.1
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [`41fae2c6f68`](https://bitbucket.org/atlassian/atlassian-frontend/commits/41fae2c6f68) - Upgrade Typescript from `4.5.5` to `4.9.5`
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 22.0.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
package/constants/package.json
CHANGED
package/dist/cjs/version.json
CHANGED
package/dist/es2019/version.json
CHANGED
package/dist/esm/version.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { FileState } from '../models/file-state';
|
|
2
|
-
export
|
|
2
|
+
export type EventPayloadMap<P> = {
|
|
3
3
|
readonly [event: string]: P;
|
|
4
4
|
};
|
|
5
|
-
export
|
|
5
|
+
export type EventPayloadListener<M extends EventPayloadMap<P>, E extends keyof M, P = any> = (payload: M[E]) => void;
|
|
6
6
|
export interface MediaViewedEventPayload {
|
|
7
7
|
fileId: string;
|
|
8
8
|
viewingLevel: 'minimal' | 'full' | 'download';
|
|
9
9
|
isUserCollection?: boolean;
|
|
10
10
|
}
|
|
11
|
-
export
|
|
11
|
+
export type UploadEventPayloadMap = {
|
|
12
12
|
'file-added': FileState;
|
|
13
13
|
'media-viewed': MediaViewedEventPayload;
|
|
14
14
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseMediaClientError } from '../../models/errors';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
2
|
+
export type FileFetcherErrorReason = 'invalidFileId' | 'emptyItems' | 'zeroVersionFile';
|
|
3
|
+
export type FileFetcherErrorAttributes = {
|
|
4
4
|
readonly reason: FileFetcherErrorReason;
|
|
5
5
|
readonly id: string;
|
|
6
6
|
readonly metadata?: {
|
|
@@ -24,7 +24,7 @@ export interface CopyFileOptions {
|
|
|
24
24
|
preview?: FilePreview | Promise<FilePreview>;
|
|
25
25
|
mimeType?: string;
|
|
26
26
|
}
|
|
27
|
-
export
|
|
27
|
+
export type ExternalUploadPayload = {
|
|
28
28
|
uploadableFileUpfrontIds: UploadableFileUpfrontIds;
|
|
29
29
|
dimensions: Dimensions;
|
|
30
30
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseMediaClientError } from '../../models/errors';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
2
|
+
export type MediaStoreErrorReason = 'failedAuthProvider' | 'tokenExpired' | 'missingInitialAuth' | 'emptyAuth' | 'authProviderTimedOut';
|
|
3
|
+
export type MediaStoreErrorAttributes = {
|
|
4
4
|
readonly reason: MediaStoreErrorReason;
|
|
5
5
|
readonly innerError?: Error;
|
|
6
6
|
};
|
|
@@ -30,7 +30,7 @@ export declare class MediaStore {
|
|
|
30
30
|
appendChunksToUpload(uploadId: string, body: AppendChunksToUploadRequestBody, collectionName?: string, traceContext?: MediaTraceContext): Promise<void>;
|
|
31
31
|
copyFileWithToken(body: MediaStoreCopyFileWithTokenBody, params: MediaStoreCopyFileWithTokenParams, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaFile>>;
|
|
32
32
|
request(path: string, options?: MediaStoreRequestOptions, controller?: AbortController): Promise<Response>;
|
|
33
|
-
resolveAuth: (authContext?: AuthContext
|
|
33
|
+
resolveAuth: (authContext?: AuthContext) => Promise<Auth>;
|
|
34
34
|
resolveInitialAuth: () => Auth;
|
|
35
35
|
}
|
|
36
36
|
export declare const getMediaEnvironment: () => string | undefined;
|
|
@@ -45,7 +45,7 @@ export interface ResponseFileItem {
|
|
|
45
45
|
export interface ItemsPayload {
|
|
46
46
|
items: ResponseFileItem[];
|
|
47
47
|
}
|
|
48
|
-
export
|
|
48
|
+
export type ImageMetadataArtifact = {
|
|
49
49
|
url?: string;
|
|
50
50
|
width?: number;
|
|
51
51
|
height?: number;
|
|
@@ -59,7 +59,7 @@ export interface ImageMetadata {
|
|
|
59
59
|
export interface MediaStoreResponse<Data> {
|
|
60
60
|
readonly data: Data;
|
|
61
61
|
}
|
|
62
|
-
export
|
|
62
|
+
export type MediaStoreRequestOptions = RequestMetadata & {
|
|
63
63
|
readonly method?: RequestMethod;
|
|
64
64
|
readonly authContext?: AuthContext;
|
|
65
65
|
readonly params?: RequestParams;
|
|
@@ -69,14 +69,14 @@ export declare type MediaStoreRequestOptions = RequestMetadata & {
|
|
|
69
69
|
readonly traceContext?: MediaTraceContext;
|
|
70
70
|
readonly resolvedAuth?: Auth;
|
|
71
71
|
};
|
|
72
|
-
export
|
|
72
|
+
export type MediaStoreCreateFileFromUploadParams = {
|
|
73
73
|
readonly collection?: string;
|
|
74
74
|
readonly occurrenceKey?: string;
|
|
75
75
|
readonly expireAfter?: number;
|
|
76
76
|
readonly replaceFileId?: string;
|
|
77
77
|
readonly skipConversions?: boolean;
|
|
78
78
|
};
|
|
79
|
-
export
|
|
79
|
+
export type MediaStoreCreateFileParams = {
|
|
80
80
|
readonly occurrenceKey?: string;
|
|
81
81
|
readonly collection?: string;
|
|
82
82
|
};
|
|
@@ -94,7 +94,7 @@ export interface TouchFileDescriptor {
|
|
|
94
94
|
export interface MediaStoreTouchFileBody {
|
|
95
95
|
descriptors: TouchFileDescriptor[];
|
|
96
96
|
}
|
|
97
|
-
export
|
|
97
|
+
export type MediaStoreCreateFileFromBinaryParams = {
|
|
98
98
|
readonly replaceFileId?: string;
|
|
99
99
|
readonly collection?: string;
|
|
100
100
|
readonly occurrenceKey?: string;
|
|
@@ -102,21 +102,21 @@ export declare type MediaStoreCreateFileFromBinaryParams = {
|
|
|
102
102
|
readonly skipConversions?: boolean;
|
|
103
103
|
readonly name?: string;
|
|
104
104
|
};
|
|
105
|
-
export
|
|
105
|
+
export type MediaStoreCreateFileFromUploadConditions = {
|
|
106
106
|
readonly hash: string;
|
|
107
107
|
readonly size: number;
|
|
108
108
|
};
|
|
109
|
-
export
|
|
109
|
+
export type MediaStoreCreateFileFromUploadBody = {
|
|
110
110
|
readonly uploadId: string;
|
|
111
111
|
readonly name?: string;
|
|
112
112
|
readonly mimeType?: string;
|
|
113
113
|
readonly conditions?: MediaStoreCreateFileFromUploadConditions;
|
|
114
114
|
};
|
|
115
|
-
export
|
|
115
|
+
export type MediaStoreGetFileParams = {
|
|
116
116
|
readonly version?: number;
|
|
117
117
|
readonly collection?: string;
|
|
118
118
|
};
|
|
119
|
-
export
|
|
119
|
+
export type MediaStoreGetFileImageParams = {
|
|
120
120
|
readonly allowAnimated?: boolean;
|
|
121
121
|
readonly version?: number;
|
|
122
122
|
readonly collection?: string;
|
|
@@ -132,15 +132,15 @@ export interface SourceFile {
|
|
|
132
132
|
collection?: string;
|
|
133
133
|
version?: number;
|
|
134
134
|
}
|
|
135
|
-
export
|
|
135
|
+
export type MediaStoreCopyFileWithTokenBody = {
|
|
136
136
|
sourceFile: SourceFile;
|
|
137
137
|
};
|
|
138
|
-
export
|
|
138
|
+
export type MediaStoreCopyFileWithTokenParams = {
|
|
139
139
|
readonly collection?: string;
|
|
140
140
|
readonly replaceFileId?: string;
|
|
141
141
|
readonly occurrenceKey?: string;
|
|
142
142
|
};
|
|
143
|
-
export
|
|
143
|
+
export type AppendChunksToUploadRequestBody = {
|
|
144
144
|
readonly chunks: string[];
|
|
145
145
|
readonly hash?: string;
|
|
146
146
|
readonly offset?: number;
|
|
@@ -153,14 +153,14 @@ export interface RejectedTouchFile {
|
|
|
153
153
|
fileId: string;
|
|
154
154
|
error: RejectionError;
|
|
155
155
|
}
|
|
156
|
-
export
|
|
156
|
+
export type RejectionError = {
|
|
157
157
|
code: 'ExceedMaxFileSizeLimit';
|
|
158
158
|
title: string;
|
|
159
159
|
href: string;
|
|
160
160
|
limit: number;
|
|
161
161
|
size: number;
|
|
162
162
|
};
|
|
163
|
-
export
|
|
163
|
+
export type TouchedFiles = {
|
|
164
164
|
created: CreatedTouchedFile[];
|
|
165
165
|
rejected: RejectedTouchFile[];
|
|
166
166
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Auth, AuthContext, AuthProvider } from '@atlaskit/media-core';
|
|
2
2
|
export declare const DEFAULT_AUTH_PROVIDER_TIMEOUT = 10000;
|
|
3
|
-
export declare const resolveAuth: (authProvider: AuthProvider, authContext?: AuthContext
|
|
4
|
-
export declare const resolveInitialAuth: (auth?: Auth
|
|
3
|
+
export declare const resolveAuth: (authProvider: AuthProvider, authContext?: AuthContext, authProviderTimeout?: number) => Promise<Auth>;
|
|
4
|
+
export declare const resolveInitialAuth: (auth?: Auth) => Auth;
|
|
@@ -7,5 +7,5 @@ export interface AsapBasedAuthHeaders {
|
|
|
7
7
|
readonly 'X-Issuer': string;
|
|
8
8
|
readonly Authorization: string;
|
|
9
9
|
}
|
|
10
|
-
export
|
|
10
|
+
export type AuthHeaders = ClientBasedAuthHeaders | AsapBasedAuthHeaders;
|
|
11
11
|
export declare function mapAuthToAuthHeaders(auth: Auth): AuthHeaders;
|
|
@@ -7,5 +7,5 @@ export interface AsapBasedQueryParameters {
|
|
|
7
7
|
readonly issuer: string;
|
|
8
8
|
readonly token: string;
|
|
9
9
|
}
|
|
10
|
-
export
|
|
10
|
+
export type AuthQueryParameters = ClientBasedQueryParameters | AsapBasedQueryParameters;
|
|
11
11
|
export declare function mapAuthToQueryParameters(auth: Auth): AuthQueryParameters;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type MediaClientErrorReason = 'clientOffline' | 'clientAbortedRequest' | 'clientTimeoutRequest' | 'serverInvalidBody' | 'serverBadRequest' | 'serverUnauthorized' | 'serverForbidden' | 'serverNotFound' | 'serverRateLimited' | 'serverInternalError' | 'serverBadGateway' | 'serverUnexpectedError' | 'failedAuthProvider' | 'tokenExpired' | 'missingInitialAuth' | 'emptyAuth' | 'authProviderTimedOut' | 'invalidFileId' | 'emptyItems' | 'zeroVersionFile' | 'pollingMaxAttemptsExceeded' | 'fileSizeExceedsLimit' | 'deprecatedEndpoint';
|
|
2
2
|
export interface MediaClientErrorAttributes {
|
|
3
3
|
reason: MediaClientErrorReason;
|
|
4
4
|
}
|
|
@@ -2,10 +2,10 @@ import { FileStatus as CommonFileStatus, MediaTraceContext } from '@atlaskit/med
|
|
|
2
2
|
import { MediaStoreResponse } from '../client/media-store';
|
|
3
3
|
import { MediaFileArtifacts } from './artifacts';
|
|
4
4
|
import { MediaItemDetails, MediaFile, MediaRepresentations, MediaType } from './media';
|
|
5
|
-
export
|
|
5
|
+
export type BaseFileState = {
|
|
6
6
|
metadataTraceContext?: MediaTraceContext;
|
|
7
7
|
};
|
|
8
|
-
export
|
|
8
|
+
export type FileStatus = CommonFileStatus;
|
|
9
9
|
export interface FilePreview {
|
|
10
10
|
value: Blob | string;
|
|
11
11
|
origin?: 'local' | 'remote';
|
|
@@ -81,8 +81,8 @@ export interface ErrorFileState extends BaseFileState {
|
|
|
81
81
|
occurrenceKey?: string;
|
|
82
82
|
message?: string;
|
|
83
83
|
}
|
|
84
|
-
export
|
|
85
|
-
export
|
|
84
|
+
export type FileState = UploadingFileState | ProcessingFileState | ProcessedFileState | ErrorFileState | ProcessingFailedState;
|
|
85
|
+
export type NonErrorFileState = Exclude<FileState, ErrorFileState>;
|
|
86
86
|
export declare const isUploadingFileState: (fileState: FileState) => fileState is UploadingFileState;
|
|
87
87
|
export declare const isProcessingFileState: (fileState: FileState) => fileState is ProcessingFileState;
|
|
88
88
|
export declare const isProcessedFileState: (fileState: FileState) => fileState is ProcessedFileState;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { MediaType } from './media';
|
|
2
|
-
export
|
|
2
|
+
export type MediaItemType = 'file' | 'external-image';
|
|
3
3
|
export interface FileItem {
|
|
4
4
|
type: 'file';
|
|
5
5
|
details: FileDetails;
|
|
6
6
|
}
|
|
7
|
-
export
|
|
7
|
+
export type FileProcessingStatus = 'pending' | 'running' | 'succeeded' | 'failed';
|
|
8
8
|
export interface MediaArtifact {
|
|
9
9
|
processingStatus?: FileProcessingStatus;
|
|
10
10
|
url?: string;
|
|
11
11
|
}
|
|
12
|
-
export
|
|
12
|
+
export type Artifacts = {
|
|
13
13
|
[name: string]: MediaArtifact;
|
|
14
14
|
};
|
|
15
15
|
export interface FileDetails {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { MediaFeatureFlags, MediaTraceContext, MediaType } from '@atlaskit/media-common';
|
|
2
2
|
import type { MediaFileArtifacts } from './artifacts';
|
|
3
|
-
export
|
|
3
|
+
export type MediaFileProcessingStatus = 'pending' | 'succeeded' | 'failed';
|
|
4
4
|
export type { MediaType } from '@atlaskit/media-common';
|
|
5
|
-
export declare const isPreviewableType: (type: MediaType, featureFlags?: MediaFeatureFlags
|
|
6
|
-
export
|
|
5
|
+
export declare const isPreviewableType: (type: MediaType, featureFlags?: MediaFeatureFlags) => boolean;
|
|
6
|
+
export type MediaFile = {
|
|
7
7
|
readonly id: string;
|
|
8
8
|
readonly mediaType: MediaType;
|
|
9
9
|
readonly mimeType: string;
|
|
@@ -15,7 +15,7 @@ export declare type MediaFile = {
|
|
|
15
15
|
readonly createdAt?: number;
|
|
16
16
|
readonly metadataTraceContext?: MediaTraceContext;
|
|
17
17
|
};
|
|
18
|
-
export
|
|
18
|
+
export type MediaItemDetails = {
|
|
19
19
|
readonly mediaType: MediaType;
|
|
20
20
|
readonly mimeType: string;
|
|
21
21
|
readonly name: string;
|
|
@@ -26,15 +26,15 @@ export declare type MediaItemDetails = {
|
|
|
26
26
|
readonly createdAt?: number;
|
|
27
27
|
readonly metadataTraceContext?: MediaTraceContext;
|
|
28
28
|
};
|
|
29
|
-
export
|
|
29
|
+
export type MediaRepresentations = {
|
|
30
30
|
image?: Object;
|
|
31
31
|
};
|
|
32
|
-
export
|
|
32
|
+
export type MediaUpload = {
|
|
33
33
|
readonly id: string;
|
|
34
34
|
readonly created: number;
|
|
35
35
|
readonly expires: number;
|
|
36
36
|
};
|
|
37
|
-
export
|
|
37
|
+
export type MediaChunksProbe = {
|
|
38
38
|
readonly results: {
|
|
39
39
|
readonly [etag: string]: {
|
|
40
40
|
readonly exists: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FilePreview } from './file-state';
|
|
2
|
-
export
|
|
2
|
+
export type MobileUploadStartEvent = {
|
|
3
3
|
fileId: string;
|
|
4
4
|
collectionName?: string;
|
|
5
5
|
occurrenceKey?: string;
|
|
@@ -9,14 +9,14 @@ export declare type MobileUploadStartEvent = {
|
|
|
9
9
|
preview?: FilePreview;
|
|
10
10
|
createdAt?: number;
|
|
11
11
|
};
|
|
12
|
-
export
|
|
12
|
+
export type MobileUploadProgressEvent = {
|
|
13
13
|
fileId: string;
|
|
14
14
|
progress: number;
|
|
15
15
|
};
|
|
16
|
-
export
|
|
16
|
+
export type MobileUploadEndEvent = {
|
|
17
17
|
fileId: string;
|
|
18
18
|
};
|
|
19
|
-
export
|
|
19
|
+
export type MobileUploadErrorEvent = {
|
|
20
20
|
fileId: string;
|
|
21
21
|
message: string;
|
|
22
22
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseMediaClientError } from '../models/errors';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
2
|
+
export type UploaderErrorReason = 'fileSizeExceedsLimit';
|
|
3
|
+
export type UploaderErrorAttributes = {
|
|
4
4
|
readonly reason: UploaderErrorReason;
|
|
5
5
|
readonly id: string;
|
|
6
6
|
readonly metadata?: {
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { ChunkinatorFile } from '@atlaskit/chunkinator';
|
|
2
2
|
import { MediaStore } from '../client/media-store';
|
|
3
3
|
import { MediaTraceContext } from '@atlaskit/media-common';
|
|
4
|
-
export
|
|
4
|
+
export type UploadableFile = {
|
|
5
5
|
content: ChunkinatorFile;
|
|
6
6
|
name?: string;
|
|
7
7
|
mimeType?: string;
|
|
8
8
|
collection?: string;
|
|
9
9
|
};
|
|
10
|
-
export
|
|
10
|
+
export type UploadableFileUpfrontIds = {
|
|
11
11
|
id: string;
|
|
12
12
|
deferredUploadId: Promise<string>;
|
|
13
13
|
occurrenceKey?: string;
|
|
14
14
|
};
|
|
15
|
-
export
|
|
15
|
+
export type UploadFileCallbacks = {
|
|
16
16
|
onProgress: (progress: number) => void;
|
|
17
17
|
onUploadFinish: (error?: any) => void;
|
|
18
18
|
};
|
|
19
19
|
export interface UploadFileResult {
|
|
20
20
|
cancel: () => void;
|
|
21
21
|
}
|
|
22
|
-
export declare const uploadFile: (file: UploadableFile, store: MediaStore, uploadableFileUpfrontIds: UploadableFileUpfrontIds, callbacks?: UploadFileCallbacks
|
|
22
|
+
export declare const uploadFile: (file: UploadableFile, store: MediaStore, uploadableFileUpfrontIds: UploadableFileUpfrontIds, callbacks?: UploadFileCallbacks, traceContext?: MediaTraceContext) => UploadFileResult;
|
|
@@ -3,18 +3,18 @@ import Dataloader from 'dataloader';
|
|
|
3
3
|
import { MediaStore, ResponseFileItem } from '../client/media-store';
|
|
4
4
|
import { MediaItemDetails } from '../models/media';
|
|
5
5
|
export declare const MAX_BATCH_SIZE = 100;
|
|
6
|
-
export
|
|
6
|
+
export type DataloaderKey = {
|
|
7
7
|
readonly id: string;
|
|
8
8
|
readonly collectionName?: string;
|
|
9
9
|
};
|
|
10
|
-
export
|
|
11
|
-
export
|
|
10
|
+
export type DataloaderResult = MediaItemDetails | null;
|
|
11
|
+
export type BatchLoadingErrorResult = {
|
|
12
12
|
readonly id: string;
|
|
13
13
|
readonly collection?: string;
|
|
14
14
|
readonly error: Error;
|
|
15
15
|
};
|
|
16
16
|
export declare const getItemsFromKeys: (dataloaderKeys: ReadonlyArray<DataloaderKey>, fileItems: Array<ResponseFileItem | BatchLoadingErrorResult>) => Array<DataloaderResult | Error>;
|
|
17
|
-
export
|
|
17
|
+
export type FileIdsByCollection = {
|
|
18
18
|
[collectionName: string]: string[];
|
|
19
19
|
};
|
|
20
20
|
/**
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { MediaStoreGetFileImageParams } from '../client/media-store';
|
|
2
|
-
export
|
|
3
|
-
export declare const imageResizeModeToFileImageMode: (resizeMode?: ImageResizeMode
|
|
2
|
+
export type ImageResizeMode = 'crop' | 'fit' | 'full-fit' | 'stretchy-fit';
|
|
3
|
+
export declare const imageResizeModeToFileImageMode: (resizeMode?: ImageResizeMode) => MediaStoreGetFileImageParams['mode'];
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { FileState } from '../../models/file-state';
|
|
2
|
-
export
|
|
2
|
+
export type MediaSubscription = {
|
|
3
3
|
unsubscribe: () => void;
|
|
4
4
|
};
|
|
5
|
-
|
|
5
|
+
type PartialObserver = {
|
|
6
6
|
next?: (value: FileState) => void;
|
|
7
7
|
error?: (err: any) => void;
|
|
8
8
|
complete?: () => void;
|
|
9
9
|
};
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
10
|
+
export type NextObserver = PartialObserver & Required<Pick<PartialObserver, 'next'>>;
|
|
11
|
+
export type ErrorObserver = PartialObserver & Required<Pick<PartialObserver, 'error'>>;
|
|
12
|
+
export type CompletionObserver = PartialObserver & Required<Pick<PartialObserver, 'complete'>>;
|
|
13
|
+
export type MediaObserver = NextObserver | ErrorObserver | CompletionObserver | ((value: FileState) => void);
|
|
14
|
+
export type MediaSubscribable = {
|
|
15
15
|
subscribe(observer?: MediaObserver): MediaSubscription;
|
|
16
16
|
};
|
|
17
17
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseMediaClientError } from '../../models/errors';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
2
|
+
export type MobileUploadErrorReason = 'emptyItems' | 'zeroVersionFile';
|
|
3
|
+
export type MobileUploadErrorAttributes = {
|
|
4
4
|
readonly reason: MobileUploadErrorReason;
|
|
5
5
|
readonly id: string;
|
|
6
6
|
readonly metadata?: {
|
|
@@ -5,4 +5,4 @@ import { FileState } from '../../models/file-state';
|
|
|
5
5
|
import { DataloaderKey, DataloaderResult } from '../createFileDataLoader';
|
|
6
6
|
import { StateMachineContext, StateMachineEvent, StateMachineTypestate } from './stateMachine/types';
|
|
7
7
|
export declare const createMobileFileStateSubject: (service: Interpreter<StateMachineContext, any, StateMachineEvent, StateMachineTypestate>) => ReplaySubject<FileState>;
|
|
8
|
-
export declare const createMobileDownloadFileStream: (dataloader: Dataloader<DataloaderKey, DataloaderResult>, id: string, collectionName?: string
|
|
8
|
+
export declare const createMobileDownloadFileStream: (dataloader: Dataloader<DataloaderKey, DataloaderResult>, id: string, collectionName?: string, occurrenceKey?: string) => ReplaySubject<FileState>;
|
|
@@ -3,5 +3,5 @@ import { Interpreter, StateMachine } from 'xstate';
|
|
|
3
3
|
import { UploadingFileState } from '../../../models/file-state';
|
|
4
4
|
import { DataloaderKey, DataloaderResult } from '../../createFileDataLoader';
|
|
5
5
|
import { StateMachineContext, StateMachineEvent, StateMachineSchema, StateMachineTypestate } from './types';
|
|
6
|
-
export declare const createMobileUploadStateMachine: (dataloader: DataLoader<DataloaderKey, DataloaderResult>, initialState: UploadingFileState, collectionName?: string
|
|
6
|
+
export declare const createMobileUploadStateMachine: (dataloader: DataLoader<DataloaderKey, DataloaderResult>, initialState: UploadingFileState, collectionName?: string) => StateMachine<StateMachineContext, any, StateMachineEvent, StateMachineTypestate>;
|
|
7
7
|
export declare function createMobileUploadService(machine: StateMachine<StateMachineContext, StateMachineSchema, StateMachineEvent, StateMachineTypestate>): Interpreter<StateMachineContext, StateMachineSchema, StateMachineEvent, StateMachineTypestate>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { StateSchema } from 'xstate';
|
|
2
2
|
import { FileState, UploadingFileState, ProcessingFileState, ProcessedFileState, ErrorFileState, ProcessingFailedState } from '../../../models/file-state';
|
|
3
|
-
export
|
|
3
|
+
export type StateMachineContext = {
|
|
4
4
|
currentFileState: FileState;
|
|
5
5
|
};
|
|
6
|
-
export
|
|
6
|
+
export type StateMachineEvent = {
|
|
7
7
|
type: 'UPLOAD_PROGRESS';
|
|
8
8
|
progress: number;
|
|
9
9
|
} | {
|
|
@@ -25,14 +25,14 @@ export declare type StateMachineEvent = {
|
|
|
25
25
|
} | {
|
|
26
26
|
type: 'REMOTE_FILESTATE_ERROR';
|
|
27
27
|
};
|
|
28
|
-
export
|
|
28
|
+
export type ProcessingStateMachineSchema = StateSchema<StateMachineContext> & {
|
|
29
29
|
states: {
|
|
30
30
|
loading: StateSchema<StateMachineContext>;
|
|
31
31
|
fetchingRemoteFileStates: StateSchema<StateMachineContext>;
|
|
32
32
|
idle: StateSchema<StateMachineContext>;
|
|
33
33
|
};
|
|
34
34
|
};
|
|
35
|
-
export
|
|
35
|
+
export type StateMachineSchema = StateSchema<StateMachineContext> & {
|
|
36
36
|
states: {
|
|
37
37
|
uploading: StateSchema<StateMachineContext>;
|
|
38
38
|
processing: ProcessingStateMachineSchema;
|
|
@@ -41,7 +41,7 @@ export declare type StateMachineSchema = StateSchema<StateMachineContext> & {
|
|
|
41
41
|
error: StateSchema<StateMachineContext>;
|
|
42
42
|
};
|
|
43
43
|
};
|
|
44
|
-
export
|
|
44
|
+
export type StateMachineTypestate = {
|
|
45
45
|
value: 'uploading';
|
|
46
46
|
context: {
|
|
47
47
|
currentFileState: UploadingFileState;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FileState } from '../models/file-state';
|
|
2
2
|
import { MediaType } from '../models/media';
|
|
3
|
-
export declare const overrideMediaTypeIfUnknown: (fileState: FileState, mediaType?: MediaType
|
|
3
|
+
export declare const overrideMediaTypeIfUnknown: (fileState: FileState, mediaType?: MediaType) => {
|
|
4
4
|
mediaType?: MediaType | undefined;
|
|
5
5
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
1
|
+
export type Executor = () => Promise<void>;
|
|
2
|
+
export type PollingErrorReason = 'pollingMaxAttemptsExceeded';
|
|
3
|
+
export type PollingErrorAttributes = {
|
|
4
4
|
readonly reason: PollingErrorReason;
|
|
5
5
|
readonly attempts: number;
|
|
6
6
|
readonly innerError?: Error;
|