/** * 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-roles. * * Mirrors the `code + factory` shape used by `AdminUsersError`. Codes * are dot-prefixed (`admin.roles.*`) so they sort alongside the matching * ability keys in logs and admin UI messages. */ export declare const AdminRolesErrorCodes: { readonly NOT_FOUND: 'admin.roles.notFound'; readonly MACHINE_NAME_IN_USE: 'admin.roles.machineNameInUse'; readonly VERSION_CONFLICT: 'admin.roles.versionConflict'; readonly USER_NOT_FOUND: 'admin.roles.userNotFound'; }; export type AdminRolesErrorCode = (typeof AdminRolesErrorCodes)[keyof typeof AdminRolesErrorCodes]; export interface AdminRolesErrorOptions { message?: string; cause?: unknown; } export declare class AdminRolesError extends Error { readonly code: AdminRolesErrorCode; constructor(code: AdminRolesErrorCode, options: { message: string; cause?: unknown; }); } /** The referenced admin role id does not exist. */ export declare const ERR_ADMIN_ROLE_NOT_FOUND: (options?: AdminRolesErrorOptions) => AdminRolesError; /** Creating a role conflicts with an existing `machine_name`. */ export declare const ERR_ADMIN_ROLE_MACHINE_NAME_IN_USE: (options?: AdminRolesErrorOptions) => AdminRolesError; /** * 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_ROLE_VERSION_CONFLICT: (options?: AdminRolesErrorOptions) => AdminRolesError; /** * The admin user targeted by a role-assignment operation does not exist. * Module-local rather than reaching into `@byline/admin/admin-users`' * error codes — keeps the modules decoupled. */ export declare const ERR_ADMIN_ROLE_USER_NOT_FOUND: (options?: AdminRolesErrorOptions) => AdminRolesError;