@scality/data-browser-library 1.0.0-preview.6 → 1.0.0-preview.8
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.
|
@@ -3,25 +3,25 @@ import { joiResolver } from "@hookform/resolvers/joi";
|
|
|
3
3
|
import { Form, FormGroup, FormSection, Loader, Stack, Text, useToast } from "@scality/core-ui";
|
|
4
4
|
import { convertRemToPixels } from "@scality/core-ui/dist/components/tablev2/TableUtils";
|
|
5
5
|
import { Button, Input } from "@scality/core-ui/dist/next";
|
|
6
|
-
import
|
|
6
|
+
import joi from "joi";
|
|
7
7
|
import { useCallback } from "react";
|
|
8
8
|
import { FormProvider, useForm } from "react-hook-form";
|
|
9
9
|
import { useNavigate, useParams } from "react-router-dom";
|
|
10
10
|
import { useGetBucketNotification, useSetBucketNotification } from "../../../hooks/index.js";
|
|
11
11
|
import { EventsSection } from "./EventsSection.js";
|
|
12
|
-
const schema = object({
|
|
13
|
-
ruleName: string().required().messages({
|
|
12
|
+
const schema = joi.object({
|
|
13
|
+
ruleName: joi.string().required().messages({
|
|
14
14
|
"string.empty": "This field is required"
|
|
15
15
|
}),
|
|
16
|
-
queueArn: string().required().pattern(/^arn:aws:sqs:[a-z0-9-]+:\d+:.+$/).messages({
|
|
16
|
+
queueArn: joi.string().required().pattern(/^arn:aws:sqs:[a-z0-9-]+:\d+:.+$/).messages({
|
|
17
17
|
"string.empty": "This field is required",
|
|
18
18
|
"string.pattern.base": "Must be a valid ARN (e.g., arn:aws:sqs:region:account-id:queue-name)"
|
|
19
19
|
}),
|
|
20
|
-
events: array().min(1).required().messages({
|
|
20
|
+
events: joi.array().min(1).required().messages({
|
|
21
21
|
"array.min": "At least one event must be selected"
|
|
22
22
|
}),
|
|
23
|
-
prefix: string().allow("").optional(),
|
|
24
|
-
suffix: string().allow("").optional()
|
|
23
|
+
prefix: joi.string().allow("").optional(),
|
|
24
|
+
suffix: joi.string().allow("").optional()
|
|
25
25
|
});
|
|
26
26
|
function BucketNotificationCreatePage() {
|
|
27
27
|
const { bucketName } = useParams();
|
|
@@ -32,7 +32,7 @@ function BucketNotificationCreatePage() {
|
|
|
32
32
|
});
|
|
33
33
|
const existingRuleNames = existingNotificationData?.QueueConfigurations?.map((config)=>config.Id) || [];
|
|
34
34
|
const dynamicSchema = schema.keys({
|
|
35
|
-
ruleName: string().required().invalid(...existingRuleNames).messages({
|
|
35
|
+
ruleName: joi.string().required().invalid(...existingRuleNames).messages({
|
|
36
36
|
"string.empty": "This field is required",
|
|
37
37
|
"any.invalid": "A rule with this name already exists"
|
|
38
38
|
})
|
package/dist/test/setup.js
CHANGED
|
@@ -57,6 +57,14 @@ jest.mock("pretty-bytes", ()=>({
|
|
|
57
57
|
return `${Math.round(num)} ${sizes[i]}`;
|
|
58
58
|
}
|
|
59
59
|
}));
|
|
60
|
+
jest.mock("joi", ()=>{
|
|
61
|
+
const Joi = jest.requireActual("joi");
|
|
62
|
+
return {
|
|
63
|
+
__esModule: true,
|
|
64
|
+
default: Joi,
|
|
65
|
+
...Joi
|
|
66
|
+
};
|
|
67
|
+
});
|
|
60
68
|
if (!File.prototype.arrayBuffer) File.prototype.arrayBuffer = function() {
|
|
61
69
|
return new Promise((resolve)=>{
|
|
62
70
|
const reader = new FileReader();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scality/data-browser-library",
|
|
3
|
-
"version": "1.0.0-preview.
|
|
3
|
+
"version": "1.0.0-preview.8",
|
|
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",
|
|
@@ -34,7 +34,8 @@
|
|
|
34
34
|
"@testing-library/user-event": "^14.6.1",
|
|
35
35
|
"joi": "^18.0.1",
|
|
36
36
|
"react-dropzone": "^14.2.0",
|
|
37
|
-
"react-hook-form": "^7.48.0"
|
|
37
|
+
"react-hook-form": "^7.48.0",
|
|
38
|
+
"@scality/zenkoclient": "^2.0.0-preview.1"
|
|
38
39
|
},
|
|
39
40
|
"peerDependencies": {
|
|
40
41
|
"@scality/core-ui": "^0.174.0",
|