Skip to content

Commit 85cb57f

Browse files
committed
"Update Page" updates
1 parent 66ef164 commit 85cb57f

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

components/notion/actions/update-page/update-page.mjs

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,30 @@ export default {
1616
alertType: "info",
1717
content: "Properties that are not set will remain unchanged.",
1818
},
19-
parent: {
19+
databaseId: {
2020
propDefinition: [
2121
notion,
2222
"databaseId",
2323
],
24-
label: "Parent Database ID",
25-
description: "Select the database that contains the page to update. If you instead provide a database ID in a custom expression, you will also have to provide the page's ID in a custom expression",
24+
},
25+
parent: {
26+
propDefinition: [
27+
notion,
28+
"dataSourceId",
29+
(c) => ({
30+
databaseId: c.databaseId,
31+
}),
32+
],
33+
label: "Parent Data Source ID",
34+
description: "Select the data source that contains the page to update. If you instead provide a data source ID in a custom expression, you will also have to provide the page's ID in a custom expression",
2635
reloadProps: true,
2736
},
2837
pageId: {
2938
propDefinition: [
3039
notion,
31-
"pageIdInDatabase",
40+
"pageIdInDataSource",
3241
(c) => ({
33-
databaseId: c.parent,
42+
dataSourceId: c.parent,
3443
}),
3544
],
3645
},
@@ -52,15 +61,15 @@ export default {
5261
"propertyTypes",
5362
(c) => ({
5463
parentId: c.parent,
55-
parentType: "database",
64+
parentType: "dataSource",
5665
}),
5766
],
5867
reloadProps: true,
5968
},
6069
},
6170
async additionalProps() {
6271
try {
63-
const { properties } = await this.notion.retrieveDatabase(this.parent);
72+
const { properties } = await this.notion.retrieveDataSource(this.parent);
6473
const selectedProperties = pick(properties, this.propertyTypes);
6574

6675
return this.buildAdditionalProps({
@@ -85,7 +94,7 @@ export default {
8594
* @returns the constructed page in Notion format
8695
*/
8796
buildPage(page) {
88-
const meta = this.buildDatabaseMeta(page);
97+
const meta = this.buildDataSourceMeta(page);
8998
const properties = this.buildPageProperties(page.properties);
9099
return {
91100
...meta,

components/notion/notion.app.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export default {
5151
return this._buildPaginatedOptions(options, response.next_cursor);
5252
},
5353
},
54-
pageIdInDatabase: {
54+
pageIdInDataSource: {
5555
type: "string",
5656
label: "Page ID",
5757
description: "Search for a page from the data source or provide a page ID",

0 commit comments

Comments
 (0)