@atlaskit/media-client 20.0.0 → 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 +13 -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 +152 -167
- package/dist/cjs/client/media-client.js +3 -27
- 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 +138 -70
- package/dist/es2019/client/media-client.js +4 -14
- 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 +154 -137
- package/dist/esm/client/media-client.js +4 -17
- 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/dist/types/client/file-fetcher/index.d.ts +6 -2
- package/package.json +8 -6
- package/report.api.md +4 -1
|
@@ -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,88 +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
|
-
|
|
52
|
+
var _mediaCommon = require("@atlaskit/media-common");
|
|
86
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; }
|
|
87
|
-
|
|
88
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; }
|
|
89
|
-
|
|
90
55
|
var FileFetcherImpl = /*#__PURE__*/function () {
|
|
91
|
-
function FileFetcherImpl(mediaStore) {
|
|
56
|
+
function FileFetcherImpl(mediaStore, featureFlags) {
|
|
92
57
|
var _this = this;
|
|
93
|
-
|
|
94
58
|
(0, _classCallCheck2.default)(this, FileFetcherImpl);
|
|
95
59
|
(0, _defineProperty2.default)(this, "createDownloadFileStream", function (id, collectionName, occurrenceKey) {
|
|
96
60
|
var subject = (0, _createMediaSubject.createMediaSubject)();
|
|
97
|
-
var poll = new _polling.PollingFunction();
|
|
61
|
+
var poll = new _polling.PollingFunction();
|
|
98
62
|
|
|
63
|
+
// ensure subject errors if polling exceeds max iterations or uncaught exception in executor
|
|
99
64
|
poll.onError = function (error) {
|
|
100
65
|
return subject.error(error);
|
|
101
66
|
};
|
|
102
|
-
|
|
103
67
|
poll.execute( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
104
68
|
var response, fileState;
|
|
105
69
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
@@ -111,47 +75,38 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
111
75
|
id: id,
|
|
112
76
|
collectionName: collectionName
|
|
113
77
|
});
|
|
114
|
-
|
|
115
78
|
case 2:
|
|
116
79
|
response = _context.sent;
|
|
117
|
-
|
|
118
80
|
if (response) {
|
|
119
81
|
_context.next = 5;
|
|
120
82
|
break;
|
|
121
83
|
}
|
|
122
|
-
|
|
123
84
|
throw new _error.FileFetcherError('emptyItems', id, {
|
|
124
85
|
collectionName: collectionName,
|
|
125
86
|
occurrenceKey: occurrenceKey
|
|
126
87
|
});
|
|
127
|
-
|
|
128
88
|
case 5:
|
|
129
89
|
if (!(0, _detectEmptyFile.isEmptyFile)(response)) {
|
|
130
90
|
_context.next = 7;
|
|
131
91
|
break;
|
|
132
92
|
}
|
|
133
|
-
|
|
134
93
|
throw new _error.FileFetcherError('zeroVersionFile', id, {
|
|
135
94
|
collectionName: collectionName,
|
|
136
95
|
occurrenceKey: occurrenceKey
|
|
137
96
|
});
|
|
138
|
-
|
|
139
97
|
case 7:
|
|
140
98
|
fileState = (0, _fileState.mapMediaItemToFileState)(id, response);
|
|
141
99
|
subject.next(fileState);
|
|
142
100
|
_context.t0 = fileState.status;
|
|
143
101
|
_context.next = _context.t0 === 'processing' ? 12 : _context.t0 === 'processed' ? 14 : 16;
|
|
144
102
|
break;
|
|
145
|
-
|
|
146
103
|
case 12:
|
|
147
104
|
// the only case for continuing polling, otherwise this function is run once only
|
|
148
105
|
poll.next();
|
|
149
106
|
return _context.abrupt("break", 16);
|
|
150
|
-
|
|
151
107
|
case 14:
|
|
152
108
|
subject.complete();
|
|
153
109
|
return _context.abrupt("break", 16);
|
|
154
|
-
|
|
155
110
|
case 16:
|
|
156
111
|
case "end":
|
|
157
112
|
return _context.stop();
|
|
@@ -161,19 +116,52 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
161
116
|
})));
|
|
162
117
|
return subject;
|
|
163
118
|
});
|
|
119
|
+
(0, _defineProperty2.default)(this, "getUploadingFileStateBase", function (file, upfrontId) {
|
|
120
|
+
// TODO: DO not modify the input parameter 'content' attribute
|
|
121
|
+
if (typeof file.content === 'string') {
|
|
122
|
+
file.content = (0, _convertBase64ToBlob.convertBase64ToBlob)(file.content);
|
|
123
|
+
}
|
|
124
|
+
var content = file.content,
|
|
125
|
+
_file$name = file.name,
|
|
126
|
+
name = _file$name === void 0 ? '' : _file$name;
|
|
127
|
+
var id = upfrontId.id,
|
|
128
|
+
occurrenceKey = upfrontId.occurrenceKey;
|
|
129
|
+
var preview;
|
|
130
|
+
// TODO [MSW-796]: get file size for base64
|
|
131
|
+
var size = 0;
|
|
132
|
+
var mimeType = '';
|
|
133
|
+
if (content instanceof Blob) {
|
|
134
|
+
size = content.size;
|
|
135
|
+
mimeType = content.type;
|
|
136
|
+
if ((0, _mediaTypeUtils.isMimeTypeSupportedByBrowser)(content.type)) {
|
|
137
|
+
preview = {
|
|
138
|
+
value: content,
|
|
139
|
+
origin: 'local'
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
var mediaType = (0, _getMediaTypeFromUploadableFile.getMediaTypeFromUploadableFile)(file);
|
|
144
|
+
return {
|
|
145
|
+
id: id,
|
|
146
|
+
occurrenceKey: occurrenceKey,
|
|
147
|
+
name: name,
|
|
148
|
+
size: size,
|
|
149
|
+
mediaType: mediaType,
|
|
150
|
+
mimeType: mimeType,
|
|
151
|
+
preview: preview
|
|
152
|
+
};
|
|
153
|
+
});
|
|
164
154
|
this.mediaStore = mediaStore;
|
|
155
|
+
this.featureFlags = featureFlags;
|
|
165
156
|
this.dataloader = (0, _createFileDataLoader.createFileDataloader)(mediaStore);
|
|
166
157
|
}
|
|
167
|
-
|
|
168
158
|
(0, _createClass2.default)(FileFetcherImpl, [{
|
|
169
159
|
key: "getFileState",
|
|
170
160
|
value: function getFileState(id) {
|
|
171
161
|
var _this2 = this;
|
|
172
|
-
|
|
173
162
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
174
163
|
var collectionName = options.collectionName,
|
|
175
|
-
|
|
176
|
-
|
|
164
|
+
occurrenceKey = options.occurrenceKey;
|
|
177
165
|
if (!(0, _uuidValidate.default)(id)) {
|
|
178
166
|
var subject = (0, _createMediaSubject.createMediaSubject)();
|
|
179
167
|
subject.error(new _error.FileFetcherError('invalidFileId', id, {
|
|
@@ -182,7 +170,6 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
182
170
|
}));
|
|
183
171
|
return (0, _mediaSubscribable.fromObservable)(subject);
|
|
184
172
|
}
|
|
185
|
-
|
|
186
173
|
return (0, _mediaSubscribable.fromObservable)((0, _fileStreamsCache.getFileStreamsCache)().getOrInsert(id, function () {
|
|
187
174
|
return _this2.createDownloadFileStream(id, collectionName);
|
|
188
175
|
}));
|
|
@@ -201,8 +188,9 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
201
188
|
key: "getFileBinaryURL",
|
|
202
189
|
value: function getFileBinaryURL(id, collectionName) {
|
|
203
190
|
return this.mediaStore.getFileBinaryURL(id, collectionName);
|
|
204
|
-
}
|
|
191
|
+
}
|
|
205
192
|
|
|
193
|
+
// TODO: ----- ADD TICKET TO PASS TRACE ID to this.dataloader.load
|
|
206
194
|
}, {
|
|
207
195
|
key: "touchFiles",
|
|
208
196
|
value: function touchFiles(descriptors, collection, traceContext) {
|
|
@@ -239,7 +227,6 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
239
227
|
value: function () {
|
|
240
228
|
var _uploadExternal = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(url, collection, traceContext) {
|
|
241
229
|
var _this3 = this;
|
|
242
|
-
|
|
243
230
|
var uploadableFileUpfrontIds, id, occurrenceKey, subject, deferredBlob, preview, name, fileState;
|
|
244
231
|
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
245
232
|
while (1) {
|
|
@@ -262,19 +249,15 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
262
249
|
case 0:
|
|
263
250
|
_context2.next = 2;
|
|
264
251
|
return deferredBlob;
|
|
265
|
-
|
|
266
252
|
case 2:
|
|
267
253
|
blob = _context2.sent;
|
|
268
|
-
|
|
269
254
|
if (!blob) {
|
|
270
255
|
reject('Could not fetch the blob');
|
|
271
256
|
}
|
|
272
|
-
|
|
273
257
|
resolve({
|
|
274
258
|
value: blob,
|
|
275
259
|
origin: 'remote'
|
|
276
260
|
});
|
|
277
|
-
|
|
278
261
|
case 5:
|
|
279
262
|
case "end":
|
|
280
263
|
return _context2.stop();
|
|
@@ -282,13 +265,11 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
282
265
|
}
|
|
283
266
|
}, _callee2);
|
|
284
267
|
}));
|
|
285
|
-
|
|
286
268
|
return function (_x4, _x5) {
|
|
287
269
|
return _ref3.apply(this, arguments);
|
|
288
270
|
};
|
|
289
271
|
}());
|
|
290
272
|
name = url.split('/').pop() || ''; // we create a initial fileState with the minimum info that we have at this point
|
|
291
|
-
|
|
292
273
|
fileState = {
|
|
293
274
|
status: 'processing',
|
|
294
275
|
name: name,
|
|
@@ -299,8 +280,8 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
299
280
|
occurrenceKey: occurrenceKey,
|
|
300
281
|
preview: preview
|
|
301
282
|
};
|
|
302
|
-
subject.next(fileState);
|
|
303
|
-
|
|
283
|
+
subject.next(fileState);
|
|
284
|
+
// we save it into the cache as soon as possible, in case someone subscribes
|
|
304
285
|
(0, _fileStreamsCache.getFileStreamsCache)().set(id, subject);
|
|
305
286
|
return _context4.abrupt("return", new Promise( /*#__PURE__*/function () {
|
|
306
287
|
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(resolve, reject) {
|
|
@@ -311,17 +292,13 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
311
292
|
case 0:
|
|
312
293
|
_context3.next = 2;
|
|
313
294
|
return deferredBlob;
|
|
314
|
-
|
|
315
295
|
case 2:
|
|
316
296
|
blob = _context3.sent;
|
|
317
|
-
|
|
318
297
|
if (blob) {
|
|
319
298
|
_context3.next = 5;
|
|
320
299
|
break;
|
|
321
300
|
}
|
|
322
|
-
|
|
323
301
|
return _context3.abrupt("return", reject('Could not download remote file'));
|
|
324
|
-
|
|
325
302
|
case 5:
|
|
326
303
|
type = blob.type, size = blob.size;
|
|
327
304
|
file = {
|
|
@@ -331,7 +308,6 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
331
308
|
name: name
|
|
332
309
|
};
|
|
333
310
|
mediaType = (0, _mediaTypeUtils.getMediaTypeFromMimeType)(type); // we emit a richer state after the blob is fetched
|
|
334
|
-
|
|
335
311
|
subject.next({
|
|
336
312
|
status: 'processing',
|
|
337
313
|
name: name,
|
|
@@ -341,20 +317,17 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
341
317
|
id: id,
|
|
342
318
|
occurrenceKey: occurrenceKey,
|
|
343
319
|
preview: preview
|
|
344
|
-
});
|
|
345
|
-
|
|
320
|
+
});
|
|
321
|
+
// we don't want to wait for the file to be upload
|
|
346
322
|
_this3.upload(file, undefined, uploadableFileUpfrontIds, traceContext);
|
|
347
|
-
|
|
348
323
|
_context3.next = 12;
|
|
349
324
|
return (0, _getDimensionsFromBlob.getDimensionsFromBlob)(mediaType, blob);
|
|
350
|
-
|
|
351
325
|
case 12:
|
|
352
326
|
dimensions = _context3.sent;
|
|
353
327
|
resolve({
|
|
354
328
|
dimensions: dimensions,
|
|
355
329
|
uploadableFileUpfrontIds: uploadableFileUpfrontIds
|
|
356
330
|
});
|
|
357
|
-
|
|
358
331
|
case 14:
|
|
359
332
|
case "end":
|
|
360
333
|
return _context3.stop();
|
|
@@ -362,12 +335,10 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
362
335
|
}
|
|
363
336
|
}, _callee3);
|
|
364
337
|
}));
|
|
365
|
-
|
|
366
338
|
return function (_x6, _x7) {
|
|
367
339
|
return _ref4.apply(this, arguments);
|
|
368
340
|
};
|
|
369
341
|
}()));
|
|
370
|
-
|
|
371
342
|
case 10:
|
|
372
343
|
case "end":
|
|
373
344
|
return _context4.stop();
|
|
@@ -375,45 +346,83 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
375
346
|
}
|
|
376
347
|
}, _callee4, this);
|
|
377
348
|
}));
|
|
378
|
-
|
|
379
349
|
function uploadExternal(_x, _x2, _x3) {
|
|
380
350
|
return _uploadExternal.apply(this, arguments);
|
|
381
351
|
}
|
|
382
|
-
|
|
383
352
|
return uploadExternal;
|
|
384
353
|
}()
|
|
385
354
|
}, {
|
|
386
|
-
key: "
|
|
387
|
-
value:
|
|
355
|
+
key: "uploadAwlaysPullFileStates",
|
|
356
|
+
value:
|
|
357
|
+
// TODO: make this the public upload method when the FF is removed
|
|
358
|
+
function uploadAwlaysPullFileStates(file, controller, uploadableFileUpfrontIds, traceContext) {
|
|
388
359
|
var _this4 = this;
|
|
360
|
+
var collection = file.collection;
|
|
361
|
+
var upfrontId = uploadableFileUpfrontIds || this.generateUploadableFileUpfrontIds(collection, traceContext);
|
|
362
|
+
var id = upfrontId.id,
|
|
363
|
+
occurrenceKey = upfrontId.occurrenceKey;
|
|
364
|
+
var stateBase = this.getUploadingFileStateBase(file, upfrontId);
|
|
365
|
+
var subject = (0, _createMediaSubject.createMediaSubject)();
|
|
366
|
+
(0, _fileStreamsCache.getFileStreamsCache)().set(id, subject);
|
|
367
|
+
var onProgress = function onProgress(progress) {
|
|
368
|
+
subject.next(_objectSpread(_objectSpread({
|
|
369
|
+
status: 'uploading'
|
|
370
|
+
}, stateBase), {}, {
|
|
371
|
+
progress: progress
|
|
372
|
+
}));
|
|
373
|
+
};
|
|
374
|
+
var processingSubscription = new _Subscription.Subscription();
|
|
375
|
+
var onUploadFinish = function onUploadFinish(error) {
|
|
376
|
+
if (error) {
|
|
377
|
+
return subject.error(error);
|
|
378
|
+
}
|
|
379
|
+
processingSubscription = _this4.createDownloadFileStream(id, collection, occurrenceKey).pipe((0, _map.map)(function (remoteFileState) {
|
|
380
|
+
return _objectSpread(_objectSpread(_objectSpread({}, stateBase), remoteFileState), (0, _overrideMediaTypeIfUnknown.overrideMediaTypeIfUnknown)(remoteFileState, stateBase.mediaType));
|
|
381
|
+
})).subscribe(subject);
|
|
382
|
+
};
|
|
383
|
+
var _uploadFile = (0, _uploader.uploadFile)(file, this.mediaStore, upfrontId, {
|
|
384
|
+
onUploadFinish: onUploadFinish,
|
|
385
|
+
onProgress: onProgress
|
|
386
|
+
}, traceContext),
|
|
387
|
+
cancel = _uploadFile.cancel;
|
|
388
|
+
controller === null || controller === void 0 ? void 0 : controller.setAbort(function () {
|
|
389
|
+
cancel();
|
|
390
|
+
// TODO: filestate should turn to "Aborted" or something.
|
|
391
|
+
// Consider canceling an upload that is already finished
|
|
392
|
+
processingSubscription.unsubscribe();
|
|
393
|
+
});
|
|
389
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)
|
|
397
|
+
setTimeout(onProgress, 0, 0);
|
|
398
|
+
return (0, _mediaSubscribable.fromObservable)(subject);
|
|
399
|
+
}
|
|
400
|
+
}, {
|
|
401
|
+
key: "uploadConditionallyPullFileStates",
|
|
402
|
+
value: function uploadConditionallyPullFileStates(file, controller, uploadableFileUpfrontIds, traceContext) {
|
|
403
|
+
var _this5 = this;
|
|
390
404
|
if (typeof file.content === 'string') {
|
|
391
405
|
file.content = (0, _convertBase64ToBlob.convertBase64ToBlob)(file.content);
|
|
392
406
|
}
|
|
393
|
-
|
|
394
407
|
var content = file.content,
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
408
|
+
_file$name2 = file.name,
|
|
409
|
+
name = _file$name2 === void 0 ? '' : _file$name2,
|
|
410
|
+
collection = file.collection;
|
|
399
411
|
if (!uploadableFileUpfrontIds) {
|
|
400
412
|
uploadableFileUpfrontIds = this.generateUploadableFileUpfrontIds(collection, traceContext);
|
|
401
413
|
}
|
|
402
|
-
|
|
403
414
|
var id = uploadableFileUpfrontIds.id;
|
|
404
415
|
var occurrenceKey = uploadableFileUpfrontIds.occurrenceKey;
|
|
405
416
|
var mimeType = '';
|
|
406
417
|
var size = 0;
|
|
407
|
-
var preview;
|
|
408
|
-
|
|
418
|
+
var preview;
|
|
419
|
+
// TODO [MSW-796]: get file size for base64
|
|
409
420
|
var mediaType = (0, _getMediaTypeFromUploadableFile.getMediaTypeFromUploadableFile)(file);
|
|
410
421
|
var subject = (0, _createMediaSubject.createMediaSubject)();
|
|
411
422
|
var processingSubscription = new _Subscription.Subscription();
|
|
412
|
-
|
|
413
423
|
if (content instanceof Blob) {
|
|
414
424
|
size = content.size;
|
|
415
425
|
mimeType = content.type;
|
|
416
|
-
|
|
417
426
|
if ((0, _mediaTypeUtils.isMimeTypeSupportedByBrowser)(content.type)) {
|
|
418
427
|
preview = {
|
|
419
428
|
value: content,
|
|
@@ -421,7 +430,6 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
421
430
|
};
|
|
422
431
|
}
|
|
423
432
|
}
|
|
424
|
-
|
|
425
433
|
var stateBase = {
|
|
426
434
|
id: id,
|
|
427
435
|
occurrenceKey: occurrenceKey,
|
|
@@ -431,7 +439,6 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
431
439
|
mimeType: mimeType,
|
|
432
440
|
preview: preview
|
|
433
441
|
};
|
|
434
|
-
|
|
435
442
|
var onProgress = function onProgress(progress) {
|
|
436
443
|
subject.next(_objectSpread(_objectSpread({
|
|
437
444
|
status: 'uploading'
|
|
@@ -439,57 +446,61 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
439
446
|
progress: progress
|
|
440
447
|
}));
|
|
441
448
|
};
|
|
442
|
-
|
|
443
449
|
var onUploadFinish = function onUploadFinish(error) {
|
|
444
450
|
if (error) {
|
|
445
451
|
return subject.error(error);
|
|
446
452
|
}
|
|
447
|
-
|
|
448
453
|
processingSubscription.add((0, _shouldFetchRemoteFileStates.shouldFetchRemoteFileStatesObservable)(mediaType, mimeType, preview).pipe((0, _concatMap.concatMap)(function (shouldFetchRemoteFileStates) {
|
|
449
454
|
if (shouldFetchRemoteFileStates) {
|
|
450
|
-
return
|
|
455
|
+
return _this5.createDownloadFileStream(id, collection, occurrenceKey).pipe((0, _map.map)(function (remoteFileState) {
|
|
451
456
|
return _objectSpread(_objectSpread(_objectSpread({}, stateBase), remoteFileState), (0, _overrideMediaTypeIfUnknown.overrideMediaTypeIfUnknown)(remoteFileState, mediaType));
|
|
452
457
|
}));
|
|
453
458
|
}
|
|
454
|
-
|
|
455
459
|
return (0, _of.of)(_objectSpread({
|
|
456
460
|
status: 'processing',
|
|
457
461
|
representations: {}
|
|
458
462
|
}, stateBase));
|
|
459
463
|
})).subscribe(subject));
|
|
460
464
|
};
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
465
|
+
var _uploadFile2 = (0, _uploader.uploadFile)(file, this.mediaStore, uploadableFileUpfrontIds, {
|
|
466
|
+
onUploadFinish: onUploadFinish,
|
|
467
|
+
onProgress: onProgress
|
|
468
|
+
}, traceContext),
|
|
469
|
+
cancel = _uploadFile2.cancel;
|
|
470
|
+
(0, _fileStreamsCache.getFileStreamsCache)().set(id, subject);
|
|
471
|
+
|
|
472
|
+
// We should report progress asynchronously, since this is what consumer expects
|
|
469
473
|
// (otherwise in newUploadService file-converting event will be emitted before files-added)
|
|
470
|
-
|
|
471
474
|
setTimeout(function () {
|
|
472
475
|
onProgress(0);
|
|
473
476
|
}, 0);
|
|
474
|
-
|
|
475
477
|
if (controller) {
|
|
476
478
|
controller.setAbort(function () {
|
|
477
479
|
cancel();
|
|
478
480
|
processingSubscription.unsubscribe();
|
|
479
481
|
});
|
|
480
482
|
}
|
|
481
|
-
|
|
482
483
|
return (0, _mediaSubscribable.fromObservable)(subject);
|
|
483
|
-
}
|
|
484
|
+
}
|
|
485
|
+
}, {
|
|
486
|
+
key: "upload",
|
|
487
|
+
value: function upload(file, controller, uploadableFileUpfrontIds, traceContext) {
|
|
488
|
+
var shouldAlwaysFetchFileState = (0, _mediaCommon.getMediaFeatureFlag)('fetchFileStateAfterUpload', this.featureFlags);
|
|
489
|
+
if (shouldAlwaysFetchFileState) {
|
|
490
|
+
return this.uploadAwlaysPullFileStates(file, controller, uploadableFileUpfrontIds, traceContext);
|
|
491
|
+
}
|
|
492
|
+
return this.uploadConditionallyPullFileStates(file, controller, uploadableFileUpfrontIds, traceContext);
|
|
493
|
+
}
|
|
484
494
|
|
|
495
|
+
// TODO: ----- ADD TICKET
|
|
485
496
|
}, {
|
|
486
497
|
key: "downloadBinary",
|
|
487
498
|
value: function () {
|
|
488
499
|
var _downloadBinary = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(id) {
|
|
489
500
|
var name,
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
501
|
+
collectionName,
|
|
502
|
+
url,
|
|
503
|
+
_args5 = arguments;
|
|
493
504
|
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
494
505
|
while (1) {
|
|
495
506
|
switch (_context5.prev = _context5.next) {
|
|
@@ -498,19 +509,16 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
498
509
|
collectionName = _args5.length > 2 ? _args5[2] : undefined;
|
|
499
510
|
_context5.next = 4;
|
|
500
511
|
return this.mediaStore.getFileBinaryURL(id, collectionName);
|
|
501
|
-
|
|
502
512
|
case 4:
|
|
503
513
|
url = _context5.sent;
|
|
504
514
|
(0, _downloadUrl.downloadUrl)(url, {
|
|
505
515
|
name: name
|
|
506
516
|
});
|
|
507
|
-
|
|
508
517
|
_globalMediaEventEmitter.globalMediaEventEmitter.emit('media-viewed', {
|
|
509
518
|
fileId: id,
|
|
510
519
|
isUserCollection: collectionName === _constants.RECENTS_COLLECTION,
|
|
511
520
|
viewingLevel: 'download'
|
|
512
521
|
});
|
|
513
|
-
|
|
514
522
|
case 7:
|
|
515
523
|
case "end":
|
|
516
524
|
return _context5.stop();
|
|
@@ -518,11 +526,9 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
518
526
|
}
|
|
519
527
|
}, _callee5, this);
|
|
520
528
|
}));
|
|
521
|
-
|
|
522
529
|
function downloadBinary(_x8) {
|
|
523
530
|
return _downloadBinary.apply(this, arguments);
|
|
524
531
|
}
|
|
525
|
-
|
|
526
532
|
return downloadBinary;
|
|
527
533
|
}()
|
|
528
534
|
}, {
|
|
@@ -530,35 +536,34 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
530
536
|
value: function () {
|
|
531
537
|
var _copyFile = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(source, destination) {
|
|
532
538
|
var options,
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
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;
|
|
562
567
|
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
563
568
|
while (1) {
|
|
564
569
|
switch (_context6.prev = _context6.next) {
|
|
@@ -576,7 +581,6 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
576
581
|
return authProvider({
|
|
577
582
|
collectionName: sourceCollection
|
|
578
583
|
});
|
|
579
|
-
|
|
580
584
|
case 9:
|
|
581
585
|
_context6.t1 = _context6.sent;
|
|
582
586
|
owner = (0, _context6.t0)(_context6.t1);
|
|
@@ -596,7 +600,6 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
596
600
|
_context6.prev = 14;
|
|
597
601
|
_context6.next = 17;
|
|
598
602
|
return mediaStore.copyFileWithToken(body, params, traceContext);
|
|
599
|
-
|
|
600
603
|
case 17:
|
|
601
604
|
_yield$mediaStore$cop = _context6.sent;
|
|
602
605
|
copiedFile = _yield$mediaStore$cop.data;
|
|
@@ -606,38 +609,32 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
606
609
|
} : undefined);
|
|
607
610
|
copiedId = copiedFileWithMimeType.id, copiedMimeType = copiedFileWithMimeType.mimeType; // backend may return an "unknown" mediaType just after the copy
|
|
608
611
|
// it's better to deduce it from "copiedMimeType" using getMediaTypeFromMimeType()
|
|
609
|
-
|
|
610
612
|
mediaType = copiedMimeType ? (0, _mediaTypeUtils.getMediaTypeFromMimeType)(copiedMimeType) : 'unknown';
|
|
611
613
|
copiedFileState = (0, _fileState.mapMediaFileToFileState)({
|
|
612
614
|
data: copiedFileWithMimeType
|
|
613
615
|
});
|
|
614
616
|
fileCache = cache.get(copiedId);
|
|
615
617
|
subject = fileCache || (0, _createMediaSubject.createMediaSubject)(); // if we were passed a "preview", we propagate it into the copiedFileState
|
|
616
|
-
|
|
617
618
|
previewOverride = !(0, _fileState.isErrorFileState)(copiedFileState) && !!preview ? {
|
|
618
619
|
preview: preview
|
|
619
620
|
} : {};
|
|
620
|
-
_context6.t2 = !(0, _fileState.isFinalFileState)(copiedFileState) &&
|
|
621
|
+
_context6.t2 = !(0, _fileState.isFinalFileState)(copiedFileState) &&
|
|
622
|
+
// mimeType should always be returned by "copyFileWithToken"
|
|
621
623
|
// but in case it's not, we don't want to penalize "copyFile"
|
|
622
624
|
copiedMimeType;
|
|
623
|
-
|
|
624
625
|
if (!_context6.t2) {
|
|
625
626
|
_context6.next = 31;
|
|
626
627
|
break;
|
|
627
628
|
}
|
|
628
|
-
|
|
629
629
|
_context6.next = 30;
|
|
630
630
|
return (0, _shouldFetchRemoteFileStates.shouldFetchRemoteFileStates)(mediaType, copiedMimeType, preview);
|
|
631
|
-
|
|
632
631
|
case 30:
|
|
633
632
|
_context6.t2 = _context6.sent;
|
|
634
|
-
|
|
635
633
|
case 31:
|
|
636
634
|
if (!_context6.t2) {
|
|
637
635
|
_context6.next = 36;
|
|
638
636
|
break;
|
|
639
637
|
}
|
|
640
|
-
|
|
641
638
|
subject.next(_objectSpread(_objectSpread(_objectSpread({}, copiedFileState), (0, _overrideMediaTypeIfUnknown.overrideMediaTypeIfUnknown)(copiedFileState, mediaType)), previewOverride));
|
|
642
639
|
processingSubscription = this.createDownloadFileStream(copiedId, destinationCollectionName, occurrenceKey).subscribe({
|
|
643
640
|
next: function next(remoteFileState) {
|
|
@@ -652,30 +649,23 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
652
649
|
});
|
|
653
650
|
_context6.next = 37;
|
|
654
651
|
break;
|
|
655
|
-
|
|
656
652
|
case 36:
|
|
657
653
|
if (!(0, _fileState.isProcessingFileState)(copiedFileState)) {
|
|
658
654
|
subject.next(_objectSpread(_objectSpread({}, copiedFileState), !(0, _fileState.isErrorFileState)(copiedFileState) && previewOverride));
|
|
659
655
|
}
|
|
660
|
-
|
|
661
656
|
case 37:
|
|
662
657
|
if (!cache.has(copiedId)) {
|
|
663
658
|
(0, _fileStreamsCache.getFileStreamsCache)().set(copiedId, subject);
|
|
664
659
|
}
|
|
665
|
-
|
|
666
660
|
return _context6.abrupt("return", copiedFile);
|
|
667
|
-
|
|
668
661
|
case 41:
|
|
669
662
|
_context6.prev = 41;
|
|
670
663
|
_context6.t3 = _context6["catch"](14);
|
|
671
|
-
|
|
672
664
|
if (processingSubscription) {
|
|
673
665
|
processingSubscription.unsubscribe();
|
|
674
666
|
}
|
|
675
|
-
|
|
676
667
|
if (replaceFileId) {
|
|
677
668
|
_fileCache = cache.get(replaceFileId);
|
|
678
|
-
|
|
679
669
|
if (_fileCache) {
|
|
680
670
|
_fileCache.error(_context6.t3);
|
|
681
671
|
} else {
|
|
@@ -683,9 +673,7 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
683
673
|
cache.set(id, (0, _createMediaSubject.createMediaSubject)(_context6.t3));
|
|
684
674
|
}
|
|
685
675
|
}
|
|
686
|
-
|
|
687
676
|
throw _context6.t3;
|
|
688
|
-
|
|
689
677
|
case 46:
|
|
690
678
|
case "end":
|
|
691
679
|
return _context6.stop();
|
|
@@ -693,15 +681,12 @@ var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
693
681
|
}
|
|
694
682
|
}, _callee6, this, [[14, 41]]);
|
|
695
683
|
}));
|
|
696
|
-
|
|
697
684
|
function copyFile(_x9, _x10) {
|
|
698
685
|
return _copyFile.apply(this, arguments);
|
|
699
686
|
}
|
|
700
|
-
|
|
701
687
|
return copyFile;
|
|
702
688
|
}()
|
|
703
689
|
}]);
|
|
704
690
|
return FileFetcherImpl;
|
|
705
691
|
}();
|
|
706
|
-
|
|
707
692
|
exports.FileFetcherImpl = FileFetcherImpl;
|