{"version":3,"file":"client.cjs","names":["createThrottleManager","createClient","createConfig","getManagementBaseUrl","ClientError","createAssetFoldersResource","createAssetsResource","createComponentFoldersResource","createDatasourceEntriesResource","createDatasourcesResource","createExperimentsResource","createInternalTagsResource","createOrgsResource","createPresetsResource","createSharedAssetFoldersResource","createSharedAssetsResource","createSharedInternalTagsResource","createSpaceRolesResource","createSpacesResource","createUsersResource","createWebhooksResource","createWorkflowStagesResource","createWorkflowsResource","createComponentsResource","createStoriesResource"],"sources":["../src/client.ts"],"sourcesContent":["import type { Client, ResolvedRequestOptions } from \"./generated/mapi/client\";\nimport type { Middleware } from \"./generated/mapi/client/utils.gen\";\nimport { createClient, createConfig } from \"./generated/mapi/client\";\nimport { getManagementBaseUrl } from \"@storyblok/region-helper\";\nimport type { Region } from \"@storyblok/region-helper\";\nimport type { RetryOptions } from \"ky\";\nimport type { Block } from \"./generated/types/block\";\nimport { ClientError } from \"./error\";\nimport type { RateLimitConfig } from \"./utils/rate-limit\";\nimport { createThrottleManager } from \"./utils/rate-limit\";\nimport { querySerializer } from \"./utils/query-serializer\";\nimport { createAssetFoldersResource } from \"./resources/asset-folders\";\nimport { createAssetsResource } from \"./resources/assets\";\nimport { createComponentFoldersResource } from \"./resources/component-folders\";\nimport { createComponentsResource } from \"./resources/components\";\nimport { createDatasourceEntriesResource } from \"./resources/datasource-entries\";\nimport { createDatasourcesResource } from \"./resources/datasources\";\nimport { createExperimentsResource } from \"./resources/experiments\";\nimport { createInternalTagsResource } from \"./resources/internal-tags\";\nimport { createOrgsResource } from \"./resources/orgs\";\nimport { createPresetsResource } from \"./resources/presets\";\nimport { createSharedAssetFoldersResource } from \"./resources/shared-asset-folders\";\nimport { createSharedAssetsResource } from \"./resources/shared-assets\";\nimport { createSharedInternalTagsResource } from \"./resources/shared-internal-tags\";\nimport { createSpaceRolesResource } from \"./resources/space-roles\";\nimport { createSpacesResource } from \"./resources/spaces\";\nimport { createStoriesResource } from \"./resources/stories\";\nimport { createUsersResource } from \"./resources/users\";\nimport { createWebhooksResource } from \"./resources/webhooks\";\nimport { createWorkflowStagesResource } from \"./resources/workflow-stages\";\nimport { createWorkflowsResource } from \"./resources/workflows\";\n\n// ---------------------------------------------------------------------------\n// Client types (co-located with runtime)\n// ---------------------------------------------------------------------------\n\nexport type ApiResponse<T, ThrowOnError extends boolean = false> = ThrowOnError extends true\n  ? { data: T; error?: never; response: Response; request: Request }\n  :\n      | { data: T; error: undefined; response: Response; request: Request }\n      | { data: undefined; error: ClientError; response: Response; request: Request };\n\nexport interface RequestConfigOverrides {\n  throwOnError?: boolean;\n}\n\n/**\n * Arbitrary options forwarded to the underlying `fetch()` call.\n *\n * Standard `RequestInit` properties (`cache`, `credentials`, `mode`, …) and\n * non-standard, vendor-specific properties (Next.js `next`, Cloudflare `cf`, …)\n * are both supported.\n *\n * @example\n * ```ts\n * client.stories.get(123, {\n *   fetchOptions: {\n *     cache: 'no-store',\n *     next: { revalidate: 60 },\n *   },\n * })\n * ```\n */\nexport type FetchOptions = Record<string, unknown>;\n\nexport interface HttpRequestOptions {\n  query?: Record<string, unknown>;\n  body?: unknown;\n  headers?: Record<string, string>;\n  signal?: AbortSignal;\n  throwOnError?: RequestConfigOverrides[\"throwOnError\"];\n  fetchOptions?: FetchOptions;\n}\n\n/**\n * Dependencies injected into every resource factory.\n */\nexport interface MapiResourceDeps<DefaultThrowOnError extends boolean = false> {\n  client: Client;\n  spaceId?: number;\n  wrapRequest: <TData, ThrowOnError extends boolean = DefaultThrowOnError>(\n    fn: () => Promise<unknown>,\n    throwOnError?: ThrowOnError,\n  ) => Promise<ApiResponse<TData, ThrowOnError>>;\n}\n\ntype TokenConfig =\n  | {\n      /** Personal access token for authentication. */\n      personalAccessToken: string;\n      oauthToken?: never;\n    }\n  | {\n      personalAccessToken?: never;\n      /** OAuth bearer token for authentication. */\n      oauthToken: string;\n    }\n  | {\n      personalAccessToken?: undefined;\n      oauthToken?: undefined;\n    };\n\nexport type ManagementApiClientConfig<ThrowOnError extends boolean = false> = TokenConfig & {\n  /**\n   * The Storyblok space ID. Used as the default for space-scoped endpoints.\n   * You can also override it per request via `path.space_id`.\n   */\n  spaceId?: number;\n  /**\n   * Storyblok region. Determines the base URL.\n   * @default 'eu'\n   */\n  region?: Region;\n  /**\n   * Override the base URL entirely (e.g. for testing).\n   */\n  baseUrl?: string;\n  /**\n   * Additional request headers.\n   */\n  headers?: Record<string, string>;\n  /**\n   * Throw on HTTP errors instead of returning them.\n   * @default false\n   */\n  throwOnError?: ThrowOnError;\n  /**\n   * Retry configuration for failed requests.\n   */\n  retry?: RetryOptions;\n  /**\n   * Request timeout in milliseconds.\n   * @default 30_000\n   */\n  timeout?: number;\n  /**\n   * Preventive rate limiting to avoid hitting the Storyblok Management API rate limits.\n   *\n   * - `undefined` (default): single bucket at 6 requests per second.\n   * - `number`: fixed requests per second.\n   * - `false`: disable rate limiting entirely.\n   * - `RateLimitConfig`: `requestsPerSecond`, `adaptive` (back off on 429 and\n   *   recover on success, on by default) and `limiter` (replace the in-memory\n   *   limiter with one shared across instances).\n   */\n  rateLimit?: RateLimitConfig | number | false;\n};\n\n// ---------------------------------------------------------------------------\n// Client factory\n// ---------------------------------------------------------------------------\n\nfunction getAuthorizationHeader(config: ManagementApiClientConfig<boolean>): string | undefined {\n  if (config.personalAccessToken) {\n    return config.personalAccessToken;\n  }\n  if (config.oauthToken) {\n    return config.oauthToken.startsWith(\"Bearer \")\n      ? config.oauthToken\n      : `Bearer ${config.oauthToken}`;\n  }\n  return undefined;\n}\n\nconst createManagementApiClientBase = <DefaultThrowOnError extends boolean = false>(\n  config: ManagementApiClientConfig<DefaultThrowOnError>,\n): {\n  deps: MapiResourceDeps<DefaultThrowOnError>;\n  resources: Omit<ReturnType<typeof buildResources<DefaultThrowOnError>>, never>;\n} => {\n  const {\n    spaceId,\n    region = \"eu\",\n    baseUrl,\n    headers = {},\n    throwOnError = false,\n    retry = {\n      limit: 12,\n      backoffLimit: 20_000,\n      methods: [\"get\", \"post\", \"put\", \"delete\", \"patch\", \"head\", \"options\", \"trace\"],\n      statusCodes: [429],\n    },\n    timeout = 30_000,\n    rateLimit,\n  } = config;\n\n  const throttleManager = createThrottleManager(rateLimit ?? {});\n  const authHeader = getAuthorizationHeader(config);\n\n  const client: Client = createClient(\n    createConfig({\n      baseUrl: baseUrl || getManagementBaseUrl(region),\n      headers: {\n        ...(authHeader ? { Authorization: authHeader } : {}),\n        ...headers,\n      },\n      // Default serializer throws on nested objects; MAPI needs `filter_query`\n      // serialized as a nested hash (`filter_query[field][op]=value`).\n      querySerializer,\n      throwOnError,\n      kyOptions: {\n        throwHttpErrors: true,\n        timeout,\n        // Admission waits here, before ky starts the timeout clock: a queue\n        // longer than `timeout` must delay requests, not fail them.\n        hooks: { beforeRequest: [throttleManager.beforeRequest] },\n        retry,\n        // `globalThis.fetch` is read per call so a fetch swapped in after the\n        // client was created still applies.\n        fetch: throttleManager.wrapFetch((input, init) => globalThis.fetch(input, init)),\n      },\n    }),\n  );\n\n  client.interceptors.error.use(\n    (\n      error: unknown,\n      response: Response | undefined,\n      _request: Request | undefined,\n      options: ResolvedRequestOptions,\n    ) => {\n      if (!response) {\n        // A transport failure only ever reaches the interceptor through the generated\n        // client's outer catch, which — unlike the HTTP-error path below — passes the\n        // options as given to this call, not merged with the client-level default. A\n        // call that relies on that default rather than overriding `throwOnError` itself\n        // would otherwise read as `undefined` here regardless of the effective value.\n        if (options.throwOnError ?? throwOnError) {\n          // No HTTP answer at all — a timeout, an abort, a DNS failure. This rejects as-is\n          // rather than being wrapped, so its name, message, and `instanceof` checks (e.g.\n          // `AbortError`) survive.\n          return error;\n        }\n\n        // Without `throwOnError` this resolves as `result.error`, which `ApiResponse`\n        // types as `ClientError`. Wrap it here to keep that contract accurate — unlike the\n        // rejection path, callers can't narrow a resolved value by `instanceof` before\n        // touching it, so it has to already be the declared shape. The original error\n        // stays reachable via `cause`.\n        return new ClientError(\"API request failed\", {\n          status: 0,\n          statusText: \"\",\n          data: undefined,\n          cause: error,\n        });\n      }\n\n      return new ClientError(response.statusText || \"API request failed\", {\n        status: response.status,\n        statusText: response.statusText,\n        data: error,\n      });\n    },\n  );\n\n  /**\n   * Builds a placeholder `Request` for a call that never got far enough to produce one\n   * — a malformed `baseUrl` fails here too, in which case a request pointing nowhere in\n   * particular still beats losing `result.error`, which carries the original, more\n   * useful message (including the full attempted request URL).\n   */\n  const createFallbackRequest = (): Request => {\n    try {\n      return new Request(baseUrl || getManagementBaseUrl(region));\n    } catch {\n      return new Request(\"about:blank\");\n    }\n  };\n\n  function wrapRequest<TData, CurrentThrowOnError extends boolean = DefaultThrowOnError>(\n    fn: () => Promise<unknown>,\n    _throwOnError?: CurrentThrowOnError,\n  ): Promise<ApiResponse<TData, CurrentThrowOnError>> {\n    return throttleManager.execute(async () => {\n      const result = (await fn()) as ApiResponse<TData, CurrentThrowOnError>;\n      const response = result.response ?? Response.error();\n      const request = result.request ?? createFallbackRequest();\n\n      return { ...result, response, request };\n    });\n  }\n\n  const deps: MapiResourceDeps<DefaultThrowOnError> = { client, spaceId, wrapRequest };\n  return { deps, resources: buildResources(deps, client) };\n};\n\nfunction buildResources<DefaultThrowOnError extends boolean = false>(\n  deps: MapiResourceDeps<DefaultThrowOnError>,\n  client: Client,\n) {\n  /**\n   * Escape hatch: send a GET request to any MAPI endpoint not yet wrapped\n   * in a dedicated resource method.\n   */\n  const httpGet = <TData = unknown>(\n    path: string,\n    options: HttpRequestOptions = {},\n  ): Promise<ApiResponse<TData, DefaultThrowOnError>> => {\n    const { fetchOptions, ...rest } = options;\n    return deps.wrapRequest<TData>(() =>\n      client.get({\n        url: path,\n        ...rest,\n        ...(fetchOptions\n          ? { kyOptions: { ...client.getConfig().kyOptions, ...fetchOptions } }\n          : {}),\n      }),\n    );\n  };\n\n  /**\n   * Escape hatch: send a POST request to any MAPI endpoint not yet wrapped\n   * in a dedicated resource method.\n   */\n  const httpPost = <TData = unknown>(\n    path: string,\n    options: HttpRequestOptions = {},\n  ): Promise<ApiResponse<TData, DefaultThrowOnError>> => {\n    const { fetchOptions, ...rest } = options;\n    return deps.wrapRequest<TData>(() =>\n      client.post({\n        url: path,\n        ...rest,\n        ...(fetchOptions\n          ? { kyOptions: { ...client.getConfig().kyOptions, ...fetchOptions } }\n          : {}),\n      }),\n    );\n  };\n\n  /**\n   * Escape hatch: send a PUT request to any MAPI endpoint not yet wrapped\n   * in a dedicated resource method.\n   */\n  const httpPut = <TData = unknown>(\n    path: string,\n    options: HttpRequestOptions = {},\n  ): Promise<ApiResponse<TData, DefaultThrowOnError>> => {\n    const { fetchOptions, ...rest } = options;\n    return deps.wrapRequest<TData>(() =>\n      client.put({\n        url: path,\n        ...rest,\n        ...(fetchOptions\n          ? { kyOptions: { ...client.getConfig().kyOptions, ...fetchOptions } }\n          : {}),\n      }),\n    );\n  };\n\n  /**\n   * Escape hatch: send a PATCH request to any MAPI endpoint not yet wrapped\n   * in a dedicated resource method.\n   */\n  const httpPatch = <TData = unknown>(\n    path: string,\n    options: HttpRequestOptions = {},\n  ): Promise<ApiResponse<TData, DefaultThrowOnError>> => {\n    const { fetchOptions, ...rest } = options;\n    return deps.wrapRequest<TData>(() =>\n      client.patch({\n        url: path,\n        ...rest,\n        ...(fetchOptions\n          ? { kyOptions: { ...client.getConfig().kyOptions, ...fetchOptions } }\n          : {}),\n      }),\n    );\n  };\n\n  /**\n   * Escape hatch: send a DELETE request to any MAPI endpoint not yet wrapped\n   * in a dedicated resource method.\n   */\n  const httpDelete = <TData = unknown>(\n    path: string,\n    options: HttpRequestOptions = {},\n  ): Promise<ApiResponse<TData, DefaultThrowOnError>> => {\n    const { fetchOptions, ...rest } = options;\n    return deps.wrapRequest<TData>(() =>\n      client.delete({\n        url: path,\n        ...rest,\n        ...(fetchOptions\n          ? { kyOptions: { ...client.getConfig().kyOptions, ...fetchOptions } }\n          : {}),\n      }),\n    );\n  };\n\n  return {\n    assetFolders: createAssetFoldersResource(deps),\n    assets: createAssetsResource(deps),\n    componentFolders: createComponentFoldersResource(deps),\n    datasourceEntries: createDatasourceEntriesResource(deps),\n    datasources: createDatasourcesResource(deps),\n    experiments: createExperimentsResource(deps),\n    delete: httpDelete,\n    get: httpGet,\n    patch: httpPatch,\n    interceptors: client.interceptors as Middleware<\n      Request,\n      Response,\n      unknown,\n      ResolvedRequestOptions\n    >,\n    internalTags: createInternalTagsResource(deps),\n    orgs: createOrgsResource<DefaultThrowOnError>({ client, wrapRequest: deps.wrapRequest }),\n    post: httpPost,\n    presets: createPresetsResource(deps),\n    put: httpPut,\n    sharedAssetFolders: createSharedAssetFoldersResource(deps),\n    sharedAssets: createSharedAssetsResource(deps),\n    sharedInternalTags: createSharedInternalTagsResource(deps),\n    spaceRoles: createSpaceRolesResource(deps),\n    spaces: createSpacesResource(deps),\n    users: createUsersResource<DefaultThrowOnError>({ client, wrapRequest: deps.wrapRequest }),\n    webhooks: createWebhooksResource(deps),\n    workflowStages: createWorkflowStagesResource(deps),\n    workflows: createWorkflowsResource(deps),\n  };\n}\n\ntype StoryblokTypesConfig = { components: Block } | { blocks: Block };\n\ntype ResolveComponents<T extends StoryblokTypesConfig> = T extends {\n  components: infer C extends Block;\n}\n  ? C\n  : T extends { blocks: infer B extends Block }\n    ? B\n    : never;\n\n/** Extracts the `fieldType → value` plugin map from a Schema, defaulting to an empty map. */\ntype ResolveFieldPlugins<T> = T extends { fieldPlugins: infer P } ? P : Record<never, never>;\n\n/**\n * The return type of `createManagementApiClient`, parameterised by `TBlocks` so that\n * `.stories` methods can narrow story content types without touching the runtime object.\n * Component *definitions* (`.components`) are wire-shaped and not narrowed by `TBlocks`.\n */\nexport type ManagementApiClient<\n  TBlocks extends Block = Block,\n  TFieldPlugins = Record<never, never>,\n  DefaultThrowOnError extends boolean = false,\n> = ReturnType<typeof buildResources<DefaultThrowOnError>> & {\n  components: ReturnType<typeof createComponentsResource<DefaultThrowOnError>>;\n  stories: ReturnType<typeof createStoriesResource<TBlocks, TFieldPlugins, DefaultThrowOnError>>;\n  /**\n   * Returns the same client instance cast to a version that narrows story content\n   * to the provided component types. No runtime cost — type parameter is erased.\n   *\n   * Accepts either `{ components: ... }` or `{ blocks: ... }` — the latter matches the\n   * `Schema` type produced by `@storyblok/schema`'s `InferSchema`.\n   *\n   * @example\n   * ```ts\n   * import type { Schema } from './schema';\n   *\n   * const client = createManagementApiClient({ personalAccessToken: '...' })\n   *   .withTypes<Schema>();\n   * ```\n   */\n  withTypes: <T extends StoryblokTypesConfig>() => ManagementApiClient<\n    ResolveComponents<T>,\n    ResolveFieldPlugins<T>,\n    DefaultThrowOnError\n  >;\n};\n\nexport const createManagementApiClient = <DefaultThrowOnError extends boolean = false>(\n  config: ManagementApiClientConfig<DefaultThrowOnError>,\n): ManagementApiClient<Block, Record<never, never>, DefaultThrowOnError> => {\n  const { deps, resources } = createManagementApiClientBase(config);\n  const self: ManagementApiClient<Block, Record<never, never>, DefaultThrowOnError> = {\n    ...resources,\n    components: createComponentsResource<DefaultThrowOnError>(deps),\n    stories: createStoriesResource<Block, Record<never, never>, DefaultThrowOnError>(deps),\n    withTypes<T extends StoryblokTypesConfig>() {\n      return self as unknown as ManagementApiClient<\n        ResolveComponents<T>,\n        ResolveFieldPlugins<T>,\n        DefaultThrowOnError\n      >;\n    },\n  };\n  return self;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAwJA,SAAS,uBAAuB,QAAgE;CAC9F,IAAI,OAAO,qBACT,OAAO,OAAO;CAEhB,IAAI,OAAO,YACT,OAAO,OAAO,WAAW,WAAW,SAAS,IACzC,OAAO,aACP,UAAU,OAAO;AAGzB;AAEA,MAAM,iCACJ,WAIG;CACH,MAAM,EACJ,SACA,SAAS,MACT,SACA,UAAU,CAAC,GACX,eAAe,OACf,QAAQ;EACN,OAAO;EACP,cAAc;EACd,SAAS;GAAC;GAAO;GAAQ;GAAO;GAAU;GAAS;GAAQ;GAAW;EAAO;EAC7E,aAAa,CAAC,GAAG;CACnB,GACA,UAAU,KACV,cACE;CAEJ,MAAM,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