{"version":3,"file":"index.cjs","names":[],"sources":["../src/lib/jsonSchema/ConstructInitialDataJsonSchema.ts","../src/lib/rules/BaseRule.ts","../src/lib/utils/messages.ts","../src/lib/rules/Rule.ts","../src/lib/rules/WhenRule.ts","../src/lib/utils/constants.ts","../src/lib/core/Definitions.ts","../src/lib/core/schema.ts","../src/lib/schemas/AnySchema.ts","../src/lib/core/ArrayTypedSchema.ts","../src/lib/schemas/ArraySchema.ts","../src/lib/schemas/BooleanSchema.ts","../src/lib/utils/DateUtils.ts","../src/lib/schemas/DateSchema.ts","../src/lib/schemas/NumberSchema.ts","../src/lib/core/ObjectTypedSchema.ts","../src/lib/schemas/ObjectSchema.ts","../src/lib/schemas/StringSchema.ts","../src/lib/jsonSchema/ConstructJsonSchema.ts","../src/lib/jsonSchema/JsonSchema.ts"],"sourcesContent":["import {\n\ttype JsonSchemaArrayType,\n\ttype JsonSchemaBooleanType,\n\ttype JsonSchemaDateType,\n\ttype JsonSchemaNumberType,\n\ttype JsonSchemaObjectType,\n\ttype JsonSchemaStringType,\n\ttype JsonSchemaType\n} from './ConstructJsonSchema';\n\nexport type JsonSchemaToDataType<T extends JsonSchemaType> = T extends JsonSchemaObjectType\n\t? { [K in keyof T['properties']]: JsonSchemaToDataType<T['properties'][K]> }\n\t: T extends JsonSchemaStringType\n\t\t? string\n\t\t: T extends JsonSchemaNumberType\n\t\t\t? number\n\t\t\t: T extends JsonSchemaBooleanType\n\t\t\t\t? boolean\n\t\t\t\t: T extends JsonSchemaDateType\n\t\t\t\t\t? Date | string\n\t\t\t\t\t: T extends JsonSchemaArrayType\n\t\t\t\t\t\t? Array<JsonSchemaToDataType<T['properties']>>\n\t\t\t\t\t\t: any;\n\nexport function ConstructInitialData<T extends JsonSchemaType>(schemaValue: T): JsonSchemaToDataType<T> {\n\tswitch ( schemaValue.type ) {\n\t\tcase 'object':\n\t\t\treturn Object.keys(schemaValue.properties)\n\t\t\t.reduce<any>((obj, key) => {\n\t\t\t\tobj[key] = ConstructInitialData(schemaValue.properties[key]);\n\t\t\t\treturn obj;\n\t\t\t}, {});\n\t\tcase 'array':\n\t\t\treturn [] as any;\n\t\tcase 'string':\n\t\t\treturn '' as any;\n\t\tcase 'number':\n\t\t\treturn 0 as any;\n\t\tdefault:\n\t\t\treturn undefined as any;\n\t}\n}\n","import { type CompileSchemaConfig } from '../types/SchemaTypes';\nimport { type SchemaError } from '../types/types';\nimport { type MessageType } from '../utils/messages';\n\nexport type RuleMethod<Value, Final = any> = (\n\tvalue: Value, \n\tform: Final\n) => SchemaError[] | false;\n\nexport type ValidationContext<T> = {\n\tcontext: {\n\t\terrors: SchemaError[]\n\t\tonlyOnTouch: string[]\n\t\tonlyOnTouchErrors: Record<string, SchemaError[]>\n\t\tpromises: Array<Promise<any>>\n\t}\n\n\tform: T\n\tparent: any\n\tpath: string\n};\n\nexport type RuleSrcCodeConfig = Pick<Required<CompileSchemaConfig>, 'context'>;\n\nexport type BaseRuleConfig<\n\tType extends string,\n\tValue, \n\tT = any, \n\tMethod extends (...args: any[]) => any = RuleMethod<Value, T>\n> = {\n\tmethod: Method\n\ttype: Type\n\tmessage?: string | ((messages: MessageType) => string)\n};\n\nexport function getError(path: string, error: string): SchemaError {\n\treturn {\n\t\terror,\n\t\tpath \n\t}; \n}\n","/* eslint-disable @typescript-eslint/no-unused-vars */\nimport deepmerge from '@fastify/deepmerge';\n\nimport { type PhoneNumberInfo } from '../phoneNumbers';\nimport { type PostalCodeInfo } from '../postalCodes';\nimport { type DateFormat } from '../types/DateFormat';\nimport { type DeepPartial } from '../types/types';\n\nconst getInvalidFormatMessage = (type: string) => `Invalid ${type} format`;\n\nexport let defaultMessages = {\n\tany: {\n\t\tenum: getInvalidFormatMessage('enum')\n\t},\n\tarray: {\n\t\tempty: 'Requires to be empty',\n\t\tmin: (minValue: number) => `Requires at least ${minValue} item${minValue === 1 ? 's' : ''}`,\n\t\tmax: (maxValue: number) => `Requires maximum of ${maxValue} item${maxValue === 1 ? 's' : ''}`,\n\t\tlength: (length: number) => `Requires ${length} item${length === 1 ? 's' : ''}`,\n\t\tunique: 'Requires to be unique',\n\t\tuniqueBy: 'Requires to be unique'\n\t},\n\tboolean: {\n\t\tmustBe: (mustBeValue: boolean) => `Must be ${mustBeValue.toString()}`\n\t},\n\tdate: {\n\t\tequals: (date: Date | ((...args: any[]) => any), format: DateFormat) => typeof date === 'function' ? 'Date is not equal' : `Requires to be at equal to date ${date.toLocaleString()}`,\n\t\tmaxDate: (maxDate: Date | ((...args: any[]) => any), format: DateFormat) => typeof maxDate === 'function' ? 'Date is not bigger than min date' : `Requires to be at smaller than date ${maxDate.toLocaleString()}`,\n\t\tminDate: (minDate: Date | ((...args: any[]) => any), format: DateFormat) => typeof minDate === 'function' ? 'Date is not smaller than max date' : `Requires to be at bigger than date ${minDate.toLocaleString()}`,\n\t\ttoday: 'Requires to be today\\'s date'\n\t},\n\tnumber: {\n\t\tmin: (minValue: number) => `Requires to be at least ${minValue}`,\n\t\tmax: (maxValue: number) => `Requires to be maximum of ${maxValue}`,\n\t\tbetween: (minValue: number, maxValue: number) => `Requires to be between ${minValue} and ${maxValue}`,\n\t\tequals: (equalsValue: number | number[]) => `Needs to be the same as ${Array.isArray(equalsValue) ? equalsValue.join(' or ') : equalsValue}`,\n\t\tinteger: 'Requires to be a integer number',\n\t\tdecimal: (equalsValue: number) => `Requires to have ${equalsValue} decimal number`,\n\t\tpositive: 'Requires to be positive number',\n\t\tnegative: 'Requires to be negative number',\n\t\tenum: getInvalidFormatMessage('enum')\n\t},\n\tstring: {\n\t\tmin: (minValue: number) => `Requires to have at least minimum size of ${minValue}`,\n\t\tmax: (maxValue: number) => `Requires to have maximum size of ${maxValue}`,\n\t\tlength: (equalsValue: number) => `Requires string to have size ${equalsValue}`,\n\t\tequals: (equalsValue: string | string[]) => `Needs to be the same as ${Array.isArray(equalsValue) ? equalsValue.join(' or ') : equalsValue}`,\n\t\tpattern: (reg: RegExp) => 'Invalid format',\n\t\tempty: 'Requires string to be empty',\n\t\tcontains: (value: string) => `Requires ${value}`,\n\t\tnumeric: getInvalidFormatMessage('number'),\n\t\talpha: getInvalidFormatMessage('text'),\n\t\talphanum: getInvalidFormatMessage('alpha numeric'),\n\t\talphadash: getInvalidFormatMessage('alpha dash'),\n\t\thex: getInvalidFormatMessage('hexadecimal'),\n\t\tbase64: getInvalidFormatMessage('base64'),\n\t\tuuid: getInvalidFormatMessage('uuid'),\n\t\tcuid: getInvalidFormatMessage('cuid'),\n\t\turl: getInvalidFormatMessage('url'),\n\t\tsingleLine: getInvalidFormatMessage('single line'),\n\t\temail: getInvalidFormatMessage('email'),\n\t\tenum: getInvalidFormatMessage('enum'),\n\t\tpostalCode: ({ format }: PostalCodeInfo) => `Invalid format needs to be like ${format}`,\n\t\tphoneNumber: ({ countryCode }: PhoneNumberInfo) => `Invalid phone format ${countryCode ? '(' + countryCode + ')' : ''} `\n\t},\n\tnotOptional: 'Not optional item',\n\tnotNullable: 'Not optional item',\n\trequired: 'Required item'\n} as const;\n\nexport type MessageType = typeof defaultMessages;\n\nconst deepMerge = deepmerge();\n\n/**\n * Method to replace default messages.\n * @param newDefaultMessages \n */\nexport function setupDefaultMessage(newDefaultMessages: DeepPartial<MessageType>) {\n\tdefaultMessages = deepMerge(defaultMessages, newDefaultMessages) as MessageType;\n}\n","import { type Schema } from '../core/schema';\nimport { type Context, type PrivateSchema } from '../types/SchemaTypes';\nimport { type SchemaError } from '../types/types';\nimport { defaultMessages, type MessageType } from '../utils/messages';\n\nimport { getError, type BaseRuleConfig, type ValidationContext } from './BaseRule';\n\n/**\n * When test is \"false\" message appears\n */\nexport type RuleBooleanMethod<Value, T = any> = (\n\tvalue: NonNullable<Value>, \n\tparent: any,\n\tconfig: ValidationContext<T>\n) => boolean;\n/**\n * When test is \"false\" message appears\n */\nexport type RuleMethodSchemaError<Value, T = any> = (\n\tvalue: NonNullable<Value>, \n\tparent: any,\n\tconfig: ValidationContext<T>\n) => SchemaError[] | true;\n\nexport type RuleMethod<Value, T = any> = RuleBooleanMethod<Value, T> | RuleMethodSchemaError<Value, T>;\n\n/**\n * When test is \"false\" message appears\n */\nexport type AsyncRuleBooleanMethod<Value, T = any> = (\n\tvalue: NonNullable<Value>, \n\tparent: any,\n\tconfig: ValidationContext<T>\n) => Promise<boolean>;\n/**\n * When test is \"false\" message appears\n */\nexport type AsyncRuleMethodSchemaError<Value, T = any> = (\n\tvalue: NonNullable<Value>, \n\tparent: any,\n\tconfig: ValidationContext<T>\n) => Promise<SchemaError[] | true>;\n\nexport type AsyncRuleMethod<Value, T = any> = AsyncRuleBooleanMethod<Value, T> | AsyncRuleMethodSchemaError<Value, T>;\n\nexport type RuleConfig<Value = any, T = any> = {\n\tisAsync: boolean\n\tisCustomTestThatReturnsArray: boolean\n} & BaseRuleConfig<'Rule', Value, T, RuleMethod<Value, T> | AsyncRuleMethod<Value, T>>;\n\nexport function getMethodContext(\n\tpath: string, \n\tvalidationContext: ValidationContext<any>,\n\tparent?: any\n): ValidationContext<any> {\n\treturn {\n\t\tcontext: validationContext.context,\n\t\tform: validationContext.form,\n\t\tpath,\n\t\tparent: parent ?? validationContext.parent\n\t};\n}\n\nfunction getRuleSrcCode<Value, T = any>(\n\tconfig: Pick<\n\t\tRuleConfig<Value, T>,\n\t\t'isCustomTestThatReturnsArray' | 'message'\n\t>,\n\tcontext: Context\n): any {\n\tconst isAsync = context.isAsync;\n\t\n\tif ( config.isCustomTestThatReturnsArray ) {\n\t\tif ( isAsync ) {\n\t\t\treturn (validationContext: ValidationContext<any>, error: SchemaError) => {\n\t\t\t\tconst _path = error.path || validationContext.path;\n\t\t\t\tconst _error = getError(_path, error.error);\n\t\t\t\tvalidationContext.context.errors.push(_error);\n\t\t\t\t(validationContext.context.onlyOnTouchErrors[_path] = validationContext.context.onlyOnTouchErrors[_path] || []).push(_error);\n\t\t\t};\n\t\t}\n\n\t\treturn (validationContext: ValidationContext<any>, error: SchemaError) => {\n\t\t\tvalidationContext.context.errors.push(getError(error.path || validationContext.path, error.error));\n\t\t};\n\t}\n\n\tconst _message: string = (\n\t\ttypeof config.message === 'string' \n\t\t\t? config.message \n\t\t\t: (config.message as ((messages: MessageType) => string))(defaultMessages)\n\t);\n\n\tif ( isAsync ) {\n\t\treturn (validationContext: ValidationContext<any>) => {\n\t\t\tconst _error = getError(validationContext.path, _message);\n\t\t\tvalidationContext.context.errors.push(_error);\n\t\t\t(validationContext.context.onlyOnTouchErrors[validationContext.path] = validationContext.context.onlyOnTouchErrors[validationContext.path] || []).push(_error);\n\t\t};\n\t}\n\n\treturn (validationContext: ValidationContext<any>) => {\n\t\tvalidationContext.context.errors.push(getError(validationContext.path, _message));\n\t};\n}\n\nexport function getRule<Value, T = any>(\n\tconfig: RuleConfig<Value, T>,\n\tcontext: Context\n) {\n\tcontext.isAsync = config.isAsync;\n\n\tconst fn = getRuleSrcCode(config, context);\n\n\tif ( config.isAsync ) {\n\t\tif ( config.isCustomTestThatReturnsArray ) {\n\t\t\treturn (value: any, validationContext: ValidationContext<any>) => {\n\t\t\t\tvalidationContext.context.promises.push(\n\t\t\t\t\t(config.method(value, validationContext.parent, validationContext) as Promise<SchemaError[]>)\n\t\t\t\t\t.then((isValid) => {\n\t\t\t\t\t\tif ( isValid.length ) {\n\t\t\t\t\t\t\tisValid.forEach((error: SchemaError) => {\n\t\t\t\t\t\t\t\tfn(validationContext, error);\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t};\n\t\t}\n\t\treturn (value: any, validationContext: ValidationContext<any>) => {\n\t\t\tvalidationContext.context.promises.push(\n\t\t\t\t(config.method(value, validationContext.parent, validationContext) as Promise<boolean>)\n\t\t\t\t.then((isValid) => {\n\t\t\t\t\tif ( isValid ) {\n\t\t\t\t\t\tfn(validationContext);\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t);\n\t\t};\n\t}\n\n\tif ( config.isCustomTestThatReturnsArray ) {\n\t\treturn (value: any, validationContext: ValidationContext<any>) => {\n\t\t\tconst isValid = config.method(value, validationContext.parent, validationContext) as SchemaError[];\n\t\t\tif ( isValid.length ) {\n\t\t\t\tisValid.forEach((error) => {\n\t\t\t\t\tfn(validationContext, error);\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\t}\n\n\treturn (value: any, validationContext: ValidationContext<any>) => {\n\t\tif ( config.method(value, validationContext.parent, validationContext) ) {\n\t\t\tfn(validationContext);\n\t\t}\n\t};\n}\n\n// #region OnlyOnTouchRule\nexport type OnlyOnTouchRuleConfig = {\n\tthen: Schema<any, any>\n\ttype: 'OnlyOnTouchRule'\n};\n\nexport function getOnlyTouchRule(\n\tconfig: OnlyOnTouchRuleConfig,\n\tcontext: Context\n) {\n\t// @ts-expect-error // Because the camp that is changing is protected\n\tconfig.then.def.isOnlyOnTouch = true;\n\t\n\treturn (config.then as PrivateSchema).compileSchema({\n\t\tcontext\n\t});\n}\n// #endregion OnlyOnTouchRule\n","import { type Schema } from '../core/schema';\nimport { type Context, type PrivateSchema } from '../types/SchemaTypes';\n\nimport { type ValidationContext } from './BaseRule';\nimport { type RuleBooleanMethod } from './Rule';\n\nexport type WhenConfig<\n\tT,\n\tInput, \n\tFinal = Input\n> = {\n\t/**\n\t * When \"is\" returns true \"then\", when false \"otherwise\"\n\t */\n\tis: RuleBooleanMethod<Input, Final>\n\tthen: (schema: T) => T\n\totherwise?: (schema: T) => T\n};\n\nexport type WhenParameter<Value = any, T = any> = {\n\tmethod: RuleBooleanMethod<Value, T>\n\tthen: Schema<any, any>\n\t/**\n\t * Makes when named, so uses a key from parent\n\t */\n\tnamedValueKey?: string\n\totherwise?: Schema<any, any>\n};\n\nexport function getWhenRule<Value = any, T = any>(\n\tconfig: WhenParameter<Value, T>,\n\tcontext: Context\n) {\n\tconst thenSrcCode = (config.then as unknown as PrivateSchema)\n\t.compileSchema({\n\t\tcontext\n\t});\n\n\t// This will never be undefined because when \n\t// creating whenRules otherwise is inserted by default\n\t// Only when whenRule is a normalRule will otherwise be undefined \n\tconst otherwiseSrcCode = (config.otherwise as unknown as PrivateSchema).compileSchema({\n\t\tcontext\n\t});\n\n\tif ( config.namedValueKey ) {\n\t\treturn (value: any, validationContext: ValidationContext<any>) => {\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tconst isValid = config.method(validationContext.parent[config.namedValueKey!], validationContext.parent, validationContext);\n\n\t\t\t(isValid ? thenSrcCode : otherwiseSrcCode)(value, validationContext);\n\t\t};\n\t}\n\n\treturn (value: any, validationContext: ValidationContext<any>) => {\n\t\tconst isValid = config.method(value, validationContext.parent, validationContext);\n\n\t\t(isValid ? thenSrcCode : otherwiseSrcCode)(value, validationContext);\n\t};\n}\n","export const IS_DEV = process.env.NODE_ENV === 'development';\n","import { type OnlyOnTouchRuleConfig, type RuleConfig } from '../rules/Rule';\nimport { type WhenParameter } from '../rules/WhenRule';\nimport { type OnlyOnTouch } from '../types/FormKey';\nimport { type SchemaError } from '../types/types';\n\nexport class Definitions<Input = any, Final = any> {\n\tpublic isOnlyOnTouch?: boolean;\n\n\tpublic isOptional?: boolean;\n\tpublic messageOptional?: string;\n\n\tpublic isNullable?: boolean;\n\tpublic messageNullable?: string;\n\n\tpublic isRequired?: boolean;\n\tpublic messageRequired?: string;\n\n\tpublic normalRules = new Map<string, RuleConfig<Input, Final> | OnlyOnTouchRuleConfig>();\n\tpublic whenRules: WhenParameter[] = [];\n\n\tpublic _validate: ((value: any, onlyOnTouch?: OnlyOnTouch<Input>) => Promise<SchemaError[]> | SchemaError[]) | undefined;\n\n\tpublic clone(): Definitions<Input, Final> {\n\t\tconst newDefinitions = Object.assign<Definitions, this>(Object.create(Object.getPrototypeOf(this)), this);\n\n\t\tnewDefinitions.normalRules = new Map(this.normalRules);\n\t\tnewDefinitions.whenRules = [...this.whenRules];\n\n\t\treturn newDefinitions;\n\t}\n}\n","/* eslint-disable no-new-func */\n/* eslint-disable @typescript-eslint/no-implied-eval */\n/* eslint-disable @typescript-eslint/no-non-null-assertion */\nimport { getError, type ValidationContext } from '../rules/BaseRule';\nimport {\n\ttype AsyncRuleBooleanMethod,\n\ttype AsyncRuleMethodSchemaError,\n\tgetOnlyTouchRule,\n\tgetRule,\n\ttype RuleBooleanMethod,\n\ttype RuleMethodSchemaError\n} from '../rules/Rule';\nimport { getWhenRule, type WhenConfig } from '../rules/WhenRule';\nimport { type OnlyOnTouch } from '../types/FormKey';\nimport { type ObjectPropertiesSchema } from '../types/SchemaMap';\nimport { type CompileSchemaConfig, type Context } from '../types/SchemaTypes';\nimport { type SchemaError } from '../types/types';\nimport { IS_DEV } from '../utils/constants';\nimport { defaultMessages, type MessageType } from '../utils/messages';\n\nimport { Definitions } from './Definitions';\n\nexport type OldTestMethodConfig<Method extends (...args: any[]) => any> = {\n\t/**\n\t * When is is \"true\" errors shows\n\t */\n\tmessage: string | ((messages: MessageType) => string)\n\t/**\n\t * @deprecated When test is \"false\" errors shows\n\t */\n\ttest: Method\n\t/**\n\t * Servers to make validation unique, otherwise method cannot be changed\n\t */\n\tname?: string\n};\n\nexport type TestMethodConfig<Method extends (...args: any[]) => any> = {\n\t/**\n\t * When is is \"true\" errors shows\n\t */\n\tis: Method\n\tmessage: string | ((messages: MessageType) => string)\n\t/**\n\t * Servers to make validation unique, otherwise method cannot be changed\n\t */\n\tname?: string\n\t/**\n\t * @deprecated When test is \"false\" errors shows\n\t */\n\ttest?: Method\n};\n\nexport abstract class Schema<Input = any, Final = any> {\n\tpublic input!: Input;\n\tpublic final!: Final;\n\tprotected isAsync: boolean = false;\n\tprotected def: Definitions<Input, Final> = new Definitions<Input, Final>();\n\tprotected message: string = '';\n\tprotected abstract rule: RuleBooleanMethod<any, any>;\n\n\tconstructor(message?: string, def?: Definitions<Input, Final>) {\n\t\tthis.message = message ?? this.message;\n\t\tif ( def ) {\n\t\t\tthis.def = def.clone();\n\t\t}\n\t}\n\n\tprotected clone(): any {\n\t\treturn new (this.constructor as new(...args: any[]) => any)(this.message, this.def);\n\t};\n\n\tprotected whenClone(): any {\n\t\tconst clone = new (this.constructor as new(...args: any[]) => any)(this.message, this.def);\n\t\t\n\t\tclone.def.normalRules = new Map();\n\t\tclone.def.whenRules = [];\n\t\tclone.rule = () => true;\n\n\t\treturn clone;\n\t};\n\n\t// #region Normal Rules\n\tprotected compileNormalRules(\n\t\tcontext: Context\n\t): Function[] {\n\t\tconst srcCode: Function[] = [];\n\n\t\tthis.def.normalRules\n\t\t.forEach((rule) => {\n\t\t\tsrcCode.push(\n\t\t\t\trule.type === 'OnlyOnTouchRule'\n\t\t\t\t\t? getOnlyTouchRule(rule, context)\n\t\t\t\t\t: getRule(rule, context)\n\t\t\t);\n\t\t});\n\n\t\treturn srcCode.flat();\n\t}\n\t// #endregion Normal Rules\n\n\t// #region When Rules\n\tprotected compileWhenSchema(context: Context) {\n\t\tconst whenCode = this.def.whenRules.map((rule) => getWhenRule(rule, context));\n\n\t\tconst l = whenCode.length;\n\t\treturn (value: any, validationContext: ValidationContext<any>) => {\n\t\t\tlet x = 0; \n\t\t\twhile (x < l) {\n\t\t\t\tconst fn = whenCode[x];\n\t\t\t\tfn(value, validationContext);\n\t\t\t\tx++;\n\t\t\t}\n\t\t};\n\t}\n\t// #endregion When Rules\n\n\tprotected compileNormalSchema(\n\t\t{\n\t\t\tcontext,\n\t\t\tsrcCode\n\t\t}: CompileSchemaConfig\n\t) {\n\t\tconst rulesSrcCode = this.compileNormalRules(context);\n\n\t\tif ( srcCode ) {\n\t\t\trulesSrcCode.push(srcCode);\n\t\t}\n\n\t\tconst l = rulesSrcCode.length;\n\n\t\tconst _message: string = (\n\t\t\ttypeof this.message === 'string' \n\t\t\t\t? this.message \n\t\t\t\t: (this.message as ((messages: MessageType) => string))(defaultMessages)\n\t\t);\n\n\t\treturn this.getMandatoryRules(\n\t\t\tthis, \n\t\t\t(value: any, validationContext: ValidationContext<Final>) => {\n\t\t\t\tif (!this.rule(value, validationContext.parent, validationContext)) {\n\t\t\t\t\tvalidationContext.context.errors.push(getError(validationContext.path, _message));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tfor (let x = 0; x < l; x++) {\n\t\t\t\t\tconst fn = rulesSrcCode[x];\n\t\t\t\t\tfn(value, validationContext);\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t}\n\n\tprotected getRequiredStringCondition = (value: any) => value == null;\n\tprotected getNotRequiredStringCondition = (value: any) => value != null;\n\n\tprivate createCondition(\n\t\tfnSrcCode: Function, \n\t\tcondition: (value: any) => boolean\n\t) {\n\t\treturn (value: any, validationContext: ValidationContext<Final>) => {\n\t\t\tif ( condition(value) ) {\n\t\t\t\tfnSrcCode(value, validationContext);\n\t\t\t}\n\t\t};\n\t}\n\n\tprivate createErrorCondition(\n\t\tfnSrcCode: (value: any, validationContext: ValidationContext<Final>) => void, \n\t\tmessage: string, \n\t\tcondition: (value: any) => boolean\n\t) {\n\t\treturn (value: any, validationContext: ValidationContext<Final>) => {\n\t\t\tif (condition(value)) {\n\t\t\t\tvalidationContext.context.errors.push(getError(validationContext.path, message));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tfnSrcCode(value, validationContext);\n\t\t};\n\t}\n\n\tprotected getMandatoryRules(schema: Schema<any>, fnSrcCode: (value: any, validationContext: ValidationContext<Final>) => void) {\n\t\tconst {\n\t\t\tisOptional, isNullable, isRequired, isOnlyOnTouch \n\t\t} = schema.def;\n\n\t\tif ( isOptional !== undefined ) {\n\t\t\treturn !isOptional\n\t\t\t\t? this.createErrorCondition(\n\t\t\t\t\tfnSrcCode,\n\t\t\t\t\tthis.def.messageOptional ?? defaultMessages.notOptional,\n\t\t\t\t\t(value) => value === undefined\n\t\t\t\t) : this.createCondition(\n\t\t\t\t\tfnSrcCode,\n\t\t\t\t\t(value) => value !== undefined\n\t\t\t\t);\n\t\t}\n\n\t\tif ( isNullable !== undefined ) {\n\t\t\treturn !isNullable\n\t\t\t\t? this.createErrorCondition(\n\t\t\t\t\tfnSrcCode,\n\t\t\t\t\tthis.def.messageNullable ?? defaultMessages.notNullable,\n\t\t\t\t\t(value) => value === null\n\t\t\t\t) : this.createCondition(\n\t\t\t\t\tfnSrcCode,\n\t\t\t\t\t(value) => value !== null\n\t\t\t\t);\n\t\t}\n\n\t\tif ( isRequired !== undefined ) {\n\t\t\treturn isRequired\n\t\t\t\t? this.createErrorCondition(\n\t\t\t\t\tfnSrcCode,\n\t\t\t\t\tthis.def.messageRequired ?? defaultMessages.required,\n\t\t\t\t\tthis.getRequiredStringCondition\n\t\t\t\t) : this.createCondition(\n\t\t\t\t\tfnSrcCode,\n\t\t\t\t\t(value) => this.getNotRequiredStringCondition(value)\n\t\t\t\t);\n\t\t}\n\n\t\tif ( isOnlyOnTouch ) { \n\t\t\treturn (value: any, validationContext: ValidationContext<Final>) => {\n\t\t\t\tif ( validationContext.context.onlyOnTouch.some((key) => key === '*' || key.includes(validationContext.path) || validationContext.path.includes(key)) ) {\n\t\t\t\t\tfnSrcCode(value, validationContext);\n\t\t\t\t\tvalidationContext.context.onlyOnTouchErrors[validationContext.path] = validationContext.context.errors.filter((error) => error.path === validationContext.path);\n\t\t\t\t}\n\t\t\t\telse if ( validationContext.context.onlyOnTouchErrors[validationContext.path] ) {\n\t\t\t\t\tvalidationContext.context.onlyOnTouchErrors[validationContext.path].forEach((error) => validationContext.context.errors.push(error));\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\n\t\treturn fnSrcCode;\n\t}\n\n\tprotected compileSchema(config: CompileSchemaConfig) {\n\t\tconst normalFunction = this.compileNormalSchema(config);\n\n\t\tif ( this.def.whenRules.length ) {\n\t\t\tconst whenFunction = this.compileWhenSchema(config.context);\n\t\t\treturn (value: any, validationContext: ValidationContext<any>) => {\n\t\t\t\tnormalFunction(value, validationContext);\n\t\t\t\twhenFunction(value, validationContext);\n\t\t\t};\n\t\t}\n\n\t\treturn normalFunction;\n\t}\n\n\tprivate addTest<Form = this['final']>(\n\t\tisAsync: boolean,\n\t\tmethod: TestMethodConfig<RuleBooleanMethod<Input, Form>> | \n\t\t\tOldTestMethodConfig<RuleBooleanMethod<Input, Form>> | \n\t\t\tRuleMethodSchemaError<Input, Form> | \n\t\t\tAsyncRuleMethodSchemaError<Input, Form> | \n\t\t\tTestMethodConfig<AsyncRuleBooleanMethod<Input, Form>> | \n\t\t\tOldTestMethodConfig<AsyncRuleBooleanMethod<Input, Form>>\n\t) {\n\t\tconst _this = this.clone();\n\n\t\t_this.def.normalRules.set(\n\t\t\ttypeof method === 'object' \n\t\t\t\t? method.name ?? `_test_${this.def.normalRules.size}`\n\t\t\t\t: `_test_${this.def.normalRules.size}`,\n\t\t\ttypeof method === 'object' \n\t\t\t\t? {\n\t\t\t\t\tisAsync,\n\t\t\t\t\tisCustomTestThatReturnsArray: false,\n\t\t\t\t\tmethod: (method as TestMethodConfig<RuleBooleanMethod<Input, Form>>).is ?? ((...args) => !(method as OldTestMethodConfig<RuleBooleanMethod<Input, Form>>).test(...args)),\n\t\t\t\t\tmessage: method.message,\n\t\t\t\t\ttype: 'Rule'\n\t\t\t\t} : {\n\t\t\t\t\tisAsync,\n\t\t\t\t\tisCustomTestThatReturnsArray: true,\n\t\t\t\t\tmethod,\n\t\t\t\t\ttype: 'Rule'\n\t\t\t\t}\n\t\t);\n\n\t\treturn _this;\n\t}\n\n\t/**\n\t * Method for custom validation\n\t */\n\tpublic test<Form = this['final']>(\n\t\tmethod: TestMethodConfig<RuleBooleanMethod<Input, Form>>\n\t): ObjectPropertiesSchema<Input, Form>;\n\tpublic test<Form = this['final']>(\n\t\tmethod: RuleMethodSchemaError<Input, Form>\n\t): ObjectPropertiesSchema<Input, Form>;\n\tpublic test<Form = this['final']>(\n\t\tmethod: OldTestMethodConfig<RuleBooleanMethod<Input, Form>>\n\t): ObjectPropertiesSchema<Input, Form>;\n\tpublic test<Form = this['final']>(\n\t\tmethod: TestMethodConfig<RuleBooleanMethod<Input, Form>> | \n\t\t\tOldTestMethodConfig<RuleBooleanMethod<Input, Form>> | \n\t\t\tRuleMethodSchemaError<Input, Form>\n\t): ObjectPropertiesSchema<Input, Form> {\n\t\treturn this.addTest(false, method);\n\t}\n\n\t/**\n\t * Method for async custom validation\n\t */\n\tpublic asyncTest<Form = this['final']>(\n\t\tmethod: TestMethodConfig<AsyncRuleBooleanMethod<Input, Form>>\n\t): this;\n\tpublic asyncTest<Form = this['final']>(\n\t\tmethod: AsyncRuleMethodSchemaError<Input, Form>,\n\t): this;\n\tpublic asyncTest<Form = this['final']>(\n\t\tmethod: OldTestMethodConfig<AsyncRuleBooleanMethod<Input, Form>>\n\t): this;\n\tpublic asyncTest<Form = this['final']>(\n\t\tmethod: AsyncRuleMethodSchemaError<Input, Form> | TestMethodConfig<AsyncRuleBooleanMethod<Input, Form>> | OldTestMethodConfig<AsyncRuleBooleanMethod<Input, Form>>\n\t): this {\n\t\treturn this.addTest(true, method);\n\t}\n\n\t/**\n\t * Makes schema conditional. Meaning when `is` is true \n\t * it will validate with `then schema` otherwise will \n\t * validate with `otherwise schema`.\n\t * @param {WhenConfig} \n\t * @example\n\t * ```Typescript\n\t * number()\n\t * .optional() // Validation will be included in `then` and `otherwise`\n\t * .when({\n\t * \tis: (value, form) => value === 10,\n\t *  then: (schema) => schema.required() ,\n\t *  otherwise: (schema) => schema.notOptional()\n\t * })\n\t * ```\n\t */\n\tpublic when<Value = any, Form = any, S extends Schema<any> = this>(\n\t\tname: string,\n\t\tconfig: WhenConfig<S, Value, Form>\n\t): this;\n\tpublic when<Value = any, Form = any, S extends Schema<any> = this>(\n\t\tconfig: WhenConfig<S, Value, Form>\n\t): this;\n\tpublic when<Value = any, Form = any, S extends Schema<any> = this>(\n\t\tname: WhenConfig<S, Value, Form> | string,\n\t\tconfig?: WhenConfig<S, Value, Form>\n\t): this {\n\t\tconst _this = this.clone();\n\n\t\tconst {\n\t\t\tthen, otherwise, is \n\t\t} = typeof name === 'string' ? config! : name;\n\n\t\tconst otherwiseThis = this.whenClone();\n\n\t\t_this.def.whenRules.push({\n\t\t\tnamedValueKey: typeof name === 'string' ? name : undefined,\n\t\t\tmethod: is,\n\t\t\tthen: then(this.whenClone()),\n\t\t\totherwise: otherwise ? otherwise(otherwiseThis) : otherwiseThis\n\t\t});\n\n\t\treturn _this;\n\t} \n\n\t/**\n\t * Makes schema validation only on touch \n\t * (meaning value will only be validated if key \n\t * is present in onlyOnTouch: OnlyOnTouch<Input>).\n\t */\n\tpublic onlyOnTouch(onlyOnTouch?: (schema: this) => this): this {\n\t\tconst _this = this.clone() as this;\n\t\tif ( onlyOnTouch === undefined ) {\n\t\t\t_this.def.isOnlyOnTouch = true;\n\t\t\treturn _this;\n\t\t}\n\n\t\tlet clone = this.whenClone() as this;\n\t\tclone.def.isOnlyOnTouch = undefined;\n\t\tclone.def.isOptional = undefined;\n\t\tclone.def.isNullable = undefined;\n\t\tclone.def.isRequired = undefined;\n\t\tclone.def.whenRules = [];\n\t\tclone.def.normalRules = new Map();\n\n\t\tclone = onlyOnTouch(clone);\n\n\t\t/* c8 ignore start */\n\t\tif ( IS_DEV ) {\n\t\t\tclone.def.normalRules.forEach((_, key) => {\n\t\t\t\tif ( this.def.normalRules.has(key) ) {\n\t\t\t\t\tthrow new Error(`Method ${key} already exists outside of 'onlyOnTouch'. To prevent confusion decide if you want '${key}' outside or inside 'onlyOnTouch'`);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\t/* c8 ignore end */\n\n\t\t_this.def.normalRules.set(\n\t\t\t`_test_${this.def.normalRules.size}`,\n\t\t\t{\n\t\t\t\tthen: clone,\n\t\t\t\ttype: 'OnlyOnTouchRule'\n\t\t\t}\n\t\t);\n\n\t\treturn _this;\n\t}\n\n\t/**\n\t * Makes schema validation validation regardless of \"touches\" \n\t * (meaning value will be validated even if key \n\t * is present in onlyOnTouch: OnlyOnTouch<Input>).\n\t */\n\tpublic notOnlyOnTouch(): this {\n\t\tconst _this = this.clone();\n\t\t_this.def.isOnlyOnTouch = false;\n\n\t\treturn _this;\n\t}\n\t\n\t/**\n\t * Makes schema validation required (meaning value can not be undefined and null).\n\t */\n\tpublic required(message?: string): this {\n\t\tconst _this = this.clone();\n\t\t_this.def.isOptional = undefined;\n\t\t_this.def.isNullable = undefined;\n\t\t_this.def.isRequired = true;\n\t\t_this.def.messageRequired = message;\n\n\t\treturn _this;\n\t}\n\n\t/**\n\t * Makes schema validation not required (meaning value can be undefined and null).\n\t */\n\tpublic notRequired(): this {\n\t\tconst _this = this.clone();\n\t\t_this.def.isOptional = undefined;\n\t\t_this.def.isNullable = undefined;\n\t\t_this.def.isRequired = false;\n\n\t\treturn _this;\n\t}\n\n\t/**\n\t * Makes schema validation optional (meaning value can be undefined).\n\t */\n\tpublic optional(): this {\n\t\tconst _this = this.clone();\n\t\t_this.def.isOptional = true;\n\t\t_this.def.isRequired = undefined;\n\n\t\treturn _this;\n\t}\n\n\t/**\n\t * Makes schema validation not optional (meaning value can not be undefined).\n\t */\n\tpublic notOptional(message?: string): this {\n\t\tconst _this = this.clone();\n\t\t_this.def.isOptional = false;\n\t\t_this.def.isRequired = undefined;\n\t\t_this.def.messageOptional = message;\n\n\t\treturn _this;\n\t}\n\n\t/**\n\t * Makes schema validation nullable (meaning value can be null).\n\t */\n\tpublic nullable(): this {\n\t\tconst _this = this.clone();\n\t\t_this.def.isNullable = true;\n\t\t_this.def.isRequired = undefined;\n\n\t\treturn _this;\n\t}\n\n\t/**\n\t * Makes schema validation not nullable (meaning value can not be null).\n\t */\n\tpublic notNullable(message?: string): this {\n\t\tconst _this = this.clone();\n\t\t_this.def.isNullable = false;\n\t\t_this.def.isRequired = undefined;\n\t\t_this.def.messageNullable = message;\n\n\t\treturn _this;\n\t}\n\n\t/**\n\t * Creates validation method. \n\t * @param config - {@link CompileConfig} \n\t */\n\tpublic compile(): this {\n\t\tconst context: Context = {};\n\t\t\n\t\tconst schemasSrcCode = this.compileSchema({\n\t\t\tcontext,\n\t\t\tisFirstSchema: true\n\t\t});\n\n\t\tthis.isAsync = context.isAsync ?? false;\n\n\t\tconst validate = this.isAsync\n\t\t\t? (validationContext: ValidationContext<Final>) => validationContext.context.promises.length > 0 \n\t\t\t\t? Promise.all(validationContext.context.promises).then(() => validationContext.context.errors) \n\t\t\t\t: validationContext.context.errors\n\t\t\t: (validationContext: ValidationContext<Final>) => validationContext.context.errors;\n\n\t\tconst onlyOnTouchErrors = {};\n\n\t\tthis.def._validate = (value: any, onlyOnTouch: OnlyOnTouch<Input> = []): typeof this.isAsync extends true ? Promise<SchemaError[]> : SchemaError[] => {\n\t\t\tconst validationContext: ValidationContext<Final> = {\n\t\t\t\tcontext: {\n\t\t\t\t\terrors: [],\n\t\t\t\t\tonlyOnTouch,\n\t\t\t\t\tpromises: [],\n\t\t\t\t\tonlyOnTouchErrors\n\t\t\t\t},\n\t\t\t\tform: value,\n\t\t\t\t\n\t\t\t\tpath: '',\n\t\t\t\tparent: value\n\t\t\t};\n\t\t\t\n\t\t\tschemasSrcCode(value, validationContext);\n\n\t\t\treturn validate(\n\t\t\t\tvalidationContext\n\t\t\t) as typeof this.isAsync extends true ? Promise<SchemaError[]> : SchemaError[];\n\t\t};\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Validates form and returns an array of errors {@link SchemaError}\n\t * @param value - form input\n\t * @param onlyOnTouch - array of keys that inform the schema if a value\n\t * was touched. Works with only with {@link Schema#onlyOnTouch} \n\t * @returns {SchemaError}\n\t */\n\tpublic validate(value: Input, onlyOnTouch: OnlyOnTouch<Input> = []): SchemaError[] | Promise<SchemaError[]> {\n\t\tif ( !this.def._validate ) {\n\t\t\tthis.compile();\n\t\t}\n\n\t\treturn this.def._validate!(value, onlyOnTouch);\n\t}\n}\n","import { Schema } from '../core/schema';\n\nexport class AnySchema<\n\tInput = any, \n\tFinal = any\n> extends Schema<Input, Final> {\n\tprotected message: string = 'Is not array';\n\tprotected rule = () => true;\n\t\n\t/**\n\t * Checks if is a value of enum.\n\t * @param enumObject enum\n\t * @param message @option Overrides default message\n\t */\n\t// eslint-disable-next-line @typescript-eslint/consistent-indexed-object-style\n\tpublic enum<T extends { [name: string]: any }>(enumObject: T, message?: string) {\n\t\tconst enumValues = Object.values(enumObject);\n\n\t\treturn this.test({\n\t\t\tis: (value) => !enumValues.includes(value),\n\t\t\tmessage: message ?? ((messages) => messages.any.enum)\n\t\t}) as unknown as AnySchema<T[keyof T], Final>;\n\t}\n}\n\nexport const any = < Input = any, Final = any>(message?: string) => new AnySchema<Input, Final>(message);\n","import { type ValidationContext } from '../rules/BaseRule';\nimport { getMethodContext } from '../rules/Rule';\nimport { type ObjectPropertiesSchema } from '../types/SchemaMap';\nimport { type CompileSchemaConfig, type PrivateSchema } from '../types/SchemaTypes';\n\nimport { type Definitions } from './Definitions';\nimport { Schema } from './schema';\n\nexport abstract class ArrayTypedSchema<\n\tInput extends any[] = any[],\n\tFinal = any,\n\tS extends ObjectPropertiesSchema<Input[number], Final> = ObjectPropertiesSchema<Input[number], Final>\n> extends Schema<Input, Final> {\n\tprotected schema: PrivateSchema;\n\n\tconstructor(schema: S, message?: string, def?: Definitions) {\n\t\tsuper(message, def);\n\t\tthis.schema = schema as unknown as PrivateSchema;\n\t}\n\n\tprotected whenClone(): any {\n\t\tconst clone = super.whenClone();\n\t\t\n\t\tclone.schema = this.schema.clone();\n\n\t\treturn clone;\n\t};\n\n\tprotected override compileSchema({ context }: CompileSchemaConfig) {\n\t\tconst fns = this.schema.compileSchema({\n\t\t\tcontext \n\t\t});\n\n\t\treturn super.compileSchema({\n\t\t\tcontext, \n\t\t\tsrcCode: (value: any, validationContext: ValidationContext<Final>) => {\n\t\t\t\tconst len = value.length;\n\t\t\t\tconst basePath = validationContext.path + '[';\n\t\t\t\tfor (let x = 0; x < len; x++) {\n\t\t\t\t\tfns(\n\t\t\t\t\t\tvalue[x], \n\t\t\t\t\t\tgetMethodContext(\n\t\t\t\t\t\t\tbasePath + x + ']',\n\t\t\t\t\t\t\tvalidationContext,\n\t\t\t\t\t\t\tvalue \n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} \n\t\t});\n\t}\n}\n","import { ArrayTypedSchema } from '../core/ArrayTypedSchema';\nimport { type ObjectPropertiesSchema } from '../types/SchemaMap';\n\nexport class ArraySchema<\n\tInput extends any[] = any[], \n\tFinal = any,\n\tS extends ObjectPropertiesSchema<Input[number], Final> = ObjectPropertiesSchema<Input[number], Final>\n> extends ArrayTypedSchema<Input, Final, S> {\n\tprotected message: string = 'Is not array';\n\tprotected rule = (value: any[]) => Array.isArray(value);\n\n\tprotected override clone() {\n\t\treturn new ArraySchema<Input, Final, S>(this.schema as unknown as S, this.message, this.def);\n\t}\n\n\t/**\n\t * Checks if is empty\n\t * @param message @option Overrides default message\n\t */\n\tpublic empty(message?: string) {\n\t\treturn this.test({\n\t\t\tis: (value: any) => value.length !== 0,\n\t\t\tmessage: message ?? ((messages) => messages.array.empty),\n\t\t\tname: `emptyArray_${message}`\n\t\t});\n\t}\n\n\t/**\n\t * Checks if has a minimal number of items in array\n\t * @param minValue\n\t * @param message @option Overrides default message\n\t */\n\tpublic min(minValue: number, message?: string) {\n\t\treturn this.test({\n\t\t\tis: (value: any) => minValue > value.length,\n\t\t\tmessage: message ?? ((messages) => messages.array.min(minValue)),\n\t\t\tname: `minArray_${minValue}_${message}`\n\t\t});\n\t}\n\n\t/**\n\t * Checks if has a maximal number of elements\n\t * @param maxValue \n\t * @param message @option Overrides default message\n\t */\n\tpublic max(maxValue: number, message?: string) {\n\t\treturn this.test({\n\t\t\tis: (value: any) => value.length > maxValue,\n\t\t\tmessage: message ?? ((messages) => messages.array.max(maxValue)),\n\t\t\tname: `maxArray_${maxValue}_${message}`\n\t\t});\n\t}\n\t\n\t/**\n\t * Checks if array has \"length\" number of elements\n\t * @param length\n\t * @param message @option Overrides default message\n\t */\n\tpublic length(length: number, message?: string) {\n\t\treturn this.test({\n\t\t\tis: (value: any) => value.length !== length,\n\t\t\tmessage: message ?? ((messages) => messages.array.length(length)),\n\t\t\tname: `lengthArray_${length}_${message}`\n\t\t});\n\t}\n\n\t/**\n\t * Checks if has only unique elements\n\t * \n\t * Note: This only check basic values, like numbers, string, boolean.\n\t * For object arrays and more complex values use {@link ArraySchema#uniqueBy}\n\t * @param message @option Overrides default message\n\t */\n\tpublic unique(message?: string) {\n\t\treturn this.test({\n\t\t\tis: (value: any) => value.length !== (new Set(value)).size,\n\t\t\tmessage: message ?? ((messages) => messages.array.unique),\n\t\t\tname: `uniqueArray_${message}`\n\t\t});\n\t}\n\n\t/**\n\t * Checks if has only unique elements by key\n\t * @param message @option Overrides default message\n\t */\n\tpublic uniqueBy(key: keyof Input[number] | ((val: Input[number]) => any), message?: string) {\n\t\tconst mapCb: (val: Input[number]) => any = (\n\t\t\ttypeof key === 'string' ? (val: any) => val[key] : key as (val: Input[number]) => any\n\t\t);\n\n\t\treturn this.test({\n\t\t\tis: (value: any) => value.length !== (new Set(value.map(mapCb))).size,\n\t\t\tmessage: message ?? ((messages) => messages.array.uniqueBy),\n\t\t\tname: typeof key !== 'function' ? `uniqueByArray_${key.toString()}_${message}` : undefined\n\t\t});\n\t}\n}\n\nexport const array = <\n\tInput extends any[] = any[],\n\tFinal = any,\n\tS extends ObjectPropertiesSchema<\n\t\tInput[number], \n\t\tFinal\n\t> = ObjectPropertiesSchema<\n\t\tInput[number], \n\t\tFinal\n\t>\n>(\n\tschemas: S,\n\tmessage?: string\n): ArraySchema<Array<S['input']>, Final, S> => new ArraySchema(schemas, message);\n","import { Schema } from '../core/schema';\nimport { type NullableType } from '../types/types';\n\nexport class BooleanSchema<\n\tInput extends NullableType<boolean> = boolean,\n\tFinal = Input\n> extends Schema<Input, Final> {\n\tprotected message: string = 'Is not boolean';\n\tprotected rule = (value: Input) => typeof value === 'boolean';\n\n\t/**\n\t * Checks if is true or false\n\t * @param mustBeValue\n\t * @param message @option Overrides default message\n\t */\n\tpublic mustBe(mustBeValue: boolean, message?: string) {\n\t\tconst _mustBeValue = mustBeValue.toString();\n\t\treturn this.test({\n\t\t\tis: (value: any) => _mustBeValue !== value.toString(),\n\t\t\tmessage: message ?? ((messages) => messages.array.empty),\n\t\t\tname: `mustBe_${mustBeValue}_${message}`\n\t\t});\n\t}\n}\n\nexport const boolean = <\n\tInput extends boolean = boolean,\n\tFinal = any\n>(message?: string) => new BooleanSchema<Input, Final>(message);\n","export function createDate({\n\tyear = 0, month = 1, day = 1,\n\thour = 0, minute = 0, second = 0, millisecond = 0\n}: {\n\tday?: number\n\thour?: number\n\tmillisecond?: number\n\tminute?: number\n\tmonth?: number\n\tsecond?: number\n\tyear?: number\n}) {\n\treturn new Date(\n\t\tyear,\n\t\tmonth,\n\t\tday,\n\t\thour,\n\t\tminute,\n\t\tsecond,\n\t\tmillisecond\n\t);\n}\n","import { Schema } from '../core/schema';\nimport { type ValidationContext } from '../rules/BaseRule';\nimport { type DateFormat } from '../types/DateFormat';\nimport { type NullableType } from '../types/types';\nimport { createDate } from '../utils/DateUtils';\n\nconst isToday = (someDate: Date): boolean => {\n\tconst today = new Date();\n\treturn (\n\t\tsomeDate.getDate() === today.getDate()\n\t\t&& someDate.getMonth() === today.getMonth()\n\t\t&& someDate.getFullYear() === today.getFullYear()\n\t);\n};\n\nfunction isDate(input: any) {    \n\tif (input instanceof Date && !isNaN(input.valueOf())) {\n\t\treturn true;\n\t}\n\tif (typeof input === 'string') {\n\t\tconst date = new Date(input);\n\t\treturn !isNaN(date.valueOf());\n\t}\n\treturn false;\n}\n\nexport type MinDateMethod<Form> = (\n\tparent: any,\n\tconfig: ValidationContext<Form>\n) => Date | undefined;\n\nexport class DateSchema<\n\tInput extends NullableType<Date | string> = Date | string,\n\tFinal = any\n> extends Schema<Input, Final> {\n\tprotected message: string = 'Is not date';\n\tprotected rule = isDate;\n\n\t/**\n\t * Checks if is today\n\t * @param message @option Overrides default message\n\t */\n\tpublic today(message?: string) {\n\t\treturn this.test({\n\t\t\tis: (value: Date | string) => !isToday(typeof value === 'string' ? new Date(value) : value),\n\t\t\tmessage: message ?? ((messages) => messages.date.today),\n\t\t\tname: `today_${message}`\n\t\t});\n\t}\n\n\tprivate getComparisonFunction<Form = this['final']>(\n\t\tdate: Date | MinDateMethod<Form> | string,\n\t\tformat: DateFormat,\n\t\tcompareFn: (x: number, y: number) => boolean\n\t) {\n\t\tlet extractTime: (date: Date) => number;\n\n\t\tswitch (format) {\n\t\t\tcase 'year':\n\t\t\t\textractTime = (date: Date) => date.getFullYear();\n\t\t\t\tbreak;\n\t\t\tcase 'month':\n\t\t\t\textractTime = (date: Date) => createDate({\n\t\t\t\t\tyear: date.getFullYear(),\n\t\t\t\t\tmonth: date.getMonth()\n\t\t\t\t}).getTime();\n\t\t\t\tbreak;\n\t\t\tcase 'date':\n\t\t\t\textractTime = (date: Date) => createDate({\n\t\t\t\t\tyear: date.getFullYear(),\n\t\t\t\t\tmonth: date.getMonth(),\n\t\t\t\t\tday: date.getDate()\n\t\t\t\t}).getTime();\n\t\t\t\tbreak;\n\t\t\tcase 'hour':\n\t\t\t\textractTime = (date: Date) => createDate({\n\t\t\t\t\tyear: date.getFullYear(),\n\t\t\t\t\tmonth: date.getMonth(),\n\t\t\t\t\tday: date.getDate(),\n\t\t\t\t\thour: date.getHours()\n\t\t\t\t}).getTime();\n\t\t\t\tbreak;\n\t\t\tcase 'minute':\n\t\t\t\textractTime = (date: Date) => createDate({\n\t\t\t\t\tyear: date.getFullYear(),\n\t\t\t\t\tmonth: date.getMonth(),\n\t\t\t\t\tday: date.getDate(),\n\t\t\t\t\thour: date.getHours(),\n\t\t\t\t\tminute: date.getMinutes()\n\t\t\t\t}).getTime();\n\t\t\t\tbreak;\n\t\t\tcase 'second':\n\t\t\t\textractTime = (date: Date) => createDate({\n\t\t\t\t\tyear: date.getFullYear(),\n\t\t\t\t\tmonth: date.getMonth(),\n\t\t\t\t\tday: date.getDate(),\n\t\t\t\t\thour: date.getHours(),\n\t\t\t\t\tminute: date.getMinutes(),\n\t\t\t\t\tsecond: date.getSeconds()\n\t\t\t\t}).getTime();\n\t\t\t\tbreak;\n\t\t\tcase 'time':\n\t\t\t\textractTime = (date: Date) => createDate({\n\t\t\t\t\thour: date.getHours(),\n\t\t\t\t\tminute: date.getMinutes(),\n\t\t\t\t\tsecond: date.getSeconds(),\n\t\t\t\t\tmillisecond: date.getSeconds()\n\t\t\t\t}).getTime();\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\textractTime = (date: Date) => date.getTime();\n\t\t\t\tbreak;\n\t\t}\n\n\t\tconst getDate = (\n\t\t\ttypeof date === 'function'\n\t\t\t\t? (\n\t\t\t\t\tdate: MinDateMethod<Form>,\n\t\t\t\t\tparent: any,\n\t\t\t\t\tconfig: ValidationContext<Form>\n\t\t\t\t) => {\n\t\t\t\t\tconst _date = date(parent, config);\n\n\t\t\t\t\treturn _date ? extractTime(_date) : undefined;\n\t\t\t\t}\n\t\t\t\t: extractTime\n\t\t) as (\n\t\t\tdate: Date | MinDateMethod<Form>,\n\t\t\tparent: any,\n\t\t\tconfig: ValidationContext<Form>\n\t\t) => number;\n\n\t\tconst _cb = typeof date === 'function'\n\t\t\t? (x: number | undefined, y: number) => {\n\t\t\t\tif (x === undefined) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\treturn compareFn(x, y);\n\t\t\t}\n\t\t\t: compareFn;\n\n\t\treturn (value: Date | string, parent: any, config: ValidationContext<Form>) => {\n\t\t\treturn _cb(\n\t\t\t\tgetDate(typeof date === 'string' ? new Date(date) : date, parent, config), \n\t\t\t\textractTime(typeof value === 'string' ? new Date(value) : value)\n\t\t\t);\n\t\t};\n\t}\n\n\t/**\n\t * Checks if is date is bigger than minDate\n\t * @param minDate\n\t * @param format @option @default 'date' compares date using format (ex: format = 'date' it will only compare year, month and date\n\t * @param message @option Overrides default message\n\t * * Note: If format = 'time' it will only compare hour, minutes, seconds and milliseconds, while format = 'dateTime' it will compare everything\n\t */\n\tpublic minDate<Form = this['final']>(\n\t\tminDate: Date | MinDateMethod<Form> | string,\n\t\tformat: DateFormat = 'date',\n\t\tmessage?: string\n\t) {\n\t\tconst minDateValue = typeof minDate === 'string' ? new Date(minDate) : minDate;\n\t\treturn this.test({\n\t\t\tis: this.getComparisonFunction(\n\t\t\t\tminDateValue,\n\t\t\t\tformat,\n\t\t\t\t(x, y) => x >= y\n\t\t\t),\n\t\t\tmessage: message ?? ((messages) => messages.date.minDate(\n\t\t\t\tminDateValue,\n\t\t\t\tformat\n\t\t\t)),\n\t\t\tname: minDateValue instanceof Date ? `minDate_${minDateValue.toISOString()}_${format}_${message}` : undefined\n\t\t});\n\t}\n\n\t/**\n\t * Checks if is date is smaller than maxDate\n\t * @param maxDate\n\t * @param format @option @default 'date' compares date using format (ex: format = 'date' it will only compare year, month and date\n\t * @param message @option Overrides default message\n\t * * Note: If format = 'time' it will only compare hour, minutes, seconds and milliseconds, while format = 'dateTime' it will compare everything\n\t */\n\tpublic maxDate<Form = this['final']>(\n\t\tmaxDate: Date | MinDateMethod<Form> | string,\n\t\tformat: DateFormat = 'date',\n\t\tmessage?: string\n\t) {\n\t\tconst maxDateValue = typeof maxDate === 'string' ? new Date(maxDate) : maxDate;\n\n\t\treturn this.test({\n\t\t\tis: this.getComparisonFunction(\n\t\t\t\tmaxDateValue,\n\t\t\t\tformat,\n\t\t\t\t(x, y) => x <= y\n\t\t\t),\n\t\t\tmessage: message ?? ((messages) => messages.date.maxDate(\n\t\t\t\tmaxDateValue,\n\t\t\t\tformat\n\t\t\t)),\n\t\t\tname: maxDateValue instanceof Date ? `maxDate_${maxDateValue.toISOString()}_${format}_${message}` : undefined\n\t\t});\n\t}\n\n\t/**\n\t * Checks if is date is equal than maxDate\n\t * @param date\n\t * @param format @option @default 'date' compares date using format (ex: format = 'date' it will only compare year, month and date\n\t * @param message @option Overrides default message\n\t * * Note: If format = 'time' it will only compare hour, minutes, seconds and milliseconds, while format = 'dateTime' it will compare everything\n\t */\n\tpublic equals<Form = this['final']>(\n\t\tdate: Date | string | MinDateMethod<Form>,\n\t\tformat: DateFormat = 'date',\n\t\tmessage?: string\n\t) {\n\t\tconst equalsDateValue = typeof date === 'string' ? new Date(date) : date;\n\n\t\treturn this.test({\n\t\t\tis: this.getComparisonFunction(\n\t\t\t\tequalsDateValue,\n\t\t\t\tformat,\n\t\t\t\t(x, y) => x === y\n\t\t\t),\n\t\t\tmessage: message ?? ((messages) => messages.date.equals(\n\t\t\t\tequalsDateValue,\n\t\t\t\tformat\n\t\t\t)),\n\t\t\tname: equalsDateValue instanceof Date ? `equals_${equalsDateValue.toISOString()}_${format}_${message}` : undefined\n\t\t});\n\t}\n}\n\nexport const date = <Input extends Date = Date, Final = any>(message?: string) => new DateSchema<Input, Final>(message);\n","import { Schema } from '../core/schema';\nimport { type NullableType } from '../types/types';\n\nexport class NumberSchema<\n\tInput extends NullableType<number> = number,\n\tFinal = any\n> extends Schema<Input, Final> {\n\tprotected message: string = 'Is not number';\n\tprotected rule = (value: number) => typeof value === 'number';\n\n\t/**\n\t * Checks if is bigger than minValue.\n\t * @param minValue min number value\n\t * @param message @option Overrides default message\n\t */\n\tpublic min(minValue: number, message?: string) {\n\t\treturn this.test({\n\t\t\tis: (value: number) => value < minValue,\n\t\t\tmessage: message ?? ((messages) => messages.number.min(minValue)),\n\t\t\tname: `minNumber_${minValue}_${message}`\n\t\t});\n\t}\n\n\t/**\n\t * Checks if is smaller than maxValue.\n\t * @param maxValue max number value\n\t * @param message @option Overrides default message\n\t */\n\tpublic max(maxValue: number, message?: string) {\n\t\treturn this.test({\n\t\t\tis: (value) => value > maxValue,\n\t\t\tmessage: message ?? ((messages) => messages.number.max(maxValue)),\n\t\t\tname: `maxNumber_${maxValue}_${message}`\n\t\t});\n\t}\n\n\t/**\n\t * Checks if is between minValue and maxValue.\n\t * @param minValue min number value\n\t * @param maxValue max number value\n\t * @param message @option Overrides default message\n\t */\n\tpublic between(minValue: number, maxValue: number, message?: string) {\n\t\treturn this.test({\n\t\t\tis: (value) => value < minValue || value > maxValue,\n\t\t\tmessage: message ?? ((messages) => messages.number.between(minValue, maxValue)),\n\t\t\tname: `betweenNumber_${minValue}_${maxValue}_${message}`\n\t\t});\n\t}\n\n\t/**\n\t * Checks if is equal to value.\n\t * @param value to equal\n\t * @param message @option Overrides default message\n\t */\n\tpublic equals(value: number | number[], message?: string) {\n\t\tconst is = Array.isArray(value)\n\t\t\t? (val: number) => !value.includes(val)\n\t\t\t: (val: number) => val !== value;\n\t\t\n\t\treturn this.test({\n\t\t\tis,\n\t\t\tmessage: message ?? ((messages) => messages.number.equals(value)),\n\t\t\tname: `equalsNumber_${Array.isArray(value) ? value.join('_') : value}_${message}`\n\t\t});\n\t}\n\n\t/**\n\t * Checks if is integer.\n\t * @param message @option Overrides default message\n\t */\n\tpublic integer(message?: string) {\n\t\treturn this.test({\n\t\t\tis: (val) => val % 1 !== 0,\n\t\t\tmessage: message ?? ((messages) => messages.number.integer),\n\t\t\tname: `integer_${message}`\n\t\t});\n\t}\n\n\t/**\n\t * Checks if is decimal.\n\t * @param message @option Overrides default message\n\t */\n\tpublic decimal(decimal: number, message?: string) {\n\t\treturn this.test({\n\t\t\tis: (val) => val.toFixed(decimal) !== val.toString(),\n\t\t\tmessage: message ?? ((messages) => messages.number.decimal(decimal)),\n\t\t\tname: `decimal_${decimal}_${message}`\n\t\t});\n\t}\n\n\t/**\n\t * Checks if is positive value.\n\t * @param message @option Overrides default message\n\t */\n\tpublic positive(message?: string) {\n\t\treturn this.test({\n\t\t\tis: (val) => val < 0,\n\t\t\tmessage: message ?? ((messages) => messages.number.positive),\n\t\t\tname: `positive_${message}`\n\t\t});\n\t}\n\n\t/**\n\t * Checks if is negative value.\n\t * @param message @option Overrides default message\n\t */\n\tpublic negative(message?: string) {\n\t\treturn this.test({\n\t\t\tis: (val) => val >= 0,\n\t\t\tmessage: message ?? ((messages) => messages.number.negative),\n\t\t\tname: `negative_${message}`\n\t\t});\n\t}\n\n\t/**\n\t * Checks if is a value of enum.\n\t * @param enumObject enum\n\t * @param message @option Overrides default message\n\t */\n\t// eslint-disable-next-line @typescript-eslint/consistent-indexed-object-style\n\tpublic enum<T extends { [name: string]: any }>(enumObject: T, message?: string) {\n\t\tconst enumValues = Object.values(enumObject);\n\n\t\treturn this.test({\n\t\t\tis: (value: any) => !enumValues.includes(value),\n\t\t\tmessage: message ?? ((messages) => messages.number.enum)\n\t\t\t// name: 'enumNumber'\n\t\t}) as unknown as NumberSchema<T[keyof T], Final>;\n\t}\n}\n\nexport const number = <\n\tInput extends number = number,\n\tFinal = any\n>(message?: string) => new NumberSchema<Input, Final>(message);\n","/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */\n/* eslint-disable @typescript-eslint/no-non-null-assertion */\nimport { type ValidationContext } from '../rules/BaseRule';\nimport { getMethodContext } from '../rules/Rule';\nimport { type OneOfConfigMessage } from '../types/OneOfTypes';\nimport { type SchemaMap } from '../types/SchemaMap';\nimport { type CompileSchemaConfig, type PrivateSchema } from '../types/SchemaTypes';\nimport { type SchemaError } from '../types/types';\n\nimport { type Definitions } from './Definitions';\nimport { Schema } from './schema';\n\nexport abstract class ObjectTypedSchema<\n\tInput = any,\n\tFinal = any\n> extends Schema<Input, Final> {\n\tprotected schema: SchemaMap<Input>;\n\tprotected shape: Map<string, PrivateSchema>;\n\n\tprotected oneOfRules = new Map<string, PrivateSchema>();\n\tprotected oneOfConfigMessage: OneOfConfigMessage | undefined;\n\n\tprotected whenClone(): any {\n\t\tconst clone = super.whenClone();\n\t\t\n\t\tclone.schema = {};\n\t\tclone.shape = new Map();\n\t\tclone.oneOfRules = new Map();\n\t\tclone.oneOfConfigMessage = undefined;\n\n\t\treturn clone;\n\t};\n\n\tconstructor(schema: SchemaMap<Input>, message?: string, def?: Definitions) {\n\t\tsuper(message, def);\n\n\t\tthis.schema = {\n\t\t\t...schema \n\t\t};\n\t\tthis.shape = new Map(Object.entries(schema));\n\t}\n\n\tprotected compileOneOfRules({ context, isFirstSchema }: CompileSchemaConfig): Function {\n\t\tconst schemas: Function[] = [];\n\t\tthis.oneOfRules.forEach((schema, childKey ) => {\n\t\t\tconst fn = schema.compileSchema({\n\t\t\t\tcontext \n\t\t\t});\n\n\t\t\tif ( isFirstSchema ) {\n\t\t\t\tschemas.push(\n\t\t\t\t\t(value: any, validationContext: ValidationContext<Final>) => {\n\t\t\t\t\t\tfn(value[childKey], getMethodContext(childKey, validationContext));\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tschemas.push(\n\t\t\t\t\t(value: any, validationContext: ValidationContext<Final>) => {\n\t\t\t\t\t\tfn(value[childKey], getMethodContext(validationContext.path + '.' + childKey, validationContext, value));\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\n\t\tconst l = schemas.length;\n\t\tfunction oneOf(value: any, validationContext: ValidationContext<Final>) {\n\t\t\tlet errors: SchemaError[] = [];\n\t\t\tconst _errors: SchemaError[] = [];\n\n\t\t\tfor (let i = 0; i < l; i++) {\n\t\t\t\tschemas[i](value, {\n\t\t\t\t\tform: validationContext.form,\n\t\t\t\t\tcontext: {\n\t\t\t\t\t\terrors,\n\t\t\t\t\t\tonlyOnTouch: validationContext.context.onlyOnTouch,\n\t\t\t\t\t\tonlyOnTouchErrors: validationContext.context.onlyOnTouchErrors,\n\t\t\t\t\t\tpromises: validationContext.context.promises\n\t\t\t\t\t},\n\t\t\t\t\tpath: validationContext.path,\n\t\t\t\t\tparent: validationContext.parent\n\t\t\t\t});\n\t\t\t\tif ( errors.length === 0 ) {\n\t\t\t\t\treturn [];\n\t\t\t\t}\n\t\t\t\t_errors.push(...errors);\n\t\t\t\terrors = [];\n\t\t\t}\n\n\t\t\treturn _errors;\n\t\t}\n\n\t\tif ( !this.oneOfConfigMessage ) {\n\t\t\treturn (value: any, validationContext: ValidationContext<Final>) => {\n\t\t\t\tconst errors = oneOf(value, validationContext);\n\t\t\t\tconst length = errors.length;\n\t\t\t\tfor (let i = 0; i < length; i++) {\n\t\t\t\t\tvalidationContext.context.errors.push(errors[i]); \n\t\t\t\t}\n\t\t\t};\n\t\t}\n\n\t\tif ( typeof this.oneOfConfigMessage === 'string' ) {\n\t\t\treturn (value: any, validationContext: ValidationContext<Final>) => {\n\t\t\t\tconst errors = oneOf(value, validationContext);\n\t\t\t\tconst length = errors.length;\n\t\t\t\tfor (let i = 0; i < length; i++) {\n\t\t\t\t\tconst error = errors[i];\n\t\t\t\t\terror.error = this.oneOfConfigMessage as string; \n\t\t\t\t\tvalidationContext.context.errors.push(error);\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\n\t\tif ( Array.isArray(this.oneOfConfigMessage) ) {\n\t\t\tconst errors = this.oneOfConfigMessage as SchemaError[];\n\t\t\tconst l = errors.length;\n\t\t\treturn (value: any, validationContext: ValidationContext<Final>) => {\n\t\t\t\tif ( oneOf(value, validationContext).length ) {\n\t\t\t\t\tfor (let i = 0; i < l; i++) {\n\t\t\t\t\t\tvalidationContext.context.errors.push(errors[i]); \n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\n\t\treturn (value: any, validationContext: ValidationContext<Final>) => {\n\t\t\tif ( oneOf(value, validationContext).length ) {\n\t\t\t\tvalidationContext.context.errors.push(this.oneOfConfigMessage as SchemaError);\n\t\t\t}\n\t\t};\n\t}\n\n\tprotected override compileSchema({\n\t\tcontext, \n\t\tsrcCode,\n\t\tisFirstSchema\n\t}: CompileSchemaConfig) {\n\t\tconst schemaRules: Function[] = srcCode ? [srcCode] : [];\n\t\t\n\t\tif ( this.shape.size ) {\n\t\t\tthis.shape.forEach((schema, childKey) => {\n\t\t\t\tconst fn = schema.compileSchema({\n\t\t\t\t\tcontext \n\t\t\t\t});\n\t\t\t\tif ( isFirstSchema ) {\n\t\t\t\t\tschemaRules.push(\n\t\t\t\t\t\t(value: any, validationContext: ValidationContext<Final>) => {\n\t\t\t\t\t\t\tfn(value[childKey], getMethodContext(childKey, validationContext));\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tschemaRules.push(\n\t\t\t\t\t\t(value: any, validationContext: ValidationContext<Final>) => {\n\t\t\t\t\t\t\tfn(value[childKey], getMethodContext(validationContext.path + '.' + childKey, validationContext, value));\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tif ( this.oneOfRules.size ) {\n\t\t\tschemaRules.push(\n\t\t\t\tthis.compileOneOfRules({\n\t\t\t\t\tcontext,\n\t\t\t\t\tisFirstSchema\n\t\t\t\t})\n\t\t\t);\n\t\t}\n\t\t\n\t\tconst l = schemaRules.length;\n\t\treturn super.compileSchema({\n\t\t\tcontext, \n\t\t\tsrcCode: (value: any, validationContext: ValidationContext<Final>) => {\n\t\t\t\tfor (let x = 0; x < l; x++) {\n\t\t\t\t\tschemaRules[x](value, validationContext);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n}\n","import { ObjectTypedSchema } from '../core/ObjectTypedSchema';\nimport { type OneOf, type OneOfConfigMessage } from '../types/OneOfTypes';\nimport { type SchemaMap } from '../types/SchemaMap';\nimport { type NullableType } from '../types/types';\n\nexport class ObjectSchema<\n\tInput extends NullableType<object> = object,\n\tFinal = any\n> extends ObjectTypedSchema<Input, Final> {\n\tprotected message: string = 'Is not object';\n\tprotected rule = (value: any) => typeof value === 'object';\n\n\tprotected override clone() {\n\t\tconst schema = new ObjectSchema<Input, Final>(\n\t\t\tthis.schema, \n\t\t\tthis.message, \n\t\t\tthis.def\n\t\t);\n\n\t\tschema.oneOfRules = new Map(this.oneOfRules.entries());\n\n\t\treturn schema;\n\t}\n\n\t// protected getRequiredStringCondition = (value: any) => value == null && typeof value === 'object';\n\n\t/**\n\t * Extends current schema object\n\t */\n\tpublic extend<\n\t\tTInput extends Input = Input,\n\t\tTFinal extends Final = Final\n\t>(schemas: SchemaMap<TInput, false, TFinal>): ObjectSchema<TInput, TFinal> {\n\t\tconst _this = this.clone();\n\t\t\n\t\tObject.entries(schemas)\n\t\t.forEach(([key, schema]) => {\n\t\t\t// @ts-expect-error // this will never be undefined but typescript can't comprehend that\n\t\t\tconst _schema = schema.clone();\n\t\t\t\n\t\t\t_this.shape.set(key, _schema);\n\n\t\t\t// @ts-expect-error // this will never be undefined but typescript can't comprehend that\n\t\t\t_this.schema[key] = _schema;\n\t\t});\n\n\t\treturn _this as unknown as ObjectSchema<TInput, TFinal>;\n\t}\n\n\t/**\n\t * OneOf makes the validation only false when all schema keys are false (have errors in them)\n\t * This is exclusive to oneOf schema, all other validation still will take place,\n\t */\n\tpublic oneOf(\n\t\toneOfKey: OneOf<Input>,\n\t\toneOfConfig?: OneOfConfigMessage\n\t): this;\n\tpublic oneOf<Key extends keyof Input>(\n\t\toneOfKey: Key[],\n\t\tschema: SchemaMap<Input>[Key],\n\t\toneOfConfig?: OneOfConfigMessage\n\t): this;\n\tpublic oneOf<Key extends keyof Input>(\n\t\toneOfKey: OneOf<Input> | Key[],\n\t\tschema?: SchemaMap<Input>[Key] | OneOfConfigMessage,\n\t\toneOfConfigMessage?: OneOfConfigMessage\n\t): this {\n\t\tconst _this = this.clone();\n\n\t\t_this.oneOfConfigMessage = Array.isArray(oneOfKey) ? oneOfConfigMessage : (schema as OneOfConfigMessage);\n\n\t\t((\n\t\t\tArray.isArray(oneOfKey) \n\t\t\t\t? oneOfKey.map((key) => [key, schema])\n\t\t\t\t: Object.entries(oneOfKey)\n\t\t) as Array<[string, SchemaMap<Input, true>[any]]>)\n\t\t.forEach(([key, schema]) => {\n\t\t\t// @ts-expect-error To be only accessible for the developer\n\t\t\t_this.oneOfRules.set(key, schema.clone());\n\t\t});\n\n\t\treturn _this as this;\n\t}\n}\nexport const object = <\n\tInput extends object = object\n>(\n\tschemas: SchemaMap<Input> = {},\n\tmessage?: string\n) => new ObjectSchema<Input>(schemas, message);\n","/* eslint-disable no-useless-escape */\nimport { Schema } from '../core/schema';\nimport type { PhoneNumberInfo } from '../phoneNumbers';\nimport type { PostalCodeInfo } from '../postalCodes';\nimport { type NullableType } from '../types/types';\nimport { defaultMessages } from '../utils/messages';\n\nconst NUMERIC_PATTERN = /^[-]?([1-9]\\d*|0)(\\.\\d+)?$/;\nconst ALPHA_PATTERN = /^[a-zA-Z]+$/;\nconst ALPHANUM_PATTERN = /^[a-zA-Z0-9]+$/;\nconst ALPHADASH_PATTERN = /^[a-zA-Z0-9_-]+$/;\nconst HEX_PATTERN = /^[0-9a-fA-F]+$/;\nconst URL_PATTERN = /^(http(s)?:\\/\\/.)?(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{2,256}\\.[a-z]{2,6}\\b([-a-zA-Z0-9@:%_\\+.~#?&//=]*)$/;\nconst BASE64_PATTERN = /^(?:[A-Za-z0-9+\\\\/]{4})*(?:[A-Za-z0-9+\\\\/]{2}==|[A-Za-z0-9+/]{3}=)?$/;\nconst PRECISE_PATTERN = /^(([^<>()[\\]\\.,;:\\s@\\\"]+(\\.[^<>()[\\]\\.,;:\\s@\\\"]+)*)|(\\\".+\\\"))@(([^<>()[\\]\\.,;:\\s@\\\"]+\\.)+[^<>()[\\]\\.,;:\\s@\\\"]{2,})$/i;\nconst CUID_PATTERN = /^c[^\\s-]{8,}$/i;\nconst UUID_PATTERN = /^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i;\nconst BASIC_PATTERN = /^\\S+@\\S+\\.\\S+$/;\n\nexport class StringSchema<\n\tInput extends NullableType<string> = string,\n\tFinal = any\n> extends Schema<Input, Final> {\n\tprotected message: string = 'Is not string';\n\tprotected rule = (value: string) => typeof value === 'string';\n\n\tprotected getRequiredStringCondition = (value: string) => value == null || value === '';\n\tprotected getNotRequiredStringCondition = (value: string) => value != null && value !== '';\n\n\t/**\n\t * Checks if has a size bigger than minValue\n\t * @param minValue min string length\n\t * @param message @option Overrides default message\n\t */\n\tpublic min(minValue: number, message?: string) {\n\t\treturn this.test({\n\t\t\tis: (value) => value.length < minValue,\n\t\t\tmessage: message ?? ((messages) => messages.string.min(minValue)),\n\t\t\tname: `minLength_${minValue}_${message}`\n\t\t});\n\t}\n\n\t/**\n\t * Checks if has a size smaller than maxValue\n\t * @param maxValue max string length\n\t * @param message @option Overrides default message\n\t */\n\tpublic max(maxValue: number, message?: string) {\n\t\treturn this.test({\n\t\t\tis: (value) => value.length > maxValue,\n\t\t\tmessage: message ?? ((messages) => messages.string.max(maxValue)),\n\t\t\tname: `maxLength_${maxValue}_${message}`\n\t\t});\n\t}\n\n\t/**\n\t * Checks if is between minValue and maxValue.\n\t * @param minValue min number value\n\t * @param maxValue max number value\n\t * @param message @option Overrides default message\n\t */\n\tpublic between(minValue: number, maxValue: number, message?: string) {\n\t\treturn this.test({\n\t\t\tis: (value) => value.length < minValue || value.length > maxValue,\n\t\t\tmessage: message ?? ((messages) => messages.number.between(minValue, maxValue)),\n\t\t\tname: `betweenString_${minValue}_${maxValue}_${message}`\n\t\t});\n\t}\n\n\t/**\n\t * Checks if string has `maxValue` length\n\t * @param length string length\n\t * @param message @option Overrides default message\n\t */\n\tpublic length(length: number, message?: string) {\n\t\treturn this.test({\n\t\t\tis: (value) => value.length !== length,\n\t\t\tmessage: message ?? ((messages) => messages.string.length(length)),\n\t\t\tname: `length_${length}_${message}`\n\t\t});\n\t}\n\n\t/**\n\t * Checks if is equal to value.\n\t * @param value to equal\n\t * @param message @option Overrides default message\n\t */\n\tpublic equals(value: string | string[], message?: string) {\n\t\tconst is = Array.isArray(value)\n\t\t\t? (val: string) => !value.includes(val)\n\t\t\t: (val: string) => val !== value;\n\t\t\n\t\treturn this.test({\n\t\t\tis: is as any,\n\t\t\tmessage: message ?? ((messages) => messages.string.equals(value)),\n\t\t\tname: `equalsString_${Array.isArray(value) ? value.join('_') : value}_${message}`\n\t\t});\n\t}\n\n\t/**\n\t * Matches regular expression\n\t * @param reg Regular expression\n\t * @param message @option Overrides default message\n\t */\n\tpublic pattern(reg: RegExp, message?: string) {\n\t\treturn this.test({\n\t\t\tis: (value) => !reg.test(value),\n\t\t\tmessage: message ?? ((messages) => messages.string.pattern(reg)),\n\t\t\tname: `pattern_${reg.source.replace(/(\\W|\\W|-)/g, '_')}`\n\t\t});\n\t}\n\n\t/**\n\t * Checks if string is empty\n\t * @param message @option Overrides default message\n\t */\n\tpublic empty(message?: string) {\n\t\treturn this.test({\n\t\t\tis: (value) => value.length !== 0,\n\t\t\tmessage: message ?? ((messages) => messages.string.empty),\n\t\t\tname: `empty_${message}`\n\t\t});\n\t}\n\n\t/**\n\t * Checks if string contains value\n\t * @param value value to check if contains\n\t * @param message @option Overrides default message\n\t */\n\tpublic contains(value: string, message?: string) {\n\t\treturn this.test({\n\t\t\tis: (val: any) => !val.includes(value),\n\t\t\tmessage: message ?? ((messages) => messages.string.contains(value)),\n\t\t\tname: `contains_${value}_${message}`\n\t\t});\n\t}\n\n\t/**\n\t * Checks if string contains only numeric characters\n\t * @param message @option Overrides default message\n\t */\n\tpublic numeric(message?: string) {\n\t\treturn this.test({\n\t\t\tis: (value) => value && !NUMERIC_PATTERN.test(value),\n\t\t\tmessage: message ?? ((messages) => messages.string.numeric),\n\t\t\tname: `numeric_${message}`\n\t\t});\n\t}\n\n\t/**\n\t * Checks if string contains only alpha characters\n\t * @param message @option Overrides default message\n\t */\n\tpublic alpha(message?: string) {\n\t\treturn this.test({\n\t\t\tis: (value) => !ALPHA_PATTERN.test(value),\n\t\t\tmessage: message ?? ((messages) => messages.string.alpha),\n\t\t\tname: `alpha_${message}`\n\t\t});\n\t}\n\n\t/**\n\t * Checks if string contains only alpha-numeric characters\n\t * @param message @option Overrides default message\n\t */\n\tpublic alphanum(message?: string) {\n\t\treturn this.test({\n\t\t\tis: (value) => !ALPHANUM_PATTERN.test(value),\n\t\t\tmessage: message ?? ((messages) => messages.string.alphanum),\n\t\t\tname: `alphanum_${message}`\n\t\t});\n\t}\n\n\t/**\n\t * Checks if string contains only contains alpha-numeric characters, as well as dashes and underscores.'\n\t * @param message @option Overrides default message\n\t */\n\tpublic alphadash(message?: string) {\n\t\treturn this.test({\n\t\t\tis: (value) => !ALPHADASH_PATTERN.test(value),\n\t\t\tmessage: message ?? ((messages) => messages.string.alphadash),\n\t\t\tname: `alphadash_${message}`\n\t\t});\n\t}\n\n\t/**\n\t * Checks if string is hexadecimal.\n\t * @param message @option Overrides default message\n\t */\n\tpublic hex(message?: string) {\n\t\treturn this.test({\n\t\t\tis: (value) => value.length % 2 !== 0 || !HEX_PATTERN.test(value),\n\t\t\tmessage: message ?? ((messages) => messages.string.hex),\n\t\t\tname: `hex_${message}`\n\t\t});\n\t}\n\n\t/**\n\t * Checks if string is base64.\n\t * @param message @option Overrides default message\n\t */\n\tpublic base64(message?: string) {\n\t\treturn this.test({\n\t\t\tis: (value) => !BASE64_PATTERN.test(value),\n\t\t\tmessage: message ?? ((messages) => messages.string.base64),\n\t\t\tname: `base64_${message}`\n\t\t});\n\t}\n\n\t/**\n\t * Checks if string is format uuid.\n\t * @param message @option Overrides default message\n\t */\n\tpublic uuid(message?: string) {\n\t\treturn this.test({\n\t\t\tis: (value) => !UUID_PATTERN.test(value),\n\t\t\tmessage: message ?? ((messages) => messages.string.uuid),\n\t\t\tname: `uuid_${message}`\n\t\t});\n\t}\n\n\t/**\n\t * Checks if string is URL accepted\n\t * @param message @option Overrides default message\n\t */\n\tpublic url(message?: string) {\n\t\treturn this.test({\n\t\t\tis: (value) => !URL_PATTERN.test(value),\n\t\t\tmessage: message ?? ((messages) => messages.string.url),\n\t\t\tname: `url_${message}`\n\t\t});\n\t}\n\n\t/**\n\t * Checks if string is format cuid.\n\t * @param message @option Overrides default message\n\t */\n\tpublic cuid(message?: string) {\n\t\treturn this.test({\n\t\t\tis: (value) => !CUID_PATTERN.test(value),\n\t\t\tmessage: message ?? ((messages) => messages.string.cuid),\n\t\t\tname: `cuid_${message}`\n\t\t});\n\t}\n\n\t/**\n\t * Checks if is a valid email.\n\t * @param mode @option Defines if is basic or precise validation\n\t * @param message @option Overrides default message\n\t */\n\tpublic email(mode?: 'basic' | 'precise', message?: string) {\n\t\tconst pattern = mode === 'precise' ? PRECISE_PATTERN : BASIC_PATTERN;\n\n\t\treturn this.test({\n\t\t\tis: (value) => !pattern.test(value),\n\t\t\tmessage: message ?? ((messages) => messages.string.email),\n\t\t\tname: `email_${mode}_${message}`\n\t\t});\n\t}\n\n\t/**\n\t * Checks if is a valid postalCode.\n\t * @param postalCode postal code to validate or a function which we can return desired postal code\n\t * @param message @option Overrides default message\n\t */\n\tpublic postalCode(\n\t\tpostalCode: PostalCodeInfo | ((value: NonNullable<Input>, form: any) => PostalCodeInfo), \n\t\tmessage?: string\n\t) {\n\t\tif ( typeof postalCode === 'function' ) {\n\t\t\treturn this.test((value, form) => {\n\t\t\t\tconst _postalCode = postalCode(value, form);\n\t\t\t\tif ( _postalCode.regex.test((value )) ) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\treturn [\n\t\t\t\t\t{\n\t\t\t\t\t\tpath: '',\n\t\t\t\t\t\terror: message ?? defaultMessages.string.postalCode(_postalCode)\n\t\t\t\t\t}\n\t\t\t\t];\n\t\t\t});\n\t\t}\n\n\t\treturn this.test({\n\t\t\tis: (value) => !postalCode.regex.test(value),\n\t\t\tmessage: message ?? ((messages) => messages.string.postalCode(postalCode)),\n\t\t\tname: `postalCode_${postalCode.country}_${message}`\n\t\t});\n\t}\n\n\t/**\n\t * Checks if is a valid phoneNumber.\n\t * @param phoneNumber phone number to validate or a function which we can return desired phone number\n\t * @param message @option Overrides default message\n\t */\n\tpublic phoneNumber(\n\t\tphoneNumber: PhoneNumberInfo | ((value: NonNullable<Input>, form: any) => PhoneNumberInfo), \n\t\tmessage?: string\n\t) {\n\t\tif ( typeof phoneNumber === 'function' ) {\n\t\t\treturn this.test((value, form) => {\n\t\t\t\tconst _phoneNumber = phoneNumber(value, form);\n\t\t\t\tif ( _phoneNumber.regex.test((value )) ) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\treturn [\n\t\t\t\t\t{\n\t\t\t\t\t\tpath: '',\n\t\t\t\t\t\terror: message ?? defaultMessages.string.phoneNumber(_phoneNumber)\n\t\t\t\t\t}\n\t\t\t\t];\n\t\t\t});\n\t\t}\n\n\t\treturn this.test({\n\t\t\tis: (value) => !phoneNumber.regex.test(value),\n\t\t\tmessage: message ?? ((messages) => messages.string.phoneNumber(phoneNumber)),\n\t\t\tname: `phoneNumber_${phoneNumber.country}_${message}`\n\t\t});\n\t}\n\n\t/**\n\t * Checks if is a value of enum.\n\t * @param enumObject enum\n\t * @param message @option Overrides default message\n\t */\n\t// eslint-disable-next-line @typescript-eslint/consistent-indexed-object-style\n\tpublic enum<T extends { [name: string]: any }>(enumObject: T, message?: string) {\n\t\tconst enumValues = Object.values(enumObject);\n\n\t\treturn this.test({\n\t\t\tis: (value) => !enumValues.includes(value),\n\t\t\tmessage: message ?? ((messages) => messages.string.enum)\n\t\t}) as unknown as StringSchema<T[keyof T], Final>;\n\t}\n}\n\nexport const string = <\n\tInput extends string = string,\n\tFinal = any\n>(message?: string) => new StringSchema<Input, Final>(message);\n","import {\n\tarray,\n\ttype ArraySchema,\n\tboolean,\n\ttype BooleanSchema,\n\tdate,\n\ttype DateSchema,\n\tnumber,\n\ttype NumberSchema,\n\tobject,\n\ttype ObjectSchema,\n\tstring,\n\ttype StringSchema\n} from '../schemas';\nimport { type SchemaMap } from '../types/SchemaMap';\nimport { type LiteralUnion, type ExcludeByValueType } from '../types/types';\n\nimport { type JsonSchemaToDataType } from './ConstructInitialDataJsonSchema';\nimport {\n\ttype JsonSchemaValidationType,\n\ttype JsonSchemaArrayValidationType,\n\ttype JsonSchemaBooleanValidationType,\n\ttype JsonSchemaDateValidationType,\n\ttype JsonSchemaNumberValidationType,\n\ttype JsonSchemaObjectValidationType,\n\ttype JsonSchemaStringValidationType\n} from './JsonSchemaValidationType';\n\nexport type JsonSchemaObjectType = {\n\tproperties: Record<string, JsonSchemaType>\n\ttype: 'object'\n\tvalidation?: JsonSchemaObjectValidationType\n};\nexport type JsonSchemaStringType = {\n\ttype: 'string'\n\tvalidation?: JsonSchemaStringValidationType\n};\nexport type JsonSchemaNumberType = {\n\ttype: 'number'\n\tvalidation?: JsonSchemaNumberValidationType\n};\nexport type JsonSchemaBooleanType = {\n\ttype: 'boolean'\n\tvalidation?: JsonSchemaBooleanValidationType\n};\nexport type JsonSchemaDateType = {\n\ttype: 'date'\n\tvalidation?: JsonSchemaDateValidationType\n};\nexport type JsonSchemaArrayType = {\n\tproperties: JsonSchemaType\n\ttype: 'array'\n\tvalidation?: JsonSchemaArrayValidationType\n};\n/* type JsonSchemaCustomType = {\n\tproperties: JsonSchemaType[] | Record<string, JsonSchemaType>\n\ttype: 'custom'\n\tvalidation?: JsonSchemaValidationType\n}; */\n\nexport type JsonSchemaType = JsonSchemaObjectType \n\t| JsonSchemaStringType \n\t| JsonSchemaNumberType \n\t| JsonSchemaBooleanType\n\t| JsonSchemaDateType\n\t| JsonSchemaArrayType;\n\t// | JsonSchemaCustomType;\n\nexport type JsonSchemaToSchemaDataType<T extends JsonSchemaType> = T extends JsonSchemaObjectType\n\t? ObjectSchema<JsonSchemaToDataType<T>>\n\t: T extends JsonSchemaStringType\n\t\t? StringSchema<JsonSchemaToDataType<T>>\n\t\t: T extends JsonSchemaNumberType\n\t\t\t? NumberSchema<JsonSchemaToDataType<T>>\n\t\t\t: T extends JsonSchemaBooleanType\n\t\t\t\t? BooleanSchema<JsonSchemaToDataType<T>>\n\t\t\t\t: T extends JsonSchemaDateType\n\t\t\t\t\t? DateSchema<JsonSchemaToDataType<T>>\n\t\t\t\t\t: T extends JsonSchemaArrayType\n\t\t\t\t\t\t? ArraySchema<JsonSchemaToDataType<T>>\n\t\t\t\t\t\t: any;\n\nexport type AnyJsonSchema = ObjectSchema | StringSchema<any, any> | NumberSchema<any, any> | BooleanSchema<any, any> | DateSchema<any, any> | ArraySchema<any, any>;\n\nfunction validation<T extends AnyJsonSchema>(\n\tschema: T, \n\tvalidation?: JsonSchemaValidationType\n): T {\n\tif ( !validation ) {\n\t\treturn schema;\n\t}\n\t\n\tObject.keys(validation)\n\t.forEach((key) => {\n\t\tconst schemaValidation = validation[key as keyof JsonSchemaValidationType];\n\n\t\tswitch ( key as LiteralUnion<keyof JsonSchemaValidationType, string> ) {\n\t\t\t// #region Date/Number/String\n\t\t\tcase 'equals':\n\t\t\t\tif ( (schemaValidation as unknown as NonNullable<JsonSchemaDateValidationType['equals']>).date ) {\n\t\t\t\t\tschema = (schema as DateSchema).equals(\n\t\t\t\t\t\t(schemaValidation as unknown as NonNullable<JsonSchemaDateValidationType['equals']>).date,\n\t\t\t\t\t\t(schemaValidation as unknown as NonNullable<JsonSchemaDateValidationType['equals']>).format,\n\t\t\t\t\t\t(schemaValidation as unknown as NonNullable<JsonSchemaDateValidationType['equals']>).message\n\t\t\t\t\t) as T;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tschema = (schema as NumberSchema | StringSchema).equals(\n\t\t\t\t\t(schemaValidation as unknown as NonNullable<JsonSchemaStringValidationType['equals']>).value as any,\n\t\t\t\t\t(schemaValidation as unknown as NonNullable<JsonSchemaStringValidationType['equals']>).message\n\t\t\t\t) as T;\n\t\t\t\treturn;\n\t\t\t// #endregion Boolean/Number/String\n\t\t\t// #region Number/String\n\t\t\tcase 'between':\n\t\t\t\tschema = (schema as NumberSchema).between(\n\t\t\t\t\t(schemaValidation as unknown as NonNullable<JsonSchemaStringValidationType['between']>).minValue, \n\t\t\t\t\t(schemaValidation as unknown as NonNullable<JsonSchemaStringValidationType['between']>).maxValue, \n\t\t\t\t\t(schemaValidation as unknown as NonNullable<JsonSchemaStringValidationType['between']>).message\n\t\t\t\t) as T;\n\t\t\t\treturn;\n\t\t\tcase 'enum':\n\t\t\t\tschema = (schema as NumberSchema).enum(\n\t\t\t\t\t(schemaValidation as unknown as NonNullable<JsonSchemaStringValidationType['enum']>).enumObject,\n\t\t\t\t\t(schemaValidation as unknown as NonNullable<JsonSchemaStringValidationType['enum']>).message\n\t\t\t\t) as T;\n\t\t\t\treturn;\n\t\t\tcase 'max':\n\t\t\t\tschema = (schema as NumberSchema).max(\n\t\t\t\t\t(schemaValidation as unknown as NonNullable<JsonSchemaStringValidationType['max']>).maxValue,\n\t\t\t\t\t(schemaValidation as unknown as NonNullable<JsonSchemaStringValidationType['max']>).message\n\t\t\t\t) as T;\n\t\t\t\treturn;\n\t\t\tcase 'min':\n\t\t\t\tschema = (schema as NumberSchema).min(\n\t\t\t\t\t(schemaValidation as unknown as NonNullable<JsonSchemaStringValidationType['min']>).minValue,\n\t\t\t\t\t(schemaValidation as unknown as NonNullable<JsonSchemaStringValidationType['min']>).message\n\t\t\t\t) as T;\n\t\t\t\treturn;\n\t\t\t// #endregion Number/String\n\t\t\t// #region String\n\t\t\tcase 'contains':\n\t\t\t\tschema = (schema as StringSchema).contains(\n\t\t\t\t\t(schemaValidation as unknown as NonNullable<JsonSchemaStringValidationType['contains']>).value, \n\t\t\t\t\t(schemaValidation as unknown as NonNullable<JsonSchemaStringValidationType['contains']>).message\n\t\t\t\t) as T;\n\t\t\t\treturn;\n\t\t\tcase 'email':\n\t\t\t\tif ( typeof (schemaValidation as unknown as NonNullable<JsonSchemaStringValidationType['email']>) === 'boolean' ) {\n\t\t\t\t\tschema = (schema as StringSchema).email() as T;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tschema = (schema as StringSchema).email(\n\t\t\t\t\t(schemaValidation as unknown as Exclude<NonNullable<JsonSchemaStringValidationType['email']>, boolean>).mode,\n\t\t\t\t\t(schemaValidation as unknown as Exclude<NonNullable<JsonSchemaStringValidationType['email']>, boolean>).message\n\t\t\t\t) as T;\n\t\t\t\treturn;\n\t\t\tcase 'length':\n\t\t\t\tschema = (schema as StringSchema).length(\n\t\t\t\t\t(schemaValidation as unknown as NonNullable<JsonSchemaStringValidationType['length']>).length,\n\t\t\t\t\t(schemaValidation as unknown as NonNullable<JsonSchemaStringValidationType['length']>).message\n\t\t\t\t) as T;\n\t\t\t\treturn;\n\t\t\tcase 'pattern':\n\t\t\t\tschema = (schema as StringSchema).pattern(\n\t\t\t\t\t(schemaValidation as unknown as NonNullable<JsonSchemaStringValidationType['pattern']>).reg,\n\t\t\t\t\t(schemaValidation as unknown as NonNullable<JsonSchemaStringValidationType['pattern']>).message\n\t\t\t\t) as T;\n\t\t\t\treturn;\n\t\t\tcase 'phoneNumber':\n\t\t\t\tschema = (schema as StringSchema).phoneNumber(\n\t\t\t\t\t(schemaValidation as unknown as NonNullable<JsonSchemaStringValidationType['phoneNumber']>).phoneNumber,\n\t\t\t\t\t(schemaValidation as unknown as NonNullable<JsonSchemaStringValidationType['phoneNumber']>).message\n\t\t\t\t) as T;\n\t\t\t\treturn;\n\t\t\tcase 'postalCode':\n\t\t\t\tschema = (schema as StringSchema).postalCode(\n\t\t\t\t\t(schemaValidation as unknown as NonNullable<JsonSchemaStringValidationType['postalCode']>).postalCode,\n\t\t\t\t\t(schemaValidation as unknown as NonNullable<JsonSchemaStringValidationType['postalCode']>).message\n\t\t\t\t) as T;\n\t\t\t\treturn;\n\t\t\t// #endregion String\n\t\t\t// #region Number\n\t\t\tcase 'decimal':\n\t\t\t\tschema = (schema as NumberSchema).decimal(\n\t\t\t\t\t(schemaValidation as unknown as NonNullable<JsonSchemaNumberValidationType['decimal']>).decimal,\n\t\t\t\t\t(schemaValidation as unknown as NonNullable<JsonSchemaNumberValidationType['decimal']>).message\n\t\t\t\t) as T;\n\t\t\t\treturn;\n\t\t\t// #endregion Number\n\t\t\t// #region Boolean\n\t\t\tcase 'mustBe':\n\t\t\t\tschema = (schema as BooleanSchema).mustBe(\n\t\t\t\t\t(schemaValidation as unknown as NonNullable<JsonSchemaBooleanValidationType['mustBe']>).mustBeValue,\n\t\t\t\t\t(schemaValidation as unknown as NonNullable<JsonSchemaBooleanValidationType['mustBe']>).message\n\t\t\t\t) as T;\n\t\t\t\treturn;\n\t\t\t// #endregion Boolean\n\t\t\t// #region Date\n\t\t\tcase 'maxDate':\n\t\t\t\tschema = (schema as DateSchema).maxDate(\n\t\t\t\t\t(schemaValidation as unknown as NonNullable<JsonSchemaDateValidationType['maxDate']>).maxDate,\n\t\t\t\t\t(schemaValidation as unknown as NonNullable<JsonSchemaDateValidationType['maxDate']>).format,\n\t\t\t\t\t(schemaValidation as unknown as NonNullable<JsonSchemaDateValidationType['maxDate']>).message\n\t\t\t\t) as T;\n\t\t\t\treturn;\n\t\t\tcase 'minDate':\n\t\t\t\tschema = (schema as DateSchema).minDate(\n\t\t\t\t\t(schemaValidation as unknown as NonNullable<JsonSchemaDateValidationType['minDate']>).minDate,\n\t\t\t\t\t(schemaValidation as unknown as NonNullable<JsonSchemaDateValidationType['minDate']>).format,\n\t\t\t\t\t(schemaValidation as unknown as NonNullable<JsonSchemaDateValidationType['minDate']>).message\n\t\t\t\t) as T;\n\t\t\t\treturn;\n\t\t\t// #endregion Date\n\t\t\t// #region Array\n\t\t\tcase 'uniqueBy':\n\t\t\t\tschema = (schema as ArraySchema).uniqueBy(\n\t\t\t\t\t(schemaValidation as unknown as NonNullable<JsonSchemaArrayValidationType['uniqueBy']>).key,\n\t\t\t\t\t(schemaValidation as unknown as NonNullable<JsonSchemaArrayValidationType['uniqueBy']>).message\n\t\t\t\t) as T;\n\t\t\t\treturn;\n\t\t\t// #endregion Array\n\t\t\t// #region object\n\t\t\tcase 'oneOf':\n\t\t\t\tconst properties = (schemaValidation as unknown as NonNullable<JsonSchemaObjectValidationType['oneOf']>).properties;\n\t\t\t\tschema = (schema as ObjectSchema).oneOf(\n\t\t\t\t\tObject.keys(properties)\n\t\t\t\t\t.reduce<SchemaMap<any>>((obj, key) => {\n\t\t\t\t\t\tobj[key] = ConstructJsonSchema(properties[key] as JsonSchemaType);\n\t\t\t\t\t\treturn obj;\n\t\t\t\t\t}, {})\n\t\t\t\t) as T;\n\t\t\t\treturn;\n\t\t\t// #endregion object\n\t\t}\n\n\t\tschema = (schema as any)[key as unknown as ExcludeByValueType<NonNullable<JsonSchemaStringValidationType>, boolean | string>](\n\t\t\ttypeof schemaValidation === 'string' ? schemaValidation : undefined\n\t\t);\n\t});\n\n\treturn schema;\n}\n\nexport function ConstructJsonSchema(schemaValue: JsonSchemaType): AnyJsonSchema {\n\tconst schemaMap: Record<typeof schemaValue.type, () => any> = {\n\t\tstring,\n\t\tnumber,\n\t\tboolean,\n\t\tdate,\n\t\tarray: () => array(ConstructJsonSchema((schemaValue as JsonSchemaArrayType).properties)),\n\t\tobject: () => object(\n\t\t\tObject.keys((schemaValue as JsonSchemaObjectType).properties)\n\t\t\t.reduce<SchemaMap<any>>((obj, key) => {\n\t\t\t\tobj[key] = ConstructJsonSchema((schemaValue as JsonSchemaObjectType).properties[key]);\n\t\t\t\treturn obj;\n\t\t\t}, {})\n\t\t)\n\t};\n\n\tlet schema: AnyJsonSchema = validation(\n\t\tschemaMap[schemaValue.type](),\n\t\tschemaValue.validation\n\t);\n\n\tif ( schemaValue.validation ) {\n\t\tif ( schemaValue.validation.required ) {\n\t\t\tschema = schema.required(\n\t\t\t\ttypeof schemaValue.validation.required === 'string' ? schemaValue.validation.required : undefined\n\t\t\t);\n\t\t}\n\t\telse if ( schemaValue.validation.required === false ) {\n\t\t\tschema = schema.notRequired();\n\t\t}\n\n\t\tif ( schemaValue.validation.nullable ) {\n\t\t\tschema = schema.nullable();\n\t\t}\n\t\telse if ( schemaValue.validation.nullable === false ) {\n\t\t\tschema = schema.notNullable();\n\t\t}\n\n\t\tif ( schemaValue.validation.optional ) {\n\t\t\tschema = schema.optional();\n\t\t}\n\t\telse if ( schemaValue.validation.optional === false ) {\n\t\t\tschema = schema.notOptional();\n\t\t}\n\t}\n\n\treturn schema;\n}\n","import { ConstructJsonSchema, type JsonSchemaToSchemaDataType, type JsonSchemaType } from './ConstructJsonSchema';\n\nexport function JsonSchema<T extends JsonSchemaType>(schema: T): JsonSchemaToSchemaDataType<T> {\n\treturn ConstructJsonSchema(schema).compile() as JsonSchemaToSchemaDataType<T>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,SAAgB,qBAA+C,aAAyC;A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