( value: unknown, validator: Validator, path: PropertyPath, side: WrapSide, mode: ValidationMode )
| 765 | } |
| 766 | |
| 767 | function validateResolvedValue( |
| 768 | value: unknown, |
| 769 | validator: Validator, |
| 770 | path: PropertyPath, |
| 771 | side: WrapSide, |
| 772 | mode: ValidationMode |
| 773 | ): unknown { |
| 774 | // Only the receiver validates. Returns are received by the client, so it |
| 775 | // checks them; the server is the sender and only wraps nested capabilities. |
| 776 | if (side === "client") { |
| 777 | if (mode === "warn") { |
| 778 | try { |
| 779 | validator(value, path); |
| 780 | } catch (err) { |
| 781 | // Validation failed: warn and pass the original value through unwrapped. |
| 782 | reportValidationFailure(err); |
| 783 | return value; |
| 784 | } |
| 785 | } else { |
| 786 | validator(value, path); |
| 787 | } |
| 788 | } |
| 789 | return wrapResolvedValue(value, validator, path, side); |
| 790 | } |
| 791 | |
| 792 | function wrapResolvedValue( |
| 793 | value: unknown, |
no test coverage detected
searching dependent graphs…