@playlive/tiltify-search
    Preparing search index...

    Function createResilientHttpClient

    • Build a Meilisearch-compatible httpClient that adds retry/backoff, content-type guards, and structured errors on top of native fetch.

      The returned function matches the httpClient shape Meilisearch expects ((...args: Parameters<typeof fetch>) => Promise<unknown>) and returns the parsed JSON response body (or undefined for empty bodies) on success. On unrecoverable failure it throws TiltifySearchHttpError.

      Parameters

      Returns (
          ...args: [input: string | Request | URL, init?: RequestInit],
      ) => Promise<unknown>

      import { Meilisearch } from "meilisearch";
      import { createResilientHttpClient } from "@playlive/tiltify-search/http-client";

      const client = new Meilisearch({
      host: "https://site-search.tiltify.com",
      apiKey: "...",
      httpClient: createResilientHttpClient({
      onRetry: ({ attempt, status, retryAfterMs, bodySample }) => {
      logger.warn({ attempt, status, retryAfterMs, bodySample }, "tiltify search retry");
      },
      }),
      });