| 1 |
import { type DescEnum, type DescField, type DescMessage, ScalarType } from "../descriptors.js"; |
| 2 |
import { FieldError } from "./error.js"; |
| 3 |
/** |
| 4 |
* Check whether the given field value is valid for the reflect API. |
| 5 |
*/ |
| 6 |
export declare function checkField(field: DescField, value: unknown): FieldError | undefined; |
| 7 |
/** |
| 8 |
* Check whether the given list item is valid for the reflect API. |
| 9 |
*/ |
| 10 |
export declare function checkListItem(field: DescField & { |
| 11 |
fieldKind: "list"; |
| 12 |
}, index: number, value: unknown): FieldError | undefined; |
| 13 |
/** |
| 14 |
* Check whether the given map key and value are valid for the reflect API. |
| 15 |
*/ |
| 16 |
export declare function checkMapEntry(field: DescField & { |
| 17 |
fieldKind: "map"; |
| 18 |
}, key: unknown, value: unknown): FieldError | undefined; |
| 19 |
type InvalidScalarValueErr = false | "invalid UTF8" | `${string} out of range`; |
| 20 |
/** |
| 21 |
* Return the check for values of the given scalar type. |
| 22 |
* |
| 23 |
* @private |
| 24 |
*/ |
| 25 |
export declare function checkScalarValue(scalar: ScalarType): (value: unknown) => true | InvalidScalarValueErr; |
| 26 |
/** |
| 27 |
* Format the reason why a value is invalid for a singular field. |
| 28 |
* |
| 29 |
* @private |
| 30 |
*/ |
| 31 |
export declare function reasonSingular(field: { |
| 32 |
scalar: ScalarType; |
| 33 |
message?: undefined; |
| 34 |
enum?: undefined; |
| 35 |
} | { |
| 36 |
scalar?: undefined; |
| 37 |
message: DescMessage; |
| 38 |
enum?: undefined; |
| 39 |
} | { |
| 40 |
scalar?: undefined; |
| 41 |
message?: undefined; |
| 42 |
enum: DescEnum; |
| 43 |
}, val: unknown, details?: string | false): string; |
| 44 |
export declare function formatVal(val: unknown): string; |
| 45 |
export {}; |