(
issues: readonly { path: readonly PropertyKey[]; message: string }[],
requestId: string,
)
| 623 | } |
| 624 | |
| 625 | function buildValidationEnvelope( |
| 626 | issues: readonly { path: readonly PropertyKey[]; message: string }[], |
| 627 | requestId: string, |
| 628 | ): { |
| 629 | code: number; |
| 630 | msg: string; |
| 631 | data: null; |
| 632 | request_id: string; |
| 633 | details: { path: string; message: string }[]; |
| 634 | } { |
| 635 | const details = issues.map((i) => ({ |
| 636 | path: i.path.map((p) => String(p)).join('.'), |
| 637 | message: i.message, |
| 638 | })); |
| 639 | const first = details[0]; |
| 640 | const msg = first === undefined |
| 641 | ? 'validation failed' |
| 642 | : first.path === '' |
| 643 | ? first.message |
| 644 | : `${first.path}: ${first.message}`; |
| 645 | return { |
| 646 | code: ErrorCode.VALIDATION_FAILED, |
| 647 | msg, |
| 648 | data: null, |
| 649 | request_id: requestId, |
| 650 | details, |
| 651 | }; |
| 652 | } |
| 653 | |
| 654 | function pickHeader( |
| 655 | headers: Record<string, string | string[] | undefined>, |
no outgoing calls
no test coverage detected