import { z } from "zod"; /** * AMC response base schema */ declare const baseSchema: z.ZodObject<{ status: z.ZodString; body: z.ZodOptional; message: z.ZodOptional; }>; /** * AMC response schema */ declare const amcResponseSchema: z.ZodType & Record>; /** * AMC response type */ type AMCResponse = z.infer; /** * Base error class for the Wikidot library * All custom errors inherit from this class */ declare abstract class WikidotError extends Error { /** Error name */ readonly name: string; /** * @param message - Error message */ constructor(message: string); } /** * Unexpected error * Represents internal inconsistencies or bugs */ declare class UnexpectedError extends WikidotError {} /** * Base error for Ajax Module Connector related issues */ declare class AMCError extends WikidotError {} /** * HTTP status code error * Thrown when an AMC request fails with an HTTP error */ declare class AMCHttpError extends AMCError { /** HTTP status code */ readonly statusCode: number; /** * @param message - Error message * @param statusCode - HTTP status code */ constructor(message: string, statusCode: number); } /** * Wikidot status code error * Thrown when AMC response status is not ok */ declare class WikidotStatusError extends AMCError { /** Wikidot status code string */ readonly statusCode: string; /** Raw AMC response, when available (e.g. to inspect form_errors payloads) */ readonly response?: AMCResponse; /** * @param message - Error message * @param statusCode - Status code (e.g., 'not_ok', 'try_again') * @param response - Raw AMC response (optional, keeps existing call sites intact) */ constructor(message: string, statusCode: string, response?: AMCResponse); } /** * Form validation error * Thrown when AMC response status is 'form_errors' or 'form_error'. * Absorbs the payload key differences across modules (formErrors / errors / message) * behind a single `errors` accessor. */ declare class FormErrorsError extends WikidotStatusError { /** Field-name -> message record, regardless of the underlying payload key */ get errors(): Record; } /** * Response data error * Thrown when response parsing fails */ declare class ResponseDataError extends AMCError {} /** * Base error for session related issues */ declare class SessionError extends WikidotError {} /** * Session creation failure error * Thrown when a login attempt fails */ declare class SessionCreateError extends SessionError {} /** * Login required error * Thrown when an authenticated operation is attempted without login */ declare class LoginRequiredError extends SessionError { constructor(message?: string); } /** * Resource not found error * Thrown when the requested resource does not exist */ declare class NotFoundException extends WikidotError {} /** * Resource already exists error * Thrown when attempting to create a resource that already exists */ declare class TargetExistsError extends WikidotError {} /** * Target state error * Thrown when a resource is in an inoperable state (e.g., locked) */ declare class TargetError extends WikidotError {} /** * Access denied error * Thrown when an operation is denied due to insufficient permissions */ declare class ForbiddenError extends WikidotError {} /** * HTML element not found error * Thrown when a required element is not found during parsing */ declare class NoElementError extends WikidotError {} export { AMCError, AMCHttpError, ForbiddenError, FormErrorsError, LoginRequiredError, NoElementError, NotFoundException, ResponseDataError, SessionCreateError, SessionError, TargetError, TargetExistsError, UnexpectedError, WikidotError, WikidotStatusError };