import TinyI18 from '../../text/TinyI18/index.mjs'; export type HttpResponse = import('./JsDoc.mjs').HttpResponse; export type HttpResponses = import('./JsDoc.mjs').HttpResponses; /** * @typedef {import('./JsDoc.mjs').HttpResponse} HttpResponse * @typedef {import('./JsDoc.mjs').HttpResponses} HttpResponses */ /** * A centralized registry designed for managing HTTP response metadata. * It provides strict data validation and integrated internationalization (i18n) support, * enabling the retrieval of localized response names, summaries, and descriptions * while preventing accidental state mutation. */ declare class TinyHttpResponseRegistry { #private; /** * A collection of utility methods to check HTTP status code ranges. */ static codeIs: Readonly<{ /** * Checks if the status code is in the 1xx (Informational) range. * @param {number} code - The HTTP status code to evaluate. * @returns {boolean} True if the code is between 100 and 199, inclusive. * @throws {TypeError} If the provided code is not a number or is NaN. */ info: (code: number) => boolean; /** * Checks if the status code is in the 2xx (Success) range. * @param {number} code - The HTTP status code to evaluate. * @returns {boolean} True if the code is between 200 and 299, inclusive. * @throws {TypeError} If the provided code is not a number or is NaN. */ success: (code: number) => boolean; /** * Checks if the status code is in the 3xx (Redirection) range. * @param {number} code - The HTTP status code to evaluate. * @returns {boolean} True if the code is between 300 and 399, inclusive. * @throws {TypeError} If the provided code is not a number or is NaN. */ redirect: (code: number) => boolean; /** * Checks if the status code is in the 4xx (Client Error) range. * @param {number} code - The HTTP status code to evaluate. * @returns {boolean} True if the code is between 400 and 499, inclusive. * @throws {TypeError} If the provided code is not a number or is NaN. */ clientError: (code: number) => boolean; /** * Checks if the status code is in the 5xx (Server Error) range. * @param {number} code - The HTTP status code to evaluate. * @returns {boolean} True if the code is between 500 and 599, inclusive. * @throws {TypeError} If the provided code is not a number or is NaN. */ serverError: (code: number) => boolean; }>; /** * Getter for the default request codes. * Returns a deep clone to prevent external mutation of the private state. * * @returns {HttpResponses} A deep copy of the current status codes. */ static get defaultRequestCodes(): HttpResponses; /** * Setter for the default request codes. * Performs deep validation and stores a deep clone to prevent external mutation. * * @param {HttpResponses} newCodes - The new mapping of HTTP responses. * @throws {TypeError} If the input is not a valid HttpResponses object. */ static set defaultRequestCodes(newCodes: HttpResponses); /** * Initializes a new instance of the TinyHttpResponseRegistry. * @param {typeof TinyI18} I18 - The TinyI18 constructor. * @param {HttpResponses} [initialResponses] - An object of initial response objects to populate the registry. * @throws {TypeError} If the input is not an object. */ constructor(I18: typeof TinyI18, initialResponses?: HttpResponses); /** * Adds a new response to the registry. * The object is frozen to prevent any modifications to its properties. * @param {number} id - The HTTP status code (e.g., 404). * @param {HttpResponse} response - The response object to be added. * @param {string} [locale] - The locale to use for storing the response. */ addResponse(id: number, response: HttpResponse, locale?: string): void; /** * Retrieves a response by its ID. * @param {number} id - The HTTP status code. * @returns {HttpResponse | null} The response object or null if not found. * @param {import('../../text/TinyI18/index.mjs').Dict} [params] * @param {string} [locale] - The locale to use for retrieval. */ get(id: number, params?: import('../../text/TinyI18/index.mjs').Dict, locale?: string): HttpResponse | null; /** * Checks if a response ID exists in the registry. * @param {number} id - The HTTP status code. * @returns {boolean} True if the ID exists, false otherwise. */ has(id: number): boolean; /** * Returns all registered responses as an object. * @returns {HttpResponses} An object containing all registered response objects. */ getAll(): HttpResponses; } export default TinyHttpResponseRegistry; //# sourceMappingURL=index.d.mts.map