import { z } from 'zod'; import { CatalogDetails, ErrorKind } from './catalog_types'; /** * Generic HTTP-level error codes shared across all API domains. * Domain-specific codes live in `catalog_api.ts`. */ export declare enum BASE_ERROR_CODES { /** Input data failed schema or business-rule validation. */ VALIDATION = "VALIDATION", /** The request is malformed or contains invalid parameters. */ BAD_REQUEST = "BAD_REQUEST", /** Credentials are missing, expired, or invalid. */ AUTHENTICATION = "AUTHENTICATION", /** Authenticated but lacks the required permissions. */ UNAUTHORIZED = "UNAUTHORIZED", /** The requested resource does not exist. */ NOT_FOUND = "NOT_FOUND", /** Server cannot produce a response matching the `Accept` header. */ NOT_ACCEPTABLE = "NOT_ACCEPTABLE", /** Operation would violate a uniqueness or integrity constraint. */ CONFLICT = "CONFLICT", /** Resource existed but has been permanently removed (unlike 404, retrying is futile). */ GONE = "GONE", /** Request is syntactically valid but semantically unprocessable (e.g. invalid state transition). */ UNPROCESSABLE_ENTITY = "UNPROCESSABLE_ENTITY", /** A required field was omitted from the request. */ MANDATORY_FIELD = "MANDATORY_FIELD", /** Unexpected server-side error (`SYSTEM` — message sanitised before being sent to clients). */ INTERNAL_SERVER_ERROR = "INTERNAL_SERVER_ERROR", /** Upstream gateway received an invalid response from the origin server (`SYSTEM`). */ BAD_GATEWAY = "BAD_GATEWAY", /** Service is temporarily unavailable (`SYSTEM`). */ SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE" } /** Maps every `BASE_ERROR_CODES` member to its HTTP status, kind, default message, and details schema. */ export declare const BASE_ERRORS_CATALOG: { VALIDATION: { kind: ErrorKind.DOMAIN; status: number; details: z.ZodObject<{ errors: z.ZodArray; }, "strip", z.ZodTypeAny, { code: string; message: string; path: string[]; validation: string; }, { code: string; message: string; path: string[]; validation: string; }>, "many">; }, "strip", z.ZodTypeAny, { errors: { code: string; message: string; path: string[]; validation: string; }[]; }, { errors: { code: string; message: string; path: string[]; validation: string; }[]; }>; message: string; }; BAD_REQUEST: { kind: ErrorKind.DOMAIN; status: number; details: z.ZodObject<{ field: z.ZodOptional; reason: z.ZodOptional; }, "strip", z.ZodTypeAny, { field?: string | undefined; reason?: string | undefined; }, { field?: string | undefined; reason?: string | undefined; }>; message: string; }; AUTHENTICATION: { kind: ErrorKind.DOMAIN; status: number; details: z.ZodObject<{ reason: z.ZodOptional; }, "strip", z.ZodTypeAny, { reason?: string | undefined; }, { reason?: string | undefined; }>; message: string; }; UNAUTHORIZED: { kind: ErrorKind.DOMAIN; status: number; details: z.ZodObject<{ requiredScope: z.ZodOptional; resource: z.ZodOptional; }, "strip", z.ZodTypeAny, { requiredScope?: string | undefined; resource?: string | undefined; }, { requiredScope?: string | undefined; resource?: string | undefined; }>; message: string; }; NOT_FOUND: { kind: ErrorKind.DOMAIN; status: number; details: z.ZodObject<{ entity: z.ZodOptional; }, "strip", z.ZodTypeAny, { entity?: string | undefined; }, { entity?: string | undefined; }>; message: string; }; NOT_ACCEPTABLE: { kind: ErrorKind.DOMAIN; status: number; details: z.ZodObject<{ acceptedTypes: z.ZodOptional>; }, "strip", z.ZodTypeAny, { acceptedTypes?: string[] | undefined; }, { acceptedTypes?: string[] | undefined; }>; message: string; }; /** Each item in the array identifies one conflicting field. */ CONFLICT: { kind: ErrorKind.DOMAIN; status: number; details: z.ZodArray, "many">; message: string; }; GONE: { kind: ErrorKind.DOMAIN; status: number; details: z.ZodObject<{ since: z.ZodOptional; }, "strip", z.ZodTypeAny, { since?: string | undefined; }, { since?: string | undefined; }>; message: string; }; UNPROCESSABLE_ENTITY: { kind: ErrorKind.DOMAIN; status: number; details: z.ZodObject<{ field: z.ZodOptional; reason: z.ZodOptional; }, "strip", z.ZodTypeAny, { field?: string | undefined; reason?: string | undefined; }, { field?: string | undefined; reason?: string | undefined; }>; message: string; }; MANDATORY_FIELD: { kind: ErrorKind.DOMAIN; status: number; details: z.ZodObject<{ field: z.ZodString; }, "strip", z.ZodTypeAny, { field: string; }, { field: string; }>; message: string; }; INTERNAL_SERVER_ERROR: { kind: ErrorKind.SYSTEM; status: number; details: z.ZodObject<{ reason: z.ZodOptional; }, "strip", z.ZodTypeAny, { reason?: string | undefined; }, { reason?: string | undefined; }>; message: string; }; BAD_GATEWAY: { kind: ErrorKind.SYSTEM; status: number; details: z.ZodObject<{ upstream: z.ZodOptional; }, "strip", z.ZodTypeAny, { upstream?: string | undefined; }, { upstream?: string | undefined; }>; message: string; }; SERVICE_UNAVAILABLE: { kind: ErrorKind.SYSTEM; status: number; details: z.ZodObject<{ retryAfter: z.ZodOptional; }, "strip", z.ZodTypeAny, { retryAfter?: number | undefined; }, { retryAfter?: number | undefined; }>; message: string; }; }; /** * Strongly-typed `details` shape for a given `BASE_ERROR_CODES` member. * @example * type ConflictDetails = BaseErrorDetails * // → Array<{ key: string; value: string; cause: string }> */ export type BaseErrorDetails = CatalogDetails; //# sourceMappingURL=catalog_base.d.ts.map