{
  "version": 3,
  "sources": ["../../src/modules/indexed-results/classes/PromiseQueue.ts", "../../src/modules/indexed-results/contexts/PromiseQueue/Context.ts", "../../src/modules/indexed-results/contexts/PromiseQueue/Provider.tsx", "../../src/modules/indexed-results/contexts/PromiseQueue/use.ts", "../../src/modules/indexed-results/hooks/support/createPollingFunction.tsx", "../../src/modules/indexed-results/hooks/support/divineIndexedResults.tsx", "../../src/modules/indexed-results/hooks/support/divineSingleIndexedResults.tsx", "../../src/modules/indexed-results/hooks/support/createDivineIndexedResultsPollingFunction.tsx", "../../src/modules/indexed-results/hooks/support/useFetchDivinersFromNode.tsx", "../../src/modules/indexed-results/hooks/support/usePollDiviners.tsx", "../../src/modules/indexed-results/hooks/support/useTryDiviners.tsx", "../../src/modules/indexed-results/hooks/useFreshIndexedResult.tsx", "../../src/modules/indexed-results/hooks/useTriggerFreshIndexedResult.tsx", "../../src/modules/indexed-results/hooks/useIndexedResults.tsx", "../../src/modules/indexed-results/interfaces/PollingStrategies.ts"],
  "sourcesContent": ["import type { EmptyObject } from '@ariestools/sdk'\n\nconst DEFAULT_ACTIVE_PROMISE_LIMIT = 6\n\ntype DefaultValue = EmptyObject | null | undefined\n\n/** A single queued task with resolve/reject handlers and a unique id. */\nexport interface QueueItem {\n  id: string\n  reject: (error: Error) => void\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\n  resolve: (value: any | PromiseLike<any>) => void\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\n  task: () => Promise<any>\n}\n\n/** Queue that evaluates a fixed number of promises concurrently, deduplicating by id. */\nexport class PromiseQueue {\n  private maxConcurrent: number\n  private queue: QueueItem[]\n  private runningPromises = new Set<Promise<DefaultValue>>()\n  private uniqueItemsSet: Set<string> // Set to store unique identifiers for tasks\n\n  constructor(maxConcurrent: number = DEFAULT_ACTIVE_PROMISE_LIMIT) {\n    this.maxConcurrent = maxConcurrent\n    this.queue = []\n    this.uniqueItemsSet = new Set()\n  }\n\n  addRequest<TValue>(task: QueueItem['task'], id: string): Promise<TValue> {\n    if (this.uniqueItemsSet.has(id)) {\n      // If the item already exists in the queue, return a stub promise\n      // NOTE: We are assuming that two different callers will not ask for the same promise\n      // A second request with the same id param is assumed to be from the same caller.\n      return new Promise((resolve, reject) => {\n        // Dummy task to maintain queue consistency\n        this.queue.push({\n          id, reject, resolve, task: () => Promise.resolve({} as TValue),\n        })\n        // Process the queue to resolve/reject the existing promise\n        void this.processQueue()\n      })\n    }\n\n    this.uniqueItemsSet.add(id)\n\n    return new Promise<TValue>((resolve, reject) => {\n      const castResult = resolve as QueueItem['resolve']\n      this.queue.push({\n        id, reject, resolve: castResult, task,\n      })\n      void this.processQueue()\n    })\n  }\n\n  private async processQueue(): Promise<void> {\n    while (this.queue.length > 0) {\n      // Check if the maximum concurrent limit is reached\n      if (this.runningPromises.size >= this.maxConcurrent) {\n        await Promise.race(this.runningPromises) // Wait for one of the running promises to settle\n        // Continue accounts other callers adding more to the running promises\n        continue\n      }\n\n      const {\n        task, resolve, reject, id,\n      } = this.queue.shift()!\n      const promise = task()\n\n      // Add the promise to the set of running promises\n      this.runningPromises.add(promise)\n\n      try {\n        const result = await promise\n        this.runningPromises.delete(promise) // Remove the promise from the set after it settles\n        this.uniqueItemsSet.delete(id)\n        resolve(result)\n      } catch (error) {\n        this.runningPromises.delete(promise) // Remove the promise from the set after it settles\n        this.uniqueItemsSet.delete(id)\n        reject(error as Error)\n      }\n    }\n  }\n}\n", "import { createContextEx } from '@ariestools/sdk-react/shared'\n\nimport type { PromiseQueueState } from './State.ts'\n\n/** React context holding a shared {@link PromiseQueue} instance. */\nexport const PromiseQueueContext = createContextEx<PromiseQueueState>()\n", "import type { PropsWithChildren } from 'react'\nimport React, { useMemo } from 'react'\n\nimport { PromiseQueue } from '../../classes/index.ts'\nimport { PromiseQueueContext } from './Context.ts'\nimport type { PromiseQueueState } from './State.ts'\n\n/** Provides a new {@link PromiseQueue} instance to descendant components. */\nexport const PromiseQueueProvider: React.FC<PropsWithChildren> = ({ children }) => {\n  const value: PromiseQueueState = useMemo(() => ({ provided: true, queue: new PromiseQueue() }), [])\n\n  return (\n    <PromiseQueueContext value={value}>\n      {children}\n    </PromiseQueueContext>\n  )\n}\n", "import { useContextEx } from '@ariestools/sdk-react/shared'\n\nimport { PromiseQueueContext } from './Context.ts'\nimport type { PromiseQueueState } from './State.ts'\n\n/** Returns the shared {@link PromiseQueue} from context, throwing if required and missing. */\nexport const usePromiseQueue = (required = true) => useContextEx<PromiseQueueState>(PromiseQueueContext, 'PromiseQueue', required)\n", "import { setTimeoutEx } from '@ariestools/sdk'\nimport type { Payload } from '@xyo-network/sdk'\n\nimport type { IndexedResultsConfig, PollingConfig } from '../../interfaces/index.ts'\n\n/** Async function invoked on each poll attempt to fetch payload results. */\nexport type PollingFunction = () => Promise<Payload[] | null | undefined>\n\n/** Default retry timing used when no {@link PollingConfig} is provided. */\nexport const DEFAULT_POLLING_CONFIG: PollingConfig = {\n  initialDelay: 100 / 3, // First time will be zero, second time will be 100\n  maxDelay: 10_000,\n  maxRetries: 8,\n}\n\n/** Builds poll/setActive helpers that retry a polling function with backoff or continuously. */\nexport const createPollingFunction = <T extends Payload = Payload>(\n  config?: IndexedResultsConfig,\n  pollDivinerConfig: PollingConfig = DEFAULT_POLLING_CONFIG,\n  pollingFunction?: PollingFunction,\n  onResult?: (result: T[] | null) => void,\n) => {\n  const { indexedQueries, processIndexedResults } = config ?? {}\n  const { isFresh } = processIndexedResults ?? {}\n  const {\n    maxDelay = 10_000, maxRetries, initialDelay = 100, onFoundResult,\n  } = pollDivinerConfig\n\n  let activePolling = true\n\n  const freshTest = (result?: Payload[] | null) => (isFresh ? isFresh(result) : true)\n\n  const pollCompleteTest = (result?: Payload[] | null) => (onFoundResult ? onFoundResult(result) : false)\n\n  /** A polling function that runs on an increasing delay for a fixed number of times */\n  const pollDivinersWithDelay = async (newDelay: number, pollingFunction?: PollingFunction) => {\n    if (activePolling && maxRetries !== null && pollingFunction) {\n      let retries = 0\n      let result: Payload[] | undefined | null\n\n      const pollDivinersWithDelayInner = async (newDelay: number) => {\n        await new Promise(resolve => setTimeoutEx(() => resolve(true), retries === 0 ? 0 : newDelay))\n        try {\n          // Try for a fixed number of times\n          if (retries < maxRetries) {\n            // logarithmic backoff till we hit the max, then we continue that delay for remaining tries\n            const updatedDelay = newDelay >= maxDelay ? newDelay : newDelay * 3\n            result = await pollingFunction()\n\n            const fresh = freshTest(result)\n\n            // have a result but its not fresh enough\n            if (result && !fresh) {\n              console.log(`Completed Retry ${retries} - Retrying in ${updatedDelay} milliseconds...`)\n              retries++\n              await pollDivinersWithDelayInner(updatedDelay)\n            }\n            onResult?.(result as T[] | null)\n          } else {\n            console.warn('Exceeded maximum retries.', JSON.stringify(indexedQueries))\n            onResult?.(result as T[] | null)\n          }\n        } catch (e) {\n          console.error('error retrying diviner', e)\n          throw e\n        }\n      }\n\n      return await pollDivinersWithDelayInner(newDelay)\n    }\n  }\n\n  /** A polling function that runs indefinitely on a set interval */\n  const pollDivinersIndefinitely = async (newDelay: number, pollingFunction?: PollingFunction) => {\n    // Uncomment to debug\n    // console.log('activePollingRef', activePollingRef)\n    if (activePolling && pollingFunction) {\n      let result: Payload[] | undefined | null\n\n      await new Promise(resolve => setTimeoutEx(() => resolve(true), newDelay))\n      try {\n        result = await pollingFunction()\n\n        const fresh = freshTest(result)\n        const pollComplete = pollCompleteTest(result)\n\n        if ((result && fresh) || result === null) {\n          onResult?.(result as T[] | null)\n        }\n\n        if (pollComplete) {\n          activePolling = false\n        } else {\n          await pollDivinersIndefinitely(initialDelay, pollingFunction)\n        }\n      } catch (e) {\n        console.error('error retrying diviner', e)\n        throw e\n      }\n    }\n  }\n\n  /** Function to invoke polling by determining a polling strategy */\n  const poll = async () => {\n    return await (maxRetries === null\n      ? pollDivinersIndefinitely(initialDelay, pollingFunction)\n      : pollDivinersWithDelay(initialDelay, pollingFunction))\n  }\n\n  const setActive = (value: boolean) => {\n    activePolling = value\n  }\n\n  return { poll, setActive }\n}\n", "import type { NodeInstance, Payload } from '@xyo-network/sdk'\nimport { asDivinerInstance } from '@xyo-network/sdk'\n\nimport type { IndexedResultsConfig } from '../../interfaces/index.ts'\nimport { divineSingleIndexedResults } from './divineSingleIndexedResults.tsx'\n\n/** Resolves configured diviners from a node and returns the first non-empty indexed result. */\nexport const divineIndexedResults = async <T extends Payload = Payload>(node?: NodeInstance | null, config?: IndexedResultsConfig) => {\n  let index = 0\n\n  const { diviners } = config ?? {}\n\n  const { indexedQueries, processIndexedResults } = config ?? {}\n  const parseIndexedResults = processIndexedResults?.parseIndexedResults\n\n  if (diviners && node && indexedQueries) {\n    while (index < diviners?.length) {\n      const nameOrAddress = diviners[index]\n      const diviner = asDivinerInstance(await node.resolve(diviners[index]))\n      if (diviner) {\n        const divinerResult = await divineSingleIndexedResults(diviner, indexedQueries, parseIndexedResults)\n        if (divinerResult?.length) {\n          return divinerResult as T[]\n        }\n      } else {\n        console.warn(`Unable to resolve or resolved non-diviner [${nameOrAddress}]`)\n      }\n      index++\n    }\n    return null\n  }\n}\n", "import { retry } from '@ariestools/sdk'\nimport type { DivinerInstance, Payload } from '@xyo-network/sdk'\n\nimport type { ParseIndexedResults } from '../../interfaces/index.ts'\n\nconst divineSingleIndexedResultsInner = async <TPayload extends Payload = Payload>(\n  diviner: DivinerInstance,\n  indexedQueries: Payload[],\n  parseIndexedResults?: ParseIndexedResults<TPayload>,\n) => {\n  const divinedResult = await diviner.divine(indexedQueries)\n  let results: TPayload[] | undefined\n  if (divinedResult?.length > 0) {\n    results = parseIndexedResults ? await parseIndexedResults(divinedResult) : (divinedResult as TPayload[])\n  }\n  return results && results.length > 0 ? results : null\n}\n\n/** Divines indexed queries against a single diviner, optionally parsing and retrying the result. */\nexport const divineSingleIndexedResults = async <TPayload extends Payload = Payload>(\n  diviner: DivinerInstance,\n  indexedQueries: Payload[],\n  parseIndexedResults?: ParseIndexedResults<TPayload>,\n  retries = 0,\n  interval = 100,\n  backoff = 2,\n): Promise<TPayload[] | null | undefined> => {\n  return await retry(() => divineSingleIndexedResultsInner(diviner, indexedQueries, parseIndexedResults), {\n    backoff, interval, retries,\n  })\n}\n", "import type { NodeInstance, Payload } from '@xyo-network/sdk'\n\nimport type { IndexedResultsConfig, PollingConfig } from '../../interfaces/index.ts'\nimport { createPollingFunction, DEFAULT_POLLING_CONFIG } from './createPollingFunction.tsx'\nimport { divineIndexedResults } from './divineIndexedResults.tsx'\n\n/** Creates a polling function that queries diviners for indexed results via a node. */\nexport const createDivineIndexedResultsPollingFunction = <T extends Payload = Payload>(\n  node?: NodeInstance | null,\n  config?: IndexedResultsConfig,\n  pollDivinerConfig: PollingConfig = DEFAULT_POLLING_CONFIG,\n  onResult?: (result: T[] | null) => void,\n) => {\n  return createPollingFunction(config, pollDivinerConfig, () => divineIndexedResults(node, config), onResult)\n}\n", "import { exists } from '@ariestools/sdk'\nimport { usePromise } from '@ariestools/sdk-react/promise'\nimport type { DivinerInstance } from '@xyo-network/sdk'\nimport { isDivinerInstance } from '@xyo-network/sdk'\n\nimport { useProvidedNode } from '#node'\n\nimport type { IndexedResultsConfig } from '../../interfaces/index.ts'\n\n/**\n * Resolves configured diviners from the provided node once up front.\n * @deprecated resolve modules on each polling attempt instead of once up front\n */\nexport const useFetchDivinersFromNode = (\n  config?: IndexedResultsConfig,\n): { diviners: DivinerInstance[] | undefined } => {\n  const { diviners: divinerNames } = config ?? {}\n  const [node] = useProvidedNode()\n\n  const [diviners] = usePromise<DivinerInstance[]>(async () => {\n    if (divinerNames) {\n      const resolvedDiviners = node ? (await Promise.all(divinerNames.map(id => node.resolve(id)))).filter(exists) : []\n      const foundDiviners = resolvedDiviners.filter(mod => isDivinerInstance(mod))\n      return foundDiviners\n    }\n  }, [divinerNames, node])\n\n  return { diviners }\n}\n", "import { setTimeoutEx } from '@ariestools/sdk'\nimport type { Payload } from '@xyo-network/sdk'\nimport {\n  useCallback, useEffect, useRef, useState,\n} from 'react'\n\nimport type { IndexedResultsConfig, PollingConfig } from '../../interfaces/index.ts'\nimport { useTryDiviners } from './useTryDiviners.tsx'\n\n/** Async function invoked on each React-hook poll attempt to fetch payload results. */\nexport type FunctionToPoll = () => Promise<Payload[] | null | undefined>\n\nconst DEFAULT_POLLING_CONFIG: PollingConfig = {\n  initialDelay: 100 / 3, // First time will be zero, second time will be 100\n  maxDelay: 10_000,\n  maxRetries: 8,\n}\n\n/** Hook that builds a poll callback with retry or continuous strategies for a function to poll. */\nexport const usePollingFunction = <T extends Payload = Payload>(\n  config?: IndexedResultsConfig,\n  pollDivinerConfig: PollingConfig = DEFAULT_POLLING_CONFIG,\n  functionToPoll?: FunctionToPoll,\n  onResult?: (result: T[] | null) => void,\n) => {\n  const { indexedQueries, processIndexedResults } = config ?? {}\n  const { isFresh } = processIndexedResults ?? {}\n  const {\n    maxDelay = 10_000, maxRetries, initialDelay = 100, onFoundResult,\n  } = pollDivinerConfig\n\n  // internal ref for managing a consistent active polling value across rerenders\n  const activePollingRef = useRef(false)\n\n  useEffect(() => {\n    // activate polling on initial load\n    activePollingRef.current = true\n    return () => {\n      // cancel all polling on component unmount\n      activePollingRef.current = false\n    }\n  }, [])\n\n  const freshTest = useCallback((result?: Payload[] | null) => (isFresh ? isFresh(result) : true), [isFresh])\n\n  const pollCompleteTest = useCallback((result?: Payload[] | null) => (onFoundResult ? onFoundResult(result) : false), [onFoundResult])\n\n  /** A polling function that runs on an increasing delay for a fixed number of times */\n  const pollDivinersWithDelay = useCallback(\n    async (newDelay: number, functionToPoll?: FunctionToPoll) => {\n      if (activePollingRef.current && maxRetries !== null && functionToPoll) {\n        let retries = 0\n        let result: Payload[] | undefined | null\n\n        const pollDivinersWithDelayInner = async (newDelay: number) => {\n          await new Promise(resolve => setTimeoutEx(() => resolve(true), retries === 0 ? 0 : newDelay))\n          try {\n            // Try for a fixed number of times\n            if (retries < maxRetries) {\n              // logarithmic backoff till we hit the max, then we continue that delay for remaining tries\n              const updatedDelay = newDelay >= maxDelay ? newDelay : newDelay * 3\n              result = await functionToPoll()\n\n              const fresh = freshTest(result)\n\n              // have a result but its not fresh enough\n              if (result && !fresh) {\n                console.log(`Completed Retry ${retries} - Retrying in ${updatedDelay} milliseconds...`)\n                retries++\n                await pollDivinersWithDelayInner(updatedDelay)\n              }\n              onResult?.(result as T[] | null)\n            } else {\n              console.warn('Exceeded maximum retries.', JSON.stringify(indexedQueries))\n              onResult?.(result as T[] | null)\n            }\n          } catch (e) {\n            console.error('error retrying diviner', e)\n            throw e\n          }\n        }\n\n        return await pollDivinersWithDelayInner(newDelay)\n      }\n    },\n    [maxRetries, maxDelay, freshTest, onResult, indexedQueries],\n  )\n\n  const pollIndefRef = useRef<(newDelay: number, fn?: FunctionToPoll) => Promise<void>>(null)\n\n  /** A polling function that runs indefinitely on a set interval */\n  const pollDivinersIndefinitely = useCallback(\n    async (newDelay: number, functionToPoll?: FunctionToPoll) => {\n      // Uncomment to debug\n      // console.log('activePollingRef', activePollingRef)\n      if (activePollingRef.current && functionToPoll) {\n        let result: Payload[] | undefined | null\n\n        await new Promise(resolve => setTimeoutEx(() => resolve(true), newDelay))\n        try {\n          result = await functionToPoll()\n\n          const fresh = freshTest(result)\n          const pollComplete = pollCompleteTest(result)\n\n          if ((result && fresh) || result === null) {\n            onResult?.(result as T[] | null)\n          }\n\n          if (pollComplete) {\n            activePollingRef.current = false\n          } else {\n            await pollIndefRef.current?.(initialDelay, functionToPoll)\n          }\n        } catch (e) {\n          console.error('error retrying diviner', e)\n          throw e\n        }\n      }\n    },\n    [pollCompleteTest, freshTest, initialDelay, onResult],\n  )\n\n  useEffect(() => {\n    pollIndefRef.current = pollDivinersIndefinitely\n  }, [pollDivinersIndefinitely])\n\n  /** Function to invoke polling by determining a polling strategy */\n  const poll = useCallback(async () => {\n    return await (maxRetries === null ? pollDivinersIndefinitely(initialDelay, functionToPoll) : pollDivinersWithDelay(initialDelay, functionToPoll))\n  }, [functionToPoll, initialDelay, maxRetries, pollDivinersIndefinitely, pollDivinersWithDelay])\n\n  return { poll }\n}\n\n/** Polls configured diviners with retry strategies and tracks the latest poll results. */\nexport const usePollDiviners = <T extends Payload = Payload>(\n  config?: IndexedResultsConfig,\n  pollDivinerConfig: PollingConfig = DEFAULT_POLLING_CONFIG,\n  onResult?: (result: T[] | null) => void,\n) => {\n  const tryDiviners = useTryDiviners(config)\n  const [results, setResults] = useState<T[] | null>()\n  const onResultLocal = useCallback((results: T[] | null) => (onResult ? onResult(results) : setResults(results)), [onResult])\n\n  const { poll } = usePollingFunction(config, pollDivinerConfig, tryDiviners, onResultLocal)\n  return { pollDiviners: poll, pollResults: results }\n}\n", "import { exists } from '@ariestools/sdk'\nimport type { DivinerInstance, Payload } from '@xyo-network/sdk'\nimport { isDivinerInstance } from '@xyo-network/sdk'\nimport { useCallback } from 'react'\n\nimport { useProvidedNode } from '#node'\n\nimport type { IndexedResultsConfig, ProcessIndexedResults } from '../../interfaces/index.ts'\n\n/** Returns a callback that tries each configured diviner until a non-empty result is found. */\nexport const useTryDiviners = <T extends Payload = Payload>(config?: IndexedResultsConfig): (() => Promise<Payload[] | undefined | null>) => {\n  const [node] = useProvidedNode()\n  const { indexedQueries, processIndexedResults } = config ?? {}\n  const parseIndexedResults = processIndexedResults?.parseIndexedResults\n\n  const tryDiviner = async (diviner: DivinerInstance, indexedQueries: Payload[], parseIndexedResults?: ProcessIndexedResults['parseIndexedResults']) => {\n    const divinedResult = await diviner.divine(indexedQueries)\n    let results: Payload[] | undefined\n    if (divinedResult?.length > 0) {\n      results = parseIndexedResults ? await parseIndexedResults(divinedResult) : divinedResult\n    }\n    return results && results.length > 0 ? results : null\n  }\n\n  const tryDiviners = useCallback(async () => {\n    let result: T[] | undefined | null\n    let divinerCount = 0\n\n    if (config?.diviners && node) {\n      const resolvedDiviners = (await Promise.all(config.diviners.map(id => node.resolve(id)))).filter(exists)\n      const diviners = resolvedDiviners.filter(mod => isDivinerInstance(mod))\n\n      if (diviners && diviners?.length > 0) {\n        while (divinerCount < diviners?.length && indexedQueries) {\n          const divinerResult = await tryDiviner(diviners[divinerCount], indexedQueries, parseIndexedResults)\n          if (divinerResult && divinerResult?.length) {\n            result = divinerResult as T[]\n            break\n          }\n          divinerCount++\n        }\n        return result ?? null\n      }\n    }\n  }, [config, indexedQueries, node, parseIndexedResults])\n\n  return tryDiviners\n}\n", "import { usePromise } from '@ariestools/sdk-react/promise'\nimport type { Payload } from '@xyo-network/sdk'\n\nimport { usePollDiviners } from './support/index.ts'\nimport type { UseIndexedResultsConfig } from './types/index.ts'\nimport { useTriggerFreshIndexedResult } from './useTriggerFreshIndexedResult.tsx'\n\n/** Refreshes then polls for indexed results when triggered, optionally via a promise queue. */\nexport const useFreshIndexedResult = <TResult extends Payload = Payload>(config?: UseIndexedResultsConfig) => {\n  const {\n    indexedResultsConfig, pollingConfig, queueConfig, trigger,\n  } = config ?? {}\n  const { queue, taskId } = queueConfig ?? {}\n\n  const freshResult = useTriggerFreshIndexedResult(indexedResultsConfig, trigger)\n\n  const { pollDiviners, pollResults } = usePollDiviners<TResult>(indexedResultsConfig, pollingConfig)\n\n  // Start the polling and wait for the results elsewhere\n  const [, error, state] = usePromise(async () => {\n    if (trigger) {\n      if (queue) {\n        const task = async () => {\n          await freshResult()\n          await pollDiviners()\n        }\n        return await queue.addRequest<ReturnType<typeof task>>(task, taskId ?? Date.now().toString())\n      } else {\n        await freshResult()\n        await pollDiviners()\n      }\n    }\n  }, [pollDiviners, freshResult, trigger, queue, taskId])\n\n  return [pollResults, error, state === 'pending' ? 'polling' : state]\n}\n", "import { useCallback } from 'react'\n\nimport type { IndexedResultsConfig } from '../interfaces/index.ts'\n\n/** Returns a callback that invokes the configured refresh path when `trigger` is true. */\nexport const useTriggerFreshIndexedResult = (indexedResultsConfig?: IndexedResultsConfig, trigger?: boolean) => {\n  const { processIndexedResults, refresh } = indexedResultsConfig ?? {}\n\n  const freshResult = useCallback(async () => {\n    if (refresh && trigger) {\n      return refresh ? await refresh?.(processIndexedResults ?? {}) : undefined\n    }\n  }, [refresh, processIndexedResults, trigger])\n\n  return freshResult\n}\n", "import { usePromise } from '@ariestools/sdk-react/promise'\nimport type { Payload } from '@xyo-network/sdk'\nimport { Semaphore } from 'async-mutex'\n\nimport { usePollDiviners } from './support/index.ts'\nimport type { UseIndexedResultsConfig } from './types/index.ts'\n\nlet semaphoreLimit = 100\nconst semaphore = new Semaphore(semaphoreLimit)\n\n/** Sets the global concurrency limit for simultaneous {@link useIndexedResults} polls. */\nexport const setIndexedResultsLimit = (limit: number) => {\n  semaphore.setValue(limit - (semaphoreLimit - semaphore.getValue()))\n  semaphoreLimit = limit\n}\n\n/** Polls diviners for indexed results when triggered, optionally via a promise queue. */\nexport const useIndexedResults = <TResult extends Payload = Payload>(config?: UseIndexedResultsConfig) => {\n  const {\n    indexedResultsConfig, pollingConfig, queueConfig, trigger,\n  } = config ?? {}\n  const { queue, taskId } = queueConfig ?? {}\n\n  const { pollDiviners, pollResults } = usePollDiviners<TResult>(indexedResultsConfig, pollingConfig)\n\n  // Start the polling and wait for the results elsewhere\n  const [, error, state] = usePromise(async () => {\n    if (trigger) {\n      await semaphore.acquire()\n      try {\n        if (queue) {\n          const task = async () => {\n            await pollDiviners()\n          }\n          return await queue.addRequest<ReturnType<typeof task>>(task, taskId ?? Date.now().toString())\n        } else {\n          await pollDiviners()\n        }\n      } finally {\n        semaphore.release()\n      }\n    }\n  }, [pollDiviners, queue, taskId, trigger])\n\n  return [pollResults, error, state === 'pending' ? 'polling' : state]\n}\n", "import type { PollingConfig } from './PollingConfig.ts'\n\n/** Named presets for how indexed-results polling should behave. */\nexport type PollingStrategyNames = 'Continuous' | 'None' | 'TillComplete'\n\nconst continuousPolling = {\n  initialDelay: 500,\n  maxRetries: null,\n}\n\n/** Built-in {@link PollingConfig} presets keyed by {@link PollingStrategyNames}. */\nexport const PollingStrategies: Record<Partial<PollingStrategyNames>, PollingConfig> = {\n  Continuous: { ...continuousPolling },\n  None: { maxRetries: 1 },\n  TillComplete: {\n    ...continuousPolling,\n    onFoundResult: () => {\n      console.warn('Polling strategy set to TillComplete but missing onFoundResult callback')\n      return false\n    },\n  },\n}\n"],
  "mappings": ";AAEA,IAAM,+BAA+B;AAe9B,IAAM,eAAN,MAAmB;AAAA,EAChB;AAAA,EACA;AAAA,EACA,kBAAkB,oBAAI,IAA2B;AAAA,EACjD;AAAA;AAAA,EAER,YAAY,gBAAwB,8BAA8B;AAChE,SAAK,gBAAgB;AACrB,SAAK,QAAQ,CAAC;AACd,SAAK,iBAAiB,oBAAI,IAAI;AAAA,EAChC;AAAA,EAEA,WAAmB,MAAyB,IAA6B;AACvE,QAAI,KAAK,eAAe,IAAI,EAAE,GAAG;AAI/B,aAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AAEtC,aAAK,MAAM,KAAK;AAAA,UACd;AAAA,UAAI;AAAA,UAAQ;AAAA,UAAS,MAAM,MAAM,QAAQ,QAAQ,CAAC,CAAW;AAAA,QAC/D,CAAC;AAED,aAAK,KAAK,aAAa;AAAA,MACzB,CAAC;AAAA,IACH;AAEA,SAAK,eAAe,IAAI,EAAE;AAE1B,WAAO,IAAI,QAAgB,CAAC,SAAS,WAAW;AAC9C,YAAM,aAAa;AACnB,WAAK,MAAM,KAAK;AAAA,QACd;AAAA,QAAI;AAAA,QAAQ,SAAS;AAAA,QAAY;AAAA,MACnC,CAAC;AACD,WAAK,KAAK,aAAa;AAAA,IACzB,CAAC;AAAA,EACH;AAAA,EAEA,MAAc,eAA8B;AAC1C,WAAO,KAAK,MAAM,SAAS,GAAG;AAE5B,UAAI,KAAK,gBAAgB,QAAQ,KAAK,eAAe;AACnD,cAAM,QAAQ,KAAK,KAAK,eAAe;AAEvC;AAAA,MACF;AAEA,YAAM;AAAA,QACJ;AAAA,QAAM;AAAA,QAAS;AAAA,QAAQ;AAAA,MACzB,IAAI,KAAK,MAAM,MAAM;AACrB,YAAM,UAAU,KAAK;AAGrB,WAAK,gBAAgB,IAAI,OAAO;AAEhC,UAAI;AACF,cAAM,SAAS,MAAM;AACrB,aAAK,g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AA,IACJ;AAAA,IAAsB;AAAA,IAAe;AAAA,IAAa;AAAA,EACpD,IAAI,UAAU,CAAC;AACf,QAAM,EAAE,OAAO,OAAO,IAAI,eAAe,CAAC;AAE1C,QAAM,EAAE,cAAc,YAAY,IAAI,gBAAyB,sBAAsB,aAAa;AAGlG,QAAM,CAAC,EAAE,OAAO,KAAK,IAAIC,YAAW,YAAY;AAC9C,QAAI,SAAS;AACX,YAAM,UAAU,QAAQ;AACxB,UAAI;AACF,YAAI,OAAO;AACT,gBAAM,OAAO,YAAY;AACvB,kBAAM,aAAa;AAAA,UACrB;AACA,iBAAO,MAAM,MAAM,WAAoC,MAAM,UAAU,KAAK,IAAI,EAAE,SAAS,CAAC;AAAA,QAC9F,OAAO;AACL,gBAAM,aAAa;AAAA,QACrB;AAAA,MACF,UAAE;AACA,kBAAU,QAAQ;AAAA,MACpB;AAAA,IACF;AAAA,EACF,GAAG,CAAC,cAAc,OAAO,QAAQ,OAAO,CAAC;AAEzC,SAAO,CAAC,aAAa,OAAO,UAAU,YAAY,YAAY,KAAK;AACrE;;;ACxCA,IAAM,oBAAoB;AAAA,EACxB,cAAc;AAAA,EACd,YAAY;AACd;AAGO,IAAM,oBAA0E;AAAA,EACrF,YAAY,EAAE,GAAG,kBAAkB;AAAA,EACnC,MAAM,EAAE,YAAY,EAAE;AAAA,EACtB,cAAc;AAAA,IACZ,GAAG;AAAA,IACH,eAAe,MAAM;AACnB,cAAQ,KAAK,yEAAyE;AACtF,aAAO;AAAA,IACT;AAAA,EACF;AACF;",
  "names": ["pollingFunction", "newDelay", "setTimeoutEx", "useCallback", "exists", "isDivinerInstance", "useProvidedNode", "indexedQueries", "parseIndexedResults", "DEFAULT_POLLING_CONFIG", "useCallback", "functionToPoll", "newDelay", "setTimeoutEx", "results", "usePromise", "useCallback", "usePromise", "usePromise", "usePromise"]
}
