@warlock.js/seal 5.31.0 → 5.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/cjs/index.cjs +20 -16
- package/cjs/index.cjs.map +1 -1
- package/cjs/{object-VTtA-k1a.cjs → object-BoVGJ68E.cjs} +30 -13
- package/cjs/object-BoVGJ68E.cjs.map +1 -0
- package/cjs/object.cjs +2 -2
- package/cjs/{required-methods-chT0TXQS.cjs → required-methods-BJlnLnwa.cjs} +237 -228
- package/cjs/required-methods-BJlnLnwa.cjs.map +1 -0
- package/cjs/{string-edcPIpcU.cjs → string-CM8x0u2w.cjs} +44 -42
- package/cjs/string-CM8x0u2w.cjs.map +1 -0
- package/cjs/string.cjs +2 -2
- package/esm/config.d.mts +7 -8
- package/esm/config.d.mts.map +1 -1
- package/esm/factory/index.d.mts +2 -1
- package/esm/factory/index.mjs +1 -1
- package/esm/factory/validate.d.mts +3 -6
- package/esm/factory/validate.d.mts.map +1 -1
- package/esm/factory/validators.d.mts +9 -6
- package/esm/factory/validators.d.mts.map +1 -1
- package/esm/helpers/date-helpers.d.mts +1 -2
- package/esm/helpers/date-helpers.d.mts.map +1 -1
- package/esm/helpers/file.utils.d.mts +2 -4
- package/esm/helpers/file.utils.d.mts.map +1 -1
- package/esm/helpers/get-field-value.d.mts +2 -3
- package/esm/helpers/get-field-value.d.mts.map +1 -1
- package/esm/helpers/get-field-value.mjs +2 -1
- package/esm/helpers/get-field-value.mjs.map +1 -1
- package/esm/helpers/index.d.mts +6 -0
- package/esm/helpers/index.mjs +1 -1
- package/esm/helpers/path-helpers.d.mts +1 -2
- package/esm/helpers/path-helpers.d.mts.map +1 -1
- package/esm/helpers/validation-helpers.d.mts +4 -10
- package/esm/helpers/validation-helpers.d.mts.map +1 -1
- package/esm/index.d.mts +7 -0
- package/esm/mutators/array-mutators.d.mts +6 -7
- package/esm/mutators/array-mutators.d.mts.map +1 -1
- package/esm/mutators/boolean-mutators.d.mts +3 -4
- package/esm/mutators/boolean-mutators.d.mts.map +1 -1
- package/esm/mutators/date-mutators.d.mts +18 -19
- package/esm/mutators/date-mutators.d.mts.map +1 -1
- package/esm/mutators/index.d.mts +8 -0
- package/esm/mutators/index.mjs +1 -1
- package/esm/mutators/number-mutators.d.mts +10 -11
- package/esm/mutators/number-mutators.d.mts.map +1 -1
- package/esm/mutators/object-mutators.d.mts +4 -5
- package/esm/mutators/object-mutators.d.mts.map +1 -1
- package/esm/mutators/object-mutators.mjs +5 -4
- package/esm/mutators/object-mutators.mjs.map +1 -1
- package/esm/mutators/scalar-mutators.d.mts +2 -3
- package/esm/mutators/scalar-mutators.d.mts.map +1 -1
- package/esm/mutators/string-mutators.d.mts +37 -38
- package/esm/mutators/string-mutators.d.mts.map +1 -1
- package/esm/mutators/string-mutators.mjs +3 -1
- package/esm/mutators/string-mutators.mjs.map +1 -1
- package/esm/object.d.mts +3 -3
- package/esm/object.d.mts.map +1 -1
- package/esm/plugins/plugin-system.d.mts +11 -9
- package/esm/plugins/plugin-system.d.mts.map +1 -1
- package/esm/rules/array/array-rules.d.mts +3 -4
- package/esm/rules/array/array-rules.d.mts.map +1 -1
- package/esm/rules/array/index.d.mts +2 -0
- package/esm/rules/array/index.mjs +1 -1
- package/esm/rules/color/color-rules.d.mts +8 -9
- package/esm/rules/color/color-rules.d.mts.map +1 -1
- package/esm/rules/color/index.d.mts +2 -0
- package/esm/rules/color/index.mjs +1 -1
- package/esm/rules/common/enum.d.mts +5 -6
- package/esm/rules/common/enum.d.mts.map +1 -1
- package/esm/rules/common/equals-field-rules.d.mts +3 -4
- package/esm/rules/common/equals-field-rules.d.mts.map +1 -1
- package/esm/rules/common/index.d.mts +7 -0
- package/esm/rules/common/index.mjs +1 -1
- package/esm/rules/common/instanceof.d.mts +2 -3
- package/esm/rules/common/instanceof.d.mts.map +1 -1
- package/esm/rules/common/literal.d.mts +2 -3
- package/esm/rules/common/literal.d.mts.map +1 -1
- package/esm/rules/common/type-rules.d.mts +10 -11
- package/esm/rules/common/type-rules.d.mts.map +1 -1
- package/esm/rules/common/unknown-key.d.mts +2 -3
- package/esm/rules/common/unknown-key.d.mts.map +1 -1
- package/esm/rules/conditional/forbidden-if-rules.d.mts +7 -8
- package/esm/rules/conditional/forbidden-if-rules.d.mts.map +1 -1
- package/esm/rules/conditional/index.d.mts +11 -0
- package/esm/rules/conditional/index.mjs +1 -1
- package/esm/rules/conditional/present-if-rules.d.mts +6 -7
- package/esm/rules/conditional/present-if-rules.d.mts.map +1 -1
- package/esm/rules/conditional/present-unless-rules.d.mts +2 -3
- package/esm/rules/conditional/present-unless-rules.d.mts.map +1 -1
- package/esm/rules/conditional/present-with-rules.d.mts +4 -5
- package/esm/rules/conditional/present-with-rules.d.mts.map +1 -1
- package/esm/rules/conditional/present-without-rules.d.mts +4 -5
- package/esm/rules/conditional/present-without-rules.d.mts.map +1 -1
- package/esm/rules/conditional/required-if-rules.d.mts +10 -11
- package/esm/rules/conditional/required-if-rules.d.mts.map +1 -1
- package/esm/rules/conditional/required-unless-rules.d.mts +2 -3
- package/esm/rules/conditional/required-unless-rules.d.mts.map +1 -1
- package/esm/rules/conditional/required-when-rule.d.mts +2 -3
- package/esm/rules/conditional/required-when-rule.d.mts.map +1 -1
- package/esm/rules/conditional/required-with-rules.d.mts +4 -5
- package/esm/rules/conditional/required-with-rules.d.mts.map +1 -1
- package/esm/rules/conditional/required-without-rules.d.mts +4 -5
- package/esm/rules/conditional/required-without-rules.d.mts.map +1 -1
- package/esm/rules/core/equal.d.mts +2 -3
- package/esm/rules/core/equal.d.mts.map +1 -1
- package/esm/rules/core/forbidden.d.mts +2 -3
- package/esm/rules/core/forbidden.d.mts.map +1 -1
- package/esm/rules/core/index.d.mts +6 -0
- package/esm/rules/core/index.mjs +1 -1
- package/esm/rules/core/required.d.mts +3 -4
- package/esm/rules/core/required.d.mts.map +1 -1
- package/esm/rules/core/union.d.mts +2 -3
- package/esm/rules/core/union.d.mts.map +1 -1
- package/esm/rules/core/when.d.mts +2 -3
- package/esm/rules/core/when.d.mts.map +1 -1
- package/esm/rules/date/date-comparison-rules.d.mts +6 -7
- package/esm/rules/date/date-comparison-rules.d.mts.map +1 -1
- package/esm/rules/date/date-day-rules.d.mts +5 -6
- package/esm/rules/date/date-day-rules.d.mts.map +1 -1
- package/esm/rules/date/date-field-comparison-rules.d.mts +4 -5
- package/esm/rules/date/date-field-comparison-rules.d.mts.map +1 -1
- package/esm/rules/date/date-field-comparison-rules.mjs +6 -3
- package/esm/rules/date/date-field-comparison-rules.mjs.map +1 -1
- package/esm/rules/date/date-period-rules.d.mts +16 -16
- package/esm/rules/date/date-period-rules.d.mts.map +1 -1
- package/esm/rules/date/date-period-rules.mjs +24 -12
- package/esm/rules/date/date-period-rules.mjs.map +1 -1
- package/esm/rules/date/date-relative-rules.d.mts +4 -5
- package/esm/rules/date/date-relative-rules.d.mts.map +1 -1
- package/esm/rules/date/date-relative-rules.mjs +3 -3
- package/esm/rules/date/date-relative-rules.mjs.map +1 -1
- package/esm/rules/date/date-special-rules.d.mts +4 -5
- package/esm/rules/date/date-special-rules.d.mts.map +1 -1
- package/esm/rules/date/date.d.mts +16 -17
- package/esm/rules/date/date.d.mts.map +1 -1
- package/esm/rules/date/date.mjs +4 -2
- package/esm/rules/date/date.mjs.map +1 -1
- package/esm/rules/date/index.d.mts +8 -0
- package/esm/rules/date/index.mjs +1 -1
- package/esm/rules/file/dimensions.d.mts +5 -6
- package/esm/rules/file/dimensions.d.mts.map +1 -1
- package/esm/rules/file/file-size.d.mts +3 -4
- package/esm/rules/file/file-size.d.mts.map +1 -1
- package/esm/rules/file/index.d.mts +3 -0
- package/esm/rules/file/index.mjs +1 -1
- package/esm/rules/index.d.mts +56 -0
- package/esm/rules/index.mjs +1 -1
- package/esm/rules/length/index.d.mts +2 -0
- package/esm/rules/length/index.mjs +1 -1
- package/esm/rules/length/length-rules.d.mts +8 -9
- package/esm/rules/length/length-rules.d.mts.map +1 -1
- package/esm/rules/number/index.d.mts +2 -0
- package/esm/rules/number/index.mjs +1 -1
- package/esm/rules/number/number-rules.d.mts +11 -12
- package/esm/rules/number/number-rules.d.mts.map +1 -1
- package/esm/rules/number/number-rules.mjs +12 -6
- package/esm/rules/number/number-rules.mjs.map +1 -1
- package/esm/rules/scalar/index.mjs +1 -1
- package/esm/rules/string/alpha.d.mts +4 -5
- package/esm/rules/string/alpha.d.mts.map +1 -1
- package/esm/rules/string/credit-card.d.mts +2 -3
- package/esm/rules/string/credit-card.d.mts.map +1 -1
- package/esm/rules/string/email.d.mts +2 -3
- package/esm/rules/string/email.d.mts.map +1 -1
- package/esm/rules/string/id-formats.d.mts +6 -7
- package/esm/rules/string/id-formats.d.mts.map +1 -1
- package/esm/rules/string/index.d.mts +12 -0
- package/esm/rules/string/index.mjs +1 -1
- package/esm/rules/string/ip.d.mts +7 -8
- package/esm/rules/string/ip.d.mts.map +1 -1
- package/esm/rules/string/matches.d.mts +2 -3
- package/esm/rules/string/matches.d.mts.map +1 -1
- package/esm/rules/string/pattern.d.mts +2 -3
- package/esm/rules/string/pattern.d.mts.map +1 -1
- package/esm/rules/string/string-comparison.d.mts +5 -6
- package/esm/rules/string/string-comparison.d.mts.map +1 -1
- package/esm/rules/string/strong-password-rule.d.mts +2 -3
- package/esm/rules/string/strong-password-rule.d.mts.map +1 -1
- package/esm/rules/string/url.d.mts +2 -3
- package/esm/rules/string/url.d.mts.map +1 -1
- package/esm/rules/string/without-whitespace.d.mts +2 -3
- package/esm/rules/string/without-whitespace.d.mts.map +1 -1
- package/esm/standard-schema/index.d.mts +4 -0
- package/esm/standard-schema/json-schema.d.mts +5 -7
- package/esm/standard-schema/json-schema.d.mts.map +1 -1
- package/esm/standard-schema/map-result.d.mts +2 -3
- package/esm/standard-schema/map-result.d.mts.map +1 -1
- package/esm/standard-schema/types.d.mts +4 -5
- package/esm/standard-schema/types.d.mts.map +1 -1
- package/esm/string.d.mts +2 -3
- package/esm/string.d.mts.map +1 -1
- package/esm/types/conditional-types.d.mts +8 -6
- package/esm/types/conditional-types.d.mts.map +1 -1
- package/esm/types/context-types.d.mts +24 -15
- package/esm/types/context-types.d.mts.map +1 -1
- package/esm/types/data-transformer-types.d.mts +3 -5
- package/esm/types/data-transformer-types.d.mts.map +1 -1
- package/esm/types/date-types.d.mts +2 -3
- package/esm/types/date-types.d.mts.map +1 -1
- package/esm/types/file.types.d.mts +1 -2
- package/esm/types/file.types.d.mts.map +1 -1
- package/esm/types/index.d.mts +11 -0
- package/esm/types/inference-types.d.mts +14 -13
- package/esm/types/inference-types.d.mts.map +1 -1
- package/esm/types/mutator-types.d.mts +9 -7
- package/esm/types/mutator-types.d.mts.map +1 -1
- package/esm/types/result-types.d.mts +12 -7
- package/esm/types/result-types.d.mts.map +1 -1
- package/esm/types/rule-types.d.mts +25 -16
- package/esm/types/rule-types.d.mts.map +1 -1
- package/esm/types/schema-types.d.mts +1 -3
- package/esm/types/schema-types.d.mts.map +1 -1
- package/esm/validators/any-validator.d.mts +1 -3
- package/esm/validators/any-validator.d.mts.map +1 -1
- package/esm/validators/array-validator.d.mts +2 -3
- package/esm/validators/array-validator.d.mts.map +1 -1
- package/esm/validators/base-validator.d.mts +2 -3
- package/esm/validators/base-validator.d.mts.map +1 -1
- package/esm/validators/base-validator.mjs +2 -1
- package/esm/validators/base-validator.mjs.map +1 -1
- package/esm/validators/boolean-validator.d.mts +1 -3
- package/esm/validators/boolean-validator.d.mts.map +1 -1
- package/esm/validators/computed-validator.d.mts +3 -4
- package/esm/validators/computed-validator.d.mts.map +1 -1
- package/esm/validators/date-validator.d.mts +2 -3
- package/esm/validators/date-validator.d.mts.map +1 -1
- package/esm/validators/discriminated-union-validator.d.mts +3 -3
- package/esm/validators/discriminated-union-validator.d.mts.map +1 -1
- package/esm/validators/float-validator.d.mts +1 -3
- package/esm/validators/float-validator.d.mts.map +1 -1
- package/esm/validators/index.d.mts +2 -1
- package/esm/validators/index.mjs +1 -1
- package/esm/validators/instanceof-validator.d.mts +1 -3
- package/esm/validators/instanceof-validator.d.mts.map +1 -1
- package/esm/validators/int-validator.d.mts +1 -3
- package/esm/validators/int-validator.d.mts.map +1 -1
- package/esm/validators/lazy-validator.d.mts +2 -3
- package/esm/validators/lazy-validator.d.mts.map +1 -1
- package/esm/validators/literal-validator.d.mts +1 -3
- package/esm/validators/literal-validator.d.mts.map +1 -1
- package/esm/validators/managed-validator.d.mts +3 -4
- package/esm/validators/managed-validator.d.mts.map +1 -1
- package/esm/validators/methods/equality-conditional-methods.d.mts +3 -4
- package/esm/validators/methods/equality-conditional-methods.d.mts.map +1 -1
- package/esm/validators/methods/forbidden-methods.d.mts +2 -3
- package/esm/validators/methods/forbidden-methods.d.mts.map +1 -1
- package/esm/validators/methods/present-methods.d.mts +2 -3
- package/esm/validators/methods/present-methods.d.mts.map +1 -1
- package/esm/validators/methods/required-methods.d.mts +3 -4
- package/esm/validators/methods/required-methods.d.mts.map +1 -1
- package/esm/validators/number-validator.d.mts +1 -3
- package/esm/validators/number-validator.d.mts.map +1 -1
- package/esm/validators/number-validator.mjs +12 -8
- package/esm/validators/number-validator.mjs.map +1 -1
- package/esm/validators/numeric-validator.d.mts +1 -3
- package/esm/validators/numeric-validator.d.mts.map +1 -1
- package/esm/validators/object-validator.d.mts +2 -3
- package/esm/validators/object-validator.d.mts.map +1 -1
- package/esm/validators/primitive-validator.d.mts +1 -3
- package/esm/validators/primitive-validator.d.mts.map +1 -1
- package/esm/validators/record-validator.d.mts +2 -3
- package/esm/validators/record-validator.d.mts.map +1 -1
- package/esm/validators/scalar-validator.d.mts +1 -3
- package/esm/validators/scalar-validator.d.mts.map +1 -1
- package/esm/validators/string-validator.d.mts +1 -3
- package/esm/validators/string-validator.d.mts.map +1 -1
- package/esm/validators/tuple-validator.d.mts +2 -3
- package/esm/validators/tuple-validator.d.mts.map +1 -1
- package/esm/validators/union-validator.d.mts +1 -3
- package/esm/validators/union-validator.d.mts.map +1 -1
- package/package.json +1 -1
- package/cjs/object-VTtA-k1a.cjs.map +0 -1
- package/cjs/required-methods-chT0TXQS.cjs.map +0 -1
- package/cjs/string-edcPIpcU.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string-mutators.mjs","names":[],"sources":["../../../../../../../../packages/seal/src/mutators/string-mutators.ts"],"sourcesContent":["import {\n capitalize,\n ltrim,\n readMoreChars,\n rtrim,\n toCamelCase,\n toKebabCase,\n toSnakeCase,\n toStudlyCase,\n trim,\n} from \"@mongez/reinforcements\";\nimport type { Mutator } from \"../types\";\n\n/** Convert string to lowercase */\nexport const lowercaseMutator: Mutator = async (value) => {\n return value?.toString().toLowerCase();\n};\n\n/** Convert string to uppercase */\nexport const uppercaseMutator: Mutator = async (value) => {\n return value?.toString().toUpperCase();\n};\n\n/** Capitalize only the first letter of the string */\nexport const capitalizeMutator: Mutator = async (value) => {\n const str = value?.toString();\n return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();\n};\n\n/** Capitalize the first letter of each word (Title Case) */\nexport const titleCaseMutator: Mutator = async (value) => {\n return capitalize(value?.toString());\n};\n\n/** Convert value to string */\nexport const stringifyMutator: Mutator = async (value) => {\n if (!value && value !== 0) return \"\";\n // only convert numbers, boolean and strings\n\n // Handle strings (pass through)\n if (typeof value === \"string\") return value;\n\n // Handle scalar types (number, boolean)\n if (typeof value === \"number\" || typeof value === \"boolean\") {\n return String(value);\n }\n};\n\n/** Trim whitespace */\nexport const trimMutator: Mutator = async (value, context) => {\n return trim(value?.toString(), context?.options?.needle ?? \" \");\n};\n\n/**\n * Strip HTML tags with a naive `<...>` regex.\n *\n * This is a **tag stripper, not an XSS sanitizer**: it is not a parser, so\n * malformed/nested markup, attribute payloads, or content re-introduced\n * later in a pipeline can defeat it. Do not rely on this alone to make\n * untrusted rich text safe to render — use a real parser-based sanitizer\n * (e.g. DOMPurify / sanitize-html) for that.\n */\nexport const stripTagsMutator: Mutator = async (value) => {\n return value?.toString().replace(/<[^>]*>?/gm, \"\");\n};\n\n/**\n * @deprecated Renamed to {@link stripTagsMutator} — the old name implied\n * XSS safety this tag-stripping regex does not provide. Kept as an alias\n * for backward compatibility; switch to `stripTagsMutator`.\n */\nexport const safeHtmlMutator: Mutator = stripTagsMutator;\n\n/** HTML escape */\nexport const htmlEscapeMutator: Mutator = async (value) => {\n return value\n ?.toString()\n .replace(/&/g, \"&\")\n .replace(/</g, \"<\")\n .replace(/>/g, \">\")\n .replace(/\"/g, \""\")\n .replace(/'/g, \"'\");\n};\n\n/** Remove special characters */\nexport const removeSpecialCharactersMutator: Mutator = async (value) => {\n return value?.toString().replace(/[^a-zA-Z0-9]/g, \"\");\n};\n\n/** URL decode */\nexport const urlDecodeMutator: Mutator = async (value) => {\n return decodeURIComponent(value);\n};\n\n/** URL encode */\nexport const urlEncodeMutator: Mutator = async (value) => {\n return encodeURIComponent(value);\n};\n\n/** Convert to camelCase */\nexport const camelCaseMutator: Mutator = async (value) => {\n return toCamelCase(value?.toString());\n};\n\n/** Convert to PascalCase */\nexport const pascalCaseMutator: Mutator = async (value) => {\n return toStudlyCase(value?.toString());\n};\n\n/** Convert to snake_case */\nexport const snakeCaseMutator: Mutator = async (value) => {\n return toSnakeCase(value?.toString());\n};\n\n/** Convert to kebab-case */\nexport const kebabCaseMutator: Mutator = async (value) => {\n return toKebabCase(value?.toString());\n};\n\n/** Convert to URL-friendly slug */\nexport const slugMutator: Mutator = async (value) => {\n return value\n ?.toString()\n .toLowerCase()\n .trim()\n .replace(/[^\\w\\s-]/g, \"\")\n .replace(/[\\s_]+/g, \"-\")\n .replace(/--+/g, \"-\")\n .replace(/^-+|-+$/g, \"\");\n};\n\n/** Trim from the left/start */\nexport const ltrimMutator: Mutator = async (value, context) => {\n return ltrim(value?.toString(), context?.options?.needle ?? \" \");\n};\n\n/** Trim from the right/end */\nexport const rtrimMutator: Mutator = async (value, context) => {\n return rtrim(value?.toString(), context?.options?.needle ?? \" \");\n};\n\n/** Base64 encode */\nexport const base64EncodeMutator: Mutator = async (value) => {\n return Buffer.from(value?.toString()).toString(\"base64\");\n};\n\n/** Base64 decode */\nexport const base64DecodeMutator: Mutator = async (value) => {\n return Buffer.from(value?.toString(), \"base64\").toString(\"utf-8\");\n};\n\n/** Replace substring or pattern */\nexport const replaceMutator: Mutator = async (value, context) => {\n const { search, replace } = context?.options ?? {};\n if (!search) return value?.toString();\n return value?.toString().replace(search, replace ?? \"\");\n};\n\n/** Replace all occurrences of substring or pattern */\nexport const replaceAllMutator: Mutator = async (value, context) => {\n const { search, replace } = context?.options ?? {};\n if (!search) return value?.toString();\n const searchValue = typeof search === \"string\" ? new RegExp(search, \"g\") : search;\n return value?.toString().replace(searchValue, replace ?? \"\");\n};\n\n/** Append/suffix text to the end */\nexport const appendMutator: Mutator = async (value, context) => {\n const suffix = context?.options?.suffix ?? \"\";\n return value?.toString() + suffix;\n};\n\n/** Prepend/prefix text to the beginning */\nexport const prependMutator: Mutator = async (value, context) => {\n const prefix = context?.options?.prefix ?? \"\";\n return prefix + value?.toString();\n};\n\n/** Reverse the string */\nexport const reverseMutator: Mutator = async (value) => {\n return value?.toString().split(\"\").reverse().join(\"\");\n};\n\n/** Truncate to a maximum length */\nexport const truncateMutator: Mutator = async (value, context) => {\n const str = value?.toString();\n const maxLength = context?.options?.maxLength ?? 100;\n const suffix = context?.options?.suffix ?? \"...\";\n return readMoreChars(str, maxLength, suffix);\n};\n\n/** Trim multiple whitespace into single space */\nexport const trimMultipleWhitespaceMutator: Mutator = async (value) => {\n return value?.toString().replace(/\\s+/g, \" \");\n};\n\n/** Pad string from the start to reach target length */\nexport const padStartMutator: Mutator = async (value, context) => {\n const length = context?.options?.length ?? 0;\n const char = context?.options?.char ?? \" \";\n return value?.toString().padStart(length, char);\n};\n\n/** Pad string from the end to reach target length */\nexport const padEndMutator: Mutator = async (value, context) => {\n const length = context?.options?.length ?? 0;\n const char = context?.options?.char ?? \" \";\n return value?.toString().padEnd(length, char);\n};\n\n/** Repeat string N times */\nexport const repeatMutator: Mutator = async (value, context) => {\n const count = context?.options?.count ?? 1;\n return value?.toString()?.repeat(count);\n};\n\n/** Mask part of string */\nexport const maskMutator: Mutator = async (value, context) => {\n const str = value?.toString();\n const maskChar = context?.options?.char ?? \"*\";\n const start = context?.options?.start ?? 0;\n const end = context?.options?.end ?? str?.length;\n const visibleStart = str?.substring(0, start);\n const visibleEnd = str?.substring(end);\n const maskedLength = end - start;\n return visibleStart + maskChar.repeat(maskedLength) + visibleEnd;\n};\n\n/** Unescape HTML entities */\nexport const unescapeHtmlMutator: Mutator = async (value) => {\n return value\n ?.toString()\n .replace(/&/g, \"&\")\n .replace(/</g, \"<\")\n .replace(/>/g, \">\")\n .replace(/"/g, '\"')\n .replace(/'/g, \"'\");\n};\n\n/** Keep only alphabetic characters */\nexport const alphaOnlyMutator: Mutator = async (value) => {\n return value.toString().replace(/[^a-zA-Z]/g, \"\");\n};\n\n/** Keep only alphanumeric characters */\nexport const alphanumericOnlyMutator: Mutator = async (value) => {\n return value.toString().replace(/[^a-zA-Z0-9]/g, \"\");\n};\n\n/** Remove all numeric characters */\nexport const removeNumbersMutator: Mutator = async (value) => {\n return value.toString().replace(/[0-9]/g, \"\");\n};\n"],"mappings":";;;;AAcA,MAAa,mBAA4B,OAAO,UAAU;CACxD,OAAO,OAAO,SAAS,CAAC,CAAC,YAAY;AACvC;;AAGA,MAAa,mBAA4B,OAAO,UAAU;CACxD,OAAO,OAAO,SAAS,CAAC,CAAC,YAAY;AACvC;;AAGA,MAAa,oBAA6B,OAAO,UAAU;CACzD,MAAM,MAAM,OAAO,SAAS;CAC5B,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,IAAI,MAAM,CAAC,CAAC,CAAC,YAAY;AAChE;;AAGA,MAAa,mBAA4B,OAAO,UAAU;CACxD,OAAO,WAAW,OAAO,SAAS,CAAC;AACrC;;AAGA,MAAa,mBAA4B,OAAO,UAAU;CACxD,IAAI,CAAC,SAAS,UAAU,GAAG,OAAO;CAIlC,IAAI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AAC,CACX,QAAQ,UAAU,GAAG,CAAC,CACtB,QAAQ,SAAS,GAAG,CAAC,CACrB,QAAQ,SAAS,GAAG,CAAC,CACrB,QAAQ,WAAW,IAAG,CAAC,CACvB,QAAQ,WAAW,GAAG;AAC3B;;AAGA,MAAa,mBAA4B,OAAO,UAAU;CACxD,OAAO,MAAM,SAAS,CAAC,CAAC,QAAQ,cAAc,EAAE;AAClD;;AAGA,MAAa,0BAAmC,OAAO,UAAU;CAC/D,OAAO,MAAM,SAAS,CAAC,CAAC,QAAQ,iBAAiB,EAAE;AACrD;;AAGA,MAAa,uBAAgC,OAAO,UAAU;CAC5D,OAAO,MAAM,SAAS,CAAC,CAAC,QAAQ,UAAU,EAAE;AAC9C"}
|
|
1
|
+
{"version":3,"file":"string-mutators.mjs","names":[],"sources":["../../../../../../../../packages/seal/src/mutators/string-mutators.ts"],"sourcesContent":["import {\n capitalize,\n ltrim,\n readMoreChars,\n rtrim,\n toCamelCase,\n toKebabCase,\n toSnakeCase,\n toStudlyCase,\n trim,\n} from \"@mongez/reinforcements\";\nimport type { Mutator } from \"../types\";\n\n/** Convert string to lowercase */\nexport const lowercaseMutator: Mutator = async (value) => {\n return value?.toString().toLowerCase();\n};\n\n/** Convert string to uppercase */\nexport const uppercaseMutator: Mutator = async (value) => {\n return value?.toString().toUpperCase();\n};\n\n/** Capitalize only the first letter of the string */\nexport const capitalizeMutator: Mutator = async (value) => {\n const str = value?.toString();\n return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();\n};\n\n/** Capitalize the first letter of each word (Title Case) */\nexport const titleCaseMutator: Mutator = async (value) => {\n return capitalize(value?.toString());\n};\n\n/** Convert value to string */\nexport const stringifyMutator: Mutator = async (value) => {\n if (!value && value !== 0) return \"\";\n // only convert numbers, boolean and strings\n\n // Handle strings (pass through)\n if (typeof value === \"string\") return value;\n\n // Handle scalar types (number, boolean)\n if (typeof value === \"number\" || typeof value === \"boolean\") {\n return String(value);\n }\n};\n\n/** Trim whitespace */\nexport const trimMutator: Mutator = async (value, context) => {\n return trim(value?.toString(), context?.options?.needle ?? \" \");\n};\n\n/**\n * Strip HTML tags with a naive `<...>` regex.\n *\n * This is a **tag stripper, not an XSS sanitizer**: it is not a parser, so\n * malformed/nested markup, attribute payloads, or content re-introduced\n * later in a pipeline can defeat it. Do not rely on this alone to make\n * untrusted rich text safe to render — use a real parser-based sanitizer\n * (e.g. DOMPurify / sanitize-html) for that.\n */\nexport const stripTagsMutator: Mutator = async (value) => {\n return value?.toString().replace(/<[^>]*>?/gm, \"\");\n};\n\n/**\n * @deprecated Renamed to {@link stripTagsMutator} — the old name implied\n * XSS safety this tag-stripping regex does not provide. Kept as an alias\n * for backward compatibility; switch to `stripTagsMutator`.\n */\nexport const safeHtmlMutator: Mutator = stripTagsMutator;\n\n/** HTML escape */\nexport const htmlEscapeMutator: Mutator = async (value) => {\n return value\n ?.toString()\n .replace(/&/g, \"&\")\n .replace(/</g, \"<\")\n .replace(/>/g, \">\")\n .replace(/\"/g, \""\")\n .replace(/'/g, \"'\");\n};\n\n/** Remove special characters */\nexport const removeSpecialCharactersMutator: Mutator = async (value) => {\n return value?.toString().replace(/[^a-zA-Z0-9]/g, \"\");\n};\n\n/** URL decode */\nexport const urlDecodeMutator: Mutator = async (value) => {\n return decodeURIComponent(value);\n};\n\n/** URL encode */\nexport const urlEncodeMutator: Mutator = async (value) => {\n return encodeURIComponent(value);\n};\n\n/** Convert to camelCase */\nexport const camelCaseMutator: Mutator = async (value) => {\n return toCamelCase(value?.toString());\n};\n\n/** Convert to PascalCase */\nexport const pascalCaseMutator: Mutator = async (value) => {\n return toStudlyCase(value?.toString());\n};\n\n/** Convert to snake_case */\nexport const snakeCaseMutator: Mutator = async (value) => {\n return toSnakeCase(value?.toString());\n};\n\n/** Convert to kebab-case */\nexport const kebabCaseMutator: Mutator = async (value) => {\n return toKebabCase(value?.toString());\n};\n\n/** Convert to URL-friendly slug */\nexport const slugMutator: Mutator = async (value) => {\n return value\n ?.toString()\n .toLowerCase()\n .trim()\n .replace(/[^\\w\\s-]/g, \"\")\n .replace(/[\\s_]+/g, \"-\")\n .replace(/--+/g, \"-\")\n .replace(/^-+|-+$/g, \"\");\n};\n\n/** Trim from the left/start */\nexport const ltrimMutator: Mutator = async (value, context) => {\n return ltrim(value?.toString(), context?.options?.needle ?? \" \");\n};\n\n/** Trim from the right/end */\nexport const rtrimMutator: Mutator = async (value, context) => {\n return rtrim(value?.toString(), context?.options?.needle ?? \" \");\n};\n\n/** Base64 encode */\nexport const base64EncodeMutator: Mutator = async (value) => {\n return Buffer.from(value?.toString()).toString(\"base64\");\n};\n\n/** Base64 decode */\nexport const base64DecodeMutator: Mutator = async (value) => {\n return Buffer.from(value?.toString(), \"base64\").toString(\"utf-8\");\n};\n\n/** Replace substring or pattern */\nexport const replaceMutator: Mutator = async (value, context) => {\n const { search, replace } = context?.options ?? {};\n if (!search) return value?.toString();\n return value?.toString().replace(search, replace ?? \"\");\n};\n\n/** Replace all occurrences of substring or pattern */\nexport const replaceAllMutator: Mutator = async (value, context) => {\n const { search, replace } = context?.options ?? {};\n if (!search) return value?.toString();\n const searchValue = typeof search === \"string\" ? new RegExp(search, \"g\") : search;\n return value?.toString().replace(searchValue, replace ?? \"\");\n};\n\n/** Append/suffix text to the end */\nexport const appendMutator: Mutator = async (value, context) => {\n const suffix = context?.options?.suffix ?? \"\";\n return value?.toString() + suffix;\n};\n\n/** Prepend/prefix text to the beginning */\nexport const prependMutator: Mutator = async (value, context) => {\n const prefix = context?.options?.prefix ?? \"\";\n return prefix + value?.toString();\n};\n\n/** Reverse the string */\nexport const reverseMutator: Mutator = async (value) => {\n return value?.toString().split(\"\").reverse().join(\"\");\n};\n\n/** Truncate to a maximum length */\nexport const truncateMutator: Mutator = async (value, context) => {\n const str = value?.toString();\n const maxLength = context?.options?.maxLength ?? 100;\n const suffix = context?.options?.suffix ?? \"...\";\n return readMoreChars(str, maxLength, suffix);\n};\n\n/** Trim multiple whitespace into single space */\nexport const trimMultipleWhitespaceMutator: Mutator = async (value) => {\n return value?.toString().replace(/\\s+/g, \" \");\n};\n\n/** Pad string from the start to reach target length */\nexport const padStartMutator: Mutator = async (value, context) => {\n const length = context?.options?.length ?? 0;\n const char = context?.options?.char ?? \" \";\n return value?.toString().padStart(length, char);\n};\n\n/** Pad string from the end to reach target length */\nexport const padEndMutator: Mutator = async (value, context) => {\n const length = context?.options?.length ?? 0;\n const char = context?.options?.char ?? \" \";\n return value?.toString().padEnd(length, char);\n};\n\n/** Repeat string N times */\nexport const repeatMutator: Mutator = async (value, context) => {\n const count = context?.options?.count ?? 1;\n return value?.toString()?.repeat(count);\n};\n\n/** Mask part of string */\nexport const maskMutator: Mutator = async (value, context) => {\n const str = value?.toString();\n const maskChar = context?.options?.char ?? \"*\";\n const start = context?.options?.start ?? 0;\n const end = context?.options?.end ?? str?.length;\n const visibleStart = str?.substring(0, start);\n const visibleEnd = str?.substring(end);\n const maskedLength = end - start;\n return visibleStart + maskChar.repeat(maskedLength) + visibleEnd;\n};\n\n/** Unescape HTML entities */\nexport const unescapeHtmlMutator: Mutator = async (value) => {\n return value\n ?.toString()\n .replace(/&/g, \"&\")\n .replace(/</g, \"<\")\n .replace(/>/g, \">\")\n .replace(/"/g, '\"')\n .replace(/'/g, \"'\");\n};\n\n/** Keep only alphabetic characters */\nexport const alphaOnlyMutator: Mutator = async (value) => {\n return value.toString().replace(/[^a-zA-Z]/g, \"\");\n};\n\n/** Keep only alphanumeric characters */\nexport const alphanumericOnlyMutator: Mutator = async (value) => {\n return value.toString().replace(/[^a-zA-Z0-9]/g, \"\");\n};\n\n/** Remove all numeric characters */\nexport const removeNumbersMutator: Mutator = async (value) => {\n return value.toString().replace(/[0-9]/g, \"\");\n};\n"],"mappings":";;;;AAcA,MAAa,mBAA4B,OAAO,UAAU;CACxD,OAAO,OAAO,SAAS,CAAC,CAAC,YAAY;AACvC;;AAGA,MAAa,mBAA4B,OAAO,UAAU;CACxD,OAAO,OAAO,SAAS,CAAC,CAA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O,OAAO,YAAY;CAC5D,MAAM,MAAM,OAAO,SAAS;CAC5B,MAAM,WAAW,SAAS,SAAS,QAAQ;CAC3C,MAAM,QAAQ,SAAS,SAAS,SAAS;CACzC,MAAM,MAAM,SAAS,SAAS,OAAO,KAAK;CAC1C,MAAM,eAAe,KAAK,UAAU,GAAG,KAAK;CAC5C,MAAM,aAAa,KAAK,UAAU,GAAG;CACrC,MAAM,eAAe,MAAM;CAC3B,OAAO,eAAe,SAAS,OAAO,YAAY,IAAI;AACxD;;AAGA,MAAa,sBAA+B,OAAO,UAAU;CAC3D,OAAO,OACH,SAAS,CAAC,CACX,QAAQ,UAAU,GAAG,CAAC,CACtB,QAAQ,SAAS,GAAG,CAAC,CACrB,QAAQ,SAAS,GAAG,CAAC,CACrB,QAAQ,WAAW,IAAG,CAAC,CACvB,QAAQ,WAAW,GAAG;AAC3B;;AAGA,MAAa,mBAA4B,OAAO,UAAU;CACxD,OAAO,MAAM,SAAS,CAAC,CAAC,QAAQ,cAAc,EAAE;AAClD;;AAGA,MAAa,0BAAmC,OAAO,UAAU;CAC/D,OAAO,MAAM,SAAS,CAAC,CAAC,QAAQ,iBAAiB,EAAE;AACrD;;AAGA,MAAa,uBAAgC,OAAO,UAAU;CAC5D,OAAO,MAAM,SAAS,CAAC,CAAC,QAAQ,UAAU,EAAE;AAC9C"}
|
package/esm/object.d.mts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Schema } from "./types/schema-types.mjs";
|
|
2
|
+
import "./types/index.mjs";
|
|
2
3
|
import { equalityConditionalMethodsApplied } from "./validators/methods/equality-conditional-methods.mjs";
|
|
3
4
|
import { forbiddenMethodsApplied } from "./validators/methods/forbidden-methods.mjs";
|
|
4
5
|
import { presentMethodsApplied } from "./validators/methods/present-methods.mjs";
|
|
5
6
|
import { requiredMethodsApplied } from "./validators/methods/required-methods.mjs";
|
|
6
7
|
import { ObjectValidator } from "./validators/object-validator.mjs";
|
|
7
|
-
|
|
8
8
|
//#region ../../packages/seal/src/object.d.ts
|
|
9
9
|
/** Create an object schema without importing the complete `v` factory. */
|
|
10
|
-
declare const object: <T extends Schema>(schema: T, errorMessage?: string) => ObjectValidator<T>;
|
|
10
|
+
export declare const object: <T extends Schema>(schema: T, errorMessage?: string) => ObjectValidator<T>;
|
|
11
11
|
//#endregion
|
|
12
|
-
export { ObjectValidator, equalityConditionalMethodsApplied, forbiddenMethodsApplied,
|
|
12
|
+
export { ObjectValidator, equalityConditionalMethodsApplied, forbiddenMethodsApplied, presentMethodsApplied, requiredMethodsApplied };
|
|
13
13
|
//# sourceMappingURL=object.d.mts.map
|
package/esm/object.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object.d.mts","names":[],"sources":["../../../../../../../packages/seal/src/object.ts"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"object.d.mts","names":[],"sources":["../../../../../../../packages/seal/src/object.ts"],"mappings":";;;;;;;;;qBAYa,SAAU,UAAU,QAAM,QAAU,GAAC,0BAAuB,gBAAA"}
|
|
@@ -4,12 +4,15 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Allows extending validators with custom functionality via plugins
|
|
6
6
|
*/
|
|
7
|
-
type PluginContext = {
|
|
8
|
-
/** Plugin name */
|
|
7
|
+
export type PluginContext = {
|
|
8
|
+
/** Plugin name */
|
|
9
|
+
name: string;
|
|
10
|
+
/** Plugin version */
|
|
9
11
|
version?: string;
|
|
10
12
|
};
|
|
11
|
-
type SealPlugin = {
|
|
12
|
-
/** Plugin metadata */
|
|
13
|
+
export type SealPlugin = {
|
|
14
|
+
/** Plugin metadata */
|
|
15
|
+
name: string;
|
|
13
16
|
version?: string;
|
|
14
17
|
description?: string;
|
|
15
18
|
/**
|
|
@@ -53,19 +56,18 @@ type SealPlugin = {
|
|
|
53
56
|
* registerPlugin(slugPlugin);
|
|
54
57
|
* ```
|
|
55
58
|
*/
|
|
56
|
-
declare function registerPlugin(plugin: SealPlugin): Promise<void>;
|
|
59
|
+
export declare function registerPlugin(plugin: SealPlugin): Promise<void>;
|
|
57
60
|
/**
|
|
58
61
|
* Unregister a plugin
|
|
59
62
|
*/
|
|
60
|
-
declare function unregisterPlugin(pluginName: string): Promise<void>;
|
|
63
|
+
export declare function unregisterPlugin(pluginName: string): Promise<void>;
|
|
61
64
|
/**
|
|
62
65
|
* Check if a plugin is installed
|
|
63
66
|
*/
|
|
64
|
-
declare function hasPlugin(pluginName: string): boolean;
|
|
67
|
+
export declare function hasPlugin(pluginName: string): boolean;
|
|
65
68
|
/**
|
|
66
69
|
* Get list of installed plugins
|
|
67
70
|
*/
|
|
68
|
-
declare function getInstalledPlugins(): SealPlugin[];
|
|
71
|
+
export declare function getInstalledPlugins(): SealPlugin[];
|
|
69
72
|
//#endregion
|
|
70
|
-
export { PluginContext, SealPlugin, getInstalledPlugins, hasPlugin, registerPlugin, unregisterPlugin };
|
|
71
73
|
//# sourceMappingURL=plugin-system.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-system.d.mts","names":[],"sources":["../../../../../../../../packages/seal/src/plugins/plugin-system.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"plugin-system.d.mts","names":[],"sources":["../../../../../../../../packages/seal/src/plugins/plugin-system.ts"],"mappings":";;;;;;YAMY;;EAEV;;EAEA;;YAGU;;EAEV;EACA;EACA;;;;;;;;;;;;;;;;EAiBA,UAAU,SAAS,yBAAyB;;;;;EAM5C,yBAAyB;;;;;;;;;;;;;;;;;;;;;wBA2BL,eAAe,QAAQ,aAAa;;;;wBAoBpC,iBAAiB,qBAAqB;;;;wBAkB5C,UAAU;;;;wBAOV,uBAAuB"}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { SchemaRule } from "../../types/rule-types.mjs";
|
|
2
|
-
|
|
2
|
+
import "../../types/index.mjs";
|
|
3
3
|
//#region ../../packages/seal/src/rules/array/array-rules.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Unique array rule - array must contain unique values
|
|
6
6
|
*/
|
|
7
|
-
declare const uniqueArrayRule: SchemaRule;
|
|
7
|
+
export declare const uniqueArrayRule: SchemaRule;
|
|
8
8
|
/**
|
|
9
9
|
* Sorted array rule - array must be sorted
|
|
10
10
|
*/
|
|
11
|
-
declare const sortedArrayRule: SchemaRule<{
|
|
11
|
+
export declare const sortedArrayRule: SchemaRule<{
|
|
12
12
|
direction?: "asc" | "desc";
|
|
13
13
|
}>;
|
|
14
14
|
//#endregion
|
|
15
|
-
export { sortedArrayRule, uniqueArrayRule };
|
|
16
15
|
//# sourceMappingURL=array-rules.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array-rules.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/array/array-rules.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"array-rules.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/array/array-rules.ts"],"mappings":";;;;;;qBAMa,iBAAiB;;;;qBAkBjB,iBAAiB;EAC5B"}
|
|
@@ -1,34 +1,33 @@
|
|
|
1
1
|
import { SchemaRule } from "../../types/rule-types.mjs";
|
|
2
|
-
|
|
2
|
+
import "../../types/index.mjs";
|
|
3
3
|
//#region ../../packages/seal/src/rules/color/color-rules.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Generic color rule - validates any color format
|
|
6
6
|
*/
|
|
7
|
-
declare const colorRule: SchemaRule;
|
|
7
|
+
export declare const colorRule: SchemaRule;
|
|
8
8
|
/**
|
|
9
9
|
* Hex color rule
|
|
10
10
|
*/
|
|
11
|
-
declare const hexColorRule: SchemaRule;
|
|
11
|
+
export declare const hexColorRule: SchemaRule;
|
|
12
12
|
/**
|
|
13
13
|
* RGB color rule
|
|
14
14
|
*/
|
|
15
|
-
declare const rgbColorRule: SchemaRule;
|
|
15
|
+
export declare const rgbColorRule: SchemaRule;
|
|
16
16
|
/**
|
|
17
17
|
* RGBA color rule
|
|
18
18
|
*/
|
|
19
|
-
declare const rgbaColorRule: SchemaRule;
|
|
19
|
+
export declare const rgbaColorRule: SchemaRule;
|
|
20
20
|
/**
|
|
21
21
|
* HSL color rule
|
|
22
22
|
*/
|
|
23
|
-
declare const hslColorRule: SchemaRule;
|
|
23
|
+
export declare const hslColorRule: SchemaRule;
|
|
24
24
|
/**
|
|
25
25
|
* Light color rule
|
|
26
26
|
*/
|
|
27
|
-
declare const lightColorRule: SchemaRule;
|
|
27
|
+
export declare const lightColorRule: SchemaRule;
|
|
28
28
|
/**
|
|
29
29
|
* Dark color rule
|
|
30
30
|
*/
|
|
31
|
-
declare const darkColorRule: SchemaRule;
|
|
31
|
+
export declare const darkColorRule: SchemaRule;
|
|
32
32
|
//#endregion
|
|
33
|
-
export { colorRule, darkColorRule, hexColorRule, hslColorRule, lightColorRule, rgbColorRule, rgbaColorRule };
|
|
34
33
|
//# sourceMappingURL=color-rules.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-rules.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/color/color-rules.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"color-rules.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/color/color-rules.ts"],"mappings":";;;;;;qBAgBa,WAAW;;;;qBAqBX,cAAc;;;;qBAcd,cAAc;;;;qBAcd,eAAe;;;;qBAcf,cAAc;;;;qBAcd,gBAAgB;;;;qBAyBhB,eAAe"}
|
|
@@ -1,30 +1,29 @@
|
|
|
1
1
|
import { SchemaRule } from "../../types/rule-types.mjs";
|
|
2
|
-
|
|
2
|
+
import "../../types/index.mjs";
|
|
3
3
|
//#region ../../packages/seal/src/rules/common/enum.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Enum rule - value must be one of the enum values
|
|
6
6
|
*/
|
|
7
|
-
declare const enumRule: SchemaRule<{
|
|
7
|
+
export declare const enumRule: SchemaRule<{
|
|
8
8
|
enum: any;
|
|
9
9
|
}>;
|
|
10
10
|
/**
|
|
11
11
|
* In rule - value must be in the given array
|
|
12
12
|
*/
|
|
13
|
-
declare const inRule: SchemaRule<{
|
|
13
|
+
export declare const inRule: SchemaRule<{
|
|
14
14
|
values: any[];
|
|
15
15
|
}>;
|
|
16
16
|
/**
|
|
17
17
|
* Allowed values rule - value must be one of allowed values
|
|
18
18
|
*/
|
|
19
|
-
declare const allowedValuesRule: SchemaRule<{
|
|
19
|
+
export declare const allowedValuesRule: SchemaRule<{
|
|
20
20
|
allowedValues: any[];
|
|
21
21
|
}>;
|
|
22
22
|
/**
|
|
23
23
|
* Not allowed values rule - value must not be in forbidden list
|
|
24
24
|
*/
|
|
25
|
-
declare const notAllowedValuesRule: SchemaRule<{
|
|
25
|
+
export declare const notAllowedValuesRule: SchemaRule<{
|
|
26
26
|
notAllowedValues: any[];
|
|
27
27
|
}>;
|
|
28
28
|
//#endregion
|
|
29
|
-
export { allowedValuesRule, enumRule, inRule, notAllowedValuesRule };
|
|
30
29
|
//# sourceMappingURL=enum.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enum.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/common/enum.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"enum.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/common/enum.ts"],"mappings":";;;;;;qBAMa,UAAU;EAAa;;;;;qBAwBvB,QAAQ;EAAa;;;;;qBAsBrB,mBAAmB;EAAa;;;;;qBAsBhC,sBAAsB;EAAa"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { SchemaRule } from "../../types/rule-types.mjs";
|
|
2
|
-
|
|
2
|
+
import "../../types/index.mjs";
|
|
3
3
|
//#region ../../packages/seal/src/rules/common/equals-field-rules.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Equals field rule - value must equal another field's value
|
|
6
6
|
* Supports both global and sibling scope
|
|
7
7
|
*/
|
|
8
|
-
declare const equalsFieldRule: SchemaRule<{
|
|
8
|
+
export declare const equalsFieldRule: SchemaRule<{
|
|
9
9
|
field: string;
|
|
10
10
|
scope?: "global" | "sibling";
|
|
11
11
|
}>;
|
|
@@ -13,10 +13,9 @@ declare const equalsFieldRule: SchemaRule<{
|
|
|
13
13
|
* Not equals field rule - value must NOT equal another field's value
|
|
14
14
|
* Supports both global and sibling scope
|
|
15
15
|
*/
|
|
16
|
-
declare const notEqualsFieldRule: SchemaRule<{
|
|
16
|
+
export declare const notEqualsFieldRule: SchemaRule<{
|
|
17
17
|
field: string;
|
|
18
18
|
scope?: "global" | "sibling";
|
|
19
19
|
}>;
|
|
20
20
|
//#endregion
|
|
21
|
-
export { equalsFieldRule, notEqualsFieldRule };
|
|
22
21
|
//# sourceMappingURL=equals-field-rules.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"equals-field-rules.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/common/equals-field-rules.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"equals-field-rules.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/common/equals-field-rules.ts"],"mappings":";;;;;;;qBAOa,iBAAiB;EAC5B;EACA;;;;;;qBAwBW,oBAAoB;EAC/B;EACA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { allowedValuesRule, enumRule, inRule, notAllowedValuesRule } from "./enum.mjs";
|
|
2
|
+
import { equalsFieldRule, notEqualsFieldRule } from "./equals-field-rules.mjs";
|
|
3
|
+
import { instanceofRule } from "./instanceof.mjs";
|
|
4
|
+
import { literalRule } from "./literal.mjs";
|
|
5
|
+
import { arrayRule, booleanRule, floatRule, intRule, numberRule, objectRule, plainObjectRule, scalarRule, stringRule } from "./type-rules.mjs";
|
|
6
|
+
import { unknownKeyRule } from "./unknown-key.mjs";
|
|
7
|
+
export { allowedValuesRule, arrayRule, booleanRule, enumRule, equalsFieldRule, floatRule, inRule, instanceofRule, intRule, literalRule, notAllowedValuesRule, notEqualsFieldRule, numberRule, objectRule, plainObjectRule, scalarRule, stringRule, unknownKeyRule };
|
|
@@ -5,4 +5,4 @@ import { literalRule } from "./literal.mjs";
|
|
|
5
5
|
import { arrayRule, booleanRule, floatRule, intRule, numberRule, objectRule, plainObjectRule, scalarRule, stringRule } from "./type-rules.mjs";
|
|
6
6
|
import { unknownKeyRule } from "./unknown-key.mjs";
|
|
7
7
|
|
|
8
|
-
export {
|
|
8
|
+
export { allowedValuesRule, arrayRule, booleanRule, enumRule, equalsFieldRule, floatRule, inRule, instanceofRule, intRule, literalRule, notAllowedValuesRule, notEqualsFieldRule, numberRule, objectRule, plainObjectRule, scalarRule, stringRule, unknownKeyRule };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SchemaRule } from "../../types/rule-types.mjs";
|
|
2
|
-
|
|
2
|
+
import "../../types/index.mjs";
|
|
3
3
|
//#region ../../packages/seal/src/rules/common/instanceof.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* InstanceOf rule - value must be an instance of the given constructor.
|
|
@@ -7,10 +7,9 @@ import { SchemaRule } from "../../types/rule-types.mjs";
|
|
|
7
7
|
* Uses the `instanceof` operator at runtime. Useful for class instances
|
|
8
8
|
* not representable in JSON Schema (File, Buffer, custom domain classes).
|
|
9
9
|
*/
|
|
10
|
-
declare const instanceofRule: SchemaRule<{
|
|
10
|
+
export declare const instanceofRule: SchemaRule<{
|
|
11
11
|
ctor: new (...args: any[]) => any;
|
|
12
12
|
name: string;
|
|
13
13
|
}>;
|
|
14
14
|
//#endregion
|
|
15
|
-
export { instanceofRule };
|
|
16
15
|
//# sourceMappingURL=instanceof.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instanceof.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/common/instanceof.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"instanceof.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/common/instanceof.ts"],"mappings":";;;;;;;;;qBASa,gBAAgB;EAAa,cAAc;EAAqB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SchemaRule } from "../../types/rule-types.mjs";
|
|
2
|
-
|
|
2
|
+
import "../../types/index.mjs";
|
|
3
3
|
//#region ../../packages/seal/src/rules/common/literal.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Literal rule - value must be strictly equal to one of the literal values.
|
|
@@ -8,9 +8,8 @@ import { SchemaRule } from "../../types/rule-types.mjs";
|
|
|
8
8
|
* true from "true", etc. Mirrors `v.string().oneOf([...])` but at the
|
|
9
9
|
* literal type level (TypeScript narrows to the union of literals).
|
|
10
10
|
*/
|
|
11
|
-
declare const literalRule: SchemaRule<{
|
|
11
|
+
export declare const literalRule: SchemaRule<{
|
|
12
12
|
values: readonly (string | number | boolean)[];
|
|
13
13
|
}>;
|
|
14
14
|
//#endregion
|
|
15
|
-
export { literalRule };
|
|
16
15
|
//# sourceMappingURL=literal.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"literal.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/common/literal.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"literal.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/common/literal.ts"],"mappings":";;;;;;;;;;qBAUa,aAAa;EAAa"}
|
|
@@ -1,42 +1,41 @@
|
|
|
1
1
|
import { SchemaRule } from "../../types/rule-types.mjs";
|
|
2
|
-
|
|
2
|
+
import "../../types/index.mjs";
|
|
3
3
|
//#region ../../packages/seal/src/rules/common/type-rules.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* String rule - validates string type
|
|
6
6
|
*/
|
|
7
|
-
declare const stringRule: SchemaRule;
|
|
7
|
+
export declare const stringRule: SchemaRule;
|
|
8
8
|
/**
|
|
9
9
|
* Number rule - validates number type
|
|
10
10
|
*/
|
|
11
|
-
declare const numberRule: SchemaRule;
|
|
11
|
+
export declare const numberRule: SchemaRule;
|
|
12
12
|
/**
|
|
13
13
|
* Boolean rule - validates boolean type
|
|
14
14
|
*/
|
|
15
|
-
declare const booleanRule: SchemaRule;
|
|
15
|
+
export declare const booleanRule: SchemaRule;
|
|
16
16
|
/**
|
|
17
17
|
* Int rule - validates integer type
|
|
18
18
|
*/
|
|
19
|
-
declare const intRule: SchemaRule;
|
|
19
|
+
export declare const intRule: SchemaRule;
|
|
20
20
|
/**
|
|
21
21
|
* Float rule - validates float type
|
|
22
22
|
*/
|
|
23
|
-
declare const floatRule: SchemaRule;
|
|
23
|
+
export declare const floatRule: SchemaRule;
|
|
24
24
|
/**
|
|
25
25
|
* Scalar rule - validates scalar value (string, number, or boolean)
|
|
26
26
|
*/
|
|
27
|
-
declare const scalarRule: SchemaRule;
|
|
27
|
+
export declare const scalarRule: SchemaRule;
|
|
28
28
|
/**
|
|
29
29
|
* Object rule - validates object type
|
|
30
30
|
*/
|
|
31
|
-
declare const objectRule: SchemaRule;
|
|
31
|
+
export declare const objectRule: SchemaRule;
|
|
32
32
|
/**
|
|
33
33
|
* Object rule - validates object type
|
|
34
34
|
*/
|
|
35
|
-
declare const plainObjectRule: SchemaRule;
|
|
35
|
+
export declare const plainObjectRule: SchemaRule;
|
|
36
36
|
/**
|
|
37
37
|
* Array rule - validates array type
|
|
38
38
|
*/
|
|
39
|
-
declare const arrayRule: SchemaRule;
|
|
39
|
+
export declare const arrayRule: SchemaRule;
|
|
40
40
|
//#endregion
|
|
41
|
-
export { arrayRule, booleanRule, floatRule, intRule, numberRule, objectRule, plainObjectRule, scalarRule, stringRule };
|
|
42
41
|
//# sourceMappingURL=type-rules.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-rules.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/common/type-rules.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"type-rules.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/common/type-rules.ts"],"mappings":";;;;;;qBAOa,YAAY;;;;qBAcZ,YAAY;;;;qBAcZ,aAAa;;;;qBAcb,SAAS;;;;qBAcT,WAAW;;;;qBAcX,YAAY;;;;qBAcZ,YAAY;;;;qBAeZ,iBAAiB;;;;qBAejB,WAAW"}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { Schema } from "../../types/schema-types.mjs";
|
|
2
2
|
import { SchemaRule } from "../../types/rule-types.mjs";
|
|
3
|
-
|
|
3
|
+
import "../../types/index.mjs";
|
|
4
4
|
//#region ../../packages/seal/src/rules/common/unknown-key.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Unknown key rule - validates that object doesn't have unknown keys
|
|
7
7
|
*/
|
|
8
|
-
declare const unknownKeyRule: SchemaRule<{
|
|
8
|
+
export declare const unknownKeyRule: SchemaRule<{
|
|
9
9
|
schema: Schema;
|
|
10
10
|
allowedKeys: string[];
|
|
11
11
|
}>;
|
|
12
12
|
//#endregion
|
|
13
|
-
export { unknownKeyRule };
|
|
14
13
|
//# sourceMappingURL=unknown-key.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unknown-key.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/common/unknown-key.ts"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"unknown-key.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/common/unknown-key.ts"],"mappings":";;;;;;;qBAMa,gBAAgB;EAC3B,QAAQ;EACR"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { SchemaRule } from "../../types/rule-types.mjs";
|
|
2
|
-
|
|
2
|
+
import "../../types/index.mjs";
|
|
3
3
|
//#region ../../packages/seal/src/rules/conditional/forbidden-if-rules.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Forbidden if rule - field is forbidden if another field equals a specific value
|
|
6
6
|
* Supports both global and sibling scope
|
|
7
7
|
*/
|
|
8
|
-
declare const forbiddenIfRule: SchemaRule<{
|
|
8
|
+
export declare const forbiddenIfRule: SchemaRule<{
|
|
9
9
|
field: string;
|
|
10
10
|
value: any;
|
|
11
11
|
scope?: "global" | "sibling";
|
|
@@ -14,7 +14,7 @@ declare const forbiddenIfRule: SchemaRule<{
|
|
|
14
14
|
* Forbidden if not rule - field is forbidden if another field does NOT equal a specific value
|
|
15
15
|
* Supports both global and sibling scope
|
|
16
16
|
*/
|
|
17
|
-
declare const forbiddenIfNotRule: SchemaRule<{
|
|
17
|
+
export declare const forbiddenIfNotRule: SchemaRule<{
|
|
18
18
|
field: string;
|
|
19
19
|
value: any;
|
|
20
20
|
scope?: "global" | "sibling";
|
|
@@ -23,7 +23,7 @@ declare const forbiddenIfNotRule: SchemaRule<{
|
|
|
23
23
|
* Forbidden if empty rule - field is forbidden if another field is empty
|
|
24
24
|
* Supports both global and sibling scope
|
|
25
25
|
*/
|
|
26
|
-
declare const forbiddenIfEmptyRule: SchemaRule<{
|
|
26
|
+
export declare const forbiddenIfEmptyRule: SchemaRule<{
|
|
27
27
|
field: string;
|
|
28
28
|
scope?: "global" | "sibling";
|
|
29
29
|
}>;
|
|
@@ -31,7 +31,7 @@ declare const forbiddenIfEmptyRule: SchemaRule<{
|
|
|
31
31
|
* Forbidden if not empty rule - field is forbidden if another field is not empty
|
|
32
32
|
* Supports both global and sibling scope
|
|
33
33
|
*/
|
|
34
|
-
declare const forbiddenIfNotEmptyRule: SchemaRule<{
|
|
34
|
+
export declare const forbiddenIfNotEmptyRule: SchemaRule<{
|
|
35
35
|
field: string;
|
|
36
36
|
scope?: "global" | "sibling";
|
|
37
37
|
}>;
|
|
@@ -39,7 +39,7 @@ declare const forbiddenIfNotEmptyRule: SchemaRule<{
|
|
|
39
39
|
* Forbidden if in rule - field is forbidden if another field's value is in the given array
|
|
40
40
|
* Supports both global and sibling scope
|
|
41
41
|
*/
|
|
42
|
-
declare const forbiddenIfInRule: SchemaRule<{
|
|
42
|
+
export declare const forbiddenIfInRule: SchemaRule<{
|
|
43
43
|
field: string;
|
|
44
44
|
values: any[];
|
|
45
45
|
scope?: "global" | "sibling";
|
|
@@ -48,11 +48,10 @@ declare const forbiddenIfInRule: SchemaRule<{
|
|
|
48
48
|
* Forbidden if not in rule - field is forbidden if another field's value is NOT in the given array
|
|
49
49
|
* Supports both global and sibling scope
|
|
50
50
|
*/
|
|
51
|
-
declare const forbiddenIfNotInRule: SchemaRule<{
|
|
51
|
+
export declare const forbiddenIfNotInRule: SchemaRule<{
|
|
52
52
|
field: string;
|
|
53
53
|
values: any[];
|
|
54
54
|
scope?: "global" | "sibling";
|
|
55
55
|
}>;
|
|
56
56
|
//#endregion
|
|
57
|
-
export { forbiddenIfEmptyRule, forbiddenIfInRule, forbiddenIfNotEmptyRule, forbiddenIfNotInRule, forbiddenIfNotRule, forbiddenIfRule };
|
|
58
57
|
//# sourceMappingURL=forbidden-if-rules.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forbidden-if-rules.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/conditional/forbidden-if-rules.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"forbidden-if-rules.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/conditional/forbidden-if-rules.ts"],"mappings":";;;;;;;qBAQa,iBAAiB;EAC5B;EACA;EACA;;;;;;qBAyBW,oBAAoB;EAC/B;EACA;EACA;;;;;;qBAuBW,sBAAsB;EACjC;EACA;;;;;;qBAsBW,yBAAyB;EACpC;EACA;;;;;;qBAsBW,mBAAmB;EAC9B;EACA;EACA;;;;;;qBAyBW,sBAAsB;EACjC;EACA;EACA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { requiredIfAllEmptyRule, requiredIfAllNotEmptyRule, requiredIfAnyEmptyRule, requiredIfAnyNotEmptyRule, requiredIfEmptyRule, requiredIfInRule, requiredIfNotEmptyRule, requiredIfNotInRule, requiredIfRule } from "./required-if-rules.mjs";
|
|
2
|
+
import { requiredUnlessRule } from "./required-unless-rules.mjs";
|
|
3
|
+
import { requiredWhenRule } from "./required-when-rule.mjs";
|
|
4
|
+
import { requiredWithAllRule, requiredWithAnyRule, requiredWithRule } from "./required-with-rules.mjs";
|
|
5
|
+
import { requiredWithoutAllRule, requiredWithoutAnyRule, requiredWithoutRule } from "./required-without-rules.mjs";
|
|
6
|
+
import { presentIfEmptyRule, presentIfInRule, presentIfNotEmptyRule, presentIfNotInRule, presentIfRule } from "./present-if-rules.mjs";
|
|
7
|
+
import { presentUnlessRule } from "./present-unless-rules.mjs";
|
|
8
|
+
import { presentWithAllRule, presentWithAnyRule, presentWithRule } from "./present-with-rules.mjs";
|
|
9
|
+
import { presentWithoutAllRule, presentWithoutAnyRule, presentWithoutRule } from "./present-without-rules.mjs";
|
|
10
|
+
import { forbiddenIfEmptyRule, forbiddenIfInRule, forbiddenIfNotEmptyRule, forbiddenIfNotInRule, forbiddenIfNotRule, forbiddenIfRule } from "./forbidden-if-rules.mjs";
|
|
11
|
+
export { forbiddenIfEmptyRule, forbiddenIfInRule, forbiddenIfNotEmptyRule, forbiddenIfNotInRule, forbiddenIfNotRule, forbiddenIfRule, presentIfEmptyRule, presentIfInRule, presentIfNotEmptyRule, presentIfNotInRule, presentIfRule, presentUnlessRule, presentWithAllRule, presentWithAnyRule, presentWithRule, presentWithoutAllRule, presentWithoutAnyRule, presentWithoutRule, requiredIfAllEmptyRule, requiredIfAllNotEmptyRule, requiredIfAnyEmptyRule, requiredIfAnyNotEmptyRule, requiredIfEmptyRule, requiredIfInRule, requiredIfNotEmptyRule, requiredIfNotInRule, requiredIfRule, requiredUnlessRule, requiredWhenRule, requiredWithAllRule, requiredWithAnyRule, requiredWithRule, requiredWithoutAllRule, requiredWithoutAnyRule, requiredWithoutRule };
|
|
@@ -9,4 +9,4 @@ import { presentWithAllRule, presentWithAnyRule, presentWithRule } from "./prese
|
|
|
9
9
|
import { presentWithoutAllRule, presentWithoutAnyRule, presentWithoutRule } from "./present-without-rules.mjs";
|
|
10
10
|
import { forbiddenIfEmptyRule, forbiddenIfInRule, forbiddenIfNotEmptyRule, forbiddenIfNotInRule, forbiddenIfNotRule, forbiddenIfRule } from "./forbidden-if-rules.mjs";
|
|
11
11
|
|
|
12
|
-
export {
|
|
12
|
+
export { forbiddenIfEmptyRule, forbiddenIfInRule, forbiddenIfNotEmptyRule, forbiddenIfNotInRule, forbiddenIfNotRule, forbiddenIfRule, presentIfEmptyRule, presentIfInRule, presentIfNotEmptyRule, presentIfNotInRule, presentIfRule, presentUnlessRule, presentWithAllRule, presentWithAnyRule, presentWithRule, presentWithoutAllRule, presentWithoutAnyRule, presentWithoutRule, requiredIfAllEmptyRule, requiredIfAllNotEmptyRule, requiredIfAnyEmptyRule, requiredIfAnyNotEmptyRule, requiredIfEmptyRule, requiredIfInRule, requiredIfNotEmptyRule, requiredIfNotInRule, requiredIfRule, requiredUnlessRule, requiredWhenRule, requiredWithAllRule, requiredWithAnyRule, requiredWithRule, requiredWithoutAllRule, requiredWithoutAnyRule, requiredWithoutRule };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { SchemaRule } from "../../types/rule-types.mjs";
|
|
2
|
-
|
|
2
|
+
import "../../types/index.mjs";
|
|
3
3
|
//#region ../../packages/seal/src/rules/conditional/present-if-rules.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Present if rule - field must be present if another field equals a specific value
|
|
6
6
|
* Supports both global and sibling scope
|
|
7
7
|
*/
|
|
8
|
-
declare const presentIfRule: SchemaRule<{
|
|
8
|
+
export declare const presentIfRule: SchemaRule<{
|
|
9
9
|
field: string;
|
|
10
10
|
value: any;
|
|
11
11
|
scope?: "global" | "sibling";
|
|
@@ -14,7 +14,7 @@ declare const presentIfRule: SchemaRule<{
|
|
|
14
14
|
* Present if empty rule - field must be present if another field is empty
|
|
15
15
|
* Supports both global and sibling scope
|
|
16
16
|
*/
|
|
17
|
-
declare const presentIfEmptyRule: SchemaRule<{
|
|
17
|
+
export declare const presentIfEmptyRule: SchemaRule<{
|
|
18
18
|
field: string;
|
|
19
19
|
scope?: "global" | "sibling";
|
|
20
20
|
}>;
|
|
@@ -22,7 +22,7 @@ declare const presentIfEmptyRule: SchemaRule<{
|
|
|
22
22
|
* Present if not empty rule - field must be present if another field is not empty
|
|
23
23
|
* Supports both global and sibling scope
|
|
24
24
|
*/
|
|
25
|
-
declare const presentIfNotEmptyRule: SchemaRule<{
|
|
25
|
+
export declare const presentIfNotEmptyRule: SchemaRule<{
|
|
26
26
|
field: string;
|
|
27
27
|
scope?: "global" | "sibling";
|
|
28
28
|
}>;
|
|
@@ -30,7 +30,7 @@ declare const presentIfNotEmptyRule: SchemaRule<{
|
|
|
30
30
|
* Present if in rule - field must be present if another field's value is in the given array
|
|
31
31
|
* Supports both global and sibling scope
|
|
32
32
|
*/
|
|
33
|
-
declare const presentIfInRule: SchemaRule<{
|
|
33
|
+
export declare const presentIfInRule: SchemaRule<{
|
|
34
34
|
field: string;
|
|
35
35
|
values: any[];
|
|
36
36
|
scope?: "global" | "sibling";
|
|
@@ -39,11 +39,10 @@ declare const presentIfInRule: SchemaRule<{
|
|
|
39
39
|
* Present if not in rule - field must be present if another field's value is NOT in the given array
|
|
40
40
|
* Supports both global and sibling scope
|
|
41
41
|
*/
|
|
42
|
-
declare const presentIfNotInRule: SchemaRule<{
|
|
42
|
+
export declare const presentIfNotInRule: SchemaRule<{
|
|
43
43
|
field: string;
|
|
44
44
|
values: any[];
|
|
45
45
|
scope?: "global" | "sibling";
|
|
46
46
|
}>;
|
|
47
47
|
//#endregion
|
|
48
|
-
export { presentIfEmptyRule, presentIfInRule, presentIfNotEmptyRule, presentIfNotInRule, presentIfRule };
|
|
49
48
|
//# sourceMappingURL=present-if-rules.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"present-if-rules.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/conditional/present-if-rules.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"present-if-rules.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/conditional/present-if-rules.ts"],"mappings":";;;;;;;qBAQa,eAAe;EAC1B;EACA;EACA;;;;;;qBA0BW,oBAAoB;EAC/B;EACA;;;;;;qBAuBW,uBAAuB;EAClC;EACA;;;;;;qBAuBW,iBAAiB;EAC5B;EACA;EACA;;;;;;qBAwBW,oBAAoB;EAC/B;EACA;EACA"}
|