@algolia/abtesting 1.23.0 → 1.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/browser.d.ts +292 -18
- package/dist/builds/browser.js +190 -7
- package/dist/builds/browser.js.map +1 -1
- package/dist/builds/browser.min.js +5 -5
- package/dist/builds/browser.min.js.map +1 -1
- package/dist/builds/browser.umd.js +7 -7
- package/dist/builds/fetch.js +190 -7
- package/dist/builds/fetch.js.map +1 -1
- package/dist/builds/node.cjs +190 -7
- package/dist/builds/node.cjs.map +1 -1
- package/dist/builds/node.js +190 -7
- package/dist/builds/node.js.map +1 -1
- package/dist/builds/worker.js +190 -7
- package/dist/builds/worker.js.map +1 -1
- package/dist/fetch.d.ts +292 -18
- package/dist/node.d.cts +292 -18
- package/dist/node.d.ts +292 -18
- package/dist/src/abtestingV3Client.cjs +190 -7
- package/dist/src/abtestingV3Client.cjs.map +1 -1
- package/dist/src/abtestingV3Client.js +190 -7
- package/dist/src/abtestingV3Client.js.map +1 -1
- package/dist/worker.d.ts +292 -18
- package/package.json +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../client-common/src/cache/createBrowserLocalStorageCache.ts","../../../client-common/src/cache/createNullCache.ts","../../../client-common/src/cache/createFallbackableCache.ts","../../../client-common/src/cache/createMemoryCache.ts","../../../client-common/src/constants.ts","../../../client-common/src/createAlgoliaAgent.ts","../../../client-common/src/createAuth.ts","../../../client-common/src/createIterablePromise.ts","../../../client-common/src/getAlgoliaAgent.ts","../../../client-common/src/logger/createNullLogger.ts","../../../client-common/src/logger/logWarning.ts","../../../client-common/src/sse.ts","../../../client-common/src/transporter/compress.ts","../../../client-common/src/transporter/createStatefulHost.ts","../../../client-common/src/transporter/errors.ts","../../../client-common/src/transporter/helpers.ts","../../../client-common/src/transporter/requestId.ts","../../../client-common/src/transporter/responses.ts","../../../client-common/src/transporter/stackTrace.ts","../../../client-common/src/transporter/createTransporter.ts","../../../client-common/src/types/logger.ts","../../../client-common/src/validateParam.ts","../../../requester-browser-xhr/src/createXhrRequester.ts","../../src/abtestingV3Client.ts","../../builds/browser.ts"],"sourcesContent":["import type { BrowserLocalStorageCacheItem, BrowserLocalStorageOptions, Cache, CacheEvents } from '../types';\n\nexport function createBrowserLocalStorageCache(options: BrowserLocalStorageOptions): Cache {\n let storage: Storage;\n // We've changed the namespace to avoid conflicts with v4, as this version is a huge breaking change\n const namespaceKey = `algolia-client-js-${options.key}`;\n\n function getStorage(): Storage {\n if (storage === undefined) {\n storage = options.localStorage || window.localStorage;\n }\n\n return storage;\n }\n\n function getNamespace<TValue>(): Record<string, TValue> {\n return JSON.parse(getStorage().getItem(namespaceKey) || '{}');\n }\n\n function setNamespace(namespace: Record<string, any>): void {\n getStorage().setItem(namespaceKey, JSON.stringify(namespace));\n }\n\n function yieldToMain(): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, 0));\n }\n\n function getFilteredNamespace(): {\n namespace: Record<string, BrowserLocalStorageCacheItem>;\n changed: boolean;\n } {\n const timeToLive = options.timeToLive ? options.timeToLive * 1000 : null;\n const namespace = getNamespace<BrowserLocalStorageCacheItem>();\n const currentTime = new Date().getTime();\n let changed = false;\n\n const filtered = Object.fromEntries(\n Object.entries(namespace).filter(([, cacheItem]) => {\n if (!cacheItem || cacheItem.timestamp === undefined) {\n changed = true;\n return false;\n }\n\n if (!timeToLive) {\n return true;\n }\n\n if (cacheItem.timestamp + timeToLive < currentTime) {\n changed = true;\n return false;\n }\n\n return true;\n }),\n );\n\n return { namespace: filtered, changed };\n }\n\n return {\n get<TValue>(\n key: Record<string, any> | string,\n defaultValue: () => Promise<TValue>,\n events: CacheEvents<TValue> = {\n miss: () => Promise.resolve(),\n },\n ): Promise<TValue> {\n return yieldToMain().then(() => {\n const { namespace, changed } = getFilteredNamespace();\n const cachedItem = namespace[JSON.stringify(key)];\n\n if (changed) {\n setNamespace(namespace);\n }\n\n if (cachedItem) {\n return cachedItem.value as TValue;\n }\n\n return defaultValue().then((value) => events.miss(value).then(() => value));\n });\n },\n\n set<TValue>(key: Record<string, any> | string, value: TValue): Promise<TValue> {\n return yieldToMain().then(() => {\n const namespace = getNamespace();\n\n namespace[JSON.stringify(key)] = {\n timestamp: new Date().getTime(),\n value,\n };\n\n getStorage().setItem(namespaceKey, JSON.stringify(namespace));\n\n return value;\n });\n },\n\n delete(key: Record<string, any> | string): Promise<void> {\n return yieldToMain().then(() => {\n const namespace = getNamespace();\n\n delete namespace[JSON.stringify(key)];\n\n getStorage().setItem(namespaceKey, JSON.stringify(namespace));\n });\n },\n\n clear(): Promise<void> {\n return Promise.resolve().then(() => {\n getStorage().removeItem(namespaceKey);\n });\n },\n };\n}\n","import type { Cache, CacheEvents } from '../types';\n\nexport function createNullCache(): Cache {\n return {\n get<TValue>(\n _key: Record<string, any> | string,\n defaultValue: () => Promise<TValue>,\n events: CacheEvents<TValue> = {\n miss: (): Promise<void> => Promise.resolve(),\n },\n ): Promise<TValue> {\n const value = defaultValue();\n\n return value.then((result) => Promise.all([result, events.miss(result)])).then(([result]) => result);\n },\n\n set<TValue>(_key: Record<string, any> | string, value: TValue): Promise<TValue> {\n return Promise.resolve(value);\n },\n\n delete(_key: Record<string, any> | string): Promise<void> {\n return Promise.resolve();\n },\n\n clear(): Promise<void> {\n return Promise.resolve();\n },\n };\n}\n","import type { Cache, CacheEvents, FallbackableCacheOptions } from '../types';\nimport { createNullCache } from './createNullCache';\n\nexport function createFallbackableCache(options: FallbackableCacheOptions): Cache {\n const caches = [...options.caches];\n const current = caches.shift();\n\n if (current === undefined) {\n return createNullCache();\n }\n\n return {\n get<TValue>(\n key: Record<string, any> | string,\n defaultValue: () => Promise<TValue>,\n events: CacheEvents<TValue> = {\n miss: (): Promise<void> => Promise.resolve(),\n },\n ): Promise<TValue> {\n return current.get(key, defaultValue, events).catch(() => {\n return createFallbackableCache({ caches }).get(key, defaultValue, events);\n });\n },\n\n set<TValue>(key: Record<string, any> | string, value: TValue): Promise<TValue> {\n return current.set(key, value).catch(() => {\n return createFallbackableCache({ caches }).set(key, value);\n });\n },\n\n delete(key: Record<string, any> | string): Promise<void> {\n return current.delete(key).catch(() => {\n return createFallbackableCache({ caches }).delete(key);\n });\n },\n\n clear(): Promise<void> {\n return current.clear().catch(() => {\n return createFallbackableCache({ caches }).clear();\n });\n },\n };\n}\n","import type { Cache, CacheEvents, MemoryCacheOptions } from '../types';\n\nexport function createMemoryCache(options: MemoryCacheOptions = { serializable: true }): Cache {\n let cache: Record<string, any> = {};\n\n return {\n get<TValue>(\n key: Record<string, any> | string,\n defaultValue: () => Promise<TValue>,\n events: CacheEvents<TValue> = {\n miss: (): Promise<void> => Promise.resolve(),\n },\n ): Promise<TValue> {\n const keyAsString = JSON.stringify(key);\n\n if (keyAsString in cache) {\n return Promise.resolve(options.serializable ? JSON.parse(cache[keyAsString]) : cache[keyAsString]);\n }\n\n const promise = defaultValue();\n\n return promise.then((value: TValue) => events.miss(value)).then(() => promise);\n },\n\n set<TValue>(key: Record<string, any> | string, value: TValue): Promise<TValue> {\n cache[JSON.stringify(key)] = options.serializable ? JSON.stringify(value) : value;\n\n return Promise.resolve(value);\n },\n\n delete(key: Record<string, unknown> | string): Promise<void> {\n delete cache[JSON.stringify(key)];\n\n return Promise.resolve();\n },\n\n clear(): Promise<void> {\n cache = {};\n\n return Promise.resolve();\n },\n };\n}\n","export const DEFAULT_CONNECT_TIMEOUT_BROWSER = 1000;\nexport const DEFAULT_READ_TIMEOUT_BROWSER = 2000;\nexport const DEFAULT_WRITE_TIMEOUT_BROWSER = 30000;\n\nexport const DEFAULT_CONNECT_TIMEOUT_NODE = 2000;\nexport const DEFAULT_READ_TIMEOUT_NODE = 5000;\nexport const DEFAULT_WRITE_TIMEOUT_NODE = 30000;\n\nexport const DEFAULT_REPLACE_ALL_OBJECTS_MAX_RETRIES = 800;\n","import type { AlgoliaAgent, AlgoliaAgentOptions } from './types';\n\nexport function createAlgoliaAgent(version: string): AlgoliaAgent {\n const algoliaAgent = {\n value: `Algolia for JavaScript (${version})`,\n add(options: AlgoliaAgentOptions): AlgoliaAgent {\n const addedAlgoliaAgent = `; ${options.segment}${options.version !== undefined ? ` (${options.version})` : ''}`;\n\n if (algoliaAgent.value.indexOf(addedAlgoliaAgent) === -1) {\n algoliaAgent.value = `${algoliaAgent.value}${addedAlgoliaAgent}`;\n }\n\n return algoliaAgent;\n },\n };\n\n return algoliaAgent;\n}\n","import type { AuthMode, Headers, QueryParameters } from './types';\n\nexport function createAuth(\n appId: string,\n apiKey: string,\n authMode: AuthMode = 'WithinHeaders',\n): {\n readonly headers: () => Headers;\n readonly queryParameters: () => QueryParameters;\n} {\n const credentials = {\n 'x-algolia-api-key': apiKey,\n 'x-algolia-application-id': appId,\n };\n\n return {\n headers(): Headers {\n return authMode === 'WithinHeaders' ? credentials : {};\n },\n\n queryParameters(): QueryParameters {\n return authMode === 'WithinQueryParameters' ? credentials : {};\n },\n };\n}\n","import type { CreateIterablePromise } from './types/createIterablePromise';\n\n/**\n * Helper: Returns the promise of a given `func` to iterate on, based on a given `validate` condition.\n *\n * @param createIterator - The createIterator options.\n * @param createIterator.func - The function to run, which returns a promise.\n * @param createIterator.validate - The validator function. It receives the resolved return of `func`.\n * @param createIterator.aggregator - The function that runs right after the `func` method has been executed, allows you to do anything with the response before `validate`.\n * @param createIterator.error - The `validate` condition to throw an error, and its message.\n * @param createIterator.timeout - The function to decide how long to wait between iterations.\n */\nexport function createIterablePromise<TResponse>({\n func,\n validate,\n aggregator,\n error,\n timeout = (): number => 0,\n}: CreateIterablePromise<TResponse>): Promise<TResponse> {\n const retry = (previousResponse?: TResponse | undefined): Promise<TResponse> => {\n return new Promise<TResponse>((resolve, reject) => {\n func(previousResponse)\n .then(async (response) => {\n if (aggregator) {\n await aggregator(response);\n }\n\n if (await validate(response)) {\n return resolve(response);\n }\n\n if (error && (await error.validate(response))) {\n return reject(new Error(await error.message(response)));\n }\n\n return setTimeout(\n () => {\n retry(response).then(resolve).catch(reject);\n },\n await timeout(),\n );\n })\n .catch((err) => {\n reject(err);\n });\n });\n };\n\n return retry();\n}\n","import { createAlgoliaAgent } from './createAlgoliaAgent';\nimport type { AlgoliaAgent, AlgoliaAgentOptions } from './types';\n\nexport type GetAlgoliaAgent = {\n algoliaAgents: AlgoliaAgentOptions[];\n client: string;\n version: string;\n};\n\nexport function getAlgoliaAgent({ algoliaAgents, client, version }: GetAlgoliaAgent): AlgoliaAgent {\n const defaultAlgoliaAgent = createAlgoliaAgent(version).add({\n segment: client,\n version,\n });\n\n algoliaAgents.forEach((algoliaAgent) => defaultAlgoliaAgent.add(algoliaAgent));\n\n return defaultAlgoliaAgent;\n}\n","import type { Logger } from '../types/logger';\n\nexport function createNullLogger(): Logger {\n return {\n debug(_message: string, _args?: any | undefined): Promise<void> {\n return Promise.resolve();\n },\n info(_message: string, _args?: any | undefined): Promise<void> {\n return Promise.resolve();\n },\n error(_message: string, _args?: any | undefined): Promise<void> {\n return Promise.resolve();\n },\n };\n}\n","import type { Logger } from '../types';\n\n/**\n * Prefers the logger's optional `warn` method and falls back to `console.warn`, so warnings stay visible with the default no-op logger.\n */\nexport function logWarning(logger: Logger, message: string): void {\n if (logger.warn) {\n // a rejecting custom `warn` must not become a fatal unhandled rejection\n void Promise.resolve(logger.warn(message)).catch(() => {});\n } else {\n console.warn(message);\n }\n}\n","/**\n * WHATWG-compliant Server-Sent Events parser.\n *\n * Three-layer architecture:\n * 1. iterLines() — byte chunking → line decoding\n * 2. SSEDecoder — line → SSE event decoding\n * 3. iterSSEEvents — top-level composer (exported)\n *\n * @see https://html.spec.whatwg.org/multipage/server-sent-events.html#event-stream-interpretation\n */\n\nconst MAX_LINE_BUFFER_SIZE = 10 * 1024 * 1024; // 10MB\n\n// ─── Types ──────────────────────────────────────────────────────────────────\n\nexport type ServerSentEvent = {\n /** Concatenated data: field values, joined by '\\n'. */\n data: string;\n /** Event type from the event: field. Defaults to \"\" (empty string). */\n event: string;\n /** Last event ID. Persists across dispatches until changed. */\n id: string | null;\n /** Reconnection time in ms. Persists across dispatches until changed. */\n retry: number | null;\n};\n\n/**\n * Wrapper for a parsed SSE event, yielded by the typed `*Stream` methods.\n *\n * - `data` is the JSON-parsed payload when parsing succeeds, `null` otherwise.\n * - `raw` is the original {@link ServerSentEvent} (always present).\n * - `error` is set when JSON parsing of `event.data` failed.\n */\nexport type StreamEvent<T = Record<string, unknown>> = {\n /** Parsed data from the event, or `null` if parsing failed. */\n data: T | null;\n /** The original, unparsed SSE event. */\n raw: ServerSentEvent;\n /** The error that occurred while parsing `event.data`, if any. */\n error?: Error;\n};\n\n// ─── Helpers ────────────────────────────────────────────────────────────────\n\n/**\n * Converts a ReadableStream into an AsyncIterable via getReader().\n * Fallback for environments where ReadableStream lacks Symbol.asyncIterator.\n */\nasync function* readableStreamToAsyncIterable(stream: ReadableStream<Uint8Array>): AsyncGenerator<Uint8Array> {\n const reader = stream.getReader();\n try {\n while (true) {\n const { done, value } = await reader.read();\n if (done) return;\n yield value;\n }\n } finally {\n reader.releaseLock();\n }\n}\n\n/**\n * Normalizes the input to an AsyncIterable<Uint8Array>.\n * Prefers Symbol.asyncIterator if available; falls back to getReader().\n */\nfunction toAsyncIterable(stream: ReadableStream<Uint8Array> | AsyncIterable<Uint8Array>): AsyncIterable<Uint8Array> {\n if (Symbol.asyncIterator in stream) {\n return stream as AsyncIterable<Uint8Array>;\n }\n return readableStreamToAsyncIterable(stream as ReadableStream<Uint8Array>);\n}\n\n// ─── Layer 1: Byte stream → Lines ──────────────────────────────────────────\n\n/**\n * Yields individual lines from a byte stream.\n *\n * Handles \\r, \\n, and \\r\\n line endings, including \\r\\n split across chunks.\n * Uses offset tracking within each decoded chunk to avoid O(n²) buffer growth.\n * Strips BOM (U+FEFF) from the very first line.\n * Throws if the internal line buffer exceeds 10MB.\n */\nasync function* iterLines(stream: ReadableStream<Uint8Array> | AsyncIterable<Uint8Array>): AsyncGenerator<string> {\n const decoder = new TextDecoder('utf-8');\n const buffer: string[] = [];\n let bufferSize = 0;\n let trailingCR = false;\n let isFirstLine = true;\n\n for await (const chunk of toAsyncIterable(stream)) {\n const text = decoder.decode(chunk, { stream: true });\n let offset = 0;\n\n // Handle \\r\\n split across chunks: if the previous chunk ended with \\r\n // and this one starts with \\n, skip the \\n (it's the second half of \\r\\n)\n if (trailingCR) {\n trailingCR = false;\n if (text.length > 0 && text[0] === '\\n') {\n offset = 1;\n }\n }\n\n while (offset < text.length) {\n const crIdx = text.indexOf('\\r', offset);\n const lfIdx = text.indexOf('\\n', offset);\n\n // No more line endings in this chunk — buffer the rest\n if (crIdx === -1 && lfIdx === -1) {\n const remaining = text.slice(offset);\n buffer.push(remaining);\n bufferSize += remaining.length;\n if (bufferSize > MAX_LINE_BUFFER_SIZE) {\n throw new Error('SSE line buffer exceeded 10MB');\n }\n break;\n }\n\n let endIdx: number;\n let skipLen: number;\n\n if (crIdx !== -1 && (lfIdx === -1 || crIdx < lfIdx)) {\n // \\r found before \\n (or no \\n at all)\n endIdx = crIdx;\n if (crIdx + 1 < text.length) {\n // Peek ahead: \\r\\n or bare \\r\n skipLen = text[crIdx + 1] === '\\n' ? 2 : 1;\n } else {\n // \\r at end of chunk — might be \\r\\n split across chunks\n trailingCR = true;\n skipLen = 1;\n }\n } else {\n // \\n found before \\r (or no \\r at all)\n // Safe: at least one of crIdx/lfIdx is != -1, and we're in the else\n // branch, so lfIdx must be != -1\n endIdx = lfIdx;\n skipLen = 1;\n }\n\n const segment = text.slice(offset, endIdx);\n buffer.push(segment);\n\n let line = buffer.length === 1 ? buffer[0]! : buffer.join('');\n buffer.length = 0;\n bufferSize = 0;\n\n // Strip BOM from the very first line only\n if (isFirstLine) {\n if (line.startsWith('\\uFEFF')) {\n line = line.slice(1);\n }\n isFirstLine = false;\n }\n\n yield line;\n offset = endIdx + skipLen;\n }\n }\n\n // Flush TextDecoder (handles any remaining bytes from multi-byte sequences)\n const remaining = decoder.decode();\n if (remaining) {\n buffer.push(remaining);\n }\n\n // Yield any remaining buffered content as the final line\n if (buffer.length > 0) {\n let line = buffer.join('');\n if (isFirstLine && line.startsWith('\\uFEFF')) {\n line = line.slice(1);\n }\n yield line;\n }\n}\n\n// ─── Layer 2: Lines → SSE Events ──────────────────────────────────────────\n\n/**\n * Stateful SSE event decoder. Feed lines one at a time via decode().\n * Returns a ServerSentEvent on blank lines (dispatch), null otherwise.\n *\n * Per WHATWG spec §9.2.6:\n * - lastEventId persists across dispatches\n * - retry persists across dispatches (global reconnection setting)\n * - eventType resets after every blank line (even when data is empty)\n * - data buffer resets after dispatch\n * - id field containing NULL (\\0) is ignored entirely\n * - retry field must be ASCII digits only\n */\nclass SSEDecoder {\n private data: string[] = [];\n private eventType = '';\n private lastEventId: string | null = null;\n private retry: number | null = null;\n\n decode(line: string): ServerSentEvent | null {\n // Blank line → dispatch event or reset\n if (line === '') {\n return this.dispatch();\n }\n\n // Comment line (starts with ':')\n if (line[0] === ':') {\n return null;\n }\n\n // Parse field:value\n const colonIdx = line.indexOf(':');\n let field: string;\n let value: string;\n\n if (colonIdx === -1) {\n // No colon → field is entire line, value is empty\n field = line;\n value = '';\n } else {\n field = line.slice(0, colonIdx);\n value = line.slice(colonIdx + 1);\n // Strip exactly ONE leading space (if present)\n if (value[0] === ' ') {\n value = value.slice(1);\n }\n }\n\n switch (field) {\n case 'data':\n this.data.push(value);\n break;\n case 'event':\n this.eventType = value;\n break;\n case 'id':\n // Ignore if value contains NULL character (security: WHATWG spec)\n if (!value.includes('\\0')) {\n this.lastEventId = value;\n }\n break;\n case 'retry':\n // Must consist of ASCII digits only (no negatives, no whitespace)\n if (/^[0-9]+$/.test(value)) {\n this.retry = parseInt(value, 10);\n }\n break;\n // Unknown fields: ignore silently\n }\n\n return null;\n }\n\n private dispatch(): ServerSentEvent | null {\n // eventType resets on every blank line per WHATWG spec,\n // regardless of whether we actually dispatch an event\n const currentEventType = this.eventType;\n this.eventType = '';\n\n // Suppress dispatch when no data: lines were received\n if (this.data.length === 0) {\n return null;\n }\n\n const event: ServerSentEvent = {\n data: this.data.join('\\n'),\n event: currentEventType,\n id: this.lastEventId,\n retry: this.retry,\n };\n\n // Reset data buffer; lastEventId and retry persist across dispatches\n this.data = [];\n\n return event;\n }\n}\n\n// ─── Layer 3: Top-level composer ──────────────────────────────────────────\n\n/**\n * Parses a byte stream as WHATWG Server-Sent Events.\n *\n * Accepts both ReadableStream<Uint8Array> (browser fetch) and\n * AsyncIterable<Uint8Array> (Node.js streams / Buffer chunks).\n *\n * @example\n * ```ts\n * const response = await fetch(url);\n * for await (const event of iterSSEEvents(response.body!)) {\n * console.log(event.event, event.data);\n * }\n * ```\n */\nexport async function* iterSSEEvents(\n stream: ReadableStream<Uint8Array> | AsyncIterable<Uint8Array>,\n): AsyncGenerator<ServerSentEvent> {\n const decoder = new SSEDecoder();\n for await (const line of iterLines(stream)) {\n const event = decoder.decode(line);\n if (event !== null) {\n yield event;\n }\n }\n}\n","export const COMPRESSION_THRESHOLD = 750;\n","import type { Host, StatefulHost } from '../types';\n\n// By default, API Clients at Algolia have expiration delay of 5 mins.\n// In the JavaScript client, we have 2 mins.\nconst EXPIRATION_DELAY = 2 * 60 * 1000;\n\nexport function createStatefulHost(host: Host, status: StatefulHost['status'] = 'up'): StatefulHost {\n const lastUpdate = Date.now();\n\n function isUp(): boolean {\n return status === 'up' || Date.now() - lastUpdate > EXPIRATION_DELAY;\n }\n\n function isTimedOut(): boolean {\n return status === 'timed out' && Date.now() - lastUpdate <= EXPIRATION_DELAY;\n }\n\n return { ...host, status, lastUpdate, isUp, isTimedOut };\n}\n","import type { Response, StackFrame } from '../types';\n\nexport class AlgoliaError extends Error {\n override name: string = 'AlgoliaError';\n\n constructor(message: string, name: string) {\n super(message);\n\n if (name) {\n this.name = name;\n }\n }\n}\n\nexport class IndexNotFoundError extends AlgoliaError {\n constructor(indexName: string) {\n super(`${indexName} does not exist`, 'IndexNotFoundError');\n }\n}\n\nexport class IndicesInSameAppError extends AlgoliaError {\n constructor() {\n super('Indices are in the same application. Use operationIndex instead.', 'IndicesInSameAppError');\n }\n}\n\nexport class IndexAlreadyExistsError extends AlgoliaError {\n constructor(indexName: string) {\n super(`${indexName} index already exists.`, 'IndexAlreadyExistsError');\n }\n}\n\nexport class ErrorWithStackTrace extends AlgoliaError {\n stackTrace: StackFrame[];\n\n correlationId?: string | undefined;\n\n constructor(message: string, stackTrace: StackFrame[], name: string, correlationId?: string | undefined) {\n super(correlationId ? `${message} (Correlation-ID: ${correlationId})` : message, name);\n // the array and object should be frozen to reflect the stackTrace at the time of the error\n this.stackTrace = stackTrace;\n this.correlationId = correlationId;\n }\n}\n\nexport class RetryError extends ErrorWithStackTrace {\n constructor(stackTrace: StackFrame[], correlationId?: string | undefined) {\n super(\n 'Unreachable hosts - your application id may be incorrect. If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support',\n stackTrace,\n 'RetryError',\n correlationId,\n );\n }\n}\n\nexport class ApiError extends ErrorWithStackTrace {\n status: number;\n\n constructor(\n message: string,\n status: number,\n stackTrace: StackFrame[],\n name = 'ApiError',\n correlationId?: string | undefined,\n ) {\n super(message, stackTrace, name, correlationId);\n this.status = status;\n }\n}\n\nexport class DeserializationError extends AlgoliaError {\n response: Response;\n\n correlationId?: string | undefined;\n\n constructor(message: string, response: Response, correlationId?: string | undefined) {\n super(correlationId ? `${message} (Correlation-ID: ${correlationId})` : message, 'DeserializationError');\n this.response = response;\n this.correlationId = correlationId;\n }\n}\n\nexport type DetailedErrorWithMessage = {\n message: string;\n label: string;\n};\n\nexport type DetailedErrorWithTypeID = {\n id: string;\n type: string;\n name?: string | undefined;\n};\n\nexport type DetailedError = {\n code: string;\n details?: DetailedErrorWithMessage[] | DetailedErrorWithTypeID[] | undefined;\n};\n\n// DetailedApiError is only used by the ingestion client to return more informative error, other clients will use ApiClient.\nexport class DetailedApiError extends ApiError {\n error: DetailedError;\n\n constructor(\n message: string,\n status: number,\n error: DetailedError,\n stackTrace: StackFrame[],\n correlationId?: string | undefined,\n ) {\n super(message, status, stackTrace, 'DetailedApiError', correlationId);\n this.error = error;\n }\n}\n","import type {\n AlgoliaHttpResponse,\n Headers,\n Host,\n QueryParameters,\n Request,\n RequestOptions,\n Response,\n StackFrame,\n} from '../types';\nimport { ApiError, DeserializationError, DetailedApiError } from './errors';\n\nexport function shuffle<TData>(array: TData[]): TData[] {\n const shuffledArray = array;\n\n for (let c = array.length - 1; c > 0; c--) {\n const b = Math.floor(Math.random() * (c + 1));\n const a = array[c];\n\n shuffledArray[c] = array[b];\n shuffledArray[b] = a;\n }\n\n return shuffledArray;\n}\n\nexport function serializeUrl(host: Host, path: string, queryParameters: QueryParameters): string {\n const queryParametersAsString = serializeQueryParameters(queryParameters);\n let url = `${host.protocol}://${host.url}${host.port ? `:${host.port}` : ''}/${\n path.charAt(0) === '/' ? path.substring(1) : path\n }`;\n\n if (queryParametersAsString.length) {\n url += `?${queryParametersAsString}`;\n }\n\n return url;\n}\n\nexport function serializeQueryParameters(parameters: QueryParameters): string {\n return Object.keys(parameters)\n .filter((key) => parameters[key] !== undefined)\n .sort()\n .map(\n (key) =>\n `${key}=${encodeURIComponent(\n Object.prototype.toString.call(parameters[key]) === '[object Array]'\n ? parameters[key].join(',')\n : parameters[key],\n ).replace(/\\+/g, '%20')}`,\n )\n .join('&');\n}\n\nexport function serializeData(request: Request, requestOptions: RequestOptions): string | undefined {\n if (request.method === 'GET' || (request.data === undefined && requestOptions.data === undefined)) {\n return undefined;\n }\n\n const data = Array.isArray(request.data) ? request.data : { ...request.data, ...requestOptions.data };\n\n return JSON.stringify(data);\n}\n\nexport function serializeHeaders(\n baseHeaders: Headers,\n requestHeaders: Headers,\n requestOptionsHeaders?: Headers | undefined,\n): Headers {\n const headers: Headers = {\n Accept: 'application/json',\n ...baseHeaders,\n ...requestHeaders,\n ...requestOptionsHeaders,\n };\n const serializedHeaders: Headers = {};\n\n Object.keys(headers).forEach((header) => {\n const value = headers[header];\n serializedHeaders[header.toLowerCase()] = value;\n });\n\n return serializedHeaders;\n}\n\nexport function deserializeSuccess<TObject>(response: Response): TObject {\n // Handle 204 No Content and other empty responses\n if (response.status === 204 || response.content.length === 0) {\n return undefined as unknown as TObject;\n }\n\n try {\n return JSON.parse(response.content);\n } catch (e) {\n throw new DeserializationError((e as Error).message, response, getCorrelationId(response.headers));\n }\n}\n\nexport function deserializeSuccessWithHttpInfo<TData>(response: Response): AlgoliaHttpResponse<TData> {\n return {\n status: response.status,\n headers: response.headers,\n content: response.content,\n data: deserializeSuccess<TData>(response),\n };\n}\n\nexport function getCorrelationId(headers: Headers | undefined): string | undefined {\n if (!headers) {\n return undefined;\n }\n\n if (headers['correlation-id'] !== undefined) {\n return headers['correlation-id'];\n }\n\n const header = Object.keys(headers).find((key) => key.toLowerCase() === 'correlation-id');\n\n return header === undefined ? undefined : headers[header];\n}\n\nexport function getLastCorrelationId(stackTrace: StackFrame[]): string | undefined {\n for (let i = stackTrace.length - 1; i >= 0; i--) {\n const correlationId = getCorrelationId(stackTrace[i].response.headers);\n if (correlationId !== undefined) {\n return correlationId;\n }\n }\n\n return undefined;\n}\n\nexport function deserializeFailure(response: Response, stackFrame: StackFrame[]): Error {\n const { content, status } = response;\n const correlationId = getCorrelationId(response.headers);\n try {\n const parsed = JSON.parse(content);\n if ('error' in parsed) {\n return new DetailedApiError(parsed.message, status, parsed.error, stackFrame, correlationId);\n }\n return new ApiError(parsed.message, status, stackFrame, 'ApiError', correlationId);\n } catch {\n // ..\n }\n return new ApiError(content, status, stackFrame, 'ApiError', correlationId);\n}\n","import type { Headers, QueryParameters, RequestOptions, Transporter } from '../types';\n\nconst BASE62_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\nconst REQUEST_ID_LENGTH = 11;\n\nexport function generateRequestId(): string {\n let requestId = '';\n\n if (typeof globalThis.crypto?.getRandomValues === 'function') {\n const bytes = new Uint8Array(REQUEST_ID_LENGTH);\n globalThis.crypto.getRandomValues(bytes);\n for (const byte of bytes) {\n requestId += BASE62_CHARS[byte % BASE62_CHARS.length];\n }\n\n return requestId;\n }\n\n for (let i = 0; i < REQUEST_ID_LENGTH; i++) {\n requestId += BASE62_CHARS[Math.floor(Math.random() * BASE62_CHARS.length)];\n }\n\n return requestId;\n}\n\nfunction hasRequestId(headers: Headers | undefined, queryParameters: QueryParameters | undefined): boolean {\n return (\n (headers !== undefined && Object.keys(headers).some((header) => header.toLowerCase() === 'request-id')) ||\n (queryParameters !== undefined &&\n Object.keys(queryParameters).some((parameter) => parameter.toLowerCase() === 'x-algolia-request-id'))\n );\n}\n\n/**\n * Returns request options carrying a Request-ID on the transporter's channel, so that every\n * request a multi-request helper performs shares the same ID. Returns the options unchanged\n * when the channel is off or when a Request-ID is already supplied. Never apply ahead of a\n * cacheable operation: the ID enters the cache key and defeats caching and deduplication.\n */\nexport function withRequestId(\n transporter: Pick<Transporter, 'requestIdChannel' | 'baseHeaders' | 'baseQueryParameters'>,\n requestOptions?: RequestOptions | undefined,\n): RequestOptions | undefined {\n if (\n transporter.requestIdChannel === undefined ||\n hasRequestId(transporter.baseHeaders, transporter.baseQueryParameters) ||\n hasRequestId(requestOptions?.headers, requestOptions?.queryParameters)\n ) {\n return requestOptions;\n }\n\n if (transporter.requestIdChannel === 'headers') {\n return { ...requestOptions, headers: { ...requestOptions?.headers, 'request-id': generateRequestId() } };\n }\n\n return {\n ...requestOptions,\n queryParameters: { ...requestOptions?.queryParameters, 'x-algolia-request-id': generateRequestId() },\n };\n}\n","import type { Response } from '../types';\n\nexport function isNetworkError({ isTimedOut, status }: Omit<Response, 'content'>): boolean {\n return !isTimedOut && ~~status === 0;\n}\n\nexport function isRetryable({ isTimedOut, status }: Omit<Response, 'content'>): boolean {\n return isTimedOut || isNetworkError({ isTimedOut, status }) || (~~(status / 100) !== 2 && ~~(status / 100) !== 4);\n}\n\nexport function isSuccess({ status }: Pick<Response, 'status'>): boolean {\n return ~~(status / 100) === 2;\n}\n","import type { Headers, StackFrame } from '../types';\n\nexport function stackTraceWithoutCredentials(stackTrace: StackFrame[]): StackFrame[] {\n return stackTrace.map((stackFrame) => stackFrameWithoutCredentials(stackFrame));\n}\n\nexport function stackFrameWithoutCredentials(stackFrame: StackFrame): StackFrame {\n const modifiedHeaders: Headers = stackFrame.request.headers['x-algolia-api-key']\n ? { 'x-algolia-api-key': '*****' }\n : {};\n\n return {\n ...stackFrame,\n request: {\n ...stackFrame.request,\n headers: {\n ...stackFrame.request.headers,\n ...modifiedHeaders,\n },\n },\n };\n}\n","import type { ServerSentEvent } from '../sse';\nimport { iterSSEEvents } from '../sse';\nimport type {\n AlgoliaHttpResponse,\n EndRequest,\n Headers,\n Host,\n QueryParameters,\n Request,\n RequestOptions,\n Response,\n StackFrame,\n TransporterOptions,\n TransporterWithHttpInfo,\n} from '../types';\nimport { COMPRESSION_THRESHOLD } from './compress';\nimport { createStatefulHost } from './createStatefulHost';\nimport { RetryError } from './errors';\nimport {\n deserializeFailure,\n deserializeSuccess,\n deserializeSuccessWithHttpInfo,\n getLastCorrelationId,\n serializeData,\n serializeHeaders,\n serializeUrl,\n} from './helpers';\nimport { generateRequestId } from './requestId';\nimport { isRetryable, isSuccess } from './responses';\nimport { stackFrameWithoutCredentials, stackTraceWithoutCredentials } from './stackTrace';\n\ntype RetryableOptions = {\n hosts: Host[];\n getTimeout: (retryCount: number, timeout: number) => number;\n};\n\nexport function createTransporter({\n hosts,\n hostsCache,\n baseHeaders,\n logger,\n baseQueryParameters,\n algoliaAgent,\n timeouts,\n requester,\n requestsCache,\n responsesCache,\n compress,\n compression,\n requestIdChannel,\n}: TransporterOptions): TransporterWithHttpInfo {\n function injectRequestId(headers: Headers, queryParameters: QueryParameters): void {\n if (\n requestIdChannel === undefined ||\n headers['request-id'] !== undefined ||\n Object.keys(queryParameters).some((parameter) => parameter.toLowerCase() === 'x-algolia-request-id')\n ) {\n return;\n }\n\n if (requestIdChannel === 'headers') {\n headers['request-id'] = generateRequestId();\n } else {\n queryParameters['x-algolia-request-id'] = generateRequestId();\n }\n }\n\n async function createRetryableOptions(compatibleHosts: Host[]): Promise<RetryableOptions> {\n const statefulHosts = await Promise.all(\n compatibleHosts.map((compatibleHost) => {\n return hostsCache.get(compatibleHost, () => {\n return Promise.resolve(createStatefulHost(compatibleHost));\n });\n }),\n );\n const hostsUp = statefulHosts.filter((host) => host.isUp());\n const hostsTimedOut = statefulHosts.filter((host) => host.isTimedOut());\n\n // Note, we put the hosts that previously timed out on the end of the list.\n const hostsAvailable = [...hostsUp, ...hostsTimedOut];\n const compatibleHostsAvailable = hostsAvailable.length > 0 ? hostsAvailable : compatibleHosts;\n\n return {\n hosts: compatibleHostsAvailable,\n getTimeout(timeoutsCount: number, baseTimeout: number): number {\n /**\n * Imagine that you have 4 hosts, if timeouts will increase\n * on the following way: 1 (timed out) > 4 (timed out) > 5 (200).\n *\n * Note that, the very next request, we start from the previous timeout.\n *\n * 5 (timed out) > 6 (timed out) > 7 ...\n *\n * This strategy may need to be reviewed, but is the strategy on the our\n * current v3 version.\n */\n const timeoutMultiplier =\n hostsTimedOut.length === 0 && timeoutsCount === 0 ? 1 : hostsTimedOut.length + 3 + timeoutsCount;\n\n return timeoutMultiplier * baseTimeout;\n },\n };\n }\n\n async function retryableRequest(\n request: Request,\n requestOptions: RequestOptions,\n isRead: boolean,\n ): Promise<Response> {\n const stackTrace: StackFrame[] = [];\n\n /**\n * First we prepare the payload that do not depend from hosts.\n */\n const serializedData = serializeData(request, requestOptions);\n const headers = serializeHeaders(baseHeaders, request.headers, requestOptions.headers);\n\n const wantsCompression =\n compression === 'gzip' &&\n serializedData !== undefined &&\n serializedData.length > COMPRESSION_THRESHOLD &&\n (request.method === 'POST' || request.method === 'PUT');\n\n if (wantsCompression && compress === undefined) {\n logger.info('Compression is disabled because no compress method is available.');\n }\n\n const shouldCompress = wantsCompression && compress !== undefined;\n const data = shouldCompress ? await compress(serializedData) : serializedData;\n if (shouldCompress) {\n headers['content-encoding'] = 'gzip';\n }\n\n // On `GET`, the data is proxied to query parameters.\n const dataQueryParameters: QueryParameters =\n request.method === 'GET'\n ? {\n ...request.data,\n ...requestOptions.data,\n }\n : {};\n\n const queryParameters: QueryParameters = {\n ...baseQueryParameters,\n ...request.queryParameters,\n ...dataQueryParameters,\n };\n\n if (algoliaAgent.value) {\n queryParameters['x-algolia-agent'] = algoliaAgent.value;\n }\n\n if (requestOptions && requestOptions.queryParameters) {\n for (const key of Object.keys(requestOptions.queryParameters)) {\n // We want to keep `undefined` and `null` values,\n // but also avoid stringifying `object`s, as they are\n // handled in the `serializeUrl` step right after.\n if (\n !requestOptions.queryParameters[key] ||\n Object.prototype.toString.call(requestOptions.queryParameters[key]) === '[object Object]'\n ) {\n queryParameters[key] = requestOptions.queryParameters[key];\n } else {\n queryParameters[key] = requestOptions.queryParameters[key].toString();\n }\n }\n }\n\n injectRequestId(headers, queryParameters);\n\n let timeoutsCount = 0;\n\n const retry = async (\n retryableHosts: Host[],\n getTimeout: (timeoutsCount: number, timeout: number) => number,\n ): Promise<Response> => {\n /**\n * We iterate on each host, until there is no host left.\n */\n const host = retryableHosts.pop();\n if (host === undefined) {\n throw new RetryError(stackTraceWithoutCredentials(stackTrace), getLastCorrelationId(stackTrace));\n }\n\n const timeout = { ...timeouts, ...requestOptions.timeouts };\n\n const payload: EndRequest = {\n data,\n headers,\n method: request.method,\n url: serializeUrl(host, request.path, queryParameters),\n connectTimeout: getTimeout(timeoutsCount, timeout.connect),\n responseTimeout: getTimeout(timeoutsCount, isRead ? timeout.read : timeout.write),\n };\n\n /**\n * The stackFrame is pushed to the stackTrace so we\n * can have information about onRetry and onFailure\n * decisions.\n */\n const pushToStackTrace = (response: Response): StackFrame => {\n const stackFrame: StackFrame = {\n request: payload,\n response,\n host,\n triesLeft: retryableHosts.length,\n };\n\n stackTrace.push(stackFrame);\n\n return stackFrame;\n };\n\n const response = await requester.send(payload);\n\n if (isRetryable(response)) {\n const stackFrame = pushToStackTrace(response);\n\n // If response is a timeout, we increase the number of timeouts so we can increase the timeout later.\n if (response.isTimedOut) {\n timeoutsCount++;\n }\n /**\n * Failures are individually sent to the logger, allowing\n * the end user to debug / store stack frames even\n * when a retry error does not happen.\n */\n logger.info('Retryable failure', stackFrameWithoutCredentials(stackFrame));\n\n /**\n * We also store the state of the host in failure cases. If the host, is\n * down it will remain down for the next 2 minutes. In a timeout situation,\n * this host will be added end of the list of hosts on the next request.\n */\n await hostsCache.set(host, createStatefulHost(host, response.isTimedOut ? 'timed out' : 'down'));\n\n return retry(retryableHosts, getTimeout);\n }\n\n if (isSuccess(response)) {\n return response;\n }\n\n pushToStackTrace(response);\n throw deserializeFailure(response, stackTrace);\n };\n\n /**\n * Finally, for each retryable host perform request until we got a non\n * retryable response. Some notes here:\n *\n * 1. The reverse here is applied so we can apply a `pop` later on => more performant.\n * 2. We also get from the retryable options a timeout multiplier that is tailored\n * for the current context.\n */\n const compatibleHosts = hosts.filter(\n (host) => host.accept === 'readWrite' || (isRead ? host.accept === 'read' : host.accept === 'write'),\n );\n const options = await createRetryableOptions(compatibleHosts);\n\n return retry([...options.hosts].reverse(), options.getTimeout);\n }\n\n function createRequest<TResponse>(request: Request, requestOptions: RequestOptions = {}): Promise<TResponse> {\n const createRetryableRequest = (): Promise<TResponse> => {\n /**\n * Then, we prepare a function factory that contains the construction of\n * the retryable request. At this point, we may *not* perform the actual\n * request. But we want to have the function factory ready.\n */\n return retryableRequest(request, requestOptions, isRead).then((response) =>\n deserializeSuccess<TResponse>(response),\n );\n };\n\n /**\n * A read request is either a `GET` request, or a request that we make\n * via the `read` transporter (e.g. `search`).\n */\n const isRead = request.useReadTransporter || request.method === 'GET';\n\n /**\n * Once we have the function factory ready, we need to determine of the\n * request is \"cacheable\" - should be cached. Note that, once again,\n * the user can force this option.\n */\n const cacheable = requestOptions.cacheable || request.cacheable;\n\n /**\n * If is not \"cacheable\", we immediately trigger the retryable request, no\n * need to check cache implementations.\n */\n if (cacheable !== true) {\n return createRetryableRequest();\n }\n\n /**\n * If the request is \"cacheable\", we need to first compute the key to ask\n * the cache implementations if this request is on progress or if the\n * response already exists on the cache.\n */\n const key = {\n request,\n requestOptions,\n transporter: {\n queryParameters: baseQueryParameters,\n headers: baseHeaders,\n },\n };\n\n /**\n * With the computed key, we first ask the responses cache\n * implementation if this request was been resolved before.\n */\n return responsesCache.get(\n key,\n () => {\n /**\n * If the request has never resolved before, we actually ask if there\n * is a current request with the same key on progress.\n */\n return requestsCache.get(key, () =>\n /**\n * Finally, if there is no request in progress with the same key,\n * this `createRetryableRequest()` will actually trigger the\n * retryable request.\n */\n requestsCache\n .set(key, createRetryableRequest())\n .then(\n (response) => Promise.all([requestsCache.delete(key), response]),\n (err) => Promise.all([requestsCache.delete(key), Promise.reject(err)]),\n )\n .then(([_, response]) => response),\n );\n },\n {\n /**\n * Of course, once we get this response back from the server, we\n * tell response cache to actually store the received response\n * to be used later.\n */\n miss: (response) => responsesCache.set(key, response),\n },\n );\n }\n\n function createRequestWithHttpInfo<TData>(\n request: Request,\n requestOptions: RequestOptions = {},\n ): Promise<AlgoliaHttpResponse<TData>> {\n /**\n * A read request is either a `GET` request, or a request that we make\n * via the `read` transporter (e.g. `search`).\n */\n const isRead = request.useReadTransporter || request.method === 'GET';\n\n /**\n * The HTTP info variant always hits the network: both the requests and\n * the responses caches are bypassed, even for `cacheable` requests, so\n * that the returned status code and headers reflect an actual API call.\n */\n return retryableRequest(request, requestOptions, isRead).then((response) =>\n deserializeSuccessWithHttpInfo<TData>(response),\n );\n }\n\n async function* requestStream(\n request: Request,\n requestOptions: RequestOptions = {},\n ): AsyncGenerator<ServerSentEvent> {\n if (!requester.sendStream) {\n throw new Error('This requester does not support streaming');\n }\n\n const data = serializeData(request, requestOptions);\n const headers = serializeHeaders(baseHeaders, request.headers, requestOptions.headers);\n headers['accept'] = 'text/event-stream';\n\n // On `GET`, the data is proxied to query parameters.\n const dataQueryParameters: QueryParameters =\n request.method === 'GET'\n ? {\n ...request.data,\n ...requestOptions.data,\n }\n : {};\n\n const queryParameters: QueryParameters = {\n ...baseQueryParameters,\n ...request.queryParameters,\n ...dataQueryParameters,\n };\n\n if (algoliaAgent.value) {\n queryParameters['x-algolia-agent'] = algoliaAgent.value;\n }\n\n if (requestOptions && requestOptions.queryParameters) {\n for (const key of Object.keys(requestOptions.queryParameters)) {\n if (\n !requestOptions.queryParameters[key] ||\n Object.prototype.toString.call(requestOptions.queryParameters[key]) === '[object Object]'\n ) {\n queryParameters[key] = requestOptions.queryParameters[key];\n } else {\n queryParameters[key] = requestOptions.queryParameters[key].toString();\n }\n }\n }\n\n injectRequestId(headers, queryParameters);\n\n const isRead = request.useReadTransporter || request.method === 'GET';\n const compatibleHosts = hosts.filter(\n (host) => host.accept === 'readWrite' || (isRead ? host.accept === 'read' : host.accept === 'write'),\n );\n const options = await createRetryableOptions(compatibleHosts);\n const host = options.hosts[0];\n if (!host) {\n throw new RetryError([]);\n }\n\n const timeout = { ...timeouts, ...requestOptions.timeouts };\n const payload: EndRequest = {\n data,\n headers,\n method: request.method,\n url: serializeUrl(host, request.path, queryParameters),\n connectTimeout: timeout.connect,\n responseTimeout: isRead ? timeout.read : timeout.write,\n };\n\n const stream = await requester.sendStream(payload);\n yield* iterSSEEvents(stream);\n }\n\n return {\n hostsCache,\n requester,\n timeouts,\n logger,\n algoliaAgent,\n baseHeaders,\n baseQueryParameters,\n requestIdChannel,\n hosts,\n request: createRequest,\n requestWithHttpInfo: createRequestWithHttpInfo,\n requestStream,\n requestsCache,\n responsesCache,\n };\n}\n","export const LogLevelEnum: Readonly<Record<string, LogLevelType>> = {\n Debug: 1,\n Info: 2,\n Error: 3,\n};\n\nexport type LogLevelType = 1 | 2 | 3;\n\nexport type Logger = {\n /**\n * Logs debug messages.\n */\n debug: (message: string, args?: any | undefined) => Promise<void>;\n\n /**\n * Logs info messages.\n */\n info: (message: string, args?: any | undefined) => Promise<void>;\n\n /**\n * Logs warning messages. When not implemented, warnings fall back to `console.warn` so they stay visible with the default no-op logger.\n */\n warn?: (message: string, args?: any | undefined) => Promise<void>;\n\n /**\n * Logs error messages.\n */\n error: (message: string, args?: any | undefined) => Promise<void>;\n};\n","export function validateRequired(field: string, method: string, value: unknown): void {\n if (value == null || (typeof value === 'string' && value.length === 0)) {\n throw new Error(`Parameter \\`${field}\\` is required when calling \\`${method}\\`.`);\n }\n}\n","import type { EndRequest, Requester, Response } from '@algolia/client-common';\n\ntype Timeout = ReturnType<typeof setTimeout>;\n\nfunction parseResponseHeaders(rawHeaders: string): Record<string, string> {\n const headers: Record<string, string> = {};\n\n for (const line of rawHeaders.trim().split(/[\\r\\n]+/)) {\n const separatorIndex = line.indexOf(': ');\n if (separatorIndex > 0) {\n headers[line.slice(0, separatorIndex).toLowerCase()] = line.slice(separatorIndex + 2);\n }\n }\n\n return headers;\n}\n\nexport function createXhrRequester(): Requester {\n function send(request: EndRequest): Promise<Response> {\n return new Promise((resolve) => {\n const baseRequester = new XMLHttpRequest();\n baseRequester.open(request.method, request.url, true);\n\n Object.keys(request.headers).forEach((key) => baseRequester.setRequestHeader(key, request.headers[key]));\n\n const createTimeout = (timeout: number, content: string): Timeout => {\n return setTimeout(() => {\n baseRequester.abort();\n\n resolve({\n status: 0,\n content,\n isTimedOut: true,\n });\n }, timeout);\n };\n\n const connectTimeout = createTimeout(request.connectTimeout, 'Connection timeout');\n\n let responseTimeout: Timeout | undefined;\n\n baseRequester.onreadystatechange = (): void => {\n if (baseRequester.readyState > baseRequester.OPENED && responseTimeout === undefined) {\n clearTimeout(connectTimeout);\n\n responseTimeout = createTimeout(request.responseTimeout, 'Socket timeout');\n }\n };\n\n baseRequester.onerror = (): void => {\n // istanbul ignore next\n if (baseRequester.status === 0) {\n clearTimeout(connectTimeout);\n clearTimeout(responseTimeout!);\n\n resolve({\n content: baseRequester.responseText || 'Network request failed',\n status: baseRequester.status,\n isTimedOut: false,\n });\n }\n };\n\n baseRequester.onload = (): void => {\n clearTimeout(connectTimeout);\n clearTimeout(responseTimeout!);\n\n resolve({\n content: baseRequester.responseText,\n headers: parseResponseHeaders(baseRequester.getAllResponseHeaders()),\n status: baseRequester.status,\n isTimedOut: false,\n });\n };\n\n baseRequester.send(request.data as XMLHttpRequestBodyInit | null | undefined);\n });\n }\n\n return { send };\n}\n","// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nimport type {\n AlgoliaHttpResponse,\n CreateClientOptions,\n Headers,\n Host,\n QueryParameters,\n Request,\n RequestOptions,\n} from '@algolia/client-common';\nimport { createAuth, createTransporter, getAlgoliaAgent, validateRequired } from '@algolia/client-common';\n\nimport type { ABTest } from '../model/aBTest';\nimport type { ABTestResponse } from '../model/aBTestResponse';\nimport type { AddABTestsRequest } from '../model/addABTestsRequest';\nimport type { EstimateABTestRequest } from '../model/estimateABTestRequest';\nimport type { EstimateABTestResponse } from '../model/estimateABTestResponse';\nimport type { ListABTestsResponse } from '../model/listABTestsResponse';\nimport type { Timeseries } from '../model/timeseries';\n\nimport type {\n CustomDeleteProps,\n CustomGetProps,\n CustomPostProps,\n CustomPutProps,\n DeleteABTestProps,\n GetABTestProps,\n GetTimeseriesProps,\n ListABTestsProps,\n StopABTestProps,\n} from '../model/clientMethodProps';\n\nexport const apiClientVersion = '1.23.0';\n\nexport const REGIONS = ['de', 'us'] as const;\nexport type Region = (typeof REGIONS)[number];\nexport type RegionOptions = { region?: Region | undefined };\n\nfunction getDefaultHosts(region?: Region | undefined): Host[] {\n const url = !region ? 'analytics.algolia.com' : 'analytics.{region}.algolia.com'.replace('{region}', region);\n\n return [{ url, accept: 'readWrite', protocol: 'https' }];\n}\n\nexport function createAbtestingV3Client({\n appId: appIdOption,\n apiKey: apiKeyOption,\n authMode,\n algoliaAgents,\n region: regionOption,\n ...options\n}: CreateClientOptions & RegionOptions) {\n const auth = createAuth(appIdOption, apiKeyOption, authMode);\n const transporter = createTransporter({\n hosts: getDefaultHosts(regionOption),\n ...options,\n algoliaAgent: getAlgoliaAgent({\n algoliaAgents,\n client: 'AbtestingV3',\n version: apiClientVersion,\n }),\n baseHeaders: {\n 'content-type': 'text/plain',\n ...auth.headers(),\n ...options.baseHeaders,\n },\n baseQueryParameters: {\n ...auth.queryParameters(),\n ...options.baseQueryParameters,\n },\n });\n\n return {\n transporter,\n\n /**\n * The `appId` currently in use.\n */\n appId: appIdOption,\n\n /**\n * The `apiKey` currently in use.\n */\n apiKey: apiKeyOption,\n\n /**\n * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.\n */\n clearCache(): Promise<void> {\n return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => undefined);\n },\n\n /**\n * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.\n */\n get _ua(): string {\n return transporter.algoliaAgent.value;\n },\n\n /**\n * Adds a `segment` to the `x-algolia-agent` sent with every requests.\n *\n * @param segment - The algolia agent (user-agent) segment to add.\n * @param version - The version of the agent.\n */\n addAlgoliaAgent(segment: string, version?: string | undefined): void {\n transporter.algoliaAgent.add({ segment, version });\n },\n\n /**\n * Helper method to switch the API key used to authenticate the requests.\n *\n * @param params - Method params.\n * @param params.apiKey - The new API Key to use.\n */\n setClientApiKey({ apiKey }: { apiKey: string }): void {\n if (!authMode || authMode === 'WithinHeaders') {\n transporter.baseHeaders['x-algolia-api-key'] = apiKey;\n } else {\n transporter.baseQueryParameters['x-algolia-api-key'] = apiKey;\n }\n },\n\n /**\n * Creates a new A/B test.\n *\n * Required API Key ACLs:\n * - editSettings\n * @param addABTestsRequest - The addABTestsRequest object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n addABTests(addABTestsRequest: AddABTestsRequest, requestOptions?: RequestOptions): Promise<ABTestResponse> {\n validateRequired('addABTestsRequest', 'addABTests', addABTestsRequest);\n\n validateRequired('addABTestsRequest.name', 'addABTests', addABTestsRequest.name);\n validateRequired('addABTestsRequest.variants', 'addABTests', addABTestsRequest.variants);\n validateRequired('addABTestsRequest.metrics', 'addABTests', addABTestsRequest.metrics);\n validateRequired('addABTestsRequest.endAt', 'addABTests', addABTestsRequest.endAt);\n\n const requestPath = '/3/abtests';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: addABTestsRequest,\n };\n\n return transporter.request(request, requestOptions);\n },\n /**\n * Creates a new A/B test.\n *\n * Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.\n *\n * Required API Key ACLs:\n * - editSettings\n * @param addABTestsRequest - The addABTestsRequest object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n * @see addABTests for the plain version.\n */\n addABTestsWithHTTPInfo(\n addABTestsRequest: AddABTestsRequest,\n requestOptions?: RequestOptions,\n ): Promise<AlgoliaHttpResponse<ABTestResponse>> {\n validateRequired('addABTestsRequest', 'addABTestsWithHTTPInfo', addABTestsRequest);\n\n validateRequired('addABTestsRequest.name', 'addABTestsWithHTTPInfo', addABTestsRequest.name);\n validateRequired('addABTestsRequest.variants', 'addABTestsWithHTTPInfo', addABTestsRequest.variants);\n validateRequired('addABTestsRequest.metrics', 'addABTestsWithHTTPInfo', addABTestsRequest.metrics);\n validateRequired('addABTestsRequest.endAt', 'addABTestsWithHTTPInfo', addABTestsRequest.endAt);\n\n const requestPath = '/3/abtests';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: addABTestsRequest,\n };\n\n return transporter.requestWithHttpInfo(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customDelete - The customDelete object.\n * @param customDelete.path - Path of the endpoint, for example `1/newFeature`.\n * @param customDelete.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customDelete(\n { path, parameters }: CustomDeleteProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n validateRequired('path', 'customDelete', path);\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n /**\n * This method lets you send requests to the Algolia REST API.\n *\n * Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.\n * @param customDelete - The customDelete object.\n * @param customDelete.path - Path of the endpoint, for example `1/newFeature`.\n * @param customDelete.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n * @see customDelete for the plain version.\n */\n customDeleteWithHTTPInfo(\n { path, parameters }: CustomDeleteProps,\n requestOptions?: RequestOptions,\n ): Promise<AlgoliaHttpResponse<Record<string, unknown>>> {\n validateRequired('path', 'customDeleteWithHTTPInfo', path);\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.requestWithHttpInfo(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customGet - The customGet object.\n * @param customGet.path - Path of the endpoint, for example `1/newFeature`.\n * @param customGet.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>> {\n validateRequired('path', 'customGet', path);\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n /**\n * This method lets you send requests to the Algolia REST API.\n *\n * Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.\n * @param customGet - The customGet object.\n * @param customGet.path - Path of the endpoint, for example `1/newFeature`.\n * @param customGet.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n * @see customGet for the plain version.\n */\n customGetWithHTTPInfo(\n { path, parameters }: CustomGetProps,\n requestOptions?: RequestOptions,\n ): Promise<AlgoliaHttpResponse<Record<string, unknown>>> {\n validateRequired('path', 'customGetWithHTTPInfo', path);\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.requestWithHttpInfo(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customPost - The customPost object.\n * @param customPost.path - Path of the endpoint, for example `1/newFeature`.\n * @param customPost.parameters - Query parameters to apply to the current query.\n * @param customPost.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPost(\n { path, parameters, body }: CustomPostProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n validateRequired('path', 'customPost', path);\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n /**\n * This method lets you send requests to the Algolia REST API.\n *\n * Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.\n * @param customPost - The customPost object.\n * @param customPost.path - Path of the endpoint, for example `1/newFeature`.\n * @param customPost.parameters - Query parameters to apply to the current query.\n * @param customPost.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n * @see customPost for the plain version.\n */\n customPostWithHTTPInfo(\n { path, parameters, body }: CustomPostProps,\n requestOptions?: RequestOptions,\n ): Promise<AlgoliaHttpResponse<Record<string, unknown>>> {\n validateRequired('path', 'customPostWithHTTPInfo', path);\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.requestWithHttpInfo(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customPut - The customPut object.\n * @param customPut.path - Path of the endpoint, for example `1/newFeature`.\n * @param customPut.parameters - Query parameters to apply to the current query.\n * @param customPut.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPut(\n { path, parameters, body }: CustomPutProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n validateRequired('path', 'customPut', path);\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'PUT',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n /**\n * This method lets you send requests to the Algolia REST API.\n *\n * Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.\n * @param customPut - The customPut object.\n * @param customPut.path - Path of the endpoint, for example `1/newFeature`.\n * @param customPut.parameters - Query parameters to apply to the current query.\n * @param customPut.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n * @see customPut for the plain version.\n */\n customPutWithHTTPInfo(\n { path, parameters, body }: CustomPutProps,\n requestOptions?: RequestOptions,\n ): Promise<AlgoliaHttpResponse<Record<string, unknown>>> {\n validateRequired('path', 'customPutWithHTTPInfo', path);\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'PUT',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.requestWithHttpInfo(request, requestOptions);\n },\n\n /**\n * Deletes an A/B test by its ID.\n *\n * Required API Key ACLs:\n * - editSettings\n * @param deleteABTest - The deleteABTest object.\n * @param deleteABTest.id - Unique A/B test identifier.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n deleteABTest({ id }: DeleteABTestProps, requestOptions?: RequestOptions): Promise<ABTestResponse> {\n validateRequired('id', 'deleteABTest', id);\n\n const requestPath = '/3/abtests/{id}'.replace('{id}', encodeURIComponent(id));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n /**\n * Deletes an A/B test by its ID.\n *\n * Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.\n *\n * Required API Key ACLs:\n * - editSettings\n * @param deleteABTest - The deleteABTest object.\n * @param deleteABTest.id - Unique A/B test identifier.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n * @see deleteABTest for the plain version.\n */\n deleteABTestWithHTTPInfo(\n { id }: DeleteABTestProps,\n requestOptions?: RequestOptions,\n ): Promise<AlgoliaHttpResponse<ABTestResponse>> {\n validateRequired('id', 'deleteABTestWithHTTPInfo', id);\n\n const requestPath = '/3/abtests/{id}'.replace('{id}', encodeURIComponent(id));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.requestWithHttpInfo(request, requestOptions);\n },\n\n /**\n * Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.\n *\n * Required API Key ACLs:\n * - analytics\n * @param estimateABTestRequest - The estimateABTestRequest object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n estimateABTest(\n estimateABTestRequest: EstimateABTestRequest,\n requestOptions?: RequestOptions,\n ): Promise<EstimateABTestResponse> {\n validateRequired('estimateABTestRequest', 'estimateABTest', estimateABTestRequest);\n\n validateRequired('estimateABTestRequest.configuration', 'estimateABTest', estimateABTestRequest.configuration);\n validateRequired('estimateABTestRequest.variants', 'estimateABTest', estimateABTestRequest.variants);\n\n const requestPath = '/3/abtests/estimate';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: estimateABTestRequest,\n };\n\n return transporter.request(request, requestOptions);\n },\n /**\n * Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.\n *\n * Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.\n *\n * Required API Key ACLs:\n * - analytics\n * @param estimateABTestRequest - The estimateABTestRequest object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n * @see estimateABTest for the plain version.\n */\n estimateABTestWithHTTPInfo(\n estimateABTestRequest: EstimateABTestRequest,\n requestOptions?: RequestOptions,\n ): Promise<AlgoliaHttpResponse<EstimateABTestResponse>> {\n validateRequired('estimateABTestRequest', 'estimateABTestWithHTTPInfo', estimateABTestRequest);\n\n validateRequired(\n 'estimateABTestRequest.configuration',\n 'estimateABTestWithHTTPInfo',\n estimateABTestRequest.configuration,\n );\n validateRequired('estimateABTestRequest.variants', 'estimateABTestWithHTTPInfo', estimateABTestRequest.variants);\n\n const requestPath = '/3/abtests/estimate';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: estimateABTestRequest,\n };\n\n return transporter.requestWithHttpInfo(request, requestOptions);\n },\n\n /**\n * Retrieves the details for an A/B test by its ID.\n *\n * Required API Key ACLs:\n * - analytics\n * @param getABTest - The getABTest object.\n * @param getABTest.id - Unique A/B test identifier.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getABTest({ id }: GetABTestProps, requestOptions?: RequestOptions): Promise<ABTest> {\n validateRequired('id', 'getABTest', id);\n\n const requestPath = '/3/abtests/{id}'.replace('{id}', encodeURIComponent(id));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n /**\n * Retrieves the details for an A/B test by its ID.\n *\n * Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.\n *\n * Required API Key ACLs:\n * - analytics\n * @param getABTest - The getABTest object.\n * @param getABTest.id - Unique A/B test identifier.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n * @see getABTest for the plain version.\n */\n getABTestWithHTTPInfo(\n { id }: GetABTestProps,\n requestOptions?: RequestOptions,\n ): Promise<AlgoliaHttpResponse<ABTest>> {\n validateRequired('id', 'getABTestWithHTTPInfo', id);\n\n const requestPath = '/3/abtests/{id}'.replace('{id}', encodeURIComponent(id));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.requestWithHttpInfo(request, requestOptions);\n },\n\n /**\n * Retrieves timeseries for an A/B test by its ID.\n *\n * Required API Key ACLs:\n * - analytics\n * @param getTimeseries - The getTimeseries object.\n * @param getTimeseries.id - Unique A/B test identifier.\n * @param getTimeseries.startDate - Start date of the period to analyze, in `YYYY-MM-DD` format.\n * @param getTimeseries.endDate - End date of the period to analyze, in `YYYY-MM-DD` format.\n * @param getTimeseries.metric - List of metrics to retrieve. If not specified, all metrics are returned.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getTimeseries(\n { id, startDate, endDate, metric }: GetTimeseriesProps,\n requestOptions?: RequestOptions,\n ): Promise<Timeseries> {\n validateRequired('id', 'getTimeseries', id);\n\n const requestPath = '/3/abtests/{id}/timeseries'.replace('{id}', encodeURIComponent(id));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n if (startDate !== undefined) {\n queryParameters['startDate'] = startDate.toString();\n }\n\n if (endDate !== undefined) {\n queryParameters['endDate'] = endDate.toString();\n }\n\n if (metric !== undefined) {\n queryParameters['metric'] = metric.toString();\n }\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n /**\n * Retrieves timeseries for an A/B test by its ID.\n *\n * Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.\n *\n * Required API Key ACLs:\n * - analytics\n * @param getTimeseries - The getTimeseries object.\n * @param getTimeseries.id - Unique A/B test identifier.\n * @param getTimeseries.startDate - Start date of the period to analyze, in `YYYY-MM-DD` format.\n * @param getTimeseries.endDate - End date of the period to analyze, in `YYYY-MM-DD` format.\n * @param getTimeseries.metric - List of metrics to retrieve. If not specified, all metrics are returned.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n * @see getTimeseries for the plain version.\n */\n getTimeseriesWithHTTPInfo(\n { id, startDate, endDate, metric }: GetTimeseriesProps,\n requestOptions?: RequestOptions,\n ): Promise<AlgoliaHttpResponse<Timeseries>> {\n validateRequired('id', 'getTimeseriesWithHTTPInfo', id);\n\n const requestPath = '/3/abtests/{id}/timeseries'.replace('{id}', encodeURIComponent(id));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n if (startDate !== undefined) {\n queryParameters['startDate'] = startDate.toString();\n }\n\n if (endDate !== undefined) {\n queryParameters['endDate'] = endDate.toString();\n }\n\n if (metric !== undefined) {\n queryParameters['metric'] = metric.toString();\n }\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.requestWithHttpInfo(request, requestOptions);\n },\n\n /**\n * Lists all A/B tests you configured for this application.\n *\n * Required API Key ACLs:\n * - analytics\n * @param listABTests - The listABTests object.\n * @param listABTests.offset - Position of the first item to return.\n * @param listABTests.limit - Number of items to return.\n * @param listABTests.indexPrefix - Index name prefix. Only A/B tests for indices starting with this string are included in the response.\n * @param listABTests.indexSuffix - Index name suffix. Only A/B tests for indices ending with this string are included in the response.\n * @param listABTests.direction - Sort order for A/B tests by start date. Use \\'asc\\' for ascending or \\'desc\\' for descending. Active A/B tests are always listed first.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n listABTests(\n { offset, limit, indexPrefix, indexSuffix, direction }: ListABTestsProps = {},\n requestOptions: RequestOptions | undefined = undefined,\n ): Promise<ListABTestsResponse> {\n const requestPath = '/3/abtests';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n if (offset !== undefined) {\n queryParameters['offset'] = offset.toString();\n }\n\n if (limit !== undefined) {\n queryParameters['limit'] = limit.toString();\n }\n\n if (indexPrefix !== undefined) {\n queryParameters['indexPrefix'] = indexPrefix.toString();\n }\n\n if (indexSuffix !== undefined) {\n queryParameters['indexSuffix'] = indexSuffix.toString();\n }\n\n if (direction !== undefined) {\n queryParameters['direction'] = direction.toString();\n }\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n /**\n * Lists all A/B tests you configured for this application.\n *\n * Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.\n *\n * Required API Key ACLs:\n * - analytics\n * @param listABTests - The listABTests object.\n * @param listABTests.offset - Position of the first item to return.\n * @param listABTests.limit - Number of items to return.\n * @param listABTests.indexPrefix - Index name prefix. Only A/B tests for indices starting with this string are included in the response.\n * @param listABTests.indexSuffix - Index name suffix. Only A/B tests for indices ending with this string are included in the response.\n * @param listABTests.direction - Sort order for A/B tests by start date. Use \\'asc\\' for ascending or \\'desc\\' for descending. Active A/B tests are always listed first.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n * @see listABTests for the plain version.\n */\n listABTestsWithHTTPInfo(\n { offset, limit, indexPrefix, indexSuffix, direction }: ListABTestsProps = {},\n requestOptions: RequestOptions | undefined = undefined,\n ): Promise<AlgoliaHttpResponse<ListABTestsResponse>> {\n const requestPath = '/3/abtests';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n if (offset !== undefined) {\n queryParameters['offset'] = offset.toString();\n }\n\n if (limit !== undefined) {\n queryParameters['limit'] = limit.toString();\n }\n\n if (indexPrefix !== undefined) {\n queryParameters['indexPrefix'] = indexPrefix.toString();\n }\n\n if (indexSuffix !== undefined) {\n queryParameters['indexSuffix'] = indexSuffix.toString();\n }\n\n if (direction !== undefined) {\n queryParameters['direction'] = direction.toString();\n }\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.requestWithHttpInfo(request, requestOptions);\n },\n\n /**\n * Stops an A/B test by its ID. You can\\'t restart stopped A/B tests.\n *\n * Required API Key ACLs:\n * - editSettings\n * @param stopABTest - The stopABTest object.\n * @param stopABTest.id - Unique A/B test identifier.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n stopABTest({ id }: StopABTestProps, requestOptions?: RequestOptions): Promise<ABTestResponse> {\n validateRequired('id', 'stopABTest', id);\n\n const requestPath = '/3/abtests/{id}/stop'.replace('{id}', encodeURIComponent(id));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n /**\n * Stops an A/B test by its ID. You can\\'t restart stopped A/B tests.\n *\n * Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.\n *\n * Required API Key ACLs:\n * - editSettings\n * @param stopABTest - The stopABTest object.\n * @param stopABTest.id - Unique A/B test identifier.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n * @see stopABTest for the plain version.\n */\n stopABTestWithHTTPInfo(\n { id }: StopABTestProps,\n requestOptions?: RequestOptions,\n ): Promise<AlgoliaHttpResponse<ABTestResponse>> {\n validateRequired('id', 'stopABTestWithHTTPInfo', id);\n\n const requestPath = '/3/abtests/{id}/stop'.replace('{id}', encodeURIComponent(id));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.requestWithHttpInfo(request, requestOptions);\n },\n };\n}\n","// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nimport {\n createBrowserLocalStorageCache,\n createFallbackableCache,\n createMemoryCache,\n createNullLogger,\n} from '@algolia/client-common';\nimport { createXhrRequester } from '@algolia/requester-browser-xhr';\n\nimport type { ClientOptions } from '@algolia/client-common';\n\nimport { apiClientVersion, createAbtestingV3Client } from '../src/abtestingV3Client';\n\nimport type { Region } from '../src/abtestingV3Client';\nimport { REGIONS } from '../src/abtestingV3Client';\n\nexport type { Region, RegionOptions } from '../src/abtestingV3Client';\n\nexport { apiClientVersion } from '../src/abtestingV3Client';\n\nexport * from '../model';\n\nexport function abtestingV3Client(\n appId: string,\n apiKey: string,\n region?: Region | undefined,\n options?: ClientOptions | undefined,\n): AbtestingV3Client {\n if (!appId || typeof appId !== 'string') {\n throw new Error('`appId` is missing.');\n }\n\n if (!apiKey || typeof apiKey !== 'string') {\n throw new Error('`apiKey` is missing.');\n }\n\n if (region && (typeof region !== 'string' || !REGIONS.includes(region))) {\n throw new Error(`\\`region\\` must be one of the following: ${REGIONS.join(', ')}`);\n }\n\n const { compression: _compression, ...browserOptions } = options || {};\n\n return createAbtestingV3Client({\n appId,\n apiKey,\n region,\n timeouts: {\n connect: 1000,\n read: 2000,\n write: 30000,\n },\n logger: createNullLogger(),\n requester: createXhrRequester(),\n algoliaAgents: [{ segment: 'Browser' }],\n authMode: 'WithinQueryParameters',\n responsesCache: createMemoryCache(),\n requestsCache: createMemoryCache({ serializable: false }),\n hostsCache: createFallbackableCache({\n caches: [createBrowserLocalStorageCache({ key: `${apiClientVersion}-${appId}` }), createMemoryCache()],\n }),\n ...browserOptions,\n });\n}\n\nexport type AbtestingV3Client = ReturnType<typeof createAbtestingV3Client>;\n"],"mappings":"AAEO,SAASA,GAA+BC,EAA4C,CACzF,IAAIC,EAEEC,EAAe,qBAAqBF,EAAQ,GAAG,GAErD,SAASG,GAAsB,CAC7B,OAAIF,IAAY,SACdA,EAAUD,EAAQ,cAAgB,OAAO,cAGpCC,CACT,CAEA,SAASG,GAA+C,CACtD,OAAO,KAAK,MAAMD,EAAW,EAAE,QAAQD,CAAY,GAAK,IAAI,CAC9D,CAEA,SAASG,EAAaC,EAAsC,CAC1DH,EAAW,EAAE,QAAQD,EAAc,KAAK,UAAUI,CAAS,CAAC,CAC9D,CAEA,SAASC,GAA6B,CACpC,OAAO,IAAI,QAASC,GAAY,WAAWA,EAAS,CAAC,CAAC,CACxD,CAEA,SAASC,GAGP,CACA,IAAMC,EAAaV,EAAQ,WAAaA,EAAQ,WAAa,IAAO,KAC9DM,EAAYF,EAA2C,EACvDO,EAAc,IAAI,KAAK,EAAE,QAAQ,EACnCC,EAAU,GAsBd,MAAO,CAAE,UApBQ,OAAO,YACtB,OAAO,QAAQN,CAAS,EAAE,OAAO,CAAC,CAAC,CAAEO,CAAS,IACxC,CAACA,GAAaA,EAAU,YAAc,QAKrCH,GAIDG,EAAU,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AE,aAAc,EAAM,CAAC,EACxD,WAAYC,EAAwB,CAClC,OAAQ,CAACC,GAA+B,CAAE,IAAK,GAAGC,CAAgB,IAAIb,CAAK,EAAG,CAAC,EAAGU,EAAkB,CAAC,CACvG,CAAC,EACD,GAAGJ,CACL,CAAC,CACH","names":["createBrowserLocalStorageCache","options","storage","namespaceKey","getStorage","getNamespace","setNamespace","namespace","yieldToMain","resolve","getFilteredNamespace","timeToLive","currentTime","changed","cacheItem","key","defaultValue","events","cachedItem","value","createNullCache","_key","result","createFallbackableCache","caches","current","createMemoryCache","cache","keyAsString","promise","createAlgoliaAgent","version","algoliaAgent","options","addedAlgoliaAgent","createAuth","appId","apiKey","authMode","credentials","getAlgoliaAgent","algoliaAgents","client","version","defaultAlgoliaAgent","createAlgoliaAgent","algoliaAgent","createNullLogger","_message","_args","MAX_LINE_BUFFER_SIZE","readableStreamToAsyncIterable","stream","reader","done","value","toAsyncIterable","iterLines","decoder","buffer","bufferSize","trailingCR","isFirstLine","chunk","text","offset","crIdx","lfIdx","remaining","endIdx","skipLen","segment","line","SSEDecoder","colonIdx","field","currentEventType","event","iterSSEEvents","COMPRESSION_THRESHOLD","EXPIRATION_DELAY","createStatefulHost","host","status","lastUpdate","isUp","isTimedOut","AlgoliaError","message","name","ErrorWithStackTrace","AlgoliaError","message","stackTrace","name","correlationId","RetryError","ApiError","status","DeserializationError","response","DetailedApiError","error","serializeUrl","host","path","queryParameters","queryParametersAsString","serializeQueryParameters","url","parameters","key","serializeData","request","requestOptions","data","serializeHeaders","baseHeaders","requestHeaders","requestOptionsHeaders","headers","serializedHeaders","header","value","deserializeSuccess","response","e","DeserializationError","getCorrelationId","deserializeSuccessWithHttpInfo","getLastCorrelationId","stackTrace","i","correlationId","deserializeFailure","stackFrame","content","status","parsed","DetailedApiError","ApiError","BASE62_CHARS","REQUEST_ID_LENGTH","generateRequestId","_a","requestId","bytes","byte","isNetworkError","isTimedOut","status","isRetryable","isSuccess","stackTraceWithoutCredentials","stackTrace","stackFrame","stackFrameWithoutCredentials","modifiedHeaders","createTransporter","hosts","hostsCache","baseHeaders","logger","baseQueryParameters","algoliaAgent","timeouts","requester","requestsCache","responsesCache","compress","compression","requestIdChannel","injectRequestId","headers","queryParameters","parameter","generateRequestId","createRetryableOptions","compatibleHosts","statefulHosts","compatibleHost","createStatefulHost","hostsUp","host","hostsTimedOut","hostsAvailable","timeoutsCount","baseTimeout","retryableRequest","request","requestOptions","isRead","serializedData","serializeData","serializeHeaders","wantsCompression","COMPRESSION_THRESHOLD","shouldCompress","data","dataQueryParameters","key","retry","retryableHosts","getTimeout","RetryError","getLastCorrelationId","timeout","payload","serializeUrl","pushToStackTrace","response","deserializeFailure","options","createRequest","createRetryableRequest","deserializeSuccess","err","_","createRequestWithHttpInfo","deserializeSuccessWithHttpInfo","requestStream","stream","iterSSEEvents","validateRequired","field","method","value","parseResponseHeaders","rawHeaders","headers","line","separatorIndex","createXhrRequester","send","request","resolve","baseRequester","key","createTimeout","timeout","content","connectTimeout","responseTimeout","apiClientVersion","REGIONS","getDefaultHosts","region","createAbtestingV3Client","appIdOption","apiKeyOption","authMode","algoliaAgents","regionOption","options","auth","createAuth","transporter","createTransporter","getAlgoliaAgent","segment","version","apiKey","addABTestsRequest","requestOptions","validateRequired","request","path","parameters","body","id","estimateABTestRequest","startDate","endDate","metric","requestPath","headers","queryParameters","offset","limit","indexPrefix","indexSuffix","direction","abtestingV3Client","appId","apiKey","region","options","REGIONS","_compression","browserOptions","createAbtestingV3Client","createNullLogger","c","createMemoryCache","createFallbackableCache","createBrowserLocalStorageCache","apiClientVersion"]}
|
|
1
|
+
{"version":3,"sources":["../../../client-common/src/cache/createBrowserLocalStorageCache.ts","../../../client-common/src/cache/createNullCache.ts","../../../client-common/src/cache/createFallbackableCache.ts","../../../client-common/src/cache/createMemoryCache.ts","../../../client-common/src/constants.ts","../../../client-common/src/createAlgoliaAgent.ts","../../../client-common/src/createAuth.ts","../../../client-common/src/createIterablePromise.ts","../../../client-common/src/getAlgoliaAgent.ts","../../../client-common/src/logger/createNullLogger.ts","../../../client-common/src/logger/logWarning.ts","../../../client-common/src/sse.ts","../../../client-common/src/transporter/compress.ts","../../../client-common/src/transporter/createStatefulHost.ts","../../../client-common/src/transporter/errors.ts","../../../client-common/src/transporter/helpers.ts","../../../client-common/src/transporter/requestId.ts","../../../client-common/src/transporter/responses.ts","../../../client-common/src/transporter/stackTrace.ts","../../../client-common/src/transporter/createTransporter.ts","../../../client-common/src/types/logger.ts","../../../client-common/src/validateParam.ts","../../../requester-browser-xhr/src/createXhrRequester.ts","../../src/abtestingV3Client.ts","../../builds/browser.ts"],"sourcesContent":["import type { BrowserLocalStorageCacheItem, BrowserLocalStorageOptions, Cache, CacheEvents } from '../types';\n\nexport function createBrowserLocalStorageCache(options: BrowserLocalStorageOptions): Cache {\n let storage: Storage;\n // We've changed the namespace to avoid conflicts with v4, as this version is a huge breaking change\n const namespaceKey = `algolia-client-js-${options.key}`;\n\n function getStorage(): Storage {\n if (storage === undefined) {\n storage = options.localStorage || window.localStorage;\n }\n\n return storage;\n }\n\n function getNamespace<TValue>(): Record<string, TValue> {\n return JSON.parse(getStorage().getItem(namespaceKey) || '{}');\n }\n\n function setNamespace(namespace: Record<string, any>): void {\n getStorage().setItem(namespaceKey, JSON.stringify(namespace));\n }\n\n function yieldToMain(): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, 0));\n }\n\n function getFilteredNamespace(): {\n namespace: Record<string, BrowserLocalStorageCacheItem>;\n changed: boolean;\n } {\n const timeToLive = options.timeToLive ? options.timeToLive * 1000 : null;\n const namespace = getNamespace<BrowserLocalStorageCacheItem>();\n const currentTime = new Date().getTime();\n let changed = false;\n\n const filtered = Object.fromEntries(\n Object.entries(namespace).filter(([, cacheItem]) => {\n if (!cacheItem || cacheItem.timestamp === undefined) {\n changed = true;\n return false;\n }\n\n if (!timeToLive) {\n return true;\n }\n\n if (cacheItem.timestamp + timeToLive < currentTime) {\n changed = true;\n return false;\n }\n\n return true;\n }),\n );\n\n return { namespace: filtered, changed };\n }\n\n return {\n get<TValue>(\n key: Record<string, any> | string,\n defaultValue: () => Promise<TValue>,\n events: CacheEvents<TValue> = {\n miss: () => Promise.resolve(),\n },\n ): Promise<TValue> {\n return yieldToMain().then(() => {\n const { namespace, changed } = getFilteredNamespace();\n const cachedItem = namespace[JSON.stringify(key)];\n\n if (changed) {\n setNamespace(namespace);\n }\n\n if (cachedItem) {\n return cachedItem.value as TValue;\n }\n\n return defaultValue().then((value) => events.miss(value).then(() => value));\n });\n },\n\n set<TValue>(key: Record<string, any> | string, value: TValue): Promise<TValue> {\n return yieldToMain().then(() => {\n const namespace = getNamespace();\n\n namespace[JSON.stringify(key)] = {\n timestamp: new Date().getTime(),\n value,\n };\n\n getStorage().setItem(namespaceKey, JSON.stringify(namespace));\n\n return value;\n });\n },\n\n delete(key: Record<string, any> | string): Promise<void> {\n return yieldToMain().then(() => {\n const namespace = getNamespace();\n\n delete namespace[JSON.stringify(key)];\n\n getStorage().setItem(namespaceKey, JSON.stringify(namespace));\n });\n },\n\n clear(): Promise<void> {\n return Promise.resolve().then(() => {\n getStorage().removeItem(namespaceKey);\n });\n },\n };\n}\n","import type { Cache, CacheEvents } from '../types';\n\nexport function createNullCache(): Cache {\n return {\n get<TValue>(\n _key: Record<string, any> | string,\n defaultValue: () => Promise<TValue>,\n events: CacheEvents<TValue> = {\n miss: (): Promise<void> => Promise.resolve(),\n },\n ): Promise<TValue> {\n const value = defaultValue();\n\n return value.then((result) => Promise.all([result, events.miss(result)])).then(([result]) => result);\n },\n\n set<TValue>(_key: Record<string, any> | string, value: TValue): Promise<TValue> {\n return Promise.resolve(value);\n },\n\n delete(_key: Record<string, any> | string): Promise<void> {\n return Promise.resolve();\n },\n\n clear(): Promise<void> {\n return Promise.resolve();\n },\n };\n}\n","import type { Cache, CacheEvents, FallbackableCacheOptions } from '../types';\nimport { createNullCache } from './createNullCache';\n\nexport function createFallbackableCache(options: FallbackableCacheOptions): Cache {\n const caches = [...options.caches];\n const current = caches.shift();\n\n if (current === undefined) {\n return createNullCache();\n }\n\n return {\n get<TValue>(\n key: Record<string, any> | string,\n defaultValue: () => Promise<TValue>,\n events: CacheEvents<TValue> = {\n miss: (): Promise<void> => Promise.resolve(),\n },\n ): Promise<TValue> {\n return current.get(key, defaultValue, events).catch(() => {\n return createFallbackableCache({ caches }).get(key, defaultValue, events);\n });\n },\n\n set<TValue>(key: Record<string, any> | string, value: TValue): Promise<TValue> {\n return current.set(key, value).catch(() => {\n return createFallbackableCache({ caches }).set(key, value);\n });\n },\n\n delete(key: Record<string, any> | string): Promise<void> {\n return current.delete(key).catch(() => {\n return createFallbackableCache({ caches }).delete(key);\n });\n },\n\n clear(): Promise<void> {\n return current.clear().catch(() => {\n return createFallbackableCache({ caches }).clear();\n });\n },\n };\n}\n","import type { Cache, CacheEvents, MemoryCacheOptions } from '../types';\n\nexport function createMemoryCache(options: MemoryCacheOptions = { serializable: true }): Cache {\n let cache: Record<string, any> = {};\n\n return {\n get<TValue>(\n key: Record<string, any> | string,\n defaultValue: () => Promise<TValue>,\n events: CacheEvents<TValue> = {\n miss: (): Promise<void> => Promise.resolve(),\n },\n ): Promise<TValue> {\n const keyAsString = JSON.stringify(key);\n\n if (keyAsString in cache) {\n return Promise.resolve(options.serializable ? JSON.parse(cache[keyAsString]) : cache[keyAsString]);\n }\n\n const promise = defaultValue();\n\n return promise.then((value: TValue) => events.miss(value)).then(() => promise);\n },\n\n set<TValue>(key: Record<string, any> | string, value: TValue): Promise<TValue> {\n cache[JSON.stringify(key)] = options.serializable ? JSON.stringify(value) : value;\n\n return Promise.resolve(value);\n },\n\n delete(key: Record<string, unknown> | string): Promise<void> {\n delete cache[JSON.stringify(key)];\n\n return Promise.resolve();\n },\n\n clear(): Promise<void> {\n cache = {};\n\n return Promise.resolve();\n },\n };\n}\n","export const DEFAULT_CONNECT_TIMEOUT_BROWSER = 1000;\nexport const DEFAULT_READ_TIMEOUT_BROWSER = 2000;\nexport const DEFAULT_WRITE_TIMEOUT_BROWSER = 30000;\n\nexport const DEFAULT_CONNECT_TIMEOUT_NODE = 2000;\nexport const DEFAULT_READ_TIMEOUT_NODE = 5000;\nexport const DEFAULT_WRITE_TIMEOUT_NODE = 30000;\n\nexport const DEFAULT_REPLACE_ALL_OBJECTS_MAX_RETRIES = 800;\n","import type { AlgoliaAgent, AlgoliaAgentOptions } from './types';\n\nexport function createAlgoliaAgent(version: string): AlgoliaAgent {\n const algoliaAgent = {\n value: `Algolia for JavaScript (${version})`,\n add(options: AlgoliaAgentOptions): AlgoliaAgent {\n const addedAlgoliaAgent = `; ${options.segment}${options.version !== undefined ? ` (${options.version})` : ''}`;\n\n if (algoliaAgent.value.indexOf(addedAlgoliaAgent) === -1) {\n algoliaAgent.value = `${algoliaAgent.value}${addedAlgoliaAgent}`;\n }\n\n return algoliaAgent;\n },\n };\n\n return algoliaAgent;\n}\n","import type { AuthMode, Headers, QueryParameters } from './types';\n\nexport function createAuth(\n appId: string,\n apiKey: string,\n authMode: AuthMode = 'WithinHeaders',\n): {\n readonly headers: () => Headers;\n readonly queryParameters: () => QueryParameters;\n} {\n const credentials = {\n 'x-algolia-api-key': apiKey,\n 'x-algolia-application-id': appId,\n };\n\n return {\n headers(): Headers {\n return authMode === 'WithinHeaders' ? credentials : {};\n },\n\n queryParameters(): QueryParameters {\n return authMode === 'WithinQueryParameters' ? credentials : {};\n },\n };\n}\n","import type { CreateIterablePromise } from './types/createIterablePromise';\n\n/**\n * Helper: Returns the promise of a given `func` to iterate on, based on a given `validate` condition.\n *\n * @param createIterator - The createIterator options.\n * @param createIterator.func - The function to run, which returns a promise.\n * @param createIterator.validate - The validator function. It receives the resolved return of `func`.\n * @param createIterator.aggregator - The function that runs right after the `func` method has been executed, allows you to do anything with the response before `validate`.\n * @param createIterator.error - The `validate` condition to throw an error, and its message.\n * @param createIterator.timeout - The function to decide how long to wait between iterations.\n */\nexport function createIterablePromise<TResponse>({\n func,\n validate,\n aggregator,\n error,\n timeout = (): number => 0,\n}: CreateIterablePromise<TResponse>): Promise<TResponse> {\n const retry = (previousResponse?: TResponse | undefined): Promise<TResponse> => {\n return new Promise<TResponse>((resolve, reject) => {\n func(previousResponse)\n .then(async (response) => {\n if (aggregator) {\n await aggregator(response);\n }\n\n if (await validate(response)) {\n return resolve(response);\n }\n\n if (error && (await error.validate(response))) {\n return reject(new Error(await error.message(response)));\n }\n\n return setTimeout(\n () => {\n retry(response).then(resolve).catch(reject);\n },\n await timeout(),\n );\n })\n .catch((err) => {\n reject(err);\n });\n });\n };\n\n return retry();\n}\n","import { createAlgoliaAgent } from './createAlgoliaAgent';\nimport type { AlgoliaAgent, AlgoliaAgentOptions } from './types';\n\nexport type GetAlgoliaAgent = {\n algoliaAgents: AlgoliaAgentOptions[];\n client: string;\n version: string;\n};\n\nexport function getAlgoliaAgent({ algoliaAgents, client, version }: GetAlgoliaAgent): AlgoliaAgent {\n const defaultAlgoliaAgent = createAlgoliaAgent(version).add({\n segment: client,\n version,\n });\n\n algoliaAgents.forEach((algoliaAgent) => defaultAlgoliaAgent.add(algoliaAgent));\n\n return defaultAlgoliaAgent;\n}\n","import type { Logger } from '../types/logger';\n\nexport function createNullLogger(): Logger {\n return {\n debug(_message: string, _args?: any | undefined): Promise<void> {\n return Promise.resolve();\n },\n info(_message: string, _args?: any | undefined): Promise<void> {\n return Promise.resolve();\n },\n error(_message: string, _args?: any | undefined): Promise<void> {\n return Promise.resolve();\n },\n };\n}\n","import type { Logger } from '../types';\n\n/**\n * Prefers the logger's optional `warn` method and falls back to `console.warn`, so warnings stay visible with the default no-op logger.\n */\nexport function logWarning(logger: Logger, message: string): void {\n if (logger.warn) {\n // a rejecting custom `warn` must not become a fatal unhandled rejection\n void Promise.resolve(logger.warn(message)).catch(() => {});\n } else {\n console.warn(message);\n }\n}\n","/**\n * WHATWG-compliant Server-Sent Events parser.\n *\n * Three-layer architecture:\n * 1. iterLines() — byte chunking → line decoding\n * 2. SSEDecoder — line → SSE event decoding\n * 3. iterSSEEvents — top-level composer (exported)\n *\n * @see https://html.spec.whatwg.org/multipage/server-sent-events.html#event-stream-interpretation\n */\n\nconst MAX_LINE_BUFFER_SIZE = 10 * 1024 * 1024; // 10MB\n\n// ─── Types ──────────────────────────────────────────────────────────────────\n\nexport type ServerSentEvent = {\n /** Concatenated data: field values, joined by '\\n'. */\n data: string;\n /** Event type from the event: field. Defaults to \"\" (empty string). */\n event: string;\n /** Last event ID. Persists across dispatches until changed. */\n id: string | null;\n /** Reconnection time in ms. Persists across dispatches until changed. */\n retry: number | null;\n};\n\n/**\n * Wrapper for a parsed SSE event, yielded by the typed `*Stream` methods.\n *\n * - `data` is the JSON-parsed payload when parsing succeeds, `null` otherwise.\n * - `raw` is the original {@link ServerSentEvent} (always present).\n * - `error` is set when JSON parsing of `event.data` failed.\n */\nexport type StreamEvent<T = Record<string, unknown>> = {\n /** Parsed data from the event, or `null` if parsing failed. */\n data: T | null;\n /** The original, unparsed SSE event. */\n raw: ServerSentEvent;\n /** The error that occurred while parsing `event.data`, if any. */\n error?: Error;\n};\n\n// ─── Helpers ────────────────────────────────────────────────────────────────\n\n/**\n * Converts a ReadableStream into an AsyncIterable via getReader().\n * Fallback for environments where ReadableStream lacks Symbol.asyncIterator.\n */\nasync function* readableStreamToAsyncIterable(stream: ReadableStream<Uint8Array>): AsyncGenerator<Uint8Array> {\n const reader = stream.getReader();\n try {\n while (true) {\n const { done, value } = await reader.read();\n if (done) return;\n yield value;\n }\n } finally {\n reader.releaseLock();\n }\n}\n\n/**\n * Normalizes the input to an AsyncIterable<Uint8Array>.\n * Prefers Symbol.asyncIterator if available; falls back to getReader().\n */\nfunction toAsyncIterable(stream: ReadableStream<Uint8Array> | AsyncIterable<Uint8Array>): AsyncIterable<Uint8Array> {\n if (Symbol.asyncIterator in stream) {\n return stream as AsyncIterable<Uint8Array>;\n }\n return readableStreamToAsyncIterable(stream as ReadableStream<Uint8Array>);\n}\n\n// ─── Layer 1: Byte stream → Lines ──────────────────────────────────────────\n\n/**\n * Yields individual lines from a byte stream.\n *\n * Handles \\r, \\n, and \\r\\n line endings, including \\r\\n split across chunks.\n * Uses offset tracking within each decoded chunk to avoid O(n²) buffer growth.\n * Strips BOM (U+FEFF) from the very first line.\n * Throws if the internal line buffer exceeds 10MB.\n */\nasync function* iterLines(stream: ReadableStream<Uint8Array> | AsyncIterable<Uint8Array>): AsyncGenerator<string> {\n const decoder = new TextDecoder('utf-8');\n const buffer: string[] = [];\n let bufferSize = 0;\n let trailingCR = false;\n let isFirstLine = true;\n\n for await (const chunk of toAsyncIterable(stream)) {\n const text = decoder.decode(chunk, { stream: true });\n let offset = 0;\n\n // Handle \\r\\n split across chunks: if the previous chunk ended with \\r\n // and this one starts with \\n, skip the \\n (it's the second half of \\r\\n)\n if (trailingCR) {\n trailingCR = false;\n if (text.length > 0 && text[0] === '\\n') {\n offset = 1;\n }\n }\n\n while (offset < text.length) {\n const crIdx = text.indexOf('\\r', offset);\n const lfIdx = text.indexOf('\\n', offset);\n\n // No more line endings in this chunk — buffer the rest\n if (crIdx === -1 && lfIdx === -1) {\n const remaining = text.slice(offset);\n buffer.push(remaining);\n bufferSize += remaining.length;\n if (bufferSize > MAX_LINE_BUFFER_SIZE) {\n throw new Error('SSE line buffer exceeded 10MB');\n }\n break;\n }\n\n let endIdx: number;\n let skipLen: number;\n\n if (crIdx !== -1 && (lfIdx === -1 || crIdx < lfIdx)) {\n // \\r found before \\n (or no \\n at all)\n endIdx = crIdx;\n if (crIdx + 1 < text.length) {\n // Peek ahead: \\r\\n or bare \\r\n skipLen = text[crIdx + 1] === '\\n' ? 2 : 1;\n } else {\n // \\r at end of chunk — might be \\r\\n split across chunks\n trailingCR = true;\n skipLen = 1;\n }\n } else {\n // \\n found before \\r (or no \\r at all)\n // Safe: at least one of crIdx/lfIdx is != -1, and we're in the else\n // branch, so lfIdx must be != -1\n endIdx = lfIdx;\n skipLen = 1;\n }\n\n const segment = text.slice(offset, endIdx);\n buffer.push(segment);\n\n let line = buffer.length === 1 ? buffer[0]! : buffer.join('');\n buffer.length = 0;\n bufferSize = 0;\n\n // Strip BOM from the very first line only\n if (isFirstLine) {\n if (line.startsWith('\\uFEFF')) {\n line = line.slice(1);\n }\n isFirstLine = false;\n }\n\n yield line;\n offset = endIdx + skipLen;\n }\n }\n\n // Flush TextDecoder (handles any remaining bytes from multi-byte sequences)\n const remaining = decoder.decode();\n if (remaining) {\n buffer.push(remaining);\n }\n\n // Yield any remaining buffered content as the final line\n if (buffer.length > 0) {\n let line = buffer.join('');\n if (isFirstLine && line.startsWith('\\uFEFF')) {\n line = line.slice(1);\n }\n yield line;\n }\n}\n\n// ─── Layer 2: Lines → SSE Events ──────────────────────────────────────────\n\n/**\n * Stateful SSE event decoder. Feed lines one at a time via decode().\n * Returns a ServerSentEvent on blank lines (dispatch), null otherwise.\n *\n * Per WHATWG spec §9.2.6:\n * - lastEventId persists across dispatches\n * - retry persists across dispatches (global reconnection setting)\n * - eventType resets after every blank line (even when data is empty)\n * - data buffer resets after dispatch\n * - id field containing NULL (\\0) is ignored entirely\n * - retry field must be ASCII digits only\n */\nclass SSEDecoder {\n private data: string[] = [];\n private eventType = '';\n private lastEventId: string | null = null;\n private retry: number | null = null;\n\n decode(line: string): ServerSentEvent | null {\n // Blank line → dispatch event or reset\n if (line === '') {\n return this.dispatch();\n }\n\n // Comment line (starts with ':')\n if (line[0] === ':') {\n return null;\n }\n\n // Parse field:value\n const colonIdx = line.indexOf(':');\n let field: string;\n let value: string;\n\n if (colonIdx === -1) {\n // No colon → field is entire line, value is empty\n field = line;\n value = '';\n } else {\n field = line.slice(0, colonIdx);\n value = line.slice(colonIdx + 1);\n // Strip exactly ONE leading space (if present)\n if (value[0] === ' ') {\n value = value.slice(1);\n }\n }\n\n switch (field) {\n case 'data':\n this.data.push(value);\n break;\n case 'event':\n this.eventType = value;\n break;\n case 'id':\n // Ignore if value contains NULL character (security: WHATWG spec)\n if (!value.includes('\\0')) {\n this.lastEventId = value;\n }\n break;\n case 'retry':\n // Must consist of ASCII digits only (no negatives, no whitespace)\n if (/^[0-9]+$/.test(value)) {\n this.retry = parseInt(value, 10);\n }\n break;\n // Unknown fields: ignore silently\n }\n\n return null;\n }\n\n private dispatch(): ServerSentEvent | null {\n // eventType resets on every blank line per WHATWG spec,\n // regardless of whether we actually dispatch an event\n const currentEventType = this.eventType;\n this.eventType = '';\n\n // Suppress dispatch when no data: lines were received\n if (this.data.length === 0) {\n return null;\n }\n\n const event: ServerSentEvent = {\n data: this.data.join('\\n'),\n event: currentEventType,\n id: this.lastEventId,\n retry: this.retry,\n };\n\n // Reset data buffer; lastEventId and retry persist across dispatches\n this.data = [];\n\n return event;\n }\n}\n\n// ─── Layer 3: Top-level composer ──────────────────────────────────────────\n\n/**\n * Parses a byte stream as WHATWG Server-Sent Events.\n *\n * Accepts both ReadableStream<Uint8Array> (browser fetch) and\n * AsyncIterable<Uint8Array> (Node.js streams / Buffer chunks).\n *\n * @example\n * ```ts\n * const response = await fetch(url);\n * for await (const event of iterSSEEvents(response.body!)) {\n * console.log(event.event, event.data);\n * }\n * ```\n */\nexport async function* iterSSEEvents(\n stream: ReadableStream<Uint8Array> | AsyncIterable<Uint8Array>,\n): AsyncGenerator<ServerSentEvent> {\n const decoder = new SSEDecoder();\n for await (const line of iterLines(stream)) {\n const event = decoder.decode(line);\n if (event !== null) {\n yield event;\n }\n }\n}\n","export const COMPRESSION_THRESHOLD = 750;\n","import type { Host, StatefulHost } from '../types';\n\n// By default, API Clients at Algolia have expiration delay of 5 mins.\n// In the JavaScript client, we have 2 mins.\nconst EXPIRATION_DELAY = 2 * 60 * 1000;\n\nexport function createStatefulHost(host: Host, status: StatefulHost['status'] = 'up'): StatefulHost {\n const lastUpdate = Date.now();\n\n function isUp(): boolean {\n return status === 'up' || Date.now() - lastUpdate > EXPIRATION_DELAY;\n }\n\n function isTimedOut(): boolean {\n return status === 'timed out' && Date.now() - lastUpdate <= EXPIRATION_DELAY;\n }\n\n return { ...host, status, lastUpdate, isUp, isTimedOut };\n}\n","import type { Headers, Response, StackFrame } from '../types';\n\nexport class AlgoliaError extends Error {\n override name: string = 'AlgoliaError';\n\n constructor(message: string, name: string) {\n super(message);\n\n if (name) {\n this.name = name;\n }\n }\n}\n\nexport class IndexNotFoundError extends AlgoliaError {\n constructor(indexName: string) {\n super(`${indexName} does not exist`, 'IndexNotFoundError');\n }\n}\n\nexport class IndicesInSameAppError extends AlgoliaError {\n constructor() {\n super('Indices are in the same application. Use operationIndex instead.', 'IndicesInSameAppError');\n }\n}\n\nexport class IndexAlreadyExistsError extends AlgoliaError {\n constructor(indexName: string) {\n super(`${indexName} index already exists.`, 'IndexAlreadyExistsError');\n }\n}\n\nexport class ErrorWithStackTrace extends AlgoliaError {\n stackTrace: StackFrame[];\n\n correlationId?: string | undefined;\n\n constructor(message: string, stackTrace: StackFrame[], name: string, correlationId?: string | undefined) {\n super(correlationId ? `${message} (Correlation-ID: ${correlationId})` : message, name);\n // the array and object should be frozen to reflect the stackTrace at the time of the error\n this.stackTrace = stackTrace;\n this.correlationId = correlationId;\n }\n}\n\nexport class RetryError extends ErrorWithStackTrace {\n constructor(stackTrace: StackFrame[], correlationId?: string | undefined) {\n super(\n 'Unreachable hosts - your application id may be incorrect. If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support',\n stackTrace,\n 'RetryError',\n correlationId,\n );\n }\n}\n\nexport class ApiError extends ErrorWithStackTrace {\n status: number;\n\n constructor(\n message: string,\n status: number,\n stackTrace: StackFrame[],\n name = 'ApiError',\n correlationId?: string | undefined,\n ) {\n super(message, stackTrace, name, correlationId);\n this.status = status;\n }\n}\n\n/**\n * Thrown by `sendStream` when the HTTP status is not 2xx, so `requestStream` can\n * wait and retry on 429 using `Retry-After` without parsing the error message.\n */\nexport class StreamRequestError extends AlgoliaError {\n status: number;\n\n headers?: Headers | undefined;\n\n constructor(status: number, body: string, headers?: Headers | undefined) {\n super(`HTTP ${status}: ${body}`, 'StreamRequestError');\n this.status = status;\n this.headers = headers;\n }\n}\n\nexport class DeserializationError extends AlgoliaError {\n response: Response;\n\n correlationId?: string | undefined;\n\n constructor(message: string, response: Response, correlationId?: string | undefined) {\n super(correlationId ? `${message} (Correlation-ID: ${correlationId})` : message, 'DeserializationError');\n this.response = response;\n this.correlationId = correlationId;\n }\n}\n\nexport type DetailedErrorWithMessage = {\n message: string;\n label: string;\n};\n\nexport type DetailedErrorWithTypeID = {\n id: string;\n type: string;\n name?: string | undefined;\n};\n\nexport type DetailedError = {\n code: string;\n details?: DetailedErrorWithMessage[] | DetailedErrorWithTypeID[] | undefined;\n};\n\n// DetailedApiError is only used by the ingestion client to return more informative error, other clients will use ApiClient.\nexport class DetailedApiError extends ApiError {\n error: DetailedError;\n\n constructor(\n message: string,\n status: number,\n error: DetailedError,\n stackTrace: StackFrame[],\n correlationId?: string | undefined,\n ) {\n super(message, status, stackTrace, 'DetailedApiError', correlationId);\n this.error = error;\n }\n}\n","import type {\n AlgoliaHttpResponse,\n Headers,\n Host,\n QueryParameters,\n Request,\n RequestOptions,\n Response,\n StackFrame,\n} from '../types';\nimport { ApiError, DeserializationError, DetailedApiError } from './errors';\n\nexport function shuffle<TData>(array: TData[]): TData[] {\n const shuffledArray = array;\n\n for (let c = array.length - 1; c > 0; c--) {\n const b = Math.floor(Math.random() * (c + 1));\n const a = array[c];\n\n shuffledArray[c] = array[b];\n shuffledArray[b] = a;\n }\n\n return shuffledArray;\n}\n\nexport function serializeUrl(host: Host, path: string, queryParameters: QueryParameters): string {\n const queryParametersAsString = serializeQueryParameters(queryParameters);\n let url = `${host.protocol}://${host.url}${host.port ? `:${host.port}` : ''}/${\n path.charAt(0) === '/' ? path.substring(1) : path\n }`;\n\n if (queryParametersAsString.length) {\n url += `?${queryParametersAsString}`;\n }\n\n return url;\n}\n\nexport function serializeQueryParameters(parameters: QueryParameters): string {\n return Object.keys(parameters)\n .filter((key) => parameters[key] !== undefined)\n .sort()\n .map(\n (key) =>\n `${key}=${encodeURIComponent(\n Object.prototype.toString.call(parameters[key]) === '[object Array]'\n ? parameters[key].join(',')\n : parameters[key],\n ).replace(/\\+/g, '%20')}`,\n )\n .join('&');\n}\n\nexport function serializeData(request: Request, requestOptions: RequestOptions): string | undefined {\n if (request.method === 'GET' || (request.data === undefined && requestOptions.data === undefined)) {\n return undefined;\n }\n\n const data = Array.isArray(request.data) ? request.data : { ...request.data, ...requestOptions.data };\n\n return JSON.stringify(data);\n}\n\nexport function serializeHeaders(\n baseHeaders: Headers,\n requestHeaders: Headers,\n requestOptionsHeaders?: Headers | undefined,\n): Headers {\n const headers: Headers = {\n Accept: 'application/json',\n ...baseHeaders,\n ...requestHeaders,\n ...requestOptionsHeaders,\n };\n const serializedHeaders: Headers = {};\n\n Object.keys(headers).forEach((header) => {\n const value = headers[header];\n serializedHeaders[header.toLowerCase()] = value;\n });\n\n return serializedHeaders;\n}\n\nexport function deserializeSuccess<TObject>(response: Response): TObject {\n // Handle 204 No Content and other empty responses\n if (response.status === 204 || response.content.length === 0) {\n return undefined as unknown as TObject;\n }\n\n try {\n return JSON.parse(response.content);\n } catch (e) {\n throw new DeserializationError((e as Error).message, response, getCorrelationId(response.headers));\n }\n}\n\nexport function deserializeSuccessWithHttpInfo<TData>(response: Response): AlgoliaHttpResponse<TData> {\n return {\n status: response.status,\n headers: response.headers,\n content: response.content,\n data: deserializeSuccess<TData>(response),\n };\n}\n\nexport function getCorrelationId(headers: Headers | undefined): string | undefined {\n if (!headers) {\n return undefined;\n }\n\n if (headers['correlation-id'] !== undefined) {\n return headers['correlation-id'];\n }\n\n const header = Object.keys(headers).find((key) => key.toLowerCase() === 'correlation-id');\n\n return header === undefined ? undefined : headers[header];\n}\n\nexport function getLastCorrelationId(stackTrace: StackFrame[]): string | undefined {\n for (let i = stackTrace.length - 1; i >= 0; i--) {\n const correlationId = getCorrelationId(stackTrace[i].response.headers);\n if (correlationId !== undefined) {\n return correlationId;\n }\n }\n\n return undefined;\n}\n\nexport function deserializeFailure(response: Response, stackFrame: StackFrame[]): Error {\n const { content, status } = response;\n const correlationId = getCorrelationId(response.headers);\n try {\n const parsed = JSON.parse(content);\n if ('error' in parsed) {\n return new DetailedApiError(parsed.message, status, parsed.error, stackFrame, correlationId);\n }\n return new ApiError(parsed.message, status, stackFrame, 'ApiError', correlationId);\n } catch {\n // ..\n }\n return new ApiError(content, status, stackFrame, 'ApiError', correlationId);\n}\n","import type { Headers, QueryParameters, RequestOptions, Transporter } from '../types';\n\nconst BASE62_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\nconst REQUEST_ID_LENGTH = 11;\n\nexport function generateRequestId(): string {\n let requestId = '';\n\n if (typeof globalThis.crypto?.getRandomValues === 'function') {\n const bytes = new Uint8Array(REQUEST_ID_LENGTH);\n globalThis.crypto.getRandomValues(bytes);\n for (const byte of bytes) {\n requestId += BASE62_CHARS[byte % BASE62_CHARS.length];\n }\n\n return requestId;\n }\n\n for (let i = 0; i < REQUEST_ID_LENGTH; i++) {\n requestId += BASE62_CHARS[Math.floor(Math.random() * BASE62_CHARS.length)];\n }\n\n return requestId;\n}\n\nfunction hasRequestId(headers: Headers | undefined, queryParameters: QueryParameters | undefined): boolean {\n return (\n (headers !== undefined && Object.keys(headers).some((header) => header.toLowerCase() === 'request-id')) ||\n (queryParameters !== undefined &&\n Object.keys(queryParameters).some((parameter) => parameter.toLowerCase() === 'x-algolia-request-id'))\n );\n}\n\n/**\n * Returns request options carrying a Request-ID on the transporter's channel, so that every\n * request a multi-request helper performs shares the same ID. Returns the options unchanged\n * when the channel is off or when a Request-ID is already supplied. Never apply ahead of a\n * cacheable operation: the ID enters the cache key and defeats caching and deduplication.\n */\nexport function withRequestId(\n transporter: Pick<Transporter, 'requestIdChannel' | 'baseHeaders' | 'baseQueryParameters'>,\n requestOptions?: RequestOptions | undefined,\n): RequestOptions | undefined {\n if (\n transporter.requestIdChannel === undefined ||\n hasRequestId(transporter.baseHeaders, transporter.baseQueryParameters) ||\n hasRequestId(requestOptions?.headers, requestOptions?.queryParameters)\n ) {\n return requestOptions;\n }\n\n if (transporter.requestIdChannel === 'headers') {\n return { ...requestOptions, headers: { ...requestOptions?.headers, 'request-id': generateRequestId() } };\n }\n\n return {\n ...requestOptions,\n queryParameters: { ...requestOptions?.queryParameters, 'x-algolia-request-id': generateRequestId() },\n };\n}\n","import type { Headers, Response } from '../types';\n\nconst DEFAULT_RATE_LIMIT_WAIT_MS = 1000;\n\nexport function isNetworkError({ isTimedOut, status }: Omit<Response, 'content'>): boolean {\n return !isTimedOut && ~~status === 0;\n}\n\nexport function isRetryable({ isTimedOut, status }: Omit<Response, 'content'>): boolean {\n return isTimedOut || isNetworkError({ isTimedOut, status }) || (~~(status / 100) !== 2 && ~~(status / 100) !== 4);\n}\n\nexport function isSuccess({ status }: Pick<Response, 'status'>): boolean {\n return ~~(status / 100) === 2;\n}\n\nexport function isRateLimited({ status }: Pick<Response, 'status'>): boolean {\n return ~~status === 429;\n}\n\nconst HTTP_429_MESSAGE = /^HTTP 429(?:\\D|$)/;\n\n/**\n * 429 from `sendStream`: a status-bearing error, or the `HTTP 429:` string requesters used to throw.\n */\nexport function isRateLimitedError(error: unknown): boolean {\n if (typeof error === 'object' && error !== null && 'status' in error) {\n return isRateLimited(error as Pick<Response, 'status'>);\n }\n\n return error instanceof Error && HTTP_429_MESSAGE.test(error.message);\n}\n\nexport function headersFromError(error: unknown): Headers | undefined {\n if (typeof error === 'object' && error !== null && 'headers' in error) {\n return (error as { headers?: Headers }).headers;\n }\n\n return undefined;\n}\n\n/**\n * `Retry-After` as a wait in milliseconds.\n * Only a positive whole-number-of-seconds string is honored; anything else (missing, `0`, HTTP-date, junk) waits 1s.\n */\nexport function parseRetryAfterMs(headers: Headers | undefined): number {\n const raw = headers?.['retry-after']?.trim();\n if (raw === undefined || raw.length === 0) {\n return DEFAULT_RATE_LIMIT_WAIT_MS;\n }\n\n if (!/^\\d+$/.test(raw)) {\n return DEFAULT_RATE_LIMIT_WAIT_MS;\n }\n\n const seconds = Number.parseInt(raw, 10);\n if (seconds <= 0) {\n return DEFAULT_RATE_LIMIT_WAIT_MS;\n }\n\n return seconds * 1000;\n}\n","import type { Headers, StackFrame } from '../types';\n\nexport function stackTraceWithoutCredentials(stackTrace: StackFrame[]): StackFrame[] {\n return stackTrace.map((stackFrame) => stackFrameWithoutCredentials(stackFrame));\n}\n\nexport function stackFrameWithoutCredentials(stackFrame: StackFrame): StackFrame {\n const modifiedHeaders: Headers = stackFrame.request.headers['x-algolia-api-key']\n ? { 'x-algolia-api-key': '*****' }\n : {};\n\n return {\n ...stackFrame,\n request: {\n ...stackFrame.request,\n headers: {\n ...stackFrame.request.headers,\n ...modifiedHeaders,\n },\n },\n };\n}\n","import type { ServerSentEvent } from '../sse';\nimport { iterSSEEvents } from '../sse';\nimport type {\n AlgoliaHttpResponse,\n EndRequest,\n Headers,\n Host,\n QueryParameters,\n Request,\n RequestOptions,\n Response,\n StackFrame,\n TransporterOptions,\n TransporterWithHttpInfo,\n} from '../types';\nimport { COMPRESSION_THRESHOLD } from './compress';\nimport { createStatefulHost } from './createStatefulHost';\nimport { RetryError } from './errors';\nimport {\n deserializeFailure,\n deserializeSuccess,\n deserializeSuccessWithHttpInfo,\n getLastCorrelationId,\n serializeData,\n serializeHeaders,\n serializeUrl,\n} from './helpers';\nimport { generateRequestId } from './requestId';\nimport {\n headersFromError,\n isRateLimited,\n isRateLimitedError,\n isRetryable,\n isSuccess,\n parseRetryAfterMs,\n} from './responses';\nimport { stackFrameWithoutCredentials, stackTraceWithoutCredentials } from './stackTrace';\n\ntype RetryableOptions = {\n hosts: Host[];\n getTimeout: (retryCount: number, timeout: number) => number;\n};\n\nexport function createTransporter({\n hosts,\n hostsCache,\n baseHeaders,\n logger,\n baseQueryParameters,\n algoliaAgent,\n timeouts,\n requester,\n requestsCache,\n responsesCache,\n compress,\n compression,\n requestIdChannel,\n maxRateLimitRetries = 3,\n}: TransporterOptions): TransporterWithHttpInfo {\n function injectRequestId(headers: Headers, queryParameters: QueryParameters): void {\n if (\n requestIdChannel === undefined ||\n headers['request-id'] !== undefined ||\n Object.keys(queryParameters).some((parameter) => parameter.toLowerCase() === 'x-algolia-request-id')\n ) {\n return;\n }\n\n if (requestIdChannel === 'headers') {\n headers['request-id'] = generateRequestId();\n } else {\n queryParameters['x-algolia-request-id'] = generateRequestId();\n }\n }\n\n const wait = (ms: number): Promise<void> =>\n new Promise((resolve) => {\n setTimeout(resolve, ms);\n });\n\n async function createRetryableOptions(compatibleHosts: Host[]): Promise<RetryableOptions> {\n const statefulHosts = await Promise.all(\n compatibleHosts.map((compatibleHost) => {\n return hostsCache.get(compatibleHost, () => {\n return Promise.resolve(createStatefulHost(compatibleHost));\n });\n }),\n );\n const hostsUp = statefulHosts.filter((host) => host.isUp());\n const hostsTimedOut = statefulHosts.filter((host) => host.isTimedOut());\n\n // Note, we put the hosts that previously timed out on the end of the list.\n const hostsAvailable = [...hostsUp, ...hostsTimedOut];\n const compatibleHostsAvailable = hostsAvailable.length > 0 ? hostsAvailable : compatibleHosts;\n\n return {\n hosts: compatibleHostsAvailable,\n getTimeout(timeoutsCount: number, baseTimeout: number): number {\n /**\n * Imagine that you have 4 hosts, if timeouts will increase\n * on the following way: 1 (timed out) > 4 (timed out) > 5 (200).\n *\n * Note that, the very next request, we start from the previous timeout.\n *\n * 5 (timed out) > 6 (timed out) > 7 ...\n *\n * This strategy may need to be reviewed, but is the strategy on the our\n * current v3 version.\n */\n const timeoutMultiplier =\n hostsTimedOut.length === 0 && timeoutsCount === 0 ? 1 : hostsTimedOut.length + 3 + timeoutsCount;\n\n return timeoutMultiplier * baseTimeout;\n },\n };\n }\n\n async function retryableRequest(\n request: Request,\n requestOptions: RequestOptions,\n isRead: boolean,\n ): Promise<Response> {\n const stackTrace: StackFrame[] = [];\n\n /**\n * First we prepare the payload that do not depend from hosts.\n */\n const serializedData = serializeData(request, requestOptions);\n const headers = serializeHeaders(baseHeaders, request.headers, requestOptions.headers);\n\n const wantsCompression =\n compression === 'gzip' &&\n serializedData !== undefined &&\n serializedData.length > COMPRESSION_THRESHOLD &&\n (request.method === 'POST' || request.method === 'PUT');\n\n if (wantsCompression && compress === undefined) {\n logger.info('Compression is disabled because no compress method is available.');\n }\n\n const shouldCompress = wantsCompression && compress !== undefined;\n const data = shouldCompress ? await compress(serializedData) : serializedData;\n if (shouldCompress) {\n headers['content-encoding'] = 'gzip';\n }\n\n // On `GET`, the data is proxied to query parameters.\n const dataQueryParameters: QueryParameters =\n request.method === 'GET'\n ? {\n ...request.data,\n ...requestOptions.data,\n }\n : {};\n\n const queryParameters: QueryParameters = {\n ...baseQueryParameters,\n ...request.queryParameters,\n ...dataQueryParameters,\n };\n\n if (algoliaAgent.value) {\n queryParameters['x-algolia-agent'] = algoliaAgent.value;\n }\n\n if (requestOptions && requestOptions.queryParameters) {\n for (const key of Object.keys(requestOptions.queryParameters)) {\n // We want to keep `undefined` and `null` values,\n // but also avoid stringifying `object`s, as they are\n // handled in the `serializeUrl` step right after.\n if (\n !requestOptions.queryParameters[key] ||\n Object.prototype.toString.call(requestOptions.queryParameters[key]) === '[object Object]'\n ) {\n queryParameters[key] = requestOptions.queryParameters[key];\n } else {\n queryParameters[key] = requestOptions.queryParameters[key].toString();\n }\n }\n }\n\n injectRequestId(headers, queryParameters);\n\n let timeoutsCount = 0;\n let rateLimitRetriesLeft = maxRateLimitRetries;\n\n const retry = async (\n retryableHosts: Host[],\n getTimeout: (timeoutsCount: number, timeout: number) => number,\n ): Promise<Response> => {\n /**\n * We iterate on each host, until there is no host left.\n */\n const host = retryableHosts.pop();\n if (host === undefined) {\n throw new RetryError(stackTraceWithoutCredentials(stackTrace), getLastCorrelationId(stackTrace));\n }\n\n const timeout = { ...timeouts, ...requestOptions.timeouts };\n\n const payload: EndRequest = {\n data,\n headers,\n method: request.method,\n url: serializeUrl(host, request.path, queryParameters),\n connectTimeout: getTimeout(timeoutsCount, timeout.connect),\n responseTimeout: getTimeout(timeoutsCount, isRead ? timeout.read : timeout.write),\n };\n\n /**\n * The stackFrame is pushed to the stackTrace so we\n * can have information about onRetry and onFailure\n * decisions.\n */\n const pushToStackTrace = (response: Response): StackFrame => {\n const stackFrame: StackFrame = {\n request: payload,\n response,\n host,\n triesLeft: retryableHosts.length,\n };\n\n stackTrace.push(stackFrame);\n\n return stackFrame;\n };\n\n const response = await requester.send(payload);\n\n if (isRateLimited(response) && rateLimitRetriesLeft > 0) {\n rateLimitRetriesLeft--;\n retryableHosts.push(host);\n const stackFrame = pushToStackTrace(response);\n const waitMs = parseRetryAfterMs(response.headers);\n logger.info('Retryable failure', {\n ...stackFrameWithoutCredentials(stackFrame),\n wait: waitMs,\n rateLimitRetriesLeft,\n });\n await wait(waitMs);\n return retry(retryableHosts, getTimeout);\n }\n\n if (isRetryable(response)) {\n const stackFrame = pushToStackTrace(response);\n\n // If response is a timeout, we increase the number of timeouts so we can increase the timeout later.\n if (response.isTimedOut) {\n timeoutsCount++;\n }\n /**\n * Failures are individually sent to the logger, allowing\n * the end user to debug / store stack frames even\n * when a retry error does not happen.\n */\n logger.info('Retryable failure', stackFrameWithoutCredentials(stackFrame));\n\n /**\n * We also store the state of the host in failure cases. If the host, is\n * down it will remain down for the next 2 minutes. In a timeout situation,\n * this host will be added end of the list of hosts on the next request.\n */\n await hostsCache.set(host, createStatefulHost(host, response.isTimedOut ? 'timed out' : 'down'));\n\n return retry(retryableHosts, getTimeout);\n }\n\n if (isSuccess(response)) {\n return response;\n }\n\n pushToStackTrace(response);\n throw deserializeFailure(response, stackTrace);\n };\n\n /**\n * Finally, for each retryable host perform request until we got a non\n * retryable response. Some notes here:\n *\n * 1. The reverse here is applied so we can apply a `pop` later on => more performant.\n * 2. We also get from the retryable options a timeout multiplier that is tailored\n * for the current context.\n */\n const compatibleHosts = hosts.filter(\n (host) => host.accept === 'readWrite' || (isRead ? host.accept === 'read' : host.accept === 'write'),\n );\n const options = await createRetryableOptions(compatibleHosts);\n\n return retry([...options.hosts].reverse(), options.getTimeout);\n }\n\n function createRequest<TResponse>(request: Request, requestOptions: RequestOptions = {}): Promise<TResponse> {\n const createRetryableRequest = (): Promise<TResponse> => {\n /**\n * Then, we prepare a function factory that contains the construction of\n * the retryable request. At this point, we may *not* perform the actual\n * request. But we want to have the function factory ready.\n */\n return retryableRequest(request, requestOptions, isRead).then((response) =>\n deserializeSuccess<TResponse>(response),\n );\n };\n\n /**\n * A read request is either a `GET` request, or a request that we make\n * via the `read` transporter (e.g. `search`).\n */\n const isRead = request.useReadTransporter || request.method === 'GET';\n\n /**\n * Once we have the function factory ready, we need to determine of the\n * request is \"cacheable\" - should be cached. Note that, once again,\n * the user can force this option.\n */\n const cacheable = requestOptions.cacheable || request.cacheable;\n\n /**\n * If is not \"cacheable\", we immediately trigger the retryable request, no\n * need to check cache implementations.\n */\n if (cacheable !== true) {\n return createRetryableRequest();\n }\n\n /**\n * If the request is \"cacheable\", we need to first compute the key to ask\n * the cache implementations if this request is on progress or if the\n * response already exists on the cache.\n */\n const key = {\n request,\n requestOptions,\n transporter: {\n queryParameters: baseQueryParameters,\n headers: baseHeaders,\n },\n };\n\n /**\n * With the computed key, we first ask the responses cache\n * implementation if this request was been resolved before.\n */\n return responsesCache.get(\n key,\n () => {\n /**\n * If the request has never resolved before, we actually ask if there\n * is a current request with the same key on progress.\n */\n return requestsCache.get(key, () =>\n /**\n * Finally, if there is no request in progress with the same key,\n * this `createRetryableRequest()` will actually trigger the\n * retryable request.\n */\n requestsCache\n .set(key, createRetryableRequest())\n .then(\n (response) => Promise.all([requestsCache.delete(key), response]),\n (err) => Promise.all([requestsCache.delete(key), Promise.reject(err)]),\n )\n .then(([_, response]) => response),\n );\n },\n {\n /**\n * Of course, once we get this response back from the server, we\n * tell response cache to actually store the received response\n * to be used later.\n */\n miss: (response) => responsesCache.set(key, response),\n },\n );\n }\n\n function createRequestWithHttpInfo<TData>(\n request: Request,\n requestOptions: RequestOptions = {},\n ): Promise<AlgoliaHttpResponse<TData>> {\n /**\n * A read request is either a `GET` request, or a request that we make\n * via the `read` transporter (e.g. `search`).\n */\n const isRead = request.useReadTransporter || request.method === 'GET';\n\n /**\n * The HTTP info variant always hits the network: both the requests and\n * the responses caches are bypassed, even for `cacheable` requests, so\n * that the returned status code and headers reflect an actual API call.\n */\n return retryableRequest(request, requestOptions, isRead).then((response) =>\n deserializeSuccessWithHttpInfo<TData>(response),\n );\n }\n\n async function* requestStream(\n request: Request,\n requestOptions: RequestOptions = {},\n ): AsyncGenerator<ServerSentEvent> {\n if (!requester.sendStream) {\n throw new Error('This requester does not support streaming');\n }\n\n const data = serializeData(request, requestOptions);\n const headers = serializeHeaders(baseHeaders, request.headers, requestOptions.headers);\n headers['accept'] = 'text/event-stream';\n\n // On `GET`, the data is proxied to query parameters.\n const dataQueryParameters: QueryParameters =\n request.method === 'GET'\n ? {\n ...request.data,\n ...requestOptions.data,\n }\n : {};\n\n const queryParameters: QueryParameters = {\n ...baseQueryParameters,\n ...request.queryParameters,\n ...dataQueryParameters,\n };\n\n if (algoliaAgent.value) {\n queryParameters['x-algolia-agent'] = algoliaAgent.value;\n }\n\n if (requestOptions && requestOptions.queryParameters) {\n for (const key of Object.keys(requestOptions.queryParameters)) {\n if (\n !requestOptions.queryParameters[key] ||\n Object.prototype.toString.call(requestOptions.queryParameters[key]) === '[object Object]'\n ) {\n queryParameters[key] = requestOptions.queryParameters[key];\n } else {\n queryParameters[key] = requestOptions.queryParameters[key].toString();\n }\n }\n }\n\n injectRequestId(headers, queryParameters);\n\n const isRead = request.useReadTransporter || request.method === 'GET';\n const compatibleHosts = hosts.filter(\n (host) => host.accept === 'readWrite' || (isRead ? host.accept === 'read' : host.accept === 'write'),\n );\n const options = await createRetryableOptions(compatibleHosts);\n const host = options.hosts[0];\n if (!host) {\n throw new RetryError([]);\n }\n\n const timeout = { ...timeouts, ...requestOptions.timeouts };\n const payload: EndRequest = {\n data,\n headers,\n method: request.method,\n url: serializeUrl(host, request.path, queryParameters),\n connectTimeout: timeout.connect,\n responseTimeout: isRead ? timeout.read : timeout.write,\n };\n\n let rateLimitRetriesLeft = maxRateLimitRetries;\n while (true) {\n let stream: ReadableStream<Uint8Array>;\n try {\n stream = await requester.sendStream(payload);\n } catch (error) {\n if (isRateLimitedError(error) && rateLimitRetriesLeft > 0) {\n rateLimitRetriesLeft--;\n const waitMs = parseRetryAfterMs(headersFromError(error));\n logger.info('Retryable failure', {\n wait: waitMs,\n rateLimitRetriesLeft,\n host,\n });\n await wait(waitMs);\n continue;\n }\n throw error;\n }\n yield* iterSSEEvents(stream);\n return;\n }\n }\n\n return {\n hostsCache,\n requester,\n timeouts,\n logger,\n algoliaAgent,\n baseHeaders,\n baseQueryParameters,\n requestIdChannel,\n hosts,\n maxRateLimitRetries,\n request: createRequest,\n requestWithHttpInfo: createRequestWithHttpInfo,\n requestStream,\n requestsCache,\n responsesCache,\n };\n}\n","export const LogLevelEnum: Readonly<Record<string, LogLevelType>> = {\n Debug: 1,\n Info: 2,\n Error: 3,\n};\n\nexport type LogLevelType = 1 | 2 | 3;\n\nexport type Logger = {\n /**\n * Logs debug messages.\n */\n debug: (message: string, args?: any | undefined) => Promise<void>;\n\n /**\n * Logs info messages.\n */\n info: (message: string, args?: any | undefined) => Promise<void>;\n\n /**\n * Logs warning messages. When not implemented, warnings fall back to `console.warn` so they stay visible with the default no-op logger.\n */\n warn?: (message: string, args?: any | undefined) => Promise<void>;\n\n /**\n * Logs error messages.\n */\n error: (message: string, args?: any | undefined) => Promise<void>;\n};\n","export function validateRequired(field: string, method: string, value: unknown): void {\n if (value == null || (typeof value === 'string' && value.length === 0)) {\n throw new Error(`Parameter \\`${field}\\` is required when calling \\`${method}\\`.`);\n }\n}\n","import type { EndRequest, Requester, Response } from '@algolia/client-common';\n\ntype Timeout = ReturnType<typeof setTimeout>;\n\nfunction parseResponseHeaders(rawHeaders: string): Record<string, string> {\n const headers: Record<string, string> = {};\n\n for (const line of rawHeaders.trim().split(/[\\r\\n]+/)) {\n const separatorIndex = line.indexOf(': ');\n if (separatorIndex > 0) {\n headers[line.slice(0, separatorIndex).toLowerCase()] = line.slice(separatorIndex + 2);\n }\n }\n\n return headers;\n}\n\nexport function createXhrRequester(): Requester {\n function send(request: EndRequest): Promise<Response> {\n return new Promise((resolve) => {\n const baseRequester = new XMLHttpRequest();\n baseRequester.open(request.method, request.url, true);\n\n Object.keys(request.headers).forEach((key) => baseRequester.setRequestHeader(key, request.headers[key]));\n\n const createTimeout = (timeout: number, content: string): Timeout => {\n return setTimeout(() => {\n baseRequester.abort();\n\n resolve({\n status: 0,\n content,\n isTimedOut: true,\n });\n }, timeout);\n };\n\n const connectTimeout = createTimeout(request.connectTimeout, 'Connection timeout');\n\n let responseTimeout: Timeout | undefined;\n\n baseRequester.onreadystatechange = (): void => {\n if (baseRequester.readyState > baseRequester.OPENED && responseTimeout === undefined) {\n clearTimeout(connectTimeout);\n\n responseTimeout = createTimeout(request.responseTimeout, 'Socket timeout');\n }\n };\n\n baseRequester.onerror = (): void => {\n // istanbul ignore next\n if (baseRequester.status === 0) {\n clearTimeout(connectTimeout);\n clearTimeout(responseTimeout!);\n\n resolve({\n content: baseRequester.responseText || 'Network request failed',\n status: baseRequester.status,\n isTimedOut: false,\n });\n }\n };\n\n baseRequester.onload = (): void => {\n clearTimeout(connectTimeout);\n clearTimeout(responseTimeout!);\n\n resolve({\n content: baseRequester.responseText,\n headers: parseResponseHeaders(baseRequester.getAllResponseHeaders()),\n status: baseRequester.status,\n isTimedOut: false,\n });\n };\n\n baseRequester.send(request.data as XMLHttpRequestBodyInit | null | undefined);\n });\n }\n\n return { send };\n}\n","// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nimport type {\n AlgoliaHttpResponse,\n CreateClientOptions,\n Headers,\n Host,\n QueryParameters,\n Request,\n RequestOptions,\n} from '@algolia/client-common';\nimport { createAuth, createTransporter, getAlgoliaAgent, validateRequired } from '@algolia/client-common';\n\nimport type { ABTest } from '../model/aBTest';\nimport type { ABTestResponse } from '../model/aBTestResponse';\nimport type { ABTestSettingsResponse } from '../model/aBTestSettingsResponse';\nimport type { AddABTestsRequest } from '../model/addABTestsRequest';\nimport type { EstimateABTestRequest } from '../model/estimateABTestRequest';\nimport type { EstimateABTestResponse } from '../model/estimateABTestResponse';\nimport type { ListABTestsResponse } from '../model/listABTestsResponse';\nimport type { Timeseries } from '../model/timeseries';\n\nimport type {\n ApplyVariantSettingsProps,\n CustomDeleteProps,\n CustomGetProps,\n CustomPostProps,\n CustomPutProps,\n DeleteABTestProps,\n GetABTestProps,\n GetABTestSettingsProps,\n GetTimeseriesProps,\n ListABTestsProps,\n SaveVariantSettingsProps,\n StopABTestProps,\n} from '../model/clientMethodProps';\n\nexport const apiClientVersion = '1.26.0';\n\nexport const REGIONS = ['de', 'us'] as const;\nexport type Region = (typeof REGIONS)[number];\nexport type RegionOptions = { region?: Region | undefined };\n\nfunction getDefaultHosts(region?: Region | undefined): Host[] {\n const url = !region ? 'analytics.algolia.com' : 'analytics.{region}.algolia.com'.replace('{region}', region);\n\n return [{ url, accept: 'readWrite', protocol: 'https' }];\n}\n\nexport function createAbtestingV3Client({\n appId: appIdOption,\n apiKey: apiKeyOption,\n authMode,\n algoliaAgents,\n region: regionOption,\n ...options\n}: CreateClientOptions & RegionOptions) {\n const auth = createAuth(appIdOption, apiKeyOption, authMode);\n const transporter = createTransporter({\n hosts: getDefaultHosts(regionOption),\n ...options,\n algoliaAgent: getAlgoliaAgent({\n algoliaAgents,\n client: 'AbtestingV3',\n version: apiClientVersion,\n }),\n baseHeaders: {\n 'content-type': 'text/plain',\n ...auth.headers(),\n ...options.baseHeaders,\n },\n baseQueryParameters: {\n ...auth.queryParameters(),\n ...options.baseQueryParameters,\n },\n });\n\n return {\n transporter,\n\n /**\n * The `appId` currently in use.\n */\n appId: appIdOption,\n\n /**\n * The `apiKey` currently in use.\n */\n apiKey: apiKeyOption,\n\n /**\n * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.\n */\n clearCache(): Promise<void> {\n return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => undefined);\n },\n\n /**\n * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.\n */\n get _ua(): string {\n return transporter.algoliaAgent.value;\n },\n\n /**\n * Adds a `segment` to the `x-algolia-agent` sent with every requests.\n *\n * @param segment - The algolia agent (user-agent) segment to add.\n * @param version - The version of the agent.\n */\n addAlgoliaAgent(segment: string, version?: string | undefined): void {\n transporter.algoliaAgent.add({ segment, version });\n },\n\n /**\n * Helper method to switch the API key used to authenticate the requests.\n *\n * @param params - Method params.\n * @param params.apiKey - The new API Key to use.\n */\n setClientApiKey({ apiKey }: { apiKey: string }): void {\n if (!authMode || authMode === 'WithinHeaders') {\n transporter.baseHeaders['x-algolia-api-key'] = apiKey;\n } else {\n transporter.baseQueryParameters['x-algolia-api-key'] = apiKey;\n }\n },\n\n /**\n * Creates a new A/B test.\n *\n * Required API Key ACLs:\n * - editSettings\n * @param addABTestsRequest - The addABTestsRequest object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n addABTests(addABTestsRequest: AddABTestsRequest, requestOptions?: RequestOptions): Promise<ABTestResponse> {\n validateRequired('addABTestsRequest', 'addABTests', addABTestsRequest);\n\n validateRequired('addABTestsRequest.name', 'addABTests', addABTestsRequest.name);\n validateRequired('addABTestsRequest.variants', 'addABTests', addABTestsRequest.variants);\n validateRequired('addABTestsRequest.metrics', 'addABTests', addABTestsRequest.metrics);\n validateRequired('addABTestsRequest.endAt', 'addABTests', addABTestsRequest.endAt);\n\n const requestPath = '/3/abtests';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: addABTestsRequest,\n };\n\n return transporter.request(request, requestOptions);\n },\n /**\n * Creates a new A/B test.\n *\n * Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.\n *\n * Required API Key ACLs:\n * - editSettings\n * @param addABTestsRequest - The addABTestsRequest object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n * @see addABTests for the plain version.\n */\n addABTestsWithHTTPInfo(\n addABTestsRequest: AddABTestsRequest,\n requestOptions?: RequestOptions,\n ): Promise<AlgoliaHttpResponse<ABTestResponse>> {\n validateRequired('addABTestsRequest', 'addABTestsWithHTTPInfo', addABTestsRequest);\n\n validateRequired('addABTestsRequest.name', 'addABTestsWithHTTPInfo', addABTestsRequest.name);\n validateRequired('addABTestsRequest.variants', 'addABTestsWithHTTPInfo', addABTestsRequest.variants);\n validateRequired('addABTestsRequest.metrics', 'addABTestsWithHTTPInfo', addABTestsRequest.metrics);\n validateRequired('addABTestsRequest.endAt', 'addABTestsWithHTTPInfo', addABTestsRequest.endAt);\n\n const requestPath = '/3/abtests';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: addABTestsRequest,\n };\n\n return transporter.requestWithHttpInfo(request, requestOptions);\n },\n\n /**\n * Applies the captured settings of the given variant to the control index. The settings must first be captured with the `saveVariantSettings` operation. To revert previously applied settings on the control index, use this operation with the control variant (variant 1). Settings can be applied up to 14 days after the A/B test ends, and reverted up to 15 days after. Later requests return `400`. Each set of captured settings can only be applied once, and settings that were reverted can\\'t be applied again. Both cases return `400`. The control index must not be in use by an active A/B test. Otherwise, the request returns `422`.\n *\n * Required API Key ACLs:\n * - analytics\n * - editSettings\n * @param applyVariantSettings - The applyVariantSettings object.\n * @param applyVariantSettings.id - Unique A/B test identifier.\n * @param applyVariantSettings.variantId - One-based index of the A/B test variant. The control is variant 1.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n applyVariantSettings({ id, variantId }: ApplyVariantSettingsProps, requestOptions?: RequestOptions): Promise<void> {\n validateRequired('id', 'applyVariantSettings', id);\n\n validateRequired('variantId', 'applyVariantSettings', variantId);\n\n const requestPath = '/3/abtests/{id}/settings/{variantId}/apply'\n .replace('{id}', encodeURIComponent(id))\n .replace('{variantId}', encodeURIComponent(variantId));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n /**\n * Applies the captured settings of the given variant to the control index. The settings must first be captured with the `saveVariantSettings` operation. To revert previously applied settings on the control index, use this operation with the control variant (variant 1). Settings can be applied up to 14 days after the A/B test ends, and reverted up to 15 days after. Later requests return `400`. Each set of captured settings can only be applied once, and settings that were reverted can\\'t be applied again. Both cases return `400`. The control index must not be in use by an active A/B test. Otherwise, the request returns `422`.\n *\n * Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.\n *\n * Required API Key ACLs:\n * - analytics\n * - editSettings\n * @param applyVariantSettings - The applyVariantSettings object.\n * @param applyVariantSettings.id - Unique A/B test identifier.\n * @param applyVariantSettings.variantId - One-based index of the A/B test variant. The control is variant 1.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n * @see applyVariantSettings for the plain version.\n */\n applyVariantSettingsWithHTTPInfo(\n { id, variantId }: ApplyVariantSettingsProps,\n requestOptions?: RequestOptions,\n ): Promise<AlgoliaHttpResponse<void>> {\n validateRequired('id', 'applyVariantSettingsWithHTTPInfo', id);\n\n validateRequired('variantId', 'applyVariantSettingsWithHTTPInfo', variantId);\n\n const requestPath = '/3/abtests/{id}/settings/{variantId}/apply'\n .replace('{id}', encodeURIComponent(id))\n .replace('{variantId}', encodeURIComponent(variantId));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.requestWithHttpInfo(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customDelete - The customDelete object.\n * @param customDelete.path - Path of the endpoint, for example `1/newFeature`.\n * @param customDelete.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customDelete(\n { path, parameters }: CustomDeleteProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n validateRequired('path', 'customDelete', path);\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n /**\n * This method lets you send requests to the Algolia REST API.\n *\n * Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.\n * @param customDelete - The customDelete object.\n * @param customDelete.path - Path of the endpoint, for example `1/newFeature`.\n * @param customDelete.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n * @see customDelete for the plain version.\n */\n customDeleteWithHTTPInfo(\n { path, parameters }: CustomDeleteProps,\n requestOptions?: RequestOptions,\n ): Promise<AlgoliaHttpResponse<Record<string, unknown>>> {\n validateRequired('path', 'customDeleteWithHTTPInfo', path);\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.requestWithHttpInfo(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customGet - The customGet object.\n * @param customGet.path - Path of the endpoint, for example `1/newFeature`.\n * @param customGet.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>> {\n validateRequired('path', 'customGet', path);\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n /**\n * This method lets you send requests to the Algolia REST API.\n *\n * Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.\n * @param customGet - The customGet object.\n * @param customGet.path - Path of the endpoint, for example `1/newFeature`.\n * @param customGet.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n * @see customGet for the plain version.\n */\n customGetWithHTTPInfo(\n { path, parameters }: CustomGetProps,\n requestOptions?: RequestOptions,\n ): Promise<AlgoliaHttpResponse<Record<string, unknown>>> {\n validateRequired('path', 'customGetWithHTTPInfo', path);\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.requestWithHttpInfo(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customPost - The customPost object.\n * @param customPost.path - Path of the endpoint, for example `1/newFeature`.\n * @param customPost.parameters - Query parameters to apply to the current query.\n * @param customPost.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPost(\n { path, parameters, body }: CustomPostProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n validateRequired('path', 'customPost', path);\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n /**\n * This method lets you send requests to the Algolia REST API.\n *\n * Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.\n * @param customPost - The customPost object.\n * @param customPost.path - Path of the endpoint, for example `1/newFeature`.\n * @param customPost.parameters - Query parameters to apply to the current query.\n * @param customPost.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n * @see customPost for the plain version.\n */\n customPostWithHTTPInfo(\n { path, parameters, body }: CustomPostProps,\n requestOptions?: RequestOptions,\n ): Promise<AlgoliaHttpResponse<Record<string, unknown>>> {\n validateRequired('path', 'customPostWithHTTPInfo', path);\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.requestWithHttpInfo(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customPut - The customPut object.\n * @param customPut.path - Path of the endpoint, for example `1/newFeature`.\n * @param customPut.parameters - Query parameters to apply to the current query.\n * @param customPut.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPut(\n { path, parameters, body }: CustomPutProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n validateRequired('path', 'customPut', path);\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'PUT',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n /**\n * This method lets you send requests to the Algolia REST API.\n *\n * Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.\n * @param customPut - The customPut object.\n * @param customPut.path - Path of the endpoint, for example `1/newFeature`.\n * @param customPut.parameters - Query parameters to apply to the current query.\n * @param customPut.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n * @see customPut for the plain version.\n */\n customPutWithHTTPInfo(\n { path, parameters, body }: CustomPutProps,\n requestOptions?: RequestOptions,\n ): Promise<AlgoliaHttpResponse<Record<string, unknown>>> {\n validateRequired('path', 'customPutWithHTTPInfo', path);\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'PUT',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.requestWithHttpInfo(request, requestOptions);\n },\n\n /**\n * Deletes an A/B test by its ID.\n *\n * Required API Key ACLs:\n * - editSettings\n * @param deleteABTest - The deleteABTest object.\n * @param deleteABTest.id - Unique A/B test identifier.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n deleteABTest({ id }: DeleteABTestProps, requestOptions?: RequestOptions): Promise<ABTestResponse> {\n validateRequired('id', 'deleteABTest', id);\n\n const requestPath = '/3/abtests/{id}'.replace('{id}', encodeURIComponent(id));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n /**\n * Deletes an A/B test by its ID.\n *\n * Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.\n *\n * Required API Key ACLs:\n * - editSettings\n * @param deleteABTest - The deleteABTest object.\n * @param deleteABTest.id - Unique A/B test identifier.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n * @see deleteABTest for the plain version.\n */\n deleteABTestWithHTTPInfo(\n { id }: DeleteABTestProps,\n requestOptions?: RequestOptions,\n ): Promise<AlgoliaHttpResponse<ABTestResponse>> {\n validateRequired('id', 'deleteABTestWithHTTPInfo', id);\n\n const requestPath = '/3/abtests/{id}'.replace('{id}', encodeURIComponent(id));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.requestWithHttpInfo(request, requestOptions);\n },\n\n /**\n * Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.\n *\n * Required API Key ACLs:\n * - analytics\n * @param estimateABTestRequest - The estimateABTestRequest object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n estimateABTest(\n estimateABTestRequest: EstimateABTestRequest,\n requestOptions?: RequestOptions,\n ): Promise<EstimateABTestResponse> {\n validateRequired('estimateABTestRequest', 'estimateABTest', estimateABTestRequest);\n\n validateRequired('estimateABTestRequest.configuration', 'estimateABTest', estimateABTestRequest.configuration);\n validateRequired('estimateABTestRequest.variants', 'estimateABTest', estimateABTestRequest.variants);\n\n const requestPath = '/3/abtests/estimate';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: estimateABTestRequest,\n };\n\n return transporter.request(request, requestOptions);\n },\n /**\n * Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.\n *\n * Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.\n *\n * Required API Key ACLs:\n * - analytics\n * @param estimateABTestRequest - The estimateABTestRequest object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n * @see estimateABTest for the plain version.\n */\n estimateABTestWithHTTPInfo(\n estimateABTestRequest: EstimateABTestRequest,\n requestOptions?: RequestOptions,\n ): Promise<AlgoliaHttpResponse<EstimateABTestResponse>> {\n validateRequired('estimateABTestRequest', 'estimateABTestWithHTTPInfo', estimateABTestRequest);\n\n validateRequired(\n 'estimateABTestRequest.configuration',\n 'estimateABTestWithHTTPInfo',\n estimateABTestRequest.configuration,\n );\n validateRequired('estimateABTestRequest.variants', 'estimateABTestWithHTTPInfo', estimateABTestRequest.variants);\n\n const requestPath = '/3/abtests/estimate';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: estimateABTestRequest,\n };\n\n return transporter.requestWithHttpInfo(request, requestOptions);\n },\n\n /**\n * Retrieves the details for an A/B test by its ID.\n *\n * Required API Key ACLs:\n * - analytics\n * @param getABTest - The getABTest object.\n * @param getABTest.id - Unique A/B test identifier.\n * @param getABTest.methods - Statistical analysis results to include, as a comma-separated list. When omitted, each test uses its configured method, or `frequentist` if no method is configured. Request both methods to include both sets of available results. This doesn\\'t change the test configuration or compute missing results. Duplicate values aren\\'t allowed.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getABTest({ id, methods }: GetABTestProps, requestOptions?: RequestOptions): Promise<ABTest> {\n validateRequired('id', 'getABTest', id);\n\n const requestPath = '/3/abtests/{id}'.replace('{id}', encodeURIComponent(id));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n if (methods !== undefined) {\n queryParameters['methods'] = methods.toString();\n }\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n /**\n * Retrieves the details for an A/B test by its ID.\n *\n * Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.\n *\n * Required API Key ACLs:\n * - analytics\n * @param getABTest - The getABTest object.\n * @param getABTest.id - Unique A/B test identifier.\n * @param getABTest.methods - Statistical analysis results to include, as a comma-separated list. When omitted, each test uses its configured method, or `frequentist` if no method is configured. Request both methods to include both sets of available results. This doesn\\'t change the test configuration or compute missing results. Duplicate values aren\\'t allowed.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n * @see getABTest for the plain version.\n */\n getABTestWithHTTPInfo(\n { id, methods }: GetABTestProps,\n requestOptions?: RequestOptions,\n ): Promise<AlgoliaHttpResponse<ABTest>> {\n validateRequired('id', 'getABTestWithHTTPInfo', id);\n\n const requestPath = '/3/abtests/{id}'.replace('{id}', encodeURIComponent(id));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n if (methods !== undefined) {\n queryParameters['methods'] = methods.toString();\n }\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.requestWithHttpInfo(request, requestOptions);\n },\n\n /**\n * Retrieves the settings captured for each variant of an A/B test, and whether another active A/B test is using the control index. Settings are captured by the `saveVariantSettings` operation. The response includes an entry for the control (variant 1) alongside the captured variant, so the control\\'s original configuration can be restored later. Returns `404` if the A/B test doesn\\'t exist or no settings have been captured for it.\n *\n * Required API Key ACLs:\n * - analytics\n * @param getABTestSettings - The getABTestSettings object.\n * @param getABTestSettings.id - Unique A/B test identifier.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getABTestSettings(\n { id }: GetABTestSettingsProps,\n requestOptions?: RequestOptions,\n ): Promise<ABTestSettingsResponse> {\n validateRequired('id', 'getABTestSettings', id);\n\n const requestPath = '/3/abtests/{id}/settings'.replace('{id}', encodeURIComponent(id));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n /**\n * Retrieves the settings captured for each variant of an A/B test, and whether another active A/B test is using the control index. Settings are captured by the `saveVariantSettings` operation. The response includes an entry for the control (variant 1) alongside the captured variant, so the control\\'s original configuration can be restored later. Returns `404` if the A/B test doesn\\'t exist or no settings have been captured for it.\n *\n * Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.\n *\n * Required API Key ACLs:\n * - analytics\n * @param getABTestSettings - The getABTestSettings object.\n * @param getABTestSettings.id - Unique A/B test identifier.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n * @see getABTestSettings for the plain version.\n */\n getABTestSettingsWithHTTPInfo(\n { id }: GetABTestSettingsProps,\n requestOptions?: RequestOptions,\n ): Promise<AlgoliaHttpResponse<ABTestSettingsResponse>> {\n validateRequired('id', 'getABTestSettingsWithHTTPInfo', id);\n\n const requestPath = '/3/abtests/{id}/settings'.replace('{id}', encodeURIComponent(id));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.requestWithHttpInfo(request, requestOptions);\n },\n\n /**\n * Retrieves timeseries for an A/B test by its ID.\n *\n * Required API Key ACLs:\n * - analytics\n * @param getTimeseries - The getTimeseries object.\n * @param getTimeseries.id - Unique A/B test identifier.\n * @param getTimeseries.startDate - Start date of the period to analyze, in `YYYY-MM-DD` format.\n * @param getTimeseries.endDate - End date of the period to analyze, in `YYYY-MM-DD` format.\n * @param getTimeseries.metric - List of metrics to retrieve. If not specified, all metrics are returned.\n * @param getTimeseries.methods - Statistical analysis results to include, as a comma-separated list. When omitted, each test uses its configured method, or `frequentist` if no method is configured. Request both methods to include both sets of available results. This doesn\\'t change the test configuration or compute missing results. Duplicate values aren\\'t allowed.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getTimeseries(\n { id, startDate, endDate, metric, methods }: GetTimeseriesProps,\n requestOptions?: RequestOptions,\n ): Promise<Timeseries> {\n validateRequired('id', 'getTimeseries', id);\n\n const requestPath = '/3/abtests/{id}/timeseries'.replace('{id}', encodeURIComponent(id));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n if (startDate !== undefined) {\n queryParameters['startDate'] = startDate.toString();\n }\n\n if (endDate !== undefined) {\n queryParameters['endDate'] = endDate.toString();\n }\n\n if (metric !== undefined) {\n queryParameters['metric'] = metric.toString();\n }\n\n if (methods !== undefined) {\n queryParameters['methods'] = methods.toString();\n }\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n /**\n * Retrieves timeseries for an A/B test by its ID.\n *\n * Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.\n *\n * Required API Key ACLs:\n * - analytics\n * @param getTimeseries - The getTimeseries object.\n * @param getTimeseries.id - Unique A/B test identifier.\n * @param getTimeseries.startDate - Start date of the period to analyze, in `YYYY-MM-DD` format.\n * @param getTimeseries.endDate - End date of the period to analyze, in `YYYY-MM-DD` format.\n * @param getTimeseries.metric - List of metrics to retrieve. If not specified, all metrics are returned.\n * @param getTimeseries.methods - Statistical analysis results to include, as a comma-separated list. When omitted, each test uses its configured method, or `frequentist` if no method is configured. Request both methods to include both sets of available results. This doesn\\'t change the test configuration or compute missing results. Duplicate values aren\\'t allowed.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n * @see getTimeseries for the plain version.\n */\n getTimeseriesWithHTTPInfo(\n { id, startDate, endDate, metric, methods }: GetTimeseriesProps,\n requestOptions?: RequestOptions,\n ): Promise<AlgoliaHttpResponse<Timeseries>> {\n validateRequired('id', 'getTimeseriesWithHTTPInfo', id);\n\n const requestPath = '/3/abtests/{id}/timeseries'.replace('{id}', encodeURIComponent(id));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n if (startDate !== undefined) {\n queryParameters['startDate'] = startDate.toString();\n }\n\n if (endDate !== undefined) {\n queryParameters['endDate'] = endDate.toString();\n }\n\n if (metric !== undefined) {\n queryParameters['metric'] = metric.toString();\n }\n\n if (methods !== undefined) {\n queryParameters['methods'] = methods.toString();\n }\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.requestWithHttpInfo(request, requestOptions);\n },\n\n /**\n * Lists all A/B tests you configured for this application.\n *\n * Required API Key ACLs:\n * - analytics\n * @param listABTests - The listABTests object.\n * @param listABTests.offset - Position of the first item to return.\n * @param listABTests.limit - Number of items to return.\n * @param listABTests.indexPrefix - Index name prefix. Only A/B tests for indices starting with this string are included in the response.\n * @param listABTests.indexSuffix - Index name suffix. Only A/B tests for indices ending with this string are included in the response.\n * @param listABTests.direction - Sort order for A/B tests by start date. Use \\'asc\\' for ascending or \\'desc\\' for descending. Active A/B tests are always listed first.\n * @param listABTests.methods - Statistical analysis results to include, as a comma-separated list. When omitted, each test uses its configured method, or `frequentist` if no method is configured. Request both methods to include both sets of available results. This doesn\\'t change the test configuration or compute missing results. Duplicate values aren\\'t allowed.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n listABTests(\n { offset, limit, indexPrefix, indexSuffix, direction, methods }: ListABTestsProps = {},\n requestOptions: RequestOptions | undefined = undefined,\n ): Promise<ListABTestsResponse> {\n const requestPath = '/3/abtests';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n if (offset !== undefined) {\n queryParameters['offset'] = offset.toString();\n }\n\n if (limit !== undefined) {\n queryParameters['limit'] = limit.toString();\n }\n\n if (indexPrefix !== undefined) {\n queryParameters['indexPrefix'] = indexPrefix.toString();\n }\n\n if (indexSuffix !== undefined) {\n queryParameters['indexSuffix'] = indexSuffix.toString();\n }\n\n if (direction !== undefined) {\n queryParameters['direction'] = direction.toString();\n }\n\n if (methods !== undefined) {\n queryParameters['methods'] = methods.toString();\n }\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n /**\n * Lists all A/B tests you configured for this application.\n *\n * Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.\n *\n * Required API Key ACLs:\n * - analytics\n * @param listABTests - The listABTests object.\n * @param listABTests.offset - Position of the first item to return.\n * @param listABTests.limit - Number of items to return.\n * @param listABTests.indexPrefix - Index name prefix. Only A/B tests for indices starting with this string are included in the response.\n * @param listABTests.indexSuffix - Index name suffix. Only A/B tests for indices ending with this string are included in the response.\n * @param listABTests.direction - Sort order for A/B tests by start date. Use \\'asc\\' for ascending or \\'desc\\' for descending. Active A/B tests are always listed first.\n * @param listABTests.methods - Statistical analysis results to include, as a comma-separated list. When omitted, each test uses its configured method, or `frequentist` if no method is configured. Request both methods to include both sets of available results. This doesn\\'t change the test configuration or compute missing results. Duplicate values aren\\'t allowed.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n * @see listABTests for the plain version.\n */\n listABTestsWithHTTPInfo(\n { offset, limit, indexPrefix, indexSuffix, direction, methods }: ListABTestsProps = {},\n requestOptions: RequestOptions | undefined = undefined,\n ): Promise<AlgoliaHttpResponse<ListABTestsResponse>> {\n const requestPath = '/3/abtests';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n if (offset !== undefined) {\n queryParameters['offset'] = offset.toString();\n }\n\n if (limit !== undefined) {\n queryParameters['limit'] = limit.toString();\n }\n\n if (indexPrefix !== undefined) {\n queryParameters['indexPrefix'] = indexPrefix.toString();\n }\n\n if (indexSuffix !== undefined) {\n queryParameters['indexSuffix'] = indexSuffix.toString();\n }\n\n if (direction !== undefined) {\n queryParameters['direction'] = direction.toString();\n }\n\n if (methods !== undefined) {\n queryParameters['methods'] = methods.toString();\n }\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.requestWithHttpInfo(request, requestOptions);\n },\n\n /**\n * Captures the settings of the given variant and of the control, then stops the A/B test. The captured settings can later be applied to the control index with the `applyVariantSettings` operation, and read back with the `getABTestSettings` operation. The A/B test must have reached 80% of its planned duration. Earlier requests return `400`. Settings can only be captured once per A/B test. A second request returns `409`. `synonyms` and `enableRules` are not captured, so applying the captured settings never changes them on the control index.\n *\n * Required API Key ACLs:\n * - analytics\n * - editSettings\n * @param saveVariantSettings - The saveVariantSettings object.\n * @param saveVariantSettings.id - Unique A/B test identifier.\n * @param saveVariantSettings.variantId - One-based index of the A/B test variant. The control is variant 1.\n * @param saveVariantSettings.saveSettingsRequest - The saveSettingsRequest object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n saveVariantSettings(\n { id, variantId, saveSettingsRequest }: SaveVariantSettingsProps,\n requestOptions?: RequestOptions,\n ): Promise<void> {\n validateRequired('id', 'saveVariantSettings', id);\n\n validateRequired('variantId', 'saveVariantSettings', variantId);\n\n validateRequired('saveSettingsRequest', 'saveVariantSettings', saveSettingsRequest);\n\n const requestPath = '/3/abtests/{id}/settings/{variantId}'\n .replace('{id}', encodeURIComponent(id))\n .replace('{variantId}', encodeURIComponent(variantId));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: saveSettingsRequest,\n };\n\n return transporter.request(request, requestOptions);\n },\n /**\n * Captures the settings of the given variant and of the control, then stops the A/B test. The captured settings can later be applied to the control index with the `applyVariantSettings` operation, and read back with the `getABTestSettings` operation. The A/B test must have reached 80% of its planned duration. Earlier requests return `400`. Settings can only be captured once per A/B test. A second request returns `409`. `synonyms` and `enableRules` are not captured, so applying the captured settings never changes them on the control index.\n *\n * Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.\n *\n * Required API Key ACLs:\n * - analytics\n * - editSettings\n * @param saveVariantSettings - The saveVariantSettings object.\n * @param saveVariantSettings.id - Unique A/B test identifier.\n * @param saveVariantSettings.variantId - One-based index of the A/B test variant. The control is variant 1.\n * @param saveVariantSettings.saveSettingsRequest - The saveSettingsRequest object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n * @see saveVariantSettings for the plain version.\n */\n saveVariantSettingsWithHTTPInfo(\n { id, variantId, saveSettingsRequest }: SaveVariantSettingsProps,\n requestOptions?: RequestOptions,\n ): Promise<AlgoliaHttpResponse<void>> {\n validateRequired('id', 'saveVariantSettingsWithHTTPInfo', id);\n\n validateRequired('variantId', 'saveVariantSettingsWithHTTPInfo', variantId);\n\n validateRequired('saveSettingsRequest', 'saveVariantSettingsWithHTTPInfo', saveSettingsRequest);\n\n const requestPath = '/3/abtests/{id}/settings/{variantId}'\n .replace('{id}', encodeURIComponent(id))\n .replace('{variantId}', encodeURIComponent(variantId));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: saveSettingsRequest,\n };\n\n return transporter.requestWithHttpInfo(request, requestOptions);\n },\n\n /**\n * Stops an A/B test by its ID. You can\\'t restart stopped A/B tests.\n *\n * Required API Key ACLs:\n * - editSettings\n * @param stopABTest - The stopABTest object.\n * @param stopABTest.id - Unique A/B test identifier.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n stopABTest({ id }: StopABTestProps, requestOptions?: RequestOptions): Promise<ABTestResponse> {\n validateRequired('id', 'stopABTest', id);\n\n const requestPath = '/3/abtests/{id}/stop'.replace('{id}', encodeURIComponent(id));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n /**\n * Stops an A/B test by its ID. You can\\'t restart stopped A/B tests.\n *\n * Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.\n *\n * Required API Key ACLs:\n * - editSettings\n * @param stopABTest - The stopABTest object.\n * @param stopABTest.id - Unique A/B test identifier.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n * @see stopABTest for the plain version.\n */\n stopABTestWithHTTPInfo(\n { id }: StopABTestProps,\n requestOptions?: RequestOptions,\n ): Promise<AlgoliaHttpResponse<ABTestResponse>> {\n validateRequired('id', 'stopABTestWithHTTPInfo', id);\n\n const requestPath = '/3/abtests/{id}/stop'.replace('{id}', encodeURIComponent(id));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.requestWithHttpInfo(request, requestOptions);\n },\n };\n}\n","// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nimport {\n createBrowserLocalStorageCache,\n createFallbackableCache,\n createMemoryCache,\n createNullLogger,\n} from '@algolia/client-common';\nimport { createXhrRequester } from '@algolia/requester-browser-xhr';\n\nimport type { ClientOptions } from '@algolia/client-common';\n\nimport { apiClientVersion, createAbtestingV3Client } from '../src/abtestingV3Client';\n\nimport type { Region } from '../src/abtestingV3Client';\nimport { REGIONS } from '../src/abtestingV3Client';\n\nexport type { Region, RegionOptions } from '../src/abtestingV3Client';\n\nexport { apiClientVersion } from '../src/abtestingV3Client';\n\nexport * from '../model';\n\nexport function abtestingV3Client(\n appId: string,\n apiKey: string,\n region?: Region | undefined,\n options?: ClientOptions | undefined,\n): AbtestingV3Client {\n if (!appId || typeof appId !== 'string') {\n throw new Error('`appId` is missing.');\n }\n\n if (!apiKey || typeof apiKey !== 'string') {\n throw new Error('`apiKey` is missing.');\n }\n\n if (region && (typeof region !== 'string' || !REGIONS.includes(region))) {\n throw new Error(`\\`region\\` must be one of the following: ${REGIONS.join(', ')}`);\n }\n\n const { compression: _compression, ...browserOptions } = options || {};\n\n return createAbtestingV3Client({\n appId,\n apiKey,\n region,\n timeouts: {\n connect: 1000,\n read: 2000,\n write: 30000,\n },\n logger: createNullLogger(),\n requester: createXhrRequester(),\n algoliaAgents: [{ segment: 'Browser' }],\n authMode: 'WithinQueryParameters',\n responsesCache: createMemoryCache(),\n requestsCache: createMemoryCache({ serializable: false }),\n hostsCache: createFallbackableCache({\n caches: [createBrowserLocalStorageCache({ key: `${apiClientVersion}-${appId}` }), create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EAAwB,CAClC,OAAQ,CAACC,GAA+B,CAAE,IAAK,GAAGC,CAAgB,IAAIb,CAAK,EAAG,CAAC,EAAGU,EAAkB,CAAC,CACvG,CAAC,EACD,GAAGJ,CACL,CAAC,CACH","names":["createBrowserLocalStorageCache","options","storage","namespaceKey","getStorage","getNamespace","setNamespace","namespace","yieldToMain","resolve","getFilteredNamespace","timeToLive","currentTime","changed","cacheItem","key","defaultValue","events","cachedItem","value","createNullCache","_key","result","createFallbackableCache","caches","current","createMemoryCache","cache","keyAsString","promise","createAlgoliaAgent","version","algoliaAgent","options","addedAlgoliaAgent","createAuth","appId","apiKey","authMode","credentials","getAlgoliaAgent","algoliaAgents","client","version","defaultAlgoliaAgent","createAlgoliaAgent","algoliaAgent","createNullLogger","_message","_args","MAX_LINE_BUFFER_SIZE","readableStreamToAsyncIterable","stream","reader","done","value","toAsyncIterable","iterLines","decoder","buffer","bufferSize","trailingCR","isFirstLine","chunk","text","offset","crIdx","lfIdx","remaining","endIdx","skipLen","segment","line","SSEDecoder","colonIdx","field","currentEventType","event","iterSSEEvents","COMPRESSION_THRESHOLD","EXPIRATION_DELAY","createStatefulHost","host","status","lastUpdate","isUp","isTimedOut","AlgoliaError","message","name","ErrorWithStackTrace","AlgoliaError","message","stackTrace","name","correlationId","RetryError","ApiError","status","DeserializationError","AlgoliaError","message","response","correlationId","DetailedApiError","ApiError","status","error","stackTrace","serializeUrl","host","path","queryParameters","queryParametersAsString","serializeQueryParameters","url","parameters","key","serializeData","request","requestOptions","data","serializeHeaders","baseHeaders","requestHeaders","requestOptionsHeaders","headers","serializedHeaders","header","value","deserializeSuccess","response","e","DeserializationError","getCorrelationId","deserializeSuccessWithHttpInfo","getLastCorrelationId","stackTrace","i","correlationId","deserializeFailure","stackFrame","content","status","parsed","DetailedApiError","ApiError","BASE62_CHARS","REQUEST_ID_LENGTH","generateRequestId","_a","requestId","bytes","byte","DEFAULT_RATE_LIMIT_WAIT_MS","isNetworkError","isTimedOut","status","isRetryable","isSuccess","isRateLimited","HTTP_429_MESSAGE","isRateLimitedError","error","headersFromError","parseRetryAfterMs","headers","_a","raw","seconds","stackTraceWithoutCredentials","stackTrace","stackFrame","stackFrameWithoutCredentials","modifiedHeaders","createTransporter","hosts","hostsCache","baseHeaders","logger","baseQueryParameters","algoliaAgent","timeouts","requester","requestsCache","responsesCache","compress","compression","requestIdChannel","maxRateLimitRetries","injectRequestId","queryParameters","parameter","generateRequestId","wait","ms","resolve","createRetryableOptions","compatibleHosts","statefulHosts","compatibleHost","createStatefulHost","hostsUp","host","hostsTimedOut","hostsAvailable","timeoutsCount","baseTimeout","retryableRequest","request","requestOptions","isRead","serializedData","serializeData","serializeHeaders","wantsCompression","COMPRESSION_THRESHOLD","shouldCompress","data","dataQueryParameters","key","rateLimitRetriesLeft","retry","retryableHosts","getTimeout","RetryError","getLastCorrelationId","timeout","payload","serializeUrl","pushToStackTrace","response","waitMs","deserializeFailure","options","createRequest","createRetryableRequest","deserializeSuccess","err","_","createRequestWithHttpInfo","deserializeSuccessWithHttpInfo","requestStream","stream","iterSSEEvents","validateRequired","field","method","value","parseResponseHeaders","rawHeaders","headers","line","separatorIndex","createXhrRequester","send","request","resolve","baseRequester","key","createTimeout","timeout","content","connectTimeout","responseTimeout","apiClientVersion","REGIONS","getDefaultHosts","region","createAbtestingV3Client","appIdOption","apiKeyOption","authMode","algoliaAgents","regionOption","options","auth","createAuth","transporter","createTransporter","getAlgoliaAgent","segment","version","apiKey","addABTestsRequest","requestOptions","validateRequired","request","id","variantId","path","parameters","body","estimateABTestRequest","methods","requestPath","headers","queryParameters","startDate","endDate","metric","offset","limit","indexPrefix","indexSuffix","direction","saveSettingsRequest","abtestingV3Client","appId","apiKey","region","options","REGIONS","_compression","browserOptions","createAbtestingV3Client","createNullLogger","c","createMemoryCache","createFallbackableCache","createBrowserLocalStorageCache","apiClientVersion"]}
|