@atlaskit/media-client 24.0.3 → 25.0.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 +12 -0
- package/dist/cjs/index.js +1 -96
- package/dist/cjs/utils/request/helpers.js +32 -117
- package/dist/es2019/index.js +2 -50
- package/dist/es2019/utils/request/helpers.js +0 -47
- package/dist/esm/index.js +2 -50
- package/dist/esm/utils/request/helpers.js +32 -115
- package/dist/types/index.d.ts +1 -45
- package/dist/types/utils/request/helpers.d.ts +0 -16
- package/dist/types-ts4.5/index.d.ts +1 -45
- package/dist/types-ts4.5/utils/request/helpers.d.ts +0 -16
- package/package.json +4 -14
- package/report.api.md +1 -89
- package/tmp/api-report-tmp.d.ts +0 -72
- package/dist/cjs/utils/isImageRemote.js +0 -22
- package/dist/cjs/utils/safeUnsubscribe.js +0 -14
- package/dist/cjs/utils/with-media-client-hoc.js +0 -88
- package/dist/es2019/utils/isImageRemote.js +0 -15
- package/dist/es2019/utils/safeUnsubscribe.js +0 -6
- package/dist/es2019/utils/with-media-client-hoc.js +0 -62
- package/dist/esm/utils/isImageRemote.js +0 -16
- package/dist/esm/utils/safeUnsubscribe.js +0 -8
- package/dist/esm/utils/with-media-client-hoc.js +0 -82
- package/dist/types/utils/isImageRemote.d.ts +0 -1
- package/dist/types/utils/safeUnsubscribe.d.ts +0 -2
- package/dist/types/utils/with-media-client-hoc.d.ts +0 -33
- package/dist/types-ts4.5/utils/isImageRemote.d.ts +0 -1
- package/dist/types-ts4.5/utils/safeUnsubscribe.d.ts +0 -2
- package/dist/types-ts4.5/utils/with-media-client-hoc.d.ts +0 -33
|
@@ -8,11 +8,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
8
8
|
import { isClientBasedAuth } from '@atlaskit/media-core';
|
|
9
9
|
import { mapAuthToQueryParameters } from '../../models/auth-query-parameters';
|
|
10
10
|
import { RequestError, isRequestError } from './errors';
|
|
11
|
-
export function clientTimeoutPromise(timeout) {
|
|
12
|
-
return new Promise(function (_, reject) {
|
|
13
|
-
setTimeout(reject, timeout, new RequestError('clientTimeoutRequest'));
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
11
|
export function waitPromise(timeout) {
|
|
17
12
|
return new Promise(function (resolve) {
|
|
18
13
|
return setTimeout(resolve, timeout);
|
|
@@ -79,84 +74,6 @@ export function extendHeaders(headers, auth, traceContext) {
|
|
|
79
74
|
}
|
|
80
75
|
return _objectSpread(_objectSpread(_objectSpread({}, headers !== null && headers !== void 0 ? headers : {}), mapAuthToRequestHeaders(auth)), mapTraceIdToRequestHeaders(traceContext));
|
|
81
76
|
}
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* @deprecated Helper is deprecated and will be removed in the next major version.
|
|
85
|
-
* TODO: https://product-fabric.atlassian.net/browse/BMPT-1354
|
|
86
|
-
*/
|
|
87
|
-
export function mapResponseToJson(_x) {
|
|
88
|
-
return _mapResponseToJson.apply(this, arguments);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* @deprecated Helper is deprecated and will be removed in the next major version.
|
|
93
|
-
* TODO: https://product-fabric.atlassian.net/browse/BMPT-1354
|
|
94
|
-
*/
|
|
95
|
-
function _mapResponseToJson() {
|
|
96
|
-
_mapResponseToJson = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(response) {
|
|
97
|
-
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
98
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
99
|
-
case 0:
|
|
100
|
-
// eslint-disable-next-line no-console
|
|
101
|
-
console.warn('Helper is deprecated and will be remove in the next major version');
|
|
102
|
-
_context3.prev = 1;
|
|
103
|
-
_context3.next = 4;
|
|
104
|
-
return response.json();
|
|
105
|
-
case 4:
|
|
106
|
-
return _context3.abrupt("return", _context3.sent);
|
|
107
|
-
case 7:
|
|
108
|
-
_context3.prev = 7;
|
|
109
|
-
_context3.t0 = _context3["catch"](1);
|
|
110
|
-
throw new RequestError('serverInvalidBody', {
|
|
111
|
-
statusCode: response.status
|
|
112
|
-
}, _context3.t0 instanceof Error ? _context3.t0 : undefined);
|
|
113
|
-
case 10:
|
|
114
|
-
case "end":
|
|
115
|
-
return _context3.stop();
|
|
116
|
-
}
|
|
117
|
-
}, _callee3, null, [[1, 7]]);
|
|
118
|
-
}));
|
|
119
|
-
return _mapResponseToJson.apply(this, arguments);
|
|
120
|
-
}
|
|
121
|
-
export function mapResponseToBlob(_x2) {
|
|
122
|
-
return _mapResponseToBlob.apply(this, arguments);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* @deprecated Helper is deprecated and will be removed in the next major version.
|
|
127
|
-
* TODO: https://product-fabric.atlassian.net/browse/BMPT-1354
|
|
128
|
-
*/
|
|
129
|
-
function _mapResponseToBlob() {
|
|
130
|
-
_mapResponseToBlob = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(response) {
|
|
131
|
-
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
132
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
133
|
-
case 0:
|
|
134
|
-
// eslint-disable-next-line no-console
|
|
135
|
-
console.warn('Helper is deprecated and will be remove in the next major version');
|
|
136
|
-
_context4.prev = 1;
|
|
137
|
-
_context4.next = 4;
|
|
138
|
-
return response.blob();
|
|
139
|
-
case 4:
|
|
140
|
-
return _context4.abrupt("return", _context4.sent);
|
|
141
|
-
case 7:
|
|
142
|
-
_context4.prev = 7;
|
|
143
|
-
_context4.t0 = _context4["catch"](1);
|
|
144
|
-
throw new RequestError('serverInvalidBody', {
|
|
145
|
-
statusCode: response.status
|
|
146
|
-
}, _context4.t0 instanceof Error ? _context4.t0 : undefined);
|
|
147
|
-
case 10:
|
|
148
|
-
case "end":
|
|
149
|
-
return _context4.stop();
|
|
150
|
-
}
|
|
151
|
-
}, _callee4, null, [[1, 7]]);
|
|
152
|
-
}));
|
|
153
|
-
return _mapResponseToBlob.apply(this, arguments);
|
|
154
|
-
}
|
|
155
|
-
export function mapResponseToVoid() {
|
|
156
|
-
// eslint-disable-next-line no-console
|
|
157
|
-
console.warn('Helper is deprecated and will be remove in the next major version');
|
|
158
|
-
return Promise.resolve();
|
|
159
|
-
}
|
|
160
77
|
export function createMapResponseToJson(metadata) {
|
|
161
78
|
return /*#__PURE__*/function () {
|
|
162
79
|
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(response) {
|
|
@@ -180,7 +97,7 @@ export function createMapResponseToJson(metadata) {
|
|
|
180
97
|
}
|
|
181
98
|
}, _callee, null, [[0, 6]]);
|
|
182
99
|
}));
|
|
183
|
-
return function (
|
|
100
|
+
return function (_x) {
|
|
184
101
|
return _ref5.apply(this, arguments);
|
|
185
102
|
};
|
|
186
103
|
}();
|
|
@@ -208,7 +125,7 @@ export function createMapResponseToBlob(metadata) {
|
|
|
208
125
|
}
|
|
209
126
|
}, _callee2, null, [[0, 6]]);
|
|
210
127
|
}));
|
|
211
|
-
return function (
|
|
128
|
+
return function (_x2) {
|
|
212
129
|
return _ref6.apply(this, arguments);
|
|
213
130
|
};
|
|
214
131
|
}();
|
|
@@ -227,11 +144,11 @@ export function cloneRequestError(error, extraMetadata) {
|
|
|
227
144
|
innerError = error.innerError;
|
|
228
145
|
return new RequestError(reason, _objectSpread(_objectSpread({}, metadata), extraMetadata), innerError);
|
|
229
146
|
}
|
|
230
|
-
export function fetchRetry(
|
|
147
|
+
export function fetchRetry(_x3, _x4) {
|
|
231
148
|
return _fetchRetry.apply(this, arguments);
|
|
232
149
|
}
|
|
233
150
|
function _fetchRetry() {
|
|
234
|
-
_fetchRetry = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
151
|
+
_fetchRetry = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(functionToRetry, metadata) {
|
|
235
152
|
var overwriteOptions,
|
|
236
153
|
options,
|
|
237
154
|
startTimeoutInMs,
|
|
@@ -241,30 +158,30 @@ function _fetchRetry() {
|
|
|
241
158
|
timeoutInMs,
|
|
242
159
|
lastError,
|
|
243
160
|
waitAndBumpTimeout,
|
|
244
|
-
|
|
245
|
-
return _regeneratorRuntime.wrap(function
|
|
246
|
-
while (1) switch (
|
|
161
|
+
_args4 = arguments;
|
|
162
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
163
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
247
164
|
case 0:
|
|
248
|
-
overwriteOptions =
|
|
165
|
+
overwriteOptions = _args4.length > 2 && _args4[2] !== undefined ? _args4[2] : {};
|
|
249
166
|
options = _objectSpread(_objectSpread({}, DEFAULT_RETRY_OPTIONS), overwriteOptions);
|
|
250
167
|
startTimeoutInMs = options.startTimeoutInMs, maxAttempts = options.maxAttempts, factor = options.factor;
|
|
251
168
|
attempts = 0;
|
|
252
169
|
timeoutInMs = startTimeoutInMs;
|
|
253
170
|
waitAndBumpTimeout = /*#__PURE__*/function () {
|
|
254
|
-
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
255
|
-
return _regeneratorRuntime.wrap(function
|
|
256
|
-
while (1) switch (
|
|
171
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
172
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
173
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
257
174
|
case 0:
|
|
258
|
-
|
|
175
|
+
_context3.next = 2;
|
|
259
176
|
return waitPromise(timeoutInMs);
|
|
260
177
|
case 2:
|
|
261
178
|
timeoutInMs *= factor;
|
|
262
179
|
attempts += 1;
|
|
263
180
|
case 4:
|
|
264
181
|
case "end":
|
|
265
|
-
return
|
|
182
|
+
return _context3.stop();
|
|
266
183
|
}
|
|
267
|
-
},
|
|
184
|
+
}, _callee3);
|
|
268
185
|
}));
|
|
269
186
|
return function waitAndBumpTimeout() {
|
|
270
187
|
return _ref7.apply(this, arguments);
|
|
@@ -272,40 +189,40 @@ function _fetchRetry() {
|
|
|
272
189
|
}();
|
|
273
190
|
case 6:
|
|
274
191
|
if (!(attempts < maxAttempts)) {
|
|
275
|
-
|
|
192
|
+
_context4.next = 24;
|
|
276
193
|
break;
|
|
277
194
|
}
|
|
278
|
-
|
|
279
|
-
|
|
195
|
+
_context4.prev = 7;
|
|
196
|
+
_context4.next = 10;
|
|
280
197
|
return functionToRetry();
|
|
281
198
|
case 10:
|
|
282
|
-
return
|
|
199
|
+
return _context4.abrupt("return", _context4.sent);
|
|
283
200
|
case 13:
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
lastError =
|
|
201
|
+
_context4.prev = 13;
|
|
202
|
+
_context4.t0 = _context4["catch"](7);
|
|
203
|
+
lastError = _context4.t0;
|
|
287
204
|
|
|
288
205
|
// don't retry if request was aborted by user
|
|
289
|
-
if (!isAbortedRequestError(
|
|
290
|
-
|
|
206
|
+
if (!isAbortedRequestError(_context4.t0)) {
|
|
207
|
+
_context4.next = 18;
|
|
291
208
|
break;
|
|
292
209
|
}
|
|
293
|
-
throw new RequestError('clientAbortedRequest', metadata,
|
|
210
|
+
throw new RequestError('clientAbortedRequest', metadata, _context4.t0);
|
|
294
211
|
case 18:
|
|
295
|
-
if (!(!isFetchNetworkError(
|
|
296
|
-
|
|
212
|
+
if (!(!isFetchNetworkError(_context4.t0) && !isRequestError(_context4.t0) || isRequestError(_context4.t0) && (!_context4.t0.metadata || !_context4.t0.metadata.statusCode || _context4.t0.metadata.statusCode < 500))) {
|
|
213
|
+
_context4.next = 20;
|
|
297
214
|
break;
|
|
298
215
|
}
|
|
299
|
-
throw
|
|
216
|
+
throw _context4.t0;
|
|
300
217
|
case 20:
|
|
301
|
-
|
|
218
|
+
_context4.next = 22;
|
|
302
219
|
return waitAndBumpTimeout();
|
|
303
220
|
case 22:
|
|
304
|
-
|
|
221
|
+
_context4.next = 6;
|
|
305
222
|
break;
|
|
306
223
|
case 24:
|
|
307
224
|
if (!isRequestError(lastError)) {
|
|
308
|
-
|
|
225
|
+
_context4.next = 26;
|
|
309
226
|
break;
|
|
310
227
|
}
|
|
311
228
|
throw cloneRequestError(lastError, {
|
|
@@ -319,9 +236,9 @@ function _fetchRetry() {
|
|
|
319
236
|
}), lastError);
|
|
320
237
|
case 27:
|
|
321
238
|
case "end":
|
|
322
|
-
return
|
|
239
|
+
return _context4.stop();
|
|
323
240
|
}
|
|
324
|
-
},
|
|
241
|
+
}, _callee4, null, [[7, 13]]);
|
|
325
242
|
}));
|
|
326
243
|
return _fetchRetry.apply(this, arguments);
|
|
327
244
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export { uploadFile } from './uploader';
|
|
|
16
16
|
export type { UploadableFile, UploadableFileUpfrontIds, UploadFileCallbacks, UploadFileResult, } from './uploader';
|
|
17
17
|
export { request, RequestError, isRequestError, isRateLimitedError, createRequestErrorReason, } from './utils/request';
|
|
18
18
|
export type { RequestErrorReason, RequestErrorMetadata, RequestErrorAttributes, } from './utils/request';
|
|
19
|
-
export { isAbortedRequestError,
|
|
19
|
+
export { isAbortedRequestError, createUrl } from './utils/request/helpers';
|
|
20
20
|
export { PollingFunction } from './utils/polling';
|
|
21
21
|
export { isPollingError, PollingError } from './utils/polling/errors';
|
|
22
22
|
export type { Executor, PollingErrorAttributes, PollingErrorReason, } from './utils/polling/types';
|
|
@@ -28,17 +28,13 @@ export type { CopySourceFile, CopyDestination, CopyFileOptions, FileFetcher, Fil
|
|
|
28
28
|
export { MediaClient } from './client/media-client';
|
|
29
29
|
export { StargateClient } from './client/stargate-client';
|
|
30
30
|
export type { EdgeData } from './client/stargate-client';
|
|
31
|
-
export { isImageRemote } from './utils/isImageRemote';
|
|
32
31
|
export { checkWebpSupport } from './utils/checkWebpSupport';
|
|
33
32
|
export { getDimensionsFromBlob } from './utils/getDimensionsFromBlob';
|
|
34
33
|
export type { Dimensions } from './utils/getDimensionsFromBlob';
|
|
35
34
|
export { createMediaSubject } from './utils/createMediaSubject';
|
|
36
|
-
export { safeUnsubscribe } from './utils/safeUnsubscribe';
|
|
37
35
|
export { isFileIdentifier, isExternalImageIdentifier, isDifferentIdentifier, } from './identifier';
|
|
38
36
|
export type { Identifier, FileIdentifier, ExternalImageIdentifier, } from './identifier';
|
|
39
37
|
export type { EventPayloadListener, UploadEventPayloadMap, MediaViewedEventPayload, } from './client/events';
|
|
40
|
-
export { withMediaClient, getMediaClient } from './utils/with-media-client-hoc';
|
|
41
|
-
export type { WithMediaClientConfig, WithMediaClientConfigProps, WithMediaClientFunction, WithMediaClient, } from './utils/with-media-client-hoc';
|
|
42
38
|
export type { MediaClientConfig } from '@atlaskit/media-core';
|
|
43
39
|
export { globalMediaEventEmitter } from './globalMediaEventEmitter';
|
|
44
40
|
export { isMediaBlobUrl, getAttrsFromUrl, addFileAttrsToUrl, objectToQueryString, } from './utils/url';
|
|
@@ -47,43 +43,3 @@ export { createMediaSubscribable, fromObservable, } from './utils/mediaSubscriba
|
|
|
47
43
|
export type { MediaSubscribable, MediaSubscription, MediaObserver, } from './utils/mediaSubscribable';
|
|
48
44
|
export { RECENTS_COLLECTION, MAX_RESOLUTION } from './constants';
|
|
49
45
|
export { getFileStreamsCache } from './file-streams-cache';
|
|
50
|
-
/**
|
|
51
|
-
* @deprecated This export will be removed. Please use one from @atlaskit/media-common or @atlaskit/media-common/mediaTypeUtils
|
|
52
|
-
*/
|
|
53
|
-
export declare const getMediaTypeFromMimeType: (mimeType: string) => import("@atlaskit/media-common").MediaType;
|
|
54
|
-
/**
|
|
55
|
-
* @deprecated This export will be removed. Please use one from @atlaskit/media-common or @atlaskit/media-common/mediaTypeUtils
|
|
56
|
-
*/
|
|
57
|
-
export declare const isImageMimeTypeSupportedByBrowser: (mimeType: string) => boolean;
|
|
58
|
-
/**
|
|
59
|
-
* @deprecated This export will be removed. Please use one from @atlaskit/media-common or @atlaskit/media-common/mediaTypeUtils
|
|
60
|
-
*/
|
|
61
|
-
export declare const isDocumentMimeTypeSupportedByBrowser: (mimeType: string) => boolean;
|
|
62
|
-
/**
|
|
63
|
-
* @deprecated This export will be removed. Please use one from @atlaskit/media-common or @atlaskit/media-common/mediaTypeUtils
|
|
64
|
-
*/
|
|
65
|
-
export declare const isMimeTypeSupportedByBrowser: (mimeType: string) => boolean;
|
|
66
|
-
/**
|
|
67
|
-
* @deprecated This export will be removed. Please use one from @atlaskit/media-common or @atlaskit/media-common/mediaTypeUtils
|
|
68
|
-
*/
|
|
69
|
-
export declare const isImageMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
70
|
-
/**
|
|
71
|
-
* @deprecated This export will be removed. Please use one from @atlaskit/media-common or @atlaskit/media-common/mediaTypeUtils
|
|
72
|
-
*/
|
|
73
|
-
export declare const isDocumentMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
74
|
-
/**
|
|
75
|
-
* @deprecated This export will be removed. Please use one from @atlaskit/media-common or @atlaskit/media-common/mediaTypeUtils
|
|
76
|
-
*/
|
|
77
|
-
export declare const isAudioMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
78
|
-
/**
|
|
79
|
-
* @deprecated This export will be removed. Please use one from @atlaskit/media-common or @atlaskit/media-common/mediaTypeUtils
|
|
80
|
-
*/
|
|
81
|
-
export declare const isVideoMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
82
|
-
/**
|
|
83
|
-
* @deprecated This export will be removed. Please use one from @atlaskit/media-common or @atlaskit/media-common/mediaTypeUtils
|
|
84
|
-
*/
|
|
85
|
-
export declare const isUnknownMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
86
|
-
/**
|
|
87
|
-
* @deprecated This export will be removed. Please use one from @atlaskit/media-common or @atlaskit/media-common/mediaTypeUtils
|
|
88
|
-
*/
|
|
89
|
-
export declare const isMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
@@ -2,7 +2,6 @@ import { Auth } from '@atlaskit/media-core';
|
|
|
2
2
|
import { MediaTraceContext } from '@atlaskit/media-common';
|
|
3
3
|
import { RequestError } from './errors';
|
|
4
4
|
import { CreateUrlOptions, RequestErrorReason, RequestErrorMetadata, RequestHeaders, RequestMetadata, RetryOptions } from './types';
|
|
5
|
-
export declare function clientTimeoutPromise(timeout: number): Promise<Response>;
|
|
6
5
|
export declare function waitPromise(timeout: number): Promise<void>;
|
|
7
6
|
export declare function isAbortedRequestError(err: any): boolean;
|
|
8
7
|
export declare function isFetchNetworkError(err: any): err is TypeError;
|
|
@@ -17,21 +16,6 @@ export declare const ZipkinHeaderKeys: {
|
|
|
17
16
|
export declare function mapAuthToRequestHeaders(auth?: Auth): RequestHeaders;
|
|
18
17
|
export declare function createUrl(url: string, { params, auth }: CreateUrlOptions): string;
|
|
19
18
|
export declare function extendHeaders(headers?: RequestHeaders, auth?: Auth, traceContext?: Required<MediaTraceContext>): RequestHeaders | undefined;
|
|
20
|
-
/**
|
|
21
|
-
* @deprecated Helper is deprecated and will be removed in the next major version.
|
|
22
|
-
* TODO: https://product-fabric.atlassian.net/browse/BMPT-1354
|
|
23
|
-
*/
|
|
24
|
-
export declare function mapResponseToJson(response: Response): Promise<any>;
|
|
25
|
-
/**
|
|
26
|
-
* @deprecated Helper is deprecated and will be removed in the next major version.
|
|
27
|
-
* TODO: https://product-fabric.atlassian.net/browse/BMPT-1354
|
|
28
|
-
*/
|
|
29
|
-
export declare function mapResponseToBlob(response: Response): Promise<Blob>;
|
|
30
|
-
/**
|
|
31
|
-
* @deprecated Helper is deprecated and will be removed in the next major version.
|
|
32
|
-
* TODO: https://product-fabric.atlassian.net/browse/BMPT-1354
|
|
33
|
-
*/
|
|
34
|
-
export declare function mapResponseToVoid(): Promise<void>;
|
|
35
19
|
export declare function createMapResponseToJson(metadata: RequestMetadata): (response: Response) => Promise<any>;
|
|
36
20
|
export declare function createMapResponseToBlob(metadata: RequestMetadata): (response: Response) => Promise<Blob>;
|
|
37
21
|
export declare const DEFAULT_RETRY_OPTIONS: RetryOptions;
|
|
@@ -16,7 +16,7 @@ export { uploadFile } from './uploader';
|
|
|
16
16
|
export type { UploadableFile, UploadableFileUpfrontIds, UploadFileCallbacks, UploadFileResult, } from './uploader';
|
|
17
17
|
export { request, RequestError, isRequestError, isRateLimitedError, createRequestErrorReason, } from './utils/request';
|
|
18
18
|
export type { RequestErrorReason, RequestErrorMetadata, RequestErrorAttributes, } from './utils/request';
|
|
19
|
-
export { isAbortedRequestError,
|
|
19
|
+
export { isAbortedRequestError, createUrl } from './utils/request/helpers';
|
|
20
20
|
export { PollingFunction } from './utils/polling';
|
|
21
21
|
export { isPollingError, PollingError } from './utils/polling/errors';
|
|
22
22
|
export type { Executor, PollingErrorAttributes, PollingErrorReason, } from './utils/polling/types';
|
|
@@ -28,17 +28,13 @@ export type { CopySourceFile, CopyDestination, CopyFileOptions, FileFetcher, Fil
|
|
|
28
28
|
export { MediaClient } from './client/media-client';
|
|
29
29
|
export { StargateClient } from './client/stargate-client';
|
|
30
30
|
export type { EdgeData } from './client/stargate-client';
|
|
31
|
-
export { isImageRemote } from './utils/isImageRemote';
|
|
32
31
|
export { checkWebpSupport } from './utils/checkWebpSupport';
|
|
33
32
|
export { getDimensionsFromBlob } from './utils/getDimensionsFromBlob';
|
|
34
33
|
export type { Dimensions } from './utils/getDimensionsFromBlob';
|
|
35
34
|
export { createMediaSubject } from './utils/createMediaSubject';
|
|
36
|
-
export { safeUnsubscribe } from './utils/safeUnsubscribe';
|
|
37
35
|
export { isFileIdentifier, isExternalImageIdentifier, isDifferentIdentifier, } from './identifier';
|
|
38
36
|
export type { Identifier, FileIdentifier, ExternalImageIdentifier, } from './identifier';
|
|
39
37
|
export type { EventPayloadListener, UploadEventPayloadMap, MediaViewedEventPayload, } from './client/events';
|
|
40
|
-
export { withMediaClient, getMediaClient } from './utils/with-media-client-hoc';
|
|
41
|
-
export type { WithMediaClientConfig, WithMediaClientConfigProps, WithMediaClientFunction, WithMediaClient, } from './utils/with-media-client-hoc';
|
|
42
38
|
export type { MediaClientConfig } from '@atlaskit/media-core';
|
|
43
39
|
export { globalMediaEventEmitter } from './globalMediaEventEmitter';
|
|
44
40
|
export { isMediaBlobUrl, getAttrsFromUrl, addFileAttrsToUrl, objectToQueryString, } from './utils/url';
|
|
@@ -47,43 +43,3 @@ export { createMediaSubscribable, fromObservable, } from './utils/mediaSubscriba
|
|
|
47
43
|
export type { MediaSubscribable, MediaSubscription, MediaObserver, } from './utils/mediaSubscribable';
|
|
48
44
|
export { RECENTS_COLLECTION, MAX_RESOLUTION } from './constants';
|
|
49
45
|
export { getFileStreamsCache } from './file-streams-cache';
|
|
50
|
-
/**
|
|
51
|
-
* @deprecated This export will be removed. Please use one from @atlaskit/media-common or @atlaskit/media-common/mediaTypeUtils
|
|
52
|
-
*/
|
|
53
|
-
export declare const getMediaTypeFromMimeType: (mimeType: string) => import("@atlaskit/media-common").MediaType;
|
|
54
|
-
/**
|
|
55
|
-
* @deprecated This export will be removed. Please use one from @atlaskit/media-common or @atlaskit/media-common/mediaTypeUtils
|
|
56
|
-
*/
|
|
57
|
-
export declare const isImageMimeTypeSupportedByBrowser: (mimeType: string) => boolean;
|
|
58
|
-
/**
|
|
59
|
-
* @deprecated This export will be removed. Please use one from @atlaskit/media-common or @atlaskit/media-common/mediaTypeUtils
|
|
60
|
-
*/
|
|
61
|
-
export declare const isDocumentMimeTypeSupportedByBrowser: (mimeType: string) => boolean;
|
|
62
|
-
/**
|
|
63
|
-
* @deprecated This export will be removed. Please use one from @atlaskit/media-common or @atlaskit/media-common/mediaTypeUtils
|
|
64
|
-
*/
|
|
65
|
-
export declare const isMimeTypeSupportedByBrowser: (mimeType: string) => boolean;
|
|
66
|
-
/**
|
|
67
|
-
* @deprecated This export will be removed. Please use one from @atlaskit/media-common or @atlaskit/media-common/mediaTypeUtils
|
|
68
|
-
*/
|
|
69
|
-
export declare const isImageMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
70
|
-
/**
|
|
71
|
-
* @deprecated This export will be removed. Please use one from @atlaskit/media-common or @atlaskit/media-common/mediaTypeUtils
|
|
72
|
-
*/
|
|
73
|
-
export declare const isDocumentMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
74
|
-
/**
|
|
75
|
-
* @deprecated This export will be removed. Please use one from @atlaskit/media-common or @atlaskit/media-common/mediaTypeUtils
|
|
76
|
-
*/
|
|
77
|
-
export declare const isAudioMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
78
|
-
/**
|
|
79
|
-
* @deprecated This export will be removed. Please use one from @atlaskit/media-common or @atlaskit/media-common/mediaTypeUtils
|
|
80
|
-
*/
|
|
81
|
-
export declare const isVideoMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
82
|
-
/**
|
|
83
|
-
* @deprecated This export will be removed. Please use one from @atlaskit/media-common or @atlaskit/media-common/mediaTypeUtils
|
|
84
|
-
*/
|
|
85
|
-
export declare const isUnknownMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
86
|
-
/**
|
|
87
|
-
* @deprecated This export will be removed. Please use one from @atlaskit/media-common or @atlaskit/media-common/mediaTypeUtils
|
|
88
|
-
*/
|
|
89
|
-
export declare const isMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
@@ -2,7 +2,6 @@ import { Auth } from '@atlaskit/media-core';
|
|
|
2
2
|
import { MediaTraceContext } from '@atlaskit/media-common';
|
|
3
3
|
import { RequestError } from './errors';
|
|
4
4
|
import { CreateUrlOptions, RequestErrorReason, RequestErrorMetadata, RequestHeaders, RequestMetadata, RetryOptions } from './types';
|
|
5
|
-
export declare function clientTimeoutPromise(timeout: number): Promise<Response>;
|
|
6
5
|
export declare function waitPromise(timeout: number): Promise<void>;
|
|
7
6
|
export declare function isAbortedRequestError(err: any): boolean;
|
|
8
7
|
export declare function isFetchNetworkError(err: any): err is TypeError;
|
|
@@ -17,21 +16,6 @@ export declare const ZipkinHeaderKeys: {
|
|
|
17
16
|
export declare function mapAuthToRequestHeaders(auth?: Auth): RequestHeaders;
|
|
18
17
|
export declare function createUrl(url: string, { params, auth }: CreateUrlOptions): string;
|
|
19
18
|
export declare function extendHeaders(headers?: RequestHeaders, auth?: Auth, traceContext?: Required<MediaTraceContext>): RequestHeaders | undefined;
|
|
20
|
-
/**
|
|
21
|
-
* @deprecated Helper is deprecated and will be removed in the next major version.
|
|
22
|
-
* TODO: https://product-fabric.atlassian.net/browse/BMPT-1354
|
|
23
|
-
*/
|
|
24
|
-
export declare function mapResponseToJson(response: Response): Promise<any>;
|
|
25
|
-
/**
|
|
26
|
-
* @deprecated Helper is deprecated and will be removed in the next major version.
|
|
27
|
-
* TODO: https://product-fabric.atlassian.net/browse/BMPT-1354
|
|
28
|
-
*/
|
|
29
|
-
export declare function mapResponseToBlob(response: Response): Promise<Blob>;
|
|
30
|
-
/**
|
|
31
|
-
* @deprecated Helper is deprecated and will be removed in the next major version.
|
|
32
|
-
* TODO: https://product-fabric.atlassian.net/browse/BMPT-1354
|
|
33
|
-
*/
|
|
34
|
-
export declare function mapResponseToVoid(): Promise<void>;
|
|
35
19
|
export declare function createMapResponseToJson(metadata: RequestMetadata): (response: Response) => Promise<any>;
|
|
36
20
|
export declare function createMapResponseToBlob(metadata: RequestMetadata): (response: Response) => Promise<Blob>;
|
|
37
21
|
export declare const DEFAULT_RETRY_OPTIONS: RetryOptions;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-client",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "25.0.1",
|
|
4
4
|
"description": "Media API Web Client Library",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@atlaskit/chunkinator": "^4.2.0",
|
|
40
|
-
"@atlaskit/media-common": "^
|
|
40
|
+
"@atlaskit/media-common": "^10.0.0",
|
|
41
41
|
"@babel/runtime": "^7.0.0",
|
|
42
42
|
"dataloader": "^2.0.0",
|
|
43
43
|
"deep-equal": "^1.0.1",
|
|
@@ -52,16 +52,7 @@
|
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"@atlaskit/media-core": "^34.1.2",
|
|
55
|
-
"@atlaskit/media-state": "^1.0.0"
|
|
56
|
-
"@emotion/react": "^11.7.1",
|
|
57
|
-
"enzyme": ">=3.10.0",
|
|
58
|
-
"react": "^16.8.0"
|
|
59
|
-
},
|
|
60
|
-
"peerDependenciesMeta": {
|
|
61
|
-
"enzyme": {
|
|
62
|
-
"optional": true,
|
|
63
|
-
"dev": true
|
|
64
|
-
}
|
|
55
|
+
"@atlaskit/media-state": "^1.0.0"
|
|
65
56
|
},
|
|
66
57
|
"devDependencies": {
|
|
67
58
|
"@atlaskit/media-core": "^34.1.0",
|
|
@@ -71,8 +62,7 @@
|
|
|
71
62
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
72
63
|
"@emotion/react": "^11.7.1",
|
|
73
64
|
"@types/deep-equal": "^1.0.1",
|
|
74
|
-
"@types/uuid-validate": "^0.0.
|
|
75
|
-
"enzyme": "^3.10.0",
|
|
65
|
+
"@types/uuid-validate": "^0.0.2",
|
|
76
66
|
"fetch-mock": "^8.0.0",
|
|
77
67
|
"react": "^16.8.0",
|
|
78
68
|
"react-dom": "^16.8.0",
|
package/report.api.md
CHANGED
|
@@ -36,7 +36,6 @@ import { MediaType } from '@atlaskit/media-common';
|
|
|
36
36
|
import { ProcessedFileState } from '@atlaskit/media-state';
|
|
37
37
|
import { ProcessingFailedState } from '@atlaskit/media-state';
|
|
38
38
|
import { ProcessingFileState } from '@atlaskit/media-state';
|
|
39
|
-
import { default as React_2 } from 'react';
|
|
40
39
|
import { ReplaySubject } from 'rxjs/ReplaySubject';
|
|
41
40
|
import { UploadingFileState } from '@atlaskit/media-state';
|
|
42
41
|
|
|
@@ -448,11 +447,6 @@ export interface GetFileOptions {
|
|
|
448
447
|
// @public (undocumented)
|
|
449
448
|
export const getFileStreamsCache: () => StreamsCache<FileState>;
|
|
450
449
|
|
|
451
|
-
// @public @deprecated (undocumented)
|
|
452
|
-
export const getMediaClient: (
|
|
453
|
-
mediaClientConfig: MediaClientConfig,
|
|
454
|
-
) => MediaClient;
|
|
455
|
-
|
|
456
450
|
// @public (undocumented)
|
|
457
451
|
export function getMediaClientErrorReason(
|
|
458
452
|
err: Error,
|
|
@@ -464,9 +458,6 @@ export const getMediaEnvironment: () => string | undefined;
|
|
|
464
458
|
// @public (undocumented)
|
|
465
459
|
export const getMediaRegion: () => string | undefined;
|
|
466
460
|
|
|
467
|
-
// @public @deprecated (undocumented)
|
|
468
|
-
export const getMediaTypeFromMimeType: (mimeType: string) => MediaType;
|
|
469
|
-
|
|
470
461
|
// @public (undocumented)
|
|
471
462
|
export const globalMediaEventEmitter: {
|
|
472
463
|
on<E extends keyof UploadEventPayloadMap>(
|
|
@@ -515,20 +506,9 @@ export const imageResizeModeToFileImageMode: (
|
|
|
515
506
|
// @public (undocumented)
|
|
516
507
|
export function isAbortedRequestError(err: any): boolean;
|
|
517
508
|
|
|
518
|
-
// @public @deprecated (undocumented)
|
|
519
|
-
export const isAudioMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
520
|
-
|
|
521
509
|
// @public (undocumented)
|
|
522
510
|
export const isDifferentIdentifier: (a: Identifier, b: Identifier) => boolean;
|
|
523
511
|
|
|
524
|
-
// @public @deprecated (undocumented)
|
|
525
|
-
export const isDocumentMimeTypeSupportedByBrowser: (
|
|
526
|
-
mimeType: string,
|
|
527
|
-
) => boolean;
|
|
528
|
-
|
|
529
|
-
// @public @deprecated (undocumented)
|
|
530
|
-
export const isDocumentMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
531
|
-
|
|
532
512
|
// @public (undocumented)
|
|
533
513
|
export const isErrorFileState: (
|
|
534
514
|
fileState: FileState,
|
|
@@ -552,18 +532,6 @@ export const isFinalFileState: (
|
|
|
552
532
|
fileState: FileState,
|
|
553
533
|
) => fileState is ErrorFileState | ProcessedFileState | ProcessingFailedState;
|
|
554
534
|
|
|
555
|
-
// @public @deprecated (undocumented)
|
|
556
|
-
export const isImageMimeTypeSupportedByBrowser: (mimeType: string) => boolean;
|
|
557
|
-
|
|
558
|
-
// @public @deprecated (undocumented)
|
|
559
|
-
export const isImageMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
560
|
-
|
|
561
|
-
// @public (undocumented)
|
|
562
|
-
export const isImageRemote: (
|
|
563
|
-
imageUrl: string,
|
|
564
|
-
windowOrigin?: string,
|
|
565
|
-
) => boolean;
|
|
566
|
-
|
|
567
535
|
// @public (undocumented)
|
|
568
536
|
export const isImageRepresentationReady: (fileState: FileState) => boolean;
|
|
569
537
|
|
|
@@ -578,12 +546,6 @@ export function isMediaClientError(error: any): error is MediaClientError<{
|
|
|
578
546
|
// @public (undocumented)
|
|
579
547
|
export function isMediaStoreError(err: Error): err is MediaStoreError;
|
|
580
548
|
|
|
581
|
-
// @public @deprecated (undocumented)
|
|
582
|
-
export const isMimeTypeSupportedByBrowser: (mimeType: string) => boolean;
|
|
583
|
-
|
|
584
|
-
// @public @deprecated (undocumented)
|
|
585
|
-
export const isMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
586
|
-
|
|
587
549
|
// @public (undocumented)
|
|
588
550
|
export function isPollingError(err?: Error): err is PollingError;
|
|
589
551
|
|
|
@@ -617,17 +579,11 @@ export function isRateLimitedError(error: Error | undefined): boolean;
|
|
|
617
579
|
// @public (undocumented)
|
|
618
580
|
export function isRequestError(err: Error): err is RequestError;
|
|
619
581
|
|
|
620
|
-
// @public @deprecated (undocumented)
|
|
621
|
-
export const isUnknownMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
622
|
-
|
|
623
582
|
// @public (undocumented)
|
|
624
583
|
export const isUploadingFileState: (
|
|
625
584
|
fileState: FileState,
|
|
626
585
|
) => fileState is UploadingFileState;
|
|
627
586
|
|
|
628
|
-
// @public @deprecated (undocumented)
|
|
629
|
-
export const isVideoMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
630
|
-
|
|
631
587
|
// @public (undocumented)
|
|
632
588
|
export interface ItemsPayload {
|
|
633
589
|
// (undocumented)
|
|
@@ -645,15 +601,6 @@ export const mapMediaItemToFileState: (
|
|
|
645
601
|
item: MediaItemDetails,
|
|
646
602
|
) => FileState;
|
|
647
603
|
|
|
648
|
-
// @public @deprecated (undocumented)
|
|
649
|
-
export function mapResponseToBlob(response: Response): Promise<Blob>;
|
|
650
|
-
|
|
651
|
-
// @public @deprecated (undocumented)
|
|
652
|
-
export function mapResponseToJson(response: Response): Promise<any>;
|
|
653
|
-
|
|
654
|
-
// @public @deprecated (undocumented)
|
|
655
|
-
export function mapResponseToVoid(): Promise<void>;
|
|
656
|
-
|
|
657
604
|
// @public (undocumented)
|
|
658
605
|
export const MAX_RESOLUTION = 4096;
|
|
659
606
|
|
|
@@ -1396,9 +1343,6 @@ export type RetryOptions = {
|
|
|
1396
1343
|
readonly factor: number;
|
|
1397
1344
|
};
|
|
1398
1345
|
|
|
1399
|
-
// @public (undocumented)
|
|
1400
|
-
export const safeUnsubscribe: (subscription: MediaSubscription) => void;
|
|
1401
|
-
|
|
1402
1346
|
// @public (undocumented)
|
|
1403
1347
|
export interface SourceFile {
|
|
1404
1348
|
// (undocumented)
|
|
@@ -1517,35 +1461,6 @@ export interface UploadFileResult {
|
|
|
1517
1461
|
|
|
1518
1462
|
export { UploadingFileState };
|
|
1519
1463
|
|
|
1520
|
-
// @public @deprecated (undocumented)
|
|
1521
|
-
export interface WithMediaClient {
|
|
1522
|
-
// (undocumented)
|
|
1523
|
-
identifier?: Identifier;
|
|
1524
|
-
// (undocumented)
|
|
1525
|
-
mediaClient: MediaClient;
|
|
1526
|
-
}
|
|
1527
|
-
|
|
1528
|
-
// @public @deprecated (undocumented)
|
|
1529
|
-
export const withMediaClient: WithMediaClientFunction;
|
|
1530
|
-
|
|
1531
|
-
// @public @deprecated (undocumented)
|
|
1532
|
-
export interface WithMediaClientConfig {
|
|
1533
|
-
// (undocumented)
|
|
1534
|
-
mediaClientConfig: MediaClientConfig;
|
|
1535
|
-
}
|
|
1536
|
-
|
|
1537
|
-
// @public @deprecated (undocumented)
|
|
1538
|
-
export type WithMediaClientConfigProps<P extends WithMediaClient> = Omit<
|
|
1539
|
-
P,
|
|
1540
|
-
'mediaClient'
|
|
1541
|
-
> &
|
|
1542
|
-
WithMediaClientConfig;
|
|
1543
|
-
|
|
1544
|
-
// @public @deprecated (undocumented)
|
|
1545
|
-
export type WithMediaClientFunction = <P extends WithMediaClient>(
|
|
1546
|
-
Component: React_2.ComponentType<P>,
|
|
1547
|
-
) => React_2.ComponentType<WithMediaClientConfigProps<P>>;
|
|
1548
|
-
|
|
1549
1464
|
// (No @packageDocumentation comment for this package)
|
|
1550
1465
|
```
|
|
1551
1466
|
|
|
@@ -1558,10 +1473,7 @@ export type WithMediaClientFunction = <P extends WithMediaClient>(
|
|
|
1558
1473
|
```json
|
|
1559
1474
|
{
|
|
1560
1475
|
"@atlaskit/media-core": "^34.1.2",
|
|
1561
|
-
"@atlaskit/media-state": "^1.0.0"
|
|
1562
|
-
"@emotion/react": "^11.7.1",
|
|
1563
|
-
"enzyme": ">=3.10.0",
|
|
1564
|
-
"react": "^16.8.0"
|
|
1476
|
+
"@atlaskit/media-state": "^1.0.0"
|
|
1565
1477
|
}
|
|
1566
1478
|
```
|
|
1567
1479
|
|