UNPKG

notion-page-tree

Version:

Recursively fetch nested Notion pages from the root page/database/block node.

1,780 lines (1,779 loc) 532 kB
import { QueryDatabaseParameters } from '@notionhq/client/build/src/api-endpoints'; declare type FilterType = QueryDatabaseParameters['filter']; export declare const asFilterCollection: <T>(arg: Record<keyof T, { or: (({ title: { equals: string; } | { does_not_equal: string; } | { contains: string; } | { does_not_contain: string; } | { starts_with: string; } | { ends_with: string; } | ({ is_empty: true; } | { is_not_empty: true; }); property: string; type?: "title" | undefined; } | { rich_text: { equals: string; } | { does_not_equal: string; } | { contains: string; } | { does_not_contain: string; } | { starts_with: string; } | { ends_with: string; } | ({ is_empty: true; } | { is_not_empty: true; }); property: string; type?: "rich_text" | undefined; } | { number: ({ is_empty: true; } | { is_not_empty: true; }) | { equals: number; } | { does_not_equal: number; } | { greater_than: number; } | { less_than: number; } | { greater_than_or_equal_to: number; } | { less_than_or_equal_to: number; }; property: string; type?: "number" | undefined; } | { checkbox: { equals: boolean; } | { does_not_equal: boolean; }; property: string; type?: "checkbox" | undefined; } | { select: ({ is_empty: true; } | { is_not_empty: true; }) | { equals: string; } | { does_not_equal: string; }; property: string; type?: "select" | undefined; } | { multi_select: ({ is_empty: true; } | { is_not_empty: true; }) | { contains: string; } | { does_not_contain: string; }; property: string; type?: "multi_select" | undefined; } | { date: ({ is_empty: true; } | { is_not_empty: true; }) | { equals: string; } | { before: string; } | { after: string; } | { on_or_before: string; } | { on_or_after: string; } | { past_week: { [x: string]: never; }; } | { past_month: { [x: string]: never; }; } | { past_year: { [x: string]: never; }; } | { next_week: { [x: string]: never; }; } | { next_month: { [x: string]: never; }; } | { next_year: { [x: string]: never; }; }; property: string; type?: "date" | undefined; } | { people: ({ is_empty: true; } | { is_not_empty: true; }) | { contains: string; } | { does_not_contain: string; }; property: string; type?: "people" | undefined; } | { files: { is_empty: true; } | { is_not_empty: true; }; property: string; type?: "files" | undefined; } | { url: { equals: string; } | { does_not_equal: string; } | { contains: string; } | { does_not_contain: string; } | { starts_with: string; } | { ends_with: string; } | ({ is_empty: true; } | { is_not_empty: true; }); property: string; type?: "url" | undefined; } | { email: { equals: string; } | { does_not_equal: string; } | { contains: string; } | { does_not_contain: string; } | { starts_with: string; } | { ends_with: string; } | ({ is_empty: true; } | { is_not_empty: true; }); property: string; type?: "email" | undefined; } | { phone_number: { equals: string; } | { does_not_equal: string; } | { contains: string; } | { does_not_contain: string; } | { starts_with: string; } | { ends_with: string; } | ({ is_empty: true; } | { is_not_empty: true; }); property: string; type?: "phone_number" | undefined; } | { relation: ({ is_empty: true; } | { is_not_empty: true; }) | { contains: string; } | { does_not_contain: string; }; property: string; type?: "relation" | undefined; } | { created_by: ({ is_empty: true; } | { is_not_empty: true; }) | { contains: string; } | { does_not_contain: string; }; property: string; type?: "created_by" | undefined; } | { created_time: ({ is_empty: true; } | { is_not_empty: true; }) | { equals: string; } | { before: string; } | { after: string; } | { on_or_before: string; } | { on_or_after: string; } | { past_week: { [x: string]: never; }; } | { past_month: { [x: string]: never; }; } | { past_year: { [x: string]: never; }; } | { next_week: { [x: string]: never; }; } | { next_month: { [x: string]: never; }; } | { next_year: { [x: string]: never; }; }; property: string; type?: "created_time" | undefined; } | { last_edited_by: ({ is_empty: true; } | { is_not_empty: true; }) | { contains: string; } | { does_not_contain: string; }; property: string; type?: "last_edited_by" | undefined; } | { last_edited_time: ({ is_empty: true; } | { is_not_empty: true; }) | { equals: string; } | { before: string; } | { after: string; } | { on_or_before: string; } | { on_or_after: string; } | { past_week: { [x: string]: never; }; } | { past_month: { [x: string]: never; }; } | { past_year: { [x: string]: never; }; } | { next_week: { [x: string]: never; }; } | { next_month: { [x: string]: never; }; } | { next_year: { [x: string]: never; }; }; property: string; type?: "last_edited_time" | undefined; } | { formula: { string: { equals: string; } | { does_not_equal: string; } | { contains: string; } | { does_not_contain: string; } | { starts_with: string; } | { ends_with: string; } | ({ is_empty: true; } | { is_not_empty: true; }); } | { checkbox: { equals: boolean; } | { does_not_equal: boolean; }; } | { number: ({ is_empty: true; } | { is_not_empty: true; }) | { equals: number; } | { does_not_equal: number; } | { greater_than: number; } | { less_than: number; } | { greater_than_or_equal_to: number; } | { less_than_or_equal_to: number; }; } | { date: ({ is_empty: true; } | { is_not_empty: true; }) | { equals: string; } | { before: string; } | { after: string; } | { on_or_before: string; } | { on_or_after: string; } | { past_week: { [x: string]: never; }; } | { past_month: { [x: string]: never; }; } | { past_year: { [x: string]: never; }; } | { next_week: { [x: string]: never; }; } | { next_month: { [x: string]: never; }; } | { next_year: { [x: string]: never; }; }; }; property: string; type?: "formula" | undefined; } | { rollup: { any: { rich_text: { equals: string; } | { does_not_equal: string; } | { contains: string; } | { does_not_contain: string; } | { starts_with: string; } | { ends_with: string; } | ({ is_empty: true; } | { is_not_empty: true; }); } | { number: ({ is_empty: true; } | { is_not_empty: true; }) | { equals: number; } | { does_not_equal: number; } | { greater_than: number; } | { less_than: number; } | { greater_than_or_equal_to: number; } | { less_than_or_equal_to: number; }; } | { checkbox: { equals: boolean; } | { does_not_equal: boolean; }; } | { select: ({ is_empty: true; } | { is_not_empty: true; }) | { equals: string; } | { does_not_equal: string; }; } | { multi_select: ({ is_empty: true; } | { is_not_empty: true; }) | { contains: string; } | { does_not_contain: string; }; } | { relation: ({ is_empty: true; } | { is_not_empty: true; }) | { contains: string; } | { does_not_contain: string; }; } | { date: ({ is_empty: true; } | { is_not_empty: true; }) | { equals: string; } | { before: string; } | { after: string; } | { on_or_before: string; } | { on_or_after: string; } | { past_week: { [x: string]: never; }; } | { past_month: { [x: string]: never; }; } | { past_year: { [x: string]: never; }; } | { next_week: { [x: string]: never; }; } | { next_month: { [x: string]: never; }; } | { next_year: { [x: string]: never; }; }; } | { people: ({ is_empty: true; } | { is_not_empty: true; }) | { contains: string; } | { does_not_contain: string; }; } | { files: { is_empty: true; } | { is_not_empty: true; }; }; } | { none: { rich_text: { equals: string; } | { does_not_equal: string; } | { contains: string; } | { does_not_contain: string; } | { starts_with: string; } | { ends_with: string; } | ({ is_empty: true; } | { is_not_empty: true; }); } | { number: ({ is_empty: true; } | { is_not_empty: true; }) | { equals: number; } | { does_not_equal: number; } | { greater_than: number; } | { less_than: number; } | { greater_than_or_equal_to: number; } | { less_than_or_equal_to: number; }; } | { checkbox: { equals: boolean; } | { does_not_equal: boolean; }; } | { select: ({ is_empty: true; } | { is_not_empty: true; }) | { equals: string; } | { does_not_equal: string; }; } | { multi_select: ({ is_empty: true; } | { is_not_empty: true; }) | { contains: string; } | { does_not_contain: string; }; } | { relation: ({ is_empty: true; } | { is_not_empty: true; }) | { contains: string; } | { does_not_contain: string; }; } | { date: ({ is_empty: true; } | { is_not_empty: true; }) | { equals: string; } | { before: string; } | { after: string; } | { on_or_before: string; } | { on_or_after: string; } | { past_week: { [x: string]: never; }; } | { past_month: { [x: string]: never; }; } | { past_year: { [x: string]: never; }; } | { next_week: { [x: string]: never; }; } | { next_month: { [x: string]: never; }; } | { next_year: { [x: string]: never; }; }; } | { people: ({ is_empty: true; } | { is_not_empty: true; }) | { contains: string; } | { does_not_contain: string; }; } | { files: { is_empty: true; } | { is_not_empty: true; }; }; } | { every: { rich_text: { equals: string; } | { does_not_equal: string; } | { contains: string; } | { does_not_contain: string; } | { starts_with: string; } | { ends_with: string; } | ({ is_empty: true; } | { is_not_empty: true; }); } | { number: ({ is_empty: true; } | { is_not_empty: true; }) | { equals: number; } | { does_not_equal: number; } | { greater_than: number; } | { less_than: number; } | { greater_than_or_equal_to: number; } | { less_than_or_equal_to: number; }; } | { checkbox: { equals: boolean; } | { does_not_equal: boolean; }; } | { select: ({ is_empty: true; } | { is_not_empty: true; }) | { equals: string; } | { does_not_equal: string; }; } | { multi_select: ({ is_empty: true; } | { is_not_empty: true; }) | { contains: string; } | { does_not_contain: string; }; } | { relation: ({ is_empty: true; } | { is_not_empty: true; }) | { contains: string; } | { does_not_contain: string; }; } | { date: ({ is_empty: true; } | { is_not_empty: true; }) | { equals: string; } | { before: string; } | { after: string; } | { on_or_before: string; } | { on_or_after: string; } | { past_week: { [x: string]: never; }; } | { past_month: { [x: string]: never; }; } | { past_year: { [x: string]: never; }; } | { next_week: { [x: string]: never; }; } | { next_month: { [x: string]: never; }; } | { next_year: { [x: string]: never; }; }; } | { people: ({ is_empty: true; } | { is_not_empty: true; }) | { contains: string; } | { does_not_contain: string; }; } | { files: { is_empty: true; } | { is_not_empty: true; }; }; } | { date: ({ is_empty: true; } | { is_not_empty: true; }) | { equals: string; } | { before: string; } | { after: string; } | { on_or_before: string; } | { on_or_after: string; } | { past_week: { [x: string]: never; }; } | { past_month: { [x: string]: never; }; } | { past_year: { [x: string]: never; }; } | { next_week: { [x: string]: never; }; } | { next_month: { [x: string]: never; }; } | { next_year: { [x: string]: never; }; }; } | { number: ({ is_empty: true; } | { is_not_empty: true; }) | { equals: number; } | { does_not_equal: number; } | { greater_than: number; } | { less_than: number; } | { greater_than_or_equal_to: number; } | { less_than_or_equal_to: number; }; }; property: string; type?: "rollup" | undefined; }) | { created_time: ({ is_empty: true; } | { is_not_empty: true; }) | { equals: string; } | { before: string; } | { after: string; } | { on_or_before: string; } | { on_or_after: string; } | { past_week: { [x: string]: never; }; } | { past_month: { [x: string]: never; }; } | { past_year: { [x: string]: never; }; } | { next_week: { [x: string]: never; }; } | { next_month: { [x: string]: never; }; } | { next_year: { [x: string]: never; }; }; timestamp: "created_time"; type?: "created_time" | undefined; } | { last_edited_time: ({ is_empty: true; } | { is_not_empty: true; }) | { equals: string; } | { before: string; } | { after: string; } | { on_or_before: string; } | { on_or_after: string; } | { past_week: { [x: string]: never; }; } | { past_month: { [x: string]: never; }; } | { past_year: { [x: string]: never; }; } | { next_week: { [x: string]: never; }; } | { next_month: { [x: string]: never; }; } | { next_year: { [x: string]: never; }; }; timestamp: "last_edited_time"; type?: "last_edited_time" | undefined; } | { or: ({ title: { equals: string; } | { does_not_equal: string; } | { contains: string; } | { does_not_contain: string; } | { starts_with: string; } | { ends_with: string; } | ({ is_empty: true; } | { is_not_empty: true; }); property: string; type?: "title" | undefined; } | { rich_text: { equals: string; } | { does_not_equal: string; } | { contains: string; } | { does_not_contain: string; } | { starts_with: string; } | { ends_with: string; } | ({ is_empty: true; } | { is_not_empty: true; }); property: string; type?: "rich_text" | undefined; } | { number: ({ is_empty: true; } | { is_not_empty: true; }) | { equals: number; } | { does_not_equal: number; } | { greater_than: number; } | { less_than: number; } | { greater_than_or_equal_to: number; } | { less_than_or_equal_to: number; }; property: string; type?: "number" | undefined; } | { checkbox: { equals: boolean; } | { does_not_equal: boolean; }; property: string; type?: "checkbox" | undefined; } | { select: ({ is_empty: true; } | { is_not_empty: true; }) | { equals: string; } | { does_not_equal: string; }; property: string; type?: "select" | undefined; } | { multi_select: ({ is_empty: true; } | { is_not_empty: true; }) | { contains: string; } | { does_not_contain: string; }; property: string; type?: "multi_select" | undefined; } | { date: ({ is_empty: true; } | { is_not_empty: true; }) | { equals: string; } | { before: string; } | { after: string; } | { on_or_before: string; } | { on_or_after: string; } | { past_week: { [x: string]: never; }; } | { past_month: { [x: string]: never; }; } | { past_year: { [x: string]: never; }; } | { next_week: { [x: string]: never; }; } | { next_month: { [x: string]: never; }; } | { next_year: { [x: string]: never; }; }; property: string; type?: "date" | undefined; } | { people: ({ is_empty: true; } | { is_not_empty: true; }) | { contains: string; } | { does_not_contain: string; }; property: string; type?: "people" | undefined; } | { files: { is_empty: true; } | { is_not_empty: true; }; property: string; type?: "files" | undefined; } | { url: { equals: string; } | { does_not_equal: string; } | { contains: string; } | { does_not_contain: string; } | { starts_with: string; } | { ends_with: string; } | ({ is_empty: true; } | { is_not_empty: true; }); property: string; type?: "url" | undefined; } | { email: { equals: string; } | { does_not_equal: string; } | { contains: string; } | { does_not_contain: string; } | { starts_with: string; } | { ends_with: string; } | ({ is_empty: true; } | { is_not_empty: true; }); property: string; type?: "email" | undefined; } | { phone_number: { equals: string; } | { does_not_equal: string; } | { contains: string; } | { does_not_contain: string; } | { starts_with: string; } | { ends_with: string; } | ({ is_empty: true; } | { is_not_empty: true; }); property: string; type?: "phone_number" | undefined; } | { relation: ({ is_empty: true; } | { is_not_empty: true; }) | { contains: string; } | { does_not_contain: string; }; property: string; type?: "relation" | undefined; } | { created_by: ({ is_empty: true; } | { is_not_empty: true; }) | { contains: string; } | { does_not_contain: string; }; property: string; type?: "created_by" | undefined; } | { created_time: ({ is_empty: true; } | { is_not_empty: true; }) | { equals: string; } | { before: string; } | { after: string; } | { on_or_before: string; } | { on_or_after: string; } | { past_week: { [x: string]: never; }; } | { past_month: { [x: string]: never; }; } | { past_year: { [x: string]: never; }; } | { next_week: { [x: string]: never; }; } | { next_month: { [x: string]: never; }; } | { next_year: { [x: string]: never; }; }; property: string; type?: "created_time" | undefined; } | { last_edited_by: ({ is_empty: true; } | { is_not_empty: true; }) | { contains: string; } | { does_not_contain: string; }; property: string; type?: "last_edited_by" | undefined; } | { last_edited_time: ({ is_empty: true; } | { is_not_empty: true; }) | { equals: string; } | { before: string; } | { after: string; } | { on_or_before: string; } | { on_or_after: string; } | { past_week: { [x: string]: never; }; } | { past_month: { [x: string]: never; }; } | { past_year: { [x: string]: never; }; } | { next_week: { [x: string]: never; }; } | { next_month: { [x: string]: never; }; } | { next_year: { [x: string]: never; }; }; property: string; type?: "last_edited_time" | undefined; } | { formula: { string: { equals: string; } | { does_not_equal: string; } | { contains: string; } | { does_not_contain: string; } | { starts_with: string; } | { ends_with: string; } | ({ is_empty: true; } | { is_not_empty: true; }); } | { checkbox: { equals: boolean; } | { does_not_equal: boolean; }; } | { number: ({ is_empty: true; } | { is_not_empty: true; }) | { equals: number; } | { does_not_equal: number; } | { greater_than: number; } | { less_than: number; } | { greater_than_or_equal_to: number; } | { less_than_or_equal_to: number; }; } | { date: ({ is_empty: true; } | { is_not_empty: true; }) | { equals: string; } | { before: string; } | { after: string; } | { on_or_before: string; } | { on_or_after: string; } | { past_week: { [x: string]: never; }; } | { past_month: { [x: string]: never; }; } | { past_year: { [x: string]: never; }; } | { next_week: { [x: string]: never; }; } | { next_month: { [x: string]: never; }; } | { next_year: { [x: string]: never; }; }; }; property: string; type?: "formula" | undefined; } | { rollup: { any: { rich_text: { equals: string; } | { does_not_equal: string; } | { contains: string; } | { does_not_contain: string; } | { starts_with: string; } | { ends_with: string; } | ({ is_empty: true; } | { is_not_empty: true; }); } | { number: ({ is_empty: true; } | { is_not_empty: true; }) | { equals: number; } | { does_not_equal: number; } | { greater_than: number; } | { less_than: number; } | { greater_than_or_equal_to: number; } | { less_than_or_equal_to: number; }; } | { checkbox: { equals: boolean; } | { does_not_equal: boolean; }; } | { select: ({ is_empty: true; } | { is_not_empty: true; }) | { equals: string; } | { does_not_equal: string; }; } | { multi_select: ({ is_empty: true; } | { is_not_empty: true; }) | { contains: string; } | { does_not_contain: string; }; } | { relation: ({ is_empty: true; } | { is_not_empty: true; }) | { contains: string; } | { does_not_contain: string; }; } | { date: ({ is_empty: true; } | { is_not_empty: true; }) | { equals: string; } | { before: string; } | { after: string; } | { on_or_before: string; } | { on_or_after: string; } | { past_week: { [x: string]: never; }; } | { past_month: { [x: string]: never; }; } | { past_year: { [x: string]: never; }; } | { next_week: { [x: string]: never; }; } | { next_month: { [x: string]: never; }; } | { next_year: { [x: string]: never; }; }; } | { people: ({ is_empty: true; } | { is_not_empty: true; }) | { contains: string; } | { does_not_contain: string; }; } | { files: { is_empty: true; } | { is_not_empty: true; }; }; } | { none: { rich_text: { equals: string; } | { does_not_equal: string; } | { contains: string; } | { does_not_contain: string; } | { starts_with: string; } | { ends_with: string; } | ({ is_empty: true; } | { is_not_empty: true; }); } | { number: ({ is_empty: true; } | { is_not_empty: true; }) | { equals: number; } | { does_not_equal: number; } | { greater_than: number; } | { less_than: number; } | { greater_than_or_equal_to: number; } | { less_than_or_equal_to: number; }; } | { checkbox: { equals: boolean; } | { does_not_equal: boolean; }; } | { select: ({ is_empty: true; } | { is_not_empty: true; }) | { equals: string; } | { does_not_equal: string; }; } | { multi_select: ({ is_empty: true; } | { is_not_empty: true; }) | { contains: string; } | { does_not_contain: string; }; } | { relation: ({ is_empty: true; } | { is_not_empty: true; }) | { contains: string; } | { does_not_contain: string; }; } | { date: ({ is_empty: true; } | { is_not_empty: true; }) | { equals: string; } | { before: string; } | { after: string; } | { on_or_before: string; } | { on_or_after: string; } | { past_week: { [x: string]: never; }; } | { past_month: { [x: string]: never; }; } | { past_year: { [x: string]: never; }; } | { next_week: { [x: string]: never; }; } | { next_month: { [x: string]: never; }; } | { next_year: { [x: string]: never; }; }; } | { people: ({ is_empty: true; } | { is_not_empty: true; }) | { contains: string; } | { does_not_contain: string; }; } | { files: { is_empty: true; } | { is_not_empty: true; }; }; } | { every: { rich_text: { equals: string; } | { does_not_equal: string; } | { contains: string; } | { does_not_contain: string; } | { starts_with: string; } | { ends_with: string; } | ({ is_empty: true; } | { is_not_empty: true; }); } | { number: ({ is_empty: true; } | { is_not_empty: true; }) | { equals: number; } | { does_not_equal: number; } | { greater_than: number; } | { less_than: number; } | { greater_than_or_equal_to: number; } | { less_than_or_equal_to: number; }; } | { checkbox: { equals: boolean; } | { does_not_equal: boolean; }; } | { select: ({ is_empty: true; } | { is_not_empty: true; }) | { equals: string; } | { does_not_equal: string; }; } | { multi_select: ({ is_empty: true; } | { is_not_empty: true; }) | { contains: string; } | { does_not_contain: string; }; } | { relation: ({ is_empty: true; } | { is_not_empty: true; }) | { contains: string; } | { does_not_contain: string; }; } | { date: ({ is_empty: true; } | { is_not_empty: true; }) | { equals: string; } | { before: string; } | { after: string; } | { on_or_before: string; } | { on_or_after: string; } | { past_week: { [x: string]: never; }; } | { past_month: { [x: string]: never; }; } | { past_year: { [x: string]: never; }; } | { next_week: { [x: string]: never; }; } | { next_month: { [x: string]: never; }; } | { next_year: { [x: string]: never; }; }; } | { people: ({ is_empty: true; } | { is_not_empty: true; }) | { contains: string; } | { does_not_contain: string; }; } | { files: { is_empty: true; } | { is_not_empty: true; }; }; } | { date: ({ is_empty: true; } | { is_not_empty: true; }) | { equals: string; } | {