@atlaskit/media-client 23.1.3 → 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 +23 -0
- package/dist/cjs/client/file-fetcher/index.js +112 -36
- package/dist/cjs/client/media-client.js +18 -6
- package/dist/cjs/client/media-store/index.js +3 -4
- package/dist/cjs/client/mobile-upload.js +38 -2
- package/dist/cjs/index.js +7 -0
- package/dist/cjs/models/file-state.js +2 -2
- package/dist/cjs/test-helpers/_numbers.js +9 -0
- package/dist/cjs/test-helpers/authProvider.js +71 -0
- package/dist/cjs/test-helpers/collectionNames.js +16 -0
- package/dist/cjs/test-helpers/exampleMediaItems.js +317 -0
- package/dist/cjs/test-helpers/fakeMediaClient.js +77 -0
- package/dist/cjs/test-helpers/index.js +374 -0
- package/dist/cjs/test-helpers/mediaClientProvider.js +60 -0
- package/dist/cjs/test-helpers/mediaPickerAuthProvider.js +95 -0
- package/dist/cjs/utils/createFileDataLoader.js +2 -2
- package/dist/cjs/utils/mobileUpload/stateMachine/states/uploading.js +2 -2
- package/dist/cjs/utils/polling/index.js +2 -2
- package/dist/cjs/utils/request/helpers.js +2 -2
- package/dist/cjs/utils/url.js +2 -2
- 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/test-helpers/_numbers.js +3 -0
- package/dist/es2019/test-helpers/authProvider.js +34 -0
- package/dist/es2019/test-helpers/collectionNames.js +5 -0
- package/dist/es2019/test-helpers/exampleMediaItems.js +268 -0
- package/dist/es2019/test-helpers/fakeMediaClient.js +63 -0
- package/dist/es2019/test-helpers/index.js +7 -0
- package/dist/es2019/test-helpers/mediaClientProvider.js +42 -0
- package/dist/es2019/test-helpers/mediaPickerAuthProvider.js +56 -0
- package/dist/es2019/utils/with-media-client-hoc.js +8 -16
- package/dist/esm/client/file-fetcher/index.js +108 -32
- package/dist/esm/client/media-client.js +19 -7
- package/dist/esm/client/media-store/index.js +3 -4
- package/dist/esm/client/mobile-upload.js +38 -2
- package/dist/esm/index.js +1 -0
- package/dist/esm/models/file-state.js +2 -2
- package/dist/esm/test-helpers/_numbers.js +3 -0
- package/dist/esm/test-helpers/authProvider.js +63 -0
- package/dist/esm/test-helpers/collectionNames.js +5 -0
- package/dist/esm/test-helpers/exampleMediaItems.js +268 -0
- package/dist/esm/test-helpers/fakeMediaClient.js +69 -0
- package/dist/esm/test-helpers/index.js +7 -0
- package/dist/esm/test-helpers/mediaClientProvider.js +48 -0
- package/dist/esm/test-helpers/mediaPickerAuthProvider.js +85 -0
- package/dist/esm/utils/createFileDataLoader.js +2 -2
- package/dist/esm/utils/mobileUpload/stateMachine/states/uploading.js +2 -2
- package/dist/esm/utils/polling/index.js +2 -2
- package/dist/esm/utils/request/helpers.js +2 -2
- package/dist/esm/utils/url.js +2 -2
- 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 -11
- 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/test-helpers/_numbers.d.ts +1 -0
- package/dist/types/test-helpers/authProvider.d.ts +6 -0
- package/dist/types/test-helpers/collectionNames.d.ts +5 -0
- package/dist/types/test-helpers/exampleMediaItems.d.ts +53 -0
- package/dist/types/test-helpers/fakeMediaClient.d.ts +4 -0
- package/dist/types/test-helpers/index.d.ts +7 -0
- package/dist/types/test-helpers/mediaClientProvider.d.ts +23 -0
- package/dist/types/test-helpers/mediaPickerAuthProvider.d.ts +5 -0
- 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 -11
- 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/test-helpers/_numbers.d.ts +1 -0
- package/dist/types-ts4.5/test-helpers/authProvider.d.ts +6 -0
- package/dist/types-ts4.5/test-helpers/collectionNames.d.ts +5 -0
- package/dist/types-ts4.5/test-helpers/exampleMediaItems.d.ts +53 -0
- package/dist/types-ts4.5/test-helpers/fakeMediaClient.d.ts +4 -0
- package/dist/types-ts4.5/test-helpers/index.d.ts +7 -0
- package/dist/types-ts4.5/test-helpers/mediaClientProvider.d.ts +23 -0
- package/dist/types-ts4.5/test-helpers/mediaPickerAuthProvider.d.ts +5 -0
- 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 +13 -4
- package/report.api.md +52 -162
- package/tmp/api-report-tmp.d.ts +51 -154
- package/dist/cjs/version.json +0 -5
- package/dist/es2019/version.json +0 -5
- package/dist/esm/version.json +0 -5
package/report.api.md
CHANGED
|
@@ -21,14 +21,24 @@ import { AuthContext } from '@atlaskit/media-core';
|
|
|
21
21
|
import { AuthProvider } from '@atlaskit/media-core';
|
|
22
22
|
import { ChunkinatorFile } from '@atlaskit/chunkinator';
|
|
23
23
|
import { ClientAltBasedAuth } from '@atlaskit/media-core';
|
|
24
|
+
import { ErrorFileState } from '@atlaskit/media-state';
|
|
25
|
+
import { FilePreview } from '@atlaskit/media-state';
|
|
26
|
+
import { FileState } from '@atlaskit/media-state';
|
|
24
27
|
import { FileStatus as FileStatus_2 } from '@atlaskit/media-common';
|
|
28
|
+
import { LRUMap } from 'lru_map';
|
|
25
29
|
import { MediaApiConfig } from '@atlaskit/media-core';
|
|
26
30
|
import { MediaClientConfig } from '@atlaskit/media-core';
|
|
27
|
-
import {
|
|
31
|
+
import { MediaFileArtifact } from '@atlaskit/media-state';
|
|
32
|
+
import { MediaFileArtifacts } from '@atlaskit/media-state';
|
|
33
|
+
import { MediaStore as MediaStore_2 } from '@atlaskit/media-state';
|
|
28
34
|
import { MediaTraceContext } from '@atlaskit/media-common';
|
|
29
35
|
import { MediaType } from '@atlaskit/media-common';
|
|
36
|
+
import { ProcessedFileState } from '@atlaskit/media-state';
|
|
37
|
+
import { ProcessingFailedState } from '@atlaskit/media-state';
|
|
38
|
+
import { ProcessingFileState } from '@atlaskit/media-state';
|
|
30
39
|
import { default as React_2 } from 'react';
|
|
31
40
|
import { ReplaySubject } from 'rxjs/ReplaySubject';
|
|
41
|
+
import { UploadingFileState } from '@atlaskit/media-state';
|
|
32
42
|
|
|
33
43
|
// @public (undocumented)
|
|
34
44
|
export type AbortFunction = () => void;
|
|
@@ -51,11 +61,6 @@ export type Artifacts = {
|
|
|
51
61
|
[name: string]: MediaArtifact;
|
|
52
62
|
};
|
|
53
63
|
|
|
54
|
-
// @public (undocumented)
|
|
55
|
-
type BaseFileState = {
|
|
56
|
-
metadataTraceContext?: MediaTraceContext;
|
|
57
|
-
};
|
|
58
|
-
|
|
59
64
|
// @public
|
|
60
65
|
abstract class BaseMediaClientError<
|
|
61
66
|
Attributes extends MediaClientErrorAttributes,
|
|
@@ -170,17 +175,7 @@ export interface EmptyFile {
|
|
|
170
175
|
readonly id: string;
|
|
171
176
|
}
|
|
172
177
|
|
|
173
|
-
|
|
174
|
-
export interface ErrorFileState extends BaseFileState {
|
|
175
|
-
// (undocumented)
|
|
176
|
-
id: string;
|
|
177
|
-
// (undocumented)
|
|
178
|
-
message?: string;
|
|
179
|
-
// (undocumented)
|
|
180
|
-
occurrenceKey?: string;
|
|
181
|
-
// (undocumented)
|
|
182
|
-
status: 'error';
|
|
183
|
-
}
|
|
178
|
+
export { ErrorFileState };
|
|
184
179
|
|
|
185
180
|
// @public (undocumented)
|
|
186
181
|
type ErrorObserver = PartialObserver & Required<Pick<PartialObserver, 'error'>>;
|
|
@@ -337,7 +332,7 @@ export type FileFetcherErrorReason =
|
|
|
337
332
|
|
|
338
333
|
// @public (undocumented)
|
|
339
334
|
export class FileFetcherImpl implements FileFetcher {
|
|
340
|
-
constructor(
|
|
335
|
+
constructor(mediaApi: MediaStore, store?: MediaStore_2);
|
|
341
336
|
// (undocumented)
|
|
342
337
|
copyFile(
|
|
343
338
|
source: CopySourceFile,
|
|
@@ -404,18 +399,7 @@ export interface FileItem {
|
|
|
404
399
|
type: 'file';
|
|
405
400
|
}
|
|
406
401
|
|
|
407
|
-
|
|
408
|
-
export interface FilePreview {
|
|
409
|
-
// (undocumented)
|
|
410
|
-
origin?: 'local' | 'remote';
|
|
411
|
-
// (undocumented)
|
|
412
|
-
originalDimensions?: {
|
|
413
|
-
width: number;
|
|
414
|
-
height: number;
|
|
415
|
-
};
|
|
416
|
-
// (undocumented)
|
|
417
|
-
value: Blob | string;
|
|
418
|
-
}
|
|
402
|
+
export { FilePreview };
|
|
419
403
|
|
|
420
404
|
// @public (undocumented)
|
|
421
405
|
export type FileProcessingStatus =
|
|
@@ -424,13 +408,7 @@ export type FileProcessingStatus =
|
|
|
424
408
|
| 'running'
|
|
425
409
|
| 'succeeded';
|
|
426
410
|
|
|
427
|
-
|
|
428
|
-
export type FileState =
|
|
429
|
-
| ErrorFileState
|
|
430
|
-
| ProcessedFileState
|
|
431
|
-
| ProcessingFailedState
|
|
432
|
-
| ProcessingFileState
|
|
433
|
-
| UploadingFileState;
|
|
411
|
+
export { FileState };
|
|
434
412
|
|
|
435
413
|
// @public (undocumented)
|
|
436
414
|
export type FileStatus = FileStatus_2;
|
|
@@ -467,10 +445,12 @@ export interface GetFileOptions {
|
|
|
467
445
|
preview?: PreviewOptions;
|
|
468
446
|
}
|
|
469
447
|
|
|
448
|
+
// @public (undocumented)
|
|
449
|
+
export const getFileStreamsCache: () => StreamsCache<FileState>;
|
|
450
|
+
|
|
470
451
|
// @public (undocumented)
|
|
471
452
|
export const getMediaClient: (
|
|
472
453
|
mediaClientConfig: MediaClientConfig,
|
|
473
|
-
featureFlags?: MediaFeatureFlags,
|
|
474
454
|
) => MediaClient;
|
|
475
455
|
|
|
476
456
|
// @public (undocumented)
|
|
@@ -720,8 +700,11 @@ export type MediaChunksProbe = {
|
|
|
720
700
|
export class MediaClient {
|
|
721
701
|
constructor(
|
|
722
702
|
mediaClientConfig: MediaClientConfig,
|
|
723
|
-
|
|
703
|
+
store?: MediaStore_2,
|
|
704
|
+
mediaApi?: MediaStore,
|
|
724
705
|
);
|
|
706
|
+
// @internal (undocumented)
|
|
707
|
+
__DO_NOT_USE__getMediaStore(): MediaStore_2;
|
|
725
708
|
// (undocumented)
|
|
726
709
|
readonly config: MediaClientConfig;
|
|
727
710
|
// (undocumented)
|
|
@@ -730,8 +713,6 @@ export class MediaClient {
|
|
|
730
713
|
payload: UploadEventPayloadMap[E],
|
|
731
714
|
): boolean;
|
|
732
715
|
// (undocumented)
|
|
733
|
-
readonly featureFlags?: MediaFeatureFlags | undefined;
|
|
734
|
-
// (undocumented)
|
|
735
716
|
readonly file: FileFetcher;
|
|
736
717
|
// (undocumented)
|
|
737
718
|
getImage(
|
|
@@ -780,6 +761,8 @@ export class MediaClient {
|
|
|
780
761
|
readonly stargate: StargateClient;
|
|
781
762
|
}
|
|
782
763
|
|
|
764
|
+
export { MediaClientConfig };
|
|
765
|
+
|
|
783
766
|
// @public
|
|
784
767
|
export interface MediaClientError<Attributes extends MediaClientErrorAttributes>
|
|
785
768
|
extends Error {
|
|
@@ -834,23 +817,9 @@ export type MediaFile = {
|
|
|
834
817
|
readonly metadataTraceContext?: MediaTraceContext;
|
|
835
818
|
};
|
|
836
819
|
|
|
837
|
-
|
|
838
|
-
export type MediaFileArtifact = {
|
|
839
|
-
readonly url: string;
|
|
840
|
-
readonly processingStatus: MediaFileProcessingStatus;
|
|
841
|
-
};
|
|
820
|
+
export { MediaFileArtifact };
|
|
842
821
|
|
|
843
|
-
|
|
844
|
-
export interface MediaFileArtifacts {
|
|
845
|
-
// (undocumented)
|
|
846
|
-
'audio.mp3'?: MediaFileArtifact;
|
|
847
|
-
// (undocumented)
|
|
848
|
-
'document.pdf'?: MediaFileArtifact;
|
|
849
|
-
// (undocumented)
|
|
850
|
-
'video_1280.mp4'?: MediaFileArtifact;
|
|
851
|
-
// (undocumented)
|
|
852
|
-
'video_640.mp4'?: MediaFileArtifact;
|
|
853
|
-
}
|
|
822
|
+
export { MediaFileArtifacts };
|
|
854
823
|
|
|
855
824
|
// @public (undocumented)
|
|
856
825
|
export type MediaFileProcessingStatus = 'failed' | 'pending' | 'succeeded';
|
|
@@ -885,10 +854,7 @@ export type MediaRepresentations = {
|
|
|
885
854
|
|
|
886
855
|
// @public (undocumented)
|
|
887
856
|
export class MediaStore {
|
|
888
|
-
constructor(
|
|
889
|
-
config: MediaApiConfig,
|
|
890
|
-
featureFlags?: MediaFeatureFlags | undefined,
|
|
891
|
-
);
|
|
857
|
+
constructor(config: MediaApiConfig);
|
|
892
858
|
// (undocumented)
|
|
893
859
|
appendChunksToUpload(
|
|
894
860
|
uploadId: string,
|
|
@@ -915,8 +881,6 @@ export class MediaStore {
|
|
|
915
881
|
traceContext?: MediaTraceContext,
|
|
916
882
|
): Promise<MediaStoreResponse<MediaUpload[]>>;
|
|
917
883
|
// (undocumented)
|
|
918
|
-
readonly featureFlags?: MediaFeatureFlags | undefined;
|
|
919
|
-
// (undocumented)
|
|
920
884
|
getArtifactURL(
|
|
921
885
|
artifacts: MediaFileArtifacts,
|
|
922
886
|
artifactName: keyof MediaFileArtifacts,
|
|
@@ -1292,83 +1256,11 @@ export interface PreviewableFileState {
|
|
|
1292
1256
|
// @public (undocumented)
|
|
1293
1257
|
export interface PreviewOptions {}
|
|
1294
1258
|
|
|
1295
|
-
|
|
1296
|
-
export interface ProcessedFileState extends BaseFileState {
|
|
1297
|
-
// (undocumented)
|
|
1298
|
-
artifacts: MediaFileArtifacts;
|
|
1299
|
-
// (undocumented)
|
|
1300
|
-
createdAt?: number;
|
|
1301
|
-
// (undocumented)
|
|
1302
|
-
id: string;
|
|
1303
|
-
// (undocumented)
|
|
1304
|
-
mediaType: MediaType;
|
|
1305
|
-
// (undocumented)
|
|
1306
|
-
mimeType: string;
|
|
1307
|
-
// (undocumented)
|
|
1308
|
-
name: string;
|
|
1309
|
-
// (undocumented)
|
|
1310
|
-
occurrenceKey?: string;
|
|
1311
|
-
// (undocumented)
|
|
1312
|
-
preview?: FilePreview | Promise<FilePreview>;
|
|
1313
|
-
// (undocumented)
|
|
1314
|
-
representations?: MediaRepresentations;
|
|
1315
|
-
// (undocumented)
|
|
1316
|
-
size: number;
|
|
1317
|
-
// (undocumented)
|
|
1318
|
-
status: 'processed';
|
|
1319
|
-
}
|
|
1259
|
+
export { ProcessedFileState };
|
|
1320
1260
|
|
|
1321
|
-
|
|
1322
|
-
export interface ProcessingFailedState extends BaseFileState {
|
|
1323
|
-
// (undocumented)
|
|
1324
|
-
artifacts: Object;
|
|
1325
|
-
// (undocumented)
|
|
1326
|
-
createdAt?: number;
|
|
1327
|
-
// (undocumented)
|
|
1328
|
-
id: string;
|
|
1329
|
-
// (undocumented)
|
|
1330
|
-
mediaType: MediaType;
|
|
1331
|
-
// (undocumented)
|
|
1332
|
-
mimeType: string;
|
|
1333
|
-
// (undocumented)
|
|
1334
|
-
name: string;
|
|
1335
|
-
// (undocumented)
|
|
1336
|
-
occurrenceKey?: string;
|
|
1337
|
-
// (undocumented)
|
|
1338
|
-
preview?: FilePreview | Promise<FilePreview>;
|
|
1339
|
-
// (undocumented)
|
|
1340
|
-
representations?: MediaRepresentations;
|
|
1341
|
-
// (undocumented)
|
|
1342
|
-
size: number;
|
|
1343
|
-
// (undocumented)
|
|
1344
|
-
status: 'failed-processing';
|
|
1345
|
-
}
|
|
1261
|
+
export { ProcessingFailedState };
|
|
1346
1262
|
|
|
1347
|
-
|
|
1348
|
-
export interface ProcessingFileState extends BaseFileState {
|
|
1349
|
-
// (undocumented)
|
|
1350
|
-
artifacts?: MediaFileArtifacts;
|
|
1351
|
-
// (undocumented)
|
|
1352
|
-
createdAt?: number;
|
|
1353
|
-
// (undocumented)
|
|
1354
|
-
id: string;
|
|
1355
|
-
// (undocumented)
|
|
1356
|
-
mediaType: MediaType;
|
|
1357
|
-
// (undocumented)
|
|
1358
|
-
mimeType: string;
|
|
1359
|
-
// (undocumented)
|
|
1360
|
-
name: string;
|
|
1361
|
-
// (undocumented)
|
|
1362
|
-
occurrenceKey?: string;
|
|
1363
|
-
// (undocumented)
|
|
1364
|
-
preview?: FilePreview | Promise<FilePreview>;
|
|
1365
|
-
// (undocumented)
|
|
1366
|
-
representations?: MediaRepresentations;
|
|
1367
|
-
// (undocumented)
|
|
1368
|
-
size: number;
|
|
1369
|
-
// (undocumented)
|
|
1370
|
-
status: 'processing';
|
|
1371
|
-
}
|
|
1263
|
+
export { ProcessingFileState };
|
|
1372
1264
|
|
|
1373
1265
|
// @public (undocumented)
|
|
1374
1266
|
export const RECENTS_COLLECTION = 'recents';
|
|
@@ -1528,6 +1420,25 @@ export class StargateClient {
|
|
|
1528
1420
|
isTokenExpired(token: EdgeData): boolean;
|
|
1529
1421
|
}
|
|
1530
1422
|
|
|
1423
|
+
// @public (undocumented)
|
|
1424
|
+
class StreamsCache<T> {
|
|
1425
|
+
constructor(streams: LRUMap<string, ReplaySubject<T>>);
|
|
1426
|
+
// (undocumented)
|
|
1427
|
+
get(id: string): ReplaySubject<T> | undefined;
|
|
1428
|
+
// (undocumented)
|
|
1429
|
+
getOrInsert(id: string, callback: () => ReplaySubject<T>): ReplaySubject<T>;
|
|
1430
|
+
// (undocumented)
|
|
1431
|
+
has(id: string): boolean;
|
|
1432
|
+
// (undocumented)
|
|
1433
|
+
remove(id: string): void;
|
|
1434
|
+
// (undocumented)
|
|
1435
|
+
removeAll(): void;
|
|
1436
|
+
// (undocumented)
|
|
1437
|
+
set(id: string, stream: ReplaySubject<T>): void;
|
|
1438
|
+
// (undocumented)
|
|
1439
|
+
get size(): number;
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1531
1442
|
// @public (undocumented)
|
|
1532
1443
|
export type TouchedFiles = {
|
|
1533
1444
|
created: CreatedTouchedFile[];
|
|
@@ -1604,29 +1515,7 @@ export interface UploadFileResult {
|
|
|
1604
1515
|
cancel: () => void;
|
|
1605
1516
|
}
|
|
1606
1517
|
|
|
1607
|
-
|
|
1608
|
-
export interface UploadingFileState extends BaseFileState {
|
|
1609
|
-
// (undocumented)
|
|
1610
|
-
createdAt?: number;
|
|
1611
|
-
// (undocumented)
|
|
1612
|
-
id: string;
|
|
1613
|
-
// (undocumented)
|
|
1614
|
-
mediaType: MediaType;
|
|
1615
|
-
// (undocumented)
|
|
1616
|
-
mimeType: string;
|
|
1617
|
-
// (undocumented)
|
|
1618
|
-
name: string;
|
|
1619
|
-
// (undocumented)
|
|
1620
|
-
occurrenceKey?: string;
|
|
1621
|
-
// (undocumented)
|
|
1622
|
-
preview?: FilePreview | Promise<FilePreview>;
|
|
1623
|
-
// (undocumented)
|
|
1624
|
-
progress: number;
|
|
1625
|
-
// (undocumented)
|
|
1626
|
-
size: number;
|
|
1627
|
-
// (undocumented)
|
|
1628
|
-
status: 'uploading';
|
|
1629
|
-
}
|
|
1518
|
+
export { UploadingFileState };
|
|
1630
1519
|
|
|
1631
1520
|
// @public (undocumented)
|
|
1632
1521
|
export interface WithMediaClient {
|
|
@@ -1655,7 +1544,6 @@ export type WithMediaClientConfigProps<P extends WithMediaClient> = Omit<
|
|
|
1655
1544
|
// @public (undocumented)
|
|
1656
1545
|
export type WithMediaClientFunction = <P extends WithMediaClient>(
|
|
1657
1546
|
Component: React_2.ComponentType<P>,
|
|
1658
|
-
featureFlags?: MediaFeatureFlags,
|
|
1659
1547
|
) => React_2.ComponentType<WithMediaClientConfigProps<P>>;
|
|
1660
1548
|
|
|
1661
1549
|
// (No @packageDocumentation comment for this package)
|
|
@@ -1670,7 +1558,9 @@ export type WithMediaClientFunction = <P extends WithMediaClient>(
|
|
|
1670
1558
|
```json
|
|
1671
1559
|
{
|
|
1672
1560
|
"@atlaskit/media-core": "^34.1.2",
|
|
1561
|
+
"@atlaskit/media-state": "^1.0.0",
|
|
1673
1562
|
"@emotion/react": "^11.7.1",
|
|
1563
|
+
"enzyme": ">=3.10.0",
|
|
1674
1564
|
"react": "^16.8.0"
|
|
1675
1565
|
}
|
|
1676
1566
|
```
|
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,23 +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
|
-
'video_1280.mp4'?: MediaFileArtifact;
|
|
633
|
-
// (undocumented)
|
|
634
|
-
'video_640.mp4'?: MediaFileArtifact;
|
|
635
|
-
}
|
|
609
|
+
export { MediaFileArtifacts }
|
|
636
610
|
|
|
637
611
|
// @public (undocumented)
|
|
638
612
|
export type MediaFileProcessingStatus = 'failed' | 'pending' | 'succeeded';
|
|
@@ -663,7 +637,7 @@ export type MediaRepresentations = {
|
|
|
663
637
|
|
|
664
638
|
// @public (undocumented)
|
|
665
639
|
export class MediaStore {
|
|
666
|
-
constructor(config: MediaApiConfig
|
|
640
|
+
constructor(config: MediaApiConfig);
|
|
667
641
|
// (undocumented)
|
|
668
642
|
appendChunksToUpload(uploadId: string, body: AppendChunksToUploadRequestBody, collectionName?: string, traceContext?: MediaTraceContext): Promise<void>;
|
|
669
643
|
// (undocumented)
|
|
@@ -673,8 +647,6 @@ export class MediaStore {
|
|
|
673
647
|
// (undocumented)
|
|
674
648
|
createUpload(createUpTo?: number, collectionName?: string, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaUpload[]>>;
|
|
675
649
|
// (undocumented)
|
|
676
|
-
readonly featureFlags?: MediaFeatureFlags | undefined;
|
|
677
|
-
// (undocumented)
|
|
678
650
|
getArtifactURL(artifacts: MediaFileArtifacts, artifactName: keyof MediaFileArtifacts, collectionName?: string): Promise<string>;
|
|
679
651
|
// (undocumented)
|
|
680
652
|
getFile(fileId: string, params?: MediaStoreGetFileParams, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaFile>>;
|
|
@@ -990,83 +962,11 @@ export interface PreviewableFileState {
|
|
|
990
962
|
export interface PreviewOptions {
|
|
991
963
|
}
|
|
992
964
|
|
|
993
|
-
|
|
994
|
-
export interface ProcessedFileState extends BaseFileState {
|
|
995
|
-
// (undocumented)
|
|
996
|
-
artifacts: MediaFileArtifacts;
|
|
997
|
-
// (undocumented)
|
|
998
|
-
createdAt?: number;
|
|
999
|
-
// (undocumented)
|
|
1000
|
-
id: string;
|
|
1001
|
-
// (undocumented)
|
|
1002
|
-
mediaType: MediaType;
|
|
1003
|
-
// (undocumented)
|
|
1004
|
-
mimeType: string;
|
|
1005
|
-
// (undocumented)
|
|
1006
|
-
name: string;
|
|
1007
|
-
// (undocumented)
|
|
1008
|
-
occurrenceKey?: string;
|
|
1009
|
-
// (undocumented)
|
|
1010
|
-
preview?: FilePreview | Promise<FilePreview>;
|
|
1011
|
-
// (undocumented)
|
|
1012
|
-
representations?: MediaRepresentations;
|
|
1013
|
-
// (undocumented)
|
|
1014
|
-
size: number;
|
|
1015
|
-
// (undocumented)
|
|
1016
|
-
status: 'processed';
|
|
1017
|
-
}
|
|
965
|
+
export { ProcessedFileState }
|
|
1018
966
|
|
|
1019
|
-
|
|
1020
|
-
export interface ProcessingFailedState extends BaseFileState {
|
|
1021
|
-
// (undocumented)
|
|
1022
|
-
artifacts: Object;
|
|
1023
|
-
// (undocumented)
|
|
1024
|
-
createdAt?: number;
|
|
1025
|
-
// (undocumented)
|
|
1026
|
-
id: string;
|
|
1027
|
-
// (undocumented)
|
|
1028
|
-
mediaType: MediaType;
|
|
1029
|
-
// (undocumented)
|
|
1030
|
-
mimeType: string;
|
|
1031
|
-
// (undocumented)
|
|
1032
|
-
name: string;
|
|
1033
|
-
// (undocumented)
|
|
1034
|
-
occurrenceKey?: string;
|
|
1035
|
-
// (undocumented)
|
|
1036
|
-
preview?: FilePreview | Promise<FilePreview>;
|
|
1037
|
-
// (undocumented)
|
|
1038
|
-
representations?: MediaRepresentations;
|
|
1039
|
-
// (undocumented)
|
|
1040
|
-
size: number;
|
|
1041
|
-
// (undocumented)
|
|
1042
|
-
status: 'failed-processing';
|
|
1043
|
-
}
|
|
967
|
+
export { ProcessingFailedState }
|
|
1044
968
|
|
|
1045
|
-
|
|
1046
|
-
export interface ProcessingFileState extends BaseFileState {
|
|
1047
|
-
// (undocumented)
|
|
1048
|
-
artifacts?: MediaFileArtifacts;
|
|
1049
|
-
// (undocumented)
|
|
1050
|
-
createdAt?: number;
|
|
1051
|
-
// (undocumented)
|
|
1052
|
-
id: string;
|
|
1053
|
-
// (undocumented)
|
|
1054
|
-
mediaType: MediaType;
|
|
1055
|
-
// (undocumented)
|
|
1056
|
-
mimeType: string;
|
|
1057
|
-
// (undocumented)
|
|
1058
|
-
name: string;
|
|
1059
|
-
// (undocumented)
|
|
1060
|
-
occurrenceKey?: string;
|
|
1061
|
-
// (undocumented)
|
|
1062
|
-
preview?: FilePreview | Promise<FilePreview>;
|
|
1063
|
-
// (undocumented)
|
|
1064
|
-
representations?: MediaRepresentations;
|
|
1065
|
-
// (undocumented)
|
|
1066
|
-
size: number;
|
|
1067
|
-
// (undocumented)
|
|
1068
|
-
status: 'processing';
|
|
1069
|
-
}
|
|
969
|
+
export { ProcessingFileState }
|
|
1070
970
|
|
|
1071
971
|
// @public (undocumented)
|
|
1072
972
|
export const RECENTS_COLLECTION = "recents";
|
|
@@ -1206,6 +1106,25 @@ export class StargateClient {
|
|
|
1206
1106
|
isTokenExpired(token: EdgeData): boolean;
|
|
1207
1107
|
}
|
|
1208
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
|
+
|
|
1209
1128
|
// @public (undocumented)
|
|
1210
1129
|
export type TouchedFiles = {
|
|
1211
1130
|
created: CreatedTouchedFile[];
|
|
@@ -1276,29 +1195,7 @@ export interface UploadFileResult {
|
|
|
1276
1195
|
cancel: () => void;
|
|
1277
1196
|
}
|
|
1278
1197
|
|
|
1279
|
-
|
|
1280
|
-
export interface UploadingFileState extends BaseFileState {
|
|
1281
|
-
// (undocumented)
|
|
1282
|
-
createdAt?: number;
|
|
1283
|
-
// (undocumented)
|
|
1284
|
-
id: string;
|
|
1285
|
-
// (undocumented)
|
|
1286
|
-
mediaType: MediaType;
|
|
1287
|
-
// (undocumented)
|
|
1288
|
-
mimeType: string;
|
|
1289
|
-
// (undocumented)
|
|
1290
|
-
name: string;
|
|
1291
|
-
// (undocumented)
|
|
1292
|
-
occurrenceKey?: string;
|
|
1293
|
-
// (undocumented)
|
|
1294
|
-
preview?: FilePreview | Promise<FilePreview>;
|
|
1295
|
-
// (undocumented)
|
|
1296
|
-
progress: number;
|
|
1297
|
-
// (undocumented)
|
|
1298
|
-
size: number;
|
|
1299
|
-
// (undocumented)
|
|
1300
|
-
status: 'uploading';
|
|
1301
|
-
}
|
|
1198
|
+
export { UploadingFileState }
|
|
1302
1199
|
|
|
1303
1200
|
// @public (undocumented)
|
|
1304
1201
|
export interface WithMediaClient {
|
|
@@ -1321,7 +1218,7 @@ export interface WithMediaClientConfig {
|
|
|
1321
1218
|
export type WithMediaClientConfigProps<P extends WithMediaClient> = Omit<P, 'mediaClient'> & WithMediaClientConfig;
|
|
1322
1219
|
|
|
1323
1220
|
// @public (undocumented)
|
|
1324
|
-
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>>;
|
|
1325
1222
|
|
|
1326
1223
|
// (No @packageDocumentation comment for this package)
|
|
1327
1224
|
|
package/dist/cjs/version.json
DELETED
package/dist/es2019/version.json
DELETED