import type { NotionDataSource } from "./dataSources/dataSource.js"; import type { NotionDataSourcePage, NotionDataSourcePageBridge, NotionDataSourcePageUpdateInput, NotionDataSourcePageUpdateResult } from "./dataSources/dataSourcePage.js"; import type { NotionPropertySchema } from "./dataSources/propertySchema.js"; import type { NotionBlockId } from "./ids.js"; import type { CustomBlockQueryDataSourceErrorInfo } from "./messages/queryDataSourceResult.js"; import type { CustomBlockPage, NotionPageId } from "./pages/page.js"; import type { NotionParent } from "./parent.js"; import type { NotionTheme } from "./theme.js"; import type { NotionUser } from "./users/user.js"; export type CustomBlockHostState = UninitializedHostState | InitializedHostState; export type UninitializedHostState = { status: "uninitialized"; theme: NotionTheme; }; export type InitializedHostState = { status: "initialized"; theme: NotionTheme; blockId: NotionBlockId; parent: NotionParent; page: CustomBlockPage; currentUser: NotionUser; dataSources: NotionDataSource[]; dataSourceState: Record; }; export type DataSourceQueryState = { /** Latest pages from the host as parsed from the bridge. `propertiesByKey` is derived lazily. */ items: NotionDataSourcePageBridge[]; isLoading: boolean; hasMore: boolean; error?: CustomBlockQueryDataSourceErrorInfo; latestRequestId?: string; latestSnapshotId?: string; latestLimit?: number; }; export declare function createEmptyDataSourceQueryState(): DataSourceQueryState; /** * Resolved page + schema views for a single data source, keyed by raw property * ID and by user-defined key. Re-derived from `propertyIdsByKey` on every read so * renames don't require a re-query. */ export type DataSourceQueryView = { items: NotionDataSourcePage[]; collectionSchema?: NotionDataSource["collectionSchema"]; propertySchemasById: { [propertyId: string]: NotionPropertySchema; }; propertySchemasByKey: { [key: string]: NotionPropertySchema | undefined; }; isLoading: boolean; hasMore: boolean; error?: CustomBlockQueryDataSourceErrorInfo; }; /** * Per-row callback that resolves property keys against the data source and forwards the * resulting write to the bridge. Injected by callers (typically the SDK singleton in `init.ts`) * so this module stays free of bridge-instance dependencies. */ export type UpdateDataSourcePageFn = (args: { dataSource: NotionDataSource; pageId: NotionPageId; input: NotionDataSourcePageUpdateInput; }) => Promise; export declare function getDataSourceQueryView(hostState: CustomBlockHostState, key: string, updateDataSourcePage: UpdateDataSourcePageFn): DataSourceQueryView; //# sourceMappingURL=hostState.d.ts.map