/** * This Source Code is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Copyright (c) Infonomic Company Limited */ /** * Module-local error codes for admin-users. * * Follows the same `code + factory` shape used by `AuthError` in * `@byline/auth`, but with its own class so consumers can distinguish * admin-users-specific failures from generic auth failures (e.g. to * translate `EMAIL_IN_USE` into a 409 at a transport boundary while * `FORBIDDEN` maps to 403). * * The codes are intentionally prefixed — `admin.users.*` — so they sort * alongside the matching ability keys in logs and admin UI messages. */ export declare const AdminUsersErrorCodes: { readonly NOT_FOUND: 'admin.users.notFound'; readonly EMAIL_IN_USE: 'admin.users.emailInUse'; readonly SELF_DELETE_FORBIDDEN: 'admin.users.selfDeleteForbidden'; readonly SELF_DISABLE_FORBIDDEN: 'admin.users.selfDisableForbidden'; readonly VERSION_CONFLICT: 'admin.users.versionConflict'; }; export type AdminUsersErrorCode = (typeof AdminUsersErrorCodes)[keyof typeof AdminUsersErrorCodes]; export interface AdminUsersErrorOptions { message?: string; cause?: unknown; } export declare class AdminUsersError extends Error { readonly code: AdminUsersErrorCode; constructor(code: AdminUsersErrorCode, options: { message: string; cause?: unknown; }); } /** The referenced admin user id does not exist. */ export declare const ERR_ADMIN_USER_NOT_FOUND: (options?: AdminUsersErrorOptions) => AdminUsersError; /** Creating or updating an admin user conflicts with an existing email. */ export declare const ERR_ADMIN_USER_EMAIL_IN_USE: (options?: AdminUsersErrorOptions) => AdminUsersError; /** The actor attempted to delete their own admin-user row. */ export declare const ERR_ADMIN_USER_SELF_DELETE: (options?: AdminUsersErrorOptions) => AdminUsersError; /** The actor attempted to disable their own admin-user row. */ export declare const ERR_ADMIN_USER_SELF_DISABLE: (options?: AdminUsersErrorOptions) => AdminUsersError; /** * The stored `vid` does not match the client-supplied `expectedVid` — * the caller is holding a stale version of the row. Typical admin-UI * response is to reload the edit form with the current values. */ export declare const ERR_ADMIN_USER_VERSION_CONFLICT: (options?: AdminUsersErrorOptions) => AdminUsersError;