@atlaskit/media-client 27.0.0 → 27.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.
Files changed (114) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/client/file-fetcher/index.js +13 -4
  3. package/dist/cjs/client/media-store/MediaStore.js +32 -15
  4. package/dist/cjs/models/artifacts.js +2 -5
  5. package/dist/cjs/utils/request/helpers.js +1 -1
  6. package/dist/es2019/client/file-fetcher/index.js +7 -1
  7. package/dist/es2019/client/media-store/MediaStore.js +14 -9
  8. package/dist/es2019/models/artifacts.js +2 -5
  9. package/dist/es2019/utils/request/helpers.js +1 -1
  10. package/dist/esm/client/file-fetcher/index.js +13 -4
  11. package/dist/esm/client/media-store/MediaStore.js +32 -15
  12. package/dist/esm/models/artifacts.js +2 -5
  13. package/dist/esm/utils/request/helpers.js +1 -1
  14. package/dist/types/client/__mocks__/media-client.d.ts +2 -2
  15. package/dist/types/client/events.d.ts +1 -1
  16. package/dist/types/client/media-client.d.ts +7 -7
  17. package/dist/types/client/media-store/MediaStore.d.ts +4 -4
  18. package/dist/types/client/media-store/resolveAuth.d.ts +1 -1
  19. package/dist/types/client/media-store/types.d.ts +6 -6
  20. package/dist/types/client/mobile-upload.d.ts +3 -3
  21. package/dist/types/file-streams-cache.d.ts +3 -3
  22. package/dist/types/globalMediaEventEmitter.d.ts +1 -1
  23. package/dist/types/models/artifacts.d.ts +1 -1
  24. package/dist/types/models/auth-headers.d.ts +1 -1
  25. package/dist/types/models/auth-query-parameters.d.ts +1 -1
  26. package/dist/types/models/errors/helpers.d.ts +1 -1
  27. package/dist/types/models/errors/index.d.ts +1 -1
  28. package/dist/types/models/file-state.d.ts +4 -4
  29. package/dist/types/models/item.d.ts +1 -1
  30. package/dist/types/models/media.d.ts +2 -2
  31. package/dist/types/models/mobile-upload.d.ts +1 -1
  32. package/dist/types/uploader/index.d.ts +3 -3
  33. package/dist/types/utils/createFileDataLoader.d.ts +2 -2
  34. package/dist/types/utils/createMediaSubject.d.ts +1 -1
  35. package/dist/types/utils/detectEmptyFile.d.ts +1 -1
  36. package/dist/types/utils/getDimensionsFromBlob.d.ts +1 -1
  37. package/dist/types/utils/getMediaTypeFromUploadableFile.d.ts +2 -2
  38. package/dist/types/utils/hashing/hasherCreator.d.ts +1 -1
  39. package/dist/types/utils/hashing/sha256SimpleHasher.d.ts +1 -1
  40. package/dist/types/utils/hashing/simpleHasher.d.ts +1 -1
  41. package/dist/types/utils/hashing/workerHasher.d.ts +1 -1
  42. package/dist/types/utils/imageResizeModeToFileImageMode.d.ts +1 -1
  43. package/dist/types/utils/mediaSubscribable/fromObservable.d.ts +3 -3
  44. package/dist/types/utils/mediaSubscribable/toPromise.d.ts +2 -2
  45. package/dist/types/utils/mediaSubscribable/types.d.ts +1 -1
  46. package/dist/types/utils/mobileUpload/helpers.d.ts +5 -5
  47. package/dist/types/utils/mobileUpload/servicesCache.d.ts +2 -2
  48. package/dist/types/utils/mobileUpload/stateMachine/index.d.ts +5 -5
  49. package/dist/types/utils/mobileUpload/stateMachine/states/error.d.ts +2 -2
  50. package/dist/types/utils/mobileUpload/stateMachine/states/processed.d.ts +2 -2
  51. package/dist/types/utils/mobileUpload/stateMachine/states/processing.d.ts +2 -2
  52. package/dist/types/utils/mobileUpload/stateMachine/states/processingFailed.d.ts +2 -2
  53. package/dist/types/utils/mobileUpload/stateMachine/states/uploading.d.ts +2 -2
  54. package/dist/types/utils/mobileUpload/stateMachine/types.d.ts +2 -2
  55. package/dist/types/utils/overrideMediaTypeIfUnknown.d.ts +2 -2
  56. package/dist/types/utils/polling/errors.d.ts +1 -1
  57. package/dist/types/utils/polling/index.d.ts +1 -1
  58. package/dist/types/utils/request/errors.d.ts +1 -1
  59. package/dist/types/utils/request/helpers.d.ts +3 -3
  60. package/dist/types/utils/request/index.d.ts +1 -1
  61. package/dist/types/utils/request/types.d.ts +1 -1
  62. package/dist/types/utils/shouldFetchRemoteFileStates.d.ts +2 -2
  63. package/dist/types-ts4.5/client/__mocks__/media-client.d.ts +2 -2
  64. package/dist/types-ts4.5/client/events.d.ts +1 -1
  65. package/dist/types-ts4.5/client/media-client.d.ts +7 -7
  66. package/dist/types-ts4.5/client/media-store/MediaStore.d.ts +4 -4
  67. package/dist/types-ts4.5/client/media-store/resolveAuth.d.ts +1 -1
  68. package/dist/types-ts4.5/client/media-store/types.d.ts +6 -6
  69. package/dist/types-ts4.5/client/mobile-upload.d.ts +3 -3
  70. package/dist/types-ts4.5/file-streams-cache.d.ts +3 -3
  71. package/dist/types-ts4.5/globalMediaEventEmitter.d.ts +1 -1
  72. package/dist/types-ts4.5/models/artifacts.d.ts +1 -1
  73. package/dist/types-ts4.5/models/auth-headers.d.ts +1 -1
  74. package/dist/types-ts4.5/models/auth-query-parameters.d.ts +1 -1
  75. package/dist/types-ts4.5/models/errors/helpers.d.ts +1 -1
  76. package/dist/types-ts4.5/models/errors/index.d.ts +1 -1
  77. package/dist/types-ts4.5/models/file-state.d.ts +4 -4
  78. package/dist/types-ts4.5/models/item.d.ts +1 -1
  79. package/dist/types-ts4.5/models/media.d.ts +2 -2
  80. package/dist/types-ts4.5/models/mobile-upload.d.ts +1 -1
  81. package/dist/types-ts4.5/uploader/index.d.ts +3 -3
  82. package/dist/types-ts4.5/utils/createFileDataLoader.d.ts +2 -2
  83. package/dist/types-ts4.5/utils/createMediaSubject.d.ts +1 -1
  84. package/dist/types-ts4.5/utils/detectEmptyFile.d.ts +1 -1
  85. package/dist/types-ts4.5/utils/getDimensionsFromBlob.d.ts +1 -1
  86. package/dist/types-ts4.5/utils/getMediaTypeFromUploadableFile.d.ts +2 -2
  87. package/dist/types-ts4.5/utils/hashing/hasherCreator.d.ts +1 -1
  88. package/dist/types-ts4.5/utils/hashing/sha256SimpleHasher.d.ts +1 -1
  89. package/dist/types-ts4.5/utils/hashing/simpleHasher.d.ts +1 -1
  90. package/dist/types-ts4.5/utils/hashing/workerHasher.d.ts +1 -1
  91. package/dist/types-ts4.5/utils/imageResizeModeToFileImageMode.d.ts +1 -1
  92. package/dist/types-ts4.5/utils/mediaSubscribable/fromObservable.d.ts +3 -3
  93. package/dist/types-ts4.5/utils/mediaSubscribable/toPromise.d.ts +2 -2
  94. package/dist/types-ts4.5/utils/mediaSubscribable/types.d.ts +1 -1
  95. package/dist/types-ts4.5/utils/mobileUpload/helpers.d.ts +5 -5
  96. package/dist/types-ts4.5/utils/mobileUpload/servicesCache.d.ts +2 -2
  97. package/dist/types-ts4.5/utils/mobileUpload/stateMachine/index.d.ts +5 -5
  98. package/dist/types-ts4.5/utils/mobileUpload/stateMachine/states/error.d.ts +2 -2
  99. package/dist/types-ts4.5/utils/mobileUpload/stateMachine/states/processed.d.ts +2 -2
  100. package/dist/types-ts4.5/utils/mobileUpload/stateMachine/states/processing.d.ts +2 -2
  101. package/dist/types-ts4.5/utils/mobileUpload/stateMachine/states/processingFailed.d.ts +2 -2
  102. package/dist/types-ts4.5/utils/mobileUpload/stateMachine/states/uploading.d.ts +2 -2
  103. package/dist/types-ts4.5/utils/mobileUpload/stateMachine/types.d.ts +2 -2
  104. package/dist/types-ts4.5/utils/overrideMediaTypeIfUnknown.d.ts +2 -2
  105. package/dist/types-ts4.5/utils/polling/errors.d.ts +1 -1
  106. package/dist/types-ts4.5/utils/polling/index.d.ts +1 -1
  107. package/dist/types-ts4.5/utils/request/errors.d.ts +1 -1
  108. package/dist/types-ts4.5/utils/request/helpers.d.ts +3 -3
  109. package/dist/types-ts4.5/utils/request/index.d.ts +1 -1
  110. package/dist/types-ts4.5/utils/request/types.d.ts +1 -1
  111. package/dist/types-ts4.5/utils/shouldFetchRemoteFileStates.d.ts +2 -2
  112. package/example-helpers/styles.ts +1 -1
  113. package/example-helpers/stylesWrapper.tsx +2 -2
  114. package/package.json +6 -3
@@ -1,4 +1,4 @@
1
- import { Hasher } from './hasher';
1
+ import { type Hasher } from './hasher';
2
2
  export interface Deferred {
3
3
  resolve: (hash: string) => void;
4
4
  reject: (error: any) => void;
@@ -1,3 +1,3 @@
1
- import { MediaStoreGetFileImageParams } from '../client/media-store';
1
+ import { type MediaStoreGetFileImageParams } from '../client/media-store';
2
2
  export type ImageResizeMode = 'crop' | 'fit' | 'full-fit' | 'stretchy-fit';
3
3
  export declare const imageResizeModeToFileImageMode: (resizeMode?: ImageResizeMode) => MediaStoreGetFileImageParams['mode'];
@@ -1,5 +1,5 @@
1
- import { ReplaySubject } from 'rxjs/ReplaySubject';
2
- import { FileState } from '@atlaskit/media-state';
3
- import { MediaSubscribable } from './types';
1
+ import { type ReplaySubject } from 'rxjs/ReplaySubject';
2
+ import { type FileState } from '@atlaskit/media-state';
3
+ import { type MediaSubscribable } from './types';
4
4
  export declare function fromObservable(observable: ReplaySubject<FileState>): MediaSubscribable;
5
5
  export declare function createMediaSubscribable(item?: FileState | Error): MediaSubscribable;
@@ -1,6 +1,6 @@
1
1
  import { Subscription } from 'rxjs/Subscription';
2
- import { MediaSubscribable } from './types';
3
- import { FileState } from '@atlaskit/media-state';
2
+ import { type MediaSubscribable } from './types';
3
+ import { type FileState } from '@atlaskit/media-state';
4
4
  /**
5
5
  * This is a helper to transform the first value emitted by an MediaSubscribable into a Promise.
6
6
  *
@@ -1,4 +1,4 @@
1
- import { FileState } from '@atlaskit/media-state';
1
+ import { type FileState } from '@atlaskit/media-state';
2
2
  export type MediaSubscription = {
3
3
  unsubscribe: () => void;
4
4
  };
@@ -1,8 +1,8 @@
1
- import Dataloader from 'dataloader';
1
+ import type Dataloader from 'dataloader';
2
2
  import { ReplaySubject } from 'rxjs/ReplaySubject';
3
- import { Interpreter } from 'xstate';
4
- import { FileState } from '@atlaskit/media-state';
5
- import { DataloaderKey, DataloaderResult } from '../createFileDataLoader';
6
- import { StateMachineContext, StateMachineEvent, StateMachineTypestate } from './stateMachine/types';
3
+ import { type Interpreter } from 'xstate';
4
+ import { type FileState } from '@atlaskit/media-state';
5
+ import { type DataloaderKey, type DataloaderResult } from '../createFileDataLoader';
6
+ import { type StateMachineContext, type StateMachineEvent, type StateMachineTypestate } from './stateMachine/types';
7
7
  export declare const createMobileFileStateSubject: (service: Interpreter<StateMachineContext, any, StateMachineEvent, StateMachineTypestate>) => ReplaySubject<FileState>;
8
8
  export declare const createMobileDownloadFileStream: (dataloader: Dataloader<DataloaderKey, DataloaderResult>, id: string, collectionName?: string, occurrenceKey?: string) => ReplaySubject<FileState>;
@@ -1,4 +1,4 @@
1
1
  import { LRUMap } from 'lru_map';
2
- import { Interpreter } from 'xstate';
3
- import { StateMachineContext, StateMachineEvent, StateMachineTypestate } from './stateMachine/types';
2
+ import { type Interpreter } from 'xstate';
3
+ import { type StateMachineContext, type StateMachineEvent, type StateMachineTypestate } from './stateMachine/types';
4
4
  export declare function createServicesCache(): LRUMap<string, Interpreter<StateMachineContext, any, StateMachineEvent, StateMachineTypestate>>;
@@ -1,7 +1,7 @@
1
- import DataLoader from 'dataloader';
2
- import { Interpreter, StateMachine } from 'xstate';
3
- import { UploadingFileState } from '@atlaskit/media-state';
4
- import { DataloaderKey, DataloaderResult } from '../../createFileDataLoader';
5
- import { StateMachineContext, StateMachineEvent, StateMachineSchema, StateMachineTypestate } from './types';
1
+ import type DataLoader from 'dataloader';
2
+ import { type Interpreter, type StateMachine } from 'xstate';
3
+ import { type UploadingFileState } from '@atlaskit/media-state';
4
+ import { type DataloaderKey, type DataloaderResult } from '../../createFileDataLoader';
5
+ import { type StateMachineContext, type StateMachineEvent, type StateMachineSchema, type StateMachineTypestate } from './types';
6
6
  export declare const createMobileUploadStateMachine: (dataloader: DataLoader<DataloaderKey, DataloaderResult>, initialState: UploadingFileState, collectionName?: string) => StateMachine<StateMachineContext, any, StateMachineEvent, StateMachineTypestate>;
7
7
  export declare function createMobileUploadService(machine: StateMachine<StateMachineContext, StateMachineSchema, StateMachineEvent, StateMachineTypestate>): Interpreter<StateMachineContext, StateMachineSchema, StateMachineEvent, StateMachineTypestate>;
@@ -1,3 +1,3 @@
1
- import { StateNodeConfig } from 'xstate';
2
- import { StateMachineContext, StateMachineSchema, StateMachineEvent } from '../types';
1
+ import { type StateNodeConfig } from 'xstate';
2
+ import { type StateMachineContext, type StateMachineSchema, type StateMachineEvent } from '../types';
3
3
  export declare const machineErrorState: StateNodeConfig<StateMachineContext, StateMachineSchema, StateMachineEvent>;
@@ -1,3 +1,3 @@
1
- import { StateNodeConfig } from 'xstate';
2
- import { StateMachineContext, StateMachineSchema, StateMachineEvent } from '../types';
1
+ import { type StateNodeConfig } from 'xstate';
2
+ import { type StateMachineContext, type StateMachineSchema, type StateMachineEvent } from '../types';
3
3
  export declare const machineProcessedState: StateNodeConfig<StateMachineContext, StateMachineSchema, StateMachineEvent>;
@@ -1,3 +1,3 @@
1
- import { StateNodeConfig } from 'xstate';
2
- import { ProcessingStateMachineSchema, StateMachineContext, StateMachineEvent } from '../types';
1
+ import { type StateNodeConfig } from 'xstate';
2
+ import { type ProcessingStateMachineSchema, type StateMachineContext, type StateMachineEvent } from '../types';
3
3
  export declare const machineProcessingState: StateNodeConfig<StateMachineContext, ProcessingStateMachineSchema, StateMachineEvent>;
@@ -1,3 +1,3 @@
1
- import { StateNodeConfig } from 'xstate';
2
- import { StateMachineContext, StateMachineSchema, StateMachineEvent } from '../types';
1
+ import { type StateNodeConfig } from 'xstate';
2
+ import { type StateMachineContext, type StateMachineSchema, type StateMachineEvent } from '../types';
3
3
  export declare const machineProcessingFailedState: StateNodeConfig<StateMachineContext, StateMachineSchema, StateMachineEvent>;
@@ -1,3 +1,3 @@
1
- import { StateNodeConfig } from 'xstate';
2
- import { StateMachineContext, StateMachineSchema, StateMachineEvent } from '../types';
1
+ import { type StateNodeConfig } from 'xstate';
2
+ import { type StateMachineContext, type StateMachineSchema, type StateMachineEvent } from '../types';
3
3
  export declare const machineUploadingState: StateNodeConfig<StateMachineContext, StateMachineSchema, StateMachineEvent>;
@@ -1,5 +1,5 @@
1
- import { StateSchema } from 'xstate';
2
- import { FileState, UploadingFileState, ProcessingFileState, ProcessedFileState, ErrorFileState, ProcessingFailedState } from '@atlaskit/media-state';
1
+ import { type StateSchema } from 'xstate';
2
+ import { type FileState, type UploadingFileState, type ProcessingFileState, type ProcessedFileState, type ErrorFileState, type ProcessingFailedState } from '@atlaskit/media-state';
3
3
  export type StateMachineContext = {
4
4
  currentFileState: FileState;
5
5
  };
@@ -1,5 +1,5 @@
1
- import { FileState } from '@atlaskit/media-state';
2
- import { MediaType } from '../models/media';
1
+ import { type FileState } from '@atlaskit/media-state';
2
+ import { type MediaType } from '../models/media';
3
3
  export declare const overrideMediaTypeIfUnknown: (fileState: FileState, mediaType?: MediaType) => {
4
4
  mediaType?: MediaType | undefined;
5
5
  };
@@ -1,5 +1,5 @@
1
1
  import { BaseMediaClientError } from '../../models/errors';
2
- import { PollingErrorReason, PollingErrorAttributes } from './types';
2
+ import { type PollingErrorReason, type PollingErrorAttributes } from './types';
3
3
  export declare class PollingError extends BaseMediaClientError<PollingErrorAttributes> {
4
4
  readonly reason: PollingErrorReason;
5
5
  readonly attempts: number;
@@ -1,4 +1,4 @@
1
- import { Executor } from './types';
1
+ import { type Executor } from './types';
2
2
  export interface PollingOptions {
3
3
  poll_intervalMs: number;
4
4
  poll_maxAttempts: number;
@@ -1,5 +1,5 @@
1
1
  import { BaseMediaClientError } from '../../models/errors';
2
- import { RequestErrorReason, RequestErrorMetadata, RequestErrorAttributes } from './types';
2
+ import { type RequestErrorReason, type RequestErrorMetadata, type RequestErrorAttributes } from './types';
3
3
  export declare class RequestError extends BaseMediaClientError<RequestErrorAttributes> {
4
4
  readonly reason: RequestErrorReason;
5
5
  readonly metadata?: RequestErrorMetadata | undefined;
@@ -1,7 +1,7 @@
1
- import { Auth } from '@atlaskit/media-core';
2
- import { MediaTraceContext } from '@atlaskit/media-common';
1
+ import { type Auth } from '@atlaskit/media-core';
2
+ import { type MediaTraceContext } from '@atlaskit/media-common';
3
3
  import { RequestError } from './errors';
4
- import { CreateUrlOptions, RequestErrorReason, RequestErrorMetadata, RequestHeaders, RequestMetadata, RetryOptions } from './types';
4
+ import { type CreateUrlOptions, type RequestErrorReason, type RequestErrorMetadata, type RequestHeaders, type RequestMetadata, type RetryOptions } from './types';
5
5
  export declare function waitPromise(timeout: number): Promise<void>;
6
6
  export declare function isAbortedRequestError(err: any): boolean;
7
7
  export declare function isFetchNetworkError(err: any): err is TypeError;
@@ -1,4 +1,4 @@
1
- import { RequestOptions } from './types';
1
+ import { type RequestOptions } from './types';
2
2
  export type { RequestErrorReason, RequestErrorMetadata, RequestErrorAttributes, } from './types';
3
3
  export { RequestError, isRequestError } from './errors';
4
4
  export { isRateLimitedError, createRequestErrorReason } from './helpers';
@@ -1,4 +1,4 @@
1
- import { Auth } from '@atlaskit/media-core';
1
+ import { type Auth } from '@atlaskit/media-core';
2
2
  import type { MediaTraceContext } from '@atlaskit/media-common';
3
3
  export type RequestMethod = 'GET' | 'POST' | 'PUT' | 'DELETE';
4
4
  export type RequestParams = {
@@ -1,5 +1,5 @@
1
- import { FilePreview } from '@atlaskit/media-state';
2
- import { MediaType } from '../models/media';
1
+ import { type FilePreview } from '@atlaskit/media-state';
2
+ import { type MediaType } from '../models/media';
3
3
  /**
4
4
  * Async helper determining if we should fetch remote fileStates from the backend:
5
5
  * - we poll the backend for all supported documents,
@@ -1,6 +1,6 @@
1
1
  import { token } from '@atlaskit/tokens';
2
2
  import { css } from '@emotion/react';
3
- import { FileStatus } from '../src';
3
+ import { type FileStatus } from '../src';
4
4
 
5
5
  export const wrapperStyles = css({
6
6
  display: 'flex',
@@ -1,6 +1,6 @@
1
1
  /** @jsx jsx */
2
2
  import { jsx } from '@emotion/react';
3
- import { ChangeEvent, ReactNode } from 'react';
3
+ import { type ChangeEvent, type ReactNode } from 'react';
4
4
  import {
5
5
  cardsWrapperStyles,
6
6
  fileInputStyles,
@@ -15,7 +15,7 @@ import {
15
15
  uploadTouchWrapperStyles,
16
16
  wrapperStyles,
17
17
  } from './styles';
18
- import { FileStatus } from '../src';
18
+ import { type FileStatus } from '../src';
19
19
 
20
20
  export const Wrapper = ({ children }: { children: ReactNode }) => {
21
21
  return <div css={wrapperStyles}>{children}</div>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-client",
3
- "version": "27.0.0",
3
+ "version": "27.1.0",
4
4
  "description": "Media API Web Client Library",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -58,9 +58,9 @@
58
58
  },
59
59
  "devDependencies": {
60
60
  "@atlaskit/media-core": "^34.2.0",
61
- "@atlaskit/media-state": "^1.0.0",
61
+ "@atlaskit/media-state": "^1.1.0",
62
62
  "@atlaskit/ssr": "*",
63
- "@atlaskit/tokens": "^1.45.0",
63
+ "@atlaskit/tokens": "^1.49.0",
64
64
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
65
65
  "@atlassian/feature-flags-test-utils": "0.2.1",
66
66
  "@emotion/react": "^11.7.1",
@@ -88,6 +88,9 @@
88
88
  "platform-feature-flags": {
89
89
  "platform.media-svg-rendering": {
90
90
  "type": "boolean"
91
+ },
92
+ "platform.media-cdn-delivery": {
93
+ "type": "boolean"
91
94
  }
92
95
  }
93
96
  }