@atlaskit/media-client 18.1.0 → 19.0.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.
Files changed (110) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/cjs/client/collection-fetcher.js +8 -8
  3. package/dist/cjs/client/file-fetcher/index.js +40 -36
  4. package/dist/cjs/client/media-client.js +2 -2
  5. package/dist/cjs/client/media-store/index.js +69 -52
  6. package/dist/cjs/uploader/index.js +22 -20
  7. package/dist/cjs/utils/request/helpers.js +39 -22
  8. package/dist/cjs/utils/request/index.js +3 -2
  9. package/dist/cjs/version.json +1 -1
  10. package/dist/es2019/client/collection-fetcher.js +6 -6
  11. package/dist/es2019/client/file-fetcher/index.js +16 -14
  12. package/dist/es2019/client/media-client.js +2 -2
  13. package/dist/es2019/client/media-store/index.js +50 -41
  14. package/dist/es2019/uploader/index.js +13 -13
  15. package/dist/es2019/utils/request/helpers.js +26 -8
  16. package/dist/es2019/utils/request/index.js +4 -3
  17. package/dist/es2019/version.json +1 -1
  18. package/dist/esm/client/collection-fetcher.js +8 -8
  19. package/dist/esm/client/file-fetcher/index.js +40 -36
  20. package/dist/esm/client/media-client.js +2 -2
  21. package/dist/esm/client/media-store/index.js +68 -50
  22. package/dist/esm/uploader/index.js +22 -20
  23. package/dist/esm/utils/request/helpers.js +36 -20
  24. package/dist/esm/utils/request/index.js +4 -3
  25. package/dist/esm/version.json +1 -1
  26. package/dist/types/client/collection-fetcher.d.ts +4 -3
  27. package/dist/types/client/file-fetcher/index.d.ts +9 -8
  28. package/dist/types/client/media-client.d.ts +2 -2
  29. package/dist/types/client/media-store/index.d.ts +15 -21
  30. package/dist/types/uploader/index.d.ts +2 -1
  31. package/dist/types/utils/request/helpers.d.ts +10 -2
  32. package/dist/types/utils/request/types.d.ts +2 -0
  33. package/package.json +4 -12
  34. package/report.api.md +101 -70
  35. package/dist/types-ts4.0/client/__mocks__/collection-fetcher.d.ts +0 -8
  36. package/dist/types-ts4.0/client/__mocks__/file-fetcher.d.ts +0 -10
  37. package/dist/types-ts4.0/client/__mocks__/media-client.d.ts +0 -13
  38. package/dist/types-ts4.0/client/collection-fetcher.d.ts +0 -35
  39. package/dist/types-ts4.0/client/events.d.ts +0 -14
  40. package/dist/types-ts4.0/client/file-fetcher/error.d.ts +0 -29
  41. package/dist/types-ts4.0/client/file-fetcher/index.d.ts +0 -56
  42. package/dist/types-ts4.0/client/media-client.d.ts +0 -28
  43. package/dist/types-ts4.0/client/media-store/error.d.ts +0 -16
  44. package/dist/types-ts4.0/client/media-store/index.d.ts +0 -174
  45. package/dist/types-ts4.0/client/media-store/resolveAuth.d.ts +0 -4
  46. package/dist/types-ts4.0/client/mobile-upload.d.ts +0 -11
  47. package/dist/types-ts4.0/client/stargate-client.d.ts +0 -15
  48. package/dist/types-ts4.0/constants.d.ts +0 -6
  49. package/dist/types-ts4.0/file-streams-cache.d.ts +0 -15
  50. package/dist/types-ts4.0/globalMediaEventEmitter.d.ts +0 -6
  51. package/dist/types-ts4.0/identifier.d.ts +0 -15
  52. package/dist/types-ts4.0/index.d.ts +0 -89
  53. package/dist/types-ts4.0/models/artifacts.d.ts +0 -12
  54. package/dist/types-ts4.0/models/auth-headers.d.ts +0 -11
  55. package/dist/types-ts4.0/models/auth-query-parameters.d.ts +0 -11
  56. package/dist/types-ts4.0/models/errors/helpers.d.ts +0 -6
  57. package/dist/types-ts4.0/models/errors/index.d.ts +0 -11
  58. package/dist/types-ts4.0/models/errors/types.d.ts +0 -15
  59. package/dist/types-ts4.0/models/file-state.d.ts +0 -91
  60. package/dist/types-ts4.0/models/item.d.ts +0 -25
  61. package/dist/types-ts4.0/models/media-subscribable.d.ts +0 -3
  62. package/dist/types-ts4.0/models/media.d.ts +0 -66
  63. package/dist/types-ts4.0/models/mobile-upload.d.ts +0 -28
  64. package/dist/types-ts4.0/upload-controller.d.ts +0 -7
  65. package/dist/types-ts4.0/uploader/calculateChunkSize.d.ts +0 -11
  66. package/dist/types-ts4.0/uploader/error.d.ts +0 -29
  67. package/dist/types-ts4.0/uploader/index.d.ts +0 -21
  68. package/dist/types-ts4.0/utils/checkWebpSupport.d.ts +0 -1
  69. package/dist/types-ts4.0/utils/convertBase64ToBlob.d.ts +0 -1
  70. package/dist/types-ts4.0/utils/createFileDataLoader.d.ts +0 -30
  71. package/dist/types-ts4.0/utils/createMediaSubject.d.ts +0 -3
  72. package/dist/types-ts4.0/utils/detectEmptyFile.d.ts +0 -16
  73. package/dist/types-ts4.0/utils/getDimensionsFromBlob.d.ts +0 -6
  74. package/dist/types-ts4.0/utils/getImageDimensionsFromBlob.d.ts +0 -5
  75. package/dist/types-ts4.0/utils/getMediaTypeFromUploadableFile.d.ts +0 -3
  76. package/dist/types-ts4.0/utils/getVideoDimensionsFromBlob.d.ts +0 -5
  77. package/dist/types-ts4.0/utils/hashing/hasher.d.ts +0 -3
  78. package/dist/types-ts4.0/utils/hashing/hasherCreator.d.ts +0 -3
  79. package/dist/types-ts4.0/utils/hashing/simpleHasher.d.ts +0 -4
  80. package/dist/types-ts4.0/utils/hashing/workerHasher.d.ts +0 -16
  81. package/dist/types-ts4.0/utils/imageResizeModeToFileImageMode.d.ts +0 -3
  82. package/dist/types-ts4.0/utils/isImageRemote.d.ts +0 -1
  83. package/dist/types-ts4.0/utils/mediaSubscribable/fromObservable.d.ts +0 -5
  84. package/dist/types-ts4.0/utils/mediaSubscribable/index.d.ts +0 -3
  85. package/dist/types-ts4.0/utils/mediaSubscribable/toPromise.d.ts +0 -10
  86. package/dist/types-ts4.0/utils/mediaSubscribable/types.d.ts +0 -16
  87. package/dist/types-ts4.0/utils/mobileUpload/error.d.ts +0 -29
  88. package/dist/types-ts4.0/utils/mobileUpload/helpers.d.ts +0 -8
  89. package/dist/types-ts4.0/utils/mobileUpload/index.d.ts +0 -5
  90. package/dist/types-ts4.0/utils/mobileUpload/servicesCache.d.ts +0 -4
  91. package/dist/types-ts4.0/utils/mobileUpload/stateMachine/index.d.ts +0 -7
  92. package/dist/types-ts4.0/utils/mobileUpload/stateMachine/states/error.d.ts +0 -3
  93. package/dist/types-ts4.0/utils/mobileUpload/stateMachine/states/processed.d.ts +0 -3
  94. package/dist/types-ts4.0/utils/mobileUpload/stateMachine/states/processing.d.ts +0 -3
  95. package/dist/types-ts4.0/utils/mobileUpload/stateMachine/states/processingFailed.d.ts +0 -3
  96. package/dist/types-ts4.0/utils/mobileUpload/stateMachine/states/uploading.d.ts +0 -3
  97. package/dist/types-ts4.0/utils/mobileUpload/stateMachine/types.d.ts +0 -69
  98. package/dist/types-ts4.0/utils/overrideMediaTypeIfUnknown.d.ts +0 -5
  99. package/dist/types-ts4.0/utils/polling/errors.d.ts +0 -12
  100. package/dist/types-ts4.0/utils/polling/index.d.ts +0 -33
  101. package/dist/types-ts4.0/utils/polling/types.d.ts +0 -7
  102. package/dist/types-ts4.0/utils/request/errors.d.ts +0 -20
  103. package/dist/types-ts4.0/utils/request/helpers.d.ts +0 -38
  104. package/dist/types-ts4.0/utils/request/index.d.ts +0 -5
  105. package/dist/types-ts4.0/utils/request/types.d.ts +0 -43
  106. package/dist/types-ts4.0/utils/safeUnsubscribe.d.ts +0 -2
  107. package/dist/types-ts4.0/utils/setTimeoutPromise.d.ts +0 -2
  108. package/dist/types-ts4.0/utils/shouldFetchRemoteFileStates.d.ts +0 -16
  109. package/dist/types-ts4.0/utils/url.d.ts +0 -17
  110. package/dist/types-ts4.0/utils/with-media-client-hoc.d.ts +0 -16
@@ -1,43 +0,0 @@
1
- import { Auth } from '@atlaskit/media-core';
2
- export declare type RequestMethod = 'GET' | 'POST' | 'PUT' | 'DELETE';
3
- export declare type RequestParams = {
4
- [key: string]: any;
5
- };
6
- export declare type RequestHeaders = {
7
- [key: string]: string;
8
- };
9
- export declare type RetryOptions = {
10
- readonly startTimeoutInMs: number;
11
- readonly maxAttempts: number;
12
- readonly factor: number;
13
- };
14
- export declare type ClientOptions = {
15
- readonly retryOptions?: Partial<RetryOptions>;
16
- readonly clientTimeout?: number;
17
- };
18
- export declare type RequestMetadata = {
19
- readonly method?: RequestMethod;
20
- readonly endpoint?: string;
21
- readonly mediaRegion?: string;
22
- readonly mediaEnv?: string;
23
- };
24
- export declare type RequestOptions = RequestMetadata & {
25
- readonly auth?: Auth;
26
- readonly params?: RequestParams;
27
- readonly headers?: RequestHeaders;
28
- readonly body?: any;
29
- readonly clientOptions?: ClientOptions;
30
- };
31
- export declare type CreateUrlOptions = {
32
- readonly params?: RequestParams;
33
- readonly auth?: Auth;
34
- };
35
- export declare type RequestErrorReason = 'clientOffline' | 'clientAbortedRequest' | 'clientTimeoutRequest' | 'serverInvalidBody' | 'serverBadRequest' | 'serverUnauthorized' | 'serverForbidden' | 'serverNotFound' | 'serverRateLimited' | 'serverInternalError' | 'serverBadGateway' | 'serverUnexpectedError';
36
- export declare type RequestErrorMetadata = RequestMetadata & {
37
- readonly attempts?: number;
38
- readonly clientExhaustedRetries?: boolean;
39
- readonly statusCode?: number;
40
- };
41
- export declare type RequestErrorAttributes = RequestErrorMetadata & {
42
- readonly reason: RequestErrorReason;
43
- };
@@ -1,2 +0,0 @@
1
- import { MediaSubscription } from './mediaSubscribable';
2
- export declare const safeUnsubscribe: (subscription: MediaSubscription) => void;
@@ -1,2 +0,0 @@
1
- export declare const resolveTimeout: <T>(timeout: number, resolveWith: T) => Promise<T>;
2
- export declare const rejectTimeout: (timeout: number, rejectWith: Error) => Promise<undefined>;
@@ -1,16 +0,0 @@
1
- import { Observable } from 'rxjs/Observable';
2
- import { FilePreview } from '../models/file-state';
3
- import { MediaType } from '../models/media';
4
- /**
5
- * Async helper determining if we should fetch remote fileStates from the backend:
6
- * - we poll the backend for all supported documents,
7
- * - we poll the backend is mimeType isn't natively supported by the browser,
8
- * - we poll the backend if we don't have a local preview available.
9
- * - we poll the backend if we have a video with which we can't extract dimensions,
10
- *
11
- * Polling the backend periodically refreshes the cached fileState until the file is processed.
12
- * Polling is needed for the use cases above to properly render the file in our components.
13
- *
14
- */
15
- export declare function shouldFetchRemoteFileStates(mediaType: MediaType, mimeType: string, preview?: FilePreview | Promise<FilePreview>): Promise<boolean>;
16
- export declare function shouldFetchRemoteFileStatesObservable(mediaType: MediaType, mimeType: string, preview?: FilePreview | Promise<FilePreview>): Observable<boolean>;
@@ -1,17 +0,0 @@
1
- export declare const isMediaBlobUrl: (url: string) => boolean;
2
- export interface MediaBlobUrlAttrs {
3
- id: string;
4
- contextId: string;
5
- collection?: string;
6
- size?: number;
7
- name?: string;
8
- mimeType?: string;
9
- width?: number;
10
- height?: number;
11
- alt?: string;
12
- }
13
- export declare const getAttrsFromUrl: (blobUrl: string) => MediaBlobUrlAttrs | undefined;
14
- export declare const objectToQueryString: (json: {
15
- [key: string]: string | number | boolean | null | undefined;
16
- }) => string;
17
- export declare const addFileAttrsToUrl: (url: string, fileAttrs: MediaBlobUrlAttrs) => string;
@@ -1,16 +0,0 @@
1
- import React from 'react';
2
- import { MediaClientConfig } from '@atlaskit/media-core';
3
- import { MediaFeatureFlags } from '@atlaskit/media-common';
4
- import { MediaClient } from '../client/media-client';
5
- import { Identifier } from '../identifier';
6
- export interface WithMediaClientConfig {
7
- mediaClientConfig: MediaClientConfig;
8
- }
9
- export interface WithMediaClient {
10
- mediaClient: MediaClient;
11
- identifier?: Identifier;
12
- }
13
- export declare const getMediaClient: (mediaClientConfig: MediaClientConfig, featureFlags?: MediaFeatureFlags | undefined) => MediaClient;
14
- export declare type WithMediaClientConfigProps<P extends WithMediaClient> = Omit<P, 'mediaClient'> & WithMediaClientConfig;
15
- export declare type WithMediaClientFunction = <P extends WithMediaClient>(Component: React.ComponentType<P>, featureFlags?: MediaFeatureFlags) => React.ComponentType<WithMediaClientConfigProps<P>>;
16
- export declare const withMediaClient: WithMediaClientFunction;