export type CreateApiCronAssetRegistryArgs = {'X-CRON-API-KEY': string}; export type CreateApiCronAssetRegistryOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Rebuild the canonical asset registry (cron) * * POST /cron/asset-registry */ export const createApiCronAssetRegistry = async (args: CreateApiCronAssetRegistryArgs, options: CreateApiCronAssetRegistryOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['X-CRON-API-KEY'] != null) headers.set("X-CRON-API-KEY", String(args['X-CRON-API-KEY'])) const url = `${baseUrl.replace(/\/+$/, '')}/cron/asset-registry${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };