@atlaskit/media-client 23.2.0 → 24.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 +13 -0
- package/dist/cjs/client/file-fetcher/index.js +110 -34
- package/dist/cjs/client/media-client.js +18 -6
- package/dist/cjs/client/media-store/index.js +1 -2
- package/dist/cjs/client/mobile-upload.js +38 -2
- package/dist/cjs/index.js +7 -0
- package/dist/cjs/utils/with-media-client-hoc.js +8 -16
- package/dist/es2019/client/file-fetcher/index.js +101 -28
- package/dist/es2019/client/media-client.js +15 -7
- package/dist/es2019/client/media-store/index.js +1 -2
- package/dist/es2019/client/mobile-upload.js +33 -2
- package/dist/es2019/index.js +1 -0
- package/dist/es2019/utils/with-media-client-hoc.js +8 -16
- package/dist/esm/client/file-fetcher/index.js +106 -30
- package/dist/esm/client/media-client.js +19 -7
- package/dist/esm/client/media-store/index.js +1 -2
- package/dist/esm/client/mobile-upload.js +38 -2
- package/dist/esm/index.js +1 -0
- package/dist/esm/utils/with-media-client-hoc.js +8 -16
- package/dist/types/client/events.d.ts +1 -1
- package/dist/types/client/file-fetcher/index.d.ts +10 -6
- package/dist/types/client/media-client.d.ts +10 -5
- package/dist/types/client/media-store/index.d.ts +3 -4
- package/dist/types/client/mobile-upload.d.ts +6 -2
- package/dist/types/file-streams-cache.d.ts +1 -1
- package/dist/types/index.d.ts +4 -2
- package/dist/types/models/artifacts.d.ts +1 -14
- package/dist/types/models/file-state.d.ts +4 -73
- package/dist/types/models/media.d.ts +1 -1
- package/dist/types/models/mobile-upload.d.ts +1 -1
- package/dist/types/utils/createMediaSubject.d.ts +1 -1
- package/dist/types/utils/mediaSubscribable/fromObservable.d.ts +1 -1
- package/dist/types/utils/mediaSubscribable/toPromise.d.ts +1 -1
- package/dist/types/utils/mediaSubscribable/types.d.ts +1 -1
- 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 +1 -1
- package/dist/types/utils/overrideMediaTypeIfUnknown.d.ts +1 -1
- package/dist/types/utils/shouldFetchRemoteFileStates.d.ts +1 -1
- package/dist/types/utils/with-media-client-hoc.d.ts +2 -3
- package/dist/types-ts4.5/client/events.d.ts +1 -1
- package/dist/types-ts4.5/client/file-fetcher/index.d.ts +10 -6
- package/dist/types-ts4.5/client/media-client.d.ts +10 -5
- package/dist/types-ts4.5/client/media-store/index.d.ts +3 -4
- package/dist/types-ts4.5/client/mobile-upload.d.ts +6 -2
- package/dist/types-ts4.5/file-streams-cache.d.ts +1 -1
- package/dist/types-ts4.5/index.d.ts +4 -2
- package/dist/types-ts4.5/models/artifacts.d.ts +1 -14
- package/dist/types-ts4.5/models/file-state.d.ts +4 -73
- package/dist/types-ts4.5/models/media.d.ts +1 -1
- package/dist/types-ts4.5/models/mobile-upload.d.ts +1 -1
- package/dist/types-ts4.5/utils/createMediaSubject.d.ts +1 -1
- package/dist/types-ts4.5/utils/mediaSubscribable/fromObservable.d.ts +1 -1
- package/dist/types-ts4.5/utils/mediaSubscribable/toPromise.d.ts +1 -1
- package/dist/types-ts4.5/utils/mediaSubscribable/types.d.ts +1 -1
- package/dist/types-ts4.5/utils/mobileUpload/helpers.d.ts +1 -1
- package/dist/types-ts4.5/utils/mobileUpload/stateMachine/index.d.ts +1 -1
- package/dist/types-ts4.5/utils/mobileUpload/stateMachine/types.d.ts +1 -1
- package/dist/types-ts4.5/utils/overrideMediaTypeIfUnknown.d.ts +1 -1
- package/dist/types-ts4.5/utils/shouldFetchRemoteFileStates.d.ts +1 -1
- package/dist/types-ts4.5/utils/with-media-client-hoc.d.ts +2 -3
- package/package.json +5 -3
- package/report.api.md +51 -168
- package/tmp/api-report-tmp.d.ts +51 -160
package/tmp/api-report-tmp.d.ts
CHANGED
|
@@ -10,14 +10,24 @@ import { AuthContext } from '@atlaskit/media-core';
|
|
|
10
10
|
import { AuthProvider } from '@atlaskit/media-core';
|
|
11
11
|
import { ChunkinatorFile } from '@atlaskit/chunkinator';
|
|
12
12
|
import { ClientAltBasedAuth } from '@atlaskit/media-core';
|
|
13
|
+
import { ErrorFileState } from '@atlaskit/media-state';
|
|
14
|
+
import { FilePreview } from '@atlaskit/media-state';
|
|
15
|
+
import { FileState } from '@atlaskit/media-state';
|
|
13
16
|
import { FileStatus as FileStatus_2 } from '@atlaskit/media-common';
|
|
17
|
+
import { LRUMap } from 'lru_map';
|
|
14
18
|
import { MediaApiConfig } from '@atlaskit/media-core';
|
|
15
19
|
import { MediaClientConfig } from '@atlaskit/media-core';
|
|
16
|
-
import {
|
|
20
|
+
import { MediaFileArtifact } from '@atlaskit/media-state';
|
|
21
|
+
import { MediaFileArtifacts } from '@atlaskit/media-state';
|
|
22
|
+
import { MediaStore as MediaStore_2 } from '@atlaskit/media-state';
|
|
17
23
|
import { MediaTraceContext } from '@atlaskit/media-common';
|
|
18
24
|
import { MediaType } from '@atlaskit/media-common';
|
|
25
|
+
import { ProcessedFileState } from '@atlaskit/media-state';
|
|
26
|
+
import { ProcessingFailedState } from '@atlaskit/media-state';
|
|
27
|
+
import { ProcessingFileState } from '@atlaskit/media-state';
|
|
19
28
|
import { default as React_2 } from 'react';
|
|
20
29
|
import { ReplaySubject } from 'rxjs/ReplaySubject';
|
|
30
|
+
import { UploadingFileState } from '@atlaskit/media-state';
|
|
21
31
|
|
|
22
32
|
// @public (undocumented)
|
|
23
33
|
export type AbortFunction = () => void;
|
|
@@ -37,11 +47,6 @@ export type Artifacts = {
|
|
|
37
47
|
[name: string]: MediaArtifact;
|
|
38
48
|
};
|
|
39
49
|
|
|
40
|
-
// @public (undocumented)
|
|
41
|
-
type BaseFileState = {
|
|
42
|
-
metadataTraceContext?: MediaTraceContext;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
50
|
// @public
|
|
46
51
|
abstract class BaseMediaClientError<Attributes extends MediaClientErrorAttributes> extends Error implements MediaClientError<Attributes> {
|
|
47
52
|
constructor(message: string);
|
|
@@ -141,17 +146,7 @@ export interface EmptyFile {
|
|
|
141
146
|
readonly id: string;
|
|
142
147
|
}
|
|
143
148
|
|
|
144
|
-
|
|
145
|
-
export interface ErrorFileState extends BaseFileState {
|
|
146
|
-
// (undocumented)
|
|
147
|
-
id: string;
|
|
148
|
-
// (undocumented)
|
|
149
|
-
message?: string;
|
|
150
|
-
// (undocumented)
|
|
151
|
-
occurrenceKey?: string;
|
|
152
|
-
// (undocumented)
|
|
153
|
-
status: 'error';
|
|
154
|
-
}
|
|
149
|
+
export { ErrorFileState }
|
|
155
150
|
|
|
156
151
|
// @public (undocumented)
|
|
157
152
|
type ErrorObserver = PartialObserver & Required<Pick<PartialObserver, 'error'>>;
|
|
@@ -266,7 +261,7 @@ export type FileFetcherErrorReason = 'emptyFileName' | 'emptyItems' | 'invalidFi
|
|
|
266
261
|
|
|
267
262
|
// @public (undocumented)
|
|
268
263
|
export class FileFetcherImpl implements FileFetcher {
|
|
269
|
-
constructor(
|
|
264
|
+
constructor(mediaApi: MediaStore, store?: MediaStore_2);
|
|
270
265
|
// (undocumented)
|
|
271
266
|
copyFile(source: CopySourceFile, destination: CopyDestination, options?: CopyFileOptions, traceContext?: MediaTraceContext): Promise<MediaFile>;
|
|
272
267
|
// (undocumented)
|
|
@@ -307,24 +302,12 @@ export interface FileItem {
|
|
|
307
302
|
type: 'file';
|
|
308
303
|
}
|
|
309
304
|
|
|
310
|
-
|
|
311
|
-
export interface FilePreview {
|
|
312
|
-
// (undocumented)
|
|
313
|
-
origin?: 'local' | 'remote';
|
|
314
|
-
// (undocumented)
|
|
315
|
-
originalDimensions?: {
|
|
316
|
-
width: number;
|
|
317
|
-
height: number;
|
|
318
|
-
};
|
|
319
|
-
// (undocumented)
|
|
320
|
-
value: Blob | string;
|
|
321
|
-
}
|
|
305
|
+
export { FilePreview }
|
|
322
306
|
|
|
323
307
|
// @public (undocumented)
|
|
324
308
|
export type FileProcessingStatus = 'failed' | 'pending' | 'running' | 'succeeded';
|
|
325
309
|
|
|
326
|
-
|
|
327
|
-
export type FileState = ErrorFileState | ProcessedFileState | ProcessingFailedState | ProcessingFileState | UploadingFileState;
|
|
310
|
+
export { FileState }
|
|
328
311
|
|
|
329
312
|
// @public (undocumented)
|
|
330
313
|
export type FileStatus = FileStatus_2;
|
|
@@ -352,7 +335,10 @@ export interface GetFileOptions {
|
|
|
352
335
|
}
|
|
353
336
|
|
|
354
337
|
// @public (undocumented)
|
|
355
|
-
export const
|
|
338
|
+
export const getFileStreamsCache: () => StreamsCache<FileState>;
|
|
339
|
+
|
|
340
|
+
// @public (undocumented)
|
|
341
|
+
export const getMediaClient: (mediaClientConfig: MediaClientConfig) => MediaClient;
|
|
356
342
|
|
|
357
343
|
// @public (undocumented)
|
|
358
344
|
export function getMediaClientErrorReason(err: Error): 'unknown' | MediaClientErrorReason;
|
|
@@ -554,14 +540,14 @@ export type MediaChunksProbe = {
|
|
|
554
540
|
|
|
555
541
|
// @public (undocumented)
|
|
556
542
|
export class MediaClient {
|
|
557
|
-
constructor(mediaClientConfig: MediaClientConfig,
|
|
543
|
+
constructor(mediaClientConfig: MediaClientConfig, store?: MediaStore_2, mediaApi?: MediaStore);
|
|
544
|
+
// @internal (undocumented)
|
|
545
|
+
__DO_NOT_USE__getMediaStore(): MediaStore_2;
|
|
558
546
|
// (undocumented)
|
|
559
547
|
readonly config: MediaClientConfig;
|
|
560
548
|
// (undocumented)
|
|
561
549
|
emit<E extends keyof UploadEventPayloadMap>(event: E, payload: UploadEventPayloadMap[E]): boolean;
|
|
562
550
|
// (undocumented)
|
|
563
|
-
readonly featureFlags?: MediaFeatureFlags | undefined;
|
|
564
|
-
// (undocumented)
|
|
565
551
|
readonly file: FileFetcher;
|
|
566
552
|
// (undocumented)
|
|
567
553
|
getImage(id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean, traceContext?: MediaTraceContext): Promise<Blob>;
|
|
@@ -587,6 +573,8 @@ export class MediaClient {
|
|
|
587
573
|
readonly stargate: StargateClient;
|
|
588
574
|
}
|
|
589
575
|
|
|
576
|
+
export { MediaClientConfig }
|
|
577
|
+
|
|
590
578
|
// @public
|
|
591
579
|
export interface MediaClientError<Attributes extends MediaClientErrorAttributes> extends Error {
|
|
592
580
|
// (undocumented)
|
|
@@ -616,29 +604,9 @@ export type MediaFile = {
|
|
|
616
604
|
readonly metadataTraceContext?: MediaTraceContext;
|
|
617
605
|
};
|
|
618
606
|
|
|
619
|
-
|
|
620
|
-
export type MediaFileArtifact = {
|
|
621
|
-
readonly url: string;
|
|
622
|
-
readonly processingStatus: MediaFileProcessingStatus;
|
|
623
|
-
};
|
|
607
|
+
export { MediaFileArtifact }
|
|
624
608
|
|
|
625
|
-
|
|
626
|
-
export interface MediaFileArtifacts {
|
|
627
|
-
// (undocumented)
|
|
628
|
-
'audio.mp3'?: MediaFileArtifact;
|
|
629
|
-
// (undocumented)
|
|
630
|
-
'document.pdf'?: MediaFileArtifact;
|
|
631
|
-
// (undocumented)
|
|
632
|
-
'image.jpg'?: MediaFileArtifact;
|
|
633
|
-
// (undocumented)
|
|
634
|
-
'image.png'?: MediaFileArtifact;
|
|
635
|
-
// (undocumented)
|
|
636
|
-
'thumb.jpg'?: MediaFileArtifact;
|
|
637
|
-
// (undocumented)
|
|
638
|
-
'video_1280.mp4'?: MediaFileArtifact;
|
|
639
|
-
// (undocumented)
|
|
640
|
-
'video_640.mp4'?: MediaFileArtifact;
|
|
641
|
-
}
|
|
609
|
+
export { MediaFileArtifacts }
|
|
642
610
|
|
|
643
611
|
// @public (undocumented)
|
|
644
612
|
export type MediaFileProcessingStatus = 'failed' | 'pending' | 'succeeded';
|
|
@@ -669,7 +637,7 @@ export type MediaRepresentations = {
|
|
|
669
637
|
|
|
670
638
|
// @public (undocumented)
|
|
671
639
|
export class MediaStore {
|
|
672
|
-
constructor(config: MediaApiConfig
|
|
640
|
+
constructor(config: MediaApiConfig);
|
|
673
641
|
// (undocumented)
|
|
674
642
|
appendChunksToUpload(uploadId: string, body: AppendChunksToUploadRequestBody, collectionName?: string, traceContext?: MediaTraceContext): Promise<void>;
|
|
675
643
|
// (undocumented)
|
|
@@ -679,8 +647,6 @@ export class MediaStore {
|
|
|
679
647
|
// (undocumented)
|
|
680
648
|
createUpload(createUpTo?: number, collectionName?: string, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaUpload[]>>;
|
|
681
649
|
// (undocumented)
|
|
682
|
-
readonly featureFlags?: MediaFeatureFlags | undefined;
|
|
683
|
-
// (undocumented)
|
|
684
650
|
getArtifactURL(artifacts: MediaFileArtifacts, artifactName: keyof MediaFileArtifacts, collectionName?: string): Promise<string>;
|
|
685
651
|
// (undocumented)
|
|
686
652
|
getFile(fileId: string, params?: MediaStoreGetFileParams, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaFile>>;
|
|
@@ -996,83 +962,11 @@ export interface PreviewableFileState {
|
|
|
996
962
|
export interface PreviewOptions {
|
|
997
963
|
}
|
|
998
964
|
|
|
999
|
-
|
|
1000
|
-
export interface ProcessedFileState extends BaseFileState {
|
|
1001
|
-
// (undocumented)
|
|
1002
|
-
artifacts: MediaFileArtifacts;
|
|
1003
|
-
// (undocumented)
|
|
1004
|
-
createdAt?: number;
|
|
1005
|
-
// (undocumented)
|
|
1006
|
-
id: string;
|
|
1007
|
-
// (undocumented)
|
|
1008
|
-
mediaType: MediaType;
|
|
1009
|
-
// (undocumented)
|
|
1010
|
-
mimeType: string;
|
|
1011
|
-
// (undocumented)
|
|
1012
|
-
name: string;
|
|
1013
|
-
// (undocumented)
|
|
1014
|
-
occurrenceKey?: string;
|
|
1015
|
-
// (undocumented)
|
|
1016
|
-
preview?: FilePreview | Promise<FilePreview>;
|
|
1017
|
-
// (undocumented)
|
|
1018
|
-
representations?: MediaRepresentations;
|
|
1019
|
-
// (undocumented)
|
|
1020
|
-
size: number;
|
|
1021
|
-
// (undocumented)
|
|
1022
|
-
status: 'processed';
|
|
1023
|
-
}
|
|
965
|
+
export { ProcessedFileState }
|
|
1024
966
|
|
|
1025
|
-
|
|
1026
|
-
export interface ProcessingFailedState extends BaseFileState {
|
|
1027
|
-
// (undocumented)
|
|
1028
|
-
artifacts: Object;
|
|
1029
|
-
// (undocumented)
|
|
1030
|
-
createdAt?: number;
|
|
1031
|
-
// (undocumented)
|
|
1032
|
-
id: string;
|
|
1033
|
-
// (undocumented)
|
|
1034
|
-
mediaType: MediaType;
|
|
1035
|
-
// (undocumented)
|
|
1036
|
-
mimeType: string;
|
|
1037
|
-
// (undocumented)
|
|
1038
|
-
name: string;
|
|
1039
|
-
// (undocumented)
|
|
1040
|
-
occurrenceKey?: string;
|
|
1041
|
-
// (undocumented)
|
|
1042
|
-
preview?: FilePreview | Promise<FilePreview>;
|
|
1043
|
-
// (undocumented)
|
|
1044
|
-
representations?: MediaRepresentations;
|
|
1045
|
-
// (undocumented)
|
|
1046
|
-
size: number;
|
|
1047
|
-
// (undocumented)
|
|
1048
|
-
status: 'failed-processing';
|
|
1049
|
-
}
|
|
967
|
+
export { ProcessingFailedState }
|
|
1050
968
|
|
|
1051
|
-
|
|
1052
|
-
export interface ProcessingFileState extends BaseFileState {
|
|
1053
|
-
// (undocumented)
|
|
1054
|
-
artifacts?: MediaFileArtifacts;
|
|
1055
|
-
// (undocumented)
|
|
1056
|
-
createdAt?: number;
|
|
1057
|
-
// (undocumented)
|
|
1058
|
-
id: string;
|
|
1059
|
-
// (undocumented)
|
|
1060
|
-
mediaType: MediaType;
|
|
1061
|
-
// (undocumented)
|
|
1062
|
-
mimeType: string;
|
|
1063
|
-
// (undocumented)
|
|
1064
|
-
name: string;
|
|
1065
|
-
// (undocumented)
|
|
1066
|
-
occurrenceKey?: string;
|
|
1067
|
-
// (undocumented)
|
|
1068
|
-
preview?: FilePreview | Promise<FilePreview>;
|
|
1069
|
-
// (undocumented)
|
|
1070
|
-
representations?: MediaRepresentations;
|
|
1071
|
-
// (undocumented)
|
|
1072
|
-
size: number;
|
|
1073
|
-
// (undocumented)
|
|
1074
|
-
status: 'processing';
|
|
1075
|
-
}
|
|
969
|
+
export { ProcessingFileState }
|
|
1076
970
|
|
|
1077
971
|
// @public (undocumented)
|
|
1078
972
|
export const RECENTS_COLLECTION = "recents";
|
|
@@ -1212,6 +1106,25 @@ export class StargateClient {
|
|
|
1212
1106
|
isTokenExpired(token: EdgeData): boolean;
|
|
1213
1107
|
}
|
|
1214
1108
|
|
|
1109
|
+
// @public (undocumented)
|
|
1110
|
+
class StreamsCache<T> {
|
|
1111
|
+
constructor(streams: LRUMap<string, ReplaySubject<T>>);
|
|
1112
|
+
// (undocumented)
|
|
1113
|
+
get(id: string): ReplaySubject<T> | undefined;
|
|
1114
|
+
// (undocumented)
|
|
1115
|
+
getOrInsert(id: string, callback: () => ReplaySubject<T>): ReplaySubject<T>;
|
|
1116
|
+
// (undocumented)
|
|
1117
|
+
has(id: string): boolean;
|
|
1118
|
+
// (undocumented)
|
|
1119
|
+
remove(id: string): void;
|
|
1120
|
+
// (undocumented)
|
|
1121
|
+
removeAll(): void;
|
|
1122
|
+
// (undocumented)
|
|
1123
|
+
set(id: string, stream: ReplaySubject<T>): void;
|
|
1124
|
+
// (undocumented)
|
|
1125
|
+
get size(): number;
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1215
1128
|
// @public (undocumented)
|
|
1216
1129
|
export type TouchedFiles = {
|
|
1217
1130
|
created: CreatedTouchedFile[];
|
|
@@ -1282,29 +1195,7 @@ export interface UploadFileResult {
|
|
|
1282
1195
|
cancel: () => void;
|
|
1283
1196
|
}
|
|
1284
1197
|
|
|
1285
|
-
|
|
1286
|
-
export interface UploadingFileState extends BaseFileState {
|
|
1287
|
-
// (undocumented)
|
|
1288
|
-
createdAt?: number;
|
|
1289
|
-
// (undocumented)
|
|
1290
|
-
id: string;
|
|
1291
|
-
// (undocumented)
|
|
1292
|
-
mediaType: MediaType;
|
|
1293
|
-
// (undocumented)
|
|
1294
|
-
mimeType: string;
|
|
1295
|
-
// (undocumented)
|
|
1296
|
-
name: string;
|
|
1297
|
-
// (undocumented)
|
|
1298
|
-
occurrenceKey?: string;
|
|
1299
|
-
// (undocumented)
|
|
1300
|
-
preview?: FilePreview | Promise<FilePreview>;
|
|
1301
|
-
// (undocumented)
|
|
1302
|
-
progress: number;
|
|
1303
|
-
// (undocumented)
|
|
1304
|
-
size: number;
|
|
1305
|
-
// (undocumented)
|
|
1306
|
-
status: 'uploading';
|
|
1307
|
-
}
|
|
1198
|
+
export { UploadingFileState }
|
|
1308
1199
|
|
|
1309
1200
|
// @public (undocumented)
|
|
1310
1201
|
export interface WithMediaClient {
|
|
@@ -1327,7 +1218,7 @@ export interface WithMediaClientConfig {
|
|
|
1327
1218
|
export type WithMediaClientConfigProps<P extends WithMediaClient> = Omit<P, 'mediaClient'> & WithMediaClientConfig;
|
|
1328
1219
|
|
|
1329
1220
|
// @public (undocumented)
|
|
1330
|
-
export type WithMediaClientFunction = <P extends WithMediaClient>(Component: React_2.ComponentType<P
|
|
1221
|
+
export type WithMediaClientFunction = <P extends WithMediaClient>(Component: React_2.ComponentType<P>) => React_2.ComponentType<WithMediaClientConfigProps<P>>;
|
|
1331
1222
|
|
|
1332
1223
|
// (No @packageDocumentation comment for this package)
|
|
1333
1224
|
|