Skip to content

DataSource

Defined in: src/models/dataSource.model.ts:21

Data Source model class with helper methods.

Data sources are individual tables of data that live under a Notion database.

new DataSource(data): DataSource

Defined in: src/models/dataSource.model.ts:22

{ file: { expiry_time: string; url: string; }; type: "file"; } | { file_upload: { id: string; }; type: "file_upload"; } | { external: { url: string; }; type: "external"; } | null = ...

Data source cover image

{ avatar_url?: string | null; id: string; name?: string; object: "user"; person: { email: string; email_verified?: boolean; }; type: "person"; } | { avatar_url?: string | null; bot: { owner: { type: "workspace"; workspace: true; } | { type: "user"; }; workspace_id?: string; workspace_limits?: { max_file_upload_size_in_bytes: number; }; workspace_name?: string | null; }; id: string; name?: string; object: "user"; type: "bot"; } | { id: string; object: "user"; } = userSchema

User who created the data source

string = notionDateStringSchema

Creation date and time for this data source, in ISO 8601 format

{ database_id: string; type: "database_id"; } | { data_source_id: string; database_id: string; type: "data_source_id"; } | { page_id: string; type: "page_id"; } | { type: "workspace"; workspace: true; } | { block_id: string; type: "block_id"; } | { agent_id: string; type: "agent_id"; } = parentSchema

Information about the database’s parent (the data source’s grandparent)

({ annotations: { bold: boolean; code: boolean; color: "default" | "blue" | "blue_background" | "brown" | "brown_background" | "gray" | "gray_background" | "green" | "green_background" | "orange" | "orange_background" | "pink" | "pink_background" | "purple" | "purple_background" | "red" | "red_background" | "yellow" | "yellow_background"; italic: boolean; strikethrough: boolean; underline: boolean; }; href: string | null; plain_text: string; text: { content: string; link: { url: string; } | null; }; type: "text"; } | { annotations: { bold: boolean; code: boolean; color: "default" | "blue" | "blue_background" | "brown" | "brown_background" | "gray" | "gray_background" | "green" | "green_background" | "orange" | "orange_background" | "pink" | "pink_background" | "purple" | "purple_background" | "red" | "red_background" | "yellow" | "yellow_background"; italic: boolean; strikethrough: boolean; underline: boolean; }; href: string | null; mention: { database: { id: string; }; type: "database"; } | { date: { end: string | null; start: string; time_zone?: string | null; }; type: "date"; } | { link_preview: { url: string; }; type: "link_preview"; } | { page: { id: string; }; type: "page"; } | { template_mention: { template_mention_date: "today" | "now"; type: "template_mention_date"; } | { template_mention_user: "me"; type: "template_mention_user"; }; type: "template_mention"; } | { type: "user"; user: { avatar_url?: string | null; id: string; name?: string; object: "user"; person: { email: string; email_verified?: boolean; }; type: "person"; } | { avatar_url?: string | null; bot: { owner: { type: …; workspace: …; } | { type: …; }; workspace_id?: string; workspace_limits?: { max_file_upload_size_in_bytes: …; }; workspace_name?: string | null; }; id: string; name?: string; object: "user"; type: "bot"; } | { id: string; object: "user"; }; }; plain_text: string; type: "mention"; } | { annotations: { bold: boolean; code: boolean; color: "default" | "blue" | "blue_background" | "brown" | "brown_background" | "gray" | "gray_background" | "green" | "green_background" | "orange" | "orange_background" | "pink" | "pink_background" | "purple" | "purple_background" | "red" | "red_background" | "yellow" | "yellow_background"; italic: boolean; strikethrough: boolean; underline: boolean; }; equation: { expression: string; }; href: string | null; plain_text: string; type: "equation"; })[] = richTextSchema

Description of the data source as it appears in Notion

{ file: { expiry_time: string; url: string; }; type: "file"; } | { file_upload: { id: string; }; type: "file_upload"; } | { external: { url: string; }; type: "external"; } | { emoji: string; type: "emoji"; } | { icon: { color?: "blue" | "brown" | "gray" | "green" | "orange" | "pink" | "purple" | "red" | "yellow" | "lightgray"; name: string; }; type: "icon"; } | { custom_emoji: { id: string; name?: string; url?: string; }; type: "custom_emoji"; } | null = ...

Data source icon (File, Emoji, Native Icon, or Custom Emoji object)

string = ...

Unique identifier for the data source

boolean = ...

Whether the data source is in the trash

boolean = ...

Whether the data source is inline

{ avatar_url?: string | null; id: string; name?: string; object: "user"; person: { email: string; email_verified?: boolean; }; type: "person"; } | { avatar_url?: string | null; bot: { owner: { type: "workspace"; workspace: true; } | { type: "user"; }; workspace_id?: string; workspace_limits?: { max_file_upload_size_in_bytes: number; }; workspace_name?: string | null; }; id: string; name?: string; object: "user"; type: "bot"; } | { id: string; object: "user"; } = userSchema

User who last edited the data source

string = notionDateStringSchema

Last edited date and time for this data source, in ISO 8601 format

"data_source" = ...

Always “data_source”

{ database_id: string; type: "database_id"; } | { data_source_id: string; database_id: string; type: "data_source_id"; } | { page_id: string; type: "page_id"; } | { type: "workspace"; workspace: true; } | { block_id: string; type: "block_id"; } | { agent_id: string; type: "agent_id"; } = parentSchema

Information about the data source’s parent database

Record<string, { checkbox: Record<string, never>; description?: string; id: string; name: string; type: "checkbox"; } | { created_by: Record<string, never>; description?: string; id: string; name: string; type: "created_by"; } | { created_time: Record<string, never>; description?: string; id: string; name: string; type: "created_time"; } | { date: Record<string, never>; description?: string; id: string; name: string; type: "date"; } | { description?: string; email: Record<string, never>; id: string; name: string; type: "email"; } | { description?: string; files: Record<string, never>; id: string; name: string; type: "files"; } | { description?: string; formula: { expression: string; }; id: string; name: string; type: "formula"; } | { description?: string; id: string; last_edited_by: Record<string, never>; name: string; type: "last_edited_by"; } | { description?: string; id: string; last_edited_time: Record<string, never>; name: string; type: "last_edited_time"; } | { description?: string; id: string; multi_select: { options: object[]; }; name: string; type: "multi_select"; } | { description?: string; id: string; name: string; number: { format: "number" | "argentine_peso" | "baht" | "australian_dollar" | "canadian_dollar" | "chilean_peso" | "colombian_peso" | "danish_krone" | "dirham" | "dollar" | "euro" | "forint" | "franc" | "hong_kong_dollar" | "koruna" | "krona" | "leu" | "lira" | "mexican_peso" | "new_taiwan_dollar" | "new_zealand_dollar" | "norwegian_krone" | "number_with_commas" | "percent" | "philippine_peso" | "pound" | "peruvian_sol" | "rand" | "real" | "ringgit" | "riyal" | "ruble" | "rupee" | "rupiah" | "shekel" | "singapore_dollar" | "uruguayan_peso" | "yen" | "yuan" | "won" | "zloty"; }; type: "number"; } | { description?: string; id: string; name: string; people: Record<string, never>; type: "people"; } | { description?: string; id: string; name: string; phone_number: Record<string, never>; type: "phone_number"; } | { description?: string; id: string; name: string; place: Record<string, never>; type: "place"; } | { description?: string; id: string; name: string; relation: { data_source_id: string; synced_property_id: string; synced_property_name: string; }; type: "relation"; } | { description?: string; id: string; name: string; rich_text: Record<string, never>; type: "rich_text"; } | { description?: string; id: string; name: string; rollup: { function: "range" | "checked" | "average" | "count_per_group" | "count" | "count_values" | "date_range" | "earliest_date" | "empty" | "latest_date" | "max" | "median" | "min" | "not_empty" | "percent_checked" | "percent_empty" | "percent_not_empty" | "percent_per_group" | "percent_unchecked" | "unchecked" | "unique" | "show_original" | "show_unique" | "sum"; relation_property_id: string; relation_property_name: string; rollup_property_id: string; rollup_property_name: string; }; type: "rollup"; } | { description?: string; id: string; name: string; select: { options: object[]; }; type: "select"; } | { description?: string; id: string; name: string; status: { groups: object[]; options: object[]; }; type: "status"; } | { description?: string; id: string; name: string; title: Record<string, never>; type: "title"; } | { description?: string; id: string; name: string; type: "url"; url: Record<string, never>; } | { description?: string; id: string; name: string; type: "unique_id"; unique_id: { prefix?: string; }; }> = propertiesObjectSchema

Schema of properties for the data source as they appear in Notion

string | null = ...

The public URL if published, otherwise null

({ annotations: { bold: boolean; code: boolean; color: "default" | "blue" | "blue_background" | "brown" | "brown_background" | "gray" | "gray_background" | "green" | "green_background" | "orange" | "orange_background" | "pink" | "pink_background" | "purple" | "purple_background" | "red" | "red_background" | "yellow" | "yellow_background"; italic: boolean; strikethrough: boolean; underline: boolean; }; href: string | null; plain_text: string; text: { content: string; link: { url: string; } | null; }; type: "text"; } | { annotations: { bold: boolean; code: boolean; color: "default" | "blue" | "blue_background" | "brown" | "brown_background" | "gray" | "gray_background" | "green" | "green_background" | "orange" | "orange_background" | "pink" | "pink_background" | "purple" | "purple_background" | "red" | "red_background" | "yellow" | "yellow_background"; italic: boolean; strikethrough: boolean; underline: boolean; }; href: string | null; mention: { database: { id: string; }; type: "database"; } | { date: { end: string | null; start: string; time_zone?: string | null; }; type: "date"; } | { link_preview: { url: string; }; type: "link_preview"; } | { page: { id: string; }; type: "page"; } | { template_mention: { template_mention_date: "today" | "now"; type: "template_mention_date"; } | { template_mention_user: "me"; type: "template_mention_user"; }; type: "template_mention"; } | { type: "user"; user: { avatar_url?: string | null; id: string; name?: string; object: "user"; person: { email: string; email_verified?: boolean; }; type: "person"; } | { avatar_url?: string | null; bot: { owner: { type: …; workspace: …; } | { type: …; }; workspace_id?: string; workspace_limits?: { max_file_upload_size_in_bytes: …; }; workspace_name?: string | null; }; id: string; name?: string; object: "user"; type: "bot"; } | { id: string; object: "user"; }; }; plain_text: string; type: "mention"; } | { annotations: { bold: boolean; code: boolean; color: "default" | "blue" | "blue_background" | "brown" | "brown_background" | "gray" | "gray_background" | "green" | "green_background" | "orange" | "orange_background" | "pink" | "pink_background" | "purple" | "purple_background" | "red" | "red_background" | "yellow" | "yellow_background"; italic: boolean; strikethrough: boolean; underline: boolean; }; equation: { expression: string; }; href: string | null; plain_text: string; type: "equation"; })[] = richTextSchema

Name of the data source as it appears in Notion

string = ...

The Notion URL of the data source

DataSource

BaseModel<NotionDataSource>.constructor

get cover(): { file: { expiry_time: string; url: string; }; type: "file"; } | { file_upload: { id: string; }; type: "file_upload"; } | { external: { url: string; }; type: "external"; } | null

Defined in: src/models/dataSource.model.ts:113

Returns the data source cover image.

{ file: { expiry_time: string; url: string; }; type: "file"; } | { file_upload: { id: string; }; type: "file_upload"; } | { external: { url: string; }; type: "external"; } | null


get createdBy(): { avatar_url?: string | null; id: string; name?: string; object: "user"; person: { email: string; email_verified?: boolean; }; type: "person"; } | { avatar_url?: string | null; bot: { owner: { type: "workspace"; workspace: true; } | { type: "user"; }; workspace_id?: string; workspace_limits?: { max_file_upload_size_in_bytes: number; }; workspace_name?: string | null; }; id: string; name?: string; object: "user"; type: "bot"; } | { id: string; object: "user"; }

Defined in: src/models/dataSource.model.ts:71

Returns the user who created the data source.

{ avatar_url?: string | null; id: string; name?: string; object: "user"; person: { email: string; email_verified?: boolean; }; type: "person"; } | { avatar_url?: string | null; bot: { owner: { type: "workspace"; workspace: true; } | { type: "user"; }; workspace_id?: string; workspace_limits?: { max_file_upload_size_in_bytes: number; }; workspace_name?: string | null; }; id: string; name?: string; object: "user"; type: "bot"; } | { id: string; object: "user"; }


get createdTime(): Date

Defined in: src/models/dataSource.model.ts:64

Returns the created time as a Date object.

Date


get databaseParent(): { database_id: string; type: "database_id"; } | { data_source_id: string; database_id: string; type: "data_source_id"; } | { page_id: string; type: "page_id"; } | { type: "workspace"; workspace: true; } | { block_id: string; type: "block_id"; } | { agent_id: string; type: "agent_id"; }

Defined in: src/models/dataSource.model.ts:57

Returns the database parent object (data source’s grandparent).

{ database_id: string; type: "database_id"; } | { data_source_id: string; database_id: string; type: "data_source_id"; } | { page_id: string; type: "page_id"; } | { type: "workspace"; workspace: true; } | { block_id: string; type: "block_id"; } | { agent_id: string; type: "agent_id"; }


get description(): ({ annotations: { bold: boolean; code: boolean; color: "default" | "blue" | "blue_background" | "brown" | "brown_background" | "gray" | "gray_background" | "green" | "green_background" | "orange" | "orange_background" | "pink" | "pink_background" | "purple" | "purple_background" | "red" | "red_background" | "yellow" | "yellow_background"; italic: boolean; strikethrough: boolean; underline: boolean; }; href: string | null; plain_text: string; text: { content: string; link: { url: string; } | null; }; type: "text"; } | { annotations: { bold: boolean; code: boolean; color: "default" | "blue" | "blue_background" | "brown" | "brown_background" | "gray" | "gray_background" | "green" | "green_background" | "orange" | "orange_background" | "pink" | "pink_background" | "purple" | "purple_background" | "red" | "red_background" | "yellow" | "yellow_background"; italic: boolean; strikethrough: boolean; underline: boolean; }; href: string | null; mention: { database: { id: string; }; type: "database"; } | { date: { end: string | null; start: string; time_zone?: string | null; }; type: "date"; } | { link_preview: { url: string; }; type: "link_preview"; } | { page: { id: string; }; type: "page"; } | { template_mention: { template_mention_date: "today" | "now"; type: "template_mention_date"; } | { template_mention_user: "me"; type: "template_mention_user"; }; type: "template_mention"; } | { type: "user"; user: { avatar_url?: string | null; id: string; name?: string; object: "user"; person: { email: string; email_verified?: boolean; }; type: "person"; } | { avatar_url?: string | null; bot: { owner: { type: "workspace"; workspace: true; } | { type: "user"; }; workspace_id?: string; workspace_limits?: { max_file_upload_size_in_bytes: number; }; workspace_name?: string | null; }; id: string; name?: string; object: "user"; type: "bot"; } | { id: string; object: "user"; }; }; plain_text: string; type: "mention"; } | { annotations: { bold: boolean; code: boolean; color: "default" | "blue" | "blue_background" | "brown" | "brown_background" | "gray" | "gray_background" | "green" | "green_background" | "orange" | "orange_background" | "pink" | "pink_background" | "purple" | "purple_background" | "red" | "red_background" | "yellow" | "yellow_background"; italic: boolean; strikethrough: boolean; underline: boolean; }; equation: { expression: string; }; href: string | null; plain_text: string; type: "equation"; })[]

Defined in: src/models/dataSource.model.ts:99

Returns the data source description as rich text array.

({ annotations: { bold: boolean; code: boolean; color: "default" | "blue" | "blue_background" | "brown" | "brown_background" | "gray" | "gray_background" | "green" | "green_background" | "orange" | "orange_background" | "pink" | "pink_background" | "purple" | "purple_background" | "red" | "red_background" | "yellow" | "yellow_background"; italic: boolean; strikethrough: boolean; underline: boolean; }; href: string | null; plain_text: string; text: { content: string; link: { url: string; } | null; }; type: "text"; } | { annotations: { bold: boolean; code: boolean; color: "default" | "blue" | "blue_background" | "brown" | "brown_background" | "gray" | "gray_background" | "green" | "green_background" | "orange" | "orange_background" | "pink" | "pink_background" | "purple" | "purple_background" | "red" | "red_background" | "yellow" | "yellow_background"; italic: boolean; strikethrough: boolean; underline: boolean; }; href: string | null; mention: { database: { id: string; }; type: "database"; } | { date: { end: string | null; start: string; time_zone?: string | null; }; type: "date"; } | { link_preview: { url: string; }; type: "link_preview"; } | { page: { id: string; }; type: "page"; } | { template_mention: { template_mention_date: "today" | "now"; type: "template_mention_date"; } | { template_mention_user: "me"; type: "template_mention_user"; }; type: "template_mention"; } | { type: "user"; user: { avatar_url?: string | null; id: string; name?: string; object: "user"; person: { email: string; email_verified?: boolean; }; type: "person"; } | { avatar_url?: string | null; bot: { owner: { type: "workspace"; workspace: true; } | { type: "user"; }; workspace_id?: string; workspace_limits?: { max_file_upload_size_in_bytes: number; }; workspace_name?: string | null; }; id: string; name?: string; object: "user"; type: "bot"; } | { id: string; object: "user"; }; }; plain_text: string; type: "mention"; } | { annotations: { bold: boolean; code: boolean; color: "default" | "blue" | "blue_background" | "brown" | "brown_background" | "gray" | "gray_background" | "green" | "green_background" | "orange" | "orange_background" | "pink" | "pink_background" | "purple" | "purple_background" | "red" | "red_background" | "yellow" | "yellow_background"; italic: boolean; strikethrough: boolean; underline: boolean; }; equation: { expression: string; }; href: string | null; plain_text: string; type: "equation"; })[]


get icon(): { file: { expiry_time: string; url: string; }; type: "file"; } | { file_upload: { id: string; }; type: "file_upload"; } | { external: { url: string; }; type: "external"; } | { emoji: string; type: "emoji"; } | { icon: { color?: "blue" | "brown" | "gray" | "green" | "orange" | "pink" | "purple" | "red" | "yellow" | "lightgray"; name: string; }; type: "icon"; } | { custom_emoji: { id: string; name?: string; url?: string; }; type: "custom_emoji"; } | null

Defined in: src/models/dataSource.model.ts:106

Returns the data source icon (file, emoji, native icon, or custom emoji).

{ file: { expiry_time: string; url: string; }; type: "file"; } | { file_upload: { id: string; }; type: "file_upload"; } | { external: { url: string; }; type: "external"; } | { emoji: string; type: "emoji"; } | { icon: { color?: "blue" | "brown" | "gray" | "green" | "orange" | "pink" | "purple" | "red" | "yellow" | "lightgray"; name: string; }; type: "icon"; } | { custom_emoji: { id: string; name?: string; url?: string; }; type: "custom_emoji"; } | null


get id(): string

Defined in: src/models/dataSource.model.ts:36

Returns the data source ID.

string

BaseModel.id


get inTrash(): boolean

Defined in: src/models/dataSource.model.ts:141

Returns whether the data source is in trash.

boolean


get isInline(): boolean

Defined in: src/models/dataSource.model.ts:134

Returns whether the data source is inline.

boolean


get lastEditedBy(): { avatar_url?: string | null; id: string; name?: string; object: "user"; person: { email: string; email_verified?: boolean; }; type: "person"; } | { avatar_url?: string | null; bot: { owner: { type: "workspace"; workspace: true; } | { type: "user"; }; workspace_id?: string; workspace_limits?: { max_file_upload_size_in_bytes: number; }; workspace_name?: string | null; }; id: string; name?: string; object: "user"; type: "bot"; } | { id: string; object: "user"; }

Defined in: src/models/dataSource.model.ts:85

Returns the user who last edited the data source.

{ avatar_url?: string | null; id: string; name?: string; object: "user"; person: { email: string; email_verified?: boolean; }; type: "person"; } | { avatar_url?: string | null; bot: { owner: { type: "workspace"; workspace: true; } | { type: "user"; }; workspace_id?: string; workspace_limits?: { max_file_upload_size_in_bytes: number; }; workspace_name?: string | null; }; id: string; name?: string; object: "user"; type: "bot"; } | { id: string; object: "user"; }


get lastEditedTime(): Date

Defined in: src/models/dataSource.model.ts:78

Returns the last edited time as a Date object.

Date


get object(): "data_source"

Defined in: src/models/dataSource.model.ts:29

Returns “data_source” - the object type.

"data_source"

BaseModel.object


get parent(): { database_id: string; type: "database_id"; } | { data_source_id: string; database_id: string; type: "data_source_id"; } | { page_id: string; type: "page_id"; } | { type: "workspace"; workspace: true; } | { block_id: string; type: "block_id"; } | { agent_id: string; type: "agent_id"; }

Defined in: src/models/dataSource.model.ts:50

Returns the parent object (database reference).

{ database_id: string; type: "database_id"; } | { data_source_id: string; database_id: string; type: "data_source_id"; } | { page_id: string; type: "page_id"; } | { type: "workspace"; workspace: true; } | { block_id: string; type: "block_id"; } | { agent_id: string; type: "agent_id"; }


get properties(): NotionPropertiesObject

Defined in: src/models/dataSource.model.ts:43

Returns the properties object (data source schema).

NotionPropertiesObject


get publicUrl(): string | null

Defined in: src/models/dataSource.model.ts:127

Returns the public URL if published, otherwise null.

string | null


get title(): ({ annotations: { bold: boolean; code: boolean; color: "default" | "blue" | "blue_background" | "brown" | "brown_background" | "gray" | "gray_background" | "green" | "green_background" | "orange" | "orange_background" | "pink" | "pink_background" | "purple" | "purple_background" | "red" | "red_background" | "yellow" | "yellow_background"; italic: boolean; strikethrough: boolean; underline: boolean; }; href: string | null; plain_text: string; text: { content: string; link: { url: string; } | null; }; type: "text"; } | { annotations: { bold: boolean; code: boolean; color: "default" | "blue" | "blue_background" | "brown" | "brown_background" | "gray" | "gray_background" | "green" | "green_background" | "orange" | "orange_background" | "pink" | "pink_background" | "purple" | "purple_background" | "red" | "red_background" | "yellow" | "yellow_background"; italic: boolean; strikethrough: boolean; underline: boolean; }; href: string | null; mention: { database: { id: string; }; type: "database"; } | { date: { end: string | null; start: string; time_zone?: string | null; }; type: "date"; } | { link_preview: { url: string; }; type: "link_preview"; } | { page: { id: string; }; type: "page"; } | { template_mention: { template_mention_date: "today" | "now"; type: "template_mention_date"; } | { template_mention_user: "me"; type: "template_mention_user"; }; type: "template_mention"; } | { type: "user"; user: { avatar_url?: string | null; id: string; name?: string; object: "user"; person: { email: string; email_verified?: boolean; }; type: "person"; } | { avatar_url?: string | null; bot: { owner: { type: "workspace"; workspace: true; } | { type: "user"; }; workspace_id?: string; workspace_limits?: { max_file_upload_size_in_bytes: number; }; workspace_name?: string | null; }; id: string; name?: string; object: "user"; type: "bot"; } | { id: string; object: "user"; }; }; plain_text: string; type: "mention"; } | { annotations: { bold: boolean; code: boolean; color: "default" | "blue" | "blue_background" | "brown" | "brown_background" | "gray" | "gray_background" | "green" | "green_background" | "orange" | "orange_background" | "pink" | "pink_background" | "purple" | "purple_background" | "red" | "red_background" | "yellow" | "yellow_background"; italic: boolean; strikethrough: boolean; underline: boolean; }; equation: { expression: string; }; href: string | null; plain_text: string; type: "equation"; })[]

Defined in: src/models/dataSource.model.ts:92

Returns the data source title as rich text array.

({ annotations: { bold: boolean; code: boolean; color: "default" | "blue" | "blue_background" | "brown" | "brown_background" | "gray" | "gray_background" | "green" | "green_background" | "orange" | "orange_background" | "pink" | "pink_background" | "purple" | "purple_background" | "red" | "red_background" | "yellow" | "yellow_background"; italic: boolean; strikethrough: boolean; underline: boolean; }; href: string | null; plain_text: string; text: { content: string; link: { url: string; } | null; }; type: "text"; } | { annotations: { bold: boolean; code: boolean; color: "default" | "blue" | "blue_background" | "brown" | "brown_background" | "gray" | "gray_background" | "green" | "green_background" | "orange" | "orange_background" | "pink" | "pink_background" | "purple" | "purple_background" | "red" | "red_background" | "yellow" | "yellow_background"; italic: boolean; strikethrough: boolean; underline: boolean; }; href: string | null; mention: { database: { id: string; }; type: "database"; } | { date: { end: string | null; start: string; time_zone?: string | null; }; type: "date"; } | { link_preview: { url: string; }; type: "link_preview"; } | { page: { id: string; }; type: "page"; } | { template_mention: { template_mention_date: "today" | "now"; type: "template_mention_date"; } | { template_mention_user: "me"; type: "template_mention_user"; }; type: "template_mention"; } | { type: "user"; user: { avatar_url?: string | null; id: string; name?: string; object: "user"; person: { email: string; email_verified?: boolean; }; type: "person"; } | { avatar_url?: string | null; bot: { owner: { type: "workspace"; workspace: true; } | { type: "user"; }; workspace_id?: string; workspace_limits?: { max_file_upload_size_in_bytes: number; }; workspace_name?: string | null; }; id: string; name?: string; object: "user"; type: "bot"; } | { id: string; object: "user"; }; }; plain_text: string; type: "mention"; } | { annotations: { bold: boolean; code: boolean; color: "default" | "blue" | "blue_background" | "brown" | "brown_background" | "gray" | "gray_background" | "green" | "green_background" | "orange" | "orange_background" | "pink" | "pink_background" | "purple" | "purple_background" | "red" | "red_background" | "yellow" | "yellow_background"; italic: boolean; strikethrough: boolean; underline: boolean; }; equation: { expression: string; }; href: string | null; plain_text: string; type: "equation"; })[]


get url(): string

Defined in: src/models/dataSource.model.ts:120

Returns the Notion URL of the data source.

string

getDescription(): string

Defined in: src/models/dataSource.model.ts:155

Extracts the plain text description from the data source.

string


getParentDatabaseId(): string | undefined

Defined in: src/models/dataSource.model.ts:162

Returns the parent database ID if parent type is database_id.

string | undefined


getProperty(name): { checkbox: Record<string, never>; description?: string; id: string; name: string; type: "checkbox"; } | { created_by: Record<string, never>; description?: string; id: string; name: string; type: "created_by"; } | { created_time: Record<string, never>; description?: string; id: string; name: string; type: "created_time"; } | { date: Record<string, never>; description?: string; id: string; name: string; type: "date"; } | { description?: string; email: Record<string, never>; id: string; name: string; type: "email"; } | { description?: string; files: Record<string, never>; id: string; name: string; type: "files"; } | { description?: string; formula: { expression: string; }; id: string; name: string; type: "formula"; } | { description?: string; id: string; last_edited_by: Record<string, never>; name: string; type: "last_edited_by"; } | { description?: string; id: string; last_edited_time: Record<string, never>; name: string; type: "last_edited_time"; } | { description?: string; id: string; multi_select: { options: object[]; }; name: string; type: "multi_select"; } | { description?: string; id: string; name: string; number: { format: "number" | "argentine_peso" | "baht" | "australian_dollar" | "canadian_dollar" | "chilean_peso" | "colombian_peso" | "danish_krone" | "dirham" | "dollar" | "euro" | "forint" | "franc" | "hong_kong_dollar" | "koruna" | "krona" | "leu" | "lira" | "mexican_peso" | "new_taiwan_dollar" | "new_zealand_dollar" | "norwegian_krone" | "number_with_commas" | "percent" | "philippine_peso" | "pound" | "peruvian_sol" | "rand" | "real" | "ringgit" | "riyal" | "ruble" | "rupee" | "rupiah" | "shekel" | "singapore_dollar" | "uruguayan_peso" | "yen" | "yuan" | "won" | "zloty"; }; type: "number"; } | { description?: string; id: string; name: string; people: Record<string, never>; type: "people"; } | { description?: string; id: string; name: string; phone_number: Record<string, never>; type: "phone_number"; } | { description?: string; id: string; name: string; place: Record<string, never>; type: "place"; } | { description?: string; id: string; name: string; relation: { data_source_id: string; synced_property_id: string; synced_property_name: string; }; type: "relation"; } | { description?: string; id: string; name: string; rich_text: Record<string, never>; type: "rich_text"; } | { description?: string; id: string; name: string; rollup: { function: "range" | "checked" | "average" | "count_per_group" | "count" | "count_values" | "date_range" | "earliest_date" | "empty" | "latest_date" | "max" | "median" | "min" | "not_empty" | "percent_checked" | "percent_empty" | "percent_not_empty" | "percent_per_group" | "percent_unchecked" | "unchecked" | "unique" | "show_original" | "show_unique" | "sum"; relation_property_id: string; relation_property_name: string; rollup_property_id: string; rollup_property_name: string; }; type: "rollup"; } | { description?: string; id: string; name: string; select: { options: object[]; }; type: "select"; } | { description?: string; id: string; name: string; status: { groups: object[]; options: object[]; }; type: "status"; } | { description?: string; id: string; name: string; title: Record<string, never>; type: "title"; } | { description?: string; id: string; name: string; type: "url"; url: Record<string, never>; } | { description?: string; id: string; name: string; type: "unique_id"; unique_id: { prefix?: string; }; } | undefined

Defined in: src/models/dataSource.model.ts:172

Gets a specific property configuration by name.

string

{ checkbox: Record<string, never>; description?: string; id: string; name: string; type: "checkbox"; } | { created_by: Record<string, never>; description?: string; id: string; name: string; type: "created_by"; } | { created_time: Record<string, never>; description?: string; id: string; name: string; type: "created_time"; } | { date: Record<string, never>; description?: string; id: string; name: string; type: "date"; } | { description?: string; email: Record<string, never>; id: string; name: string; type: "email"; } | { description?: string; files: Record<string, never>; id: string; name: string; type: "files"; } | { description?: string; formula: { expression: string; }; id: string; name: string; type: "formula"; } | { description?: string; id: string; last_edited_by: Record<string, never>; name: string; type: "last_edited_by"; } | { description?: string; id: string; last_edited_time: Record<string, never>; name: string; type: "last_edited_time"; } | { description?: string; id: string; multi_select: { options: object[]; }; name: string; type: "multi_select"; } | { description?: string; id: string; name: string; number: { format: "number" | "argentine_peso" | "baht" | "australian_dollar" | "canadian_dollar" | "chilean_peso" | "colombian_peso" | "danish_krone" | "dirham" | "dollar" | "euro" | "forint" | "franc" | "hong_kong_dollar" | "koruna" | "krona" | "leu" | "lira" | "mexican_peso" | "new_taiwan_dollar" | "new_zealand_dollar" | "norwegian_krone" | "number_with_commas" | "percent" | "philippine_peso" | "pound" | "peruvian_sol" | "rand" | "real" | "ringgit" | "riyal" | "ruble" | "rupee" | "rupiah" | "shekel" | "singapore_dollar" | "uruguayan_peso" | "yen" | "yuan" | "won" | "zloty"; }; type: "number"; } | { description?: string; id: string; name: string; people: Record<string, never>; type: "people"; } | { description?: string; id: string; name: string; phone_number: Record<string, never>; type: "phone_number"; } | { description?: string; id: string; name: string; place: Record<string, never>; type: "place"; } | { description?: string; id: string; name: string; relation: { data_source_id: string; synced_property_id: string; synced_property_name: string; }; type: "relation"; } | { description?: string; id: string; name: string; rich_text: Record<string, never>; type: "rich_text"; } | { description?: string; id: string; name: string; rollup: { function: "range" | "checked" | "average" | "count_per_group" | "count" | "count_values" | "date_range" | "earliest_date" | "empty" | "latest_date" | "max" | "median" | "min" | "not_empty" | "percent_checked" | "percent_empty" | "percent_not_empty" | "percent_per_group" | "percent_unchecked" | "unchecked" | "unique" | "show_original" | "show_unique" | "sum"; relation_property_id: string; relation_property_name: string; rollup_property_id: string; rollup_property_name: string; }; type: "rollup"; } | { description?: string; id: string; name: string; select: { options: object[]; }; type: "select"; } | { description?: string; id: string; name: string; status: { groups: object[]; options: object[]; }; type: "status"; } | { description?: string; id: string; name: string; title: Record<string, never>; type: "title"; } | { description?: string; id: string; name: string; type: "url"; url: Record<string, never>; } | { description?: string; id: string; name: string; type: "unique_id"; unique_id: { prefix?: string; }; } | undefined


getPropertyNames(): string[]

Defined in: src/models/dataSource.model.ts:179

Gets all property names.

string[]


getTitle(): string

Defined in: src/models/dataSource.model.ts:148

Extracts the plain text title from the data source.

string


hasProperty(name): boolean

Defined in: src/models/dataSource.model.ts:186

Checks if the data source has a specific property.

string

boolean


toJSON(): object

Defined in: src/models/base.model.ts:20

Returns the raw validated data as a plain object.

cover: { file: { expiry_time: string; url: string; }; type: "file"; } | { file_upload: { id: string; }; type: "file_upload"; } | { external: { url: string; }; type: "external"; } | null

Data source cover image

created_by: { avatar_url?: string | null; id: string; name?: string; object: "user"; person: { email: string; email_verified?: boolean; }; type: "person"; } | { avatar_url?: string | null; bot: { owner: { type: "workspace"; workspace: true; } | { type: "user"; }; workspace_id?: string; workspace_limits?: { max_file_upload_size_in_bytes: number; }; workspace_name?: string | null; }; id: string; name?: string; object: "user"; type: "bot"; } | { id: string; object: "user"; } = userSchema

User who created the data source

created_time: string = notionDateStringSchema

Creation date and time for this data source, in ISO 8601 format

database_parent: { database_id: string; type: "database_id"; } | { data_source_id: string; database_id: string; type: "data_source_id"; } | { page_id: string; type: "page_id"; } | { type: "workspace"; workspace: true; } | { block_id: string; type: "block_id"; } | { agent_id: string; type: "agent_id"; } = parentSchema

Information about the database’s parent (the data source’s grandparent)

description: ({ annotations: { bold: boolean; code: boolean; color: "default" | "blue" | "blue_background" | "brown" | "brown_background" | "gray" | "gray_background" | "green" | "green_background" | "orange" | "orange_background" | "pink" | "pink_background" | "purple" | "purple_background" | "red" | "red_background" | "yellow" | "yellow_background"; italic: boolean; strikethrough: boolean; underline: boolean; }; href: string | null; plain_text: string; text: { content: string; link: { url: string; } | null; }; type: "text"; } | { annotations: { bold: boolean; code: boolean; color: "default" | "blue" | "blue_background" | "brown" | "brown_background" | "gray" | "gray_background" | "green" | "green_background" | "orange" | "orange_background" | "pink" | "pink_background" | "purple" | "purple_background" | "red" | "red_background" | "yellow" | "yellow_background"; italic: boolean; strikethrough: boolean; underline: boolean; }; href: string | null; mention: { database: { id: string; }; type: "database"; } | { date: { end: string | null; start: string; time_zone?: string | null; }; type: "date"; } | { link_preview: { url: string; }; type: "link_preview"; } | { page: { id: string; }; type: "page"; } | { template_mention: { template_mention_date: "today" | "now"; type: "template_mention_date"; } | { template_mention_user: "me"; type: "template_mention_user"; }; type: "template_mention"; } | { type: "user"; user: { avatar_url?: string | null; id: string; name?: string; object: "user"; person: { email: string; email_verified?: boolean; }; type: "person"; } | { avatar_url?: string | null; bot: { owner: { type: …; workspace: …; } | { type: …; }; workspace_id?: string; workspace_limits?: { max_file_upload_size_in_bytes: …; }; workspace_name?: string | null; }; id: string; name?: string; object: "user"; type: "bot"; } | { id: string; object: "user"; }; }; plain_text: string; type: "mention"; } | { annotations: { bold: boolean; code: boolean; color: "default" | "blue" | "blue_background" | "brown" | "brown_background" | "gray" | "gray_background" | "green" | "green_background" | "orange" | "orange_background" | "pink" | "pink_background" | "purple" | "purple_background" | "red" | "red_background" | "yellow" | "yellow_background"; italic: boolean; strikethrough: boolean; underline: boolean; }; equation: { expression: string; }; href: string | null; plain_text: string; type: "equation"; })[] = richTextSchema

Description of the data source as it appears in Notion

icon: { file: { expiry_time: string; url: string; }; type: "file"; } | { file_upload: { id: string; }; type: "file_upload"; } | { external: { url: string; }; type: "external"; } | { emoji: string; type: "emoji"; } | { icon: { color?: "blue" | "brown" | "gray" | "green" | "orange" | "pink" | "purple" | "red" | "yellow" | "lightgray"; name: string; }; type: "icon"; } | { custom_emoji: { id: string; name?: string; url?: string; }; type: "custom_emoji"; } | null

Data source icon (File, Emoji, Native Icon, or Custom Emoji object)

id: string

Unique identifier for the data source

in_trash: boolean

Whether the data source is in the trash

is_inline: boolean

Whether the data source is inline

last_edited_by: { avatar_url?: string | null; id: string; name?: string; object: "user"; person: { email: string; email_verified?: boolean; }; type: "person"; } | { avatar_url?: string | null; bot: { owner: { type: "workspace"; workspace: true; } | { type: "user"; }; workspace_id?: string; workspace_limits?: { max_file_upload_size_in_bytes: number; }; workspace_name?: string | null; }; id: string; name?: string; object: "user"; type: "bot"; } | { id: string; object: "user"; } = userSchema

User who last edited the data source

last_edited_time: string = notionDateStringSchema

Last edited date and time for this data source, in ISO 8601 format

object: "data_source"

Always “data_source”

parent: { database_id: string; type: "database_id"; } | { data_source_id: string; database_id: string; type: "data_source_id"; } | { page_id: string; type: "page_id"; } | { type: "workspace"; workspace: true; } | { block_id: string; type: "block_id"; } | { agent_id: string; type: "agent_id"; } = parentSchema

Information about the data source’s parent database

properties: Record<string, { checkbox: Record<string, never>; description?: string; id: string; name: string; type: "checkbox"; } | { created_by: Record<string, never>; description?: string; id: string; name: string; type: "created_by"; } | { created_time: Record<string, never>; description?: string; id: string; name: string; type: "created_time"; } | { date: Record<string, never>; description?: string; id: string; name: string; type: "date"; } | { description?: string; email: Record<string, never>; id: string; name: string; type: "email"; } | { description?: string; files: Record<string, never>; id: string; name: string; type: "files"; } | { description?: string; formula: { expression: string; }; id: string; name: string; type: "formula"; } | { description?: string; id: string; last_edited_by: Record<string, never>; name: string; type: "last_edited_by"; } | { description?: string; id: string; last_edited_time: Record<string, never>; name: string; type: "last_edited_time"; } | { description?: string; id: string; multi_select: { options: object[]; }; name: string; type: "multi_select"; } | { description?: string; id: string; name: string; number: { format: "number" | "argentine_peso" | "baht" | "australian_dollar" | "canadian_dollar" | "chilean_peso" | "colombian_peso" | "danish_krone" | "dirham" | "dollar" | "euro" | "forint" | "franc" | "hong_kong_dollar" | "koruna" | "krona" | "leu" | "lira" | "mexican_peso" | "new_taiwan_dollar" | "new_zealand_dollar" | "norwegian_krone" | "number_with_commas" | "percent" | "philippine_peso" | "pound" | "peruvian_sol" | "rand" | "real" | "ringgit" | "riyal" | "ruble" | "rupee" | "rupiah" | "shekel" | "singapore_dollar" | "uruguayan_peso" | "yen" | "yuan" | "won" | "zloty"; }; type: "number"; } | { description?: string; id: string; name: string; people: Record<string, never>; type: "people"; } | { description?: string; id: string; name: string; phone_number: Record<string, never>; type: "phone_number"; } | { description?: string; id: string; name: string; place: Record<string, never>; type: "place"; } | { description?: string; id: string; name: string; relation: { data_source_id: string; synced_property_id: string; synced_property_name: string; }; type: "relation"; } | { description?: string; id: string; name: string; rich_text: Record<string, never>; type: "rich_text"; } | { description?: string; id: string; name: string; rollup: { function: "range" | "checked" | "average" | "count_per_group" | "count" | "count_values" | "date_range" | "earliest_date" | "empty" | "latest_date" | "max" | "median" | "min" | "not_empty" | "percent_checked" | "percent_empty" | "percent_not_empty" | "percent_per_group" | "percent_unchecked" | "unchecked" | "unique" | "show_original" | "show_unique" | "sum"; relation_property_id: string; relation_property_name: string; rollup_property_id: string; rollup_property_name: string; }; type: "rollup"; } | { description?: string; id: string; name: string; select: { options: object[]; }; type: "select"; } | { description?: string; id: string; name: string; status: { groups: object[]; options: object[]; }; type: "status"; } | { description?: string; id: string; name: string; title: Record<string, never>; type: "title"; } | { description?: string; id: string; name: string; type: "url"; url: Record<string, never>; } | { description?: string; id: string; name: string; type: "unique_id"; unique_id: { prefix?: string; }; }> = propertiesObjectSchema

Schema of properties for the data source as they appear in Notion

public_url: string | null

The public URL if published, otherwise null

title: ({ annotations: { bold: boolean; code: boolean; color: "default" | "blue" | "blue_background" | "brown" | "brown_background" | "gray" | "gray_background" | "green" | "green_background" | "orange" | "orange_background" | "pink" | "pink_background" | "purple" | "purple_background" | "red" | "red_background" | "yellow" | "yellow_background"; italic: boolean; strikethrough: boolean; underline: boolean; }; href: string | null; plain_text: string; text: { content: string; link: { url: string; } | null; }; type: "text"; } | { annotations: { bold: boolean; code: boolean; color: "default" | "blue" | "blue_background" | "brown" | "brown_background" | "gray" | "gray_background" | "green" | "green_background" | "orange" | "orange_background" | "pink" | "pink_background" | "purple" | "purple_background" | "red" | "red_background" | "yellow" | "yellow_background"; italic: boolean; strikethrough: boolean; underline: boolean; }; href: string | null; mention: { database: { id: string; }; type: "database"; } | { date: { end: string | null; start: string; time_zone?: string | null; }; type: "date"; } | { link_preview: { url: string; }; type: "link_preview"; } | { page: { id: string; }; type: "page"; } | { template_mention: { template_mention_date: "today" | "now"; type: "template_mention_date"; } | { template_mention_user: "me"; type: "template_mention_user"; }; type: "template_mention"; } | { type: "user"; user: { avatar_url?: string | null; id: string; name?: string; object: "user"; person: { email: string; email_verified?: boolean; }; type: "person"; } | { avatar_url?: string | null; bot: { owner: { type: …; workspace: …; } | { type: …; }; workspace_id?: string; workspace_limits?: { max_file_upload_size_in_bytes: …; }; workspace_name?: string | null; }; id: string; name?: string; object: "user"; type: "bot"; } | { id: string; object: "user"; }; }; plain_text: string; type: "mention"; } | { annotations: { bold: boolean; code: boolean; color: "default" | "blue" | "blue_background" | "brown" | "brown_background" | "gray" | "gray_background" | "green" | "green_background" | "orange" | "orange_background" | "pink" | "pink_background" | "purple" | "purple_background" | "red" | "red_background" | "yellow" | "yellow_background"; italic: boolean; strikethrough: boolean; underline: boolean; }; equation: { expression: string; }; href: string | null; plain_text: string; type: "equation"; })[] = richTextSchema

Name of the data source as it appears in Notion

url: string

The Notion URL of the data source

BaseModel.toJSON