Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
import utils from "../../common/utils.mjs";
import notion from "../../notion.app.mjs";
import base from "../common/base-page-builder.mjs";
import pick from "lodash-es/pick.js";

export default {
...base,
key: "notion-create-page-from-database",
name: "Create Page from Data Source",
description: "Create a page from a data source. [See the documentation](https://developers.notion.com/reference/post-page)",
version: "1.0.2",
version: "1.0.3",
type: "action",
props: {
notion,
Expand All @@ -19,13 +20,26 @@
],
label: "Parent Data Source ID",
description: "Select a parent data source or provide a data source ID",
reloadProps: true,
},
Name: {
type: "string",
label: "Name",
description: "The name of the page. Use this only if the data source has a `title` property named `Name`. Otherwise, use the `Properties` prop below to set the title property.",
optional: true,
},
propertyTypes: {
propDefinition: [
notion,
"propertyTypes",
(c) => ({
parentId: c.parentDataSource,
parentType: "data_source",
}),
],
description: "Select one or more page properties. Willl override properties set in the `Properties` prop below.",
reloadProps: true,
},
properties: {
type: "object",
label: "Properties",
Expand All @@ -45,7 +59,7 @@
description: "Cover [External URL](https://developers.notion.com/reference/file-object#external-file-objects)",
optional: true,
},
alert: {

Check warning on line 62 in components/notion/actions/create-page-from-database/create-page-from-database.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop alert must have a description. See https://pipedream.com/docs/components/guidelines/#props

Check warning on line 62 in components/notion/actions/create-page-from-database/create-page-from-database.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop alert must have a label. See https://pipedream.com/docs/components/guidelines/#props
type: "alert",
alertType: "info",
content: "This action will create an empty page by default. To add content, use the `Page Content` prop below.",
Expand All @@ -57,6 +71,13 @@
],
},
},
async additionalProps() {
const { properties } = await this.notion.retrieveDataSource(this.parentDataSource);
const selectedProperties = pick(properties, this.propertyTypes);
return this.buildAdditionalProps({
properties: selectedProperties,
});
},
methods: {
...base.methods,
/**
Expand Down
2 changes: 1 addition & 1 deletion components/notion/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/notion",
"version": "1.0.2",
"version": "1.0.3",
"description": "Pipedream Notion Components",
"main": "notion.app.mjs",
"keywords": [
Expand Down
Loading
Loading