import * as _ops_ai_toggly_hooks_types from '@ops-ai/toggly-hooks-types'; import { T as TogglyConfig, a as TogglyClient, F as Flags, V as VariantResult } from '../index-B3YY1P83.js'; import '@ops-ai/toggly-local-gates'; /** * Server-side Toggly client implementation */ declare class TogglyServer implements TogglyClient { private readonly config; private cache; private fetchPromise; private readonly isBuildTime; private telemetry; /** * Once we have counted a TTL skip for a given cache timestamp, further * getFlag/getFlags calls in the same TTL window do not increment again * (one outcome per refresh attempt, not per evaluate). */ private ttlHitCountedForTimestamp; constructor(config: TogglyConfig, isBuildTime?: boolean); private startTelemetry; private recordDefinitionCacheHit; private recordDefinitionCacheMiss; /** Flush pending usage stats and business metrics. */ flushTelemetry(): Promise; measure(metricKey: string, value: number, options?: { feature?: string; variant?: string; }): void; incrementCounter(metricKey: string, value?: number, options?: { feature?: string; variant?: string; }): void; observe(metricKey: string, value: number, options?: { feature?: string; variant?: string; }): void; /** Flush and tear down usage/metrics telemetry. */ close(options?: { timeoutMs?: number; }): Promise; /** * Get API URL for fetching definitions (or evaluated variants when enableVariants). */ private getApiUrl; private buildEvalContext; /** * Check if cache is valid */ private isCacheValid; private defaultsOnlyCache; /** * Fetch flags (and optional variant defs) from Toggly API. * Returns a result plus whether this call applied a new network revision (miss) * or served last-good cache after error (hit). Defaults-only is neither. */ private fetchFlags; /** * Refresh flags cache. * Counts one definition-refresh hit/miss per performed attempt. * Concurrent in-flight skips do not count. */ refreshFlags(): Promise; private ensureCache; /** * Get all feature flags */ getFlags(): Promise; /** * Get a single feature flag value */ getFlag(key: string, defaultValue?: boolean, entity?: _ops_ai_toggly_hooks_types.TogglyEntityContext | Record | null, kind?: string): Promise; /** * Evaluate a feature gate with multiple flags */ evaluateGate(keys: string[], requirement?: 'all' | 'any', negate?: boolean, entity?: _ops_ai_toggly_hooks_types.TogglyEntityContext | Record | null, kind?: string): Promise; registerContext(kind: string, mapper: (entity: T) => _ops_ai_toggly_hooks_types.TogglyEntityContext): void; /** * Current variant assignment for a feature (requires enableVariants). */ getVariant(featureKey: string): Promise; /** * Configuration payload for the assigned variant, if any. */ getVariantValue(featureKey: string, isT?: (v: unknown) => v is T): Promise; } /** * Create a new Toggly server-side client instance */ declare function createTogglyServerClient(config: TogglyConfig, isBuildTime?: boolean): TogglyServer; export { TogglyServer, createTogglyServerClient };