@atlaskit/media-client 36.3.3 → 36.4.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 (132) hide show
  1. package/AGENTS.md +18 -15
  2. package/CHANGELOG.md +15 -0
  3. package/artifacts/package.json +1 -8
  4. package/check-webp-support/package.json +1 -8
  5. package/constants/package.json +1 -8
  6. package/create-media-subject/package.json +1 -8
  7. package/dist/cjs/client/file-fetcher/index.js +7 -5
  8. package/dist/cjs/client/media-store/MediaStore.js +19 -7
  9. package/dist/cjs/uploader/index.js +3 -1
  10. package/dist/es2019/client/file-fetcher/index.js +7 -5
  11. package/dist/es2019/client/media-store/MediaStore.js +20 -8
  12. package/dist/es2019/uploader/index.js +3 -1
  13. package/dist/esm/client/file-fetcher/index.js +7 -5
  14. package/dist/esm/client/media-store/MediaStore.js +19 -7
  15. package/dist/esm/uploader/index.js +3 -1
  16. package/dist/types/client/file-fetcher/index.d.ts +2 -2
  17. package/dist/types/client/media-store/MediaStore.d.ts +6 -2
  18. package/dist/types/client/media-store/types.d.ts +6 -2
  19. package/error/package.json +1 -8
  20. package/errors/helpers/package.json +1 -8
  21. package/errors/package.json +1 -8
  22. package/errors/types/package.json +1 -8
  23. package/events/package.json +1 -8
  24. package/file-fetcher/error/package.json +1 -8
  25. package/file-fetcher/package.json +1 -8
  26. package/file-state/package.json +1 -8
  27. package/file-streams-cache/package.json +1 -8
  28. package/from-observable/package.json +1 -8
  29. package/get-dimensions-from-blob/package.json +1 -8
  30. package/global-media-event-emitter/package.json +1 -8
  31. package/identifier/package.json +1 -8
  32. package/image-resize-mode-to-file-image-mode/package.json +1 -8
  33. package/item/package.json +1 -8
  34. package/media/package.json +1 -8
  35. package/media-client/package.json +1 -8
  36. package/media-store/package.json +1 -8
  37. package/media-store/types/package.json +1 -8
  38. package/media-subscribable/types/package.json +1 -8
  39. package/mobile-upload/package.json +1 -8
  40. package/package.json +4 -4
  41. package/polling/errors/package.json +1 -8
  42. package/polling/package.json +1 -8
  43. package/polling/types/package.json +1 -8
  44. package/request/errors/package.json +1 -8
  45. package/request/helpers/package.json +1 -8
  46. package/request/package.json +1 -8
  47. package/request/types/package.json +1 -8
  48. package/stargate-client/package.json +1 -8
  49. package/upload-controller/package.json +1 -8
  50. package/uploader/package.json +1 -8
  51. package/url/package.json +1 -8
  52. package/dist/types-ts4.5/client/__mocks__/collection-fetcher.d.ts +0 -7
  53. package/dist/types-ts4.5/client/__mocks__/file-fetcher.d.ts +0 -9
  54. package/dist/types-ts4.5/client/__mocks__/media-client.d.ts +0 -10
  55. package/dist/types-ts4.5/client/events.d.ts +0 -29
  56. package/dist/types-ts4.5/client/file-fetcher/error.d.ts +0 -33
  57. package/dist/types-ts4.5/client/file-fetcher/index.d.ts +0 -86
  58. package/dist/types-ts4.5/client/media-client.d.ts +0 -34
  59. package/dist/types-ts4.5/client/media-store/MediaStore.d.ts +0 -56
  60. package/dist/types-ts4.5/client/media-store/error.d.ts +0 -15
  61. package/dist/types-ts4.5/client/media-store/index.d.ts +0 -4
  62. package/dist/types-ts4.5/client/media-store/resolveAuth.d.ts +0 -4
  63. package/dist/types-ts4.5/client/media-store/types.d.ts +0 -207
  64. package/dist/types-ts4.5/client/mobile-upload.d.ts +0 -15
  65. package/dist/types-ts4.5/client/stargate-client.d.ts +0 -15
  66. package/dist/types-ts4.5/constants.d.ts +0 -6
  67. package/dist/types-ts4.5/file-streams-cache.d.ts +0 -15
  68. package/dist/types-ts4.5/globalMediaEventEmitter.d.ts +0 -6
  69. package/dist/types-ts4.5/identifier.d.ts +0 -15
  70. package/dist/types-ts4.5/index.d.ts +0 -45
  71. package/dist/types-ts4.5/models/artifacts.d.ts +0 -2
  72. package/dist/types-ts4.5/models/auth-headers.d.ts +0 -11
  73. package/dist/types-ts4.5/models/auth-query-parameters.d.ts +0 -11
  74. package/dist/types-ts4.5/models/document.d.ts +0 -95
  75. package/dist/types-ts4.5/models/errors/helpers.d.ts +0 -6
  76. package/dist/types-ts4.5/models/errors/index.d.ts +0 -24
  77. package/dist/types-ts4.5/models/errors/types.d.ts +0 -22
  78. package/dist/types-ts4.5/models/file-state.d.ts +0 -32
  79. package/dist/types-ts4.5/models/item.d.ts +0 -27
  80. package/dist/types-ts4.5/models/media.d.ts +0 -65
  81. package/dist/types-ts4.5/models/mobile-upload.d.ts +0 -28
  82. package/dist/types-ts4.5/upload-controller.d.ts +0 -7
  83. package/dist/types-ts4.5/uploader/calculateChunkSize.d.ts +0 -11
  84. package/dist/types-ts4.5/uploader/error.d.ts +0 -27
  85. package/dist/types-ts4.5/uploader/index.d.ts +0 -23
  86. package/dist/types-ts4.5/utils/checkWebpSupport.d.ts +0 -1
  87. package/dist/types-ts4.5/utils/convertBase64ToBlob.d.ts +0 -1
  88. package/dist/types-ts4.5/utils/createCopyIntentRegisterationBatcher.d.ts +0 -20
  89. package/dist/types-ts4.5/utils/createFileDataLoader.d.ts +0 -30
  90. package/dist/types-ts4.5/utils/createMediaSubject.d.ts +0 -3
  91. package/dist/types-ts4.5/utils/detectEmptyFile.d.ts +0 -16
  92. package/dist/types-ts4.5/utils/getDimensionsFromBlob.d.ts +0 -6
  93. package/dist/types-ts4.5/utils/getDocument.d.ts +0 -2
  94. package/dist/types-ts4.5/utils/getImageDimensionsFromBlob.d.ts +0 -5
  95. package/dist/types-ts4.5/utils/getMediaTypeFromUploadableFile.d.ts +0 -3
  96. package/dist/types-ts4.5/utils/getNavigator.d.ts +0 -2
  97. package/dist/types-ts4.5/utils/getVideoDimensionsFromBlob.d.ts +0 -5
  98. package/dist/types-ts4.5/utils/hashing/hasher.d.ts +0 -3
  99. package/dist/types-ts4.5/utils/hashing/hasherCreator.d.ts +0 -4
  100. package/dist/types-ts4.5/utils/hashing/sha256SimpleHasher.d.ts +0 -4
  101. package/dist/types-ts4.5/utils/hashing/simpleHasher.d.ts +0 -4
  102. package/dist/types-ts4.5/utils/imageResizeModeToFileImageMode.d.ts +0 -3
  103. package/dist/types-ts4.5/utils/isCommercial.d.ts +0 -1
  104. package/dist/types-ts4.5/utils/mediaCdn.d.ts +0 -5
  105. package/dist/types-ts4.5/utils/mediaSubscribable/fromObservable.d.ts +0 -5
  106. package/dist/types-ts4.5/utils/mediaSubscribable/index.d.ts +0 -3
  107. package/dist/types-ts4.5/utils/mediaSubscribable/toPromise.d.ts +0 -10
  108. package/dist/types-ts4.5/utils/mediaSubscribable/types.d.ts +0 -17
  109. package/dist/types-ts4.5/utils/mobileUpload/error.d.ts +0 -33
  110. package/dist/types-ts4.5/utils/mobileUpload/helpers.d.ts +0 -8
  111. package/dist/types-ts4.5/utils/mobileUpload/index.d.ts +0 -5
  112. package/dist/types-ts4.5/utils/mobileUpload/servicesCache.d.ts +0 -4
  113. package/dist/types-ts4.5/utils/mobileUpload/stateMachine/index.d.ts +0 -7
  114. package/dist/types-ts4.5/utils/mobileUpload/stateMachine/states/error.d.ts +0 -3
  115. package/dist/types-ts4.5/utils/mobileUpload/stateMachine/states/processed.d.ts +0 -3
  116. package/dist/types-ts4.5/utils/mobileUpload/stateMachine/states/processing.d.ts +0 -3
  117. package/dist/types-ts4.5/utils/mobileUpload/stateMachine/states/processingFailed.d.ts +0 -3
  118. package/dist/types-ts4.5/utils/mobileUpload/stateMachine/states/uploading.d.ts +0 -3
  119. package/dist/types-ts4.5/utils/mobileUpload/stateMachine/types.d.ts +0 -69
  120. package/dist/types-ts4.5/utils/overrideMediaTypeIfUnknown.d.ts +0 -5
  121. package/dist/types-ts4.5/utils/pathBasedUrl.d.ts +0 -3
  122. package/dist/types-ts4.5/utils/polling/errors.d.ts +0 -11
  123. package/dist/types-ts4.5/utils/polling/index.d.ts +0 -34
  124. package/dist/types-ts4.5/utils/polling/types.d.ts +0 -10
  125. package/dist/types-ts4.5/utils/request/errors.d.ts +0 -22
  126. package/dist/types-ts4.5/utils/request/helpers.d.ts +0 -32
  127. package/dist/types-ts4.5/utils/request/index.d.ts +0 -5
  128. package/dist/types-ts4.5/utils/request/types.d.ts +0 -47
  129. package/dist/types-ts4.5/utils/setTimeoutPromise.d.ts +0 -2
  130. package/dist/types-ts4.5/utils/shouldFetchRemoteFileStates.d.ts +0 -14
  131. package/dist/types-ts4.5/utils/url.d.ts +0 -18
  132. package/dist/types-ts4.5/utils/watermarkVersion.d.ts +0 -10
@@ -1,32 +0,0 @@
1
- import { type FileStatus as CommonFileStatus } from '@atlaskit/media-common';
2
- import { type MediaStoreResponse } from '../client/media-store';
3
- import { type MediaItemDetails, type MediaFile } from './media';
4
- import { type FilePreview, type FileState, type ErrorFileState, type UploadingFileState, type ProcessingFileState, type ProcessedFileState, type ProcessingFailedState, type MediaFileArtifacts } from '@atlaskit/media-state';
5
- export type FileStatus = CommonFileStatus;
6
- export interface PreviewOptions {
7
- }
8
- export interface GetFileOptions {
9
- initialFileState?: FileState;
10
- preview?: PreviewOptions;
11
- collectionName?: string;
12
- occurrenceKey?: string;
13
- includeHashForDuplicateFiles?: boolean;
14
- forceRefresh?: boolean;
15
- }
16
- export interface PreviewableFileState {
17
- preview: FilePreview | Promise<FilePreview>;
18
- }
19
- export type NonErrorFileState = Exclude<FileState, ErrorFileState>;
20
- export declare const isUploadingFileState: (fileState: FileState) => fileState is UploadingFileState;
21
- export declare const isProcessingFileState: (fileState: FileState) => fileState is ProcessingFileState;
22
- export declare const isProcessedFileState: (fileState: FileState) => fileState is ProcessedFileState;
23
- export declare const isErrorFileState: (fileState: FileState) => fileState is ErrorFileState;
24
- export declare const isPreviewableFileState: (fileState: FileState) => fileState is Exclude<FileState, ErrorFileState> & PreviewableFileState;
25
- export declare const isFinalFileState: (fileState: FileState) => fileState is ProcessedFileState | ErrorFileState | ProcessingFailedState;
26
- export declare const isNonErrorFinalFileState: (fileState: FileState) => fileState is ProcessedFileState | ProcessingFailedState;
27
- export declare const hasArtifacts: (fileState: FileState) => fileState is FileState & {
28
- artifacts: MediaFileArtifacts;
29
- };
30
- export declare const isImageRepresentationReady: (fileState: FileState) => boolean;
31
- export declare const mapMediaFileToFileState: (mediaFile: MediaStoreResponse<MediaFile>) => FileState;
32
- export declare const mapMediaItemToFileState: (id: string, item: MediaItemDetails) => FileState;
@@ -1,27 +0,0 @@
1
- import { type MediaType } from './media';
2
- import { type ProcessingFailReason } from '@atlaskit/media-state';
3
- export type MediaItemType = 'file' | 'external-image';
4
- export interface FileItem {
5
- type: 'file';
6
- details: FileDetails;
7
- }
8
- export type FileProcessingStatus = 'pending' | 'running' | 'succeeded' | 'failed';
9
- export interface MediaArtifact {
10
- processingStatus?: FileProcessingStatus;
11
- url?: string;
12
- }
13
- export type Artifacts = {
14
- [name: string]: MediaArtifact;
15
- };
16
- export interface FileDetails {
17
- id: string;
18
- name?: string;
19
- size?: number;
20
- mimeType?: string;
21
- mediaType?: MediaType;
22
- creationDate?: number;
23
- processingStatus?: FileProcessingStatus;
24
- artifacts?: Artifacts;
25
- createdAt?: number;
26
- failReason?: ProcessingFailReason;
27
- }
@@ -1,65 +0,0 @@
1
- import { type MediaTraceContext, type MediaType } from '@atlaskit/media-common';
2
- import { type MediaFileArtifacts, type ProcessingFailReason } from '@atlaskit/media-state';
3
- export type MediaFileProcessingStatus = 'pending' | 'succeeded' | 'failed';
4
- export type { MediaType } from '@atlaskit/media-common';
5
- export declare const isPreviewableType: (type: MediaType) => boolean;
6
- export type AbuseClassification = {
7
- classification: 'ABHORRENT' | 'MALICIOUS' | 'ILLICIT' | 'COPYRIGHT';
8
- confidence: 'HIGH' | 'MEDIUM' | 'LOW' | 'SYNTHETIC';
9
- };
10
- export type FileMediaMetadata = {
11
- duration?: number;
12
- };
13
- export type MediaFile = {
14
- readonly id: string;
15
- readonly mediaType: MediaType;
16
- readonly mimeType: string;
17
- readonly name: string;
18
- readonly processingStatus?: MediaFileProcessingStatus;
19
- readonly size: number;
20
- readonly artifacts: MediaFileArtifacts;
21
- readonly representations: MediaRepresentations;
22
- readonly createdAt?: number;
23
- readonly hash?: string;
24
- readonly metadataTraceContext?: MediaTraceContext;
25
- readonly abuseClassification?: AbuseClassification;
26
- readonly mediaMetadata?: FileMediaMetadata;
27
- readonly failReason?: ProcessingFailReason;
28
- readonly previewCdnUrl?: string;
29
- };
30
- export type MediaItemDetails = {
31
- readonly mediaType: MediaType;
32
- readonly mimeType: string;
33
- readonly name: string;
34
- readonly processingStatus: MediaFileProcessingStatus;
35
- readonly size: number;
36
- readonly artifacts: MediaFileArtifacts;
37
- readonly representations: MediaRepresentations;
38
- readonly createdAt?: number;
39
- readonly hash?: string;
40
- readonly metadataTraceContext?: MediaTraceContext;
41
- readonly abuseClassification?: AbuseClassification;
42
- readonly mediaMetadata?: FileMediaMetadata;
43
- readonly failReason?: ProcessingFailReason;
44
- readonly previewCdnUrl?: string;
45
- };
46
- export type NotFoundMediaItemDetails = {
47
- readonly id: string;
48
- readonly collection?: string;
49
- readonly type: 'not-found';
50
- readonly metadataTraceContext?: MediaTraceContext;
51
- };
52
- export declare const isNotFoundMediaItemDetails: (itemDetails: any) => itemDetails is NotFoundMediaItemDetails;
53
- export type MediaRepresentations = {
54
- image?: object;
55
- };
56
- export type MediaUpload = {
57
- readonly id: string;
58
- readonly created: number;
59
- readonly expires: number;
60
- };
61
- export declare enum DATA_UNIT {
62
- MB = 1048576,
63
- GB = 1073741824,
64
- TB = 1099511627776
65
- }
@@ -1,28 +0,0 @@
1
- import { type FilePreview } from '@atlaskit/media-state';
2
- export type MobileUploadStartEvent = {
3
- fileId: string;
4
- collectionName?: string;
5
- occurrenceKey?: string;
6
- fileName: string;
7
- fileSize: number;
8
- fileMimetype: string;
9
- preview?: FilePreview;
10
- createdAt?: number;
11
- };
12
- export type MobileUploadProgressEvent = {
13
- fileId: string;
14
- progress: number;
15
- };
16
- export type MobileUploadEndEvent = {
17
- fileId: string;
18
- };
19
- export type MobileUploadErrorEvent = {
20
- fileId: string;
21
- message: string;
22
- };
23
- export interface MobileUpload {
24
- notifyUploadStart(event: MobileUploadStartEvent): void;
25
- notifyUploadProgress(event: MobileUploadProgressEvent): void;
26
- notifyUploadEnd(event: MobileUploadEndEvent): void;
27
- notifyUploadError(event: MobileUploadErrorEvent): void;
28
- }
@@ -1,7 +0,0 @@
1
- export type AbortFunction = () => void;
2
- export declare class UploadController {
3
- abortFunction?: AbortFunction;
4
- constructor();
5
- setAbort(abortFunction: AbortFunction): void;
6
- abort(): void;
7
- }
@@ -1,11 +0,0 @@
1
- export declare const fileSizeError = "fileSizeExceedsLimit";
2
- /**
3
- * This is a helper to dynamically calculate the chunk size for a given file size.
4
- *
5
- * @param fileSize The size of a file to calculate the chunk size for.
6
- * @returns A number of bytes per chunk or Throws an Error if the file size exceeds 2TB
7
- *
8
- * @see {@link https://product-fabric.atlassian.net/wiki/spaces/FIL/pages/3221881143/Rule+of+thumb+for+chunk+sizes#Given-the-following-conditions}
9
- *
10
- */
11
- export declare const calculateChunkSize: (fileSize: number) => number;
@@ -1,27 +0,0 @@
1
- import { BaseMediaClientError } from '../models/errors';
2
- export type UploaderErrorReason = 'fileSizeExceedsLimit';
3
- export type UploaderErrorAttributes = {
4
- readonly reason: UploaderErrorReason;
5
- readonly id: string;
6
- readonly metadata?: {
7
- readonly collectionName?: string;
8
- readonly occurrenceKey?: string;
9
- };
10
- };
11
- export type UploaderErrorMetadata = {
12
- readonly id: string;
13
- readonly collectionName?: string;
14
- readonly occurrenceKey?: string;
15
- };
16
- export declare class UploaderError extends BaseMediaClientError<UploaderErrorReason, UploaderErrorMetadata, undefined, UploaderErrorAttributes> {
17
- readonly id: string;
18
- constructor(reason: UploaderErrorReason, metadata: UploaderErrorMetadata);
19
- /** Will be deprecated. Use the properties `reason` and `metadata` instead */
20
- get attributes(): {
21
- reason: 'fileSizeExceedsLimit';
22
- id: string;
23
- collectionName: string | undefined;
24
- occurrenceKey: string | undefined;
25
- };
26
- }
27
- export declare function isUploaderError(err: Error): err is UploaderError;
@@ -1,23 +0,0 @@
1
- import { type ChunkinatorFile } from '@atlaskit/chunkinator';
2
- import { type MediaStore } from '../client/media-store';
3
- import { type MediaTraceContext } from '@atlaskit/media-common';
4
- export type UploadableFile = {
5
- content: ChunkinatorFile;
6
- name?: string;
7
- mimeType?: string;
8
- collection?: string;
9
- size?: number;
10
- };
11
- export type UploadableFileUpfrontIds = {
12
- id: string;
13
- deferredUploadId: Promise<string>;
14
- occurrenceKey?: string;
15
- };
16
- export type UploadFileCallbacks = {
17
- onProgress: (progress: number) => void;
18
- onUploadFinish: (error?: any) => void;
19
- };
20
- export interface UploadFileResult {
21
- cancel: () => void;
22
- }
23
- export declare const uploadFile: (file: UploadableFile, store: MediaStore, uploadableFileUpfrontIds: UploadableFileUpfrontIds, callbacks?: UploadFileCallbacks, traceContext?: MediaTraceContext) => UploadFileResult;
@@ -1 +0,0 @@
1
- export declare const checkWebpSupport: () => Promise<boolean>;
@@ -1 +0,0 @@
1
- export declare const convertBase64ToBlob: (base64: string) => Blob;
@@ -1,20 +0,0 @@
1
- import Dataloader from 'dataloader';
2
- import { type MediaStore } from '../client/media-store';
3
- import { type NotFoundMediaItemDetails, type MediaItemDetails } from '../models/media';
4
- import { type Auth } from '@atlaskit/media-core';
5
- export declare const MAX_BATCH_SIZE = 100;
6
- export type CopyIntentKey = {
7
- readonly id: string;
8
- readonly resolvedAuth: Auth;
9
- readonly collectionName?: string;
10
- };
11
- export type DataloaderResult = MediaItemDetails | NotFoundMediaItemDetails;
12
- export type BatchLoadingErrorResult = {
13
- readonly id: string;
14
- readonly collection?: string;
15
- readonly error: Error;
16
- };
17
- export type FilesByToken = {
18
- [token: string]: CopyIntentKey[];
19
- };
20
- export declare function createCopyIntentRegisterationBatcher(mediaStore: MediaStore): Dataloader<CopyIntentKey, Error | undefined, string>;
@@ -1,30 +0,0 @@
1
- import Dataloader from 'dataloader';
2
- import { type MediaStore, type ResponseFileItem, type EmptyResponseFileItem } from '../client/media-store';
3
- import { type NotFoundMediaItemDetails, type MediaItemDetails } from '../models/media';
4
- export declare const MAX_BATCH_SIZE = 100;
5
- export type DataloaderKey = {
6
- readonly id: string;
7
- readonly collectionName?: string;
8
- readonly includeHashForDuplicateFiles?: boolean;
9
- };
10
- export type DataloaderResult = MediaItemDetails | NotFoundMediaItemDetails;
11
- export type BatchLoadingErrorResult = {
12
- readonly id: string;
13
- readonly collection?: string;
14
- readonly error: Error;
15
- };
16
- export declare const getItemsFromKeys: (dataloaderKeys: ReadonlyArray<DataloaderKey>, fileItems: Array<ResponseFileItem | BatchLoadingErrorResult | EmptyResponseFileItem>) => Array<DataloaderResult | Error>;
17
- export type FileIdsByCollection = {
18
- [collectionName: string]: string[];
19
- };
20
- /**
21
- * Returns a function that, given Array<DataloaderKey>, resolves to an array of same length containing either DataloaderResult or Error.
22
- * Such contract is formalised by Dataloader 1.0, @see https://github.com/graphql/dataloader
23
- *
24
- * If an Error is resolved in the results, it must be at same position then their corresponding key:
25
- * - Dataloader will re-throw that Error when accessing/loading that particular key
26
- *
27
- * @param mediaStore instance of MediaStore
28
- */
29
- export declare function createBatchLoadingFunc(mediaStore: MediaStore): (keys: ReadonlyArray<DataloaderKey>) => Promise<Array<DataloaderResult | Error>>;
30
- export declare function createFileDataloader(mediaStore: MediaStore): Dataloader<DataloaderKey, DataloaderResult>;
@@ -1,3 +0,0 @@
1
- import { ReplaySubject } from 'rxjs/ReplaySubject';
2
- import { type FileState } from '@atlaskit/media-state';
3
- export declare function createMediaSubject<T extends FileState>(initialState?: T | Error): ReplaySubject<T>;
@@ -1,16 +0,0 @@
1
- import { type MediaItemDetails } from '../models/media';
2
- /**
3
- * EMPTY_FILE_HOURS_ELAPSED_TOLERANCE - how many hours since this file was
4
- * created until we give up on expecting metadata?
5
- *
6
- * Yes, this is not an exact science. Any value under this tolerance will
7
- * go undetected, however this is still suitable to catch the majority of
8
- * cases where empty (files which never finished upload) are being reloaded.
9
- *
10
- * Continuous bad renders of empty files will eat our card render SLIs, so until
11
- * there is a better response from backend we use this technique.
12
- *
13
- * Being encapsulated in this function, we can always improve the detection transparently.
14
- */
15
- export declare const EMPTY_FILE_HOURS_ELAPSED_TOLERANCE_MS: number;
16
- export declare function isEmptyFile(fileDetails: MediaItemDetails, now?: number): Boolean;
@@ -1,6 +0,0 @@
1
- import { type MediaType } from '@atlaskit/media-common';
2
- export type Dimensions = {
3
- width: number;
4
- height: number;
5
- };
6
- export declare const getDimensionsFromBlob: (mediaType: MediaType, blob: Blob) => Promise<Dimensions>;
@@ -1,2 +0,0 @@
1
- declare const _default: () => Document | undefined;
2
- export default _default;
@@ -1,5 +0,0 @@
1
- export type Dimensions = {
2
- width: number;
3
- height: number;
4
- };
5
- export declare const getImageDimensionsFromBlob: (url: string) => Promise<Dimensions>;
@@ -1,3 +0,0 @@
1
- import { type MediaType } from '../models/media';
2
- import { type UploadableFile } from '../uploader';
3
- export declare const getMediaTypeFromUploadableFile: (file: UploadableFile) => MediaType;
@@ -1,2 +0,0 @@
1
- declare const _default: () => Navigator | undefined;
2
- export default _default;
@@ -1,5 +0,0 @@
1
- export interface Dimensions {
2
- width: number;
3
- height: number;
4
- }
5
- export declare const getVideoDimensionsFromBlob: (blob: Blob) => Promise<Dimensions>;
@@ -1,3 +0,0 @@
1
- export interface Hasher {
2
- hash(blob: Blob): Promise<string>;
3
- }
@@ -1,4 +0,0 @@
1
- import { type Hasher } from './hasher';
2
- import { ChunkHashAlgorithm } from '@atlaskit/media-core';
3
- export declare const destroyHashers: () => void;
4
- export declare const createHasher: (algorithm: ChunkHashAlgorithm) => Promise<Hasher>;
@@ -1,4 +0,0 @@
1
- import { type Hasher } from './hasher';
2
- export declare class SimpleHasher implements Hasher {
3
- hash(blob: Blob): Promise<string>;
4
- }
@@ -1,4 +0,0 @@
1
- import { type Hasher } from './hasher';
2
- export declare class SimpleHasher implements Hasher {
3
- hash(blob: Blob): Promise<string>;
4
- }
@@ -1,3 +0,0 @@
1
- import { type MediaStoreGetFileImageParams } from '../client/media-store';
2
- export type ImageResizeMode = 'crop' | 'fit' | 'full-fit' | 'stretchy-fit';
3
- export declare const imageResizeModeToFileImageMode: (resizeMode?: ImageResizeMode) => MediaStoreGetFileImageParams["mode"];
@@ -1 +0,0 @@
1
- export declare function isCommercial(): boolean;
@@ -1,5 +0,0 @@
1
- export declare const MEDIA_CDN_MAP: {
2
- [key: string]: string;
3
- };
4
- export declare function isCDNEnabled(): boolean;
5
- export declare function mapToMediaCdnUrl(url: string, token: string): string;
@@ -1,5 +0,0 @@
1
- import { type ReplaySubject } from 'rxjs/ReplaySubject';
2
- import { type FileState } from '@atlaskit/media-state';
3
- import { type MediaSubscribable } from './types';
4
- export declare function fromObservable(observable: ReplaySubject<FileState>): MediaSubscribable;
5
- export declare function createMediaSubscribable(item?: FileState | Error): MediaSubscribable;
@@ -1,3 +0,0 @@
1
- export type { MediaSubscribable, MediaObserver, MediaSubscription } from './types';
2
- export { toPromise } from './toPromise';
3
- export { createMediaSubscribable, fromObservable } from './fromObservable';
@@ -1,10 +0,0 @@
1
- import { Subscription } from 'rxjs/Subscription';
2
- import { type MediaSubscribable } from './types';
3
- import { type FileState } from '@atlaskit/media-state';
4
- /**
5
- * This is a helper to transform the first value emitted by an MediaSubscribable into a Promise.
6
- *
7
- * @param mediaSubscribable a given MediaSubscribable<MediaSubscribableItem>
8
- * @param subscription a default Subscription (this parameter exists for testing purpose)
9
- */
10
- export declare const toPromise: (mediaSubscribable: MediaSubscribable, subscription?: Subscription) => Promise<FileState>;
@@ -1,17 +0,0 @@
1
- import { type FileState } from '@atlaskit/media-state';
2
- export type MediaSubscription = {
3
- unsubscribe: () => void;
4
- };
5
- type PartialObserver = {
6
- next?: (value: FileState) => void;
7
- error?: (err: any) => void;
8
- complete?: () => void;
9
- };
10
- export type NextObserver = PartialObserver & Required<Pick<PartialObserver, 'next'>>;
11
- export type ErrorObserver = PartialObserver & Required<Pick<PartialObserver, 'error'>>;
12
- export type CompletionObserver = PartialObserver & Required<Pick<PartialObserver, 'complete'>>;
13
- export type MediaObserver = NextObserver | ErrorObserver | CompletionObserver | ((value: FileState) => void);
14
- export type MediaSubscribable = {
15
- subscribe(observer?: MediaObserver): MediaSubscription;
16
- };
17
- export {};
@@ -1,33 +0,0 @@
1
- import { type MediaTraceContext } from '@atlaskit/media-common';
2
- import { BaseMediaClientError } from '../../models/errors';
3
- export type MobileUploadErrorReason = 'emptyItems' | 'zeroVersionFile';
4
- export type MobileUploadErrorAttributes = {
5
- readonly reason: MobileUploadErrorReason;
6
- readonly id: string;
7
- readonly metadata?: {
8
- readonly collectionName?: string;
9
- readonly occurrenceKey?: string;
10
- readonly traceContext?: MediaTraceContext;
11
- };
12
- };
13
- export type MobileUploadErrorMetadata = {
14
- readonly id: string;
15
- readonly collectionName?: string;
16
- readonly occurrenceKey?: string;
17
- readonly traceContext?: MediaTraceContext;
18
- };
19
- export declare class MobileUploadError extends BaseMediaClientError<MobileUploadErrorReason, MobileUploadErrorMetadata, undefined, MobileUploadErrorAttributes> {
20
- readonly id: string;
21
- constructor(reason: MobileUploadErrorReason, metadata: MobileUploadErrorMetadata);
22
- /** Will be deprecated. Use the properties `reason` and `metadata` instead */
23
- get attributes(): {
24
- reason: MobileUploadErrorReason;
25
- id: string;
26
- collectionName: string | undefined;
27
- occurrenceKey: string | undefined;
28
- metadata: {
29
- traceContext: MediaTraceContext | undefined;
30
- };
31
- };
32
- }
33
- export declare function isMobileUploadError(err: Error): err is MobileUploadError;
@@ -1,8 +0,0 @@
1
- import type Dataloader from 'dataloader';
2
- import { ReplaySubject } from 'rxjs/ReplaySubject';
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
- export declare const createMobileFileStateSubject: (service: Interpreter<StateMachineContext, any, StateMachineEvent, StateMachineTypestate>) => ReplaySubject<FileState>;
8
- export declare const createMobileDownloadFileStream: (dataloader: Dataloader<DataloaderKey, DataloaderResult>, id: string, collectionName?: string, occurrenceKey?: string) => ReplaySubject<FileState>;
@@ -1,5 +0,0 @@
1
- export { isMobileUploadError, MobileUploadError } from './error';
2
- export { createServicesCache } from './servicesCache';
3
- export { createMobileUploadService, createMobileUploadStateMachine } from './stateMachine';
4
- export { createMobileFileStateSubject } from './helpers';
5
- export type { StateMachineContext, StateMachineSchema, StateMachineEvent, StateMachineTypestate, } from './stateMachine/types';
@@ -1,4 +0,0 @@
1
- import { LRUMap } from 'lru_map';
2
- import { type Interpreter } from 'xstate';
3
- import { type StateMachineContext, type StateMachineEvent, type StateMachineTypestate } from './stateMachine/types';
4
- export declare function createServicesCache(): LRUMap<string, Interpreter<StateMachineContext, any, StateMachineEvent, StateMachineTypestate>>;
@@ -1,7 +0,0 @@
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
- export declare const createMobileUploadStateMachine: (dataloader: DataLoader<DataloaderKey, DataloaderResult>, initialState: UploadingFileState, collectionName?: string) => StateMachine<StateMachineContext, any, StateMachineEvent, StateMachineTypestate>;
7
- export declare function createMobileUploadService(machine: StateMachine<StateMachineContext, StateMachineSchema, StateMachineEvent, StateMachineTypestate>): Interpreter<StateMachineContext, StateMachineSchema, StateMachineEvent, StateMachineTypestate>;
@@ -1,3 +0,0 @@
1
- import { type StateNodeConfig } from 'xstate';
2
- import { type StateMachineContext, type StateMachineSchema, type StateMachineEvent } from '../types';
3
- export declare const machineErrorState: StateNodeConfig<StateMachineContext, StateMachineSchema, StateMachineEvent>;
@@ -1,3 +0,0 @@
1
- import { type StateNodeConfig } from 'xstate';
2
- import { type StateMachineContext, type StateMachineSchema, type StateMachineEvent } from '../types';
3
- export declare const machineProcessedState: StateNodeConfig<StateMachineContext, StateMachineSchema, StateMachineEvent>;
@@ -1,3 +0,0 @@
1
- import { type StateNodeConfig } from 'xstate';
2
- import { type ProcessingStateMachineSchema, type StateMachineContext, type StateMachineEvent } from '../types';
3
- export declare const machineProcessingState: StateNodeConfig<StateMachineContext, ProcessingStateMachineSchema, StateMachineEvent>;
@@ -1,3 +0,0 @@
1
- import { type StateNodeConfig } from 'xstate';
2
- import { type StateMachineContext, type StateMachineSchema, type StateMachineEvent } from '../types';
3
- export declare const machineProcessingFailedState: StateNodeConfig<StateMachineContext, StateMachineSchema, StateMachineEvent>;
@@ -1,3 +0,0 @@
1
- import { type StateNodeConfig } from 'xstate';
2
- import { type StateMachineContext, type StateMachineSchema, type StateMachineEvent } from '../types';
3
- export declare const machineUploadingState: StateNodeConfig<StateMachineContext, StateMachineSchema, StateMachineEvent>;
@@ -1,69 +0,0 @@
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
- export type StateMachineContext = {
4
- currentFileState: FileState;
5
- };
6
- export type StateMachineEvent = {
7
- type: 'UPLOAD_PROGRESS';
8
- progress: number;
9
- } | {
10
- type: 'UPLOAD_END';
11
- } | {
12
- type: 'UPLOAD_ERROR';
13
- message: string;
14
- } | {
15
- type: 'REMOTE_FILESTATE_FETCH';
16
- } | {
17
- type: 'REMOTE_FILESTATE_BYPASS';
18
- } | {
19
- type: 'REMOTE_FILESTATE_RESULT';
20
- fileState: FileState;
21
- } | {
22
- type: 'REMOTE_FILESTATE_PROCESSED';
23
- } | {
24
- type: 'REMOTE_FILESTATE_PROCESSING_FAILED';
25
- } | {
26
- type: 'REMOTE_FILESTATE_ERROR';
27
- };
28
- export type ProcessingStateMachineSchema = StateSchema<StateMachineContext> & {
29
- states: {
30
- loading: StateSchema<StateMachineContext>;
31
- fetchingRemoteFileStates: StateSchema<StateMachineContext>;
32
- idle: StateSchema<StateMachineContext>;
33
- };
34
- };
35
- export type StateMachineSchema = StateSchema<StateMachineContext> & {
36
- states: {
37
- uploading: StateSchema<StateMachineContext>;
38
- processing: ProcessingStateMachineSchema;
39
- processed: StateSchema<StateMachineContext>;
40
- processingFailed: StateSchema<StateMachineContext>;
41
- error: StateSchema<StateMachineContext>;
42
- };
43
- };
44
- export type StateMachineTypestate = {
45
- value: 'uploading';
46
- context: {
47
- currentFileState: UploadingFileState;
48
- };
49
- } | {
50
- value: 'processing';
51
- context: {
52
- currentFileState: ProcessingFileState;
53
- };
54
- } | {
55
- value: 'processed';
56
- context: {
57
- currentFileState: ProcessedFileState;
58
- };
59
- } | {
60
- value: 'processingFailed';
61
- context: {
62
- currentFileState: ProcessingFailedState;
63
- };
64
- } | {
65
- value: 'error';
66
- context: {
67
- currentFileState: ErrorFileState;
68
- };
69
- };
@@ -1,5 +0,0 @@
1
- import { type FileState } from '@atlaskit/media-state';
2
- import { type MediaType } from '../models/media';
3
- export declare const overrideMediaTypeIfUnknown: (fileState: FileState, mediaType?: MediaType) => {
4
- mediaType?: MediaType;
5
- };
@@ -1,3 +0,0 @@
1
- export declare function isPathBasedEnabled(): boolean;
2
- export declare function mapToPathBasedUrl(url: string): string;
3
- export declare function mapRetryUrlToPathBasedUrl(url: string): URL;
@@ -1,11 +0,0 @@
1
- import { BaseMediaClientError } from '../../models/errors';
2
- import { type PollingErrorReason, type PollingErrorAttributes, type PollingErrorMetadata } from './types';
3
- export declare class PollingError extends BaseMediaClientError<PollingErrorReason, PollingErrorMetadata, undefined, PollingErrorAttributes> {
4
- constructor(reason: PollingErrorReason, metadata: PollingErrorMetadata);
5
- /** Will be deprecated. Use the properties `reason` and `metadata` instead */
6
- get attributes(): {
7
- reason: 'pollingMaxAttemptsExceeded';
8
- attempts: number;
9
- };
10
- }
11
- export declare function isPollingError(err?: Error): err is PollingError;