/** * Errors thrown by the Lucid Resourceful Library * @module @nhtio/lucid-resourceful/errors */ import { Exception } from '@poppinss/utils'; import type { SyntaxError } from "./bundled_liqe"; import type { ValidationError } from "./joi"; export declare class E_INVALID_RESOURCEFUL_DATA_TYPE_OPTIONS extends Exception { static status: number; static code: string; readonly details?: ValidationError['details']; constructor(name: string, reason?: ValidationError); } export declare class E_INVALID_RESOURCEFUL_MIXIN_OPTIONS extends Exception { static status: number; static code: string; readonly details?: ValidationError['details']; constructor(name: string, reason?: ValidationError); } export declare const E_INVALID_PREPARED_VALUE: new (args: [ string, string ], options?: globalThis.ErrorOptions) => Exception; export declare const E_INVALID_CONSUMED_VALUE: new (args: [ string, any, string ], options?: globalThis.ErrorOptions) => Exception; export declare const E_UNCASTABLE: new (args: [ string ], options?: globalThis.ErrorOptions) => Exception; export declare class E_INVALID_RESOURCEFUL_DECORATOR_OPTIONS extends Exception { static status: number; static code: string; readonly details?: ValidationError['details']; constructor(decoratorName: string, fieldName: string, reason?: ValidationError); } export declare class E_FORBIDDEN extends Exception { static status: number; static code: string; constructor(message: string); } export declare class E_INVALID_LUCENE_QUERY extends Exception { static status: number; static code: string; constructor(message: string); } export declare class E_INVALID_COLUMN_ACCESS extends Exception { static status: number; static code: string; constructor(columnName: string); } export declare class E_UNEXPECTED_COLUMN_IN_QUERY extends Exception { static status: number; static code: string; constructor(columnName: string); } export declare class E_LUCENE_SYNTAX_EXCEPTION extends Exception { static status: number; static code: string; readonly offset: number; readonly line: number; readonly column: number; readonly details: string; constructor(query: string, original: SyntaxError); } export declare class E_LUCENE_UNEXPECTED_EXCEPTION extends Exception { static status: number; static code: string; constructor(original: unknown); } export declare class E_LUCENE_INVALID_TYPE extends Exception { static status: number; static code: string; constructor(type: string); } export declare class E_INVALID_RESOUREFUL_INDEX_REQUEST_EXCEPTION extends Exception { static status: number; static code: string; readonly details?: ValidationError['details']; constructor(reason?: ValidationError); } export declare class E_MISSING_PRIMARY_KEY_EXCEPTION extends Exception { static status: number; static code: string; constructor(type: string); } export declare class E_RECORD_NOT_FOUND_EXCEPTION extends Exception { static status: number; static code: string; constructor(); } export declare class E_RELATIONSHIP_NOT_FOUND_EXCEPTION extends Exception { static status: number; static code: string; constructor(); } export declare class E_UNSYNCABLE_RELATIONSHIP_EXCEPTION extends Exception { static status: number; static code: string; constructor(); } export declare class E_INVALID_PAYLOAD_EXCEPTION extends Exception { static status: number; static code: string; readonly details?: ValidationError['details']; constructor(reason?: ValidationError); } export declare class E_FORBIDDEN_PAYLOAD_EXCEPTION extends Exception { static status: number; static code: string; readonly details?: ValidationError['details']; constructor(reason?: ValidationError); } export declare class E_INVALID_RELATIONSHIP_EXCEPTION extends Exception { static status: number; static code: string; constructor(message: string); } /** * Thrown when a cached `belongsTo` relation's `localKey` differs from the related * model's `primaryKey`. The relation cache keys a `belongsTo` lookup by the parent * FK value (the related row's `localKey`) but tags the stored entry by the related * row's `primaryKey`; when these diverge the lookup key and eviction tag describe * different rows, so a cached entry could serve the wrong row. The cache fails loud * here rather than risk returning incorrect data. */ export declare class E_RELATION_CACHE_KEY_DIVERGENCE extends Exception { static status: number; static code: string; constructor(relationName: string, relatedModelName: string, localKey: string, primaryKey: string); } /** * Structured context attached to every runtime relation-cache operational * failure (ADR-009). Identifies the model whose error handler is consulted, plus * the relation / lookup key / eviction tag the failing operation concerned. * * @public */ export interface RelationCacheErrorContext { /** Canonical identity name of the model involved (the declaring model on reads/writes, the target on evictions). */ model: string; /** The relation name, when the failure is tied to a specific relation load. */ relation?: string; /** The cache lookup key, when applicable. */ key?: string | null; /** The eviction tag, when applicable. */ tag?: string | null; /** * The value that caused the failure, when one exists: the snapshot being * written (`E_RELATION_CACHE_WRITE_FAILED`) or the cached snapshot that failed * to rehydrate (`E_RELATION_CACHE_REHYDRATION_FAILED`). Absent for read / * resolution / eviction failures, which have no causing payload. */ value?: unknown; } /** * Base class for every RUNTIME relation-cache operational failure routed through * the `onRelationsCacheError` handler (ADR-009). Subclasses pin a per-site `code`; * the original throw is preserved as `cause` and structured context as `context`, * so a handler can `instanceof` / switch on `.code` and inspect `.cause`/`.context`. * * These are NOT thrown to the caller — they are reported to the handler while the * load degrades to the DB. Misconfiguration (invalid options / key divergence) * stays fail-loud and does NOT extend this. * * @public */ export declare class E_RELATION_CACHE_OPERATION_FAILED extends Exception { static status: number; static code: string; /** Structured context describing the failing operation. */ readonly context: RelationCacheErrorContext; constructor(message: string, context: RelationCacheErrorContext, cause: unknown); } /** A cache read (`get`) failed; the load degrades to an uncached DB load (ADR-009). @public */ export declare class E_RELATION_CACHE_READ_FAILED extends E_RELATION_CACHE_OPERATION_FAILED { static code: string; constructor(context: RelationCacheErrorContext, cause: unknown); } /** A cache write-back (`set`) failed on a miss; caching is skipped, the fetched row is still returned (ADR-009). @public */ export declare class E_RELATION_CACHE_WRITE_FAILED extends E_RELATION_CACHE_OPERATION_FAILED { static code: string; constructor(context: RelationCacheErrorContext, cause: unknown); } /** A write-through eviction (`deleteByTag`) failed; the business write still commits, staleness stays TTL-bounded (ADR-009). @public */ export declare class E_RELATION_CACHE_EVICTION_FAILED extends E_RELATION_CACHE_OPERATION_FAILED { static code: string; constructor(context: RelationCacheErrorContext, cause: unknown); } /** Resolving the cache service (the host resolver threw, or the app/cache was unreachable) failed; the load degrades to an uncached DB load (ADR-009). @public */ export declare class E_RELATION_CACHE_RESOLUTION_FAILED extends E_RELATION_CACHE_OPERATION_FAILED { static code: string; constructor(context: RelationCacheErrorContext, cause: unknown); } /** Rehydrating a cached snapshot into a model instance failed (a poisoned/incompatible entry); the load degrades to an uncached DB load that overwrites the entry (ADR-009). @public */ export declare class E_RELATION_CACHE_REHYDRATION_FAILED extends E_RELATION_CACHE_OPERATION_FAILED { static code: string; constructor(context: RelationCacheErrorContext, cause: unknown); } export declare class E_INVALID_RESOUREFUL_READ_RELATIONSHIP_REQUEST_EXCEPTION extends Exception { static status: number; static code: string; readonly details?: ValidationError['details']; constructor(reason: E_INVALID_RESOUREFUL_INDEX_REQUEST_EXCEPTION); } export declare class E_LUCENE_REGEX_NOT_SUPPORTED extends Exception { static status: number; static code: string; constructor(); } export declare class E_BULK_UPDATE_SEARCH_UNKNOWN_EXCEPTION extends Exception { static status: number; static code: string; constructor(); } /** * Exception thrown when an invalid field is specified for aggregation operations. * * This error occurs when attempting to perform aggregations on fields that: * - Don't exist in the model * - Are not marked as aggregatable in their column definition * - Are computed accessors or relationships (which cannot be aggregated at the database level) * * @example * ```typescript * // This would throw if 'nonExistentField' doesn't exist or isn't aggregatable * await User.$onResourcefulIndex('*', 1, 10, ['id'], null, ctx, app, [], { * nonExistentField: ['sum', 'avg'] * }) * ``` */ export declare class E_INVALID_AGGREGATION_FIELD extends Exception { static status: number; static code: string; constructor(fieldName: string, modelName: string); } /** * Exception thrown when an invalid aggregation operation is specified for a field. * * This error occurs when attempting to perform aggregation operations that are not * supported by the library or when the operation name is misspelled. Valid operations * include: 'avg', 'min', 'max', 'sum', 'countDistinct', 'sumDistinct', 'avgDistinct'. * * @example * ```typescript * // This would throw if 'invalidOperation' is not a valid aggregation method * await User.$onResourcefulIndex('*', 1, 10, ['id'], null, ctx, app, [], { * totalSales: ['invalidOperation'] * }) * ``` */ export declare class E_INVALID_AGGREGATION_OPERATION extends Exception { static status: number; static code: string; constructor(operationName: string, fieldName: string, modelName: string); } export declare class E_INVALID_RESOURCEFUL_ROUTER_OPTIONS extends Exception { static status: number; static code: string; readonly details?: ValidationError['details']; constructor(reason?: ValidationError); } export declare class E_UNRESOLVABLE_MODEL extends Exception { static status: number; static code: string; constructor(path: string, reason?: unknown); } export declare class E_INVALID_RESOURCEFUL_MODELS_MAP extends Exception { static status: number; static code: string; readonly details?: ValidationError['details']; constructor(reason?: ValidationError); } export declare class E_INVALID_RESOURCEFUL_MODELS_MAP_AGGREGATE extends Exception { static status: number; static code: string; readonly causes: (E_UNRESOLVABLE_MODEL | E_INVALID_RESOURCEFUL_MODELS_MAP)[]; constructor(causes: (E_UNRESOLVABLE_MODEL | E_INVALID_RESOURCEFUL_MODELS_MAP)[]); } export declare class E_RESOURCEFUL_ROUTER_MISCONFIGURED extends Exception { static status: number; static code: string; constructor(reason?: unknown); } export declare const E_ROUTE_NOT_FOUND: new (args: [ method: string, url: string ], options?: globalThis.ErrorOptions) => Exception; export declare class E_NOT_IN_MODEL_CONTEXT extends Exception { static status: number; static code: string; constructor(reason?: unknown); } export declare const E_INVALID_HTTP_METHOD_EXCEPTION: new (args: [ method: string, path: string ], options?: globalThis.ErrorOptions) => Exception; export { UNIQUE_CONSTRAINT_VIOLATION, FOREIGN_KEY_VIOLATION, NOT_NULL_VIOLATION, CHECK_CONSTRAINT_VIOLATION, DATA_VALIDATION_ERROR, INVALID_DATA_TYPE, DEADLOCK, LOCK_TIMEOUT, SCHEMA_ERROR, DATABASE_CONNECTION_ERROR, PERMISSION_DENIED, SERIALIZATION_FAILURE, QUERY_SYNTAX_ERROR, DIVISION_BY_ZERO, } from "./private/router_macro/utils/errors"; export declare class E_NOT_IN_ODATA_CONTEXT extends Exception { static status: number; static code: string; constructor(reason?: unknown); } export declare class E_UNACCEPTABLE_FORMAT extends Exception { static status: number; static code: string; constructor(fmt: string, reason?: unknown); } export declare class E_INVALID_ENTITYSET_IDENTIFIERS extends Exception { static status: number; static code: string; readonly details: ValidationError['details']; readonly help: string; constructor(causes: Set); } export declare class E_EXPAND_NOT_IMPLEMENTED extends Exception { static status: number; static code: string; readonly details: ValidationError['details']; constructor(modelName: string, causes: Array); } export declare class E_ODATA_FILTER_UNEXPECTED_CHARACTER extends Exception { static status: number; static code: string; readonly details: ValidationError['details']; constructor(char: string, position: number); } export declare class E_ODATA_FILTER_UNEXPECTED_TYPE extends Exception { static status: number; static code: string; readonly details: ValidationError['details']; constructor(type: string, token: any, value?: string); } export declare class E_ODATA_FILTER_UNEXPECTED_END_OF_INPUT extends Exception { static status: number; static code: string; readonly details: ValidationError['details']; constructor(); } export declare class E_ODATA_UNKNOWN_PARAMETER_ALIAS extends Exception { static status: number; static code: string; readonly details: ValidationError['details']; constructor(alias: string); } export declare class E_ODATA_FILTER_UNEXPECTED_TOKEN extends Exception { static status: number; static code: string; readonly details: ValidationError['details']; constructor(token: any); } export declare class E_ODATA_FILTER_INAPPLICABLE_NODE_TYPE extends Exception { static status: number; static code: string; readonly details: ValidationError['details']; constructor(node: any); } export declare class E_ODATA_FILTER_UNKNOWN_LOGICAL_OPERATOR extends Exception { static status: number; static code: string; readonly details: ValidationError['details']; constructor(node: any); } export declare class E_ODATA_FILTER_UNKNOWN_COMPARISON_OPERATOR extends Exception { static status: number; static code: string; readonly details: ValidationError['details']; constructor(node: any); } export declare class E_ODATA_FILTER_INVALID_COMPARISON_SIDE extends Exception { static status: number; static code: string; readonly details: ValidationError['details']; constructor(); } export declare class E_ODATA_FILTER_UNEVALUATABLE_NODE_TYPE extends Exception { static status: number; static code: string; readonly details: ValidationError['details']; constructor(node: any); } export declare class E_ODATA_FILTER_UNSUPPORTED_FUNCTION_COMPARISON extends Exception { static status: number; static code: string; readonly details: ValidationError['details']; constructor(funcName: string); } export declare class E_ODATA_FILTER_EXPECTED_COLUMN_REFERENCE extends Exception { static status: number; static code: string; readonly details: ValidationError['details']; constructor(); } export declare class E_UNSUPPORTED_DATABASE_DIALECT extends Exception { static status: number; static code: string; readonly details: ValidationError['details']; constructor(dialect: string); } export declare const E_ENCODED_BODY_PARSING_FAILED: new (args?: any, options?: globalThis.ErrorOptions) => Exception; export declare const E_MISSING_CURRENT_INSTANCE_ID: new (args?: any, options?: globalThis.ErrorOptions) => Exception;