import { type State as ApiClientState } from '../state/api-client/state'; import { type File, type GlobalElement, type LocalizedGlobalElement, type PagePathnameSlice, type Swatch, type Table, type Typography, type HttpFetch } from './types'; import { type SiteVersion } from './site-version'; import { ApiResourcesClient } from './api-resources-client'; /** * NOTE(miguel): This "client" is used to fetch Makeswift API resources needed for the host. For * example, swatches, files, typographies, etc. Ideally it's internal to the runtime and is only * used by controls to transform API references to API resources. * * Moreover, its use should be reserved for the builder only, since for live pages all Makeswift * API resources should be embedded in the "page snapshot". In the builder, this client serves the * purpose of sending requests for API resources and keeping a cache so that changes that happen in * the builder, like modifying a swatch, can be sent via `postMessage` to the host and the cache can * immediately update the value and re-render. * * Furthermore, the API resources requested shouldn't be requested directly from the Makeswift API * as that would require those resources to not be authenticated since the requests come from the * browser when running the host. Instead, the requests should go to the host directly, at the * Makeswift API endpoint (i.g., `/api/makeswift/[...makeswift]` dynamic route) where the host's * API key can be used, securely, in the server. For this reason, this client should really be a * client of the host's API, not Makeswift's, intended to build and continuously maintain a realtime * snapshot for use in the builder, not the lives pages. */ export declare class HostApiResourcesClient extends ApiResourcesClient { readonly fetch: HttpFetch; constructor({ fetch, preloadedState, }: { fetch: HttpFetch; preloadedState: Partial; }); protected fetchSwatchImpl(id: string, version: SiteVersion | null): Promise; protected fetchFileImpl(id: string, version: SiteVersion | null): Promise; protected fetchTypographyImpl(id: string, version: SiteVersion | null): Promise; protected fetchGlobalElementImpl(id: string, version: SiteVersion | null): Promise; protected fetchLocalizedGlobalElementImpl(id: string, version: SiteVersion | null, locale: string): Promise; protected fetchPagePathnameSliceImpl(id: string, version: SiteVersion | null, locale: string | null | undefined): Promise; protected fetchTableImpl(id: string, version: SiteVersion | null): Promise; private fetchVersioned; } //# sourceMappingURL=host-api-resources-client.d.ts.map