Skip to content

Commit 02416e8

Browse files
authored
[v5] Data source parent and relation property shape updates (#607)
## Description This PR syncs the latest changes from Notion's codebase to the TS SDK `src/api-endpoints.ts`. Specifically, the changes here are primarily around preparing for the next release candidate for the v5 version: - Rename `parent` to `database_parent` on `DataSourceObjectResponse` and introduce a new `parent` field that can be either `database_id` or `data_source_id` to match `2025-09-03` changes - Add `data_source_id` to `DatabasePropertyRelationConfigResponseCommon` and only accept `data_source_id` in `RelationPropertyConfigurationRequest` to match `2025-09-03` changes - Miscellaneous no-op auto-generated docstring/comment additions, e.g. to `SelectColor` ## How was this change tested? - [x] Automated test (unit, integration, etc.) - [ ] Manual test (provide reproducible testing steps below) Relying on automated test coverage/successful CI build for these changes ahead of more manual testing ahead of v5 SDK GA. ## Screenshots N/A
1 parent e3354a5 commit 02416e8

File tree

1 file changed

+49
-23
lines changed

1 file changed

+49
-23
lines changed

src/api-endpoints.ts

Lines changed: 49 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ type ParentForBlockBasedObjectResponse =
8989
| BlockIdParentForBlockBasedObjectResponse
9090
| WorkspaceParentForBlockBasedObjectResponse
9191

92+
/**
93+
* One of: `default`, `gray`, `brown`, `orange`, `yellow`, `green`, `blue`, `purple`,
94+
* `pink`, `red`
95+
*/
9296
type SelectColor =
9397
| "default"
9498
| "gray"
@@ -5064,6 +5068,28 @@ export type PartialDataSourceObjectResponse = {
50645068
properties: Record<string, DatabasePropertyConfigResponse>
50655069
}
50665070

5071+
type DatabaseParentResponse = {
5072+
// The parent type.
5073+
type: "database_id"
5074+
// The ID of the parent database.
5075+
database_id: string
5076+
}
5077+
5078+
type DataSourceParentResponse = {
5079+
// The parent type.
5080+
type: "data_source_id"
5081+
// The ID of the parent data source.
5082+
data_source_id: string
5083+
}
5084+
5085+
/**
5086+
* The parent of the data source. This is typically a database (`database_id`), but for
5087+
* externally synced data sources, can be another data source (`data_source_id`).
5088+
*/
5089+
type ParentOfDataSourceResponse =
5090+
| DatabaseParentResponse
5091+
| DataSourceParentResponse
5092+
50675093
export type DataSourceObjectResponse = {
50685094
// The data source object type name.
50695095
object: "data_source"
@@ -5074,7 +5100,9 @@ export type DataSourceObjectResponse = {
50745100
// The description of the data source.
50755101
description: Array<RichTextItemResponse>
50765102
// The parent of the data source.
5077-
parent:
5103+
parent: ParentOfDataSourceResponse
5104+
// The parent of the data source's containing database.
5105+
database_parent:
50785106
| {
50795107
// The parent type.
50805108
type: "page_id"
@@ -5087,24 +5115,14 @@ export type DataSourceObjectResponse = {
50875115
// Always true for workspace parent.
50885116
workspace: true
50895117
}
5090-
| {
5091-
// The parent type.
5092-
type: "database_id"
5093-
// The ID of the parent database.
5094-
database_id: string
5095-
}
5118+
| DatabaseParentResponse
50965119
| {
50975120
// The parent type.
50985121
type: "block_id"
50995122
// The ID of the parent block.
51005123
block_id: string
51015124
}
5102-
| {
5103-
// The parent type.
5104-
type: "data_source_id"
5105-
// The ID of the parent data source.
5106-
data_source_id: string
5107-
}
5125+
| DataSourceParentResponse
51085126
// Whether the data source is inline.
51095127
is_inline: boolean
51105128
// Whether the data source is archived.
@@ -5133,6 +5151,12 @@ export type DataSourceObjectResponse = {
51335151

51345152
export type PartialBlockObjectResponse = { object: "block"; id: string }
51355153

5154+
/**
5155+
* One of: `default`, `gray`, `brown`, `orange`, `yellow`, `green`, `blue`, `purple`,
5156+
* `pink`, `red`, `default_background`, `gray_background`, `brown_background`,
5157+
* `orange_background`, `yellow_background`, `green_background`, `blue_background`,
5158+
* `purple_background`, `pink_background`, `red_background`
5159+
*/
51365160
type ApiColor =
51375161
| "default"
51385162
| "gray"
@@ -6122,7 +6146,10 @@ type PropertyItemPropertyItemListResponse = {
61226146

61236147
export type PropertyItemListResponse = PropertyItemPropertyItemListResponse
61246148

6125-
type DatabasePropertyRelationConfigResponseCommon = { database_id: string }
6149+
type DatabasePropertyRelationConfigResponseCommon = {
6150+
database_id: string
6151+
data_source_id: string
6152+
}
61266153

61276154
type DatabasePropertyConfigResponseCommon = {
61286155
// The ID of the property.
@@ -6276,12 +6303,7 @@ export type DatabaseObjectResponse = {
62766303
// Always true for workspace parent.
62776304
workspace: true
62786305
}
6279-
| {
6280-
// The parent type.
6281-
type: "database_id"
6282-
// The ID of the parent database.
6283-
database_id: string
6284-
}
6306+
| DatabaseParentResponse
62856307
| {
62866308
// The parent type.
62876309
type: "block_id"
@@ -7153,7 +7175,7 @@ type StatusPropertyConfigurationRequest = {
71537175

71547176
type RelationPropertyConfigurationRequest = {
71557177
type?: "relation"
7156-
relation: { database_id: IdRequest } & (
7178+
relation: { data_source_id: IdRequest } & (
71577179
| { type?: "single_property"; single_property: EmptyObject }
71587180
| {
71597181
type?: "dual_property"
@@ -8319,12 +8341,12 @@ type UpdateDataSourceBodyParameters = {
83198341
relation:
83208342
| {
83218343
single_property: EmptyObject
8322-
database_id: IdRequest
8344+
data_source_id: IdRequest
83238345
type?: "single_property"
83248346
}
83258347
| {
83268348
dual_property: Record<string, never>
8327-
database_id: IdRequest
8349+
data_source_id: IdRequest
83288350
type?: "dual_property"
83298351
}
83308352
type?: "relation"
@@ -8867,10 +8889,12 @@ type ListCommentsQueryParameters = {
88678889
export type ListCommentsParameters = ListCommentsQueryParameters
88688890

88698891
export type ListCommentsResponse = {
8892+
// Always `list`
88708893
object: "list"
88718894
next_cursor: string | null
88728895
has_more: boolean
88738896
results: Array<CommentObjectResponse>
8897+
// Always `comment`
88748898
type: "comment"
88758899
comment: EmptyObject
88768900
}
@@ -8966,10 +8990,12 @@ type ListFileUploadsQueryParameters = {
89668990
export type ListFileUploadsParameters = ListFileUploadsQueryParameters
89678991

89688992
export type ListFileUploadsResponse = {
8993+
// Always `list`
89698994
object: "list"
89708995
next_cursor: string | null
89718996
has_more: boolean
89728997
results: Array<FileUploadObjectResponse>
8998+
// Always `file_upload`
89738999
type: "file_upload"
89749000
file_upload: EmptyObject
89759001
}

0 commit comments

Comments
 (0)