@atlaskit/media-client 28.6.0 → 29.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 +9 -0
- package/dist/cjs/client/file-fetcher/index.js +99 -53
- package/dist/cjs/client/media-store/MediaStore.js +24 -21
- package/dist/cjs/utils/createCopyIntentRegisterationBatcher.js +123 -0
- package/dist/es2019/client/file-fetcher/index.js +22 -0
- package/dist/es2019/client/media-store/MediaStore.js +6 -11
- package/dist/es2019/utils/createCopyIntentRegisterationBatcher.js +75 -0
- package/dist/esm/client/file-fetcher/index.js +99 -53
- package/dist/esm/client/media-store/MediaStore.js +24 -21
- package/dist/esm/utils/createCopyIntentRegisterationBatcher.js +115 -0
- package/dist/types/client/file-fetcher/index.d.ts +3 -0
- package/dist/types/client/media-store/MediaStore.d.ts +4 -1
- package/dist/types/client/media-store/types.d.ts +5 -1
- package/dist/types/utils/createCopyIntentRegisterationBatcher.d.ts +20 -0
- package/dist/types-ts4.5/client/file-fetcher/index.d.ts +3 -0
- package/dist/types-ts4.5/client/media-store/MediaStore.d.ts +4 -1
- package/dist/types-ts4.5/client/media-store/types.d.ts +5 -1
- package/dist/types-ts4.5/utils/createCopyIntentRegisterationBatcher.d.ts +20 -0
- package/package.json +4 -4
|
@@ -39,11 +39,13 @@ export interface FileFetcher {
|
|
|
39
39
|
getCurrentState(id: string, options?: GetFileOptions): Promise<FileState>;
|
|
40
40
|
copyFile(source: CopySourceFile, destination: CopyDestination, options?: CopyFileOptions, traceContext?: MediaTraceContext): Promise<MediaFile>;
|
|
41
41
|
getFileBinaryURL(id: string, collectionName?: string, maxAge?: number): Promise<string>;
|
|
42
|
+
registerCopyIntent(id: string, collectionName?: string): Promise<void>;
|
|
42
43
|
}
|
|
43
44
|
export declare class FileFetcherImpl implements FileFetcher {
|
|
44
45
|
private readonly mediaApi;
|
|
45
46
|
private readonly store;
|
|
46
47
|
private readonly dataloader;
|
|
48
|
+
private readonly copyIntentRegisterationBatcher;
|
|
47
49
|
constructor(mediaApi: MediaApi, store?: MediaStore);
|
|
48
50
|
private getErrorFileState;
|
|
49
51
|
private setFileState;
|
|
@@ -58,6 +60,7 @@ export declare class FileFetcherImpl implements FileFetcher {
|
|
|
58
60
|
private getUploadingFileStateBase;
|
|
59
61
|
upload(file: UploadableFile, controller?: UploadController, uploadableFileUpfrontIds?: UploadableFileUpfrontIds, traceContext?: MediaTraceContext): MediaSubscribable;
|
|
60
62
|
downloadBinary(id: string, name?: string, collectionName?: string, traceContext?: MediaTraceContext): Promise<void>;
|
|
63
|
+
registerCopyIntent(id: string, collectionName?: string): Promise<void>;
|
|
61
64
|
private copyFileWithToken;
|
|
62
65
|
private copyFileWithIntent;
|
|
63
66
|
copyFile(source: CopySourceFile, destination: CopyDestination, options?: CopyFileOptions, traceContext?: MediaTraceContext): Promise<MediaFile>;
|
|
@@ -29,7 +29,10 @@ export declare class MediaStore implements MediaApi {
|
|
|
29
29
|
appendChunksToUpload(uploadId: string, body: AppendChunksToUploadRequestBody, collectionName?: string, traceContext?: MediaTraceContext): Promise<void>;
|
|
30
30
|
copyFileWithToken(body: MediaStoreCopyFileWithTokenBody, params: MediaStoreCopyFileWithTokenParams, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaFile>>;
|
|
31
31
|
copyFile(id: string, params: CopyFileParams, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaFile>>;
|
|
32
|
-
registerCopyIntents(
|
|
32
|
+
registerCopyIntents(files: Array<{
|
|
33
|
+
id: string;
|
|
34
|
+
collection?: string;
|
|
35
|
+
}>, traceContext?: MediaTraceContext, resolvedAuth?: Auth): Promise<void>;
|
|
33
36
|
request(path: string, options?: MediaStoreRequestOptions, controller?: AbortController, useMediaCdn?: boolean): Promise<Response>;
|
|
34
37
|
testUrl(url: string, options?: {
|
|
35
38
|
traceContext?: MediaTraceContext;
|
|
@@ -37,6 +37,7 @@ export interface MediaStoreResponse<Data> {
|
|
|
37
37
|
export type MediaStoreRequestOptions = RequestMetadata & {
|
|
38
38
|
readonly method?: RequestMethod;
|
|
39
39
|
readonly authContext?: AuthContext;
|
|
40
|
+
readonly resolvedAuth?: Auth;
|
|
40
41
|
readonly params?: RequestParams;
|
|
41
42
|
readonly headers?: RequestHeaders;
|
|
42
43
|
readonly body?: any;
|
|
@@ -172,7 +173,10 @@ export interface MediaApi {
|
|
|
172
173
|
appendChunksToUpload: (uploadId: string, body: AppendChunksToUploadRequestBody, collectionName?: string, traceContext?: MediaTraceContext) => Promise<void>;
|
|
173
174
|
copyFileWithToken: (body: MediaStoreCopyFileWithTokenBody, params: MediaStoreCopyFileWithTokenParams, traceContext?: MediaTraceContext) => Promise<MediaStoreResponse<MediaFile>>;
|
|
174
175
|
copyFile: (id: string, params: CopyFileParams) => Promise<MediaStoreResponse<MediaFile>>;
|
|
175
|
-
registerCopyIntents: (
|
|
176
|
+
registerCopyIntents: (files: Array<{
|
|
177
|
+
id: string;
|
|
178
|
+
collection: string;
|
|
179
|
+
}>, traceContext?: MediaTraceContext, resolvedAuth?: Auth) => Promise<void>;
|
|
176
180
|
request: (path: string, options: MediaStoreRequestOptions, controller?: AbortController) => Promise<Response>;
|
|
177
181
|
testUrl: (url: string, options?: {
|
|
178
182
|
traceContext?: MediaTraceContext;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import Dataloader from 'dataloader';
|
|
2
|
+
import { type MediaStore } from '../client/media-store';
|
|
3
|
+
import { type NotFoundMediaItemDetails, type MediaItemDetails } from '../models/media';
|
|
4
|
+
import { type Auth } from '@atlaskit/media-core';
|
|
5
|
+
export declare const MAX_BATCH_SIZE = 100;
|
|
6
|
+
export type CopyIntentKey = {
|
|
7
|
+
readonly id: string;
|
|
8
|
+
readonly resolvedAuth: Auth;
|
|
9
|
+
readonly collectionName?: string;
|
|
10
|
+
};
|
|
11
|
+
export type DataloaderResult = MediaItemDetails | NotFoundMediaItemDetails;
|
|
12
|
+
export type BatchLoadingErrorResult = {
|
|
13
|
+
readonly id: string;
|
|
14
|
+
readonly collection?: string;
|
|
15
|
+
readonly error: Error;
|
|
16
|
+
};
|
|
17
|
+
export type FilesByToken = {
|
|
18
|
+
[token: string]: CopyIntentKey[];
|
|
19
|
+
};
|
|
20
|
+
export declare function createCopyIntentRegisterationBatcher(mediaStore: MediaStore): Dataloader<CopyIntentKey, Error | undefined, string>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-client",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "29.0.0",
|
|
4
4
|
"description": "Media API Web Client Library",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -50,14 +50,14 @@
|
|
|
50
50
|
"xstate": "4.20.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"@atlaskit/media-core": "^34.
|
|
53
|
+
"@atlaskit/media-core": "^34.4.0",
|
|
54
54
|
"@atlaskit/media-state": "^1.0.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@atlaskit/media-core": "^34.
|
|
57
|
+
"@atlaskit/media-core": "^34.4.0",
|
|
58
58
|
"@atlaskit/media-state": "^1.2.0",
|
|
59
59
|
"@atlaskit/ssr": "*",
|
|
60
|
-
"@atlaskit/tokens": "^2.
|
|
60
|
+
"@atlaskit/tokens": "^2.5.0",
|
|
61
61
|
"@atlassian/feature-flags-test-utils": "0.2.3",
|
|
62
62
|
"@emotion/react": "^11.7.1",
|
|
63
63
|
"@types/deep-equal": "^1.0.1",
|