@scality/data-browser-library 1.0.0-preview.8 → 1.0.0-preview.9

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 (88) hide show
  1. package/dist/components/__tests__/BucketCreate.test.d.ts +1 -0
  2. package/dist/components/__tests__/BucketCreate.test.js +408 -0
  3. package/dist/components/__tests__/BucketLifecycleFormPage.test.d.ts +1 -0
  4. package/dist/components/__tests__/BucketLifecycleFormPage.test.js +618 -0
  5. package/dist/components/__tests__/BucketLifecycleList.test.d.ts +1 -0
  6. package/dist/components/__tests__/BucketLifecycleList.test.js +325 -0
  7. package/dist/components/__tests__/BucketList.test.js +190 -0
  8. package/dist/components/__tests__/BucketOverview.test.js +298 -8
  9. package/dist/components/__tests__/BucketReplicationFormPage.test.d.ts +1 -0
  10. package/dist/components/__tests__/BucketReplicationFormPage.test.js +1757 -0
  11. package/dist/components/__tests__/BucketReplicationList.test.d.ts +1 -0
  12. package/dist/components/__tests__/BucketReplicationList.test.js +344 -0
  13. package/dist/components/__tests__/DeleteBucketConfigRuleButton.test.d.ts +1 -0
  14. package/dist/components/__tests__/DeleteBucketConfigRuleButton.test.js +196 -0
  15. package/dist/components/__tests__/EmptyBucketButton.test.d.ts +1 -0
  16. package/dist/components/__tests__/EmptyBucketButton.test.js +302 -0
  17. package/dist/components/buckets/BucketCreate.d.ts +49 -0
  18. package/dist/components/buckets/BucketCreate.js +237 -0
  19. package/dist/components/buckets/BucketDetails.js +62 -10
  20. package/dist/components/buckets/BucketLifecycleFormPage.d.ts +15 -0
  21. package/dist/components/buckets/BucketLifecycleFormPage.js +1070 -0
  22. package/dist/components/buckets/BucketLifecycleList.d.ts +10 -0
  23. package/dist/components/buckets/BucketLifecycleList.js +270 -0
  24. package/dist/components/buckets/BucketList.d.ts +5 -2
  25. package/dist/components/buckets/BucketList.js +38 -28
  26. package/dist/components/buckets/BucketOverview.d.ts +65 -4
  27. package/dist/components/buckets/BucketOverview.js +261 -179
  28. package/dist/components/buckets/BucketPage.js +1 -1
  29. package/dist/components/buckets/BucketReplicationFormPage.d.ts +1 -0
  30. package/dist/components/buckets/BucketReplicationFormPage.js +834 -0
  31. package/dist/components/buckets/BucketReplicationList.d.ts +11 -0
  32. package/dist/components/buckets/BucketReplicationList.js +189 -0
  33. package/dist/components/buckets/DeleteBucketConfigRuleButton.d.ts +18 -0
  34. package/dist/components/buckets/DeleteBucketConfigRuleButton.js +53 -0
  35. package/dist/components/buckets/EmptyBucketButton.d.ts +5 -0
  36. package/dist/components/buckets/EmptyBucketButton.js +232 -0
  37. package/dist/components/buckets/EmptyBucketSummary.d.ts +9 -0
  38. package/dist/components/buckets/EmptyBucketSummary.js +60 -0
  39. package/dist/components/buckets/EmptyBucketSummaryList.d.ts +13 -0
  40. package/dist/components/buckets/EmptyBucketSummaryList.js +140 -0
  41. package/dist/components/index.d.ts +8 -1
  42. package/dist/components/index.js +9 -2
  43. package/dist/components/objects/ObjectLock/EditRetentionButton.d.ts +4 -0
  44. package/dist/components/objects/ObjectLock/EditRetentionButton.js +32 -0
  45. package/dist/components/objects/ObjectLock/ObjectLockRetentionSettings.d.ts +3 -0
  46. package/dist/components/objects/ObjectLock/ObjectLockRetentionSettings.js +211 -0
  47. package/dist/components/objects/ObjectLock/ObjectLockSettings.d.ts +9 -0
  48. package/dist/components/objects/ObjectLock/ObjectLockSettings.js +158 -0
  49. package/dist/components/objects/ObjectLock/ObjectLockSettingsUtils.d.ts +8 -0
  50. package/dist/components/objects/ObjectLock/ObjectLockSettingsUtils.js +39 -0
  51. package/dist/components/objects/ObjectLock/__tests__/EditRetentionButton.test.d.ts +1 -0
  52. package/dist/components/objects/ObjectLock/__tests__/EditRetentionButton.test.js +204 -0
  53. package/dist/components/objects/ObjectLock/__tests__/ObjectLockSettings.test.d.ts +1 -0
  54. package/dist/components/objects/ObjectLock/__tests__/ObjectLockSettings.test.js +374 -0
  55. package/dist/components/ui/ArrayFieldActions.d.ts +36 -0
  56. package/dist/components/ui/ArrayFieldActions.js +38 -0
  57. package/dist/components/ui/ConfirmDeleteRuleModal.d.ts +16 -0
  58. package/dist/components/ui/ConfirmDeleteRuleModal.js +43 -0
  59. package/dist/components/ui/FilterFormSection.d.ts +44 -0
  60. package/dist/components/ui/FilterFormSection.js +159 -0
  61. package/dist/config/factory.d.ts +13 -2
  62. package/dist/config/factory.js +9 -6
  63. package/dist/hooks/__tests__/useISVBucketDetection.test.d.ts +1 -0
  64. package/dist/hooks/__tests__/useISVBucketDetection.test.js +188 -0
  65. package/dist/hooks/factories/__tests__/useCreateS3QueryHook.test.js +44 -1
  66. package/dist/hooks/factories/useCreateS3QueryHook.js +22 -1
  67. package/dist/hooks/index.d.ts +4 -0
  68. package/dist/hooks/index.js +5 -1
  69. package/dist/hooks/useDeleteBucketConfigRule.d.ts +26 -0
  70. package/dist/hooks/useDeleteBucketConfigRule.js +46 -0
  71. package/dist/hooks/useEmptyBucket.d.ts +27 -0
  72. package/dist/hooks/useEmptyBucket.js +116 -0
  73. package/dist/hooks/useISVBucketDetection.d.ts +15 -0
  74. package/dist/hooks/useISVBucketDetection.js +27 -0
  75. package/dist/hooks/useTableRowSelection.d.ts +9 -0
  76. package/dist/hooks/useTableRowSelection.js +45 -0
  77. package/dist/test/testUtils.d.ts +99 -17
  78. package/dist/test/testUtils.js +64 -16
  79. package/dist/test/utils/errorHandling.test.js +39 -1
  80. package/dist/utils/constants.d.ts +12 -0
  81. package/dist/utils/constants.js +9 -0
  82. package/dist/utils/errorHandling.d.ts +9 -0
  83. package/dist/utils/errorHandling.js +6 -1
  84. package/dist/utils/index.d.ts +2 -0
  85. package/dist/utils/index.js +2 -0
  86. package/dist/utils/s3RuleUtils.d.ts +53 -0
  87. package/dist/utils/s3RuleUtils.js +101 -0
  88. package/package.json +1 -1
@@ -0,0 +1,53 @@
1
+ export declare const AWS_RULE_LIMITS: {
2
+ RULE_ID_MAX_LENGTH: number;
3
+ TAG_KEY_MAX_LENGTH: number;
4
+ TAG_VALUE_MAX_LENGTH: number;
5
+ };
6
+ export declare const STATUS_OPTIONS: readonly [{
7
+ readonly value: "Enabled";
8
+ readonly label: "Enabled";
9
+ }, {
10
+ readonly value: "Disabled";
11
+ readonly label: "Disabled";
12
+ }];
13
+ export type FilterType = "none" | "prefix" | "tags" | "and";
14
+ /**
15
+ * Filter data for S3 rules. All fields are present for form handling,
16
+ * but only certain fields are used based on filterType.
17
+ */
18
+ export interface FilterData {
19
+ filterType: FilterType;
20
+ prefix: string;
21
+ tags: Array<{
22
+ key: string;
23
+ value: string;
24
+ }>;
25
+ }
26
+ /**
27
+ * Type-safe filter specification for S3 rule building.
28
+ * Each variant only includes the fields relevant to that filter type.
29
+ */
30
+ export type FilterSpec = {
31
+ type: "none";
32
+ } | {
33
+ type: "prefix";
34
+ prefix: string;
35
+ } | {
36
+ type: "tags";
37
+ tags: Array<{
38
+ key: string;
39
+ value: string;
40
+ }>;
41
+ } | {
42
+ type: "and";
43
+ prefix: string;
44
+ tags: Array<{
45
+ key: string;
46
+ value: string;
47
+ }>;
48
+ };
49
+ /**
50
+ * Converts form FilterData to type-safe FilterSpec.
51
+ */
52
+ export declare function toFilterSpec(data: FilterData): FilterSpec;
53
+ export declare function buildS3Filter(data: FilterData): Record<string, unknown>;
@@ -0,0 +1,101 @@
1
+ const AWS_RULE_LIMITS = {
2
+ RULE_ID_MAX_LENGTH: 255,
3
+ TAG_KEY_MAX_LENGTH: 128,
4
+ TAG_VALUE_MAX_LENGTH: 256
5
+ };
6
+ const STATUS_OPTIONS = [
7
+ {
8
+ value: "Enabled",
9
+ label: "Enabled"
10
+ },
11
+ {
12
+ value: "Disabled",
13
+ label: "Disabled"
14
+ }
15
+ ];
16
+ function toFilterSpec(data) {
17
+ switch(data.filterType){
18
+ case "none":
19
+ return {
20
+ type: "none"
21
+ };
22
+ case "prefix":
23
+ return {
24
+ type: "prefix",
25
+ prefix: data.prefix
26
+ };
27
+ case "tags":
28
+ return {
29
+ type: "tags",
30
+ tags: data.tags
31
+ };
32
+ case "and":
33
+ return {
34
+ type: "and",
35
+ prefix: data.prefix,
36
+ tags: data.tags
37
+ };
38
+ }
39
+ }
40
+ function buildS3Filter(data) {
41
+ const spec = toFilterSpec(data);
42
+ switch(spec.type){
43
+ case "none":
44
+ return {};
45
+ case "prefix":
46
+ return {
47
+ Prefix: spec.prefix
48
+ };
49
+ case "tags":
50
+ if (0 === spec.tags.length) return {};
51
+ if (1 === spec.tags.length) return {
52
+ Tag: {
53
+ Key: spec.tags[0].key,
54
+ Value: spec.tags[0].value
55
+ }
56
+ };
57
+ return {
58
+ And: {
59
+ Tags: spec.tags.map((tag)=>({
60
+ Key: tag.key,
61
+ Value: tag.value
62
+ }))
63
+ }
64
+ };
65
+ case "and":
66
+ {
67
+ const hasPrefix = spec.prefix && "" !== spec.prefix.trim();
68
+ const hasTags = spec.tags.length > 0;
69
+ if (!hasTags && !hasPrefix) return {};
70
+ if (!hasTags && hasPrefix) return {
71
+ Prefix: spec.prefix
72
+ };
73
+ if (hasTags && !hasPrefix) {
74
+ if (1 === spec.tags.length) return {
75
+ Tag: {
76
+ Key: spec.tags[0].key,
77
+ Value: spec.tags[0].value
78
+ }
79
+ };
80
+ return {
81
+ And: {
82
+ Tags: spec.tags.map((tag)=>({
83
+ Key: tag.key,
84
+ Value: tag.value
85
+ }))
86
+ }
87
+ };
88
+ }
89
+ return {
90
+ And: {
91
+ Prefix: spec.prefix,
92
+ Tags: spec.tags.map((tag)=>({
93
+ Key: tag.key,
94
+ Value: tag.value
95
+ }))
96
+ }
97
+ };
98
+ }
99
+ }
100
+ }
101
+ export { AWS_RULE_LIMITS, STATUS_OPTIONS, buildS3Filter, toFilterSpec };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scality/data-browser-library",
3
- "version": "1.0.0-preview.8",
3
+ "version": "1.0.0-preview.9",
4
4
  "description": "A modular React component library for browsing S3 buckets and objects",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",