@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.
Files changed (256) hide show
  1. package/dist/components/Editor.d.ts +12 -0
  2. package/dist/components/Editor.js +28 -0
  3. package/dist/components/__tests__/BucketCreate.test.d.ts +1 -0
  4. package/dist/components/__tests__/BucketCreate.test.js +408 -0
  5. package/dist/components/__tests__/BucketLifecycleFormPage.test.d.ts +1 -0
  6. package/dist/components/__tests__/BucketLifecycleFormPage.test.js +618 -0
  7. package/dist/components/__tests__/BucketLifecycleList.test.d.ts +1 -0
  8. package/dist/components/__tests__/BucketLifecycleList.test.js +325 -0
  9. package/dist/components/__tests__/BucketList.test.d.ts +1 -0
  10. package/dist/components/__tests__/BucketList.test.js +415 -0
  11. package/dist/components/__tests__/BucketNotificationCreatePage.test.d.ts +1 -0
  12. package/dist/components/__tests__/BucketNotificationCreatePage.test.js +316 -0
  13. package/dist/components/__tests__/BucketOverview.test.d.ts +1 -0
  14. package/dist/components/__tests__/BucketOverview.test.js +769 -0
  15. package/dist/components/__tests__/BucketPolicyPage.test.d.ts +1 -0
  16. package/dist/components/__tests__/BucketPolicyPage.test.js +268 -0
  17. package/dist/components/__tests__/BucketReplicationFormPage.test.d.ts +1 -0
  18. package/dist/components/__tests__/BucketReplicationFormPage.test.js +1757 -0
  19. package/dist/components/__tests__/BucketReplicationList.test.d.ts +1 -0
  20. package/dist/components/__tests__/BucketReplicationList.test.js +344 -0
  21. package/dist/components/__tests__/CreateFolderButton.test.d.ts +1 -0
  22. package/dist/components/__tests__/CreateFolderButton.test.js +147 -0
  23. package/dist/components/__tests__/DeleteBucketButton.test.d.ts +1 -0
  24. package/dist/components/__tests__/DeleteBucketButton.test.js +272 -0
  25. package/dist/components/__tests__/DeleteBucketConfigRuleButton.test.d.ts +1 -0
  26. package/dist/components/__tests__/DeleteBucketConfigRuleButton.test.js +196 -0
  27. package/dist/components/__tests__/DeleteObjectButton.test.d.ts +1 -0
  28. package/dist/components/__tests__/DeleteObjectButton.test.js +302 -0
  29. package/dist/components/__tests__/EmptyBucketButton.test.d.ts +1 -0
  30. package/dist/components/__tests__/EmptyBucketButton.test.js +302 -0
  31. package/dist/components/__tests__/MetadataSearch.test.d.ts +1 -0
  32. package/dist/components/__tests__/MetadataSearch.test.js +201 -0
  33. package/dist/components/__tests__/ObjectList.test.d.ts +1 -0
  34. package/dist/components/__tests__/ObjectList.test.js +283 -0
  35. package/dist/components/__tests__/UploadButton.test.d.ts +1 -0
  36. package/dist/components/__tests__/UploadButton.test.js +144 -0
  37. package/dist/components/buckets/BucketCreate.d.ts +49 -0
  38. package/dist/components/buckets/BucketCreate.js +237 -0
  39. package/dist/components/buckets/BucketDetails.d.ts +1 -0
  40. package/dist/components/buckets/BucketDetails.js +106 -0
  41. package/dist/components/buckets/BucketLifecycleFormPage.d.ts +15 -0
  42. package/dist/components/buckets/BucketLifecycleFormPage.js +1085 -0
  43. package/dist/components/buckets/BucketLifecycleList.d.ts +10 -0
  44. package/dist/components/buckets/BucketLifecycleList.js +270 -0
  45. package/dist/components/buckets/BucketList.d.ts +15 -0
  46. package/dist/components/buckets/BucketList.js +146 -0
  47. package/dist/components/buckets/BucketLocation.d.ts +3 -0
  48. package/dist/components/buckets/BucketLocation.js +16 -0
  49. package/dist/components/buckets/BucketOverview.d.ts +88 -0
  50. package/dist/components/buckets/BucketOverview.js +291 -0
  51. package/dist/components/buckets/BucketPage.d.ts +2 -0
  52. package/dist/components/buckets/BucketPage.js +47 -0
  53. package/dist/components/buckets/BucketPolicyButton.d.ts +7 -0
  54. package/dist/components/buckets/BucketPolicyButton.js +18 -0
  55. package/dist/components/buckets/BucketPolicyPage.d.ts +1 -0
  56. package/dist/components/buckets/BucketPolicyPage.js +236 -0
  57. package/dist/components/buckets/BucketReplicationFormPage.d.ts +1 -0
  58. package/dist/components/buckets/BucketReplicationFormPage.js +834 -0
  59. package/dist/components/buckets/BucketReplicationList.d.ts +11 -0
  60. package/dist/components/buckets/BucketReplicationList.js +189 -0
  61. package/dist/components/buckets/BucketVersioning.d.ts +4 -0
  62. package/dist/components/buckets/BucketVersioning.js +73 -0
  63. package/dist/components/buckets/DeleteBucketButton.d.ts +8 -0
  64. package/dist/components/buckets/DeleteBucketButton.js +78 -0
  65. package/dist/components/buckets/DeleteBucketConfigRuleButton.d.ts +18 -0
  66. package/dist/components/buckets/DeleteBucketConfigRuleButton.js +53 -0
  67. package/dist/components/buckets/EmptyBucketButton.d.ts +5 -0
  68. package/dist/components/buckets/EmptyBucketButton.js +232 -0
  69. package/dist/components/buckets/EmptyBucketSummary.d.ts +9 -0
  70. package/dist/components/buckets/EmptyBucketSummary.js +60 -0
  71. package/dist/components/buckets/EmptyBucketSummaryList.d.ts +13 -0
  72. package/dist/components/buckets/EmptyBucketSummaryList.js +140 -0
  73. package/dist/components/buckets/__tests__/BucketVersioning.test.d.ts +1 -0
  74. package/dist/components/buckets/__tests__/BucketVersioning.test.js +163 -0
  75. package/dist/components/buckets/notifications/BucketNotificationCreatePage.d.ts +1 -0
  76. package/dist/components/buckets/notifications/BucketNotificationCreatePage.js +234 -0
  77. package/dist/components/buckets/notifications/EventsSection.d.ts +1 -0
  78. package/dist/components/buckets/notifications/EventsSection.js +123 -0
  79. package/dist/components/buckets/notifications/events.d.ts +12 -0
  80. package/dist/components/buckets/notifications/events.js +27 -0
  81. package/dist/components/index.d.ts +21 -0
  82. package/dist/components/index.js +22 -0
  83. package/dist/components/layouts/ArrowNavigation.d.ts +4 -0
  84. package/dist/components/layouts/ArrowNavigation.js +16 -0
  85. package/dist/components/layouts/BrowserPageLayout.d.ts +12 -0
  86. package/dist/components/layouts/BrowserPageLayout.js +51 -0
  87. package/dist/components/objects/CreateFolderButton.d.ts +29 -0
  88. package/dist/components/objects/CreateFolderButton.js +118 -0
  89. package/dist/components/objects/DeleteObjectButton.d.ts +8 -0
  90. package/dist/components/objects/DeleteObjectButton.js +191 -0
  91. package/dist/components/objects/ObjectDetails/ObjectMetadata.d.ts +2 -0
  92. package/dist/components/objects/ObjectDetails/ObjectMetadata.js +356 -0
  93. package/dist/components/objects/ObjectDetails/ObjectSummary.d.ts +3 -0
  94. package/dist/components/objects/ObjectDetails/ObjectSummary.js +241 -0
  95. package/dist/components/objects/ObjectDetails/ObjectTags.d.ts +3 -0
  96. package/dist/components/objects/ObjectDetails/ObjectTags.js +272 -0
  97. package/dist/components/objects/ObjectDetails/index.d.ts +9 -0
  98. package/dist/components/objects/ObjectDetails/index.js +75 -0
  99. package/dist/components/objects/ObjectList.d.ts +40 -0
  100. package/dist/components/objects/ObjectList.js +453 -0
  101. package/dist/components/objects/ObjectLock/EditRetentionButton.d.ts +4 -0
  102. package/dist/components/objects/ObjectLock/EditRetentionButton.js +32 -0
  103. package/dist/components/objects/ObjectLock/ObjectLockRetentionSettings.d.ts +3 -0
  104. package/dist/components/objects/ObjectLock/ObjectLockRetentionSettings.js +211 -0
  105. package/dist/components/objects/ObjectLock/ObjectLockSettings.d.ts +9 -0
  106. package/dist/components/objects/ObjectLock/ObjectLockSettings.js +158 -0
  107. package/dist/components/objects/ObjectLock/ObjectLockSettingsUtils.d.ts +8 -0
  108. package/dist/components/objects/ObjectLock/ObjectLockSettingsUtils.js +39 -0
  109. package/dist/components/objects/ObjectLock/__tests__/EditRetentionButton.test.d.ts +1 -0
  110. package/dist/components/objects/ObjectLock/__tests__/EditRetentionButton.test.js +204 -0
  111. package/dist/components/objects/ObjectLock/__tests__/ObjectLockSettings.test.d.ts +1 -0
  112. package/dist/components/objects/ObjectLock/__tests__/ObjectLockSettings.test.js +374 -0
  113. package/dist/components/objects/ObjectPage.d.ts +1 -0
  114. package/dist/components/objects/ObjectPage.js +45 -0
  115. package/dist/components/objects/UploadButton.d.ts +34 -0
  116. package/dist/components/objects/UploadButton.js +229 -0
  117. package/dist/components/providers/DataBrowserProvider.d.ts +20 -0
  118. package/dist/components/providers/DataBrowserProvider.js +42 -0
  119. package/dist/components/search/MetadataSearch.d.ts +5 -0
  120. package/dist/components/search/MetadataSearch.js +162 -0
  121. package/dist/components/search/SearchHints.d.ts +8 -0
  122. package/dist/components/search/SearchHints.js +21 -0
  123. package/dist/components/ui/ArrayFieldActions.d.ts +36 -0
  124. package/dist/components/ui/ArrayFieldActions.js +43 -0
  125. package/dist/components/ui/ConfirmDeleteRuleModal.d.ts +16 -0
  126. package/dist/components/ui/ConfirmDeleteRuleModal.js +43 -0
  127. package/dist/components/ui/DeleteObjectModalContent.d.ts +5 -0
  128. package/dist/components/ui/DeleteObjectModalContent.js +71 -0
  129. package/dist/components/ui/FilterFormSection.d.ts +44 -0
  130. package/dist/components/ui/FilterFormSection.js +159 -0
  131. package/dist/components/ui/Search.elements.d.ts +17 -0
  132. package/dist/components/ui/Search.elements.js +59 -0
  133. package/dist/components/ui/Table.elements.d.ts +36 -0
  134. package/dist/components/ui/Table.elements.js +87 -0
  135. package/dist/config/factory.d.ts +63 -0
  136. package/dist/config/factory.js +74 -0
  137. package/dist/config/types.d.ts +46 -0
  138. package/dist/config/types.js +0 -0
  139. package/dist/hooks/__tests__/useISVBucketDetection.test.d.ts +1 -0
  140. package/dist/hooks/__tests__/useISVBucketDetection.test.js +188 -0
  141. package/dist/hooks/__tests__/useIsBucketEmpty.test.d.ts +1 -0
  142. package/dist/hooks/__tests__/useIsBucketEmpty.test.js +122 -0
  143. package/dist/hooks/bucketConfiguration.d.ts +168 -0
  144. package/dist/hooks/bucketConfiguration.js +67 -0
  145. package/dist/hooks/bucketOperations.d.ts +36 -0
  146. package/dist/hooks/bucketOperations.js +12 -0
  147. package/dist/hooks/factories/__tests__/useCreateS3FunctionMutationHook.test.d.ts +1 -0
  148. package/dist/hooks/factories/__tests__/useCreateS3FunctionMutationHook.test.js +276 -0
  149. package/dist/hooks/factories/__tests__/useCreateS3InfiniteQueryHook.test.d.ts +1 -0
  150. package/dist/hooks/factories/__tests__/useCreateS3InfiniteQueryHook.test.js +259 -0
  151. package/dist/hooks/factories/__tests__/useCreateS3LoginHook.test.d.ts +1 -0
  152. package/dist/hooks/factories/__tests__/useCreateS3LoginHook.test.js +166 -0
  153. package/dist/hooks/factories/__tests__/useCreateS3MutationHook.test.d.ts +1 -0
  154. package/dist/hooks/factories/__tests__/useCreateS3MutationHook.test.js +200 -0
  155. package/dist/hooks/factories/__tests__/useCreateS3QueryHook.test.d.ts +1 -0
  156. package/dist/hooks/factories/__tests__/useCreateS3QueryHook.test.js +179 -0
  157. package/dist/hooks/factories/index.d.ts +18 -0
  158. package/dist/hooks/factories/index.js +5 -0
  159. package/dist/hooks/factories/useCreateS3InfiniteQueryHook.d.ts +13 -0
  160. package/dist/hooks/factories/useCreateS3InfiniteQueryHook.js +76 -0
  161. package/dist/hooks/factories/useCreateS3LoginHook.d.ts +8 -0
  162. package/dist/hooks/factories/useCreateS3LoginHook.js +22 -0
  163. package/dist/hooks/factories/useCreateS3MutationHook.d.ts +5 -0
  164. package/dist/hooks/factories/useCreateS3MutationHook.js +50 -0
  165. package/dist/hooks/factories/useCreateS3QueryHook.d.ts +3 -0
  166. package/dist/hooks/factories/useCreateS3QueryHook.js +51 -0
  167. package/dist/hooks/index.d.ts +13 -0
  168. package/dist/hooks/index.js +13 -0
  169. package/dist/hooks/loginOperations.d.ts +21 -0
  170. package/dist/hooks/loginOperations.js +9 -0
  171. package/dist/hooks/objectOperations.d.ts +190 -0
  172. package/dist/hooks/objectOperations.js +67 -0
  173. package/dist/hooks/presignedOperations.d.ts +73 -0
  174. package/dist/hooks/presignedOperations.js +72 -0
  175. package/dist/hooks/useBatchObjectLegalHold.d.ts +11 -0
  176. package/dist/hooks/useBatchObjectLegalHold.js +45 -0
  177. package/dist/hooks/useDeleteBucketConfigRule.d.ts +26 -0
  178. package/dist/hooks/useDeleteBucketConfigRule.js +46 -0
  179. package/dist/hooks/useEmptyBucket.d.ts +27 -0
  180. package/dist/hooks/useEmptyBucket.js +116 -0
  181. package/dist/hooks/useISVBucketDetection.d.ts +15 -0
  182. package/dist/hooks/useISVBucketDetection.js +27 -0
  183. package/dist/hooks/useIsBucketEmpty.d.ts +7 -0
  184. package/dist/hooks/useIsBucketEmpty.js +36 -0
  185. package/dist/hooks/useLoginMutation.d.ts +21 -0
  186. package/dist/hooks/useLoginMutation.js +9 -0
  187. package/dist/hooks/useS3Client.d.ts +1 -0
  188. package/dist/hooks/useS3Client.js +13 -0
  189. package/dist/hooks/useTableRowSelection.d.ts +9 -0
  190. package/dist/hooks/useTableRowSelection.js +45 -0
  191. package/dist/index.d.ts +6 -0
  192. package/dist/index.js +6 -0
  193. package/dist/schemas/bucketPolicySchema.json +321 -0
  194. package/dist/test/msw/handlers/deleteBucket.d.ts +1 -0
  195. package/dist/test/msw/handlers/deleteBucket.js +14 -0
  196. package/dist/test/msw/handlers/getBucketAcl.d.ts +1 -0
  197. package/dist/test/msw/handlers/getBucketAcl.js +96 -0
  198. package/dist/test/msw/handlers/getBucketLocation.d.ts +1 -0
  199. package/dist/test/msw/handlers/getBucketLocation.js +23 -0
  200. package/dist/test/msw/handlers/getBucketPolicy.d.ts +11 -0
  201. package/dist/test/msw/handlers/getBucketPolicy.js +72 -0
  202. package/dist/test/msw/handlers/headObject.d.ts +1 -0
  203. package/dist/test/msw/handlers/headObject.js +17 -0
  204. package/dist/test/msw/handlers/listBuckets.d.ts +1 -0
  205. package/dist/test/msw/handlers/listBuckets.js +24 -0
  206. package/dist/test/msw/handlers/listObjectVersions.d.ts +1 -0
  207. package/dist/test/msw/handlers/listObjectVersions.js +83 -0
  208. package/dist/test/msw/handlers/listObjects.d.ts +1 -0
  209. package/dist/test/msw/handlers/listObjects.js +66 -0
  210. package/dist/test/msw/handlers/objectLegalHold.d.ts +1 -0
  211. package/dist/test/msw/handlers/objectLegalHold.js +24 -0
  212. package/dist/test/msw/handlers/objectRetention.d.ts +1 -0
  213. package/dist/test/msw/handlers/objectRetention.js +27 -0
  214. package/dist/test/msw/handlers/putBucketAcl.d.ts +1 -0
  215. package/dist/test/msw/handlers/putBucketAcl.js +18 -0
  216. package/dist/test/msw/handlers/putObject.d.ts +1 -0
  217. package/dist/test/msw/handlers/putObject.js +16 -0
  218. package/dist/test/msw/handlers.d.ts +4 -0
  219. package/dist/test/msw/handlers.js +109 -0
  220. package/dist/test/msw/index.d.ts +2 -0
  221. package/dist/test/msw/index.js +3 -0
  222. package/dist/test/msw/server.d.ts +4 -0
  223. package/dist/test/msw/server.js +20 -0
  224. package/dist/test/msw/utils.d.ts +2 -0
  225. package/dist/test/msw/utils.js +13 -0
  226. package/dist/test/setup.d.ts +1 -0
  227. package/dist/test/setup.js +90 -0
  228. package/dist/test/testUtils.d.ts +181 -0
  229. package/dist/test/testUtils.js +310 -0
  230. package/dist/test/utils/errorHandling.test.d.ts +1 -0
  231. package/dist/test/utils/errorHandling.test.js +423 -0
  232. package/dist/types/index.d.ts +51 -0
  233. package/dist/types/index.js +0 -0
  234. package/dist/utils/constants.d.ts +12 -0
  235. package/dist/utils/constants.js +9 -0
  236. package/dist/utils/deletion/index.d.ts +2 -0
  237. package/dist/utils/deletion/index.js +2 -0
  238. package/dist/utils/deletion/messages.d.ts +5 -0
  239. package/dist/utils/deletion/messages.js +29 -0
  240. package/dist/utils/deletion/types.d.ts +11 -0
  241. package/dist/utils/deletion/types.js +0 -0
  242. package/dist/utils/errorHandling.d.ts +63 -0
  243. package/dist/utils/errorHandling.js +84 -0
  244. package/dist/utils/hooks.d.ts +2 -0
  245. package/dist/utils/hooks.js +26 -0
  246. package/dist/utils/index.d.ts +4 -0
  247. package/dist/utils/index.js +4 -0
  248. package/dist/utils/proxyMiddleware.d.ts +18 -0
  249. package/dist/utils/proxyMiddleware.js +56 -0
  250. package/dist/utils/s3Client.d.ts +5 -0
  251. package/dist/utils/s3Client.js +36 -0
  252. package/dist/utils/s3RuleUtils.d.ts +53 -0
  253. package/dist/utils/s3RuleUtils.js +101 -0
  254. package/dist/utils/useFeatures.d.ts +1 -0
  255. package/dist/utils/useFeatures.js +7 -0
  256. 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 };