//#region src/common/schema/schema.d.ts /** * Metadata interface for type descriptions and additional properties */ interface TypeMeta { desc?: string; } /** * Core Type class for schema validation and type inference * Implements StandardSchemaV1 for cross-library compatibility */ declare class Type { readonly type: string; _default?: any; _optional?: boolean; _meta?: TypeMeta; _check?: (obj: any) => boolean; _object?: any; _type?: any; _union?: any; _enumValues?: any; _args?: any; _ret?: any; _info?: any; constructor(name: string, options?: Partial>); /** * Standard Schema V1 compliance property * Provides a standard interface for validation and type inference */ get '~standard'(): any; /** * Validation method for standard-schema compliance */ validate(value: any): any; /** * Creates a copy of the type with new properties merged */ private _cloneWithProps; /** * Helper to copy type properties when creating new type instances */ private static _copyTypeProperties; /** * Marks the type as optional, meaning it can be undefined * This is useful for properties that are not required. */ optional(): Type; /** * Sets a default value for the type, which will be used if the value is not provided * The default value can be a function that receives the schema as argument, or a static value. */ default(value: T | ((schema?: this) => T)): Type; /** * Props / Metadata for the type, like description or other properties */ meta(meta: TypeMeta): Type; /** * Sets the `desc` property for the type, which is a human-readable description */ describe(msg: string): Type; /** * Extends the type with an object, merging the properties */ extend(obj: O): Type>; /** * Picks certain keys from an object schema */ pick(keys: Record): Type>; /** * Omits certain keys from an object schema */ omit(keys: Record): Type>; /** * Helper method to modify object properties with a transformation function */ private _transformObjectProperties; /** * Makes some or all properties of an object schema optional */ partial(): Type>; partial(keys: Record): Type> & Omit>; /** * Makes some or all properties of an object schema required */ required(): Type>; required(keys: Record): Type> & Omit>; /** * Helper method to clone a type with optional flag */ private static _cloneTypeWithOptional; } /** * Type inference utility for extracting the TypeScript type from a schema Type */ type Infer = T extends Type ? TT : never; /** * Creates a string type validator */ declare function string(): Type; /** * Creates a number type validator */ declare function number(): Type; /** * Creates an integer type validator */ declare function int(): Type; /** * Creates a boolean type validator */ declare function boolean(): Type; /** * Creates a none type validator (undefined | null) * Like undefined | null in TS and nil in Swift */ declare function none(): Type; /** * Creates an any type validator that accepts any non-null value */ declare function any(): Type; declare const float: typeof number; declare const double: typeof number; declare const real: typeof number; /** * Utility type to make object properties optional if their value type includes undefined. * @category Schema */ type TypeObjectFixOptional = { [K in keyof T as undefined extends T[K] ? K : never]?: T[K] & {} } & { [K in keyof T as undefined extends T[K] ? never : K]: T[K] & {} }; /** * Utility type for pretty-printing object types */ type TypeObjectPretty = Extract<{ [K in keyof V]: V[K] }, unknown>; /** * Main object type utility */ type TypeObject = TypeObjectPretty }>>; /** * Creates an object type validator with specified properties */ declare function object(tobj: T): Type>; /** * Creates a record type validator (object with string keys and uniform value type) */ declare function record(valueType: T): Type>>; /** * Utility type for union of types. * @category Schema */ type TypeUnion[]> = { [K in keyof T]: T[K] extends Type ? U : never }[number]; /** * Creates a union type validator (like `string | number | boolean`) */ declare function union[]>(options: T): Type>; /** * Utility type for literal types. * @category Schema */ type TypeLiterals = string | number | bigint | boolean; /** * Creates a literal value validator */ declare function literal(value: T): Type; /** * Creates a string literal union validator (like `"a" | "b" | "c"`) */ declare function stringLiterals(values: T): Type; /** * Utility type for tuple types. * @category Schema */ type TypeTuple = { -readonly [K in keyof T]: T[K] extends Type ? U : never }; /** * Output type for TypeArray. * @category Schema */ type TypeArrayOutput = [...TypeTuple, ...(Rest extends Type ? Infer[] : [])]; /** * Utility type for array types. * @category Schema */ type TypeArray = Type>; /** * Creates a tuple type validator with fixed length and types e.g. [string, number, boolean] */ declare function tuple(items: T): Type>; /** * Creates an array type validator for a specific item type */ declare function array(itemType: Type): Type; /** * Creates a regular function type validator */ declare function func, ...Type[]] | [], TypeFuncRet = Type, T = (...args: TypeTuple) => Infer>(args: TypeFuncArgs, ret: TypeFuncRet): Type; /** * Creates an RPC function type validator that takes one argument and returns a promise */ declare function rpc | undefined = undefined, TypeRpcRet extends Type = Type, T = (TypeRpcInfo extends undefined ? () => Infer : (info: Infer) => Infer | Promise>)>(info?: TypeRpcInfo, ret?: TypeRpcRet): Type; //#endregion export { rpc as C, union as D, tuple as E, record as S, stringLiterals as T, literal as _, TypeLiterals as a, object as b, TypeTuple as c, array as d, boolean as f, int as g, func as h, TypeArrayOutput as i, TypeUnion as l, float as m, Type as n, TypeMeta as o, double as p, TypeArray as r, TypeObjectFixOptional as s, Infer as t, any as u, none as v, string as w, real as x, number as y }; //# sourceMappingURL=schema-BNke0iHR.d.cts.map