Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
closingTime: Yup.lazy(value => {
if (+value < moment().unix()) {
return Yup.number().min(moment().unix(), 'invalid closing time');
}
return Yup.string().required('Required');
}), // Yup.string().required('Required'),
image: Yup.mixed()
return lazy(values => {
const minDeposit = parseFloat(
formatCurrencyValue(
convertToCurrency(
minimumDepositsAmount[values[CREATE_PROGRAM_FIELDS.currency]],
values[CREATE_PROGRAM_FIELDS.rate] || 1
),
values[CREATE_PROGRAM_FIELDS.currency]
)
);
return object().shape({
[CREATE_PROGRAM_FIELDS.stopOutLevel]: number()
.required(
t("create-program-page.settings.validation.stop-out-required")
)
.min(
10,
t("create-program-page.settings.validation.stop-out-is-zero")
)
.max(
100,
t("create-program-page.settings.validation.stop-out-is-large")
),
[CREATE_PROGRAM_FIELDS.logo]: inputImageShape(t),
[CREATE_PROGRAM_FIELDS.title]: assetTitleShape(t),
[CREATE_PROGRAM_FIELDS.description]: assetDescriptionShape(t),
[CREATE_PROGRAM_FIELDS.currency]: string().required(
.required(),
disabled: yup.bool().required(),
timeLimit: yup
.number()
.label('Time Limit')
.integer()
.min(1000)
.max(10000)
.required(),
tolerance: yup
.number()
.label('Tolerance Factor')
.min(0.1)
.max(10)
.required(),
memoryLimit: yup
.number()
.label('Memory Limit')
.integer()
.min(16 * 1024 * 1024)
.max(512 * 1024 * 1024)
.required(),
outputLimit: yup
.number()
.label('Output Limit')
.integer()
.min(1)
.max(512 * 1024 * 1024)
.required(),
})
const handleSubmit = async (
domain: string().matches(
/([a-zA-Z0-9-_]+\.)+([a-zA-Z]{2,3}\.)?([a-zA-Z]{2,16}|XN--[a-zA-Z0-9]+)/,
'Domain is not valid.'
),
status: mixed().oneOf(['disabled', 'active', 'edit_mode', 'has_errors']),
tags: array(),
description: string()
.min(1, 'Description must be between 1 and 255 characters.')
.max(255, 'Description must be between 1 and 255 characters.'),
retry_sec: number(),
master_ips: array().of(string()),
axfr_ips: array()
.of(string())
.typeError('Must be a comma-separated list of IP addresses.'),
expire_sec: number(),
refresh_sec: number(),
ttl_sec: number()
});
export const createDomainSchema = domainSchemaBase.shape({
domain: string()
.required('Domain is required.')
.matches(
/([a-zA-Z0-9-_]+\.)+([a-zA-Z]{2,3}\.)?([a-zA-Z]{2,16}|XN--[a-zA-Z0-9]+)/,
'Domain is not valid.'
),
type: mixed()
.required()
.oneOf(['master', 'slave']),
soa_email: string()
.when('type', {
is: type => type === 'master',
{
type: 'select',
pageSize: 20,
name: 'task',
message: 'Task',
format: value => (value && value.task ? value.task.name : value),
choices () {
return this.state.answers.project.task_assignments.map(taskToChoice)
}
},
{
type: 'input',
name: 'hours',
message: 'Hours',
validate: validator(
number()
.min(0.1)
.required()
),
result: Number
},
{
type: 'input',
name: 'notes',
message: 'Notes (optional)'
}
])
if (hours > 8) {
const { confirm } = await prompt({
type: 'confirm',
name: 'confirm',
const reportValidation = (t) => Yup.object().shape({
type: Yup.string().required(t('This field is required')),
role_played: Yup.string().required(t('This field is required')),
observable_value: Yup.string().required(t('This field is required')),
weight: Yup.number()
.typeError(t('The value must be a number'))
.integer(t('The value must be a number'))
.required(t('This field is required')),
first_seen: Yup.date()
.typeError(t('The value must be a date (YYYY-MM-DD)'))
.required(t('This field is required')),
last_seen: Yup.date()
.typeError(t('The value must be a date (YYYY-MM-DD)'))
.required(t('This field is required')),
description: Yup.string(),
threats: Yup.array().required(t('This field is required')),
markingDefinitions: Yup.array(),
});
{
regex: /(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]/g,
},
{ domain_name: "should be valid" }
)
.required({ domain_name: "required" })
.typeError({ domain_name: "should be valid" }),
subscription_status: yup
.number()
.required({ subscription_status: "required" })
.typeError({ subscription_status: "should be number" }),
subscription_valid_upto: yup
.number()
.required({ subscription_valid_upto: "required" })
.typeError({ subscription_valid_upto: "should be number" }),
hi5_limit: yup
.number()
.required({ hi5_limit: "required" })
.typeError({ hi5_limit: "should be number" }),
hi5_quota_renewal_frequency: yup
.string({
hi5_quota_renewal_frequency: "should be string",
})
.required({
hi5_quota_renewal_frequency: "required",
}),
timezone: yup.string().required({ timezone: "required" }),
});
};