@scality/data-browser-library 1.0.0-preview.13 → 1.0.0-preview.16
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/components/DataBrowserUI.d.ts +6 -14
- package/dist/components/DataBrowserUI.js +79 -55
- package/dist/components/Editor.d.ts +1 -1
- package/dist/components/Editor.js +3 -3
- package/dist/components/__tests__/BucketCreate.test.js +102 -102
- package/dist/components/__tests__/BucketDetails.test.js +122 -123
- package/dist/components/__tests__/BucketLifecycleFormPage.test.js +177 -177
- package/dist/components/__tests__/BucketLifecycleList.test.js +85 -85
- package/dist/components/__tests__/BucketList.test.js +175 -176
- package/dist/components/__tests__/BucketNotificationCreatePage.test.js +84 -84
- package/dist/components/__tests__/BucketOverview.test.js +257 -201
- package/dist/components/__tests__/BucketPolicyPage.test.js +62 -62
- package/dist/components/__tests__/BucketReplicationFormPage.test.js +542 -542
- package/dist/components/__tests__/BucketReplicationList.test.js +106 -106
- package/dist/components/__tests__/CreateFolderButton.test.js +56 -56
- package/dist/components/__tests__/DeleteBucketButton.test.js +62 -62
- package/dist/components/__tests__/DeleteBucketConfigRuleButton.test.js +47 -47
- package/dist/components/__tests__/DeleteObjectButton.test.js +63 -63
- package/dist/components/__tests__/EmptyBucketButton.test.js +56 -56
- package/dist/components/__tests__/MetadataSearch.test.js +65 -65
- package/dist/components/__tests__/ObjectList.test.js +252 -251
- package/dist/components/__tests__/UploadButton.test.js +45 -45
- package/dist/components/buckets/BucketCreate.d.ts +2 -2
- package/dist/components/buckets/BucketCreate.js +41 -41
- package/dist/components/buckets/BucketDetails.d.ts +2 -2
- package/dist/components/buckets/BucketDetails.js +48 -36
- package/dist/components/buckets/BucketLifecycleFormPage.js +161 -160
- package/dist/components/buckets/BucketLifecycleList.d.ts +2 -2
- package/dist/components/buckets/BucketLifecycleList.js +46 -46
- package/dist/components/buckets/BucketList.d.ts +2 -2
- package/dist/components/buckets/BucketList.js +28 -27
- package/dist/components/buckets/BucketLocation.js +3 -3
- package/dist/components/buckets/BucketOverview.d.ts +1 -1
- package/dist/components/buckets/BucketOverview.js +64 -65
- package/dist/components/buckets/BucketPage.js +19 -11
- package/dist/components/buckets/BucketPolicyButton.js +2 -2
- package/dist/components/buckets/BucketPolicyPage.js +27 -25
- package/dist/components/buckets/BucketReplicationFormPage.js +133 -132
- package/dist/components/buckets/BucketReplicationList.d.ts +2 -2
- package/dist/components/buckets/BucketReplicationList.js +41 -41
- package/dist/components/buckets/BucketVersioning.js +11 -11
- package/dist/components/buckets/DeleteBucketButton.js +5 -5
- package/dist/components/buckets/DeleteBucketConfigRuleButton.d.ts +2 -2
- package/dist/components/buckets/DeleteBucketConfigRuleButton.js +1 -1
- package/dist/components/buckets/EmptyBucketButton.js +19 -19
- package/dist/components/buckets/EmptyBucketSummary.d.ts +1 -1
- package/dist/components/buckets/EmptyBucketSummary.js +1 -1
- package/dist/components/buckets/EmptyBucketSummaryList.js +22 -22
- package/dist/components/buckets/__tests__/BucketVersioning.test.js +45 -45
- package/dist/components/buckets/notifications/BucketNotificationCreatePage.js +34 -33
- package/dist/components/buckets/notifications/EventsSection.js +144 -28
- package/dist/components/buckets/notifications/__tests__/events.test.d.ts +1 -0
- package/dist/components/buckets/notifications/__tests__/events.test.js +56 -0
- package/dist/components/buckets/notifications/events.d.ts +71 -7
- package/dist/components/buckets/notifications/events.js +98 -16
- package/dist/components/index.d.ts +24 -22
- package/dist/components/index.js +5 -3
- package/dist/components/layouts/ArrowNavigation.d.ts +1 -2
- package/dist/components/layouts/ArrowNavigation.js +3 -3
- package/dist/components/layouts/BrowserPageLayout.d.ts +2 -3
- package/dist/components/layouts/BrowserPageLayout.js +1 -1
- package/dist/components/objects/CreateFolderButton.d.ts +2 -2
- package/dist/components/objects/CreateFolderButton.js +9 -9
- package/dist/components/objects/DeleteObjectButton.d.ts +1 -1
- package/dist/components/objects/DeleteObjectButton.js +20 -20
- package/dist/components/objects/ObjectDetails/ObjectMetadata.d.ts +1 -1
- package/dist/components/objects/ObjectDetails/ObjectMetadata.js +56 -56
- package/dist/components/objects/ObjectDetails/ObjectSummary.d.ts +1 -1
- package/dist/components/objects/ObjectDetails/ObjectSummary.js +39 -39
- package/dist/components/objects/ObjectDetails/ObjectTags.d.ts +1 -1
- package/dist/components/objects/ObjectDetails/ObjectTags.js +25 -25
- package/dist/components/objects/ObjectDetails/__tests__/ObjectDetails.test.js +119 -119
- package/dist/components/objects/ObjectDetails/__tests__/ObjectSummary.test.js +211 -211
- package/dist/components/objects/ObjectDetails/index.d.ts +1 -1
- package/dist/components/objects/ObjectDetails/index.js +30 -30
- package/dist/components/objects/ObjectList.d.ts +5 -5
- package/dist/components/objects/ObjectList.js +113 -112
- package/dist/components/objects/ObjectLock/EditRetentionButton.js +3 -3
- package/dist/components/objects/ObjectLock/ObjectLockRetentionSettings.js +14 -14
- package/dist/components/objects/ObjectLock/ObjectLockSettings.d.ts +1 -1
- package/dist/components/objects/ObjectLock/ObjectLockSettings.js +29 -28
- package/dist/components/objects/ObjectLock/ObjectLockSettingsUtils.d.ts +1 -1
- package/dist/components/objects/ObjectLock/ObjectLockSettingsUtils.js +6 -6
- package/dist/components/objects/ObjectLock/__tests__/EditRetentionButton.test.js +50 -50
- package/dist/components/objects/ObjectLock/__tests__/ObjectLockSettings.test.js +77 -77
- package/dist/components/objects/ObjectPage.js +5 -4
- package/dist/components/objects/UploadButton.d.ts +3 -3
- package/dist/components/objects/UploadButton.js +5 -5
- package/dist/components/providers/DataBrowserProvider.d.ts +23 -12
- package/dist/components/providers/DataBrowserProvider.js +60 -38
- package/dist/components/providers/QueryProvider.d.ts +9 -0
- package/dist/components/providers/QueryProvider.js +22 -0
- package/dist/components/search/MetadataSearch.js +26 -25
- package/dist/components/search/SearchHints.js +1 -1
- package/dist/components/ui/ArrayFieldActions.js +4 -4
- package/dist/components/ui/ConfirmDeleteRuleModal.d.ts +1 -1
- package/dist/components/ui/ConfirmDeleteRuleModal.js +1 -1
- package/dist/components/ui/DeleteObjectModalContent.d.ts +1 -1
- package/dist/components/ui/DeleteObjectModalContent.js +12 -12
- package/dist/components/ui/FilterFormSection.d.ts +2 -2
- package/dist/components/ui/FilterFormSection.js +29 -29
- package/dist/components/ui/Search.elements.d.ts +1 -1
- package/dist/components/ui/Search.elements.js +7 -7
- package/dist/components/ui/Table.elements.js +5 -5
- package/dist/config/factory.d.ts +23 -10
- package/dist/config/factory.js +22 -7
- package/dist/config/types.d.ts +20 -3
- package/dist/contexts/DataBrowserUICustomizationContext.d.ts +2 -2
- package/dist/hooks/__tests__/useISVBucketDetection.test.js +42 -42
- package/dist/hooks/__tests__/useIsBucketEmpty.test.js +25 -25
- package/dist/hooks/bucketConfiguration.d.ts +1 -1
- package/dist/hooks/bucketConfiguration.js +48 -48
- package/dist/hooks/bucketOperations.d.ts +1 -1
- package/dist/hooks/bucketOperations.js +6 -6
- package/dist/hooks/factories/__tests__/useCreateS3FunctionMutationHook.test.js +78 -78
- package/dist/hooks/factories/__tests__/useCreateS3InfiniteQueryHook.test.js +78 -78
- package/dist/hooks/factories/__tests__/useCreateS3LoginHook.test.js +42 -42
- package/dist/hooks/factories/__tests__/useCreateS3MutationHook.test.js +61 -61
- package/dist/hooks/factories/__tests__/useCreateS3QueryHook.test.js +63 -63
- package/dist/hooks/factories/index.d.ts +4 -4
- package/dist/hooks/factories/useCreateS3InfiniteQueryHook.d.ts +2 -2
- package/dist/hooks/factories/useCreateS3InfiniteQueryHook.js +15 -12
- package/dist/hooks/factories/useCreateS3LoginHook.d.ts +2 -2
- package/dist/hooks/factories/useCreateS3MutationHook.d.ts +3 -3
- package/dist/hooks/factories/useCreateS3MutationHook.js +6 -1
- package/dist/hooks/factories/useCreateS3QueryHook.d.ts +2 -2
- package/dist/hooks/factories/useCreateS3QueryHook.js +8 -5
- package/dist/hooks/index.d.ts +16 -13
- package/dist/hooks/index.js +4 -1
- package/dist/hooks/loginOperations.d.ts +1 -1
- package/dist/hooks/loginOperations.js +1 -1
- package/dist/hooks/objectOperations.d.ts +2 -2
- package/dist/hooks/objectOperations.js +49 -49
- package/dist/hooks/presignedOperations.d.ts +2 -2
- package/dist/hooks/presignedOperations.js +3 -3
- package/dist/hooks/useBatchObjectLegalHold.js +7 -4
- package/dist/hooks/useDataBrowserNavigate.d.ts +28 -0
- package/dist/hooks/useDataBrowserNavigate.js +24 -0
- package/dist/hooks/useDeleteBucketConfigRule.d.ts +2 -2
- package/dist/hooks/useDeleteBucketConfigRule.js +4 -4
- package/dist/hooks/useEmptyBucket.js +10 -10
- package/dist/hooks/useFeatures.d.ts +7 -0
- package/dist/hooks/useFeatures.js +8 -0
- package/dist/hooks/useISVBucketDetection.js +5 -5
- package/dist/hooks/useIsBucketEmpty.js +4 -4
- package/dist/hooks/useLoginMutation.d.ts +1 -1
- package/dist/hooks/useLoginMutation.js +1 -1
- package/dist/hooks/useS3Client.d.ts +6 -0
- package/dist/hooks/useS3Client.js +3 -2
- package/dist/hooks/useS3ConfigSwitch.d.ts +11 -0
- package/dist/hooks/useS3ConfigSwitch.js +37 -0
- package/dist/hooks/useSupportedNotificationEvents.d.ts +6 -0
- package/dist/hooks/useSupportedNotificationEvents.js +8 -0
- package/dist/index.d.ts +6 -6
- package/dist/test/msw/handlers/deleteBucket.d.ts +1 -1
- package/dist/test/msw/handlers/deleteBucket.js +20 -10
- package/dist/test/msw/handlers/getBucketAcl.d.ts +1 -1
- package/dist/test/msw/handlers/getBucketAcl.js +29 -17
- package/dist/test/msw/handlers/getBucketLocation.d.ts +1 -1
- package/dist/test/msw/handlers/getBucketLocation.js +29 -15
- package/dist/test/msw/handlers/getBucketPolicy.d.ts +1 -1
- package/dist/test/msw/handlers/getBucketPolicy.js +52 -32
- package/dist/test/msw/handlers/headObject.d.ts +1 -1
- package/dist/test/msw/handlers/headObject.js +31 -13
- package/dist/test/msw/handlers/listBuckets.d.ts +1 -1
- package/dist/test/msw/handlers/listBuckets.js +5 -3
- package/dist/test/msw/handlers/listObjectVersions.d.ts +1 -1
- package/dist/test/msw/handlers/listObjectVersions.js +38 -26
- package/dist/test/msw/handlers/listObjects.d.ts +1 -1
- package/dist/test/msw/handlers/listObjects.js +35 -23
- package/dist/test/msw/handlers/objectLegalHold.d.ts +1 -1
- package/dist/test/msw/handlers/objectLegalHold.js +31 -16
- package/dist/test/msw/handlers/objectRetention.d.ts +1 -1
- package/dist/test/msw/handlers/objectRetention.js +31 -17
- package/dist/test/msw/handlers/putBucketAcl.d.ts +1 -1
- package/dist/test/msw/handlers/putBucketAcl.js +29 -14
- package/dist/test/msw/handlers/putObject.d.ts +1 -1
- package/dist/test/msw/handlers/putObject.js +27 -12
- package/dist/test/msw/handlers.d.ts +3 -3
- package/dist/test/msw/handlers.js +72 -49
- package/dist/test/msw/index.d.ts +2 -2
- package/dist/test/msw/server.d.ts +1 -1
- package/dist/test/msw/server.js +1 -1
- package/dist/test/msw/utils.js +2 -2
- package/dist/test/setup.d.ts +1 -1
- package/dist/test/setup.js +19 -19
- package/dist/test/testUtils.d.ts +9 -15
- package/dist/test/testUtils.js +73 -91
- package/dist/test/utils/errorHandling.test.js +119 -119
- package/dist/types/index.d.ts +6 -31
- package/dist/utils/__tests__/s3ConfigIdentifier.test.d.ts +1 -0
- package/dist/utils/__tests__/s3ConfigIdentifier.test.js +429 -0
- package/dist/utils/constants.js +8 -8
- package/dist/utils/deletion/index.d.ts +2 -2
- package/dist/utils/deletion/messages.d.ts +1 -1
- package/dist/utils/deletion/messages.js +4 -4
- package/dist/utils/errorHandling.d.ts +3 -3
- package/dist/utils/errorHandling.js +6 -6
- package/dist/utils/hooks.js +8 -8
- package/dist/utils/index.d.ts +5 -4
- package/dist/utils/index.js +2 -0
- package/dist/utils/proxyMiddleware.d.ts +1 -1
- package/dist/utils/proxyMiddleware.js +6 -11
- package/dist/utils/s3Client.d.ts +2 -2
- package/dist/utils/s3Client.js +1 -1
- package/dist/utils/s3ConfigIdentifier.d.ts +68 -0
- package/dist/utils/s3ConfigIdentifier.js +55 -0
- package/dist/utils/s3RuleUtils.d.ts +5 -5
- package/dist/utils/s3RuleUtils.js +17 -17
- package/package.json +2 -2
- package/dist/utils/useFeatures.d.ts +0 -1
- package/dist/utils/useFeatures.js +0 -7
|
@@ -3,65 +3,65 @@ import { useCreateS3InfiniteQueryHook } from "./factories/useCreateS3InfiniteQue
|
|
|
3
3
|
import { useCreateS3MutationHook } from "./factories/useCreateS3MutationHook.js";
|
|
4
4
|
import { useCreateS3QueryHook } from "./factories/useCreateS3QueryHook.js";
|
|
5
5
|
import { SearchObjectsV2Command, SearchObjectsVersionCommand } from "@scality/zenkoclient";
|
|
6
|
-
const useListObjects = useCreateS3InfiniteQueryHook(ListObjectsV2Command,
|
|
7
|
-
const useListObjectVersions = useCreateS3InfiniteQueryHook(ListObjectVersionsCommand,
|
|
8
|
-
const useSearchObjects = useCreateS3InfiniteQueryHook(SearchObjectsV2Command,
|
|
9
|
-
const useSearchObjectsVersions = useCreateS3InfiniteQueryHook(SearchObjectsVersionCommand,
|
|
10
|
-
const useObjectMetadata = useCreateS3QueryHook(HeadObjectCommand,
|
|
11
|
-
const useGetObject = useCreateS3QueryHook(GetObjectCommand,
|
|
12
|
-
const usePutObject = useCreateS3MutationHook(PutObjectCommand,
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
const useListObjects = useCreateS3InfiniteQueryHook(ListObjectsV2Command, 'ListObjects');
|
|
7
|
+
const useListObjectVersions = useCreateS3InfiniteQueryHook(ListObjectVersionsCommand, 'ListObjectVersions');
|
|
8
|
+
const useSearchObjects = useCreateS3InfiniteQueryHook(SearchObjectsV2Command, 'SearchObjects');
|
|
9
|
+
const useSearchObjectsVersions = useCreateS3InfiniteQueryHook(SearchObjectsVersionCommand, 'SearchObjectsVersions');
|
|
10
|
+
const useObjectMetadata = useCreateS3QueryHook(HeadObjectCommand, 'HeadObject');
|
|
11
|
+
const useGetObject = useCreateS3QueryHook(GetObjectCommand, 'GetObject');
|
|
12
|
+
const usePutObject = useCreateS3MutationHook(PutObjectCommand, 'PutObject', [
|
|
13
|
+
'ListObjects',
|
|
14
|
+
'SearchObjects'
|
|
15
15
|
]);
|
|
16
|
-
const useCreateFolder = useCreateS3MutationHook(PutObjectCommand,
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
const useCreateFolder = useCreateS3MutationHook(PutObjectCommand, 'PutObject', [
|
|
17
|
+
'ListObjects',
|
|
18
|
+
'SearchObjects'
|
|
19
19
|
]);
|
|
20
|
-
const useUploadObjects = useCreateS3MutationHook(PutObjectCommand,
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
const useUploadObjects = useCreateS3MutationHook(PutObjectCommand, 'PutObject', [
|
|
21
|
+
'ListObjects',
|
|
22
|
+
'SearchObjects'
|
|
23
23
|
]);
|
|
24
|
-
const useDeleteObject = useCreateS3MutationHook(DeleteObjectCommand,
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
const useDeleteObject = useCreateS3MutationHook(DeleteObjectCommand, 'DeleteObject', [
|
|
25
|
+
'ListObjects',
|
|
26
|
+
'SearchObjects'
|
|
27
27
|
]);
|
|
28
|
-
const useDeleteObjects = useCreateS3MutationHook(DeleteObjectsCommand,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
const useDeleteObjects = useCreateS3MutationHook(DeleteObjectsCommand, 'DeleteObjects', [
|
|
29
|
+
'ListObjects',
|
|
30
|
+
'ListObjectVersions',
|
|
31
|
+
'SearchObjects',
|
|
32
|
+
'SearchObjectsVersions'
|
|
33
33
|
]);
|
|
34
|
-
const useCopyObject = useCreateS3MutationHook(CopyObjectCommand,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
const useCopyObject = useCreateS3MutationHook(CopyObjectCommand, 'CopyObject', [
|
|
35
|
+
'ListObjects',
|
|
36
|
+
'SearchObjects',
|
|
37
|
+
'HeadObject'
|
|
38
38
|
]);
|
|
39
|
-
const useObjectRetention = useCreateS3QueryHook(GetObjectRetentionCommand,
|
|
40
|
-
const useSetObjectRetention = useCreateS3MutationHook(PutObjectRetentionCommand,
|
|
41
|
-
|
|
39
|
+
const useObjectRetention = useCreateS3QueryHook(GetObjectRetentionCommand, 'GetObjectRetention');
|
|
40
|
+
const useSetObjectRetention = useCreateS3MutationHook(PutObjectRetentionCommand, 'PutObjectRetention', [
|
|
41
|
+
'GetObjectRetention'
|
|
42
42
|
]);
|
|
43
|
-
const useObjectLegalHold = useCreateS3QueryHook(GetObjectLegalHoldCommand,
|
|
44
|
-
const useSetObjectLegalHold = useCreateS3MutationHook(PutObjectLegalHoldCommand,
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
const useObjectLegalHold = useCreateS3QueryHook(GetObjectLegalHoldCommand, 'GetObjectLegalHold');
|
|
44
|
+
const useSetObjectLegalHold = useCreateS3MutationHook(PutObjectLegalHoldCommand, 'PutObjectLegalHold', [
|
|
45
|
+
'GetObjectLegalHold',
|
|
46
|
+
'BatchObjectLegalHold'
|
|
47
47
|
]);
|
|
48
|
-
const useObjectTagging = useCreateS3QueryHook(GetObjectTaggingCommand,
|
|
49
|
-
const useSetObjectTagging = useCreateS3MutationHook(PutObjectTaggingCommand,
|
|
50
|
-
|
|
48
|
+
const useObjectTagging = useCreateS3QueryHook(GetObjectTaggingCommand, 'GetObjectTagging');
|
|
49
|
+
const useSetObjectTagging = useCreateS3MutationHook(PutObjectTaggingCommand, 'PutObjectTagging', [
|
|
50
|
+
'GetObjectTagging'
|
|
51
51
|
]);
|
|
52
|
-
const useDeleteObjectTagging = useCreateS3MutationHook(DeleteObjectTaggingCommand,
|
|
53
|
-
|
|
52
|
+
const useDeleteObjectTagging = useCreateS3MutationHook(DeleteObjectTaggingCommand, 'DeleteObjectTagging', [
|
|
53
|
+
'GetObjectTagging'
|
|
54
54
|
]);
|
|
55
|
-
const useObjectAcl = useCreateS3QueryHook(GetObjectAclCommand,
|
|
56
|
-
const useSetObjectAcl = useCreateS3MutationHook(PutObjectAclCommand,
|
|
57
|
-
|
|
55
|
+
const useObjectAcl = useCreateS3QueryHook(GetObjectAclCommand, 'GetObjectAcl');
|
|
56
|
+
const useSetObjectAcl = useCreateS3MutationHook(PutObjectAclCommand, 'PutObjectAcl', [
|
|
57
|
+
'GetObjectAcl'
|
|
58
58
|
]);
|
|
59
|
-
const useGetObjectAttributes = useCreateS3QueryHook(GetObjectAttributesCommand,
|
|
60
|
-
const useGetObjectTorrent = useCreateS3QueryHook(GetObjectTorrentCommand,
|
|
61
|
-
const useRestoreObject = useCreateS3MutationHook(RestoreObjectCommand,
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
const useGetObjectAttributes = useCreateS3QueryHook(GetObjectAttributesCommand, 'GetObjectAttributes');
|
|
60
|
+
const useGetObjectTorrent = useCreateS3QueryHook(GetObjectTorrentCommand, 'GetObjectTorrent');
|
|
61
|
+
const useRestoreObject = useCreateS3MutationHook(RestoreObjectCommand, 'RestoreObject', [
|
|
62
|
+
'HeadObject',
|
|
63
|
+
'ListObjects'
|
|
64
64
|
]);
|
|
65
|
-
const useSelectObjectContent = useCreateS3QueryHook(SelectObjectContentCommand,
|
|
66
|
-
const useListMultipartUploads = useCreateS3InfiniteQueryHook(ListMultipartUploadsCommand,
|
|
65
|
+
const useSelectObjectContent = useCreateS3QueryHook(SelectObjectContentCommand, 'SelectObjectContent');
|
|
66
|
+
const useListMultipartUploads = useCreateS3InfiniteQueryHook(ListMultipartUploadsCommand, 'ListMultipartUploads');
|
|
67
67
|
export { useCopyObject, useCreateFolder, useDeleteObject, useDeleteObjectTagging, useDeleteObjects, useGetObject, useGetObjectAttributes, useGetObjectTorrent, useListMultipartUploads, useListObjectVersions, useListObjects, useObjectAcl, useObjectLegalHold, useObjectMetadata, useObjectRetention, useObjectTagging, usePutObject, useRestoreObject, useSearchObjects, useSearchObjectsVersions, useSelectObjectContent, useSetObjectAcl, useSetObjectLegalHold, useSetObjectRetention, useSetObjectTagging, useUploadObjects };
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* 2. Get Presigned POST
|
|
7
7
|
* 3. Get Presigned Upload (PUT)
|
|
8
8
|
*/
|
|
9
|
-
import { PresignedPostOptions, PresignedPost } from
|
|
10
|
-
import { GetObjectCommandInput, PutObjectCommandInput } from
|
|
9
|
+
import { PresignedPostOptions, PresignedPost } from '@aws-sdk/s3-presigned-post';
|
|
10
|
+
import { GetObjectCommandInput, PutObjectCommandInput } from '@aws-sdk/client-s3';
|
|
11
11
|
/**
|
|
12
12
|
* Hook for getting presigned download URLs
|
|
13
13
|
*
|
|
@@ -23,7 +23,7 @@ const generatePresignedDownloadUrl = async (client, config)=>{
|
|
|
23
23
|
VersionId: config.VersionId
|
|
24
24
|
};
|
|
25
25
|
} catch (error) {
|
|
26
|
-
throw createS3OperationError(error,
|
|
26
|
+
throw createS3OperationError(error, 'GeneratePresignedDownload', config.Bucket, config.Key);
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
const generatePresignedUploadUrl = async (client, config)=>{
|
|
@@ -45,7 +45,7 @@ const generatePresignedUploadUrl = async (client, config)=>{
|
|
|
45
45
|
Key: Key
|
|
46
46
|
};
|
|
47
47
|
} catch (error) {
|
|
48
|
-
throw createS3OperationError(error,
|
|
48
|
+
throw createS3OperationError(error, 'GeneratePresignedUpload', config.Bucket, config.Key);
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
51
|
const generatePresignedPost = async (client, config)=>{
|
|
@@ -63,7 +63,7 @@ const generatePresignedPost = async (client, config)=>{
|
|
|
63
63
|
ExpiresAt: expiresAt
|
|
64
64
|
};
|
|
65
65
|
} catch (error) {
|
|
66
|
-
throw createS3OperationError(error,
|
|
66
|
+
throw createS3OperationError(error, 'GeneratePresignedPost', config.Bucket, config.Key);
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
69
|
const useGetPresignedDownload = useCreateS3FunctionMutationHook(generatePresignedDownloadUrl);
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import { useQuery } from "@tanstack/react-query";
|
|
2
2
|
import { useS3Client } from "./useS3Client.js";
|
|
3
|
+
import { useDataBrowserContext } from "../components/providers/DataBrowserProvider.js";
|
|
3
4
|
import { GetObjectLegalHoldCommand } from "@aws-sdk/client-s3";
|
|
4
5
|
const useBatchObjectLegalHold = (bucketName, objects, enabled = true)=>{
|
|
6
|
+
const { s3ConfigIdentifier } = useDataBrowserContext();
|
|
5
7
|
const s3Client = useS3Client();
|
|
6
8
|
return useQuery({
|
|
7
9
|
queryKey: [
|
|
8
|
-
|
|
10
|
+
s3ConfigIdentifier,
|
|
11
|
+
'BatchObjectLegalHold',
|
|
9
12
|
bucketName,
|
|
10
|
-
...objects.map((obj)=>`${obj.Key}:${obj.VersionId ||
|
|
13
|
+
...objects.map((obj)=>`${obj.Key}:${obj.VersionId || 'null'}`)
|
|
11
14
|
],
|
|
12
15
|
queryFn: async ()=>{
|
|
13
16
|
const results = {};
|
|
14
17
|
await Promise.allSettled(objects.map(async (obj)=>{
|
|
15
|
-
const key = `${obj.Key}:${obj.VersionId ||
|
|
18
|
+
const key = `${obj.Key}:${obj.VersionId || 'null'}`;
|
|
16
19
|
try {
|
|
17
20
|
const command = new GetObjectLegalHoldCommand({
|
|
18
21
|
Bucket: bucketName,
|
|
@@ -25,7 +28,7 @@ const useBatchObjectLegalHold = (bucketName, objects, enabled = true)=>{
|
|
|
25
28
|
results[key] = {
|
|
26
29
|
key: obj.Key,
|
|
27
30
|
versionId: obj.VersionId,
|
|
28
|
-
isLegalHoldEnabled: response.LegalHold?.Status ===
|
|
31
|
+
isLegalHoldEnabled: response.LegalHold?.Status === 'ON'
|
|
29
32
|
};
|
|
30
33
|
} catch (error) {
|
|
31
34
|
results[key] = {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { NavigateOptions } from 'react-router';
|
|
2
|
+
/**
|
|
3
|
+
* Normalizes a path by prefixing it with the basePath.
|
|
4
|
+
* Handles edge cases like missing slashes, relative paths, and root paths.
|
|
5
|
+
*
|
|
6
|
+
* @param basePath - The base path prefix (e.g., "/accounts/my-account/buckets")
|
|
7
|
+
* @param to - The target path (e.g., "/my-bucket")
|
|
8
|
+
* @returns The normalized absolute path (e.g., "/accounts/my-account/buckets/my-bucket")
|
|
9
|
+
*/
|
|
10
|
+
export declare const normalizePath: (basePath: string, to: string) => string;
|
|
11
|
+
/**
|
|
12
|
+
* Hook for navigation with automatic basePath prefixing.
|
|
13
|
+
* Must be used within DataBrowserUI component.
|
|
14
|
+
*
|
|
15
|
+
* This hook wraps react-router's useNavigate and automatically prefixes all
|
|
16
|
+
* navigation paths with the basePath configured in DataBrowserUI props.
|
|
17
|
+
* This allows internal navigation to work correctly when DataBrowserUI is
|
|
18
|
+
* mounted at any route within the application.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* // If DataBrowserUI has basePath="/accounts/my-account/buckets"
|
|
23
|
+
* const navigate = useDataBrowserNavigate();
|
|
24
|
+
* navigate('/my-bucket'); // Navigates to "/accounts/my-account/buckets/my-bucket"
|
|
25
|
+
* navigate(-1); // History navigation works as normal (no prefixing)
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare const useDataBrowserNavigate: () => (to: string | number, options?: NavigateOptions) => void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useCallback } from "react";
|
|
2
|
+
import { useNavigate } from "react-router";
|
|
3
|
+
import { useDataBrowserUICustomization } from "../contexts/DataBrowserUICustomizationContext.js";
|
|
4
|
+
const normalizePath = (basePath, to)=>{
|
|
5
|
+
if (!basePath) return to;
|
|
6
|
+
if (!to.startsWith('/')) return to;
|
|
7
|
+
const base = basePath.replace(/^\/+|\/+$/g, '');
|
|
8
|
+
const path = to.replace(/^\/+/, '');
|
|
9
|
+
if (!path) return base ? `/${base}` : '/';
|
|
10
|
+
return `/${base}/${path}`.replace(/\/+/g, '/');
|
|
11
|
+
};
|
|
12
|
+
const useDataBrowserNavigate = ()=>{
|
|
13
|
+
const navigate = useNavigate();
|
|
14
|
+
const { basePath = '' } = useDataBrowserUICustomization();
|
|
15
|
+
return useCallback((to, options)=>{
|
|
16
|
+
if ('number' == typeof to) return void navigate(to);
|
|
17
|
+
const targetPath = normalizePath(basePath, to);
|
|
18
|
+
options ? navigate(targetPath, options) : navigate(targetPath);
|
|
19
|
+
}, [
|
|
20
|
+
navigate,
|
|
21
|
+
basePath
|
|
22
|
+
]);
|
|
23
|
+
};
|
|
24
|
+
export { normalizePath, useDataBrowserNavigate };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { UseMutationResult } from
|
|
1
|
+
import type { UseMutationResult } from '@tanstack/react-query';
|
|
2
2
|
interface BucketCommandInput {
|
|
3
3
|
Bucket: string | undefined;
|
|
4
4
|
}
|
|
@@ -10,7 +10,7 @@ interface UseDeleteBucketConfigRuleOptions<TRule extends {
|
|
|
10
10
|
rules: TRule[];
|
|
11
11
|
updateMutation: UseMutationResult<TUpdateOutput, TError, TUpdateInput, unknown>;
|
|
12
12
|
deleteMutation: UseMutationResult<TDeleteOutput, TError, TDeleteInput, unknown>;
|
|
13
|
-
buildUpdateInput: (remainingRules: TRule[]) => Omit<TUpdateInput,
|
|
13
|
+
buildUpdateInput: (remainingRules: TRule[]) => Omit<TUpdateInput, 'Bucket'>;
|
|
14
14
|
successMessage?: string;
|
|
15
15
|
errorMessage?: string;
|
|
16
16
|
onSuccess?: () => void;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { useToast } from "@scality/core-ui";
|
|
2
|
-
function useDeleteBucketConfigRule({ bucketName, ruleId, rules, updateMutation, deleteMutation, buildUpdateInput, successMessage =
|
|
2
|
+
function useDeleteBucketConfigRule({ bucketName, ruleId, rules, updateMutation, deleteMutation, buildUpdateInput, successMessage = 'Rule deleted successfully', errorMessage = 'Failed to delete rule', onSuccess, onError }) {
|
|
3
3
|
const { showToast } = useToast();
|
|
4
4
|
const { mutate: updateConfig, status: updateStatus } = updateMutation;
|
|
5
5
|
const { mutate: deleteConfig, status: deleteStatus } = deleteMutation;
|
|
6
|
-
const isDeleting =
|
|
6
|
+
const isDeleting = 'pending' === updateStatus || 'pending' === deleteStatus;
|
|
7
7
|
const deleteRule = ()=>{
|
|
8
8
|
const remainingRules = rules.filter((rule)=>rule.ID !== ruleId);
|
|
9
9
|
const handleSuccess = ()=>{
|
|
10
10
|
showToast({
|
|
11
11
|
open: true,
|
|
12
12
|
message: successMessage,
|
|
13
|
-
status:
|
|
13
|
+
status: 'success'
|
|
14
14
|
});
|
|
15
15
|
onSuccess?.();
|
|
16
16
|
};
|
|
@@ -20,7 +20,7 @@ function useDeleteBucketConfigRule({ bucketName, ruleId, rules, updateMutation,
|
|
|
20
20
|
showToast({
|
|
21
21
|
open: true,
|
|
22
22
|
message: displayMessage,
|
|
23
|
-
status:
|
|
23
|
+
status: 'error'
|
|
24
24
|
});
|
|
25
25
|
onError?.(errorToReport);
|
|
26
26
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback, useState } from "react";
|
|
2
|
-
import { useQueryClient } from "@tanstack/react-query";
|
|
3
2
|
import { useS3Client } from "./useS3Client.js";
|
|
3
|
+
import { useInvalidateQueries } from "../components/providers/DataBrowserProvider.js";
|
|
4
4
|
import { DeleteObjectsCommand, ListObjectVersionsCommand } from "@aws-sdk/client-s3";
|
|
5
5
|
const useEmptyBucket = (options = {})=>{
|
|
6
6
|
const { maxObjects = 20000, maxKeysPerList = 1000, bypassGovernanceRetention = true, onProgress, onSuccess, onError } = options;
|
|
@@ -8,7 +8,7 @@ const useEmptyBucket = (options = {})=>{
|
|
|
8
8
|
const [error, setError] = useState(null);
|
|
9
9
|
const [result, setResult] = useState(null);
|
|
10
10
|
const s3Client = useS3Client();
|
|
11
|
-
const
|
|
11
|
+
const invalidateQueries = useInvalidateQueries();
|
|
12
12
|
const emptyBucket = useCallback(async (bucketName)=>{
|
|
13
13
|
setIsEmptying(true);
|
|
14
14
|
setError(null);
|
|
@@ -50,7 +50,7 @@ const useEmptyBucket = (options = {})=>{
|
|
|
50
50
|
deletedCount += successCount;
|
|
51
51
|
totalAttempted += objectsToDelete.length;
|
|
52
52
|
if (deleteResponse.Errors) allErrors.push(...deleteResponse.Errors.map((error)=>({
|
|
53
|
-
key: error.Key ||
|
|
53
|
+
key: error.Key || 'unknown',
|
|
54
54
|
code: error.Code,
|
|
55
55
|
message: error.Message
|
|
56
56
|
})));
|
|
@@ -70,20 +70,20 @@ const useEmptyBucket = (options = {})=>{
|
|
|
70
70
|
limitReached
|
|
71
71
|
};
|
|
72
72
|
setResult(bucketResult);
|
|
73
|
-
|
|
73
|
+
invalidateQueries({
|
|
74
74
|
queryKey: [
|
|
75
|
-
|
|
75
|
+
'ListObjects'
|
|
76
76
|
]
|
|
77
77
|
});
|
|
78
|
-
|
|
78
|
+
invalidateQueries({
|
|
79
79
|
queryKey: [
|
|
80
|
-
|
|
80
|
+
'ListObjectVersions'
|
|
81
81
|
]
|
|
82
82
|
});
|
|
83
83
|
onSuccess?.(bucketResult);
|
|
84
84
|
return bucketResult;
|
|
85
85
|
} catch (err) {
|
|
86
|
-
const errorObj = err instanceof Error ? err : new Error(
|
|
86
|
+
const errorObj = err instanceof Error ? err : new Error('Failed to empty bucket');
|
|
87
87
|
setError(errorObj);
|
|
88
88
|
onError?.(errorObj);
|
|
89
89
|
return null;
|
|
@@ -92,13 +92,13 @@ const useEmptyBucket = (options = {})=>{
|
|
|
92
92
|
}
|
|
93
93
|
}, [
|
|
94
94
|
s3Client,
|
|
95
|
+
invalidateQueries,
|
|
95
96
|
maxObjects,
|
|
96
97
|
maxKeysPerList,
|
|
97
98
|
bypassGovernanceRetention,
|
|
98
99
|
onProgress,
|
|
99
100
|
onSuccess,
|
|
100
|
-
onError
|
|
101
|
-
queryClient
|
|
101
|
+
onError
|
|
102
102
|
]);
|
|
103
103
|
const reset = useCallback(()=>{
|
|
104
104
|
setIsEmptying(false);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook to check if a feature is enabled in the S3 configuration.
|
|
3
|
+
*
|
|
4
|
+
* @param feature - The feature name to check
|
|
5
|
+
* @returns true if enabled, false if disabled, undefined if config not available
|
|
6
|
+
*/
|
|
7
|
+
export declare function useFeatures(feature: string): boolean | undefined;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { useDataBrowserContext } from "../components/providers/DataBrowserProvider.js";
|
|
2
|
+
function useFeatures(feature) {
|
|
3
|
+
const { getS3Config } = useDataBrowserContext();
|
|
4
|
+
if (!getS3Config) return;
|
|
5
|
+
const config = getS3Config();
|
|
6
|
+
return config.features?.includes(feature) ?? false;
|
|
7
|
+
}
|
|
8
|
+
export { useFeatures };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { useGetBucketTagging } from "./bucketConfiguration.js";
|
|
2
|
-
import { useFeatures } from "
|
|
2
|
+
import { useFeatures } from "./useFeatures.js";
|
|
3
3
|
import { BUCKET_TAG_APPLICATION, BUCKET_TAG_VEEAM_APPLICATION, COMMVAULT_APPLICATION, VEEAM_BACKUP_REPLICATION, VEEAM_OFFICE_365, VEEAM_OFFICE_365_V8, VEEAM_VBO_APPLICATION } from "../utils/constants.js";
|
|
4
4
|
const useISVBucketStatus = (bucketName)=>{
|
|
5
|
-
const isISVFeatureEnabled = useFeatures(
|
|
5
|
+
const isISVFeatureEnabled = useFeatures('ISV');
|
|
6
6
|
const { data: bucketTags, status: bucketTagsStatus } = useGetBucketTagging({
|
|
7
7
|
Bucket: bucketName
|
|
8
8
|
}, {
|
|
9
|
-
enabled: isISVFeatureEnabled
|
|
9
|
+
enabled: true === isISVFeatureEnabled
|
|
10
10
|
});
|
|
11
11
|
const veeamTagApplication = bucketTags?.TagSet?.find((tag)=>tag.Key === BUCKET_TAG_VEEAM_APPLICATION)?.Value;
|
|
12
12
|
const ISVApplicationTag = bucketTags?.TagSet?.find((tag)=>tag.Key === BUCKET_TAG_APPLICATION)?.Value;
|
|
@@ -19,8 +19,8 @@ const useISVBucketStatus = (bucketName)=>{
|
|
|
19
19
|
isVeeamBucket: isVeeam,
|
|
20
20
|
isCommvaultBucket,
|
|
21
21
|
isISVManaged,
|
|
22
|
-
isvApplication: isCommvaultBucket ?
|
|
23
|
-
isLoading: isISVFeatureEnabled &&
|
|
22
|
+
isvApplication: isCommvaultBucket ? 'Commvault' : isVeeam ? 'Veeam' : void 0,
|
|
23
|
+
isLoading: isISVFeatureEnabled && 'pending' === bucketTagsStatus,
|
|
24
24
|
bucketTagsStatus
|
|
25
25
|
};
|
|
26
26
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { useMemo } from "react";
|
|
2
2
|
import { useListObjects } from "./objectOperations.js";
|
|
3
|
-
const isInfiniteData = (data)=>null != data &&
|
|
3
|
+
const isInfiniteData = (data)=>null != data && 'object' == typeof data && 'pages' in data && Array.isArray(data.pages);
|
|
4
4
|
const useIsBucketEmpty = (bucketName)=>{
|
|
5
5
|
const { data, status, error } = useListObjects({
|
|
6
6
|
Bucket: bucketName,
|
|
7
7
|
MaxKeys: 1,
|
|
8
|
-
Delimiter:
|
|
8
|
+
Delimiter: '/'
|
|
9
9
|
}, {
|
|
10
10
|
enabled: !!bucketName
|
|
11
11
|
});
|
|
12
12
|
const isEmpty = useMemo(()=>{
|
|
13
|
-
if (
|
|
13
|
+
if ('pending' === status || !data) return null;
|
|
14
14
|
if (!isInfiniteData(data)) return null;
|
|
15
15
|
for (const page of data.pages){
|
|
16
16
|
if (page?.Contents && page.Contents.length > 0) {
|
|
@@ -29,7 +29,7 @@ const useIsBucketEmpty = (bucketName)=>{
|
|
|
29
29
|
]);
|
|
30
30
|
return {
|
|
31
31
|
isEmpty,
|
|
32
|
-
isLoading:
|
|
32
|
+
isLoading: 'pending' === status,
|
|
33
33
|
error: error instanceof Error ? error : null
|
|
34
34
|
};
|
|
35
35
|
};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This file contains the login authentication hook using the factory pattern
|
|
5
5
|
* for consistency with other S3 operations.
|
|
6
6
|
*/
|
|
7
|
-
import { S3BrowserConfig, S3Credentials } from
|
|
7
|
+
import { S3BrowserConfig, S3Credentials } from '../types';
|
|
8
8
|
export type LoginConfig = S3BrowserConfig & {
|
|
9
9
|
credentials: S3Credentials;
|
|
10
10
|
};
|
|
@@ -5,5 +5,5 @@ class LoginAuthenticationCommand {
|
|
|
5
5
|
this.input = input;
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
|
-
const useLoginMutation = useCreateS3LoginHook(LoginAuthenticationCommand,
|
|
8
|
+
const useLoginMutation = useCreateS3LoginHook(LoginAuthenticationCommand, 'S3 Authentication');
|
|
9
9
|
export { useLoginMutation };
|
|
@@ -2,12 +2,13 @@ import { useMemo } from "react";
|
|
|
2
2
|
import { useDataBrowserContext } from "../components/providers/DataBrowserProvider.js";
|
|
3
3
|
import { createS3Client } from "../utils/s3Client.js";
|
|
4
4
|
const useS3Client = ()=>{
|
|
5
|
-
const { getS3Config } = useDataBrowserContext();
|
|
5
|
+
const { s3ConfigIdentifier, getS3Config } = useDataBrowserContext();
|
|
6
|
+
if (!getS3Config) throw new Error('useS3Client: S3 config not available. Ensure DataBrowserProvider has getS3Config prop set.');
|
|
6
7
|
return useMemo(()=>{
|
|
7
8
|
const config = getS3Config();
|
|
8
9
|
return createS3Client(config);
|
|
9
10
|
}, [
|
|
10
|
-
|
|
11
|
+
s3ConfigIdentifier
|
|
11
12
|
]);
|
|
12
13
|
};
|
|
13
14
|
export { useS3Client };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook that handles navigation and query cleanup when S3 config changes.
|
|
3
|
+
* Must be used inside both DataBrowserProvider and DataBrowserUICustomizationProvider.
|
|
4
|
+
*
|
|
5
|
+
* When the S3 config identifier changes:
|
|
6
|
+
* - Navigates to the buckets page first (to trigger component unmounting)
|
|
7
|
+
* - Clears all queries associated with the previous config (after navigation)
|
|
8
|
+
*
|
|
9
|
+
* @internal This hook is designed for internal use within DataBrowserUI only.
|
|
10
|
+
*/
|
|
11
|
+
export declare const useS3ConfigSwitch: () => void;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { useEffect, useRef } from "react";
|
|
2
|
+
import { useNavigate } from "react-router";
|
|
3
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
4
|
+
import { useDataBrowserContext } from "../components/providers/DataBrowserProvider.js";
|
|
5
|
+
import { useDataBrowserUICustomization } from "../contexts/DataBrowserUICustomizationContext.js";
|
|
6
|
+
import { normalizePath } from "./useDataBrowserNavigate.js";
|
|
7
|
+
const useS3ConfigSwitch = ()=>{
|
|
8
|
+
const { s3ConfigIdentifier } = useDataBrowserContext();
|
|
9
|
+
const { basePath = '' } = useDataBrowserUICustomization();
|
|
10
|
+
const queryClient = useQueryClient();
|
|
11
|
+
const navigate = useNavigate();
|
|
12
|
+
const prevConfigIdRef = useRef();
|
|
13
|
+
useEffect(()=>{
|
|
14
|
+
if (void 0 !== prevConfigIdRef.current && prevConfigIdRef.current !== s3ConfigIdentifier) {
|
|
15
|
+
const previousConfigId = prevConfigIdRef.current;
|
|
16
|
+
const bucketsPath = normalizePath(basePath, '/buckets');
|
|
17
|
+
navigate(bucketsPath, {
|
|
18
|
+
replace: true
|
|
19
|
+
});
|
|
20
|
+
queueMicrotask(()=>{
|
|
21
|
+
queryClient.removeQueries({
|
|
22
|
+
queryKey: [
|
|
23
|
+
previousConfigId
|
|
24
|
+
],
|
|
25
|
+
exact: false
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
prevConfigIdRef.current = s3ConfigIdentifier;
|
|
30
|
+
}, [
|
|
31
|
+
s3ConfigIdentifier,
|
|
32
|
+
navigate,
|
|
33
|
+
basePath,
|
|
34
|
+
queryClient
|
|
35
|
+
]);
|
|
36
|
+
};
|
|
37
|
+
export { useS3ConfigSwitch };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { S3EventType } from '../config/types';
|
|
2
|
+
/**
|
|
3
|
+
* Hook to get supported notification events from the DataBrowser configuration
|
|
4
|
+
* If no supported events are configured, returns undefined (meaning all events are supported)
|
|
5
|
+
*/
|
|
6
|
+
export declare function useSupportedNotificationEvents(): S3EventType[] | undefined;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { useDataBrowserContext } from "../components/providers/DataBrowserProvider.js";
|
|
2
|
+
function useSupportedNotificationEvents() {
|
|
3
|
+
const { getS3Config } = useDataBrowserContext();
|
|
4
|
+
if (!getS3Config) return;
|
|
5
|
+
const config = getS3Config();
|
|
6
|
+
return config?.supportedNotificationEvents;
|
|
7
|
+
}
|
|
8
|
+
export { useSupportedNotificationEvents };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
1
|
+
export * from './components';
|
|
2
|
+
export * from './hooks';
|
|
3
|
+
export * from './types';
|
|
4
|
+
export * from './utils';
|
|
5
|
+
export * from './config/factory';
|
|
6
|
+
export * from './config/types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const deleteBucketHandler: import("msw").
|
|
1
|
+
export declare const deleteBucketHandler: import("msw").HttpHandler;
|
|
@@ -1,14 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HttpResponse, http } from "msw";
|
|
2
2
|
import { createS3ErrorXml, getS3BaseUrl } from "../utils.js";
|
|
3
|
-
const deleteBucketHandler =
|
|
4
|
-
const { bucketName } =
|
|
5
|
-
if (
|
|
6
|
-
if (bucketName.includes(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
if (bucketName.includes(
|
|
10
|
-
|
|
3
|
+
const deleteBucketHandler = http["delete"](`${getS3BaseUrl()}/:bucketName`, async ({ params })=>{
|
|
4
|
+
const { bucketName } = params;
|
|
5
|
+
if ('string' == typeof bucketName) {
|
|
6
|
+
if (bucketName.includes('non-existent-bucket')) return HttpResponse.xml(createS3ErrorXml('NoSuchBucket', 'The specified bucket does not exist', bucketName), {
|
|
7
|
+
status: 404
|
|
8
|
+
});
|
|
9
|
+
if (bucketName.includes('bucket-not-empty')) return HttpResponse.xml(createS3ErrorXml('BucketNotEmpty', 'The bucket you tried to delete is not empty', bucketName), {
|
|
10
|
+
status: 409
|
|
11
|
+
});
|
|
12
|
+
if (bucketName.includes('restricted-bucket')) return HttpResponse.xml(createS3ErrorXml('AccessDenied', 'Access Denied'), {
|
|
13
|
+
status: 403
|
|
14
|
+
});
|
|
15
|
+
if (bucketName.includes('network-error-bucket')) return HttpResponse.error();
|
|
16
|
+
if (bucketName.includes('error-callback-bucket')) return HttpResponse.xml(createS3ErrorXml('InternalError', 'We encountered an internal error. Please try again.'), {
|
|
17
|
+
status: 500
|
|
18
|
+
});
|
|
11
19
|
}
|
|
12
|
-
return
|
|
20
|
+
return new Response(null, {
|
|
21
|
+
status: 204
|
|
22
|
+
});
|
|
13
23
|
});
|
|
14
24
|
export { deleteBucketHandler };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const getBucketAclHandler: import("msw").
|
|
1
|
+
export declare const getBucketAclHandler: import("msw").HttpHandler;
|