@atlaskit/media-client 30.0.0 → 31.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 +16 -0
- package/dist/cjs/client/file-fetcher/index.js +26 -15
- package/dist/cjs/index.js +6 -0
- package/dist/cjs/models/file-state.js +4 -1
- package/dist/es2019/client/file-fetcher/index.js +14 -3
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/models/file-state.js +1 -0
- package/dist/esm/client/file-fetcher/index.js +26 -15
- package/dist/esm/index.js +1 -1
- package/dist/esm/models/file-state.js +3 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/models/file-state.d.ts +2 -0
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/models/file-state.d.ts +2 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/media-client
|
|
2
2
|
|
|
3
|
+
## 31.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#104917](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/104917)
|
|
8
|
+
[`f5b9e90ce5043`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f5b9e90ce5043) -
|
|
9
|
+
changed useFileHashes to take an array of identifiers which it will then pre-emptively fetch
|
|
10
|
+
metadata when it detects duplicates with missing hashes
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- [#104917](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/104917)
|
|
15
|
+
[`4c1c65faff476`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4c1c65faff476) -
|
|
16
|
+
Adding forceRefresh to fileState request to enable removing cache and forcing the refetching of
|
|
17
|
+
meta-data
|
|
18
|
+
|
|
3
19
|
## 30.0.0
|
|
4
20
|
|
|
5
21
|
### Major Changes
|
|
@@ -86,7 +86,7 @@ var FileFetcherImpl = exports.FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
86
86
|
});
|
|
87
87
|
});
|
|
88
88
|
// TODO: ----- ADD TICKET TO PASS TRACE ID to this.dataloader.load
|
|
89
|
-
(0, _defineProperty2.default)(this, "createDownloadFileStream", function (id, collectionName, occurrenceKey, includeHashForDuplicateFiles) {
|
|
89
|
+
(0, _defineProperty2.default)(this, "createDownloadFileStream", function (id, collectionName, occurrenceKey, includeHashForDuplicateFiles, forceRefresh) {
|
|
90
90
|
var subject = (0, _createMediaSubject.createMediaSubject)();
|
|
91
91
|
var poll = new _polling.PollingFunction();
|
|
92
92
|
|
|
@@ -99,16 +99,23 @@ var FileFetcherImpl = exports.FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
99
99
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
100
100
|
while (1) switch (_context.prev = _context.next) {
|
|
101
101
|
case 0:
|
|
102
|
-
|
|
102
|
+
if (forceRefresh) {
|
|
103
|
+
_this.dataloader.clear({
|
|
104
|
+
id: id,
|
|
105
|
+
collectionName: collectionName,
|
|
106
|
+
includeHashForDuplicateFiles: includeHashForDuplicateFiles
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
_context.next = 3;
|
|
103
110
|
return _this.dataloader.load({
|
|
104
111
|
id: id,
|
|
105
112
|
collectionName: collectionName,
|
|
106
113
|
includeHashForDuplicateFiles: includeHashForDuplicateFiles
|
|
107
114
|
});
|
|
108
|
-
case
|
|
115
|
+
case 3:
|
|
109
116
|
response = _context.sent;
|
|
110
117
|
if (!(0, _media.isNotFoundMediaItemDetails)(response)) {
|
|
111
|
-
_context.next =
|
|
118
|
+
_context.next = 6;
|
|
112
119
|
break;
|
|
113
120
|
}
|
|
114
121
|
throw new _error.FileFetcherError('emptyItems', {
|
|
@@ -117,9 +124,9 @@ var FileFetcherImpl = exports.FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
117
124
|
occurrenceKey: occurrenceKey,
|
|
118
125
|
traceContext: response.metadataTraceContext
|
|
119
126
|
});
|
|
120
|
-
case
|
|
127
|
+
case 6:
|
|
121
128
|
if (!(0, _detectEmptyFile.isEmptyFile)(response)) {
|
|
122
|
-
_context.next =
|
|
129
|
+
_context.next = 8;
|
|
123
130
|
break;
|
|
124
131
|
}
|
|
125
132
|
throw new _error.FileFetcherError('zeroVersionFile', {
|
|
@@ -128,20 +135,20 @@ var FileFetcherImpl = exports.FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
128
135
|
occurrenceKey: occurrenceKey,
|
|
129
136
|
traceContext: response.metadataTraceContext
|
|
130
137
|
});
|
|
131
|
-
case
|
|
138
|
+
case 8:
|
|
132
139
|
fileState = (0, _fileState2.mapMediaItemToFileState)(id, response);
|
|
133
140
|
subject.next(fileState);
|
|
134
141
|
_context.t0 = fileState.status;
|
|
135
|
-
_context.next = _context.t0 === 'processing' ?
|
|
142
|
+
_context.next = _context.t0 === 'processing' ? 13 : _context.t0 === 'processed' ? 15 : 17;
|
|
136
143
|
break;
|
|
137
|
-
case
|
|
144
|
+
case 13:
|
|
138
145
|
// the only case for continuing polling, otherwise this function is run once only
|
|
139
146
|
poll.next();
|
|
140
|
-
return _context.abrupt("break",
|
|
141
|
-
case
|
|
147
|
+
return _context.abrupt("break", 17);
|
|
148
|
+
case 15:
|
|
142
149
|
subject.complete();
|
|
143
|
-
return _context.abrupt("break",
|
|
144
|
-
case
|
|
150
|
+
return _context.abrupt("break", 17);
|
|
151
|
+
case 17:
|
|
145
152
|
case "end":
|
|
146
153
|
return _context.stop();
|
|
147
154
|
}
|
|
@@ -194,7 +201,8 @@ var FileFetcherImpl = exports.FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
194
201
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
195
202
|
var collectionName = options.collectionName,
|
|
196
203
|
occurrenceKey = options.occurrenceKey,
|
|
197
|
-
includeHashForDuplicateFiles = options.includeHashForDuplicateFiles
|
|
204
|
+
includeHashForDuplicateFiles = options.includeHashForDuplicateFiles,
|
|
205
|
+
forceRefresh = options.forceRefresh;
|
|
198
206
|
if (!(0, _uuidValidate.default)(id)) {
|
|
199
207
|
var subject = (0, _createMediaSubject.createMediaSubject)();
|
|
200
208
|
var err = new _error.FileFetcherError('invalidFileId', {
|
|
@@ -207,8 +215,11 @@ var FileFetcherImpl = exports.FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
207
215
|
this.setFileState(id, errorFileState);
|
|
208
216
|
return (0, _mediaSubscribable.fromObservable)(subject);
|
|
209
217
|
}
|
|
218
|
+
if (forceRefresh) {
|
|
219
|
+
(0, _fileStreamsCache.getFileStreamsCache)().remove(id);
|
|
220
|
+
}
|
|
210
221
|
return (0, _mediaSubscribable.fromObservable)((0, _fileStreamsCache.getFileStreamsCache)().getOrInsert(id, function () {
|
|
211
|
-
var subject = _this2.createDownloadFileStream(id, collectionName, undefined, includeHashForDuplicateFiles);
|
|
222
|
+
var subject = _this2.createDownloadFileStream(id, collectionName, undefined, includeHashForDuplicateFiles, forceRefresh);
|
|
212
223
|
subject.subscribe({
|
|
213
224
|
next: function next(fileState) {
|
|
214
225
|
_this2.setFileState(id, fileState);
|
package/dist/cjs/index.js
CHANGED
|
@@ -249,6 +249,12 @@ Object.defineProperty(exports, "isMediaStoreError", {
|
|
|
249
249
|
return _mediaStore.isMediaStoreError;
|
|
250
250
|
}
|
|
251
251
|
});
|
|
252
|
+
Object.defineProperty(exports, "isNonErrorFinalFileState", {
|
|
253
|
+
enumerable: true,
|
|
254
|
+
get: function get() {
|
|
255
|
+
return _fileState.isNonErrorFinalFileState;
|
|
256
|
+
}
|
|
257
|
+
});
|
|
252
258
|
Object.defineProperty(exports, "isPollingError", {
|
|
253
259
|
enumerable: true,
|
|
254
260
|
get: function get() {
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.mapMediaItemToFileState = exports.mapMediaFileToFileState = exports.isUploadingFileState = exports.isProcessingFileState = exports.isProcessedFileState = exports.isPreviewableFileState = exports.isImageRepresentationReady = exports.isFinalFileState = exports.isErrorFileState = void 0;
|
|
7
|
+
exports.mapMediaItemToFileState = exports.mapMediaFileToFileState = exports.isUploadingFileState = exports.isProcessingFileState = exports.isProcessedFileState = exports.isPreviewableFileState = exports.isNonErrorFinalFileState = exports.isImageRepresentationReady = exports.isFinalFileState = exports.isErrorFileState = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
10
10
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -26,6 +26,9 @@ var isPreviewableFileState = exports.isPreviewableFileState = function isPreview
|
|
|
26
26
|
var isFinalFileState = exports.isFinalFileState = function isFinalFileState(fileState) {
|
|
27
27
|
return ['processed', 'failed-processing', 'error'].includes(fileState.status);
|
|
28
28
|
};
|
|
29
|
+
var isNonErrorFinalFileState = exports.isNonErrorFinalFileState = function isNonErrorFinalFileState(fileState) {
|
|
30
|
+
return ['processed', 'failed-processing'].includes(fileState.status);
|
|
31
|
+
};
|
|
29
32
|
var isImageRepresentationReady = exports.isImageRepresentationReady = function isImageRepresentationReady(fileState) {
|
|
30
33
|
switch (fileState.status) {
|
|
31
34
|
case 'processing':
|
|
@@ -55,13 +55,20 @@ export class FileFetcherImpl {
|
|
|
55
55
|
});
|
|
56
56
|
});
|
|
57
57
|
// TODO: ----- ADD TICKET TO PASS TRACE ID to this.dataloader.load
|
|
58
|
-
_defineProperty(this, "createDownloadFileStream", (id, collectionName, occurrenceKey, includeHashForDuplicateFiles) => {
|
|
58
|
+
_defineProperty(this, "createDownloadFileStream", (id, collectionName, occurrenceKey, includeHashForDuplicateFiles, forceRefresh) => {
|
|
59
59
|
const subject = createMediaSubject();
|
|
60
60
|
const poll = new PollingFunction();
|
|
61
61
|
|
|
62
62
|
// ensure subject errors if polling exceeds max iterations or uncaught exception in executor
|
|
63
63
|
poll.onError = error => subject.error(error);
|
|
64
64
|
poll.execute(async () => {
|
|
65
|
+
if (forceRefresh) {
|
|
66
|
+
this.dataloader.clear({
|
|
67
|
+
id,
|
|
68
|
+
collectionName,
|
|
69
|
+
includeHashForDuplicateFiles
|
|
70
|
+
});
|
|
71
|
+
}
|
|
65
72
|
const response = await this.dataloader.load({
|
|
66
73
|
id,
|
|
67
74
|
collectionName,
|
|
@@ -142,7 +149,8 @@ export class FileFetcherImpl {
|
|
|
142
149
|
const {
|
|
143
150
|
collectionName,
|
|
144
151
|
occurrenceKey,
|
|
145
|
-
includeHashForDuplicateFiles
|
|
152
|
+
includeHashForDuplicateFiles,
|
|
153
|
+
forceRefresh
|
|
146
154
|
} = options;
|
|
147
155
|
if (!isValidId(id)) {
|
|
148
156
|
const subject = createMediaSubject();
|
|
@@ -156,8 +164,11 @@ export class FileFetcherImpl {
|
|
|
156
164
|
this.setFileState(id, errorFileState);
|
|
157
165
|
return fromObservable(subject);
|
|
158
166
|
}
|
|
167
|
+
if (forceRefresh) {
|
|
168
|
+
getFileStreamsCache().remove(id);
|
|
169
|
+
}
|
|
159
170
|
return fromObservable(getFileStreamsCache().getOrInsert(id, () => {
|
|
160
|
-
const subject = this.createDownloadFileStream(id, collectionName, undefined, includeHashForDuplicateFiles);
|
|
171
|
+
const subject = this.createDownloadFileStream(id, collectionName, undefined, includeHashForDuplicateFiles, forceRefresh);
|
|
161
172
|
subject.subscribe({
|
|
162
173
|
next: fileState => {
|
|
163
174
|
this.setFileState(id, fileState);
|
package/dist/es2019/index.js
CHANGED
|
@@ -3,7 +3,7 @@ export { UploadController } from './upload-controller';
|
|
|
3
3
|
export { isPreviewableType } from './models/media';
|
|
4
4
|
export { getArtifactUrl } from './models/artifacts';
|
|
5
5
|
export { isMediaClientError, getMediaClientErrorReason, isCommonMediaClientError, toCommonMediaClientError } from './models/errors';
|
|
6
|
-
export { isUploadingFileState, isProcessingFileState, isProcessedFileState, isErrorFileState, isPreviewableFileState, isFinalFileState, isImageRepresentationReady, mapMediaFileToFileState, mapMediaItemToFileState } from './models/file-state';
|
|
6
|
+
export { isUploadingFileState, isProcessingFileState, isProcessedFileState, isErrorFileState, isPreviewableFileState, isFinalFileState, isImageRepresentationReady, isNonErrorFinalFileState, mapMediaFileToFileState, mapMediaItemToFileState } from './models/file-state';
|
|
7
7
|
export { uploadFile } from './uploader';
|
|
8
8
|
export { request, RequestError, isRequestError, isRateLimitedError, createRequestErrorReason } from './utils/request';
|
|
9
9
|
export { isAbortedRequestError, createUrl } from './utils/request/helpers';
|
|
@@ -4,6 +4,7 @@ export const isProcessedFileState = fileState => fileState.status === 'processed
|
|
|
4
4
|
export const isErrorFileState = fileState => fileState.status === 'error';
|
|
5
5
|
export const isPreviewableFileState = fileState => !isErrorFileState(fileState) && !!fileState.preview;
|
|
6
6
|
export const isFinalFileState = fileState => ['processed', 'failed-processing', 'error'].includes(fileState.status);
|
|
7
|
+
export const isNonErrorFinalFileState = fileState => ['processed', 'failed-processing'].includes(fileState.status);
|
|
7
8
|
export const isImageRepresentationReady = fileState => {
|
|
8
9
|
switch (fileState.status) {
|
|
9
10
|
case 'processing':
|
|
@@ -68,7 +68,7 @@ export var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
68
68
|
});
|
|
69
69
|
});
|
|
70
70
|
// TODO: ----- ADD TICKET TO PASS TRACE ID to this.dataloader.load
|
|
71
|
-
_defineProperty(this, "createDownloadFileStream", function (id, collectionName, occurrenceKey, includeHashForDuplicateFiles) {
|
|
71
|
+
_defineProperty(this, "createDownloadFileStream", function (id, collectionName, occurrenceKey, includeHashForDuplicateFiles, forceRefresh) {
|
|
72
72
|
var subject = createMediaSubject();
|
|
73
73
|
var poll = new PollingFunction();
|
|
74
74
|
|
|
@@ -81,16 +81,23 @@ export var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
81
81
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
82
82
|
while (1) switch (_context.prev = _context.next) {
|
|
83
83
|
case 0:
|
|
84
|
-
|
|
84
|
+
if (forceRefresh) {
|
|
85
|
+
_this.dataloader.clear({
|
|
86
|
+
id: id,
|
|
87
|
+
collectionName: collectionName,
|
|
88
|
+
includeHashForDuplicateFiles: includeHashForDuplicateFiles
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
_context.next = 3;
|
|
85
92
|
return _this.dataloader.load({
|
|
86
93
|
id: id,
|
|
87
94
|
collectionName: collectionName,
|
|
88
95
|
includeHashForDuplicateFiles: includeHashForDuplicateFiles
|
|
89
96
|
});
|
|
90
|
-
case
|
|
97
|
+
case 3:
|
|
91
98
|
response = _context.sent;
|
|
92
99
|
if (!isNotFoundMediaItemDetails(response)) {
|
|
93
|
-
_context.next =
|
|
100
|
+
_context.next = 6;
|
|
94
101
|
break;
|
|
95
102
|
}
|
|
96
103
|
throw new FileFetcherError('emptyItems', {
|
|
@@ -99,9 +106,9 @@ export var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
99
106
|
occurrenceKey: occurrenceKey,
|
|
100
107
|
traceContext: response.metadataTraceContext
|
|
101
108
|
});
|
|
102
|
-
case
|
|
109
|
+
case 6:
|
|
103
110
|
if (!isEmptyFile(response)) {
|
|
104
|
-
_context.next =
|
|
111
|
+
_context.next = 8;
|
|
105
112
|
break;
|
|
106
113
|
}
|
|
107
114
|
throw new FileFetcherError('zeroVersionFile', {
|
|
@@ -110,20 +117,20 @@ export var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
110
117
|
occurrenceKey: occurrenceKey,
|
|
111
118
|
traceContext: response.metadataTraceContext
|
|
112
119
|
});
|
|
113
|
-
case
|
|
120
|
+
case 8:
|
|
114
121
|
fileState = mapMediaItemToFileState(id, response);
|
|
115
122
|
subject.next(fileState);
|
|
116
123
|
_context.t0 = fileState.status;
|
|
117
|
-
_context.next = _context.t0 === 'processing' ?
|
|
124
|
+
_context.next = _context.t0 === 'processing' ? 13 : _context.t0 === 'processed' ? 15 : 17;
|
|
118
125
|
break;
|
|
119
|
-
case
|
|
126
|
+
case 13:
|
|
120
127
|
// the only case for continuing polling, otherwise this function is run once only
|
|
121
128
|
poll.next();
|
|
122
|
-
return _context.abrupt("break",
|
|
123
|
-
case
|
|
129
|
+
return _context.abrupt("break", 17);
|
|
130
|
+
case 15:
|
|
124
131
|
subject.complete();
|
|
125
|
-
return _context.abrupt("break",
|
|
126
|
-
case
|
|
132
|
+
return _context.abrupt("break", 17);
|
|
133
|
+
case 17:
|
|
127
134
|
case "end":
|
|
128
135
|
return _context.stop();
|
|
129
136
|
}
|
|
@@ -176,7 +183,8 @@ export var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
176
183
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
177
184
|
var collectionName = options.collectionName,
|
|
178
185
|
occurrenceKey = options.occurrenceKey,
|
|
179
|
-
includeHashForDuplicateFiles = options.includeHashForDuplicateFiles
|
|
186
|
+
includeHashForDuplicateFiles = options.includeHashForDuplicateFiles,
|
|
187
|
+
forceRefresh = options.forceRefresh;
|
|
180
188
|
if (!isValidId(id)) {
|
|
181
189
|
var subject = createMediaSubject();
|
|
182
190
|
var err = new FileFetcherError('invalidFileId', {
|
|
@@ -189,8 +197,11 @@ export var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
189
197
|
this.setFileState(id, errorFileState);
|
|
190
198
|
return fromObservable(subject);
|
|
191
199
|
}
|
|
200
|
+
if (forceRefresh) {
|
|
201
|
+
getFileStreamsCache().remove(id);
|
|
202
|
+
}
|
|
192
203
|
return fromObservable(getFileStreamsCache().getOrInsert(id, function () {
|
|
193
|
-
var subject = _this2.createDownloadFileStream(id, collectionName, undefined, includeHashForDuplicateFiles);
|
|
204
|
+
var subject = _this2.createDownloadFileStream(id, collectionName, undefined, includeHashForDuplicateFiles, forceRefresh);
|
|
194
205
|
subject.subscribe({
|
|
195
206
|
next: function next(fileState) {
|
|
196
207
|
_this2.setFileState(id, fileState);
|
package/dist/esm/index.js
CHANGED
|
@@ -3,7 +3,7 @@ export { UploadController } from './upload-controller';
|
|
|
3
3
|
export { isPreviewableType } from './models/media';
|
|
4
4
|
export { getArtifactUrl } from './models/artifacts';
|
|
5
5
|
export { isMediaClientError, getMediaClientErrorReason, isCommonMediaClientError, toCommonMediaClientError } from './models/errors';
|
|
6
|
-
export { isUploadingFileState, isProcessingFileState, isProcessedFileState, isErrorFileState, isPreviewableFileState, isFinalFileState, isImageRepresentationReady, mapMediaFileToFileState, mapMediaItemToFileState } from './models/file-state';
|
|
6
|
+
export { isUploadingFileState, isProcessingFileState, isProcessedFileState, isErrorFileState, isPreviewableFileState, isFinalFileState, isImageRepresentationReady, isNonErrorFinalFileState, mapMediaFileToFileState, mapMediaItemToFileState } from './models/file-state';
|
|
7
7
|
export { uploadFile } from './uploader';
|
|
8
8
|
export { request, RequestError, isRequestError, isRateLimitedError, createRequestErrorReason } from './utils/request';
|
|
9
9
|
export { isAbortedRequestError, createUrl } from './utils/request/helpers';
|
|
@@ -19,6 +19,9 @@ export var isPreviewableFileState = function isPreviewableFileState(fileState) {
|
|
|
19
19
|
export var isFinalFileState = function isFinalFileState(fileState) {
|
|
20
20
|
return ['processed', 'failed-processing', 'error'].includes(fileState.status);
|
|
21
21
|
};
|
|
22
|
+
export var isNonErrorFinalFileState = function isNonErrorFinalFileState(fileState) {
|
|
23
|
+
return ['processed', 'failed-processing'].includes(fileState.status);
|
|
24
|
+
};
|
|
22
25
|
export var isImageRepresentationReady = function isImageRepresentationReady(fileState) {
|
|
23
26
|
switch (fileState.status) {
|
|
24
27
|
case 'processing':
|
package/dist/types/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export type { MediaFileProcessingStatus, MediaType, MediaFile, MediaRepresentati
|
|
|
8
8
|
export { getArtifactUrl } from './models/artifacts';
|
|
9
9
|
export { isMediaClientError, getMediaClientErrorReason, isCommonMediaClientError, toCommonMediaClientError, } from './models/errors';
|
|
10
10
|
export type { MediaClientError, MediaClientErrorReason, MediaClientErrorAttributes, } from './models/errors';
|
|
11
|
-
export { isUploadingFileState, isProcessingFileState, isProcessedFileState, isErrorFileState, isPreviewableFileState, isFinalFileState, isImageRepresentationReady, mapMediaFileToFileState, mapMediaItemToFileState, } from './models/file-state';
|
|
11
|
+
export { isUploadingFileState, isProcessingFileState, isProcessedFileState, isErrorFileState, isPreviewableFileState, isFinalFileState, isImageRepresentationReady, isNonErrorFinalFileState, mapMediaFileToFileState, mapMediaItemToFileState, } from './models/file-state';
|
|
12
12
|
export type { FileStatus, PreviewOptions, GetFileOptions, NonErrorFileState, PreviewableFileState, } from './models/file-state';
|
|
13
13
|
export type { FileState, FilePreview, ErrorFileState, UploadingFileState, ProcessingFileState, ProcessedFileState, ProcessingFailedState, MediaFileArtifact, MediaFileArtifacts, } from '@atlaskit/media-state';
|
|
14
14
|
export type { MobileUpload, MobileUploadStartEvent, MobileUploadProgressEvent, MobileUploadEndEvent, MobileUploadErrorEvent, } from './models/mobile-upload';
|
|
@@ -10,6 +10,7 @@ export interface GetFileOptions {
|
|
|
10
10
|
collectionName?: string;
|
|
11
11
|
occurrenceKey?: string;
|
|
12
12
|
includeHashForDuplicateFiles?: boolean;
|
|
13
|
+
forceRefresh?: boolean;
|
|
13
14
|
}
|
|
14
15
|
export interface PreviewableFileState {
|
|
15
16
|
preview: FilePreview | Promise<FilePreview>;
|
|
@@ -21,6 +22,7 @@ export declare const isProcessedFileState: (fileState: FileState) => fileState i
|
|
|
21
22
|
export declare const isErrorFileState: (fileState: FileState) => fileState is ErrorFileState;
|
|
22
23
|
export declare const isPreviewableFileState: (fileState: FileState) => fileState is (UploadingFileState | ProcessingFileState | ProcessedFileState | ProcessingFailedState) & PreviewableFileState;
|
|
23
24
|
export declare const isFinalFileState: (fileState: FileState) => fileState is ProcessedFileState | ErrorFileState | ProcessingFailedState;
|
|
25
|
+
export declare const isNonErrorFinalFileState: (fileState: FileState) => fileState is ProcessedFileState | ProcessingFailedState;
|
|
24
26
|
export declare const isImageRepresentationReady: (fileState: FileState) => boolean;
|
|
25
27
|
export declare const mapMediaFileToFileState: (mediaFile: MediaStoreResponse<MediaFile>) => FileState;
|
|
26
28
|
export declare const mapMediaItemToFileState: (id: string, item: MediaItemDetails) => FileState;
|
|
@@ -8,7 +8,7 @@ export type { MediaFileProcessingStatus, MediaType, MediaFile, MediaRepresentati
|
|
|
8
8
|
export { getArtifactUrl } from './models/artifacts';
|
|
9
9
|
export { isMediaClientError, getMediaClientErrorReason, isCommonMediaClientError, toCommonMediaClientError, } from './models/errors';
|
|
10
10
|
export type { MediaClientError, MediaClientErrorReason, MediaClientErrorAttributes, } from './models/errors';
|
|
11
|
-
export { isUploadingFileState, isProcessingFileState, isProcessedFileState, isErrorFileState, isPreviewableFileState, isFinalFileState, isImageRepresentationReady, mapMediaFileToFileState, mapMediaItemToFileState, } from './models/file-state';
|
|
11
|
+
export { isUploadingFileState, isProcessingFileState, isProcessedFileState, isErrorFileState, isPreviewableFileState, isFinalFileState, isImageRepresentationReady, isNonErrorFinalFileState, mapMediaFileToFileState, mapMediaItemToFileState, } from './models/file-state';
|
|
12
12
|
export type { FileStatus, PreviewOptions, GetFileOptions, NonErrorFileState, PreviewableFileState, } from './models/file-state';
|
|
13
13
|
export type { FileState, FilePreview, ErrorFileState, UploadingFileState, ProcessingFileState, ProcessedFileState, ProcessingFailedState, MediaFileArtifact, MediaFileArtifacts, } from '@atlaskit/media-state';
|
|
14
14
|
export type { MobileUpload, MobileUploadStartEvent, MobileUploadProgressEvent, MobileUploadEndEvent, MobileUploadErrorEvent, } from './models/mobile-upload';
|
|
@@ -10,6 +10,7 @@ export interface GetFileOptions {
|
|
|
10
10
|
collectionName?: string;
|
|
11
11
|
occurrenceKey?: string;
|
|
12
12
|
includeHashForDuplicateFiles?: boolean;
|
|
13
|
+
forceRefresh?: boolean;
|
|
13
14
|
}
|
|
14
15
|
export interface PreviewableFileState {
|
|
15
16
|
preview: FilePreview | Promise<FilePreview>;
|
|
@@ -21,6 +22,7 @@ export declare const isProcessedFileState: (fileState: FileState) => fileState i
|
|
|
21
22
|
export declare const isErrorFileState: (fileState: FileState) => fileState is ErrorFileState;
|
|
22
23
|
export declare const isPreviewableFileState: (fileState: FileState) => fileState is (UploadingFileState | ProcessingFileState | ProcessedFileState | ProcessingFailedState) & PreviewableFileState;
|
|
23
24
|
export declare const isFinalFileState: (fileState: FileState) => fileState is ProcessedFileState | ErrorFileState | ProcessingFailedState;
|
|
25
|
+
export declare const isNonErrorFinalFileState: (fileState: FileState) => fileState is ProcessedFileState | ProcessingFailedState;
|
|
24
26
|
export declare const isImageRepresentationReady: (fileState: FileState) => boolean;
|
|
25
27
|
export declare const mapMediaFileToFileState: (mediaFile: MediaStoreResponse<MediaFile>) => FileState;
|
|
26
28
|
export declare const mapMediaItemToFileState: (id: string, item: MediaItemDetails) => FileState;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-client",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "31.0.0",
|
|
4
4
|
"description": "Media API Web Client Library",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"@atlaskit/media-core": "^34.4.0",
|
|
58
58
|
"@atlaskit/media-state": "^1.5.0",
|
|
59
59
|
"@atlaskit/ssr": "*",
|
|
60
|
-
"@atlaskit/tokens": "^3.
|
|
60
|
+
"@atlaskit/tokens": "^3.2.0",
|
|
61
61
|
"@atlassian/feature-flags-test-utils": "0.2.3",
|
|
62
62
|
"@emotion/react": "^11.7.1",
|
|
63
63
|
"@types/deep-equal": "^1.0.1",
|