import { AST, LiteralValue } from "@fncts/schema/AST"; import { Schema, OptionalSchema } from "@fncts/schema/Schema/definition"; import { ASTAnnotation } from "@fncts/schema/ASTAnnotation"; import { Vector } from "@fncts/base/collection/immutable/Vector"; import { Parser } from "@fncts/schema/Parser/definition"; import { ASTAnnotationMap } from "@fncts/schema/ASTAnnotationMap"; import { Refinement } from "@fncts/base/data/Refinement/definition"; import { Predicate } from "@fncts/base/data/Predicate/definition"; import { Maybe } from "@fncts/base/data/Maybe/definition"; import { ParseResult } from "@fncts/schema/ParseResult"; import type { ParseOptions } from "../AST.js"; import type { Brand, Validation } from "@fncts/base/data/Branded"; /** * @tsplus static fncts.schema.SchemaOps fromAST * @tsplus location "@fncts/schema/Schema/api" */ export declare function make(ast: AST): Schema; /** * @tsplus pipeable fncts.schema.Schema annotate * @tsplus location "@fncts/schema/Schema/api" */ export declare function annotate(annotation: ASTAnnotation, value: V): (self: Schema) => Schema; /** * @tsplus static fncts.schema.SchemaOps declaration * @tsplus location "@fncts/schema/Schema/api" */ export declare function declaration(typeParameters: Vector>, decode: (...typeParameters: ReadonlyArray>) => Parser, encode: (...typeParameters: ReadonlyArray>) => Parser, annotations?: ASTAnnotationMap): Schema; /** * @tsplus pipeable fncts.schema.Schema filter * @tsplus location "@fncts/schema/Schema/api" */ export declare function filter(refinement: Refinement): (self: Schema) => Schema; export declare function filter(predicate: Predicate): (self: Schema) => Schema; /** * @tsplus pipeable fncts.schema.Schema brand * @tsplus location "@fncts/schema/Schema/api" */ export declare function brand(validation: Validation): (self: Schema) => Schema>; /** * @tsplus static fncts.schema.SchemaOps literal * @tsplus location "@fncts/schema/Schema/api" */ export declare function literal>(...literals: Literals): Schema; /** * @tsplus static fncts.schema.SchemaOps never * @tsplus implicit * @tsplus location "@fncts/schema/Schema/api" */ export declare const never: Schema; /** * @tsplus static fncts.schema.SchemaOps unknown * @tsplus implicit * @tsplus location "@fncts/schema/Schema/api" */ export declare const unknown: Schema; /** * @tsplus static fncts.schema.SchemaOps any * @tsplus location "@fncts/schema/Schema/api" */ export declare const any: Schema; /** * @tsplus static fncts.schema.SchemaOps undefined * @tsplus implicit * @tsplus location "@fncts/schema/Schema/api" */ export declare const _undefined: Schema; export { _undefined as undefined }; /** * @tsplus static fncts.schema.SchemaOps null * @tsplus implicit * @tsplus location "@fncts/schema/Schema/api" */ export declare const _null: Schema; export { _null as null }; /** * @tsplus static fncts.schema.SchemaOps void * @tsplus implicit * @tsplus location "@fncts/schema/Schema/api" */ export declare const _void: Schema; export { _void as void }; /** * @tsplus static fncts.schema.SchemaOps string * @tsplus implicit * @tsplus location "@fncts/schema/Schema/api" */ export declare const string: Schema; /** * @tsplus static fncts.schema.SchemaOps number * @tsplus implicit * @tsplus location "@fncts/schema/Schema/api" */ export declare const number: Schema; /** * @tsplus static fncts.schema.SchemaOps boolean * @tsplus implicit * @tsplus location "@fncts/schema/Schema/api" */ export declare const boolean: Schema; /** * @tsplus static fncts.schema.SchemaOps bigint * @tsplus implicit * @tsplus location "@fncts/schema/Schema/api" */ export declare const bigint: Schema; /** * @tsplus static fncts.schema.SchemaOps symbol * @tsplus implicit * @tsplus location "@fncts/schema/Schema/api" */ export declare const symbol: Schema; /** * @tsplus static fncts.schema.SchemaOps object * @tsplus implicit * @tsplus location "@fncts/schema/Schema/api" */ export declare const object: Schema; /** * @tsplus static fncts.schema.SchemaOps date * @tsplus location "@fncts/schema/Schema/api" */ export declare const date: Schema; /** * @tsplus implicit * @tsplus location "@fncts/schema/Schema/api" */ export declare const implicitDate: Schema; /** * @tsplus derive fncts.schema.Schema<|> 30 * @tsplus static fncts.schema.SchemaOps union * @tsplus location "@fncts/schema/Schema/api" */ export declare function union>(...members: { [K in keyof A]: Schema; }): Schema; /** * @tsplus getter fncts.schema.Schema nullable * @tsplus location "@fncts/schema/Schema/api" */ export declare function nullable(self: Schema): Schema; /** * @tsplus static fncts.schema.SchemaOps uniqueSymbol * @tsplus location "@fncts/schema/Schema/api" */ export declare function uniqueSymbol(symbol: S, annotations?: ASTAnnotationMap): Schema; /** * @tsplus getter fncts.schema.Schema optional * @tsplus location "@fncts/schema/Schema/api" */ export declare function optional(self: Schema): OptionalSchema; /** * @tsplus fluent fncts.schema.Schema isOptional * @tsplus location "@fncts/schema/Schema/api" */ export declare function isOptional(self: Schema): self is OptionalSchema; export type OptionalSchemaKeys = { [K in keyof T]: T[K] extends OptionalSchema ? K : never; }[keyof T]; /** * @tsplus getter fncts.schema.Schema parseOptional * @tsplus location "@fncts/schema/Schema/api" */ export declare function parseOptional(self: Schema): Schema>; /** * @tsplus fluent fncts.schema.Schema isParseOptional * @tsplus location "@fncts/schema/Schema/api" */ export declare function isParseOptional(self: Schema): boolean; export type Spread = { [K in keyof A]: A[K]; } extends infer B ? B : never; /** * @tsplus static fncts.schema.SchemaOps struct * @tsplus location "@fncts/schema/Schema/api" */ export declare function struct>>(fields: Fields): Schema>]: Schema.Infer; } & { readonly [K in OptionalSchemaKeys]?: Schema.Infer; }>>; /** * @tsplus static fncts.schema.SchemaOps tuple * @tsplus location "@fncts/schema/Schema/api" */ export declare function tuple>>(...elements: Elements): Schema<{ readonly [K in keyof Elements]: Schema.Infer; }>; /** * @tsplus static fncts.schema.SchemaOps lazy * @tsplus location "@fncts/schema/Schema/api" */ export declare function lazy(f: () => Schema, annotations?: ASTAnnotationMap): Schema; /** * @tsplus static fncts.schema.SchemaOps array * @tsplus getter fncts.schema.Schema array * @tsplus location "@fncts/schema/Schema/api" */ export declare function array(item: Schema): Schema>; /** * @tsplus static fncts.schema.SchemaOps mutableArray * @tsplus getter fncts.schema.Schema mutableArray * @tsplus location "@fncts/schema/Schema/api" */ export declare function mutableArray(item: Schema): Schema>; /** * @tsplus static fncts.schema.SchemaOps record * @tsplus location "@fncts/schema/Schema/api" */ export declare function record(key: Schema, value: Schema): Schema<{ readonly [k in K]: V; }>; /** * @tsplus static fncts.schema.SchemaOps enum * @tsplus location "@fncts/schema/Schema/api" */ export declare function enum_(enums: A): Schema; export { enum_ as enum }; type Join = T extends [infer Head, ...infer Tail] ? `${Head & (string | number | bigint | boolean | null | undefined)}${Tail extends [] ? "" : Join}` : never; /** * @tsplus static fncts.schema.SchemaOps templateLiteral * @tsplus location "@fncts/schema/Schema/api" */ export declare function templateLiteral, ...Array>]>(...[head, ...tail]: T): Schema; }>>; /** * @tsplus static fncts.schema.SchemaOps keyof * @tsplus getter fncts.schema.Schema keyof * @tsplus location "@fncts/schema/Schema/api" */ export declare function keyof(self: Schema): Schema; /** * @tsplus pipeable fncts.schema.Schema extend * @tsplus location "@fncts/schema/Schema/api" */ export declare function extend(that: Schema): (self: Schema) => Schema>; /** * @tsplus pipeable fncts.schema.Schema instanceOf * @tsplus location "@fncts/schema/Schema/api" */ export declare function instanceOf any>(constructor: A): (self: Schema) => Schema>; /** * @tsplus pipeable fncts.schema.Schema transformOrFail * @tsplus location "@fncts/schema/Schema/api" */ export declare function transformOrFail(to: Schema, decode: (input: A, options?: ParseOptions) => ParseResult, encode: (input: B, options?: ParseOptions) => ParseResult): (from: Schema) => Schema; /** * @tsplus pipeable fncts.schema.Schema transform * @tsplus location "@fncts/schema/Schema/api" */ export declare function transform(to: Schema, decode: (input: A, options?: ParseOptions) => B, encode: (input: B, options?: ParseOptions) => A): (from: Schema) => Schema; /** * @tsplus pipeable fncts.schema.Schema pick * @tsplus location "@fncts/schema/Schema/api" */ export declare function pick>(...keys: Keys): (self: Schema) => Schema>; /** * @tsplus pipeable fncts.schema.Schema omit * @tsplus location "@fncts/schema/Schema/api" */ export declare function omit>(...keys: Keys): (self: Schema) => Schema>;