@atlaskit/media-client 33.0.0 → 33.1.1
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 +20 -0
- package/dist/cjs/client/file-fetcher/index.js +143 -114
- package/dist/cjs/client/media-store/MediaStore.js +226 -137
- package/dist/cjs/utils/request/helpers.js +1 -1
- package/dist/es2019/client/file-fetcher/index.js +15 -0
- package/dist/es2019/client/media-store/MediaStore.js +62 -6
- package/dist/es2019/utils/request/helpers.js +1 -1
- package/dist/esm/client/file-fetcher/index.js +143 -114
- package/dist/esm/client/media-store/MediaStore.js +226 -137
- package/dist/esm/utils/request/helpers.js +1 -1
- package/dist/types/client/file-fetcher/index.d.ts +4 -1
- package/dist/types/client/media-store/MediaStore.d.ts +3 -1
- package/dist/types/client/media-store/types.d.ts +13 -0
- package/dist/types-ts4.5/client/file-fetcher/index.d.ts +4 -1
- package/dist/types-ts4.5/client/media-store/MediaStore.d.ts +3 -1
- package/dist/types-ts4.5/client/media-store/types.d.ts +13 -0
- package/package.json +3 -3
|
@@ -73,7 +73,7 @@ export function createUrl(url, _ref2) {
|
|
|
73
73
|
return value != null;
|
|
74
74
|
}).forEach(function (pair) {
|
|
75
75
|
var _parsedUrl$searchPara;
|
|
76
|
-
(_parsedUrl$searchPara = parsedUrl.searchParams).
|
|
76
|
+
(_parsedUrl$searchPara = parsedUrl.searchParams).set.apply(_parsedUrl$searchPara, _toConsumableArray(pair));
|
|
77
77
|
});
|
|
78
78
|
parsedUrl.searchParams.sort();
|
|
79
79
|
return parsedUrl.toString();
|
|
@@ -2,13 +2,14 @@ import { type AuthProvider } from '@atlaskit/media-core';
|
|
|
2
2
|
import { type MediaFileArtifacts } from '@atlaskit/media-state';
|
|
3
3
|
import { MediaStore as MediaApi, type MediaStoreCopyFileWithTokenParams, type TouchedFiles, type TouchFileDescriptor } from '../media-store';
|
|
4
4
|
import { type GetFileOptions } from '../../models/file-state';
|
|
5
|
-
import { type MediaFile } from '../../models/media';
|
|
5
|
+
import { type MediaItemDetails, type MediaFile } from '../../models/media';
|
|
6
6
|
import { type UploadableFile, type UploadableFileUpfrontIds } from '../../uploader';
|
|
7
7
|
import { type UploadController } from '../../upload-controller';
|
|
8
8
|
import { type MediaSubscribable } from '../../utils/mediaSubscribable';
|
|
9
9
|
import { type Dimensions } from '../../utils/getDimensionsFromBlob';
|
|
10
10
|
import { type MediaTraceContext } from '@atlaskit/media-common';
|
|
11
11
|
import { type FilePreview, type FileState, type MediaStore } from '@atlaskit/media-state';
|
|
12
|
+
import { type UploadArtifactParams } from '../media-store/types';
|
|
12
13
|
export type { FileFetcherErrorAttributes, FileFetcherErrorReason } from './error';
|
|
13
14
|
export { isFileFetcherError, FileFetcherError } from './error';
|
|
14
15
|
export interface CopySourceFile {
|
|
@@ -40,6 +41,7 @@ export interface FileFetcher {
|
|
|
40
41
|
copyFile(source: CopySourceFile, destination: CopyDestination, options?: CopyFileOptions, traceContext?: MediaTraceContext): Promise<MediaFile>;
|
|
41
42
|
getFileBinaryURL(id: string, collectionName?: string, maxAge?: number): Promise<string>;
|
|
42
43
|
registerCopyIntent(id: string, collectionName?: string): Promise<void>;
|
|
44
|
+
uploadArtifact(id: string, file: File, params: UploadArtifactParams, collectionName?: string, traceContext?: MediaTraceContext): Promise<MediaItemDetails>;
|
|
43
45
|
}
|
|
44
46
|
export declare class FileFetcherImpl implements FileFetcher {
|
|
45
47
|
private readonly mediaApi;
|
|
@@ -64,4 +66,5 @@ export declare class FileFetcherImpl implements FileFetcher {
|
|
|
64
66
|
private copyFileWithToken;
|
|
65
67
|
private copyFileWithIntent;
|
|
66
68
|
copyFile(source: CopySourceFile, destination: CopyDestination, options?: CopyFileOptions, traceContext?: MediaTraceContext): Promise<MediaFile>;
|
|
69
|
+
uploadArtifact: FileFetcher['uploadArtifact'];
|
|
67
70
|
}
|
|
@@ -20,7 +20,9 @@ export declare class MediaStore implements MediaApi {
|
|
|
20
20
|
private createFileImageURL;
|
|
21
21
|
getFileBinary(id: string, collectionName?: string, abortController?: AbortController, maxAge?: number): Promise<Blob>;
|
|
22
22
|
getFileBinaryURL(id: string, collectionName?: string, maxAge?: number): Promise<string>;
|
|
23
|
-
getArtifactURL(artifacts: MediaFileArtifacts, artifactName: keyof MediaFileArtifacts, collectionName?: string): Promise<string>;
|
|
23
|
+
getArtifactURL(artifacts: MediaFileArtifacts, artifactName: keyof MediaFileArtifacts, collectionName?: string, maxAge?: number): Promise<string>;
|
|
24
|
+
getArtifactBinary: MediaApi['getArtifactBinary'];
|
|
25
|
+
uploadArtifact: MediaApi['uploadArtifact'];
|
|
24
26
|
getImage(id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean, traceContext?: MediaTraceContext): Promise<Blob>;
|
|
25
27
|
getItems(ids: string[], collectionName?: string, traceContext?: MediaTraceContext, includeHashForDuplicateFiles?: boolean): Promise<MediaStoreResponse<ItemsPayload>>;
|
|
26
28
|
getImageMetadata(id: string, params?: MediaStoreGetFileImageParams, traceContext?: MediaTraceContext): Promise<{
|
|
@@ -152,6 +152,17 @@ export interface EmptyFile {
|
|
|
152
152
|
readonly id: string;
|
|
153
153
|
readonly createdAt: number;
|
|
154
154
|
}
|
|
155
|
+
export type GetArtifactBinaryOptions = {
|
|
156
|
+
collectionName?: string;
|
|
157
|
+
abortController?: AbortController;
|
|
158
|
+
maxAge?: number;
|
|
159
|
+
traceContext?: MediaTraceContext;
|
|
160
|
+
};
|
|
161
|
+
export type UploadArtifactCaptionsParams = {
|
|
162
|
+
type: 'caption';
|
|
163
|
+
language: string;
|
|
164
|
+
};
|
|
165
|
+
export type UploadArtifactParams = UploadArtifactCaptionsParams;
|
|
155
166
|
export interface MediaApi {
|
|
156
167
|
removeCollectionFile: (id: string, collectionName: string, occurrenceKey?: string, traceContext?: MediaTraceContext) => Promise<void>;
|
|
157
168
|
createUpload: (createUpTo: number, collectionName?: string, traceContext?: MediaTraceContext, chunkChunkHashAlgorithm?: ChunkHashAlgorithm) => Promise<MediaStoreResponse<MediaUpload[]>>;
|
|
@@ -165,6 +176,8 @@ export interface MediaApi {
|
|
|
165
176
|
getFileBinary: (id: string, collectionName?: string, abortController?: AbortController) => Promise<Blob>;
|
|
166
177
|
getFileBinaryURL: (id: string, collectionName?: string) => Promise<string>;
|
|
167
178
|
getArtifactURL: (artifacts: MediaFileArtifacts, artifactName: keyof MediaFileArtifacts, collectionName?: string) => Promise<string>;
|
|
179
|
+
getArtifactBinary(artifacts: MediaFileArtifacts, artifactName: keyof MediaFileArtifacts, options: GetArtifactBinaryOptions): Promise<Blob>;
|
|
180
|
+
uploadArtifact(id: string, file: File, params: UploadArtifactParams, collectionName?: string, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaItemDetails>>;
|
|
168
181
|
getImage: (id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean, traceContext?: MediaTraceContext) => Promise<Blob>;
|
|
169
182
|
getItems: (ids: string[], collectionName?: string, traceContext?: MediaTraceContext, includeHashForDuplicateFiles?: boolean) => Promise<MediaStoreResponse<ItemsPayload>>;
|
|
170
183
|
getImageMetadata: (id: string, params?: MediaStoreGetFileImageParams, traceContext?: MediaTraceContext) => Promise<{
|
|
@@ -2,13 +2,14 @@ import { type AuthProvider } from '@atlaskit/media-core';
|
|
|
2
2
|
import { type MediaFileArtifacts } from '@atlaskit/media-state';
|
|
3
3
|
import { MediaStore as MediaApi, type MediaStoreCopyFileWithTokenParams, type TouchedFiles, type TouchFileDescriptor } from '../media-store';
|
|
4
4
|
import { type GetFileOptions } from '../../models/file-state';
|
|
5
|
-
import { type MediaFile } from '../../models/media';
|
|
5
|
+
import { type MediaItemDetails, type MediaFile } from '../../models/media';
|
|
6
6
|
import { type UploadableFile, type UploadableFileUpfrontIds } from '../../uploader';
|
|
7
7
|
import { type UploadController } from '../../upload-controller';
|
|
8
8
|
import { type MediaSubscribable } from '../../utils/mediaSubscribable';
|
|
9
9
|
import { type Dimensions } from '../../utils/getDimensionsFromBlob';
|
|
10
10
|
import { type MediaTraceContext } from '@atlaskit/media-common';
|
|
11
11
|
import { type FilePreview, type FileState, type MediaStore } from '@atlaskit/media-state';
|
|
12
|
+
import { type UploadArtifactParams } from '../media-store/types';
|
|
12
13
|
export type { FileFetcherErrorAttributes, FileFetcherErrorReason } from './error';
|
|
13
14
|
export { isFileFetcherError, FileFetcherError } from './error';
|
|
14
15
|
export interface CopySourceFile {
|
|
@@ -40,6 +41,7 @@ export interface FileFetcher {
|
|
|
40
41
|
copyFile(source: CopySourceFile, destination: CopyDestination, options?: CopyFileOptions, traceContext?: MediaTraceContext): Promise<MediaFile>;
|
|
41
42
|
getFileBinaryURL(id: string, collectionName?: string, maxAge?: number): Promise<string>;
|
|
42
43
|
registerCopyIntent(id: string, collectionName?: string): Promise<void>;
|
|
44
|
+
uploadArtifact(id: string, file: File, params: UploadArtifactParams, collectionName?: string, traceContext?: MediaTraceContext): Promise<MediaItemDetails>;
|
|
43
45
|
}
|
|
44
46
|
export declare class FileFetcherImpl implements FileFetcher {
|
|
45
47
|
private readonly mediaApi;
|
|
@@ -64,4 +66,5 @@ export declare class FileFetcherImpl implements FileFetcher {
|
|
|
64
66
|
private copyFileWithToken;
|
|
65
67
|
private copyFileWithIntent;
|
|
66
68
|
copyFile(source: CopySourceFile, destination: CopyDestination, options?: CopyFileOptions, traceContext?: MediaTraceContext): Promise<MediaFile>;
|
|
69
|
+
uploadArtifact: FileFetcher['uploadArtifact'];
|
|
67
70
|
}
|
|
@@ -20,7 +20,9 @@ export declare class MediaStore implements MediaApi {
|
|
|
20
20
|
private createFileImageURL;
|
|
21
21
|
getFileBinary(id: string, collectionName?: string, abortController?: AbortController, maxAge?: number): Promise<Blob>;
|
|
22
22
|
getFileBinaryURL(id: string, collectionName?: string, maxAge?: number): Promise<string>;
|
|
23
|
-
getArtifactURL(artifacts: MediaFileArtifacts, artifactName: keyof MediaFileArtifacts, collectionName?: string): Promise<string>;
|
|
23
|
+
getArtifactURL(artifacts: MediaFileArtifacts, artifactName: keyof MediaFileArtifacts, collectionName?: string, maxAge?: number): Promise<string>;
|
|
24
|
+
getArtifactBinary: MediaApi['getArtifactBinary'];
|
|
25
|
+
uploadArtifact: MediaApi['uploadArtifact'];
|
|
24
26
|
getImage(id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean, traceContext?: MediaTraceContext): Promise<Blob>;
|
|
25
27
|
getItems(ids: string[], collectionName?: string, traceContext?: MediaTraceContext, includeHashForDuplicateFiles?: boolean): Promise<MediaStoreResponse<ItemsPayload>>;
|
|
26
28
|
getImageMetadata(id: string, params?: MediaStoreGetFileImageParams, traceContext?: MediaTraceContext): Promise<{
|
|
@@ -152,6 +152,17 @@ export interface EmptyFile {
|
|
|
152
152
|
readonly id: string;
|
|
153
153
|
readonly createdAt: number;
|
|
154
154
|
}
|
|
155
|
+
export type GetArtifactBinaryOptions = {
|
|
156
|
+
collectionName?: string;
|
|
157
|
+
abortController?: AbortController;
|
|
158
|
+
maxAge?: number;
|
|
159
|
+
traceContext?: MediaTraceContext;
|
|
160
|
+
};
|
|
161
|
+
export type UploadArtifactCaptionsParams = {
|
|
162
|
+
type: 'caption';
|
|
163
|
+
language: string;
|
|
164
|
+
};
|
|
165
|
+
export type UploadArtifactParams = UploadArtifactCaptionsParams;
|
|
155
166
|
export interface MediaApi {
|
|
156
167
|
removeCollectionFile: (id: string, collectionName: string, occurrenceKey?: string, traceContext?: MediaTraceContext) => Promise<void>;
|
|
157
168
|
createUpload: (createUpTo: number, collectionName?: string, traceContext?: MediaTraceContext, chunkChunkHashAlgorithm?: ChunkHashAlgorithm) => Promise<MediaStoreResponse<MediaUpload[]>>;
|
|
@@ -165,6 +176,8 @@ export interface MediaApi {
|
|
|
165
176
|
getFileBinary: (id: string, collectionName?: string, abortController?: AbortController) => Promise<Blob>;
|
|
166
177
|
getFileBinaryURL: (id: string, collectionName?: string) => Promise<string>;
|
|
167
178
|
getArtifactURL: (artifacts: MediaFileArtifacts, artifactName: keyof MediaFileArtifacts, collectionName?: string) => Promise<string>;
|
|
179
|
+
getArtifactBinary(artifacts: MediaFileArtifacts, artifactName: keyof MediaFileArtifacts, options: GetArtifactBinaryOptions): Promise<Blob>;
|
|
180
|
+
uploadArtifact(id: string, file: File, params: UploadArtifactParams, collectionName?: string, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaItemDetails>>;
|
|
168
181
|
getImage: (id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean, traceContext?: MediaTraceContext) => Promise<Blob>;
|
|
169
182
|
getItems: (ids: string[], collectionName?: string, traceContext?: MediaTraceContext, includeHashForDuplicateFiles?: boolean) => Promise<MediaStoreResponse<ItemsPayload>>;
|
|
170
183
|
getImageMetadata: (id: string, params?: MediaStoreGetFileImageParams, traceContext?: MediaTraceContext) => Promise<{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-client",
|
|
3
|
-
"version": "33.
|
|
3
|
+
"version": "33.1.1",
|
|
4
4
|
"description": "Media API Web Client Library",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -50,11 +50,11 @@
|
|
|
50
50
|
"xstate": "4.20.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"@atlaskit/media-core": "^36.
|
|
53
|
+
"@atlaskit/media-core": "^36.1.0",
|
|
54
54
|
"@atlaskit/media-state": "^1.5.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@atlaskit/media-core": "^36.
|
|
57
|
+
"@atlaskit/media-core": "^36.1.0",
|
|
58
58
|
"@atlaskit/media-state": "^1.5.0",
|
|
59
59
|
"@atlaskit/ssr": "workspace:^",
|
|
60
60
|
"@atlaskit/tokens": "^4.8.0",
|