Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
key: Yup.string()
.emptyOrLength(16 * 2, m.validate32) // 16 Byte hex
.transform(toUndefined)
.default(random16BytesString),
}),
s_nwk_s_int_key: Yup.lazy(() =>
isNewVersion
? Yup.object().shape({
key: Yup.string()
.emptyOrLength(16 * 2, m.validate32) // 16 Byte hex
.transform(toUndefined)
.default(random16BytesString),
})
: Yup.object().strip(),
),
nwk_s_enc_key: Yup.lazy(() =>
isNewVersion
? Yup.object().shape({
key: Yup.string()
.emptyOrLength(16 * 2, m.validate32) // 16 Byte hex
.transform(toUndefined)
.default(random16BytesString),
})
: Yup.object().strip(),
),
app_s_key: Yup.object().shape({
key: Yup.string()
.emptyOrLength(16 * 2, m.validate32) // 16 Byte hex
.transform(toUndefined)
.default(random16BytesString),
}),
}),
then: schema =>
schema.shape({
nwk_key: Yup.lazy(
value =>
value !== undefined
? Yup.object().shape({
key: Yup.string()
.emptyOrLength(16 * 2, m.validate32) // 16 Byte hex
.transform(toUndefined)
.default(random16BytesString),
})
: Yup.object().strip(), // Avoid generating when key is unexposed
),
app_key: Yup.lazy(
value =>
value !== undefined
? Yup.object().shape({
key: Yup.string()
.emptyOrLength(16 * 2, m.validate32) // 16 Byte hex
.transform(toUndefined)
.default(random16BytesString),
})
: Yup.object().strip(), // Avoid generating when key is unexposed
),
}),
otherwise: schema =>
(externalJs, version, mode, schema) => {
if (mode === ACTIVATION_MODES.OTAA) {
const strippedSchema = Yup.object().strip()
const keySchema = Yup.lazy(() => {
return !externalJs
? Yup.object().shape({
key: Yup.string()
.emptyOrLength(16 * 2, m.validate32) // 16 Byte hex
.transform(toUndefined)
.default(random16BytesString),
})
: strippedSchema
})
if (externalJs) {
return schema.shape({
nwk_key: strippedSchema,
app_key: strippedSchema,
})
}
(externalJs, version, schema) => {
const strippedSchema = Yup.object().strip()
const keySchema = Yup.lazy(() => {
return !externalJs
? Yup.object().shape({
key: Yup.string()
.emptyOrLength(16 * 2, m.validate32) // 16 Byte hex
.transform(toUndefined)
.default(random16BytesString),
})
: Yup.object().strip()
})
if (externalJs) {
return schema.shape({
nwk_key: strippedSchema,
app_key: strippedSchema,
})
}
(externalJs, version, schema) => {
const strippedSchema = Yup.object().strip()
const keySchema = Yup.lazy(() => {
return !externalJs
? Yup.object().shape({
key: Yup.string()
.emptyOrLength(16 * 2, m.validate32) // 16 Byte hex
.transform(toUndefined)
.default(random16BytesString),
})
: Yup.object().strip()
})
if (externalJs) {
return schema.shape({
nwk_key: strippedSchema,
app_key: strippedSchema,
})
}
}
return yup.object().shape({
...commonShape,
default: defaultType.nullable(),
...numberTypeShape,
});
}
case 'relation':
return yup.object().shape({
name: yup
.string()
.matches(NAME_REGEX, errorsTrads.regex)
.unique(errorsTrads.unique, alreadyTakenAttributes)
.required(errorsTrads.required),
targetAttribute: yup.lazy(() => {
let schema = yup.string();
if (!['oneWay', 'manyWay'].includes(dataToValidate.nature)) {
schema = schema.matches(NAME_REGEX, errorsTrads.regex);
}
return schema
.unique(errorsTrads.unique, targetAttributeAlreadyTakenValue)
.required(errorsTrads.required);
}),
target: yup.string().required(errorsTrads.required),
nature: yup.string().required(),
dominant: yup.boolean().nullable(),
unique: yup.boolean().nullable(),
});
default:
return yup.object().shape({
.of(componentFieldSchema)
.nullable();
if (min) {
componentSchema = componentSchema.min(min, errorsTrads.min);
}
if (max) {
componentSchema = componentSchema.max(max, errorsTrads.max);
}
acc[current] = componentSchema;
return acc;
} else {
const componentSchema = yup.lazy(obj => {
if (obj !== undefined) {
return attribute.required === true
? componentFieldSchema.defined()
: componentFieldSchema.nullable();
}
return attribute.required === true
? yup.object().defined()
: yup.object().nullable();
});
acc[current] = componentSchema;
return acc;
}
}
@Validate(yup.lazy(() => Money.schema()))
public unitPrice?: FlatConvectorModel;
@Validate(yup.number())
public factor?: number;
@Validate(yup.lazy(() => Money.schema()))
public net?: FlatConvectorModel;
@Validate(yup.lazy(() => yup.array(Reference.schema())))
public udi?: Array>; //Device
@Validate(yup.array(yup.number()))
public noteNumber?: Array;
@Validate(yup.lazy(() => yup.array(ExplanationOfBenefitItemAdjudication.schema())))
public adjudication?: Array>;
@Validate(yup.lazy(() => yup.array(ExplanationOfBenefitItemDetailSubDetail.schema())))
public subDetail?: Array>;
}
export class ExplanationOfBenefitItemDetailSubDetail extends BackboneElement {
@Default('fhir.datatypes.ExplanationOfBenefit.ExplanationOfBenefitItemDetailSubDetail')
@ReadOnly()
public readonly type: string;
@Required()
@Validate(yup.number())
public sequence: number;
type: yup
.mixed()
.required("Valid Experiment Engine should be selected")
.when("$experimentEngineOptions", (options, schema) =>
schema.oneOf(options, "Valid Experiment Engine should be selected")
),
config: yup.mixed().when("type", {
is: "nop",
otherwise: experimentConfigSchema
})
})
})
}),
yup.object().shape({
config: yup.object().shape({
enricher: yup.lazy(value => {
switch (value.type) {
case "docker":
return enricherSchema.concat(dockerDeploymentSchema);
default:
return enricherSchema;
}
})
})
}),
yup.object().shape({
config: yup.object().shape({
ensembler: yup.object().shape({
type: yup
.mixed()
.required("Valid Ensembler type should be selected")
.oneOf(