import { Block, BlockId, Blockquote, CdaStructuredTextRecord, CdaStructuredTextValue, Code, Document, Heading, InlineBlock, InlineItem, InlineNode, ItemLink, Link, List, ListItem, Node, NodeType, Paragraph, Root, Span, StructuredText, ThematicBreak, WithChildrenNode } from './types'; export declare function hasChildren(node: Node): node is WithChildrenNode; export declare function isInlineNode(node: Node): node is InlineNode; export declare function isHeading(node: Node): node is Heading; export declare function isSpan(node: Node): node is Span; export declare function isRoot(node: Node): node is Root; export declare function isParagraph(node: Node): node is Paragraph; export declare function isList(node: Node): node is List; export declare function isListItem(node: Node): node is ListItem; export declare function isBlockquote(node: Node): node is Blockquote; export declare function isBlock(node: Node): node is Block; /** * Narrows a union of block item shapes to the member whose model * (`item_type`) matches `Id`. * * Matches existing (persisted) blocks — items that carry an `id` and * whose `relationships.item_type.data.id` matches. That covers both the * `nested: true` response form and the "updated block" variant of * request payloads. Filtered out: * - bare string IDs (no `id` property to read) * - newly-created blocks in request payloads (they have no `id` yet — * the caller already knows the type, so finding them by model is * not the typical use case) * * `relationships` is constrained as optional so the updated-block * request shape (where `relationships?` may be omitted when patching an * existing block) is still picked up. */ export type NarrowBlockItemByItemType = Extract; /** * Type guard that narrows a `block` node to the variant whose `item` * belongs to a specific model. * * Two call styles are available: * * - Curried: `isBlockWithItemOfType(itemTypeId)` returns a predicate, * handy with `findFirstNode` / `findAllNodes` / `Array#filter`. * - Direct: `isBlockWithItemOfType(itemTypeId, node)` checks a node * inline (e.g. inside an `if`). * * For the literal `Id` to be preserved (and narrowing to work), the * `itemTypeId` argument must be typed as a literal — use `as const` on * pre-set ID constants. * * @example * ```ts * // Curried * const needle = findFirstNode( * body.document, * isBlockWithItemOfType(WARNING_BLOCK_TYPE_ID), * ); * * // Direct * if (isBlockWithItemOfType(WARNING_BLOCK_TYPE_ID, node)) { * node.item; // narrowed to the Warning item shape * } * ``` */ export declare function isBlockWithItemOfType(itemTypeId: Id): (node: Node) => node is Block>; export declare function isBlockWithItemOfType(itemTypeId: Id, node: Node): node is Block>; export declare function isInlineBlock(node: Node): node is InlineBlock; /** * Type guard that narrows an `inlineBlock` node to the variant whose * `item` belongs to a specific model. * * Mirrors {@link isBlockWithItemOfType} for inline blocks; supports both * the curried form (`isInlineBlockWithItemOfType(itemTypeId)`) and the * direct form (`isInlineBlockWithItemOfType(itemTypeId, node)`). * * For the literal `Id` to be preserved (and narrowing to work), the * `itemTypeId` argument must be typed as a literal — use `as const` on * pre-set ID constants. * * @example * ```ts * // Curried * const needle = findFirstNode( * body.document, * isInlineBlockWithItemOfType(CALLOUT_BLOCK_TYPE_ID), * ); * * // Direct * if (isInlineBlockWithItemOfType(CALLOUT_BLOCK_TYPE_ID, node)) { * node.item; // narrowed to the Callout item shape * } * ``` */ export declare function isInlineBlockWithItemOfType(itemTypeId: Id): (node: Node) => node is InlineBlock>; export declare function isInlineBlockWithItemOfType(itemTypeId: Id, node: Node): node is InlineBlock>; export declare function isCode(node: Node): node is Code; export declare function isLink(node: Node): node is Link; export declare function isItemLink(node: Node): node is ItemLink; export declare function isInlineItem(node: Node): node is InlineItem; export declare function isThematicBreak(node: Node): node is ThematicBreak; export declare function isNodeType(value: string): value is NodeType; export declare function isNode(obj: unknown): obj is Node; export declare function isCdaStructuredTextValue(obj: unknown): obj is CdaStructuredTextValue; /** * @deprecated Use isCdaStructuredTextValue instead */ export declare function isStructuredText(obj: unknown): obj is StructuredText; export declare function isDocument(obj: unknown): obj is Document; export declare function isEmptyDocument(obj: unknown): boolean;