import type { ServiceResult } from '../models/service-result.js'; import type { UserReadiness } from './UserReadinessService.js'; import { type UserConfigurationResult, type IConfigurationServiceDeps } from './UserConfigurationTypes.js'; /** * Handles the configure workflow for UserConfigurationService. * * Checks the current user state, identifies required changes (permission sets, * API-only profiling), and optionally applies them. Supports dry-run mode to * preview changes without applying them. * * This class is instantiated by UserConfigurationService and should not be * used directly by consumers. */ export declare class ConfigureMode { private readonly deps; constructor(deps: IConfigurationServiceDeps); /** * Creates an empty UserConfigurationResult for error cases. */ private static createEmptyConfigurationResult; /** * Builds the previous configuration state from readiness check. */ private static buildConfigurationState; /** * Builds the list of required configuration actions. */ private static buildConfigurationActions; /** * Creates the result when Cuneiform is not installed. */ private static createCuneiformNotInstalledResult; /** * Handles permission set insert failures, mapping error codes appropriately. */ private static handlePermissionSetInsertFailure; /** * Orchestrates user configuration for Cuneiform operations. * * Checks the current user state, identifies required changes (permission sets, * API-only profiling), and optionally applies them. Supports dry-run mode to * preview changes without applying them. * * **Idempotency**: Skips already-configured items. Re-running configure() on * a fully configured user will report all actions as 'skipped'. * * @param userId - The Salesforce user ID to configure * @param options - Configuration options * @param options.dryRun - If true, reports planned changes without applying them (default: false) * @param options.readiness - Pre-fetched readiness snapshot. When provided, reuses it instead of issuing a second checkReadiness call — guaranteeing agreement with the caller's display. * @returns ServiceResult containing UserConfigurationResult with actions taken/skipped/failed */ execute(userId: string, options?: { dryRun?: boolean; readiness?: UserReadiness; }): Promise>; /** * Executes a single permission set assignment action. */ private executePermissionSetAction; /** * Executes a single API-only profiling action. */ private executeApiOnlyProfilingAction; /** * Executes all configuration actions sequentially. * * Actions are executed sequentially because permission set assignments * may have dependencies and order matters for proper error reporting. */ private executeConfigurationActions; /** * Builds user state from a pre-fetched readiness snapshot. Avoids a second * `checkReadiness` call when the caller already has a fresh snapshot — the * canonical agreement guarantee for `user details --configure`. * * Username is still fetched independently (different SOQL query than readiness). * `getUserInfo` failures degrade to an empty username — matching the tolerance * of `fetchUserReadinessState` so the caller path is no less defensive. */ private fetchUserStateWithCachedReadiness; /** * Fetches user readiness state and user info in parallel. */ private fetchUserReadinessState; /** * Fetches the updated configuration state after applying changes. */ private fetchUpdatedState; /** * Builds the final configuration result based on execution outcomes. */ private buildConfigurationResult; /** * Creates the result for dry-run mode or when no changes are needed. */ private createDryRunOrNoChangesResult; }