@atlaskit/media-client 20.0.1 → 20.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/cjs/client/collection-fetcher.js +4 -44
- package/dist/cjs/client/file-fetcher/error.js +3 -19
- package/dist/cjs/client/file-fetcher/index.js +72 -191
- package/dist/cjs/client/media-client.js +2 -26
- package/dist/cjs/client/media-store/error.js +1 -17
- package/dist/cjs/client/media-store/index.js +13 -103
- package/dist/cjs/client/media-store/resolveAuth.js +2 -23
- package/dist/cjs/client/mobile-upload.js +9 -22
- package/dist/cjs/client/stargate-client.js +0 -12
- package/dist/cjs/constants.js +0 -3
- package/dist/cjs/file-streams-cache.js +0 -11
- package/dist/cjs/globalMediaEventEmitter.js +0 -3
- package/dist/cjs/identifier.js +0 -8
- package/dist/cjs/index.js +0 -38
- package/dist/cjs/models/artifacts.js +0 -4
- package/dist/cjs/models/auth-headers.js +0 -2
- package/dist/cjs/models/auth-query-parameters.js +0 -2
- package/dist/cjs/models/errors/helpers.js +0 -2
- package/dist/cjs/models/errors/index.js +4 -20
- package/dist/cjs/models/file-state.js +10 -36
- package/dist/cjs/models/media.js +2 -8
- package/dist/cjs/upload-controller.js +0 -6
- package/dist/cjs/uploader/calculateChunkSize.js +1 -10
- package/dist/cjs/uploader/error.js +3 -19
- package/dist/cjs/uploader/index.js +3 -43
- package/dist/cjs/utils/checkWebpSupport.js +3 -7
- package/dist/cjs/utils/convertBase64ToBlob.js +0 -5
- package/dist/cjs/utils/createFileDataLoader.js +4 -28
- package/dist/cjs/utils/createMediaSubject.js +0 -4
- package/dist/cjs/utils/detectEmptyFile.js +8 -15
- package/dist/cjs/utils/getDimensionsFromBlob.js +0 -14
- package/dist/cjs/utils/getImageDimensionsFromBlob.js +0 -4
- package/dist/cjs/utils/getMediaTypeFromUploadableFile.js +0 -3
- package/dist/cjs/utils/getVideoDimensionsFromBlob.js +2 -8
- package/dist/cjs/utils/hashing/hasherCreator.js +0 -20
- package/dist/cjs/utils/hashing/simpleHasher.js +0 -12
- package/dist/cjs/utils/hashing/workerHasher.js +3 -24
- package/dist/cjs/utils/imageResizeModeToFileImageMode.js +0 -2
- package/dist/cjs/utils/isImageRemote.js +0 -5
- package/dist/cjs/utils/mediaSubscribable/fromObservable.js +2 -4
- package/dist/cjs/utils/mediaSubscribable/index.js +0 -2
- package/dist/cjs/utils/mediaSubscribable/toPromise.js +1 -3
- package/dist/cjs/utils/mobileUpload/error.js +3 -19
- package/dist/cjs/utils/mobileUpload/helpers.js +2 -26
- package/dist/cjs/utils/mobileUpload/index.js +0 -4
- package/dist/cjs/utils/mobileUpload/servicesCache.js +0 -2
- package/dist/cjs/utils/mobileUpload/stateMachine/index.js +0 -22
- package/dist/cjs/utils/mobileUpload/stateMachine/states/processing.js +0 -2
- package/dist/cjs/utils/mobileUpload/stateMachine/states/uploading.js +0 -7
- package/dist/cjs/utils/overrideMediaTypeIfUnknown.js +0 -4
- package/dist/cjs/utils/polling/errors.js +1 -17
- package/dist/cjs/utils/polling/index.js +1 -30
- package/dist/cjs/utils/request/errors.js +8 -24
- package/dist/cjs/utils/request/helpers.js +19 -103
- package/dist/cjs/utils/request/index.js +15 -26
- package/dist/cjs/utils/safeUnsubscribe.js +0 -2
- package/dist/cjs/utils/setTimeoutPromise.js +0 -4
- package/dist/cjs/utils/shouldFetchRemoteFileStates.js +0 -21
- package/dist/cjs/utils/url.js +4 -27
- package/dist/cjs/utils/with-media-client-hoc.js +12 -28
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/client/collection-fetcher.js +6 -18
- package/dist/es2019/client/file-fetcher/error.js +0 -2
- package/dist/es2019/client/file-fetcher/index.js +49 -91
- package/dist/es2019/client/media-client.js +3 -13
- package/dist/es2019/client/media-store/error.js +0 -2
- package/dist/es2019/client/media-store/index.js +37 -52
- package/dist/es2019/client/media-store/resolveAuth.js +1 -5
- package/dist/es2019/client/mobile-upload.js +0 -8
- package/dist/es2019/client/stargate-client.js +0 -3
- package/dist/es2019/constants.js +0 -1
- package/dist/es2019/file-streams-cache.js +0 -11
- package/dist/es2019/globalMediaEventEmitter.js +0 -4
- package/dist/es2019/index.js +4 -11
- package/dist/es2019/models/artifacts.js +0 -2
- package/dist/es2019/models/errors/index.js +5 -4
- package/dist/es2019/models/file-state.js +6 -7
- package/dist/es2019/models/media.js +2 -3
- package/dist/es2019/upload-controller.js +0 -3
- package/dist/es2019/uploader/calculateChunkSize.js +1 -4
- package/dist/es2019/uploader/error.js +0 -2
- package/dist/es2019/uploader/index.js +0 -13
- package/dist/es2019/utils/checkWebpSupport.js +3 -4
- package/dist/es2019/utils/convertBase64ToBlob.js +0 -2
- package/dist/es2019/utils/createFileDataLoader.js +6 -9
- package/dist/es2019/utils/createMediaSubject.js +0 -2
- package/dist/es2019/utils/detectEmptyFile.js +1 -5
- package/dist/es2019/utils/getDimensionsFromBlob.js +0 -3
- package/dist/es2019/utils/getImageDimensionsFromBlob.js +0 -2
- package/dist/es2019/utils/getVideoDimensionsFromBlob.js +2 -1
- package/dist/es2019/utils/hashing/hasherCreator.js +0 -2
- package/dist/es2019/utils/hashing/simpleHasher.js +0 -3
- package/dist/es2019/utils/hashing/workerHasher.js +1 -16
- package/dist/es2019/utils/isImageRemote.js +0 -2
- package/dist/es2019/utils/mediaSubscribable/fromObservable.js +2 -1
- package/dist/es2019/utils/mediaSubscribable/toPromise.js +1 -1
- package/dist/es2019/utils/mobileUpload/error.js +0 -2
- package/dist/es2019/utils/mobileUpload/helpers.js +2 -7
- package/dist/es2019/utils/mobileUpload/stateMachine/index.js +0 -2
- package/dist/es2019/utils/mobileUpload/stateMachine/states/uploading.js +2 -1
- package/dist/es2019/utils/overrideMediaTypeIfUnknown.js +0 -1
- package/dist/es2019/utils/polling/errors.js +0 -2
- package/dist/es2019/utils/polling/index.js +3 -20
- package/dist/es2019/utils/request/errors.js +0 -2
- package/dist/es2019/utils/request/helpers.js +24 -35
- package/dist/es2019/utils/request/index.js +2 -2
- package/dist/es2019/utils/shouldFetchRemoteFileStates.js +1 -5
- package/dist/es2019/utils/url.js +6 -14
- package/dist/es2019/utils/with-media-client-hoc.js +10 -7
- package/dist/es2019/version.json +1 -1
- package/dist/esm/client/collection-fetcher.js +4 -34
- package/dist/esm/client/file-fetcher/error.js +3 -12
- package/dist/esm/client/file-fetcher/index.js +74 -161
- package/dist/esm/client/media-client.js +3 -16
- package/dist/esm/client/media-store/error.js +1 -10
- package/dist/esm/client/media-store/index.js +13 -89
- package/dist/esm/client/media-store/resolveAuth.js +2 -13
- package/dist/esm/client/mobile-upload.js +9 -15
- package/dist/esm/client/stargate-client.js +0 -7
- package/dist/esm/constants.js +0 -1
- package/dist/esm/file-streams-cache.js +0 -6
- package/dist/esm/globalMediaEventEmitter.js +0 -1
- package/dist/esm/index.js +4 -11
- package/dist/esm/models/artifacts.js +0 -2
- package/dist/esm/models/errors/index.js +5 -12
- package/dist/esm/models/file-state.js +10 -17
- package/dist/esm/models/media.js +2 -3
- package/dist/esm/upload-controller.js +0 -2
- package/dist/esm/uploader/calculateChunkSize.js +1 -4
- package/dist/esm/uploader/error.js +3 -12
- package/dist/esm/uploader/index.js +3 -32
- package/dist/esm/utils/checkWebpSupport.js +3 -4
- package/dist/esm/utils/convertBase64ToBlob.js +0 -3
- package/dist/esm/utils/createFileDataLoader.js +4 -18
- package/dist/esm/utils/createMediaSubject.js +0 -2
- package/dist/esm/utils/detectEmptyFile.js +8 -12
- package/dist/esm/utils/getDimensionsFromBlob.js +0 -7
- package/dist/esm/utils/getImageDimensionsFromBlob.js +0 -2
- package/dist/esm/utils/getVideoDimensionsFromBlob.js +2 -3
- package/dist/esm/utils/hashing/hasherCreator.js +0 -9
- package/dist/esm/utils/hashing/simpleHasher.js +0 -4
- package/dist/esm/utils/hashing/workerHasher.js +3 -18
- package/dist/esm/utils/isImageRemote.js +0 -3
- package/dist/esm/utils/mediaSubscribable/fromObservable.js +2 -1
- package/dist/esm/utils/mediaSubscribable/toPromise.js +1 -1
- package/dist/esm/utils/mobileUpload/error.js +3 -12
- package/dist/esm/utils/mobileUpload/helpers.js +2 -11
- package/dist/esm/utils/mobileUpload/stateMachine/index.js +0 -6
- package/dist/esm/utils/mobileUpload/stateMachine/states/uploading.js +0 -3
- package/dist/esm/utils/overrideMediaTypeIfUnknown.js +0 -1
- package/dist/esm/utils/polling/errors.js +1 -10
- package/dist/esm/utils/polling/index.js +1 -27
- package/dist/esm/utils/request/errors.js +8 -17
- package/dist/esm/utils/request/helpers.js +22 -76
- package/dist/esm/utils/request/index.js +15 -20
- package/dist/esm/utils/shouldFetchRemoteFileStates.js +1 -15
- package/dist/esm/utils/url.js +4 -18
- package/dist/esm/utils/with-media-client-hoc.js +12 -17
- package/dist/esm/version.json +1 -1
- package/package.json +7 -5
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
@@ -18,90 +17,53 @@ Object.defineProperty(exports, "isFileFetcherError", {
|
|
|
18
17
|
return _error.isFileFetcherError;
|
|
19
18
|
}
|
|
20
19
|
});
|
|
21
|
-
|
|
22
20
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
23
|
-
|
|
24
21
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
25
|
-
|
|
26
22
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
27
|
-
|
|
28
23
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
29
|
-
|
|
30
24
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
31
|
-
|
|
32
25
|
var _Subscription = require("rxjs/Subscription");
|
|
33
|
-
|
|
34
26
|
var _of = require("rxjs/observable/of");
|
|
35
|
-
|
|
36
27
|
var _map = require("rxjs/operators/map");
|
|
37
|
-
|
|
38
28
|
var _concatMap = require("rxjs/operators/concatMap");
|
|
39
|
-
|
|
40
29
|
var _v = _interopRequireDefault(require("uuid/v4"));
|
|
41
|
-
|
|
42
30
|
require("setimmediate");
|
|
43
|
-
|
|
44
31
|
var _mediaCore = require("@atlaskit/media-core");
|
|
45
|
-
|
|
46
32
|
var _downloadUrl = require("@atlaskit/media-common/downloadUrl");
|
|
47
|
-
|
|
48
33
|
var _mediaStore = require("../media-store");
|
|
49
|
-
|
|
50
34
|
var _fileState = require("../../models/file-state");
|
|
51
|
-
|
|
52
35
|
var _error = require("./error");
|
|
53
|
-
|
|
54
36
|
var _uploader = require("../../uploader");
|
|
55
|
-
|
|
56
37
|
var _fileStreamsCache = require("../../file-streams-cache");
|
|
57
|
-
|
|
58
38
|
var _globalMediaEventEmitter = require("../../globalMediaEventEmitter");
|
|
59
|
-
|
|
60
39
|
var _constants = require("../../constants");
|
|
61
|
-
|
|
62
40
|
var _uuidValidate = _interopRequireDefault(require("uuid-validate"));
|
|
63
|
-
|
|
64
41
|
var _createFileDataLoader = require("../../utils/createFileDataLoader");
|
|
65
|
-
|
|
66
42
|
var _getMediaTypeFromUploadableFile = require("../../utils/getMediaTypeFromUploadableFile");
|
|
67
|
-
|
|
68
43
|
var _overrideMediaTypeIfUnknown = require("../../utils/overrideMediaTypeIfUnknown");
|
|
69
|
-
|
|
70
44
|
var _convertBase64ToBlob = require("../../utils/convertBase64ToBlob");
|
|
71
|
-
|
|
72
45
|
var _mediaSubscribable = require("../../utils/mediaSubscribable");
|
|
73
|
-
|
|
74
46
|
var _getDimensionsFromBlob = require("../../utils/getDimensionsFromBlob");
|
|
75
|
-
|
|
76
47
|
var _createMediaSubject = require("../../utils/createMediaSubject");
|
|
77
|
-
|
|
78
48
|
var _mediaTypeUtils = require("@atlaskit/media-common/mediaTypeUtils");
|
|
79
|
-
|
|
80
49
|
var _shouldFetchRemoteFileStates = require("../../utils/shouldFetchRemoteFileStates");
|
|
81
|
-
|
|
82
50
|
var _polling = require("../../utils/polling");
|
|
83
|
-
|
|
84
51
|
var _detectEmptyFile = require("../../utils/detectEmptyFile");
|
|
85
|
-
|
|
86
52
|
var _mediaCommon = require("@atlaskit/media-common");
|
|
87
|
-
|
|
88
53
|
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; }
|
|
89
|
-
|
|
90
54
|
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; }
|
|
91
|
-
|
|
92
55
|
var FileFetcherImpl = /*#__PURE__*/function () {
|
|
93
56
|
function FileFetcherImpl(mediaStore, featureFlags) {
|
|
94
57
|
var _this = this;
|
|
95
|
-
|
|
96
58
|
(0, _classCallCheck2.default)(this, FileFetcherImpl);
|
|
97
59
|
(0, _defineProperty2.default)(this, "createDownloadFileStream", function (id, collectionName, occurrenceKey) {
|
|
98
60
|
var subject = (0, _createMediaSubject.createMediaSubject)();
|
|
99
|
-
var poll = new _polling.PollingFunction();
|
|
61
|
+
var poll = new _polling.PollingFunction();
|
|
100
62
|
|
|
63
|
+
// ensure subject errors if polling exceeds max iterations or uncaught exception in executor
|
|
101
64
|
poll.onError = function (error) {
|
|
102
65
|
return subject.error(error);
|
|
103
66
|
};
|
|
104
|
-
|
|
105
67
|
poll.execute( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
106
68
|
var response, fileState;
|
|
107
69
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
@@ -113,47 +75,38 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
113
75
|
id: id,
|
|
114
76
|
collectionName: collectionName
|
|
115
77
|
});
|
|
116
|
-
|
|
117
78
|
case 2:
|
|
118
79
|
response = _context.sent;
|
|
119
|
-
|
|
120
80
|
if (response) {
|
|
121
81
|
_context.next = 5;
|
|
122
82
|
break;
|
|
123
83
|
}
|
|
124
|
-
|
|
125
84
|
throw new _error.FileFetcherError('emptyItems', id, {
|
|
126
85
|
collectionName: collectionName,
|
|
127
86
|
occurrenceKey: occurrenceKey
|
|
128
87
|
});
|
|
129
|
-
|
|
130
88
|
case 5:
|
|
131
89
|
if (!(0, _detectEmptyFile.isEmptyFile)(response)) {
|
|
132
90
|
_context.next = 7;
|
|
133
91
|
break;
|
|
134
92
|
}
|
|
135
|
-
|
|
136
93
|
throw new _error.FileFetcherError('zeroVersionFile', id, {
|
|
137
94
|
collectionName: collectionName,
|
|
138
95
|
occurrenceKey: occurrenceKey
|
|
139
96
|
});
|
|
140
|
-
|
|
141
97
|
case 7:
|
|
142
98
|
fileState = (0, _fileState.mapMediaItemToFileState)(id, response);
|
|
143
99
|
subject.next(fileState);
|
|
144
100
|
_context.t0 = fileState.status;
|
|
145
101
|
_context.next = _context.t0 === 'processing' ? 12 : _context.t0 === 'processed' ? 14 : 16;
|
|
146
102
|
break;
|
|
147
|
-
|
|
148
103
|
case 12:
|
|
149
104
|
// the only case for continuing polling, otherwise this function is run once only
|
|
150
105
|
poll.next();
|
|
151
106
|
return _context.abrupt("break", 16);
|
|
152
|
-
|
|
153
107
|
case 14:
|
|
154
108
|
subject.complete();
|
|
155
109
|
return _context.abrupt("break", 16);
|
|
156
|
-
|
|
157
110
|
case 16:
|
|
158
111
|
case "end":
|
|
159
112
|
return _context.stop();
|
|
@@ -168,21 +121,18 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
168
121
|
if (typeof file.content === 'string') {
|
|
169
122
|
file.content = (0, _convertBase64ToBlob.convertBase64ToBlob)(file.content);
|
|
170
123
|
}
|
|
171
|
-
|
|
172
124
|
var content = file.content,
|
|
173
|
-
|
|
174
|
-
|
|
125
|
+
_file$name = file.name,
|
|
126
|
+
name = _file$name === void 0 ? '' : _file$name;
|
|
175
127
|
var id = upfrontId.id,
|
|
176
|
-
|
|
177
|
-
var preview;
|
|
178
|
-
|
|
128
|
+
occurrenceKey = upfrontId.occurrenceKey;
|
|
129
|
+
var preview;
|
|
130
|
+
// TODO [MSW-796]: get file size for base64
|
|
179
131
|
var size = 0;
|
|
180
132
|
var mimeType = '';
|
|
181
|
-
|
|
182
133
|
if (content instanceof Blob) {
|
|
183
134
|
size = content.size;
|
|
184
135
|
mimeType = content.type;
|
|
185
|
-
|
|
186
136
|
if ((0, _mediaTypeUtils.isMimeTypeSupportedByBrowser)(content.type)) {
|
|
187
137
|
preview = {
|
|
188
138
|
value: content,
|
|
@@ -190,7 +140,6 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
190
140
|
};
|
|
191
141
|
}
|
|
192
142
|
}
|
|
193
|
-
|
|
194
143
|
var mediaType = (0, _getMediaTypeFromUploadableFile.getMediaTypeFromUploadableFile)(file);
|
|
195
144
|
return {
|
|
196
145
|
id: id,
|
|
@@ -206,16 +155,13 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
206
155
|
this.featureFlags = featureFlags;
|
|
207
156
|
this.dataloader = (0, _createFileDataLoader.createFileDataloader)(mediaStore);
|
|
208
157
|
}
|
|
209
|
-
|
|
210
158
|
(0, _createClass2.default)(FileFetcherImpl, [{
|
|
211
159
|
key: "getFileState",
|
|
212
160
|
value: function getFileState(id) {
|
|
213
161
|
var _this2 = this;
|
|
214
|
-
|
|
215
162
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
216
163
|
var collectionName = options.collectionName,
|
|
217
|
-
|
|
218
|
-
|
|
164
|
+
occurrenceKey = options.occurrenceKey;
|
|
219
165
|
if (!(0, _uuidValidate.default)(id)) {
|
|
220
166
|
var subject = (0, _createMediaSubject.createMediaSubject)();
|
|
221
167
|
subject.error(new _error.FileFetcherError('invalidFileId', id, {
|
|
@@ -224,7 +170,6 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
224
170
|
}));
|
|
225
171
|
return (0, _mediaSubscribable.fromObservable)(subject);
|
|
226
172
|
}
|
|
227
|
-
|
|
228
173
|
return (0, _mediaSubscribable.fromObservable)((0, _fileStreamsCache.getFileStreamsCache)().getOrInsert(id, function () {
|
|
229
174
|
return _this2.createDownloadFileStream(id, collectionName);
|
|
230
175
|
}));
|
|
@@ -243,8 +188,9 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
243
188
|
key: "getFileBinaryURL",
|
|
244
189
|
value: function getFileBinaryURL(id, collectionName) {
|
|
245
190
|
return this.mediaStore.getFileBinaryURL(id, collectionName);
|
|
246
|
-
}
|
|
191
|
+
}
|
|
247
192
|
|
|
193
|
+
// TODO: ----- ADD TICKET TO PASS TRACE ID to this.dataloader.load
|
|
248
194
|
}, {
|
|
249
195
|
key: "touchFiles",
|
|
250
196
|
value: function touchFiles(descriptors, collection, traceContext) {
|
|
@@ -281,7 +227,6 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
281
227
|
value: function () {
|
|
282
228
|
var _uploadExternal = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(url, collection, traceContext) {
|
|
283
229
|
var _this3 = this;
|
|
284
|
-
|
|
285
230
|
var uploadableFileUpfrontIds, id, occurrenceKey, subject, deferredBlob, preview, name, fileState;
|
|
286
231
|
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
287
232
|
while (1) {
|
|
@@ -304,19 +249,15 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
304
249
|
case 0:
|
|
305
250
|
_context2.next = 2;
|
|
306
251
|
return deferredBlob;
|
|
307
|
-
|
|
308
252
|
case 2:
|
|
309
253
|
blob = _context2.sent;
|
|
310
|
-
|
|
311
254
|
if (!blob) {
|
|
312
255
|
reject('Could not fetch the blob');
|
|
313
256
|
}
|
|
314
|
-
|
|
315
257
|
resolve({
|
|
316
258
|
value: blob,
|
|
317
259
|
origin: 'remote'
|
|
318
260
|
});
|
|
319
|
-
|
|
320
261
|
case 5:
|
|
321
262
|
case "end":
|
|
322
263
|
return _context2.stop();
|
|
@@ -324,13 +265,11 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
324
265
|
}
|
|
325
266
|
}, _callee2);
|
|
326
267
|
}));
|
|
327
|
-
|
|
328
268
|
return function (_x4, _x5) {
|
|
329
269
|
return _ref3.apply(this, arguments);
|
|
330
270
|
};
|
|
331
271
|
}());
|
|
332
272
|
name = url.split('/').pop() || ''; // we create a initial fileState with the minimum info that we have at this point
|
|
333
|
-
|
|
334
273
|
fileState = {
|
|
335
274
|
status: 'processing',
|
|
336
275
|
name: name,
|
|
@@ -341,8 +280,8 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
341
280
|
occurrenceKey: occurrenceKey,
|
|
342
281
|
preview: preview
|
|
343
282
|
};
|
|
344
|
-
subject.next(fileState);
|
|
345
|
-
|
|
283
|
+
subject.next(fileState);
|
|
284
|
+
// we save it into the cache as soon as possible, in case someone subscribes
|
|
346
285
|
(0, _fileStreamsCache.getFileStreamsCache)().set(id, subject);
|
|
347
286
|
return _context4.abrupt("return", new Promise( /*#__PURE__*/function () {
|
|
348
287
|
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(resolve, reject) {
|
|
@@ -353,17 +292,13 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
353
292
|
case 0:
|
|
354
293
|
_context3.next = 2;
|
|
355
294
|
return deferredBlob;
|
|
356
|
-
|
|
357
295
|
case 2:
|
|
358
296
|
blob = _context3.sent;
|
|
359
|
-
|
|
360
297
|
if (blob) {
|
|
361
298
|
_context3.next = 5;
|
|
362
299
|
break;
|
|
363
300
|
}
|
|
364
|
-
|
|
365
301
|
return _context3.abrupt("return", reject('Could not download remote file'));
|
|
366
|
-
|
|
367
302
|
case 5:
|
|
368
303
|
type = blob.type, size = blob.size;
|
|
369
304
|
file = {
|
|
@@ -373,7 +308,6 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
373
308
|
name: name
|
|
374
309
|
};
|
|
375
310
|
mediaType = (0, _mediaTypeUtils.getMediaTypeFromMimeType)(type); // we emit a richer state after the blob is fetched
|
|
376
|
-
|
|
377
311
|
subject.next({
|
|
378
312
|
status: 'processing',
|
|
379
313
|
name: name,
|
|
@@ -383,20 +317,17 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
383
317
|
id: id,
|
|
384
318
|
occurrenceKey: occurrenceKey,
|
|
385
319
|
preview: preview
|
|
386
|
-
});
|
|
387
|
-
|
|
320
|
+
});
|
|
321
|
+
// we don't want to wait for the file to be upload
|
|
388
322
|
_this3.upload(file, undefined, uploadableFileUpfrontIds, traceContext);
|
|
389
|
-
|
|
390
323
|
_context3.next = 12;
|
|
391
324
|
return (0, _getDimensionsFromBlob.getDimensionsFromBlob)(mediaType, blob);
|
|
392
|
-
|
|
393
325
|
case 12:
|
|
394
326
|
dimensions = _context3.sent;
|
|
395
327
|
resolve({
|
|
396
328
|
dimensions: dimensions,
|
|
397
329
|
uploadableFileUpfrontIds: uploadableFileUpfrontIds
|
|
398
330
|
});
|
|
399
|
-
|
|
400
331
|
case 14:
|
|
401
332
|
case "end":
|
|
402
333
|
return _context3.stop();
|
|
@@ -404,12 +335,10 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
404
335
|
}
|
|
405
336
|
}, _callee3);
|
|
406
337
|
}));
|
|
407
|
-
|
|
408
338
|
return function (_x6, _x7) {
|
|
409
339
|
return _ref4.apply(this, arguments);
|
|
410
340
|
};
|
|
411
341
|
}()));
|
|
412
|
-
|
|
413
342
|
case 10:
|
|
414
343
|
case "end":
|
|
415
344
|
return _context4.stop();
|
|
@@ -417,27 +346,24 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
417
346
|
}
|
|
418
347
|
}, _callee4, this);
|
|
419
348
|
}));
|
|
420
|
-
|
|
421
349
|
function uploadExternal(_x, _x2, _x3) {
|
|
422
350
|
return _uploadExternal.apply(this, arguments);
|
|
423
351
|
}
|
|
424
|
-
|
|
425
352
|
return uploadExternal;
|
|
426
353
|
}()
|
|
427
354
|
}, {
|
|
428
355
|
key: "uploadAwlaysPullFileStates",
|
|
429
|
-
value:
|
|
356
|
+
value:
|
|
357
|
+
// TODO: make this the public upload method when the FF is removed
|
|
430
358
|
function uploadAwlaysPullFileStates(file, controller, uploadableFileUpfrontIds, traceContext) {
|
|
431
359
|
var _this4 = this;
|
|
432
|
-
|
|
433
360
|
var collection = file.collection;
|
|
434
361
|
var upfrontId = uploadableFileUpfrontIds || this.generateUploadableFileUpfrontIds(collection, traceContext);
|
|
435
362
|
var id = upfrontId.id,
|
|
436
|
-
|
|
363
|
+
occurrenceKey = upfrontId.occurrenceKey;
|
|
437
364
|
var stateBase = this.getUploadingFileStateBase(file, upfrontId);
|
|
438
365
|
var subject = (0, _createMediaSubject.createMediaSubject)();
|
|
439
366
|
(0, _fileStreamsCache.getFileStreamsCache)().set(id, subject);
|
|
440
|
-
|
|
441
367
|
var onProgress = function onProgress(progress) {
|
|
442
368
|
subject.next(_objectSpread(_objectSpread({
|
|
443
369
|
status: 'uploading'
|
|
@@ -445,33 +371,29 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
445
371
|
progress: progress
|
|
446
372
|
}));
|
|
447
373
|
};
|
|
448
|
-
|
|
449
374
|
var processingSubscription = new _Subscription.Subscription();
|
|
450
|
-
|
|
451
375
|
var onUploadFinish = function onUploadFinish(error) {
|
|
452
376
|
if (error) {
|
|
453
377
|
return subject.error(error);
|
|
454
378
|
}
|
|
455
|
-
|
|
456
379
|
processingSubscription = _this4.createDownloadFileStream(id, collection, occurrenceKey).pipe((0, _map.map)(function (remoteFileState) {
|
|
457
380
|
return _objectSpread(_objectSpread(_objectSpread({}, stateBase), remoteFileState), (0, _overrideMediaTypeIfUnknown.overrideMediaTypeIfUnknown)(remoteFileState, stateBase.mediaType));
|
|
458
381
|
})).subscribe(subject);
|
|
459
382
|
};
|
|
460
|
-
|
|
461
383
|
var _uploadFile = (0, _uploader.uploadFile)(file, this.mediaStore, upfrontId, {
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
384
|
+
onUploadFinish: onUploadFinish,
|
|
385
|
+
onProgress: onProgress
|
|
386
|
+
}, traceContext),
|
|
387
|
+
cancel = _uploadFile.cancel;
|
|
467
388
|
controller === null || controller === void 0 ? void 0 : controller.setAbort(function () {
|
|
468
|
-
cancel();
|
|
389
|
+
cancel();
|
|
390
|
+
// TODO: filestate should turn to "Aborted" or something.
|
|
469
391
|
// Consider canceling an upload that is already finished
|
|
470
|
-
|
|
471
392
|
processingSubscription.unsubscribe();
|
|
472
|
-
});
|
|
473
|
-
// (otherwise in newUploadService file-converting event will be emitted before files-added)
|
|
393
|
+
});
|
|
474
394
|
|
|
395
|
+
// We should report progress asynchronously, since this is what consumer expects
|
|
396
|
+
// (otherwise in newUploadService file-converting event will be emitted before files-added)
|
|
475
397
|
setTimeout(onProgress, 0, 0);
|
|
476
398
|
return (0, _mediaSubscribable.fromObservable)(subject);
|
|
477
399
|
}
|
|
@@ -479,34 +401,28 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
479
401
|
key: "uploadConditionallyPullFileStates",
|
|
480
402
|
value: function uploadConditionallyPullFileStates(file, controller, uploadableFileUpfrontIds, traceContext) {
|
|
481
403
|
var _this5 = this;
|
|
482
|
-
|
|
483
404
|
if (typeof file.content === 'string') {
|
|
484
405
|
file.content = (0, _convertBase64ToBlob.convertBase64ToBlob)(file.content);
|
|
485
406
|
}
|
|
486
|
-
|
|
487
407
|
var content = file.content,
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
408
|
+
_file$name2 = file.name,
|
|
409
|
+
name = _file$name2 === void 0 ? '' : _file$name2,
|
|
410
|
+
collection = file.collection;
|
|
492
411
|
if (!uploadableFileUpfrontIds) {
|
|
493
412
|
uploadableFileUpfrontIds = this.generateUploadableFileUpfrontIds(collection, traceContext);
|
|
494
413
|
}
|
|
495
|
-
|
|
496
414
|
var id = uploadableFileUpfrontIds.id;
|
|
497
415
|
var occurrenceKey = uploadableFileUpfrontIds.occurrenceKey;
|
|
498
416
|
var mimeType = '';
|
|
499
417
|
var size = 0;
|
|
500
|
-
var preview;
|
|
501
|
-
|
|
418
|
+
var preview;
|
|
419
|
+
// TODO [MSW-796]: get file size for base64
|
|
502
420
|
var mediaType = (0, _getMediaTypeFromUploadableFile.getMediaTypeFromUploadableFile)(file);
|
|
503
421
|
var subject = (0, _createMediaSubject.createMediaSubject)();
|
|
504
422
|
var processingSubscription = new _Subscription.Subscription();
|
|
505
|
-
|
|
506
423
|
if (content instanceof Blob) {
|
|
507
424
|
size = content.size;
|
|
508
425
|
mimeType = content.type;
|
|
509
|
-
|
|
510
426
|
if ((0, _mediaTypeUtils.isMimeTypeSupportedByBrowser)(content.type)) {
|
|
511
427
|
preview = {
|
|
512
428
|
value: content,
|
|
@@ -514,7 +430,6 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
514
430
|
};
|
|
515
431
|
}
|
|
516
432
|
}
|
|
517
|
-
|
|
518
433
|
var stateBase = {
|
|
519
434
|
id: id,
|
|
520
435
|
occurrenceKey: occurrenceKey,
|
|
@@ -524,7 +439,6 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
524
439
|
mimeType: mimeType,
|
|
525
440
|
preview: preview
|
|
526
441
|
};
|
|
527
|
-
|
|
528
442
|
var onProgress = function onProgress(progress) {
|
|
529
443
|
subject.next(_objectSpread(_objectSpread({
|
|
530
444
|
status: 'uploading'
|
|
@@ -532,68 +446,61 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
532
446
|
progress: progress
|
|
533
447
|
}));
|
|
534
448
|
};
|
|
535
|
-
|
|
536
449
|
var onUploadFinish = function onUploadFinish(error) {
|
|
537
450
|
if (error) {
|
|
538
451
|
return subject.error(error);
|
|
539
452
|
}
|
|
540
|
-
|
|
541
453
|
processingSubscription.add((0, _shouldFetchRemoteFileStates.shouldFetchRemoteFileStatesObservable)(mediaType, mimeType, preview).pipe((0, _concatMap.concatMap)(function (shouldFetchRemoteFileStates) {
|
|
542
454
|
if (shouldFetchRemoteFileStates) {
|
|
543
455
|
return _this5.createDownloadFileStream(id, collection, occurrenceKey).pipe((0, _map.map)(function (remoteFileState) {
|
|
544
456
|
return _objectSpread(_objectSpread(_objectSpread({}, stateBase), remoteFileState), (0, _overrideMediaTypeIfUnknown.overrideMediaTypeIfUnknown)(remoteFileState, mediaType));
|
|
545
457
|
}));
|
|
546
458
|
}
|
|
547
|
-
|
|
548
459
|
return (0, _of.of)(_objectSpread({
|
|
549
460
|
status: 'processing',
|
|
550
461
|
representations: {}
|
|
551
462
|
}, stateBase));
|
|
552
463
|
})).subscribe(subject));
|
|
553
464
|
};
|
|
554
|
-
|
|
555
465
|
var _uploadFile2 = (0, _uploader.uploadFile)(file, this.mediaStore, uploadableFileUpfrontIds, {
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
466
|
+
onUploadFinish: onUploadFinish,
|
|
467
|
+
onProgress: onProgress
|
|
468
|
+
}, traceContext),
|
|
469
|
+
cancel = _uploadFile2.cancel;
|
|
470
|
+
(0, _fileStreamsCache.getFileStreamsCache)().set(id, subject);
|
|
560
471
|
|
|
561
|
-
|
|
472
|
+
// We should report progress asynchronously, since this is what consumer expects
|
|
562
473
|
// (otherwise in newUploadService file-converting event will be emitted before files-added)
|
|
563
|
-
|
|
564
474
|
setTimeout(function () {
|
|
565
475
|
onProgress(0);
|
|
566
476
|
}, 0);
|
|
567
|
-
|
|
568
477
|
if (controller) {
|
|
569
478
|
controller.setAbort(function () {
|
|
570
479
|
cancel();
|
|
571
480
|
processingSubscription.unsubscribe();
|
|
572
481
|
});
|
|
573
482
|
}
|
|
574
|
-
|
|
575
483
|
return (0, _mediaSubscribable.fromObservable)(subject);
|
|
576
484
|
}
|
|
577
485
|
}, {
|
|
578
486
|
key: "upload",
|
|
579
487
|
value: function upload(file, controller, uploadableFileUpfrontIds, traceContext) {
|
|
580
488
|
var shouldAlwaysFetchFileState = (0, _mediaCommon.getMediaFeatureFlag)('fetchFileStateAfterUpload', this.featureFlags);
|
|
581
|
-
|
|
582
489
|
if (shouldAlwaysFetchFileState) {
|
|
583
490
|
return this.uploadAwlaysPullFileStates(file, controller, uploadableFileUpfrontIds, traceContext);
|
|
584
491
|
}
|
|
585
|
-
|
|
586
492
|
return this.uploadConditionallyPullFileStates(file, controller, uploadableFileUpfrontIds, traceContext);
|
|
587
|
-
}
|
|
493
|
+
}
|
|
588
494
|
|
|
495
|
+
// TODO: ----- ADD TICKET
|
|
589
496
|
}, {
|
|
590
497
|
key: "downloadBinary",
|
|
591
498
|
value: function () {
|
|
592
499
|
var _downloadBinary = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(id) {
|
|
593
500
|
var name,
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
501
|
+
collectionName,
|
|
502
|
+
url,
|
|
503
|
+
_args5 = arguments;
|
|
597
504
|
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
598
505
|
while (1) {
|
|
599
506
|
switch (_context5.prev = _context5.next) {
|
|
@@ -602,19 +509,16 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
602
509
|
collectionName = _args5.length > 2 ? _args5[2] : undefined;
|
|
603
510
|
_context5.next = 4;
|
|
604
511
|
return this.mediaStore.getFileBinaryURL(id, collectionName);
|
|
605
|
-
|
|
606
512
|
case 4:
|
|
607
513
|
url = _context5.sent;
|
|
608
514
|
(0, _downloadUrl.downloadUrl)(url, {
|
|
609
515
|
name: name
|
|
610
516
|
});
|
|
611
|
-
|
|
612
517
|
_globalMediaEventEmitter.globalMediaEventEmitter.emit('media-viewed', {
|
|
613
518
|
fileId: id,
|
|
614
519
|
isUserCollection: collectionName === _constants.RECENTS_COLLECTION,
|
|
615
520
|
viewingLevel: 'download'
|
|
616
521
|
});
|
|
617
|
-
|
|
618
522
|
case 7:
|
|
619
523
|
case "end":
|
|
620
524
|
return _context5.stop();
|
|
@@ -622,11 +526,9 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
622
526
|
}
|
|
623
527
|
}, _callee5, this);
|
|
624
528
|
}));
|
|
625
|
-
|
|
626
529
|
function downloadBinary(_x8) {
|
|
627
530
|
return _downloadBinary.apply(this, arguments);
|
|
628
531
|
}
|
|
629
|
-
|
|
630
532
|
return downloadBinary;
|
|
631
533
|
}()
|
|
632
534
|
}, {
|
|
@@ -634,35 +536,34 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
634
536
|
value: function () {
|
|
635
537
|
var _copyFile = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(source, destination) {
|
|
636
538
|
var options,
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
539
|
+
traceContext,
|
|
540
|
+
authProvider,
|
|
541
|
+
sourceCollection,
|
|
542
|
+
id,
|
|
543
|
+
destinationAuthProvider,
|
|
544
|
+
destinationCollectionName,
|
|
545
|
+
replaceFileId,
|
|
546
|
+
occurrenceKey,
|
|
547
|
+
preview,
|
|
548
|
+
mimeType,
|
|
549
|
+
mediaStore,
|
|
550
|
+
owner,
|
|
551
|
+
body,
|
|
552
|
+
params,
|
|
553
|
+
cache,
|
|
554
|
+
processingSubscription,
|
|
555
|
+
_yield$mediaStore$cop,
|
|
556
|
+
copiedFile,
|
|
557
|
+
copiedFileWithMimeType,
|
|
558
|
+
copiedId,
|
|
559
|
+
copiedMimeType,
|
|
560
|
+
mediaType,
|
|
561
|
+
copiedFileState,
|
|
562
|
+
fileCache,
|
|
563
|
+
subject,
|
|
564
|
+
previewOverride,
|
|
565
|
+
_fileCache,
|
|
566
|
+
_args6 = arguments;
|
|
666
567
|
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
667
568
|
while (1) {
|
|
668
569
|
switch (_context6.prev = _context6.next) {
|
|
@@ -680,7 +581,6 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
680
581
|
return authProvider({
|
|
681
582
|
collectionName: sourceCollection
|
|
682
583
|
});
|
|
683
|
-
|
|
684
584
|
case 9:
|
|
685
585
|
_context6.t1 = _context6.sent;
|
|
686
586
|
owner = (0, _context6.t0)(_context6.t1);
|
|
@@ -700,7 +600,6 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
700
600
|
_context6.prev = 14;
|
|
701
601
|
_context6.next = 17;
|
|
702
602
|
return mediaStore.copyFileWithToken(body, params, traceContext);
|
|
703
|
-
|
|
704
603
|
case 17:
|
|
705
604
|
_yield$mediaStore$cop = _context6.sent;
|
|
706
605
|
copiedFile = _yield$mediaStore$cop.data;
|
|
@@ -710,38 +609,32 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
710
609
|
} : undefined);
|
|
711
610
|
copiedId = copiedFileWithMimeType.id, copiedMimeType = copiedFileWithMimeType.mimeType; // backend may return an "unknown" mediaType just after the copy
|
|
712
611
|
// it's better to deduce it from "copiedMimeType" using getMediaTypeFromMimeType()
|
|
713
|
-
|
|
714
612
|
mediaType = copiedMimeType ? (0, _mediaTypeUtils.getMediaTypeFromMimeType)(copiedMimeType) : 'unknown';
|
|
715
613
|
copiedFileState = (0, _fileState.mapMediaFileToFileState)({
|
|
716
614
|
data: copiedFileWithMimeType
|
|
717
615
|
});
|
|
718
616
|
fileCache = cache.get(copiedId);
|
|
719
617
|
subject = fileCache || (0, _createMediaSubject.createMediaSubject)(); // if we were passed a "preview", we propagate it into the copiedFileState
|
|
720
|
-
|
|
721
618
|
previewOverride = !(0, _fileState.isErrorFileState)(copiedFileState) && !!preview ? {
|
|
722
619
|
preview: preview
|
|
723
620
|
} : {};
|
|
724
|
-
_context6.t2 = !(0, _fileState.isFinalFileState)(copiedFileState) &&
|
|
621
|
+
_context6.t2 = !(0, _fileState.isFinalFileState)(copiedFileState) &&
|
|
622
|
+
// mimeType should always be returned by "copyFileWithToken"
|
|
725
623
|
// but in case it's not, we don't want to penalize "copyFile"
|
|
726
624
|
copiedMimeType;
|
|
727
|
-
|
|
728
625
|
if (!_context6.t2) {
|
|
729
626
|
_context6.next = 31;
|
|
730
627
|
break;
|
|
731
628
|
}
|
|
732
|
-
|
|
733
629
|
_context6.next = 30;
|
|
734
630
|
return (0, _shouldFetchRemoteFileStates.shouldFetchRemoteFileStates)(mediaType, copiedMimeType, preview);
|
|
735
|
-
|
|
736
631
|
case 30:
|
|
737
632
|
_context6.t2 = _context6.sent;
|
|
738
|
-
|
|
739
633
|
case 31:
|
|
740
634
|
if (!_context6.t2) {
|
|
741
635
|
_context6.next = 36;
|
|
742
636
|
break;
|
|
743
637
|
}
|
|
744
|
-
|
|
745
638
|
subject.next(_objectSpread(_objectSpread(_objectSpread({}, copiedFileState), (0, _overrideMediaTypeIfUnknown.overrideMediaTypeIfUnknown)(copiedFileState, mediaType)), previewOverride));
|
|
746
639
|
processingSubscription = this.createDownloadFileStream(copiedId, destinationCollectionName, occurrenceKey).subscribe({
|
|
747
640
|
next: function next(remoteFileState) {
|
|
@@ -756,30 +649,23 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
756
649
|
});
|
|
757
650
|
_context6.next = 37;
|
|
758
651
|
break;
|
|
759
|
-
|
|
760
652
|
case 36:
|
|
761
653
|
if (!(0, _fileState.isProcessingFileState)(copiedFileState)) {
|
|
762
654
|
subject.next(_objectSpread(_objectSpread({}, copiedFileState), !(0, _fileState.isErrorFileState)(copiedFileState) && previewOverride));
|
|
763
655
|
}
|
|
764
|
-
|
|
765
656
|
case 37:
|
|
766
657
|
if (!cache.has(copiedId)) {
|
|
767
658
|
(0, _fileStreamsCache.getFileStreamsCache)().set(copiedId, subject);
|
|
768
659
|
}
|
|
769
|
-
|
|
770
660
|
return _context6.abrupt("return", copiedFile);
|
|
771
|
-
|
|
772
661
|
case 41:
|
|
773
662
|
_context6.prev = 41;
|
|
774
663
|
_context6.t3 = _context6["catch"](14);
|
|
775
|
-
|
|
776
664
|
if (processingSubscription) {
|
|
777
665
|
processingSubscription.unsubscribe();
|
|
778
666
|
}
|
|
779
|
-
|
|
780
667
|
if (replaceFileId) {
|
|
781
668
|
_fileCache = cache.get(replaceFileId);
|
|
782
|
-
|
|
783
669
|
if (_fileCache) {
|
|
784
670
|
_fileCache.error(_context6.t3);
|
|
785
671
|
} else {
|
|
@@ -787,9 +673,7 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
787
673
|
cache.set(id, (0, _createMediaSubject.createMediaSubject)(_context6.t3));
|
|
788
674
|
}
|
|
789
675
|
}
|
|
790
|
-
|
|
791
676
|
throw _context6.t3;
|
|
792
|
-
|
|
793
677
|
case 46:
|
|
794
678
|
case "end":
|
|
795
679
|
return _context6.stop();
|
|
@@ -797,15 +681,12 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
797
681
|
}
|
|
798
682
|
}, _callee6, this, [[14, 41]]);
|
|
799
683
|
}));
|
|
800
|
-
|
|
801
684
|
function copyFile(_x9, _x10) {
|
|
802
685
|
return _copyFile.apply(this, arguments);
|
|
803
686
|
}
|
|
804
|
-
|
|
805
687
|
return copyFile;
|
|
806
688
|
}()
|
|
807
689
|
}]);
|
|
808
690
|
return FileFetcherImpl;
|
|
809
691
|
}();
|
|
810
|
-
|
|
811
692
|
exports.FileFetcherImpl = FileFetcherImpl;
|