@atlaskit/media-client 14.3.2 → 15.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 +111 -0
- package/dist/cjs/client/collection-fetcher.js +5 -3
- package/dist/cjs/client/file-fetcher/index.js +17 -15
- package/dist/cjs/client/media-store/index.js +2 -2
- package/dist/cjs/index.js +12 -11
- package/dist/cjs/models/errors/index.js +3 -1
- package/dist/cjs/models/file-state.js +2 -2
- package/dist/cjs/models/media-subscribable.js +5 -0
- package/dist/cjs/utils/{createFileStateSubject.js → createMediaSubject.js} +3 -5
- package/dist/cjs/utils/{observableToPromise.js → mediaSubscribableToPromise.js} +6 -7
- package/dist/cjs/utils/mobileUpload/helpers.js +2 -2
- package/dist/cjs/utils/mobileUpload/stateMachine/states/uploading.js +2 -2
- package/dist/cjs/utils/polling/index.js +2 -2
- package/dist/cjs/utils/request/helpers.js +2 -2
- package/dist/cjs/utils/toMediaSubscribable.js +28 -0
- package/dist/cjs/utils/url.js +2 -2
- package/dist/cjs/utils/with-media-client-hoc.js +3 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/client/collection-fetcher.js +2 -1
- package/dist/es2019/client/file-fetcher/index.js +13 -12
- package/dist/es2019/index.js +3 -2
- package/dist/es2019/models/media-subscribable.js +1 -0
- package/dist/es2019/utils/{createFileStateSubject.js → createMediaSubject.js} +2 -2
- package/dist/es2019/utils/mediaSubscribableToPromise.js +20 -0
- package/dist/es2019/utils/mobileUpload/helpers.js +2 -2
- package/dist/es2019/utils/toMediaSubscribable.js +18 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/client/collection-fetcher.js +4 -3
- package/dist/esm/client/file-fetcher/index.js +16 -15
- package/dist/esm/client/media-store/index.js +2 -2
- package/dist/esm/index.js +3 -2
- package/dist/esm/models/errors/index.js +2 -1
- package/dist/esm/models/file-state.js +2 -2
- package/dist/esm/models/media-subscribable.js +1 -0
- package/dist/esm/utils/{createFileStateSubject.js → createMediaSubject.js} +2 -2
- package/dist/esm/utils/{observableToPromise.js → mediaSubscribableToPromise.js} +5 -6
- package/dist/esm/utils/mobileUpload/helpers.js +2 -2
- package/dist/esm/utils/mobileUpload/stateMachine/states/uploading.js +2 -2
- package/dist/esm/utils/polling/index.js +2 -2
- package/dist/esm/utils/request/helpers.js +2 -2
- package/dist/esm/utils/toMediaSubscribable.js +18 -0
- package/dist/esm/utils/url.js +2 -2
- package/dist/esm/utils/with-media-client-hoc.js +2 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/client/collection-fetcher.d.ts +2 -1
- package/dist/types/client/file-fetcher/index.d.ts +5 -5
- package/dist/types/client/media-store/resolveAuth.d.ts +1 -1
- package/dist/types/globalMediaEventEmitter.d.ts +3 -3
- package/dist/types/index.d.ts +5 -3
- package/dist/types/models/file-state.d.ts +1 -1
- package/dist/types/models/media-subscribable.d.ts +3 -0
- package/dist/types/utils/createMediaSubject.d.ts +3 -0
- package/dist/types/utils/imageResizeModeToFileImageMode.d.ts +1 -1
- package/dist/types/utils/mediaSubscribableToPromise.d.ts +10 -0
- package/dist/types/utils/overrideMediaTypeIfUnknown.d.ts +2 -2
- package/dist/types/utils/request/errors.d.ts +1 -1
- package/dist/types/utils/safeUnsubscribe.d.ts +2 -2
- package/dist/types/utils/toMediaSubscribable.d.ts +20 -0
- package/package.json +11 -13
- package/dist/es2019/utils/observableToPromise.js +0 -21
- package/dist/types/utils/createFileStateSubject.d.ts +0 -3
- package/dist/types/utils/observableToPromise.d.ts +0 -10
|
@@ -21,18 +21,19 @@ import { createFileDataloader } from '../../utils/createFileDataLoader';
|
|
|
21
21
|
import { getMediaTypeFromUploadableFile } from '../../utils/getMediaTypeFromUploadableFile';
|
|
22
22
|
import { overrideMediaTypeIfUnknown } from '../../utils/overrideMediaTypeIfUnknown';
|
|
23
23
|
import { convertBase64ToBlob } from '../../utils/convertBase64ToBlob';
|
|
24
|
-
import {
|
|
24
|
+
import { mediaSubscribableToPromise } from '../../utils/mediaSubscribableToPromise';
|
|
25
25
|
import { getDimensionsFromBlob } from '../../utils/getDimensionsFromBlob';
|
|
26
|
-
import {
|
|
26
|
+
import { createMediaSubject } from '../../utils/createMediaSubject';
|
|
27
27
|
import { isMimeTypeSupportedByBrowser, getMediaTypeFromMimeType } from '@atlaskit/media-common/mediaTypeUtils';
|
|
28
28
|
import { shouldFetchRemoteFileStates, shouldFetchRemoteFileStatesObservable } from '../../utils/shouldFetchRemoteFileStates';
|
|
29
29
|
import { PollingFunction } from '../../utils/polling';
|
|
30
30
|
import { isEmptyFile } from '../../utils/detectEmptyFile';
|
|
31
|
+
import { toMediaSubscribable } from '../../utils/toMediaSubscribable';
|
|
31
32
|
export { isFileFetcherError, FileFetcherError } from './error';
|
|
32
33
|
export class FileFetcherImpl {
|
|
33
34
|
constructor(mediaStore) {
|
|
34
35
|
_defineProperty(this, "createDownloadFileStream", (id, collectionName, occurrenceKey) => {
|
|
35
|
-
const subject =
|
|
36
|
+
const subject = createMediaSubject();
|
|
36
37
|
const poll = new PollingFunction(); // ensure subject errors if polling exceeds max iterations or uncaught exception in executor
|
|
37
38
|
|
|
38
39
|
poll.onError = error => subject.error(error);
|
|
@@ -85,19 +86,19 @@ export class FileFetcherImpl {
|
|
|
85
86
|
} = options;
|
|
86
87
|
|
|
87
88
|
if (!isValidId(id)) {
|
|
88
|
-
const subject =
|
|
89
|
+
const subject = createMediaSubject();
|
|
89
90
|
subject.error(new FileFetcherError('invalidFileId', id, {
|
|
90
91
|
collectionName,
|
|
91
92
|
occurrenceKey
|
|
92
93
|
}));
|
|
93
|
-
return subject;
|
|
94
|
+
return toMediaSubscribable(subject);
|
|
94
95
|
}
|
|
95
96
|
|
|
96
|
-
return getFileStreamsCache().getOrInsert(id, () => this.createDownloadFileStream(id, collectionName));
|
|
97
|
+
return toMediaSubscribable(getFileStreamsCache().getOrInsert(id, () => this.createDownloadFileStream(id, collectionName)));
|
|
97
98
|
}
|
|
98
99
|
|
|
99
100
|
getCurrentState(id, options) {
|
|
100
|
-
return
|
|
101
|
+
return mediaSubscribableToPromise(this.getFileState(id, options));
|
|
101
102
|
}
|
|
102
103
|
|
|
103
104
|
getArtifactURL(artifacts, artifactName, collectionName) {
|
|
@@ -140,7 +141,7 @@ export class FileFetcherImpl {
|
|
|
140
141
|
id,
|
|
141
142
|
occurrenceKey
|
|
142
143
|
} = uploadableFileUpfrontIds;
|
|
143
|
-
const subject =
|
|
144
|
+
const subject = createMediaSubject();
|
|
144
145
|
const deferredBlob = fetch(url).then(response => response.blob()).catch(() => undefined);
|
|
145
146
|
const preview = new Promise(async (resolve, reject) => {
|
|
146
147
|
const blob = await deferredBlob;
|
|
@@ -231,7 +232,7 @@ export class FileFetcherImpl {
|
|
|
231
232
|
let preview; // TODO [MSW-796]: get file size for base64
|
|
232
233
|
|
|
233
234
|
const mediaType = getMediaTypeFromUploadableFile(file);
|
|
234
|
-
const subject =
|
|
235
|
+
const subject = createMediaSubject();
|
|
235
236
|
const processingSubscription = new Subscription();
|
|
236
237
|
|
|
237
238
|
if (content instanceof Blob) {
|
|
@@ -306,7 +307,7 @@ export class FileFetcherImpl {
|
|
|
306
307
|
});
|
|
307
308
|
}
|
|
308
309
|
|
|
309
|
-
return subject;
|
|
310
|
+
return toMediaSubscribable(subject);
|
|
310
311
|
}
|
|
311
312
|
|
|
312
313
|
async downloadBinary(id, name = 'download', collectionName) {
|
|
@@ -379,7 +380,7 @@ export class FileFetcherImpl {
|
|
|
379
380
|
data: copiedFileWithMimeType
|
|
380
381
|
});
|
|
381
382
|
const fileCache = cache.get(copiedId);
|
|
382
|
-
const subject = fileCache ||
|
|
383
|
+
const subject = fileCache || createMediaSubject(); // if we were passed a "preview", we propagate it into the copiedFileState
|
|
383
384
|
|
|
384
385
|
const previewOverride = !isErrorFileState(copiedFileState) && !!preview ? {
|
|
385
386
|
preview
|
|
@@ -423,7 +424,7 @@ export class FileFetcherImpl {
|
|
|
423
424
|
fileCache.error(error);
|
|
424
425
|
} else {
|
|
425
426
|
// Create a new subject with the error state for new subscriptions
|
|
426
|
-
cache.set(id,
|
|
427
|
+
cache.set(id, createMediaSubject(error));
|
|
427
428
|
}
|
|
428
429
|
}
|
|
429
430
|
|
package/dist/es2019/index.js
CHANGED
|
@@ -4,6 +4,7 @@ export { isPreviewableType, isMediaCollectionItemFullDetails } from './models/me
|
|
|
4
4
|
export { getArtifactUrl } from './models/artifacts';
|
|
5
5
|
export { isMediaClientError, getMediaClientErrorReason } from './models/errors';
|
|
6
6
|
export { isUploadingFileState, isProcessingFileState, isProcessedFileState, isErrorFileState, isPreviewableFileState, isFinalFileState, isImageRepresentationReady, mapMediaFileToFileState, mapMediaItemToFileState } from './models/file-state';
|
|
7
|
+
// TODO: remove access to media file stream cache https://product-fabric.atlassian.net/browse/MEX-1417
|
|
7
8
|
export { getFileStreamsCache, StreamsCache } from './file-streams-cache';
|
|
8
9
|
export { uploadFile } from './uploader';
|
|
9
10
|
export { request, RequestError, isRequestError, isRateLimitedError } from './utils/request';
|
|
@@ -17,14 +18,14 @@ export { MediaClient } from './client/media-client';
|
|
|
17
18
|
export { StargateClient } from './client/stargate-client';
|
|
18
19
|
export { isImageRemote } from './utils/isImageRemote';
|
|
19
20
|
export { checkWebpSupport } from './utils/checkWebpSupport';
|
|
20
|
-
export { observableToPromise } from './utils/observableToPromise';
|
|
21
21
|
export { getDimensionsFromBlob } from './utils/getDimensionsFromBlob';
|
|
22
|
-
export {
|
|
22
|
+
export { createMediaSubject } from './utils/createMediaSubject';
|
|
23
23
|
export { safeUnsubscribe } from './utils/safeUnsubscribe';
|
|
24
24
|
export { isFileIdentifier, isExternalImageIdentifier, isDifferentIdentifier } from './identifier';
|
|
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/toMediaSubscribable';
|
|
28
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.
|
|
29
30
|
|
|
30
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';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReplaySubject } from 'rxjs/ReplaySubject';
|
|
2
|
-
export
|
|
2
|
+
export function createMediaSubject(initialState) {
|
|
3
3
|
const subject = new ReplaySubject(1);
|
|
4
4
|
|
|
5
5
|
if (initialState instanceof Error) {
|
|
@@ -9,4 +9,4 @@ export const createFileStateSubject = initialState => {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
return subject;
|
|
12
|
-
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Subscription } from 'rxjs/Subscription';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This is a helper to transform the first value emitted by an MediaSubscribable into a Promise.
|
|
5
|
+
*
|
|
6
|
+
* @param mediaSubscribable a given MediaSubscribable<MediaSubscribableItem>
|
|
7
|
+
* @param subscription a default Subscription (this parameter exists for testing purpose)
|
|
8
|
+
*/
|
|
9
|
+
export const mediaSubscribableToPromise = (mediaSubscribable, subscription = new Subscription()) => {
|
|
10
|
+
return new Promise((resolve, reject) => subscription.add(mediaSubscribable.subscribe({
|
|
11
|
+
next: state => {
|
|
12
|
+
resolve(state);
|
|
13
|
+
subscription.unsubscribe();
|
|
14
|
+
},
|
|
15
|
+
error: error => {
|
|
16
|
+
reject(error);
|
|
17
|
+
subscription.unsubscribe();
|
|
18
|
+
}
|
|
19
|
+
})));
|
|
20
|
+
};
|
|
@@ -2,7 +2,7 @@ import { ReplaySubject } from 'rxjs/ReplaySubject';
|
|
|
2
2
|
import { from } from 'rxjs/observable/from';
|
|
3
3
|
import { map } from 'rxjs/operators/map';
|
|
4
4
|
import { mapMediaItemToFileState } from '../../models/file-state';
|
|
5
|
-
import {
|
|
5
|
+
import { createMediaSubject } from '../createMediaSubject';
|
|
6
6
|
import { isEmptyFile } from '../detectEmptyFile';
|
|
7
7
|
import { PollingFunction } from '../polling';
|
|
8
8
|
import { MobileUploadError } from './error';
|
|
@@ -12,7 +12,7 @@ export const createMobileFileStateSubject = service => {
|
|
|
12
12
|
return subject;
|
|
13
13
|
};
|
|
14
14
|
export const createMobileDownloadFileStream = (dataloader, id, collectionName, occurrenceKey) => {
|
|
15
|
-
const subject =
|
|
15
|
+
const subject = createMediaSubject();
|
|
16
16
|
const poll = new PollingFunction(); // ensure subject errors if polling exceeds max iterations or uncaught exception in executor
|
|
17
17
|
|
|
18
18
|
poll.onError = error => subject.error(error);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createMediaSubject } from './createMediaSubject';
|
|
2
|
+
export function toMediaSubscribable(observable) {
|
|
3
|
+
return {
|
|
4
|
+
subscribe: observer => {
|
|
5
|
+
const subscription = // This is needed to handle "subscribe" function overload.
|
|
6
|
+
// It allows accepting a single "next" callback function as an argument.
|
|
7
|
+
observer instanceof Function ? observable.subscribe(observer) : observable.subscribe(observer);
|
|
8
|
+
return {
|
|
9
|
+
unsubscribe: () => {
|
|
10
|
+
subscription.unsubscribe();
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export function createMediaSubscribable(mediaSubscribableItem) {
|
|
17
|
+
return toMediaSubscribable(createMediaSubject(mediaSubscribableItem));
|
|
18
|
+
}
|
package/dist/es2019/version.json
CHANGED
|
@@ -5,13 +5,14 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
5
5
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
6
6
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
7
7
|
|
|
8
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
8
|
+
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; }
|
|
9
9
|
|
|
10
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
10
|
+
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; }
|
|
11
11
|
|
|
12
12
|
import { ReplaySubject } from 'rxjs/ReplaySubject';
|
|
13
13
|
import { getFileStreamsCache } from '../file-streams-cache';
|
|
14
14
|
import { mapMediaFileToFileState } from '../models/file-state';
|
|
15
|
+
import { toMediaSubscribable } from '../utils/toMediaSubscribable';
|
|
15
16
|
export var collectionCache = {};
|
|
16
17
|
|
|
17
18
|
var createCacheEntry = function createCacheEntry() {
|
|
@@ -97,7 +98,7 @@ export var CollectionFetcher = /*#__PURE__*/function () {
|
|
|
97
98
|
}).catch(function (error) {
|
|
98
99
|
return subject.error(error);
|
|
99
100
|
});
|
|
100
|
-
return subject;
|
|
101
|
+
return toMediaSubscribable(subject);
|
|
101
102
|
}
|
|
102
103
|
}, {
|
|
103
104
|
key: "removeFile",
|
|
@@ -4,9 +4,9 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
|
4
4
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
5
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
6
6
|
|
|
7
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
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
|
|
|
9
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
9
|
+
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
10
|
|
|
11
11
|
import { Subscription } from 'rxjs/Subscription';
|
|
12
12
|
import { of } from 'rxjs/observable/of';
|
|
@@ -30,13 +30,14 @@ 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 { mediaSubscribableToPromise } from '../../utils/mediaSubscribableToPromise';
|
|
34
34
|
import { getDimensionsFromBlob } from '../../utils/getDimensionsFromBlob';
|
|
35
|
-
import {
|
|
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';
|
|
40
41
|
export { isFileFetcherError, FileFetcherError } from './error';
|
|
41
42
|
export var FileFetcherImpl = /*#__PURE__*/function () {
|
|
42
43
|
function FileFetcherImpl(mediaStore) {
|
|
@@ -45,7 +46,7 @@ export var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
45
46
|
_classCallCheck(this, FileFetcherImpl);
|
|
46
47
|
|
|
47
48
|
_defineProperty(this, "createDownloadFileStream", function (id, collectionName, occurrenceKey) {
|
|
48
|
-
var subject =
|
|
49
|
+
var subject = createMediaSubject();
|
|
49
50
|
var poll = new PollingFunction(); // ensure subject errors if polling exceeds max iterations or uncaught exception in executor
|
|
50
51
|
|
|
51
52
|
poll.onError = function (error) {
|
|
@@ -128,22 +129,22 @@ export var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
128
129
|
occurrenceKey = options.occurrenceKey;
|
|
129
130
|
|
|
130
131
|
if (!isValidId(id)) {
|
|
131
|
-
var subject =
|
|
132
|
+
var subject = createMediaSubject();
|
|
132
133
|
subject.error(new FileFetcherError('invalidFileId', id, {
|
|
133
134
|
collectionName: collectionName,
|
|
134
135
|
occurrenceKey: occurrenceKey
|
|
135
136
|
}));
|
|
136
|
-
return subject;
|
|
137
|
+
return toMediaSubscribable(subject);
|
|
137
138
|
}
|
|
138
139
|
|
|
139
|
-
return getFileStreamsCache().getOrInsert(id, function () {
|
|
140
|
+
return toMediaSubscribable(getFileStreamsCache().getOrInsert(id, function () {
|
|
140
141
|
return _this2.createDownloadFileStream(id, collectionName);
|
|
141
|
-
});
|
|
142
|
+
}));
|
|
142
143
|
}
|
|
143
144
|
}, {
|
|
144
145
|
key: "getCurrentState",
|
|
145
146
|
value: function getCurrentState(id, options) {
|
|
146
|
-
return
|
|
147
|
+
return mediaSubscribableToPromise(this.getFileState(id, options));
|
|
147
148
|
}
|
|
148
149
|
}, {
|
|
149
150
|
key: "getArtifactURL",
|
|
@@ -199,7 +200,7 @@ export var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
199
200
|
case 0:
|
|
200
201
|
uploadableFileUpfrontIds = this.generateUploadableFileUpfrontIds(collection);
|
|
201
202
|
id = uploadableFileUpfrontIds.id, occurrenceKey = uploadableFileUpfrontIds.occurrenceKey;
|
|
202
|
-
subject =
|
|
203
|
+
subject = createMediaSubject();
|
|
203
204
|
deferredBlob = fetch(url).then(function (response) {
|
|
204
205
|
return response.blob();
|
|
205
206
|
}).catch(function () {
|
|
@@ -361,7 +362,7 @@ export var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
361
362
|
var preview; // TODO [MSW-796]: get file size for base64
|
|
362
363
|
|
|
363
364
|
var mediaType = getMediaTypeFromUploadableFile(file);
|
|
364
|
-
var subject =
|
|
365
|
+
var subject = createMediaSubject();
|
|
365
366
|
var processingSubscription = new Subscription();
|
|
366
367
|
|
|
367
368
|
if (content instanceof Blob) {
|
|
@@ -433,7 +434,7 @@ export var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
433
434
|
});
|
|
434
435
|
}
|
|
435
436
|
|
|
436
|
-
return subject;
|
|
437
|
+
return toMediaSubscribable(subject);
|
|
437
438
|
}
|
|
438
439
|
}, {
|
|
439
440
|
key: "downloadBinary",
|
|
@@ -562,7 +563,7 @@ export var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
562
563
|
data: copiedFileWithMimeType
|
|
563
564
|
});
|
|
564
565
|
fileCache = cache.get(copiedId);
|
|
565
|
-
subject = fileCache ||
|
|
566
|
+
subject = fileCache || createMediaSubject(); // if we were passed a "preview", we propagate it into the copiedFileState
|
|
566
567
|
|
|
567
568
|
previewOverride = !isErrorFileState(copiedFileState) && !!preview ? {
|
|
568
569
|
preview: preview
|
|
@@ -630,7 +631,7 @@ export var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
630
631
|
_fileCache.error(_context6.t3);
|
|
631
632
|
} else {
|
|
632
633
|
// Create a new subject with the error state for new subscriptions
|
|
633
|
-
cache.set(id,
|
|
634
|
+
cache.set(id, createMediaSubject(_context6.t3));
|
|
634
635
|
}
|
|
635
636
|
}
|
|
636
637
|
|
|
@@ -4,9 +4,9 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
|
4
4
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
5
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
6
6
|
|
|
7
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
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
|
|
|
9
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
9
|
+
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
10
|
|
|
11
11
|
import { FILE_CACHE_MAX_AGE, MAX_RESOLUTION } from '../../constants';
|
|
12
12
|
import { getArtifactUrl } from '../../models/artifacts';
|
package/dist/esm/index.js
CHANGED
|
@@ -4,6 +4,7 @@ export { isPreviewableType, isMediaCollectionItemFullDetails } from './models/me
|
|
|
4
4
|
export { getArtifactUrl } from './models/artifacts';
|
|
5
5
|
export { isMediaClientError, getMediaClientErrorReason } from './models/errors';
|
|
6
6
|
export { isUploadingFileState, isProcessingFileState, isProcessedFileState, isErrorFileState, isPreviewableFileState, isFinalFileState, isImageRepresentationReady, mapMediaFileToFileState, mapMediaItemToFileState } from './models/file-state';
|
|
7
|
+
// TODO: remove access to media file stream cache https://product-fabric.atlassian.net/browse/MEX-1417
|
|
7
8
|
export { getFileStreamsCache, StreamsCache } from './file-streams-cache';
|
|
8
9
|
export { uploadFile } from './uploader';
|
|
9
10
|
export { request, RequestError, isRequestError, isRateLimitedError } from './utils/request';
|
|
@@ -17,14 +18,14 @@ export { MediaClient } from './client/media-client';
|
|
|
17
18
|
export { StargateClient } from './client/stargate-client';
|
|
18
19
|
export { isImageRemote } from './utils/isImageRemote';
|
|
19
20
|
export { checkWebpSupport } from './utils/checkWebpSupport';
|
|
20
|
-
export { observableToPromise } from './utils/observableToPromise';
|
|
21
21
|
export { getDimensionsFromBlob } from './utils/getDimensionsFromBlob';
|
|
22
|
-
export {
|
|
22
|
+
export { createMediaSubject } from './utils/createMediaSubject';
|
|
23
23
|
export { safeUnsubscribe } from './utils/safeUnsubscribe';
|
|
24
24
|
export { isFileIdentifier, isExternalImageIdentifier, isDifferentIdentifier } from './identifier';
|
|
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/toMediaSubscribable';
|
|
28
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.
|
|
29
30
|
|
|
30
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,3 +1,4 @@
|
|
|
1
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
1
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
3
|
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
3
4
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
@@ -36,5 +37,5 @@ export var BaseMediaClientError = /*#__PURE__*/function (_Error) {
|
|
|
36
37
|
return _this;
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
return BaseMediaClientError;
|
|
40
|
+
return _createClass(BaseMediaClientError);
|
|
40
41
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
|
|
3
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
3
|
+
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; }
|
|
4
4
|
|
|
5
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
5
|
+
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; }
|
|
6
6
|
|
|
7
7
|
export var isUploadingFileState = function isUploadingFileState(fileState) {
|
|
8
8
|
return fileState.status === 'uploading';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReplaySubject } from 'rxjs/ReplaySubject';
|
|
2
|
-
export
|
|
2
|
+
export function createMediaSubject(initialState) {
|
|
3
3
|
var subject = new ReplaySubject(1);
|
|
4
4
|
|
|
5
5
|
if (initialState instanceof Error) {
|
|
@@ -9,4 +9,4 @@ export var createFileStateSubject = function createFileStateSubject(initialState
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
return subject;
|
|
12
|
-
}
|
|
12
|
+
}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { Subscription } from 'rxjs/Subscription';
|
|
2
|
+
|
|
2
3
|
/**
|
|
3
|
-
*
|
|
4
|
-
* Note that in RxJS 7 ".toPromise()" is deprecated and replaced by "firstValueFrom()/.lastValueFrom()"
|
|
4
|
+
* This is a helper to transform the first value emitted by an MediaSubscribable into a Promise.
|
|
5
5
|
*
|
|
6
|
-
* @param
|
|
6
|
+
* @param mediaSubscribable a given MediaSubscribable<MediaSubscribableItem>
|
|
7
7
|
* @param subscription a default Subscription (this parameter exists for testing purpose)
|
|
8
8
|
*/
|
|
9
|
-
|
|
10
|
-
export var observableToPromise = function observableToPromise(observable) {
|
|
9
|
+
export var mediaSubscribableToPromise = function mediaSubscribableToPromise(mediaSubscribable) {
|
|
11
10
|
var subscription = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Subscription();
|
|
12
11
|
return new Promise(function (resolve, reject) {
|
|
13
|
-
return subscription.add(
|
|
12
|
+
return subscription.add(mediaSubscribable.subscribe({
|
|
14
13
|
next: function next(state) {
|
|
15
14
|
resolve(state);
|
|
16
15
|
subscription.unsubscribe();
|
|
@@ -4,7 +4,7 @@ import { ReplaySubject } from 'rxjs/ReplaySubject';
|
|
|
4
4
|
import { from } from 'rxjs/observable/from';
|
|
5
5
|
import { map } from 'rxjs/operators/map';
|
|
6
6
|
import { mapMediaItemToFileState } from '../../models/file-state';
|
|
7
|
-
import {
|
|
7
|
+
import { createMediaSubject } from '../createMediaSubject';
|
|
8
8
|
import { isEmptyFile } from '../detectEmptyFile';
|
|
9
9
|
import { PollingFunction } from '../polling';
|
|
10
10
|
import { MobileUploadError } from './error';
|
|
@@ -16,7 +16,7 @@ export var createMobileFileStateSubject = function createMobileFileStateSubject(
|
|
|
16
16
|
return subject;
|
|
17
17
|
};
|
|
18
18
|
export var createMobileDownloadFileStream = function createMobileDownloadFileStream(dataloader, id, collectionName, occurrenceKey) {
|
|
19
|
-
var subject =
|
|
19
|
+
var subject = createMediaSubject();
|
|
20
20
|
var poll = new PollingFunction(); // ensure subject errors if polling exceeds max iterations or uncaught exception in executor
|
|
21
21
|
|
|
22
22
|
poll.onError = function (error) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
|
|
3
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
3
|
+
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; }
|
|
4
4
|
|
|
5
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
5
|
+
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; }
|
|
6
6
|
|
|
7
7
|
import { assign } from 'xstate';
|
|
8
8
|
import { isUploadingFileState } from '../../../../models/file-state';
|
|
@@ -4,9 +4,9 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
|
4
4
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
5
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
6
6
|
|
|
7
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
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
|
|
|
9
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
9
|
+
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
10
|
|
|
11
11
|
import { PollingError } from './errors';
|
|
12
12
|
// default polling options without using feature flags
|
|
@@ -2,9 +2,9 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
4
|
|
|
5
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
5
|
+
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; }
|
|
6
6
|
|
|
7
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
7
|
+
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; }
|
|
8
8
|
|
|
9
9
|
import { isClientBasedAuth } from '@atlaskit/media-core';
|
|
10
10
|
import { parse, stringify } from 'query-string';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createMediaSubject } from './createMediaSubject';
|
|
2
|
+
export function toMediaSubscribable(observable) {
|
|
3
|
+
return {
|
|
4
|
+
subscribe: function subscribe(observer) {
|
|
5
|
+
var subscription = // This is needed to handle "subscribe" function overload.
|
|
6
|
+
// It allows accepting a single "next" callback function as an argument.
|
|
7
|
+
observer instanceof Function ? observable.subscribe(observer) : observable.subscribe(observer);
|
|
8
|
+
return {
|
|
9
|
+
unsubscribe: function unsubscribe() {
|
|
10
|
+
subscription.unsubscribe();
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export function createMediaSubscribable(mediaSubscribableItem) {
|
|
17
|
+
return toMediaSubscribable(createMediaSubject(mediaSubscribableItem));
|
|
18
|
+
}
|
package/dist/esm/utils/url.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
|
|
3
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
3
|
+
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; }
|
|
4
4
|
|
|
5
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
5
|
+
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; }
|
|
6
6
|
|
|
7
7
|
var mediaBlobUrlIdentifier = 'media-blob-url';
|
|
8
8
|
export var isMediaBlobUrl = function isMediaBlobUrl(url) {
|
|
@@ -5,6 +5,7 @@ import _createClass from "@babel/runtime/helpers/createClass";
|
|
|
5
5
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
6
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
7
7
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
8
|
+
var _excluded = ["mediaClientConfig"];
|
|
8
9
|
|
|
9
10
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
10
11
|
|
|
@@ -55,7 +56,7 @@ export var withMediaClient = function withMediaClient(Component, featureFlags) {
|
|
|
55
56
|
// TODO MPT-315: clean up after we move mediaClientConfig into FileIdentifier
|
|
56
57
|
var _this$props = this.props,
|
|
57
58
|
mediaClientConfig = _this$props.mediaClientConfig,
|
|
58
|
-
otherProps = _objectWithoutProperties(_this$props,
|
|
59
|
+
otherProps = _objectWithoutProperties(_this$props, _excluded);
|
|
59
60
|
|
|
60
61
|
var mediaClient = !mediaClientConfig ? createEmptyMediaClient(featureFlags) : getMediaClient(mediaClientConfig, featureFlags);
|
|
61
62
|
return /*#__PURE__*/React.createElement(Component, _extends({}, otherProps, {
|
package/dist/esm/version.json
CHANGED
|
@@ -2,6 +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/toMediaSubscribable';
|
|
5
6
|
export interface MediaCollectionFileItemDetails extends FileDetails {
|
|
6
7
|
occurrenceKey: string;
|
|
7
8
|
}
|
|
@@ -28,7 +29,7 @@ export declare class CollectionFetcher {
|
|
|
28
29
|
private createFileStateObserver;
|
|
29
30
|
private populateCache;
|
|
30
31
|
private removeFromCache;
|
|
31
|
-
getItems(collectionName: string, params?: MediaStoreGetCollectionItemsParams):
|
|
32
|
+
getItems(collectionName: string, params?: MediaStoreGetCollectionItemsParams): MediaSubscribable<MediaCollectionItem[]>;
|
|
32
33
|
removeFile(id: string, collectionName: string, occurrenceKey?: string): Promise<void>;
|
|
33
34
|
loadNextPage(collectionName: string, params?: MediaStoreGetCollectionItemsParams): Promise<void>;
|
|
34
35
|
}
|