import { RequestDocument, Variables } from 'graphql-request'; interface TokenPair { accessToken: string; refreshToken: string; expiresAt?: number; } type Json = unknown; type Env = 'prod' | 'alpha' | 'dev' | 'local'; interface PaginationInput { limit?: number; offset?: number; sortBy?: string; sortOrder?: 'asc' | 'desc'; } interface ContextInput { userId?: string; workspaceId?: string; projectId?: string; appId?: string; custom?: Record; } interface TokenStore { get(): Promise; set(tokens: TokenPair): Promise; clear(): Promise; } declare class InMemoryTokenStore implements TokenStore { private tokens; constructor(initial?: TokenPair | null); get(): Promise; set(tokens: TokenPair): Promise; clear(): Promise; } interface FileTokenStoreOptions { path: string; } declare class FileTokenStore implements TokenStore { private readonly opts; constructor(opts: FileTokenStoreOptions); get(): Promise; set(tokens: TokenPair): Promise; clear(): Promise; } interface EnvTokenStoreOptions { accessTokenVar: string; refreshTokenVar?: string; expiresAtVar?: string; } declare class EnvTokenStore implements TokenStore { private readonly opts; constructor(opts: EnvTokenStoreOptions); get(): Promise; set(_tokens: TokenPair): Promise; clear(): Promise; } declare class AuthStore { private readonly tokenStore; private workspaceToken; private apiKey; constructor(tokenStore: TokenStore); getTokens(): Promise; setTokens(tokens: TokenPair): Promise; clearTokens(): Promise; setWorkspaceToken(token: string | null): void; getWorkspaceToken(): string | null; setApiKey(key: string | null): void; getApiKey(): string | null; isAuthenticated(): Promise; } declare function createAuthStore(initial?: { tokens?: TokenPair | null; workspaceToken?: string | null; apiKey?: string | null; tokenStore?: TokenStore; }): AuthStore; interface BaseGraphQLClientOptions { workspaceEndpoint: string; globalEndpoint: string; productOrigin?: string; auth: AuthStore; timeout?: number; autoRefresh?: boolean; onTokenRefresh?: (tokens: { accessToken: string; refreshToken: string; expiresAt?: number; }) => void | Promise; defaultSignal?: AbortSignal; } interface GqlRequestOptions { signal?: AbortSignal; } declare class BaseGraphQLClient { private readonly workspaceClient; private readonly globalClient; private readonly opts; constructor(opts: BaseGraphQLClientOptions); private buildHeaders; private isExpiringSoon; private ensureFresh; performTokenRefresh(): Promise<{ accessToken: string; refreshToken: string; expiresAt?: number; }>; private executeWithRetry; globalRequest(document: RequestDocument, variables?: Variables, options?: GqlRequestOptions): Promise; workspaceRequest(document: RequestDocument, variables?: Variables, options?: GqlRequestOptions): Promise; workspaceAuthOnlyRequest(document: RequestDocument, variables?: Variables, options?: GqlRequestOptions): Promise; } interface GqlClient { request(document: RequestDocument, variables?: Variables, options?: GqlRequestOptions): Promise; } declare function gqlClient(base: BaseGraphQLClient, scope: 'workspace' | 'global' | 'workspaceAuthOnly'): GqlClient; type LogLevel = 'debug' | 'info' | 'warn' | 'error'; interface Logger { debug(msg: string, meta?: Record): void; info(msg: string, meta?: Record): void; warn(msg: string, meta?: Record): void; error(msg: string, meta?: Record): void; } declare function createLogger(opts?: { level?: LogLevel; prefix?: string; }): Logger; declare class ModuleRegistry { private readonly apis; set(id: string, api: unknown): void; get(id: string): API; has(id: string): boolean; ids(): readonly string[]; } interface SdkContextConfig { productName: string; productVersion?: string; workspaceEndpoint?: string; globalEndpoint?: string; productOrigin?: string; oidcIssuer?: string; clientId?: string; clientSecret?: string; redirectUri?: string; apiKey?: string; accessToken?: string; refreshToken?: string; workspaceToken?: string; tokenStore?: TokenStore; timeout?: number; autoRefresh?: boolean; onTokenRefresh?: (tokens: TokenPair) => void | Promise; env?: Env; logLevel?: LogLevel; logger?: Logger; signal?: AbortSignal; } interface OidcConfig { issuer: string; clientId?: string; clientSecret?: string; redirectUri?: string; } interface SdkContext { readonly productName: string; readonly productVersion: string; readonly env: Env; readonly gql: { workspace: GqlClient; global: GqlClient; workspaceAuthOnly: GqlClient; }; readonly client: BaseGraphQLClient; readonly auth: AuthStore; readonly oidc: OidcConfig; readonly logger: Logger; readonly modules: ModuleRegistry; readonly signal?: AbortSignal; } declare function buildContext(config: SdkContextConfig): SdkContext; interface SdkModule { readonly id: string; readonly version: string; readonly displayName: string; readonly dependsOn?: readonly string[]; attach(ctx: SdkContext): API; } declare function sortModules(modules: readonly SdkModule[]): SdkModule[]; export { AuthStore as A, BaseGraphQLClient as B, type ContextInput as C, type Env as E, FileTokenStore as F, type GqlClient as G, InMemoryTokenStore as I, type Json as J, type LogLevel as L, ModuleRegistry as M, type OidcConfig as O, type PaginationInput as P, type SdkModule as S, type TokenPair as T, type SdkContext as a, EnvTokenStore as b, type EnvTokenStoreOptions as c, type FileTokenStoreOptions as d, type GqlRequestOptions as e, type Logger as f, type SdkContextConfig as g, type TokenStore as h, buildContext as i, createAuthStore as j, createLogger as k, gqlClient as l, sortModules as s };