@atlaskit/media-client 25.0.2 → 25.0.3
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 +6 -0
- package/dist/cjs/client/media-store/MediaStore.js +631 -0
- package/dist/cjs/client/media-store/index.js +19 -627
- package/dist/cjs/client/media-store/types.js +5 -0
- package/dist/es2019/client/media-store/MediaStore.js +385 -0
- package/dist/es2019/client/media-store/index.js +1 -385
- package/dist/es2019/client/media-store/types.js +1 -0
- package/dist/esm/client/media-store/MediaStore.js +624 -0
- package/dist/esm/client/media-store/index.js +1 -624
- package/dist/esm/client/media-store/types.js +1 -0
- package/dist/types/client/media-store/MediaStore.d.ts +34 -0
- package/dist/types/client/media-store/index.d.ts +2 -166
- package/dist/types/client/media-store/types.d.ts +161 -0
- package/dist/types-ts4.5/client/media-store/MediaStore.d.ts +34 -0
- package/dist/types-ts4.5/client/media-store/index.d.ts +2 -166
- package/dist/types-ts4.5/client/media-store/types.d.ts +161 -0
- package/package.json +1 -1
- package/report.api.md +120 -1
- package/tmp/api-report-tmp.d.ts +47 -1
|
@@ -1,168 +1,4 @@
|
|
|
1
|
-
import { AsapBasedAuth, AuthContext, ClientAltBasedAuth, MediaApiConfig, Auth } from '@atlaskit/media-core';
|
|
2
|
-
import { MediaTraceContext } from '@atlaskit/media-common';
|
|
3
|
-
import { MediaFileArtifacts } from '@atlaskit/media-state';
|
|
4
|
-
import { MediaChunksProbe, MediaItemDetails, MediaFile, MediaUpload } from '../../models/media';
|
|
5
|
-
import { ClientOptions, RequestHeaders, RequestMethod, RequestParams, RequestMetadata } from '../../utils/request/types';
|
|
6
1
|
export type { MediaStoreErrorReason, MediaStoreErrorAttributes } from './error';
|
|
7
2
|
export { MediaStoreError, isMediaStoreError } from './error';
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
constructor(config: MediaApiConfig);
|
|
11
|
-
removeCollectionFile(id: string, collectionName: string, occurrenceKey?: string, traceContext?: MediaTraceContext): Promise<void>;
|
|
12
|
-
createUpload(createUpTo?: number, collectionName?: string, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaUpload[]>>;
|
|
13
|
-
uploadChunk(etag: string, blob: Blob, uploadId: string, partNumber: number, collectionName?: string, traceContext?: MediaTraceContext): Promise<void>;
|
|
14
|
-
probeChunks(chunks: string[], uploadId: string, collectionName?: string, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaChunksProbe>>;
|
|
15
|
-
createFileFromUpload(body: MediaStoreCreateFileFromUploadBody, params?: MediaStoreCreateFileFromUploadParams, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaFile>>;
|
|
16
|
-
getRejectedResponseFromDescriptor(descriptor: TouchFileDescriptor, limit: number): RejectedTouchFile;
|
|
17
|
-
touchFiles(body: MediaStoreTouchFileBody, params?: MediaStoreTouchFileParams, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<TouchedFiles>>;
|
|
18
|
-
getFile(fileId: string, params?: MediaStoreGetFileParams, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaFile>>;
|
|
19
|
-
getFileImageURL(id: string, params?: MediaStoreGetFileImageParams): Promise<string>;
|
|
20
|
-
getFileImageURLSync(id: string, params?: MediaStoreGetFileImageParams): string;
|
|
21
|
-
private createFileImageURL;
|
|
22
|
-
getFileBinaryURL(id: string, collectionName?: string): Promise<string>;
|
|
23
|
-
getArtifactURL(artifacts: MediaFileArtifacts, artifactName: keyof MediaFileArtifacts, collectionName?: string): Promise<string>;
|
|
24
|
-
getImage(id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean, traceContext?: MediaTraceContext): Promise<Blob>;
|
|
25
|
-
getItems(ids: string[], collectionName?: string, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<ItemsPayload>>;
|
|
26
|
-
getImageMetadata(id: string, params?: MediaStoreGetFileImageParams, traceContext?: MediaTraceContext): Promise<{
|
|
27
|
-
metadata: ImageMetadata;
|
|
28
|
-
}>;
|
|
29
|
-
appendChunksToUpload(uploadId: string, body: AppendChunksToUploadRequestBody, collectionName?: string, traceContext?: MediaTraceContext): Promise<void>;
|
|
30
|
-
copyFileWithToken(body: MediaStoreCopyFileWithTokenBody, params: MediaStoreCopyFileWithTokenParams, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaFile>>;
|
|
31
|
-
request(path: string, options?: MediaStoreRequestOptions, controller?: AbortController): Promise<Response>;
|
|
32
|
-
resolveAuth: (authContext?: AuthContext) => Promise<Auth>;
|
|
33
|
-
resolveInitialAuth: () => Auth;
|
|
34
|
-
}
|
|
35
|
-
export declare const getMediaEnvironment: () => string | undefined;
|
|
36
|
-
export declare const getMediaRegion: () => string | undefined;
|
|
37
|
-
export interface ResponseFileItem {
|
|
38
|
-
id: string;
|
|
39
|
-
type: 'file';
|
|
40
|
-
details: MediaItemDetails;
|
|
41
|
-
collection?: string;
|
|
42
|
-
metadataTraceContext?: MediaTraceContext;
|
|
43
|
-
}
|
|
44
|
-
export interface ItemsPayload {
|
|
45
|
-
items: ResponseFileItem[];
|
|
46
|
-
}
|
|
47
|
-
export type ImageMetadataArtifact = {
|
|
48
|
-
url?: string;
|
|
49
|
-
width?: number;
|
|
50
|
-
height?: number;
|
|
51
|
-
size?: number;
|
|
52
|
-
};
|
|
53
|
-
export interface ImageMetadata {
|
|
54
|
-
pending: boolean;
|
|
55
|
-
preview?: ImageMetadataArtifact;
|
|
56
|
-
original?: ImageMetadataArtifact;
|
|
57
|
-
}
|
|
58
|
-
export interface MediaStoreResponse<Data> {
|
|
59
|
-
readonly data: Data;
|
|
60
|
-
}
|
|
61
|
-
export type MediaStoreRequestOptions = RequestMetadata & {
|
|
62
|
-
readonly method?: RequestMethod;
|
|
63
|
-
readonly authContext?: AuthContext;
|
|
64
|
-
readonly params?: RequestParams;
|
|
65
|
-
readonly headers?: RequestHeaders;
|
|
66
|
-
readonly body?: any;
|
|
67
|
-
readonly clientOptions?: ClientOptions;
|
|
68
|
-
readonly traceContext?: MediaTraceContext;
|
|
69
|
-
};
|
|
70
|
-
export type MediaStoreCreateFileFromUploadParams = {
|
|
71
|
-
readonly collection?: string;
|
|
72
|
-
readonly occurrenceKey?: string;
|
|
73
|
-
readonly expireAfter?: number;
|
|
74
|
-
readonly replaceFileId?: string;
|
|
75
|
-
readonly skipConversions?: boolean;
|
|
76
|
-
};
|
|
77
|
-
export type MediaStoreCreateFileParams = {
|
|
78
|
-
readonly occurrenceKey?: string;
|
|
79
|
-
readonly collection?: string;
|
|
80
|
-
};
|
|
81
|
-
export interface MediaStoreTouchFileParams {
|
|
82
|
-
readonly collection?: string;
|
|
83
|
-
}
|
|
84
|
-
export interface TouchFileDescriptor {
|
|
85
|
-
fileId: string;
|
|
86
|
-
collection?: string;
|
|
87
|
-
occurrenceKey?: string;
|
|
88
|
-
expireAfter?: number;
|
|
89
|
-
deletable?: boolean;
|
|
90
|
-
size?: number;
|
|
91
|
-
}
|
|
92
|
-
export interface MediaStoreTouchFileBody {
|
|
93
|
-
descriptors: TouchFileDescriptor[];
|
|
94
|
-
}
|
|
95
|
-
export type MediaStoreCreateFileFromBinaryParams = {
|
|
96
|
-
readonly replaceFileId?: string;
|
|
97
|
-
readonly collection?: string;
|
|
98
|
-
readonly occurrenceKey?: string;
|
|
99
|
-
readonly expireAfter?: number;
|
|
100
|
-
readonly skipConversions?: boolean;
|
|
101
|
-
readonly name?: string;
|
|
102
|
-
};
|
|
103
|
-
export type MediaStoreCreateFileFromUploadConditions = {
|
|
104
|
-
readonly hash?: string;
|
|
105
|
-
readonly size?: number;
|
|
106
|
-
};
|
|
107
|
-
export type MediaStoreCreateFileFromUploadBody = {
|
|
108
|
-
readonly uploadId: string;
|
|
109
|
-
readonly name?: string;
|
|
110
|
-
readonly mimeType?: string;
|
|
111
|
-
readonly conditions?: MediaStoreCreateFileFromUploadConditions;
|
|
112
|
-
};
|
|
113
|
-
export type MediaStoreGetFileParams = {
|
|
114
|
-
readonly version?: number;
|
|
115
|
-
readonly collection?: string;
|
|
116
|
-
};
|
|
117
|
-
export type MediaStoreGetFileImageParams = {
|
|
118
|
-
readonly allowAnimated?: boolean;
|
|
119
|
-
readonly version?: number;
|
|
120
|
-
readonly collection?: string;
|
|
121
|
-
readonly width?: number;
|
|
122
|
-
readonly height?: number;
|
|
123
|
-
readonly mode?: 'fit' | 'full-fit' | 'crop';
|
|
124
|
-
readonly upscale?: boolean;
|
|
125
|
-
readonly 'max-age'?: number;
|
|
126
|
-
};
|
|
127
|
-
export interface SourceFile {
|
|
128
|
-
id: string;
|
|
129
|
-
owner: ClientAltBasedAuth | AsapBasedAuth;
|
|
130
|
-
collection?: string;
|
|
131
|
-
version?: number;
|
|
132
|
-
}
|
|
133
|
-
export type MediaStoreCopyFileWithTokenBody = {
|
|
134
|
-
sourceFile: SourceFile;
|
|
135
|
-
};
|
|
136
|
-
export type MediaStoreCopyFileWithTokenParams = {
|
|
137
|
-
readonly collection?: string;
|
|
138
|
-
readonly replaceFileId?: string;
|
|
139
|
-
readonly occurrenceKey?: string;
|
|
140
|
-
};
|
|
141
|
-
export type AppendChunksToUploadRequestBody = {
|
|
142
|
-
readonly chunks: string[];
|
|
143
|
-
readonly hash?: string;
|
|
144
|
-
readonly offset?: number;
|
|
145
|
-
};
|
|
146
|
-
export interface CreatedTouchedFile {
|
|
147
|
-
fileId: string;
|
|
148
|
-
uploadId: string;
|
|
149
|
-
}
|
|
150
|
-
export interface RejectedTouchFile {
|
|
151
|
-
fileId: string;
|
|
152
|
-
error: RejectionError;
|
|
153
|
-
}
|
|
154
|
-
export type RejectionError = {
|
|
155
|
-
code: 'ExceedMaxFileSizeLimit';
|
|
156
|
-
title: string;
|
|
157
|
-
href: string;
|
|
158
|
-
limit: number;
|
|
159
|
-
size: number;
|
|
160
|
-
};
|
|
161
|
-
export type TouchedFiles = {
|
|
162
|
-
created: CreatedTouchedFile[];
|
|
163
|
-
rejected?: RejectedTouchFile[];
|
|
164
|
-
};
|
|
165
|
-
export interface EmptyFile {
|
|
166
|
-
readonly id: string;
|
|
167
|
-
readonly createdAt: number;
|
|
168
|
-
}
|
|
3
|
+
export { MediaStore, getMediaEnvironment, getMediaRegion } from './MediaStore';
|
|
4
|
+
export type { ResponseFileItem, ItemsPayload, ImageMetadataArtifact, ImageMetadata, MediaStoreResponse, MediaStoreRequestOptions, MediaStoreCreateFileFromUploadParams, MediaStoreCreateFileParams, MediaStoreTouchFileParams, TouchFileDescriptor, MediaStoreTouchFileBody, MediaStoreCreateFileFromBinaryParams, MediaStoreCreateFileFromUploadConditions, MediaStoreCreateFileFromUploadBody, MediaStoreGetFileParams, MediaStoreGetFileImageParams, SourceFile, MediaStoreCopyFileWithTokenBody, MediaStoreCopyFileWithTokenParams, AppendChunksToUploadRequestBody, CreatedTouchedFile, RejectedTouchFile, RejectionError, TouchedFiles, EmptyFile, MediaApi, } from './types';
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { Auth, AsapBasedAuth, AuthContext, ClientAltBasedAuth } from '@atlaskit/media-core';
|
|
2
|
+
import { MediaTraceContext } from '@atlaskit/media-common';
|
|
3
|
+
import { MediaFileArtifacts } from '@atlaskit/media-state';
|
|
4
|
+
import { MediaItemDetails, MediaChunksProbe, MediaFile, MediaUpload } from '../../models/media';
|
|
5
|
+
import { ClientOptions, RequestHeaders, RequestMethod, RequestParams, RequestMetadata } from '../../utils/request/types';
|
|
6
|
+
export interface ResponseFileItem {
|
|
7
|
+
id: string;
|
|
8
|
+
type: 'file';
|
|
9
|
+
details: MediaItemDetails;
|
|
10
|
+
collection?: string;
|
|
11
|
+
metadataTraceContext?: MediaTraceContext;
|
|
12
|
+
}
|
|
13
|
+
export interface ItemsPayload {
|
|
14
|
+
items: ResponseFileItem[];
|
|
15
|
+
}
|
|
16
|
+
export type ImageMetadataArtifact = {
|
|
17
|
+
url?: string;
|
|
18
|
+
width?: number;
|
|
19
|
+
height?: number;
|
|
20
|
+
size?: number;
|
|
21
|
+
};
|
|
22
|
+
export interface ImageMetadata {
|
|
23
|
+
pending: boolean;
|
|
24
|
+
preview?: ImageMetadataArtifact;
|
|
25
|
+
original?: ImageMetadataArtifact;
|
|
26
|
+
}
|
|
27
|
+
export interface MediaStoreResponse<Data> {
|
|
28
|
+
readonly data: Data;
|
|
29
|
+
}
|
|
30
|
+
export type MediaStoreRequestOptions = RequestMetadata & {
|
|
31
|
+
readonly method?: RequestMethod;
|
|
32
|
+
readonly authContext?: AuthContext;
|
|
33
|
+
readonly params?: RequestParams;
|
|
34
|
+
readonly headers?: RequestHeaders;
|
|
35
|
+
readonly body?: any;
|
|
36
|
+
readonly clientOptions?: ClientOptions;
|
|
37
|
+
readonly traceContext?: MediaTraceContext;
|
|
38
|
+
};
|
|
39
|
+
export type MediaStoreCreateFileFromUploadParams = {
|
|
40
|
+
readonly collection?: string;
|
|
41
|
+
readonly occurrenceKey?: string;
|
|
42
|
+
readonly expireAfter?: number;
|
|
43
|
+
readonly replaceFileId?: string;
|
|
44
|
+
readonly skipConversions?: boolean;
|
|
45
|
+
};
|
|
46
|
+
export type MediaStoreCreateFileParams = {
|
|
47
|
+
readonly occurrenceKey?: string;
|
|
48
|
+
readonly collection?: string;
|
|
49
|
+
};
|
|
50
|
+
export interface MediaStoreTouchFileParams {
|
|
51
|
+
readonly collection?: string;
|
|
52
|
+
}
|
|
53
|
+
export interface TouchFileDescriptor {
|
|
54
|
+
fileId: string;
|
|
55
|
+
collection?: string;
|
|
56
|
+
occurrenceKey?: string;
|
|
57
|
+
expireAfter?: number;
|
|
58
|
+
deletable?: boolean;
|
|
59
|
+
size?: number;
|
|
60
|
+
}
|
|
61
|
+
export interface MediaStoreTouchFileBody {
|
|
62
|
+
descriptors: TouchFileDescriptor[];
|
|
63
|
+
}
|
|
64
|
+
export type MediaStoreCreateFileFromBinaryParams = {
|
|
65
|
+
readonly replaceFileId?: string;
|
|
66
|
+
readonly collection?: string;
|
|
67
|
+
readonly occurrenceKey?: string;
|
|
68
|
+
readonly expireAfter?: number;
|
|
69
|
+
readonly skipConversions?: boolean;
|
|
70
|
+
readonly name?: string;
|
|
71
|
+
};
|
|
72
|
+
export type MediaStoreCreateFileFromUploadConditions = {
|
|
73
|
+
readonly hash?: string;
|
|
74
|
+
readonly size?: number;
|
|
75
|
+
};
|
|
76
|
+
export type MediaStoreCreateFileFromUploadBody = {
|
|
77
|
+
readonly uploadId: string;
|
|
78
|
+
readonly name?: string;
|
|
79
|
+
readonly mimeType?: string;
|
|
80
|
+
readonly conditions?: MediaStoreCreateFileFromUploadConditions;
|
|
81
|
+
};
|
|
82
|
+
export type MediaStoreGetFileParams = {
|
|
83
|
+
readonly version?: number;
|
|
84
|
+
readonly collection?: string;
|
|
85
|
+
};
|
|
86
|
+
export type MediaStoreGetFileImageParams = {
|
|
87
|
+
readonly allowAnimated?: boolean;
|
|
88
|
+
readonly version?: number;
|
|
89
|
+
readonly collection?: string;
|
|
90
|
+
readonly width?: number;
|
|
91
|
+
readonly height?: number;
|
|
92
|
+
readonly mode?: 'fit' | 'full-fit' | 'crop';
|
|
93
|
+
readonly upscale?: boolean;
|
|
94
|
+
readonly 'max-age'?: number;
|
|
95
|
+
};
|
|
96
|
+
export interface SourceFile {
|
|
97
|
+
id: string;
|
|
98
|
+
owner: ClientAltBasedAuth | AsapBasedAuth;
|
|
99
|
+
collection?: string;
|
|
100
|
+
version?: number;
|
|
101
|
+
}
|
|
102
|
+
export type MediaStoreCopyFileWithTokenBody = {
|
|
103
|
+
sourceFile: SourceFile;
|
|
104
|
+
};
|
|
105
|
+
export type MediaStoreCopyFileWithTokenParams = {
|
|
106
|
+
readonly collection?: string;
|
|
107
|
+
readonly replaceFileId?: string;
|
|
108
|
+
readonly occurrenceKey?: string;
|
|
109
|
+
};
|
|
110
|
+
export type AppendChunksToUploadRequestBody = {
|
|
111
|
+
readonly chunks: string[];
|
|
112
|
+
readonly hash?: string;
|
|
113
|
+
readonly offset?: number;
|
|
114
|
+
};
|
|
115
|
+
export interface CreatedTouchedFile {
|
|
116
|
+
fileId: string;
|
|
117
|
+
uploadId: string;
|
|
118
|
+
}
|
|
119
|
+
export interface RejectedTouchFile {
|
|
120
|
+
fileId: string;
|
|
121
|
+
error: RejectionError;
|
|
122
|
+
}
|
|
123
|
+
export type RejectionError = {
|
|
124
|
+
code: 'ExceedMaxFileSizeLimit';
|
|
125
|
+
title: string;
|
|
126
|
+
href: string;
|
|
127
|
+
limit: number;
|
|
128
|
+
size: number;
|
|
129
|
+
};
|
|
130
|
+
export type TouchedFiles = {
|
|
131
|
+
created: CreatedTouchedFile[];
|
|
132
|
+
rejected?: RejectedTouchFile[];
|
|
133
|
+
};
|
|
134
|
+
export interface EmptyFile {
|
|
135
|
+
readonly id: string;
|
|
136
|
+
readonly createdAt: number;
|
|
137
|
+
}
|
|
138
|
+
export interface MediaApi {
|
|
139
|
+
removeCollectionFile: (id: string, collectionName: string, occurrenceKey?: string, traceContext?: MediaTraceContext) => Promise<void>;
|
|
140
|
+
createUpload: (createUpTo: number, collectionName?: string, traceContext?: MediaTraceContext) => Promise<MediaStoreResponse<MediaUpload[]>>;
|
|
141
|
+
uploadChunk: (etag: string, blob: Blob, uploadId: string, partNumber: number, collectionName?: string, traceContext?: MediaTraceContext) => Promise<void>;
|
|
142
|
+
probeChunks: (chunks: string[], uploadId: string, collectionName?: string, traceContext?: MediaTraceContext) => Promise<MediaStoreResponse<MediaChunksProbe>>;
|
|
143
|
+
createFileFromUpload: (body: MediaStoreCreateFileFromUploadBody, params: MediaStoreCreateFileFromUploadParams, traceContext?: MediaTraceContext) => Promise<MediaStoreResponse<MediaFile>>;
|
|
144
|
+
getRejectedResponseFromDescriptor: (descriptor: TouchFileDescriptor, limit: number) => RejectedTouchFile;
|
|
145
|
+
touchFiles: (body: MediaStoreTouchFileBody, params: MediaStoreTouchFileParams, traceContext?: MediaTraceContext) => Promise<MediaStoreResponse<TouchedFiles>>;
|
|
146
|
+
getFile: (fileId: string, params: MediaStoreGetFileParams, traceContext?: MediaTraceContext) => Promise<MediaStoreResponse<MediaFile>>;
|
|
147
|
+
getFileImageURL: (id: string, params?: MediaStoreGetFileImageParams) => Promise<string>;
|
|
148
|
+
getFileImageURLSync: (id: string, params?: MediaStoreGetFileImageParams) => string;
|
|
149
|
+
getFileBinaryURL: (id: string, collectionName?: string) => Promise<string>;
|
|
150
|
+
getArtifactURL: (artifacts: MediaFileArtifacts, artifactName: keyof MediaFileArtifacts, collectionName?: string) => Promise<string>;
|
|
151
|
+
getImage: (id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean, traceContext?: MediaTraceContext) => Promise<Blob>;
|
|
152
|
+
getItems: (ids: string[], collectionName?: string, traceContext?: MediaTraceContext) => Promise<MediaStoreResponse<ItemsPayload>>;
|
|
153
|
+
getImageMetadata: (id: string, params?: MediaStoreGetFileImageParams, traceContext?: MediaTraceContext) => Promise<{
|
|
154
|
+
metadata: ImageMetadata;
|
|
155
|
+
}>;
|
|
156
|
+
appendChunksToUpload: (uploadId: string, body: AppendChunksToUploadRequestBody, collectionName?: string, traceContext?: MediaTraceContext) => Promise<void>;
|
|
157
|
+
copyFileWithToken: (body: MediaStoreCopyFileWithTokenBody, params: MediaStoreCopyFileWithTokenParams, traceContext?: MediaTraceContext) => Promise<MediaStoreResponse<MediaFile>>;
|
|
158
|
+
request: (path: string, options: MediaStoreRequestOptions, controller?: AbortController) => Promise<Response>;
|
|
159
|
+
resolveAuth: (authContext?: AuthContext) => Promise<Auth>;
|
|
160
|
+
resolveInitialAuth: () => Auth;
|
|
161
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { AuthContext, MediaApiConfig, Auth } from '@atlaskit/media-core';
|
|
2
|
+
import { MediaTraceContext } from '@atlaskit/media-common';
|
|
3
|
+
import { MediaFileArtifacts } from '@atlaskit/media-state';
|
|
4
|
+
import type { ItemsPayload, ImageMetadata, MediaStoreResponse, MediaStoreTouchFileParams, TouchFileDescriptor, MediaStoreTouchFileBody, RejectedTouchFile, MediaStoreRequestOptions, MediaStoreCreateFileFromUploadParams, MediaStoreCreateFileFromUploadBody, MediaStoreGetFileParams, MediaStoreGetFileImageParams, MediaStoreCopyFileWithTokenBody, MediaStoreCopyFileWithTokenParams, AppendChunksToUploadRequestBody, TouchedFiles, MediaApi } from './types';
|
|
5
|
+
import { MediaChunksProbe, MediaFile, MediaUpload } from '../../models/media';
|
|
6
|
+
export declare class MediaStore implements MediaApi {
|
|
7
|
+
private readonly config;
|
|
8
|
+
constructor(config: MediaApiConfig);
|
|
9
|
+
removeCollectionFile(id: string, collectionName: string, occurrenceKey?: string, traceContext?: MediaTraceContext): Promise<void>;
|
|
10
|
+
createUpload(createUpTo?: number, collectionName?: string, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaUpload[]>>;
|
|
11
|
+
uploadChunk(etag: string, blob: Blob, uploadId: string, partNumber: number, collectionName?: string, traceContext?: MediaTraceContext): Promise<void>;
|
|
12
|
+
probeChunks(chunks: string[], uploadId: string, collectionName?: string, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaChunksProbe>>;
|
|
13
|
+
createFileFromUpload(body: MediaStoreCreateFileFromUploadBody, params?: MediaStoreCreateFileFromUploadParams, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaFile>>;
|
|
14
|
+
getRejectedResponseFromDescriptor(descriptor: TouchFileDescriptor, limit: number): RejectedTouchFile;
|
|
15
|
+
touchFiles(body: MediaStoreTouchFileBody, params?: MediaStoreTouchFileParams, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<TouchedFiles>>;
|
|
16
|
+
getFile(fileId: string, params?: MediaStoreGetFileParams, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaFile>>;
|
|
17
|
+
getFileImageURL(id: string, params?: MediaStoreGetFileImageParams): Promise<string>;
|
|
18
|
+
getFileImageURLSync(id: string, params?: MediaStoreGetFileImageParams): string;
|
|
19
|
+
private createFileImageURL;
|
|
20
|
+
getFileBinaryURL(id: string, collectionName?: string): Promise<string>;
|
|
21
|
+
getArtifactURL(artifacts: MediaFileArtifacts, artifactName: keyof MediaFileArtifacts, collectionName?: string): Promise<string>;
|
|
22
|
+
getImage(id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean, traceContext?: MediaTraceContext): Promise<Blob>;
|
|
23
|
+
getItems(ids: string[], collectionName?: string, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<ItemsPayload>>;
|
|
24
|
+
getImageMetadata(id: string, params?: MediaStoreGetFileImageParams, traceContext?: MediaTraceContext): Promise<{
|
|
25
|
+
metadata: ImageMetadata;
|
|
26
|
+
}>;
|
|
27
|
+
appendChunksToUpload(uploadId: string, body: AppendChunksToUploadRequestBody, collectionName?: string, traceContext?: MediaTraceContext): Promise<void>;
|
|
28
|
+
copyFileWithToken(body: MediaStoreCopyFileWithTokenBody, params: MediaStoreCopyFileWithTokenParams, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaFile>>;
|
|
29
|
+
request(path: string, options?: MediaStoreRequestOptions, controller?: AbortController): Promise<Response>;
|
|
30
|
+
resolveAuth: (authContext?: AuthContext) => Promise<Auth>;
|
|
31
|
+
resolveInitialAuth: () => Auth;
|
|
32
|
+
}
|
|
33
|
+
export declare const getMediaEnvironment: () => string | undefined;
|
|
34
|
+
export declare const getMediaRegion: () => string | undefined;
|
|
@@ -1,168 +1,4 @@
|
|
|
1
|
-
import { AsapBasedAuth, AuthContext, ClientAltBasedAuth, MediaApiConfig, Auth } from '@atlaskit/media-core';
|
|
2
|
-
import { MediaTraceContext } from '@atlaskit/media-common';
|
|
3
|
-
import { MediaFileArtifacts } from '@atlaskit/media-state';
|
|
4
|
-
import { MediaChunksProbe, MediaItemDetails, MediaFile, MediaUpload } from '../../models/media';
|
|
5
|
-
import { ClientOptions, RequestHeaders, RequestMethod, RequestParams, RequestMetadata } from '../../utils/request/types';
|
|
6
1
|
export type { MediaStoreErrorReason, MediaStoreErrorAttributes } from './error';
|
|
7
2
|
export { MediaStoreError, isMediaStoreError } from './error';
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
constructor(config: MediaApiConfig);
|
|
11
|
-
removeCollectionFile(id: string, collectionName: string, occurrenceKey?: string, traceContext?: MediaTraceContext): Promise<void>;
|
|
12
|
-
createUpload(createUpTo?: number, collectionName?: string, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaUpload[]>>;
|
|
13
|
-
uploadChunk(etag: string, blob: Blob, uploadId: string, partNumber: number, collectionName?: string, traceContext?: MediaTraceContext): Promise<void>;
|
|
14
|
-
probeChunks(chunks: string[], uploadId: string, collectionName?: string, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaChunksProbe>>;
|
|
15
|
-
createFileFromUpload(body: MediaStoreCreateFileFromUploadBody, params?: MediaStoreCreateFileFromUploadParams, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaFile>>;
|
|
16
|
-
getRejectedResponseFromDescriptor(descriptor: TouchFileDescriptor, limit: number): RejectedTouchFile;
|
|
17
|
-
touchFiles(body: MediaStoreTouchFileBody, params?: MediaStoreTouchFileParams, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<TouchedFiles>>;
|
|
18
|
-
getFile(fileId: string, params?: MediaStoreGetFileParams, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaFile>>;
|
|
19
|
-
getFileImageURL(id: string, params?: MediaStoreGetFileImageParams): Promise<string>;
|
|
20
|
-
getFileImageURLSync(id: string, params?: MediaStoreGetFileImageParams): string;
|
|
21
|
-
private createFileImageURL;
|
|
22
|
-
getFileBinaryURL(id: string, collectionName?: string): Promise<string>;
|
|
23
|
-
getArtifactURL(artifacts: MediaFileArtifacts, artifactName: keyof MediaFileArtifacts, collectionName?: string): Promise<string>;
|
|
24
|
-
getImage(id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean, traceContext?: MediaTraceContext): Promise<Blob>;
|
|
25
|
-
getItems(ids: string[], collectionName?: string, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<ItemsPayload>>;
|
|
26
|
-
getImageMetadata(id: string, params?: MediaStoreGetFileImageParams, traceContext?: MediaTraceContext): Promise<{
|
|
27
|
-
metadata: ImageMetadata;
|
|
28
|
-
}>;
|
|
29
|
-
appendChunksToUpload(uploadId: string, body: AppendChunksToUploadRequestBody, collectionName?: string, traceContext?: MediaTraceContext): Promise<void>;
|
|
30
|
-
copyFileWithToken(body: MediaStoreCopyFileWithTokenBody, params: MediaStoreCopyFileWithTokenParams, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaFile>>;
|
|
31
|
-
request(path: string, options?: MediaStoreRequestOptions, controller?: AbortController): Promise<Response>;
|
|
32
|
-
resolveAuth: (authContext?: AuthContext) => Promise<Auth>;
|
|
33
|
-
resolveInitialAuth: () => Auth;
|
|
34
|
-
}
|
|
35
|
-
export declare const getMediaEnvironment: () => string | undefined;
|
|
36
|
-
export declare const getMediaRegion: () => string | undefined;
|
|
37
|
-
export interface ResponseFileItem {
|
|
38
|
-
id: string;
|
|
39
|
-
type: 'file';
|
|
40
|
-
details: MediaItemDetails;
|
|
41
|
-
collection?: string;
|
|
42
|
-
metadataTraceContext?: MediaTraceContext;
|
|
43
|
-
}
|
|
44
|
-
export interface ItemsPayload {
|
|
45
|
-
items: ResponseFileItem[];
|
|
46
|
-
}
|
|
47
|
-
export type ImageMetadataArtifact = {
|
|
48
|
-
url?: string;
|
|
49
|
-
width?: number;
|
|
50
|
-
height?: number;
|
|
51
|
-
size?: number;
|
|
52
|
-
};
|
|
53
|
-
export interface ImageMetadata {
|
|
54
|
-
pending: boolean;
|
|
55
|
-
preview?: ImageMetadataArtifact;
|
|
56
|
-
original?: ImageMetadataArtifact;
|
|
57
|
-
}
|
|
58
|
-
export interface MediaStoreResponse<Data> {
|
|
59
|
-
readonly data: Data;
|
|
60
|
-
}
|
|
61
|
-
export type MediaStoreRequestOptions = RequestMetadata & {
|
|
62
|
-
readonly method?: RequestMethod;
|
|
63
|
-
readonly authContext?: AuthContext;
|
|
64
|
-
readonly params?: RequestParams;
|
|
65
|
-
readonly headers?: RequestHeaders;
|
|
66
|
-
readonly body?: any;
|
|
67
|
-
readonly clientOptions?: ClientOptions;
|
|
68
|
-
readonly traceContext?: MediaTraceContext;
|
|
69
|
-
};
|
|
70
|
-
export type MediaStoreCreateFileFromUploadParams = {
|
|
71
|
-
readonly collection?: string;
|
|
72
|
-
readonly occurrenceKey?: string;
|
|
73
|
-
readonly expireAfter?: number;
|
|
74
|
-
readonly replaceFileId?: string;
|
|
75
|
-
readonly skipConversions?: boolean;
|
|
76
|
-
};
|
|
77
|
-
export type MediaStoreCreateFileParams = {
|
|
78
|
-
readonly occurrenceKey?: string;
|
|
79
|
-
readonly collection?: string;
|
|
80
|
-
};
|
|
81
|
-
export interface MediaStoreTouchFileParams {
|
|
82
|
-
readonly collection?: string;
|
|
83
|
-
}
|
|
84
|
-
export interface TouchFileDescriptor {
|
|
85
|
-
fileId: string;
|
|
86
|
-
collection?: string;
|
|
87
|
-
occurrenceKey?: string;
|
|
88
|
-
expireAfter?: number;
|
|
89
|
-
deletable?: boolean;
|
|
90
|
-
size?: number;
|
|
91
|
-
}
|
|
92
|
-
export interface MediaStoreTouchFileBody {
|
|
93
|
-
descriptors: TouchFileDescriptor[];
|
|
94
|
-
}
|
|
95
|
-
export type MediaStoreCreateFileFromBinaryParams = {
|
|
96
|
-
readonly replaceFileId?: string;
|
|
97
|
-
readonly collection?: string;
|
|
98
|
-
readonly occurrenceKey?: string;
|
|
99
|
-
readonly expireAfter?: number;
|
|
100
|
-
readonly skipConversions?: boolean;
|
|
101
|
-
readonly name?: string;
|
|
102
|
-
};
|
|
103
|
-
export type MediaStoreCreateFileFromUploadConditions = {
|
|
104
|
-
readonly hash?: string;
|
|
105
|
-
readonly size?: number;
|
|
106
|
-
};
|
|
107
|
-
export type MediaStoreCreateFileFromUploadBody = {
|
|
108
|
-
readonly uploadId: string;
|
|
109
|
-
readonly name?: string;
|
|
110
|
-
readonly mimeType?: string;
|
|
111
|
-
readonly conditions?: MediaStoreCreateFileFromUploadConditions;
|
|
112
|
-
};
|
|
113
|
-
export type MediaStoreGetFileParams = {
|
|
114
|
-
readonly version?: number;
|
|
115
|
-
readonly collection?: string;
|
|
116
|
-
};
|
|
117
|
-
export type MediaStoreGetFileImageParams = {
|
|
118
|
-
readonly allowAnimated?: boolean;
|
|
119
|
-
readonly version?: number;
|
|
120
|
-
readonly collection?: string;
|
|
121
|
-
readonly width?: number;
|
|
122
|
-
readonly height?: number;
|
|
123
|
-
readonly mode?: 'fit' | 'full-fit' | 'crop';
|
|
124
|
-
readonly upscale?: boolean;
|
|
125
|
-
readonly 'max-age'?: number;
|
|
126
|
-
};
|
|
127
|
-
export interface SourceFile {
|
|
128
|
-
id: string;
|
|
129
|
-
owner: ClientAltBasedAuth | AsapBasedAuth;
|
|
130
|
-
collection?: string;
|
|
131
|
-
version?: number;
|
|
132
|
-
}
|
|
133
|
-
export type MediaStoreCopyFileWithTokenBody = {
|
|
134
|
-
sourceFile: SourceFile;
|
|
135
|
-
};
|
|
136
|
-
export type MediaStoreCopyFileWithTokenParams = {
|
|
137
|
-
readonly collection?: string;
|
|
138
|
-
readonly replaceFileId?: string;
|
|
139
|
-
readonly occurrenceKey?: string;
|
|
140
|
-
};
|
|
141
|
-
export type AppendChunksToUploadRequestBody = {
|
|
142
|
-
readonly chunks: string[];
|
|
143
|
-
readonly hash?: string;
|
|
144
|
-
readonly offset?: number;
|
|
145
|
-
};
|
|
146
|
-
export interface CreatedTouchedFile {
|
|
147
|
-
fileId: string;
|
|
148
|
-
uploadId: string;
|
|
149
|
-
}
|
|
150
|
-
export interface RejectedTouchFile {
|
|
151
|
-
fileId: string;
|
|
152
|
-
error: RejectionError;
|
|
153
|
-
}
|
|
154
|
-
export type RejectionError = {
|
|
155
|
-
code: 'ExceedMaxFileSizeLimit';
|
|
156
|
-
title: string;
|
|
157
|
-
href: string;
|
|
158
|
-
limit: number;
|
|
159
|
-
size: number;
|
|
160
|
-
};
|
|
161
|
-
export type TouchedFiles = {
|
|
162
|
-
created: CreatedTouchedFile[];
|
|
163
|
-
rejected?: RejectedTouchFile[];
|
|
164
|
-
};
|
|
165
|
-
export interface EmptyFile {
|
|
166
|
-
readonly id: string;
|
|
167
|
-
readonly createdAt: number;
|
|
168
|
-
}
|
|
3
|
+
export { MediaStore, getMediaEnvironment, getMediaRegion } from './MediaStore';
|
|
4
|
+
export type { ResponseFileItem, ItemsPayload, ImageMetadataArtifact, ImageMetadata, MediaStoreResponse, MediaStoreRequestOptions, MediaStoreCreateFileFromUploadParams, MediaStoreCreateFileParams, MediaStoreTouchFileParams, TouchFileDescriptor, MediaStoreTouchFileBody, MediaStoreCreateFileFromBinaryParams, MediaStoreCreateFileFromUploadConditions, MediaStoreCreateFileFromUploadBody, MediaStoreGetFileParams, MediaStoreGetFileImageParams, SourceFile, MediaStoreCopyFileWithTokenBody, MediaStoreCopyFileWithTokenParams, AppendChunksToUploadRequestBody, CreatedTouchedFile, RejectedTouchFile, RejectionError, TouchedFiles, EmptyFile, MediaApi, } from './types';
|