import { ConvexError } from "convex/values"; //#region src/modules/contracts/errors.d.ts /** Explicit synchronous validators for the final public detail representation. */ export type ErrorDetailParser = Readonly<{ parse: (value: unknown) => Output; }>; export type ErrorDefinitions = Readonly>; }>>>; type Code = Extract; type Details = Definition extends ErrorDefinitions[string] ? { [Field in keyof Definition['details']]: ReturnType; } : never; declare const declaredErrorBrand: unique symbol; /** Server failures are trusted only by the contract that created them. */ export type DeclaredError = { [Key in Code]: Readonly<{ _tag: 'DeclaredError'; code: Key; details: Details; [declaredErrorBrand]: true; }>; }[Code]; export type DeclaredFailure = { [Key in Code]: Readonly<{ _tag: 'DeclaredFailure'; version: 1; code: Key; message: string; details: Details; }>; }[Code]; export type UnknownFailure = Readonly<{ _tag: 'UnknownFailure'; version: 1; }>; export type DecodedFailure = DeclaredFailure | UnknownFailure; export type ErrorContract = Readonly<{ create: >(code: Key, details: Details]>) => Extract, { code: Key; }>; envelope: >(code: Key, details: Details]>) => Extract, { code: Key; }>; toConvexError: >(code: Key, details: Details]>) => ConvexError, { code: Key; }>>; project: (error: unknown) => DecodedFailure; /** Receives envelope data, e.g. ConvexError.data; never parses error messages. */ decode: (payload: unknown) => DecodedFailure; }>; /** Closed safe codes, allowlisted details, and a versioned checked transport union. */ export declare function defineErrorContract(definitions: Definitions): ErrorContract; /** A structural decoder also accepts combined contracts without requiring constructors. */ export type FailureContract = Pick, 'decode'>; export type FailureOf = ReturnType; type ProjectingContract = FailureContract & Pick, 'project'>; /** Extract only ConvexError.data, including one bounded serialized JSON envelope. */ export declare function decodeFailure(error: unknown, contract: Contract): FailureOf; type CombinedErrorContract = Readonly<{ project: (error: unknown) => FailureOf | UnknownFailure; decode: (payload: unknown) => FailureOf | UnknownFailure; }>; /** Ordered projection and decoding; duplicate codes retain the union of member details. */ export declare function combineErrorContracts(...contracts: Contracts): CombinedErrorContract; /** Fixed, diagnostic-free transport shared by query endpoints and client recovery. */ export declare const queryErrors: Readonly<{ create: >(code: Key, details: Details<{ readonly 'invalid-cursor': { readonly message: "Invalid cursor"; readonly details: {}; }; readonly FIELD_GROUP_DENIED: { readonly message: "Field group access denied"; readonly details: {}; }; readonly QUERY_FANOUT: { readonly message: "Query fan-out limit exceeded"; readonly details: {}; }; readonly SEARCH_TEXT_REQUIRED: { readonly message: "Search text required"; readonly details: {}; }; readonly SEARCH_END_CURSOR_UNSUPPORTED: { readonly message: "Search end cursor unsupported"; readonly details: {}; }; readonly SEARCH_ORDER_UNSUPPORTED: { readonly message: "Search ordering unsupported"; readonly details: {}; }; readonly SEARCH_RELATION_UNSUPPORTED: { readonly message: "Relation search unsupported"; readonly details: {}; }; readonly SEARCH_OPTIONS_UNSUPPORTED: { readonly message: "Search options unsupported"; readonly details: {}; }; readonly SEARCH_PROTOCOL_UNSUPPORTED: { readonly message: "Search pagination protocol unsupported"; readonly details: {}; }; }[NoInfer]>) => Extract, { code: Key; }> | Extract, { code: Key; }> | Extract, { code: Key; }> | Extract, { code: Key; }> | Extract, { code: Key; }> | Extract, { code: Key; }> | Extract, { code: Key; }> | Extract, { code: Key; }> | Extract, { code: Key; }>; envelope: >(code: Key, details: Details<{ readonly 'invalid-cursor': { readonly message: "Invalid cursor"; readonly details: {}; }; readonly FIELD_GROUP_DENIED: { readonly message: "Field group access denied"; readonly details: {}; }; readonly QUERY_FANOUT: { readonly message: "Query fan-out limit exceeded"; readonly details: {}; }; readonly SEARCH_TEXT_REQUIRED: { readonly message: "Search text required"; readonly details: {}; }; readonly SEARCH_END_CURSOR_UNSUPPORTED: { readonly message: "Search end cursor unsupported"; readonly details: {}; }; readonly SEARCH_ORDER_UNSUPPORTED: { readonly message: "Search ordering unsupported"; readonly details: {}; }; readonly SEARCH_RELATION_UNSUPPORTED: { readonly message: "Relation search unsupported"; readonly details: {}; }; readonly SEARCH_OPTIONS_UNSUPPORTED: { readonly message: "Search options unsupported"; readonly details: {}; }; readonly SEARCH_PROTOCOL_UNSUPPORTED: { readonly message: "Search pagination protocol unsupported"; readonly details: {}; }; }[NoInfer]>) => Extract, { code: Key; }> | Extract, { code: Key; }> | Extract, { code: Key; }> | Extract, { code: Key; }> | Extract, { code: Key; }> | Extract, { code: Key; }> | Extract, { code: Key; }> | Extract, { code: Key; }> | Extract, { code: Key; }>; toConvexError: >(code: Key, details: Details<{ readonly 'invalid-cursor': { readonly message: "Invalid cursor"; readonly details: {}; }; readonly FIELD_GROUP_DENIED: { readonly message: "Field group access denied"; readonly details: {}; }; readonly QUERY_FANOUT: { readonly message: "Query fan-out limit exceeded"; readonly details: {}; }; readonly SEARCH_TEXT_REQUIRED: { readonly message: "Search text required"; readonly details: {}; }; readonly SEARCH_END_CURSOR_UNSUPPORTED: { readonly message: "Search end cursor unsupported"; readonly details: {}; }; readonly SEARCH_ORDER_UNSUPPORTED: { readonly message: "Search ordering unsupported"; readonly details: {}; }; readonly SEARCH_RELATION_UNSUPPORTED: { readonly message: "Relation search unsupported"; readonly details: {}; }; readonly SEARCH_OPTIONS_UNSUPPORTED: { readonly message: "Search options unsupported"; readonly details: {}; }; readonly SEARCH_PROTOCOL_UNSUPPORTED: { readonly message: "Search pagination protocol unsupported"; readonly details: {}; }; }[NoInfer]>) => ConvexError, { code: Key; }> | Extract, { code: Key; }> | Extract, { code: Key; }> | Extract, { code: Key; }> | Extract, { code: Key; }> | Extract, { code: Key; }> | Extract, { code: Key; }> | Extract, { code: Key; }> | Extract, { code: Key; }>>; project: (error: unknown) => DecodedFailure<{ readonly 'invalid-cursor': { readonly message: "Invalid cursor"; readonly details: {}; }; readonly FIELD_GROUP_DENIED: { readonly message: "Field group access denied"; readonly details: {}; }; readonly QUERY_FANOUT: { readonly message: "Query fan-out limit exceeded"; readonly details: {}; }; readonly SEARCH_TEXT_REQUIRED: { readonly message: "Search text required"; readonly details: {}; }; readonly SEARCH_END_CURSOR_UNSUPPORTED: { readonly message: "Search end cursor unsupported"; readonly details: {}; }; readonly SEARCH_ORDER_UNSUPPORTED: { readonly message: "Search ordering unsupported"; readonly details: {}; }; readonly SEARCH_RELATION_UNSUPPORTED: { readonly message: "Relation search unsupported"; readonly details: {}; }; readonly SEARCH_OPTIONS_UNSUPPORTED: { readonly message: "Search options unsupported"; readonly details: {}; }; readonly SEARCH_PROTOCOL_UNSUPPORTED: { readonly message: "Search pagination protocol unsupported"; readonly details: {}; }; }>; /** Receives envelope data, e.g. ConvexError.data; never parses error messages. */ decode: (payload: unknown) => DecodedFailure<{ readonly 'invalid-cursor': { readonly message: "Invalid cursor"; readonly details: {}; }; readonly FIELD_GROUP_DENIED: { readonly message: "Field group access denied"; readonly details: {}; }; readonly QUERY_FANOUT: { readonly message: "Query fan-out limit exceeded"; readonly details: {}; }; readonly SEARCH_TEXT_REQUIRED: { readonly message: "Search text required"; readonly details: {}; }; readonly SEARCH_END_CURSOR_UNSUPPORTED: { readonly message: "Search end cursor unsupported"; readonly details: {}; }; readonly SEARCH_ORDER_UNSUPPORTED: { readonly message: "Search ordering unsupported"; readonly details: {}; }; readonly SEARCH_RELATION_UNSUPPORTED: { readonly message: "Relation search unsupported"; readonly details: {}; }; readonly SEARCH_OPTIONS_UNSUPPORTED: { readonly message: "Search options unsupported"; readonly details: {}; }; readonly SEARCH_PROTOCOL_UNSUPPORTED: { readonly message: "Search pagination protocol unsupported"; readonly details: {}; }; }>; }>; //#endregion //# sourceMappingURL=errors.d.mts.map