@atlaskit/media-client 17.0.0 → 17.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/cjs/client/collection-fetcher.js +4 -4
- package/dist/cjs/client/file-fetcher/index.js +5 -7
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/uploader/index.js +112 -37
- package/dist/cjs/utils/{toMediaSubscribable.js → mediaSubscribable/fromObservable.js} +4 -4
- package/dist/cjs/utils/mediaSubscribable/index.js +27 -0
- package/dist/cjs/utils/{mediaSubscribableToPromise.js → mediaSubscribable/toPromise.js} +3 -3
- package/dist/cjs/utils/mediaSubscribable/types.js +5 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/client/collection-fetcher.js +2 -2
- package/dist/es2019/client/file-fetcher/index.js +5 -6
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/uploader/index.js +13 -7
- package/dist/es2019/utils/{toMediaSubscribable.js → mediaSubscribable/fromObservable.js} +3 -3
- package/dist/es2019/utils/mediaSubscribable/index.js +2 -0
- package/dist/es2019/utils/{mediaSubscribableToPromise.js → mediaSubscribable/toPromise.js} +1 -1
- package/dist/es2019/utils/mediaSubscribable/types.js +1 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/client/collection-fetcher.js +3 -3
- package/dist/esm/client/file-fetcher/index.js +6 -7
- package/dist/esm/client/media-client.js +1 -1
- package/dist/esm/client/media-store/index.js +1 -1
- package/dist/esm/client/media-store/resolveAuth.js +1 -1
- package/dist/esm/client/stargate-client.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/uploader/index.js +113 -38
- package/dist/esm/utils/createFileDataLoader.js +1 -1
- package/dist/esm/utils/getDimensionsFromBlob.js +1 -1
- package/dist/esm/utils/getVideoDimensionsFromBlob.js +1 -1
- package/dist/esm/utils/hashing/hasherCreator.js +1 -1
- package/dist/esm/utils/{toMediaSubscribable.js → mediaSubscribable/fromObservable.js} +3 -3
- package/dist/esm/utils/mediaSubscribable/index.js +2 -0
- package/dist/esm/utils/{mediaSubscribableToPromise.js → mediaSubscribable/toPromise.js} +1 -1
- package/dist/esm/utils/mediaSubscribable/types.js +1 -0
- package/dist/esm/utils/mobileUpload/helpers.js +1 -1
- package/dist/esm/utils/mobileUpload/stateMachine/index.js +1 -1
- package/dist/esm/utils/polling/index.js +1 -1
- package/dist/esm/utils/request/helpers.js +1 -1
- package/dist/esm/utils/request/index.js +1 -1
- package/dist/esm/utils/shouldFetchRemoteFileStates.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/client/collection-fetcher.d.ts +1 -1
- package/dist/types/client/file-fetcher/index.d.ts +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/utils/mediaSubscribable/fromObservable.d.ts +5 -0
- package/dist/types/utils/mediaSubscribable/index.d.ts +3 -0
- package/dist/types/utils/{mediaSubscribableToPromise.d.ts → mediaSubscribable/toPromise.d.ts} +3 -3
- package/dist/types/utils/mediaSubscribable/types.d.ts +16 -0
- package/dist/types/utils/safeUnsubscribe.d.ts +1 -1
- package/example-helpers/styles.ts +99 -0
- package/example-helpers/stylesWrapper.tsx +82 -0
- package/package.json +6 -5
- package/report.api.md +1389 -0
- package/dist/types/utils/toMediaSubscribable.d.ts +0 -20
- package/example-helpers/styled.ts +0 -77
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
@@ -8,6 +7,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
8
7
|
|
|
9
8
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
10
9
|
|
|
10
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
11
11
|
import { Subscription } from 'rxjs/Subscription';
|
|
12
12
|
import { of } from 'rxjs/observable/of';
|
|
13
13
|
import { map } from 'rxjs/operators/map';
|
|
@@ -30,14 +30,13 @@ import { createFileDataloader } from '../../utils/createFileDataLoader';
|
|
|
30
30
|
import { getMediaTypeFromUploadableFile } from '../../utils/getMediaTypeFromUploadableFile';
|
|
31
31
|
import { overrideMediaTypeIfUnknown } from '../../utils/overrideMediaTypeIfUnknown';
|
|
32
32
|
import { convertBase64ToBlob } from '../../utils/convertBase64ToBlob';
|
|
33
|
-
import {
|
|
33
|
+
import { toPromise, fromObservable } from '../../utils/mediaSubscribable';
|
|
34
34
|
import { getDimensionsFromBlob } from '../../utils/getDimensionsFromBlob';
|
|
35
35
|
import { createMediaSubject } from '../../utils/createMediaSubject';
|
|
36
36
|
import { isMimeTypeSupportedByBrowser, getMediaTypeFromMimeType } from '@atlaskit/media-common/mediaTypeUtils';
|
|
37
37
|
import { shouldFetchRemoteFileStates, shouldFetchRemoteFileStatesObservable } from '../../utils/shouldFetchRemoteFileStates';
|
|
38
38
|
import { PollingFunction } from '../../utils/polling';
|
|
39
39
|
import { isEmptyFile } from '../../utils/detectEmptyFile';
|
|
40
|
-
import { toMediaSubscribable } from '../../utils/toMediaSubscribable';
|
|
41
40
|
export { isFileFetcherError, FileFetcherError } from './error';
|
|
42
41
|
export var FileFetcherImpl = /*#__PURE__*/function () {
|
|
43
42
|
function FileFetcherImpl(mediaStore) {
|
|
@@ -134,17 +133,17 @@ export var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
134
133
|
collectionName: collectionName,
|
|
135
134
|
occurrenceKey: occurrenceKey
|
|
136
135
|
}));
|
|
137
|
-
return
|
|
136
|
+
return fromObservable(subject);
|
|
138
137
|
}
|
|
139
138
|
|
|
140
|
-
return
|
|
139
|
+
return fromObservable(getFileStreamsCache().getOrInsert(id, function () {
|
|
141
140
|
return _this2.createDownloadFileStream(id, collectionName);
|
|
142
141
|
}));
|
|
143
142
|
}
|
|
144
143
|
}, {
|
|
145
144
|
key: "getCurrentState",
|
|
146
145
|
value: function getCurrentState(id, options) {
|
|
147
|
-
return
|
|
146
|
+
return toPromise(this.getFileState(id, options));
|
|
148
147
|
}
|
|
149
148
|
}, {
|
|
150
149
|
key: "getArtifactURL",
|
|
@@ -432,7 +431,7 @@ export var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
432
431
|
});
|
|
433
432
|
}
|
|
434
433
|
|
|
435
|
-
return
|
|
434
|
+
return fromObservable(subject);
|
|
436
435
|
}
|
|
437
436
|
}, {
|
|
438
437
|
key: "downloadBinary",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
5
5
|
import { EventEmitter2 } from 'eventemitter2';
|
|
6
6
|
import { MediaStore } from './media-store';
|
|
7
7
|
import { CollectionFetcher } from './collection-fetcher';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
4
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
6
6
|
|
|
7
7
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
8
8
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
import { MediaStoreError } from './error';
|
|
4
4
|
import { rejectTimeout } from '../../utils/setTimeoutPromise';
|
|
5
5
|
export var DEFAULT_AUTH_PROVIDER_TIMEOUT = 10000;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
5
5
|
export var StargateClient = /*#__PURE__*/function () {
|
|
6
6
|
function StargateClient(baseUrl) {
|
|
7
7
|
_classCallCheck(this, StargateClient);
|
package/dist/esm/index.js
CHANGED
|
@@ -25,7 +25,7 @@ export { isFileIdentifier, isExternalImageIdentifier, isDifferentIdentifier } fr
|
|
|
25
25
|
export { withMediaClient, getMediaClient } from './utils/with-media-client-hoc';
|
|
26
26
|
export { globalMediaEventEmitter } from './globalMediaEventEmitter';
|
|
27
27
|
export { isMediaBlobUrl, getAttrsFromUrl, addFileAttrsToUrl, objectToQueryString } from './utils/url';
|
|
28
|
-
export { createMediaSubscribable } from './utils/
|
|
28
|
+
export { createMediaSubscribable } from './utils/mediaSubscribable';
|
|
29
29
|
export { RECENTS_COLLECTION, MAX_RESOLUTION } from './constants'; // TODO MEX-659 Remove these exports when all the usages from media-client are replaced with media-common.
|
|
30
30
|
|
|
31
31
|
import { getMediaTypeFromMimeType as _getMediaTypeFromMimeType, isImageMimeTypeSupportedByBrowser as _isImageMimeTypeSupportedByBrowser, isDocumentMimeTypeSupportedByBrowser as _isDocumentMimeTypeSupportedByBrowser, isMimeTypeSupportedByBrowser as _isMimeTypeSupportedByBrowser, isImageMimeTypeSupportedByServer as _isImageMimeTypeSupportedByServer, isDocumentMimeTypeSupportedByServer as _isDocumentMimeTypeSupportedByServer, isAudioMimeTypeSupportedByServer as _isAudioMimeTypeSupportedByServer, isVideoMimeTypeSupportedByServer as _isVideoMimeTypeSupportedByServer, isUnknownMimeTypeSupportedByServer as _isUnknownMimeTypeSupportedByServer, isMimeTypeSupportedByServer as _isMimeTypeSupportedByServer } from '@atlaskit/media-common/mediaTypeUtils';
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
+
|
|
4
|
+
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; }
|
|
5
|
+
|
|
6
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7
|
+
|
|
8
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
9
|
import { chunkinator } from '@atlaskit/chunkinator';
|
|
4
10
|
import { from } from 'rxjs/observable/from';
|
|
5
11
|
import { concatMap } from 'rxjs/operators/concatMap';
|
|
@@ -36,7 +42,7 @@ var hashingFunction = /*#__PURE__*/function () {
|
|
|
36
42
|
};
|
|
37
43
|
}();
|
|
38
44
|
|
|
39
|
-
var createProbingFunction = function createProbingFunction(store, collectionName) {
|
|
45
|
+
var createProbingFunction = function createProbingFunction(store, deferredUploadId, collectionName) {
|
|
40
46
|
return /*#__PURE__*/function () {
|
|
41
47
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(chunks) {
|
|
42
48
|
var response, results;
|
|
@@ -44,19 +50,43 @@ var createProbingFunction = function createProbingFunction(store, collectionName
|
|
|
44
50
|
while (1) {
|
|
45
51
|
switch (_context2.prev = _context2.next) {
|
|
46
52
|
case 0:
|
|
47
|
-
_context2.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
53
|
+
_context2.t0 = store;
|
|
54
|
+
_context2.t1 = hashedChunks(chunks);
|
|
55
|
+
_context2.t2 = collectionName;
|
|
56
|
+
|
|
57
|
+
if (!getMediaFeatureFlag('mediaUploadApiV2', store.featureFlags)) {
|
|
58
|
+
_context2.next = 9;
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
_context2.next = 6;
|
|
63
|
+
return deferredUploadId;
|
|
64
|
+
|
|
65
|
+
case 6:
|
|
66
|
+
_context2.t3 = _context2.sent;
|
|
67
|
+
_context2.next = 10;
|
|
68
|
+
break;
|
|
69
|
+
|
|
70
|
+
case 9:
|
|
71
|
+
_context2.t3 = undefined;
|
|
51
72
|
|
|
52
|
-
case
|
|
73
|
+
case 10:
|
|
74
|
+
_context2.t4 = _context2.t3;
|
|
75
|
+
_context2.t5 = {
|
|
76
|
+
collectionName: _context2.t2,
|
|
77
|
+
uploadId: _context2.t4
|
|
78
|
+
};
|
|
79
|
+
_context2.next = 14;
|
|
80
|
+
return _context2.t0.probeChunks.call(_context2.t0, _context2.t1, _context2.t5);
|
|
81
|
+
|
|
82
|
+
case 14:
|
|
53
83
|
response = _context2.sent;
|
|
54
84
|
results = response.data.results;
|
|
55
85
|
return _context2.abrupt("return", Object.values(results).map(function (result) {
|
|
56
86
|
return result.exists;
|
|
57
87
|
}));
|
|
58
88
|
|
|
59
|
-
case
|
|
89
|
+
case 17:
|
|
60
90
|
case "end":
|
|
61
91
|
return _context2.stop();
|
|
62
92
|
}
|
|
@@ -70,63 +100,108 @@ var createProbingFunction = function createProbingFunction(store, collectionName
|
|
|
70
100
|
}();
|
|
71
101
|
};
|
|
72
102
|
|
|
73
|
-
var createUploadingFunction = function createUploadingFunction(store, collectionName) {
|
|
74
|
-
return function (
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
103
|
+
var createUploadingFunction = function createUploadingFunction(store, deferredUploadId, collectionName) {
|
|
104
|
+
return /*#__PURE__*/function () {
|
|
105
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(chunk) {
|
|
106
|
+
var options;
|
|
107
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
108
|
+
while (1) {
|
|
109
|
+
switch (_context3.prev = _context3.next) {
|
|
110
|
+
case 0:
|
|
111
|
+
if (!getMediaFeatureFlag('mediaUploadApiV2', store.featureFlags)) {
|
|
112
|
+
_context3.next = 8;
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
_context3.t1 = chunk.partNumber;
|
|
117
|
+
_context3.next = 4;
|
|
118
|
+
return deferredUploadId;
|
|
119
|
+
|
|
120
|
+
case 4:
|
|
121
|
+
_context3.t2 = _context3.sent;
|
|
122
|
+
_context3.t0 = {
|
|
123
|
+
partNumber: _context3.t1,
|
|
124
|
+
uploadId: _context3.t2
|
|
125
|
+
};
|
|
126
|
+
_context3.next = 9;
|
|
127
|
+
break;
|
|
128
|
+
|
|
129
|
+
case 8:
|
|
130
|
+
_context3.t0 = {};
|
|
131
|
+
|
|
132
|
+
case 9:
|
|
133
|
+
options = _context3.t0;
|
|
134
|
+
_context3.next = 12;
|
|
135
|
+
return store.uploadChunk(chunk.hash, chunk.blob, _objectSpread({
|
|
136
|
+
collectionName: collectionName
|
|
137
|
+
}, options));
|
|
138
|
+
|
|
139
|
+
case 12:
|
|
140
|
+
return _context3.abrupt("return", _context3.sent);
|
|
141
|
+
|
|
142
|
+
case 13:
|
|
143
|
+
case "end":
|
|
144
|
+
return _context3.stop();
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}, _callee3);
|
|
148
|
+
}));
|
|
149
|
+
|
|
150
|
+
return function (_x3) {
|
|
151
|
+
return _ref3.apply(this, arguments);
|
|
152
|
+
};
|
|
153
|
+
}();
|
|
79
154
|
};
|
|
80
155
|
|
|
81
156
|
var createProcessingFunction = function createProcessingFunction(store, deferredUploadId, collection) {
|
|
82
157
|
var offset = 0;
|
|
83
158
|
return /*#__PURE__*/function () {
|
|
84
|
-
var
|
|
85
|
-
return _regeneratorRuntime.wrap(function
|
|
159
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(chunks) {
|
|
160
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
86
161
|
while (1) {
|
|
87
|
-
switch (
|
|
162
|
+
switch (_context4.prev = _context4.next) {
|
|
88
163
|
case 0:
|
|
89
|
-
|
|
90
|
-
|
|
164
|
+
_context4.t0 = store;
|
|
165
|
+
_context4.next = 3;
|
|
91
166
|
return deferredUploadId;
|
|
92
167
|
|
|
93
168
|
case 3:
|
|
94
|
-
|
|
95
|
-
|
|
169
|
+
_context4.t1 = _context4.sent;
|
|
170
|
+
_context4.t2 = {
|
|
96
171
|
chunks: hashedChunks(chunks),
|
|
97
172
|
offset: offset
|
|
98
173
|
};
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
return
|
|
174
|
+
_context4.t3 = collection;
|
|
175
|
+
_context4.next = 8;
|
|
176
|
+
return _context4.t0.appendChunksToUpload.call(_context4.t0, _context4.t1, _context4.t2, _context4.t3);
|
|
102
177
|
|
|
103
178
|
case 8:
|
|
104
179
|
offset += chunks.length;
|
|
105
180
|
|
|
106
181
|
case 9:
|
|
107
182
|
case "end":
|
|
108
|
-
return
|
|
183
|
+
return _context4.stop();
|
|
109
184
|
}
|
|
110
185
|
}
|
|
111
|
-
},
|
|
186
|
+
}, _callee4);
|
|
112
187
|
}));
|
|
113
188
|
|
|
114
|
-
return function (
|
|
115
|
-
return
|
|
189
|
+
return function (_x4) {
|
|
190
|
+
return _ref4.apply(this, arguments);
|
|
116
191
|
};
|
|
117
192
|
}();
|
|
118
193
|
};
|
|
119
194
|
|
|
120
195
|
var createFileFromUpload = /*#__PURE__*/function () {
|
|
121
|
-
var
|
|
196
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(file, store, uploadableFileUpfrontIds, uploadId) {
|
|
122
197
|
var collection, name, mimeType, id, occurrenceKey;
|
|
123
|
-
return _regeneratorRuntime.wrap(function
|
|
198
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
124
199
|
while (1) {
|
|
125
|
-
switch (
|
|
200
|
+
switch (_context5.prev = _context5.next) {
|
|
126
201
|
case 0:
|
|
127
202
|
collection = file.collection, name = file.name, mimeType = file.mimeType;
|
|
128
203
|
id = uploadableFileUpfrontIds.id, occurrenceKey = uploadableFileUpfrontIds.occurrenceKey;
|
|
129
|
-
return
|
|
204
|
+
return _context5.abrupt("return", store.createFileFromUpload({
|
|
130
205
|
uploadId: uploadId,
|
|
131
206
|
name: name,
|
|
132
207
|
mimeType: mimeType
|
|
@@ -138,14 +213,14 @@ var createFileFromUpload = /*#__PURE__*/function () {
|
|
|
138
213
|
|
|
139
214
|
case 3:
|
|
140
215
|
case "end":
|
|
141
|
-
return
|
|
216
|
+
return _context5.stop();
|
|
142
217
|
}
|
|
143
218
|
}
|
|
144
|
-
},
|
|
219
|
+
}, _callee5);
|
|
145
220
|
}));
|
|
146
221
|
|
|
147
|
-
return function createFileFromUpload(
|
|
148
|
-
return
|
|
222
|
+
return function createFileFromUpload(_x5, _x6, _x7, _x8) {
|
|
223
|
+
return _ref5.apply(this, arguments);
|
|
149
224
|
};
|
|
150
225
|
}();
|
|
151
226
|
|
|
@@ -182,8 +257,8 @@ export var uploadFile = function uploadFile(file, store, uploadableFileUpfrontId
|
|
|
182
257
|
probingBatchSize: 100,
|
|
183
258
|
chunkSize: chunkSize,
|
|
184
259
|
uploadingConcurrency: 3,
|
|
185
|
-
uploadingFunction: createUploadingFunction(store, collection),
|
|
186
|
-
probingFunction: createProbingFunction(store, collection),
|
|
260
|
+
uploadingFunction: createUploadingFunction(store, deferredUploadId, collection),
|
|
261
|
+
probingFunction: createProbingFunction(store, deferredUploadId, collection),
|
|
187
262
|
processingBatchSize: PROCESSING_BATCH_SIZE,
|
|
188
263
|
processingFunction: createProcessingFunction(store, deferredUploadId, collection)
|
|
189
264
|
}, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
4
|
// import setimmediate to temporary fix dataloader 2.0.0 bug
|
|
5
5
|
// @see https://github.com/graphql/dataloader/issues/249
|
|
6
6
|
import 'setimmediate';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
import { getImageDimensionsFromBlob } from './getImageDimensionsFromBlob';
|
|
4
4
|
import { getVideoDimensionsFromBlob } from './getVideoDimensionsFromBlob';
|
|
5
5
|
export var getDimensionsFromBlob = /*#__PURE__*/function () {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
import VideoSnapshot from 'video-snapshot';
|
|
4
4
|
export var getVideoDimensionsFromBlob = /*#__PURE__*/function () {
|
|
5
5
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(blob) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
var hasher = null;
|
|
4
4
|
export var destroyHasher = function destroyHasher() {
|
|
5
5
|
return hasher = null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createMediaSubject } from '
|
|
2
|
-
export function
|
|
1
|
+
import { createMediaSubject } from '../createMediaSubject';
|
|
2
|
+
export function fromObservable(observable) {
|
|
3
3
|
return {
|
|
4
4
|
subscribe: function subscribe(observer) {
|
|
5
5
|
var subscription = // This is needed to handle "subscribe" function overload.
|
|
@@ -14,5 +14,5 @@ export function toMediaSubscribable(observable) {
|
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
export function createMediaSubscribable(mediaSubscribableItem) {
|
|
17
|
-
return
|
|
17
|
+
return fromObservable(createMediaSubject(mediaSubscribableItem));
|
|
18
18
|
}
|
|
@@ -6,7 +6,7 @@ import { Subscription } from 'rxjs/Subscription';
|
|
|
6
6
|
* @param mediaSubscribable a given MediaSubscribable<MediaSubscribableItem>
|
|
7
7
|
* @param subscription a default Subscription (this parameter exists for testing purpose)
|
|
8
8
|
*/
|
|
9
|
-
export var
|
|
9
|
+
export var toPromise = function toPromise(mediaSubscribable) {
|
|
10
10
|
var subscription = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Subscription();
|
|
11
11
|
return new Promise(function (resolve, reject) {
|
|
12
12
|
return subscription.add(mediaSubscribable.subscribe({
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
import { ReplaySubject } from 'rxjs/ReplaySubject';
|
|
4
4
|
import { from } from 'rxjs/observable/from';
|
|
5
5
|
import { map } from 'rxjs/operators/map';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
import { map } from 'rxjs/operators/map';
|
|
4
4
|
import { createMachine, interpret } from 'xstate';
|
|
5
5
|
import { isProcessingFileState } from '../../../models/file-state';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
4
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
6
6
|
|
|
7
7
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
8
8
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
2
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
4
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
5
4
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
6
6
|
|
|
7
7
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
8
8
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
export { RequestError, isRequestError } from './errors';
|
|
4
4
|
export { isRateLimitedError } from './helpers';
|
|
5
5
|
import { createUrl, fetchRetry, createProcessFetchResponse, withAuth } from './helpers';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
import { from } from 'rxjs/observable/from';
|
|
4
4
|
import { isMimeTypeSupportedByBrowser, isMimeTypeSupportedByServer } from '@atlaskit/media-common/mediaTypeUtils';
|
|
5
5
|
import { getVideoDimensionsFromBlob } from './getVideoDimensionsFromBlob';
|
package/dist/esm/version.json
CHANGED
|
@@ -2,7 +2,7 @@ import { ReplaySubject } from 'rxjs/ReplaySubject';
|
|
|
2
2
|
import { FileDetails, FileItem } from '../models/item';
|
|
3
3
|
import { MediaCollectionItem } from '../models/media';
|
|
4
4
|
import { MediaStore, MediaStoreGetCollectionItemsParams } from './media-store';
|
|
5
|
-
import { MediaSubscribable } from '../utils/
|
|
5
|
+
import { MediaSubscribable } from '../utils/mediaSubscribable';
|
|
6
6
|
export interface MediaCollectionFileItemDetails extends FileDetails {
|
|
7
7
|
occurrenceKey: string;
|
|
8
8
|
}
|
|
@@ -6,8 +6,8 @@ import { MediaFile } from '../../models/media';
|
|
|
6
6
|
import { UploadableFile, UploadableFileUpfrontIds } from '../../uploader';
|
|
7
7
|
import { MediaFileArtifacts } from '../../models/artifacts';
|
|
8
8
|
import { UploadController } from '../../upload-controller';
|
|
9
|
+
import { MediaSubscribable } from '../../utils/mediaSubscribable';
|
|
9
10
|
import { Dimensions } from '../../utils/getDimensionsFromBlob';
|
|
10
|
-
import { MediaSubscribable } from '../../utils/toMediaSubscribable';
|
|
11
11
|
export type { FileFetcherErrorAttributes, FileFetcherErrorReason, } from './error';
|
|
12
12
|
export { isFileFetcherError, FileFetcherError } from './error';
|
|
13
13
|
export interface CopySourceFile {
|
package/dist/types/index.d.ts
CHANGED
|
@@ -45,8 +45,8 @@ export type { WithMediaClientConfig, WithMediaClientConfigProps, WithMediaClient
|
|
|
45
45
|
export { globalMediaEventEmitter } from './globalMediaEventEmitter';
|
|
46
46
|
export { isMediaBlobUrl, getAttrsFromUrl, addFileAttrsToUrl, objectToQueryString, } from './utils/url';
|
|
47
47
|
export type { MediaBlobUrlAttrs } from './utils/url';
|
|
48
|
-
export { createMediaSubscribable } from './utils/
|
|
49
|
-
export type { MediaSubscribable, MediaSubscription, MediaObserver, } from './utils/
|
|
48
|
+
export { createMediaSubscribable } from './utils/mediaSubscribable';
|
|
49
|
+
export type { MediaSubscribable, MediaSubscription, MediaObserver, } from './utils/mediaSubscribable';
|
|
50
50
|
export { RECENTS_COLLECTION, MAX_RESOLUTION } from './constants';
|
|
51
51
|
/**
|
|
52
52
|
* @deprecated This export will be removed. Please use one from @atlaskit/media-common or @atlaskit/media-common/mediaTypeUtils
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ReplaySubject } from 'rxjs/ReplaySubject';
|
|
2
|
+
import { MediaSubscribableItem } from '../../models/media-subscribable';
|
|
3
|
+
import { MediaSubscribable } from './types';
|
|
4
|
+
export declare function fromObservable<T>(observable: ReplaySubject<T>): MediaSubscribable<T>;
|
|
5
|
+
export declare function createMediaSubscribable<T extends MediaSubscribableItem>(mediaSubscribableItem?: T | Error): MediaSubscribable<T>;
|
package/dist/types/utils/{mediaSubscribableToPromise.d.ts → mediaSubscribable/toPromise.d.ts}
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Subscription } from 'rxjs/Subscription';
|
|
2
|
-
import { MediaSubscribable } from './
|
|
3
|
-
import { MediaSubscribableItem } from '
|
|
2
|
+
import { MediaSubscribable } from './types';
|
|
3
|
+
import { MediaSubscribableItem } from '../../models/media-subscribable';
|
|
4
4
|
/**
|
|
5
5
|
* This is a helper to transform the first value emitted by an MediaSubscribable into a Promise.
|
|
6
6
|
*
|
|
7
7
|
* @param mediaSubscribable a given MediaSubscribable<MediaSubscribableItem>
|
|
8
8
|
* @param subscription a default Subscription (this parameter exists for testing purpose)
|
|
9
9
|
*/
|
|
10
|
-
export declare const
|
|
10
|
+
export declare const toPromise: <T extends MediaSubscribableItem>(mediaSubscribable: MediaSubscribable<T>, subscription?: Subscription) => Promise<T>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare type MediaSubscription = {
|
|
2
|
+
unsubscribe: () => void;
|
|
3
|
+
};
|
|
4
|
+
declare type PartialObserver<T> = {
|
|
5
|
+
next?: (value: T) => void;
|
|
6
|
+
error?: (err: any) => void;
|
|
7
|
+
complete?: () => void;
|
|
8
|
+
};
|
|
9
|
+
export declare type NextObserver<T> = PartialObserver<T> & Required<Pick<PartialObserver<T>, 'next'>>;
|
|
10
|
+
export declare type ErrorObserver<T> = PartialObserver<T> & Required<Pick<PartialObserver<T>, 'error'>>;
|
|
11
|
+
export declare type CompletionObserver<T> = PartialObserver<T> & Required<Pick<PartialObserver<T>, 'complete'>>;
|
|
12
|
+
export declare type MediaObserver<T> = NextObserver<T> | ErrorObserver<T> | CompletionObserver<T> | ((value: T) => void);
|
|
13
|
+
export declare type MediaSubscribable<T> = {
|
|
14
|
+
subscribe(observer?: MediaObserver<T>): MediaSubscription;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { MediaSubscription } from './
|
|
1
|
+
import { MediaSubscription } from './mediaSubscribable';
|
|
2
2
|
export declare const safeUnsubscribe: (subscription: MediaSubscription) => void;
|