{"version":3,"file":"W3cV2DataIntegrityIssueMapping.mjs","names":[],"sources":["../../../../src/modules/vc/data-integrity/W3cV2DataIntegrityIssueMapping.ts"],"sourcesContent":["import { CredoError } from '../../../error'\nimport { ClaimFormat } from '../models/ClaimFormat'\n\nexport interface W3cV2DataIntegrityIssue {\n  code: string\n  message: string\n  path?: string\n}\n\nexport function mapDataIntegrityIssuesToCredoError(options: {\n  operation: 'signCredential' | 'verifyCredential' | 'signPresentation' | 'verifyPresentation'\n  claimFormat: ClaimFormat.DiVc | ClaimFormat.DiVp\n  issues?: W3cV2DataIntegrityIssue[]\n}): CredoError | undefined {\n  const issues = options.issues ?? []\n  if (issues.length === 0) return undefined\n\n  const details = issues\n    .map((issue) => {\n      const location = issue.path ? ` (path: ${issue.path})` : ''\n      return `[${issue.code}] ${issue.message}${location}`\n    })\n    .join('; ')\n\n  return new CredoError(\n    `Data Integrity ${options.operation} for '${options.claimFormat}' reported ${issues.length} issue(s): ${details}`\n  )\n}\n"],"mappings":";;;AASA,SAAgB,mCAAmC,SAIxB;CACzB,MAAM,SAAS,QAAQ,UAAU,CAAC;CAClC,IAAI,OAAO,WAAW,GAAG,OAAO,KAAA;CAEhC,MAAM,UAAU,OACb,KAAK,UAAU;EACd,MAAM,WAAW,MAAM,OAAO,WAAW,MAAM,KAAK,KAAK;EACzD,OAAO,IAAI,MAAM,KAAK,IAAI,MAAM,UAAU;CAC5C,CAAC,CAAC,CACD,KAAK,IAAI;CAEZ,OAAO,IAAI,WACT,kBAAkB,QAAQ,UAAU,QAAQ,QAAQ,YAAY,aAAa,OAAO,OAAO,aAAa,SAC1G;AACF"}