@scality/data-browser-library 1.0.0-preview.11
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/Editor.d.ts +12 -0
- package/dist/components/Editor.js +28 -0
- package/dist/components/__tests__/BucketCreate.test.d.ts +1 -0
- package/dist/components/__tests__/BucketCreate.test.js +408 -0
- package/dist/components/__tests__/BucketLifecycleFormPage.test.d.ts +1 -0
- package/dist/components/__tests__/BucketLifecycleFormPage.test.js +618 -0
- package/dist/components/__tests__/BucketLifecycleList.test.d.ts +1 -0
- package/dist/components/__tests__/BucketLifecycleList.test.js +325 -0
- package/dist/components/__tests__/BucketList.test.d.ts +1 -0
- package/dist/components/__tests__/BucketList.test.js +415 -0
- package/dist/components/__tests__/BucketNotificationCreatePage.test.d.ts +1 -0
- package/dist/components/__tests__/BucketNotificationCreatePage.test.js +316 -0
- package/dist/components/__tests__/BucketOverview.test.d.ts +1 -0
- package/dist/components/__tests__/BucketOverview.test.js +769 -0
- package/dist/components/__tests__/BucketPolicyPage.test.d.ts +1 -0
- package/dist/components/__tests__/BucketPolicyPage.test.js +268 -0
- package/dist/components/__tests__/BucketReplicationFormPage.test.d.ts +1 -0
- package/dist/components/__tests__/BucketReplicationFormPage.test.js +1757 -0
- package/dist/components/__tests__/BucketReplicationList.test.d.ts +1 -0
- package/dist/components/__tests__/BucketReplicationList.test.js +344 -0
- package/dist/components/__tests__/CreateFolderButton.test.d.ts +1 -0
- package/dist/components/__tests__/CreateFolderButton.test.js +147 -0
- package/dist/components/__tests__/DeleteBucketButton.test.d.ts +1 -0
- package/dist/components/__tests__/DeleteBucketButton.test.js +272 -0
- package/dist/components/__tests__/DeleteBucketConfigRuleButton.test.d.ts +1 -0
- package/dist/components/__tests__/DeleteBucketConfigRuleButton.test.js +196 -0
- package/dist/components/__tests__/DeleteObjectButton.test.d.ts +1 -0
- package/dist/components/__tests__/DeleteObjectButton.test.js +302 -0
- package/dist/components/__tests__/EmptyBucketButton.test.d.ts +1 -0
- package/dist/components/__tests__/EmptyBucketButton.test.js +302 -0
- package/dist/components/__tests__/MetadataSearch.test.d.ts +1 -0
- package/dist/components/__tests__/MetadataSearch.test.js +201 -0
- package/dist/components/__tests__/ObjectList.test.d.ts +1 -0
- package/dist/components/__tests__/ObjectList.test.js +283 -0
- package/dist/components/__tests__/UploadButton.test.d.ts +1 -0
- package/dist/components/__tests__/UploadButton.test.js +144 -0
- package/dist/components/buckets/BucketCreate.d.ts +49 -0
- package/dist/components/buckets/BucketCreate.js +237 -0
- package/dist/components/buckets/BucketDetails.d.ts +1 -0
- package/dist/components/buckets/BucketDetails.js +106 -0
- package/dist/components/buckets/BucketLifecycleFormPage.d.ts +15 -0
- package/dist/components/buckets/BucketLifecycleFormPage.js +1085 -0
- package/dist/components/buckets/BucketLifecycleList.d.ts +10 -0
- package/dist/components/buckets/BucketLifecycleList.js +270 -0
- package/dist/components/buckets/BucketList.d.ts +15 -0
- package/dist/components/buckets/BucketList.js +146 -0
- package/dist/components/buckets/BucketLocation.d.ts +3 -0
- package/dist/components/buckets/BucketLocation.js +16 -0
- package/dist/components/buckets/BucketOverview.d.ts +88 -0
- package/dist/components/buckets/BucketOverview.js +291 -0
- package/dist/components/buckets/BucketPage.d.ts +2 -0
- package/dist/components/buckets/BucketPage.js +47 -0
- package/dist/components/buckets/BucketPolicyButton.d.ts +7 -0
- package/dist/components/buckets/BucketPolicyButton.js +18 -0
- package/dist/components/buckets/BucketPolicyPage.d.ts +1 -0
- package/dist/components/buckets/BucketPolicyPage.js +236 -0
- package/dist/components/buckets/BucketReplicationFormPage.d.ts +1 -0
- package/dist/components/buckets/BucketReplicationFormPage.js +834 -0
- package/dist/components/buckets/BucketReplicationList.d.ts +11 -0
- package/dist/components/buckets/BucketReplicationList.js +189 -0
- package/dist/components/buckets/BucketVersioning.d.ts +4 -0
- package/dist/components/buckets/BucketVersioning.js +73 -0
- package/dist/components/buckets/DeleteBucketButton.d.ts +8 -0
- package/dist/components/buckets/DeleteBucketButton.js +78 -0
- package/dist/components/buckets/DeleteBucketConfigRuleButton.d.ts +18 -0
- package/dist/components/buckets/DeleteBucketConfigRuleButton.js +53 -0
- package/dist/components/buckets/EmptyBucketButton.d.ts +5 -0
- package/dist/components/buckets/EmptyBucketButton.js +232 -0
- package/dist/components/buckets/EmptyBucketSummary.d.ts +9 -0
- package/dist/components/buckets/EmptyBucketSummary.js +60 -0
- package/dist/components/buckets/EmptyBucketSummaryList.d.ts +13 -0
- package/dist/components/buckets/EmptyBucketSummaryList.js +140 -0
- package/dist/components/buckets/__tests__/BucketVersioning.test.d.ts +1 -0
- package/dist/components/buckets/__tests__/BucketVersioning.test.js +163 -0
- package/dist/components/buckets/notifications/BucketNotificationCreatePage.d.ts +1 -0
- package/dist/components/buckets/notifications/BucketNotificationCreatePage.js +234 -0
- package/dist/components/buckets/notifications/EventsSection.d.ts +1 -0
- package/dist/components/buckets/notifications/EventsSection.js +123 -0
- package/dist/components/buckets/notifications/events.d.ts +12 -0
- package/dist/components/buckets/notifications/events.js +27 -0
- package/dist/components/index.d.ts +21 -0
- package/dist/components/index.js +22 -0
- package/dist/components/layouts/ArrowNavigation.d.ts +4 -0
- package/dist/components/layouts/ArrowNavigation.js +16 -0
- package/dist/components/layouts/BrowserPageLayout.d.ts +12 -0
- package/dist/components/layouts/BrowserPageLayout.js +51 -0
- package/dist/components/objects/CreateFolderButton.d.ts +29 -0
- package/dist/components/objects/CreateFolderButton.js +118 -0
- package/dist/components/objects/DeleteObjectButton.d.ts +8 -0
- package/dist/components/objects/DeleteObjectButton.js +191 -0
- package/dist/components/objects/ObjectDetails/ObjectMetadata.d.ts +2 -0
- package/dist/components/objects/ObjectDetails/ObjectMetadata.js +356 -0
- package/dist/components/objects/ObjectDetails/ObjectSummary.d.ts +3 -0
- package/dist/components/objects/ObjectDetails/ObjectSummary.js +241 -0
- package/dist/components/objects/ObjectDetails/ObjectTags.d.ts +3 -0
- package/dist/components/objects/ObjectDetails/ObjectTags.js +272 -0
- package/dist/components/objects/ObjectDetails/index.d.ts +9 -0
- package/dist/components/objects/ObjectDetails/index.js +75 -0
- package/dist/components/objects/ObjectList.d.ts +40 -0
- package/dist/components/objects/ObjectList.js +453 -0
- package/dist/components/objects/ObjectLock/EditRetentionButton.d.ts +4 -0
- package/dist/components/objects/ObjectLock/EditRetentionButton.js +32 -0
- package/dist/components/objects/ObjectLock/ObjectLockRetentionSettings.d.ts +3 -0
- package/dist/components/objects/ObjectLock/ObjectLockRetentionSettings.js +211 -0
- package/dist/components/objects/ObjectLock/ObjectLockSettings.d.ts +9 -0
- package/dist/components/objects/ObjectLock/ObjectLockSettings.js +158 -0
- package/dist/components/objects/ObjectLock/ObjectLockSettingsUtils.d.ts +8 -0
- package/dist/components/objects/ObjectLock/ObjectLockSettingsUtils.js +39 -0
- package/dist/components/objects/ObjectLock/__tests__/EditRetentionButton.test.d.ts +1 -0
- package/dist/components/objects/ObjectLock/__tests__/EditRetentionButton.test.js +204 -0
- package/dist/components/objects/ObjectLock/__tests__/ObjectLockSettings.test.d.ts +1 -0
- package/dist/components/objects/ObjectLock/__tests__/ObjectLockSettings.test.js +374 -0
- package/dist/components/objects/ObjectPage.d.ts +1 -0
- package/dist/components/objects/ObjectPage.js +45 -0
- package/dist/components/objects/UploadButton.d.ts +34 -0
- package/dist/components/objects/UploadButton.js +229 -0
- package/dist/components/providers/DataBrowserProvider.d.ts +20 -0
- package/dist/components/providers/DataBrowserProvider.js +42 -0
- package/dist/components/search/MetadataSearch.d.ts +5 -0
- package/dist/components/search/MetadataSearch.js +162 -0
- package/dist/components/search/SearchHints.d.ts +8 -0
- package/dist/components/search/SearchHints.js +21 -0
- package/dist/components/ui/ArrayFieldActions.d.ts +36 -0
- package/dist/components/ui/ArrayFieldActions.js +43 -0
- package/dist/components/ui/ConfirmDeleteRuleModal.d.ts +16 -0
- package/dist/components/ui/ConfirmDeleteRuleModal.js +43 -0
- package/dist/components/ui/DeleteObjectModalContent.d.ts +5 -0
- package/dist/components/ui/DeleteObjectModalContent.js +71 -0
- package/dist/components/ui/FilterFormSection.d.ts +44 -0
- package/dist/components/ui/FilterFormSection.js +159 -0
- package/dist/components/ui/Search.elements.d.ts +17 -0
- package/dist/components/ui/Search.elements.js +59 -0
- package/dist/components/ui/Table.elements.d.ts +36 -0
- package/dist/components/ui/Table.elements.js +87 -0
- package/dist/config/factory.d.ts +63 -0
- package/dist/config/factory.js +74 -0
- package/dist/config/types.d.ts +46 -0
- package/dist/config/types.js +0 -0
- package/dist/hooks/__tests__/useISVBucketDetection.test.d.ts +1 -0
- package/dist/hooks/__tests__/useISVBucketDetection.test.js +188 -0
- package/dist/hooks/__tests__/useIsBucketEmpty.test.d.ts +1 -0
- package/dist/hooks/__tests__/useIsBucketEmpty.test.js +122 -0
- package/dist/hooks/bucketConfiguration.d.ts +168 -0
- package/dist/hooks/bucketConfiguration.js +67 -0
- package/dist/hooks/bucketOperations.d.ts +36 -0
- package/dist/hooks/bucketOperations.js +12 -0
- package/dist/hooks/factories/__tests__/useCreateS3FunctionMutationHook.test.d.ts +1 -0
- package/dist/hooks/factories/__tests__/useCreateS3FunctionMutationHook.test.js +276 -0
- package/dist/hooks/factories/__tests__/useCreateS3InfiniteQueryHook.test.d.ts +1 -0
- package/dist/hooks/factories/__tests__/useCreateS3InfiniteQueryHook.test.js +259 -0
- package/dist/hooks/factories/__tests__/useCreateS3LoginHook.test.d.ts +1 -0
- package/dist/hooks/factories/__tests__/useCreateS3LoginHook.test.js +166 -0
- package/dist/hooks/factories/__tests__/useCreateS3MutationHook.test.d.ts +1 -0
- package/dist/hooks/factories/__tests__/useCreateS3MutationHook.test.js +200 -0
- package/dist/hooks/factories/__tests__/useCreateS3QueryHook.test.d.ts +1 -0
- package/dist/hooks/factories/__tests__/useCreateS3QueryHook.test.js +179 -0
- package/dist/hooks/factories/index.d.ts +18 -0
- package/dist/hooks/factories/index.js +5 -0
- package/dist/hooks/factories/useCreateS3InfiniteQueryHook.d.ts +13 -0
- package/dist/hooks/factories/useCreateS3InfiniteQueryHook.js +76 -0
- package/dist/hooks/factories/useCreateS3LoginHook.d.ts +8 -0
- package/dist/hooks/factories/useCreateS3LoginHook.js +22 -0
- package/dist/hooks/factories/useCreateS3MutationHook.d.ts +5 -0
- package/dist/hooks/factories/useCreateS3MutationHook.js +50 -0
- package/dist/hooks/factories/useCreateS3QueryHook.d.ts +3 -0
- package/dist/hooks/factories/useCreateS3QueryHook.js +51 -0
- package/dist/hooks/index.d.ts +13 -0
- package/dist/hooks/index.js +13 -0
- package/dist/hooks/loginOperations.d.ts +21 -0
- package/dist/hooks/loginOperations.js +9 -0
- package/dist/hooks/objectOperations.d.ts +190 -0
- package/dist/hooks/objectOperations.js +67 -0
- package/dist/hooks/presignedOperations.d.ts +73 -0
- package/dist/hooks/presignedOperations.js +72 -0
- package/dist/hooks/useBatchObjectLegalHold.d.ts +11 -0
- package/dist/hooks/useBatchObjectLegalHold.js +45 -0
- package/dist/hooks/useDeleteBucketConfigRule.d.ts +26 -0
- package/dist/hooks/useDeleteBucketConfigRule.js +46 -0
- package/dist/hooks/useEmptyBucket.d.ts +27 -0
- package/dist/hooks/useEmptyBucket.js +116 -0
- package/dist/hooks/useISVBucketDetection.d.ts +15 -0
- package/dist/hooks/useISVBucketDetection.js +27 -0
- package/dist/hooks/useIsBucketEmpty.d.ts +7 -0
- package/dist/hooks/useIsBucketEmpty.js +36 -0
- package/dist/hooks/useLoginMutation.d.ts +21 -0
- package/dist/hooks/useLoginMutation.js +9 -0
- package/dist/hooks/useS3Client.d.ts +1 -0
- package/dist/hooks/useS3Client.js +13 -0
- package/dist/hooks/useTableRowSelection.d.ts +9 -0
- package/dist/hooks/useTableRowSelection.js +45 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/dist/schemas/bucketPolicySchema.json +321 -0
- package/dist/test/msw/handlers/deleteBucket.d.ts +1 -0
- package/dist/test/msw/handlers/deleteBucket.js +14 -0
- package/dist/test/msw/handlers/getBucketAcl.d.ts +1 -0
- package/dist/test/msw/handlers/getBucketAcl.js +96 -0
- package/dist/test/msw/handlers/getBucketLocation.d.ts +1 -0
- package/dist/test/msw/handlers/getBucketLocation.js +23 -0
- package/dist/test/msw/handlers/getBucketPolicy.d.ts +11 -0
- package/dist/test/msw/handlers/getBucketPolicy.js +72 -0
- package/dist/test/msw/handlers/headObject.d.ts +1 -0
- package/dist/test/msw/handlers/headObject.js +17 -0
- package/dist/test/msw/handlers/listBuckets.d.ts +1 -0
- package/dist/test/msw/handlers/listBuckets.js +24 -0
- package/dist/test/msw/handlers/listObjectVersions.d.ts +1 -0
- package/dist/test/msw/handlers/listObjectVersions.js +83 -0
- package/dist/test/msw/handlers/listObjects.d.ts +1 -0
- package/dist/test/msw/handlers/listObjects.js +66 -0
- package/dist/test/msw/handlers/objectLegalHold.d.ts +1 -0
- package/dist/test/msw/handlers/objectLegalHold.js +24 -0
- package/dist/test/msw/handlers/objectRetention.d.ts +1 -0
- package/dist/test/msw/handlers/objectRetention.js +27 -0
- package/dist/test/msw/handlers/putBucketAcl.d.ts +1 -0
- package/dist/test/msw/handlers/putBucketAcl.js +18 -0
- package/dist/test/msw/handlers/putObject.d.ts +1 -0
- package/dist/test/msw/handlers/putObject.js +16 -0
- package/dist/test/msw/handlers.d.ts +4 -0
- package/dist/test/msw/handlers.js +109 -0
- package/dist/test/msw/index.d.ts +2 -0
- package/dist/test/msw/index.js +3 -0
- package/dist/test/msw/server.d.ts +4 -0
- package/dist/test/msw/server.js +20 -0
- package/dist/test/msw/utils.d.ts +2 -0
- package/dist/test/msw/utils.js +13 -0
- package/dist/test/setup.d.ts +1 -0
- package/dist/test/setup.js +90 -0
- package/dist/test/testUtils.d.ts +181 -0
- package/dist/test/testUtils.js +310 -0
- package/dist/test/utils/errorHandling.test.d.ts +1 -0
- package/dist/test/utils/errorHandling.test.js +423 -0
- package/dist/types/index.d.ts +51 -0
- package/dist/types/index.js +0 -0
- package/dist/utils/constants.d.ts +12 -0
- package/dist/utils/constants.js +9 -0
- package/dist/utils/deletion/index.d.ts +2 -0
- package/dist/utils/deletion/index.js +2 -0
- package/dist/utils/deletion/messages.d.ts +5 -0
- package/dist/utils/deletion/messages.js +29 -0
- package/dist/utils/deletion/types.d.ts +11 -0
- package/dist/utils/deletion/types.js +0 -0
- package/dist/utils/errorHandling.d.ts +63 -0
- package/dist/utils/errorHandling.js +84 -0
- package/dist/utils/hooks.d.ts +2 -0
- package/dist/utils/hooks.js +26 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.js +4 -0
- package/dist/utils/proxyMiddleware.d.ts +18 -0
- package/dist/utils/proxyMiddleware.js +56 -0
- package/dist/utils/s3Client.d.ts +5 -0
- package/dist/utils/s3Client.js +36 -0
- package/dist/utils/s3RuleUtils.d.ts +53 -0
- package/dist/utils/s3RuleUtils.js +101 -0
- package/dist/utils/useFeatures.d.ts +1 -0
- package/dist/utils/useFeatures.js +7 -0
- package/package.json +84 -0
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { renderHook } from "@testing-library/react";
|
|
2
|
+
import { useISVBucketStatus } from "../useISVBucketDetection.js";
|
|
3
|
+
import { useGetBucketTagging } from "../bucketConfiguration.js";
|
|
4
|
+
import { useFeatures } from "../../utils/useFeatures.js";
|
|
5
|
+
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";
|
|
6
|
+
import { createTestWrapper } from "../../test/testUtils.js";
|
|
7
|
+
jest.mock("../bucketConfiguration");
|
|
8
|
+
jest.mock("../../utils/useFeatures");
|
|
9
|
+
const mockUseGetBucketTagging = useGetBucketTagging;
|
|
10
|
+
const mockUseFeatures = useFeatures;
|
|
11
|
+
describe("useISVBucketStatus", ()=>{
|
|
12
|
+
beforeEach(()=>{
|
|
13
|
+
jest.clearAllMocks();
|
|
14
|
+
mockUseFeatures.mockReturnValue(true);
|
|
15
|
+
});
|
|
16
|
+
it("should return false for all flags when ISV feature is disabled", ()=>{
|
|
17
|
+
mockUseFeatures.mockReturnValue(false);
|
|
18
|
+
mockUseGetBucketTagging.mockReturnValue({
|
|
19
|
+
data: void 0,
|
|
20
|
+
status: "success"
|
|
21
|
+
});
|
|
22
|
+
const { result } = renderHook(()=>useISVBucketStatus("test-bucket"), {
|
|
23
|
+
wrapper: createTestWrapper()
|
|
24
|
+
});
|
|
25
|
+
expect(result.current.isVeeamBucket).toBe(false);
|
|
26
|
+
expect(result.current.isCommvaultBucket).toBe(false);
|
|
27
|
+
expect(result.current.isISVManaged).toBe(false);
|
|
28
|
+
expect(result.current.isvApplication).toBeUndefined();
|
|
29
|
+
expect(result.current.isLoading).toBe(false);
|
|
30
|
+
});
|
|
31
|
+
it("should detect Veeam Backup & Replication bucket", ()=>{
|
|
32
|
+
mockUseGetBucketTagging.mockReturnValue({
|
|
33
|
+
data: {
|
|
34
|
+
TagSet: [
|
|
35
|
+
{
|
|
36
|
+
Key: BUCKET_TAG_VEEAM_APPLICATION,
|
|
37
|
+
Value: VEEAM_BACKUP_REPLICATION
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
status: "success"
|
|
42
|
+
});
|
|
43
|
+
const { result } = renderHook(()=>useISVBucketStatus("test-bucket"), {
|
|
44
|
+
wrapper: createTestWrapper()
|
|
45
|
+
});
|
|
46
|
+
expect(result.current.isVeeamBucket).toBe(true);
|
|
47
|
+
expect(result.current.isCommvaultBucket).toBe(false);
|
|
48
|
+
expect(result.current.isISVManaged).toBe(true);
|
|
49
|
+
expect(result.current.isvApplication).toBe("Veeam");
|
|
50
|
+
});
|
|
51
|
+
it("should detect Veeam Office 365 v6/v7 bucket", ()=>{
|
|
52
|
+
mockUseGetBucketTagging.mockReturnValue({
|
|
53
|
+
data: {
|
|
54
|
+
TagSet: [
|
|
55
|
+
{
|
|
56
|
+
Key: BUCKET_TAG_VEEAM_APPLICATION,
|
|
57
|
+
Value: VEEAM_OFFICE_365
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
},
|
|
61
|
+
status: "success"
|
|
62
|
+
});
|
|
63
|
+
const { result } = renderHook(()=>useISVBucketStatus("test-bucket"), {
|
|
64
|
+
wrapper: createTestWrapper()
|
|
65
|
+
});
|
|
66
|
+
expect(result.current.isVeeamBucket).toBe(true);
|
|
67
|
+
expect(result.current.isISVManaged).toBe(true);
|
|
68
|
+
expect(result.current.isvApplication).toBe("Veeam");
|
|
69
|
+
});
|
|
70
|
+
it("should detect Veeam Office 365 v8+ bucket", ()=>{
|
|
71
|
+
mockUseGetBucketTagging.mockReturnValue({
|
|
72
|
+
data: {
|
|
73
|
+
TagSet: [
|
|
74
|
+
{
|
|
75
|
+
Key: BUCKET_TAG_VEEAM_APPLICATION,
|
|
76
|
+
Value: VEEAM_OFFICE_365_V8
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
},
|
|
80
|
+
status: "success"
|
|
81
|
+
});
|
|
82
|
+
const { result } = renderHook(()=>useISVBucketStatus("test-bucket"), {
|
|
83
|
+
wrapper: createTestWrapper()
|
|
84
|
+
});
|
|
85
|
+
expect(result.current.isVeeamBucket).toBe(true);
|
|
86
|
+
expect(result.current.isISVManaged).toBe(true);
|
|
87
|
+
expect(result.current.isvApplication).toBe("Veeam");
|
|
88
|
+
});
|
|
89
|
+
it("should detect ISV bucket tagged as Veeam Backup & Replication", ()=>{
|
|
90
|
+
mockUseGetBucketTagging.mockReturnValue({
|
|
91
|
+
data: {
|
|
92
|
+
TagSet: [
|
|
93
|
+
{
|
|
94
|
+
Key: BUCKET_TAG_APPLICATION,
|
|
95
|
+
Value: VEEAM_BACKUP_REPLICATION
|
|
96
|
+
}
|
|
97
|
+
]
|
|
98
|
+
},
|
|
99
|
+
status: "success"
|
|
100
|
+
});
|
|
101
|
+
const { result } = renderHook(()=>useISVBucketStatus("test-bucket"), {
|
|
102
|
+
wrapper: createTestWrapper()
|
|
103
|
+
});
|
|
104
|
+
expect(result.current.isVeeamBucket).toBe(true);
|
|
105
|
+
expect(result.current.isISVManaged).toBe(true);
|
|
106
|
+
expect(result.current.isvApplication).toBe("Veeam");
|
|
107
|
+
});
|
|
108
|
+
it("should detect ISV bucket tagged as Veeam VBO", ()=>{
|
|
109
|
+
mockUseGetBucketTagging.mockReturnValue({
|
|
110
|
+
data: {
|
|
111
|
+
TagSet: [
|
|
112
|
+
{
|
|
113
|
+
Key: BUCKET_TAG_APPLICATION,
|
|
114
|
+
Value: VEEAM_VBO_APPLICATION
|
|
115
|
+
}
|
|
116
|
+
]
|
|
117
|
+
},
|
|
118
|
+
status: "success"
|
|
119
|
+
});
|
|
120
|
+
const { result } = renderHook(()=>useISVBucketStatus("test-bucket"), {
|
|
121
|
+
wrapper: createTestWrapper()
|
|
122
|
+
});
|
|
123
|
+
expect(result.current.isVeeamBucket).toBe(true);
|
|
124
|
+
expect(result.current.isISVManaged).toBe(true);
|
|
125
|
+
expect(result.current.isvApplication).toBe("Veeam");
|
|
126
|
+
});
|
|
127
|
+
it("should detect Commvault bucket", ()=>{
|
|
128
|
+
mockUseGetBucketTagging.mockReturnValue({
|
|
129
|
+
data: {
|
|
130
|
+
TagSet: [
|
|
131
|
+
{
|
|
132
|
+
Key: BUCKET_TAG_APPLICATION,
|
|
133
|
+
Value: COMMVAULT_APPLICATION
|
|
134
|
+
}
|
|
135
|
+
]
|
|
136
|
+
},
|
|
137
|
+
status: "success"
|
|
138
|
+
});
|
|
139
|
+
const { result } = renderHook(()=>useISVBucketStatus("test-bucket"), {
|
|
140
|
+
wrapper: createTestWrapper()
|
|
141
|
+
});
|
|
142
|
+
expect(result.current.isVeeamBucket).toBe(false);
|
|
143
|
+
expect(result.current.isCommvaultBucket).toBe(true);
|
|
144
|
+
expect(result.current.isISVManaged).toBe(true);
|
|
145
|
+
expect(result.current.isvApplication).toBe("Commvault");
|
|
146
|
+
});
|
|
147
|
+
it("should return false for non-ISV bucket", ()=>{
|
|
148
|
+
mockUseGetBucketTagging.mockReturnValue({
|
|
149
|
+
data: {
|
|
150
|
+
TagSet: [
|
|
151
|
+
{
|
|
152
|
+
Key: "SomeOtherTag",
|
|
153
|
+
Value: "SomeValue"
|
|
154
|
+
}
|
|
155
|
+
]
|
|
156
|
+
},
|
|
157
|
+
status: "success"
|
|
158
|
+
});
|
|
159
|
+
const { result } = renderHook(()=>useISVBucketStatus("test-bucket"), {
|
|
160
|
+
wrapper: createTestWrapper()
|
|
161
|
+
});
|
|
162
|
+
expect(result.current.isVeeamBucket).toBe(false);
|
|
163
|
+
expect(result.current.isCommvaultBucket).toBe(false);
|
|
164
|
+
expect(result.current.isISVManaged).toBe(false);
|
|
165
|
+
expect(result.current.isvApplication).toBeUndefined();
|
|
166
|
+
});
|
|
167
|
+
it("should return loading state when fetching bucket tags", ()=>{
|
|
168
|
+
mockUseGetBucketTagging.mockReturnValue({
|
|
169
|
+
data: void 0,
|
|
170
|
+
status: "pending"
|
|
171
|
+
});
|
|
172
|
+
const { result } = renderHook(()=>useISVBucketStatus("test-bucket"), {
|
|
173
|
+
wrapper: createTestWrapper()
|
|
174
|
+
});
|
|
175
|
+
expect(result.current.isLoading).toBe(true);
|
|
176
|
+
});
|
|
177
|
+
it("should not be loading when ISV feature is disabled", ()=>{
|
|
178
|
+
mockUseFeatures.mockReturnValue(false);
|
|
179
|
+
mockUseGetBucketTagging.mockReturnValue({
|
|
180
|
+
data: void 0,
|
|
181
|
+
status: "pending"
|
|
182
|
+
});
|
|
183
|
+
const { result } = renderHook(()=>useISVBucketStatus("test-bucket"), {
|
|
184
|
+
wrapper: createTestWrapper()
|
|
185
|
+
});
|
|
186
|
+
expect(result.current.isLoading).toBe(false);
|
|
187
|
+
});
|
|
188
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { useIsBucketEmpty } from "../useIsBucketEmpty.js";
|
|
2
|
+
import { useListObjects } from "../objectOperations.js";
|
|
3
|
+
import { renderHookWithWrapper } from "../../test/testUtils.js";
|
|
4
|
+
jest.mock("../objectOperations");
|
|
5
|
+
const mockUseListObjects = jest.mocked(useListObjects);
|
|
6
|
+
describe("useIsBucketEmpty", ()=>{
|
|
7
|
+
beforeEach(()=>{
|
|
8
|
+
jest.clearAllMocks();
|
|
9
|
+
});
|
|
10
|
+
it("returns loading state when checking bucket", ()=>{
|
|
11
|
+
mockUseListObjects.mockReturnValue({
|
|
12
|
+
data: void 0,
|
|
13
|
+
status: "pending",
|
|
14
|
+
error: null
|
|
15
|
+
});
|
|
16
|
+
const { result } = renderHookWithWrapper(()=>useIsBucketEmpty("test-bucket"));
|
|
17
|
+
expect(result.current.isEmpty).toBe(null);
|
|
18
|
+
expect(result.current.isLoading).toBe(true);
|
|
19
|
+
expect(result.current.error).toBe(null);
|
|
20
|
+
});
|
|
21
|
+
it("returns true when bucket is empty", ()=>{
|
|
22
|
+
mockUseListObjects.mockReturnValue({
|
|
23
|
+
data: {
|
|
24
|
+
pages: [
|
|
25
|
+
{
|
|
26
|
+
Contents: [],
|
|
27
|
+
CommonPrefixes: []
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
status: "success",
|
|
32
|
+
error: null
|
|
33
|
+
});
|
|
34
|
+
const { result } = renderHookWithWrapper(()=>useIsBucketEmpty("test-bucket"));
|
|
35
|
+
expect(result.current.isEmpty).toBe(true);
|
|
36
|
+
expect(result.current.isLoading).toBe(false);
|
|
37
|
+
});
|
|
38
|
+
it("returns false when bucket has objects", ()=>{
|
|
39
|
+
mockUseListObjects.mockReturnValue({
|
|
40
|
+
data: {
|
|
41
|
+
pages: [
|
|
42
|
+
{
|
|
43
|
+
Contents: [
|
|
44
|
+
{
|
|
45
|
+
Key: "file.txt"
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
CommonPrefixes: []
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
status: "success",
|
|
53
|
+
error: null
|
|
54
|
+
});
|
|
55
|
+
const { result } = renderHookWithWrapper(()=>useIsBucketEmpty("test-bucket"));
|
|
56
|
+
expect(result.current.isEmpty).toBe(false);
|
|
57
|
+
expect(result.current.isLoading).toBe(false);
|
|
58
|
+
});
|
|
59
|
+
it("returns false when bucket has folders", ()=>{
|
|
60
|
+
mockUseListObjects.mockReturnValue({
|
|
61
|
+
data: {
|
|
62
|
+
pages: [
|
|
63
|
+
{
|
|
64
|
+
Contents: [],
|
|
65
|
+
CommonPrefixes: [
|
|
66
|
+
{
|
|
67
|
+
Prefix: "folder/"
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
status: "success",
|
|
74
|
+
error: null
|
|
75
|
+
});
|
|
76
|
+
const { result } = renderHookWithWrapper(()=>useIsBucketEmpty("test-bucket"));
|
|
77
|
+
expect(result.current.isEmpty).toBe(false);
|
|
78
|
+
expect(result.current.isLoading).toBe(false);
|
|
79
|
+
});
|
|
80
|
+
it("handles error state", ()=>{
|
|
81
|
+
const testError = new Error("Access denied");
|
|
82
|
+
mockUseListObjects.mockReturnValue({
|
|
83
|
+
data: void 0,
|
|
84
|
+
status: "error",
|
|
85
|
+
error: testError
|
|
86
|
+
});
|
|
87
|
+
const { result } = renderHookWithWrapper(()=>useIsBucketEmpty("test-bucket"));
|
|
88
|
+
expect(result.current.isEmpty).toBe(null);
|
|
89
|
+
expect(result.current.isLoading).toBe(false);
|
|
90
|
+
expect(result.current.error).toBe(testError);
|
|
91
|
+
});
|
|
92
|
+
it("ignores invalid objects and prefixes", ()=>{
|
|
93
|
+
mockUseListObjects.mockReturnValue({
|
|
94
|
+
data: {
|
|
95
|
+
pages: [
|
|
96
|
+
{
|
|
97
|
+
Contents: [
|
|
98
|
+
{
|
|
99
|
+
Key: void 0
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
Key: ""
|
|
103
|
+
}
|
|
104
|
+
],
|
|
105
|
+
CommonPrefixes: [
|
|
106
|
+
{
|
|
107
|
+
Prefix: null
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
Prefix: ""
|
|
111
|
+
}
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
]
|
|
115
|
+
},
|
|
116
|
+
status: "success",
|
|
117
|
+
error: null
|
|
118
|
+
});
|
|
119
|
+
const { result } = renderHookWithWrapper(()=>useIsBucketEmpty("test-bucket"));
|
|
120
|
+
expect(result.current.isEmpty).toBe(true);
|
|
121
|
+
});
|
|
122
|
+
});
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* S3 Bucket Configuration Operations
|
|
3
|
+
*
|
|
4
|
+
* This file contains hooks for managing bucket configuration settings
|
|
5
|
+
* like ACL, policies, versioning, CORS, lifecycle, etc.
|
|
6
|
+
*/
|
|
7
|
+
import { GetBucketAclCommandInput, GetBucketAclCommandOutput, PutBucketAclCommandInput, PutBucketAclCommandOutput, GetBucketPolicyCommandInput, GetBucketPolicyCommandOutput, PutBucketPolicyCommandInput, PutBucketPolicyCommandOutput, DeleteBucketPolicyCommandInput, DeleteBucketPolicyCommandOutput, GetBucketVersioningCommandInput, GetBucketVersioningCommandOutput, PutBucketVersioningCommandInput, PutBucketVersioningCommandOutput, GetBucketCorsCommandInput, GetBucketCorsCommandOutput, PutBucketCorsCommandInput, PutBucketCorsCommandOutput, DeleteBucketCorsCommandInput, DeleteBucketCorsCommandOutput, GetBucketLifecycleConfigurationCommandInput, GetBucketLifecycleConfigurationCommandOutput, PutBucketLifecycleConfigurationCommandInput, PutBucketLifecycleConfigurationCommandOutput, DeleteBucketLifecycleCommandInput, DeleteBucketLifecycleCommandOutput, GetBucketNotificationConfigurationCommandInput, GetBucketNotificationConfigurationCommandOutput, PutBucketNotificationConfigurationCommandInput, PutBucketNotificationConfigurationCommandOutput, GetBucketEncryptionCommandInput, GetBucketEncryptionCommandOutput, PutBucketEncryptionCommandInput, PutBucketEncryptionCommandOutput, GetBucketTaggingCommandInput, GetBucketTaggingCommandOutput, PutBucketTaggingCommandInput, PutBucketTaggingCommandOutput, DeleteBucketTaggingCommandInput, DeleteBucketTaggingCommandOutput, GetObjectLockConfigurationCommandInput, GetObjectLockConfigurationCommandOutput, PutObjectLockConfigurationCommandInput, PutObjectLockConfigurationCommandOutput, GetBucketReplicationCommandInput, GetBucketReplicationCommandOutput, PutBucketReplicationCommandInput, PutBucketReplicationCommandOutput, DeleteBucketReplicationCommandInput, DeleteBucketReplicationCommandOutput } from "@aws-sdk/client-s3";
|
|
8
|
+
/**
|
|
9
|
+
* Hook for retrieving S3 bucket access control list (ACL) settings
|
|
10
|
+
*
|
|
11
|
+
* Fetches the access control list of an S3 bucket, which defines permissions
|
|
12
|
+
* for different AWS accounts or predefined groups.
|
|
13
|
+
*/
|
|
14
|
+
export declare const useGetBucketAcl: (params?: GetBucketAclCommandInput | undefined, options?: Omit<import("@tanstack/react-query").UseQueryOptions<GetBucketAclCommandOutput, import("..").EnhancedS3Error, GetBucketAclCommandOutput, readonly unknown[]>, "queryKey" | "queryFn"> | undefined) => import("@tanstack/react-query").UseQueryResult<GetBucketAclCommandOutput, import("..").EnhancedS3Error>;
|
|
15
|
+
/**
|
|
16
|
+
* Hook for setting S3 bucket ACL (Access Control List)
|
|
17
|
+
*
|
|
18
|
+
* Updates the access control list for an S3 bucket. The ACL defines which AWS
|
|
19
|
+
* accounts or groups are granted access and the type of access.
|
|
20
|
+
*/
|
|
21
|
+
export declare const useSetBucketAcl: (options?: Omit<import("@tanstack/react-query").UseMutationOptions<PutBucketAclCommandOutput, import("..").EnhancedS3Error, PutBucketAclCommandInput, unknown>, "mutationFn"> | undefined) => import("@tanstack/react-query").UseMutationResult<PutBucketAclCommandOutput, import("..").EnhancedS3Error, PutBucketAclCommandInput>;
|
|
22
|
+
/**
|
|
23
|
+
* Hook for retrieving S3 bucket policy
|
|
24
|
+
*
|
|
25
|
+
* Fetches the bucket policy for an S3 bucket as a JSON string. The bucket policy
|
|
26
|
+
* defines permissions for accessing the bucket and its objects.
|
|
27
|
+
*/
|
|
28
|
+
export declare const useGetBucketPolicy: (params?: GetBucketPolicyCommandInput | undefined, options?: Omit<import("@tanstack/react-query").UseQueryOptions<GetBucketPolicyCommandOutput, import("..").EnhancedS3Error, GetBucketPolicyCommandOutput, readonly unknown[]>, "queryKey" | "queryFn"> | undefined) => import("@tanstack/react-query").UseQueryResult<GetBucketPolicyCommandOutput, import("..").EnhancedS3Error>;
|
|
29
|
+
/**
|
|
30
|
+
* Hook for setting S3 bucket policy
|
|
31
|
+
*
|
|
32
|
+
* Updates the bucket policy for an S3 bucket. The policy must be a valid JSON
|
|
33
|
+
* document that defines access permissions.
|
|
34
|
+
*/
|
|
35
|
+
export declare const useSetBucketPolicy: (options?: Omit<import("@tanstack/react-query").UseMutationOptions<PutBucketPolicyCommandOutput, import("..").EnhancedS3Error, PutBucketPolicyCommandInput, unknown>, "mutationFn"> | undefined) => import("@tanstack/react-query").UseMutationResult<PutBucketPolicyCommandOutput, import("..").EnhancedS3Error, PutBucketPolicyCommandInput>;
|
|
36
|
+
/**
|
|
37
|
+
* Hook for deleting S3 bucket policy
|
|
38
|
+
*
|
|
39
|
+
* Removes the bucket policy from an S3 bucket, reverting to default access controls.
|
|
40
|
+
*/
|
|
41
|
+
export declare const useDeleteBucketPolicy: (options?: Omit<import("@tanstack/react-query").UseMutationOptions<DeleteBucketPolicyCommandOutput, import("..").EnhancedS3Error, DeleteBucketPolicyCommandInput, unknown>, "mutationFn"> | undefined) => import("@tanstack/react-query").UseMutationResult<DeleteBucketPolicyCommandOutput, import("..").EnhancedS3Error, DeleteBucketPolicyCommandInput>;
|
|
42
|
+
/**
|
|
43
|
+
* Hook for retrieving S3 bucket versioning configuration
|
|
44
|
+
*
|
|
45
|
+
* Fetches the versioning state of an S3 bucket. Returns information about
|
|
46
|
+
* whether versioning is enabled, suspended, or never configured.
|
|
47
|
+
*/
|
|
48
|
+
export declare const useGetBucketVersioning: (params?: GetBucketVersioningCommandInput | undefined, options?: Omit<import("@tanstack/react-query").UseQueryOptions<GetBucketVersioningCommandOutput, import("..").EnhancedS3Error, GetBucketVersioningCommandOutput, readonly unknown[]>, "queryKey" | "queryFn"> | undefined) => import("@tanstack/react-query").UseQueryResult<GetBucketVersioningCommandOutput, import("..").EnhancedS3Error>;
|
|
49
|
+
/**
|
|
50
|
+
* Hook for setting S3 bucket versioning configuration
|
|
51
|
+
*
|
|
52
|
+
* Enables or suspends versioning on an S3 bucket. Once versioning is enabled,
|
|
53
|
+
* it cannot be disabled, only suspended.
|
|
54
|
+
*/
|
|
55
|
+
export declare const useSetBucketVersioning: (options?: Omit<import("@tanstack/react-query").UseMutationOptions<PutBucketVersioningCommandOutput, import("..").EnhancedS3Error, PutBucketVersioningCommandInput, unknown>, "mutationFn"> | undefined) => import("@tanstack/react-query").UseMutationResult<PutBucketVersioningCommandOutput, import("..").EnhancedS3Error, PutBucketVersioningCommandInput>;
|
|
56
|
+
/**
|
|
57
|
+
* Hook for retrieving S3 bucket CORS configuration
|
|
58
|
+
*
|
|
59
|
+
* Fetches the Cross-Origin Resource Sharing (CORS) configuration for an S3 bucket.
|
|
60
|
+
* CORS rules define how web applications from different domains can access bucket resources.
|
|
61
|
+
*/
|
|
62
|
+
export declare const useGetBucketCors: (params?: GetBucketCorsCommandInput | undefined, options?: Omit<import("@tanstack/react-query").UseQueryOptions<GetBucketCorsCommandOutput, import("..").EnhancedS3Error, GetBucketCorsCommandOutput, readonly unknown[]>, "queryKey" | "queryFn"> | undefined) => import("@tanstack/react-query").UseQueryResult<GetBucketCorsCommandOutput, import("..").EnhancedS3Error>;
|
|
63
|
+
/**
|
|
64
|
+
* Hook for setting S3 bucket CORS configuration
|
|
65
|
+
*
|
|
66
|
+
* Sets the CORS configuration for an S3 bucket. CORS rules specify which domains
|
|
67
|
+
* can access bucket resources and what HTTP methods are allowed.
|
|
68
|
+
*/
|
|
69
|
+
export declare const useSetBucketCors: (options?: Omit<import("@tanstack/react-query").UseMutationOptions<PutBucketCorsCommandOutput, import("..").EnhancedS3Error, PutBucketCorsCommandInput, unknown>, "mutationFn"> | undefined) => import("@tanstack/react-query").UseMutationResult<PutBucketCorsCommandOutput, import("..").EnhancedS3Error, PutBucketCorsCommandInput>;
|
|
70
|
+
/**
|
|
71
|
+
* Hook for deleting S3 bucket CORS configuration
|
|
72
|
+
*
|
|
73
|
+
* Removes the CORS configuration from an S3 bucket, disabling cross-origin access.
|
|
74
|
+
*/
|
|
75
|
+
export declare const useDeleteBucketCors: (options?: Omit<import("@tanstack/react-query").UseMutationOptions<DeleteBucketCorsCommandOutput, import("..").EnhancedS3Error, DeleteBucketCorsCommandInput, unknown>, "mutationFn"> | undefined) => import("@tanstack/react-query").UseMutationResult<DeleteBucketCorsCommandOutput, import("..").EnhancedS3Error, DeleteBucketCorsCommandInput>;
|
|
76
|
+
/**
|
|
77
|
+
* Hook for retrieving S3 bucket lifecycle configuration
|
|
78
|
+
*
|
|
79
|
+
* Fetches the lifecycle configuration for an S3 bucket. Lifecycle rules define
|
|
80
|
+
* automatic actions like transitioning objects to different storage classes or deleting them.
|
|
81
|
+
*/
|
|
82
|
+
export declare const useGetBucketLifecycle: (params?: GetBucketLifecycleConfigurationCommandInput | undefined, options?: Omit<import("@tanstack/react-query").UseQueryOptions<GetBucketLifecycleConfigurationCommandOutput, import("..").EnhancedS3Error, GetBucketLifecycleConfigurationCommandOutput, readonly unknown[]>, "queryKey" | "queryFn"> | undefined) => import("@tanstack/react-query").UseQueryResult<GetBucketLifecycleConfigurationCommandOutput, import("..").EnhancedS3Error>;
|
|
83
|
+
/**
|
|
84
|
+
* Hook for setting S3 bucket lifecycle configuration
|
|
85
|
+
*
|
|
86
|
+
* Sets the lifecycle configuration for an S3 bucket. Lifecycle rules can automatically
|
|
87
|
+
* transition objects between storage classes and delete expired objects.
|
|
88
|
+
*/
|
|
89
|
+
export declare const useSetBucketLifecycle: (options?: Omit<import("@tanstack/react-query").UseMutationOptions<PutBucketLifecycleConfigurationCommandOutput, import("..").EnhancedS3Error, PutBucketLifecycleConfigurationCommandInput, unknown>, "mutationFn"> | undefined) => import("@tanstack/react-query").UseMutationResult<PutBucketLifecycleConfigurationCommandOutput, import("..").EnhancedS3Error, PutBucketLifecycleConfigurationCommandInput>;
|
|
90
|
+
/**
|
|
91
|
+
* Hook for deleting S3 bucket lifecycle configuration
|
|
92
|
+
*
|
|
93
|
+
* Removes the lifecycle configuration from an S3 bucket, disabling automatic
|
|
94
|
+
* object transitions and expiration.
|
|
95
|
+
*/
|
|
96
|
+
export declare const useDeleteBucketLifecycle: (options?: Omit<import("@tanstack/react-query").UseMutationOptions<DeleteBucketLifecycleCommandOutput, import("..").EnhancedS3Error, DeleteBucketLifecycleCommandInput, unknown>, "mutationFn"> | undefined) => import("@tanstack/react-query").UseMutationResult<DeleteBucketLifecycleCommandOutput, import("..").EnhancedS3Error, DeleteBucketLifecycleCommandInput>;
|
|
97
|
+
/**
|
|
98
|
+
* Hook for retrieving S3 bucket notification configuration
|
|
99
|
+
*
|
|
100
|
+
* Fetches the notification configuration for an S3 bucket. Notifications can be
|
|
101
|
+
* sent to SNS topics, SQS queues, or Lambda functions when certain events occur.
|
|
102
|
+
*/
|
|
103
|
+
export declare const useGetBucketNotification: (params?: GetBucketNotificationConfigurationCommandInput | undefined, options?: Omit<import("@tanstack/react-query").UseQueryOptions<GetBucketNotificationConfigurationCommandOutput, import("..").EnhancedS3Error, GetBucketNotificationConfigurationCommandOutput, readonly unknown[]>, "queryKey" | "queryFn"> | undefined) => import("@tanstack/react-query").UseQueryResult<GetBucketNotificationConfigurationCommandOutput, import("..").EnhancedS3Error>;
|
|
104
|
+
/**
|
|
105
|
+
* Hook for setting S3 bucket notification configuration
|
|
106
|
+
*
|
|
107
|
+
* Sets the notification configuration for an S3 bucket. Configures which events
|
|
108
|
+
* trigger notifications and where those notifications are sent.
|
|
109
|
+
*/
|
|
110
|
+
export declare const useSetBucketNotification: (options?: Omit<import("@tanstack/react-query").UseMutationOptions<PutBucketNotificationConfigurationCommandOutput, import("..").EnhancedS3Error, PutBucketNotificationConfigurationCommandInput, unknown>, "mutationFn"> | undefined) => import("@tanstack/react-query").UseMutationResult<PutBucketNotificationConfigurationCommandOutput, import("..").EnhancedS3Error, PutBucketNotificationConfigurationCommandInput>;
|
|
111
|
+
/**
|
|
112
|
+
* Hook for retrieving S3 bucket encryption configuration
|
|
113
|
+
*
|
|
114
|
+
* Fetches the default encryption configuration for an S3 bucket. This determines
|
|
115
|
+
* how objects are encrypted when uploaded without explicit encryption settings.
|
|
116
|
+
*/
|
|
117
|
+
export declare const useGetBucketEncryption: (params?: GetBucketEncryptionCommandInput | undefined, options?: Omit<import("@tanstack/react-query").UseQueryOptions<GetBucketEncryptionCommandOutput, import("..").EnhancedS3Error, GetBucketEncryptionCommandOutput, readonly unknown[]>, "queryKey" | "queryFn"> | undefined) => import("@tanstack/react-query").UseQueryResult<GetBucketEncryptionCommandOutput, import("..").EnhancedS3Error>;
|
|
118
|
+
/**
|
|
119
|
+
* Hook for setting S3 bucket encryption configuration
|
|
120
|
+
*
|
|
121
|
+
* Sets the default encryption configuration for an S3 bucket. Objects uploaded
|
|
122
|
+
* without explicit encryption will use this configuration.
|
|
123
|
+
*/
|
|
124
|
+
export declare const useSetBucketEncryption: (options?: Omit<import("@tanstack/react-query").UseMutationOptions<PutBucketEncryptionCommandOutput, import("..").EnhancedS3Error, PutBucketEncryptionCommandInput, unknown>, "mutationFn"> | undefined) => import("@tanstack/react-query").UseMutationResult<PutBucketEncryptionCommandOutput, import("..").EnhancedS3Error, PutBucketEncryptionCommandInput>;
|
|
125
|
+
/**
|
|
126
|
+
* Hook for retrieving S3 bucket tags
|
|
127
|
+
*
|
|
128
|
+
* Fetches the tag set associated with an S3 bucket. Tags are key-value pairs
|
|
129
|
+
* that provide metadata for organizing and managing buckets.
|
|
130
|
+
*/
|
|
131
|
+
export declare const useGetBucketTagging: (params?: GetBucketTaggingCommandInput | undefined, options?: Omit<import("@tanstack/react-query").UseQueryOptions<GetBucketTaggingCommandOutput, import("..").EnhancedS3Error, GetBucketTaggingCommandOutput, readonly unknown[]>, "queryKey" | "queryFn"> | undefined) => import("@tanstack/react-query").UseQueryResult<GetBucketTaggingCommandOutput, import("..").EnhancedS3Error>;
|
|
132
|
+
/**
|
|
133
|
+
* Hook for setting S3 bucket tags
|
|
134
|
+
*
|
|
135
|
+
* Sets or updates the tag set for an S3 bucket. Tags help organize and categorize
|
|
136
|
+
* buckets for billing, access control, and management purposes.
|
|
137
|
+
*/
|
|
138
|
+
export declare const useSetBucketTagging: (options?: Omit<import("@tanstack/react-query").UseMutationOptions<PutBucketTaggingCommandOutput, import("..").EnhancedS3Error, PutBucketTaggingCommandInput, unknown>, "mutationFn"> | undefined) => import("@tanstack/react-query").UseMutationResult<PutBucketTaggingCommandOutput, import("..").EnhancedS3Error, PutBucketTaggingCommandInput>;
|
|
139
|
+
/**
|
|
140
|
+
* Hook for deleting S3 bucket tags
|
|
141
|
+
*
|
|
142
|
+
* Removes all tags from an S3 bucket. This operation cannot be undone,
|
|
143
|
+
* so use with caution.
|
|
144
|
+
*/
|
|
145
|
+
export declare const useDeleteBucketTagging: (options?: Omit<import("@tanstack/react-query").UseMutationOptions<DeleteBucketTaggingCommandOutput, import("..").EnhancedS3Error, DeleteBucketTaggingCommandInput, unknown>, "mutationFn"> | undefined) => import("@tanstack/react-query").UseMutationResult<DeleteBucketTaggingCommandOutput, import("..").EnhancedS3Error, DeleteBucketTaggingCommandInput>;
|
|
146
|
+
export declare const useGetBucketObjectLockConfiguration: (params?: GetObjectLockConfigurationCommandInput | undefined, options?: Omit<import("@tanstack/react-query").UseQueryOptions<GetObjectLockConfigurationCommandOutput, import("..").EnhancedS3Error, GetObjectLockConfigurationCommandOutput, readonly unknown[]>, "queryKey" | "queryFn"> | undefined) => import("@tanstack/react-query").UseQueryResult<GetObjectLockConfigurationCommandOutput, import("..").EnhancedS3Error>;
|
|
147
|
+
export declare const useSetBucketObjectLockConfiguration: (options?: Omit<import("@tanstack/react-query").UseMutationOptions<PutObjectLockConfigurationCommandOutput, import("..").EnhancedS3Error, PutObjectLockConfigurationCommandInput, unknown>, "mutationFn"> | undefined) => import("@tanstack/react-query").UseMutationResult<PutObjectLockConfigurationCommandOutput, import("..").EnhancedS3Error, PutObjectLockConfigurationCommandInput>;
|
|
148
|
+
/**
|
|
149
|
+
* Hook for retrieving S3 bucket replication configuration
|
|
150
|
+
*
|
|
151
|
+
* Fetches the replication configuration for an S3 bucket. Replication enables
|
|
152
|
+
* automatic, asynchronous copying of objects across buckets in different or same regions.
|
|
153
|
+
*/
|
|
154
|
+
export declare const useGetBucketReplication: (params?: GetBucketReplicationCommandInput | undefined, options?: Omit<import("@tanstack/react-query").UseQueryOptions<GetBucketReplicationCommandOutput, import("..").EnhancedS3Error, GetBucketReplicationCommandOutput, readonly unknown[]>, "queryKey" | "queryFn"> | undefined) => import("@tanstack/react-query").UseQueryResult<GetBucketReplicationCommandOutput, import("..").EnhancedS3Error>;
|
|
155
|
+
/**
|
|
156
|
+
* Hook for setting S3 bucket replication configuration
|
|
157
|
+
*
|
|
158
|
+
* Sets the replication configuration for an S3 bucket. Requires versioning to be
|
|
159
|
+
* enabled on both source and destination buckets.
|
|
160
|
+
*/
|
|
161
|
+
export declare const useSetBucketReplication: (options?: Omit<import("@tanstack/react-query").UseMutationOptions<PutBucketReplicationCommandOutput, import("..").EnhancedS3Error, PutBucketReplicationCommandInput, unknown>, "mutationFn"> | undefined) => import("@tanstack/react-query").UseMutationResult<PutBucketReplicationCommandOutput, import("..").EnhancedS3Error, PutBucketReplicationCommandInput>;
|
|
162
|
+
/**
|
|
163
|
+
* Hook for deleting S3 bucket replication configuration
|
|
164
|
+
*
|
|
165
|
+
* Removes the replication configuration from an S3 bucket. Objects that have already
|
|
166
|
+
* been replicated remain in the destination bucket.
|
|
167
|
+
*/
|
|
168
|
+
export declare const useDeleteBucketReplication: (options?: Omit<import("@tanstack/react-query").UseMutationOptions<DeleteBucketReplicationCommandOutput, import("..").EnhancedS3Error, DeleteBucketReplicationCommandInput, unknown>, "mutationFn"> | undefined) => import("@tanstack/react-query").UseMutationResult<DeleteBucketReplicationCommandOutput, import("..").EnhancedS3Error, DeleteBucketReplicationCommandInput>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { DeleteBucketCorsCommand, DeleteBucketLifecycleCommand, DeleteBucketPolicyCommand, DeleteBucketReplicationCommand, DeleteBucketTaggingCommand, GetBucketAclCommand, GetBucketCorsCommand, GetBucketEncryptionCommand, GetBucketLifecycleConfigurationCommand, GetBucketNotificationConfigurationCommand, GetBucketPolicyCommand, GetBucketReplicationCommand, GetBucketTaggingCommand, GetBucketVersioningCommand, GetObjectLockConfigurationCommand, PutBucketAclCommand, PutBucketCorsCommand, PutBucketEncryptionCommand, PutBucketLifecycleConfigurationCommand, PutBucketNotificationConfigurationCommand, PutBucketPolicyCommand, PutBucketReplicationCommand, PutBucketTaggingCommand, PutBucketVersioningCommand, PutObjectLockConfigurationCommand } from "@aws-sdk/client-s3";
|
|
2
|
+
import { useCreateS3QueryHook } from "./factories/useCreateS3QueryHook.js";
|
|
3
|
+
import { useCreateS3MutationHook } from "./factories/useCreateS3MutationHook.js";
|
|
4
|
+
const useGetBucketAcl = useCreateS3QueryHook(GetBucketAclCommand, "GetBucketAcl");
|
|
5
|
+
const useSetBucketAcl = useCreateS3MutationHook(PutBucketAclCommand, "PutBucketAcl", [
|
|
6
|
+
"GetBucketAcl",
|
|
7
|
+
"ListBuckets"
|
|
8
|
+
]);
|
|
9
|
+
const useGetBucketPolicy = useCreateS3QueryHook(GetBucketPolicyCommand, "GetBucketPolicy");
|
|
10
|
+
const useSetBucketPolicy = useCreateS3MutationHook(PutBucketPolicyCommand, "PutBucketPolicy", [
|
|
11
|
+
"GetBucketPolicy",
|
|
12
|
+
"ListBuckets"
|
|
13
|
+
]);
|
|
14
|
+
const useDeleteBucketPolicy = useCreateS3MutationHook(DeleteBucketPolicyCommand, "DeleteBucketPolicy", [
|
|
15
|
+
"GetBucketPolicy"
|
|
16
|
+
]);
|
|
17
|
+
const useGetBucketVersioning = useCreateS3QueryHook(GetBucketVersioningCommand, "GetBucketVersioning");
|
|
18
|
+
const useSetBucketVersioning = useCreateS3MutationHook(PutBucketVersioningCommand, "PutBucketVersioning", [
|
|
19
|
+
"GetBucketVersioning"
|
|
20
|
+
]);
|
|
21
|
+
const useGetBucketCors = useCreateS3QueryHook(GetBucketCorsCommand, "GetBucketCors");
|
|
22
|
+
const useSetBucketCors = useCreateS3MutationHook(PutBucketCorsCommand, "PutBucketCors", [
|
|
23
|
+
"GetBucketCors",
|
|
24
|
+
"ListBuckets"
|
|
25
|
+
]);
|
|
26
|
+
const useDeleteBucketCors = useCreateS3MutationHook(DeleteBucketCorsCommand, "DeleteBucketCors", [
|
|
27
|
+
"GetBucketCors"
|
|
28
|
+
]);
|
|
29
|
+
const useGetBucketLifecycle = useCreateS3QueryHook(GetBucketLifecycleConfigurationCommand, "GetBucketLifecycleConfiguration");
|
|
30
|
+
const useSetBucketLifecycle = useCreateS3MutationHook(PutBucketLifecycleConfigurationCommand, "PutBucketLifecycleConfiguration", [
|
|
31
|
+
"GetBucketLifecycleConfiguration",
|
|
32
|
+
"ListBuckets"
|
|
33
|
+
]);
|
|
34
|
+
const useDeleteBucketLifecycle = useCreateS3MutationHook(DeleteBucketLifecycleCommand, "DeleteBucketLifecycle", [
|
|
35
|
+
"GetBucketLifecycleConfiguration"
|
|
36
|
+
]);
|
|
37
|
+
const useGetBucketNotification = useCreateS3QueryHook(GetBucketNotificationConfigurationCommand, "GetBucketNotificationConfiguration");
|
|
38
|
+
const useSetBucketNotification = useCreateS3MutationHook(PutBucketNotificationConfigurationCommand, "PutBucketNotificationConfiguration", [
|
|
39
|
+
"GetBucketNotificationConfiguration",
|
|
40
|
+
"ListBuckets"
|
|
41
|
+
]);
|
|
42
|
+
const useGetBucketEncryption = useCreateS3QueryHook(GetBucketEncryptionCommand, "GetBucketEncryption");
|
|
43
|
+
const useSetBucketEncryption = useCreateS3MutationHook(PutBucketEncryptionCommand, "PutBucketEncryption", [
|
|
44
|
+
"GetBucketEncryption",
|
|
45
|
+
"ListBuckets"
|
|
46
|
+
]);
|
|
47
|
+
const useGetBucketTagging = useCreateS3QueryHook(GetBucketTaggingCommand, "GetBucketTagging");
|
|
48
|
+
const useSetBucketTagging = useCreateS3MutationHook(PutBucketTaggingCommand, "PutBucketTagging", [
|
|
49
|
+
"GetBucketTagging",
|
|
50
|
+
"ListBuckets"
|
|
51
|
+
]);
|
|
52
|
+
const useDeleteBucketTagging = useCreateS3MutationHook(DeleteBucketTaggingCommand, "DeleteBucketTagging", [
|
|
53
|
+
"GetBucketTagging"
|
|
54
|
+
]);
|
|
55
|
+
const useGetBucketObjectLockConfiguration = useCreateS3QueryHook(GetObjectLockConfigurationCommand, "GetObjectLockConfiguration");
|
|
56
|
+
const useSetBucketObjectLockConfiguration = useCreateS3MutationHook(PutObjectLockConfigurationCommand, "PutObjectLockConfiguration", [
|
|
57
|
+
"GetObjectLockConfiguration"
|
|
58
|
+
]);
|
|
59
|
+
const useGetBucketReplication = useCreateS3QueryHook(GetBucketReplicationCommand, "GetBucketReplication");
|
|
60
|
+
const useSetBucketReplication = useCreateS3MutationHook(PutBucketReplicationCommand, "PutBucketReplication", [
|
|
61
|
+
"GetBucketReplication",
|
|
62
|
+
"ListBuckets"
|
|
63
|
+
]);
|
|
64
|
+
const useDeleteBucketReplication = useCreateS3MutationHook(DeleteBucketReplicationCommand, "DeleteBucketReplication", [
|
|
65
|
+
"GetBucketReplication"
|
|
66
|
+
]);
|
|
67
|
+
export { useDeleteBucketCors, useDeleteBucketLifecycle, useDeleteBucketPolicy, useDeleteBucketReplication, useDeleteBucketTagging, useGetBucketAcl, useGetBucketCors, useGetBucketEncryption, useGetBucketLifecycle, useGetBucketNotification, useGetBucketObjectLockConfiguration, useGetBucketPolicy, useGetBucketReplication, useGetBucketTagging, useGetBucketVersioning, useSetBucketAcl, useSetBucketCors, useSetBucketEncryption, useSetBucketLifecycle, useSetBucketNotification, useSetBucketObjectLockConfiguration, useSetBucketPolicy, useSetBucketReplication, useSetBucketTagging, useSetBucketVersioning };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Basic S3 Bucket Operations
|
|
3
|
+
*
|
|
4
|
+
* This file contains hooks for fundamental bucket operations like
|
|
5
|
+
* listing, creating, and deleting buckets.
|
|
6
|
+
*/
|
|
7
|
+
import { ListBucketsCommandInput, ListBucketsCommandOutput, CreateBucketCommandInput, CreateBucketCommandOutput, DeleteBucketCommandInput, DeleteBucketCommandOutput, GetBucketLocationCommandInput, GetBucketLocationCommandOutput } from "@aws-sdk/client-s3";
|
|
8
|
+
/**
|
|
9
|
+
* Hook for listing all S3 buckets
|
|
10
|
+
*
|
|
11
|
+
* Lists all S3 buckets accessible to the authenticated user.
|
|
12
|
+
* Note: Unlike objects listing, bucket listing doesn't support pagination
|
|
13
|
+
* as S3 returns all buckets in a single response.
|
|
14
|
+
*/
|
|
15
|
+
export declare const useBuckets: (params?: ListBucketsCommandInput | undefined, options?: Omit<import("@tanstack/react-query").UseQueryOptions<ListBucketsCommandOutput, import("..").EnhancedS3Error, ListBucketsCommandOutput, readonly unknown[]>, "queryKey" | "queryFn"> | undefined) => import("@tanstack/react-query").UseQueryResult<ListBucketsCommandOutput, import("..").EnhancedS3Error>;
|
|
16
|
+
/**
|
|
17
|
+
* Hook for retrieving S3 bucket location constraint information
|
|
18
|
+
*
|
|
19
|
+
* Fetches the AWS region where an S3 bucket is located. This is essential
|
|
20
|
+
* for cross-region operations and understanding bucket placement.
|
|
21
|
+
*/
|
|
22
|
+
export declare const useGetBucketLocation: (params?: GetBucketLocationCommandInput | undefined, options?: Omit<import("@tanstack/react-query").UseQueryOptions<GetBucketLocationCommandOutput, import("..").EnhancedS3Error, GetBucketLocationCommandOutput, readonly unknown[]>, "queryKey" | "queryFn"> | undefined) => import("@tanstack/react-query").UseQueryResult<GetBucketLocationCommandOutput, import("..").EnhancedS3Error>;
|
|
23
|
+
/**
|
|
24
|
+
* Hook for creating a new S3 bucket
|
|
25
|
+
*
|
|
26
|
+
* Creates a new S3 bucket with specified configuration options.
|
|
27
|
+
* Automatically invalidates the buckets list after successful creation.
|
|
28
|
+
*/
|
|
29
|
+
export declare const useCreateBucket: (options?: Omit<import("@tanstack/react-query").UseMutationOptions<CreateBucketCommandOutput, import("..").EnhancedS3Error, CreateBucketCommandInput, unknown>, "mutationFn"> | undefined) => import("@tanstack/react-query").UseMutationResult<CreateBucketCommandOutput, import("..").EnhancedS3Error, CreateBucketCommandInput>;
|
|
30
|
+
/**
|
|
31
|
+
* Hook for deleting an S3 bucket
|
|
32
|
+
*
|
|
33
|
+
* Deletes an empty S3 bucket. The bucket must be empty before deletion.
|
|
34
|
+
* Automatically invalidates the buckets list after successful deletion.
|
|
35
|
+
*/
|
|
36
|
+
export declare const useDeleteBucket: (options?: Omit<import("@tanstack/react-query").UseMutationOptions<DeleteBucketCommandOutput, import("..").EnhancedS3Error, DeleteBucketCommandInput, unknown>, "mutationFn"> | undefined) => import("@tanstack/react-query").UseMutationResult<DeleteBucketCommandOutput, import("..").EnhancedS3Error, DeleteBucketCommandInput>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CreateBucketCommand, DeleteBucketCommand, GetBucketLocationCommand, ListBucketsCommand } from "@aws-sdk/client-s3";
|
|
2
|
+
import { useCreateS3QueryHook } from "./factories/useCreateS3QueryHook.js";
|
|
3
|
+
import { useCreateS3MutationHook } from "./factories/useCreateS3MutationHook.js";
|
|
4
|
+
const useBuckets = useCreateS3QueryHook(ListBucketsCommand, "ListBuckets");
|
|
5
|
+
const useGetBucketLocation = useCreateS3QueryHook(GetBucketLocationCommand, "GetBucketLocation");
|
|
6
|
+
const useCreateBucket = useCreateS3MutationHook(CreateBucketCommand, "CreateBucket", [
|
|
7
|
+
"ListBuckets"
|
|
8
|
+
]);
|
|
9
|
+
const useDeleteBucket = useCreateS3MutationHook(DeleteBucketCommand, "DeleteBucket", [
|
|
10
|
+
"ListBuckets"
|
|
11
|
+
]);
|
|
12
|
+
export { useBuckets, useCreateBucket, useDeleteBucket, useGetBucketLocation };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|