@atlaskit/media-client 18.1.0 → 19.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 +10 -0
- package/dist/cjs/client/collection-fetcher.js +8 -8
- package/dist/cjs/client/file-fetcher/index.js +40 -36
- package/dist/cjs/client/media-client.js +2 -2
- package/dist/cjs/client/media-store/index.js +69 -52
- package/dist/cjs/uploader/index.js +22 -20
- package/dist/cjs/utils/request/helpers.js +39 -22
- package/dist/cjs/utils/request/index.js +3 -2
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/client/collection-fetcher.js +6 -6
- package/dist/es2019/client/file-fetcher/index.js +16 -14
- package/dist/es2019/client/media-client.js +2 -2
- package/dist/es2019/client/media-store/index.js +50 -41
- package/dist/es2019/uploader/index.js +13 -13
- package/dist/es2019/utils/request/helpers.js +26 -8
- package/dist/es2019/utils/request/index.js +4 -3
- package/dist/es2019/version.json +1 -1
- package/dist/esm/client/collection-fetcher.js +8 -8
- package/dist/esm/client/file-fetcher/index.js +40 -36
- package/dist/esm/client/media-client.js +2 -2
- package/dist/esm/client/media-store/index.js +68 -50
- package/dist/esm/uploader/index.js +22 -20
- package/dist/esm/utils/request/helpers.js +36 -20
- package/dist/esm/utils/request/index.js +4 -3
- package/dist/esm/version.json +1 -1
- package/dist/types/client/collection-fetcher.d.ts +4 -3
- package/dist/types/client/file-fetcher/index.d.ts +9 -8
- package/dist/types/client/media-client.d.ts +2 -2
- package/dist/types/client/media-store/index.d.ts +15 -21
- package/dist/types/uploader/index.d.ts +2 -1
- package/dist/types/utils/request/helpers.d.ts +10 -2
- package/dist/types/utils/request/types.d.ts +2 -0
- package/package.json +4 -12
- package/report.api.md +101 -70
- package/dist/types-ts4.0/client/__mocks__/collection-fetcher.d.ts +0 -8
- package/dist/types-ts4.0/client/__mocks__/file-fetcher.d.ts +0 -10
- package/dist/types-ts4.0/client/__mocks__/media-client.d.ts +0 -13
- package/dist/types-ts4.0/client/collection-fetcher.d.ts +0 -35
- package/dist/types-ts4.0/client/events.d.ts +0 -14
- package/dist/types-ts4.0/client/file-fetcher/error.d.ts +0 -29
- package/dist/types-ts4.0/client/file-fetcher/index.d.ts +0 -56
- package/dist/types-ts4.0/client/media-client.d.ts +0 -28
- package/dist/types-ts4.0/client/media-store/error.d.ts +0 -16
- package/dist/types-ts4.0/client/media-store/index.d.ts +0 -174
- package/dist/types-ts4.0/client/media-store/resolveAuth.d.ts +0 -4
- package/dist/types-ts4.0/client/mobile-upload.d.ts +0 -11
- package/dist/types-ts4.0/client/stargate-client.d.ts +0 -15
- package/dist/types-ts4.0/constants.d.ts +0 -6
- package/dist/types-ts4.0/file-streams-cache.d.ts +0 -15
- package/dist/types-ts4.0/globalMediaEventEmitter.d.ts +0 -6
- package/dist/types-ts4.0/identifier.d.ts +0 -15
- package/dist/types-ts4.0/index.d.ts +0 -89
- package/dist/types-ts4.0/models/artifacts.d.ts +0 -12
- package/dist/types-ts4.0/models/auth-headers.d.ts +0 -11
- package/dist/types-ts4.0/models/auth-query-parameters.d.ts +0 -11
- package/dist/types-ts4.0/models/errors/helpers.d.ts +0 -6
- package/dist/types-ts4.0/models/errors/index.d.ts +0 -11
- package/dist/types-ts4.0/models/errors/types.d.ts +0 -15
- package/dist/types-ts4.0/models/file-state.d.ts +0 -91
- package/dist/types-ts4.0/models/item.d.ts +0 -25
- package/dist/types-ts4.0/models/media-subscribable.d.ts +0 -3
- package/dist/types-ts4.0/models/media.d.ts +0 -66
- package/dist/types-ts4.0/models/mobile-upload.d.ts +0 -28
- package/dist/types-ts4.0/upload-controller.d.ts +0 -7
- package/dist/types-ts4.0/uploader/calculateChunkSize.d.ts +0 -11
- package/dist/types-ts4.0/uploader/error.d.ts +0 -29
- package/dist/types-ts4.0/uploader/index.d.ts +0 -21
- package/dist/types-ts4.0/utils/checkWebpSupport.d.ts +0 -1
- package/dist/types-ts4.0/utils/convertBase64ToBlob.d.ts +0 -1
- package/dist/types-ts4.0/utils/createFileDataLoader.d.ts +0 -30
- package/dist/types-ts4.0/utils/createMediaSubject.d.ts +0 -3
- package/dist/types-ts4.0/utils/detectEmptyFile.d.ts +0 -16
- package/dist/types-ts4.0/utils/getDimensionsFromBlob.d.ts +0 -6
- package/dist/types-ts4.0/utils/getImageDimensionsFromBlob.d.ts +0 -5
- package/dist/types-ts4.0/utils/getMediaTypeFromUploadableFile.d.ts +0 -3
- package/dist/types-ts4.0/utils/getVideoDimensionsFromBlob.d.ts +0 -5
- package/dist/types-ts4.0/utils/hashing/hasher.d.ts +0 -3
- package/dist/types-ts4.0/utils/hashing/hasherCreator.d.ts +0 -3
- package/dist/types-ts4.0/utils/hashing/simpleHasher.d.ts +0 -4
- package/dist/types-ts4.0/utils/hashing/workerHasher.d.ts +0 -16
- package/dist/types-ts4.0/utils/imageResizeModeToFileImageMode.d.ts +0 -3
- package/dist/types-ts4.0/utils/isImageRemote.d.ts +0 -1
- package/dist/types-ts4.0/utils/mediaSubscribable/fromObservable.d.ts +0 -5
- package/dist/types-ts4.0/utils/mediaSubscribable/index.d.ts +0 -3
- package/dist/types-ts4.0/utils/mediaSubscribable/toPromise.d.ts +0 -10
- package/dist/types-ts4.0/utils/mediaSubscribable/types.d.ts +0 -16
- package/dist/types-ts4.0/utils/mobileUpload/error.d.ts +0 -29
- package/dist/types-ts4.0/utils/mobileUpload/helpers.d.ts +0 -8
- package/dist/types-ts4.0/utils/mobileUpload/index.d.ts +0 -5
- package/dist/types-ts4.0/utils/mobileUpload/servicesCache.d.ts +0 -4
- package/dist/types-ts4.0/utils/mobileUpload/stateMachine/index.d.ts +0 -7
- package/dist/types-ts4.0/utils/mobileUpload/stateMachine/states/error.d.ts +0 -3
- package/dist/types-ts4.0/utils/mobileUpload/stateMachine/states/processed.d.ts +0 -3
- package/dist/types-ts4.0/utils/mobileUpload/stateMachine/states/processing.d.ts +0 -3
- package/dist/types-ts4.0/utils/mobileUpload/stateMachine/states/processingFailed.d.ts +0 -3
- package/dist/types-ts4.0/utils/mobileUpload/stateMachine/states/uploading.d.ts +0 -3
- package/dist/types-ts4.0/utils/mobileUpload/stateMachine/types.d.ts +0 -69
- package/dist/types-ts4.0/utils/overrideMediaTypeIfUnknown.d.ts +0 -5
- package/dist/types-ts4.0/utils/polling/errors.d.ts +0 -12
- package/dist/types-ts4.0/utils/polling/index.d.ts +0 -33
- package/dist/types-ts4.0/utils/polling/types.d.ts +0 -7
- package/dist/types-ts4.0/utils/request/errors.d.ts +0 -20
- package/dist/types-ts4.0/utils/request/helpers.d.ts +0 -38
- package/dist/types-ts4.0/utils/request/index.d.ts +0 -5
- package/dist/types-ts4.0/utils/request/types.d.ts +0 -43
- package/dist/types-ts4.0/utils/safeUnsubscribe.d.ts +0 -2
- package/dist/types-ts4.0/utils/setTimeoutPromise.d.ts +0 -2
- package/dist/types-ts4.0/utils/shouldFetchRemoteFileStates.d.ts +0 -16
- package/dist/types-ts4.0/utils/url.d.ts +0 -17
- package/dist/types-ts4.0/utils/with-media-client-hoc.d.ts +0 -16
package/report.api.md
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
|
+
<!-- API Report Version: 2.2 -->
|
|
2
|
+
|
|
1
3
|
## API Report File for "@atlaskit/media-client"
|
|
2
4
|
|
|
3
|
-
> Do not edit this file.
|
|
5
|
+
> Do not edit this file. This report is auto-generated using [API Extractor](https://api-extractor.com/).
|
|
6
|
+
> [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
|
|
7
|
+
|
|
8
|
+
### Table of contents
|
|
4
9
|
|
|
5
|
-
|
|
6
|
-
Generated API Report version: 2.0
|
|
7
|
-
-->
|
|
10
|
+
- [Main Entry Types](#main-entry-types)
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
### Main Entry Types
|
|
13
|
+
|
|
14
|
+
<!--SECTION START: Main Entry Types-->
|
|
10
15
|
|
|
11
16
|
```ts
|
|
12
17
|
import { AsapBasedAuth } from '@atlaskit/media-core';
|
|
@@ -19,6 +24,7 @@ import { FileStatus as FileStatus_2 } from '@atlaskit/media-common';
|
|
|
19
24
|
import { MediaApiConfig } from '@atlaskit/media-core';
|
|
20
25
|
import { MediaClientConfig } from '@atlaskit/media-core';
|
|
21
26
|
import { MediaFeatureFlags } from '@atlaskit/media-common';
|
|
27
|
+
import { MediaTraceContext } from '@atlaskit/media-common';
|
|
22
28
|
import { MediaType } from '@atlaskit/media-common';
|
|
23
29
|
import { default as React_2 } from 'react';
|
|
24
30
|
import { ReplaySubject } from 'rxjs/ReplaySubject';
|
|
@@ -46,10 +52,11 @@ export type Artifacts = {
|
|
|
46
52
|
|
|
47
53
|
// @public
|
|
48
54
|
abstract class BaseMediaClientError<
|
|
49
|
-
Attributes extends MediaClientErrorAttributes
|
|
55
|
+
Attributes extends MediaClientErrorAttributes,
|
|
50
56
|
>
|
|
51
57
|
extends Error
|
|
52
|
-
implements MediaClientError<Attributes>
|
|
58
|
+
implements MediaClientError<Attributes>
|
|
59
|
+
{
|
|
53
60
|
constructor(message: string);
|
|
54
61
|
// (undocumented)
|
|
55
62
|
abstract get attributes(): Attributes;
|
|
@@ -73,11 +80,13 @@ export class CollectionFetcher {
|
|
|
73
80
|
getItems(
|
|
74
81
|
collectionName: string,
|
|
75
82
|
params?: MediaStoreGetCollectionItemsParams,
|
|
83
|
+
traceContext?: MediaTraceContext,
|
|
76
84
|
): MediaSubscribable<MediaCollectionItem[]>;
|
|
77
85
|
// (undocumented)
|
|
78
86
|
loadNextPage(
|
|
79
87
|
collectionName: string,
|
|
80
88
|
params?: MediaStoreGetCollectionItemsParams,
|
|
89
|
+
traceContext?: MediaTraceContext,
|
|
81
90
|
): Promise<void>;
|
|
82
91
|
// (undocumented)
|
|
83
92
|
readonly mediaStore: MediaStore;
|
|
@@ -86,6 +95,7 @@ export class CollectionFetcher {
|
|
|
86
95
|
id: string,
|
|
87
96
|
collectionName: string,
|
|
88
97
|
occurrenceKey?: string,
|
|
98
|
+
traceContext?: MediaTraceContext,
|
|
89
99
|
): Promise<void>;
|
|
90
100
|
}
|
|
91
101
|
|
|
@@ -129,12 +139,12 @@ export interface CreatedTouchedFile {
|
|
|
129
139
|
|
|
130
140
|
// @public (undocumented)
|
|
131
141
|
export function createMediaSubject<T extends MediaSubscribableItem>(
|
|
132
|
-
initialState?:
|
|
142
|
+
initialState?: Error | T,
|
|
133
143
|
): ReplaySubject<T>;
|
|
134
144
|
|
|
135
145
|
// @public (undocumented)
|
|
136
146
|
export function createMediaSubscribable<T extends MediaSubscribableItem>(
|
|
137
|
-
mediaSubscribableItem?:
|
|
147
|
+
mediaSubscribableItem?: Error | T,
|
|
138
148
|
): MediaSubscribable<T>;
|
|
139
149
|
|
|
140
150
|
// @public (undocumented)
|
|
@@ -195,7 +205,7 @@ type ErrorObserver<T> = PartialObserver<T> &
|
|
|
195
205
|
export type EventPayloadListener<
|
|
196
206
|
M extends EventPayloadMap<P>,
|
|
197
207
|
E extends keyof M,
|
|
198
|
-
P = any
|
|
208
|
+
P = any,
|
|
199
209
|
> = (payload: M[E]) => void;
|
|
200
210
|
|
|
201
211
|
// @public (undocumented)
|
|
@@ -251,6 +261,7 @@ export interface FileFetcher {
|
|
|
251
261
|
source: CopySourceFile,
|
|
252
262
|
destination: CopyDestination,
|
|
253
263
|
options?: CopyFileOptions,
|
|
264
|
+
traceContext?: MediaTraceContext,
|
|
254
265
|
): Promise<MediaFile>;
|
|
255
266
|
// (undocumented)
|
|
256
267
|
downloadBinary(
|
|
@@ -277,33 +288,34 @@ export interface FileFetcher {
|
|
|
277
288
|
touchFiles(
|
|
278
289
|
descriptors: TouchFileDescriptor[],
|
|
279
290
|
collection?: string,
|
|
291
|
+
traceContext?: MediaTraceContext,
|
|
280
292
|
): Promise<TouchedFiles>;
|
|
281
293
|
// (undocumented)
|
|
282
294
|
upload(
|
|
283
295
|
file: UploadableFile,
|
|
284
296
|
controller?: UploadController,
|
|
285
297
|
uploadableFileUpfrontIds?: UploadableFileUpfrontIds,
|
|
298
|
+
traceContext?: MediaTraceContext,
|
|
286
299
|
): MediaSubscribable<FileState>;
|
|
287
300
|
// (undocumented)
|
|
288
301
|
uploadExternal(
|
|
289
302
|
url: string,
|
|
290
303
|
collection?: string,
|
|
304
|
+
traceContext?: MediaTraceContext,
|
|
291
305
|
): Promise<ExternalUploadPayload>;
|
|
292
306
|
}
|
|
293
307
|
|
|
294
308
|
// @public (undocumented)
|
|
295
|
-
export class FileFetcherError extends BaseMediaClientError<
|
|
296
|
-
FileFetcherErrorAttributes
|
|
297
|
-
> {
|
|
309
|
+
export class FileFetcherError extends BaseMediaClientError<FileFetcherErrorAttributes> {
|
|
298
310
|
constructor(
|
|
299
311
|
reason: FileFetcherErrorReason,
|
|
300
312
|
id: string,
|
|
301
313
|
metadata?:
|
|
314
|
+
| undefined
|
|
302
315
|
| {
|
|
303
316
|
readonly collectionName?: string | undefined;
|
|
304
317
|
readonly occurrenceKey?: string | undefined;
|
|
305
|
-
}
|
|
306
|
-
| undefined,
|
|
318
|
+
},
|
|
307
319
|
);
|
|
308
320
|
// (undocumented)
|
|
309
321
|
get attributes(): {
|
|
@@ -316,11 +328,11 @@ export class FileFetcherError extends BaseMediaClientError<
|
|
|
316
328
|
readonly id: string;
|
|
317
329
|
// (undocumented)
|
|
318
330
|
readonly metadata?:
|
|
331
|
+
| undefined
|
|
319
332
|
| {
|
|
320
333
|
readonly collectionName?: string | undefined;
|
|
321
334
|
readonly occurrenceKey?: string | undefined;
|
|
322
|
-
}
|
|
323
|
-
| undefined;
|
|
335
|
+
};
|
|
324
336
|
// (undocumented)
|
|
325
337
|
readonly reason: FileFetcherErrorReason;
|
|
326
338
|
}
|
|
@@ -337,8 +349,8 @@ export type FileFetcherErrorAttributes = {
|
|
|
337
349
|
|
|
338
350
|
// @public (undocumented)
|
|
339
351
|
export type FileFetcherErrorReason =
|
|
340
|
-
| 'invalidFileId'
|
|
341
352
|
| 'emptyItems'
|
|
353
|
+
| 'invalidFileId'
|
|
342
354
|
| 'zeroVersionFile';
|
|
343
355
|
|
|
344
356
|
// @public (undocumented)
|
|
@@ -349,6 +361,7 @@ export class FileFetcherImpl implements FileFetcher {
|
|
|
349
361
|
source: CopySourceFile,
|
|
350
362
|
destination: CopyDestination,
|
|
351
363
|
options?: CopyFileOptions,
|
|
364
|
+
traceContext?: MediaTraceContext,
|
|
352
365
|
): Promise<MediaFile>;
|
|
353
366
|
// (undocumented)
|
|
354
367
|
downloadBinary(
|
|
@@ -375,17 +388,20 @@ export class FileFetcherImpl implements FileFetcher {
|
|
|
375
388
|
touchFiles(
|
|
376
389
|
descriptors: TouchFileDescriptor[],
|
|
377
390
|
collection?: string,
|
|
391
|
+
traceContext?: MediaTraceContext,
|
|
378
392
|
): Promise<TouchedFiles>;
|
|
379
393
|
// (undocumented)
|
|
380
394
|
upload(
|
|
381
395
|
file: UploadableFile,
|
|
382
396
|
controller?: UploadController,
|
|
383
397
|
uploadableFileUpfrontIds?: UploadableFileUpfrontIds,
|
|
398
|
+
traceContext?: MediaTraceContext,
|
|
384
399
|
): MediaSubscribable<FileState>;
|
|
385
400
|
// (undocumented)
|
|
386
401
|
uploadExternal(
|
|
387
402
|
url: string,
|
|
388
403
|
collection?: string,
|
|
404
|
+
traceContext?: MediaTraceContext,
|
|
389
405
|
): Promise<ExternalUploadPayload>;
|
|
390
406
|
}
|
|
391
407
|
|
|
@@ -424,18 +440,18 @@ export interface FilePreview {
|
|
|
424
440
|
|
|
425
441
|
// @public (undocumented)
|
|
426
442
|
export type FileProcessingStatus =
|
|
443
|
+
| 'failed'
|
|
427
444
|
| 'pending'
|
|
428
445
|
| 'running'
|
|
429
|
-
| 'succeeded'
|
|
430
|
-
| 'failed';
|
|
446
|
+
| 'succeeded';
|
|
431
447
|
|
|
432
448
|
// @public (undocumented)
|
|
433
449
|
export type FileState =
|
|
434
|
-
| UploadingFileState
|
|
435
|
-
| ProcessingFileState
|
|
436
|
-
| ProcessedFileState
|
|
437
450
|
| ErrorFileState
|
|
438
|
-
|
|
|
451
|
+
| ProcessedFileState
|
|
452
|
+
| ProcessingFailedState
|
|
453
|
+
| ProcessingFileState
|
|
454
|
+
| UploadingFileState;
|
|
439
455
|
|
|
440
456
|
// @public (undocumented)
|
|
441
457
|
export type FileStatus = FileStatus_2;
|
|
@@ -476,7 +492,7 @@ export const getMediaClient: (
|
|
|
476
492
|
// @public (undocumented)
|
|
477
493
|
export function getMediaClientErrorReason(
|
|
478
494
|
err: Error,
|
|
479
|
-
):
|
|
495
|
+
): 'unknown' | MediaClientErrorReason;
|
|
480
496
|
|
|
481
497
|
// @public (undocumented)
|
|
482
498
|
export const getMediaEnvironment: () => string | undefined;
|
|
@@ -504,7 +520,7 @@ export const globalMediaEventEmitter: {
|
|
|
504
520
|
};
|
|
505
521
|
|
|
506
522
|
// @public (undocumented)
|
|
507
|
-
export type Identifier =
|
|
523
|
+
export type Identifier = ExternalImageIdentifier | FileIdentifier;
|
|
508
524
|
|
|
509
525
|
// @public (undocumented)
|
|
510
526
|
export interface ImageMetadata {
|
|
@@ -570,7 +586,7 @@ export const isFileIdentifier: (
|
|
|
570
586
|
// @public (undocumented)
|
|
571
587
|
export const isFinalFileState: (
|
|
572
588
|
fileState: FileState,
|
|
573
|
-
) => fileState is
|
|
589
|
+
) => fileState is ErrorFileState | ProcessedFileState | ProcessingFailedState;
|
|
574
590
|
|
|
575
591
|
// @public @deprecated (undocumented)
|
|
576
592
|
export const isImageMimeTypeSupportedByBrowser: (mimeType: string) => boolean;
|
|
@@ -591,9 +607,7 @@ export const isImageRepresentationReady: (fileState: FileState) => boolean;
|
|
|
591
607
|
export const isMediaBlobUrl: (url: string) => boolean;
|
|
592
608
|
|
|
593
609
|
// @public (undocumented)
|
|
594
|
-
export function isMediaClientError(
|
|
595
|
-
error: any,
|
|
596
|
-
): error is MediaClientError<{
|
|
610
|
+
export function isMediaClientError(error: any): error is MediaClientError<{
|
|
597
611
|
reason: MediaClientErrorReason;
|
|
598
612
|
}>;
|
|
599
613
|
|
|
@@ -618,10 +632,10 @@ export function isPollingError(err?: Error): err is PollingError;
|
|
|
618
632
|
export const isPreviewableFileState: (
|
|
619
633
|
fileState: FileState,
|
|
620
634
|
) => fileState is (
|
|
621
|
-
| UploadingFileState
|
|
622
|
-
| ProcessingFileState
|
|
623
635
|
| ProcessedFileState
|
|
624
636
|
| ProcessingFailedState
|
|
637
|
+
| ProcessingFileState
|
|
638
|
+
| UploadingFileState
|
|
625
639
|
) &
|
|
626
640
|
PreviewableFileState;
|
|
627
641
|
|
|
@@ -751,6 +765,7 @@ export class MediaClient {
|
|
|
751
765
|
params?: MediaStoreGetFileImageParams,
|
|
752
766
|
controller?: AbortController,
|
|
753
767
|
fetchMaxRes?: boolean,
|
|
768
|
+
traceContext?: MediaTraceContext,
|
|
754
769
|
): Promise<Blob>;
|
|
755
770
|
// (undocumented)
|
|
756
771
|
getImageMetadata(
|
|
@@ -799,28 +814,28 @@ export interface MediaClientErrorAttributes {
|
|
|
799
814
|
|
|
800
815
|
// @public (undocumented)
|
|
801
816
|
export type MediaClientErrorReason =
|
|
802
|
-
| '
|
|
817
|
+
| 'authProviderTimedOut'
|
|
803
818
|
| 'clientAbortedRequest'
|
|
819
|
+
| 'clientOffline'
|
|
804
820
|
| 'clientTimeoutRequest'
|
|
805
|
-
| '
|
|
821
|
+
| 'emptyAuth'
|
|
822
|
+
| 'emptyItems'
|
|
823
|
+
| 'failedAuthProvider'
|
|
824
|
+
| 'fileSizeExceedsLimit'
|
|
825
|
+
| 'invalidFileId'
|
|
826
|
+
| 'missingInitialAuth'
|
|
827
|
+
| 'pollingMaxAttemptsExceeded'
|
|
828
|
+
| 'serverBadGateway'
|
|
806
829
|
| 'serverBadRequest'
|
|
807
|
-
| 'serverUnauthorized'
|
|
808
830
|
| 'serverForbidden'
|
|
831
|
+
| 'serverInternalError'
|
|
832
|
+
| 'serverInvalidBody'
|
|
809
833
|
| 'serverNotFound'
|
|
810
834
|
| 'serverRateLimited'
|
|
811
|
-
| '
|
|
812
|
-
| 'serverBadGateway'
|
|
835
|
+
| 'serverUnauthorized'
|
|
813
836
|
| 'serverUnexpectedError'
|
|
814
|
-
| 'failedAuthProvider'
|
|
815
837
|
| 'tokenExpired'
|
|
816
|
-
| '
|
|
817
|
-
| 'emptyAuth'
|
|
818
|
-
| 'authProviderTimedOut'
|
|
819
|
-
| 'invalidFileId'
|
|
820
|
-
| 'emptyItems'
|
|
821
|
-
| 'zeroVersionFile'
|
|
822
|
-
| 'pollingMaxAttemptsExceeded'
|
|
823
|
-
| 'fileSizeExceedsLimit';
|
|
838
|
+
| 'zeroVersionFile';
|
|
824
839
|
|
|
825
840
|
// @public (undocumented)
|
|
826
841
|
export type MediaCollection = {
|
|
@@ -838,8 +853,8 @@ export type MediaCollectionItem = {
|
|
|
838
853
|
|
|
839
854
|
// @public (undocumented)
|
|
840
855
|
export type MediaCollectionItemDetails =
|
|
841
|
-
|
|
|
842
|
-
|
|
|
856
|
+
| MediaCollectionItemFullDetails
|
|
857
|
+
| MediaCollectionItemMinimalDetails;
|
|
843
858
|
|
|
844
859
|
// @public (undocumented)
|
|
845
860
|
export type MediaCollectionItemFullDetails = {
|
|
@@ -897,17 +912,17 @@ export interface MediaFileArtifacts {
|
|
|
897
912
|
}
|
|
898
913
|
|
|
899
914
|
// @public (undocumented)
|
|
900
|
-
export type MediaFileProcessingStatus = '
|
|
915
|
+
export type MediaFileProcessingStatus = 'failed' | 'pending' | 'succeeded';
|
|
901
916
|
|
|
902
917
|
// @public (undocumented)
|
|
903
|
-
export type MediaItemType = '
|
|
918
|
+
export type MediaItemType = 'external-image' | 'file';
|
|
904
919
|
|
|
905
920
|
// @public (undocumented)
|
|
906
921
|
export type MediaObserver<T> =
|
|
907
|
-
|
|
|
908
|
-
| ErrorObserver<T>
|
|
922
|
+
| ((value: T) => void)
|
|
909
923
|
| CompletionObserver<T>
|
|
910
|
-
|
|
|
924
|
+
| ErrorObserver<T>
|
|
925
|
+
| NextObserver<T>;
|
|
911
926
|
|
|
912
927
|
// @public (undocumented)
|
|
913
928
|
export type MediaRepresentations = {
|
|
@@ -925,21 +940,25 @@ export class MediaStore {
|
|
|
925
940
|
uploadId: string,
|
|
926
941
|
body: AppendChunksToUploadRequestBody,
|
|
927
942
|
collectionName?: string,
|
|
943
|
+
traceContext?: MediaTraceContext,
|
|
928
944
|
): Promise<void>;
|
|
929
945
|
// (undocumented)
|
|
930
946
|
copyFileWithToken(
|
|
931
947
|
body: MediaStoreCopyFileWithTokenBody,
|
|
932
948
|
params: MediaStoreCopyFileWithTokenParams,
|
|
949
|
+
traceContext?: MediaTraceContext,
|
|
933
950
|
): Promise<MediaStoreResponse<MediaFile>>;
|
|
934
951
|
// (undocumented)
|
|
935
952
|
createFileFromUpload(
|
|
936
953
|
body: MediaStoreCreateFileFromUploadBody,
|
|
937
954
|
params?: MediaStoreCreateFileFromUploadParams,
|
|
955
|
+
traceContext?: MediaTraceContext,
|
|
938
956
|
): Promise<MediaStoreResponse<MediaFile>>;
|
|
939
957
|
// (undocumented)
|
|
940
958
|
createUpload(
|
|
941
959
|
createUpTo?: number,
|
|
942
960
|
collectionName?: string,
|
|
961
|
+
traceContext?: MediaTraceContext,
|
|
943
962
|
): Promise<MediaStoreResponse<MediaUpload[]>>;
|
|
944
963
|
// (undocumented)
|
|
945
964
|
readonly featureFlags?: MediaFeatureFlags | undefined;
|
|
@@ -953,11 +972,13 @@ export class MediaStore {
|
|
|
953
972
|
getCollectionItems(
|
|
954
973
|
collectionName: string,
|
|
955
974
|
params?: MediaStoreGetCollectionItemsParams,
|
|
975
|
+
traceContext?: MediaTraceContext,
|
|
956
976
|
): Promise<MediaStoreResponse<MediaCollectionItems>>;
|
|
957
977
|
// (undocumented)
|
|
958
978
|
getFile(
|
|
959
979
|
fileId: string,
|
|
960
980
|
params?: MediaStoreGetFileParams,
|
|
981
|
+
traceContext?: MediaTraceContext,
|
|
961
982
|
): Promise<MediaStoreResponse<MediaFile>>;
|
|
962
983
|
// (undocumented)
|
|
963
984
|
getFileBinaryURL(id: string, collectionName?: string): Promise<string>;
|
|
@@ -977,11 +998,13 @@ export class MediaStore {
|
|
|
977
998
|
params?: MediaStoreGetFileImageParams,
|
|
978
999
|
controller?: AbortController,
|
|
979
1000
|
fetchMaxRes?: boolean,
|
|
1001
|
+
traceContext?: MediaTraceContext,
|
|
980
1002
|
): Promise<Blob>;
|
|
981
1003
|
// (undocumented)
|
|
982
1004
|
getImageMetadata(
|
|
983
1005
|
id: string,
|
|
984
1006
|
params?: MediaStoreGetFileImageParams,
|
|
1007
|
+
traceContext?: MediaTraceContext,
|
|
985
1008
|
): Promise<{
|
|
986
1009
|
metadata: ImageMetadata;
|
|
987
1010
|
}>;
|
|
@@ -989,6 +1012,7 @@ export class MediaStore {
|
|
|
989
1012
|
getItems(
|
|
990
1013
|
ids: string[],
|
|
991
1014
|
collectionName?: string,
|
|
1015
|
+
traceContext?: MediaTraceContext,
|
|
992
1016
|
): Promise<MediaStoreResponse<ItemsPayload>>;
|
|
993
1017
|
// (undocumented)
|
|
994
1018
|
probeChunks(
|
|
@@ -1000,12 +1024,14 @@ export class MediaStore {
|
|
|
1000
1024
|
collectionName?: string;
|
|
1001
1025
|
uploadId?: string;
|
|
1002
1026
|
},
|
|
1027
|
+
traceContext?: MediaTraceContext,
|
|
1003
1028
|
): Promise<MediaStoreResponse<MediaChunksProbe>>;
|
|
1004
1029
|
// (undocumented)
|
|
1005
1030
|
removeCollectionFile(
|
|
1006
1031
|
id: string,
|
|
1007
1032
|
collectionName: string,
|
|
1008
1033
|
occurrenceKey?: string,
|
|
1034
|
+
traceContext?: MediaTraceContext,
|
|
1009
1035
|
): Promise<void>;
|
|
1010
1036
|
// (undocumented)
|
|
1011
1037
|
request(
|
|
@@ -1021,6 +1047,7 @@ export class MediaStore {
|
|
|
1021
1047
|
touchFiles(
|
|
1022
1048
|
body: MediaStoreTouchFileBody,
|
|
1023
1049
|
params?: MediaStoreTouchFileParams,
|
|
1050
|
+
traceContext?: MediaTraceContext,
|
|
1024
1051
|
): Promise<MediaStoreResponse<TouchedFiles>>;
|
|
1025
1052
|
// (undocumented)
|
|
1026
1053
|
uploadChunk(
|
|
@@ -1035,6 +1062,7 @@ export class MediaStore {
|
|
|
1035
1062
|
uploadId?: string;
|
|
1036
1063
|
partNumber?: number;
|
|
1037
1064
|
},
|
|
1065
|
+
traceContext?: MediaTraceContext,
|
|
1038
1066
|
): Promise<void>;
|
|
1039
1067
|
}
|
|
1040
1068
|
|
|
@@ -1090,9 +1118,7 @@ export type MediaStoreCreateFileParams = {
|
|
|
1090
1118
|
};
|
|
1091
1119
|
|
|
1092
1120
|
// @public (undocumented)
|
|
1093
|
-
export class MediaStoreError extends BaseMediaClientError<
|
|
1094
|
-
MediaStoreErrorAttributes
|
|
1095
|
-
> {
|
|
1121
|
+
export class MediaStoreError extends BaseMediaClientError<MediaStoreErrorAttributes> {
|
|
1096
1122
|
constructor(reason: MediaStoreErrorReason, innerError?: Error | undefined);
|
|
1097
1123
|
// (undocumented)
|
|
1098
1124
|
get attributes(): {
|
|
@@ -1113,18 +1139,18 @@ export type MediaStoreErrorAttributes = {
|
|
|
1113
1139
|
|
|
1114
1140
|
// @public (undocumented)
|
|
1115
1141
|
export type MediaStoreErrorReason =
|
|
1142
|
+
| 'authProviderTimedOut'
|
|
1143
|
+
| 'emptyAuth'
|
|
1116
1144
|
| 'failedAuthProvider'
|
|
1117
|
-
| 'tokenExpired'
|
|
1118
1145
|
| 'missingInitialAuth'
|
|
1119
|
-
| '
|
|
1120
|
-
| 'authProviderTimedOut';
|
|
1146
|
+
| 'tokenExpired';
|
|
1121
1147
|
|
|
1122
1148
|
// @public (undocumented)
|
|
1123
1149
|
export type MediaStoreGetCollectionItemsParams = {
|
|
1124
1150
|
readonly limit?: number;
|
|
1125
1151
|
readonly inclusiveStartKey?: string;
|
|
1126
1152
|
readonly sortDirection?: 'asc' | 'desc';
|
|
1127
|
-
readonly details?: '
|
|
1153
|
+
readonly details?: 'full' | 'minimal';
|
|
1128
1154
|
};
|
|
1129
1155
|
|
|
1130
1156
|
// @public (undocumented)
|
|
@@ -1134,7 +1160,7 @@ export type MediaStoreGetFileImageParams = {
|
|
|
1134
1160
|
readonly collection?: string;
|
|
1135
1161
|
readonly width?: number;
|
|
1136
1162
|
readonly height?: number;
|
|
1137
|
-
readonly mode?: '
|
|
1163
|
+
readonly mode?: 'crop' | 'fit' | 'full-fit';
|
|
1138
1164
|
readonly upscale?: boolean;
|
|
1139
1165
|
readonly 'max-age'?: number;
|
|
1140
1166
|
};
|
|
@@ -1153,6 +1179,7 @@ export type MediaStoreRequestOptions = RequestMetadata & {
|
|
|
1153
1179
|
readonly headers?: RequestHeaders;
|
|
1154
1180
|
readonly body?: any;
|
|
1155
1181
|
readonly clientOptions?: ClientOptions;
|
|
1182
|
+
readonly traceContext?: MediaTraceContext;
|
|
1156
1183
|
};
|
|
1157
1184
|
|
|
1158
1185
|
// @public (undocumented)
|
|
@@ -1202,7 +1229,7 @@ export interface MediaViewedEventPayload {
|
|
|
1202
1229
|
// (undocumented)
|
|
1203
1230
|
isUserCollection?: boolean;
|
|
1204
1231
|
// (undocumented)
|
|
1205
|
-
viewingLevel: '
|
|
1232
|
+
viewingLevel: 'download' | 'full' | 'minimal';
|
|
1206
1233
|
}
|
|
1207
1234
|
|
|
1208
1235
|
// @public (undocumented)
|
|
@@ -1255,7 +1282,7 @@ export type NonErrorFileState = Exclude<FileState, ErrorFileState>;
|
|
|
1255
1282
|
|
|
1256
1283
|
// @public (undocumented)
|
|
1257
1284
|
export const objectToQueryString: (json: {
|
|
1258
|
-
[key: string]:
|
|
1285
|
+
[key: string]: boolean | null | number | string | undefined;
|
|
1259
1286
|
}) => string;
|
|
1260
1287
|
|
|
1261
1288
|
// @public (undocumented)
|
|
@@ -1464,17 +1491,17 @@ export type RequestErrorMetadata = RequestMetadata & {
|
|
|
1464
1491
|
|
|
1465
1492
|
// @public (undocumented)
|
|
1466
1493
|
export type RequestErrorReason =
|
|
1467
|
-
| 'clientOffline'
|
|
1468
1494
|
| 'clientAbortedRequest'
|
|
1495
|
+
| 'clientOffline'
|
|
1469
1496
|
| 'clientTimeoutRequest'
|
|
1470
|
-
| '
|
|
1497
|
+
| 'serverBadGateway'
|
|
1471
1498
|
| 'serverBadRequest'
|
|
1472
|
-
| 'serverUnauthorized'
|
|
1473
1499
|
| 'serverForbidden'
|
|
1500
|
+
| 'serverInternalError'
|
|
1501
|
+
| 'serverInvalidBody'
|
|
1474
1502
|
| 'serverNotFound'
|
|
1475
1503
|
| 'serverRateLimited'
|
|
1476
|
-
| '
|
|
1477
|
-
| 'serverBadGateway'
|
|
1504
|
+
| 'serverUnauthorized'
|
|
1478
1505
|
| 'serverUnexpectedError';
|
|
1479
1506
|
|
|
1480
1507
|
// @public (undocumented)
|
|
@@ -1491,11 +1518,12 @@ export type RequestMetadata = {
|
|
|
1491
1518
|
};
|
|
1492
1519
|
|
|
1493
1520
|
// @public (undocumented)
|
|
1494
|
-
export type RequestMethod = '
|
|
1521
|
+
export type RequestMethod = 'DELETE' | 'GET' | 'POST' | 'PUT';
|
|
1495
1522
|
|
|
1496
1523
|
// @public (undocumented)
|
|
1497
1524
|
export type RequestOptions = RequestMetadata & {
|
|
1498
1525
|
readonly auth?: Auth;
|
|
1526
|
+
readonly traceContext?: Required<MediaTraceContext>;
|
|
1499
1527
|
readonly params?: RequestParams;
|
|
1500
1528
|
readonly headers?: RequestHeaders;
|
|
1501
1529
|
readonly body?: any;
|
|
@@ -1536,7 +1564,7 @@ export interface SourceFile {
|
|
|
1536
1564
|
// (undocumented)
|
|
1537
1565
|
id: string;
|
|
1538
1566
|
// (undocumented)
|
|
1539
|
-
owner:
|
|
1567
|
+
owner: AsapBasedAuth | ClientAltBasedAuth;
|
|
1540
1568
|
// (undocumented)
|
|
1541
1569
|
version?: number;
|
|
1542
1570
|
}
|
|
@@ -1607,6 +1635,7 @@ export const uploadFile: (
|
|
|
1607
1635
|
store: MediaStore,
|
|
1608
1636
|
uploadableFileUpfrontIds: UploadableFileUpfrontIds,
|
|
1609
1637
|
callbacks?: UploadFileCallbacks | undefined,
|
|
1638
|
+
traceContext?: MediaTraceContext | undefined,
|
|
1610
1639
|
) => UploadFileResult;
|
|
1611
1640
|
|
|
1612
1641
|
// @public (undocumented)
|
|
@@ -1677,3 +1706,5 @@ export type WithMediaClientFunction = <P extends WithMediaClient>(
|
|
|
1677
1706
|
|
|
1678
1707
|
// (No @packageDocumentation comment for this package)
|
|
1679
1708
|
```
|
|
1709
|
+
|
|
1710
|
+
<!--SECTION END: Main Entry Types-->
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/// <reference types="jest" />
|
|
2
|
-
export declare class FileFetcher {
|
|
3
|
-
constructor();
|
|
4
|
-
getFileState: jest.Mock<any, any>;
|
|
5
|
-
getCurrentState: jest.Mock<any, any>;
|
|
6
|
-
getArtifactURL: jest.Mock<any, any>;
|
|
7
|
-
touchFiles: jest.Mock<any, any>;
|
|
8
|
-
upload: jest.Mock<any, any>;
|
|
9
|
-
downloadBinary: jest.Mock<any, any>;
|
|
10
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/// <reference types="jest" />
|
|
2
|
-
import { MediaClientConfig } from '@atlaskit/media-core';
|
|
3
|
-
import { CollectionFetcher } from '../collection-fetcher';
|
|
4
|
-
import { FileFetcher } from '../file-fetcher';
|
|
5
|
-
export declare class MediaClient {
|
|
6
|
-
readonly config: MediaClientConfig;
|
|
7
|
-
readonly collection: CollectionFetcher;
|
|
8
|
-
readonly file: FileFetcher;
|
|
9
|
-
constructor(config: MediaClientConfig);
|
|
10
|
-
getImage: jest.Mock<any, any>;
|
|
11
|
-
getImageUrl: jest.Mock<any, any>;
|
|
12
|
-
getImageMetadata: jest.Mock<any, any>;
|
|
13
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { ReplaySubject } from 'rxjs/ReplaySubject';
|
|
2
|
-
import { FileDetails, FileItem } from '../models/item';
|
|
3
|
-
import { MediaCollectionItem } from '../models/media';
|
|
4
|
-
import { MediaStore, MediaStoreGetCollectionItemsParams } from './media-store';
|
|
5
|
-
import { MediaSubscribable } from '../utils/mediaSubscribable';
|
|
6
|
-
export interface MediaCollectionFileItemDetails extends FileDetails {
|
|
7
|
-
occurrenceKey: string;
|
|
8
|
-
}
|
|
9
|
-
export interface MediaCollectionFileItem extends FileItem {
|
|
10
|
-
details: MediaCollectionFileItemDetails;
|
|
11
|
-
}
|
|
12
|
-
export interface MediaCollection {
|
|
13
|
-
id: string;
|
|
14
|
-
items: Array<MediaCollectionItem>;
|
|
15
|
-
}
|
|
16
|
-
export interface CollectionCacheEntry {
|
|
17
|
-
items: MediaCollectionItem[];
|
|
18
|
-
subject: ReplaySubject<MediaCollectionItem[]>;
|
|
19
|
-
isLoadingNextPage: boolean;
|
|
20
|
-
nextInclusiveStartKey?: string;
|
|
21
|
-
}
|
|
22
|
-
export declare type CollectionCache = {
|
|
23
|
-
[collectionName: string]: CollectionCacheEntry;
|
|
24
|
-
};
|
|
25
|
-
export declare const collectionCache: CollectionCache;
|
|
26
|
-
export declare class CollectionFetcher {
|
|
27
|
-
readonly mediaStore: MediaStore;
|
|
28
|
-
constructor(mediaStore: MediaStore);
|
|
29
|
-
private createFileStateObserver;
|
|
30
|
-
private populateCache;
|
|
31
|
-
private removeFromCache;
|
|
32
|
-
getItems(collectionName: string, params?: MediaStoreGetCollectionItemsParams): MediaSubscribable<MediaCollectionItem[]>;
|
|
33
|
-
removeFile(id: string, collectionName: string, occurrenceKey?: string): Promise<void>;
|
|
34
|
-
loadNextPage(collectionName: string, params?: MediaStoreGetCollectionItemsParams): Promise<void>;
|
|
35
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { FileState } from '../models/file-state';
|
|
2
|
-
export declare type EventPayloadMap<P> = {
|
|
3
|
-
readonly [event: string]: P;
|
|
4
|
-
};
|
|
5
|
-
export declare type EventPayloadListener<M extends EventPayloadMap<P>, E extends keyof M, P = any> = (payload: M[E]) => void;
|
|
6
|
-
export interface MediaViewedEventPayload {
|
|
7
|
-
fileId: string;
|
|
8
|
-
viewingLevel: 'minimal' | 'full' | 'download';
|
|
9
|
-
isUserCollection?: boolean;
|
|
10
|
-
}
|
|
11
|
-
export declare type UploadEventPayloadMap = {
|
|
12
|
-
'file-added': FileState;
|
|
13
|
-
'media-viewed': MediaViewedEventPayload;
|
|
14
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { BaseMediaClientError } from '../../models/errors';
|
|
2
|
-
export declare type FileFetcherErrorReason = 'invalidFileId' | 'emptyItems' | 'zeroVersionFile';
|
|
3
|
-
export declare type FileFetcherErrorAttributes = {
|
|
4
|
-
readonly reason: FileFetcherErrorReason;
|
|
5
|
-
readonly id: string;
|
|
6
|
-
readonly metadata?: {
|
|
7
|
-
readonly collectionName?: string;
|
|
8
|
-
readonly occurrenceKey?: string;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
export declare class FileFetcherError extends BaseMediaClientError<FileFetcherErrorAttributes> {
|
|
12
|
-
readonly reason: FileFetcherErrorReason;
|
|
13
|
-
readonly id: string;
|
|
14
|
-
readonly metadata?: {
|
|
15
|
-
readonly collectionName?: string | undefined;
|
|
16
|
-
readonly occurrenceKey?: string | undefined;
|
|
17
|
-
} | undefined;
|
|
18
|
-
constructor(reason: FileFetcherErrorReason, id: string, metadata?: {
|
|
19
|
-
readonly collectionName?: string | undefined;
|
|
20
|
-
readonly occurrenceKey?: string | undefined;
|
|
21
|
-
} | undefined);
|
|
22
|
-
get attributes(): {
|
|
23
|
-
reason: FileFetcherErrorReason;
|
|
24
|
-
id: string;
|
|
25
|
-
collectionName: string | undefined;
|
|
26
|
-
occurrenceKey: string | undefined;
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
export declare function isFileFetcherError(err: Error): err is FileFetcherError;
|