import { z } from 'zod'; import { optional } from '../optional'; import { Status, Variant } from './types.gen'; import { TimeStamp } from '../telem'; type Base = { key: string; name: string; variant: V; message: string; description?: string; time: TimeStamp; }; export type Crude = optional.Optional, "key" | "time" | "name"> & ([DetailsSchema] extends [z.ZodNever] ? {} : { details: z.output; }); /** * Interface that errors may optionally implement to provide richer rendering when * passed to {@link fromException}. Implementers return a partial {@link Crude} spec * whose fields override the defaults derived from the underlying `Error`. * * This is a duck-typed contract: `fromException` checks for the presence of a * `toStatus` method via the `in` operator, so there is no need to import this * interface to use it. */ export interface Custom { toStatus(): Partial>; } export declare const exceptionDetailsSchema: z.ZodIntersection; }, z.core.$strip>, z.ZodRecord, z.ZodUnknown>>; export declare const fromException: (exc: unknown, message?: string) => Status>; /** * Converts an exception-shaped status (one built via {@link fromException}) back * into a thrown-shaped {@link Error}. The returned error carries the status's * wrapped message, copies `name` and `stack` from the inner error preserved on * `details.error`, and stashes the full status on `cause` for callers that need * the rich shape. * * Use this when bridging the status pipeline back into a context that expects * a real Error — typically before `throw`-ing across an error boundary. */ export declare const toError: (s: Status>) => Error; export declare const create: (spec: Crude) => Status>; export declare const keepVariants: (variant?: Variant, keep?: Variant | Variant[]) => Variant | undefined; export declare const removeVariants: (variant?: Variant, remove?: Variant | Variant[]) => Variant | undefined; export interface ToStringOptions { includeTimestamp?: boolean; includeName?: boolean; } export declare const toString:
(stat: Status
, options?: ToStringOptions) => string; export {}; //# sourceMappingURL=status.d.ts.map