export type KitErrorCode = 'STORAGE' | 'VALIDATION' | 'NOT_FOUND' | 'DUPLICATE' | 'FOREIGN_KEY' | 'RESTRICT' | 'CONFLICT' | 'TRIGGER_VALIDATION' | 'MIGRATION' | 'SCHEMA_DRIFT' | 'TIMEOUT' | 'UNSUPPORTED' | 'INTEGRITY' | 'AUTH_REQUIRED' | 'AUTH_NOT_REQUIRED' | 'INVALID_CREDENTIALS' | 'PERMISSION_DENIED' | 'QUERY_CANCELLED' | 'DEADLINE_EXCEEDED' | 'QUERY_ID_CONFLICT' | 'QUERY_REGISTRY_FULL' | 'QUERY_FAILED' | 'REMOTE_PROTOCOL' | 'CANCEL_TOO_LATE' | 'QUERY_ALREADY_FINISHED' | 'QUERY_NOT_FOUND' | 'TRANSACTION_ABORTED' | 'COMMIT_OUTCOME' | 'QUERY_CANCELLED_AFTER_COMMIT' | 'DEADLINE_AFTER_COMMIT' | 'RESULT_LIMIT_EXCEEDED' | 'SERIALIZATION_FAILED' | 'SERIALIZATION_FAILED_AFTER_COMMIT' | 'CAPABILITY_UNSUPPORTED' | 'QUERY_OUTCOME_UNKNOWN'; export interface DurableQueryOutcome { committed: boolean | null; committedStatements?: number; lastCommitEpoch?: bigint; /** Authoritative commit HLC when the server recorded one (0.64+). */ lastCommitHlc?: { physicalMicros: number; logical: number; nodeTiebreaker: number; }; firstCommitStatementIndex?: number; lastCommitStatementIndex?: number; completedStatements?: number; statementIndex?: number; /** Serialization phase name (parity with native serialization_state). */ serializationState?: string; } export interface SqlErrorMetadata { cancelOutcome?: string; cancellationReason?: string; retryable?: boolean; serverState?: string; } export declare class KitError extends Error { readonly code: KitErrorCode; constructor(message: string, code?: KitErrorCode); } export declare class KitValidationError extends KitError { table?: string; column?: string; constructor(message: string, table?: string, column?: string); } export declare class KitNotFoundError extends KitError { table: string; pk: unknown; constructor(table: string, pk: unknown); } export declare class KitDuplicateError extends KitError { table: string; constraint: string; constructor(table: string, constraint: string); } export declare class KitForeignKeyError extends KitError { table: string; constraint: string; constructor(table: string, constraint: string); } export declare class KitRestrictError extends KitError { table: string; constraint: string; constructor(table: string, constraint: string); } export declare class KitConflictError extends KitError { retryable: boolean; constructor(message?: string); } export declare class KitTriggerValidationError extends KitError { constructor(message: string); } export declare class KitMigrationError extends KitError { constructor(message: string); } export declare class KitSchemaDriftError extends KitError { constructor(message: string); } export declare class KitTimeoutError extends KitError { constructor(message?: string); } export declare class KitUnsupportedError extends KitError { constructor(message: string, code?: 'UNSUPPORTED' | 'CAPABILITY_UNSUPPORTED'); } export declare class CapabilityUnsupportedError extends KitUnsupportedError { constructor(message: string); } export declare class QueryCancelledError extends KitError { readonly queryId: string; readonly committed: boolean | null; readonly committedStatements?: number; readonly lastCommitEpoch?: bigint; readonly lastCommitHlc?: DurableQueryOutcome['lastCommitHlc']; readonly firstCommitStatementIndex?: number; readonly lastCommitStatementIndex?: number; readonly completedStatements?: number; readonly statementIndex?: number; readonly serializationState?: string; readonly cancelOutcome?: string; readonly cancellationReason?: string; readonly retryable?: boolean; readonly serverState?: string; constructor(queryId: string, message?: string, outcome?: DurableQueryOutcome, metadata?: SqlErrorMetadata); } export declare class QueryTimeoutError extends KitError { readonly queryId: string; readonly committed: boolean | null; readonly committedStatements?: number; readonly lastCommitEpoch?: bigint; readonly lastCommitHlc?: DurableQueryOutcome['lastCommitHlc']; readonly firstCommitStatementIndex?: number; readonly lastCommitStatementIndex?: number; readonly completedStatements?: number; readonly statementIndex?: number; readonly serializationState?: string; readonly cancelOutcome?: string; readonly cancellationReason?: string; readonly retryable?: boolean; readonly serverState?: string; constructor(queryId: string, message?: string, outcome?: DurableQueryOutcome, metadata?: SqlErrorMetadata); } export declare class CommitOutcomeError extends KitError { readonly queryId: string; readonly committed: boolean | null; readonly committedStatements?: number; readonly lastCommitEpoch?: bigint; readonly lastCommitHlc?: DurableQueryOutcome['lastCommitHlc']; readonly firstCommitStatementIndex?: number; readonly lastCommitStatementIndex?: number; readonly completedStatements?: number; readonly statementIndex?: number; readonly serializationState?: string; readonly cancelOutcome?: string; readonly cancellationReason?: string; readonly retryable?: boolean; readonly serverState?: string; constructor(queryId: string, message: string, outcome: DurableQueryOutcome, metadata?: SqlErrorMetadata); } export declare class QueryExecutionError extends KitError { readonly queryId: string; readonly terminalCode: string; readonly committed: boolean | null; readonly committedStatements?: number; readonly lastCommitEpoch?: bigint; readonly lastCommitHlc?: DurableQueryOutcome['lastCommitHlc']; readonly firstCommitStatementIndex?: number; readonly lastCommitStatementIndex?: number; readonly completedStatements?: number; readonly statementIndex?: number; readonly serializationState?: string; readonly cancelOutcome?: string; readonly cancellationReason?: string; readonly retryable?: boolean; readonly serverState?: string; constructor(queryId: string, terminalCode: string, message: string, outcome: DurableQueryOutcome, metadata?: SqlErrorMetadata); } export declare class RemoteProtocolError extends KitError { readonly serverCode: string; readonly httpStatus: number; readonly queryId?: string; readonly durableOutcome: DurableQueryOutcome; readonly metadata: SqlErrorMetadata; constructor(serverCode: string, httpStatus: number, message: string, queryId: string | undefined, outcome: DurableQueryOutcome, metadata?: SqlErrorMetadata); } export declare class ResultLimitExceededError extends KitError { readonly queryId: string; readonly committed: boolean | null; readonly committedStatements?: number; readonly lastCommitEpoch?: bigint; readonly lastCommitHlc?: DurableQueryOutcome['lastCommitHlc']; readonly firstCommitStatementIndex?: number; readonly lastCommitStatementIndex?: number; readonly completedStatements?: number; readonly statementIndex?: number; readonly serializationState?: string; readonly cancelOutcome?: string; readonly cancellationReason?: string; readonly retryable?: boolean; readonly serverState?: string; constructor(queryId: string, message: string, outcome: DurableQueryOutcome, metadata?: SqlErrorMetadata); } export declare class SerializationError extends KitError { readonly queryId: string; readonly committed: boolean | null; readonly committedStatements?: number; readonly lastCommitEpoch?: bigint; readonly lastCommitHlc?: DurableQueryOutcome['lastCommitHlc']; readonly firstCommitStatementIndex?: number; readonly lastCommitStatementIndex?: number; readonly completedStatements?: number; readonly statementIndex?: number; readonly serializationState?: string; readonly cancelOutcome?: string; readonly cancellationReason?: string; readonly retryable?: boolean; readonly serverState?: string; constructor(queryId: string, message: string, outcome: DurableQueryOutcome, metadata?: SqlErrorMetadata); } export declare class QueryOutcomeUnknownError extends KitError { readonly queryId: string; readonly committed: null; readonly committedStatements: null; readonly lastCommitEpoch: null; readonly firstCommitStatementIndex: null; readonly lastCommitStatementIndex: null; readonly completedStatements: null; readonly statementIndex: null; readonly cancelOutcome?: string; readonly cancellationReason?: string; readonly retryable?: boolean; readonly serverState?: string; constructor(queryId: string, message?: string, metadata?: SqlErrorMetadata); } export declare class QueryIdConflictError extends KitError { readonly queryId: string; constructor(queryId: string, message?: string); } export declare class TransactionAbortedError extends KitError { constructor(message?: string); } /** Thrown when a `require_auth` database is opened without credentials, or an * operation runs on a handle with no cached principal. HTTP 401 equivalent. */ export declare class KitAuthRequiredError extends KitError { constructor(message: string); } /** Thrown when a credentialed constructor is used on a credentialless database * (the caller picked the wrong constructor). */ export declare class KitAuthNotRequiredError extends KitError { constructor(message: string); } /** Thrown when `openWithCredentials` verification fails (bad username/password). * HTTP 401 equivalent. */ export declare class KitInvalidCredentialsError extends KitError { readonly username: string; constructor(username: string); } /** Thrown when an operation's required permission is not satisfied by the * cached principal. HTTP 403 equivalent. */ export declare class KitPermissionDeniedError extends KitError { constructor(message: string); } /** * Returns true when the underlying error is a retryable MongrelDB write-write * conflict. The native addon prefixes commit-time conflict errors with * `__CONFLICT__:` so callers can detect them without instanceof checks against * addon-owned classes that may not cross the require boundary cleanly. */ export declare function isRetryableConflict(err: unknown): boolean; //# sourceMappingURL=errors.d.ts.map