import { type FetchableValue } from '@makeswift/controls';
import * as MakeswiftApiClient from '../state/makeswift-api-client';
import { APIResourceType, File, GlobalElement, LocalizedGlobalElement, Page, PagePathnameSlice, Site, Snippet, Swatch, Table, Typography } from './types';
import { GraphQLClient } from './graphql/client';
export type CacheData = MakeswiftApiClient.SerializedState;
export declare const CacheData: {
    empty(): CacheData;
};
/**
 * 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 MakeswiftHostApiClient {
    graphqlClient: GraphQLClient;
    makeswiftApiClient: MakeswiftApiClient.Store;
    subscribe: MakeswiftApiClient.Store['subscribe'];
    fetch: MakeswiftApiClient.HttpFetch;
    constructor({ uri, fetch, cacheData, locale, }: {
        uri: string;
        fetch: MakeswiftApiClient.HttpFetch;
        cacheData?: CacheData;
        locale?: string;
    });
    readSwatch(swatchId: string): Swatch | null;
    fetchSwatch(swatchId: string): Promise<Swatch | null>;
    resolveSwatch(swatchId: string | undefined): FetchableValue<Swatch | null>;
    readFile(fileId: string): File | null;
    fetchFile(fileId: string): Promise<File | null>;
    resolveFile(fileId: string | undefined): FetchableValue<File | null>;
    readTypography(typographyId: string): Typography | null;
    fetchTypography(typographyId: string): Promise<Typography | null>;
    resolveTypography(typographyId: string | undefined): FetchableValue<Typography | null>;
    readGlobalElement(globalElementId: string): GlobalElement | null;
    fetchGlobalElement(globalElementId: string): Promise<GlobalElement | null>;
    readLocalizedGlobalElement({ globalElementId, locale, }: {
        globalElementId: string;
        locale: string;
    }): LocalizedGlobalElement | null;
    fetchLocalizedGlobalElement({ globalElementId, locale, }: {
        globalElementId: string;
        locale: string;
    }): Promise<LocalizedGlobalElement | null>;
    readPagePathnameSlice({ pageId, locale, }: {
        pageId: string;
        locale: string | null;
    }): PagePathnameSlice | null;
    fetchPagePathnameSlice({ pageId, locale, }: {
        pageId: string;
        locale: string | null;
    }): Promise<PagePathnameSlice | null>;
    resolvePagePathnameSlice({ pageId, locale, }: {
        pageId: string | undefined;
        locale: string | null;
    }): FetchableValue<PagePathnameSlice | null>;
    resolveResource<R>(type: APIResourceType, { id, read, fetch, }: {
        id: string | undefined;
        read: (id: string) => R | null;
        fetch: (id: string) => Promise<R | null>;
    }): FetchableValue<R | null>;
    readTable(tableId: string): Table | null;
    fetchTable(tableId: string): Promise<Table | null>;
    createTableRecord(tableId: string, columns: any): Promise<void>;
    readSite(siteId: string): Site | null;
    readPage(pageId: string): Page | null;
    readSnippet(snippetId: string): Snippet | null;
}
//# sourceMappingURL=react.d.ts.map