@atlaskit/media-client 37.2.37 → 37.3.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 +58 -0
- package/dist/cjs/client/file-fetcher/FileFetcherError.js +54 -0
- package/dist/cjs/client/file-fetcher/error.js +13 -52
- package/dist/cjs/client/file-fetcher/index.js +59 -46
- package/dist/cjs/client/file-fetcher/isFileFetcherError.js +10 -0
- package/dist/cjs/client/media-client.js +4 -4
- package/dist/cjs/client/media-store/MediaStore.js +100 -108
- package/dist/cjs/client/media-store/MediaStoreError.js +36 -0
- package/dist/cjs/client/media-store/cdnFeatureFlag.js +14 -0
- package/dist/cjs/client/media-store/decodeJwtToken.js +9 -0
- package/dist/cjs/client/media-store/error.js +13 -34
- package/dist/cjs/client/media-store/extendImageParams.js +23 -0
- package/dist/cjs/client/media-store/getMediaEnvironment.js +11 -0
- package/dist/cjs/client/media-store/getMediaRegion.js +11 -0
- package/dist/cjs/client/media-store/getValueFromSessionStorage.js +10 -0
- package/dist/cjs/client/media-store/isMediaStoreError.js +10 -0
- package/dist/cjs/client/media-store/jsonHeaders.js +10 -0
- package/dist/cjs/client/media-store/resolveAuth.js +10 -16
- package/dist/cjs/client/media-store/resolveInitialAuth.js +13 -0
- package/dist/cjs/client/media-store/setKeyValueInSessionStorage.js +19 -0
- package/dist/cjs/client/mobile-upload.js +9 -6
- package/dist/cjs/identifier.js +20 -15
- package/dist/cjs/index.js +60 -37
- package/dist/cjs/is-different-identifier.js +16 -0
- package/dist/cjs/is-external-image-identifier.js +9 -0
- package/dist/cjs/is-file-identifier.js +9 -0
- package/dist/cjs/models/artifacts.js +2 -2
- package/dist/cjs/models/errors/BaseMediaClientError.js +43 -0
- package/dist/cjs/models/errors/CommonMediaClientError.js +32 -0
- package/dist/cjs/models/errors/fromCommonMediaClientError.js +28 -0
- package/dist/cjs/models/errors/getMediaClientErrorReason.js +10 -0
- package/dist/cjs/models/errors/helpers.js +14 -8
- package/dist/cjs/models/errors/index.js +37 -96
- package/dist/cjs/models/errors/isCommonMediaClientError.js +17 -0
- package/dist/cjs/models/errors/isMediaClientError.js +9 -0
- package/dist/cjs/models/errors/toCommonMediaClientError.js +13 -0
- package/dist/cjs/models/file-state.js +75 -93
- package/dist/cjs/models/has-artifacts.js +9 -0
- package/dist/cjs/models/is-error-file-state.js +9 -0
- package/dist/cjs/models/is-final-file-state.js +9 -0
- package/dist/cjs/models/is-image-representation-ready.js +16 -0
- package/dist/cjs/models/is-non-error-final-file-state.js +9 -0
- package/dist/cjs/models/is-not-found-media-item-details.js +9 -0
- package/dist/cjs/models/is-previewable-file-state.js +10 -0
- package/dist/cjs/models/is-previewable-type.js +10 -0
- package/dist/cjs/models/is-processed-file-state.js +9 -0
- package/dist/cjs/models/is-processing-file-state.js +9 -0
- package/dist/cjs/models/is-uploading-file-state.js +9 -0
- package/dist/cjs/models/map-media-file-to-file-state.js +59 -0
- package/dist/cjs/models/map-media-item-to-file-state.js +18 -0
- package/dist/cjs/models/media.js +23 -10
- package/dist/cjs/uploader/{error.js → UploaderError.js} +2 -6
- package/dist/cjs/uploader/index.js +4 -4
- package/dist/cjs/uploader/isUploaderError.js +10 -0
- package/dist/cjs/utils/addFileAttrsToUrl.js +24 -0
- package/dist/cjs/utils/createBatchLoadingFunc.js +127 -0
- package/dist/cjs/utils/createFileDataLoader.js +1 -170
- package/dist/cjs/utils/createFileDataloader-2.js +15 -0
- package/dist/cjs/utils/getAttrsFromUrl.js +41 -0
- package/dist/cjs/utils/getItemsFromKeys.js +50 -0
- package/dist/cjs/utils/isCDNEnabled.js +15 -0
- package/dist/cjs/utils/isMediaBlobUrl.js +10 -0
- package/dist/cjs/utils/isPathBasedEnabled.js +14 -0
- package/dist/cjs/utils/mapRetryUrlToPathBasedUrl.js +24 -0
- package/dist/cjs/utils/mapToMediaCdnUrl.js +38 -0
- package/dist/cjs/utils/mapToPathBasedUrl.js +32 -0
- package/dist/cjs/utils/mediaCdn.js +2 -40
- package/dist/cjs/utils/mediaSubscribable/createMediaSubscribable.js +11 -0
- package/dist/cjs/utils/mediaSubscribable/fromObservable.js +13 -5
- package/dist/cjs/utils/mobileUpload/{error.js → MobileUploadError.js} +2 -6
- package/dist/cjs/utils/mobileUpload/{helpers.js → createMobileDownloadFileStream.js} +8 -18
- package/dist/cjs/utils/mobileUpload/createMobileFileStateSubject.js +16 -0
- package/dist/cjs/utils/mobileUpload/isMobileUploadError.js +10 -0
- package/dist/cjs/utils/mobileUpload/stateMachine/createMobileUploadService.js +10 -0
- package/dist/cjs/utils/mobileUpload/stateMachine/{index.js → createMobileUploadStateMachine.js} +8 -12
- package/dist/cjs/utils/mobileUpload/stateMachine/states/uploading.js +3 -3
- package/dist/cjs/utils/objectToQueryString.js +17 -0
- package/dist/cjs/utils/overrideMediaTypeIfUnknown.js +2 -2
- package/dist/cjs/utils/pathBasedUrl.js +2 -49
- package/dist/cjs/utils/polling/PollingError.js +36 -0
- package/dist/cjs/utils/polling/errors.js +13 -34
- package/dist/cjs/utils/polling/index.js +11 -6
- package/dist/cjs/utils/polling/isPollingError.js +10 -0
- package/dist/cjs/utils/rejectTimeout.js +11 -0
- package/dist/cjs/utils/request/RequestError.js +56 -0
- package/dist/cjs/utils/request/cloneRequestError.js +17 -0
- package/dist/cjs/utils/request/createMapResponseToBlob.js +43 -0
- package/dist/cjs/utils/request/createMapResponseToJson.js +43 -0
- package/dist/cjs/utils/request/createProcessFetchResponse.js +16 -0
- package/dist/cjs/utils/request/createRequestErrorFromResponse.js +20 -0
- package/dist/cjs/utils/request/createRequestErrorReason.js +30 -0
- package/dist/cjs/utils/request/createUrl.js +31 -0
- package/dist/cjs/utils/request/defaultShouldRetryError.js +12 -0
- package/dist/cjs/utils/request/errors.js +13 -54
- package/dist/cjs/utils/request/extendHeaders.js +21 -0
- package/dist/cjs/utils/request/extendTraceContext.js +16 -0
- package/dist/cjs/utils/request/extractMediaHeaders.js +15 -0
- package/dist/cjs/utils/request/fetchRetry.js +120 -0
- package/dist/cjs/utils/request/getStatusCode.js +11 -0
- package/dist/cjs/utils/request/helpers.js +198 -313
- package/dist/cjs/utils/request/index.js +36 -20
- package/dist/cjs/utils/request/isAbortedRequestError.js +9 -0
- package/dist/cjs/utils/request/isFetchNetworkError.js +10 -0
- package/dist/cjs/utils/request/isRateLimitedError.js +11 -0
- package/dist/cjs/utils/request/isRequestError.js +10 -0
- package/dist/cjs/utils/request/mapAuthToRequestHeaders.js +22 -0
- package/dist/cjs/utils/request/waitPromise.js +11 -0
- package/dist/cjs/utils/{setTimeoutPromise.js → resolveTimeout.js} +1 -6
- package/dist/cjs/utils/url.js +43 -63
- package/dist/es2019/client/file-fetcher/FileFetcherError.js +34 -0
- package/dist/es2019/client/file-fetcher/error.js +9 -37
- package/dist/es2019/client/file-fetcher/index.js +32 -17
- package/dist/es2019/client/file-fetcher/isFileFetcherError.js +4 -0
- package/dist/es2019/client/media-client.js +1 -1
- package/dist/es2019/client/media-store/MediaStore.js +35 -59
- package/dist/es2019/client/media-store/MediaStoreError.js +19 -0
- package/dist/es2019/client/media-store/cdnFeatureFlag.js +8 -0
- package/dist/es2019/client/media-store/decodeJwtToken.js +3 -0
- package/dist/es2019/client/media-store/error.js +9 -22
- package/dist/es2019/client/media-store/extendImageParams.js +14 -0
- package/dist/es2019/client/media-store/getMediaEnvironment.js +5 -0
- package/dist/es2019/client/media-store/getMediaRegion.js +5 -0
- package/dist/es2019/client/media-store/getValueFromSessionStorage.js +4 -0
- package/dist/es2019/client/media-store/isMediaStoreError.js +4 -0
- package/dist/es2019/client/media-store/jsonHeaders.js +4 -0
- package/dist/es2019/client/media-store/resolveAuth.js +2 -8
- package/dist/es2019/client/media-store/resolveInitialAuth.js +7 -0
- package/dist/es2019/client/media-store/setKeyValueInSessionStorage.js +13 -0
- package/dist/es2019/client/mobile-upload.js +5 -2
- package/dist/es2019/identifier.js +14 -14
- package/dist/es2019/index.js +31 -8
- package/dist/es2019/is-different-identifier.js +9 -0
- package/dist/es2019/is-external-image-identifier.js +3 -0
- package/dist/es2019/is-file-identifier.js +3 -0
- package/dist/es2019/models/artifacts.js +1 -1
- package/dist/es2019/models/errors/BaseMediaClientError.js +23 -0
- package/dist/es2019/models/errors/CommonMediaClientError.js +13 -0
- package/dist/es2019/models/errors/fromCommonMediaClientError.js +20 -0
- package/dist/es2019/models/errors/getMediaClientErrorReason.js +4 -0
- package/dist/es2019/models/errors/helpers.js +10 -6
- package/dist/es2019/models/errors/index.js +27 -72
- package/dist/es2019/models/errors/isCommonMediaClientError.js +11 -0
- package/dist/es2019/models/errors/isMediaClientError.js +3 -0
- package/dist/es2019/models/errors/toCommonMediaClientError.js +8 -0
- package/dist/es2019/models/file-state.js +46 -79
- package/dist/es2019/models/has-artifacts.js +1 -0
- package/dist/es2019/models/is-error-file-state.js +1 -0
- package/dist/es2019/models/is-final-file-state.js +1 -0
- package/dist/es2019/models/is-image-representation-ready.js +10 -0
- package/dist/es2019/models/is-non-error-final-file-state.js +1 -0
- package/dist/es2019/models/is-not-found-media-item-details.js +3 -0
- package/dist/es2019/models/is-previewable-file-state.js +2 -0
- package/dist/es2019/models/is-previewable-type.js +4 -0
- package/dist/es2019/models/is-processed-file-state.js +1 -0
- package/dist/es2019/models/is-processing-file-state.js +1 -0
- package/dist/es2019/models/is-uploading-file-state.js +1 -0
- package/dist/es2019/models/map-media-file-to-file-state.js +53 -0
- package/dist/es2019/models/map-media-item-to-file-state.js +9 -0
- package/dist/es2019/models/media.js +12 -8
- package/dist/es2019/uploader/{error.js → UploaderError.js} +1 -4
- package/dist/es2019/uploader/index.js +3 -3
- package/dist/es2019/uploader/isUploaderError.js +4 -0
- package/dist/es2019/utils/addFileAttrsToUrl.js +19 -0
- package/dist/es2019/utils/createBatchLoadingFunc.js +74 -0
- package/dist/es2019/utils/createFileDataLoader.js +1 -122
- package/dist/es2019/utils/createFileDataloader-2.js +8 -0
- package/dist/es2019/utils/getAttrsFromUrl.js +35 -0
- package/dist/es2019/utils/getItemsFromKeys.js +43 -0
- package/dist/es2019/utils/isCDNEnabled.js +9 -0
- package/dist/es2019/utils/isMediaBlobUrl.js +4 -0
- package/dist/es2019/utils/isPathBasedEnabled.js +7 -0
- package/dist/es2019/utils/mapRetryUrlToPathBasedUrl.js +17 -0
- package/dist/es2019/utils/mapToMediaCdnUrl.js +32 -0
- package/dist/es2019/utils/mapToPathBasedUrl.js +25 -0
- package/dist/es2019/utils/mediaCdn.js +1 -37
- package/dist/es2019/utils/mediaSubscribable/createMediaSubscribable.js +5 -0
- package/dist/es2019/utils/mediaSubscribable/fromObservable.js +7 -4
- package/dist/es2019/utils/mobileUpload/{error.js → MobileUploadError.js} +1 -4
- package/dist/es2019/utils/mobileUpload/{helpers.js → createMobileDownloadFileStream.js} +3 -11
- package/dist/es2019/utils/mobileUpload/createMobileFileStateSubject.js +8 -0
- package/dist/es2019/utils/mobileUpload/isMobileUploadError.js +4 -0
- package/dist/es2019/utils/mobileUpload/stateMachine/createMobileUploadService.js +4 -0
- package/dist/es2019/utils/mobileUpload/stateMachine/{index.js → createMobileUploadStateMachine.js} +7 -10
- package/dist/es2019/utils/mobileUpload/stateMachine/states/uploading.js +1 -1
- package/dist/es2019/utils/objectToQueryString.js +9 -0
- package/dist/es2019/utils/overrideMediaTypeIfUnknown.js +1 -1
- package/dist/es2019/utils/pathBasedUrl.js +1 -45
- package/dist/es2019/utils/polling/PollingError.js +21 -0
- package/dist/es2019/utils/polling/errors.js +9 -24
- package/dist/es2019/utils/polling/index.js +10 -2
- package/dist/es2019/utils/polling/isPollingError.js +4 -0
- package/dist/es2019/utils/rejectTimeout.js +3 -0
- package/dist/es2019/utils/request/RequestError.js +39 -0
- package/dist/es2019/utils/request/cloneRequestError.js +12 -0
- package/dist/es2019/utils/request/createMapResponseToBlob.js +15 -0
- package/dist/es2019/utils/request/createMapResponseToJson.js +15 -0
- package/dist/es2019/utils/request/createProcessFetchResponse.js +10 -0
- package/dist/es2019/utils/request/createRequestErrorFromResponse.js +14 -0
- package/dist/es2019/utils/request/createRequestErrorReason.js +24 -0
- package/dist/es2019/utils/request/createUrl.js +17 -0
- package/dist/es2019/utils/request/defaultShouldRetryError.js +6 -0
- package/dist/es2019/utils/request/errors.js +9 -42
- package/dist/es2019/utils/request/extendHeaders.js +18 -0
- package/dist/es2019/utils/request/extendTraceContext.js +5 -0
- package/dist/es2019/utils/request/extractMediaHeaders.js +11 -0
- package/dist/es2019/utils/request/fetchRetry.js +54 -0
- package/dist/es2019/utils/request/getStatusCode.js +5 -0
- package/dist/es2019/utils/request/helpers.js +73 -215
- package/dist/es2019/utils/request/index.js +25 -4
- package/dist/es2019/utils/request/isAbortedRequestError.js +3 -0
- package/dist/es2019/utils/request/isFetchNetworkError.js +4 -0
- package/dist/es2019/utils/request/isRateLimitedError.js +5 -0
- package/dist/es2019/utils/request/isRequestError.js +4 -0
- package/dist/es2019/utils/request/mapAuthToRequestHeaders.js +16 -0
- package/dist/es2019/utils/request/waitPromise.js +3 -0
- package/dist/es2019/utils/resolveTimeout.js +3 -0
- package/dist/es2019/utils/url.js +18 -65
- package/dist/esm/client/file-fetcher/FileFetcherError.js +47 -0
- package/dist/esm/client/file-fetcher/error.js +9 -50
- package/dist/esm/client/file-fetcher/index.js +32 -17
- package/dist/esm/client/file-fetcher/isFileFetcherError.js +4 -0
- package/dist/esm/client/media-client.js +1 -1
- package/dist/esm/client/media-store/MediaStore.js +35 -58
- package/dist/esm/client/media-store/MediaStoreError.js +29 -0
- package/dist/esm/client/media-store/cdnFeatureFlag.js +8 -0
- package/dist/esm/client/media-store/decodeJwtToken.js +3 -0
- package/dist/esm/client/media-store/error.js +9 -32
- package/dist/esm/client/media-store/extendImageParams.js +16 -0
- package/dist/esm/client/media-store/getMediaEnvironment.js +5 -0
- package/dist/esm/client/media-store/getMediaRegion.js +5 -0
- package/dist/esm/client/media-store/getValueFromSessionStorage.js +4 -0
- package/dist/esm/client/media-store/isMediaStoreError.js +4 -0
- package/dist/esm/client/media-store/jsonHeaders.js +4 -0
- package/dist/esm/client/media-store/resolveAuth.js +3 -9
- package/dist/esm/client/media-store/resolveInitialAuth.js +7 -0
- package/dist/esm/client/media-store/setKeyValueInSessionStorage.js +13 -0
- package/dist/esm/client/mobile-upload.js +5 -2
- package/dist/esm/identifier.js +14 -14
- package/dist/esm/index.js +31 -8
- package/dist/esm/is-different-identifier.js +9 -0
- package/dist/esm/is-external-image-identifier.js +3 -0
- package/dist/esm/is-file-identifier.js +3 -0
- package/dist/esm/models/artifacts.js +1 -1
- package/dist/esm/models/errors/BaseMediaClientError.js +36 -0
- package/dist/esm/models/errors/CommonMediaClientError.js +25 -0
- package/dist/esm/models/errors/fromCommonMediaClientError.js +21 -0
- package/dist/esm/models/errors/getMediaClientErrorReason.js +4 -0
- package/dist/esm/models/errors/helpers.js +10 -6
- package/dist/esm/models/errors/index.js +27 -91
- package/dist/esm/models/errors/isCommonMediaClientError.js +11 -0
- package/dist/esm/models/errors/isMediaClientError.js +3 -0
- package/dist/esm/models/errors/toCommonMediaClientError.js +8 -0
- package/dist/esm/models/file-state.js +46 -93
- package/dist/esm/models/has-artifacts.js +3 -0
- package/dist/esm/models/is-error-file-state.js +3 -0
- package/dist/esm/models/is-final-file-state.js +3 -0
- package/dist/esm/models/is-image-representation-ready.js +10 -0
- package/dist/esm/models/is-non-error-final-file-state.js +3 -0
- package/dist/esm/models/is-not-found-media-item-details.js +3 -0
- package/dist/esm/models/is-previewable-file-state.js +4 -0
- package/dist/esm/models/is-previewable-type.js +4 -0
- package/dist/esm/models/is-processed-file-state.js +3 -0
- package/dist/esm/models/is-processing-file-state.js +3 -0
- package/dist/esm/models/is-uploading-file-state.js +3 -0
- package/dist/esm/models/map-media-file-to-file-state.js +52 -0
- package/dist/esm/models/map-media-item-to-file-state.js +11 -0
- package/dist/esm/models/media.js +12 -8
- package/dist/esm/uploader/{error.js → UploaderError.js} +2 -5
- package/dist/esm/uploader/index.js +3 -3
- package/dist/esm/uploader/isUploaderError.js +4 -0
- package/dist/esm/utils/addFileAttrsToUrl.js +17 -0
- package/dist/esm/utils/createBatchLoadingFunc.js +121 -0
- package/dist/esm/utils/createFileDataLoader.js +1 -166
- package/dist/esm/utils/createFileDataloader-2.js +8 -0
- package/dist/esm/utils/getAttrsFromUrl.js +35 -0
- package/dist/esm/utils/getItemsFromKeys.js +43 -0
- package/dist/esm/utils/isCDNEnabled.js +9 -0
- package/dist/esm/utils/isMediaBlobUrl.js +4 -0
- package/dist/esm/utils/isPathBasedEnabled.js +7 -0
- package/dist/esm/utils/mapRetryUrlToPathBasedUrl.js +17 -0
- package/dist/esm/utils/mapToMediaCdnUrl.js +32 -0
- package/dist/esm/utils/mapToPathBasedUrl.js +25 -0
- package/dist/esm/utils/mediaCdn.js +1 -37
- package/dist/esm/utils/mediaSubscribable/createMediaSubscribable.js +5 -0
- package/dist/esm/utils/mediaSubscribable/fromObservable.js +7 -4
- package/dist/esm/utils/mobileUpload/{error.js → MobileUploadError.js} +2 -5
- package/dist/esm/utils/mobileUpload/{helpers.js → createMobileDownloadFileStream.js} +3 -13
- package/dist/esm/utils/mobileUpload/createMobileFileStateSubject.js +10 -0
- package/dist/esm/utils/mobileUpload/isMobileUploadError.js +4 -0
- package/dist/esm/utils/mobileUpload/stateMachine/createMobileUploadService.js +4 -0
- package/dist/esm/utils/mobileUpload/stateMachine/{index.js → createMobileUploadStateMachine.js} +7 -10
- package/dist/esm/utils/mobileUpload/stateMachine/states/uploading.js +1 -1
- package/dist/esm/utils/objectToQueryString.js +11 -0
- package/dist/esm/utils/overrideMediaTypeIfUnknown.js +1 -1
- package/dist/esm/utils/pathBasedUrl.js +1 -45
- package/dist/esm/utils/polling/PollingError.js +29 -0
- package/dist/esm/utils/polling/errors.js +9 -32
- package/dist/esm/utils/polling/index.js +10 -2
- package/dist/esm/utils/polling/isPollingError.js +4 -0
- package/dist/esm/utils/rejectTimeout.js +5 -0
- package/dist/esm/utils/request/RequestError.js +49 -0
- package/dist/esm/utils/request/cloneRequestError.js +10 -0
- package/dist/esm/utils/request/createMapResponseToBlob.js +36 -0
- package/dist/esm/utils/request/createMapResponseToJson.js +36 -0
- package/dist/esm/utils/request/createProcessFetchResponse.js +10 -0
- package/dist/esm/utils/request/createRequestErrorFromResponse.js +13 -0
- package/dist/esm/utils/request/createRequestErrorReason.js +24 -0
- package/dist/esm/utils/request/createUrl.js +24 -0
- package/dist/esm/utils/request/defaultShouldRetryError.js +6 -0
- package/dist/esm/utils/request/errors.js +9 -52
- package/dist/esm/utils/request/extendHeaders.js +14 -0
- package/dist/esm/utils/request/extendTraceContext.js +9 -0
- package/dist/esm/utils/request/extractMediaHeaders.js +9 -0
- package/dist/esm/utils/request/fetchRetry.js +113 -0
- package/dist/esm/utils/request/getStatusCode.js +5 -0
- package/dist/esm/utils/request/helpers.js +73 -295
- package/dist/esm/utils/request/index.js +25 -4
- package/dist/esm/utils/request/isAbortedRequestError.js +3 -0
- package/dist/esm/utils/request/isFetchNetworkError.js +4 -0
- package/dist/esm/utils/request/isRateLimitedError.js +5 -0
- package/dist/esm/utils/request/isRequestError.js +4 -0
- package/dist/esm/utils/request/mapAuthToRequestHeaders.js +16 -0
- package/dist/esm/utils/request/waitPromise.js +5 -0
- package/dist/esm/utils/{setTimeoutPromise.js → resolveTimeout.js} +0 -5
- package/dist/esm/utils/url.js +18 -65
- package/dist/types/client/file-fetcher/FileFetcherError.d.ts +32 -0
- package/dist/types/client/file-fetcher/error.d.ts +9 -33
- package/dist/types/client/file-fetcher/index.d.ts +15 -7
- package/dist/types/client/file-fetcher/isFileFetcherError.d.ts +2 -0
- package/dist/types/client/media-client.d.ts +4 -3
- package/dist/types/client/media-store/MediaStore.d.ts +18 -6
- package/dist/types/client/media-store/MediaStoreError.d.ts +14 -0
- package/dist/types/client/media-store/cdnFeatureFlag.d.ts +1 -0
- package/dist/types/client/media-store/decodeJwtToken.d.ts +3 -0
- package/dist/types/client/media-store/error.d.ts +9 -15
- package/dist/types/client/media-store/extendImageParams.d.ts +2 -0
- package/dist/types/client/media-store/getMediaEnvironment.d.ts +1 -0
- package/dist/types/client/media-store/getMediaRegion.d.ts +1 -0
- package/dist/types/client/media-store/getValueFromSessionStorage.d.ts +1 -0
- package/dist/types/client/media-store/isMediaStoreError.d.ts +2 -0
- package/dist/types/client/media-store/jsonHeaders.d.ts +1 -0
- package/dist/types/client/media-store/resolveAuth.d.ts +0 -1
- package/dist/types/client/media-store/resolveInitialAuth.d.ts +2 -0
- package/dist/types/client/media-store/setKeyValueInSessionStorage.d.ts +1 -0
- package/dist/types/client/mobile-upload.d.ts +1 -1
- package/dist/types/identifier.d.ts +12 -3
- package/dist/types/index.d.ts +34 -10
- package/dist/types/is-different-identifier.d.ts +2 -0
- package/dist/types/is-external-image-identifier.d.ts +2 -0
- package/dist/types/is-file-identifier.d.ts +2 -0
- package/dist/types/models/errors/BaseMediaClientError.d.ts +11 -0
- package/dist/types/models/errors/CommonMediaClientError.d.ts +7 -0
- package/dist/types/models/errors/fromCommonMediaClientError.d.ts +4 -0
- package/dist/types/models/errors/getMediaClientErrorReason.d.ts +2 -0
- package/dist/types/models/errors/helpers.d.ts +8 -5
- package/dist/types/models/errors/index.d.ts +26 -21
- package/dist/types/models/errors/isCommonMediaClientError.d.ts +3 -0
- package/dist/types/models/errors/isMediaClientError.d.ts +4 -0
- package/dist/types/models/errors/toCommonMediaClientError.d.ts +4 -0
- package/dist/types/models/file-state.d.ts +45 -16
- package/dist/types/models/has-artifacts.d.ts +4 -0
- package/dist/types/models/is-error-file-state.d.ts +2 -0
- package/dist/types/models/is-final-file-state.d.ts +2 -0
- package/dist/types/models/is-image-representation-ready.d.ts +2 -0
- package/dist/types/models/is-non-error-final-file-state.d.ts +2 -0
- package/dist/types/models/is-not-found-media-item-details.d.ts +2 -0
- package/dist/types/models/is-previewable-file-state.d.ts +3 -0
- package/dist/types/models/is-previewable-type.d.ts +2 -0
- package/dist/types/models/is-processed-file-state.d.ts +2 -0
- package/dist/types/models/is-processing-file-state.d.ts +2 -0
- package/dist/types/models/is-uploading-file-state.d.ts +2 -0
- package/dist/types/models/map-media-file-to-file-state.d.ts +4 -0
- package/dist/types/models/map-media-item-to-file-state.d.ts +3 -0
- package/dist/types/models/media.d.ts +8 -2
- package/dist/types/uploader/{error.d.ts → UploaderError.d.ts} +12 -13
- package/dist/types/uploader/index.d.ts +1 -1
- package/dist/types/uploader/isUploaderError.d.ts +2 -0
- package/dist/types/utils/addFileAttrsToUrl.d.ts +2 -0
- package/dist/types/utils/createBatchLoadingFunc.d.ts +11 -0
- package/dist/types/utils/createCopyIntentRegisterationBatcher.d.ts +1 -1
- package/dist/types/utils/createFileDataLoader.d.ts +0 -14
- package/dist/types/utils/createFileDataloader-2.d.ts +4 -0
- package/dist/types/utils/getAttrsFromUrl.d.ts +2 -0
- package/dist/types/utils/getItemsFromKeys.d.ts +3 -0
- package/dist/types/utils/imageResizeModeToFileImageMode.d.ts +1 -1
- package/dist/types/utils/isCDNEnabled.d.ts +1 -0
- package/dist/types/utils/isMediaBlobUrl.d.ts +1 -0
- package/dist/types/utils/isPathBasedEnabled.d.ts +1 -0
- package/dist/types/utils/mapRetryUrlToPathBasedUrl.d.ts +1 -0
- package/dist/types/utils/mapToMediaCdnUrl.d.ts +1 -0
- package/dist/types/utils/mapToPathBasedUrl.d.ts +1 -0
- package/dist/types/utils/mediaCdn.d.ts +1 -2
- package/dist/types/utils/mediaSubscribable/createMediaSubscribable.d.ts +3 -0
- package/dist/types/utils/mediaSubscribable/fromObservable.d.ts +4 -1
- package/dist/types/utils/mobileUpload/{error.d.ts → MobileUploadError.d.ts} +15 -16
- package/dist/types/utils/mobileUpload/createMobileDownloadFileStream.d.ts +5 -0
- package/dist/types/utils/mobileUpload/{helpers.d.ts → createMobileFileStateSubject.d.ts} +0 -3
- package/dist/types/utils/mobileUpload/isMobileUploadError.d.ts +2 -0
- package/dist/types/utils/mobileUpload/stateMachine/createMobileUploadService.d.ts +3 -0
- package/dist/types/utils/mobileUpload/stateMachine/{index.d.ts → createMobileUploadStateMachine.d.ts} +2 -3
- package/dist/types/utils/objectToQueryString.d.ts +3 -0
- package/dist/types/utils/pathBasedUrl.d.ts +1 -3
- package/dist/types/utils/polling/PollingError.d.ts +10 -0
- package/dist/types/utils/polling/errors.d.ts +8 -11
- package/dist/types/utils/polling/index.d.ts +8 -1
- package/dist/types/utils/polling/isPollingError.d.ts +2 -0
- package/dist/types/utils/{setTimeoutPromise.d.ts → rejectTimeout.d.ts} +0 -1
- package/dist/types/utils/request/RequestError.d.ts +21 -0
- package/dist/types/utils/request/cloneRequestError.d.ts +3 -0
- package/dist/types/utils/request/createMapResponseToBlob.d.ts +2 -0
- package/dist/types/utils/request/createMapResponseToJson.d.ts +2 -0
- package/dist/types/utils/request/createProcessFetchResponse.d.ts +2 -0
- package/dist/types/utils/request/createRequestErrorFromResponse.d.ts +3 -0
- package/dist/types/utils/request/createRequestErrorReason.d.ts +2 -0
- package/dist/types/utils/request/createUrl.d.ts +2 -0
- package/dist/types/utils/request/defaultShouldRetryError.d.ts +1 -0
- package/dist/types/utils/request/errors.d.ts +8 -22
- package/dist/types/utils/request/extendHeaders.d.ts +4 -0
- package/dist/types/utils/request/extendTraceContext.d.ts +2 -0
- package/dist/types/utils/request/extractMediaHeaders.d.ts +4 -0
- package/dist/types/utils/request/fetchRetry.d.ts +2 -0
- package/dist/types/utils/request/getStatusCode.d.ts +1 -0
- package/dist/types/utils/request/helpers.d.ts +73 -24
- package/dist/types/utils/request/index.d.ts +16 -2
- package/dist/types/utils/request/isAbortedRequestError.d.ts +1 -0
- package/dist/types/utils/request/isFetchNetworkError.d.ts +1 -0
- package/dist/types/utils/request/isRateLimitedError.d.ts +1 -0
- package/dist/types/utils/request/isRequestError.d.ts +2 -0
- package/dist/types/utils/request/mapAuthToRequestHeaders.d.ts +3 -0
- package/dist/types/utils/request/waitPromise.d.ts +1 -0
- package/dist/types/utils/resolveTimeout.d.ts +1 -0
- package/dist/types/utils/url.d.ts +17 -6
- package/example-helpers/CardsWrapper.tsx +15 -0
- package/example-helpers/FileInput.tsx +20 -0
- package/example-helpers/FileStateWrapper.tsx +15 -0
- package/example-helpers/FileWrapper.tsx +22 -0
- package/example-helpers/Header.tsx +15 -0
- package/example-helpers/ImagePreview.tsx +18 -0
- package/example-helpers/MetadataWrapper.tsx +15 -0
- package/example-helpers/PreviewWrapper.tsx +15 -0
- package/example-helpers/Response.tsx +15 -0
- package/example-helpers/Row.tsx +15 -0
- package/example-helpers/UploadTouchWrapper.tsx +15 -0
- package/example-helpers/Wrapper.tsx +15 -0
- package/package.json +2 -2
- package/dist/cjs/client/media-store/index.js +0 -37
- package/dist/cjs/utils/mediaSubscribable/index.js +0 -25
- package/dist/cjs/utils/mobileUpload/index.js +0 -45
- package/dist/es2019/client/media-store/index.js +0 -2
- package/dist/es2019/utils/mediaSubscribable/index.js +0 -2
- package/dist/es2019/utils/mobileUpload/index.js +0 -4
- package/dist/es2019/utils/setTimeoutPromise.js +0 -6
- package/dist/esm/client/media-store/index.js +0 -2
- package/dist/esm/utils/mediaSubscribable/index.js +0 -2
- package/dist/esm/utils/mobileUpload/index.js +0 -4
- package/dist/types/client/media-store/index.d.ts +0 -4
- package/dist/types/utils/mediaSubscribable/index.d.ts +0 -3
- package/dist/types/utils/mobileUpload/index.d.ts +0 -5
- package/example-helpers/stylesWrapper.tsx +0 -98
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
4
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
5
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
|
+
import { getRandomTelemetryId } from '@atlaskit/media-common';
|
|
8
|
+
import { getItemsFromKeys } from './getItemsFromKeys';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Returns a function that, given Array<DataloaderKey>, resolves to an array of same length containing either DataloaderResult or Error.
|
|
12
|
+
* Such contract is formalised by Dataloader 1.0, @see https://github.com/graphql/dataloader
|
|
13
|
+
*
|
|
14
|
+
* If an Error is resolved in the results, it must be at same position then their corresponding key:
|
|
15
|
+
* - Dataloader will re-throw that Error when accessing/loading that particular key
|
|
16
|
+
*
|
|
17
|
+
* @param mediaStore instance of MediaStore
|
|
18
|
+
*/
|
|
19
|
+
export function createBatchLoadingFunc(mediaStore) {
|
|
20
|
+
return /*#__PURE__*/function () {
|
|
21
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(keys) {
|
|
22
|
+
var nonCollectionName, includeHashByCollection, fileIdsByCollection, items;
|
|
23
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
24
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
25
|
+
case 0:
|
|
26
|
+
nonCollectionName = '__media-single-file-collection__';
|
|
27
|
+
includeHashByCollection = keys.reduce(function (acc, key) {
|
|
28
|
+
var collectionName = key.collectionName || nonCollectionName;
|
|
29
|
+
if (key.includeHashForDuplicateFiles) {
|
|
30
|
+
acc[collectionName] = key.includeHashForDuplicateFiles;
|
|
31
|
+
}
|
|
32
|
+
return acc;
|
|
33
|
+
}, {});
|
|
34
|
+
fileIdsByCollection = keys.reduce(function (acc, key) {
|
|
35
|
+
var collectionName = key.collectionName || nonCollectionName;
|
|
36
|
+
var fileIds = acc[collectionName] || [];
|
|
37
|
+
|
|
38
|
+
// de-duplicate ids in collection
|
|
39
|
+
if (fileIds.indexOf(key.id) === -1) {
|
|
40
|
+
fileIds.push(key.id);
|
|
41
|
+
}
|
|
42
|
+
acc[collectionName] = fileIds;
|
|
43
|
+
return acc;
|
|
44
|
+
}, {});
|
|
45
|
+
items = [];
|
|
46
|
+
_context2.next = 1;
|
|
47
|
+
return Promise.all(Object.keys(fileIdsByCollection).map( /*#__PURE__*/function () {
|
|
48
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(collectionNameKey) {
|
|
49
|
+
var metadataTraceContext, fileIds, includeHashForDuplicateFiles, collectionName, response, itemsWithMetadataTraceContext, itemsIds, fileIdsNotFound, _t;
|
|
50
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
51
|
+
while (1) switch (_context.prev = _context.next) {
|
|
52
|
+
case 0:
|
|
53
|
+
metadataTraceContext = {
|
|
54
|
+
traceId: getRandomTelemetryId(),
|
|
55
|
+
spanId: getRandomTelemetryId()
|
|
56
|
+
};
|
|
57
|
+
fileIds = fileIdsByCollection[collectionNameKey];
|
|
58
|
+
includeHashForDuplicateFiles = includeHashByCollection[collectionNameKey];
|
|
59
|
+
collectionName = collectionNameKey === nonCollectionName ? undefined : collectionNameKey;
|
|
60
|
+
_context.prev = 1;
|
|
61
|
+
_context.next = 2;
|
|
62
|
+
return mediaStore.getItems(fileIds, collectionName, metadataTraceContext, includeHashForDuplicateFiles);
|
|
63
|
+
case 2:
|
|
64
|
+
response = _context.sent;
|
|
65
|
+
itemsWithMetadataTraceContext = response.data.items.map(function (item) {
|
|
66
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
67
|
+
metadataTraceContext: metadataTraceContext
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
items.push.apply(items, _toConsumableArray(itemsWithMetadataTraceContext));
|
|
71
|
+
|
|
72
|
+
// add EmptyResponseFileItem for each file ID not included in /items response
|
|
73
|
+
itemsIds = itemsWithMetadataTraceContext.map(function (item) {
|
|
74
|
+
return item.id;
|
|
75
|
+
});
|
|
76
|
+
fileIdsNotFound = fileIds.filter(function (id) {
|
|
77
|
+
return !itemsIds.includes(id);
|
|
78
|
+
});
|
|
79
|
+
fileIdsNotFound.forEach(function (fileId) {
|
|
80
|
+
items.push({
|
|
81
|
+
id: fileId,
|
|
82
|
+
collection: collectionName,
|
|
83
|
+
type: 'not-found',
|
|
84
|
+
metadataTraceContext: metadataTraceContext
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
_context.next = 4;
|
|
88
|
+
break;
|
|
89
|
+
case 3:
|
|
90
|
+
_context.prev = 3;
|
|
91
|
+
_t = _context["catch"](1);
|
|
92
|
+
fileIds.forEach(function (fileId) {
|
|
93
|
+
items.push({
|
|
94
|
+
id: fileId,
|
|
95
|
+
collection: collectionName,
|
|
96
|
+
error: _t
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
case 4:
|
|
100
|
+
case "end":
|
|
101
|
+
return _context.stop();
|
|
102
|
+
}
|
|
103
|
+
}, _callee, null, [[1, 3]]);
|
|
104
|
+
}));
|
|
105
|
+
return function (_x2) {
|
|
106
|
+
return _ref2.apply(this, arguments);
|
|
107
|
+
};
|
|
108
|
+
}()));
|
|
109
|
+
case 1:
|
|
110
|
+
return _context2.abrupt("return", getItemsFromKeys(keys, items));
|
|
111
|
+
case 2:
|
|
112
|
+
case "end":
|
|
113
|
+
return _context2.stop();
|
|
114
|
+
}
|
|
115
|
+
}, _callee2);
|
|
116
|
+
}));
|
|
117
|
+
return function (_x) {
|
|
118
|
+
return _ref.apply(this, arguments);
|
|
119
|
+
};
|
|
120
|
+
}();
|
|
121
|
+
}
|
|
@@ -1,166 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
5
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
|
-
import Dataloader from 'dataloader';
|
|
8
|
-
import { getRandomTelemetryId } from '@atlaskit/media-common';
|
|
9
|
-
export var MAX_BATCH_SIZE = 100;
|
|
10
|
-
var isBatchLoadingErrorResult = function isBatchLoadingErrorResult(result) {
|
|
11
|
-
return result.error instanceof Error;
|
|
12
|
-
};
|
|
13
|
-
var isResponseFileItem = function isResponseFileItem(fileItem) {
|
|
14
|
-
return 'details' in fileItem;
|
|
15
|
-
};
|
|
16
|
-
var makeCacheKey = function makeCacheKey(id, collection) {
|
|
17
|
-
return collection ? "".concat(id, "-").concat(collection) : id;
|
|
18
|
-
};
|
|
19
|
-
export var getItemsFromKeys = function getItemsFromKeys(dataloaderKeys, fileItems) {
|
|
20
|
-
var itemsByKey = fileItems.reduce(function (prev, fileItem) {
|
|
21
|
-
var id = fileItem.id,
|
|
22
|
-
collection = fileItem.collection;
|
|
23
|
-
var key = makeCacheKey(id, collection);
|
|
24
|
-
if (isBatchLoadingErrorResult(fileItem)) {
|
|
25
|
-
prev[key] = fileItem.error;
|
|
26
|
-
} else if (isResponseFileItem(fileItem)) {
|
|
27
|
-
prev[key] = _objectSpread(_objectSpread({}, fileItem.details), {}, {
|
|
28
|
-
metadataTraceContext: fileItem.metadataTraceContext
|
|
29
|
-
});
|
|
30
|
-
} else {
|
|
31
|
-
prev[key] = {
|
|
32
|
-
id: id,
|
|
33
|
-
collection: collection,
|
|
34
|
-
type: 'not-found',
|
|
35
|
-
metadataTraceContext: fileItem.metadataTraceContext
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
return prev;
|
|
39
|
-
}, {});
|
|
40
|
-
return dataloaderKeys.map(function (dataloaderKey) {
|
|
41
|
-
var id = dataloaderKey.id,
|
|
42
|
-
collectionName = dataloaderKey.collectionName;
|
|
43
|
-
var key = makeCacheKey(id, collectionName);
|
|
44
|
-
return itemsByKey[key] || {
|
|
45
|
-
id: id,
|
|
46
|
-
type: 'not-found'
|
|
47
|
-
};
|
|
48
|
-
});
|
|
49
|
-
};
|
|
50
|
-
/**
|
|
51
|
-
* Returns a function that, given Array<DataloaderKey>, resolves to an array of same length containing either DataloaderResult or Error.
|
|
52
|
-
* Such contract is formalised by Dataloader 1.0, @see https://github.com/graphql/dataloader
|
|
53
|
-
*
|
|
54
|
-
* If an Error is resolved in the results, it must be at same position then their corresponding key:
|
|
55
|
-
* - Dataloader will re-throw that Error when accessing/loading that particular key
|
|
56
|
-
*
|
|
57
|
-
* @param mediaStore instance of MediaStore
|
|
58
|
-
*/
|
|
59
|
-
export function createBatchLoadingFunc(mediaStore) {
|
|
60
|
-
return /*#__PURE__*/function () {
|
|
61
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(keys) {
|
|
62
|
-
var nonCollectionName, includeHashByCollection, fileIdsByCollection, items;
|
|
63
|
-
return _regeneratorRuntime.wrap(function (_context2) {
|
|
64
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
65
|
-
case 0:
|
|
66
|
-
nonCollectionName = '__media-single-file-collection__';
|
|
67
|
-
includeHashByCollection = keys.reduce(function (acc, key) {
|
|
68
|
-
var collectionName = key.collectionName || nonCollectionName;
|
|
69
|
-
if (key.includeHashForDuplicateFiles) {
|
|
70
|
-
acc[collectionName] = key.includeHashForDuplicateFiles;
|
|
71
|
-
}
|
|
72
|
-
return acc;
|
|
73
|
-
}, {});
|
|
74
|
-
fileIdsByCollection = keys.reduce(function (acc, key) {
|
|
75
|
-
var collectionName = key.collectionName || nonCollectionName;
|
|
76
|
-
var fileIds = acc[collectionName] || [];
|
|
77
|
-
|
|
78
|
-
// de-duplicate ids in collection
|
|
79
|
-
if (fileIds.indexOf(key.id) === -1) {
|
|
80
|
-
fileIds.push(key.id);
|
|
81
|
-
}
|
|
82
|
-
acc[collectionName] = fileIds;
|
|
83
|
-
return acc;
|
|
84
|
-
}, {});
|
|
85
|
-
items = [];
|
|
86
|
-
_context2.next = 1;
|
|
87
|
-
return Promise.all(Object.keys(fileIdsByCollection).map( /*#__PURE__*/function () {
|
|
88
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(collectionNameKey) {
|
|
89
|
-
var metadataTraceContext, fileIds, includeHashForDuplicateFiles, collectionName, response, itemsWithMetadataTraceContext, itemsIds, fileIdsNotFound, _t;
|
|
90
|
-
return _regeneratorRuntime.wrap(function (_context) {
|
|
91
|
-
while (1) switch (_context.prev = _context.next) {
|
|
92
|
-
case 0:
|
|
93
|
-
metadataTraceContext = {
|
|
94
|
-
traceId: getRandomTelemetryId(),
|
|
95
|
-
spanId: getRandomTelemetryId()
|
|
96
|
-
};
|
|
97
|
-
fileIds = fileIdsByCollection[collectionNameKey];
|
|
98
|
-
includeHashForDuplicateFiles = includeHashByCollection[collectionNameKey];
|
|
99
|
-
collectionName = collectionNameKey === nonCollectionName ? undefined : collectionNameKey;
|
|
100
|
-
_context.prev = 1;
|
|
101
|
-
_context.next = 2;
|
|
102
|
-
return mediaStore.getItems(fileIds, collectionName, metadataTraceContext, includeHashForDuplicateFiles);
|
|
103
|
-
case 2:
|
|
104
|
-
response = _context.sent;
|
|
105
|
-
itemsWithMetadataTraceContext = response.data.items.map(function (item) {
|
|
106
|
-
return _objectSpread(_objectSpread({}, item), {}, {
|
|
107
|
-
metadataTraceContext: metadataTraceContext
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
items.push.apply(items, _toConsumableArray(itemsWithMetadataTraceContext));
|
|
111
|
-
|
|
112
|
-
// add EmptyResponseFileItem for each file ID not included in /items response
|
|
113
|
-
itemsIds = itemsWithMetadataTraceContext.map(function (item) {
|
|
114
|
-
return item.id;
|
|
115
|
-
});
|
|
116
|
-
fileIdsNotFound = fileIds.filter(function (id) {
|
|
117
|
-
return !itemsIds.includes(id);
|
|
118
|
-
});
|
|
119
|
-
fileIdsNotFound.forEach(function (fileId) {
|
|
120
|
-
items.push({
|
|
121
|
-
id: fileId,
|
|
122
|
-
collection: collectionName,
|
|
123
|
-
type: 'not-found',
|
|
124
|
-
metadataTraceContext: metadataTraceContext
|
|
125
|
-
});
|
|
126
|
-
});
|
|
127
|
-
_context.next = 4;
|
|
128
|
-
break;
|
|
129
|
-
case 3:
|
|
130
|
-
_context.prev = 3;
|
|
131
|
-
_t = _context["catch"](1);
|
|
132
|
-
fileIds.forEach(function (fileId) {
|
|
133
|
-
items.push({
|
|
134
|
-
id: fileId,
|
|
135
|
-
collection: collectionName,
|
|
136
|
-
error: _t
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
case 4:
|
|
140
|
-
case "end":
|
|
141
|
-
return _context.stop();
|
|
142
|
-
}
|
|
143
|
-
}, _callee, null, [[1, 3]]);
|
|
144
|
-
}));
|
|
145
|
-
return function (_x2) {
|
|
146
|
-
return _ref2.apply(this, arguments);
|
|
147
|
-
};
|
|
148
|
-
}()));
|
|
149
|
-
case 1:
|
|
150
|
-
return _context2.abrupt("return", getItemsFromKeys(keys, items));
|
|
151
|
-
case 2:
|
|
152
|
-
case "end":
|
|
153
|
-
return _context2.stop();
|
|
154
|
-
}
|
|
155
|
-
}, _callee2);
|
|
156
|
-
}));
|
|
157
|
-
return function (_x) {
|
|
158
|
-
return _ref.apply(this, arguments);
|
|
159
|
-
};
|
|
160
|
-
}();
|
|
161
|
-
}
|
|
162
|
-
export function createFileDataloader(mediaStore) {
|
|
163
|
-
return new Dataloader(createBatchLoadingFunc(mediaStore), {
|
|
164
|
-
maxBatchSize: MAX_BATCH_SIZE
|
|
165
|
-
});
|
|
166
|
-
}
|
|
1
|
+
export var MAX_BATCH_SIZE = 100;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import Dataloader from 'dataloader';
|
|
2
|
+
import { createBatchLoadingFunc } from './createBatchLoadingFunc';
|
|
3
|
+
import { MAX_BATCH_SIZE } from './createFileDataLoader';
|
|
4
|
+
export function createFileDataloader(mediaStore) {
|
|
5
|
+
return new Dataloader(createBatchLoadingFunc(mediaStore), {
|
|
6
|
+
maxBatchSize: MAX_BATCH_SIZE
|
|
7
|
+
});
|
|
8
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
var getNumberFromParams = function getNumberFromParams(params, name) {
|
|
2
|
+
var value = params.get(name);
|
|
3
|
+
return typeof value === 'string' && !isNaN(parseInt(value)) ? parseInt(value) : undefined;
|
|
4
|
+
};
|
|
5
|
+
var getStringFromParams = function getStringFromParams(params, name) {
|
|
6
|
+
var value = params.get(name);
|
|
7
|
+
if (!value) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
return decodeURIComponent(value);
|
|
11
|
+
};
|
|
12
|
+
export var getAttrsFromUrl = function getAttrsFromUrl(blobUrl) {
|
|
13
|
+
var url = new URL(blobUrl);
|
|
14
|
+
var hash = url.hash.replace('#', '');
|
|
15
|
+
var params = new URLSearchParams(hash);
|
|
16
|
+
var id = params.get('id');
|
|
17
|
+
var contextId = params.get('contextId');
|
|
18
|
+
var clientId = params.get('clientId');
|
|
19
|
+
// check if we have the required params (clientId is optional for backwards compatibility)
|
|
20
|
+
if (!id || !contextId) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
id: id,
|
|
25
|
+
contextId: contextId,
|
|
26
|
+
clientId: clientId || undefined,
|
|
27
|
+
collection: getStringFromParams(params, 'collection'),
|
|
28
|
+
alt: getStringFromParams(params, 'alt'),
|
|
29
|
+
height: getNumberFromParams(params, 'height'),
|
|
30
|
+
width: getNumberFromParams(params, 'width'),
|
|
31
|
+
size: getNumberFromParams(params, 'size'),
|
|
32
|
+
name: getStringFromParams(params, 'name'),
|
|
33
|
+
mimeType: getStringFromParams(params, 'mimeType')
|
|
34
|
+
};
|
|
35
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
var isBatchLoadingErrorResult = function isBatchLoadingErrorResult(result) {
|
|
5
|
+
return result.error instanceof Error;
|
|
6
|
+
};
|
|
7
|
+
var isResponseFileItem = function isResponseFileItem(fileItem) {
|
|
8
|
+
return 'details' in fileItem;
|
|
9
|
+
};
|
|
10
|
+
var makeCacheKey = function makeCacheKey(id, collection) {
|
|
11
|
+
return collection ? "".concat(id, "-").concat(collection) : id;
|
|
12
|
+
};
|
|
13
|
+
export var getItemsFromKeys = function getItemsFromKeys(dataloaderKeys, fileItems) {
|
|
14
|
+
var itemsByKey = fileItems.reduce(function (prev, fileItem) {
|
|
15
|
+
var id = fileItem.id,
|
|
16
|
+
collection = fileItem.collection;
|
|
17
|
+
var key = makeCacheKey(id, collection);
|
|
18
|
+
if (isBatchLoadingErrorResult(fileItem)) {
|
|
19
|
+
prev[key] = fileItem.error;
|
|
20
|
+
} else if (isResponseFileItem(fileItem)) {
|
|
21
|
+
prev[key] = _objectSpread(_objectSpread({}, fileItem.details), {}, {
|
|
22
|
+
metadataTraceContext: fileItem.metadataTraceContext
|
|
23
|
+
});
|
|
24
|
+
} else {
|
|
25
|
+
prev[key] = {
|
|
26
|
+
id: id,
|
|
27
|
+
collection: collection,
|
|
28
|
+
type: 'not-found',
|
|
29
|
+
metadataTraceContext: fileItem.metadataTraceContext
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
return prev;
|
|
33
|
+
}, {});
|
|
34
|
+
return dataloaderKeys.map(function (dataloaderKey) {
|
|
35
|
+
var id = dataloaderKey.id,
|
|
36
|
+
collectionName = dataloaderKey.collectionName;
|
|
37
|
+
var key = makeCacheKey(id, collectionName);
|
|
38
|
+
return itemsByKey[key] || {
|
|
39
|
+
id: id,
|
|
40
|
+
type: 'not-found'
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { isGoogleCloudPlatform } from '@atlaskit/atlassian-context/cloud-provider';
|
|
2
|
+
import { isIsolatedCloud } from '@atlaskit/atlassian-context/is-isolated-cloud';
|
|
3
|
+
import { isGCPtenant as isGCPtenantInStaging } from '@atlaskit/media-common/mediaEnvUtils';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
|
+
import { isCommercial } from './isCommercial';
|
|
6
|
+
import { isPathBasedEnabled } from './isPathBasedEnabled';
|
|
7
|
+
export function isCDNEnabled() {
|
|
8
|
+
return isCommercial() && !isIsolatedCloud() && !(isGoogleCloudPlatform() || isGCPtenantInStaging()) && fg('platform_media_cdn_delivery') && !isPathBasedEnabled();
|
|
9
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
|
+
import getDocument from './getDocument';
|
|
3
|
+
export function isPathBasedEnabled() {
|
|
4
|
+
var _getDocument;
|
|
5
|
+
var isLocalhost = ((_getDocument = getDocument()) === null || _getDocument === void 0 || (_getDocument = _getDocument.location) === null || _getDocument === void 0 ? void 0 : _getDocument.hostname) === 'localhost';
|
|
6
|
+
return fg('platform_media_path_based_route') && !isLocalhost;
|
|
7
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import getDocument from './getDocument';
|
|
2
|
+
import { mediaApiPathPrefix } from './pathBasedUrl';
|
|
3
|
+
export function mapRetryUrlToPathBasedUrl(url) {
|
|
4
|
+
var _getDocument$location, _getDocument;
|
|
5
|
+
var parsedUrl = new URL(url);
|
|
6
|
+
parsedUrl.host = (_getDocument$location = (_getDocument = getDocument()) === null || _getDocument === void 0 ? void 0 : _getDocument.location.host) !== null && _getDocument$location !== void 0 ? _getDocument$location : '';
|
|
7
|
+
|
|
8
|
+
// remove CDN from the URL for retry if it exists
|
|
9
|
+
var pathname = parsedUrl.pathname;
|
|
10
|
+
if (pathname.endsWith('/cdn')) {
|
|
11
|
+
parsedUrl.pathname = pathname.replace('/cdn', '');
|
|
12
|
+
}
|
|
13
|
+
if (!parsedUrl.pathname.startsWith(mediaApiPathPrefix)) {
|
|
14
|
+
parsedUrl.pathname = "".concat(mediaApiPathPrefix).concat(parsedUrl.pathname);
|
|
15
|
+
}
|
|
16
|
+
return parsedUrl;
|
|
17
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { isGoogleCloudPlatform } from '@atlaskit/atlassian-context/cloud-provider';
|
|
2
|
+
import { isGCPtenant as isGCPtenantInStaging } from '@atlaskit/media-common/mediaEnvUtils';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
|
+
import { isCDNEnabled } from './isCDNEnabled';
|
|
5
|
+
import { MEDIA_CDN_MAP, MEDIA_TOKEN_LENGTH_LIMIT } from './mediaCdn';
|
|
6
|
+
export function mapToMediaCdnUrl(url, token) {
|
|
7
|
+
var _token$length;
|
|
8
|
+
var tokenLength = (_token$length = token === null || token === void 0 ? void 0 : token.length) !== null && _token$length !== void 0 ? _token$length : 0;
|
|
9
|
+
if (!isCDNEnabled() || tokenLength > MEDIA_TOKEN_LENGTH_LIMIT) {
|
|
10
|
+
return url;
|
|
11
|
+
}
|
|
12
|
+
var isGcpTenant = isGoogleCloudPlatform() || isGCPtenantInStaging();
|
|
13
|
+
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
14
|
+
if (!isGcpTenant && fg('platform_media_cdn_delivery') && fg('platform_media_cdn_single_host')) {
|
|
15
|
+
try {
|
|
16
|
+
var parsedUrl = new URL(url);
|
|
17
|
+
var cdnHost = MEDIA_CDN_MAP[parsedUrl.host];
|
|
18
|
+
|
|
19
|
+
// If no mapping is found, return the original URL
|
|
20
|
+
if (!cdnHost) {
|
|
21
|
+
return url;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Replace the host with the CDN host in the original URL
|
|
25
|
+
parsedUrl.host = cdnHost;
|
|
26
|
+
return parsedUrl.toString();
|
|
27
|
+
} catch (error) {
|
|
28
|
+
return url;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return url;
|
|
32
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import getDocument from './getDocument';
|
|
2
|
+
import { isPathBasedEnabled } from './isPathBasedEnabled';
|
|
3
|
+
import { mediaApiPathPrefix } from './pathBasedUrl';
|
|
4
|
+
function getRelativeUrl(absoluteUrl) {
|
|
5
|
+
var url = new URL(absoluteUrl);
|
|
6
|
+
return "".concat(url.pathname).concat(url.search).concat(url.hash);
|
|
7
|
+
}
|
|
8
|
+
export function mapToPathBasedUrl(url) {
|
|
9
|
+
if (isPathBasedEnabled()) {
|
|
10
|
+
var _getDocument;
|
|
11
|
+
var parsedUrl = new URL(url);
|
|
12
|
+
if (!parsedUrl.pathname.startsWith(mediaApiPathPrefix)) {
|
|
13
|
+
parsedUrl.pathname = "".concat(mediaApiPathPrefix).concat(parsedUrl.pathname);
|
|
14
|
+
}
|
|
15
|
+
var location = (_getDocument = getDocument()) === null || _getDocument === void 0 ? void 0 : _getDocument.location;
|
|
16
|
+
|
|
17
|
+
// in this case we are most likely in SSR / a non browser environment so just return a relative URL
|
|
18
|
+
if (!location) {
|
|
19
|
+
return getRelativeUrl(parsedUrl.toString());
|
|
20
|
+
}
|
|
21
|
+
parsedUrl.host = location.host;
|
|
22
|
+
return parsedUrl.toString();
|
|
23
|
+
}
|
|
24
|
+
return url;
|
|
25
|
+
}
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
|
-
import { isCommercial } from './isCommercial';
|
|
3
|
-
import { isIsolatedCloud } from '@atlaskit/atlassian-context/is-isolated-cloud';
|
|
4
|
-
import { isGoogleCloudPlatform } from '@atlaskit/atlassian-context/cloud-provider';
|
|
5
|
-
import { isGCPtenant as isGCPtenantInStaging } from '@atlaskit/media-common/mediaEnvUtils';
|
|
6
|
-
import { isPathBasedEnabled } from './pathBasedUrl';
|
|
7
1
|
export var MEDIA_CDN_MAP = {
|
|
8
2
|
'api.media.atlassian.com': 'media-cdn.atlassian.com',
|
|
9
3
|
'media.staging.atl-paas.net': 'media-cdn.stg.atlassian.com'
|
|
@@ -12,34 +6,4 @@ export var MEDIA_CDN_MAP = {
|
|
|
12
6
|
// Cloudfront has a hard limit of 8,192 bytes
|
|
13
7
|
// https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-limits.html
|
|
14
8
|
// Assuming other parts of the URL make up a max of ~1000 (in reality it's lower), the token can be ~7000
|
|
15
|
-
var MEDIA_TOKEN_LENGTH_LIMIT = 7000;
|
|
16
|
-
export function isCDNEnabled() {
|
|
17
|
-
return isCommercial() && !isIsolatedCloud() && !(isGoogleCloudPlatform() || isGCPtenantInStaging()) && fg('platform_media_cdn_delivery') && !isPathBasedEnabled();
|
|
18
|
-
}
|
|
19
|
-
export function mapToMediaCdnUrl(url, token) {
|
|
20
|
-
var _token$length;
|
|
21
|
-
var tokenLength = (_token$length = token === null || token === void 0 ? void 0 : token.length) !== null && _token$length !== void 0 ? _token$length : 0;
|
|
22
|
-
if (!isCDNEnabled() || tokenLength > MEDIA_TOKEN_LENGTH_LIMIT) {
|
|
23
|
-
return url;
|
|
24
|
-
}
|
|
25
|
-
var isGcpTenant = isGoogleCloudPlatform() || isGCPtenantInStaging();
|
|
26
|
-
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
27
|
-
if (!isGcpTenant && fg('platform_media_cdn_delivery') && fg('platform_media_cdn_single_host')) {
|
|
28
|
-
try {
|
|
29
|
-
var parsedUrl = new URL(url);
|
|
30
|
-
var cdnHost = MEDIA_CDN_MAP[parsedUrl.host];
|
|
31
|
-
|
|
32
|
-
// If no mapping is found, return the original URL
|
|
33
|
-
if (!cdnHost) {
|
|
34
|
-
return url;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// Replace the host with the CDN host in the original URL
|
|
38
|
-
parsedUrl.host = cdnHost;
|
|
39
|
-
return parsedUrl.toString();
|
|
40
|
-
} catch (error) {
|
|
41
|
-
return url;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return url;
|
|
45
|
-
}
|
|
9
|
+
export var MEDIA_TOKEN_LENGTH_LIMIT = 7000;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/* eslint-disable @repo/internal/deprecations/deprecation-ticket-required -- VOLTC-139 tracks removal of these deprecated re-export shims. */
|
|
2
|
+
|
|
2
3
|
export function fromObservable(observable) {
|
|
3
4
|
return {
|
|
4
5
|
subscribe: function subscribe(observer) {
|
|
@@ -14,6 +15,8 @@ export function fromObservable(observable) {
|
|
|
14
15
|
}
|
|
15
16
|
};
|
|
16
17
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated Use `import { createMediaSubscribable } from '@atlaskit/media-client'` instead.
|
|
21
|
+
*/
|
|
22
|
+
export { createMediaSubscribable } from './createMediaSubscribable';
|
|
@@ -5,7 +5,7 @@ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
|
5
5
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
6
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
7
7
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
8
|
-
import { BaseMediaClientError } from '../../models/errors';
|
|
8
|
+
import { BaseMediaClientError } from '../../models/errors/BaseMediaClientError';
|
|
9
9
|
export var MobileUploadError = /*#__PURE__*/function (_BaseMediaClientError) {
|
|
10
10
|
// Legacy Attribute. Should be removed
|
|
11
11
|
|
|
@@ -40,7 +40,4 @@ export var MobileUploadError = /*#__PURE__*/function (_BaseMediaClientError) {
|
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
}]);
|
|
43
|
-
}(BaseMediaClientError);
|
|
44
|
-
export function isMobileUploadError(err) {
|
|
45
|
-
return err instanceof MobileUploadError;
|
|
46
|
-
}
|
|
43
|
+
}(BaseMediaClientError);
|
|
@@ -1,21 +1,11 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { map } from 'rxjs/operators/map';
|
|
6
|
-
import { mapMediaItemToFileState } from '../../models/file-state';
|
|
3
|
+
import { isNotFoundMediaItemDetails } from '../../models/is-not-found-media-item-details';
|
|
4
|
+
import { mapMediaItemToFileState } from '../../models/map-media-item-to-file-state';
|
|
7
5
|
import { createMediaSubject } from '../createMediaSubject';
|
|
8
6
|
import { isEmptyFile } from '../detectEmptyFile';
|
|
9
7
|
import { PollingFunction } from '../polling';
|
|
10
|
-
import { MobileUploadError } from './
|
|
11
|
-
import { isNotFoundMediaItemDetails } from '../../models/media';
|
|
12
|
-
export var createMobileFileStateSubject = function createMobileFileStateSubject(service) {
|
|
13
|
-
var subject = new ReplaySubject(1);
|
|
14
|
-
from(service.start()).pipe(map(function (state) {
|
|
15
|
-
return state.context.currentFileState;
|
|
16
|
-
})).subscribe(subject);
|
|
17
|
-
return subject;
|
|
18
|
-
};
|
|
8
|
+
import { MobileUploadError } from './MobileUploadError';
|
|
19
9
|
export var createMobileDownloadFileStream = function createMobileDownloadFileStream(dataloader, id, collectionName, occurrenceKey) {
|
|
20
10
|
var subject = createMediaSubject();
|
|
21
11
|
var poll = new PollingFunction();
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { from } from 'rxjs/observable/from';
|
|
2
|
+
import { map } from 'rxjs/operators/map';
|
|
3
|
+
import { ReplaySubject } from 'rxjs/ReplaySubject';
|
|
4
|
+
export var createMobileFileStateSubject = function createMobileFileStateSubject(service) {
|
|
5
|
+
var subject = new ReplaySubject(1);
|
|
6
|
+
from(service.start()).pipe(map(function (state) {
|
|
7
|
+
return state.context.currentFileState;
|
|
8
|
+
})).subscribe(subject);
|
|
9
|
+
return subject;
|
|
10
|
+
};
|
package/dist/esm/utils/mobileUpload/stateMachine/{index.js → createMobileUploadStateMachine.js}
RENAMED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
import { map } from 'rxjs/operators/map';
|
|
4
|
-
import { createMachine
|
|
5
|
-
import { isProcessingFileState } from '../../../models/file-state';
|
|
4
|
+
import { createMachine } from 'xstate';
|
|
5
|
+
import { isProcessingFileState } from '../../../models/is-processing-file-state';
|
|
6
6
|
import { shouldFetchRemoteFileStates as _shouldFetchRemoteFileStates } from '../../shouldFetchRemoteFileStates';
|
|
7
|
-
import { createMobileDownloadFileStream } from '../
|
|
8
|
-
import {
|
|
9
|
-
import { machineProcessingState } from './states/processing';
|
|
7
|
+
import { createMobileDownloadFileStream } from '../createMobileDownloadFileStream';
|
|
8
|
+
import { machineErrorState } from './states/error';
|
|
10
9
|
import { machineProcessedState } from './states/processed';
|
|
10
|
+
import { machineProcessingState } from './states/processing';
|
|
11
11
|
import { machineProcessingFailedState } from './states/processingFailed';
|
|
12
|
-
import {
|
|
12
|
+
import { machineUploadingState } from './states/uploading';
|
|
13
13
|
export var createMobileUploadStateMachine = function createMobileUploadStateMachine(dataloader, initialState, collectionName) {
|
|
14
14
|
return createMachine({
|
|
15
15
|
// Initial state
|
|
@@ -64,7 +64,4 @@ export var createMobileUploadStateMachine = function createMobileUploadStateMach
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
});
|
|
67
|
-
};
|
|
68
|
-
export function createMobileUploadService(machine) {
|
|
69
|
-
return interpret(machine);
|
|
70
|
-
}
|
|
67
|
+
};
|