@atlaskit/media-client 20.0.2 → 20.1.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 +16 -0
- package/dist/cjs/client/collection-fetcher.js +14 -89
- package/dist/cjs/client/media-store/index.js +9 -43
- package/dist/cjs/constants.js +1 -1
- package/dist/cjs/utils/deprecatedEndpointError.js +43 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/client/collection-fetcher.js +13 -77
- package/dist/es2019/client/media-store/index.js +7 -39
- package/dist/es2019/constants.js +1 -1
- package/dist/es2019/utils/deprecatedEndpointError.js +20 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/client/collection-fetcher.js +14 -89
- package/dist/esm/client/media-store/index.js +9 -43
- package/dist/esm/constants.js +1 -1
- package/dist/esm/utils/deprecatedEndpointError.js +34 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/client/collection-fetcher.d.ts +8 -2
- package/dist/types/client/media-store/index.d.ts +4 -0
- package/dist/types/models/errors/types.d.ts +1 -1
- package/dist/types/utils/deprecatedEndpointError.d.ts +16 -0
- package/package.json +4 -4
- package/report.api.md +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/media-client
|
|
2
2
|
|
|
3
|
+
## 20.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`894e1910ed4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/894e1910ed4) - Deprecation notice: Media Client and Media Store classes will no longer expose collection items listing methods. They will be removed in the next release
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 20.0.3
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [`4fdaa8a4645`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4fdaa8a4645) - update default chunk size from 4mb to 5mb
|
|
18
|
+
|
|
3
19
|
## 20.0.2
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -6,54 +6,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.collectionCache = exports.CollectionFetcher = void 0;
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
11
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
14
|
-
var _ReplaySubject = require("rxjs/ReplaySubject");
|
|
15
12
|
var _fileStreamsCache = require("../file-streams-cache");
|
|
16
|
-
var
|
|
17
|
-
var _mediaSubscribable = require("../utils/mediaSubscribable");
|
|
18
|
-
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; }
|
|
19
|
-
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; }
|
|
13
|
+
var _deprecatedEndpointError = require("../utils/deprecatedEndpointError");
|
|
20
14
|
var collectionCache = {};
|
|
21
15
|
exports.collectionCache = collectionCache;
|
|
22
|
-
var createCacheEntry = function createCacheEntry() {
|
|
23
|
-
return {
|
|
24
|
-
items: [],
|
|
25
|
-
subject: new _ReplaySubject.ReplaySubject(1),
|
|
26
|
-
isLoadingNextPage: false
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
16
|
var CollectionFetcher = /*#__PURE__*/function () {
|
|
30
17
|
function CollectionFetcher(mediaStore) {
|
|
31
18
|
(0, _classCallCheck2.default)(this, CollectionFetcher);
|
|
32
19
|
this.mediaStore = mediaStore;
|
|
33
20
|
}
|
|
34
21
|
(0, _createClass2.default)(CollectionFetcher, [{
|
|
35
|
-
key: "createFileStateObserver",
|
|
36
|
-
value: function createFileStateObserver(id, details) {
|
|
37
|
-
var subject = new _ReplaySubject.ReplaySubject(1);
|
|
38
|
-
var mediaFile = _objectSpread({
|
|
39
|
-
id: id
|
|
40
|
-
}, details);
|
|
41
|
-
var fileState = (0, _fileState.mapMediaFileToFileState)({
|
|
42
|
-
data: mediaFile
|
|
43
|
-
});
|
|
44
|
-
subject.next(fileState);
|
|
45
|
-
return subject;
|
|
46
|
-
}
|
|
47
|
-
}, {
|
|
48
|
-
key: "populateCache",
|
|
49
|
-
value: function populateCache(items) {
|
|
50
|
-
var _this = this;
|
|
51
|
-
items.forEach(function (item) {
|
|
52
|
-
var fileStream = _this.createFileStateObserver(item.id, item.details);
|
|
53
|
-
(0, _fileStreamsCache.getFileStreamsCache)().set(item.id, fileStream);
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
}, {
|
|
57
22
|
key: "removeFromCache",
|
|
58
23
|
value: function removeFromCache(id, collectionName) {
|
|
59
24
|
var collectionCacheIndex = collectionCache[collectionName].items.findIndex(function (item) {
|
|
@@ -65,31 +30,15 @@ var CollectionFetcher = /*#__PURE__*/function () {
|
|
|
65
30
|
(0, _fileStreamsCache.getFileStreamsCache)().remove(id);
|
|
66
31
|
collectionCache[collectionName].items.splice(collectionCacheIndex, 1);
|
|
67
32
|
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-170 Internal documentation for deprecation (no external access)}
|
|
36
|
+
* This method is no longer working. Will be removed in the next release
|
|
37
|
+
*/
|
|
68
38
|
}, {
|
|
69
39
|
key: "getItems",
|
|
70
40
|
value: function getItems(collectionName, params, traceContext) {
|
|
71
|
-
|
|
72
|
-
if (!collectionCache[collectionName]) {
|
|
73
|
-
collectionCache[collectionName] = createCacheEntry();
|
|
74
|
-
}
|
|
75
|
-
var collection = collectionCache[collectionName];
|
|
76
|
-
var subject = collection.subject;
|
|
77
|
-
this.mediaStore.getCollectionItems(collectionName, _objectSpread(_objectSpread({}, params), {}, {
|
|
78
|
-
details: 'full'
|
|
79
|
-
}), traceContext).then(function (items) {
|
|
80
|
-
var _items$data = items.data,
|
|
81
|
-
contents = _items$data.contents,
|
|
82
|
-
nextInclusiveStartKey = _items$data.nextInclusiveStartKey;
|
|
83
|
-
_this2.populateCache(contents);
|
|
84
|
-
// It's hard to merge two together, so we just take what's came from the server.
|
|
85
|
-
// Since we load only one page > 2 pages will be ditched from the cache.
|
|
86
|
-
collection.items = items.data.contents;
|
|
87
|
-
collection.nextInclusiveStartKey = nextInclusiveStartKey;
|
|
88
|
-
subject.next(collection.items);
|
|
89
|
-
}).catch(function (error) {
|
|
90
|
-
return subject.error(error);
|
|
91
|
-
});
|
|
92
|
-
return (0, _mediaSubscribable.fromObservable)(subject);
|
|
41
|
+
throw new _deprecatedEndpointError.DeprecatedError('collection/:name/items');
|
|
93
42
|
}
|
|
94
43
|
}, {
|
|
95
44
|
key: "removeFile",
|
|
@@ -118,49 +67,25 @@ var CollectionFetcher = /*#__PURE__*/function () {
|
|
|
118
67
|
}
|
|
119
68
|
return removeFile;
|
|
120
69
|
}()
|
|
70
|
+
/**
|
|
71
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-170 Internal documentation for deprecation (no external access)}
|
|
72
|
+
* This method is no longer working. Will be removed in the next release
|
|
73
|
+
*/
|
|
121
74
|
}, {
|
|
122
75
|
key: "loadNextPage",
|
|
123
76
|
value: function () {
|
|
124
77
|
var _loadNextPage = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(collectionName, params, traceContext) {
|
|
125
|
-
var collection, isLoading, _collectionCache$coll, inclusiveStartKey, currentItems, subject, response, _response$data, contents, nextInclusiveStartKey, newItems, items;
|
|
126
78
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
127
79
|
while (1) {
|
|
128
80
|
switch (_context2.prev = _context2.next) {
|
|
129
81
|
case 0:
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
if (!(!collection || !collection.nextInclusiveStartKey || isLoading)) {
|
|
133
|
-
_context2.next = 4;
|
|
134
|
-
break;
|
|
135
|
-
}
|
|
136
|
-
return _context2.abrupt("return");
|
|
137
|
-
case 4:
|
|
138
|
-
collection.isLoadingNextPage = true;
|
|
139
|
-
_collectionCache$coll = collectionCache[collectionName], inclusiveStartKey = _collectionCache$coll.nextInclusiveStartKey, currentItems = _collectionCache$coll.items, subject = _collectionCache$coll.subject;
|
|
140
|
-
_context2.next = 8;
|
|
141
|
-
return this.mediaStore.getCollectionItems(collectionName, _objectSpread(_objectSpread({}, params), {}, {
|
|
142
|
-
inclusiveStartKey: inclusiveStartKey,
|
|
143
|
-
details: 'full'
|
|
144
|
-
}), traceContext);
|
|
145
|
-
case 8:
|
|
146
|
-
response = _context2.sent;
|
|
147
|
-
_response$data = response.data, contents = _response$data.contents, nextInclusiveStartKey = _response$data.nextInclusiveStartKey;
|
|
148
|
-
this.populateCache(contents);
|
|
149
|
-
newItems = response.data.contents;
|
|
150
|
-
items = [].concat((0, _toConsumableArray2.default)(currentItems), (0, _toConsumableArray2.default)(newItems));
|
|
151
|
-
subject.next(items);
|
|
152
|
-
collectionCache[collectionName] = {
|
|
153
|
-
items: items,
|
|
154
|
-
nextInclusiveStartKey: nextInclusiveStartKey,
|
|
155
|
-
subject: subject,
|
|
156
|
-
isLoadingNextPage: false
|
|
157
|
-
};
|
|
158
|
-
case 15:
|
|
82
|
+
throw new _deprecatedEndpointError.DeprecatedError('collection/:name/items');
|
|
83
|
+
case 1:
|
|
159
84
|
case "end":
|
|
160
85
|
return _context2.stop();
|
|
161
86
|
}
|
|
162
87
|
}
|
|
163
|
-
}, _callee2
|
|
88
|
+
}, _callee2);
|
|
164
89
|
}));
|
|
165
90
|
function loadNextPage(_x5, _x6, _x7) {
|
|
166
91
|
return _loadNextPage.apply(this, arguments);
|
|
@@ -29,6 +29,7 @@ var _artifacts = require("../../models/artifacts");
|
|
|
29
29
|
var _request3 = require("../../utils/request");
|
|
30
30
|
var _helpers = require("../../utils/request/helpers");
|
|
31
31
|
var _resolveAuth = require("./resolveAuth");
|
|
32
|
+
var _deprecatedEndpointError = require("../../utils/deprecatedEndpointError");
|
|
32
33
|
var _error = require("./error");
|
|
33
34
|
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; }
|
|
34
35
|
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; }
|
|
@@ -39,10 +40,6 @@ var defaultImageOptions = {
|
|
|
39
40
|
allowAnimated: true,
|
|
40
41
|
mode: 'crop'
|
|
41
42
|
};
|
|
42
|
-
var defaultGetCollectionItems = {
|
|
43
|
-
limit: 30,
|
|
44
|
-
sortDirection: 'desc'
|
|
45
|
-
};
|
|
46
43
|
var extendImageParams = function extendImageParams(params) {
|
|
47
44
|
var fetchMaxRes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
48
45
|
return _objectSpread(_objectSpread(_objectSpread({}, defaultImageOptions), params), fetchMaxRes ? {
|
|
@@ -67,57 +64,26 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
67
64
|
this.config = config;
|
|
68
65
|
this.featureFlags = featureFlags;
|
|
69
66
|
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-170 Internal documentation for deprecation (no external access)}
|
|
70
|
+
* This method is no longer working. Will be removed in the next release
|
|
71
|
+
*/
|
|
70
72
|
(0, _createClass2.default)(MediaStore, [{
|
|
71
73
|
key: "getCollectionItems",
|
|
72
74
|
value: function () {
|
|
73
75
|
var _getCollectionItems = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(collectionName, params, traceContext) {
|
|
74
|
-
var metadata, options, response, _yield$createMapRespo, _yield$createMapRespo2, contents, nextInclusiveStartKey, contentsWithoutEmptyFiles;
|
|
75
76
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
76
77
|
while (1) {
|
|
77
78
|
switch (_context.prev = _context.next) {
|
|
78
79
|
case 0:
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
endpoint: '/collection/{collectionName}/items'
|
|
82
|
-
};
|
|
83
|
-
options = _objectSpread(_objectSpread({}, metadata), {}, {
|
|
84
|
-
authContext: {
|
|
85
|
-
collectionName: collectionName
|
|
86
|
-
},
|
|
87
|
-
params: _objectSpread(_objectSpread({}, defaultGetCollectionItems), params),
|
|
88
|
-
headers: {
|
|
89
|
-
Accept: 'application/json'
|
|
90
|
-
},
|
|
91
|
-
traceContext: traceContext
|
|
92
|
-
});
|
|
93
|
-
_context.next = 4;
|
|
94
|
-
return this.request("/collection/".concat(collectionName, "/items"), options);
|
|
95
|
-
case 4:
|
|
96
|
-
response = _context.sent;
|
|
97
|
-
_context.next = 7;
|
|
98
|
-
return (0, _helpers.createMapResponseToJson)(metadata)(response);
|
|
99
|
-
case 7:
|
|
100
|
-
_yield$createMapRespo = _context.sent;
|
|
101
|
-
_yield$createMapRespo2 = _yield$createMapRespo.data;
|
|
102
|
-
contents = _yield$createMapRespo2.contents;
|
|
103
|
-
nextInclusiveStartKey = _yield$createMapRespo2.nextInclusiveStartKey;
|
|
104
|
-
// [TODO] MS-705: remove after backend adds filter
|
|
105
|
-
// This prevents showing "ghost" files in recents
|
|
106
|
-
contentsWithoutEmptyFiles = contents.filter(function (item) {
|
|
107
|
-
return item.details.size && item.details.size > 0;
|
|
108
|
-
});
|
|
109
|
-
return _context.abrupt("return", {
|
|
110
|
-
data: {
|
|
111
|
-
contents: contentsWithoutEmptyFiles,
|
|
112
|
-
nextInclusiveStartKey: nextInclusiveStartKey
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
case 13:
|
|
80
|
+
throw new _deprecatedEndpointError.DeprecatedError('collection/:name/items');
|
|
81
|
+
case 1:
|
|
116
82
|
case "end":
|
|
117
83
|
return _context.stop();
|
|
118
84
|
}
|
|
119
85
|
}
|
|
120
|
-
}, _callee
|
|
86
|
+
}, _callee);
|
|
121
87
|
}));
|
|
122
88
|
function getCollectionItems(_x, _x2, _x3) {
|
|
123
89
|
return _getCollectionItems.apply(this, arguments);
|
package/dist/cjs/constants.js
CHANGED
|
@@ -11,7 +11,7 @@ var FILE_CACHE_MAX_AGE = 60 * 60 * 24 * 30; // Retain for 30 days
|
|
|
11
11
|
exports.FILE_CACHE_MAX_AGE = FILE_CACHE_MAX_AGE;
|
|
12
12
|
var MAX_RESOLUTION = 4096;
|
|
13
13
|
exports.MAX_RESOLUTION = MAX_RESOLUTION;
|
|
14
|
-
var CHUNK_SIZE =
|
|
14
|
+
var CHUNK_SIZE = 5 * _media.DATA_UNIT.MB;
|
|
15
15
|
exports.CHUNK_SIZE = CHUNK_SIZE;
|
|
16
16
|
var PROCESSING_BATCH_SIZE = 1000;
|
|
17
17
|
exports.PROCESSING_BATCH_SIZE = PROCESSING_BATCH_SIZE;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.DeprecatedError = void 0;
|
|
8
|
+
exports.isDeprecatedError = isDeprecatedError;
|
|
9
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
12
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
13
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
14
|
+
var _errors = require("../models/errors");
|
|
15
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
16
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
17
|
+
var reason = 'deprecatedEndpoint';
|
|
18
|
+
var DeprecatedError = /*#__PURE__*/function (_BaseMediaClientError) {
|
|
19
|
+
(0, _inherits2.default)(DeprecatedError, _BaseMediaClientError);
|
|
20
|
+
var _super = _createSuper(DeprecatedError);
|
|
21
|
+
function DeprecatedError(endpointName) {
|
|
22
|
+
var _this;
|
|
23
|
+
(0, _classCallCheck2.default)(this, DeprecatedError);
|
|
24
|
+
_this = _super.call(this, reason);
|
|
25
|
+
_this.endpointName = endpointName;
|
|
26
|
+
return _this;
|
|
27
|
+
}
|
|
28
|
+
(0, _createClass2.default)(DeprecatedError, [{
|
|
29
|
+
key: "attributes",
|
|
30
|
+
get: function get() {
|
|
31
|
+
var endpointName = this.endpointName;
|
|
32
|
+
return {
|
|
33
|
+
reason: reason,
|
|
34
|
+
endpointName: endpointName
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
}]);
|
|
38
|
+
return DeprecatedError;
|
|
39
|
+
}(_errors.BaseMediaClientError);
|
|
40
|
+
exports.DeprecatedError = DeprecatedError;
|
|
41
|
+
function isDeprecatedError(err) {
|
|
42
|
+
return err instanceof DeprecatedError;
|
|
43
|
+
}
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,35 +1,10 @@
|
|
|
1
|
-
import { ReplaySubject } from 'rxjs/ReplaySubject';
|
|
2
1
|
import { getFileStreamsCache } from '../file-streams-cache';
|
|
3
|
-
import {
|
|
4
|
-
import { fromObservable } from '../utils/mediaSubscribable';
|
|
2
|
+
import { DeprecatedError } from '../utils/deprecatedEndpointError';
|
|
5
3
|
export const collectionCache = {};
|
|
6
|
-
const createCacheEntry = () => ({
|
|
7
|
-
items: [],
|
|
8
|
-
subject: new ReplaySubject(1),
|
|
9
|
-
isLoadingNextPage: false
|
|
10
|
-
});
|
|
11
4
|
export class CollectionFetcher {
|
|
12
5
|
constructor(mediaStore) {
|
|
13
6
|
this.mediaStore = mediaStore;
|
|
14
7
|
}
|
|
15
|
-
createFileStateObserver(id, details) {
|
|
16
|
-
const subject = new ReplaySubject(1);
|
|
17
|
-
const mediaFile = {
|
|
18
|
-
id,
|
|
19
|
-
...details
|
|
20
|
-
};
|
|
21
|
-
const fileState = mapMediaFileToFileState({
|
|
22
|
-
data: mediaFile
|
|
23
|
-
});
|
|
24
|
-
subject.next(fileState);
|
|
25
|
-
return subject;
|
|
26
|
-
}
|
|
27
|
-
populateCache(items) {
|
|
28
|
-
items.forEach(item => {
|
|
29
|
-
const fileStream = this.createFileStateObserver(item.id, item.details);
|
|
30
|
-
getFileStreamsCache().set(item.id, fileStream);
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
8
|
removeFromCache(id, collectionName) {
|
|
34
9
|
const collectionCacheIndex = collectionCache[collectionName].items.findIndex(item => item.id === id);
|
|
35
10
|
if (collectionCacheIndex === -1) {
|
|
@@ -38,28 +13,13 @@ export class CollectionFetcher {
|
|
|
38
13
|
getFileStreamsCache().remove(id);
|
|
39
14
|
collectionCache[collectionName].items.splice(collectionCacheIndex, 1);
|
|
40
15
|
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-170 Internal documentation for deprecation (no external access)}
|
|
19
|
+
* This method is no longer working. Will be removed in the next release
|
|
20
|
+
*/
|
|
41
21
|
getItems(collectionName, params, traceContext) {
|
|
42
|
-
|
|
43
|
-
collectionCache[collectionName] = createCacheEntry();
|
|
44
|
-
}
|
|
45
|
-
const collection = collectionCache[collectionName];
|
|
46
|
-
const subject = collection.subject;
|
|
47
|
-
this.mediaStore.getCollectionItems(collectionName, {
|
|
48
|
-
...params,
|
|
49
|
-
details: 'full'
|
|
50
|
-
}, traceContext).then(items => {
|
|
51
|
-
const {
|
|
52
|
-
contents,
|
|
53
|
-
nextInclusiveStartKey
|
|
54
|
-
} = items.data;
|
|
55
|
-
this.populateCache(contents);
|
|
56
|
-
// It's hard to merge two together, so we just take what's came from the server.
|
|
57
|
-
// Since we load only one page > 2 pages will be ditched from the cache.
|
|
58
|
-
collection.items = items.data.contents;
|
|
59
|
-
collection.nextInclusiveStartKey = nextInclusiveStartKey;
|
|
60
|
-
subject.next(collection.items);
|
|
61
|
-
}).catch(error => subject.error(error));
|
|
62
|
-
return fromObservable(subject);
|
|
22
|
+
throw new DeprecatedError('collection/:name/items');
|
|
63
23
|
}
|
|
64
24
|
async removeFile(id, collectionName, occurrenceKey, traceContext) {
|
|
65
25
|
await this.mediaStore.removeCollectionFile(id, collectionName, occurrenceKey, traceContext);
|
|
@@ -67,36 +27,12 @@ export class CollectionFetcher {
|
|
|
67
27
|
const collection = collectionCache[collectionName];
|
|
68
28
|
collection.subject.next(collection.items);
|
|
69
29
|
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-170 Internal documentation for deprecation (no external access)}
|
|
33
|
+
* This method is no longer working. Will be removed in the next release
|
|
34
|
+
*/
|
|
70
35
|
async loadNextPage(collectionName, params, traceContext) {
|
|
71
|
-
|
|
72
|
-
const isLoading = collection ? collection.isLoadingNextPage : false;
|
|
73
|
-
if (!collection || !collection.nextInclusiveStartKey || isLoading) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
collection.isLoadingNextPage = true;
|
|
77
|
-
const {
|
|
78
|
-
nextInclusiveStartKey: inclusiveStartKey,
|
|
79
|
-
items: currentItems,
|
|
80
|
-
subject
|
|
81
|
-
} = collectionCache[collectionName];
|
|
82
|
-
const response = await this.mediaStore.getCollectionItems(collectionName, {
|
|
83
|
-
...params,
|
|
84
|
-
inclusiveStartKey,
|
|
85
|
-
details: 'full'
|
|
86
|
-
}, traceContext);
|
|
87
|
-
const {
|
|
88
|
-
contents,
|
|
89
|
-
nextInclusiveStartKey
|
|
90
|
-
} = response.data;
|
|
91
|
-
this.populateCache(contents);
|
|
92
|
-
const newItems = response.data.contents;
|
|
93
|
-
const items = [...currentItems, ...newItems];
|
|
94
|
-
subject.next(items);
|
|
95
|
-
collectionCache[collectionName] = {
|
|
96
|
-
items,
|
|
97
|
-
nextInclusiveStartKey,
|
|
98
|
-
subject,
|
|
99
|
-
isLoadingNextPage: false
|
|
100
|
-
};
|
|
36
|
+
throw new DeprecatedError('collection/:name/items');
|
|
101
37
|
}
|
|
102
38
|
}
|
|
@@ -5,6 +5,7 @@ import { getArtifactUrl } from '../../models/artifacts';
|
|
|
5
5
|
import { request } from '../../utils/request';
|
|
6
6
|
import { createUrl, createMapResponseToJson, createMapResponseToBlob } from '../../utils/request/helpers';
|
|
7
7
|
import { resolveAuth, resolveInitialAuth } from './resolveAuth';
|
|
8
|
+
import { DeprecatedError } from '../../utils/deprecatedEndpointError';
|
|
8
9
|
export { MediaStoreError, isMediaStoreError } from './error';
|
|
9
10
|
const MEDIA_API_REGION = 'media-api-region';
|
|
10
11
|
const MEDIA_API_ENVIRONMENT = 'media-api-environment';
|
|
@@ -13,10 +14,6 @@ const defaultImageOptions = {
|
|
|
13
14
|
allowAnimated: true,
|
|
14
15
|
mode: 'crop'
|
|
15
16
|
};
|
|
16
|
-
const defaultGetCollectionItems = {
|
|
17
|
-
limit: 30,
|
|
18
|
-
sortDirection: 'desc'
|
|
19
|
-
};
|
|
20
17
|
const extendImageParams = (params, fetchMaxRes = false) => {
|
|
21
18
|
return {
|
|
22
19
|
...defaultImageOptions,
|
|
@@ -38,42 +35,13 @@ export class MediaStore {
|
|
|
38
35
|
this.config = config;
|
|
39
36
|
this.featureFlags = featureFlags;
|
|
40
37
|
}
|
|
41
|
-
async getCollectionItems(collectionName, params, traceContext) {
|
|
42
|
-
const metadata = {
|
|
43
|
-
method: 'GET',
|
|
44
|
-
endpoint: '/collection/{collectionName}/items'
|
|
45
|
-
};
|
|
46
|
-
const options = {
|
|
47
|
-
...metadata,
|
|
48
|
-
authContext: {
|
|
49
|
-
collectionName
|
|
50
|
-
},
|
|
51
|
-
params: {
|
|
52
|
-
...defaultGetCollectionItems,
|
|
53
|
-
...params
|
|
54
|
-
},
|
|
55
|
-
headers: {
|
|
56
|
-
Accept: 'application/json'
|
|
57
|
-
},
|
|
58
|
-
traceContext
|
|
59
|
-
};
|
|
60
|
-
const response = await this.request(`/collection/${collectionName}/items`, options);
|
|
61
|
-
const {
|
|
62
|
-
data: {
|
|
63
|
-
contents,
|
|
64
|
-
nextInclusiveStartKey
|
|
65
|
-
}
|
|
66
|
-
} = await createMapResponseToJson(metadata)(response);
|
|
67
38
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
nextInclusiveStartKey
|
|
75
|
-
}
|
|
76
|
-
};
|
|
39
|
+
/**
|
|
40
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-170 Internal documentation for deprecation (no external access)}
|
|
41
|
+
* This method is no longer working. Will be removed in the next release
|
|
42
|
+
*/
|
|
43
|
+
async getCollectionItems(collectionName, params, traceContext) {
|
|
44
|
+
throw new DeprecatedError('collection/:name/items');
|
|
77
45
|
}
|
|
78
46
|
async removeCollectionFile(id, collectionName, occurrenceKey, traceContext) {
|
|
79
47
|
const metadata = {
|
package/dist/es2019/constants.js
CHANGED
|
@@ -2,6 +2,6 @@ import { DATA_UNIT } from './models/media';
|
|
|
2
2
|
export const RECENTS_COLLECTION = 'recents';
|
|
3
3
|
export const FILE_CACHE_MAX_AGE = 60 * 60 * 24 * 30; // Retain for 30 days
|
|
4
4
|
export const MAX_RESOLUTION = 4096;
|
|
5
|
-
export const CHUNK_SIZE =
|
|
5
|
+
export const CHUNK_SIZE = 5 * DATA_UNIT.MB;
|
|
6
6
|
export const PROCESSING_BATCH_SIZE = 1000;
|
|
7
7
|
export const MAX_UPLOAD_FILE_SIZE = 2 * DATA_UNIT.TB;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BaseMediaClientError } from '../models/errors';
|
|
2
|
+
const reason = 'deprecatedEndpoint';
|
|
3
|
+
export class DeprecatedError extends BaseMediaClientError {
|
|
4
|
+
constructor(endpointName) {
|
|
5
|
+
super(reason);
|
|
6
|
+
this.endpointName = endpointName;
|
|
7
|
+
}
|
|
8
|
+
get attributes() {
|
|
9
|
+
const {
|
|
10
|
+
endpointName
|
|
11
|
+
} = this;
|
|
12
|
+
return {
|
|
13
|
+
reason,
|
|
14
|
+
endpointName
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export function isDeprecatedError(err) {
|
|
19
|
+
return err instanceof DeprecatedError;
|
|
20
|
+
}
|
package/dist/es2019/version.json
CHANGED
|
@@ -1,51 +1,16 @@
|
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
5
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
6
4
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
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; }
|
|
8
|
-
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; }
|
|
9
|
-
import { ReplaySubject } from 'rxjs/ReplaySubject';
|
|
10
5
|
import { getFileStreamsCache } from '../file-streams-cache';
|
|
11
|
-
import {
|
|
12
|
-
import { fromObservable } from '../utils/mediaSubscribable';
|
|
6
|
+
import { DeprecatedError } from '../utils/deprecatedEndpointError';
|
|
13
7
|
export var collectionCache = {};
|
|
14
|
-
var createCacheEntry = function createCacheEntry() {
|
|
15
|
-
return {
|
|
16
|
-
items: [],
|
|
17
|
-
subject: new ReplaySubject(1),
|
|
18
|
-
isLoadingNextPage: false
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
8
|
export var CollectionFetcher = /*#__PURE__*/function () {
|
|
22
9
|
function CollectionFetcher(mediaStore) {
|
|
23
10
|
_classCallCheck(this, CollectionFetcher);
|
|
24
11
|
this.mediaStore = mediaStore;
|
|
25
12
|
}
|
|
26
13
|
_createClass(CollectionFetcher, [{
|
|
27
|
-
key: "createFileStateObserver",
|
|
28
|
-
value: function createFileStateObserver(id, details) {
|
|
29
|
-
var subject = new ReplaySubject(1);
|
|
30
|
-
var mediaFile = _objectSpread({
|
|
31
|
-
id: id
|
|
32
|
-
}, details);
|
|
33
|
-
var fileState = mapMediaFileToFileState({
|
|
34
|
-
data: mediaFile
|
|
35
|
-
});
|
|
36
|
-
subject.next(fileState);
|
|
37
|
-
return subject;
|
|
38
|
-
}
|
|
39
|
-
}, {
|
|
40
|
-
key: "populateCache",
|
|
41
|
-
value: function populateCache(items) {
|
|
42
|
-
var _this = this;
|
|
43
|
-
items.forEach(function (item) {
|
|
44
|
-
var fileStream = _this.createFileStateObserver(item.id, item.details);
|
|
45
|
-
getFileStreamsCache().set(item.id, fileStream);
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
}, {
|
|
49
14
|
key: "removeFromCache",
|
|
50
15
|
value: function removeFromCache(id, collectionName) {
|
|
51
16
|
var collectionCacheIndex = collectionCache[collectionName].items.findIndex(function (item) {
|
|
@@ -57,31 +22,15 @@ export var CollectionFetcher = /*#__PURE__*/function () {
|
|
|
57
22
|
getFileStreamsCache().remove(id);
|
|
58
23
|
collectionCache[collectionName].items.splice(collectionCacheIndex, 1);
|
|
59
24
|
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-170 Internal documentation for deprecation (no external access)}
|
|
28
|
+
* This method is no longer working. Will be removed in the next release
|
|
29
|
+
*/
|
|
60
30
|
}, {
|
|
61
31
|
key: "getItems",
|
|
62
32
|
value: function getItems(collectionName, params, traceContext) {
|
|
63
|
-
|
|
64
|
-
if (!collectionCache[collectionName]) {
|
|
65
|
-
collectionCache[collectionName] = createCacheEntry();
|
|
66
|
-
}
|
|
67
|
-
var collection = collectionCache[collectionName];
|
|
68
|
-
var subject = collection.subject;
|
|
69
|
-
this.mediaStore.getCollectionItems(collectionName, _objectSpread(_objectSpread({}, params), {}, {
|
|
70
|
-
details: 'full'
|
|
71
|
-
}), traceContext).then(function (items) {
|
|
72
|
-
var _items$data = items.data,
|
|
73
|
-
contents = _items$data.contents,
|
|
74
|
-
nextInclusiveStartKey = _items$data.nextInclusiveStartKey;
|
|
75
|
-
_this2.populateCache(contents);
|
|
76
|
-
// It's hard to merge two together, so we just take what's came from the server.
|
|
77
|
-
// Since we load only one page > 2 pages will be ditched from the cache.
|
|
78
|
-
collection.items = items.data.contents;
|
|
79
|
-
collection.nextInclusiveStartKey = nextInclusiveStartKey;
|
|
80
|
-
subject.next(collection.items);
|
|
81
|
-
}).catch(function (error) {
|
|
82
|
-
return subject.error(error);
|
|
83
|
-
});
|
|
84
|
-
return fromObservable(subject);
|
|
33
|
+
throw new DeprecatedError('collection/:name/items');
|
|
85
34
|
}
|
|
86
35
|
}, {
|
|
87
36
|
key: "removeFile",
|
|
@@ -110,49 +59,25 @@ export var CollectionFetcher = /*#__PURE__*/function () {
|
|
|
110
59
|
}
|
|
111
60
|
return removeFile;
|
|
112
61
|
}()
|
|
62
|
+
/**
|
|
63
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-170 Internal documentation for deprecation (no external access)}
|
|
64
|
+
* This method is no longer working. Will be removed in the next release
|
|
65
|
+
*/
|
|
113
66
|
}, {
|
|
114
67
|
key: "loadNextPage",
|
|
115
68
|
value: function () {
|
|
116
69
|
var _loadNextPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(collectionName, params, traceContext) {
|
|
117
|
-
var collection, isLoading, _collectionCache$coll, inclusiveStartKey, currentItems, subject, response, _response$data, contents, nextInclusiveStartKey, newItems, items;
|
|
118
70
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
119
71
|
while (1) {
|
|
120
72
|
switch (_context2.prev = _context2.next) {
|
|
121
73
|
case 0:
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
if (!(!collection || !collection.nextInclusiveStartKey || isLoading)) {
|
|
125
|
-
_context2.next = 4;
|
|
126
|
-
break;
|
|
127
|
-
}
|
|
128
|
-
return _context2.abrupt("return");
|
|
129
|
-
case 4:
|
|
130
|
-
collection.isLoadingNextPage = true;
|
|
131
|
-
_collectionCache$coll = collectionCache[collectionName], inclusiveStartKey = _collectionCache$coll.nextInclusiveStartKey, currentItems = _collectionCache$coll.items, subject = _collectionCache$coll.subject;
|
|
132
|
-
_context2.next = 8;
|
|
133
|
-
return this.mediaStore.getCollectionItems(collectionName, _objectSpread(_objectSpread({}, params), {}, {
|
|
134
|
-
inclusiveStartKey: inclusiveStartKey,
|
|
135
|
-
details: 'full'
|
|
136
|
-
}), traceContext);
|
|
137
|
-
case 8:
|
|
138
|
-
response = _context2.sent;
|
|
139
|
-
_response$data = response.data, contents = _response$data.contents, nextInclusiveStartKey = _response$data.nextInclusiveStartKey;
|
|
140
|
-
this.populateCache(contents);
|
|
141
|
-
newItems = response.data.contents;
|
|
142
|
-
items = [].concat(_toConsumableArray(currentItems), _toConsumableArray(newItems));
|
|
143
|
-
subject.next(items);
|
|
144
|
-
collectionCache[collectionName] = {
|
|
145
|
-
items: items,
|
|
146
|
-
nextInclusiveStartKey: nextInclusiveStartKey,
|
|
147
|
-
subject: subject,
|
|
148
|
-
isLoadingNextPage: false
|
|
149
|
-
};
|
|
150
|
-
case 15:
|
|
74
|
+
throw new DeprecatedError('collection/:name/items');
|
|
75
|
+
case 1:
|
|
151
76
|
case "end":
|
|
152
77
|
return _context2.stop();
|
|
153
78
|
}
|
|
154
79
|
}
|
|
155
|
-
}, _callee2
|
|
80
|
+
}, _callee2);
|
|
156
81
|
}));
|
|
157
82
|
function loadNextPage(_x5, _x6, _x7) {
|
|
158
83
|
return _loadNextPage.apply(this, arguments);
|
|
@@ -11,6 +11,7 @@ import { getArtifactUrl } from '../../models/artifacts';
|
|
|
11
11
|
import { request as _request } from '../../utils/request';
|
|
12
12
|
import { createUrl, createMapResponseToJson, createMapResponseToBlob } from '../../utils/request/helpers';
|
|
13
13
|
import { resolveAuth, resolveInitialAuth } from './resolveAuth';
|
|
14
|
+
import { DeprecatedError } from '../../utils/deprecatedEndpointError';
|
|
14
15
|
export { MediaStoreError, isMediaStoreError } from './error';
|
|
15
16
|
var MEDIA_API_REGION = 'media-api-region';
|
|
16
17
|
var MEDIA_API_ENVIRONMENT = 'media-api-environment';
|
|
@@ -19,10 +20,6 @@ var defaultImageOptions = {
|
|
|
19
20
|
allowAnimated: true,
|
|
20
21
|
mode: 'crop'
|
|
21
22
|
};
|
|
22
|
-
var defaultGetCollectionItems = {
|
|
23
|
-
limit: 30,
|
|
24
|
-
sortDirection: 'desc'
|
|
25
|
-
};
|
|
26
23
|
var extendImageParams = function extendImageParams(params) {
|
|
27
24
|
var fetchMaxRes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
28
25
|
return _objectSpread(_objectSpread(_objectSpread({}, defaultImageOptions), params), fetchMaxRes ? {
|
|
@@ -47,57 +44,26 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
47
44
|
this.config = config;
|
|
48
45
|
this.featureFlags = featureFlags;
|
|
49
46
|
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-170 Internal documentation for deprecation (no external access)}
|
|
50
|
+
* This method is no longer working. Will be removed in the next release
|
|
51
|
+
*/
|
|
50
52
|
_createClass(MediaStore, [{
|
|
51
53
|
key: "getCollectionItems",
|
|
52
54
|
value: function () {
|
|
53
55
|
var _getCollectionItems = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(collectionName, params, traceContext) {
|
|
54
|
-
var metadata, options, response, _yield$createMapRespo, _yield$createMapRespo2, contents, nextInclusiveStartKey, contentsWithoutEmptyFiles;
|
|
55
56
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
56
57
|
while (1) {
|
|
57
58
|
switch (_context.prev = _context.next) {
|
|
58
59
|
case 0:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
endpoint: '/collection/{collectionName}/items'
|
|
62
|
-
};
|
|
63
|
-
options = _objectSpread(_objectSpread({}, metadata), {}, {
|
|
64
|
-
authContext: {
|
|
65
|
-
collectionName: collectionName
|
|
66
|
-
},
|
|
67
|
-
params: _objectSpread(_objectSpread({}, defaultGetCollectionItems), params),
|
|
68
|
-
headers: {
|
|
69
|
-
Accept: 'application/json'
|
|
70
|
-
},
|
|
71
|
-
traceContext: traceContext
|
|
72
|
-
});
|
|
73
|
-
_context.next = 4;
|
|
74
|
-
return this.request("/collection/".concat(collectionName, "/items"), options);
|
|
75
|
-
case 4:
|
|
76
|
-
response = _context.sent;
|
|
77
|
-
_context.next = 7;
|
|
78
|
-
return createMapResponseToJson(metadata)(response);
|
|
79
|
-
case 7:
|
|
80
|
-
_yield$createMapRespo = _context.sent;
|
|
81
|
-
_yield$createMapRespo2 = _yield$createMapRespo.data;
|
|
82
|
-
contents = _yield$createMapRespo2.contents;
|
|
83
|
-
nextInclusiveStartKey = _yield$createMapRespo2.nextInclusiveStartKey;
|
|
84
|
-
// [TODO] MS-705: remove after backend adds filter
|
|
85
|
-
// This prevents showing "ghost" files in recents
|
|
86
|
-
contentsWithoutEmptyFiles = contents.filter(function (item) {
|
|
87
|
-
return item.details.size && item.details.size > 0;
|
|
88
|
-
});
|
|
89
|
-
return _context.abrupt("return", {
|
|
90
|
-
data: {
|
|
91
|
-
contents: contentsWithoutEmptyFiles,
|
|
92
|
-
nextInclusiveStartKey: nextInclusiveStartKey
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
case 13:
|
|
60
|
+
throw new DeprecatedError('collection/:name/items');
|
|
61
|
+
case 1:
|
|
96
62
|
case "end":
|
|
97
63
|
return _context.stop();
|
|
98
64
|
}
|
|
99
65
|
}
|
|
100
|
-
}, _callee
|
|
66
|
+
}, _callee);
|
|
101
67
|
}));
|
|
102
68
|
function getCollectionItems(_x, _x2, _x3) {
|
|
103
69
|
return _getCollectionItems.apply(this, arguments);
|
package/dist/esm/constants.js
CHANGED
|
@@ -2,6 +2,6 @@ import { DATA_UNIT } from './models/media';
|
|
|
2
2
|
export var RECENTS_COLLECTION = 'recents';
|
|
3
3
|
export var FILE_CACHE_MAX_AGE = 60 * 60 * 24 * 30; // Retain for 30 days
|
|
4
4
|
export var MAX_RESOLUTION = 4096;
|
|
5
|
-
export var CHUNK_SIZE =
|
|
5
|
+
export var CHUNK_SIZE = 5 * DATA_UNIT.MB;
|
|
6
6
|
export var PROCESSING_BATCH_SIZE = 1000;
|
|
7
7
|
export var MAX_UPLOAD_FILE_SIZE = 2 * DATA_UNIT.TB;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
4
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
7
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
8
|
+
import { BaseMediaClientError } from '../models/errors';
|
|
9
|
+
var reason = 'deprecatedEndpoint';
|
|
10
|
+
export var DeprecatedError = /*#__PURE__*/function (_BaseMediaClientError) {
|
|
11
|
+
_inherits(DeprecatedError, _BaseMediaClientError);
|
|
12
|
+
var _super = _createSuper(DeprecatedError);
|
|
13
|
+
function DeprecatedError(endpointName) {
|
|
14
|
+
var _this;
|
|
15
|
+
_classCallCheck(this, DeprecatedError);
|
|
16
|
+
_this = _super.call(this, reason);
|
|
17
|
+
_this.endpointName = endpointName;
|
|
18
|
+
return _this;
|
|
19
|
+
}
|
|
20
|
+
_createClass(DeprecatedError, [{
|
|
21
|
+
key: "attributes",
|
|
22
|
+
get: function get() {
|
|
23
|
+
var endpointName = this.endpointName;
|
|
24
|
+
return {
|
|
25
|
+
reason: reason,
|
|
26
|
+
endpointName: endpointName
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
}]);
|
|
30
|
+
return DeprecatedError;
|
|
31
|
+
}(BaseMediaClientError);
|
|
32
|
+
export function isDeprecatedError(err) {
|
|
33
|
+
return err instanceof DeprecatedError;
|
|
34
|
+
}
|
package/dist/esm/version.json
CHANGED
|
@@ -27,10 +27,16 @@ export declare const collectionCache: CollectionCache;
|
|
|
27
27
|
export declare class CollectionFetcher {
|
|
28
28
|
readonly mediaStore: MediaStore;
|
|
29
29
|
constructor(mediaStore: MediaStore);
|
|
30
|
-
private createFileStateObserver;
|
|
31
|
-
private populateCache;
|
|
32
30
|
private removeFromCache;
|
|
31
|
+
/**
|
|
32
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-170 Internal documentation for deprecation (no external access)}
|
|
33
|
+
* This method is no longer working. Will be removed in the next release
|
|
34
|
+
*/
|
|
33
35
|
getItems(collectionName: string, params?: MediaStoreGetCollectionItemsParams, traceContext?: MediaTraceContext): MediaSubscribable<MediaCollectionItem[]>;
|
|
34
36
|
removeFile(id: string, collectionName: string, occurrenceKey?: string, traceContext?: MediaTraceContext): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-170 Internal documentation for deprecation (no external access)}
|
|
39
|
+
* This method is no longer working. Will be removed in the next release
|
|
40
|
+
*/
|
|
35
41
|
loadNextPage(collectionName: string, params?: MediaStoreGetCollectionItemsParams, traceContext?: MediaTraceContext): Promise<void>;
|
|
36
42
|
}
|
|
@@ -9,6 +9,10 @@ export declare class MediaStore {
|
|
|
9
9
|
private readonly config;
|
|
10
10
|
readonly featureFlags?: MediaFeatureFlags | undefined;
|
|
11
11
|
constructor(config: MediaApiConfig, featureFlags?: MediaFeatureFlags | undefined);
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-170 Internal documentation for deprecation (no external access)}
|
|
14
|
+
* This method is no longer working. Will be removed in the next release
|
|
15
|
+
*/
|
|
12
16
|
getCollectionItems(collectionName: string, params?: MediaStoreGetCollectionItemsParams, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaCollectionItems>>;
|
|
13
17
|
removeCollectionFile(id: string, collectionName: string, occurrenceKey?: string, traceContext?: MediaTraceContext): Promise<void>;
|
|
14
18
|
createUpload(createUpTo?: number, collectionName?: string, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaUpload[]>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare type MediaClientErrorReason = 'clientOffline' | 'clientAbortedRequest' | 'clientTimeoutRequest' | 'serverInvalidBody' | 'serverBadRequest' | 'serverUnauthorized' | 'serverForbidden' | 'serverNotFound' | 'serverRateLimited' | 'serverInternalError' | 'serverBadGateway' | 'serverUnexpectedError' | 'failedAuthProvider' | 'tokenExpired' | 'missingInitialAuth' | 'emptyAuth' | 'authProviderTimedOut' | 'invalidFileId' | 'emptyItems' | 'zeroVersionFile' | 'pollingMaxAttemptsExceeded' | 'fileSizeExceedsLimit';
|
|
1
|
+
export declare type MediaClientErrorReason = 'clientOffline' | 'clientAbortedRequest' | 'clientTimeoutRequest' | 'serverInvalidBody' | 'serverBadRequest' | 'serverUnauthorized' | 'serverForbidden' | 'serverNotFound' | 'serverRateLimited' | 'serverInternalError' | 'serverBadGateway' | 'serverUnexpectedError' | 'failedAuthProvider' | 'tokenExpired' | 'missingInitialAuth' | 'emptyAuth' | 'authProviderTimedOut' | 'invalidFileId' | 'emptyItems' | 'zeroVersionFile' | 'pollingMaxAttemptsExceeded' | 'fileSizeExceedsLimit' | 'deprecatedEndpoint';
|
|
2
2
|
export interface MediaClientErrorAttributes {
|
|
3
3
|
reason: MediaClientErrorReason;
|
|
4
4
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseMediaClientError } from '../models/errors';
|
|
2
|
+
declare const reason: "deprecatedEndpoint";
|
|
3
|
+
export declare type DeprecatedErrorAttributes = {
|
|
4
|
+
readonly reason: typeof reason;
|
|
5
|
+
readonly endpointName: string;
|
|
6
|
+
};
|
|
7
|
+
export declare class DeprecatedError extends BaseMediaClientError<DeprecatedErrorAttributes> {
|
|
8
|
+
readonly endpointName: string;
|
|
9
|
+
constructor(endpointName: string);
|
|
10
|
+
get attributes(): {
|
|
11
|
+
reason: "deprecatedEndpoint";
|
|
12
|
+
endpointName: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export declare function isDeprecatedError(err: Error): err is DeprecatedError;
|
|
16
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-client",
|
|
3
|
-
"version": "20.0
|
|
3
|
+
"version": "20.1.0",
|
|
4
4
|
"description": "Media API Web Client Library",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@atlaskit/chunkinator": "^4.1.0",
|
|
31
|
-
"@atlaskit/media-common": "^
|
|
31
|
+
"@atlaskit/media-common": "^3.0.0",
|
|
32
32
|
"@babel/runtime": "^7.0.0",
|
|
33
33
|
"dataloader": "^2.0.0",
|
|
34
34
|
"deep-equal": "^1.0.1",
|
|
@@ -42,14 +42,14 @@
|
|
|
42
42
|
"xstate": "4.20.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@atlaskit/media-core": "^34.0.
|
|
45
|
+
"@atlaskit/media-core": "^34.0.2",
|
|
46
46
|
"@emotion/react": "^11.7.1",
|
|
47
47
|
"react": "^16.8.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@atlaskit/button": "^16.5.0",
|
|
51
51
|
"@atlaskit/docs": "*",
|
|
52
|
-
"@atlaskit/media-card": "^74.
|
|
52
|
+
"@atlaskit/media-card": "^74.7.0",
|
|
53
53
|
"@atlaskit/media-core": "^34.0.0",
|
|
54
54
|
"@atlaskit/media-test-helpers": "^30.1.0",
|
|
55
55
|
"@atlaskit/ssr": "*",
|
package/report.api.md
CHANGED
|
@@ -82,13 +82,13 @@ export type ClientOptions = {
|
|
|
82
82
|
// @public (undocumented)
|
|
83
83
|
export class CollectionFetcher {
|
|
84
84
|
constructor(mediaStore: MediaStore);
|
|
85
|
-
// (undocumented)
|
|
85
|
+
// @deprecated (undocumented)
|
|
86
86
|
getItems(
|
|
87
87
|
collectionName: string,
|
|
88
88
|
params?: MediaStoreGetCollectionItemsParams,
|
|
89
89
|
traceContext?: MediaTraceContext,
|
|
90
90
|
): MediaSubscribable<MediaCollectionItem[]>;
|
|
91
|
-
// (undocumented)
|
|
91
|
+
// @deprecated (undocumented)
|
|
92
92
|
loadNextPage(
|
|
93
93
|
collectionName: string,
|
|
94
94
|
params?: MediaStoreGetCollectionItemsParams,
|
|
@@ -827,6 +827,7 @@ export type MediaClientErrorReason =
|
|
|
827
827
|
| 'clientAbortedRequest'
|
|
828
828
|
| 'clientOffline'
|
|
829
829
|
| 'clientTimeoutRequest'
|
|
830
|
+
| 'deprecatedEndpoint'
|
|
830
831
|
| 'emptyAuth'
|
|
831
832
|
| 'emptyItems'
|
|
832
833
|
| 'failedAuthProvider'
|
|
@@ -979,7 +980,7 @@ export class MediaStore {
|
|
|
979
980
|
artifactName: keyof MediaFileArtifacts,
|
|
980
981
|
collectionName?: string,
|
|
981
982
|
): Promise<string>;
|
|
982
|
-
// (undocumented)
|
|
983
|
+
// @deprecated (undocumented)
|
|
983
984
|
getCollectionItems(
|
|
984
985
|
collectionName: string,
|
|
985
986
|
params?: MediaStoreGetCollectionItemsParams,
|