| 241 | } |
| 242 | |
| 243 | export class Validator { |
| 244 | declare meta: ArkEnv.meta |
| 245 | declare allows: (data: unknown) => boolean |
| 246 | declare assert: (data: unknown, pipedFromCtx?: Traversal) => unknown |
| 247 | declare "~standard": StandardSchemaV1.Props |
| 248 | declare withContext: (context: ArkEnv.context) => ContextualTarget |
| 249 | // a member the build bakes is the validator's own. One it doesn't reads |
| 250 | // undefined, and under the "development" condition throws with the fix |
| 251 | declare expression: string |
| 252 | declare description: string |
| 253 | declare json: JsonStructure |
| 254 | declare toJSON: () => JsonStructure |
| 255 | declare toJsonSchema: () => JsonSchema |
| 256 | |
| 257 | traverse( |
| 258 | data: unknown, |
| 259 | pipedFromCtx?: Traversal |
| 260 | ): ArkErrors | {} | null | undefined { |
| 261 | return this(data, pipedFromCtx, null) as never |
| 262 | } |
| 263 | |
| 264 | from(input: unknown): unknown { |
| 265 | return this.assert(input) |
| 266 | } |
| 267 | |
| 268 | // a build without the expression member has none to print, and one whose |
| 269 | // validators all lack it ships no read of it |
| 270 | toString(): string { |
| 271 | return holdsExpression && this.expression !== undefined ? |
| 272 | `Type<${this.expression}>` |
| 273 | : "Type" |
| 274 | } |
| 275 | } |
| 276 | |
| 277 | const getOwnPropertyDescriptors = /* @__PURE__ */ (() => |
| 278 | Object.getOwnPropertyDescriptors)() |
nothing calls this directly
no outgoing calls
no test coverage detected