@atlaskit/media-client 21.1.0 → 22.0.1

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.
Files changed (37) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/constants/package.json +2 -2
  3. package/dist/cjs/version.json +1 -1
  4. package/dist/es2019/version.json +1 -1
  5. package/dist/esm/version.json +1 -1
  6. package/dist/types/client/events.d.ts +3 -3
  7. package/dist/types/client/file-fetcher/error.d.ts +2 -2
  8. package/dist/types/client/file-fetcher/index.d.ts +1 -1
  9. package/dist/types/client/media-store/error.d.ts +2 -2
  10. package/dist/types/client/media-store/index.d.ts +15 -15
  11. package/dist/types/client/media-store/resolveAuth.d.ts +2 -2
  12. package/dist/types/identifier.d.ts +1 -1
  13. package/dist/types/models/artifacts.d.ts +1 -1
  14. package/dist/types/models/auth-headers.d.ts +1 -1
  15. package/dist/types/models/auth-query-parameters.d.ts +1 -1
  16. package/dist/types/models/errors/types.d.ts +1 -1
  17. package/dist/types/models/file-state.d.ts +4 -4
  18. package/dist/types/models/item.d.ts +3 -3
  19. package/dist/types/models/media.d.ts +7 -7
  20. package/dist/types/models/mobile-upload.d.ts +4 -4
  21. package/dist/types/upload-controller.d.ts +1 -1
  22. package/dist/types/uploader/error.d.ts +2 -2
  23. package/dist/types/uploader/index.d.ts +4 -4
  24. package/dist/types/utils/createFileDataLoader.d.ts +4 -4
  25. package/dist/types/utils/getDimensionsFromBlob.d.ts +1 -1
  26. package/dist/types/utils/getImageDimensionsFromBlob.d.ts +1 -1
  27. package/dist/types/utils/imageResizeModeToFileImageMode.d.ts +2 -2
  28. package/dist/types/utils/mediaSubscribable/types.d.ts +7 -7
  29. package/dist/types/utils/mobileUpload/error.d.ts +2 -2
  30. package/dist/types/utils/mobileUpload/helpers.d.ts +1 -1
  31. package/dist/types/utils/mobileUpload/stateMachine/index.d.ts +1 -1
  32. package/dist/types/utils/mobileUpload/stateMachine/types.d.ts +5 -5
  33. package/dist/types/utils/overrideMediaTypeIfUnknown.d.ts +1 -1
  34. package/dist/types/utils/polling/types.d.ts +3 -3
  35. package/dist/types/utils/request/types.d.ts +11 -11
  36. package/dist/types/utils/with-media-client-hoc.d.ts +3 -3
  37. package/package.json +18 -10
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaskit/media-client
2
2
 
3
+ ## 22.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`41fae2c6f68`](https://bitbucket.org/atlassian/atlassian-frontend/commits/41fae2c6f68) - Upgrade Typescript from `4.5.5` to `4.9.5`
8
+ - Updated dependencies
9
+
10
+ ## 22.0.0
11
+
12
+ ### Minor Changes
13
+
14
+ - [`56507598609`](https://bitbucket.org/atlassian/atlassian-frontend/commits/56507598609) - Skip minor dependency bump
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies
19
+
3
20
  ## 21.1.0
4
21
 
5
22
  ### Minor Changes
@@ -6,9 +6,9 @@
6
6
  "sideEffects": false,
7
7
  "types": "../dist/types/constants.d.ts",
8
8
  "typesVersions": {
9
- ">=4.0 <4.5": {
9
+ ">=4.5 <4.9": {
10
10
  "*": [
11
- "../dist/types-ts4.0/constants.d.ts"
11
+ "../dist/types-ts4.5/constants.d.ts"
12
12
  ]
13
13
  }
14
14
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/media-client",
3
- "version": "21.1.0",
3
+ "version": "22.0.1",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/media-client",
3
- "version": "21.1.0",
3
+ "version": "22.0.1",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/media-client",
3
- "version": "21.1.0",
3
+ "version": "22.0.1",
4
4
  "sideEffects": false
5
5
  }
@@ -1,14 +1,14 @@
1
1
  import { FileState } from '../models/file-state';
2
- export declare type EventPayloadMap<P> = {
2
+ export type EventPayloadMap<P> = {
3
3
  readonly [event: string]: P;
4
4
  };
5
- export declare type EventPayloadListener<M extends EventPayloadMap<P>, E extends keyof M, P = any> = (payload: M[E]) => void;
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 declare type UploadEventPayloadMap = {
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 declare type FileFetcherErrorReason = 'invalidFileId' | 'emptyItems' | 'zeroVersionFile';
3
- export declare type FileFetcherErrorAttributes = {
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 declare type ExternalUploadPayload = {
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 declare type MediaStoreErrorReason = 'failedAuthProvider' | 'tokenExpired' | 'missingInitialAuth' | 'emptyAuth' | 'authProviderTimedOut';
3
- export declare type MediaStoreErrorAttributes = {
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 | undefined) => Promise<Auth>;
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 declare type ImageMetadataArtifact = {
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 declare type MediaStoreRequestOptions = RequestMetadata & {
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 declare type MediaStoreCreateFileFromUploadParams = {
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 declare type MediaStoreCreateFileParams = {
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 declare type MediaStoreCreateFileFromBinaryParams = {
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 declare type MediaStoreCreateFileFromUploadConditions = {
105
+ export type MediaStoreCreateFileFromUploadConditions = {
106
106
  readonly hash: string;
107
107
  readonly size: number;
108
108
  };
109
- export declare type MediaStoreCreateFileFromUploadBody = {
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 declare type MediaStoreGetFileParams = {
115
+ export type MediaStoreGetFileParams = {
116
116
  readonly version?: number;
117
117
  readonly collection?: string;
118
118
  };
119
- export declare type MediaStoreGetFileImageParams = {
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 declare type MediaStoreCopyFileWithTokenBody = {
135
+ export type MediaStoreCopyFileWithTokenBody = {
136
136
  sourceFile: SourceFile;
137
137
  };
138
- export declare type MediaStoreCopyFileWithTokenParams = {
138
+ export type MediaStoreCopyFileWithTokenParams = {
139
139
  readonly collection?: string;
140
140
  readonly replaceFileId?: string;
141
141
  readonly occurrenceKey?: string;
142
142
  };
143
- export declare type AppendChunksToUploadRequestBody = {
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 declare type RejectionError = {
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 declare type TouchedFiles = {
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 | undefined, authProviderTimeout?: number) => Promise<Auth>;
4
- export declare const resolveInitialAuth: (auth?: Auth | undefined) => Auth;
3
+ export declare const resolveAuth: (authProvider: AuthProvider, authContext?: AuthContext, authProviderTimeout?: number) => Promise<Auth>;
4
+ export declare const resolveInitialAuth: (auth?: Auth) => Auth;
@@ -1,4 +1,4 @@
1
- export declare type Identifier = FileIdentifier | ExternalImageIdentifier;
1
+ export type Identifier = FileIdentifier | ExternalImageIdentifier;
2
2
  export interface FileIdentifier {
3
3
  readonly mediaItemType: 'file';
4
4
  readonly id: string;
@@ -1,5 +1,5 @@
1
1
  import type { MediaFileProcessingStatus } from './media';
2
- export declare type MediaFileArtifact = {
2
+ export type MediaFileArtifact = {
3
3
  readonly url: string;
4
4
  readonly processingStatus: MediaFileProcessingStatus;
5
5
  };
@@ -7,5 +7,5 @@ export interface AsapBasedAuthHeaders {
7
7
  readonly 'X-Issuer': string;
8
8
  readonly Authorization: string;
9
9
  }
10
- export declare type AuthHeaders = ClientBasedAuthHeaders | AsapBasedAuthHeaders;
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 declare type AuthQueryParameters = ClientBasedQueryParameters | AsapBasedQueryParameters;
10
+ export type AuthQueryParameters = ClientBasedQueryParameters | AsapBasedQueryParameters;
11
11
  export declare function mapAuthToQueryParameters(auth: Auth): AuthQueryParameters;
@@ -1,4 +1,4 @@
1
- export declare 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';
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 declare type BaseFileState = {
5
+ export type BaseFileState = {
6
6
  metadataTraceContext?: MediaTraceContext;
7
7
  };
8
- export declare type FileStatus = CommonFileStatus;
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 declare type FileState = UploadingFileState | ProcessingFileState | ProcessedFileState | ErrorFileState | ProcessingFailedState;
85
- export declare type NonErrorFileState = Exclude<FileState, ErrorFileState>;
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 declare type MediaItemType = 'file' | 'external-image';
2
+ export type MediaItemType = 'file' | 'external-image';
3
3
  export interface FileItem {
4
4
  type: 'file';
5
5
  details: FileDetails;
6
6
  }
7
- export declare type FileProcessingStatus = 'pending' | 'running' | 'succeeded' | 'failed';
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 declare type Artifacts = {
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 declare type MediaFileProcessingStatus = 'pending' | 'succeeded' | 'failed';
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 | undefined) => boolean;
6
- export declare type MediaFile = {
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 declare type MediaItemDetails = {
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 declare type MediaRepresentations = {
29
+ export type MediaRepresentations = {
30
30
  image?: Object;
31
31
  };
32
- export declare type MediaUpload = {
32
+ export type MediaUpload = {
33
33
  readonly id: string;
34
34
  readonly created: number;
35
35
  readonly expires: number;
36
36
  };
37
- export declare type MediaChunksProbe = {
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 declare type MobileUploadStartEvent = {
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 declare type MobileUploadProgressEvent = {
12
+ export type MobileUploadProgressEvent = {
13
13
  fileId: string;
14
14
  progress: number;
15
15
  };
16
- export declare type MobileUploadEndEvent = {
16
+ export type MobileUploadEndEvent = {
17
17
  fileId: string;
18
18
  };
19
- export declare type MobileUploadErrorEvent = {
19
+ export type MobileUploadErrorEvent = {
20
20
  fileId: string;
21
21
  message: string;
22
22
  };
@@ -1,4 +1,4 @@
1
- export declare type AbortFunction = () => void;
1
+ export type AbortFunction = () => void;
2
2
  export declare class UploadController {
3
3
  abortFunction?: AbortFunction;
4
4
  constructor();
@@ -1,6 +1,6 @@
1
1
  import { BaseMediaClientError } from '../models/errors';
2
- export declare type UploaderErrorReason = 'fileSizeExceedsLimit';
3
- export declare type UploaderErrorAttributes = {
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 declare type UploadableFile = {
4
+ export type UploadableFile = {
5
5
  content: ChunkinatorFile;
6
6
  name?: string;
7
7
  mimeType?: string;
8
8
  collection?: string;
9
9
  };
10
- export declare type UploadableFileUpfrontIds = {
10
+ export type UploadableFileUpfrontIds = {
11
11
  id: string;
12
12
  deferredUploadId: Promise<string>;
13
13
  occurrenceKey?: string;
14
14
  };
15
- export declare type UploadFileCallbacks = {
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 | undefined, traceContext?: MediaTraceContext | undefined) => UploadFileResult;
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 declare type DataloaderKey = {
6
+ export type DataloaderKey = {
7
7
  readonly id: string;
8
8
  readonly collectionName?: string;
9
9
  };
10
- export declare type DataloaderResult = MediaItemDetails | null;
11
- export declare type BatchLoadingErrorResult = {
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 declare type FileIdsByCollection = {
17
+ export type FileIdsByCollection = {
18
18
  [collectionName: string]: string[];
19
19
  };
20
20
  /**
@@ -1,5 +1,5 @@
1
1
  import { MediaType } from '@atlaskit/media-common';
2
- export declare type Dimensions = {
2
+ export type Dimensions = {
3
3
  width: number;
4
4
  height: number;
5
5
  };
@@ -1,4 +1,4 @@
1
- export declare type Dimensions = {
1
+ export type Dimensions = {
2
2
  width: number;
3
3
  height: number;
4
4
  };
@@ -1,3 +1,3 @@
1
1
  import { MediaStoreGetFileImageParams } from '../client/media-store';
2
- export declare type ImageResizeMode = 'crop' | 'fit' | 'full-fit' | 'stretchy-fit';
3
- export declare const imageResizeModeToFileImageMode: (resizeMode?: ImageResizeMode | undefined) => MediaStoreGetFileImageParams['mode'];
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 declare type MediaSubscription = {
2
+ export type MediaSubscription = {
3
3
  unsubscribe: () => void;
4
4
  };
5
- declare type PartialObserver = {
5
+ type PartialObserver = {
6
6
  next?: (value: FileState) => void;
7
7
  error?: (err: any) => void;
8
8
  complete?: () => void;
9
9
  };
10
- export declare type NextObserver = PartialObserver & Required<Pick<PartialObserver, 'next'>>;
11
- export declare type ErrorObserver = PartialObserver & Required<Pick<PartialObserver, 'error'>>;
12
- export declare type CompletionObserver = PartialObserver & Required<Pick<PartialObserver, 'complete'>>;
13
- export declare type MediaObserver = NextObserver | ErrorObserver | CompletionObserver | ((value: FileState) => void);
14
- export declare type MediaSubscribable = {
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 declare type MobileUploadErrorReason = 'emptyItems' | 'zeroVersionFile';
3
- export declare type MobileUploadErrorAttributes = {
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 | undefined, occurrenceKey?: string | undefined) => ReplaySubject<FileState>;
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 | undefined) => StateMachine<StateMachineContext, any, StateMachineEvent, StateMachineTypestate>;
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 declare type StateMachineContext = {
3
+ export type StateMachineContext = {
4
4
  currentFileState: FileState;
5
5
  };
6
- export declare type StateMachineEvent = {
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 declare type ProcessingStateMachineSchema = StateSchema<StateMachineContext> & {
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 declare type StateMachineSchema = StateSchema<StateMachineContext> & {
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 declare type StateMachineTypestate = {
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 | undefined) => {
3
+ export declare const overrideMediaTypeIfUnknown: (fileState: FileState, mediaType?: MediaType) => {
4
4
  mediaType?: MediaType | undefined;
5
5
  };
@@ -1,6 +1,6 @@
1
- export declare type Executor = () => Promise<void>;
2
- export declare type PollingErrorReason = 'pollingMaxAttemptsExceeded';
3
- export declare type PollingErrorAttributes = {
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;
@@ -1,29 +1,29 @@
1
1
  import { Auth } from '@atlaskit/media-core';
2
2
  import type { MediaTraceContext } from '@atlaskit/media-common';
3
- export declare type RequestMethod = 'GET' | 'POST' | 'PUT' | 'DELETE';
4
- export declare type RequestParams = {
3
+ export type RequestMethod = 'GET' | 'POST' | 'PUT' | 'DELETE';
4
+ export type RequestParams = {
5
5
  [key: string]: any;
6
6
  };
7
- export declare type RequestHeaders = {
7
+ export type RequestHeaders = {
8
8
  [key: string]: string;
9
9
  };
10
- export declare type RetryOptions = {
10
+ export type RetryOptions = {
11
11
  readonly startTimeoutInMs: number;
12
12
  readonly maxAttempts: number;
13
13
  readonly factor: number;
14
14
  };
15
- export declare type ClientOptions = {
15
+ export type ClientOptions = {
16
16
  readonly retryOptions?: Partial<RetryOptions>;
17
17
  readonly clientTimeout?: number;
18
18
  };
19
- export declare type RequestMetadata = {
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 declare type RequestOptions = RequestMetadata & {
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 declare type CreateUrlOptions = {
34
+ export type CreateUrlOptions = {
35
35
  readonly params?: RequestParams;
36
36
  readonly auth?: Auth;
37
37
  };
38
- export declare type RequestErrorReason = 'clientOffline' | 'clientAbortedRequest' | 'clientTimeoutRequest' | 'serverInvalidBody' | 'serverBadRequest' | 'serverUnauthorized' | 'serverForbidden' | 'serverNotFound' | 'serverRateLimited' | 'serverInternalError' | 'serverBadGateway' | 'serverUnexpectedError';
39
- export declare type RequestErrorMetadata = RequestMetadata & {
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 declare type RequestErrorAttributes = RequestErrorMetadata & {
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 | undefined) => MediaClient;
14
- export declare type WithMediaClientConfigProps<P extends WithMediaClient> = Omit<P, 'mediaClient'> & WithMediaClientConfig;
15
- export declare type WithMediaClientFunction = <P extends WithMediaClient>(Component: React.ComponentType<P>, featureFlags?: MediaFeatureFlags) => React.ComponentType<WithMediaClientConfigProps<P>>;
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-client",
3
- "version": "21.1.0",
3
+ "version": "22.0.1",
4
4
  "description": "Media API Web Client Library",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -12,6 +12,14 @@
12
12
  "module": "dist/esm/index.js",
13
13
  "module:es2019": "dist/es2019/index.js",
14
14
  "types": "dist/types/index.d.ts",
15
+ "typesVersions": {
16
+ ">=4.5 <4.9": {
17
+ "*": [
18
+ "dist/types-ts4.5/*",
19
+ "dist/types-ts4.5/index.d.ts"
20
+ ]
21
+ }
22
+ },
15
23
  "sideEffects": false,
16
24
  "atlaskit:src": "src/index.ts",
17
25
  "af:exports": {
@@ -27,8 +35,8 @@
27
35
  }
28
36
  },
29
37
  "dependencies": {
30
- "@atlaskit/chunkinator": "^4.1.0",
31
- "@atlaskit/media-common": "^4.0.0",
38
+ "@atlaskit/chunkinator": "^4.2.0",
39
+ "@atlaskit/media-common": "^4.1.0",
32
40
  "@babel/runtime": "^7.0.0",
33
41
  "dataloader": "^2.0.0",
34
42
  "deep-equal": "^1.0.1",
@@ -42,18 +50,18 @@
42
50
  "xstate": "4.20.0"
43
51
  },
44
52
  "peerDependencies": {
45
- "@atlaskit/media-core": "^34.0.2",
53
+ "@atlaskit/media-core": "^34.1.1",
46
54
  "@emotion/react": "^11.7.1",
47
55
  "react": "^16.8.0"
48
56
  },
49
57
  "devDependencies": {
50
- "@atlaskit/button": "^16.6.0",
58
+ "@atlaskit/button": "^16.7.0",
51
59
  "@atlaskit/docs": "*",
52
- "@atlaskit/media-card": "^74.7.0",
53
- "@atlaskit/media-core": "^34.0.0",
54
- "@atlaskit/media-test-helpers": "^32.1.0",
60
+ "@atlaskit/media-card": "^74.8.0",
61
+ "@atlaskit/media-core": "^34.1.0",
62
+ "@atlaskit/media-test-helpers": "^33.0.0",
55
63
  "@atlaskit/ssr": "*",
56
- "@atlaskit/tokens": "^1.2.0",
64
+ "@atlaskit/tokens": "^1.4.0",
57
65
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
58
66
  "@emotion/react": "^11.7.1",
59
67
  "@types/deep-equal": "^1.0.1",
@@ -62,7 +70,7 @@
62
70
  "fetch-mock": "^8.0.0",
63
71
  "react": "^16.8.0",
64
72
  "react-dom": "^16.8.0",
65
- "typescript": "4.5.5"
73
+ "typescript": "~4.9.5"
66
74
  },
67
75
  "resolutions": {},
68
76
  "techstack": {