@aws-amplify/ui-react-storage 3.4.1 → 3.5.1
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/browser.js +35 -2
- package/dist/{createAmplifyAuthAdapter-BRctUWdR.js → createAmplifyAuthAdapter-0MaHde-Z.js} +3053 -2919
- package/dist/esm/browser.mjs +2 -0
- package/dist/esm/components/StorageBrowser/StorageBrowserAmplify.mjs +2 -7
- package/dist/esm/components/StorageBrowser/StorageBrowserDefault.mjs +3 -16
- package/dist/esm/components/StorageBrowser/actions/configs/context.mjs +4 -9
- package/dist/esm/components/StorageBrowser/actions/configs/defaults.mjs +14 -39
- package/dist/esm/components/StorageBrowser/actions/configs/utils.mjs +8 -0
- package/dist/esm/components/StorageBrowser/actions/handlers/copy.mjs +13 -13
- package/dist/esm/components/StorageBrowser/actions/handlers/createFolder.mjs +9 -6
- package/dist/esm/components/StorageBrowser/actions/handlers/delete.mjs +9 -7
- package/dist/esm/components/StorageBrowser/actions/handlers/download.mjs +7 -11
- package/dist/esm/components/StorageBrowser/actions/handlers/listLocationItems.mjs +3 -3
- package/dist/esm/components/StorageBrowser/actions/handlers/upload.mjs +11 -7
- package/dist/esm/components/StorageBrowser/actions/handlers/utils.mjs +1 -11
- package/dist/esm/components/StorageBrowser/adapters/createManagedAuthAdapter/createManagedAuthAdapter.mjs +1 -3
- package/dist/esm/components/StorageBrowser/controls/PaginationControl.mjs +3 -3
- package/dist/esm/components/StorageBrowser/controls/SearchFieldControl.mjs +12 -0
- package/dist/esm/components/StorageBrowser/controls/hooks/usePagination.mjs +9 -0
- package/dist/esm/components/StorageBrowser/controls/hooks/useSearchField.mjs +17 -0
- package/dist/esm/components/StorageBrowser/createStorageBrowser.mjs +42 -27
- package/dist/esm/components/StorageBrowser/displayText/libraries/en/locationDetailView.mjs +6 -0
- package/dist/esm/components/StorageBrowser/displayText/libraries/en/locationsView.mjs +2 -2
- package/dist/esm/components/StorageBrowser/providers/configuration/createConfigurationProvider.mjs +4 -10
- package/dist/esm/components/StorageBrowser/providers/configuration/useGetActionInputCallback.mjs +7 -7
- package/dist/esm/components/StorageBrowser/providers/store/locationItems/context.mjs +1 -1
- package/dist/esm/components/StorageBrowser/tasks/useProcessTasks.mjs +27 -6
- package/dist/esm/components/StorageBrowser/useAction/constants.mjs +4 -0
- package/dist/esm/components/StorageBrowser/useAction/context.mjs +8 -0
- package/dist/esm/components/StorageBrowser/useAction/useAction.mjs +18 -0
- package/dist/esm/components/StorageBrowser/useAction/useHandler.mjs +40 -0
- package/dist/esm/components/StorageBrowser/useAction/useList.mjs +19 -0
- package/dist/esm/components/StorageBrowser/useAction/useListFolderItems.mjs +23 -0
- package/dist/esm/components/StorageBrowser/useAction/useListLocationItems.mjs +23 -0
- package/dist/esm/components/StorageBrowser/{actions/useAction → useAction}/useListLocations.mjs +7 -6
- package/dist/esm/components/StorageBrowser/useAction/utils.mjs +26 -0
- package/dist/esm/components/StorageBrowser/views/LocationActionView/CopyView/CopyView.mjs +3 -3
- package/dist/esm/components/StorageBrowser/views/LocationActionView/CopyView/useCopyView.mjs +32 -17
- package/dist/esm/components/StorageBrowser/views/LocationActionView/CopyView/useFolders.mjs +12 -17
- package/dist/esm/components/StorageBrowser/views/LocationActionView/CreateFolderView/useCreateFolderView.mjs +18 -15
- package/dist/esm/components/StorageBrowser/views/LocationActionView/DeleteView/useDeleteView.mjs +17 -12
- package/dist/esm/components/StorageBrowser/views/LocationActionView/LocationActionView.mjs +9 -16
- package/dist/esm/components/StorageBrowser/views/LocationActionView/UploadView/useUploadView.mjs +44 -49
- package/dist/esm/components/StorageBrowser/views/LocationActionView/getActionViewTableData.mjs +5 -5
- package/dist/esm/components/StorageBrowser/views/LocationDetailView/LocationDetailView.mjs +3 -3
- package/dist/esm/components/StorageBrowser/views/LocationDetailView/LocationDetailViewProvider.mjs +12 -8
- package/dist/esm/components/StorageBrowser/views/LocationDetailView/getLocationDetailViewTableData/getLocationDetailViewTableData.mjs +1 -0
- package/dist/esm/components/StorageBrowser/views/LocationDetailView/useLocationDetailView.mjs +50 -69
- package/dist/esm/components/StorageBrowser/views/LocationsView/LocationsView.mjs +3 -3
- package/dist/esm/components/StorageBrowser/views/LocationsView/LocationsViewProvider.mjs +2 -3
- package/dist/esm/components/StorageBrowser/views/LocationsView/useLocationsView.mjs +22 -29
- package/dist/esm/components/StorageBrowser/views/context/actionViews.mjs +33 -0
- package/dist/esm/components/StorageBrowser/views/context/getViews.mjs +32 -0
- package/dist/esm/components/StorageBrowser/views/context/primaryViews.mjs +32 -0
- package/dist/esm/components/StorageBrowser/views/context/views.mjs +19 -0
- package/dist/esm/components/StorageBrowser/views/{createUseView.mjs → useView.mjs} +19 -28
- package/dist/esm/version.mjs +1 -1
- package/dist/index.js +5 -10
- package/dist/styles.css +6 -2
- package/dist/types/components/StorageBrowser/actions/configs/context.d.ts +4 -5
- package/dist/types/components/StorageBrowser/actions/configs/defaults.d.ts +6 -7
- package/dist/types/components/StorageBrowser/actions/configs/index.d.ts +3 -2
- package/dist/types/components/StorageBrowser/actions/configs/types.d.ts +39 -69
- package/dist/types/components/StorageBrowser/actions/configs/utils.d.ts +2 -0
- package/dist/types/components/StorageBrowser/actions/handlers/copy.d.ts +12 -5
- package/dist/types/components/StorageBrowser/actions/handlers/createFolder.d.ts +7 -4
- package/dist/types/components/StorageBrowser/actions/handlers/delete.d.ts +6 -3
- package/dist/types/components/StorageBrowser/actions/handlers/download.d.ts +6 -3
- package/dist/types/components/StorageBrowser/actions/handlers/types.d.ts +11 -2
- package/dist/types/components/StorageBrowser/actions/handlers/upload.d.ts +8 -4
- package/dist/types/components/StorageBrowser/actions/handlers/utils.d.ts +0 -1
- package/dist/types/components/StorageBrowser/actions/index.d.ts +2 -4
- package/dist/types/components/StorageBrowser/adapters/permissionParsers.d.ts +1 -1
- package/dist/types/components/StorageBrowser/composables/ActionsList.d.ts +2 -2
- package/dist/types/components/StorageBrowser/controls/SearchFieldControl.d.ts +2 -0
- package/dist/types/components/StorageBrowser/controls/hooks/usePagination.d.ts +2 -0
- package/dist/types/components/StorageBrowser/controls/hooks/useSearchField.d.ts +2 -0
- package/dist/types/components/StorageBrowser/controls/types.d.ts +3 -3
- package/dist/types/components/StorageBrowser/createStorageBrowser.d.ts +3 -7
- package/dist/types/components/StorageBrowser/displayText/index.d.ts +1 -1
- package/dist/types/components/StorageBrowser/displayText/types.d.ts +1 -1
- package/dist/types/components/StorageBrowser/index.d.ts +3 -1
- package/dist/types/components/StorageBrowser/providers/configuration/index.d.ts +1 -1
- package/dist/types/components/StorageBrowser/providers/configuration/types.d.ts +2 -2
- package/dist/types/components/StorageBrowser/providers/store/files/types.d.ts +10 -1
- package/dist/types/components/StorageBrowser/providers/store/files/utils.d.ts +1 -2
- package/dist/types/components/StorageBrowser/tasks/types.d.ts +16 -13
- package/dist/types/components/StorageBrowser/tasks/useProcessTasks.d.ts +2 -3
- package/dist/types/components/StorageBrowser/types.d.ts +42 -12
- package/dist/types/components/StorageBrowser/useAction/constants.d.ts +3 -0
- package/dist/types/components/StorageBrowser/useAction/context.d.ts +5 -0
- package/dist/types/components/StorageBrowser/{actions/useAction → useAction}/createEnhancedListHandler.d.ts +3 -3
- package/dist/types/components/StorageBrowser/useAction/index.d.ts +6 -0
- package/dist/types/components/StorageBrowser/useAction/types.d.ts +76 -0
- package/dist/types/components/StorageBrowser/useAction/useAction.d.ts +3 -0
- package/dist/types/components/StorageBrowser/useAction/useHandler.d.ts +3 -0
- package/dist/types/components/StorageBrowser/useAction/useList.d.ts +9 -0
- package/dist/types/components/StorageBrowser/useAction/useListFolderItems.d.ts +13 -0
- package/dist/types/components/StorageBrowser/useAction/useListLocationItems.d.ts +10 -0
- package/dist/types/components/StorageBrowser/useAction/useListLocations.d.ts +8 -0
- package/dist/types/components/StorageBrowser/useAction/utils.d.ts +6 -0
- package/dist/types/components/StorageBrowser/views/LocationActionView/CopyView/useFolders.d.ts +1 -4
- package/dist/types/components/StorageBrowser/views/LocationActionView/CreateFolderView/types.d.ts +2 -2
- package/dist/types/components/StorageBrowser/views/LocationActionView/LocationActionView.d.ts +2 -6
- package/dist/types/components/StorageBrowser/views/LocationActionView/getActionViewTableData.d.ts +2 -4
- package/dist/types/components/StorageBrowser/views/LocationActionView/index.d.ts +6 -6
- package/dist/types/components/StorageBrowser/views/LocationActionView/types.d.ts +4 -8
- package/dist/types/components/StorageBrowser/views/LocationDetailView/getLocationDetailViewTableData/getLocationDetailViewTableData.d.ts +1 -3
- package/dist/types/components/StorageBrowser/views/LocationDetailView/types.d.ts +16 -17
- package/dist/types/components/StorageBrowser/views/LocationsView/types.d.ts +8 -12
- package/dist/types/components/StorageBrowser/views/context/actionViews.d.ts +6 -0
- package/dist/types/components/StorageBrowser/views/context/getViews.d.ts +4 -0
- package/dist/types/components/StorageBrowser/views/context/index.d.ts +1 -0
- package/dist/types/components/StorageBrowser/views/context/primaryViews.d.ts +6 -0
- package/dist/types/components/StorageBrowser/views/context/types.d.ts +9 -0
- package/dist/types/components/StorageBrowser/views/context/views.d.ts +10 -0
- package/dist/types/components/StorageBrowser/views/index.d.ts +2 -2
- package/dist/types/components/StorageBrowser/views/types.d.ts +22 -0
- package/dist/types/components/StorageBrowser/views/useView.d.ts +16 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +5 -5
- package/dist/esm/components/StorageBrowser/controls/SearchControl.mjs +0 -13
- package/dist/esm/components/StorageBrowser/views/LocationActionView/constants.mjs +0 -3
- package/dist/esm/components/StorageBrowser/views/LocationActionView/useActionView.mjs +0 -20
- package/dist/esm/components/StorageBrowser/views/context.mjs +0 -43
- package/dist/types/components/StorageBrowser/actions/createUseAction.d.ts +0 -2
- package/dist/types/components/StorageBrowser/actions/types.d.ts +0 -8
- package/dist/types/components/StorageBrowser/actions/useAction/index.d.ts +0 -1
- package/dist/types/components/StorageBrowser/actions/useAction/useListLocations.d.ts +0 -8
- package/dist/types/components/StorageBrowser/controls/SearchControl.d.ts +0 -2
- package/dist/types/components/StorageBrowser/views/LocationActionView/constants.d.ts +0 -1
- package/dist/types/components/StorageBrowser/views/context.d.ts +0 -16
- package/dist/types/components/StorageBrowser/views/createUseView.d.ts +0 -19
- /package/dist/esm/components/StorageBrowser/{actions/useAction → useAction}/createEnhancedListHandler.mjs +0 -0
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
|
-
import { usePaginate } from '../hooks/usePaginate.mjs';
|
|
3
|
-
import '../../actions/configs/context.mjs';
|
|
4
|
-
import '@aws-amplify/storage/internals';
|
|
5
|
-
import { createFileDataItemFromLocation } from '../../actions/handlers/utils.mjs';
|
|
6
|
-
import '@aws-amplify/ui';
|
|
7
|
-
import { downloadHandler } from '../../actions/handlers/download.mjs';
|
|
8
|
-
import 'aws-amplify/storage';
|
|
9
|
-
import { useListLocations } from '../../actions/useAction/useListLocations.mjs';
|
|
10
2
|
import '../../providers/store/location/context.mjs';
|
|
11
3
|
import '../../providers/store/files/context.mjs';
|
|
12
4
|
import '../../providers/store/actionType/context.mjs';
|
|
13
5
|
import '../../providers/store/locationItems/context.mjs';
|
|
14
6
|
import { useStore } from '../../providers/store/useStore.mjs';
|
|
7
|
+
import '../../useAction/context.mjs';
|
|
8
|
+
import { useAction } from '../../useAction/useAction.mjs';
|
|
9
|
+
import { useList } from '../../useAction/useList.mjs';
|
|
10
|
+
import '@aws-amplify/ui';
|
|
11
|
+
import '@aws-amplify/storage/internals';
|
|
12
|
+
import { getFileKey } from '../../actions/handlers/utils.mjs';
|
|
13
|
+
import 'aws-amplify/storage';
|
|
14
|
+
import '../../actions/configs/context.mjs';
|
|
15
|
+
import { usePaginate } from '../hooks/usePaginate.mjs';
|
|
15
16
|
import { useSearch } from '../hooks/useSearch.mjs';
|
|
16
|
-
import { useGetActionInput } from '../../providers/configuration/context.mjs';
|
|
17
|
-
import '@aws-amplify/ui-react-core/elements';
|
|
18
|
-
import '../../providers/configuration/credentials/context.mjs';
|
|
19
|
-
import { useProcessTasks } from '../../tasks/useProcessTasks.mjs';
|
|
20
17
|
|
|
21
18
|
const DEFAULT_EXCLUDE = {
|
|
22
19
|
exactPermissions: ['delete', 'write'],
|
|
@@ -27,11 +24,10 @@ const DEFAULT_LIST_OPTIONS = {
|
|
|
27
24
|
pageSize: DEFAULT_PAGE_SIZE,
|
|
28
25
|
};
|
|
29
26
|
const useLocationsView = (options) => {
|
|
30
|
-
const
|
|
31
|
-
const [state, handleList] =
|
|
27
|
+
const handleDownload = useAction('download')[1];
|
|
28
|
+
const [state, handleList] = useList('locations');
|
|
29
|
+
const dispatchStoreAction = useStore()[1];
|
|
32
30
|
const { data, message, hasError, isLoading } = state;
|
|
33
|
-
const [_, handleDownload] = useProcessTasks(downloadHandler);
|
|
34
|
-
const [, dispatchStoreAction] = useStore();
|
|
35
31
|
const { items, nextToken, search } = data;
|
|
36
32
|
const hasNextToken = !!nextToken;
|
|
37
33
|
const { hasExhaustedSearch = false } = search ?? {};
|
|
@@ -44,17 +40,13 @@ const useLocationsView = (options) => {
|
|
|
44
40
|
const listOptions = listOptionsRef.current;
|
|
45
41
|
// initial load
|
|
46
42
|
React__default.useEffect(() => {
|
|
47
|
-
handleList({
|
|
48
|
-
options: { ...listOptions, refresh: true },
|
|
49
|
-
});
|
|
43
|
+
handleList({ options: { ...listOptions, refresh: true } });
|
|
50
44
|
}, [handleList, listOptions]);
|
|
51
45
|
// set up pagination
|
|
52
46
|
const paginateCallback = () => {
|
|
53
47
|
if (!nextToken)
|
|
54
48
|
return;
|
|
55
|
-
handleList({
|
|
56
|
-
options: { ...listOptions, nextToken },
|
|
57
|
-
});
|
|
49
|
+
handleList({ options: { ...listOptions, nextToken } });
|
|
58
50
|
};
|
|
59
51
|
const { currentPage, onPaginate, handleReset, highestPageVisited, pageItems, } = usePaginate({
|
|
60
52
|
items,
|
|
@@ -77,7 +69,6 @@ const useLocationsView = (options) => {
|
|
|
77
69
|
});
|
|
78
70
|
};
|
|
79
71
|
const { searchQuery, onSearchQueryChange, onSearchSubmit, resetSearch } = useSearch({ onSearch });
|
|
80
|
-
const shouldShowEmptyMessage = pageItems.length === 0 && !isLoading && !hasError;
|
|
81
72
|
return {
|
|
82
73
|
isLoading,
|
|
83
74
|
hasError,
|
|
@@ -86,13 +77,17 @@ const useLocationsView = (options) => {
|
|
|
86
77
|
hasNextPage: hasNextToken,
|
|
87
78
|
highestPageVisited,
|
|
88
79
|
pageItems,
|
|
89
|
-
shouldShowEmptyMessage,
|
|
90
80
|
searchQuery,
|
|
91
81
|
hasExhaustedSearch,
|
|
92
82
|
onDownload: (location) => {
|
|
83
|
+
const { prefix: key } = location;
|
|
93
84
|
handleDownload({
|
|
94
|
-
|
|
95
|
-
|
|
85
|
+
data: {
|
|
86
|
+
fileKey: getFileKey(key),
|
|
87
|
+
key,
|
|
88
|
+
id: crypto.randomUUID(),
|
|
89
|
+
},
|
|
90
|
+
location,
|
|
96
91
|
});
|
|
97
92
|
},
|
|
98
93
|
onNavigate: (location) => {
|
|
@@ -102,9 +97,7 @@ const useLocationsView = (options) => {
|
|
|
102
97
|
onRefresh: () => {
|
|
103
98
|
resetSearch();
|
|
104
99
|
handleReset();
|
|
105
|
-
handleList({
|
|
106
|
-
options: { ...listOptions, refresh: true },
|
|
107
|
-
});
|
|
100
|
+
handleList({ options: { ...listOptions, refresh: true } });
|
|
108
101
|
},
|
|
109
102
|
onPaginate,
|
|
110
103
|
onSearch: onSearchSubmit,
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { UploadView } from '../LocationActionView/UploadView/UploadView.mjs';
|
|
3
|
+
import '@aws-amplify/ui';
|
|
4
|
+
import '../../providers/store/location/context.mjs';
|
|
5
|
+
import '../../providers/store/files/context.mjs';
|
|
6
|
+
import '../../providers/store/actionType/context.mjs';
|
|
7
|
+
import '../../providers/store/locationItems/context.mjs';
|
|
8
|
+
import '../../useAction/context.mjs';
|
|
9
|
+
import '../../providers/configuration/context.mjs';
|
|
10
|
+
import '@aws-amplify/ui-react-core';
|
|
11
|
+
import '@aws-amplify/ui-react-core/elements';
|
|
12
|
+
import '../../providers/configuration/credentials/context.mjs';
|
|
13
|
+
import '@aws-amplify/storage/internals';
|
|
14
|
+
import 'aws-amplify/storage';
|
|
15
|
+
import '../../actions/configs/context.mjs';
|
|
16
|
+
import { CreateFolderView } from '../LocationActionView/CreateFolderView/CreateFolderView.mjs';
|
|
17
|
+
import { CopyView } from '../LocationActionView/CopyView/CopyView.mjs';
|
|
18
|
+
import { DeleteView } from '../LocationActionView/DeleteView/DeleteView.mjs';
|
|
19
|
+
|
|
20
|
+
const DEFAULT_ACTION_VIEWS = {
|
|
21
|
+
createFolder: CreateFolderView,
|
|
22
|
+
copy: CopyView,
|
|
23
|
+
delete: DeleteView,
|
|
24
|
+
upload: UploadView,
|
|
25
|
+
};
|
|
26
|
+
const ActionViewsContext = React__default.createContext({
|
|
27
|
+
action: DEFAULT_ACTION_VIEWS,
|
|
28
|
+
});
|
|
29
|
+
function useActionViews() {
|
|
30
|
+
return React__default.useContext(ActionViewsContext);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { ActionViewsContext, DEFAULT_ACTION_VIEWS, useActionViews };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { capitalize, isObject, isFunction } from '@aws-amplify/ui';
|
|
2
|
+
import { DEFAULT_ACTION_VIEWS } from './actionViews.mjs';
|
|
3
|
+
import { DEFAULT_PRIMARY_VIEWS } from './primaryViews.mjs';
|
|
4
|
+
|
|
5
|
+
const getViews = (views, customConfigs) => {
|
|
6
|
+
const resolvedDefaultActionViews = Object.entries(DEFAULT_ACTION_VIEWS).reduce((output, [actionName, component]) => {
|
|
7
|
+
// use viewName to lookup overrides for default action views
|
|
8
|
+
const viewName = capitalize(`${actionName}View`);
|
|
9
|
+
return {
|
|
10
|
+
...output,
|
|
11
|
+
[actionName]: (views?.[viewName] ?? component),
|
|
12
|
+
};
|
|
13
|
+
}, {});
|
|
14
|
+
const customActionViews = !isObject(customConfigs)
|
|
15
|
+
? {}
|
|
16
|
+
: Object.entries(customConfigs).reduce((acc, [key, config]) => {
|
|
17
|
+
// ignore custom actions that are only handlers
|
|
18
|
+
return !isObject(config) || isFunction(config)
|
|
19
|
+
? acc
|
|
20
|
+
: { ...acc, [key]: views?.[config.viewName] };
|
|
21
|
+
}, {});
|
|
22
|
+
return {
|
|
23
|
+
action: { ...resolvedDefaultActionViews, ...customActionViews },
|
|
24
|
+
primary: {
|
|
25
|
+
LocationActionView: views?.LocationActionView ?? DEFAULT_PRIMARY_VIEWS.LocationActionView,
|
|
26
|
+
LocationDetailView: views?.LocationDetailView ?? DEFAULT_PRIMARY_VIEWS.LocationDetailView,
|
|
27
|
+
LocationsView: views?.LocationsView ?? DEFAULT_PRIMARY_VIEWS.LocationsView,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { getViews };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import '../LocationActionView/CopyView/CopyView.mjs';
|
|
3
|
+
import '@aws-amplify/ui';
|
|
4
|
+
import '../../providers/store/location/context.mjs';
|
|
5
|
+
import '../../providers/store/files/context.mjs';
|
|
6
|
+
import '../../providers/store/actionType/context.mjs';
|
|
7
|
+
import '../../providers/store/locationItems/context.mjs';
|
|
8
|
+
import '../../useAction/context.mjs';
|
|
9
|
+
import '../../providers/configuration/context.mjs';
|
|
10
|
+
import '@aws-amplify/ui-react-core';
|
|
11
|
+
import '@aws-amplify/ui-react-core/elements';
|
|
12
|
+
import '../../providers/configuration/credentials/context.mjs';
|
|
13
|
+
import '@aws-amplify/storage/internals';
|
|
14
|
+
import 'aws-amplify/storage';
|
|
15
|
+
import '../../actions/configs/context.mjs';
|
|
16
|
+
import '../LocationActionView/CreateFolderView/CreateFolderView.mjs';
|
|
17
|
+
import '../LocationActionView/DeleteView/DeleteView.mjs';
|
|
18
|
+
import { LocationActionView } from '../LocationActionView/LocationActionView.mjs';
|
|
19
|
+
import '../LocationActionView/UploadView/UploadView.mjs';
|
|
20
|
+
import { LocationDetailView } from '../LocationDetailView/LocationDetailView.mjs';
|
|
21
|
+
import { LocationsView } from '../LocationsView/LocationsView.mjs';
|
|
22
|
+
|
|
23
|
+
const DEFAULT_PRIMARY_VIEWS = {
|
|
24
|
+
LocationActionView: LocationActionView,
|
|
25
|
+
LocationDetailView: LocationDetailView,
|
|
26
|
+
LocationsView: LocationsView,
|
|
27
|
+
};
|
|
28
|
+
const PrimaryViewsContext = React__default.createContext({
|
|
29
|
+
primary: DEFAULT_PRIMARY_VIEWS,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export { DEFAULT_PRIMARY_VIEWS, PrimaryViewsContext };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { getViews } from './getViews.mjs';
|
|
3
|
+
import { ActionViewsContext } from './actionViews.mjs';
|
|
4
|
+
import { PrimaryViewsContext } from './primaryViews.mjs';
|
|
5
|
+
|
|
6
|
+
function ViewsProvider({ children, views, actions, }) {
|
|
7
|
+
const { custom } = actions ?? {};
|
|
8
|
+
const value = React__default.useMemo(() => getViews(views, custom), [custom, views]);
|
|
9
|
+
return (React__default.createElement(PrimaryViewsContext.Provider, { value: value },
|
|
10
|
+
React__default.createElement(ActionViewsContext.Provider, { value: value }, children)));
|
|
11
|
+
}
|
|
12
|
+
function useViews() {
|
|
13
|
+
return {
|
|
14
|
+
primary: React__default.useContext(PrimaryViewsContext).primary,
|
|
15
|
+
action: React__default.useContext(ActionViewsContext).action,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { ViewsProvider, useViews };
|
|
@@ -4,44 +4,35 @@ import './LocationActionView/CreateFolderView/CreateFolderView.mjs';
|
|
|
4
4
|
import { useCreateFolderView } from './LocationActionView/CreateFolderView/useCreateFolderView.mjs';
|
|
5
5
|
import './LocationActionView/DeleteView/DeleteView.mjs';
|
|
6
6
|
import { useDeleteView } from './LocationActionView/DeleteView/useDeleteView.mjs';
|
|
7
|
-
import './LocationActionView/UploadView/UploadView.mjs';
|
|
8
|
-
import { useUploadView } from './LocationActionView/UploadView/useUploadView.mjs';
|
|
9
|
-
import { useActionView } from './LocationActionView/useActionView.mjs';
|
|
10
7
|
import 'react';
|
|
11
|
-
import '../actions/configs/context.mjs';
|
|
12
|
-
import '@aws-amplify/storage/internals';
|
|
13
|
-
import '@aws-amplify/ui';
|
|
14
|
-
import 'aws-amplify/storage';
|
|
15
|
-
import '@aws-amplify/ui-react-core';
|
|
16
8
|
import '../providers/store/location/context.mjs';
|
|
17
9
|
import '../providers/store/files/context.mjs';
|
|
18
10
|
import '../providers/store/actionType/context.mjs';
|
|
19
11
|
import '../providers/store/locationItems/context.mjs';
|
|
12
|
+
import './context/actionViews.mjs';
|
|
13
|
+
import './LocationActionView/UploadView/UploadView.mjs';
|
|
14
|
+
import { useUploadView } from './LocationActionView/UploadView/useUploadView.mjs';
|
|
15
|
+
import '@aws-amplify/ui';
|
|
20
16
|
import './LocationsView/LocationsView.mjs';
|
|
21
17
|
import { useLocationsView } from './LocationsView/useLocationsView.mjs';
|
|
22
18
|
import './LocationDetailView/LocationDetailView.mjs';
|
|
23
19
|
import { useLocationDetailView } from './LocationDetailView/useLocationDetailView.mjs';
|
|
24
20
|
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
21
|
+
const USE_VIEW_HOOKS = {
|
|
22
|
+
Copy: useCopyView,
|
|
23
|
+
CreateFolder: useCreateFolderView,
|
|
24
|
+
Delete: useDeleteView,
|
|
25
|
+
LocationDetail: useLocationDetailView,
|
|
26
|
+
Locations: useLocationsView,
|
|
27
|
+
Upload: useUploadView,
|
|
32
28
|
};
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}), {});
|
|
41
|
-
return function useView(type) {
|
|
42
|
-
// todo: add assertion here
|
|
43
|
-
return hooks[type](type);
|
|
44
|
-
};
|
|
29
|
+
const isUseViewType = (value) => !!USE_VIEW_HOOKS?.[value];
|
|
30
|
+
// @ts-expect-error
|
|
31
|
+
const useView = (type) => {
|
|
32
|
+
if (!isUseViewType(type)) {
|
|
33
|
+
throw new Error(`Value of \`${type}\` cannot be used to index \`useView\``);
|
|
34
|
+
}
|
|
35
|
+
return USE_VIEW_HOOKS[type]();
|
|
45
36
|
};
|
|
46
37
|
|
|
47
|
-
export {
|
|
38
|
+
export { useView };
|
package/dist/esm/version.mjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ var uiReactCore = require('@aws-amplify/ui-react-core');
|
|
|
9
9
|
var auth = require('aws-amplify/auth');
|
|
10
10
|
var storage = require('aws-amplify/storage');
|
|
11
11
|
var internal = require('@aws-amplify/ui-react/internal');
|
|
12
|
-
var createAmplifyAuthAdapter = require('./createAmplifyAuthAdapter-
|
|
12
|
+
var createAmplifyAuthAdapter = require('./createAmplifyAuthAdapter-0MaHde-Z.js');
|
|
13
13
|
require('@aws-amplify/storage/internals');
|
|
14
14
|
require('@aws-amplify/ui-react-core/elements');
|
|
15
15
|
require('aws-amplify');
|
|
@@ -551,8 +551,6 @@ function FilePicker$1({ children, className = ui.ComponentClassName.FileUploader
|
|
|
551
551
|
return (React__namespace["default"].createElement(uiReact.Button, { ...props, className: className, size: size }, children));
|
|
552
552
|
}
|
|
553
553
|
|
|
554
|
-
const VERSION = '3.4.1';
|
|
555
|
-
|
|
556
554
|
const logger$1 = ui.getLogger('Storage');
|
|
557
555
|
const MISSING_REQUIRED_PROPS_MESSAGE$1 = '`FileUploader` requires a `maxFileCount` prop to be provided.';
|
|
558
556
|
const ACCESS_LEVEL_WITH_PATH_CALLBACK_MESSAGE$1 = '`FileUploader` does not allow usage of a `path` callback prop with an `accessLevel` prop.';
|
|
@@ -692,7 +690,7 @@ const FileUploaderBase = React__namespace.forwardRef(function FileUploader({ acc
|
|
|
692
690
|
uiReactCore.useSetUserAgent({
|
|
693
691
|
componentName: 'FileUploader',
|
|
694
692
|
packageName: 'react-storage',
|
|
695
|
-
version: VERSION,
|
|
693
|
+
version: createAmplifyAuthAdapter.VERSION,
|
|
696
694
|
});
|
|
697
695
|
return (React__namespace.createElement(Components.Container, { className: `${ui.ComponentClassName.FileUploader} ${hasFiles ? ui.ComponentClassName.FileUploaderPreviewer : ''}` },
|
|
698
696
|
React__namespace.createElement(Components.DropZone, { inDropZone: dragState !== 'inactive', ...dropZoneProps, displayText: displayText },
|
|
@@ -747,7 +745,7 @@ const StorageImage = ({ accessLevel, className, fallbackSrc, identityId, imgKey,
|
|
|
747
745
|
uiReactCore.useSetUserAgent({
|
|
748
746
|
componentName: 'StorageImage',
|
|
749
747
|
packageName: 'react-storage',
|
|
750
|
-
version: VERSION,
|
|
748
|
+
version: createAmplifyAuthAdapter.VERSION,
|
|
751
749
|
});
|
|
752
750
|
const onError = onGetUrlError ?? onStorageGetError;
|
|
753
751
|
const input = React__namespace.useMemo(() => ({
|
|
@@ -1032,7 +1030,7 @@ const StorageManagerBase = React__namespace.forwardRef(function StorageManager({
|
|
|
1032
1030
|
uiReactCore.useSetUserAgent({
|
|
1033
1031
|
componentName: 'StorageManager',
|
|
1034
1032
|
packageName: 'react-storage',
|
|
1035
|
-
version: VERSION,
|
|
1033
|
+
version: createAmplifyAuthAdapter.VERSION,
|
|
1036
1034
|
});
|
|
1037
1035
|
return (React__namespace.createElement(Components.Container, { className: `${ui.ComponentClassName.StorageManager} ${hasFiles ? ui.ComponentClassName.StorageManagerPreviewer : ''}` },
|
|
1038
1036
|
React__namespace.createElement(Components.DropZone, { inDropZone: dragState !== 'inactive', ...dropZoneProps, displayText: displayText },
|
|
@@ -1055,10 +1053,7 @@ const StorageManager = Object.assign({}, StorageManagerBase, {
|
|
|
1055
1053
|
});
|
|
1056
1054
|
|
|
1057
1055
|
const StorageBrowser = ({ views, displayText, }) => {
|
|
1058
|
-
const { StorageBrowser } = React__namespace["default"].useRef(createAmplifyAuthAdapter.createStorageBrowser({
|
|
1059
|
-
components: createAmplifyAuthAdapter.componentsDefault,
|
|
1060
|
-
config: createAmplifyAuthAdapter.createAmplifyAuthAdapter(),
|
|
1061
|
-
})).current;
|
|
1056
|
+
const { StorageBrowser } = React__namespace["default"].useRef(createAmplifyAuthAdapter.createStorageBrowser({ config: createAmplifyAuthAdapter.createAmplifyAuthAdapter() })).current;
|
|
1062
1057
|
return React__namespace["default"].createElement(StorageBrowser, { views: views, displayText: displayText });
|
|
1063
1058
|
};
|
|
1064
1059
|
|
package/dist/styles.css
CHANGED
|
@@ -6842,12 +6842,16 @@ html[dir=rtl] .amplify-field-group__inner-start {
|
|
|
6842
6842
|
flex-direction: row;
|
|
6843
6843
|
align-items: flex-start;
|
|
6844
6844
|
gap: var(--amplify-components-ai-conversation-form-gap);
|
|
6845
|
-
padding: var(--amplify-components-ai-conversation-form-padding);
|
|
6846
6845
|
}
|
|
6847
6846
|
.amplify-ai-conversation__form__dropzone {
|
|
6848
6847
|
text-align: initial;
|
|
6849
6848
|
border: none;
|
|
6849
|
+
padding: var(--amplify-components-ai-conversation-form-padding);
|
|
6850
|
+
}
|
|
6851
|
+
.amplify-ai-conversation__form__error {
|
|
6850
6852
|
padding: 0;
|
|
6853
|
+
padding-block-start: var(--amplify-components-ai-conversation-attachment-list-padding-block-start);
|
|
6854
|
+
gap: var(--amplify-components-ai-conversation-attachment-gap);
|
|
6851
6855
|
}
|
|
6852
6856
|
.amplify-ai-conversation__attachment {
|
|
6853
6857
|
display: flex;
|
|
@@ -6867,7 +6871,7 @@ html[dir=rtl] .amplify-field-group__inner-start {
|
|
|
6867
6871
|
flex-direction: row;
|
|
6868
6872
|
flex-wrap: wrap;
|
|
6869
6873
|
gap: var(--amplify-components-ai-conversation-attachment-list-gap);
|
|
6870
|
-
padding-block-start: var(--amplify-components-ai-conversation-attachment-padding-block-start);
|
|
6874
|
+
padding-block-start: var(--amplify-components-ai-conversation-attachment-list-padding-block-start);
|
|
6871
6875
|
}
|
|
6872
6876
|
.amplify-ai-conversation__attachment__image {
|
|
6873
6877
|
width: var(--amplify-components-ai-conversation-attachment-image-width);
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { ActionViewConfigs } from './types';
|
|
3
3
|
export interface ActionConfigsProviderProps {
|
|
4
|
-
|
|
4
|
+
actionConfigs: ActionViewConfigs;
|
|
5
5
|
children?: React.ReactNode;
|
|
6
6
|
}
|
|
7
7
|
export declare const useActionConfigs: (params?: {
|
|
8
8
|
errorMessage?: string | undefined;
|
|
9
9
|
} | undefined) => {
|
|
10
|
-
|
|
10
|
+
actionConfigs: ActionViewConfigs | undefined;
|
|
11
11
|
}, ActionConfigsProvider: import("react").ComponentType<import("react").PropsWithChildren<{
|
|
12
|
-
|
|
12
|
+
actionConfigs: ActionViewConfigs | undefined;
|
|
13
13
|
}>>;
|
|
14
|
-
export declare function useActionConfig<T extends keyof ActionConfigs>(type?: T): ActionConfigs[T];
|
|
@@ -1,24 +1,23 @@
|
|
|
1
|
-
import { CopyActionConfig, CreateFolderActionConfig, DeleteActionConfig,
|
|
1
|
+
import { CopyActionConfig, CreateFolderActionConfig, DeleteActionConfig, UploadActionConfig } from './types';
|
|
2
2
|
export declare const copyActionConfig: CopyActionConfig;
|
|
3
3
|
export declare const deleteActionConfig: DeleteActionConfig;
|
|
4
4
|
export declare const createFolderActionConfig: CreateFolderActionConfig;
|
|
5
|
-
export declare const listLocationItemsActionConfig: ListLocationItemsActionConfig;
|
|
6
|
-
export declare const listLocationsActionConfig: ListLocationsActionConfig;
|
|
7
5
|
export declare const uploadActionConfig: UploadActionConfig;
|
|
8
6
|
export declare const defaultActionViewConfigs: {
|
|
9
7
|
copy: CopyActionConfig;
|
|
10
8
|
createFolder: CreateFolderActionConfig;
|
|
9
|
+
download: import("../handlers").DownloadHandler;
|
|
11
10
|
delete: DeleteActionConfig;
|
|
12
11
|
upload: UploadActionConfig;
|
|
13
12
|
};
|
|
14
13
|
export type DefaultActionViewType = keyof typeof defaultActionViewConfigs;
|
|
15
|
-
export declare const DEFAULT_ACTION_VIEW_TYPES: ("upload" | "copy" | "delete" | "createFolder")[];
|
|
16
|
-
export declare const isDefaultActionViewType: (value?: string) => value is "upload" | "copy" | "delete" | "createFolder";
|
|
14
|
+
export declare const DEFAULT_ACTION_VIEW_TYPES: ("upload" | "copy" | "delete" | "download" | "createFolder")[];
|
|
15
|
+
export declare const isDefaultActionViewType: (value?: string) => value is "upload" | "copy" | "delete" | "download" | "createFolder";
|
|
17
16
|
export declare const defaultActionConfigs: {
|
|
18
|
-
listLocationItems:
|
|
19
|
-
listLocations: ListLocationsActionConfig;
|
|
17
|
+
listLocationItems: import("../handlers").ListLocationItemsHandler;
|
|
20
18
|
copy: CopyActionConfig;
|
|
21
19
|
createFolder: CreateFolderActionConfig;
|
|
20
|
+
download: import("../handlers").DownloadHandler;
|
|
22
21
|
delete: DeleteActionConfig;
|
|
23
22
|
upload: UploadActionConfig;
|
|
24
23
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export { ActionConfigsProvider, ActionConfigsProviderProps,
|
|
2
|
-
export { defaultActionConfigs, defaultActionViewConfigs, isDefaultActionViewType, } from './defaults';
|
|
1
|
+
export { ActionConfigsProvider, ActionConfigsProviderProps, useActionConfigs, } from './context';
|
|
2
|
+
export { defaultActionConfigs, defaultActionViewConfigs, DefaultActionViewType, isDefaultActionViewType, } from './defaults';
|
|
3
3
|
export * from './types';
|
|
4
|
+
export { getActionConfigs } from './utils';
|
|
@@ -1,38 +1,15 @@
|
|
|
1
1
|
import { StorageBrowserIconType } from '../../context/elements';
|
|
2
|
-
import { LocationPermissions } from '
|
|
3
|
-
|
|
2
|
+
import { CopyHandler, CreateFolderHandler, DeleteHandler, DownloadHandler, ListLocationItemsHandler, ListLocations, LocationItemData, LocationPermissions, TaskData, TaskHandler, TaskHandlerInput, TaskHandlerOutput, UploadHandler } from '../handlers';
|
|
3
|
+
export type ActionHandler<TData = any, RValue = any> = TaskHandler<TaskHandlerInput<TData & TaskData>, TaskHandlerOutput<RValue>>;
|
|
4
4
|
type StringWithoutSpaces<T extends string> = Exclude<T, ` ${string}` | `${string} ` | `${string} ${string}`>;
|
|
5
|
-
export type
|
|
6
|
-
type ActionName = StringWithoutSpaces<
|
|
7
|
-
/**
|
|
8
|
-
* native OS file picker type. to restrict selectable file types, define the picker types
|
|
9
|
-
* followed by accepted file types as strings
|
|
10
|
-
* @example
|
|
11
|
-
* ```ts
|
|
12
|
-
* type JPEGOnly = ['FOLDER', '.jpeg'];
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
export type SelectionType = LocationItemType | [LocationItemType, ...string[]];
|
|
16
|
-
export interface ActionConfigTemplate<T> {
|
|
17
|
-
/**
|
|
18
|
-
* The name of the component associated with the action
|
|
19
|
-
*/
|
|
20
|
-
componentName: ComponentName;
|
|
21
|
-
/**
|
|
22
|
-
* action handler
|
|
23
|
-
*/
|
|
24
|
-
handler: T;
|
|
25
|
-
}
|
|
5
|
+
export type ViewName = Capitalize<`${string}View`>;
|
|
6
|
+
export type ActionName<T extends string = string> = StringWithoutSpaces<T>;
|
|
26
7
|
export interface ActionListItemConfig {
|
|
27
8
|
/**
|
|
28
9
|
* conditionally disable item selection based on currently selected values
|
|
29
10
|
* @default false
|
|
30
11
|
*/
|
|
31
12
|
disable?: (selectedValues: LocationItemData[] | undefined) => boolean;
|
|
32
|
-
/**
|
|
33
|
-
* open native OS file picker with associated selection type on item select
|
|
34
|
-
*/
|
|
35
|
-
fileSelection?: SelectionType;
|
|
36
13
|
/**
|
|
37
14
|
* conditionally render list item based on location permission
|
|
38
15
|
* @default false
|
|
@@ -51,61 +28,54 @@ export interface ActionListItemConfig {
|
|
|
51
28
|
* defines an action to be included in the actions list of the `LocationDetailView` with
|
|
52
29
|
* a dedicated subcomponent of the `LocationActionView`
|
|
53
30
|
*/
|
|
54
|
-
export interface
|
|
55
|
-
/**
|
|
56
|
-
* configure action list item behavior. provide multiple configs
|
|
57
|
-
* to create additional list items for a single action
|
|
58
|
-
*/
|
|
59
|
-
actionsListItemConfig?: ActionListItemConfig;
|
|
31
|
+
export interface ActionViewConfig<T extends ActionHandler = ActionHandler, K extends ViewName = ViewName> {
|
|
60
32
|
/**
|
|
61
|
-
*
|
|
62
|
-
* @default false
|
|
33
|
+
* action handler
|
|
63
34
|
*/
|
|
64
|
-
|
|
35
|
+
handler: T;
|
|
65
36
|
/**
|
|
66
|
-
*
|
|
67
|
-
*
|
|
37
|
+
* The view slot name associated with the action provided on the
|
|
38
|
+
* `StorageBrowser` through the `views` prop
|
|
68
39
|
*/
|
|
69
|
-
|
|
40
|
+
viewName: K;
|
|
70
41
|
/**
|
|
71
|
-
*
|
|
42
|
+
* configure action list item behavior. provide multiple configs
|
|
43
|
+
* to create additional list items for a single action
|
|
72
44
|
*/
|
|
73
|
-
|
|
45
|
+
actionListItem: ActionListItemConfig;
|
|
74
46
|
}
|
|
75
|
-
export interface
|
|
47
|
+
export interface UploadActionConfig extends ActionViewConfig<UploadHandler, 'UploadView'> {
|
|
76
48
|
}
|
|
77
|
-
export interface
|
|
78
|
-
componentName: 'UploadView';
|
|
49
|
+
export interface DeleteActionConfig extends ActionViewConfig<DeleteHandler, 'DeleteView'> {
|
|
79
50
|
}
|
|
80
|
-
export interface
|
|
81
|
-
componentName: 'DeleteView';
|
|
51
|
+
export interface CopyActionConfig extends ActionViewConfig<CopyHandler, 'CopyView'> {
|
|
82
52
|
}
|
|
83
|
-
export interface
|
|
84
|
-
componentName: 'CopyView';
|
|
53
|
+
export interface CreateFolderActionConfig extends ActionViewConfig<CreateFolderHandler, 'CreateFolderView'> {
|
|
85
54
|
}
|
|
86
|
-
export interface
|
|
87
|
-
|
|
55
|
+
export interface ListActionConfig<T> {
|
|
56
|
+
/**
|
|
57
|
+
* action handler
|
|
58
|
+
*/
|
|
59
|
+
handler: T;
|
|
88
60
|
}
|
|
89
|
-
export interface
|
|
90
|
-
|
|
91
|
-
|
|
61
|
+
export interface DefaultActionConfigs {
|
|
62
|
+
createFolder?: CreateFolderActionConfig;
|
|
63
|
+
listLocationItems?: ListLocationItemsHandler;
|
|
64
|
+
upload?: UploadActionConfig;
|
|
65
|
+
delete?: DeleteActionConfig;
|
|
66
|
+
download?: DownloadHandler;
|
|
67
|
+
copy?: CopyActionConfig;
|
|
92
68
|
}
|
|
93
|
-
export interface
|
|
94
|
-
|
|
95
|
-
displayName: (bucket: string | undefined, prefix: string | undefined) => string;
|
|
69
|
+
export interface ExtendedDefaultActionConfigs extends Required<DefaultActionConfigs> {
|
|
70
|
+
listLocations: ListLocations;
|
|
96
71
|
}
|
|
97
|
-
export
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
72
|
+
export type CustomActionConfigs = Record<ActionName, ActionViewConfig | ActionHandler>;
|
|
73
|
+
/**
|
|
74
|
+
* @internal @unstable
|
|
75
|
+
*/
|
|
76
|
+
export interface ExtendedActionConfigs {
|
|
77
|
+
default?: ExtendedDefaultActionConfigs;
|
|
78
|
+
custom?: CustomActionConfigs;
|
|
104
79
|
}
|
|
105
|
-
export type
|
|
106
|
-
export type ActionConfigs<ActionsKeys extends ActionName = ActionName> = Record<ActionsKeys, ListLocationItemsActionConfig | ListLocationsActionConfig | CreateFolderActionConfig | UploadActionConfig | TaskActionConfig>;
|
|
107
|
-
export type ResolveActionHandler<T> = T extends TaskActionConfig<infer K> | ListActionConfig<infer K> ? K : never;
|
|
108
|
-
export type ResolveActionHandlers<T> = {
|
|
109
|
-
[K in keyof T]: ResolveActionHandler<T[K]>;
|
|
110
|
-
};
|
|
80
|
+
export type ActionViewConfigs<ActionsKeys extends ActionName = ActionName> = Record<ActionsKeys, ActionViewConfig>;
|
|
111
81
|
export {};
|
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export interface CopyHandlerData extends
|
|
1
|
+
import { TaskData, TaskHandler, TaskHandlerInput, TaskHandlerOptions, TaskHandlerOutput } from './types';
|
|
2
|
+
export interface CopyHandlerData extends TaskData {
|
|
3
|
+
sourceKey: string;
|
|
4
|
+
eTag?: string;
|
|
5
|
+
fileKey: string;
|
|
6
|
+
lastModified: Date;
|
|
3
7
|
}
|
|
4
|
-
export interface CopyHandlerInput extends TaskHandlerInput<CopyHandlerData, TaskHandlerOptions
|
|
5
|
-
|
|
8
|
+
export interface CopyHandlerInput extends TaskHandlerInput<CopyHandlerData, TaskHandlerOptions<{
|
|
9
|
+
key: string;
|
|
10
|
+
}>> {
|
|
6
11
|
}
|
|
7
|
-
export interface CopyHandlerOutput extends TaskHandlerOutput
|
|
12
|
+
export interface CopyHandlerOutput extends TaskHandlerOutput<{
|
|
13
|
+
key: string;
|
|
14
|
+
}> {
|
|
8
15
|
}
|
|
9
16
|
export interface CopyHandler extends TaskHandler<CopyHandlerInput, CopyHandlerOutput> {
|
|
10
17
|
}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { TaskData, TaskHandler, TaskHandlerInput, TaskHandlerOutput, TaskHandlerOptions } from './types';
|
|
2
2
|
export interface CreateFolderHandlerData extends TaskData {
|
|
3
|
-
}
|
|
4
|
-
export interface CreateFolderHandlerOptions extends TaskHandlerOptions {
|
|
5
3
|
preventOverwrite?: boolean;
|
|
6
4
|
}
|
|
5
|
+
export interface CreateFolderHandlerOptions extends TaskHandlerOptions<{
|
|
6
|
+
key: string;
|
|
7
|
+
}> {
|
|
8
|
+
}
|
|
7
9
|
export interface CreateFolderHandlerInput extends TaskHandlerInput<CreateFolderHandlerData, CreateFolderHandlerOptions> {
|
|
8
|
-
destinationPrefix: string;
|
|
9
10
|
}
|
|
10
|
-
export interface CreateFolderHandlerOutput extends TaskHandlerOutput
|
|
11
|
+
export interface CreateFolderHandlerOutput extends TaskHandlerOutput<{
|
|
12
|
+
key: string;
|
|
13
|
+
}> {
|
|
11
14
|
}
|
|
12
15
|
export interface CreateFolderHandler extends TaskHandler<CreateFolderHandlerInput, CreateFolderHandlerOutput> {
|
|
13
16
|
}
|