import type { CreatePageInput, CreatePageResult, GetPageResult, GetUserResult, ListUsersInput, ListUsersResult, NotionPageId, NotionUserId, UpdatePageInput, UpdatePageResult, UseDataSourceOptions } from "../types.js"; import type { NotionDataSource } from "./dataSources/dataSource.js"; import type { NotionDataSourcePageUpdateInput, NotionDataSourcePageUpdateResult } from "./dataSources/dataSourcePage.js"; import { type CustomBlockHostState } from "./hostState.js"; import type { ManifestLoadResult } from "./loadManifest.js"; import type { CustomBlockManifest } from "./manifest.js"; import { type InitMessage } from "./messages/init.js"; /** * Used to ensure that the host and client are using the same version of the bridge protocol. A * single host needs to support multiple custom blocks built with different versions of the bridge * protocol. Increment this number any time a breaking change is made to the bridge protocol. */ export declare const CUSTOM_BLOCK_BRIDGE_PROTOCOL_VERSION = 2; /** * A single entry in the bridge message log. Kept intentionally plain so the log * is copy-pasteable to a local coding agent without needing extra context. */ export type MessageLogEntry = { timestamp: string; direction: "sent" | "received"; data: unknown; }; export declare class SandboxBridge { private hostState; private listeners; private messageLog; private messageLogListeners; private nextRequestId; private readonly pendingCreatePage; private readonly pendingGetPage; private readonly pendingGetUser; private readonly pendingListUsers; private readonly pendingUpdatePage; private hasSentReady; private latestDataSourceBindings; private resolveInit; private rejectInit; private readonly initMessage; private manifest; constructor(); private static MAX_LOG_ENTRIES; private logMessage; getMessageLog(): readonly MessageLogEntry[]; subscribeToMessageLog(listener: () => void): () => boolean; awaitInit(signal?: AbortSignal): Promise; sendReady(manifestResult: ManifestLoadResult): void; private postToHost; private notify; private handleMessage; subscribe(listener: () => void): () => boolean; getHostState(): CustomBlockHostState; /** * The author-declared manifest loaded from `custom_blocks.json` and forwarded * to the host in `ready`. `null` when it failed to load/parse and the host * should reject init via `ready.status: "error"`. Static for the lifetime * of the sandbox. */ getManifest(): CustomBlockManifest | null; /** * Apply an `init` payload as if it had arrived from the host. Lets callers * seed the bridge directly (e.g. the React provider's standalone preview * fallback) without going through `postMessage`. The bridge stays unaware * of why it's being seeded. */ setMockState(message: InitMessage): void; private applyInit; queryDataSource(key: string, options?: UseDataSourceOptions): void; private setDataSourceQueryError; postResize(height: number): void; createPage(input: CreatePageInput): Promise; getPage(pageId: NotionPageId): Promise; getUser(userId: NotionUserId): Promise; listUsers(input?: ListUsersInput): Promise; updatePage(input: UpdatePageInput): Promise; /** * Updates a page on a known data source, resolving any property keys against the data source's * `propertyIdsByKey` before sending the bridge message. Used by the per-row `update` callback * returned from {@link getDataSourceQueryView}. */ updateDataSourcePage(args: { dataSource: NotionDataSource; pageId: NotionPageId; input: NotionDataSourcePageUpdateInput; }): Promise; /** * Translates the public `CreatePageInput["parent"]` into the bridge-native * `CreatePageMessageParent`. The `data_source_key` variant is resolved sandbox-side against * the data source mapping the host delivered in `init` / `dataSourcesChanged`. */ private resolveCreatePageParent; } //# sourceMappingURL=SandboxBridge.d.ts.map