{"version":3,"file":"validation-error.mjs","sources":["../../src/utils/validation-error.mts"],"sourcesContent":["import { isMap, isSet } from '@sindresorhus/is';\nimport { Arr, isString, match, pipe, unknownToString } from 'ts-data-forge';\nimport { toUnionString } from './to-union-string.mjs';\n\nexport type ValidationErrorDetails = Readonly<\n  | {\n      kind: 'custom';\n      message: string;\n    }\n  | {\n      kind: 'template-literal';\n    }\n  | {\n      kind: 'enum';\n      values: readonly unknown[];\n    }\n  | {\n      kind: 'integer-range';\n      start: number;\n      endExclusive: number;\n    }\n  | {\n      kind: 'integer-range-inclusive';\n      start: number;\n      endInclusive: number;\n    }\n  | {\n      kind: 'tuple-length';\n      expectedLength: number;\n      actualLength: number;\n    }\n  | {\n      kind: 'array-length';\n      expectedLength: number;\n      actualLength: number;\n    }\n  | {\n      kind: 'array-min-length';\n      minLength: number;\n      actualLength: number;\n    }\n  | {\n      kind: 'array-max-length';\n      maxLength: number;\n      actualLength: number;\n    }\n  | {\n      kind: 'array-range-length';\n      minLength: number;\n      maxLength: number;\n      actualLength: number;\n    }\n  | {\n      kind: 'non-empty-array';\n    }\n  | {\n      kind: 'missing-key';\n      key: string;\n    }\n  | {\n      kind: 'excess-key';\n      key: string;\n    }\n  | {\n      kind: 'intersection';\n      typeNames: readonly string[];\n    }\n  | {\n      kind: 'union';\n      typeNames: readonly string[];\n    }\n  | {\n      kind: 'union-category-mismatch';\n      memberCount: number;\n      memberCategories: readonly string[];\n    }\n  | {\n      kind: 'union-closest-member';\n      memberCount: number;\n      /** The member whose errors follow the message. */\n      closestMemberTypeName: string;\n      /**\n       * Members that produced the same number of errors as\n       * {@link ValidationErrorDetails.closestMemberTypeName} and are therefore\n       * just as plausible. Empty when the closest member is unambiguous.\n       */\n      equallyCloseMemberTypeNames: readonly string[];\n    }\n  | {\n      kind: 'record-entry';\n      entry: 'key' | 'value';\n      expectedType: string;\n    }\n  | {\n      kind: 'map-entry';\n      entry: 'key' | 'value';\n      expectedType: string;\n    }\n  | {\n      kind: 'set-element';\n      expectedType: string;\n    }\n  | {\n      kind: 'brand';\n      description: string;\n    }\n  | {\n      kind: 'string-constraint';\n      violation: StringConstraintViolation;\n    }\n  | {\n      kind: 'numeric-constraint';\n      numericType: 'bigint' | 'number';\n      violation: NumericConstraintViolation;\n    }\n>;\n\n/**\n * Describes which `string` constraint (see the `string` codec) a value failed,\n * together with the constraint's configured value. `value` doubles as the\n * value shown in the constructor-time \"defaultValue ... does not satisfy the\n * constraint ...\" message, so it mirrors the raw constraint input (the flag\n * constraints carry `true`, `regex` carries its `source`).\n */\nexport type StringConstraintViolation = Readonly<\n  | {\n      constraint: 'nonempty' | 'lowercase' | 'uppercase';\n      value: true;\n    }\n  | {\n      constraint: 'minLength' | 'maxLength';\n      value: number;\n    }\n  | {\n      constraint: 'startsWith' | 'endsWith' | 'includes';\n      value: string;\n    }\n  | {\n      constraint: 'regex';\n      value: string;\n    }\n>;\n\n/**\n * Describes which numeric constraint (see the `number` / `bigint` codecs) a\n * value failed. Range bounds are stringified so a single type can describe both\n * `number` and `bigint` violations; `value` doubles as the value shown in the\n * constructor-time \"defaultValue ... does not satisfy the constraint ...\"\n * message.\n */\nexport type NumericConstraintViolation = Readonly<\n  | {\n      constraint:\n        | 'finite'\n        | 'int'\n        | 'safeInteger'\n        | 'nonZero'\n        | 'negative'\n        | 'nonNegative'\n        | 'positive'\n        | 'nonPositive';\n      value: true;\n    }\n  | {\n      constraint:\n        'gt' | 'gte' | 'min' | 'lt' | 'lte' | 'max' | 'multipleOf' | 'step';\n      value: string;\n    }\n>;\n\n/**\n * Represents a validation error with structured information\n */\nexport type ValidationError = Readonly<{\n  /** The path to the field that failed validation (e.g., 'user.address.street') */\n  path: readonly string[];\n  /** The actual value that failed validation */\n  actualValue: unknown;\n  /** The expected type or constraint */\n  expectedType: string;\n  /** The name of the type that was being validated */\n  typeName: string;\n  /** Optional structured information used to construct a descriptive message */\n  details?: ValidationErrorDetails | undefined;\n}>;\n\n/**\n * Converts a validation error to a human-readable string message\n */\nexport const validationErrorToMessage = (\n  error: ValidationError,\n  maxLengthToPrintActualValue: number = 20,\n): string => {\n  const pathPrefix = Arr.isNonEmpty(error.path)\n    ? (`Error at ${error.path.join('.')}: ` as const)\n    : 'Error: ';\n\n  const actualValue = describeActualValue(\n    error.actualValue,\n    maxLengthToPrintActualValue,\n  );\n\n  const detailsMessage = createDetailsMessage(error, actualValue);\n\n  return `${pathPrefix}${\n    detailsMessage ??\n    `expected <${error.expectedType}> type but ${typedValueClause(actualValue)} was passed.`\n  }`;\n};\n\n/**\n * Human-readable name for the runtime type of a value.\n *\n * `typeof` reports a bare `\"object\"` for `null` and for every non-primitive,\n * which makes an error message unable to distinguish a plain object from\n * `null` or from the basic containers, so those are named individually.\n */\nexport const runtimeTypeNameOf = (value: unknown): string =>\n  value === null\n    ? 'null'\n    : Arr.isArray(value)\n      ? 'array'\n      : isMap(value)\n        ? 'Map'\n        : isSet(value)\n          ? 'Set'\n          : typeof value;\n\n/** A value as it is rendered inside an error message. */\ntype ActualValueView = Readonly<{\n  /** See {@link runtimeTypeNameOf}. */\n  typeName: string;\n\n  /**\n   * The value itself (`\"purple\"`, `` `5` ``), or `''` when it is longer than\n   * the configured maximum print length.\n   */\n  literal: string;\n\n  /**\n   * Replaces {@link literal} when the value is too long to print. Keeps the\n   * message informative by describing the value's size instead of dropping it\n   * entirely (e.g. `a string of length 50`).\n   */\n  summary: string;\n}>;\n\nconst describeActualValue = (\n  actualValue: unknown,\n  maxLengthToPrintActualValue: number,\n): ActualValueView =>\n  ({\n    typeName: runtimeTypeNameOf(actualValue),\n    literal: isString(actualValue)\n      ? actualValue.length <= maxLengthToPrintActualValue\n        ? (`\"${actualValue}\"` as const)\n        : ('' as const)\n      : pipe(unknownToString(actualValue)).map((s) =>\n          s.length <= maxLengthToPrintActualValue ? (`\\`${s}\\`` as const) : '',\n        ).value,\n    summary: summarizeActualValue(actualValue),\n  }) as const;\n\nconst summarizeActualValue = (actualValue: unknown): string =>\n  isString(actualValue)\n    ? (`a string of length ${actualValue.length}` as const)\n    : Arr.isArray(actualValue)\n      ? (`an array of length ${actualValue.length}` as const)\n      : isMap(actualValue)\n        ? (`a Map of size ${actualValue.size}` as const)\n        : isSet(actualValue)\n          ? (`a Set of size ${actualValue.size}` as const)\n          : (`a value of type <${runtimeTypeNameOf(actualValue)}>` as const);\n\n/**\n * Renders the subject of the trailing `\"... was passed.\"` clause, prefixed\n * with the value's runtime type (`<string> type value \"purple\"`).\n *\n * `unmatchedReason` is used only when the value is too long to print: for a\n * type that accepts several shapes (a union, an enum, an intersection),\n * naming the runtime type alone reads as if that type were acceptable, so the\n * reason why the value was rejected has to be spelled out instead.\n */\nconst typedValueClause = (\n  actualValue: ActualValueView,\n  unmatchedReason?: string,\n): string =>\n  actualValue.literal === ''\n    ? withUnmatchedReason(actualValue.summary, unmatchedReason)\n    : (`<${actualValue.typeName}> type value ${actualValue.literal}` as const);\n\n/** Same as {@link typedValueClause}, but without the leading type name. */\nconst bareValueClause = (\n  actualValue: ActualValueView,\n  unmatchedReason?: string,\n): string =>\n  actualValue.literal === ''\n    ? withUnmatchedReason(actualValue.summary, unmatchedReason)\n    : actualValue.literal;\n\nconst withUnmatchedReason = (\n  summary: string,\n  unmatchedReason: string | undefined,\n): string =>\n  unmatchedReason === undefined\n    ? summary\n    : (`${summary} ${unmatchedReason}` as const);\n\n/**\n * Maximum length of the ` | `-joined listing of union member type names that a\n * message may spell out. Beyond it a listing is more noise than help, so both\n * users of this bound summarize instead: `union` switches from listing every\n * member to reporting the closest one, and the closest-member message stops\n * naming the members that tie with it.\n */\nexport const UNION_MEMBER_LISTING_MAX_LENGTH = 60;\n\n/**\n * Names the closest union member, plus the members that are just as close.\n *\n * The tie is a subset of members that were already too many to list, so the\n * bound is applied to the names this clause *adds* — the closest member is\n * named either way.\n */\nconst closestMemberClause = (\n  closestMemberTypeName: string,\n  equallyCloseMemberTypeNames: readonly string[],\n): string => {\n  if (!Arr.isNonEmpty(equallyCloseMemberTypeNames)) {\n    return `the closest member type is <${closestMemberTypeName}>, which failed as follows:`;\n  }\n\n  if (\n    toUnionString(equallyCloseMemberTypeNames).length >\n    UNION_MEMBER_LISTING_MAX_LENGTH\n  ) {\n    return `${equallyCloseMemberTypeNames.length + 1} members are equally close; <${closestMemberTypeName}> failed as follows:`;\n  }\n\n  const allTypeNames = Arr.toUnshifted(closestMemberTypeName)(\n    equallyCloseMemberTypeNames,\n  );\n\n  return `the closest member types are <${allTypeNames.join('>, <')}>; the first of them failed as follows:`;\n};\n\nconst createDetailsMessage = (\n  error: ValidationError,\n  actualValue: ActualValueView,\n): string | undefined => {\n  switch (error.details?.kind) {\n    case undefined:\n      return undefined;\n\n    case 'custom':\n      return error.details.message;\n\n    case 'template-literal':\n      return `expected <${error.expectedType}> but ${typedValueClause(actualValue)} was passed.`;\n\n    case 'integer-range':\n      return `expected an integer between ${error.details.start} and ${error.details.endExclusive - 1} but ${bareValueClause(actualValue)} was passed.`;\n\n    case 'integer-range-inclusive':\n      return `expected an integer between ${error.details.start} and ${error.details.endInclusive} but ${bareValueClause(actualValue)} was passed.`;\n\n    case 'tuple-length':\n      return `expected tuple of length ${error.details.expectedLength} but length ${error.details.actualLength} was passed.`;\n\n    case 'array-length':\n      return `expected array of length ${error.details.expectedLength} but length ${error.details.actualLength} was passed.`;\n\n    case 'array-min-length':\n      return `expected array of length ${error.details.minLength} or more but length ${error.details.actualLength} was passed.`;\n\n    case 'array-max-length':\n      return `expected array of length ${error.details.maxLength} or less but length ${error.details.actualLength} was passed.`;\n\n    case 'array-range-length':\n      return `expected array of length between ${error.details.minLength} and ${error.details.maxLength} but length ${error.details.actualLength} was passed.`;\n\n    case 'non-empty-array':\n      return 'expected non-empty array but empty array was passed.';\n\n    case 'missing-key':\n      return `missing required key \"${error.details.key}\".`;\n\n    case 'excess-key':\n      return `excess property \"${error.details.key}\" is not allowed.`;\n\n    case 'intersection':\n      return `expected value to match all types of <${error.details.typeNames.join('>, <')}> but ${typedValueClause(actualValue, 'not matching all of them')} was passed.`;\n\n    case 'enum':\n      return `expected one of { ${error.details.values\n        .map(String)\n        .join(\n          ', ',\n        )} } but ${bareValueClause(actualValue, 'matching none of them')} was passed.`;\n\n    case 'union':\n      return `expected one of <${error.details.typeNames.join('>, <')}> but ${typedValueClause(actualValue, 'matching none of them')} was passed.`;\n\n    case 'union-category-mismatch':\n      return `the value did not match any of the ${error.details.memberCount} members of the union; expected a value of type <${error.details.memberCategories.join('> | <')}> but ${typedValueClause(actualValue)} was passed.`;\n\n    case 'union-closest-member':\n      return `the value did not match any of the ${error.details.memberCount} members of the union; ${closestMemberClause(\n        error.details.closestMemberTypeName,\n        error.details.equallyCloseMemberTypeNames,\n      )}`;\n\n    case 'record-entry':\n      return match(error.details.entry, {\n        key: `expected record key type to be <${error.details.expectedType}> but ${typedValueClause(actualValue)} was passed.`,\n        value: `expected record value type to be <${error.details.expectedType}> but ${typedValueClause(actualValue)} was passed.`,\n      });\n\n    case 'map-entry':\n      return match(error.details.entry, {\n        key: `expected Map key type to be <${error.details.expectedType}> but ${typedValueClause(actualValue)} was passed.`,\n        value: `expected Map value type to be <${error.details.expectedType}> but ${typedValueClause(actualValue)} was passed.`,\n      });\n\n    case 'set-element':\n      return `expected Set element type to be <${error.details.expectedType}> but ${typedValueClause(actualValue)} was passed.`;\n\n    case 'brand':\n      return `expected value to satisfy constraint: ${error.details.description}.`;\n\n    case 'string-constraint':\n      return stringConstraintToMessage(\n        error.details.violation,\n        error.actualValue,\n        actualValue,\n      );\n\n    case 'numeric-constraint':\n      return numericConstraintToMessage(\n        error.details.numericType,\n        error.details.violation,\n        actualValue,\n      );\n  }\n};\n\nconst stringConstraintToMessage = (\n  violation: StringConstraintViolation,\n  rawActualValue: unknown,\n  actualValue: ActualValueView,\n): string => {\n  const actualLength = isString(rawActualValue) ? rawActualValue.length : 0;\n\n  // The length carries the constraint violation, so the value itself is only\n  // appended when it is short enough to print.\n  const lengthClause =\n    actualValue.literal === ''\n      ? (`a string of length ${actualLength}` as const)\n      : (`a string of length ${actualLength} ${actualValue.literal}` as const);\n\n  switch (violation.constraint) {\n    case 'nonempty':\n      return 'expected a non-empty string but an empty string was passed.';\n\n    case 'minLength':\n      return `expected a string of length ${violation.value} or more but ${lengthClause} was passed.`;\n\n    case 'maxLength':\n      return `expected a string of length ${violation.value} or less but ${lengthClause} was passed.`;\n\n    case 'startsWith':\n      return `expected a string starting with \"${violation.value}\" but ${bareValueClause(actualValue)} was passed.`;\n\n    case 'endsWith':\n      return `expected a string ending with \"${violation.value}\" but ${bareValueClause(actualValue)} was passed.`;\n\n    case 'includes':\n      return `expected a string containing \"${violation.value}\" but ${bareValueClause(actualValue)} was passed.`;\n\n    case 'uppercase':\n      return `expected an uppercase string but ${bareValueClause(actualValue)} was passed.`;\n\n    case 'lowercase':\n      return `expected a lowercase string but ${bareValueClause(actualValue)} was passed.`;\n\n    case 'regex':\n      return `expected a string matching /${violation.value}/ but ${bareValueClause(actualValue)} was passed.`;\n  }\n};\n\nconst numericConstraintToMessage = (\n  numericType: 'bigint' | 'number',\n  violation: NumericConstraintViolation,\n  actualValue: ActualValueView,\n): string => {\n  switch (violation.constraint) {\n    case 'finite':\n      return `expected a finite number but ${bareValueClause(actualValue)} was passed.`;\n\n    case 'int':\n      return `expected an integer but ${bareValueClause(actualValue)} was passed.`;\n\n    case 'safeInteger':\n      return `expected a safe integer but ${bareValueClause(actualValue)} was passed.`;\n\n    case 'nonZero':\n      return `expected a non-zero ${numericType} but ${bareValueClause(actualValue)} was passed.`;\n\n    case 'negative':\n      return `expected a negative ${numericType} but ${bareValueClause(actualValue)} was passed.`;\n\n    case 'nonNegative':\n      return `expected a non-negative ${numericType} but ${bareValueClause(actualValue)} was passed.`;\n\n    case 'positive':\n      return `expected a positive ${numericType} but ${bareValueClause(actualValue)} was passed.`;\n\n    case 'nonPositive':\n      return `expected a non-positive ${numericType} but ${bareValueClause(actualValue)} was passed.`;\n\n    case 'gt':\n      return `expected a ${numericType} greater than ${violation.value} but ${bareValueClause(actualValue)} was passed.`;\n\n    case 'gte':\n    case 'min':\n      return `expected a ${numericType} greater than or equal to ${violation.value} but ${bareValueClause(actualValue)} was passed.`;\n\n    case 'lt':\n      return `expected a ${numericType} less than ${violation.value} but ${bareValueClause(actualValue)} was passed.`;\n\n    case 'lte':\n    case 'max':\n      return `expected a ${numericType} less than or equal to ${violation.value} but ${bareValueClause(actualValue)} was passed.`;\n\n    case 'multipleOf':\n    case 'step':\n      return `expected a ${numericType} to be a multiple of ${violation.value} but ${bareValueClause(actualValue)} was passed.`;\n  }\n};\n\n/**\n * Converts an array of validation errors to an array of string messages\n * (for backward compatibility)\n */\nexport const validationErrorsToMessages = (\n  errors: readonly ValidationError[],\n  maxLengthToPrintActualValue: number = 20,\n): readonly string[] =>\n  errors.map((e) => validationErrorToMessage(e, maxLengthToPrintActualValue));\n\n/**\n * Prepends a path segment to all validation errors\n */\nexport const prependPathToValidationErrors = (\n  errors: readonly ValidationError[],\n  pathSegment: string,\n): readonly ValidationError[] =>\n  errors.map((error) => ({\n    ...error,\n    path: Arr.toUnshifted(pathSegment)(error.path),\n  }));\n\n/**\n * Prepends an array index to all validation errors\n */\nexport const prependIndexToValidationErrors = (\n  errors: readonly ValidationError[],\n  index: number,\n): readonly ValidationError[] =>\n  prependPathToValidationErrors(errors, index.toString());\n\n/**\n * Creates a basic validation error for primitive type validation\n */\nexport const createPrimitiveValidationError = ({\n  actualValue,\n  expectedType,\n  typeName,\n  details,\n}: Readonly<{\n  actualValue: unknown;\n  expectedType: string;\n  typeName: string;\n  details: ValidationErrorDetails | undefined;\n}>): ValidationError =>\n  ({\n    path: [],\n    actualValue,\n    expectedType,\n    typeName,\n    details,\n  }) as const;\n"],"names":[],"mappings":";;;;AA6LO,MAAM,wBAAA,GAA2B,CACtC,KAAA,EACA,2BAAA,GAAsC,EAAA,KAC3B;AACX,EAAA,MAAM,UAAA,GAAa,GAAA,CAAI,UAAA,CAAW,KAAA,CAAM,IAAI,CAAA,GACvC,CAAA,SA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