@atlaskit/media-client 18.1.0 → 19.1.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/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/models/file-state.js +4 -2
- package/dist/cjs/uploader/index.js +40 -70
- package/dist/cjs/utils/createFileDataLoader.js +32 -15
- package/dist/cjs/utils/request/helpers.js +39 -22
- package/dist/cjs/utils/request/index.js +5 -3
- 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/models/file-state.js +4 -2
- package/dist/es2019/uploader/index.js +17 -21
- package/dist/es2019/utils/createFileDataLoader.js +13 -3
- package/dist/es2019/utils/request/helpers.js +26 -8
- package/dist/es2019/utils/request/index.js +6 -4
- 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/models/file-state.js +4 -2
- package/dist/esm/uploader/index.js +40 -69
- package/dist/esm/utils/createFileDataLoader.js +31 -13
- package/dist/esm/utils/request/helpers.js +36 -20
- package/dist/esm/utils/request/index.js +6 -4
- 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 +16 -21
- package/dist/types/models/file-state.d.ts +9 -6
- package/dist/types/models/media.d.ts +3 -1
- 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 +3 -0
- package/package.json +7 -15
- package/report.api.md +116 -75
- 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.3 -->
|
|
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';
|
|
@@ -44,12 +50,18 @@ export type Artifacts = {
|
|
|
44
50
|
[name: string]: MediaArtifact;
|
|
45
51
|
};
|
|
46
52
|
|
|
53
|
+
// @public (undocumented)
|
|
54
|
+
type BaseFileState = {
|
|
55
|
+
metadataTraceContext?: MediaTraceContext;
|
|
56
|
+
};
|
|
57
|
+
|
|
47
58
|
// @public
|
|
48
59
|
abstract class BaseMediaClientError<
|
|
49
|
-
Attributes extends MediaClientErrorAttributes
|
|
60
|
+
Attributes extends MediaClientErrorAttributes,
|
|
50
61
|
>
|
|
51
62
|
extends Error
|
|
52
|
-
implements MediaClientError<Attributes>
|
|
63
|
+
implements MediaClientError<Attributes>
|
|
64
|
+
{
|
|
53
65
|
constructor(message: string);
|
|
54
66
|
// (undocumented)
|
|
55
67
|
abstract get attributes(): Attributes;
|
|
@@ -73,11 +85,13 @@ export class CollectionFetcher {
|
|
|
73
85
|
getItems(
|
|
74
86
|
collectionName: string,
|
|
75
87
|
params?: MediaStoreGetCollectionItemsParams,
|
|
88
|
+
traceContext?: MediaTraceContext,
|
|
76
89
|
): MediaSubscribable<MediaCollectionItem[]>;
|
|
77
90
|
// (undocumented)
|
|
78
91
|
loadNextPage(
|
|
79
92
|
collectionName: string,
|
|
80
93
|
params?: MediaStoreGetCollectionItemsParams,
|
|
94
|
+
traceContext?: MediaTraceContext,
|
|
81
95
|
): Promise<void>;
|
|
82
96
|
// (undocumented)
|
|
83
97
|
readonly mediaStore: MediaStore;
|
|
@@ -86,6 +100,7 @@ export class CollectionFetcher {
|
|
|
86
100
|
id: string,
|
|
87
101
|
collectionName: string,
|
|
88
102
|
occurrenceKey?: string,
|
|
103
|
+
traceContext?: MediaTraceContext,
|
|
89
104
|
): Promise<void>;
|
|
90
105
|
}
|
|
91
106
|
|
|
@@ -129,12 +144,12 @@ export interface CreatedTouchedFile {
|
|
|
129
144
|
|
|
130
145
|
// @public (undocumented)
|
|
131
146
|
export function createMediaSubject<T extends MediaSubscribableItem>(
|
|
132
|
-
initialState?:
|
|
147
|
+
initialState?: Error | T,
|
|
133
148
|
): ReplaySubject<T>;
|
|
134
149
|
|
|
135
150
|
// @public (undocumented)
|
|
136
151
|
export function createMediaSubscribable<T extends MediaSubscribableItem>(
|
|
137
|
-
mediaSubscribableItem?:
|
|
152
|
+
mediaSubscribableItem?: Error | T,
|
|
138
153
|
): MediaSubscribable<T>;
|
|
139
154
|
|
|
140
155
|
// @public (undocumented)
|
|
@@ -176,7 +191,7 @@ export interface EmptyFile {
|
|
|
176
191
|
}
|
|
177
192
|
|
|
178
193
|
// @public (undocumented)
|
|
179
|
-
export interface ErrorFileState {
|
|
194
|
+
export interface ErrorFileState extends BaseFileState {
|
|
180
195
|
// (undocumented)
|
|
181
196
|
id: string;
|
|
182
197
|
// (undocumented)
|
|
@@ -195,7 +210,7 @@ type ErrorObserver<T> = PartialObserver<T> &
|
|
|
195
210
|
export type EventPayloadListener<
|
|
196
211
|
M extends EventPayloadMap<P>,
|
|
197
212
|
E extends keyof M,
|
|
198
|
-
P = any
|
|
213
|
+
P = any,
|
|
199
214
|
> = (payload: M[E]) => void;
|
|
200
215
|
|
|
201
216
|
// @public (undocumented)
|
|
@@ -251,6 +266,7 @@ export interface FileFetcher {
|
|
|
251
266
|
source: CopySourceFile,
|
|
252
267
|
destination: CopyDestination,
|
|
253
268
|
options?: CopyFileOptions,
|
|
269
|
+
traceContext?: MediaTraceContext,
|
|
254
270
|
): Promise<MediaFile>;
|
|
255
271
|
// (undocumented)
|
|
256
272
|
downloadBinary(
|
|
@@ -277,33 +293,34 @@ export interface FileFetcher {
|
|
|
277
293
|
touchFiles(
|
|
278
294
|
descriptors: TouchFileDescriptor[],
|
|
279
295
|
collection?: string,
|
|
296
|
+
traceContext?: MediaTraceContext,
|
|
280
297
|
): Promise<TouchedFiles>;
|
|
281
298
|
// (undocumented)
|
|
282
299
|
upload(
|
|
283
300
|
file: UploadableFile,
|
|
284
301
|
controller?: UploadController,
|
|
285
302
|
uploadableFileUpfrontIds?: UploadableFileUpfrontIds,
|
|
303
|
+
traceContext?: MediaTraceContext,
|
|
286
304
|
): MediaSubscribable<FileState>;
|
|
287
305
|
// (undocumented)
|
|
288
306
|
uploadExternal(
|
|
289
307
|
url: string,
|
|
290
308
|
collection?: string,
|
|
309
|
+
traceContext?: MediaTraceContext,
|
|
291
310
|
): Promise<ExternalUploadPayload>;
|
|
292
311
|
}
|
|
293
312
|
|
|
294
313
|
// @public (undocumented)
|
|
295
|
-
export class FileFetcherError extends BaseMediaClientError<
|
|
296
|
-
FileFetcherErrorAttributes
|
|
297
|
-
> {
|
|
314
|
+
export class FileFetcherError extends BaseMediaClientError<FileFetcherErrorAttributes> {
|
|
298
315
|
constructor(
|
|
299
316
|
reason: FileFetcherErrorReason,
|
|
300
317
|
id: string,
|
|
301
318
|
metadata?:
|
|
319
|
+
| undefined
|
|
302
320
|
| {
|
|
303
321
|
readonly collectionName?: string | undefined;
|
|
304
322
|
readonly occurrenceKey?: string | undefined;
|
|
305
|
-
}
|
|
306
|
-
| undefined,
|
|
323
|
+
},
|
|
307
324
|
);
|
|
308
325
|
// (undocumented)
|
|
309
326
|
get attributes(): {
|
|
@@ -316,11 +333,11 @@ export class FileFetcherError extends BaseMediaClientError<
|
|
|
316
333
|
readonly id: string;
|
|
317
334
|
// (undocumented)
|
|
318
335
|
readonly metadata?:
|
|
336
|
+
| undefined
|
|
319
337
|
| {
|
|
320
338
|
readonly collectionName?: string | undefined;
|
|
321
339
|
readonly occurrenceKey?: string | undefined;
|
|
322
|
-
}
|
|
323
|
-
| undefined;
|
|
340
|
+
};
|
|
324
341
|
// (undocumented)
|
|
325
342
|
readonly reason: FileFetcherErrorReason;
|
|
326
343
|
}
|
|
@@ -337,8 +354,8 @@ export type FileFetcherErrorAttributes = {
|
|
|
337
354
|
|
|
338
355
|
// @public (undocumented)
|
|
339
356
|
export type FileFetcherErrorReason =
|
|
340
|
-
| 'invalidFileId'
|
|
341
357
|
| 'emptyItems'
|
|
358
|
+
| 'invalidFileId'
|
|
342
359
|
| 'zeroVersionFile';
|
|
343
360
|
|
|
344
361
|
// @public (undocumented)
|
|
@@ -349,6 +366,7 @@ export class FileFetcherImpl implements FileFetcher {
|
|
|
349
366
|
source: CopySourceFile,
|
|
350
367
|
destination: CopyDestination,
|
|
351
368
|
options?: CopyFileOptions,
|
|
369
|
+
traceContext?: MediaTraceContext,
|
|
352
370
|
): Promise<MediaFile>;
|
|
353
371
|
// (undocumented)
|
|
354
372
|
downloadBinary(
|
|
@@ -375,17 +393,20 @@ export class FileFetcherImpl implements FileFetcher {
|
|
|
375
393
|
touchFiles(
|
|
376
394
|
descriptors: TouchFileDescriptor[],
|
|
377
395
|
collection?: string,
|
|
396
|
+
traceContext?: MediaTraceContext,
|
|
378
397
|
): Promise<TouchedFiles>;
|
|
379
398
|
// (undocumented)
|
|
380
399
|
upload(
|
|
381
400
|
file: UploadableFile,
|
|
382
401
|
controller?: UploadController,
|
|
383
402
|
uploadableFileUpfrontIds?: UploadableFileUpfrontIds,
|
|
403
|
+
traceContext?: MediaTraceContext,
|
|
384
404
|
): MediaSubscribable<FileState>;
|
|
385
405
|
// (undocumented)
|
|
386
406
|
uploadExternal(
|
|
387
407
|
url: string,
|
|
388
408
|
collection?: string,
|
|
409
|
+
traceContext?: MediaTraceContext,
|
|
389
410
|
): Promise<ExternalUploadPayload>;
|
|
390
411
|
}
|
|
391
412
|
|
|
@@ -424,18 +445,18 @@ export interface FilePreview {
|
|
|
424
445
|
|
|
425
446
|
// @public (undocumented)
|
|
426
447
|
export type FileProcessingStatus =
|
|
448
|
+
| 'failed'
|
|
427
449
|
| 'pending'
|
|
428
450
|
| 'running'
|
|
429
|
-
| 'succeeded'
|
|
430
|
-
| 'failed';
|
|
451
|
+
| 'succeeded';
|
|
431
452
|
|
|
432
453
|
// @public (undocumented)
|
|
433
454
|
export type FileState =
|
|
434
|
-
| UploadingFileState
|
|
435
|
-
| ProcessingFileState
|
|
436
|
-
| ProcessedFileState
|
|
437
455
|
| ErrorFileState
|
|
438
|
-
|
|
|
456
|
+
| ProcessedFileState
|
|
457
|
+
| ProcessingFailedState
|
|
458
|
+
| ProcessingFileState
|
|
459
|
+
| UploadingFileState;
|
|
439
460
|
|
|
440
461
|
// @public (undocumented)
|
|
441
462
|
export type FileStatus = FileStatus_2;
|
|
@@ -476,7 +497,7 @@ export const getMediaClient: (
|
|
|
476
497
|
// @public (undocumented)
|
|
477
498
|
export function getMediaClientErrorReason(
|
|
478
499
|
err: Error,
|
|
479
|
-
):
|
|
500
|
+
): 'unknown' | MediaClientErrorReason;
|
|
480
501
|
|
|
481
502
|
// @public (undocumented)
|
|
482
503
|
export const getMediaEnvironment: () => string | undefined;
|
|
@@ -504,7 +525,7 @@ export const globalMediaEventEmitter: {
|
|
|
504
525
|
};
|
|
505
526
|
|
|
506
527
|
// @public (undocumented)
|
|
507
|
-
export type Identifier =
|
|
528
|
+
export type Identifier = ExternalImageIdentifier | FileIdentifier;
|
|
508
529
|
|
|
509
530
|
// @public (undocumented)
|
|
510
531
|
export interface ImageMetadata {
|
|
@@ -570,7 +591,7 @@ export const isFileIdentifier: (
|
|
|
570
591
|
// @public (undocumented)
|
|
571
592
|
export const isFinalFileState: (
|
|
572
593
|
fileState: FileState,
|
|
573
|
-
) => fileState is
|
|
594
|
+
) => fileState is ErrorFileState | ProcessedFileState | ProcessingFailedState;
|
|
574
595
|
|
|
575
596
|
// @public @deprecated (undocumented)
|
|
576
597
|
export const isImageMimeTypeSupportedByBrowser: (mimeType: string) => boolean;
|
|
@@ -591,9 +612,7 @@ export const isImageRepresentationReady: (fileState: FileState) => boolean;
|
|
|
591
612
|
export const isMediaBlobUrl: (url: string) => boolean;
|
|
592
613
|
|
|
593
614
|
// @public (undocumented)
|
|
594
|
-
export function isMediaClientError(
|
|
595
|
-
error: any,
|
|
596
|
-
): error is MediaClientError<{
|
|
615
|
+
export function isMediaClientError(error: any): error is MediaClientError<{
|
|
597
616
|
reason: MediaClientErrorReason;
|
|
598
617
|
}>;
|
|
599
618
|
|
|
@@ -618,10 +637,10 @@ export function isPollingError(err?: Error): err is PollingError;
|
|
|
618
637
|
export const isPreviewableFileState: (
|
|
619
638
|
fileState: FileState,
|
|
620
639
|
) => fileState is (
|
|
621
|
-
| UploadingFileState
|
|
622
|
-
| ProcessingFileState
|
|
623
640
|
| ProcessedFileState
|
|
624
641
|
| ProcessingFailedState
|
|
642
|
+
| ProcessingFileState
|
|
643
|
+
| UploadingFileState
|
|
625
644
|
) &
|
|
626
645
|
PreviewableFileState;
|
|
627
646
|
|
|
@@ -751,6 +770,7 @@ export class MediaClient {
|
|
|
751
770
|
params?: MediaStoreGetFileImageParams,
|
|
752
771
|
controller?: AbortController,
|
|
753
772
|
fetchMaxRes?: boolean,
|
|
773
|
+
traceContext?: MediaTraceContext,
|
|
754
774
|
): Promise<Blob>;
|
|
755
775
|
// (undocumented)
|
|
756
776
|
getImageMetadata(
|
|
@@ -799,28 +819,28 @@ export interface MediaClientErrorAttributes {
|
|
|
799
819
|
|
|
800
820
|
// @public (undocumented)
|
|
801
821
|
export type MediaClientErrorReason =
|
|
802
|
-
| '
|
|
822
|
+
| 'authProviderTimedOut'
|
|
803
823
|
| 'clientAbortedRequest'
|
|
824
|
+
| 'clientOffline'
|
|
804
825
|
| 'clientTimeoutRequest'
|
|
805
|
-
| '
|
|
826
|
+
| 'emptyAuth'
|
|
827
|
+
| 'emptyItems'
|
|
828
|
+
| 'failedAuthProvider'
|
|
829
|
+
| 'fileSizeExceedsLimit'
|
|
830
|
+
| 'invalidFileId'
|
|
831
|
+
| 'missingInitialAuth'
|
|
832
|
+
| 'pollingMaxAttemptsExceeded'
|
|
833
|
+
| 'serverBadGateway'
|
|
806
834
|
| 'serverBadRequest'
|
|
807
|
-
| 'serverUnauthorized'
|
|
808
835
|
| 'serverForbidden'
|
|
836
|
+
| 'serverInternalError'
|
|
837
|
+
| 'serverInvalidBody'
|
|
809
838
|
| 'serverNotFound'
|
|
810
839
|
| 'serverRateLimited'
|
|
811
|
-
| '
|
|
812
|
-
| 'serverBadGateway'
|
|
840
|
+
| 'serverUnauthorized'
|
|
813
841
|
| 'serverUnexpectedError'
|
|
814
|
-
| 'failedAuthProvider'
|
|
815
842
|
| 'tokenExpired'
|
|
816
|
-
| '
|
|
817
|
-
| 'emptyAuth'
|
|
818
|
-
| 'authProviderTimedOut'
|
|
819
|
-
| 'invalidFileId'
|
|
820
|
-
| 'emptyItems'
|
|
821
|
-
| 'zeroVersionFile'
|
|
822
|
-
| 'pollingMaxAttemptsExceeded'
|
|
823
|
-
| 'fileSizeExceedsLimit';
|
|
843
|
+
| 'zeroVersionFile';
|
|
824
844
|
|
|
825
845
|
// @public (undocumented)
|
|
826
846
|
export type MediaCollection = {
|
|
@@ -838,8 +858,8 @@ export type MediaCollectionItem = {
|
|
|
838
858
|
|
|
839
859
|
// @public (undocumented)
|
|
840
860
|
export type MediaCollectionItemDetails =
|
|
841
|
-
|
|
|
842
|
-
|
|
|
861
|
+
| MediaCollectionItemFullDetails
|
|
862
|
+
| MediaCollectionItemMinimalDetails;
|
|
843
863
|
|
|
844
864
|
// @public (undocumented)
|
|
845
865
|
export type MediaCollectionItemFullDetails = {
|
|
@@ -851,6 +871,7 @@ export type MediaCollectionItemFullDetails = {
|
|
|
851
871
|
readonly artifacts: MediaFileArtifacts;
|
|
852
872
|
readonly representations: MediaRepresentations;
|
|
853
873
|
readonly createdAt?: number;
|
|
874
|
+
readonly metadataTraceContext?: MediaTraceContext;
|
|
854
875
|
};
|
|
855
876
|
|
|
856
877
|
// @public (undocumented)
|
|
@@ -876,6 +897,7 @@ export type MediaFile = {
|
|
|
876
897
|
readonly artifacts: MediaFileArtifacts;
|
|
877
898
|
readonly representations: MediaRepresentations;
|
|
878
899
|
readonly createdAt?: number;
|
|
900
|
+
readonly metadataTraceContext?: MediaTraceContext;
|
|
879
901
|
};
|
|
880
902
|
|
|
881
903
|
// @public (undocumented)
|
|
@@ -897,17 +919,17 @@ export interface MediaFileArtifacts {
|
|
|
897
919
|
}
|
|
898
920
|
|
|
899
921
|
// @public (undocumented)
|
|
900
|
-
export type MediaFileProcessingStatus = '
|
|
922
|
+
export type MediaFileProcessingStatus = 'failed' | 'pending' | 'succeeded';
|
|
901
923
|
|
|
902
924
|
// @public (undocumented)
|
|
903
|
-
export type MediaItemType = '
|
|
925
|
+
export type MediaItemType = 'external-image' | 'file';
|
|
904
926
|
|
|
905
927
|
// @public (undocumented)
|
|
906
928
|
export type MediaObserver<T> =
|
|
907
|
-
|
|
|
908
|
-
| ErrorObserver<T>
|
|
929
|
+
| ((value: T) => void)
|
|
909
930
|
| CompletionObserver<T>
|
|
910
|
-
|
|
|
931
|
+
| ErrorObserver<T>
|
|
932
|
+
| NextObserver<T>;
|
|
911
933
|
|
|
912
934
|
// @public (undocumented)
|
|
913
935
|
export type MediaRepresentations = {
|
|
@@ -925,21 +947,25 @@ export class MediaStore {
|
|
|
925
947
|
uploadId: string,
|
|
926
948
|
body: AppendChunksToUploadRequestBody,
|
|
927
949
|
collectionName?: string,
|
|
950
|
+
traceContext?: MediaTraceContext,
|
|
928
951
|
): Promise<void>;
|
|
929
952
|
// (undocumented)
|
|
930
953
|
copyFileWithToken(
|
|
931
954
|
body: MediaStoreCopyFileWithTokenBody,
|
|
932
955
|
params: MediaStoreCopyFileWithTokenParams,
|
|
956
|
+
traceContext?: MediaTraceContext,
|
|
933
957
|
): Promise<MediaStoreResponse<MediaFile>>;
|
|
934
958
|
// (undocumented)
|
|
935
959
|
createFileFromUpload(
|
|
936
960
|
body: MediaStoreCreateFileFromUploadBody,
|
|
937
961
|
params?: MediaStoreCreateFileFromUploadParams,
|
|
962
|
+
traceContext?: MediaTraceContext,
|
|
938
963
|
): Promise<MediaStoreResponse<MediaFile>>;
|
|
939
964
|
// (undocumented)
|
|
940
965
|
createUpload(
|
|
941
966
|
createUpTo?: number,
|
|
942
967
|
collectionName?: string,
|
|
968
|
+
traceContext?: MediaTraceContext,
|
|
943
969
|
): Promise<MediaStoreResponse<MediaUpload[]>>;
|
|
944
970
|
// (undocumented)
|
|
945
971
|
readonly featureFlags?: MediaFeatureFlags | undefined;
|
|
@@ -953,11 +979,13 @@ export class MediaStore {
|
|
|
953
979
|
getCollectionItems(
|
|
954
980
|
collectionName: string,
|
|
955
981
|
params?: MediaStoreGetCollectionItemsParams,
|
|
982
|
+
traceContext?: MediaTraceContext,
|
|
956
983
|
): Promise<MediaStoreResponse<MediaCollectionItems>>;
|
|
957
984
|
// (undocumented)
|
|
958
985
|
getFile(
|
|
959
986
|
fileId: string,
|
|
960
987
|
params?: MediaStoreGetFileParams,
|
|
988
|
+
traceContext?: MediaTraceContext,
|
|
961
989
|
): Promise<MediaStoreResponse<MediaFile>>;
|
|
962
990
|
// (undocumented)
|
|
963
991
|
getFileBinaryURL(id: string, collectionName?: string): Promise<string>;
|
|
@@ -977,11 +1005,13 @@ export class MediaStore {
|
|
|
977
1005
|
params?: MediaStoreGetFileImageParams,
|
|
978
1006
|
controller?: AbortController,
|
|
979
1007
|
fetchMaxRes?: boolean,
|
|
1008
|
+
traceContext?: MediaTraceContext,
|
|
980
1009
|
): Promise<Blob>;
|
|
981
1010
|
// (undocumented)
|
|
982
1011
|
getImageMetadata(
|
|
983
1012
|
id: string,
|
|
984
1013
|
params?: MediaStoreGetFileImageParams,
|
|
1014
|
+
traceContext?: MediaTraceContext,
|
|
985
1015
|
): Promise<{
|
|
986
1016
|
metadata: ImageMetadata;
|
|
987
1017
|
}>;
|
|
@@ -989,6 +1019,7 @@ export class MediaStore {
|
|
|
989
1019
|
getItems(
|
|
990
1020
|
ids: string[],
|
|
991
1021
|
collectionName?: string,
|
|
1022
|
+
traceContext?: MediaTraceContext,
|
|
992
1023
|
): Promise<MediaStoreResponse<ItemsPayload>>;
|
|
993
1024
|
// (undocumented)
|
|
994
1025
|
probeChunks(
|
|
@@ -1000,12 +1031,14 @@ export class MediaStore {
|
|
|
1000
1031
|
collectionName?: string;
|
|
1001
1032
|
uploadId?: string;
|
|
1002
1033
|
},
|
|
1034
|
+
traceContext?: MediaTraceContext,
|
|
1003
1035
|
): Promise<MediaStoreResponse<MediaChunksProbe>>;
|
|
1004
1036
|
// (undocumented)
|
|
1005
1037
|
removeCollectionFile(
|
|
1006
1038
|
id: string,
|
|
1007
1039
|
collectionName: string,
|
|
1008
1040
|
occurrenceKey?: string,
|
|
1041
|
+
traceContext?: MediaTraceContext,
|
|
1009
1042
|
): Promise<void>;
|
|
1010
1043
|
// (undocumented)
|
|
1011
1044
|
request(
|
|
@@ -1021,6 +1054,7 @@ export class MediaStore {
|
|
|
1021
1054
|
touchFiles(
|
|
1022
1055
|
body: MediaStoreTouchFileBody,
|
|
1023
1056
|
params?: MediaStoreTouchFileParams,
|
|
1057
|
+
traceContext?: MediaTraceContext,
|
|
1024
1058
|
): Promise<MediaStoreResponse<TouchedFiles>>;
|
|
1025
1059
|
// (undocumented)
|
|
1026
1060
|
uploadChunk(
|
|
@@ -1035,6 +1069,7 @@ export class MediaStore {
|
|
|
1035
1069
|
uploadId?: string;
|
|
1036
1070
|
partNumber?: number;
|
|
1037
1071
|
},
|
|
1072
|
+
traceContext?: MediaTraceContext,
|
|
1038
1073
|
): Promise<void>;
|
|
1039
1074
|
}
|
|
1040
1075
|
|
|
@@ -1090,9 +1125,7 @@ export type MediaStoreCreateFileParams = {
|
|
|
1090
1125
|
};
|
|
1091
1126
|
|
|
1092
1127
|
// @public (undocumented)
|
|
1093
|
-
export class MediaStoreError extends BaseMediaClientError<
|
|
1094
|
-
MediaStoreErrorAttributes
|
|
1095
|
-
> {
|
|
1128
|
+
export class MediaStoreError extends BaseMediaClientError<MediaStoreErrorAttributes> {
|
|
1096
1129
|
constructor(reason: MediaStoreErrorReason, innerError?: Error | undefined);
|
|
1097
1130
|
// (undocumented)
|
|
1098
1131
|
get attributes(): {
|
|
@@ -1113,18 +1146,18 @@ export type MediaStoreErrorAttributes = {
|
|
|
1113
1146
|
|
|
1114
1147
|
// @public (undocumented)
|
|
1115
1148
|
export type MediaStoreErrorReason =
|
|
1149
|
+
| 'authProviderTimedOut'
|
|
1150
|
+
| 'emptyAuth'
|
|
1116
1151
|
| 'failedAuthProvider'
|
|
1117
|
-
| 'tokenExpired'
|
|
1118
1152
|
| 'missingInitialAuth'
|
|
1119
|
-
| '
|
|
1120
|
-
| 'authProviderTimedOut';
|
|
1153
|
+
| 'tokenExpired';
|
|
1121
1154
|
|
|
1122
1155
|
// @public (undocumented)
|
|
1123
1156
|
export type MediaStoreGetCollectionItemsParams = {
|
|
1124
1157
|
readonly limit?: number;
|
|
1125
1158
|
readonly inclusiveStartKey?: string;
|
|
1126
1159
|
readonly sortDirection?: 'asc' | 'desc';
|
|
1127
|
-
readonly details?: '
|
|
1160
|
+
readonly details?: 'full' | 'minimal';
|
|
1128
1161
|
};
|
|
1129
1162
|
|
|
1130
1163
|
// @public (undocumented)
|
|
@@ -1134,7 +1167,7 @@ export type MediaStoreGetFileImageParams = {
|
|
|
1134
1167
|
readonly collection?: string;
|
|
1135
1168
|
readonly width?: number;
|
|
1136
1169
|
readonly height?: number;
|
|
1137
|
-
readonly mode?: '
|
|
1170
|
+
readonly mode?: 'crop' | 'fit' | 'full-fit';
|
|
1138
1171
|
readonly upscale?: boolean;
|
|
1139
1172
|
readonly 'max-age'?: number;
|
|
1140
1173
|
};
|
|
@@ -1153,6 +1186,7 @@ export type MediaStoreRequestOptions = RequestMetadata & {
|
|
|
1153
1186
|
readonly headers?: RequestHeaders;
|
|
1154
1187
|
readonly body?: any;
|
|
1155
1188
|
readonly clientOptions?: ClientOptions;
|
|
1189
|
+
readonly traceContext?: MediaTraceContext;
|
|
1156
1190
|
};
|
|
1157
1191
|
|
|
1158
1192
|
// @public (undocumented)
|
|
@@ -1202,7 +1236,7 @@ export interface MediaViewedEventPayload {
|
|
|
1202
1236
|
// (undocumented)
|
|
1203
1237
|
isUserCollection?: boolean;
|
|
1204
1238
|
// (undocumented)
|
|
1205
|
-
viewingLevel: '
|
|
1239
|
+
viewingLevel: 'download' | 'full' | 'minimal';
|
|
1206
1240
|
}
|
|
1207
1241
|
|
|
1208
1242
|
// @public (undocumented)
|
|
@@ -1255,7 +1289,7 @@ export type NonErrorFileState = Exclude<FileState, ErrorFileState>;
|
|
|
1255
1289
|
|
|
1256
1290
|
// @public (undocumented)
|
|
1257
1291
|
export const objectToQueryString: (json: {
|
|
1258
|
-
[key: string]:
|
|
1292
|
+
[key: string]: boolean | null | number | string | undefined;
|
|
1259
1293
|
}) => string;
|
|
1260
1294
|
|
|
1261
1295
|
// @public (undocumented)
|
|
@@ -1336,7 +1370,7 @@ export interface PreviewableFileState {
|
|
|
1336
1370
|
export interface PreviewOptions {}
|
|
1337
1371
|
|
|
1338
1372
|
// @public (undocumented)
|
|
1339
|
-
export interface ProcessedFileState {
|
|
1373
|
+
export interface ProcessedFileState extends BaseFileState {
|
|
1340
1374
|
// (undocumented)
|
|
1341
1375
|
artifacts: MediaFileArtifacts;
|
|
1342
1376
|
// (undocumented)
|
|
@@ -1362,7 +1396,7 @@ export interface ProcessedFileState {
|
|
|
1362
1396
|
}
|
|
1363
1397
|
|
|
1364
1398
|
// @public (undocumented)
|
|
1365
|
-
export interface ProcessingFailedState {
|
|
1399
|
+
export interface ProcessingFailedState extends BaseFileState {
|
|
1366
1400
|
// (undocumented)
|
|
1367
1401
|
artifacts: Object;
|
|
1368
1402
|
// (undocumented)
|
|
@@ -1388,7 +1422,7 @@ export interface ProcessingFailedState {
|
|
|
1388
1422
|
}
|
|
1389
1423
|
|
|
1390
1424
|
// @public (undocumented)
|
|
1391
|
-
export interface ProcessingFileState {
|
|
1425
|
+
export interface ProcessingFileState extends BaseFileState {
|
|
1392
1426
|
// (undocumented)
|
|
1393
1427
|
artifacts?: MediaFileArtifacts;
|
|
1394
1428
|
// (undocumented)
|
|
@@ -1464,17 +1498,17 @@ export type RequestErrorMetadata = RequestMetadata & {
|
|
|
1464
1498
|
|
|
1465
1499
|
// @public (undocumented)
|
|
1466
1500
|
export type RequestErrorReason =
|
|
1467
|
-
| 'clientOffline'
|
|
1468
1501
|
| 'clientAbortedRequest'
|
|
1502
|
+
| 'clientOffline'
|
|
1469
1503
|
| 'clientTimeoutRequest'
|
|
1470
|
-
| '
|
|
1504
|
+
| 'serverBadGateway'
|
|
1471
1505
|
| 'serverBadRequest'
|
|
1472
|
-
| 'serverUnauthorized'
|
|
1473
1506
|
| 'serverForbidden'
|
|
1507
|
+
| 'serverInternalError'
|
|
1508
|
+
| 'serverInvalidBody'
|
|
1474
1509
|
| 'serverNotFound'
|
|
1475
1510
|
| 'serverRateLimited'
|
|
1476
|
-
| '
|
|
1477
|
-
| 'serverBadGateway'
|
|
1511
|
+
| 'serverUnauthorized'
|
|
1478
1512
|
| 'serverUnexpectedError';
|
|
1479
1513
|
|
|
1480
1514
|
// @public (undocumented)
|
|
@@ -1488,14 +1522,16 @@ export type RequestMetadata = {
|
|
|
1488
1522
|
readonly endpoint?: string;
|
|
1489
1523
|
readonly mediaRegion?: string;
|
|
1490
1524
|
readonly mediaEnv?: string;
|
|
1525
|
+
readonly traceContext?: MediaTraceContext;
|
|
1491
1526
|
};
|
|
1492
1527
|
|
|
1493
1528
|
// @public (undocumented)
|
|
1494
|
-
export type RequestMethod = '
|
|
1529
|
+
export type RequestMethod = 'DELETE' | 'GET' | 'POST' | 'PUT';
|
|
1495
1530
|
|
|
1496
1531
|
// @public (undocumented)
|
|
1497
1532
|
export type RequestOptions = RequestMetadata & {
|
|
1498
1533
|
readonly auth?: Auth;
|
|
1534
|
+
readonly traceContext?: Required<MediaTraceContext>;
|
|
1499
1535
|
readonly params?: RequestParams;
|
|
1500
1536
|
readonly headers?: RequestHeaders;
|
|
1501
1537
|
readonly body?: any;
|
|
@@ -1516,6 +1552,8 @@ export interface ResponseFileItem {
|
|
|
1516
1552
|
// (undocumented)
|
|
1517
1553
|
id: string;
|
|
1518
1554
|
// (undocumented)
|
|
1555
|
+
metadataTraceContext?: MediaTraceContext;
|
|
1556
|
+
// (undocumented)
|
|
1519
1557
|
type: 'file';
|
|
1520
1558
|
}
|
|
1521
1559
|
|
|
@@ -1536,7 +1574,7 @@ export interface SourceFile {
|
|
|
1536
1574
|
// (undocumented)
|
|
1537
1575
|
id: string;
|
|
1538
1576
|
// (undocumented)
|
|
1539
|
-
owner:
|
|
1577
|
+
owner: AsapBasedAuth | ClientAltBasedAuth;
|
|
1540
1578
|
// (undocumented)
|
|
1541
1579
|
version?: number;
|
|
1542
1580
|
}
|
|
@@ -1607,6 +1645,7 @@ export const uploadFile: (
|
|
|
1607
1645
|
store: MediaStore,
|
|
1608
1646
|
uploadableFileUpfrontIds: UploadableFileUpfrontIds,
|
|
1609
1647
|
callbacks?: UploadFileCallbacks | undefined,
|
|
1648
|
+
traceContext?: MediaTraceContext | undefined,
|
|
1610
1649
|
) => UploadFileResult;
|
|
1611
1650
|
|
|
1612
1651
|
// @public (undocumented)
|
|
@@ -1622,7 +1661,7 @@ export interface UploadFileResult {
|
|
|
1622
1661
|
}
|
|
1623
1662
|
|
|
1624
1663
|
// @public (undocumented)
|
|
1625
|
-
export interface UploadingFileState {
|
|
1664
|
+
export interface UploadingFileState extends BaseFileState {
|
|
1626
1665
|
// (undocumented)
|
|
1627
1666
|
createdAt?: number;
|
|
1628
1667
|
// (undocumented)
|
|
@@ -1677,3 +1716,5 @@ export type WithMediaClientFunction = <P extends WithMediaClient>(
|
|
|
1677
1716
|
|
|
1678
1717
|
// (No @packageDocumentation comment for this package)
|
|
1679
1718
|
```
|
|
1719
|
+
|
|
1720
|
+
<!--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
|
-
}
|