import { type CliConfig } from '../config/index.js'; import { type AuthContext } from '../context.js'; import { validateToken } from './validate-token.js'; /** A stored auth setting an environment variable may override. */ export type AuthSetting = 'endpoint' | 'token' | 'workspaceId'; /** * Refuse to store a setting the environment overrides. * * The env-override policy lives here alone: every auth mutation asserts * through this before writing, so a command that appears to succeed cannot * leave the CLI using something else. * * @param action What the command does, e.g., `log in`. */ export declare const assertMutable: (auth: AuthContext, setting: AuthSetting, action: string) => void; /** * Store a token, validating it first. * * The token is stored under the endpoint it will be used with, which * `--endpoint` or the environment may have pointed elsewhere for this one * command: logging in to another endpoint stores a token for it without * selecting it. The workspace is only what the token is validated against, * as a Personal Access Token is meaningless without one. * * Validation reaches the network, so a test may inject its own `validate`. */ export declare const login: (token: string, config?: CliConfig, validate?: typeof validateToken) => Promise; /** Store the token for the current endpoint, e.g., one just prompted for. */ export declare const storeToken: (token: string, config?: CliConfig) => void; /** Remove the stored token and workspace selection. */ export declare const logout: (config?: CliConfig) => void; /** * Store the endpoint to make requests against. * * The workspace selection belongs to the previous endpoint, so it is cleared. */ export declare const selectEndpoint: (endpoint: string, config?: CliConfig) => void; /** Store the workspace requests are made against. */ export declare const selectWorkspace: (workspaceId: string, config?: CliConfig) => void; /** Store whether the API schema comes from the endpoint instead of npm. */ export declare const setUseRemoteSchema: (useRemoteSchema: boolean, config?: CliConfig) => void;