import type { StandardSchemaV1 } from "@standard-schema/spec"; /** * Any Standard Schema compatible validator. */ export type StandardSchema = StandardSchemaV1; /** * Infer the parsed output type from a Standard Schema. */ export type InferOutput = StandardSchemaV1.InferOutput; /** * Value object definition returned by `defineValueObject(...).build()`. */ export interface ValueObjectDef { /** Name used for debugging and introspection. */ name: Name; /** Standard Schema used to validate values. */ schema: Schema; /** * Create a validated value from unknown input. * * This is async because Standard Schema validators may be async. */ create(input: unknown): Promise>; /** * Check whether an input is valid for this value object. */ isValid(input: unknown): Promise; /** Type-only alias for the inferred TypeScript type. Undefined at runtime. */ Type: InferOutput; } /** * Builder class for creating Value Objects. */ declare class ValueObjectBuilder { private readonly cfg; constructor(cfg: { name: Name; schema?: Schema; }); /** * Set the schema for this value object. */ schema(s: S): ValueObjectBuilder; /** * Finalize the value object definition. */ build(): ValueObjectDef; } /** * Create a new value object builder. * * Value objects are schema-backed primitives for domain concepts such as email * addresses or money values. Beignet does not add a runtime brand; the schema * output controls the runtime value. * * @example * ```ts * const Email = defineValueObject("Email") * .schema(z.string().email()) * .build(); * * type Email = typeof Email.Type; * * const email = await Email.create("test@example.com"); // OK * const isValid = await Email.isValid("test@example.com"); // true * ``` */ export declare function defineValueObject(name: Name): ValueObjectBuilder; export {}; //# sourceMappingURL=value-object.d.ts.map