@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
|
@@ -2,7 +2,7 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
|
2
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
export { RequestError, isRequestError } from './errors';
|
|
4
4
|
export { isRateLimitedError } from './helpers';
|
|
5
|
-
import { createUrl, fetchRetry, createProcessFetchResponse,
|
|
5
|
+
import { createUrl, fetchRetry, createProcessFetchResponse, extendHeaders } from './helpers';
|
|
6
6
|
export function request(_x) {
|
|
7
7
|
return _request.apply(this, arguments);
|
|
8
8
|
}
|
|
@@ -20,6 +20,7 @@ function _request() {
|
|
|
20
20
|
body,
|
|
21
21
|
_options$clientOption,
|
|
22
22
|
clientOptions,
|
|
23
|
+
traceContext,
|
|
23
24
|
retryOptions,
|
|
24
25
|
metadata,
|
|
25
26
|
doFetch,
|
|
@@ -31,7 +32,7 @@ function _request() {
|
|
|
31
32
|
case 0:
|
|
32
33
|
options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
|
33
34
|
controller = _args.length > 2 ? _args[2] : undefined;
|
|
34
|
-
_options$method = options.method, method = _options$method === void 0 ? 'GET' : _options$method, endpoint = options.endpoint, auth = options.auth, params = options.params, headers = options.headers, body = options.body, _options$clientOption = options.clientOptions, clientOptions = _options$clientOption === void 0 ? {} : _options$clientOption;
|
|
35
|
+
_options$method = options.method, method = _options$method === void 0 ? 'GET' : _options$method, endpoint = options.endpoint, auth = options.auth, params = options.params, headers = options.headers, body = options.body, _options$clientOption = options.clientOptions, clientOptions = _options$clientOption === void 0 ? {} : _options$clientOption, traceContext = options.traceContext;
|
|
35
36
|
retryOptions = clientOptions.retryOptions;
|
|
36
37
|
metadata = {
|
|
37
38
|
method: method,
|
|
@@ -44,7 +45,7 @@ function _request() {
|
|
|
44
45
|
}), {
|
|
45
46
|
method: method,
|
|
46
47
|
body: body,
|
|
47
|
-
headers:
|
|
48
|
+
headers: extendHeaders(headers, auth, traceContext),
|
|
48
49
|
signal: controller && controller.signal
|
|
49
50
|
}).then(createProcessFetchResponse(metadata));
|
|
50
51
|
};
|
package/dist/esm/version.json
CHANGED
|
@@ -3,6 +3,7 @@ import { FileDetails, FileItem } from '../models/item';
|
|
|
3
3
|
import { MediaCollectionItem } from '../models/media';
|
|
4
4
|
import { MediaStore, MediaStoreGetCollectionItemsParams } from './media-store';
|
|
5
5
|
import { MediaSubscribable } from '../utils/mediaSubscribable';
|
|
6
|
+
import { MediaTraceContext } from '@atlaskit/media-common';
|
|
6
7
|
export interface MediaCollectionFileItemDetails extends FileDetails {
|
|
7
8
|
occurrenceKey: string;
|
|
8
9
|
}
|
|
@@ -29,7 +30,7 @@ export declare class CollectionFetcher {
|
|
|
29
30
|
private createFileStateObserver;
|
|
30
31
|
private populateCache;
|
|
31
32
|
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>;
|
|
33
|
+
getItems(collectionName: string, params?: MediaStoreGetCollectionItemsParams, traceContext?: MediaTraceContext): MediaSubscribable<MediaCollectionItem[]>;
|
|
34
|
+
removeFile(id: string, collectionName: string, occurrenceKey?: string, traceContext?: MediaTraceContext): Promise<void>;
|
|
35
|
+
loadNextPage(collectionName: string, params?: MediaStoreGetCollectionItemsParams, traceContext?: MediaTraceContext): Promise<void>;
|
|
35
36
|
}
|
|
@@ -8,6 +8,7 @@ import { MediaFileArtifacts } from '../../models/artifacts';
|
|
|
8
8
|
import { UploadController } from '../../upload-controller';
|
|
9
9
|
import { MediaSubscribable } from '../../utils/mediaSubscribable';
|
|
10
10
|
import { Dimensions } from '../../utils/getDimensionsFromBlob';
|
|
11
|
+
import { MediaTraceContext } from '@atlaskit/media-common';
|
|
11
12
|
export type { FileFetcherErrorAttributes, FileFetcherErrorReason, } from './error';
|
|
12
13
|
export { isFileFetcherError, FileFetcherError } from './error';
|
|
13
14
|
export interface CopySourceFile {
|
|
@@ -30,12 +31,12 @@ export declare type ExternalUploadPayload = {
|
|
|
30
31
|
export interface FileFetcher {
|
|
31
32
|
getFileState(id: string, options?: GetFileOptions): MediaSubscribable<FileState>;
|
|
32
33
|
getArtifactURL(artifacts: MediaFileArtifacts, artifactName: keyof MediaFileArtifacts, collectionName?: string): Promise<string>;
|
|
33
|
-
touchFiles(descriptors: TouchFileDescriptor[], collection?: string): Promise<TouchedFiles>;
|
|
34
|
-
upload(file: UploadableFile, controller?: UploadController, uploadableFileUpfrontIds?: UploadableFileUpfrontIds): MediaSubscribable<FileState>;
|
|
35
|
-
uploadExternal(url: string, collection?: string): Promise<ExternalUploadPayload>;
|
|
34
|
+
touchFiles(descriptors: TouchFileDescriptor[], collection?: string, traceContext?: MediaTraceContext): Promise<TouchedFiles>;
|
|
35
|
+
upload(file: UploadableFile, controller?: UploadController, uploadableFileUpfrontIds?: UploadableFileUpfrontIds, traceContext?: MediaTraceContext): MediaSubscribable<FileState>;
|
|
36
|
+
uploadExternal(url: string, collection?: string, traceContext?: MediaTraceContext): Promise<ExternalUploadPayload>;
|
|
36
37
|
downloadBinary(id: string, name?: string, collectionName?: string): Promise<void>;
|
|
37
38
|
getCurrentState(id: string, options?: GetFileOptions): Promise<FileState>;
|
|
38
|
-
copyFile(source: CopySourceFile, destination: CopyDestination, options?: CopyFileOptions): Promise<MediaFile>;
|
|
39
|
+
copyFile(source: CopySourceFile, destination: CopyDestination, options?: CopyFileOptions, traceContext?: MediaTraceContext): Promise<MediaFile>;
|
|
39
40
|
getFileBinaryURL(id: string, collectionName?: string): Promise<string>;
|
|
40
41
|
}
|
|
41
42
|
export declare class FileFetcherImpl implements FileFetcher {
|
|
@@ -47,10 +48,10 @@ export declare class FileFetcherImpl implements FileFetcher {
|
|
|
47
48
|
getArtifactURL(artifacts: MediaFileArtifacts, artifactName: keyof MediaFileArtifacts, collectionName?: string): Promise<string>;
|
|
48
49
|
getFileBinaryURL(id: string, collectionName?: string): Promise<string>;
|
|
49
50
|
private createDownloadFileStream;
|
|
50
|
-
touchFiles(descriptors: TouchFileDescriptor[], collection?: string): Promise<TouchedFiles>;
|
|
51
|
+
touchFiles(descriptors: TouchFileDescriptor[], collection?: string, traceContext?: MediaTraceContext): Promise<TouchedFiles>;
|
|
51
52
|
private generateUploadableFileUpfrontIds;
|
|
52
|
-
uploadExternal(url: string, collection?: string): Promise<ExternalUploadPayload>;
|
|
53
|
-
upload(file: UploadableFile, controller?: UploadController, uploadableFileUpfrontIds?: UploadableFileUpfrontIds): MediaSubscribable<FileState>;
|
|
53
|
+
uploadExternal(url: string, collection?: string, traceContext?: MediaTraceContext): Promise<ExternalUploadPayload>;
|
|
54
|
+
upload(file: UploadableFile, controller?: UploadController, uploadableFileUpfrontIds?: UploadableFileUpfrontIds, traceContext?: MediaTraceContext): MediaSubscribable<FileState>;
|
|
54
55
|
downloadBinary(id: string, name?: string, collectionName?: string): Promise<void>;
|
|
55
|
-
copyFile(source: CopySourceFile, destination: CopyDestination, options?: CopyFileOptions): Promise<MediaFile>;
|
|
56
|
+
copyFile(source: CopySourceFile, destination: CopyDestination, options?: CopyFileOptions, traceContext?: MediaTraceContext): Promise<MediaFile>;
|
|
56
57
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MediaClientConfig } from '@atlaskit/media-core';
|
|
2
|
-
import { MediaFeatureFlags } from '@atlaskit/media-common';
|
|
2
|
+
import { MediaFeatureFlags, MediaTraceContext } from '@atlaskit/media-common';
|
|
3
3
|
import { MediaStore, MediaStoreGetFileImageParams, ImageMetadata } from './media-store';
|
|
4
4
|
import { CollectionFetcher } from './collection-fetcher';
|
|
5
5
|
import { FileFetcher } from './file-fetcher';
|
|
@@ -17,7 +17,7 @@ export declare class MediaClient {
|
|
|
17
17
|
private mobileUpload?;
|
|
18
18
|
readonly config: MediaClientConfig;
|
|
19
19
|
constructor(mediaClientConfig: MediaClientConfig, featureFlags?: MediaFeatureFlags | undefined);
|
|
20
|
-
getImage(id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean,
|
|
20
|
+
getImage(id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean, traceContext?: MediaTraceContext): Promise<Blob>;
|
|
21
21
|
getImageUrl(id: string, params?: MediaStoreGetFileImageParams): Promise<string>;
|
|
22
22
|
getImageUrlSync(id: string, params?: MediaStoreGetFileImageParams): string;
|
|
23
23
|
getImageMetadata(id: string, params?: MediaStoreGetFileImageParams): Promise<ImageMetadata>;
|
|
@@ -1,48 +1,41 @@
|
|
|
1
1
|
import { AsapBasedAuth, AuthContext, ClientAltBasedAuth, MediaApiConfig, Auth } from '@atlaskit/media-core';
|
|
2
|
-
import { MediaFeatureFlags } from '@atlaskit/media-common';
|
|
2
|
+
import { MediaFeatureFlags, MediaTraceContext } from '@atlaskit/media-common';
|
|
3
3
|
import { MediaFileArtifacts } from '../../models/artifacts';
|
|
4
4
|
import { MediaChunksProbe, MediaCollectionItemFullDetails, MediaCollectionItems, MediaFile, MediaUpload } from '../../models/media';
|
|
5
5
|
import { ClientOptions, RequestHeaders, RequestMethod, RequestParams, RequestMetadata } from '../../utils/request/types';
|
|
6
6
|
export type { MediaStoreErrorReason, MediaStoreErrorAttributes } from './error';
|
|
7
7
|
export { MediaStoreError, isMediaStoreError } from './error';
|
|
8
|
-
export declare const ZipkinHeaderKeys: {
|
|
9
|
-
traceId: string;
|
|
10
|
-
spanId: string;
|
|
11
|
-
parentSpanId: string;
|
|
12
|
-
sampled: string;
|
|
13
|
-
flags: string;
|
|
14
|
-
};
|
|
15
8
|
export declare class MediaStore {
|
|
16
9
|
private readonly config;
|
|
17
10
|
readonly featureFlags?: MediaFeatureFlags | undefined;
|
|
18
11
|
constructor(config: MediaApiConfig, featureFlags?: MediaFeatureFlags | undefined);
|
|
19
|
-
getCollectionItems(collectionName: string, params?: MediaStoreGetCollectionItemsParams): Promise<MediaStoreResponse<MediaCollectionItems>>;
|
|
20
|
-
removeCollectionFile(id: string, collectionName: string, occurrenceKey?: string): Promise<void>;
|
|
21
|
-
createUpload(createUpTo?: number, collectionName?: string): Promise<MediaStoreResponse<MediaUpload[]>>;
|
|
12
|
+
getCollectionItems(collectionName: string, params?: MediaStoreGetCollectionItemsParams, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaCollectionItems>>;
|
|
13
|
+
removeCollectionFile(id: string, collectionName: string, occurrenceKey?: string, traceContext?: MediaTraceContext): Promise<void>;
|
|
14
|
+
createUpload(createUpTo?: number, collectionName?: string, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaUpload[]>>;
|
|
22
15
|
uploadChunk(etag: string, blob: Blob, { collectionName, uploadId, partNumber, }?: {
|
|
23
16
|
collectionName?: string;
|
|
24
17
|
uploadId?: string;
|
|
25
18
|
partNumber?: number;
|
|
26
|
-
}): Promise<void>;
|
|
19
|
+
}, traceContext?: MediaTraceContext): Promise<void>;
|
|
27
20
|
probeChunks(chunks: string[], { collectionName, uploadId, }?: {
|
|
28
21
|
collectionName?: string;
|
|
29
22
|
uploadId?: string;
|
|
30
|
-
}): Promise<MediaStoreResponse<MediaChunksProbe>>;
|
|
31
|
-
createFileFromUpload(body: MediaStoreCreateFileFromUploadBody, params?: MediaStoreCreateFileFromUploadParams): Promise<MediaStoreResponse<MediaFile>>;
|
|
32
|
-
touchFiles(body: MediaStoreTouchFileBody, params?: MediaStoreTouchFileParams): Promise<MediaStoreResponse<TouchedFiles>>;
|
|
33
|
-
getFile(fileId: string, params?: MediaStoreGetFileParams): Promise<MediaStoreResponse<MediaFile>>;
|
|
23
|
+
}, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaChunksProbe>>;
|
|
24
|
+
createFileFromUpload(body: MediaStoreCreateFileFromUploadBody, params?: MediaStoreCreateFileFromUploadParams, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaFile>>;
|
|
25
|
+
touchFiles(body: MediaStoreTouchFileBody, params?: MediaStoreTouchFileParams, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<TouchedFiles>>;
|
|
26
|
+
getFile(fileId: string, params?: MediaStoreGetFileParams, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaFile>>;
|
|
34
27
|
getFileImageURL(id: string, params?: MediaStoreGetFileImageParams): Promise<string>;
|
|
35
28
|
getFileImageURLSync(id: string, params?: MediaStoreGetFileImageParams): string;
|
|
36
29
|
private createFileImageURL;
|
|
37
30
|
getFileBinaryURL(id: string, collectionName?: string): Promise<string>;
|
|
38
31
|
getArtifactURL(artifacts: MediaFileArtifacts, artifactName: keyof MediaFileArtifacts, collectionName?: string): Promise<string>;
|
|
39
|
-
getImage(id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean,
|
|
40
|
-
getItems(ids: string[], collectionName?: string): Promise<MediaStoreResponse<ItemsPayload>>;
|
|
41
|
-
getImageMetadata(id: string, params?: MediaStoreGetFileImageParams): Promise<{
|
|
32
|
+
getImage(id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean, traceContext?: MediaTraceContext): Promise<Blob>;
|
|
33
|
+
getItems(ids: string[], collectionName?: string, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<ItemsPayload>>;
|
|
34
|
+
getImageMetadata(id: string, params?: MediaStoreGetFileImageParams, traceContext?: MediaTraceContext): Promise<{
|
|
42
35
|
metadata: ImageMetadata;
|
|
43
36
|
}>;
|
|
44
|
-
appendChunksToUpload(uploadId: string, body: AppendChunksToUploadRequestBody, collectionName?: string): Promise<void>;
|
|
45
|
-
copyFileWithToken(body: MediaStoreCopyFileWithTokenBody, params: MediaStoreCopyFileWithTokenParams): Promise<MediaStoreResponse<MediaFile>>;
|
|
37
|
+
appendChunksToUpload(uploadId: string, body: AppendChunksToUploadRequestBody, collectionName?: string, traceContext?: MediaTraceContext): Promise<void>;
|
|
38
|
+
copyFileWithToken(body: MediaStoreCopyFileWithTokenBody, params: MediaStoreCopyFileWithTokenParams, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaFile>>;
|
|
46
39
|
request(path: string, options?: MediaStoreRequestOptions, controller?: AbortController): Promise<Response>;
|
|
47
40
|
resolveAuth: (authContext?: AuthContext | undefined) => Promise<Auth>;
|
|
48
41
|
resolveInitialAuth: () => Auth;
|
|
@@ -79,6 +72,7 @@ export declare type MediaStoreRequestOptions = RequestMetadata & {
|
|
|
79
72
|
readonly headers?: RequestHeaders;
|
|
80
73
|
readonly body?: any;
|
|
81
74
|
readonly clientOptions?: ClientOptions;
|
|
75
|
+
readonly traceContext?: MediaTraceContext;
|
|
82
76
|
};
|
|
83
77
|
export declare type MediaStoreCreateFileFromUploadParams = {
|
|
84
78
|
readonly collection?: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ChunkinatorFile } from '@atlaskit/chunkinator';
|
|
2
2
|
import { MediaStore } from '../client/media-store';
|
|
3
|
+
import { MediaTraceContext } from '@atlaskit/media-common';
|
|
3
4
|
export declare type UploadableFile = {
|
|
4
5
|
content: ChunkinatorFile;
|
|
5
6
|
name?: string;
|
|
@@ -18,4 +19,4 @@ export declare type UploadFileCallbacks = {
|
|
|
18
19
|
export interface UploadFileResult {
|
|
19
20
|
cancel: () => void;
|
|
20
21
|
}
|
|
21
|
-
export declare const uploadFile: (file: UploadableFile, store: MediaStore, uploadableFileUpfrontIds: UploadableFileUpfrontIds, callbacks?: UploadFileCallbacks | undefined) => UploadFileResult;
|
|
22
|
+
export declare const uploadFile: (file: UploadableFile, store: MediaStore, uploadableFileUpfrontIds: UploadableFileUpfrontIds, callbacks?: UploadFileCallbacks | undefined, traceContext?: MediaTraceContext | undefined) => UploadFileResult;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Auth } from '@atlaskit/media-core';
|
|
2
|
+
import { MediaTraceContext } from '@atlaskit/media-common';
|
|
2
3
|
import { RequestError } from './errors';
|
|
3
4
|
import { CreateUrlOptions, RequestErrorReason, RequestErrorMetadata, RequestHeaders, RequestMetadata, RetryOptions } from './types';
|
|
4
5
|
export declare function clientTimeoutPromise(timeout: number): Promise<Response>;
|
|
@@ -6,9 +7,16 @@ export declare function waitPromise(timeout: number): Promise<void>;
|
|
|
6
7
|
export declare function isAbortedRequestError(err: any): boolean;
|
|
7
8
|
export declare function isFetchNetworkError(err: any): err is TypeError;
|
|
8
9
|
export declare function isRateLimitedError(error: Error | undefined): boolean;
|
|
9
|
-
export declare
|
|
10
|
+
export declare const ZipkinHeaderKeys: {
|
|
11
|
+
traceId: string;
|
|
12
|
+
spanId: string;
|
|
13
|
+
parentSpanId: string;
|
|
14
|
+
sampled: string;
|
|
15
|
+
flags: string;
|
|
16
|
+
};
|
|
17
|
+
export declare function mapAuthToRequestHeaders(auth?: Auth): RequestHeaders;
|
|
10
18
|
export declare function createUrl(url: string, { params, auth }: CreateUrlOptions): string;
|
|
11
|
-
export declare function
|
|
19
|
+
export declare function extendHeaders(headers?: RequestHeaders, auth?: Auth, traceContext?: Required<MediaTraceContext>): RequestHeaders | undefined;
|
|
12
20
|
/**
|
|
13
21
|
* @deprecated Helper is deprecated and will be removed in the next major version.
|
|
14
22
|
* TODO: https://product-fabric.atlassian.net/browse/BMPT-1354
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Auth } from '@atlaskit/media-core';
|
|
2
|
+
import type { MediaTraceContext } from '@atlaskit/media-common';
|
|
2
3
|
export declare type RequestMethod = 'GET' | 'POST' | 'PUT' | 'DELETE';
|
|
3
4
|
export declare type RequestParams = {
|
|
4
5
|
[key: string]: any;
|
|
@@ -23,6 +24,7 @@ export declare type RequestMetadata = {
|
|
|
23
24
|
};
|
|
24
25
|
export declare type RequestOptions = RequestMetadata & {
|
|
25
26
|
readonly auth?: Auth;
|
|
27
|
+
readonly traceContext?: Required<MediaTraceContext>;
|
|
26
28
|
readonly params?: RequestParams;
|
|
27
29
|
readonly headers?: RequestHeaders;
|
|
28
30
|
readonly body?: any;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-client",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "19.0.0",
|
|
4
4
|
"description": "Media API Web Client Library",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -12,14 +12,6 @@
|
|
|
12
12
|
"module": "dist/esm/index.js",
|
|
13
13
|
"module:es2019": "dist/es2019/index.js",
|
|
14
14
|
"types": "dist/types/index.d.ts",
|
|
15
|
-
"typesVersions": {
|
|
16
|
-
">=4.0 <4.5": {
|
|
17
|
-
"*": [
|
|
18
|
-
"dist/types-ts4.0/*",
|
|
19
|
-
"dist/types-ts4.0/index.d.ts"
|
|
20
|
-
]
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
15
|
"sideEffects": false,
|
|
24
16
|
"atlaskit:src": "src/index.ts",
|
|
25
17
|
"af:exports": {
|
|
@@ -55,13 +47,13 @@
|
|
|
55
47
|
"react": "^16.8.0"
|
|
56
48
|
},
|
|
57
49
|
"devDependencies": {
|
|
58
|
-
"@atlaskit/button": "^16.
|
|
50
|
+
"@atlaskit/button": "^16.5.0",
|
|
59
51
|
"@atlaskit/docs": "*",
|
|
60
|
-
"@atlaskit/media-card": "^74.
|
|
52
|
+
"@atlaskit/media-card": "^74.3.0",
|
|
61
53
|
"@atlaskit/media-core": "^34.0.0",
|
|
62
54
|
"@atlaskit/media-test-helpers": "^30.0.0",
|
|
63
55
|
"@atlaskit/ssr": "*",
|
|
64
|
-
"@atlaskit/tokens": "^0.
|
|
56
|
+
"@atlaskit/tokens": "^0.11.0",
|
|
65
57
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
66
58
|
"@emotion/react": "^11.7.1",
|
|
67
59
|
"@types/deep-equal": "^1.0.1",
|