@atlaskit/media-client 15.0.0 → 16.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 +34 -0
- package/constants/package.json +1 -0
- package/dist/cjs/client/media-store/index.js +26 -4
- package/dist/cjs/index.js +12 -6
- package/dist/cjs/uploader.js +4 -2
- package/dist/cjs/utils/request/helpers.js +26 -31
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/client/media-store/index.js +19 -3
- package/dist/es2019/index.js +2 -2
- package/dist/es2019/uploader.js +3 -3
- package/dist/es2019/utils/request/helpers.js +8 -24
- package/dist/es2019/version.json +1 -1
- package/dist/esm/client/media-store/index.js +20 -4
- package/dist/esm/index.js +2 -2
- package/dist/esm/uploader.js +4 -2
- package/dist/esm/utils/request/helpers.js +24 -28
- package/dist/esm/version.json +1 -1
- package/dist/types/client/media-store/index.d.ts +2 -0
- package/dist/types/client/media-store/resolveAuth.d.ts +1 -1
- package/dist/types/globalMediaEventEmitter.d.ts +3 -3
- package/dist/types/index.d.ts +3 -3
- package/dist/types/models/file-state.d.ts +1 -1
- package/dist/types/uploader.d.ts +1 -1
- package/dist/types/utils/imageResizeModeToFileImageMode.d.ts +1 -1
- package/dist/types/utils/overrideMediaTypeIfUnknown.d.ts +2 -2
- package/dist/types/utils/request/errors.d.ts +1 -1
- package/dist/types/utils/request/helpers.d.ts +0 -4
- package/package.json +9 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @atlaskit/media-client
|
|
2
2
|
|
|
3
|
+
## 16.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [`b6d47de3fd9`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b6d47de3fd9) - [MEX-1417] remove access to media file streams cache
|
|
8
|
+
|
|
9
|
+
### Minor Changes
|
|
10
|
+
|
|
11
|
+
- [`5e249d1ad05`](https://bitbucket.org/atlassian/atlassian-frontend/commits/5e249d1ad05) - Exposed media environment
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`bde94d1a336`](https://bitbucket.org/atlassian/atlassian-frontend/commits/bde94d1a336) - When chunkinator has multiple processing batches of chunks, file will only be finalised uploading for once.
|
|
16
|
+
- [`567b33b2eeb`](https://bitbucket.org/atlassian/atlassian-frontend/commits/567b33b2eeb) - stripe out null and undefined params when calling media server
|
|
17
|
+
- [`c4c75f5a769`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c4c75f5a769) - Removed query string from media client
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
20
|
+
## 15.1.1
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- [`a424e62b264`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a424e62b264) - Changes to support Node 16 Typescript definitions from `@types/node`.
|
|
25
|
+
|
|
26
|
+
## 15.1.0
|
|
27
|
+
|
|
28
|
+
### Minor Changes
|
|
29
|
+
|
|
30
|
+
- [`cb2392f6d33`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cb2392f6d33) - Export `WithMediaClient` type to resolve a deep import path d.ts reference
|
|
31
|
+
|
|
32
|
+
### Patch Changes
|
|
33
|
+
|
|
34
|
+
- [`cb2392f6d33`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cb2392f6d33) - Upgrade to TypeScript 4.2.4
|
|
35
|
+
- Updated dependencies
|
|
36
|
+
|
|
3
37
|
## 15.0.0
|
|
4
38
|
|
|
5
39
|
### Major Changes
|
package/constants/package.json
CHANGED
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "MediaStoreError", {
|
|
|
12
12
|
return _error.MediaStoreError;
|
|
13
13
|
}
|
|
14
14
|
});
|
|
15
|
+
exports.getMediaRegion = exports.getMediaEnvironment = void 0;
|
|
15
16
|
Object.defineProperty(exports, "isMediaStoreError", {
|
|
16
17
|
enumerable: true,
|
|
17
18
|
get: function get() {
|
|
@@ -45,6 +46,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
45
46
|
|
|
46
47
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
47
48
|
|
|
49
|
+
var MEDIA_API_REGION = 'media-api-region';
|
|
48
50
|
var defaultImageOptions = {
|
|
49
51
|
'max-age': _constants.FILE_CACHE_MAX_AGE,
|
|
50
52
|
allowAnimated: true,
|
|
@@ -67,6 +69,7 @@ var jsonHeaders = {
|
|
|
67
69
|
Accept: 'application/json',
|
|
68
70
|
'Content-Type': 'application/json'
|
|
69
71
|
};
|
|
72
|
+
var mediaEnvironment;
|
|
70
73
|
|
|
71
74
|
var MediaStore = /*#__PURE__*/function () {
|
|
72
75
|
function MediaStore(config, featureFlags) {
|
|
@@ -700,9 +703,10 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
700
703
|
case 8:
|
|
701
704
|
response = _context11.sent;
|
|
702
705
|
updateMediaRegion(response.headers.get('x-media-region'));
|
|
706
|
+
updateMediaEnvironment(response.headers.get('x-media-env'));
|
|
703
707
|
return _context11.abrupt("return", response);
|
|
704
708
|
|
|
705
|
-
case
|
|
709
|
+
case 12:
|
|
706
710
|
case "end":
|
|
707
711
|
return _context11.stop();
|
|
708
712
|
}
|
|
@@ -727,9 +731,27 @@ function updateMediaRegion(region) {
|
|
|
727
731
|
return;
|
|
728
732
|
}
|
|
729
733
|
|
|
730
|
-
var currentRegion = window.sessionStorage.getItem(
|
|
734
|
+
var currentRegion = window.sessionStorage.getItem(MEDIA_API_REGION);
|
|
731
735
|
|
|
732
736
|
if (currentRegion !== region) {
|
|
733
|
-
window.sessionStorage.setItem(
|
|
737
|
+
window.sessionStorage.setItem(MEDIA_API_REGION, region);
|
|
734
738
|
}
|
|
735
|
-
}
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
var updateMediaEnvironment = function updateMediaEnvironment(mediaEnv) {
|
|
742
|
+
if (mediaEnv) {
|
|
743
|
+
mediaEnvironment = mediaEnv;
|
|
744
|
+
}
|
|
745
|
+
};
|
|
746
|
+
|
|
747
|
+
var getMediaEnvironment = function getMediaEnvironment() {
|
|
748
|
+
return mediaEnvironment;
|
|
749
|
+
};
|
|
750
|
+
|
|
751
|
+
exports.getMediaEnvironment = getMediaEnvironment;
|
|
752
|
+
|
|
753
|
+
var getMediaRegion = function getMediaRegion() {
|
|
754
|
+
return window && window.sessionStorage && window.sessionStorage.getItem(MEDIA_API_REGION) || undefined;
|
|
755
|
+
};
|
|
756
|
+
|
|
757
|
+
exports.getMediaRegion = getMediaRegion;
|
package/dist/cjs/index.js
CHANGED
|
@@ -135,12 +135,6 @@ Object.defineProperty(exports, "getDimensionsFromBlob", {
|
|
|
135
135
|
return _getDimensionsFromBlob.getDimensionsFromBlob;
|
|
136
136
|
}
|
|
137
137
|
});
|
|
138
|
-
Object.defineProperty(exports, "getFileStreamsCache", {
|
|
139
|
-
enumerable: true,
|
|
140
|
-
get: function get() {
|
|
141
|
-
return _fileStreamsCache.getFileStreamsCache;
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
138
|
Object.defineProperty(exports, "getMediaClient", {
|
|
145
139
|
enumerable: true,
|
|
146
140
|
get: function get() {
|
|
@@ -153,6 +147,18 @@ Object.defineProperty(exports, "getMediaClientErrorReason", {
|
|
|
153
147
|
return _errors.getMediaClientErrorReason;
|
|
154
148
|
}
|
|
155
149
|
});
|
|
150
|
+
Object.defineProperty(exports, "getMediaEnvironment", {
|
|
151
|
+
enumerable: true,
|
|
152
|
+
get: function get() {
|
|
153
|
+
return _mediaStore.getMediaEnvironment;
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
Object.defineProperty(exports, "getMediaRegion", {
|
|
157
|
+
enumerable: true,
|
|
158
|
+
get: function get() {
|
|
159
|
+
return _mediaStore.getMediaRegion;
|
|
160
|
+
}
|
|
161
|
+
});
|
|
156
162
|
exports.getMediaTypeFromMimeType = void 0;
|
|
157
163
|
Object.defineProperty(exports, "globalMediaEventEmitter", {
|
|
158
164
|
enumerable: true,
|
package/dist/cjs/uploader.js
CHANGED
|
@@ -156,6 +156,8 @@ var createFileFromUpload = /*#__PURE__*/function () {
|
|
|
156
156
|
}();
|
|
157
157
|
|
|
158
158
|
var uploadFile = function uploadFile(file, store, uploadableFileUpfrontIds, callbacks) {
|
|
159
|
+
var chunkSize = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 4 * 1024 * 1024;
|
|
160
|
+
var processingBatchSize = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1000;
|
|
159
161
|
var content = file.content,
|
|
160
162
|
collection = file.collection;
|
|
161
163
|
var deferredUploadId = uploadableFileUpfrontIds.deferredUploadId;
|
|
@@ -163,11 +165,11 @@ var uploadFile = function uploadFile(file, store, uploadableFileUpfrontIds, call
|
|
|
163
165
|
hashingFunction: hashingFunction,
|
|
164
166
|
hashingConcurrency: 5,
|
|
165
167
|
probingBatchSize: 100,
|
|
166
|
-
chunkSize:
|
|
168
|
+
chunkSize: chunkSize,
|
|
167
169
|
uploadingConcurrency: 3,
|
|
168
170
|
uploadingFunction: createUploadingFunction(store, collection),
|
|
169
171
|
probingFunction: createProbingFunction(store, collection),
|
|
170
|
-
processingBatchSize:
|
|
172
|
+
processingBatchSize: processingBatchSize,
|
|
171
173
|
processingFunction: createProcessingFunction(store, deferredUploadId, collection)
|
|
172
174
|
}, {
|
|
173
175
|
onProgress: function onProgress(progress) {
|
|
@@ -14,7 +14,6 @@ exports.createProcessFetchResponse = createProcessFetchResponse;
|
|
|
14
14
|
exports.createRequestErrorFromResponse = createRequestErrorFromResponse;
|
|
15
15
|
exports.createRequestErrorReason = createRequestErrorReason;
|
|
16
16
|
exports.createUrl = createUrl;
|
|
17
|
-
exports.extract = extract;
|
|
18
17
|
exports.fetchRetry = fetchRetry;
|
|
19
18
|
exports.isAbortedRequestError = isAbortedRequestError;
|
|
20
19
|
exports.isFetchNetworkError = isFetchNetworkError;
|
|
@@ -30,12 +29,14 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
|
|
|
30
29
|
|
|
31
30
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
32
31
|
|
|
32
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
33
|
+
|
|
34
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
35
|
+
|
|
33
36
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
34
37
|
|
|
35
38
|
var _mediaCore = require("@atlaskit/media-core");
|
|
36
39
|
|
|
37
|
-
var _queryString = require("query-string");
|
|
38
|
-
|
|
39
40
|
var _authQueryParameters = require("../../models/auth-query-parameters");
|
|
40
41
|
|
|
41
42
|
var _errors = require("./errors");
|
|
@@ -69,21 +70,6 @@ function isRateLimitedError(error) {
|
|
|
69
70
|
return !!error && (0, _errors.isRequestError)(error) && error.attributes.statusCode === 429 || !!error && !!error.message && error.message.includes('429');
|
|
70
71
|
}
|
|
71
72
|
|
|
72
|
-
function extract(url) {
|
|
73
|
-
var index = url.indexOf('?');
|
|
74
|
-
|
|
75
|
-
if (index > 0) {
|
|
76
|
-
return {
|
|
77
|
-
baseUrl: url.substring(0, index),
|
|
78
|
-
queryParams: (0, _queryString.parse)(url.substring(index + 1, url.length))
|
|
79
|
-
};
|
|
80
|
-
} else {
|
|
81
|
-
return {
|
|
82
|
-
baseUrl: url
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
73
|
function mapAuthToRequestHeaders(auth) {
|
|
88
74
|
if ((0, _mediaCore.isClientBasedAuth)(auth)) {
|
|
89
75
|
return {
|
|
@@ -101,15 +87,24 @@ function mapAuthToRequestHeaders(auth) {
|
|
|
101
87
|
function createUrl(url, _ref) {
|
|
102
88
|
var params = _ref.params,
|
|
103
89
|
auth = _ref.auth;
|
|
90
|
+
var parsedUrl = new URL(url);
|
|
91
|
+
var authParams = auth && (0, _authQueryParameters.mapAuthToQueryParameters)(auth) || {};
|
|
104
92
|
|
|
105
|
-
var
|
|
106
|
-
baseUrl = _extract.baseUrl,
|
|
107
|
-
queryParams = _extract.queryParams;
|
|
93
|
+
var paramsToAppend = _objectSpread(_objectSpread({}, params), authParams);
|
|
108
94
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
95
|
+
Object.entries(paramsToAppend).filter(function (_ref2) {
|
|
96
|
+
var _ref3 = (0, _slicedToArray2.default)(_ref2, 2),
|
|
97
|
+
_ = _ref3[0],
|
|
98
|
+
value = _ref3[1];
|
|
99
|
+
|
|
100
|
+
return value != null;
|
|
101
|
+
}).forEach(function (pair) {
|
|
102
|
+
var _parsedUrl$searchPara;
|
|
103
|
+
|
|
104
|
+
(_parsedUrl$searchPara = parsedUrl.searchParams).append.apply(_parsedUrl$searchPara, (0, _toConsumableArray2.default)(pair));
|
|
105
|
+
});
|
|
106
|
+
parsedUrl.searchParams.sort();
|
|
107
|
+
return parsedUrl.toString();
|
|
113
108
|
}
|
|
114
109
|
|
|
115
110
|
function withAuth(auth) {
|
|
@@ -217,7 +212,7 @@ function mapResponseToVoid() {
|
|
|
217
212
|
|
|
218
213
|
function createMapResponseToJson(metadata) {
|
|
219
214
|
return /*#__PURE__*/function () {
|
|
220
|
-
var
|
|
215
|
+
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(response) {
|
|
221
216
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
222
217
|
while (1) {
|
|
223
218
|
switch (_context.prev = _context.next) {
|
|
@@ -245,14 +240,14 @@ function createMapResponseToJson(metadata) {
|
|
|
245
240
|
}));
|
|
246
241
|
|
|
247
242
|
return function (_x3) {
|
|
248
|
-
return
|
|
243
|
+
return _ref4.apply(this, arguments);
|
|
249
244
|
};
|
|
250
245
|
}();
|
|
251
246
|
}
|
|
252
247
|
|
|
253
248
|
function createMapResponseToBlob(metadata) {
|
|
254
249
|
return /*#__PURE__*/function () {
|
|
255
|
-
var
|
|
250
|
+
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(response) {
|
|
256
251
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
257
252
|
while (1) {
|
|
258
253
|
switch (_context2.prev = _context2.next) {
|
|
@@ -280,7 +275,7 @@ function createMapResponseToBlob(metadata) {
|
|
|
280
275
|
}));
|
|
281
276
|
|
|
282
277
|
return function (_x4) {
|
|
283
|
-
return
|
|
278
|
+
return _ref5.apply(this, arguments);
|
|
284
279
|
};
|
|
285
280
|
}();
|
|
286
281
|
}
|
|
@@ -329,7 +324,7 @@ function _fetchRetry() {
|
|
|
329
324
|
timeoutInMs = startTimeoutInMs;
|
|
330
325
|
|
|
331
326
|
waitAndBumpTimeout = /*#__PURE__*/function () {
|
|
332
|
-
var
|
|
327
|
+
var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
333
328
|
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
334
329
|
while (1) {
|
|
335
330
|
switch (_context5.prev = _context5.next) {
|
|
@@ -350,7 +345,7 @@ function _fetchRetry() {
|
|
|
350
345
|
}));
|
|
351
346
|
|
|
352
347
|
return function waitAndBumpTimeout() {
|
|
353
|
-
return
|
|
348
|
+
return _ref6.apply(this, arguments);
|
|
354
349
|
};
|
|
355
350
|
}();
|
|
356
351
|
|
package/dist/cjs/version.json
CHANGED
|
@@ -5,6 +5,7 @@ import { request } from '../../utils/request';
|
|
|
5
5
|
import { createUrl, createMapResponseToJson, createMapResponseToBlob } from '../../utils/request/helpers';
|
|
6
6
|
import { resolveAuth, resolveInitialAuth } from './resolveAuth';
|
|
7
7
|
export { MediaStoreError, isMediaStoreError } from './error';
|
|
8
|
+
const MEDIA_API_REGION = 'media-api-region';
|
|
8
9
|
const defaultImageOptions = {
|
|
9
10
|
'max-age': FILE_CACHE_MAX_AGE,
|
|
10
11
|
allowAnimated: true,
|
|
@@ -29,6 +30,7 @@ const jsonHeaders = {
|
|
|
29
30
|
Accept: 'application/json',
|
|
30
31
|
'Content-Type': 'application/json'
|
|
31
32
|
};
|
|
33
|
+
let mediaEnvironment;
|
|
32
34
|
export class MediaStore {
|
|
33
35
|
constructor(config, featureFlags) {
|
|
34
36
|
_defineProperty(this, "resolveAuth", authContext => resolveAuth(this.config.authProvider, authContext));
|
|
@@ -374,6 +376,7 @@ export class MediaStore {
|
|
|
374
376
|
clientOptions
|
|
375
377
|
}, controller);
|
|
376
378
|
updateMediaRegion(response.headers.get('x-media-region'));
|
|
379
|
+
updateMediaEnvironment(response.headers.get('x-media-env'));
|
|
377
380
|
return response;
|
|
378
381
|
}
|
|
379
382
|
|
|
@@ -384,9 +387,22 @@ function updateMediaRegion(region) {
|
|
|
384
387
|
return;
|
|
385
388
|
}
|
|
386
389
|
|
|
387
|
-
const currentRegion = window.sessionStorage.getItem(
|
|
390
|
+
const currentRegion = window.sessionStorage.getItem(MEDIA_API_REGION);
|
|
388
391
|
|
|
389
392
|
if (currentRegion !== region) {
|
|
390
|
-
window.sessionStorage.setItem(
|
|
393
|
+
window.sessionStorage.setItem(MEDIA_API_REGION, region);
|
|
391
394
|
}
|
|
392
|
-
}
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
const updateMediaEnvironment = mediaEnv => {
|
|
398
|
+
if (mediaEnv) {
|
|
399
|
+
mediaEnvironment = mediaEnv;
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
export const getMediaEnvironment = () => {
|
|
404
|
+
return mediaEnvironment;
|
|
405
|
+
};
|
|
406
|
+
export const getMediaRegion = () => {
|
|
407
|
+
return window && window.sessionStorage && window.sessionStorage.getItem(MEDIA_API_REGION) || undefined;
|
|
408
|
+
};
|
package/dist/es2019/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { MediaStore, MediaStoreError, isMediaStoreError } from './client/media-store';
|
|
1
|
+
export { MediaStore, MediaStoreError, isMediaStoreError, getMediaEnvironment, getMediaRegion } from './client/media-store';
|
|
2
2
|
export { UploadController } from './upload-controller';
|
|
3
3
|
export { isPreviewableType, isMediaCollectionItemFullDetails } from './models/media';
|
|
4
4
|
export { getArtifactUrl } from './models/artifacts';
|
|
5
5
|
export { isMediaClientError, getMediaClientErrorReason } from './models/errors';
|
|
6
6
|
export { isUploadingFileState, isProcessingFileState, isProcessedFileState, isErrorFileState, isPreviewableFileState, isFinalFileState, isImageRepresentationReady, mapMediaFileToFileState, mapMediaItemToFileState } from './models/file-state';
|
|
7
7
|
// TODO: remove access to media file stream cache https://product-fabric.atlassian.net/browse/MEX-1417
|
|
8
|
-
export {
|
|
8
|
+
export { StreamsCache } from './file-streams-cache';
|
|
9
9
|
export { uploadFile } from './uploader';
|
|
10
10
|
export { request, RequestError, isRequestError, isRateLimitedError } from './utils/request';
|
|
11
11
|
export { isAbortedRequestError, mapResponseToJson, mapResponseToBlob, mapResponseToVoid, createUrl } from './utils/request/helpers';
|
package/dist/es2019/uploader.js
CHANGED
|
@@ -50,7 +50,7 @@ const createFileFromUpload = async (file, store, uploadableFileUpfrontIds, uploa
|
|
|
50
50
|
});
|
|
51
51
|
};
|
|
52
52
|
|
|
53
|
-
export const uploadFile = (file, store, uploadableFileUpfrontIds, callbacks) => {
|
|
53
|
+
export const uploadFile = (file, store, uploadableFileUpfrontIds, callbacks, chunkSize = 4 * 1024 * 1024, processingBatchSize = 1000) => {
|
|
54
54
|
const {
|
|
55
55
|
content,
|
|
56
56
|
collection
|
|
@@ -62,11 +62,11 @@ export const uploadFile = (file, store, uploadableFileUpfrontIds, callbacks) =>
|
|
|
62
62
|
hashingFunction,
|
|
63
63
|
hashingConcurrency: 5,
|
|
64
64
|
probingBatchSize: 100,
|
|
65
|
-
chunkSize
|
|
65
|
+
chunkSize,
|
|
66
66
|
uploadingConcurrency: 3,
|
|
67
67
|
uploadingFunction: createUploadingFunction(store, collection),
|
|
68
68
|
probingFunction: createProbingFunction(store, collection),
|
|
69
|
-
processingBatchSize
|
|
69
|
+
processingBatchSize,
|
|
70
70
|
processingFunction: createProcessingFunction(store, deferredUploadId, collection)
|
|
71
71
|
}, {
|
|
72
72
|
onProgress(progress) {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { isClientBasedAuth } from '@atlaskit/media-core';
|
|
2
|
-
import { parse, stringify } from 'query-string';
|
|
3
2
|
import { mapAuthToQueryParameters } from '../../models/auth-query-parameters';
|
|
4
3
|
import { RequestError, isRequestError } from './errors';
|
|
5
4
|
export function clientTimeoutPromise(timeout) {
|
|
@@ -20,20 +19,6 @@ export function isFetchNetworkError(err) {
|
|
|
20
19
|
export function isRateLimitedError(error) {
|
|
21
20
|
return !!error && isRequestError(error) && error.attributes.statusCode === 429 || !!error && !!error.message && error.message.includes('429');
|
|
22
21
|
}
|
|
23
|
-
export function extract(url) {
|
|
24
|
-
const index = url.indexOf('?');
|
|
25
|
-
|
|
26
|
-
if (index > 0) {
|
|
27
|
-
return {
|
|
28
|
-
baseUrl: url.substring(0, index),
|
|
29
|
-
queryParams: parse(url.substring(index + 1, url.length))
|
|
30
|
-
};
|
|
31
|
-
} else {
|
|
32
|
-
return {
|
|
33
|
-
baseUrl: url
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
22
|
export function mapAuthToRequestHeaders(auth) {
|
|
38
23
|
if (isClientBasedAuth(auth)) {
|
|
39
24
|
return {
|
|
@@ -51,17 +36,16 @@ export function createUrl(url, {
|
|
|
51
36
|
params,
|
|
52
37
|
auth
|
|
53
38
|
}) {
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
} = extract(url);
|
|
58
|
-
const authParams = auth && mapAuthToQueryParameters(auth);
|
|
59
|
-
const queryString = stringify({ ...queryParams,
|
|
60
|
-
...params,
|
|
39
|
+
const parsedUrl = new URL(url);
|
|
40
|
+
const authParams = auth && mapAuthToQueryParameters(auth) || {};
|
|
41
|
+
const paramsToAppend = { ...params,
|
|
61
42
|
...authParams
|
|
43
|
+
};
|
|
44
|
+
Object.entries(paramsToAppend).filter(([_, value]) => value != null).forEach(pair => {
|
|
45
|
+
parsedUrl.searchParams.append(...pair);
|
|
62
46
|
});
|
|
63
|
-
|
|
64
|
-
return
|
|
47
|
+
parsedUrl.searchParams.sort();
|
|
48
|
+
return parsedUrl.toString();
|
|
65
49
|
}
|
|
66
50
|
export function withAuth(auth) {
|
|
67
51
|
return headers => {
|
package/dist/es2019/version.json
CHANGED
|
@@ -14,6 +14,7 @@ import { request as _request } from '../../utils/request';
|
|
|
14
14
|
import { createUrl, createMapResponseToJson, createMapResponseToBlob } from '../../utils/request/helpers';
|
|
15
15
|
import { resolveAuth, resolveInitialAuth } from './resolveAuth';
|
|
16
16
|
export { MediaStoreError, isMediaStoreError } from './error';
|
|
17
|
+
var MEDIA_API_REGION = 'media-api-region';
|
|
17
18
|
var defaultImageOptions = {
|
|
18
19
|
'max-age': FILE_CACHE_MAX_AGE,
|
|
19
20
|
allowAnimated: true,
|
|
@@ -36,6 +37,7 @@ var jsonHeaders = {
|
|
|
36
37
|
Accept: 'application/json',
|
|
37
38
|
'Content-Type': 'application/json'
|
|
38
39
|
};
|
|
40
|
+
var mediaEnvironment;
|
|
39
41
|
export var MediaStore = /*#__PURE__*/function () {
|
|
40
42
|
function MediaStore(config, featureFlags) {
|
|
41
43
|
var _this = this;
|
|
@@ -671,9 +673,10 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
671
673
|
case 8:
|
|
672
674
|
response = _context11.sent;
|
|
673
675
|
updateMediaRegion(response.headers.get('x-media-region'));
|
|
676
|
+
updateMediaEnvironment(response.headers.get('x-media-env'));
|
|
674
677
|
return _context11.abrupt("return", response);
|
|
675
678
|
|
|
676
|
-
case
|
|
679
|
+
case 12:
|
|
677
680
|
case "end":
|
|
678
681
|
return _context11.stop();
|
|
679
682
|
}
|
|
@@ -697,9 +700,22 @@ function updateMediaRegion(region) {
|
|
|
697
700
|
return;
|
|
698
701
|
}
|
|
699
702
|
|
|
700
|
-
var currentRegion = window.sessionStorage.getItem(
|
|
703
|
+
var currentRegion = window.sessionStorage.getItem(MEDIA_API_REGION);
|
|
701
704
|
|
|
702
705
|
if (currentRegion !== region) {
|
|
703
|
-
window.sessionStorage.setItem(
|
|
706
|
+
window.sessionStorage.setItem(MEDIA_API_REGION, region);
|
|
704
707
|
}
|
|
705
|
-
}
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
var updateMediaEnvironment = function updateMediaEnvironment(mediaEnv) {
|
|
711
|
+
if (mediaEnv) {
|
|
712
|
+
mediaEnvironment = mediaEnv;
|
|
713
|
+
}
|
|
714
|
+
};
|
|
715
|
+
|
|
716
|
+
export var getMediaEnvironment = function getMediaEnvironment() {
|
|
717
|
+
return mediaEnvironment;
|
|
718
|
+
};
|
|
719
|
+
export var getMediaRegion = function getMediaRegion() {
|
|
720
|
+
return window && window.sessionStorage && window.sessionStorage.getItem(MEDIA_API_REGION) || undefined;
|
|
721
|
+
};
|
package/dist/esm/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { MediaStore, MediaStoreError, isMediaStoreError } from './client/media-store';
|
|
1
|
+
export { MediaStore, MediaStoreError, isMediaStoreError, getMediaEnvironment, getMediaRegion } from './client/media-store';
|
|
2
2
|
export { UploadController } from './upload-controller';
|
|
3
3
|
export { isPreviewableType, isMediaCollectionItemFullDetails } from './models/media';
|
|
4
4
|
export { getArtifactUrl } from './models/artifacts';
|
|
5
5
|
export { isMediaClientError, getMediaClientErrorReason } from './models/errors';
|
|
6
6
|
export { isUploadingFileState, isProcessingFileState, isProcessedFileState, isErrorFileState, isPreviewableFileState, isFinalFileState, isImageRepresentationReady, mapMediaFileToFileState, mapMediaItemToFileState } from './models/file-state';
|
|
7
7
|
// TODO: remove access to media file stream cache https://product-fabric.atlassian.net/browse/MEX-1417
|
|
8
|
-
export {
|
|
8
|
+
export { StreamsCache } from './file-streams-cache';
|
|
9
9
|
export { uploadFile } from './uploader';
|
|
10
10
|
export { request, RequestError, isRequestError, isRateLimitedError } from './utils/request';
|
|
11
11
|
export { isAbortedRequestError, mapResponseToJson, mapResponseToBlob, mapResponseToVoid, createUrl } from './utils/request/helpers';
|
package/dist/esm/uploader.js
CHANGED
|
@@ -142,6 +142,8 @@ var createFileFromUpload = /*#__PURE__*/function () {
|
|
|
142
142
|
}();
|
|
143
143
|
|
|
144
144
|
export var uploadFile = function uploadFile(file, store, uploadableFileUpfrontIds, callbacks) {
|
|
145
|
+
var chunkSize = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 4 * 1024 * 1024;
|
|
146
|
+
var processingBatchSize = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1000;
|
|
145
147
|
var content = file.content,
|
|
146
148
|
collection = file.collection;
|
|
147
149
|
var deferredUploadId = uploadableFileUpfrontIds.deferredUploadId;
|
|
@@ -149,11 +151,11 @@ export var uploadFile = function uploadFile(file, store, uploadableFileUpfrontId
|
|
|
149
151
|
hashingFunction: hashingFunction,
|
|
150
152
|
hashingConcurrency: 5,
|
|
151
153
|
probingBatchSize: 100,
|
|
152
|
-
chunkSize:
|
|
154
|
+
chunkSize: chunkSize,
|
|
153
155
|
uploadingConcurrency: 3,
|
|
154
156
|
uploadingFunction: createUploadingFunction(store, collection),
|
|
155
157
|
probingFunction: createProbingFunction(store, collection),
|
|
156
|
-
processingBatchSize:
|
|
158
|
+
processingBatchSize: processingBatchSize,
|
|
157
159
|
processingFunction: createProcessingFunction(store, deferredUploadId, collection)
|
|
158
160
|
}, {
|
|
159
161
|
onProgress: function onProgress(progress) {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
4
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
5
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
6
|
|
|
5
7
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -7,7 +9,6 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
7
9
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
8
10
|
|
|
9
11
|
import { isClientBasedAuth } from '@atlaskit/media-core';
|
|
10
|
-
import { parse, stringify } from 'query-string';
|
|
11
12
|
import { mapAuthToQueryParameters } from '../../models/auth-query-parameters';
|
|
12
13
|
import { RequestError, isRequestError } from './errors';
|
|
13
14
|
export function clientTimeoutPromise(timeout) {
|
|
@@ -30,20 +31,6 @@ export function isFetchNetworkError(err) {
|
|
|
30
31
|
export function isRateLimitedError(error) {
|
|
31
32
|
return !!error && isRequestError(error) && error.attributes.statusCode === 429 || !!error && !!error.message && error.message.includes('429');
|
|
32
33
|
}
|
|
33
|
-
export function extract(url) {
|
|
34
|
-
var index = url.indexOf('?');
|
|
35
|
-
|
|
36
|
-
if (index > 0) {
|
|
37
|
-
return {
|
|
38
|
-
baseUrl: url.substring(0, index),
|
|
39
|
-
queryParams: parse(url.substring(index + 1, url.length))
|
|
40
|
-
};
|
|
41
|
-
} else {
|
|
42
|
-
return {
|
|
43
|
-
baseUrl: url
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
34
|
export function mapAuthToRequestHeaders(auth) {
|
|
48
35
|
if (isClientBasedAuth(auth)) {
|
|
49
36
|
return {
|
|
@@ -60,15 +47,24 @@ export function mapAuthToRequestHeaders(auth) {
|
|
|
60
47
|
export function createUrl(url, _ref) {
|
|
61
48
|
var params = _ref.params,
|
|
62
49
|
auth = _ref.auth;
|
|
50
|
+
var parsedUrl = new URL(url);
|
|
51
|
+
var authParams = auth && mapAuthToQueryParameters(auth) || {};
|
|
52
|
+
|
|
53
|
+
var paramsToAppend = _objectSpread(_objectSpread({}, params), authParams);
|
|
63
54
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
55
|
+
Object.entries(paramsToAppend).filter(function (_ref2) {
|
|
56
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
57
|
+
_ = _ref3[0],
|
|
58
|
+
value = _ref3[1];
|
|
67
59
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
60
|
+
return value != null;
|
|
61
|
+
}).forEach(function (pair) {
|
|
62
|
+
var _parsedUrl$searchPara;
|
|
63
|
+
|
|
64
|
+
(_parsedUrl$searchPara = parsedUrl.searchParams).append.apply(_parsedUrl$searchPara, _toConsumableArray(pair));
|
|
65
|
+
});
|
|
66
|
+
parsedUrl.searchParams.sort();
|
|
67
|
+
return parsedUrl.toString();
|
|
72
68
|
}
|
|
73
69
|
export function withAuth(auth) {
|
|
74
70
|
return function (headers) {
|
|
@@ -171,7 +167,7 @@ export function mapResponseToVoid() {
|
|
|
171
167
|
}
|
|
172
168
|
export function createMapResponseToJson(metadata) {
|
|
173
169
|
return /*#__PURE__*/function () {
|
|
174
|
-
var
|
|
170
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(response) {
|
|
175
171
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
176
172
|
while (1) {
|
|
177
173
|
switch (_context.prev = _context.next) {
|
|
@@ -199,13 +195,13 @@ export function createMapResponseToJson(metadata) {
|
|
|
199
195
|
}));
|
|
200
196
|
|
|
201
197
|
return function (_x3) {
|
|
202
|
-
return
|
|
198
|
+
return _ref4.apply(this, arguments);
|
|
203
199
|
};
|
|
204
200
|
}();
|
|
205
201
|
}
|
|
206
202
|
export function createMapResponseToBlob(metadata) {
|
|
207
203
|
return /*#__PURE__*/function () {
|
|
208
|
-
var
|
|
204
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(response) {
|
|
209
205
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
210
206
|
while (1) {
|
|
211
207
|
switch (_context2.prev = _context2.next) {
|
|
@@ -233,7 +229,7 @@ export function createMapResponseToBlob(metadata) {
|
|
|
233
229
|
}));
|
|
234
230
|
|
|
235
231
|
return function (_x4) {
|
|
236
|
-
return
|
|
232
|
+
return _ref5.apply(this, arguments);
|
|
237
233
|
};
|
|
238
234
|
}();
|
|
239
235
|
}
|
|
@@ -278,7 +274,7 @@ function _fetchRetry() {
|
|
|
278
274
|
timeoutInMs = startTimeoutInMs;
|
|
279
275
|
|
|
280
276
|
waitAndBumpTimeout = /*#__PURE__*/function () {
|
|
281
|
-
var
|
|
277
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
282
278
|
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
283
279
|
while (1) {
|
|
284
280
|
switch (_context5.prev = _context5.next) {
|
|
@@ -299,7 +295,7 @@ function _fetchRetry() {
|
|
|
299
295
|
}));
|
|
300
296
|
|
|
301
297
|
return function waitAndBumpTimeout() {
|
|
302
|
-
return
|
|
298
|
+
return _ref6.apply(this, arguments);
|
|
303
299
|
};
|
|
304
300
|
}();
|
|
305
301
|
|
package/dist/esm/version.json
CHANGED
|
@@ -33,6 +33,8 @@ export declare class MediaStore {
|
|
|
33
33
|
resolveAuth: (authContext?: AuthContext | undefined) => Promise<Auth>;
|
|
34
34
|
resolveInitialAuth: () => Auth;
|
|
35
35
|
}
|
|
36
|
+
export declare const getMediaEnvironment: () => string | undefined;
|
|
37
|
+
export declare const getMediaRegion: () => string | undefined;
|
|
36
38
|
export interface ResponseFileItem {
|
|
37
39
|
id: string;
|
|
38
40
|
type: 'file';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Auth, AuthContext, AuthProvider } from '@atlaskit/media-core';
|
|
2
2
|
export declare const DEFAULT_AUTH_PROVIDER_TIMEOUT = 10000;
|
|
3
3
|
export declare const resolveAuth: (authProvider: AuthProvider, authContext?: AuthContext | undefined, authProviderTimeout?: number) => Promise<Auth>;
|
|
4
|
-
export declare const resolveInitialAuth: (auth?:
|
|
4
|
+
export declare const resolveInitialAuth: (auth?: Auth | undefined) => Auth;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UploadEventPayloadMap, EventPayloadListener } from './client/events';
|
|
2
2
|
export declare const globalMediaEventEmitter: {
|
|
3
|
-
on<E extends
|
|
4
|
-
off<E_1 extends
|
|
5
|
-
emit<E_2 extends
|
|
3
|
+
on<E extends keyof UploadEventPayloadMap>(event: E, listener: EventPayloadListener<UploadEventPayloadMap, E, any>): void;
|
|
4
|
+
off<E_1 extends keyof UploadEventPayloadMap>(event: E_1, listener: EventPayloadListener<UploadEventPayloadMap, E_1, any>): void;
|
|
5
|
+
emit<E_2 extends keyof UploadEventPayloadMap>(event: E_2, payload: UploadEventPayloadMap[E_2]): boolean | undefined;
|
|
6
6
|
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { MediaStore, MediaStoreError, isMediaStoreError, } from './client/media-store';
|
|
1
|
+
export { MediaStore, MediaStoreError, isMediaStoreError, getMediaEnvironment, getMediaRegion, } from './client/media-store';
|
|
2
2
|
export type { ResponseFileItem, ItemsPayload, ImageMetadataArtifact, ImageMetadata, MediaStoreResponse, MediaStoreRequestOptions, MediaStoreCreateFileFromUploadParams, MediaStoreCreateFileParams, MediaStoreTouchFileParams, TouchFileDescriptor, MediaStoreTouchFileBody, MediaStoreCreateFileFromBinaryParams, MediaStoreCreateFileFromUploadConditions, MediaStoreCreateFileFromUploadBody, MediaStoreGetFileParams, MediaStoreGetFileImageParams, MediaStoreGetCollectionItemsParams, SourceFile, MediaStoreCopyFileWithTokenBody, MediaStoreCopyFileWithTokenParams, AppendChunksToUploadRequestBody, CreatedTouchedFile, TouchedFiles, EmptyFile, MediaStoreErrorReason, MediaStoreErrorAttributes, } from './client/media-store';
|
|
3
3
|
export { UploadController } from './upload-controller';
|
|
4
4
|
export type { AbortFunction } from './upload-controller';
|
|
@@ -13,7 +13,7 @@ export type { MediaClientError, MediaClientErrorReason, MediaClientErrorAttribut
|
|
|
13
13
|
export { isUploadingFileState, isProcessingFileState, isProcessedFileState, isErrorFileState, isPreviewableFileState, isFinalFileState, isImageRepresentationReady, mapMediaFileToFileState, mapMediaItemToFileState, } from './models/file-state';
|
|
14
14
|
export type { FileStatus, FilePreview, PreviewOptions, GetFileOptions, UploadingFileState, ProcessingFileState, ProcessedFileState, ProcessingFailedState, ErrorFileState, NonErrorFileState, PreviewableFileState, FileState, } from './models/file-state';
|
|
15
15
|
export type { MobileUploadStartEvent, MobileUploadProgressEvent, MobileUploadEndEvent, MobileUploadErrorEvent, } from './models/mobile-upload';
|
|
16
|
-
export {
|
|
16
|
+
export { StreamsCache } from './file-streams-cache';
|
|
17
17
|
export { uploadFile } from './uploader';
|
|
18
18
|
export type { UploadableFile, UploadableFileUpfrontIds, UploadFileCallbacks, UploadFileResult, } from './uploader';
|
|
19
19
|
export { request, RequestError, isRequestError, isRateLimitedError, } from './utils/request';
|
|
@@ -41,7 +41,7 @@ export { isFileIdentifier, isExternalImageIdentifier, isDifferentIdentifier, } f
|
|
|
41
41
|
export type { Identifier, FileIdentifier, ExternalImageIdentifier, } from './identifier';
|
|
42
42
|
export type { EventPayloadListener, UploadEventPayloadMap, MediaViewedEventPayload, } from './client/events';
|
|
43
43
|
export { withMediaClient, getMediaClient } from './utils/with-media-client-hoc';
|
|
44
|
-
export type { WithMediaClientConfig, WithMediaClientConfigProps, WithMediaClientFunction, } from './utils/with-media-client-hoc';
|
|
44
|
+
export type { WithMediaClientConfig, WithMediaClientConfigProps, WithMediaClientFunction, WithMediaClient, } from './utils/with-media-client-hoc';
|
|
45
45
|
export { globalMediaEventEmitter } from './globalMediaEventEmitter';
|
|
46
46
|
export { isMediaBlobUrl, getAttrsFromUrl, addFileAttrsToUrl, objectToQueryString, } from './utils/url';
|
|
47
47
|
export type { MediaBlobUrlAttrs } from './utils/url';
|
|
@@ -84,7 +84,7 @@ export declare const isUploadingFileState: (fileState: FileState) => fileState i
|
|
|
84
84
|
export declare const isProcessingFileState: (fileState: FileState) => fileState is ProcessingFileState;
|
|
85
85
|
export declare const isProcessedFileState: (fileState: FileState) => fileState is ProcessedFileState;
|
|
86
86
|
export declare const isErrorFileState: (fileState: FileState) => fileState is ErrorFileState;
|
|
87
|
-
export declare const isPreviewableFileState: (fileState: FileState) => fileState is (UploadingFileState
|
|
87
|
+
export declare const isPreviewableFileState: (fileState: FileState) => fileState is (UploadingFileState | ProcessingFileState | ProcessedFileState | ProcessingFailedState) & PreviewableFileState;
|
|
88
88
|
export declare const isFinalFileState: (fileState: FileState) => fileState is ProcessedFileState | ProcessingFailedState | ErrorFileState;
|
|
89
89
|
export declare const isImageRepresentationReady: (fileState: FileState) => boolean;
|
|
90
90
|
export declare const mapMediaFileToFileState: (mediaFile: MediaStoreResponse<MediaFile>) => FileState;
|
package/dist/types/uploader.d.ts
CHANGED
|
@@ -18,4 +18,4 @@ export declare type UploadFileCallbacks = {
|
|
|
18
18
|
export interface UploadFileResult {
|
|
19
19
|
cancel: () => void;
|
|
20
20
|
}
|
|
21
|
-
export declare const uploadFile: (file: UploadableFile, store: MediaStore, uploadableFileUpfrontIds: UploadableFileUpfrontIds, callbacks?: UploadFileCallbacks | undefined) => UploadFileResult;
|
|
21
|
+
export declare const uploadFile: (file: UploadableFile, store: MediaStore, uploadableFileUpfrontIds: UploadableFileUpfrontIds, callbacks?: UploadFileCallbacks | undefined, chunkSize?: number, processingBatchSize?: number) => UploadFileResult;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { MediaStoreGetFileImageParams } from '../client/media-store';
|
|
2
2
|
export declare type ImageResizeMode = 'crop' | 'fit' | 'full-fit' | 'stretchy-fit';
|
|
3
|
-
export declare const imageResizeModeToFileImageMode: (resizeMode?:
|
|
3
|
+
export declare const imageResizeModeToFileImageMode: (resizeMode?: ImageResizeMode | undefined) => MediaStoreGetFileImageParams['mode'];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FileState } from '../models/file-state';
|
|
2
2
|
import { MediaType } from '../models/media';
|
|
3
|
-
export declare const overrideMediaTypeIfUnknown: (fileState: FileState, mediaType?:
|
|
4
|
-
mediaType?:
|
|
3
|
+
export declare const overrideMediaTypeIfUnknown: (fileState: FileState, mediaType?: MediaType | undefined) => {
|
|
4
|
+
mediaType?: MediaType | undefined;
|
|
5
5
|
};
|
|
@@ -7,7 +7,7 @@ export declare class RequestError extends BaseMediaClientError<RequestErrorAttri
|
|
|
7
7
|
constructor(reason: RequestErrorReason, metadata?: RequestErrorMetadata | undefined, innerError?: Error | undefined);
|
|
8
8
|
get attributes(): {
|
|
9
9
|
reason: RequestErrorReason;
|
|
10
|
-
method: "
|
|
10
|
+
method: import("./types").RequestMethod | undefined;
|
|
11
11
|
endpoint: string | undefined;
|
|
12
12
|
attempts: number | undefined;
|
|
13
13
|
clientExhaustedRetries: boolean | undefined;
|
|
@@ -6,10 +6,6 @@ export declare function waitPromise(timeout: number): Promise<void>;
|
|
|
6
6
|
export declare function isAbortedRequestError(err: any): boolean;
|
|
7
7
|
export declare function isFetchNetworkError(err: any): err is TypeError;
|
|
8
8
|
export declare function isRateLimitedError(error: Error | undefined): boolean;
|
|
9
|
-
export declare function extract(url: string): {
|
|
10
|
-
baseUrl: string;
|
|
11
|
-
queryParams?: any;
|
|
12
|
-
};
|
|
13
9
|
export declare function mapAuthToRequestHeaders(auth: Auth): RequestHeaders;
|
|
14
10
|
export declare function createUrl(url: string, { params, auth }: CreateUrlOptions): string;
|
|
15
11
|
export declare function withAuth(auth?: Auth): (headers?: RequestHeaders | undefined) => RequestHeaders | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-client",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "16.0.0",
|
|
4
4
|
"description": "Media API Web Client Library",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -27,14 +27,13 @@
|
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@atlaskit/chunkinator": "^
|
|
31
|
-
"@atlaskit/media-common": "^2.
|
|
30
|
+
"@atlaskit/chunkinator": "^4.0.0",
|
|
31
|
+
"@atlaskit/media-common": "^2.13.0",
|
|
32
32
|
"@babel/runtime": "^7.0.0",
|
|
33
33
|
"dataloader": "^2.0.0",
|
|
34
34
|
"deep-equal": "^1.0.1",
|
|
35
35
|
"eventemitter2": "^4.1.0",
|
|
36
36
|
"lru-fast": "^0.2.2",
|
|
37
|
-
"query-string": "^6.14.1",
|
|
38
37
|
"rusha": "^0.8.13",
|
|
39
38
|
"rxjs": "^5.5.0",
|
|
40
39
|
"setimmediate": "^1.0.5",
|
|
@@ -44,27 +43,25 @@
|
|
|
44
43
|
"xstate": "^4.20.0"
|
|
45
44
|
},
|
|
46
45
|
"peerDependencies": {
|
|
47
|
-
"@atlaskit/media-core": "^
|
|
46
|
+
"@atlaskit/media-core": "^33.0.0",
|
|
48
47
|
"react": "^16.8.0"
|
|
49
48
|
},
|
|
50
49
|
"devDependencies": {
|
|
51
|
-
"@atlaskit/button": "^16.
|
|
50
|
+
"@atlaskit/button": "^16.3.0",
|
|
52
51
|
"@atlaskit/docs": "*",
|
|
53
|
-
"@atlaskit/media-card": "^73.
|
|
54
|
-
"@atlaskit/media-core": "^
|
|
55
|
-
"@atlaskit/media-test-helpers": "^
|
|
52
|
+
"@atlaskit/media-card": "^73.6.0",
|
|
53
|
+
"@atlaskit/media-core": "^33.0.0",
|
|
54
|
+
"@atlaskit/media-test-helpers": "^30.0.0",
|
|
56
55
|
"@atlaskit/ssr": "*",
|
|
57
56
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
58
57
|
"@types/deep-equal": "^1.0.1",
|
|
59
|
-
"@types/query-string": "^4.3.1",
|
|
60
58
|
"@types/uuid-validate": "^0.0.0",
|
|
61
59
|
"enzyme": "^3.10.0",
|
|
62
60
|
"fetch-mock": "^8.0.0",
|
|
63
|
-
"jest-fetch-mock": "^3.0.3",
|
|
64
61
|
"react": "^16.8.0",
|
|
65
62
|
"react-dom": "^16.8.0",
|
|
66
63
|
"styled-components": "^3.2.6",
|
|
67
|
-
"typescript": "
|
|
64
|
+
"typescript": "4.2.4"
|
|
68
65
|
},
|
|
69
66
|
"resolutions": {
|
|
70
67
|
"lru-fast": "0.2.2"
|