import type { NotionCollectionSchema } from "./bridge/dataSources/dataSource.js"; import type { NotionDataSourcePage, NotionDataSourcePageUpdateInput, NotionDataSourcePageUpdateResult } from "./bridge/dataSources/dataSourcePage.js"; import type { NotionPropertySchema } from "./bridge/dataSources/propertySchema.js"; import type { CustomBlockErrorInfo } from "./bridge/errors.js"; import type { NotionDataSourceId } from "./bridge/ids.js"; import type { NotionCreatePagePosition } from "./bridge/messages/createPage.js"; import type { CustomBlockCreatePageErrorInfo } from "./bridge/messages/createPageResult.js"; import type { CustomBlockGetPageErrorInfo } from "./bridge/messages/getPage.js"; import type { CustomBlockGetUserErrorInfo } from "./bridge/messages/getUser.js"; import type { CustomBlockListUsersErrorInfo } from "./bridge/messages/listUsers.js"; import type { CustomBlockQueryDataSourceErrorInfo } from "./bridge/messages/queryDataSourceResult.js"; import type { CustomBlockUpdatePageErrorInfo } from "./bridge/messages/updatePageResult.js"; import type { NotionPage, NotionPageCover, NotionPageIcon, NotionPageId, NotionPagePropertyInputMap, NotionPagePropertyWriteMap } from "./bridge/pages/page.js"; import type { NotionUser, NotionUserList } from "./bridge/users/user.js"; export type { NotionDataSourceId, NotionSpaceId } from "./bridge/ids.js"; export type { NotionPageId } from "./bridge/pages/page.js"; export type { NotionUser, NotionUserId, NotionUserList, } from "./bridge/users/user.js"; export type { CustomBlockCreatePageErrorInfo, CustomBlockErrorInfo, CustomBlockGetPageErrorInfo, CustomBlockGetUserErrorInfo, CustomBlockListUsersErrorInfo, CustomBlockQueryDataSourceErrorInfo, CustomBlockUpdatePageErrorInfo, NotionDataSourcePageUpdateInput, NotionDataSourcePageUpdateResult, }; /** * Return shape of `useDataSource`. * * - `items` — the rows the host has returned so far. Empty until the first response arrives. * - `isLoading` — `true` while a query is in flight. * - `hasMore` — `true` if the host indicated more rows are available beyond the current page. * - `error` — structured error information if the most recent query failed. */ export type UseDataSourceResult = { items: NotionDataSourcePage[]; /** * Collection/data-source schema for the bound Notion data source, including raw property * schemas. Undefined when the semantic data-source key has not been bound. */ collectionSchema?: NotionCollectionSchema; /** * Per-property schemas keyed by raw property ID, including the four synthetic built-ins * (`created_time`, `last_edited_time`, `created_by`, `last_edited_by`). */ propertySchemasById: { [propertyId: string]: NotionPropertySchema; }; /** * Per-property schemas keyed by user-defined keys from the data source's `propertyIdsByKey`. * Built-ins are NOT included here. Keys mapped to `undefined` indicate a declared-but-unbound * slot. */ propertySchemasByKey: { [key: string]: NotionPropertySchema | undefined; }; isLoading: boolean; hasMore: boolean; error?: CustomBlockQueryDataSourceErrorInfo; }; export type UseDataSourceOptions = { /** * Maximum number of rows to request from the host. Defaults to 20. */ limit?: number; }; /** * Parent reference accepted by `sdk.pages.create`. Mirrors Notion's public `POST /v1/pages` * parent shape; see https://developers.notion.com/reference/data-source. * * - `page_id`: Create a child page under the given Notion page. * - `data_source_id`: Create a row inside the given Notion data source (aka the internal * collection). The public API's `data_source_id` is the same UUID as the `collectionPointer.id` * exposed in `dataSources`, so either value works here. * - `data_source_key`: Create a row inside the data source that the custom block was configured with * under this semantic key. The SDK resolves the key to a `data_source_id` locally before * sending the request to the host. */ export type CreatePageParent = { type: "page_id"; page_id: NotionPageId; } | { type: "data_source_id"; data_source_id: NotionDataSourceId; } | { type: "data_source_key"; key: string; }; /** * Input accepted by `sdk.pages.create`. Mirrors the Notion public API `POST /v1/pages` API. */ export type CreatePageInput = { parent: CreatePageParent; properties: NotionPagePropertyInputMap; icon?: NotionPageIcon; cover?: NotionPageCover; position?: NotionCreatePagePosition; }; /** * The result of a `sdk.pages.create` API call. */ export type CreatePageResult = { status: "success"; /** The newly created page. */ page: NotionPage; } | { status: "error"; error: CustomBlockCreatePageErrorInfo; }; /** * Input accepted by `sdk.pages.update`. * * `properties` is keyed by raw Notion property ID. To update a row with configured * custom-block property keys, use the `update` helper on pages returned from * `useDataSource`. */ export type UpdatePageInput = { pageId: NotionPageId; properties?: NotionPagePropertyWriteMap; icon?: NotionPageIcon; cover?: NotionPageCover; archived?: boolean; }; /** * Result of `sdk.pages.get`. */ export type GetPageResult = { status: "success"; page: NotionPage; } | { status: "error"; error: CustomBlockGetPageErrorInfo; }; /** * Result of `sdk.pages.update` / `sdk.pages.delete`. */ export type UpdatePageResult = { status: "success"; page: NotionPage; } | { status: "error"; error: CustomBlockUpdatePageErrorInfo; }; export type ListUsersInput = { startCursor?: string; pageSize?: number; }; export type ListUsersResult = { status: "success"; list: NotionUserList; } | { status: "error"; error: CustomBlockListUsersErrorInfo; }; export type GetUserResult = { status: "success"; user: NotionUser; } | { status: "error"; error: CustomBlockGetUserErrorInfo; }; //# sourceMappingURL=types.d.ts.map