UNPKG

@omniconvert/server-side-testing-sdk

Version:

TypeScript SDK for server-side A/B testing and experimentation

86 lines 2.48 kB
import { ContextParamInterface } from './ContextParamInterface'; /** * Context class for managing all context parameters * Provides validation and parameter management for experiments */ export declare class Context { private params; constructor(params?: ContextParamInterface[]); /** * Add a parameter to the context */ addParam(param: ContextParamInterface): void; /** * Check if a parameter exists by class name */ hasParam(paramClassName: string): boolean; /** * Get a parameter by its class name */ getParam(paramClassName: string): ContextParamInterface | undefined; /** * Get a parameter by its class constructor */ getParamByClass<T extends ContextParamInterface>(paramClass: new (...args: any[]) => T): T | undefined; /** * Get the value of a parameter by its class name, or an empty string if not set */ getParamValueOrEmptyString(paramClassName: string): string; /** * Get the value of a parameter by its class constructor */ getParamValue<T extends ContextParamInterface>(paramClass: new (...args: any[]) => T): unknown; /** * Remove a parameter by class name */ removeParam(paramClassName: string): boolean; /** * Remove a parameter by class constructor */ removeParamByClass<T extends ContextParamInterface>(paramClass: new (...args: any[]) => T): boolean; /** * Validate all parameters in the context */ validate(): void; /** * Get all context parameters */ getAllParams(): ContextParamInterface[]; /** * Get parameters by type/instance */ getParams<T extends ContextParamInterface>(paramClass: new (...args: any[]) => T): T[]; /** * Get all parameter names */ getParamNames(): string[]; /** * Get the number of parameters */ getParamCount(): number; /** * Clear all parameters */ clear(): void; /** * Check if context is empty */ isEmpty(): boolean; /** * Convert the context to an array representation */ toArray(): Record<string, unknown>; /** * Convert to JSON */ toJSON(): Record<string, unknown>; /** * Create context from plain object (for deserialization) */ static fromObject(_obj: Record<string, unknown>): Context; /** * Clone the context */ clone(): Context; } //# sourceMappingURL=Context.d.ts.map