{
  "version": 3,
  "sources": ["../../src/client.ts", "../../src/openapi/api.ts", "../../src/openapi/base.ts", "../../src/openapi/common.ts", "../../src/openapi/configuration.ts", "../../src/version.ts", "../../src/sdk_codes.ts", "../../src/polling.ts", "../../src/streaming.ts", "../../src/constants.ts", "../../src/log.ts", "../../src/store.ts", "../../src/evaluator.ts", "../../src/repository.ts", "../../src/metrics.ts", "../../src/index.ts"],
  "sourcesContent": ["import EventEmitter from 'events';\nimport jwt_decode from 'jwt-decode';\nimport axios, { AxiosInstance, AxiosRequestConfig } from 'axios';\nimport axiosRetry from 'axios-retry';\nimport {\n  APIConfiguration,\n  Claims,\n  Options,\n  StreamEvent,\n  Target,\n} from './types';\nimport { Configuration, ClientApi, FeatureConfig, Variation } from './openapi';\nimport { VERSION } from './version';\nimport { PollerEvent, PollingProcessor } from './polling';\nimport { StreamProcessor } from './streaming';\nimport { Evaluator } from './evaluator';\nimport { apiConfiguration, defaultOptions } from './constants';\nimport { Repository, RepositoryEvent, StorageRepository } from './repository';\nimport {\n  MetricEvent,\n  MetricsProcessor,\n  MetricsProcessorInterface,\n} from './metrics';\nimport { Logger } from './log';\nimport {\n  infoMetricsThreadStarted,\n  infoPollStarted,\n  infoSDKCloseSuccess,\n  infoSDKInitOK,\n  infoSDKStartClose,\n  infoStreamConnected,\n  warnAuthFailedSrvDefaults,\n  warnDefaultVariationServed,\n  warnFailedInitAuthError,\n  warnMissingSDKKey,\n} from './sdk_codes';\nimport https from 'https';\nimport * as fs from 'fs';\n\nenum Processor {\n  POLL,\n  STREAM,\n  METRICS,\n}\n\nexport enum Event {\n  READY = 'ready',\n  FAILED = 'failed',\n  CHANGED = 'changed',\n}\n\nexport const SDK_INFO = `NodeJS ${VERSION} Server`;\n\nexport default class Client {\n  private evaluator: Evaluator;\n  private repository: Repository;\n  private api: ClientApi;\n  private sdkKey: string;\n  private log: Logger;\n  private authToken: string;\n  private environment: string;\n  private configuration: Configuration;\n  private options: Options;\n  private apiConfiguration: APIConfiguration = apiConfiguration;\n  private cluster = '1';\n  private eventBus = new EventEmitter();\n  private pollProcessor: PollingProcessor;\n  private streamProcessor: StreamProcessor;\n  private metricsProcessor: MetricsProcessorInterface;\n  private initialized = false;\n  private failure = false;\n  private waitForInitializePromise: Promise<Client>;\n  private pollerReady = false;\n  private streamReady = false;\n  private metricReady = false;\n  private closing = false;\n  private httpsClient: AxiosInstance;\n  private httpsCa: Buffer;\n\n  constructor(sdkKey: string, options: Options = {}) {\n    this.sdkKey = sdkKey;\n    this.options = { ...defaultOptions, ...options };\n    this.log = this.options.logger;\n\n    if (options.pollInterval < defaultOptions.pollInterval) {\n      this.options.pollInterval = defaultOptions.pollInterval;\n      this.log.warn(\n        `Polling interval cannot be lower than ${defaultOptions.pollInterval} ms`,\n      );\n    }\n\n    if (options.eventsSyncInterval < defaultOptions.eventsSyncInterval) {\n      this.options.eventsSyncInterval = defaultOptions.eventsSyncInterval;\n      this.log.warn(\n        `Events sync interval cannot be lower than ${defaultOptions.eventsSyncInterval} ms`,\n      );\n    }\n\n    this.configuration = new Configuration({\n      basePath: this.options.baseUrl,\n      baseOptions: {\n        headers: {\n          'User-Agent': `NodeJsSDK/${VERSION}`,\n          'Harness-SDK-Info': SDK_INFO,\n        },\n      },\n    });\n\n    this.repository = new StorageRepository(\n      this.options.cache,\n      this.options.store,\n      this.eventBus,\n    );\n    this.evaluator = new Evaluator(this.repository, this.log);\n\n    if (this.options.tlsTrustedCa) {\n      this.httpsCa = fs.readFileSync(this.options.tlsTrustedCa);\n    }\n\n    // Setup https client for sass or on-prem connections\n    this.httpsClient = this.createAxiosInstanceWithRetries(\n      this.options,\n      this.httpsCa,\n    );\n    this.api = new ClientApi(\n      this.configuration,\n      this.options.baseUrl,\n      this.httpsClient,\n    );\n\n    this.processEvents();\n    this.run();\n  }\n\n  private processEvents(): void {\n    this.eventBus.on(PollerEvent.READY, () => {\n      this.initialize(Processor.POLL);\n    });\n\n    this.eventBus.on(PollerEvent.ERROR, (error) => {\n      this.failure = true;\n      this.eventBus.emit(\n        Event.FAILED,\n        new Error(\n          `Failed to load flags or groups: ${error?.message ?? 'unknown'}`,\n        ),\n      );\n    });\n\n    this.eventBus.on(StreamEvent.READY, () => {\n      this.initialize(Processor.STREAM);\n    });\n\n    // Track if we've already logged the streaming error since the last successful connection\n    let streamingErrorLogged = false;\n\n    // Reset the error logging flag when we connect successfully\n    this.eventBus.on(StreamEvent.CONNECTED, () => {\n      // Reset the streaming error logged state when we successfully connect\n      streamingErrorLogged = false;\n      this.pollProcessor.stop();\n    });\n\n    // Handle stream retry events\n    this.eventBus.on(StreamEvent.RETRYING, () => {\n      this.failure = true;\n\n      // Only log the error message if it's the first time since the last successful connection\n      if (!streamingErrorLogged) {\n        this.log.error(\n          'Issue with streaming: falling back to polling while the SDK attempts to reconnect',\n        );\n        streamingErrorLogged = true;\n      } else {\n        // Log at debug level for subsequent retries until a successful reconnection\n        this.log.debug(\n          'Still trying to reconnect stream, staying on polling for now',\n        );\n      }\n\n      if (!this.closing) {\n        this.pollProcessor.start();\n      }\n    });\n\n    this.eventBus.on(StreamEvent.ERROR, () => {\n      this.failure = true;\n      this.log.error(\n        'Unrecoverable issue with streaming: falling back to polling',\n      );\n\n      if (!this.closing) {\n        this.pollProcessor.start();\n      }\n\n      this.eventBus.emit(Event.FAILED);\n    });\n\n    this.eventBus.on(MetricEvent.READY, () => {\n      this.initialize(Processor.METRICS);\n    });\n\n    this.eventBus.on(MetricEvent.ERROR, () => {\n      this.failure = true;\n      this.eventBus.emit(Event.FAILED);\n    });\n\n    this.eventBus.on(StreamEvent.DISCONNECTED, () => {\n      if (!this.closing) {\n        this.pollProcessor.start();\n      }\n    });\n\n    for (const event of Object.values(RepositoryEvent)) {\n      this.eventBus.on(event, (identifier) => {\n        switch (event) {\n          case RepositoryEvent.FLAG_STORED:\n          case RepositoryEvent.FLAG_DELETED:\n            this.eventBus.emit(Event.CHANGED, identifier);\n            break;\n          case RepositoryEvent.SEGMENT_STORED:\n          case RepositoryEvent.SEGMENT_DELETED:\n            // find all flags where segment match and emit the event\n            this.repository\n              .findFlagsBySegment(identifier)\n              .then((values: string[]) => {\n                values.forEach((value) =>\n                  this.eventBus.emit(Event.CHANGED, value),\n                );\n              });\n            break;\n        }\n      });\n    }\n  }\n\n  on(event: Event, callback: (...args: unknown[]) => void): void {\n    const arrayObjects = [];\n\n    for (const value of Object.values(Event)) {\n      arrayObjects.push(value);\n    }\n\n    if (arrayObjects.includes(event)) {\n      this.eventBus.on(event, callback);\n    }\n  }\n\n  off(event?: string, callback?: () => void): void {\n    if (event) {\n      this.eventBus.off(event, callback);\n    } else {\n      this.close();\n    }\n  }\n\n  private async authenticate(): Promise<void> {\n    if (!this.sdkKey) {\n      warnMissingSDKKey(this.log);\n      this.failure = true;\n      return;\n    }\n\n    try {\n      const response = await this.api.authenticate({\n        apiKey: this.sdkKey,\n      });\n      this.authToken = response.data.authToken;\n      this.configuration.accessToken = this.authToken;\n\n      const decoded: Claims = jwt_decode(this.authToken);\n\n      if (!decoded.environment) {\n        this.failure = true;\n        this.log.error(\n          'Error while authenticating, err:  the JWT token has missing claim \"environmentUUID\" ',\n        );\n      }\n\n      if (decoded.accountID) {\n        this.configuration.baseOptions.headers['Harness-AccountID'] =\n          decoded.accountID;\n      }\n\n      if (decoded.environmentIdentifier) {\n        this.configuration.baseOptions.headers['Harness-EnvironmentID'] =\n          decoded.environmentIdentifier;\n      }\n\n      this.environment = decoded.environment;\n      this.cluster = decoded.clusterIdentifier || '1';\n    } catch (error) {\n      this.failure = true;\n      this.log.error('Error while authenticating, err: ', error);\n      warnAuthFailedSrvDefaults(this.log);\n      warnFailedInitAuthError(this.log);\n      this.eventBus.emit(Event.FAILED, error);\n    }\n  }\n\n  waitForInitialization(): Promise<Client> {\n    if (!this.waitForInitializePromise) {\n      if (this.initialized) {\n        this.waitForInitializePromise = Promise.resolve(this);\n      } else if (!this.initialized && this.failure) {\n        // We unblock the call even if initialization has failed. We've\n        // already warned the user that initialization has failed with the reason and that\n        // defaults will be served\n        this.waitForInitializePromise = Promise.resolve(this);\n      } else {\n        this.waitForInitializePromise = new Promise((resolve, reject) => {\n          this.eventBus.once(Event.READY, () => {\n            setTimeout(() => resolve(this), 0);\n          });\n          this.eventBus.once(Event.FAILED, reject);\n        });\n      }\n    }\n    return this.waitForInitializePromise;\n  }\n\n  private axiosRetryCondition(error) {\n    // Auth is a POST request so not covered by isNetworkOrIdempotentRequestError and it's not an aborted connection\n    const status = error?.response?.status;\n    const url = error?.config?.url ?? '';\n    const metricsUuidPattern = /metrics\\/[0-9a-fA-F-]{36}/;\n\n    if (url.includes('client/auth') && status === 403) {\n      // No point retrying with wrong SDK key\n      return false;\n    }\n\n    if (metricsUuidPattern.test(url) && status === 400) {\n      // No point retrying with the same bad metrics payload over and over again\n      return false;\n    }\n\n    // Otherwise retry: if connection is aborted, DNS issues, service down, network errors, etc\n    return true;\n  }\n\n  private createAxiosInstanceWithRetries(\n    options: Options,\n    httpsCa: Buffer,\n  ): AxiosInstance {\n    let axiosConfig: AxiosRequestConfig = {\n      timeout: options.axiosTimeout,\n    };\n\n    if (httpsCa) {\n      // Set axiosConfig with httpsAgent when TLS config is provided\n      axiosConfig = {\n        ...axiosConfig,\n        httpsAgent: new https.Agent({\n          ca: httpsCa,\n        }),\n      };\n    }\n\n    const instance: AxiosInstance = axios.create(axiosConfig);\n    axiosRetry(instance, {\n      retries: options.axiosRetries,\n      retryDelay: (retryCount, error) => axiosRetry.exponentialDelay((retryCount > 7 ? 7 : retryCount), error, 500), // cap to 7 to avoid exponential delays getting too long\n      retryCondition: this.axiosRetryCondition,\n      shouldResetTimeout: true,\n      onRetry: (retryCount, error, requestConfig) => {\n        // Get the URL without query parameters for cleaner logs\n        const url = requestConfig.url?.split('?')[0] || 'unknown URL';\n        const method = requestConfig.method?.toUpperCase() || 'unknown method';\n\n        const retryMessage =\n          `Retrying request (${retryCount}/${options.axiosRetries}) to ${method} ${url} - ` +\n          `Error: ${error.code || 'unknown'} - ${error.message}`;\n\n        // Log first retry as warn and subsequent retries as debug to reduce noise\n        if (retryCount === 1) {\n          this.log.warn(\n            `${retryMessage} (subsequent retries will be logged at DEBUG level)`,\n          );\n        } else {\n          this.log.debug(retryMessage);\n        }\n      },\n      onMaxRetryTimesExceeded: (error, retryCount) => {\n        // Get request details to use in error log\n        const config = error.config || {};\n        const axiosConfig = config as AxiosRequestConfig;\n        const url = axiosConfig.url?.split('?')[0] || 'unknown URL';\n        const method = axiosConfig.method?.toUpperCase() || 'unknown method';\n\n        this.log.warn(\n          `Request failed permanently after ${retryCount} retries: ${method} ${url} - ` +\n            `Error: ${error.code || 'unknown'} - ${error.message}`,\n        );\n      },\n    });\n    return instance;\n  }\n\n  private initialize(processor: Processor): void {\n    switch (processor) {\n      case Processor.POLL:\n        this.pollerReady = true;\n        this.log.debug('PollingProcessor ready');\n        infoPollStarted(this.options.pollInterval, this.log);\n        break;\n      case Processor.STREAM:\n        this.streamReady = true;\n        this.log.debug('StreamingProcessor ready');\n        infoStreamConnected(this.log);\n        break;\n      case Processor.METRICS:\n        this.metricReady = true;\n        this.log.debug('MetricsProcessor ready');\n        infoMetricsThreadStarted(this.options.eventsSyncInterval, this.log);\n        break;\n    }\n\n    if (this.options.enableStream && !this.streamReady) {\n      return;\n    }\n\n    if (this.options.enableAnalytics && !this.metricReady) {\n      return;\n    }\n\n    if (!this.pollerReady) {\n      return;\n    }\n\n    this.initialized = true;\n    this.eventBus.emit(Event.READY);\n    infoSDKInitOK(this.log);\n  }\n\n  private async run(): Promise<void> {\n    await this.authenticate();\n\n    // If authentication has failed then we don't want to continue. We have already warned\n    // the user that authentication has failed, and that the SDK will serve defaults.\n    if (this.failure) {\n      return;\n    }\n\n    this.pollProcessor = new PollingProcessor(\n      this.environment,\n      this.cluster,\n      this.api,\n      this.apiConfiguration,\n      this.options,\n      this.eventBus,\n      this.repository,\n    );\n\n    this.pollProcessor.start();\n\n    if (this.options.enableStream) {\n      this.streamProcessor = new StreamProcessor(\n        this.api,\n        this.sdkKey,\n        apiConfiguration,\n        this.environment,\n        this.authToken,\n        this.options,\n        this.cluster,\n        this.eventBus,\n        this.repository,\n        this.configuration.baseOptions.headers,\n        this.httpsCa,\n      );\n\n      this.streamProcessor.start();\n    }\n\n    if (this.options.enableAnalytics) {\n      this.metricsProcessor = new MetricsProcessor(\n        this.environment,\n        this.cluster,\n        this.configuration,\n        this.options,\n        this.eventBus,\n        false,\n        this.httpsClient,\n      );\n      this.metricsProcessor.start();\n    }\n\n    this.log.info('finished setting up processors');\n  }\n\n  boolVariation(\n    identifier: string,\n    target?: Target,\n    defaultValue = false,\n  ): Promise<boolean> {\n    if (!this.initialized) {\n      warnDefaultVariationServed(\n        identifier,\n        target,\n        defaultValue.toString(),\n        this.log,\n      );\n\n      return Promise.resolve(defaultValue);\n    }\n    this.validateTargetIdentifier(target);\n\n    return this.evaluator.boolVariation(\n      identifier,\n      target,\n      defaultValue,\n      (fc: FeatureConfig, target: Target, variation: Variation) => {\n        if (this.metricsProcessor) {\n          this.metricsProcessor.enqueue(target, fc, variation);\n        }\n      },\n    );\n  }\n\n  stringVariation(\n    identifier: string,\n    target?: Target,\n    defaultValue = '',\n  ): Promise<string> {\n    if (!this.initialized) {\n      warnDefaultVariationServed(\n        identifier,\n        target,\n        defaultValue.toString(),\n        this.log,\n      );\n\n      return Promise.resolve(defaultValue);\n    }\n    this.validateTargetIdentifier(target);\n\n    return this.evaluator.stringVariation(\n      identifier,\n      target,\n      defaultValue,\n      (fc: FeatureConfig, target: Target, variation: Variation) => {\n        if (this.metricsProcessor) {\n          this.metricsProcessor.enqueue(target, fc, variation);\n        }\n      },\n    );\n  }\n\n  numberVariation(\n    identifier: string,\n    target?: Target,\n    defaultValue = 0,\n  ): Promise<number> {\n    if (!this.initialized) {\n      warnDefaultVariationServed(\n        identifier,\n        target,\n        defaultValue.toString(),\n        this.log,\n      );\n\n      return Promise.resolve(defaultValue);\n    }\n    this.validateTargetIdentifier(target);\n\n    return this.evaluator.numberVariation(\n      identifier,\n      target,\n      defaultValue,\n      (fc: FeatureConfig, target: Target, variation: Variation) => {\n        if (this.metricsProcessor) {\n          this.metricsProcessor.enqueue(target, fc, variation);\n        }\n      },\n    );\n  }\n\n  jsonVariation(\n    identifier: string,\n    target?: Target,\n    defaultValue = {},\n  ): Promise<Record<string, unknown>> {\n    if (!this.initialized) {\n      warnDefaultVariationServed(\n        identifier,\n        target,\n        defaultValue.toString(),\n        this.log,\n      );\n\n      return Promise.resolve(defaultValue);\n    }\n    this.validateTargetIdentifier(target);\n\n    return this.evaluator.jsonVariation(\n      identifier,\n      target,\n      defaultValue,\n      (fc: FeatureConfig, target: Target, variation: Variation) => {\n        if (this.metricsProcessor) {\n          this.metricsProcessor.enqueue(target, fc, variation);\n        }\n      },\n    );\n  }\n\n  validateTargetIdentifier(target: Target): void {\n    // If the identifier isn't a string, convert it and log a warning\n    if (target && typeof target.identifier !== 'string') {\n      const identifierString = JSON.stringify(target.identifier);\n      this.log.warn(`Target identifier: '${target.identifier}' is not a string, converting to the string value: ${identifierString}`)\n      target.identifier = identifierString\n    }\n  }\n\n  close(): void {\n    infoSDKStartClose(this.log);\n    this.closing = true;\n    this.pollProcessor.close();\n\n    if (this.streamProcessor) {\n      this.streamProcessor.close();\n    }\n\n    if (this.metricsProcessor) {\n      this.metricsProcessor.close();\n    }\n\n    this.eventBus.removeAllListeners();\n    this.closing = false;\n    infoSDKCloseSuccess(this.log);\n  }\n}\n", "/* tslint:disable */\n/* eslint-disable */\n/**\n * Harness feature flag service client apis\n * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)\n *\n * The version of the OpenAPI document: 1.0.0\n * Contact: cf@harness.io\n *\n * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).\n * https://openapi-generator.tech\n * Do not edit the class manually.\n */\n\n\nimport { Configuration } from './configuration';\nimport globalAxios, { AxiosPromise, AxiosInstance } from 'axios';\n// Some imports not used depending on template conditions\n// @ts-ignore\nimport { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common';\n// @ts-ignore\nimport { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base';\n\n/**\n *\n * @export\n * @interface AuthenticationRequest\n */\nexport interface AuthenticationRequest {\n    /**\n     *\n     * @type {string}\n     * @memberof AuthenticationRequest\n     */\n    apiKey: string;\n    /**\n     *\n     * @type {AuthenticationRequestTarget}\n     * @memberof AuthenticationRequest\n     */\n    target?: AuthenticationRequestTarget;\n}\n/**\n *\n * @export\n * @interface AuthenticationRequestTarget\n */\nexport interface AuthenticationRequestTarget {\n    /**\n     *\n     * @type {string}\n     * @memberof AuthenticationRequestTarget\n     */\n    identifier: string;\n    /**\n     *\n     * @type {string}\n     * @memberof AuthenticationRequestTarget\n     */\n    name?: string;\n    /**\n     *\n     * @type {boolean}\n     * @memberof AuthenticationRequestTarget\n     */\n    anonymous?: boolean;\n    /**\n     *\n     * @type {object}\n     * @memberof AuthenticationRequestTarget\n     */\n    attributes?: object;\n}\n/**\n *\n * @export\n * @interface AuthenticationResponse\n */\nexport interface AuthenticationResponse {\n    /**\n     *\n     * @type {string}\n     * @memberof AuthenticationResponse\n     */\n    authToken: string;\n}\n/**\n * A clause describes what conditions are used to evaluate a flag\n * @export\n * @interface Clause\n */\nexport interface Clause {\n    /**\n     * The unique ID for the clause\n     * @type {string}\n     * @memberof Clause\n     */\n    id?: string;\n    /**\n     * The attribute to use in the clause.  This can be any target attribute\n     * @type {string}\n     * @memberof Clause\n     */\n    attribute: string;\n    /**\n     * The type of operation such as equals, starts_with, contains\n     * @type {string}\n     * @memberof Clause\n     */\n    op: string;\n    /**\n     * The values that are compared against the operator\n     * @type {Array<string>}\n     * @memberof Clause\n     */\n    values: Array<string>;\n    /**\n     * Is the operation negated?\n     * @type {boolean}\n     * @memberof Clause\n     */\n    negate: boolean;\n}\n/**\n * Describes a distribution rule\n * @export\n * @interface Distribution\n */\nexport interface Distribution {\n    /**\n     * The attribute to use when distributing targets across buckets\n     * @type {string}\n     * @memberof Distribution\n     */\n    bucketBy: string;\n    /**\n     * A list of variations and the weight that should be given to each\n     * @type {Array<WeightedVariation>}\n     * @memberof Distribution\n     */\n    variations: Array<WeightedVariation>;\n}\n/**\n *\n * @export\n * @interface Evaluation\n */\nexport interface Evaluation {\n    /**\n     *\n     * @type {string}\n     * @memberof Evaluation\n     */\n    flag: string;\n    /**\n     *\n     * @type {string}\n     * @memberof Evaluation\n     */\n    value: string;\n    /**\n     *\n     * @type {string}\n     * @memberof Evaluation\n     */\n    kind: string;\n    /**\n     *\n     * @type {string}\n     * @memberof Evaluation\n     */\n    identifier?: string;\n}\n/**\n *\n * @export\n * @interface FeatureConfig\n */\nexport interface FeatureConfig {\n    /**\n     *\n     * @type {string}\n     * @memberof FeatureConfig\n     */\n    project: string;\n    /**\n     *\n     * @type {string}\n     * @memberof FeatureConfig\n     */\n    environment: string;\n    /**\n     *\n     * @type {string}\n     * @memberof FeatureConfig\n     */\n    feature: string;\n    /**\n     *\n     * @type {FeatureState}\n     * @memberof FeatureConfig\n     */\n    state: FeatureState;\n    /**\n     *\n     * @type {string}\n     * @memberof FeatureConfig\n     */\n    kind: FeatureConfigKindEnum;\n    /**\n     *\n     * @type {Array<Variation>}\n     * @memberof FeatureConfig\n     */\n    variations: Array<Variation>;\n    /**\n     *\n     * @type {Array<ServingRule>}\n     * @memberof FeatureConfig\n     */\n    rules?: Array<ServingRule>;\n    /**\n     *\n     * @type {Serve}\n     * @memberof FeatureConfig\n     */\n    defaultServe: Serve;\n    /**\n     *\n     * @type {string}\n     * @memberof FeatureConfig\n     */\n    offVariation: string;\n    /**\n     *\n     * @type {Array<Prerequisite>}\n     * @memberof FeatureConfig\n     */\n    prerequisites?: Array<Prerequisite>;\n    /**\n     *\n     * @type {Array<VariationMap>}\n     * @memberof FeatureConfig\n     */\n    variationToTargetMap?: Array<VariationMap>;\n    /**\n     *\n     * @type {number}\n     * @memberof FeatureConfig\n     */\n    version?: number;\n}\n\n/**\n    * @export\n    * @enum {string}\n    */\nexport enum FeatureConfigKindEnum {\n    Boolean = 'boolean',\n    Int = 'int',\n    String = 'string',\n    Json = 'json'\n}\n\n/**\n * The state of a flag either off or on\n * @export\n * @enum {string}\n */\n\nexport enum FeatureState {\n    On = 'on',\n    Off = 'off'\n}\n\n/**\n * The rule used to determine what variation to serve to a target\n * @export\n * @interface GroupServingRule\n */\nexport interface GroupServingRule {\n    /**\n     * The unique identifier for this rule\n     * @type {string}\n     * @memberof GroupServingRule\n     */\n    ruleId: string;\n    /**\n     * The rules priority relative to other rules.  The rules are evaluated in order with 1 being the highest\n     * @type {number}\n     * @memberof GroupServingRule\n     */\n    priority: number;\n    /**\n     * A list of clauses to use in the rule\n     * @type {Array<Clause>}\n     * @memberof GroupServingRule\n     */\n    clauses: Array<Clause>;\n}\n/**\n *\n * @export\n * @interface InlineObject\n */\nexport interface InlineObject {\n    /**\n     *\n     * @type {string}\n     * @memberof InlineObject\n     */\n    proxyKey: string;\n}\n/**\n *\n * @export\n * @interface KeyValue\n */\nexport interface KeyValue {\n    /**\n     *\n     * @type {string}\n     * @memberof KeyValue\n     */\n    key: string;\n    /**\n     *\n     * @type {string}\n     * @memberof KeyValue\n     */\n    value: string;\n}\n/**\n *\n * @export\n * @interface Metrics\n */\nexport interface Metrics {\n    /**\n     *\n     * @type {Array<TargetData>}\n     * @memberof Metrics\n     */\n    targetData?: Array<TargetData>;\n    /**\n     *\n     * @type {Array<MetricsData>}\n     * @memberof Metrics\n     */\n    metricsData?: Array<MetricsData>;\n}\n/**\n *\n * @export\n * @interface MetricsData\n */\nexport interface MetricsData {\n    /**\n     * time at when this data was recorded\n     * @type {number}\n     * @memberof MetricsData\n     */\n    timestamp: number;\n    /**\n     *\n     * @type {number}\n     * @memberof MetricsData\n     */\n    count: number;\n    /**\n     * This can be of type FeatureMetrics\n     * @type {string}\n     * @memberof MetricsData\n     */\n    metricsType: MetricsDataMetricsTypeEnum;\n    /**\n     *\n     * @type {Array<KeyValue>}\n     * @memberof MetricsData\n     */\n    attributes: Array<KeyValue>;\n}\n\n/**\n    * @export\n    * @enum {string}\n    */\nexport enum MetricsDataMetricsTypeEnum {\n    Ffmetrics = 'FFMETRICS'\n}\n\n/**\n *\n * @export\n * @interface ModelError\n */\nexport interface ModelError {\n    /**\n     * The http error code\n     * @type {string}\n     * @memberof ModelError\n     */\n    code: string;\n    /**\n     * The reason the request failed\n     * @type {string}\n     * @memberof ModelError\n     */\n    message: string;\n    /**\n     * Additional details about the error\n     * @type {object}\n     * @memberof ModelError\n     */\n    details?: object;\n}\n/**\n *\n * @export\n * @interface Pagination\n */\nexport interface Pagination {\n    /**\n     * The version of this object.  The version will be incremented each time the object is modified\n     * @type {number}\n     * @memberof Pagination\n     */\n    version?: number;\n    /**\n     * The total number of pages\n     * @type {number}\n     * @memberof Pagination\n     */\n    pageCount: number;\n    /**\n     * The total number of items\n     * @type {number}\n     * @memberof Pagination\n     */\n    itemCount: number;\n    /**\n     * The number of items per page\n     * @type {number}\n     * @memberof Pagination\n     */\n    pageSize: number;\n    /**\n     * The current page\n     * @type {number}\n     * @memberof Pagination\n     */\n    pageIndex: number;\n}\n/**\n * Feature Flag pre-requisites\n * @export\n * @interface Prerequisite\n */\nexport interface Prerequisite {\n    /**\n     * The feature identifier that is the prerequisite\n     * @type {string}\n     * @memberof Prerequisite\n     */\n    feature: string;\n    /**\n     * A list of variations that must be met\n     * @type {Array<string>}\n     * @memberof Prerequisite\n     */\n    variations: Array<string>;\n}\n/**\n * TBD\n * @export\n * @interface ProxyConfig\n */\nexport interface ProxyConfig {\n    /**\n     * The version of this object.  The version will be incremented each time the object is modified\n     * @type {number}\n     * @memberof ProxyConfig\n     */\n    version?: number;\n    /**\n     * The total number of pages\n     * @type {number}\n     * @memberof ProxyConfig\n     */\n    pageCount: number;\n    /**\n     * The total number of items\n     * @type {number}\n     * @memberof ProxyConfig\n     */\n    itemCount: number;\n    /**\n     * The number of items per page\n     * @type {number}\n     * @memberof ProxyConfig\n     */\n    pageSize: number;\n    /**\n     * The current page\n     * @type {number}\n     * @memberof ProxyConfig\n     */\n    pageIndex: number;\n    /**\n     *\n     * @type {Array<ProxyConfigAllOfEnvironments>}\n     * @memberof ProxyConfig\n     */\n    environments?: Array<ProxyConfigAllOfEnvironments>;\n}\n/**\n *\n * @export\n * @interface ProxyConfigAllOf\n */\nexport interface ProxyConfigAllOf {\n    /**\n     *\n     * @type {Array<ProxyConfigAllOfEnvironments>}\n     * @memberof ProxyConfigAllOf\n     */\n    environments?: Array<ProxyConfigAllOfEnvironments>;\n}\n/**\n *\n * @export\n * @interface ProxyConfigAllOfEnvironments\n */\nexport interface ProxyConfigAllOfEnvironments {\n    /**\n     *\n     * @type {string}\n     * @memberof ProxyConfigAllOfEnvironments\n     */\n    id?: string;\n    /**\n     *\n     * @type {Array<string>}\n     * @memberof ProxyConfigAllOfEnvironments\n     */\n    apiKeys?: Array<string>;\n    /**\n     *\n     * @type {Array<FeatureConfig>}\n     * @memberof ProxyConfigAllOfEnvironments\n     */\n    featureConfigs?: Array<FeatureConfig>;\n    /**\n     *\n     * @type {Array<Segment>}\n     * @memberof ProxyConfigAllOfEnvironments\n     */\n    segments?: Array<Segment>;\n}\n/**\n * A Target Group (Segment) response\n * @export\n * @interface Segment\n */\nexport interface Segment {\n    /**\n     * Unique identifier for the target group.\n     * @type {string}\n     * @memberof Segment\n     */\n    identifier: string;\n    /**\n     * Name of the target group.\n     * @type {string}\n     * @memberof Segment\n     */\n    name: string;\n    /**\n     * The environment this target group belongs to\n     * @type {string}\n     * @memberof Segment\n     */\n    environment?: string;\n    /**\n     * Tags for this target group\n     * @type {Array<Tag>}\n     * @memberof Segment\n     */\n    tags?: Array<Tag>;\n    /**\n     * A list of Targets who belong to this target group\n     * @type {Array<Target>}\n     * @memberof Segment\n     */\n    included?: Array<Target>;\n    /**\n     * A list of Targets who are excluded from this target group\n     * @type {Array<Target>}\n     * @memberof Segment\n     */\n    excluded?: Array<Target>;\n    /**\n     *\n     * @type {Array<Clause>}\n     * @memberof Segment\n     */\n    rules?: Array<Clause>;\n    /**\n     * An array of rules that can cause a user to be included in this segment.\n     * @type {Array<GroupServingRule>}\n     * @memberof Segment\n     */\n    servingRules?: Array<GroupServingRule>;\n    /**\n     * The data and time in milliseconds when the group was created\n     * @type {number}\n     * @memberof Segment\n     */\n    createdAt?: number;\n    /**\n     * The data and time in milliseconds when the group was last modified\n     * @type {number}\n     * @memberof Segment\n     */\n    modifiedAt?: number;\n    /**\n     * The version of this group.  Each time it is modified the version is incremented\n     * @type {number}\n     * @memberof Segment\n     */\n    version?: number;\n}\n/**\n * Describe the distribution rule and the variation that should be served to the target\n * @export\n * @interface Serve\n */\nexport interface Serve {\n    /**\n     *\n     * @type {Distribution}\n     * @memberof Serve\n     */\n    distribution?: Distribution;\n    /**\n     *\n     * @type {string}\n     * @memberof Serve\n     */\n    variation?: string;\n}\n/**\n * The rule used to determine what variation to serve to a target\n * @export\n * @interface ServingRule\n */\nexport interface ServingRule {\n    /**\n     * The unique identifier for this rule\n     * @type {string}\n     * @memberof ServingRule\n     */\n    ruleId?: string;\n    /**\n     * The rules priority relative to other rules.  The rules are evaluated in order with 1 being the highest\n     * @type {number}\n     * @memberof ServingRule\n     */\n    priority: number;\n    /**\n     * A list of clauses to use in the rule\n     * @type {Array<Clause>}\n     * @memberof ServingRule\n     */\n    clauses: Array<Clause>;\n    /**\n     *\n     * @type {Serve}\n     * @memberof ServingRule\n     */\n    serve: Serve;\n}\n/**\n * A Tag object used to tag feature flags - consists of name and identifier\n * @export\n * @interface Tag\n */\nexport interface Tag {\n    /**\n     * The name of the tag\n     * @type {string}\n     * @memberof Tag\n     */\n    name: string;\n    /**\n     * The identifier of the tag\n     * @type {string}\n     * @memberof Tag\n     */\n    identifier: string;\n}\n/**\n * A Target object\n * @export\n * @interface Target\n */\nexport interface Target {\n    /**\n     * The unique identifier for this target\n     * @type {string}\n     * @memberof Target\n     */\n    identifier: string;\n    /**\n     * The account ID that the target belongs to\n     * @type {string}\n     * @memberof Target\n     */\n    account: string;\n    /**\n     * The identifier for the organization that the target belongs to\n     * @type {string}\n     * @memberof Target\n     */\n    org: string;\n    /**\n     * The identifier for the environment that the target belongs to\n     * @type {string}\n     * @memberof Target\n     */\n    environment: string;\n    /**\n     * The identifier for the project that this target belongs to\n     * @type {string}\n     * @memberof Target\n     */\n    project: string;\n    /**\n     * The name of this Target\n     * @type {string}\n     * @memberof Target\n     */\n    name: string;\n    /**\n     * Indicates if this target is anonymous\n     * @type {boolean}\n     * @memberof Target\n     */\n    anonymous?: boolean;\n    /**\n     * a JSON representation of the attributes for this target\n     * @type {object}\n     * @memberof Target\n     */\n    attributes?: object;\n    /**\n     * The date and time in milliseconds when this Target was created\n     * @type {number}\n     * @memberof Target\n     */\n    createdAt?: number;\n    /**\n     * A list of Target Groups (Segments) that this Target belongs to\n     * @type {Array<Segment>}\n     * @memberof Target\n     */\n    segments?: Array<Segment>;\n}\n/**\n *\n * @export\n * @interface TargetData\n */\nexport interface TargetData {\n    /**\n     *\n     * @type {string}\n     * @memberof TargetData\n     */\n    identifier: string;\n    /**\n     *\n     * @type {string}\n     * @memberof TargetData\n     */\n    name: string;\n    /**\n     *\n     * @type {Array<KeyValue>}\n     * @memberof TargetData\n     */\n    attributes: Array<KeyValue>;\n}\n/**\n * Target map provides the details of a target that belongs to a flag\n * @export\n * @interface TargetMap\n */\nexport interface TargetMap {\n    /**\n     * The identifier for the target\n     * @type {string}\n     * @memberof TargetMap\n     */\n    identifier: string;\n    /**\n     * The name of the target\n     * @type {string}\n     * @memberof TargetMap\n     */\n    name: string;\n}\n/**\n * A variation of a flag that can be returned to a target\n * @export\n * @interface Variation\n */\nexport interface Variation {\n    /**\n     * The unique identifier for the variation\n     * @type {string}\n     * @memberof Variation\n     */\n    identifier: string;\n    /**\n     * The variation value to serve such as true or false for a boolean flag\n     * @type {string}\n     * @memberof Variation\n     */\n    value: string;\n    /**\n     * The user friendly name of the variation\n     * @type {string}\n     * @memberof Variation\n     */\n    name?: string;\n    /**\n     * A description of the variation\n     * @type {string}\n     * @memberof Variation\n     */\n    description?: string;\n}\n/**\n * A mapping of variations to targets and target groups (segments).  The targets listed here should receive this variation.\n * @export\n * @interface VariationMap\n */\nexport interface VariationMap {\n    /**\n     * The variation identifier\n     * @type {string}\n     * @memberof VariationMap\n     */\n    variation: string;\n    /**\n     * A list of target mappings\n     * @type {Array<TargetMap>}\n     * @memberof VariationMap\n     */\n    targets?: Array<TargetMap>;\n    /**\n     * A list of target groups (segments)\n     * @type {Array<string>}\n     * @memberof VariationMap\n     */\n    targetSegments?: Array<string>;\n}\n/**\n * A variation and the weighting it should receive as part of a percentage rollout\n * @export\n * @interface WeightedVariation\n */\nexport interface WeightedVariation {\n    /**\n     * The variation identifier\n     * @type {string}\n     * @memberof WeightedVariation\n     */\n    variation: string;\n    /**\n     * The weight to be given to the variation in percent\n     * @type {number}\n     * @memberof WeightedVariation\n     */\n    weight: number;\n}\n\n/**\n * ClientApi - axios parameter creator\n * @export\n */\nexport const ClientApiAxiosParamCreator = function (configuration?: Configuration) {\n    return {\n        /**\n         * Used to retrieve all target segments for certain account id.\n         * @summary Authenticate with the admin server.\n         * @param {AuthenticationRequest} [authenticationRequest]\n         * @param {*} [options] Override http request option.\n         * @throws {RequiredError}\n         */\n        authenticate: async (authenticationRequest?: AuthenticationRequest, options: any = {}): Promise<RequestArgs> => {\n            const localVarPath = `/client/auth`;\n            // use dummy base URL string because the URL constructor only accepts absolute URLs.\n            const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);\n            let baseOptions;\n            if (configuration) {\n                baseOptions = configuration.baseOptions;\n            }\n\n            const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};\n            const localVarHeaderParameter = {} as any;\n            const localVarQueryParameter = {} as any;\n\n\n\n            localVarHeaderParameter['Content-Type'] = 'application/json';\n\n            setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);\n            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};\n            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};\n            localVarRequestOptions.data = serializeDataIfNeeded(authenticationRequest, localVarRequestOptions, configuration)\n\n            return {\n                url: toPathString(localVarUrlObj),\n                options: localVarRequestOptions,\n            };\n        },\n        /**\n         * Used to retrieve all segments for certain account id.\n         * @summary Retrieve all segments.\n         * @param {string} environmentUUID Unique identifier for the environment object in the API.\n         * @param {string} [cluster] Unique identifier for the cluster for the account\n         * @param {string} [rules] When set to rules&#x3D;v2 will return AND rule compatible serving_rules field. When not set or set to any other value will return old rules field only compatible with OR rules.\n         * @param {*} [options] Override http request option.\n         * @throws {RequiredError}\n         */\n        getAllSegments: async (environmentUUID: string, cluster?: string, rules?: string, options: any = {}): Promise<RequestArgs> => {\n            // verify required parameter 'environmentUUID' is not null or undefined\n            assertParamExists('getAllSegments', 'environmentUUID', environmentUUID)\n            const localVarPath = `/client/env/{environmentUUID}/target-segments`\n                .replace(`{${\"environmentUUID\"}}`, encodeURIComponent(String(environmentUUID)));\n            // use dummy base URL string because the URL constructor only accepts absolute URLs.\n            const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);\n            let baseOptions;\n            if (configuration) {\n                baseOptions = configuration.baseOptions;\n            }\n\n            const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};\n            const localVarHeaderParameter = {} as any;\n            const localVarQueryParameter = {} as any;\n\n            // authentication BearerAuth required\n            // http bearer authentication required\n            await setBearerAuthToObject(localVarHeaderParameter, configuration)\n\n            if (cluster !== undefined) {\n                localVarQueryParameter['cluster'] = cluster;\n            }\n\n            if (rules !== undefined) {\n                localVarQueryParameter['rules'] = rules;\n            }\n\n\n\n            setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);\n            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};\n            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};\n\n            return {\n                url: toPathString(localVarUrlObj),\n                options: localVarRequestOptions,\n            };\n        },\n        /**\n         *\n         * @summary Get feature evaluations for target\n         * @param {string} environmentUUID Unique identifier for the environment object in the API.\n         * @param {string} feature Unique identifier for the flag object in the API.\n         * @param {string} target Unique identifier for the target object in the API.\n         * @param {string} [cluster] Unique identifier for the cluster for the account\n         * @param {*} [options] Override http request option.\n         * @throws {RequiredError}\n         */\n        getEvaluationByIdentifier: async (environmentUUID: string, feature: string, target: string, cluster?: string, options: any = {}): Promise<RequestArgs> => {\n            // verify required parameter 'environmentUUID' is not null or undefined\n            assertParamExists('getEvaluationByIdentifier', 'environmentUUID', environmentUUID)\n            // verify required parameter 'feature' is not null or undefined\n            assertParamExists('getEvaluationByIdentifier', 'feature', feature)\n            // verify required parameter 'target' is not null or undefined\n            assertParamExists('getEvaluationByIdentifier', 'target', target)\n            const localVarPath = `/client/env/{environmentUUID}/target/{target}/evaluations/{feature}`\n                .replace(`{${\"environmentUUID\"}}`, encodeURIComponent(String(environmentUUID)))\n                .replace(`{${\"feature\"}}`, encodeURIComponent(String(feature)))\n                .replace(`{${\"target\"}}`, encodeURIComponent(String(target)));\n            // use dummy base URL string because the URL constructor only accepts absolute URLs.\n            const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);\n            let baseOptions;\n            if (configuration) {\n                baseOptions = configuration.baseOptions;\n            }\n\n            const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};\n            const localVarHeaderParameter = {} as any;\n            const localVarQueryParameter = {} as any;\n\n            // authentication BearerAuth required\n            // http bearer authentication required\n            await setBearerAuthToObject(localVarHeaderParameter, configuration)\n\n            if (cluster !== undefined) {\n                localVarQueryParameter['cluster'] = cluster;\n            }\n\n\n\n            setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);\n            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};\n            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};\n\n            return {\n                url: toPathString(localVarUrlObj),\n                options: localVarRequestOptions,\n            };\n        },\n        /**\n         *\n         * @summary Get feature evaluations for target\n         * @param {string} environmentUUID Unique identifier for the environment object in the API.\n         * @param {string} target Unique identifier for the target object in the API.\n         * @param {string} [cluster] Unique identifier for the cluster for the account\n         * @param {*} [options] Override http request option.\n         * @throws {RequiredError}\n         */\n        getEvaluations: async (environmentUUID: string, target: string, cluster?: string, options: any = {}): Promise<RequestArgs> => {\n            // verify required parameter 'environmentUUID' is not null or undefined\n            assertParamExists('getEvaluations', 'environmentUUID', environmentUUID)\n            // verify required parameter 'target' is not null or undefined\n            assertParamExists('getEvaluations', 'target', target)\n            const localVarPath = `/client/env/{environmentUUID}/target/{target}/evaluations`\n                .replace(`{${\"environmentUUID\"}}`, encodeURIComponent(String(environmentUUID)))\n                .replace(`{${\"target\"}}`, encodeURIComponent(String(target)));\n            // use dummy base URL string because the URL constructor only accepts absolute URLs.\n            const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);\n            let baseOptions;\n            if (configuration) {\n                baseOptions = configuration.baseOptions;\n            }\n\n            const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};\n            const localVarHeaderParameter = {} as any;\n            const localVarQueryParameter = {} as any;\n\n            // authentication BearerAuth required\n            // http bearer authentication required\n            await setBearerAuthToObject(localVarHeaderParameter, configuration)\n\n            if (cluster !== undefined) {\n                localVarQueryParameter['cluster'] = cluster;\n            }\n\n\n\n            setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);\n            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};\n            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};\n\n            return {\n                url: toPathString(localVarUrlObj),\n                options: localVarRequestOptions,\n            };\n        },\n        /**\n         * All feature flags with activations in project environment\n         * @summary Get all feature flags activations\n         * @param {string} environmentUUID Unique identifier for the environment object in the API.\n         * @param {string} [cluster] Unique identifier for the cluster for the account\n         * @param {*} [options] Override http request option.\n         * @throws {RequiredError}\n         */\n        getFeatureConfig: async (environmentUUID: string, cluster?: string, options: any = {}): Promise<RequestArgs> => {\n            // verify required parameter 'environmentUUID' is not null or undefined\n            assertParamExists('getFeatureConfig', 'environmentUUID', environmentUUID)\n            const localVarPath = `/client/env/{environmentUUID}/feature-configs`\n                .replace(`{${\"environmentUUID\"}}`, encodeURIComponent(String(environmentUUID)));\n            // use dummy base URL string because the URL constructor only accepts absolute URLs.\n            const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);\n            let baseOptions;\n            if (configuration) {\n                baseOptions = configuration.baseOptions;\n            }\n\n            const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};\n            const localVarHeaderParameter = {} as any;\n            const localVarQueryParameter = {} as any;\n\n            // authentication BearerAuth required\n            // http bearer authentication required\n            await setBearerAuthToObject(localVarHeaderParameter, configuration)\n\n            if (cluster !== undefined) {\n                localVarQueryParameter['cluster'] = cluster;\n            }\n\n\n\n            setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);\n            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};\n            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};\n\n            return {\n                url: toPathString(localVarUrlObj),\n                options: localVarRequestOptions,\n            };\n        },\n        /**\n         *\n         * @summary Get feature config\n         * @param {string} identifier Unique identifier for the flag object in the API.\n         * @param {string} environmentUUID Unique identifier for the environment object in the API.\n         * @param {string} [cluster] Unique identifier for the cluster for the account\n         * @param {*} [options] Override http request option.\n         * @throws {RequiredError}\n         */\n        getFeatureConfigByIdentifier: async (identifier: string, environmentUUID: string, cluster?: string, options: any = {}): Promise<RequestArgs> => {\n            // verify required parameter 'identifier' is not null or undefined\n            assertParamExists('getFeatureConfigByIdentifier', 'identifier', identifier)\n            // verify required parameter 'environmentUUID' is not null or undefined\n            assertParamExists('getFeatureConfigByIdentifier', 'environmentUUID', environmentUUID)\n            const localVarPath = `/client/env/{environmentUUID}/feature-configs/{identifier}`\n                .replace(`{${\"identifier\"}}`, encodeURIComponent(String(identifier)))\n                .replace(`{${\"environmentUUID\"}}`, encodeURIComponent(String(environmentUUID)));\n            // use dummy base URL string because the URL constructor only accepts absolute URLs.\n            const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);\n            let baseOptions;\n            if (configuration) {\n                baseOptions = configuration.baseOptions;\n            }\n\n            const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};\n            const localVarHeaderParameter = {} as any;\n            const localVarQueryParameter = {} as any;\n\n            // authentication BearerAuth required\n            // http bearer authentication required\n            await setBearerAuthToObject(localVarHeaderParameter, configuration)\n\n            if (cluster !== undefined) {\n                localVarQueryParameter['cluster'] = cluster;\n            }\n\n\n\n            setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);\n            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};\n            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};\n\n            return {\n                url: toPathString(localVarUrlObj),\n                options: localVarRequestOptions,\n            };\n        },\n        /**\n         * Used to retrieve a segment for a certain account id by identifier\n         * @summary Retrieve a segment by identifier\n         * @param {string} identifier Unique identifier for the segment object in the API\n         * @param {string} environmentUUID Unique identifier for the environment object in the API\n         * @param {string} [cluster] Unique identifier for the cluster for the account\n         * @param {string} [rules] When set to rules&#x3D;v2 will return AND rule compatible serving_rules field. When not set or set to any other value will return old rules field only compatible with OR rules.\n         * @param {*} [options] Override http request option.\n         * @throws {RequiredError}\n         */\n        getSegmentByIdentifier: async (identifier: string, environmentUUID: string, cluster?: string, rules?: string, options: any = {}): Promise<RequestArgs> => {\n            // verify required parameter 'identifier' is not null or undefined\n            assertParamExists('getSegmentByIdentifier', 'identifier', identifier)\n            // verify required parameter 'environmentUUID' is not null or undefined\n            assertParamExists('getSegmentByIdentifier', 'environmentUUID', environmentUUID)\n            const localVarPath = `/client/env/{environmentUUID}/target-segments/{identifier}`\n                .replace(`{${\"identifier\"}}`, encodeURIComponent(String(identifier)))\n                .replace(`{${\"environmentUUID\"}}`, encodeURIComponent(String(environmentUUID)));\n            // use dummy base URL string because the URL constructor only accepts absolute URLs.\n            const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);\n            let baseOptions;\n            if (configuration) {\n                baseOptions = configuration.baseOptions;\n            }\n\n            const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};\n            const localVarHeaderParameter = {} as any;\n            const localVarQueryParameter = {} as any;\n\n            // authentication BearerAuth required\n            // http bearer authentication required\n            await setBearerAuthToObject(localVarHeaderParameter, configuration)\n\n            if (cluster !== undefined) {\n                localVarQueryParameter['cluster'] = cluster;\n            }\n\n            if (rules !== undefined) {\n                localVarQueryParameter['rules'] = rules;\n            }\n\n\n\n            setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);\n            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};\n            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};\n\n            return {\n                url: toPathString(localVarUrlObj),\n                options: localVarRequestOptions,\n            };\n        },\n        /**\n         *\n         * @summary Stream endpoint.\n         * @param {string} aPIKey\n         * @param {string} [cluster] Unique identifier for the cluster for the account\n         * @param {*} [options] Override http request option.\n         * @throws {RequiredError}\n         */\n        stream: async (aPIKey: string, cluster?: string, options: any = {}): Promise<RequestArgs> => {\n            // verify required parameter 'aPIKey' is not null or undefined\n            assertParamExists('stream', 'aPIKey', aPIKey)\n            const localVarPath = `/stream`;\n            // use dummy base URL string because the URL constructor only accepts absolute URLs.\n            const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);\n            let baseOptions;\n            if (configuration) {\n                baseOptions = configuration.baseOptions;\n            }\n\n            const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};\n            const localVarHeaderParameter = {} as any;\n            const localVarQueryParameter = {} as any;\n\n            // authentication BearerAuth required\n            // http bearer authentication required\n            await setBearerAuthToObject(localVarHeaderParameter, configuration)\n\n            if (cluster !== undefined) {\n                localVarQueryParameter['cluster'] = cluster;\n            }\n\n            if (aPIKey !== undefined && aPIKey !== null) {\n                localVarHeaderParameter['API-Key'] = String(aPIKey);\n            }\n\n\n\n            setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);\n            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};\n            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};\n\n            return {\n                url: toPathString(localVarUrlObj),\n                options: localVarRequestOptions,\n            };\n        },\n    }\n};\n\n/**\n * ClientApi - functional programming interface\n * @export\n */\nexport const ClientApiFp = function(configuration?: Configuration) {\n    const localVarAxiosParamCreator = ClientApiAxiosParamCreator(configuration)\n    return {\n        /**\n         * Used to retrieve all target segments for certain account id.\n         * @summary Authenticate with the admin server.\n         * @param {AuthenticationRequest} [authenticationRequest]\n         * @param {*} [options] Override http request option.\n         * @throws {RequiredError}\n         */\n        async authenticate(authenticationRequest?: AuthenticationRequest, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<AuthenticationResponse>> {\n            const localVarAxiosArgs = await localVarAxiosParamCreator.authenticate(authenticationRequest, options);\n            return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);\n        },\n        /**\n         * Used to retrieve all segments for certain account id.\n         * @summary Retrieve all segments.\n         * @param {string} environmentUUID Unique identifier for the environment object in the API.\n         * @param {string} [cluster] Unique identifier for the cluster for the account\n         * @param {string} [rules] When set to rules&#x3D;v2 will return AND rule compatible serving_rules field. When not set or set to any other value will return old rules field only compatible with OR rules.\n         * @param {*} [options] Override http request option.\n         * @throws {RequiredError}\n         */\n        async getAllSegments(environmentUUID: string, cluster?: string, rules?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<Segment>>> {\n            const localVarAxiosArgs = await localVarAxiosParamCreator.getAllSegments(environmentUUID, cluster, rules, options);\n            return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);\n        },\n        /**\n         *\n         * @summary Get feature evaluations for target\n         * @param {string} environmentUUID Unique identifier for the environment object in the API.\n         * @param {string} feature Unique identifier for the flag object in the API.\n         * @param {string} target Unique identifier for the target object in the API.\n         * @param {string} [cluster] Unique identifier for the cluster for the account\n         * @param {*} [options] Override http request option.\n         * @throws {RequiredError}\n         */\n        async getEvaluationByIdentifier(environmentUUID: string, feature: string, target: string, cluster?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Evaluation>> {\n            const localVarAxiosArgs = await localVarAxiosParamCreator.getEvaluationByIdentifier(environmentUUID, feature, target, cluster, options);\n            return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);\n        },\n        /**\n         *\n         * @summary Get feature evaluations for target\n         * @param {string} environmentUUID Unique identifier for the environment object in the API.\n         * @param {string} target Unique identifier for the target object in the API.\n         * @param {string} [cluster] Unique identifier for the cluster for the account\n         * @param {*} [options] Override http request option.\n         * @throws {RequiredError}\n         */\n        async getEvaluations(environmentUUID: string, target: string, cluster?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Pagination & Array<object>>> {\n            const localVarAxiosArgs = await localVarAxiosParamCreator.getEvaluations(environmentUUID, target, cluster, options);\n            return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);\n        },\n        /**\n         * All feature flags with activations in project environment\n         * @summary Get all feature flags activations\n         * @param {string} environmentUUID Unique identifier for the environment object in the API.\n         * @param {string} [cluster] Unique identifier for the cluster for the account\n         * @param {*} [options] Override http request option.\n         * @throws {RequiredError}\n         */\n        async getFeatureConfig(environmentUUID: string, cluster?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<FeatureConfig>>> {\n            const localVarAxiosArgs = await localVarAxiosParamCreator.getFeatureConfig(environmentUUID, cluster, options);\n            return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);\n        },\n        /**\n         *\n         * @summary Get feature config\n         * @param {string} identifier Unique identifier for the flag object in the API.\n         * @param {string} environmentUUID Unique identifier for the environment object in the API.\n         * @param {string} [cluster] Unique identifier for the cluster for the account\n         * @param {*} [options] Override http request option.\n         * @throws {RequiredError}\n         */\n        async getFeatureConfigByIdentifier(identifier: string, environmentUUID: string, cluster?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<FeatureConfig>> {\n            const localVarAxiosArgs = await localVarAxiosParamCreator.getFeatureConfigByIdentifier(identifier, environmentUUID, cluster, options);\n            return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);\n        },\n        /**\n         * Used to retrieve a segment for a certain account id by identifier\n         * @summary Retrieve a segment by identifier\n         * @param {string} identifier Unique identifier for the segment object in the API\n         * @param {string} environmentUUID Unique identifier for the environment object in the API\n         * @param {string} [cluster] Unique identifier for the cluster for the account\n         * @param {string} [rules] When set to rules&#x3D;v2 will return AND rule compatible serving_rules field. When not set or set to any other value will return old rules field only compatible with OR rules.\n         * @param {*} [options] Override http request option.\n         * @throws {RequiredError}\n         */\n        async getSegmentByIdentifier(identifier: string, environmentUUID: string, cluster?: string, rules?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Segment>> {\n            const localVarAxiosArgs = await localVarAxiosParamCreator.getSegmentByIdentifier(identifier, environmentUUID, cluster, rules, options);\n            return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);\n        },\n        /**\n         *\n         * @summary Stream endpoint.\n         * @param {string} aPIKey\n         * @param {string} [cluster] Unique identifier for the cluster for the account\n         * @param {*} [options] Override http request option.\n         * @throws {RequiredError}\n         */\n        async stream(aPIKey: string, cluster?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {\n            const localVarAxiosArgs = await localVarAxiosParamCreator.stream(aPIKey, cluster, options);\n            return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);\n        },\n    }\n};\n\n/**\n * ClientApi - factory interface\n * @export\n */\nexport const ClientApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {\n    const localVarFp = ClientApiFp(configuration)\n    return {\n        /**\n         * Used to retrieve all target segments for certain account id.\n         * @summary Authenticate with the admin server.\n         * @param {AuthenticationRequest} [authenticationRequest]\n         * @param {*} [options] Override http request option.\n         * @throws {RequiredError}\n         */\n        authenticate(authenticationRequest?: AuthenticationRequest, options?: any): AxiosPromise<AuthenticationResponse> {\n            return localVarFp.authenticate(authenticationRequest, options).then((request) => request(axios, basePath));\n        },\n        /**\n         * Used to retrieve all segments for certain account id.\n         * @summary Retrieve all segments.\n         * @param {string} environmentUUID Unique identifier for the environment object in the API.\n         * @param {string} [cluster] Unique identifier for the cluster for the account\n         * @param {string} [rules] When set to rules&#x3D;v2 will return AND rule compatible serving_rules field. When not set or set to any other value will return old rules field only compatible with OR rules.\n         * @param {*} [options] Override http request option.\n         * @throws {RequiredError}\n         */\n        getAllSegments(environmentUUID: string, cluster?: string, rules?: string, options?: any): AxiosPromise<Array<Segment>> {\n            return localVarFp.getAllSegments(environmentUUID, cluster, rules, options).then((request) => request(axios, basePath));\n        },\n        /**\n         *\n         * @summary Get feature evaluations for target\n         * @param {string} environmentUUID Unique identifier for the environment object in the API.\n         * @param {string} feature Unique identifier for the flag object in the API.\n         * @param {string} target Unique identifier for the target object in the API.\n         * @param {string} [cluster] Unique identifier for the cluster for the account\n         * @param {*} [options] Override http request option.\n         * @throws {RequiredError}\n         */\n        getEvaluationByIdentifier(environmentUUID: string, feature: string, target: string, cluster?: string, options?: any): AxiosPromise<Evaluation> {\n            return localVarFp.getEvaluationByIdentifier(environmentUUID, feature, target, cluster, options).then((request) => request(axios, basePath));\n        },\n        /**\n         *\n         * @summary Get feature evaluations for target\n         * @param {string} environmentUUID Unique identifier for the environment object in the API.\n         * @param {string} target Unique identifier for the target object in the API.\n         * @param {string} [cluster] Unique identifier for the cluster for the account\n         * @param {*} [options] Override http request option.\n         * @throws {RequiredError}\n         */\n        getEvaluations(environmentUUID: string, target: string, cluster?: string, options?: any): AxiosPromise<Pagination & Array<object>> {\n            return localVarFp.getEvaluations(environmentUUID, target, cluster, options).then((request) => request(axios, basePath));\n        },\n        /**\n         * All feature flags with activations in project environment\n         * @summary Get all feature flags activations\n         * @param {string} environmentUUID Unique identifier for the environment object in the API.\n         * @param {string} [cluster] Unique identifier for the cluster for the account\n         * @param {*} [options] Override http request option.\n         * @throws {RequiredError}\n         */\n        getFeatureConfig(environmentUUID: string, cluster?: string, options?: any): AxiosPromise<Array<FeatureConfig>> {\n            return localVarFp.getFeatureConfig(environmentUUID, cluster, options).then((request) => request(axios, basePath));\n        },\n        /**\n         *\n         * @summary Get feature config\n         * @param {string} identifier Unique identifier for the flag object in the API.\n         * @param {string} environmentUUID Unique identifier for the environment object in the API.\n         * @param {string} [cluster] Unique identifier for the cluster for the account\n         * @param {*} [options] Override http request option.\n         * @throws {RequiredError}\n         */\n        getFeatureConfigByIdentifier(identifier: string, environmentUUID: string, cluster?: string, options?: any): AxiosPromise<FeatureConfig> {\n            return localVarFp.getFeatureConfigByIdentifier(identifier, environmentUUID, cluster, options).then((request) => request(axios, basePath));\n        },\n        /**\n         * Used to retrieve a segment for a certain account id by identifier\n         * @summary Retrieve a segment by identifier\n         * @param {string} identifier Unique identifier for the segment object in the API\n         * @param {string} environmentUUID Unique identifier for the environment object in the API\n         * @param {string} [cluster] Unique identifier for the cluster for the account\n         * @param {string} [rules] When set to rules&#x3D;v2 will return AND rule compatible serving_rules field. When not set or set to any other value will return old rules field only compatible with OR rules.\n         * @param {*} [options] Override http request option.\n         * @throws {RequiredError}\n         */\n        getSegmentByIdentifier(identifier: string, environmentUUID: string, cluster?: string, rules?: string, options?: any): AxiosPromise<Segment> {\n            return localVarFp.getSegmentByIdentifier(identifier, environmentUUID, cluster, rules, options).then((request) => request(axios, basePath));\n        },\n        /**\n         *\n         * @summary Stream endpoint.\n         * @param {string} aPIKey\n         * @param {string} [cluster] Unique identifier for the cluster for the account\n         * @param {*} [options] Override http request option.\n         * @throws {RequiredError}\n         */\n        stream(aPIKey: string, cluster?: string, options?: any): AxiosPromise<void> {\n            return localVarFp.stream(aPIKey, cluster, options).then((request) => request(axios, basePath));\n        },\n    };\n};\n\n/**\n * ClientApi - object-oriented interface\n * @export\n * @class ClientApi\n * @extends {BaseAPI}\n */\nexport class ClientApi extends BaseAPI {\n    /**\n     * Used to retrieve all target segments for certain account id.\n     * @summary Authenticate with the admin server.\n     * @param {AuthenticationRequest} [authenticationRequest]\n     * @param {*} [options] Override http request option.\n     * @throws {RequiredError}\n     * @memberof ClientApi\n     */\n    public authenticate(authenticationRequest?: AuthenticationRequest, options?: any) {\n        return ClientApiFp(this.configuration).authenticate(authenticationRequest, options).then((request) => request(this.axios, this.basePath));\n    }\n\n    /**\n     * Used to retrieve all segments for certain account id.\n     * @summary Retrieve all segments.\n     * @param {string} environmentUUID Unique identifier for the environment object in the API.\n     * @param {string} [cluster] Unique identifier for the cluster for the account\n     * @param {string} [rules] When set to rules&#x3D;v2 will return AND rule compatible serving_rules field. When not set or set to any other value will return old rules field only compatible with OR rules.\n     * @param {*} [options] Override http request option.\n     * @throws {RequiredError}\n     * @memberof ClientApi\n     */\n    public getAllSegments(environmentUUID: string, cluster?: string, rules?: string, options?: any) {\n        return ClientApiFp(this.configuration).getAllSegments(environmentUUID, cluster, rules, options).then((request) => request(this.axios, this.basePath));\n    }\n\n    /**\n     *\n     * @summary Get feature evaluations for target\n     * @param {string} environmentUUID Unique identifier for the environment object in the API.\n     * @param {string} feature Unique identifier for the flag object in the API.\n     * @param {string} target Unique identifier for the target object in the API.\n     * @param {string} [cluster] Unique identifier for the cluster for the account\n     * @param {*} [options] Override http request option.\n     * @throws {RequiredError}\n     * @memberof ClientApi\n     */\n    public getEvaluationByIdentifier(environmentUUID: string, feature: string, target: string, cluster?: string, options?: any) {\n        return ClientApiFp(this.configuration).getEvaluationByIdentifier(environmentUUID, feature, target, cluster, options).then((request) => request(this.axios, this.basePath));\n    }\n\n    /**\n     *\n     * @summary Get feature evaluations for target\n     * @param {string} environmentUUID Unique identifier for the environment object in the API.\n     * @param {string} target Unique identifier for the target object in the API.\n     * @param {string} [cluster] Unique identifier for the cluster for the account\n     * @param {*} [options] Override http request option.\n     * @throws {RequiredError}\n     * @memberof ClientApi\n     */\n    public getEvaluations(environmentUUID: string, target: string, cluster?: string, options?: any) {\n        return ClientApiFp(this.configuration).getEvaluations(environmentUUID, target, cluster, options).then((request) => request(this.axios, this.basePath));\n    }\n\n    /**\n     * All feature flags with activations in project environment\n     * @summary Get all feature flags activations\n     * @param {string} environmentUUID Unique identifier for the environment object in the API.\n     * @param {string} [cluster] Unique identifier for the cluster for the account\n     * @param {*} [options] Override http request option.\n     * @throws {RequiredError}\n     * @memberof ClientApi\n     */\n    public getFeatureConfig(environmentUUID: string, cluster?: string, options?: any) {\n        return ClientApiFp(this.configuration).getFeatureConfig(environmentUUID, cluster, options).then((request) => request(this.axios, this.basePath));\n    }\n\n    /**\n     *\n     * @summary Get feature config\n     * @param {string} identifier Unique identifier for the flag object in the API.\n     * @param {string} environmentUUID Unique identifier for the environment object in the API.\n     * @param {string} [cluster] Unique identifier for the cluster for the account\n     * @param {*} [options] Override http request option.\n     * @throws {RequiredError}\n     * @memberof ClientApi\n     */\n    public getFeatureConfigByIdentifier(identifier: string, environmentUUID: string, cluster?: string, options?: any) {\n        return ClientApiFp(this.configuration).getFeatureConfigByIdentifier(identifier, environmentUUID, cluster, options).then((request) => request(this.axios, this.basePath));\n    }\n\n    /**\n     * Used to retrieve a segment for a certain account id by identifier\n     * @summary Retrieve a segment by identifier\n     * @param {string} identifier Unique identifier for the segment object in the API\n     * @param {string} environmentUUID Unique identifier for the environment object in the API\n     * @param {string} [cluster] Unique identifier for the cluster for the account\n     * @param {string} [rules] When set to rules&#x3D;v2 will return AND rule compatible serving_rules field. When not set or set to any other value will return old rules field only compatible with OR rules.\n     * @param {*} [options] Override http request option.\n     * @throws {RequiredError}\n     * @memberof ClientApi\n     */\n    public getSegmentByIdentifier(identifier: string, environmentUUID: string, cluster?: string, rules?: string, options?: any) {\n        return ClientApiFp(this.configuration).getSegmentByIdentifier(identifier, environmentUUID, cluster, rules, options).then((request) => request(this.axios, this.basePath));\n    }\n\n    /**\n     *\n     * @summary Stream endpoint.\n     * @param {string} aPIKey\n     * @param {string} [cluster] Unique identifier for the cluster for the account\n     * @param {*} [options] Override http request option.\n     * @throws {RequiredError}\n     * @memberof ClientApi\n     */\n    public stream(aPIKey: string, cluster?: string, options?: any) {\n        return ClientApiFp(this.configuration).stream(aPIKey, cluster, options).then((request) => request(this.axios, this.basePath));\n    }\n}\n\n\n/**\n * MetricsApi - axios parameter creator\n * @export\n */\nexport const MetricsApiAxiosParamCreator = function (configuration?: Configuration) {\n    return {\n        /**\n         * Send metrics to Analytics server\n         * @summary Send metrics to the Analytics server.\n         * @param {string} environmentUUID environment parameter in query.\n         * @param {string} [cluster] Unique identifier for the cluster for the account\n         * @param {Metrics} [metrics]\n         * @param {*} [options] Override http request option.\n         * @throws {RequiredError}\n         */\n        postMetrics: async (environmentUUID: string, cluster?: string, metrics?: Metrics, options: any = {}): Promise<RequestArgs> => {\n            // verify required parameter 'environmentUUID' is not null or undefined\n            assertParamExists('postMetrics', 'environmentUUID', environmentUUID)\n            const localVarPath = `/metrics/{environmentUUID}`\n                .replace(`{${\"environmentUUID\"}}`, encodeURIComponent(String(environmentUUID)));\n            // use dummy base URL string because the URL constructor only accepts absolute URLs.\n            const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);\n            let baseOptions;\n            if (configuration) {\n                baseOptions = configuration.baseOptions;\n            }\n\n            const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};\n            const localVarHeaderParameter = {} as any;\n            const localVarQueryParameter = {} as any;\n\n            // authentication ApiKeyAuth required\n            await setApiKeyToObject(localVarHeaderParameter, \"api-key\", configuration)\n\n            // authentication BearerAuth required\n            // http bearer authentication required\n            await setBearerAuthToObject(localVarHeaderParameter, configuration)\n\n            if (cluster !== undefined) {\n                localVarQueryParameter['cluster'] = cluster;\n            }\n\n\n\n            localVarHeaderParameter['Content-Type'] = 'application/json';\n\n            setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);\n            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};\n            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};\n            localVarRequestOptions.data = serializeDataIfNeeded(metrics, localVarRequestOptions, configuration)\n\n            return {\n                url: toPathString(localVarUrlObj),\n                options: localVarRequestOptions,\n            };\n        },\n    }\n};\n\n/**\n * MetricsApi - functional programming interface\n * @export\n */\nexport const MetricsApiFp = function(configuration?: Configuration) {\n    const localVarAxiosParamCreator = MetricsApiAxiosParamCreator(configuration)\n    return {\n        /**\n         * Send metrics to Analytics server\n         * @summary Send metrics to the Analytics server.\n         * @param {string} environmentUUID environment parameter in query.\n         * @param {string} [cluster] Unique identifier for the cluster for the account\n         * @param {Metrics} [metrics]\n         * @param {*} [options] Override http request option.\n         * @throws {RequiredError}\n         */\n        async postMetrics(environmentUUID: string, cluster?: string, metrics?: Metrics, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {\n            const localVarAxiosArgs = await localVarAxiosParamCreator.postMetrics(environmentUUID, cluster, metrics, options);\n            return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);\n        },\n    }\n};\n\n/**\n * MetricsApi - factory interface\n * @export\n */\nexport const MetricsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {\n    const localVarFp = MetricsApiFp(configuration)\n    return {\n        /**\n         * Send metrics to Analytics server\n         * @summary Send metrics to the Analytics server.\n         * @param {string} environmentUUID environment parameter in query.\n         * @param {string} [cluster] Unique identifier for the cluster for the account\n         * @param {Metrics} [metrics]\n         * @param {*} [options] Override http request option.\n         * @throws {RequiredError}\n         */\n        postMetrics(environmentUUID: string, cluster?: string, metrics?: Metrics, options?: any): AxiosPromise<void> {\n            return localVarFp.postMetrics(environmentUUID, cluster, metrics, options).then((request) => request(axios, basePath));\n        },\n    };\n};\n\n/**\n * MetricsApi - object-oriented interface\n * @export\n * @class MetricsApi\n * @extends {BaseAPI}\n */\nexport class MetricsApi extends BaseAPI {\n    /**\n     * Send metrics to Analytics server\n     * @summary Send metrics to the Analytics server.\n     * @param {string} environmentUUID environment parameter in query.\n     * @param {string} [cluster] Unique identifier for the cluster for the account\n     * @param {Metrics} [metrics]\n     * @param {*} [options] Override http request option.\n     * @throws {RequiredError}\n     * @memberof MetricsApi\n     */\n    public postMetrics(environmentUUID: string, cluster?: string, metrics?: Metrics, options?: any) {\n        return MetricsApiFp(this.configuration).postMetrics(environmentUUID, cluster, metrics, options).then((request) => request(this.axios, this.basePath));\n    }\n}\n\n\n/**\n * ProxyApi - axios parameter creator\n * @export\n */\nexport const ProxyApiAxiosParamCreator = function (configuration?: Configuration) {\n    return {\n        /**\n         * Endpoint that the Proxy can use to authenticate with the client server\n         * @summary Endpoint that the Proxy can use to authenticate with the client server\n         * @param {InlineObject} [inlineObject]\n         * @param {*} [options] Override http request option.\n         * @throws {RequiredError}\n         */\n        authenticateProxyKey: async (inlineObject?: InlineObject, options: any = {}): Promise<RequestArgs> => {\n            const localVarPath = `/proxy/auth`;\n            // use dummy base URL string because the URL constructor only accepts absolute URLs.\n            const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);\n            let baseOptions;\n            if (configuration) {\n                baseOptions = configuration.baseOptions;\n            }\n\n            const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};\n            const localVarHeaderParameter = {} as any;\n            const localVarQueryParameter = {} as any;\n\n\n\n            localVarHeaderParameter['Content-Type'] = 'application/json';\n\n            setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);\n            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};\n            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};\n            localVarRequestOptions.data = serializeDataIfNeeded(inlineObject, localVarRequestOptions, configuration)\n\n            return {\n                url: toPathString(localVarUrlObj),\n                options: localVarRequestOptions,\n            };\n        },\n        /**\n         * Gets Proxy config for multiple environments if the Key query param is provided or gets config for a single environment if an environment query param is provided\n         * @summary Gets Proxy config for multiple environments\n         * @param {string} key Accpets a Proxy Key.\n         * @param {number} [pageNumber] PageNumber\n         * @param {number} [pageSize] PageSize\n         * @param {string} [cluster] Unique identifier for the cluster for the account\n         * @param {string} [environment] Accepts an EnvironmentID. If this is provided then the endpoint will only return config for this environment. If this is left empty then the Proxy will return config for all environments associated with the Proxy Key.\n         * @param {*} [options] Override http request option.\n         * @throws {RequiredError}\n         */\n        getProxyConfig: async (key: string, pageNumber?: number, pageSize?: number, cluster?: string, environment?: string, options: any = {}): Promise<RequestArgs> => {\n            // verify required parameter 'key' is not null or undefined\n            assertParamExists('getProxyConfig', 'key', key)\n            const localVarPath = `/proxy/config`;\n            // use dummy base URL string because the URL constructor only accepts absolute URLs.\n            const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);\n            let baseOptions;\n            if (configuration) {\n                baseOptions = configuration.baseOptions;\n            }\n\n            const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};\n            const localVarHeaderParameter = {} as any;\n            const localVarQueryParameter = {} as any;\n\n            // authentication BearerAuth required\n            // http bearer authentication required\n            await setBearerAuthToObject(localVarHeaderParameter, configuration)\n\n            if (pageNumber !== undefined) {\n                localVarQueryParameter['pageNumber'] = pageNumber;\n            }\n\n            if (pageSize !== undefined) {\n                localVarQueryParameter['pageSize'] = pageSize;\n            }\n\n            if (cluster !== undefined) {\n                localVarQueryParameter['cluster'] = cluster;\n            }\n\n            if (environment !== undefined) {\n                localVarQueryParameter['environment'] = environment;\n            }\n\n            if (key !== undefined) {\n                localVarQueryParameter['key'] = key;\n            }\n\n\n\n            setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);\n            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};\n            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};\n\n            return {\n                url: toPathString(localVarUrlObj),\n                options: localVarRequestOptions,\n            };\n        },\n    }\n};\n\n/**\n * ProxyApi - functional programming interface\n * @export\n */\nexport const ProxyApiFp = function(configuration?: Configuration) {\n    const localVarAxiosParamCreator = ProxyApiAxiosParamCreator(configuration)\n    return {\n        /**\n         * Endpoint that the Proxy can use to authenticate with the client server\n         * @summary Endpoint that the Proxy can use to authenticate with the client server\n         * @param {InlineObject} [inlineObject]\n         * @param {*} [options] Override http request option.\n         * @throws {RequiredError}\n         */\n        async authenticateProxyKey(inlineObject?: InlineObject, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<AuthenticationResponse>> {\n            const localVarAxiosArgs = await localVarAxiosParamCreator.authenticateProxyKey(inlineObject, options);\n            return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);\n        },\n        /**\n         * Gets Proxy config for multiple environments if the Key query param is provided or gets config for a single environment if an environment query param is provided\n         * @summary Gets Proxy config for multiple environments\n         * @param {string} key Accpets a Proxy Key.\n         * @param {number} [pageNumber] PageNumber\n         * @param {number} [pageSize] PageSize\n         * @param {string} [cluster] Unique identifier for the cluster for the account\n         * @param {string} [environment] Accepts an EnvironmentID. If this is provided then the endpoint will only return config for this environment. If this is left empty then the Proxy will return config for all environments associated with the Proxy Key.\n         * @param {*} [options] Override http request option.\n         * @throws {RequiredError}\n         */\n        async getProxyConfig(key: string, pageNumber?: number, pageSize?: number, cluster?: string, environment?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ProxyConfig>> {\n            const localVarAxiosArgs = await localVarAxiosParamCreator.getProxyConfig(key, pageNumber, pageSize, cluster, environment, options);\n            return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);\n        },\n    }\n};\n\n/**\n * ProxyApi - factory interface\n * @export\n */\nexport const ProxyApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {\n    const localVarFp = ProxyApiFp(configuration)\n    return {\n        /**\n         * Endpoint that the Proxy can use to authenticate with the client server\n         * @summary Endpoint that the Proxy can use to authenticate with the client server\n         * @param {InlineObject} [inlineObject]\n         * @param {*} [options] Override http request option.\n         * @throws {RequiredError}\n         */\n        authenticateProxyKey(inlineObject?: InlineObject, options?: any): AxiosPromise<AuthenticationResponse> {\n            return localVarFp.authenticateProxyKey(inlineObject, options).then((request) => request(axios, basePath));\n        },\n        /**\n         * Gets Proxy config for multiple environments if the Key query param is provided or gets config for a single environment if an environment query param is provided\n         * @summary Gets Proxy config for multiple environments\n         * @param {string} key Accpets a Proxy Key.\n         * @param {number} [pageNumber] PageNumber\n         * @param {number} [pageSize] PageSize\n         * @param {string} [cluster] Unique identifier for the cluster for the account\n         * @param {string} [environment] Accepts an EnvironmentID. If this is provided then the endpoint will only return config for this environment. If this is left empty then the Proxy will return config for all environments associated with the Proxy Key.\n         * @param {*} [options] Override http request option.\n         * @throws {RequiredError}\n         */\n        getProxyConfig(key: string, pageNumber?: number, pageSize?: number, cluster?: string, environment?: string, options?: any): AxiosPromise<ProxyConfig> {\n            return localVarFp.getProxyConfig(key, pageNumber, pageSize, cluster, environment, options).then((request) => request(axios, basePath));\n        },\n    };\n};\n\n/**\n * ProxyApi - object-oriented interface\n * @export\n * @class ProxyApi\n * @extends {BaseAPI}\n */\nexport class ProxyApi extends BaseAPI {\n    /**\n     * Endpoint that the Proxy can use to authenticate with the client server\n     * @summary Endpoint that the Proxy can use to authenticate with the client server\n     * @param {InlineObject} [inlineObject]\n     * @param {*} [options] Override http request option.\n     * @throws {RequiredError}\n     * @memberof ProxyApi\n     */\n    public authenticateProxyKey(inlineObject?: InlineObject, options?: any) {\n        return ProxyApiFp(this.configuration).authenticateProxyKey(inlineObject, options).then((request) => request(this.axios, this.basePath));\n    }\n\n    /**\n     * Gets Proxy config for multiple environments if the Key query param is provided or gets config for a single environment if an environment query param is provided\n     * @summary Gets Proxy config for multiple environments\n     * @param {string} key Accpets a Proxy Key.\n     * @param {number} [pageNumber] PageNumber\n     * @param {number} [pageSize] PageSize\n     * @param {string} [cluster] Unique identifier for the cluster for the account\n     * @param {string} [environment] Accepts an EnvironmentID. If this is provided then the endpoint will only return config for this environment. If this is left empty then the Proxy will return config for all environments associated with the Proxy Key.\n     * @param {*} [options] Override http request option.\n     * @throws {RequiredError}\n     * @memberof ProxyApi\n     */\n    public getProxyConfig(key: string, pageNumber?: number, pageSize?: number, cluster?: string, environment?: string, options?: any) {\n        return ProxyApiFp(this.configuration).getProxyConfig(key, pageNumber, pageSize, cluster, environment, options).then((request) => request(this.axios, this.basePath));\n    }\n}\n\n\n", "/* tslint:disable */\n/* eslint-disable */\n/**\n * Harness feature flag service client apis\n * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)\n *\n * The version of the OpenAPI document: 1.0.0\n * Contact: cf@harness.io\n *\n * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).\n * https://openapi-generator.tech\n * Do not edit the class manually.\n */\n\n\nimport { Configuration } from \"./configuration\";\n// Some imports not used depending on template conditions\n// @ts-ignore\nimport globalAxios, { AxiosPromise, AxiosInstance } from 'axios';\n\nexport const BASE_PATH = \"http://localhost/api/1.0\".replace(/\\/+$/, \"\");\n\n/**\n *\n * @export\n */\nexport const COLLECTION_FORMATS = {\n    csv: \",\",\n    ssv: \" \",\n    tsv: \"\\t\",\n    pipes: \"|\",\n};\n\n/**\n *\n * @export\n * @interface RequestArgs\n */\nexport interface RequestArgs {\n    url: string;\n    options: any;\n}\n\n/**\n *\n * @export\n * @class BaseAPI\n */\nexport class BaseAPI {\n    protected configuration: Configuration | undefined;\n\n    constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {\n        if (configuration) {\n            this.configuration = configuration;\n            this.basePath = configuration.basePath || this.basePath;\n        }\n    }\n};\n\n/**\n *\n * @export\n * @class RequiredError\n * @extends {Error}\n */\nexport class RequiredError extends Error {\n    name: \"RequiredError\" = \"RequiredError\";\n    constructor(public field: string, msg?: string) {\n        super(msg);\n    }\n}\n", "/* tslint:disable */\n/* eslint-disable */\n/**\n * Harness feature flag service client apis\n * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)\n *\n * The version of the OpenAPI document: 1.0.0\n * Contact: cf@harness.io\n *\n * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).\n * https://openapi-generator.tech\n * Do not edit the class manually.\n */\n\n\nimport { Configuration } from \"./configuration\";\nimport { RequiredError,\u3000RequestArgs } from \"./base\";\nimport { AxiosInstance } from 'axios';\n\n/**\n *\n * @export\n */\nexport const DUMMY_BASE_URL = 'https://example.com'\n\n/**\n *\n * @throws {RequiredError}\n * @export\n */\nexport const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) {\n    if (paramValue === null || paramValue === undefined) {\n        throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);\n    }\n}\n\n/**\n *\n * @export\n */\nexport const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) {\n    if (configuration && configuration.apiKey) {\n        const localVarApiKeyValue = typeof configuration.apiKey === 'function'\n            ? await configuration.apiKey(keyParamName)\n            : await configuration.apiKey;\n        object[keyParamName] = localVarApiKeyValue;\n    }\n}\n\n/**\n *\n * @export\n */\nexport const setBasicAuthToObject = function (object: any, configuration?: Configuration) {\n    if (configuration && (configuration.username || configuration.password)) {\n        object[\"auth\"] = { username: configuration.username, password: configuration.password };\n    }\n}\n\n/**\n *\n * @export\n */\nexport const setBearerAuthToObject = async function (object: any, configuration?: Configuration) {\n    if (configuration && configuration.accessToken) {\n        const accessToken = typeof configuration.accessToken === 'function'\n            ? await configuration.accessToken()\n            : await configuration.accessToken;\n        object[\"Authorization\"] = \"Bearer \" + accessToken;\n    }\n}\n\n/**\n *\n * @export\n */\nexport const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) {\n    if (configuration && configuration.accessToken) {\n        const localVarAccessTokenValue = typeof configuration.accessToken === 'function'\n            ? await configuration.accessToken(name, scopes)\n            : await configuration.accessToken;\n        object[\"Authorization\"] = \"Bearer \" + localVarAccessTokenValue;\n    }\n}\n\n/**\n *\n * @export\n */\nexport const setSearchParams = function (url: URL, ...objects: any[]) {\n    const searchParams = new URLSearchParams(url.search);\n    for (const object of objects) {\n        for (const key in object) {\n            if (Array.isArray(object[key])) {\n                searchParams.delete(key);\n                for (const item of object[key]) {\n                    searchParams.append(key, item);\n                }\n            } else {\n                searchParams.set(key, object[key]);\n            }\n        }\n    }\n    url.search = searchParams.toString();\n}\n\n/**\n *\n * @export\n */\nexport const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) {\n    const nonString = typeof value !== 'string';\n    const needsSerialization = nonString && configuration && configuration.isJsonMime\n        ? configuration.isJsonMime(requestOptions.headers['Content-Type'])\n        : nonString;\n    return needsSerialization\n        ? JSON.stringify(value !== undefined ? value : {})\n        : (value || \"\");\n}\n\n/**\n *\n * @export\n */\nexport const toPathString = function (url: URL) {\n    return url.pathname + url.search + url.hash\n}\n\n/**\n *\n * @export\n */\nexport const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {\n    return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {\n        const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url};\n        return axios.request(axiosRequestArgs);\n    };\n}\n", "/* tslint:disable */\n/* eslint-disable */\n/**\n * Harness feature flag service client apis\n * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)\n *\n * The version of the OpenAPI document: 1.0.0\n * Contact: cf@harness.io\n *\n * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).\n * https://openapi-generator.tech\n * Do not edit the class manually.\n */\n\n\nexport interface ConfigurationParameters {\n    apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);\n    username?: string;\n    password?: string;\n    accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);\n    basePath?: string;\n    baseOptions?: any;\n    formDataCtor?: new () => any;\n}\n\nexport class Configuration {\n    /**\n     * parameter for apiKey security\n     * @param name security name\n     * @memberof Configuration\n     */\n    apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);\n    /**\n     * parameter for basic security\n     *\n     * @type {string}\n     * @memberof Configuration\n     */\n    username?: string;\n    /**\n     * parameter for basic security\n     *\n     * @type {string}\n     * @memberof Configuration\n     */\n    password?: string;\n    /**\n     * parameter for oauth2 security\n     * @param name security name\n     * @param scopes oauth2 scope\n     * @memberof Configuration\n     */\n    accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);\n    /**\n     * override base path\n     *\n     * @type {string}\n     * @memberof Configuration\n     */\n    basePath?: string;\n    /**\n     * base options for axios calls\n     *\n     * @type {any}\n     * @memberof Configuration\n     */\n    baseOptions?: any;\n    /**\n     * The FormData constructor that will be used to create multipart form data\n     * requests. You can inject this here so that execution environments that\n     * do not support the FormData class can still run the generated client.\n     *\n     * @type {new () => FormData}\n     */\n    formDataCtor?: new () => any;\n\n    constructor(param: ConfigurationParameters = {}) {\n        this.apiKey = param.apiKey;\n        this.username = param.username;\n        this.password = param.password;\n        this.accessToken = param.accessToken;\n        this.basePath = param.basePath;\n        this.baseOptions = param.baseOptions;\n        this.formDataCtor = param.formDataCtor;\n    }\n\n    /**\n     * Check if the given MIME is a JSON MIME.\n     * JSON MIME examples:\n     *   application/json\n     *   application/json; charset=UTF8\n     *   APPLICATION/JSON\n     *   application/vnd.company+json\n     * @param mime - MIME (Multipurpose Internet Mail Extensions)\n     * @return True if the given MIME is JSON, false otherwise.\n     */\n    public isJsonMime(mime: string): boolean {\n        const jsonMime: RegExp = new RegExp('^(application\\/json|[^;/ \\t]+\\/[^;/ \\t]+[+]json)[ \\t]*(;.*)?$', 'i');\n        return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');\n    }\n}\n", "export const VERSION = '1.8.12';\n", "import { Logger } from './log';\nimport { Target } from './types';\nimport { VERSION } from './version';\n\nconst sdkCodes: Record<number, string> = {\n  // SDK_INIT_1xxx\n  1000: 'The SDK has successfully initialized, version ' + VERSION,\n  1001: 'The SDK has failed to initialize due to an authentication error - defaults will be served',\n  1002: 'The SDK has failed to initialize due to a missing or empty API key - defaults will be served',\n  // SDK_AUTH_2xxx\n  2000: 'Authentication was successful',\n  2001: 'Authentication failed with a non-recoverable error',\n  2002: 'Authentication attempt failed:',\n  2003: 'Authentication failed and max retries have been exceeded',\n  // SDK_CLOSE_3xxx\n  3000: 'Closing SDK',\n  3001: 'SDK Closed successfully',\n  // SDK_POLL_4xxx\n  4000: 'Polling started, interval:',\n  4001: 'Polling stopped',\n  // SDK_STREAM_5xxx\n  5000: 'SSE stream successfully connected',\n  5001: 'SSE stream disconnected, reason:',  // When used with retrying, will combine with 5003\n  5002: 'SSE event received',\n  5003: 'SSE retrying to connect in',\n  5004: 'SSE stopped',\n  // SDK_EVAL_6xxx -\n  6000: 'Evaluation successful: ',\n  6001: 'Evaluation Failed, returning default variation: ',\n  6002: \"BucketBy attribute not found in target attributes, falling back to 'identifier':\",\n  // SDK_METRICS_7xxx\n  7000: 'Metrics thread started with request interval:',\n  7001: 'Metrics stopped',\n  7002: 'Posting metrics failed, reason:',\n  7003: 'Metrics posted successfully',\n  7004: 'Target metrics exceeded max size, remaining targets for this analytics interval will not be sent',\n  7007: 'Evaluation metrics exceeded max size, remaining evaluations for this analytics interval will not be sent'\n};\n\nfunction getSDKCodeMessage(key: number): string {\n  if (key in sdkCodes) {\n    return sdkCodes[key];\n  } else {\n    return 'Unknown SDK code';\n  }\n}\n\nfunction getSdkErrMsg(\n  errorCode: number,\n  appendText: string | number = '',\n): string {\n  return `SDKCODE:${errorCode}: ${getSDKCodeMessage(\n    errorCode,\n  )} ${appendText}`;\n}\n\nexport function warnMissingSDKKey(logger: Logger): void {\n  logger.warn(getSdkErrMsg(1002));\n}\n\nexport function infoPollStarted(durationMS: number, logger: Logger): void {\n  logger.info(getSdkErrMsg(4000, durationMS / 1000 + ' seconds'));\n}\n\nexport function infoSDKInitOK(logger: Logger): void {\n  logger.info(getSdkErrMsg(1000));\n}\n\nexport function infoSDKStartClose(logger: Logger): void {\n  logger.info(getSdkErrMsg(3000));\n}\n\nexport function infoSDKCloseSuccess(logger: Logger): void {\n  logger.info(getSdkErrMsg(3001));\n}\n\nexport function infoSDKAuthOK(logger: Logger): void {\n  logger.info(getSdkErrMsg(2000));\n}\n\nexport function infoPollingStopped(logger: Logger): void {\n  logger.info(getSdkErrMsg(4001));\n}\n\nexport function infoStreamConnected(logger: Logger): void {\n  logger.info(getSdkErrMsg(5000));\n}\n\nexport function debugStreamEventReceived(logger: Logger): void {\n  logger.debug(getSdkErrMsg(5002));\n}\n\nexport function infoStreamStopped(logger: Logger): void {\n  logger.info(getSdkErrMsg(5004));\n}\n\nexport function infoMetricsThreadStarted(\n  interval: number,\n  logger: Logger,\n): void {\n  logger.info(getSdkErrMsg(7000, interval / 1000 + ' seconds'));\n}\n\nexport function infoMetricsSuccess(logger: Logger): void {\n  logger.info(getSdkErrMsg(7003));\n}\n\nexport function infoMetricsThreadExited(logger: Logger): void {\n  logger.info(getSdkErrMsg(7001));\n}\n\nexport function warnTargetMetricsExceeded(logger: Logger): void {\n  logger.warn(getSdkErrMsg(7004));\n}\n\nexport function warnEvaluationMetricsExceeded(logger: Logger): void {\n  logger.warn(getSdkErrMsg(7007));\n}\n\nexport function debugEvalSuccess(\n  result: string,\n  flagIdentifier: string,\n  target: Target,\n  logger: Logger,\n): void {\n  logger.debug(\n    getSdkErrMsg(\n      6000,\n      `result=${result}, flag identifier=${flagIdentifier}, target=${JSON.stringify(\n        target,\n      )}`,\n    ),\n  );\n}\n\nexport function warnAuthFailedSrvDefaults(logger: Logger): void {\n  logger.warn(getSdkErrMsg(2001));\n}\n\nexport function warnFailedInitAuthError(logger: Logger): void {\n  logger.warn(getSdkErrMsg(1001));\n}\n\nexport function warnAuthFailedExceedRetries(logger: Logger): void {\n  logger.warn(getSdkErrMsg(2003));\n}\n\nexport function warnAuthRetrying(\n  attempt: number,\n  error: string,\n  logger: Logger,\n): void {\n  logger.warn(\n    getSdkErrMsg(\n      2002,\n      `attempt=${attempt}, error=${error}, continue retrying=true`,\n    ),\n  );\n}\n\n// Track disconnect attempts for throttling warning logs\nlet disconnectAttempts = 0;\nlet lastConnectionSuccess = Date.now(); // Initialize with current time to avoid huge numbers\n\n// Restart disconnect counter when connection succeeds\nexport function restartDisconnectCounter(): void {\n  disconnectAttempts = 0;\n  lastConnectionSuccess = Date.now();\n}\n\n// Reset disconnect counter\nexport function resetDisconnectCounter(): void {\n  disconnectAttempts = 0;\n  lastConnectionSuccess = Date.now();\n}\n\n\n// Combined warning function for both disconnect and retry in a single message\nexport function warnStreamDisconnectedWithRetry(reason: string, ms: number, logger: Logger): void {\n  disconnectAttempts++;\n\n  // First disconnect after a successful connection - always warn\n  // Combine both codes to create a message with both disconnect reason and retry info\n  const combinedMessage = `${getSdkErrMsg(5001)} ${reason} - ${getSdkErrMsg(5003)} ${ms}ms`;\n\n  if (disconnectAttempts === 1) {\n    logger.warn(`${combinedMessage} (subsequent logs until 10th attempt will be at DEBUG level to reduce noise)`);\n  }\n  else if (disconnectAttempts === 10) {\n    const timeSince = Date.now() - lastConnectionSuccess;\n    const timeSinceConnection = Math.floor(timeSince/1000);\n    logger.warn(`${combinedMessage} (10th attempt, connection unstable for ${timeSinceConnection} seconds, subsequent logs will be at DEBUG level except every 50th attempt)`);\n  }\n\n  else if (disconnectAttempts > 10 && disconnectAttempts % 50 === 0) {\n    const timeSince = Date.now() - lastConnectionSuccess;\n    const timeSinceConnection = Math.floor(timeSince/1000);\n    const nextWarnAt = disconnectAttempts + 50;\n    logger.warn(`${combinedMessage} (${disconnectAttempts}th attempt, connection unstable for ${timeSinceConnection} seconds, next warning at ${nextWarnAt}th attempt)`);\n  }\n\n  // All other disconnect attempts - log at debug level\n  else {\n    logger.debug(`${combinedMessage} (attempt ${disconnectAttempts}, logging at debug level to reduce noise)`);\n  }\n}\n\n\nexport function warnPostMetricsFailed(reason: string, logger: Logger): void {\n  logger.warn(getSdkErrMsg(7002, reason));\n}\n\nexport function warnDefaultVariationServed(\n  flag: string,\n  target: Target,\n  defaultValue: string,\n  logger: Logger,\n): void {\n  logger.warn(\n    getSdkErrMsg(\n      6001,\n      `default variation used=${defaultValue}, flag=${flag}, target=${JSON.stringify(\n        target,\n      )}`,\n    ),\n  );\n}\n\nexport function warnBucketByAttributeNotFound(\n  bucketBy: string,\n  usingValue: string,\n  logger: Logger,\n): void {\n  logger.warn(\n    getSdkErrMsg(6002, `missing=${bucketBy}, using value=${usingValue}`),\n  );\n}\n", "import { ClientApi, FeatureConfig, Segment } from './openapi';\nimport { APIConfiguration, Options } from './types';\nimport EventEmitter from 'events';\nimport { Repository } from './repository';\nimport { ConsoleLog } from './log';\nimport { infoPollingStopped } from './sdk_codes';\n\nexport enum PollerEvent {\n  READY = 'poller_ready',\n  ERROR = 'poller_error',\n}\n\nexport class PollingProcessor {\n  private environment: string;\n  private cluster: string;\n  private api: ClientApi;\n  private apiConfiguration: APIConfiguration;\n  private stopped = true;\n  private options: Options;\n  private repository: Repository;\n  private initialized = false;\n  private eventBus: EventEmitter;\n  private timeout: NodeJS.Timeout;\n  private log: ConsoleLog;\n  private lastPollTime = 0;\n\n  constructor(\n    environment: string,\n    cluster: string,\n    api: ClientApi,\n    apiConfiguration: APIConfiguration,\n    options: Options,\n    eventBus: EventEmitter,\n    repository: Repository,\n  ) {\n    this.api = api;\n    this.apiConfiguration = apiConfiguration;\n    this.options = options;\n    this.environment = environment;\n    this.cluster = cluster;\n    this.repository = repository;\n    this.eventBus = eventBus;\n    this.log = options.logger;\n  }\n\n  private poll() {\n    if (this.stopped) {\n      this.log.info('PollingProcessor stopped');\n      infoPollingStopped(this.log);\n      return;\n    }\n\n    const startTime = new Date().getTime();\n    const pollAgain = () => {\n      const elapsed = new Date().getTime() - startTime;\n      const sleepFor = Math.max(this.options.pollInterval - elapsed, 0);\n\n      this.timeout = setTimeout(() => this.poll(), sleepFor);\n    };\n\n    if (this.lastPollTime > Date.now() - this.options.pollInterval) {\n      this.log.info(\n        `Last poll was ${Math.round(\n          (Date.now() - this.lastPollTime) / 1000,\n        )} seconds ago, skipping flag refresh`,\n      );\n      pollAgain();\n      return;\n    }\n\n    this.lastPollTime = Date.now();\n    Promise.all([this.retrieveFlags(), this.retrieveSegments()])\n      .then(() => {\n        // when first fetch is successful then poller is ready\n        if (!this.initialized) {\n          setTimeout(() => {\n            this.initialized = true;\n            this.eventBus.emit(PollerEvent.READY);\n          }, 0);\n        }\n      })\n      .catch((error) => {\n        this.eventBus.emit(PollerEvent.ERROR, error);\n      })\n      .finally(() => {\n        // we will check one more time if processor is stopped\n        if (this.stopped) {\n          this.log.info('PollingProcessor stopped');\n          infoPollingStopped(this.log);\n          return;\n        }\n        pollAgain();\n      });\n  }\n\n  private async retrieveFlags(): Promise<void> {\n    try {\n      this.log.debug('Fetching flags started');\n      const response = await this.api.getFeatureConfig(\n        this.environment,\n        this.cluster,\n      );\n      this.log.debug('Fetching flags finished');\n      response.data.forEach((fc: FeatureConfig) =>\n        this.repository.setFlag(fc.feature, fc),\n      );\n    } catch (error) {\n      this.log.error(\n        `Error loading flags (${error.code ?? \"UNKNOWN\"}): ${error.message}`\n      );\n      throw error;\n    }\n  }\n\n  private async retrieveSegments(): Promise<void> {\n    try {\n      this.log.debug('Fetching segments started');\n      const response = await this.api.getAllSegments(\n        this.environment,\n        this.cluster,\n        this.apiConfiguration.targetSegmentRulesQueryParameter,\n      );\n      this.log.debug('Fetching segments finished');\n      // prepare cache for storing segments\n      response.data.forEach((segment: Segment) =>\n        this.repository.setSegment(segment.identifier, segment),\n      );\n    } catch (error) {\n      this.log.error(\n        `Error loading segments (${error.code ?? \"UNKNOWN\"}): ${error.message}`\n      );\n      throw error;\n    }\n  }\n\n  start(): void {\n    if (!this.stopped) {\n      this.log.debug('PollingProcessor already started');\n      return;\n    }\n    this.log.info(\n      'Starting PollingProcessor with request interval: ',\n      this.options.pollInterval,\n    );\n    this.stopped = false;\n    this.poll();\n  }\n\n  stop(): void {\n    this.log.info('Stopping PollingProcessor');\n    this.stopped = true;\n  }\n\n  close(): void {\n    this.log.info('Closing PollingProcessor');\n    this.stop();\n    clearTimeout(this.timeout);\n    this.log.info('PollingProcessor closed');\n  }\n}\n", "import EventEmitter from 'events';\nimport { AxiosPromise } from 'axios';\nimport { ClientApi, FeatureConfig, Segment } from './openapi';\nimport { StreamEvent, Options, StreamMsg, APIConfiguration } from './types';\nimport { Repository } from './repository';\nimport { ConsoleLog } from './log';\n\nimport https, { RequestOptions } from 'https';\nimport http, { ClientRequest } from 'http';\nimport {\n  debugStreamEventReceived,\n  infoStreamStopped,\n  warnStreamDisconnectedWithRetry,\n  resetDisconnectCounter,\n  restartDisconnectCounter,\n} from './sdk_codes';\n\ntype FetchFunction = (\n  identifier: string,\n  environment: string,\n  cluster: string,\n  // Only target-segment requests require this, and it will be safely ignored for feature calls.\n  targetSegmentRulesQueryParameter: string,\n) => AxiosPromise<FeatureConfig | Segment>;\n\nexport class StreamProcessor {\n  static readonly CONNECTED = 1;\n  static readonly RETRYING = 2;\n  static readonly CLOSED = 3;\n  static readonly SSE_TIMEOUT_MS = 30000;\n\n  private readonly apiKey: string;\n  private readonly jwtToken: string;\n  private readonly environment: string;\n  private readonly cluster: string;\n  private readonly api: ClientApi;\n  private readonly apiConfiguration: APIConfiguration;\n  private readonly repository: Repository;\n  private readonly retryDelayMs: number;\n  private readonly headers: Record<string, string>;\n  private readonly httpsCa: Buffer;\n\n  private options: Options;\n  private request: ClientRequest;\n  private eventBus: EventEmitter;\n  private readyState: number;\n  private log: ConsoleLog;\n  private retryAttempt = 0;\n  private retryTimeout: NodeJS.Timeout | undefined;\n\n  constructor(\n    api: ClientApi,\n    apiKey: string,\n    apiConfiguration: APIConfiguration,\n    environment: string,\n    jwtToken: string,\n    options: Options,\n    cluster: string,\n    eventBus: EventEmitter,\n    repository: Repository,\n    headers: Record<string, string>,\n    httpsCa: Buffer,\n  ) {\n    this.api = api;\n    this.apiKey = apiKey;\n    this.apiConfiguration = apiConfiguration;\n    this.environment = environment;\n    this.jwtToken = jwtToken;\n    this.options = options;\n    this.cluster = cluster;\n    this.eventBus = eventBus;\n    this.repository = repository;\n    this.log = this.options.logger;\n\n    const minDelay = 5000;\n    const maxDelay = 10000;\n    this.retryDelayMs = Math.floor(\n      Math.random() * (maxDelay - minDelay) + minDelay,\n    );\n    this.headers = headers;\n    this.httpsCa = httpsCa;\n  }\n\n  start(): void {\n    this.log.info('Starting new StreamProcessor');\n\n    const url = `${this.options.baseUrl}/stream?cluster=${this.cluster}`;\n\n    const options = {\n      headers: {\n        'Cache-Control': 'no-cache',\n        Accept: 'text/event-stream',\n        Authorization: `Bearer ${this.jwtToken}`,\n        'API-Key': this.apiKey,\n        ...this.headers,\n      },\n      ca: undefined,\n    };\n\n    if (this.httpsCa) {\n      options.ca = this.httpsCa;\n    }\n\n    const onConnected = () => {\n      this.log.info(`SSE stream connected OK: ${url}`);\n\n      // Reset disconnect counter when connection succeeds\n      restartDisconnectCounter();\n\n      this.retryAttempt = 0;\n      this.readyState = StreamProcessor.CONNECTED;\n      this.eventBus.emit(StreamEvent.CONNECTED);\n    };\n\n    const onFailed = (msg: string) => {\n      if (this.readyState !== StreamProcessor.CLOSED && !this.retryTimeout) {\n        this.retryAttempt += 1;\n\n        const delayMs = this.getRandomRetryDelayMs();\n        warnStreamDisconnectedWithRetry(msg, delayMs, this.log);\n        this.readyState = StreamProcessor.RETRYING;\n        this.eventBus.emit(StreamEvent.RETRYING);\n\n        this.retryTimeout = setTimeout(() => {\n          this.retryTimeout = undefined;\n          if (this.readyState !== StreamProcessor.CLOSED) {\n            this.connect(url, options, onConnected, onFailed);\n          }\n        }, delayMs);\n      }\n    };\n\n    this.connect(url, options, onConnected, onFailed);\n\n    this.eventBus.emit(StreamEvent.READY);\n  }\n\n  private getRandomRetryDelayMs(): number {\n    const delayMs = this.retryDelayMs * this.retryAttempt;\n    return Math.min(delayMs, 60000);\n  }\n\n  private cleanupConnection(): void {\n    if (this.request) {\n      this.request.removeAllListeners();\n      this.request.destroy();\n      this.request = undefined;\n    }\n  }\n\n  private connect(\n    url: string,\n    options: RequestOptions,\n    onConnected: () => void,\n    onFailed: (msg: string) => void,\n  ): void {\n    if (this.readyState === StreamProcessor.CONNECTED) {\n      this.log.debug('SSE already connected, skip retry');\n      return;\n    }\n\n    this.cleanupConnection();\n\n    const isSecure = url.startsWith('https:');\n    this.log.debug('SSE HTTP start request', url);\n\n    this.request = (isSecure ? https : http)\n      .request(url, options, (res) => {\n        this.log.debug('SSE got HTTP response code', res.statusCode);\n\n        if (res.statusCode >= 400 && res.statusCode <= 599) {\n          onFailed(`HTTP code ${res.statusCode}`);\n          return;\n        }\n\n        onConnected();\n\n        res\n          .on('data', (data) => {\n            this.processData(data);\n          })\n          .on('close', () => {\n            onFailed('SSE stream closed');\n          });\n      })\n      .on('error', (err) => {\n        onFailed('SSE request failed ' + err.message);\n      })\n      .on('timeout', () => {\n        onFailed(\n          'SSE request timed out after ' +\n            StreamProcessor.SSE_TIMEOUT_MS +\n            'ms',\n        );\n      })\n      .setTimeout(StreamProcessor.SSE_TIMEOUT_MS);\n    this.request.end();\n  }\n\n  private processData(data: any): void {\n    const lines = data.toString().split(/\\r?\\n/);\n    if (lines[0].startsWith(':')) {\n      this.log.debug('SSE Heartbeat received');\n      return;\n    }\n    lines.forEach((line) => this.processLine(line));\n  }\n\n  private processLine(line: string): void {\n    if (line.startsWith('data:')) {\n      debugStreamEventReceived(this.log);\n      this.log.debug('SSE GOT:', line.substring(5));\n      const msg = JSON.parse(line.substring(5));\n\n      if (msg.domain === 'flag') {\n        this.msgProcessor(\n          msg,\n          this.api.getFeatureConfigByIdentifier.bind(this.api),\n          this.repository.setFlag.bind(this.repository),\n          this.repository.deleteFlag.bind(this.repository),\n        ).then(\n          (_) => this.log.info('>>SSE Got flag for:', msg.identifier),\n          (e) =>\n            this.log.error('>>SSE Failed to get flag for:', msg.identifier, e),\n        );\n      } else if (msg.domain === 'target-segment') {\n        this.msgProcessor(\n          msg,\n          this.api.getSegmentByIdentifier.bind(this.api),\n          this.repository.setSegment.bind(this.repository),\n          this.repository.deleteSegment.bind(this.repository),\n        ).then(\n          (_) => this.log.info('SSE Got target-segment for:', msg.identifier),\n          (e) =>\n            this.log.error(\n              '>>SSE Failed to get target-segment for:',\n              msg.identifier,\n              e,\n            ),\n        );\n      }\n    }\n  }\n\n  private async msgProcessor(\n    msg: StreamMsg,\n    fn: FetchFunction,\n    setFn: (identifier: string, data: FeatureConfig | Segment) => void,\n    delFn: (identifier: string) => void,\n  ): Promise<void> {\n    this.log.info('Processing message', msg);\n    try {\n      if (msg.event === 'create' || msg.event === 'patch') {\n        const { data } = await fn(\n          msg.identifier,\n          this.environment,\n          this.cluster,\n          this.apiConfiguration.targetSegmentRulesQueryParameter,\n        );\n        setFn(msg.identifier, data);\n      } else if (msg.event === 'delete') {\n        delFn(msg.identifier);\n      }\n    } catch (error) {\n      this.log.error(\n        'Error while fetching data with identifier:',\n        msg.identifier,\n        error,\n      );\n      throw error;\n    }\n    this.log.info('Processing message finished', msg);\n    return;\n  }\n\n  connected(): boolean {\n    return this.readyState === StreamProcessor.CONNECTED;\n  }\n\n  close(): void {\n    if (this.readyState === StreamProcessor.CLOSED) {\n      this.log.info('SteamProcessor already closed');\n      return;\n    }\n\n    clearTimeout(this.retryTimeout);\n    this.retryTimeout = undefined;\n\n    this.readyState = StreamProcessor.CLOSED;\n    this.log.info('Closing StreamProcessor');\n\n    resetDisconnectCounter();\n    this.request.destroy();\n    this.request = undefined;\n\n    this.eventBus.emit(StreamEvent.DISCONNECTED);\n    this.log.info('StreamProcessor closed');\n    infoStreamStopped(this.log);\n  }\n}\n", "import LRU from 'lru-cache';\nimport { ConsoleLog } from './log';\nimport { FileStore } from './store';\nimport { APIConfiguration, Options } from './types';\n\nexport const ONE_HUNDRED = 100;\n\nexport const FF_METRIC_TYPE = 'FFMETRICS',\n  FEATURE_IDENTIFIER_ATTRIBUTE = 'featureIdentifier',\n  FEATURE_NAME_ATTRIBUTE = 'featureName',\n  VARIATION_IDENTIFIER_ATTRIBUTE = 'variationIdentifier',\n  VARIATION_VALUE_ATTRIBUTE = 'featureValue',\n  TARGET_ATTRIBUTE = 'target',\n  SDK_VERSION_ATTRIBUTE = 'SDK_VERSION',\n  SDK_TYPE_ATTRIBUTE = 'SDK_TYPE',\n  SDK_TYPE = 'server',\n  SDK_LANGUAGE_ATTRIBUTE = 'SDK_LANGUAGE',\n  SDK_LANGUAGE = 'javascript',\n  GLOBAL_TARGET = 'global';\n\nexport const SEGMENT_MATCH_OPERATOR = 'segmentMatch',\n  IN_OPERATOR = 'in',\n  EQUAL_OPERATOR = 'equal',\n  GT_OPERATOR = 'gt',\n  STARTS_WITH_OPERATOR = 'starts_with',\n  ENDS_WITH_OPERATOR = 'ends_with',\n  CONTAINS_OPERATOR = 'contains',\n  EQUAL_SENSITIVE_OPERATOR = 'equal_sensitive';\n\nexport const BASE_URL = 'https://config.ff.harness.io/api/1.0',\n  EVENTS_URL = 'https://events.ff.harness.io/api/1.0',\n  SECOND = 1000,\n  MINUTE = 60 * SECOND,\n  PULL_INTERVAL = 1 * MINUTE,\n  EVENTS_SYNC_INTERVAL = 1 * MINUTE;\n\nexport const defaultOptions: Options = {\n  baseUrl: BASE_URL,\n  eventsUrl: EVENTS_URL,\n  pollInterval: PULL_INTERVAL,\n  eventsSyncInterval: EVENTS_SYNC_INTERVAL,\n  enableStream: true,\n  enableAnalytics: true,\n  cache: new LRU({ max: 100 }),\n  store: new FileStore(),\n  logger: new ConsoleLog(),\n  axiosTimeout: 30000,\n  axiosRetries: Infinity, // Retry forever unless explicitly overridden\n};\n\nconst TARGET_SEGMENT_RULES_QUERY_PARAMETER = 'v2';\nexport const apiConfiguration: APIConfiguration = {\n  targetSegmentRulesQueryParameter: TARGET_SEGMENT_RULES_QUERY_PARAMETER,\n};\n", "export interface Logger {\n  trace(message?: unknown, ...optionalParams: unknown[]): void;\n  debug(message?: unknown, ...optionalParams: unknown[]): void;\n  info(message?: unknown, ...optionalParams: unknown[]): void;\n  warn(message?: unknown, ...optionalParams: unknown[]): void;\n  error(message?: unknown, ...optionalParams: unknown[]): void;\n}\n\n// Wrapper for console\nexport class ConsoleLog implements Logger {\n  trace(message?: unknown, ...optionalParams: unknown[]): void {\n    console.trace(message, ...optionalParams);\n  }\n  debug(message?: unknown, ...optionalParams: unknown[]): void {\n    console.debug(message, ...optionalParams);\n  }\n  info(message?: unknown, ...optionalParams: unknown[]): void {\n    console.info(message, ...optionalParams);\n  }\n  warn(message?: unknown, ...optionalParams: unknown[]): void {\n    console.warn(message, ...optionalParams);\n  }\n  error(message?: unknown, ...optionalParams: unknown[]): void {\n    console.error(message, ...optionalParams);\n  }\n}\n", "import Keyv from 'keyv';\nimport { KeyvFile } from 'keyv-file';\nimport { AsyncKeyValueStore } from './types';\n\nexport class FileStore implements AsyncKeyValueStore {\n  private keyv: Keyv;\n  private keyvFile: KeyvFile;\n\n  constructor(options = {}) {\n    this.keyvFile = new KeyvFile(options);\n    this.keyv = new Keyv({\n      store: this.keyvFile,\n    });\n  }\n\n  set(key: string, value: unknown): Promise<true> {\n    return this.keyv.set(key, value);\n  }\n\n  get<T>(key: string): Promise<T> {\n    return this.keyv.get(key);\n  }\n\n  del(key: string): Promise<boolean> {\n    return this.keyv.delete(key);\n  }\n\n  keys(): Promise<Generator<string, void, void>> {\n    return Promise.resolve((function* (keys: string[]) {\n      for (const key of keys) {\n        yield key;\n      }\n    })(this.keyvFile.keys()));\n  }\n}\n", "import {\n  CONTAINS_OPERATOR,\n  ENDS_WITH_OPERATOR,\n  EQUAL_OPERATOR,\n  EQUAL_SENSITIVE_OPERATOR,\n  GT_OPERATOR,\n  IN_OPERATOR,\n  ONE_HUNDRED,\n  SEGMENT_MATCH_OPERATOR,\n  STARTS_WITH_OPERATOR,\n} from './constants';\nimport { Query, Target, Type } from './types';\nimport {\n  Clause,\n  Distribution,\n  FeatureConfig,\n  FeatureConfigKindEnum,\n  FeatureState,\n  ServingRule,\n  Variation,\n  Target as ApiTarget,\n  VariationMap,\n} from './openapi';\nimport murmurhash from 'murmurhash';\nimport { ConsoleLog } from './log';\nimport {\n  debugEvalSuccess,\n  warnBucketByAttributeNotFound,\n  warnDefaultVariationServed,\n} from './sdk_codes';\n\ntype Callback = (\n  fc: FeatureConfig,\n  target: Target,\n  variation: Variation,\n) => void;\n\nexport class Evaluator {\n  private query: Query;\n  private log: ConsoleLog;\n\n  constructor(query: Query, logger: ConsoleLog) {\n    this.query = query;\n    this.log = logger;\n  }\n\n  private getAttrValue(target: Target, attribute: string): Type | undefined {\n    return target[attribute] || target.attributes?.[attribute];\n  }\n\n  private findVariation(\n    variations: Variation[],\n    identifier: string,\n  ): Variation | undefined {\n    return variations.find(\n      (value: Variation) => value.identifier === identifier,\n    );\n  }\n\n  private getNormalizedNumberWithNormalizer(\n    bucketBy: string,\n    property: Type,\n    normalizer: number,\n  ): number {\n    const value = [bucketBy, property].join(':');\n    const hash = parseInt(murmurhash(value).toString());\n    return (hash % normalizer) + 1;\n  }\n\n  private getNormalizedNumber(bucketBy: string, property: Type): number {\n    return this.getNormalizedNumberWithNormalizer(\n      bucketBy,\n      property,\n      ONE_HUNDRED,\n    );\n  }\n\n  private isEnabled(\n    target: Target,\n    bucketBy: string,\n    percentage: number,\n  ): boolean {\n    let bb = bucketBy;\n    let property = this.getAttrValue(target, bb);\n    if (!property) {\n      bb = 'identifier';\n      property = this.getAttrValue(target, bb);\n\n      if (!property) {\n        return false;\n      }\n\n      warnBucketByAttributeNotFound(bucketBy, property?.toString(), this.log);\n    }\n    const bucketId = this.getNormalizedNumber(bb, property);\n    return percentage > 0 && bucketId <= percentage;\n  }\n\n  private evaluateDistribution(\n    distribution: Distribution,\n    target: Target,\n  ): string {\n    if (!distribution) {\n      return undefined;\n    }\n\n    let variation = '';\n    let totalPercentage = 0;\n    for (const v of distribution.variations) {\n      variation = v.variation;\n      totalPercentage += v.weight;\n      if (this.isEnabled(target, distribution.bucketBy, totalPercentage)) {\n        return v.variation;\n      }\n    }\n    return variation;\n  }\n\n  private async isTargetIncludedOrExcludedInSegment(\n    segments: string[],\n    target: Target,\n  ): Promise<boolean> {\n    for (const segmentIdentifier of segments) {\n      const segment = await this.query.getSegment(segmentIdentifier);\n\n      if (segment) {\n        // Should Target be excluded - if in excluded list we return false\n        if (\n          segment.excluded?.find(\n            (value: ApiTarget) => value.identifier === target.identifier,\n          )\n        ) {\n          this.log.debug(\n            'Target %s excluded from segment %s via exclude list\\n',\n            target.name,\n            segment.name,\n          );\n          return false;\n        }\n\n        // Should Target be included - if in included list we return true\n        if (\n          segment.included?.find(\n            (value: ApiTarget) => value.identifier === target.identifier,\n          )\n        ) {\n          this.log.debug(\n            'Target %s included in segment %s via include list\\n',\n            target.name,\n            segment.name,\n          );\n          return true;\n        }\n\n        if (segment?.servingRules?.length) {\n          // Use enhanced rules first if they're available\n          for (const servingRule of segment.servingRules) {\n            if (await this.evaluateClauses_v2(servingRule.clauses, target)) {\n              return true;\n            }\n          }\n        } else {\n          // Fall back to legacy rules\n          // Should Target be included via segment rules\n          if (\n            segment.rules &&\n            (await this.evaluateClauses(segment.rules, target))\n          ) {\n            this.log.debug(\n              'Target %s included in segment %s via rules\\n',\n              target.name,\n              segment.name,\n            );\n            return true;\n          }\n        }\n      }\n    }\n    return false;\n  }\n\n  private async evaluateClause(\n    clause: Clause,\n    target: Target,\n  ): Promise<boolean> {\n    if (!clause?.op || !clause?.values?.length) {\n      return false;\n    }\n\n    const attrValue = this.getAttrValue(target, clause.attribute);\n    const targetAttribute = attrValue?.toString();\n    if (clause.op !== SEGMENT_MATCH_OPERATOR && !targetAttribute) {\n      return false;\n    }\n\n    const value = clause.values[0];\n\n    switch (clause.op) {\n      case IN_OPERATOR:\n        for (const val of clause.values) {\n          if (val == targetAttribute) {\n            return true;\n          }\n        }\n        return false;\n      case EQUAL_OPERATOR:\n        return targetAttribute.toLowerCase() == value.toLowerCase();\n      case EQUAL_SENSITIVE_OPERATOR:\n        return targetAttribute == value;\n      case GT_OPERATOR:\n        return targetAttribute > value;\n      case STARTS_WITH_OPERATOR:\n        return targetAttribute.startsWith(value);\n      case ENDS_WITH_OPERATOR:\n        return targetAttribute.endsWith(value);\n      case CONTAINS_OPERATOR:\n        return targetAttribute.includes(value);\n      case SEGMENT_MATCH_OPERATOR:\n        return await this.isTargetIncludedOrExcludedInSegment(\n          clause.values,\n          target,\n        );\n    }\n    return false;\n  }\n\n  private async evaluateClauses(\n    clauses: Clause[],\n    target: Target,\n  ): Promise<boolean> {\n    for (const clause of clauses) {\n      if (await this.evaluateClause(clause, target)) {\n        // If any clause returns true we return - rules being treated as OR rather than AND\n        return true;\n      }\n    }\n    // all clauses conditions failed so return false\n    return false;\n  }\n\n  private async evaluateClauses_v2(\n    clauses: Clause[],\n    target: Target,\n  ): Promise<boolean> {\n    if (!clauses.length) {\n      return false;\n    }\n\n    for (const clause of clauses) {\n      if (!(await this.evaluateClause(clause, target))) {\n        // first clause to false, short-circuit and exit with false\n        return false;\n      }\n    }\n    // all clauses have passed\n    return true;\n  }\n\n  private evaluateRule(rule: ServingRule, target: Target): Promise<boolean> {\n    return this.evaluateClauses(rule.clauses, target);\n  }\n\n  private async evaluateRules(\n    rules: ServingRule[],\n    target: Target,\n  ): Promise<string | undefined> {\n    if (!target || !rules) {\n      return undefined;\n    }\n\n    rules.sort((a: ServingRule, b: ServingRule) =>\n      a.priority > b.priority ? 1 : -1,\n    );\n\n    let identifier: string;\n    for (const rule of rules) {\n      // if evaluation is false just continue to next rule\n      if (!(await this.evaluateRule(rule, target))) {\n        continue;\n      }\n\n      // rule matched, check if there is distribution\n      if (rule.serve.distribution) {\n        identifier = this.evaluateDistribution(rule.serve.distribution, target);\n      }\n\n      // rule matched, here must be variation if distribution is undefined or null\n      if (rule.serve.variation) {\n        identifier = rule.serve.variation;\n      }\n\n      // evaluation succeded, find variation in flag\n      return identifier;\n    }\n    return undefined;\n  }\n\n  private async evaluateVariationMap(\n    variationToTargetMap: VariationMap[],\n    target: Target,\n  ): Promise<string | undefined> {\n    if (!target || !variationToTargetMap) {\n      return undefined;\n    }\n\n    for (const variationMap of variationToTargetMap) {\n      // find target\n      const targetMap = variationMap.targets?.find(\n        (elem) => elem.identifier === target.identifier,\n      );\n      if (targetMap) {\n        return variationMap.variation;\n      }\n\n      // find target in segment\n      const segmentIdentifiers = variationMap.targetSegments;\n      if (\n        segmentIdentifiers &&\n        (await this.isTargetIncludedOrExcludedInSegment(\n          segmentIdentifiers,\n          target,\n        ))\n      ) {\n        return variationMap.variation;\n      }\n    }\n\n    return undefined;\n  }\n\n  private async evaluateFlag(\n    fc: FeatureConfig,\n    target: Target,\n  ): Promise<Variation | undefined> {\n    let variation = fc.offVariation;\n    if (fc.state === FeatureState.On) {\n      variation =\n        (await this.evaluateVariationMap(fc.variationToTargetMap, target)) ||\n        (await this.evaluateRules(fc.rules, target)) ||\n        this.evaluateDistribution(fc.defaultServe.distribution, target) ||\n        fc.defaultServe.variation;\n    }\n    return this.findVariation(fc.variations, variation);\n  }\n\n  private async checkPreRequisite(\n    parent: FeatureConfig,\n    target: Target,\n  ): Promise<boolean> {\n    if (parent.prerequisites) {\n      this.log.debug(\n        'Checking pre requisites %s of parent feature %s',\n        parent.prerequisites,\n        parent.feature,\n      );\n\n      for (const pqs of parent.prerequisites) {\n        const preReqFeatureConfig = await this.query.getFlag(pqs.feature);\n        if (!preReqFeatureConfig) {\n          this.log.warn(\n            'Could not retrieve the pre requisite details of feature flag: %s',\n            parent.feature,\n          );\n          return true;\n        }\n\n        // Pre requisite variation value evaluated below\n        const variation = await this.evaluateFlag(preReqFeatureConfig, target);\n        this.log.info(\n          'Pre requisite flag %s has variation %s for target %s',\n          preReqFeatureConfig.feature,\n          variation,\n          target,\n        );\n\n        // Compare if the pre requisite variation is a possible valid value of\n        // the pre requisite FF\n        this.log.info(\n          'Pre requisite flag %s should have the variations %s',\n          preReqFeatureConfig.feature,\n          pqs.variations,\n        );\n\n        if (!pqs.variations.includes(variation.identifier)) {\n          return false;\n        } else {\n          if (!(await this.checkPreRequisite(preReqFeatureConfig, target))) {\n            return false;\n          }\n        }\n      }\n    }\n    return true;\n  }\n\n  private async evaluate(\n    identifier: string,\n    target: Target,\n    expected: FeatureConfigKindEnum,\n    callback?: Callback,\n  ): Promise<Variation | undefined> {\n    const fc = await this.query.getFlag(identifier);\n    if (!fc || fc.kind !== expected) {\n      return undefined;\n    }\n    if (fc.prerequisites) {\n      const prereq = await this.checkPreRequisite(fc, target);\n      if (!prereq) {\n        return this.findVariation(fc.variations, fc.offVariation);\n      }\n    }\n\n    const variation = await this.evaluateFlag(fc, target);\n    if (variation) {\n      if (callback) {\n        callback(fc, target, variation);\n      }\n      return variation;\n    }\n\n    return undefined;\n  }\n\n  async boolVariation(\n    identifier: string,\n    target: Target,\n    defaultValue = false,\n    callback?: Callback,\n  ): Promise<boolean> {\n    const variation = await this.evaluate(\n      identifier,\n      target,\n      FeatureConfigKindEnum.Boolean,\n      callback,\n    );\n    if (variation) {\n      const result = variation.value.toLowerCase() === 'true';\n      debugEvalSuccess(`${result}`, identifier, target, this.log);\n      return result;\n    }\n    warnDefaultVariationServed(\n      identifier,\n      target,\n      defaultValue.toString(),\n      this.log,\n    );\n    return defaultValue;\n  }\n\n  async stringVariation(\n    identifier: string,\n    target: Target,\n    defaultValue = '',\n    callback?: Callback,\n  ): Promise<string> {\n    const variation = await this.evaluate(\n      identifier,\n      target,\n      FeatureConfigKindEnum.String,\n      callback,\n    );\n    if (variation) {\n      debugEvalSuccess(`${variation.value}`, identifier, target, this.log);\n      return variation.value;\n    }\n    warnDefaultVariationServed(\n      identifier,\n      target,\n      defaultValue.toString(),\n      this.log,\n    );\n    return defaultValue;\n  }\n\n  async numberVariation(\n    identifier: string,\n    target: Target,\n    defaultValue = 0,\n    callback?: Callback,\n  ): Promise<number> {\n    const variation = await this.evaluate(\n      identifier,\n      target,\n      FeatureConfigKindEnum.Int,\n      callback,\n    );\n    if (variation) {\n      const result = parseFloat(variation.value);\n      debugEvalSuccess(`${result}`, identifier, target, this.log);\n      return result;\n    }\n    warnDefaultVariationServed(\n      identifier,\n      target,\n      defaultValue.toString(),\n      this.log,\n    );\n    return defaultValue;\n  }\n\n  async jsonVariation(\n    identifier: string,\n    target: Target,\n    defaultValue = {},\n    callback?: Callback,\n  ): Promise<Record<string, unknown>> {\n    const variation = await this.evaluate(\n      identifier,\n      target,\n      FeatureConfigKindEnum.Json,\n      callback,\n    );\n    if (variation) {\n      debugEvalSuccess(`${variation.value}`, identifier, target, this.log);\n      return JSON.parse(variation.value);\n    }\n    warnDefaultVariationServed(\n      identifier,\n      target,\n      defaultValue.toString(),\n      this.log,\n    );\n    return defaultValue;\n  }\n}\n", "import EventEmitter from 'events';\nimport { SEGMENT_MATCH_OPERATOR } from './constants';\nimport { FeatureConfig, Segment } from './openapi';\nimport { AsyncKeyValueStore, KeyValueStore, Query } from './types';\n\nexport interface Repository extends Query {\n  // put values\n  setFlag(identifier: string, fc: FeatureConfig): Promise<void>;\n  setSegment(identifier: string, segment: Segment): Promise<void>;\n\n  // remove values\n  deleteFlag(identifier: string): Promise<void>;\n  deleteSegment(identifier: string): Promise<void>;\n}\n\nexport enum RepositoryEvent {\n  FLAG_STORED = 'flag_stored',\n  FLAG_DELETED = 'flag_deleted',\n  SEGMENT_STORED = 'segment_stored',\n  SEGMENT_DELETED = 'segment_deleted',\n}\n\nexport class StorageRepository implements Repository {\n  private cache: KeyValueStore;\n  private store: AsyncKeyValueStore;\n  private eventBus: EventEmitter;\n\n  constructor(\n    cache: KeyValueStore,\n    store?: AsyncKeyValueStore,\n    eventBus?: EventEmitter,\n  ) {\n    if (!cache) {\n      throw new Error('Cache is required argument and cannot be undefined');\n    }\n    this.eventBus = eventBus;\n    this.cache = cache;\n    this.store = store;\n  }\n\n  async setFlag(identifier: string, fc: FeatureConfig): Promise<void> {\n    if (await this.isFlagOutdated(identifier, fc)) {\n      return;\n    }\n    const flagKey = this.formatFlagKey(identifier);\n    if (this.store) {\n      await this.store.set(flagKey, fc);\n      this.cache.delete(flagKey);\n    } else {\n      this.cache.set(flagKey, fc);\n    }\n    if (this.eventBus) {\n      this.eventBus.emit(RepositoryEvent.FLAG_STORED, identifier);\n    }\n  }\n\n  async setSegment(identifier: string, segment: Segment): Promise<void> {\n    if (await this.isSegmentOutdated(identifier, segment)) {\n      return;\n    }\n\n    // Sort the serving rules before storing the segment\n    this.sortSegmentServingRules(segment);\n\n    const segmentKey = this.formatSegmentKey(identifier);\n    if (this.store) {\n      await this.store.set(segmentKey, segment);\n      this.cache.delete(segmentKey);\n    } else {\n      this.cache.set(segmentKey, segment);\n    }\n    if (this.eventBus) {\n      this.eventBus.emit(RepositoryEvent.SEGMENT_STORED, identifier);\n    }\n  }\n\n  async deleteFlag(identifier: string): Promise<void> {\n    const flagKey = this.formatFlagKey(identifier);\n    if (this.store) {\n      await this.store.del(flagKey);\n    }\n    this.cache.delete(flagKey);\n    if (this.eventBus) {\n      this.eventBus.emit(RepositoryEvent.FLAG_DELETED, identifier);\n    }\n  }\n\n  async deleteSegment(identifier: string): Promise<void> {\n    const segmentKey = this.formatSegmentKey(identifier);\n    if (this.store) {\n      await this.store.del(segmentKey);\n    }\n    this.cache.delete(segmentKey);\n    if (this.eventBus) {\n      this.eventBus.emit(RepositoryEvent.SEGMENT_DELETED, identifier);\n    }\n  }\n\n  async getFlag(identifier: string, cacheable = true): Promise<FeatureConfig> {\n    const flagKey = this.formatFlagKey(identifier);\n    let flag = this.cache.get(flagKey) as FeatureConfig;\n    if (flag) {\n      return flag;\n    }\n    if (this.store) {\n      flag = await this.store.get<FeatureConfig>(flagKey);\n      if (flag && cacheable) {\n        this.cache.set(flagKey, flag);\n      }\n      return flag;\n    }\n    return undefined;\n  }\n\n  async getSegment(identifier: string, cacheable = true): Promise<Segment> {\n    const segmentKey = this.formatSegmentKey(identifier);\n    let segment = this.cache.get(segmentKey) as Segment;\n    if (segment) {\n      return segment;\n    }\n    if (this.store) {\n      segment = await this.store.get<Segment>(segmentKey);\n      if (segment && cacheable) {\n        this.cache.set(segmentKey, segment);\n      }\n      return segment;\n    }\n    return undefined;\n  }\n\n  async findFlagsBySegment(segment: string): Promise<string[]> {\n    const result = [];\n    let keys = this.cache.keys();\n    if (this.store) {\n      keys = await this.store.keys();\n    }\n    for (const key of keys) {\n      const flag = await this.getFlag(key);\n      if (!flag) {\n        return [];\n      }\n      for (const rule of flag?.rules) {\n        for (const clause of rule?.clauses) {\n          if (\n            clause.op === SEGMENT_MATCH_OPERATOR &&\n            clause.values.includes(segment)\n          ) {\n            result.push(flag.feature);\n          }\n        }\n      }\n    }\n    return result;\n  }\n\n  private async isFlagOutdated(\n    key: string,\n    flag: FeatureConfig,\n  ): Promise<boolean> {\n    const oldFlag = await this.getFlag(key, false); // dont set cacheable, we are just checking the version\n    return oldFlag?.version && oldFlag.version >= flag?.version;\n  }\n\n  private async isSegmentOutdated(\n    key: string,\n    segment: Segment,\n  ): Promise<boolean> {\n    const oldSegment = await this.getSegment(key, false); // dont set cacheable, we are just checking the version\n    return oldSegment?.version && oldSegment.version >= segment?.version;\n  }\n\n  private sortSegmentServingRules(segment: Segment): void {\n    if (segment.servingRules && segment.servingRules.length > 1) {\n      segment.servingRules.sort((r1, r2) => r1.priority - r2.priority);\n    }\n  }\n\n  private formatFlagKey(key: string): string {\n    return `flags/${key}`;\n  }\n\n  private formatSegmentKey(key: string): string {\n    return `segments/${key}`;\n  }\n}\n", "import * as events from 'events';\nimport {\n  FEATURE_IDENTIFIER_ATTRIBUTE,\n  FEATURE_NAME_ATTRIBUTE,\n  GLOBAL_TARGET,\n  SDK_LANGUAGE,\n  SDK_LANGUAGE_ATTRIBUTE,\n  SDK_TYPE,\n  SDK_TYPE_ATTRIBUTE,\n  SDK_VERSION_ATTRIBUTE,\n  TARGET_ATTRIBUTE,\n  VARIATION_IDENTIFIER_ATTRIBUTE,\n} from './constants';\nimport {\n  Configuration,\n  FeatureConfig,\n  KeyValue,\n  Metrics,\n  MetricsApi,\n  MetricsData,\n  MetricsDataMetricsTypeEnum,\n  TargetData,\n  Variation,\n} from './openapi';\nimport { Options, Target } from './types';\nimport { VERSION } from './version';\nimport {\n  warnEvaluationMetricsExceeded,\n  infoMetricsSuccess,\n  infoMetricsThreadExited,\n  warnTargetMetricsExceeded,\n  warnPostMetricsFailed,\n} from './sdk_codes';\nimport { Logger } from './log';\nimport { AxiosInstance } from 'axios';\n\nexport enum MetricEvent {\n  READY = 'metrics_ready',\n  ERROR = 'metrics_error',\n}\n\ninterface AnalyticsEvent {\n  target: Target;\n  featureConfig: FeatureConfig;\n  variation: Variation;\n  count: number;\n}\n\nexport interface MetricsProcessorInterface {\n  start(): void;\n  close(): void;\n  enqueue(\n    target: Target,\n    featureConfig: FeatureConfig,\n    variation: Variation,\n  ): void;\n}\n\nexport class MetricsProcessor implements MetricsProcessorInterface {\n  private evaluationAnalytics: Map<string, AnalyticsEvent> = new Map();\n  private targetAnalytics: Map<string, Target> = new Map();\n\n  // Only store and send targets that haven't been sent before in the life of the client instance\n  private seenTargets: Set<string> = new Set();\n\n  // Maximum sizes for caches\n  private MAX_EVALUATION_ANALYTICS_SIZE = 10000;\n  private MAX_TARGET_ANALYTICS_SIZE = 100000;\n  private evaluationAnalyticsExceeded = false;\n  private targetAnalyticsExceeded = false;\n\n  private syncInterval?: NodeJS.Timeout;\n  private api: MetricsApi;\n  private readonly log: Logger;\n\n  constructor(\n    private environment: string,\n    private cluster: string = '1',\n    private conf: Configuration,\n    private options: Options,\n    private eventBus: events.EventEmitter,\n    private closed: boolean = false,\n    private httpsClient: AxiosInstance,\n  ) {\n    const configuration = new Configuration({\n      ...this.conf,\n      basePath: options.eventsUrl,\n    });\n    if (httpsClient) {\n      this.api = new MetricsApi(configuration, options.eventsUrl, this.httpsClient);\n    } else {\n      this.api = new MetricsApi(configuration);\n    }\n\n    this.log = options.logger;\n  }\n\n  start(): void {\n    this.log.info(\n      'Starting MetricsProcessor with request interval: ',\n      this.options.eventsSyncInterval,\n    );\n    this.syncInterval = setInterval(\n      () => this._send(),\n      this.options.eventsSyncInterval,\n    );\n    this.eventBus.emit(MetricEvent.READY);\n  }\n\n  close(): void {\n    this.log.info('Closing MetricsProcessor');\n    if (this.syncInterval) {\n      clearInterval(this.syncInterval);\n    }\n    this._send();\n    this.closed = true;\n    this.log.info('MetricsProcessor closed');\n    infoMetricsThreadExited(this.log);\n  }\n\n  enqueue(\n    target: Target,\n    featureConfig: FeatureConfig,\n    variation: Variation,\n  ): void {\n    const event: AnalyticsEvent = {\n      target,\n      featureConfig,\n      variation,\n      count: 0,\n    };\n    this.storeEvaluationAnalytic(event);\n    this.storeTargetAnalytic(target);\n  }\n\n  private storeTargetAnalytic(target: Target): void {\n    if (this.targetAnalytics.size >= this.MAX_TARGET_ANALYTICS_SIZE) {\n      if (!this.targetAnalyticsExceeded) {\n        this.targetAnalyticsExceeded = true;\n        warnTargetMetricsExceeded(this.log);\n      }\n\n      return;\n    }\n\n    if (target && !target.anonymous) {\n      // If target has been seen then ignore it\n      if (this.seenTargets.has(target.identifier)) {\n        return;\n      }\n\n      this.seenTargets.add(target.identifier);\n      this.targetAnalytics.set(target.identifier, target);\n    }\n  }\n\n  private storeEvaluationAnalytic(event: AnalyticsEvent): void {\n    if (this.evaluationAnalytics.size >= this.MAX_EVALUATION_ANALYTICS_SIZE) {\n      if (!this.evaluationAnalyticsExceeded) {\n        this.evaluationAnalyticsExceeded = true;\n        warnEvaluationMetricsExceeded(this.log);\n      }\n\n      return;\n    }\n\n    const key = this._formatKey(event);\n    const found = this.evaluationAnalytics.get(key);\n    if (found) {\n      found.count++;\n    } else {\n      event.count = 1;\n      this.evaluationAnalytics.set(key, event);\n    }\n  }\n\n  private _formatKey(event: AnalyticsEvent): string {\n    const feature = event.featureConfig.feature;\n    const variation = event.variation.identifier;\n    const value = event.variation.value;\n    return `${feature}/${variation}/${value}/${GLOBAL_TARGET}`;\n  }\n\n  private _summarize(): Metrics | unknown {\n    const targetData: TargetData[] = [];\n    const metricsData: MetricsData[] = [];\n\n    // clone map and clear data\n    const clonedEvaluationAnalytics = new Map(this.evaluationAnalytics);\n    const clonedTargetAnalytics = new Map(this.targetAnalytics);\n    this.evaluationAnalytics.clear();\n    this.targetAnalytics.clear();\n    this.evaluationAnalyticsExceeded = false;\n    this.targetAnalyticsExceeded = false;\n\n    clonedEvaluationAnalytics.forEach((event) => {\n      const metricsAttributes: KeyValue[] = [\n        {\n          key: FEATURE_IDENTIFIER_ATTRIBUTE,\n          value: event.featureConfig.feature,\n        },\n        {\n          key: VARIATION_IDENTIFIER_ATTRIBUTE,\n          value: event.variation.identifier,\n        },\n        { key: FEATURE_NAME_ATTRIBUTE, value: event.featureConfig.feature },\n        { key: SDK_TYPE_ATTRIBUTE, value: SDK_TYPE },\n        { key: SDK_LANGUAGE_ATTRIBUTE, value: SDK_LANGUAGE },\n        { key: SDK_VERSION_ATTRIBUTE, value: VERSION },\n        { key: TARGET_ATTRIBUTE, value: event?.target?.identifier ?? null },\n      ];\n\n      const md: MetricsData = {\n        timestamp: Date.now(),\n        count: event.count,\n        metricsType: MetricsDataMetricsTypeEnum.Ffmetrics,\n        attributes: metricsAttributes,\n      };\n      metricsData.push(md);\n    });\n\n    clonedTargetAnalytics.forEach((target) => {\n      let targetAttributes: KeyValue[] = [];\n      if (target.attributes) {\n        targetAttributes = Object.entries(target.attributes).map(\n          ([key, value]) => {\n            return { key, value: this.valueToString(value) };\n          },\n        );\n      }\n\n      const targetName = target.name || target.identifier;\n\n      targetData.push({\n        identifier: target.identifier,\n        name: targetName,\n        attributes: targetAttributes,\n      });\n    });\n\n    return {\n      targetData: targetData,\n      metricsData: metricsData,\n    };\n  }\n\n  private async _send(): Promise<void> {\n    if (this.closed) {\n      this.log.debug('SDK has been closed before metrics can be sent');\n      return;\n    }\n\n    if (!this.evaluationAnalytics.size) {\n      this.log.debug('No metrics to send in this interval');\n      return;\n    }\n\n    const metrics: Metrics = this._summarize();\n\n    this.log.debug('Start sending metrics data');\n    try {\n      const response = await this.api.postMetrics(\n        this.environment,\n        this.cluster,\n        metrics,\n      );\n      this.log.debug('Metrics server returns: ', response.status);\n      infoMetricsSuccess(this.log);\n      if (response.status >= 400) {\n        this.log.error(\n          'Error while sending metrics data with status code: ',\n          response.status,\n        );\n      }\n    } catch (error) {\n      warnPostMetricsFailed(`${error}`, this.log);\n      this.log.debug('Metrics server returns error: ', error);\n    }\n  }\n\n  private valueToString(value: any): string {\n    return typeof value === 'object' && !Array.isArray(value)\n      ? JSON.stringify(value)\n      : String(value);\n  }\n}\n", "import Client, { Event } from './client';\nimport * as LRU from 'lru-cache';\nimport { Options, Target } from './types';\nimport { Logger } from './log';\nimport { AsyncKeyValueStore, KeyValueStore } from './types';\nimport { FileStore } from './store';\n\nexport {\n  Client,\n  Event,\n  Options,\n  Target,\n  AsyncKeyValueStore,\n  KeyValueStore,\n  Logger,\n  LRU,\n  FileStore,\n};\nexport default {\n  instance: undefined,\n  init: function (sdkKey: string, options: Options): void {\n    if (!this.instance) {\n      this.instance = new Client(sdkKey, options);\n    }\n  },\n  waitForInitialization: function (): Promise<Client> {\n    return this.instance.waitForInitialization();\n  },\n  boolVariation: function (\n    identifier: string,\n    target?: Target,\n    defaultValue = false,\n  ): Promise<boolean> {\n    return this.instance.boolVariation(identifier, target, defaultValue);\n  },\n  stringVariation: function (\n    identifier: string,\n    target?: Target,\n    defaultValue = '',\n  ): Promise<string> {\n    return this.instance.stringVariation(identifier, target, defaultValue);\n  },\n  numberVariation: function (\n    identifier: string,\n    target?: Target,\n    defaultValue = 0,\n  ): Promise<number> {\n    return this.instance.numberVariation(identifier, target, defaultValue);\n  },\n  jsonVariation: function (\n    identifier: string,\n    target?: Target,\n    defaultValue = '',\n  ): Promise<Record<string, unknown>> {\n    return this.instance.jsonVariation(identifier, target, defaultValue);\n  },\n  on: function (event: Event, callback: (...args: unknown[]) => void): void {\n    this.instance.on(event, callback);\n  },\n  off: function (event?: Event, callback?: () => void): void {\n    this.instance.off(event, callback);\n  },\n  close: function (): void {\n    return this.instance.close();\n  },\n};\n"],
  "mappings": "AAAA,OAAOA,OAAkB,SACzB,OAAOC,OAAgB,aACvB,OAAOC,OAAkD,QACzD,OAAOC,OAAgB,cCavB,OAAOC,MAAkD,QCEzD,OAAOC,OAAkD,QAElD,IAAMC,EAAY,2BAA2B,QAAQ,OAAQ,EAAE,EA4B/D,IAAMC,EAAN,KAAc,CAGjB,YAAYC,EAAyCC,EAAmBC,EAAqBC,EAAuBC,GAAa,CAA5E,cAAAH,EAAwC,WAAAE,EACrFH,IACA,KAAK,cAAgBA,EACrB,KAAK,SAAWA,EAAc,UAAY,KAAK,SAEvD,CACJ,EAQaK,EAAN,cAA4B,KAAM,CAErC,YAAmBC,EAAeC,EAAc,CAC5C,MAAMA,CAAG,EADM,WAAAD,EADnB,UAAwB,eAGxB,CACJ,EC/CO,IAAME,EAAiB,sBAOjBC,EAAoB,SAAUC,EAAsBC,EAAmBC,EAAqB,CACrG,GAAIA,GAAe,KACf,MAAM,IAAIC,EAAcF,EAAW,sBAAsBA,CAAS,uCAAuCD,CAAY,GAAG,CAEhI,EAMaI,EAAoB,eAAgBC,EAAaC,EAAsBC,EAA+B,CAC/G,GAAIA,GAAiBA,EAAc,OAAQ,CACvC,IAAMC,EAAsB,OAAOD,EAAc,QAAW,WACtD,MAAMA,EAAc,OAAOD,CAAY,EACvC,MAAMC,EAAc,OAC1BF,EAAOC,CAAY,EAAIE,CAC3B,CACJ,EAgBO,IAAMC,EAAwB,eAAgBC,EAAaC,EAA+B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cF,EAAYC,EAAQC,CAAY,CACrE,EACA,GAAI,SAAUC,EAAcC,EAA8C,CACxE,KAAK,SAAS,GAAGD,EAAOC,CAAQ,CAClC,EACA,IAAK,SAAUD,EAAeC,EAA6B,CACzD,KAAK,SAAS,IAAID,EAAOC,CAAQ,CACnC,EACA,MAAO,UAAkB,CACvB,OAAO,KAAK,SAAS,MAAM,CAC7B,CACF",
  "names": ["EventEmitter", "jwt_decode", "axios", "axiosRetry", "globalAxios", "globalAxios", "BASE_PATH", "BaseAPI", "configuration", "basePath", "BASE_PATH", "axios", "globalAxios", "RequiredError", "field", "msg", "DUMMY_BASE_URL", "assertParamExists", "functionName", "paramName", "paramValue", "RequiredError", "setApiKeyToObject", "object", "keyParamName", "configuration", "localVarApiKeyValue", "setBearerAuthToObject", "object", "configuration", "accessToken", "setSearchParams", "url", "objects", "searchParams", "object", "key", "item", "serializeDataIfNeeded", "value", "requestOptions", "configuration", "nonString", "toPathString", "createRequestFunction", "axiosArgs", "globalAxios", "BASE_PATH", "axios", "basePath", "axiosRequestArgs", "ClientApiAxiosParamCreator", "configuration", "authenticationRequest", "options", "localVarPath", "localVarUrlObj", "DUMMY_BASE_URL", "baseOptions", "localVarRequestOptions", "localVarHeaderParameter", "localVarQueryParameter", "setSearchParams", "headersFromBaseOptions", "serializeDataIfNeeded", "toPathString", "environmentUUID", "cluster", "rules", "assertParamExists", "setBearerAuthToObject", "feature", "target", "identifier", "aPIKey", "ClientApiFp", "localVarAxiosParamCreator", "localVarAxiosArgs", "createRequestFunction", "globalAxios", "BASE_PATH", "ClientApi", "BaseAPI", "authenticationRequest", "options", "ClientApiFp", "request", "environmentUUID", "cluster", "rules", "feature", "target", "identifier", "aPIKey", "MetricsApiAxiosParamCreator", "configuration", "metrics", "assertParamExists", "localVarPath", "localVarUrlObj", "DUMMY_BASE_URL", "baseOptions", "localVarRequestOptions", "localVarHeaderParameter", "localVarQueryParameter", "setApiKeyToObject", "setBearerAuthToObject", "setSearchParams", "headersFromBaseOptions", "serializeDataIfNeeded", "toPathString", "MetricsApiFp", "localVarAxiosParamCreator", "localVarAxiosArgs", "createRequestFunction", "globalAxios", "BASE_PATH", "MetricsApi", "BaseAPI", "environmentUUID", "cluster", "metrics", "options", "MetricsApiFp", "request", "Configuration", "param", "mime", "jsonMime", "VERSION", "sdkCodes", "VERSION", "getSDKCodeMessage", "key", "getSdkErrMsg", "errorCode", "appendText", "warnMissingSDKKey", "logger", "infoPollStarted", "durationMS", "infoSDKInitOK", "infoSDKStartClose", "infoSDKCloseSuccess", "infoPollingStopped", "logger", "getSdkErrMsg", "infoStreamConnected", "debugStreamEventReceived", "infoStreamStopped", "infoMetricsThreadStarted", "interval", "infoMetricsSuccess", "infoMetricsThreadExited", "warnTargetMetricsExceeded", "warnEvaluationMetricsExceeded", "debugEvalSuccess", "result", "flagIdentifier", "target", "warnAuthFailedSrvDefaults", "warnFailedInitAuthError", "disconnectAttempts", "lastConnectionSuccess", "restartDisconnectCounter", "resetDisconnectCounter", "warnStreamDisconnectedWithRetry", "reason", "ms", "logger", "combinedMessage", "getSdkErrMsg", "timeSince", "timeSinceConnection", "nextWarnAt", "warnPostMetricsFailed", "warnDefaultVariationServed", "flag", "target", "defaultValue", "warnBucketByAttributeNotFound", "bucketBy", "usingValue", "PollingProcessor", "environment", "cluster", "api", "apiConfiguration", "options", "eventBus", "repository", "infoPollingStopped", "startTime", "pollAgain", "elapsed", "sleepFor", "error", "_a", "response", "fc", "segment", "https", "http", "_StreamProcessor", "api", "apiKey", "apiConfiguration", "environment", "jwtToken", "options", "cluster", "eventBus", "repository", "headers", "httpsCa", "minDelay", "maxDelay", "url", "onConnected", "restartDisconnectCounter", "onFailed", "msg", "delayMs", "warnStreamDisconnectedWithRetry", "isSecure", "https", "http", "res", "data", "err", "lines", "line", "debugStreamEventReceived", "_", "e", "fn", "setFn", "delFn", "error", "resetDisconnectCounter", "infoStreamStopped", "StreamProcessor", "LRU", "ConsoleLog", "message", "optionalParams", "Keyv", "KeyvFile", "FileStore", "options", "key", "value", "keys", "ONE_HUNDRED", "FEATURE_IDENTIFIER_ATTRIBUTE", "FEATURE_NAME_ATTRIBUTE", "VARIATION_IDENTIFIER_ATTRIBUTE", "TARGET_ATTRIBUTE", "SDK_VERSION_ATTRIBUTE", "SDK_TYPE_ATTRIBUTE", "SDK_TYPE", "SDK_LANGUAGE_ATTRIBUTE", "SDK_LANGUAGE", "GLOBAL_TARGET", "SEGMENT_MATCH_OPERATOR", "IN_OPERATOR", "EQUAL_OPERATOR", "GT_OPERATOR", "STARTS_WITH_OPERATOR", "ENDS_WITH_OPERATOR", "CONTAINS_OPERATOR", "EQUAL_SENSITIVE_OPERATOR", "BASE_URL", "EVENTS_URL", "SECOND", "MINUTE", "PULL_INTERVAL", "EVENTS_SYNC_INTERVAL", "defaultOptions", "LRU", "FileStore", "ConsoleLog", "TARGET_SEGMENT_RULES_QUERY_PARAMETER", "apiConfiguration", "murmurhash", "Evaluator", "query", "logger", "target", "attribute", "_a", "variations", "identifier", "value", "bucketBy", "property", "normalizer", "murmurhash", "ONE_HUNDRED", "percentage", "bb", "warnBucketByAttributeNotFound", "bucketId", "distribution", "variation", "totalPercentage", "v", "segments", "_b", "_c", "segmentIdentifier", "segment", "servingRule", "clause", "attrValue", "targetAttribute", "SEGMENT_MATCH_OPERATOR", "IN_OPERATOR", "val", "EQUAL_OPERATOR", "EQUAL_SENSITIVE_OPERATOR", "GT_OPERATOR", "STARTS_WITH_OPERATOR", "ENDS_WITH_OPERATOR", "CONTAINS_OPERATOR", "clauses", "rule", "rules", "a", "b", "variationToTargetMap", "variationMap", "elem", "segmentIdentifiers", "fc", "parent", "pqs", "preReqFeatureConfig", "expected", "callback", "defaultValue", "result", "debugEvalSuccess", "warnDefaultVariationServed", "RepositoryEvent", "StorageRepository", "cache", "store", "eventBus", "identifier", "fc", "flagKey", "segment", "segmentKey", "cacheable", "flag", "result", "keys", "key", "rule", "clause", "SEGMENT_MATCH_OPERATOR", "oldFlag", "oldSegment", "r1", "r2", "MetricsProcessor", "environment", "cluster", "conf", "options", "eventBus", "closed", "httpsClient", "configuration", "Configuration", "MetricsApi", "infoMetricsThreadExited", "target", "featureConfig", "variation", "event", "warnTargetMetricsExceeded", "warnEvaluationMetricsExceeded", "key", "found", "feature", "value", "GLOBAL_TARGET", "targetData", "metricsData", "clonedEvaluationAnalytics", "clonedTargetAnalytics", "_a", "_b", "metricsAttributes", "FEATURE_IDENTIFIER_ATTRIBUTE", "VARIATION_IDENTIFIER_ATTRIBUTE", "FEATURE_NAME_ATTRIBUTE", "SDK_TYPE_ATTRIBUTE", "SDK_TYPE", "SDK_LANGUAGE_ATTRIBUTE", "SDK_LANGUAGE", "SDK_VERSION_ATTRIBUTE", "VERSION", "TARGET_ATTRIBUTE", "md", "targetAttributes", "targetName", "metrics", "response", "infoMetricsSuccess", "error", "warnPostMetricsFailed", "https", "fs", "Event", "SDK_INFO", "VERSION", "Client", "sdkKey", "options", "apiConfiguration", "EventEmitter", "defaultOptions", "Configuration", "StorageRepository", "Evaluator", "ClientApi", "error", "_a", "streamingErrorLogged", "event", "RepositoryEvent", "identifier", "values", "value", "callback", "arrayObjects", "warnMissingSDKKey", "response", "decoded", "jwt_decode", "warnAuthFailedSrvDefaults", "warnFailedInitAuthError", "resolve", "reject", "_b", "_c", "status", "url", "metricsUuidPattern", "httpsCa", "axiosConfig", "https", "instance", "axios", "axiosRetry", "retryCount", "requestConfig", "method", "retryMessage", "processor", "infoPollStarted", "infoStreamConnected", "infoMetricsThreadStarted", "infoSDKInitOK", "PollingProcessor", "StreamProcessor", "MetricsProcessor", "target", "defaultValue", "fc", "variation", "warnDefaultVariationServed", "identifierString", "infoSDKStartClose", "infoSDKCloseSuccess", "LRU", "index_default", "sdkKey", "options", "Client", "identifier", "target", "defaultValue", "event", "callback"]
}
