@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,34 +0,0 @@
1
- import { type MediaClientConfig } from '@atlaskit/media-core';
2
- import { type MediaTraceContext } from '@atlaskit/media-common';
3
- import { MediaStore as MediaApi, type MediaStoreGetFileImageParams, type ImageMetadata } from './media-store';
4
- import { type FileFetcher } from './file-fetcher';
5
- import { type UploadEventPayloadMap, type EventPayloadListener } from './events';
6
- import { StargateClient } from './stargate-client';
7
- import { type MobileUpload } from '../models/mobile-upload';
8
- import { type MediaStore } from '@atlaskit/media-state';
9
- export declare class MediaClient {
10
- readonly mediaClientConfig: MediaClientConfig;
11
- private readonly store;
12
- readonly mediaStore: MediaApi;
13
- readonly file: FileFetcher;
14
- readonly stargate: StargateClient;
15
- private readonly eventEmitter;
16
- private mobileUpload?;
17
- readonly config: MediaClientConfig;
18
- constructor(mediaClientConfig: MediaClientConfig, store?: MediaStore, mediaApi?: MediaApi);
19
- /**
20
- * @internal
21
- */
22
- __DO_NOT_USE__getMediaStore(): MediaStore;
23
- getImage(id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean, traceContext?: MediaTraceContext): Promise<Blob>;
24
- getImageUrl(id: string, params?: MediaStoreGetFileImageParams): Promise<string>;
25
- getImageUrlSync(id: string, params?: MediaStoreGetFileImageParams): string;
26
- getClientId(collectionName?: string): Promise<string | undefined>;
27
- getClientIdSync(): string | undefined;
28
- getImageMetadata(id: string, params?: MediaStoreGetFileImageParams): Promise<ImageMetadata>;
29
- mobileUploadPromise(): Promise<MobileUpload>;
30
- removeFileFromCollection(id: string, collectionName: string, occurrenceKey?: string, traceContext?: MediaTraceContext): Promise<void>;
31
- on<E extends keyof UploadEventPayloadMap>(event: E, listener: EventPayloadListener<UploadEventPayloadMap, E>): void;
32
- off<E extends keyof UploadEventPayloadMap>(event: E, listener: EventPayloadListener<UploadEventPayloadMap, E>): void;
33
- emit<E extends keyof UploadEventPayloadMap>(event: E, payload: UploadEventPayloadMap[E]): boolean;
34
- }
@@ -1,56 +0,0 @@
1
- import { type AuthContext, type MediaApiConfig, type Auth } from '@atlaskit/media-core';
2
- import { type MediaTraceContext } from '@atlaskit/media-common';
3
- import { type MediaFileArtifacts } from '@atlaskit/media-state';
4
- import type { ItemsPayload, ImageMetadata, MediaStoreResponse, MediaStoreTouchFileParams, TouchFileDescriptor, MediaStoreTouchFileBody, RejectedTouchFile, MediaStoreRequestOptions, MediaStoreCreateFileFromUploadParams, MediaStoreCreateFileFromUploadBody, MediaStoreGetFileParams, MediaStoreGetFileImageParams, MediaStoreCopyFileWithTokenBody, MediaStoreCopyFileWithTokenParams, AppendChunksToUploadRequestBody, TouchedFiles, MediaApi, CopyFileParams } from './types';
5
- import { type MediaFile, type MediaUpload } from '../../models/media';
6
- import { ChunkHashAlgorithm } from '@atlaskit/media-core';
7
- import { type GetDocumentPageImage, type DocumentPageRangeContent, type GetDocumentContentOptions } from '../../models/document';
8
- export declare class MediaStore implements MediaApi {
9
- private readonly config;
10
- private readonly _chunkHashAlgorithm;
11
- constructor(config: MediaApiConfig);
12
- getClientId(collectionName?: string): Promise<string | undefined>;
13
- getClientIdSync(): string | undefined;
14
- private static extractClientIdFromAuth;
15
- removeCollectionFile(id: string, collectionName: string, occurrenceKey?: string, traceContext?: MediaTraceContext): Promise<void>;
16
- createUpload(createUpTo?: number, collectionName?: string, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaUpload[]>>;
17
- uploadChunk(etag: string, blob: Blob, uploadId: string, partNumber: number, collectionName?: string, traceContext?: MediaTraceContext): Promise<void>;
18
- createFileFromUpload(body: MediaStoreCreateFileFromUploadBody, params?: MediaStoreCreateFileFromUploadParams, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaFile>>;
19
- getRejectedResponseFromDescriptor(descriptor: TouchFileDescriptor, limit: number): RejectedTouchFile;
20
- touchFiles(body: MediaStoreTouchFileBody, params?: MediaStoreTouchFileParams, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<TouchedFiles>>;
21
- getFile(fileId: string, params?: MediaStoreGetFileParams, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaFile>>;
22
- getFileImageURL(id: string, params?: MediaStoreGetFileImageParams): Promise<string>;
23
- getFileImageURLSync(id: string, params?: MediaStoreGetFileImageParams): string;
24
- private createFileImageURL;
25
- getFileBinary(id: string, collectionName?: string, abortController?: AbortController, maxAge?: number): Promise<Blob>;
26
- getFileBinaryURL(id: string, collectionName?: string, maxAge?: number): Promise<string>;
27
- getArtifactURL(artifacts: MediaFileArtifacts, artifactName: keyof MediaFileArtifacts, collectionName?: string, maxAge?: number): Promise<string>;
28
- getArtifactBinary: MediaApi['getArtifactBinary'];
29
- uploadArtifact: MediaApi['uploadArtifact'];
30
- deleteArtifact: MediaApi['deleteArtifact'];
31
- getImage(id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean, traceContext?: MediaTraceContext): Promise<Blob>;
32
- getItems(ids: string[], collectionName?: string, traceContext?: MediaTraceContext, includeHashForDuplicateFiles?: boolean): Promise<MediaStoreResponse<ItemsPayload>>;
33
- getImageMetadata(id: string, params?: MediaStoreGetFileImageParams, traceContext?: MediaTraceContext): Promise<{
34
- metadata: ImageMetadata;
35
- }>;
36
- getDocumentContent(id: string, options: GetDocumentContentOptions, traceContext?: MediaTraceContext): Promise<DocumentPageRangeContent>;
37
- getDocumentPageImage(id: string, options: GetDocumentPageImage, traceContext?: MediaTraceContext): Promise<Blob>;
38
- appendChunksToUpload(uploadId: string, body: AppendChunksToUploadRequestBody, collectionName?: string, traceContext?: MediaTraceContext, options?: {
39
- expectedFileSize?: number;
40
- }): Promise<void>;
41
- copyFileWithToken(body: MediaStoreCopyFileWithTokenBody, params: MediaStoreCopyFileWithTokenParams, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaFile>>;
42
- copyFile(id: string, params: CopyFileParams, traceContext?: MediaTraceContext, clientId?: string): Promise<MediaStoreResponse<MediaFile>>;
43
- registerCopyIntents(files: Array<{
44
- id: string;
45
- collection?: string;
46
- }>, traceContext?: MediaTraceContext, resolvedAuth?: Auth): Promise<void>;
47
- request(path: string, options?: MediaStoreRequestOptions, controller?: AbortController, useMediaCdn?: boolean): Promise<Response>;
48
- testUrl(url: string, options?: {
49
- traceContext?: MediaTraceContext;
50
- }): Promise<void>;
51
- resolveAuth: (authContext?: AuthContext) => Promise<Auth>;
52
- resolveInitialAuth: () => Auth;
53
- get chunkHashAlgorithm(): ChunkHashAlgorithm;
54
- }
55
- export declare const getMediaEnvironment: () => string | undefined;
56
- export declare const getMediaRegion: () => string | undefined;
@@ -1,15 +0,0 @@
1
- import { BaseMediaClientError } from '../../models/errors';
2
- export type MediaStoreErrorReason = 'failedAuthProvider' | 'tokenExpired' | 'missingInitialAuth' | 'emptyAuth' | 'authProviderTimedOut';
3
- export type MediaStoreErrorAttributes = {
4
- readonly reason: MediaStoreErrorReason;
5
- readonly innerError?: Error;
6
- };
7
- export declare class MediaStoreError extends BaseMediaClientError<MediaStoreErrorReason, undefined, Error | undefined, MediaStoreErrorAttributes> {
8
- constructor(reason: MediaStoreErrorReason, innerError?: Error);
9
- /** Will be deprecated. Use the properties `reason` and `metadata` instead */
10
- get attributes(): {
11
- reason: MediaStoreErrorReason;
12
- innerError: Error | undefined;
13
- };
14
- }
15
- export declare function isMediaStoreError(err: Error): err is MediaStoreError;
@@ -1,4 +0,0 @@
1
- export type { MediaStoreErrorReason, MediaStoreErrorAttributes } from './error';
2
- export { MediaStoreError, isMediaStoreError } from './error';
3
- export { MediaStore, getMediaEnvironment, getMediaRegion } from './MediaStore';
4
- export type { ResponseFileItem, EmptyResponseFileItem, ItemsPayload, ImageMetadataArtifact, ImageMetadata, MediaStoreResponse, MediaStoreRequestOptions, MediaStoreCreateFileFromUploadParams, MediaStoreCreateFileParams, MediaStoreTouchFileParams, TouchFileDescriptor, MediaStoreTouchFileBody, MediaStoreCreateFileFromBinaryParams, MediaStoreCreateFileFromUploadConditions, MediaStoreCreateFileFromUploadBody, MediaStoreGetFileParams, MediaStoreGetFileImageParams, SourceFile, MediaStoreCopyFileWithTokenBody, MediaStoreCopyFileWithTokenParams, AppendChunksToUploadRequestBody, CreatedTouchedFile, RejectedTouchFile, RejectionError, TouchedFiles, EmptyFile, MediaApi, } from './types';
@@ -1,4 +0,0 @@
1
- import { type Auth, type AuthContext, type AuthProvider } from '@atlaskit/media-core';
2
- export declare const DEFAULT_AUTH_PROVIDER_TIMEOUT = 10000;
3
- export declare const resolveAuth: (authProvider: AuthProvider, authContext?: AuthContext, authProviderTimeout?: number) => Promise<Auth>;
4
- export declare const resolveInitialAuth: (auth?: Auth) => Auth;
@@ -1,207 +0,0 @@
1
- import { type Auth, type AsapBasedAuth, type AuthContext, type ClientAltBasedAuth } from '@atlaskit/media-core';
2
- import { type SSR, type MediaTraceContext } from '@atlaskit/media-common';
3
- import { type MediaFileArtifacts } from '@atlaskit/media-state';
4
- import { type MediaItemDetails, type MediaFile, type MediaUpload } from '../../models/media';
5
- import { type ClientOptions, type RequestHeaders, type RequestMethod, type RequestParams, type RequestMetadata } from '../../utils/request/types';
6
- import { type ChunkHashAlgorithm } from '@atlaskit/media-core';
7
- import { type DocumentPageRangeContent, type GetDocumentPageImage, type GetDocumentContentOptions } from '../../models/document';
8
- export interface ResponseFileItem {
9
- id: string;
10
- type: 'file';
11
- details: MediaItemDetails;
12
- collection?: string;
13
- metadataTraceContext?: MediaTraceContext;
14
- }
15
- export interface EmptyResponseFileItem {
16
- id: string;
17
- type: 'not-found';
18
- collection?: string;
19
- metadataTraceContext?: MediaTraceContext;
20
- }
21
- export interface ItemsPayload {
22
- items: ResponseFileItem[];
23
- }
24
- export type ImageMetadataArtifact = {
25
- url?: string;
26
- width?: number;
27
- height?: number;
28
- size?: number;
29
- };
30
- export interface ImageMetadata {
31
- pending: boolean;
32
- preview?: ImageMetadataArtifact;
33
- original?: ImageMetadataArtifact;
34
- }
35
- export interface MediaStoreResponse<Data> {
36
- readonly data: Data;
37
- }
38
- export type MediaStoreRequestOptions = RequestMetadata & {
39
- readonly method?: RequestMethod;
40
- readonly authContext?: AuthContext;
41
- readonly resolvedAuth?: Auth;
42
- readonly params?: RequestParams;
43
- readonly headers?: RequestHeaders;
44
- readonly body?: any;
45
- readonly clientOptions?: ClientOptions;
46
- readonly traceContext?: MediaTraceContext;
47
- readonly ChunkhashAlgorithm?: ChunkHashAlgorithm;
48
- readonly addMediaClientParam?: boolean;
49
- };
50
- export type MediaStoreCreateFileFromUploadParams = {
51
- readonly collection?: string;
52
- readonly occurrenceKey?: string;
53
- readonly expireAfter?: number;
54
- readonly replaceFileId?: string;
55
- readonly skipConversions?: boolean;
56
- };
57
- export type MediaStoreCreateFileParams = {
58
- readonly occurrenceKey?: string;
59
- readonly collection?: string;
60
- };
61
- export interface MediaStoreTouchFileParams {
62
- readonly collection?: string;
63
- }
64
- export interface TouchFileDescriptor {
65
- fileId: string;
66
- collection?: string;
67
- occurrenceKey?: string;
68
- expireAfter?: number;
69
- deletable?: boolean;
70
- size?: number;
71
- }
72
- export interface MediaStoreTouchFileBody {
73
- descriptors: TouchFileDescriptor[];
74
- }
75
- export type MediaStoreCreateFileFromBinaryParams = {
76
- readonly replaceFileId?: string;
77
- readonly collection?: string;
78
- readonly occurrenceKey?: string;
79
- readonly expireAfter?: number;
80
- readonly skipConversions?: boolean;
81
- readonly name?: string;
82
- };
83
- export type MediaStoreCreateFileFromUploadConditions = {
84
- readonly hash?: string;
85
- readonly size?: number;
86
- };
87
- export type MediaStoreCreateFileFromUploadBody = {
88
- readonly uploadId: string;
89
- readonly name?: string;
90
- readonly mimeType?: string;
91
- readonly conditions?: MediaStoreCreateFileFromUploadConditions;
92
- };
93
- export type MediaStoreGetFileParams = {
94
- readonly version?: number;
95
- readonly collection?: string;
96
- };
97
- export type MediaStoreGetFileImageParams = {
98
- readonly allowAnimated?: boolean;
99
- readonly version?: number;
100
- readonly collection?: string;
101
- readonly width?: number;
102
- readonly height?: number;
103
- readonly mode?: 'fit' | 'full-fit' | 'crop';
104
- readonly upscale?: boolean;
105
- readonly 'max-age'?: number;
106
- readonly source?: string;
107
- readonly ssr?: SSR;
108
- };
109
- export interface SourceFile {
110
- id: string;
111
- owner: ClientAltBasedAuth | AsapBasedAuth;
112
- collection?: string;
113
- version?: number;
114
- }
115
- export type MediaStoreCopyFileWithTokenBody = {
116
- sourceFile: SourceFile;
117
- };
118
- export type CopyFileParams = {
119
- sourceCollection?: string;
120
- collection?: string;
121
- replaceFileId?: string;
122
- };
123
- export type MediaStoreCopyFileWithTokenParams = {
124
- readonly collection?: string;
125
- readonly replaceFileId?: string;
126
- readonly occurrenceKey?: string;
127
- };
128
- export type AppendChunksToUploadRequestBody = {
129
- readonly chunks: string[];
130
- readonly hash?: string;
131
- readonly offset?: number;
132
- };
133
- export interface CreatedTouchedFile {
134
- fileId: string;
135
- uploadId: string;
136
- }
137
- export interface RejectedTouchFile {
138
- fileId: string;
139
- error: RejectionError;
140
- }
141
- export type RejectionError = {
142
- code: 'ExceedMaxFileSizeLimit';
143
- title: string;
144
- href: string;
145
- limit: number;
146
- size: number;
147
- };
148
- export type TouchedFiles = {
149
- created: CreatedTouchedFile[];
150
- rejected?: RejectedTouchFile[];
151
- };
152
- export interface EmptyFile {
153
- readonly id: string;
154
- readonly createdAt: number;
155
- }
156
- export type GetArtifactBinaryOptions = {
157
- collectionName?: string;
158
- abortController?: AbortController;
159
- maxAge?: number;
160
- traceContext?: MediaTraceContext;
161
- };
162
- export type UploadArtifactCaptionsParams = {
163
- type: 'caption';
164
- language: string;
165
- };
166
- export type UploadArtifactParams = UploadArtifactCaptionsParams;
167
- export interface MediaApi {
168
- removeCollectionFile: (id: string, collectionName: string, occurrenceKey?: string, traceContext?: MediaTraceContext) => Promise<void>;
169
- createUpload: (createUpTo: number, collectionName?: string, traceContext?: MediaTraceContext, chunkChunkHashAlgorithm?: ChunkHashAlgorithm) => Promise<MediaStoreResponse<MediaUpload[]>>;
170
- uploadChunk: (etag: string, blob: Blob, uploadId: string, partNumber: number, collectionName?: string, traceContext?: MediaTraceContext) => Promise<void>;
171
- createFileFromUpload: (body: MediaStoreCreateFileFromUploadBody, params: MediaStoreCreateFileFromUploadParams, traceContext?: MediaTraceContext) => Promise<MediaStoreResponse<MediaFile>>;
172
- getRejectedResponseFromDescriptor: (descriptor: TouchFileDescriptor, limit: number) => RejectedTouchFile;
173
- touchFiles: (body: MediaStoreTouchFileBody, params: MediaStoreTouchFileParams, traceContext?: MediaTraceContext) => Promise<MediaStoreResponse<TouchedFiles>>;
174
- getFile: (fileId: string, params: MediaStoreGetFileParams, traceContext?: MediaTraceContext) => Promise<MediaStoreResponse<MediaFile>>;
175
- getFileImageURL: (id: string, params?: MediaStoreGetFileImageParams) => Promise<string>;
176
- getFileImageURLSync: (id: string, params?: MediaStoreGetFileImageParams) => string;
177
- getFileBinary: (id: string, collectionName?: string, abortController?: AbortController) => Promise<Blob>;
178
- getFileBinaryURL: (id: string, collectionName?: string) => Promise<string>;
179
- getArtifactURL: (artifacts: MediaFileArtifacts, artifactName: keyof MediaFileArtifacts, collectionName?: string) => Promise<string>;
180
- getArtifactBinary(artifacts: MediaFileArtifacts, artifactName: keyof MediaFileArtifacts, options: GetArtifactBinaryOptions): Promise<Blob>;
181
- uploadArtifact(id: string, file: File, params: UploadArtifactParams, collectionName?: string, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaItemDetails>>;
182
- deleteArtifact(id: string, artifactName: string, collectionName?: string, traceContext?: MediaTraceContext): Promise<void>;
183
- getImage: (id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean, traceContext?: MediaTraceContext) => Promise<Blob>;
184
- getItems: (ids: string[], collectionName?: string, traceContext?: MediaTraceContext, includeHashForDuplicateFiles?: boolean) => Promise<MediaStoreResponse<ItemsPayload>>;
185
- getImageMetadata: (id: string, params?: MediaStoreGetFileImageParams, traceContext?: MediaTraceContext) => Promise<{
186
- metadata: ImageMetadata;
187
- }>;
188
- appendChunksToUpload: (uploadId: string, body: AppendChunksToUploadRequestBody, collectionName?: string, traceContext?: MediaTraceContext, options?: {
189
- expectedFileSize?: number;
190
- }) => Promise<void>;
191
- copyFileWithToken: (body: MediaStoreCopyFileWithTokenBody, params: MediaStoreCopyFileWithTokenParams, traceContext?: MediaTraceContext) => Promise<MediaStoreResponse<MediaFile>>;
192
- copyFile: (id: string, params: CopyFileParams) => Promise<MediaStoreResponse<MediaFile>>;
193
- registerCopyIntents: (files: Array<{
194
- id: string;
195
- collection: string;
196
- }>, traceContext?: MediaTraceContext, resolvedAuth?: Auth) => Promise<void>;
197
- request: (path: string, options: MediaStoreRequestOptions, controller?: AbortController) => Promise<Response>;
198
- testUrl: (url: string, options?: {
199
- traceContext?: MediaTraceContext;
200
- }) => Promise<void>;
201
- resolveAuth: (authContext?: AuthContext) => Promise<Auth>;
202
- resolveInitialAuth: () => Auth;
203
- /** @exprimental This is exprimental for the purposes of enabling the document viewer and not ready for external use, it is prone to breaking changes */
204
- getDocumentContent(id: string, options: GetDocumentContentOptions, traceContext?: MediaTraceContext): Promise<DocumentPageRangeContent>;
205
- /** @exprimental This is exprimental for the purposes of enabling the document viewer and not ready for external use, it is prone to breaking changes */
206
- getDocumentPageImage(id: string, options: GetDocumentPageImage, traceContext?: MediaTraceContext): Promise<Blob>;
207
- }
@@ -1,15 +0,0 @@
1
- import { type MediaStore } from '@atlaskit/media-state';
2
- import { type MobileUpload, type MobileUploadStartEvent, type MobileUploadProgressEvent, type MobileUploadEndEvent, type MobileUploadErrorEvent } from '../models/mobile-upload';
3
- import { type MediaStore as MediaApi } from './media-store';
4
- export declare class MobileUploadImpl implements MobileUpload {
5
- private readonly store;
6
- private readonly dataloader;
7
- private readonly servicesCache;
8
- constructor(mediaApi: MediaApi, store?: MediaStore);
9
- notifyUploadStart(event: MobileUploadStartEvent): void;
10
- notifyUploadProgress(event: MobileUploadProgressEvent): void;
11
- notifyUploadEnd(event: MobileUploadEndEvent): void;
12
- notifyUploadError(event: MobileUploadErrorEvent): void;
13
- private getErrorFileState;
14
- private setFileState;
15
- }
@@ -1,15 +0,0 @@
1
- export interface EdgeData {
2
- data: {
3
- clientId: string;
4
- token: string;
5
- baseUrl: string;
6
- expiresIn: number;
7
- iat: number;
8
- };
9
- }
10
- export declare class StargateClient {
11
- private baseUrl;
12
- constructor(baseUrl: string | undefined);
13
- fetchToken(clientId: string): Promise<EdgeData>;
14
- isTokenExpired(token: EdgeData): boolean;
15
- }
@@ -1,6 +0,0 @@
1
- export declare const RECENTS_COLLECTION = "recents";
2
- export declare const FILE_CACHE_MAX_AGE: number;
3
- export declare const MAX_RESOLUTION = 4096;
4
- export declare const CHUNK_SIZE: number;
5
- export declare const PROCESSING_BATCH_SIZE = 1000;
6
- export declare const MAX_UPLOAD_FILE_SIZE: number;
@@ -1,15 +0,0 @@
1
- import { type LRUMap } from 'lru_map';
2
- import { type ReplaySubject } from 'rxjs/ReplaySubject';
3
- import { type FileState } from '@atlaskit/media-state';
4
- export declare class StreamsCache<T> {
5
- private readonly streams;
6
- constructor(streams: LRUMap<string, ReplaySubject<T>>);
7
- has(id: string): boolean;
8
- set(id: string, stream: ReplaySubject<T>): void;
9
- get(id: string): ReplaySubject<T> | undefined;
10
- getOrInsert(id: string, callback: () => ReplaySubject<T>): ReplaySubject<T>;
11
- removeAll(): void;
12
- remove(id: string): void;
13
- get size(): number;
14
- }
15
- export declare const getFileStreamsCache: () => StreamsCache<FileState>;
@@ -1,6 +0,0 @@
1
- import { type UploadEventPayloadMap, type EventPayloadListener } from './client/events';
2
- export declare const globalMediaEventEmitter: {
3
- on<E extends keyof UploadEventPayloadMap>(event: E, listener: EventPayloadListener<UploadEventPayloadMap, E>): void;
4
- off<E extends keyof UploadEventPayloadMap>(event: E, listener: EventPayloadListener<UploadEventPayloadMap, E>): void;
5
- emit<E extends keyof UploadEventPayloadMap>(event: E, payload: UploadEventPayloadMap[E]): boolean | undefined;
6
- };
@@ -1,15 +0,0 @@
1
- export type Identifier = FileIdentifier | ExternalImageIdentifier;
2
- export interface FileIdentifier {
3
- readonly mediaItemType: 'file';
4
- readonly id: string;
5
- readonly occurrenceKey?: string;
6
- readonly collectionName?: string;
7
- }
8
- export interface ExternalImageIdentifier {
9
- readonly mediaItemType: 'external-image';
10
- readonly dataURI: string;
11
- readonly name?: string;
12
- }
13
- export declare const isFileIdentifier: (identifier: Identifier) => identifier is FileIdentifier;
14
- export declare const isExternalImageIdentifier: (identifier: Identifier) => identifier is ExternalImageIdentifier;
15
- export declare const isDifferentIdentifier: (a: Identifier, b: Identifier) => boolean;
@@ -1,45 +0,0 @@
1
- export { MediaStore, MediaStoreError, isMediaStoreError, getMediaEnvironment, getMediaRegion, } from './client/media-store';
2
- export type { ResponseFileItem, EmptyResponseFileItem, ItemsPayload, ImageMetadataArtifact, ImageMetadata, MediaStoreResponse, MediaStoreRequestOptions, MediaStoreCreateFileFromUploadParams, MediaStoreCreateFileParams, MediaStoreTouchFileParams, TouchFileDescriptor, MediaStoreTouchFileBody, MediaStoreCreateFileFromBinaryParams, MediaStoreCreateFileFromUploadConditions, MediaStoreCreateFileFromUploadBody, MediaStoreGetFileParams, MediaStoreGetFileImageParams, SourceFile, MediaStoreCopyFileWithTokenBody, MediaStoreCopyFileWithTokenParams, AppendChunksToUploadRequestBody, CreatedTouchedFile, TouchedFiles, EmptyFile, MediaStoreErrorReason, MediaStoreErrorAttributes, MediaApi, } from './client/media-store';
3
- export { UploadController } from './upload-controller';
4
- export type { AbortFunction } from './upload-controller';
5
- export type { MediaItemType, FileItem, FileProcessingStatus, MediaArtifact, Artifacts, FileDetails, } from './models/item';
6
- export { isPreviewableType } from './models/media';
7
- export type { MediaFileProcessingStatus, MediaType, MediaFile, MediaRepresentations, MediaItemDetails, MediaUpload, } from './models/media';
8
- export { getArtifactUrl } from './models/artifacts';
9
- export { isMediaClientError, getMediaClientErrorReason, isCommonMediaClientError, toCommonMediaClientError, } from './models/errors';
10
- export type { MediaClientError, MediaClientErrorReason, MediaClientErrorAttributes, } from './models/errors';
11
- export { isUploadingFileState, isProcessingFileState, isProcessedFileState, isErrorFileState, isPreviewableFileState, isFinalFileState, isImageRepresentationReady, isNonErrorFinalFileState, mapMediaFileToFileState, mapMediaItemToFileState, hasArtifacts, } from './models/file-state';
12
- export type { FileStatus, PreviewOptions, GetFileOptions, NonErrorFileState, PreviewableFileState, } from './models/file-state';
13
- export type { FileState, FilePreview, ErrorFileState, UploadingFileState, ProcessingFileState, ProcessedFileState, ProcessingFailedState, MediaFileArtifact, MediaFileArtifacts, } from '@atlaskit/media-state';
14
- export type { MobileUpload, MobileUploadStartEvent, MobileUploadProgressEvent, MobileUploadEndEvent, MobileUploadErrorEvent, } from './models/mobile-upload';
15
- export { uploadFile } from './uploader';
16
- export type { UploadableFile, UploadableFileUpfrontIds, UploadFileCallbacks, UploadFileResult, } from './uploader';
17
- export { request, RequestError, isRequestError, isRateLimitedError, createRequestErrorReason, } from './utils/request';
18
- export type { RequestErrorReason, RequestErrorMetadata, RequestErrorAttributes, } from './utils/request';
19
- export { isAbortedRequestError, createUrl } from './utils/request/helpers';
20
- export { PollingFunction, isPollingError, PollingError } from './utils/polling';
21
- export type { Executor, PollingErrorAttributes, PollingErrorReason } from './utils/polling/types';
22
- export type { RequestMethod, RequestParams, RequestHeaders, RetryOptions, ClientOptions, RequestMetadata, RequestOptions, CreateUrlOptions, } from './utils/request/types';
23
- export type { ImageResizeMode } from './utils/imageResizeModeToFileImageMode';
24
- export { imageResizeModeToFileImageMode } from './utils/imageResizeModeToFileImageMode';
25
- export { FileFetcherImpl, FileFetcherError, isFileFetcherError } from './client/file-fetcher';
26
- export type { CopySourceFile, CopyDestination, CopyFileOptions, FileFetcher, FileFetcherErrorAttributes, FileFetcherErrorReason, } from './client/file-fetcher';
27
- export { MediaClient } from './client/media-client';
28
- export { StargateClient } from './client/stargate-client';
29
- export type { EdgeData } from './client/stargate-client';
30
- export { checkWebpSupport } from './utils/checkWebpSupport';
31
- export { getDimensionsFromBlob } from './utils/getDimensionsFromBlob';
32
- export type { Dimensions } from './utils/getDimensionsFromBlob';
33
- export { createMediaSubject } from './utils/createMediaSubject';
34
- export { isFileIdentifier, isExternalImageIdentifier, isDifferentIdentifier } from './identifier';
35
- export type { Identifier, FileIdentifier, ExternalImageIdentifier } from './identifier';
36
- export type { EventPayloadListener, UploadEventPayloadMap, MediaViewedEventPayload, AuthProviderSucceededEventPayload, AuthProviderFailedEventPayload, } from './client/events';
37
- export type { MediaClientConfig } from '@atlaskit/media-core';
38
- export { globalMediaEventEmitter } from './globalMediaEventEmitter';
39
- export { isMediaBlobUrl, getAttrsFromUrl, addFileAttrsToUrl, objectToQueryString, } from './utils/url';
40
- export type { MediaBlobUrlAttrs } from './utils/url';
41
- export { createMediaSubscribable, fromObservable } from './utils/mediaSubscribable';
42
- export type { MediaSubscribable, MediaSubscription, MediaObserver, } from './utils/mediaSubscribable';
43
- export { RECENTS_COLLECTION, MAX_RESOLUTION } from './constants';
44
- export { getFileStreamsCache } from './file-streams-cache';
45
- export { ChunkHashAlgorithm } from '@atlaskit/media-core';
@@ -1,2 +0,0 @@
1
- import { type MediaFileArtifacts } from '@atlaskit/media-state';
2
- export declare const getArtifactUrl: (artifacts: MediaFileArtifacts, prop: keyof MediaFileArtifacts) => string | undefined;
@@ -1,11 +0,0 @@
1
- import { type Auth } from '@atlaskit/media-core';
2
- export interface ClientBasedAuthHeaders {
3
- readonly 'X-Client-Id': string;
4
- readonly Authorization: string;
5
- }
6
- export interface AsapBasedAuthHeaders {
7
- readonly 'X-Issuer': string;
8
- readonly Authorization: string;
9
- }
10
- export type AuthHeaders = ClientBasedAuthHeaders | AsapBasedAuthHeaders;
11
- export declare function mapAuthToAuthHeaders(auth: Auth): AuthHeaders;
@@ -1,11 +0,0 @@
1
- import { type Auth } from '@atlaskit/media-core';
2
- export interface ClientBasedQueryParameters {
3
- readonly client: string;
4
- readonly token: string;
5
- }
6
- export interface AsapBasedQueryParameters {
7
- readonly issuer: string;
8
- readonly token: string;
9
- }
10
- export type AuthQueryParameters = ClientBasedQueryParameters | AsapBasedQueryParameters;
11
- export declare function mapAuthToQueryParameters(auth: Auth): AuthQueryParameters;
@@ -1,95 +0,0 @@
1
- export type Font = {
2
- name: string;
3
- size: number;
4
- weight: number;
5
- is_all_caps: boolean;
6
- is_bold_reenforced: boolean;
7
- is_cursive: boolean;
8
- is_fixed_pitch: boolean;
9
- is_italic: boolean;
10
- is_non_symbolic: boolean;
11
- is_proportional_pitch: boolean;
12
- is_sans_serif: boolean;
13
- is_serif: boolean;
14
- is_small_caps: boolean;
15
- is_symbolic: boolean;
16
- };
17
- export type Span = {
18
- text: string;
19
- fi: number;
20
- r: number;
21
- x: number;
22
- y: number;
23
- h: number;
24
- l: number;
25
- };
26
- export type Line = {
27
- r: number;
28
- spans: readonly Span[];
29
- };
30
- export type DocumentAnnotations = {
31
- text_form_fields: readonly TextField[];
32
- combobox_form_fields: readonly ComboBoxField[];
33
- };
34
- export type TextField = {
35
- x: number;
36
- y: number;
37
- w: number;
38
- h: number;
39
- f: number;
40
- text: string;
41
- multiline: boolean;
42
- };
43
- export type ComboBoxField = {
44
- x: number;
45
- y: number;
46
- w: number;
47
- h: number;
48
- f: number;
49
- text: string;
50
- };
51
- export type DocumentLink = {
52
- type: 'uri';
53
- dest: string;
54
- x: number;
55
- y: number;
56
- w: number;
57
- h: number;
58
- } | {
59
- type: 'local';
60
- p_num: number;
61
- x: number;
62
- y: number;
63
- w: number;
64
- h: number;
65
- };
66
- export type DocumentPageContent = {
67
- rotation: number;
68
- width: number;
69
- height: number;
70
- lines: readonly Line[];
71
- annotations: DocumentAnnotations;
72
- links: readonly DocumentLink[];
73
- password?: string;
74
- };
75
- export type DocumentPageRangeContent = {
76
- total_pages: number;
77
- start_index: number;
78
- end_index: number;
79
- fonts: readonly Font[];
80
- pages: readonly DocumentPageContent[];
81
- };
82
- export type GetDocumentContentOptions = {
83
- pageStart: number;
84
- pageEnd: number;
85
- collectionName?: string;
86
- maxAge?: number;
87
- password?: string;
88
- };
89
- export type GetDocumentPageImage = {
90
- page: number;
91
- zoom: number;
92
- collectionName?: string;
93
- maxAge?: number;
94
- password?: string;
95
- };
@@ -1,6 +0,0 @@
1
- export type { MediaClientError, MediaClientErrorReason } from './types';
2
- import { type MediaClientError, type MediaClientErrorReason } from './types';
3
- export declare function isMediaClientError(error: any): error is MediaClientError<{
4
- reason: MediaClientErrorReason;
5
- }>;
6
- export declare function getMediaClientErrorReason(err: Error): MediaClientErrorReason | 'unknown';
@@ -1,24 +0,0 @@
1
- import type { ErrorFileState } from '@atlaskit/media-state';
2
- import type { MediaClientError, MediaClientErrorAttributes, MediaClientErrorReason, MediaClientErrorMetadata } from './types';
3
- export type { MediaClientError, MediaClientErrorReason, MediaClientErrorAttributes } from './types';
4
- export { isMediaClientError, getMediaClientErrorReason } from './helpers';
5
- /**
6
- * Base class for media errors
7
- */
8
- export declare abstract class BaseMediaClientError<Reason extends MediaClientErrorReason, Metadata extends MediaClientErrorMetadata | undefined, InnerError extends Error | undefined, Attributes extends MediaClientErrorAttributes> extends Error implements MediaClientError<Attributes> {
9
- readonly reason: Reason;
10
- readonly metadata: Metadata;
11
- readonly innerError: InnerError;
12
- constructor(reason: Reason, metadata: Metadata, innerError: InnerError);
13
- abstract get attributes(): Attributes;
14
- }
15
- /** Generic Media Client Erorr. All errors extending BaseMediaClientError match CommonMediaClientError attributes. Used to deserialize ErrorFileState */
16
- export declare class CommonMediaClientError extends BaseMediaClientError<MediaClientErrorReason, MediaClientErrorMetadata | undefined, Error | undefined, MediaClientErrorAttributes> {
17
- constructor(reason: MediaClientErrorReason, metadata?: MediaClientErrorMetadata, innerError?: Error);
18
- get attributes(): MediaClientErrorAttributes;
19
- }
20
- export declare function isCommonMediaClientError(error: any): error is BaseMediaClientError<MediaClientErrorReason, MediaClientErrorMetadata | undefined, Error | undefined, MediaClientErrorAttributes>;
21
- /** Deserializer ErrorFileState -> CommonMediaClientError */
22
- export declare const toCommonMediaClientError: (errorFileState: ErrorFileState) => CommonMediaClientError;
23
- /** Serializer CommonMediaClientError -> ErrorFileState */
24
- export declare const fromCommonMediaClientError: (id: string, occurrenceKey: string | undefined, error: CommonMediaClientError) => ErrorFileState;
@@ -1,22 +0,0 @@
1
- import { type MediaTraceContext } from '@atlaskit/media-common';
2
- export interface SerializableObject {
3
- [key: string]: string | number | boolean | null | undefined | SerializableObject;
4
- }
5
- export type MediaClientErrorReason = 'clientOffline' | 'clientAbortedRequest' | 'clientTimeoutRequest' | 'serverInvalidBody' | 'serverBadRequest' | 'serverUnauthorized' | 'serverForbidden' | 'serverNotFound' | 'serverRateLimited' | 'serverInternalError' | 'serverBadGateway' | 'serverUnexpectedError' | 'serverUnprocessableEntity' | 'serverEntityLocked' | 'failedAuthProvider' | 'tokenExpired' | 'missingInitialAuth' | 'emptyAuth' | 'authProviderTimedOut' | 'invalidFileId' | 'emptyItems' | 'zeroVersionFile' | 'emptyFileName' | 'pollingMaxAttemptsExceeded' | 'fileSizeExceedsLimit' | 'deprecatedEndpoint';
6
- export type MediaClientErrorMetadata = SerializableObject & {
7
- traceContext?: MediaTraceContext;
8
- };
9
- export interface MediaClientErrorAttributes {
10
- reason: MediaClientErrorReason;
11
- }
12
- /**
13
- * MediaClientError is the main interface which all the errors
14
- * in Media Client must implement.
15
- * MediaClientErrorReason is a dictionary that restricts all the possible
16
- * reasons that the erros can define. Its values are private to this file.
17
- * Any new error has to define its own Error Reasons locally, and also declare them
18
- * here to comply with the interface restrictions
19
- */
20
- export interface MediaClientError<Attributes extends MediaClientErrorAttributes> extends Error {
21
- readonly attributes: Attributes;
22
- }