/** * VariableScope * * Hierarchical variable scoping system for http-test. * Variables are resolved in priority order from highest to lowest: * 1. Request-level (@var = value in current request) * 2. File-level (@var = value at file top) * 3. Runtime variables (from --var file) * 4. Environment variables (http-client.env.json) * 5. Script globals (client.global.set) * 6. Dynamic variables ($guid, $timestamp, etc.) * 7. System environment ($processEnv NAME) */ /** * Scope type enumeration */ export declare enum ScopeType { /** Request-level variables */ REQUEST = "request", /** File-level variables */ FILE = "file", /** Runtime variables from --var file */ RUNTIME = "runtime", /** Environment variables from http-client.env.json */ ENVIRONMENT = "environment", /** Script global variables */ SCRIPT_GLOBAL = "script_global", /** Dynamic variables ($guid, $timestamp, etc.) */ DYNAMIC = "dynamic", /** System environment variables */ SYSTEM = "system" } /** * Priority order for scope types (higher = higher priority) */ export declare const ScopePriority: Record; /** * Variable value type */ export type VariableValue = string | number | boolean; /** * Variables record type */ export type Variables = Record; /** * Variable scope with optional parent chain */ export declare class VariableScope { readonly type: ScopeType; private parent?; private variables; /** * Create a new variable scope * @param type Scope type * @param parent Optional parent scope for chain resolution */ constructor(type: ScopeType, parent?: VariableScope); /** * Set a variable in this scope */ set(key: string, value: VariableValue): void; /** * Set multiple variables at once */ setMany(variables: Variables): void; /** * Get a variable from this scope only (not parent) */ get(key: string): VariableValue | undefined; /** * Check if variable exists in this scope only */ has(key: string): boolean; /** * Delete a variable from this scope */ delete(key: string): boolean; /** * Clear all variables in this scope */ clear(): void; /** * Get all variables in this scope only */ getAll(): Variables; /** * Resolve a variable through the scope chain * Checks this scope first, then parent scopes */ resolve(key: string): VariableValue | undefined; /** * Check if variable exists in this scope or any parent */ resolvable(key: string): boolean; /** * Get all resolved variables from this scope and all parents * Higher priority scopes override lower priority ones */ resolveAll(): Variables; /** * Get the parent scope */ getParent(): VariableScope | undefined; /** * Set a new parent scope */ setParent(parent: VariableScope | undefined): void; /** * Get the number of variables in this scope only */ size(): number; } /** * Complete scope chain for a request */ export interface ScopeChain { /** System environment scope (lowest priority) */ system: VariableScope; /** Dynamic variables scope */ dynamic: VariableScope; /** Script global variables scope */ scriptGlobal: VariableScope; /** Environment file scope */ environment: VariableScope; /** Runtime variables scope */ runtime: VariableScope; /** File-level scope */ file: VariableScope; /** Request-level scope (highest priority) */ request: VariableScope; } /** * Create a complete scope chain with proper parent links */ export declare function createScopeChain(): ScopeChain; /** * Create a fresh request scope attached to existing file scope */ export declare function createRequestScope(fileScope: VariableScope): VariableScope;