@aws-amplify/ui-react-storage 0.0.0-studio-console-80bb2e2-20230921222703 → 0.0.0-theming-v2-f8422a3-20240627193426
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/components/StorageImage/StorageImage.mjs +57 -1
- package/dist/esm/components/StorageManager/StorageManager.mjs +181 -1
- package/dist/esm/components/StorageManager/hooks/useStorageManager/actions.mjs +35 -1
- package/dist/esm/components/StorageManager/hooks/useStorageManager/reducer.mjs +132 -1
- package/dist/esm/components/StorageManager/hooks/useStorageManager/types.mjs +12 -1
- package/dist/esm/components/StorageManager/hooks/useStorageManager/useStorageManager.mjs +58 -1
- package/dist/esm/components/StorageManager/hooks/useUploadFiles/useUploadFiles.mjs +74 -1
- package/dist/esm/components/StorageManager/types.mjs +11 -1
- package/dist/esm/components/StorageManager/ui/Container/Container.mjs +8 -1
- package/dist/esm/components/StorageManager/ui/DropZone/DropZone.mjs +16 -1
- package/dist/esm/components/StorageManager/ui/FileList/FileControl.mjs +23 -1
- package/dist/esm/components/StorageManager/ui/FileList/FileDetails.mjs +15 -1
- package/dist/esm/components/StorageManager/ui/FileList/FileList.mjs +44 -1
- package/dist/esm/components/StorageManager/ui/FileList/FileRemoveButton.mjs +12 -1
- package/dist/esm/components/StorageManager/ui/FileList/FileStatusMessage.mjs +28 -1
- package/dist/esm/components/StorageManager/ui/FileList/FileThumbnail.mjs +12 -1
- package/dist/esm/components/StorageManager/ui/FileListFooter/FileListFooter.mjs +13 -1
- package/dist/esm/components/StorageManager/ui/FileListHeader/FileListHeader.mjs +14 -1
- package/dist/esm/components/StorageManager/ui/FilePicker/FilePicker.mjs +9 -1
- package/dist/esm/components/StorageManager/utils/checkMaxFileSize.mjs +12 -1
- package/dist/esm/components/StorageManager/utils/displayText.mjs +39 -1
- package/dist/esm/components/StorageManager/utils/filterAllowedFiles.mjs +27 -1
- package/dist/esm/components/StorageManager/utils/getInput.mjs +25 -0
- package/dist/esm/components/StorageManager/utils/humanFileSize.mjs +29 -1
- package/dist/esm/components/StorageManager/utils/resolveFile.mjs +20 -0
- package/dist/esm/components/StorageManager/utils/uploadFile.mjs +26 -1
- package/dist/esm/index.mjs +2 -1
- package/dist/esm/version.mjs +3 -0
- package/dist/index.js +832 -1
- package/dist/styles.css +462 -370
- package/dist/types/components/StorageImage/StorageImage.d.ts +6 -2
- package/dist/types/components/StorageImage/types.d.ts +33 -2
- package/dist/types/components/StorageManager/StorageManager.d.ts +5 -2
- package/dist/types/components/StorageManager/hooks/useStorageManager/actions.d.ts +2 -5
- package/dist/types/components/StorageManager/hooks/useStorageManager/types.d.ts +1 -1
- package/dist/types/components/StorageManager/hooks/useStorageManager/useStorageManager.d.ts +2 -5
- package/dist/types/components/StorageManager/hooks/useUploadFiles/useUploadFiles.d.ts +5 -2
- package/dist/types/components/StorageManager/types.d.ts +17 -11
- package/dist/types/components/StorageManager/ui/FileList/types.d.ts +7 -17
- package/dist/types/components/StorageManager/ui/FileListFooter/FileListFooter.d.ts +2 -2
- package/dist/types/components/StorageManager/ui/FileListHeader/FileListHeader.d.ts +2 -2
- package/dist/types/components/StorageManager/utils/displayText.d.ts +22 -20
- package/dist/types/components/StorageManager/utils/getInput.d.ts +13 -0
- package/dist/types/components/StorageManager/utils/index.d.ts +3 -2
- package/dist/types/components/StorageManager/utils/resolveFile.d.ts +9 -0
- package/dist/types/components/StorageManager/utils/uploadFile.d.ts +30 -17
- package/dist/types/version.d.ts +1 -0
- package/package.json +9 -40
- package/dist/esm/components/StorageManager/hooks/useUploadFiles/resolveFile.mjs +0 -1
- package/dist/types/components/StorageImage/_tests_/StorageImage.test.d.ts +0 -1
- package/dist/types/components/StorageManager/hooks/useUploadFiles/resolveFile.d.ts +0 -10
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { StorageImageProps } from './types';
|
|
3
|
-
export declare const
|
|
2
|
+
import type { StorageImageProps, StorageImagePathProps } from './types';
|
|
3
|
+
export declare const MISSING_REQUIRED_PROP_MESSAGE = "`StorageImage` requires either an `imgKey` or `path` prop.";
|
|
4
|
+
export declare const HAS_DEPRECATED_PROPS_MESSAGE = "`imgKey`, `accessLevel`, and `identityId` will be replaced with `path` in a future major version. See https://ui.docs.amplify.aws/react/connected-components/storage/storageimage#props";
|
|
5
|
+
export declare const HAS_PATH_AND_KEY_MESSAGE = "`imgKey` is ignored when both `imgKey` and `path` props are provided.";
|
|
6
|
+
export declare const HAS_PATH_AND_UNSUPPORTED_OPTIONS_MESSAGE = "`accessLevel` and `identityId` are ignored when the `path` prop is provided.";
|
|
7
|
+
export declare const StorageImage: ({ accessLevel, className, fallbackSrc, identityId, imgKey, path, onStorageGetError, onGetUrlError, validateObjectExistence, ...rest }: StorageImageProps | StorageImagePathProps) => JSX.Element;
|
|
@@ -1,9 +1,40 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { StorageAccessLevel } from '@aws-amplify/core';
|
|
2
|
+
import { ImageProps } from '@aws-amplify/ui-react';
|
|
3
3
|
export interface StorageImageProps extends Omit<ImageProps, 'src'> {
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated
|
|
6
|
+
* `imgKey` will be replaced with `path` in a future major version of Amplify UI. See https://ui.docs.amplify.aws/react/connected-components/storage/storageimage#props
|
|
7
|
+
*/
|
|
4
8
|
imgKey: string;
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated
|
|
11
|
+
* `accessLevel` will be replaced with `path` in a future major version of Amplify UI. See https://ui.docs.amplify.aws/react/connected-components/storage/storageimage#props
|
|
12
|
+
*/
|
|
5
13
|
accessLevel: StorageAccessLevel;
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated
|
|
16
|
+
* `identityId` will be replaced with `path` in a future major version of Amplify UI. See https://ui.docs.amplify.aws/react/connected-components/storage/storageimage#props
|
|
17
|
+
*/
|
|
6
18
|
identityId?: string;
|
|
7
19
|
fallbackSrc?: string;
|
|
20
|
+
validateObjectExistence?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated use `onGetUrlError`
|
|
23
|
+
*
|
|
24
|
+
* `onStorageGetError` will be replaced with `onGetUrlError` in a future major version of Amplify UI. See https://ui.docs.amplify.aws/react/connected-components/storage/storageimage#props
|
|
25
|
+
*/
|
|
8
26
|
onStorageGetError?: (error: Error) => void;
|
|
27
|
+
onGetUrlError?: (error: Error) => void;
|
|
28
|
+
path?: never;
|
|
9
29
|
}
|
|
30
|
+
type OmittedPropKey = 'accessLevel' | 'imgKey' | 'identityId' | 'onStorageGetError' | 'path';
|
|
31
|
+
export interface StorageImagePathProps extends Omit<StorageImageProps, OmittedPropKey> {
|
|
32
|
+
path: string | ((input: {
|
|
33
|
+
identityId?: string;
|
|
34
|
+
}) => string);
|
|
35
|
+
imgKey?: never;
|
|
36
|
+
accessLevel?: never;
|
|
37
|
+
identityId?: never;
|
|
38
|
+
onStorageGetError?: never;
|
|
39
|
+
}
|
|
40
|
+
export {};
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { StorageManagerProps, StorageManagerHandle } from './types';
|
|
2
|
+
import { StorageManagerProps, StorageManagerPathProps, StorageManagerHandle } from './types';
|
|
3
3
|
import { Container, DropZone, FileList, FileListHeader, FileListFooter, FilePicker } from './ui';
|
|
4
|
-
declare const StorageManager
|
|
4
|
+
export declare const MISSING_REQUIRED_PROPS_MESSAGE = "`StorageManager` requires a `maxFileCount` prop to be provided.";
|
|
5
|
+
export declare const ACCESS_LEVEL_WITH_PATH_CALLBACK_MESSAGE = "`StorageManager` does not allow usage of a `path` callback prop with an `accessLevel` prop.";
|
|
6
|
+
export declare const ACCESS_LEVEL_DEPRECATION_MESSAGE = "`accessLevel` has been deprecated and will be removed in a future major version. See migration notes at https://ui.docs.amplify.aws/react/connected-components/storage/storagemanager";
|
|
7
|
+
declare const StorageManager: React.ForwardRefExoticComponent<(StorageManagerProps | StorageManagerPathProps) & React.RefAttributes<StorageManagerHandle>> & {
|
|
5
8
|
Container: typeof Container;
|
|
6
9
|
DropZone: typeof DropZone;
|
|
7
10
|
FileList: typeof FileList;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import { UploadTask } from '@aws-amplify/storage';
|
|
2
1
|
import { FileStatus } from '../../types';
|
|
3
2
|
import { Action, AddFilesActionParams } from './types';
|
|
3
|
+
import { TaskEvent } from '../../utils';
|
|
4
4
|
export declare const addFilesAction: ({ files, status, getFileErrorMessage, }: AddFilesActionParams) => Action;
|
|
5
5
|
export declare const clearFilesAction: () => Action;
|
|
6
6
|
export declare const queueFilesAction: () => Action;
|
|
7
|
-
export declare const setUploadingFileAction: ({ id, uploadTask, }:
|
|
8
|
-
id: string;
|
|
9
|
-
uploadTask: UploadTask | undefined;
|
|
10
|
-
}) => Action;
|
|
7
|
+
export declare const setUploadingFileAction: ({ id, uploadTask, }: TaskEvent) => Action;
|
|
11
8
|
export declare const setUploadProgressAction: ({ id, progress, }: {
|
|
12
9
|
id: string;
|
|
13
10
|
progress: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { UploadTask } from '@aws-amplify/storage';
|
|
2
1
|
import { StorageFiles, FileStatus, DefaultFile } from '../../types';
|
|
3
2
|
import { GetFileErrorMessage } from './types';
|
|
3
|
+
import { TaskHandler } from '../../utils';
|
|
4
4
|
export interface UseStorageManager {
|
|
5
5
|
addFiles: (params: {
|
|
6
6
|
files: File[];
|
|
@@ -9,10 +9,7 @@ export interface UseStorageManager {
|
|
|
9
9
|
}) => void;
|
|
10
10
|
clearFiles: () => void;
|
|
11
11
|
queueFiles: () => void;
|
|
12
|
-
setUploadingFile:
|
|
13
|
-
id: string;
|
|
14
|
-
uploadTask?: UploadTask;
|
|
15
|
-
}) => void;
|
|
12
|
+
setUploadingFile: TaskHandler;
|
|
16
13
|
setUploadProgress: (params: {
|
|
17
14
|
id: string;
|
|
18
15
|
progress: number;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { PathCallback } from '../../utils';
|
|
1
2
|
import { StorageManagerProps } from '../../types';
|
|
2
3
|
import { UseStorageManager } from '../useStorageManager';
|
|
3
|
-
export interface UseUploadFilesProps extends Pick<StorageManagerProps, '
|
|
4
|
+
export interface UseUploadFilesProps extends Pick<StorageManagerProps, 'isResumable' | 'onUploadSuccess' | 'onUploadError' | 'onUploadStart' | 'maxFileCount' | 'processFile'>, Pick<UseStorageManager, 'setUploadingFile' | 'setUploadProgress' | 'setUploadSuccess' | 'files'> {
|
|
5
|
+
accessLevel?: StorageManagerProps['accessLevel'];
|
|
6
|
+
path?: string | PathCallback;
|
|
4
7
|
}
|
|
5
|
-
export declare function useUploadFiles({ files, accessLevel, isResumable, setUploadProgress, setUploadingFile, setUploadSuccess, onUploadError, onUploadSuccess, onUploadStart, maxFileCount, processFile,
|
|
8
|
+
export declare function useUploadFiles({ files, accessLevel, isResumable, setUploadProgress, setUploadingFile, setUploadSuccess, onUploadError, onUploadSuccess, onUploadStart, maxFileCount, processFile, path, }: UseUploadFilesProps): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type { StorageAccessLevel
|
|
2
|
+
import type { StorageAccessLevel } from '@aws-amplify/core';
|
|
3
3
|
import { ContainerProps, DropZoneProps, FileListHeaderProps, FileListFooterProps, FileListProps, FilePickerProps } from './ui';
|
|
4
|
-
import { StorageManagerDisplayText } from './utils';
|
|
4
|
+
import { StorageManagerDisplayText, PathCallback, UploadTask } from './utils';
|
|
5
5
|
export declare enum FileStatus {
|
|
6
6
|
ADDED = "added",
|
|
7
7
|
QUEUED = "queued",
|
|
@@ -22,7 +22,10 @@ export interface StorageFile {
|
|
|
22
22
|
}
|
|
23
23
|
export type StorageFiles = StorageFile[];
|
|
24
24
|
export type DefaultFile = Pick<StorageFile, 'key'>;
|
|
25
|
-
export
|
|
25
|
+
export interface ProcessFileParams extends Record<string, any> {
|
|
26
|
+
file: File;
|
|
27
|
+
key: string;
|
|
28
|
+
}
|
|
26
29
|
export type ProcessFile = (params: ProcessFileParams) => Promise<ProcessFileParams> | ProcessFileParams;
|
|
27
30
|
export interface StorageManagerHandle {
|
|
28
31
|
clearFiles: () => void;
|
|
@@ -60,7 +63,7 @@ export interface StorageManagerProps {
|
|
|
60
63
|
/**
|
|
61
64
|
* Overrides default display text
|
|
62
65
|
*/
|
|
63
|
-
displayText?:
|
|
66
|
+
displayText?: StorageManagerDisplayText;
|
|
64
67
|
/**
|
|
65
68
|
* Determines if upload can be paused / resumed
|
|
66
69
|
*/
|
|
@@ -106,14 +109,17 @@ export interface StorageManagerProps {
|
|
|
106
109
|
*/
|
|
107
110
|
showThumbnails?: boolean;
|
|
108
111
|
/**
|
|
109
|
-
*
|
|
110
|
-
* @see https://docs.amplify.aws/lib/storage/custom-plugin/q/platform/js/
|
|
112
|
+
* Provided value is prefixed to the file `key` for each file
|
|
111
113
|
*/
|
|
112
|
-
|
|
114
|
+
path?: string;
|
|
115
|
+
}
|
|
116
|
+
export interface StorageManagerPathProps extends Omit<StorageManagerProps, 'accessLevel' | 'path'> {
|
|
113
117
|
/**
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
118
|
+
* S3 bucket key, allows either a `string` or a `PathCallback`:
|
|
119
|
+
* - `string`: `path` is prefixed to the file `key` for each file
|
|
120
|
+
* - `PathCallback`: callback provided an input containing the current `identityId`,
|
|
121
|
+
* resolved value is prefixed to the file `key` for each file
|
|
117
122
|
*/
|
|
118
|
-
path
|
|
123
|
+
path: string | PathCallback;
|
|
124
|
+
accessLevel?: never;
|
|
119
125
|
}
|
|
@@ -1,31 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { StorageManagerDisplayText } from '../../utils/displayText';
|
|
1
|
+
import { StorageManagerDisplayTextDefault, TaskHandler } from '../../utils';
|
|
3
2
|
import { FileStatus, StorageFile } from '../../types';
|
|
4
3
|
export interface FileListProps {
|
|
5
|
-
displayText:
|
|
4
|
+
displayText: StorageManagerDisplayTextDefault;
|
|
6
5
|
files: StorageFile[];
|
|
7
6
|
isResumable: boolean;
|
|
8
|
-
onCancelUpload:
|
|
9
|
-
id: string;
|
|
10
|
-
uploadTask: UploadTask;
|
|
11
|
-
}) => void;
|
|
7
|
+
onCancelUpload: TaskHandler;
|
|
12
8
|
onDeleteUpload: (params: {
|
|
13
9
|
id: string;
|
|
14
10
|
}) => void;
|
|
15
|
-
onPause:
|
|
16
|
-
|
|
17
|
-
uploadTask: UploadTask;
|
|
18
|
-
}) => void;
|
|
19
|
-
onResume: (params: {
|
|
20
|
-
id: string;
|
|
21
|
-
uploadTask: UploadTask;
|
|
22
|
-
}) => void;
|
|
11
|
+
onPause: TaskHandler;
|
|
12
|
+
onResume: TaskHandler;
|
|
23
13
|
showThumbnails: boolean;
|
|
24
14
|
hasMaxFilesError: boolean;
|
|
25
15
|
maxFileCount: number;
|
|
26
16
|
}
|
|
27
17
|
export interface FileControlProps {
|
|
28
|
-
displayText:
|
|
18
|
+
displayText: StorageManagerDisplayTextDefault;
|
|
29
19
|
displayName: string;
|
|
30
20
|
errorMessage: string;
|
|
31
21
|
isImage: boolean;
|
|
@@ -41,7 +31,7 @@ export interface FileControlProps {
|
|
|
41
31
|
status: FileStatus;
|
|
42
32
|
thumbnailUrl: string;
|
|
43
33
|
}
|
|
44
|
-
export interface FileStatusMessageProps extends Pick<
|
|
34
|
+
export interface FileStatusMessageProps extends Pick<StorageManagerDisplayTextDefault, 'getUploadingText' | 'getPausedText' | 'uploadSuccessfulText'> {
|
|
45
35
|
status: FileStatus;
|
|
46
36
|
errorMessage: string;
|
|
47
37
|
percentage: number;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { StorageManagerDisplayTextDefault } from '../../utils';
|
|
3
3
|
export interface FileListFooterProps {
|
|
4
4
|
remainingFilesCount: number;
|
|
5
|
-
displayText:
|
|
5
|
+
displayText: StorageManagerDisplayTextDefault;
|
|
6
6
|
onClearAll: () => void;
|
|
7
7
|
onUploadAll: () => void;
|
|
8
8
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { StorageManagerDisplayTextDefault } from '../../utils';
|
|
3
3
|
export interface FileListHeaderProps {
|
|
4
4
|
allUploadsSuccessful: boolean;
|
|
5
|
-
displayText:
|
|
5
|
+
displayText: StorageManagerDisplayTextDefault;
|
|
6
6
|
fileCount: number;
|
|
7
7
|
remainingFilesCount: number;
|
|
8
8
|
selectedFilesCount?: number;
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
import { DisplayTextTemplate } from '@aws-amplify/ui';
|
|
2
|
+
export type StorageManagerDisplayText = DisplayTextTemplate<{
|
|
3
|
+
getFilesUploadedText?: (count: number) => string;
|
|
4
|
+
getFileSizeErrorText?: (sizeText: string) => string;
|
|
5
|
+
getRemainingFilesText?: (count: number) => string;
|
|
6
|
+
getSelectedFilesText?: (count: number) => string;
|
|
7
|
+
getUploadingText?: (percentage: number) => string;
|
|
8
|
+
getUploadButtonText?: (count: number) => string;
|
|
9
|
+
getMaxFilesErrorText?: (count: number) => string;
|
|
10
|
+
getErrorText?: (message: string) => string;
|
|
11
|
+
doneButtonText?: string;
|
|
12
|
+
clearAllButtonText?: string;
|
|
13
|
+
extensionNotAllowedText?: string;
|
|
14
|
+
browseFilesText?: string;
|
|
15
|
+
dropFilesText?: string;
|
|
16
|
+
pauseButtonText?: string;
|
|
17
|
+
resumeButtonText?: string;
|
|
18
|
+
uploadSuccessfulText?: string;
|
|
19
|
+
getPausedText?: (percentage: number) => string;
|
|
20
|
+
}>;
|
|
21
|
+
export type StorageManagerDisplayTextDefault = Required<StorageManagerDisplayText>;
|
|
22
|
+
export declare const defaultStorageManagerDisplayText: StorageManagerDisplayTextDefault;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { StorageAccessLevel } from '@aws-amplify/core';
|
|
2
|
+
import { UploadDataWithPathInput, UploadDataInput } from 'aws-amplify/storage';
|
|
3
|
+
import { ProcessFile } from '../types';
|
|
4
|
+
import { PathCallback, PathInput } from './uploadFile';
|
|
5
|
+
export interface GetInputParams {
|
|
6
|
+
accessLevel: StorageAccessLevel | undefined;
|
|
7
|
+
file: File;
|
|
8
|
+
key: string;
|
|
9
|
+
onProgress: NonNullable<UploadDataWithPathInput['options']>['onProgress'];
|
|
10
|
+
path: string | PathCallback | undefined;
|
|
11
|
+
processFile: ProcessFile | undefined;
|
|
12
|
+
}
|
|
13
|
+
export declare const getInput: ({ accessLevel, file, key, onProgress, path, processFile, }: GetInputParams) => () => Promise<PathInput | UploadDataInput>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { checkMaxFileSize } from './checkMaxFileSize';
|
|
2
|
-
export { defaultStorageManagerDisplayText, StorageManagerDisplayText, } from './displayText';
|
|
2
|
+
export { defaultStorageManagerDisplayText, StorageManagerDisplayText, StorageManagerDisplayTextDefault, } from './displayText';
|
|
3
3
|
export { filterAllowedFiles } from './filterAllowedFiles';
|
|
4
4
|
export { humanFileSize } from './humanFileSize';
|
|
5
|
-
export {
|
|
5
|
+
export { getInput } from './getInput';
|
|
6
|
+
export { PathCallback, TaskEvent, TaskHandler, uploadFile, UploadTask, } from './uploadFile';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ProcessFile, ProcessFileParams } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Utility function that takes the processFile prop, along with a file a key
|
|
4
|
+
* and returns a Promise that resolves to { file, key, ..rest }
|
|
5
|
+
* regardless if processFile is defined and if it is sync or async
|
|
6
|
+
*/
|
|
7
|
+
export declare const resolveFile: ({ processFile, ...input }: ProcessFileParams & {
|
|
8
|
+
processFile?: ProcessFile | undefined;
|
|
9
|
+
}) => Promise<ProcessFileParams>;
|
|
@@ -1,19 +1,32 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { UploadDataInput, UploadDataWithPathOutput, UploadDataWithPathInput, UploadDataOutput } from 'aws-amplify/storage';
|
|
2
|
+
/**
|
|
3
|
+
* Callback provided an input containing the current `identityId`
|
|
4
|
+
*
|
|
5
|
+
* @param {{identityId: string | undefined}} input - Input parameters
|
|
6
|
+
* @returns target S3 bucket key
|
|
7
|
+
*/
|
|
8
|
+
export type PathCallback = (input: {
|
|
9
|
+
identityId: string | undefined;
|
|
10
|
+
}) => string;
|
|
11
|
+
export type UploadTask = UploadDataOutput | UploadDataWithPathOutput;
|
|
12
|
+
export interface TaskEvent {
|
|
13
|
+
id: string;
|
|
14
|
+
uploadTask: UploadTask;
|
|
15
|
+
}
|
|
16
|
+
export type PathInput = Omit<UploadDataWithPathInput, 'path'> & {
|
|
17
|
+
path: string;
|
|
18
|
+
};
|
|
19
|
+
export type TaskHandler = (event: TaskEvent) => void;
|
|
20
|
+
export interface UploadFileProps {
|
|
21
|
+
input: () => Promise<PathInput | UploadDataInput>;
|
|
22
|
+
onComplete?: (result: Awaited<(UploadDataWithPathOutput | UploadDataOutput)['result']>) => void;
|
|
23
|
+
onError?: (event: {
|
|
24
|
+
key: string;
|
|
25
|
+
error: Error;
|
|
10
26
|
}) => void;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
27
|
+
onStart?: (event: {
|
|
28
|
+
key: string;
|
|
29
|
+
uploadTask: UploadTask;
|
|
14
30
|
}) => void;
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
type UploadFile = Promise<void> | UploadTask;
|
|
18
|
-
export declare function uploadFile({ file, key, level, progressCallback, errorCallback, completeCallback, isResumable, provider, ...rest }: UploadFileProps): UploadFile;
|
|
19
|
-
export {};
|
|
31
|
+
}
|
|
32
|
+
export declare function uploadFile({ input, onError, onStart, onComplete, }: UploadFileProps): Promise<UploadDataWithPathOutput | UploadDataOutput>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const VERSION = "3.1.3";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/ui-react-storage",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-theming-v2-f8422a3-20240627193426",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/esm/index.mjs",
|
|
6
6
|
"exports": {
|
|
@@ -35,51 +35,20 @@
|
|
|
35
35
|
"prebuild": "rimraf dist",
|
|
36
36
|
"size": "yarn size-limit",
|
|
37
37
|
"test": "jest",
|
|
38
|
-
"test:ci": "yarn test && yarn check:esm",
|
|
39
38
|
"test:watch": "yarn test --watch",
|
|
40
39
|
"typecheck": "tsc --noEmit"
|
|
41
40
|
},
|
|
42
41
|
"dependencies": {
|
|
43
|
-
"@aws-amplify/ui": "0.0.0-
|
|
44
|
-
"@aws-amplify/ui-react": "0.0.0-
|
|
45
|
-
"@aws-amplify/ui-react-core": "0.0.0-
|
|
46
|
-
"classnames": "2.3.1",
|
|
42
|
+
"@aws-amplify/ui": "0.0.0-theming-v2-f8422a3-20240627193426",
|
|
43
|
+
"@aws-amplify/ui-react": "0.0.0-theming-v2-f8422a3-20240627193426",
|
|
44
|
+
"@aws-amplify/ui-react-core": "0.0.0-theming-v2-f8422a3-20240627193426",
|
|
47
45
|
"lodash": "4.17.21",
|
|
48
|
-
"tslib": "2.
|
|
46
|
+
"tslib": "^2.5.2"
|
|
49
47
|
},
|
|
50
48
|
"peerDependencies": {
|
|
51
|
-
"aws-amplify": "^
|
|
52
|
-
"react": "
|
|
53
|
-
"react-dom": "
|
|
54
|
-
},
|
|
55
|
-
"peerDependenciesMeta": {
|
|
56
|
-
"aws-amplify": {
|
|
57
|
-
"optional": true
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
"devDependencies": {
|
|
61
|
-
"@aws-amplify/eslint-config-amplify-ui": "0.0.0",
|
|
62
|
-
"@rollup/plugin-typescript": "^8.3.1",
|
|
63
|
-
"@size-limit/preset-big-lib": "^8.2.6",
|
|
64
|
-
"@testing-library/jest-dom": "^5.14.1",
|
|
65
|
-
"@testing-library/react": "^12.0.0",
|
|
66
|
-
"@testing-library/react-hooks": "^7.0.1",
|
|
67
|
-
"@testing-library/user-event": "^13.2.1",
|
|
68
|
-
"@types/jest": "^26.0.23",
|
|
69
|
-
"@types/react": "^17.0.2",
|
|
70
|
-
"@types/testing-library__jest-dom": "^5.14.1",
|
|
71
|
-
"eslint": "^8.44.0",
|
|
72
|
-
"jest": "^27.0.4",
|
|
73
|
-
"react": "^17.0.2",
|
|
74
|
-
"react-dom": "^17.0.2",
|
|
75
|
-
"rimraf": "^3.0.2",
|
|
76
|
-
"rollup": "^2.70.0",
|
|
77
|
-
"rollup-plugin-node-externals": "^4.1.1",
|
|
78
|
-
"rollup-plugin-styles": "^4.0.0",
|
|
79
|
-
"rollup-plugin-terser": "^7.0.2",
|
|
80
|
-
"size-limit": "^8.2.6",
|
|
81
|
-
"ts-jest": "^27.0.3",
|
|
82
|
-
"ts-morph": "^12.0.0"
|
|
49
|
+
"aws-amplify": "^6.3.2",
|
|
50
|
+
"react": "^16.14.0 || ^17.0 || ^18.0",
|
|
51
|
+
"react-dom": "^16.14.0 || ^17.0 || ^18.0"
|
|
83
52
|
},
|
|
84
53
|
"sideEffects": [
|
|
85
54
|
"dist/**/*.css"
|
|
@@ -89,7 +58,7 @@
|
|
|
89
58
|
"name": "StorageManager",
|
|
90
59
|
"path": "dist/esm/index.mjs",
|
|
91
60
|
"import": "{ StorageManager }",
|
|
92
|
-
"limit": "
|
|
61
|
+
"limit": "25.5 kB"
|
|
93
62
|
}
|
|
94
63
|
]
|
|
95
64
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{isFunction as e}from"@aws-amplify/ui";const i=({processFile:i,file:o,key:s})=>new Promise(((t,c)=>{const f=e(i)?i({file:o,key:s}):{file:o,key:s};f instanceof Promise?f.then(t).catch(c):t(f)}));export{i as resolveFile};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ProcessFileParams, StorageManagerProps } from '../../types';
|
|
2
|
-
interface ResolveFileParams extends Pick<StorageManagerProps, 'processFile'>, ProcessFileParams {
|
|
3
|
-
}
|
|
4
|
-
/**
|
|
5
|
-
* Utility function that takes the processFile prop, along with a file a key
|
|
6
|
-
* and returns a Promise that resolves to { file, key, ..rest }
|
|
7
|
-
* regardless if processFile is defined and if it is sync or async
|
|
8
|
-
*/
|
|
9
|
-
export declare const resolveFile: ({ processFile, file, key, }: ResolveFileParams) => Promise<ProcessFileParams>;
|
|
10
|
-
export {};
|