Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
2 changes: 1 addition & 1 deletion components/notion/actions/append-block/append-block.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
name: "Append Block to Parent",
description:
"Append new and/or existing blocks to the specified parent. [See the documentation](https://developers.notion.com/reference/patch-block-children)",
version: "0.3.2",
version: "0.3.3",
type: "action",
props: {
notion,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
key: "notion-create-comment",
name: "Create Comment",
description: "Create a comment in a page or existing discussion thread. [See the documentation](https://developers.notion.com/reference/create-a-comment)",
version: "0.0.3",
version: "0.0.4",
type: "action",
props: {
notion,
infoLabel: {

Check warning on line 12 in components/notion/actions/create-comment/create-comment.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

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

Check warning on line 12 in components/notion/actions/create-comment/create-comment.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop infoLabel must have a description. See https://pipedream.com/docs/components/guidelines/#props
type: "alert",
alertType: "info",
content: "Provide either a Page ID or a Discussion ID to create the comment under.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
key: "notion-create-page-from-database",
name: "Create Page from Database",
description: "Create a page from a database. [See the documentation](https://developers.notion.com/reference/post-page)",
version: "0.1.17",
version: "0.1.18",
type: "action",
props: {
notion,
Expand Down Expand Up @@ -37,7 +37,7 @@
],
reloadProps: true,
},
alert: {

Check warning on line 40 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

Check warning on line 40 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
type: "alert",
alertType: "info",
content: "This action will create an empty page by default. To add content, use the `Page Content` prop below.",
Expand Down
2 changes: 1 addition & 1 deletion components/notion/actions/create-page/create-page.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "notion-create-page",
name: "Create Page",
description: "Create a page from a parent page. [See the documentation](https://developers.notion.com/reference/post-page)",
version: "0.2.15",
version: "0.2.16",
type: "action",
props: {
notion,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "notion-duplicate-page",
name: "Duplicate Page",
description: "Create a new page copied from an existing page block. [See the documentation](https://developers.notion.com/reference/post-page)",
version: "0.0.12",
version: "0.0.13",
type: "action",
props: {
notion,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "notion-query-database",
name: "Query Database",
description: "Query a database with a specified filter. [See the documentation](https://developers.notion.com/reference/post-database-query)",
version: "0.0.10",
version: "0.0.11",
type: "action",
props: {
notion,
Expand Down
16 changes: 8 additions & 8 deletions components/notion/actions/retrieve-block/retrieve-block.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
key: "notion-retrieve-block",
name: "Retrieve Page Content",
description: "Get page content as block objects or markdown. Blocks can be text, lists, media, a page, among others. [See the documentation](https://developers.notion.com/reference/retrieve-a-block)",
version: "0.2.1",
version: "0.3.{{ts}}",

Check warning on line 7 in components/notion/actions/retrieve-block/retrieve-block.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

{{ts}} macro should be removed before committing
type: "action",
props: {
notion,
Expand Down Expand Up @@ -33,20 +33,20 @@
},
},
async run({ $ }) {
let markdownContent;
if (this.retrieveMarkdown) {
markdownContent = await this.notion.getPageAsMarkdown(this.blockId);
}

const { retrieveChildren } = this;
const subpagesOnly = retrieveChildren === "Sub-Pages Only";

const block = await this.notion.retrieveBlock(this.blockId);
const shouldRetrieveChildren = [
true,
"All Children",
"Sub-Pages Only",
].includes(retrieveChildren);

let markdownContent;
if (this.retrieveMarkdown) {
markdownContent = await this.notion.getPageAsMarkdown(this.blockId, shouldRetrieveChildren);
}

const block = await this.notion.retrieveBlock(this.blockId);
if (shouldRetrieveChildren) {
block.children = await this.notion.retrieveBlockChildren(block, subpagesOnly);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "notion-retrieve-database-content",
name: "Retrieve Database Content",
description: "Get all content of a database. [See the documentation](https://developers.notion.com/reference/post-database-query)",
version: "0.0.5",
version: "0.0.6",
type: "action",
props: {
notion,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "notion-retrieve-database-schema",
name: "Retrieve Database Schema",
description: "Get the property schema of a database in Notion. [See the documentation](https://developers.notion.com/reference/retrieve-a-database)",
version: "0.0.7",
version: "0.0.8",
type: "action",
props: {
notion,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "notion-retrieve-page-property-item",
name: "Retrieve Page Property Item",
description: "Get a Property Item object for a selected page and property. [See the documentation](https://developers.notion.com/reference/retrieve-a-page-property)",
version: "0.0.6",
version: "0.0.7",
type: "action",
props: {
notion,
Expand Down
2 changes: 1 addition & 1 deletion components/notion/actions/retrieve-page/retrieve-page.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
key: "notion-retrieve-page",
name: "Retrieve Page Metadata",
description: "Get details of a page. [See the documentation](https://developers.notion.com/reference/retrieve-a-page)",
version: "0.0.7",
version: "0.0.8",
type: "action",
props: {
notion,
infoLabel: {

Check warning on line 11 in components/notion/actions/retrieve-page/retrieve-page.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

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

Check warning on line 11 in components/notion/actions/retrieve-page/retrieve-page.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop infoLabel must have a description. See https://pipedream.com/docs/components/guidelines/#props
type: "alert",
alertType: "info",
content: "If you need to retrieve page content or block objects, use the **Retrieve Page Content** action instead.",
Expand Down
2 changes: 1 addition & 1 deletion components/notion/actions/search/search.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "notion-search",
name: "Find Pages or Databases",
description: "Searches for a page or database. [See the documentation](https://developers.notion.com/reference/post-search)",
version: "0.0.6",
version: "0.0.7",
type: "action",
props: {
...common.props,
Expand Down
2 changes: 1 addition & 1 deletion components/notion/actions/update-page/update-page.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
key: "notion-update-page",
name: "Update Page",
description: "Update a page's property values. To append page content, use the *Append Block* action instead. [See the documentation](https://developers.notion.com/reference/patch-page)",
version: "1.1.5",
version: "1.1.6",
type: "action",
props: {
notion,
infoLabel: {

Check warning on line 14 in components/notion/actions/update-page/update-page.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

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

Check warning on line 14 in components/notion/actions/update-page/update-page.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop infoLabel must have a description. See https://pipedream.com/docs/components/guidelines/#props
type: "alert",
alertType: "info",
content: "Properties that are not set will remain unchanged.",
Expand Down
26 changes: 13 additions & 13 deletions components/notion/notion.app.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import notion from "@notionhq/client";
import NOTION_META from "./common/notion-meta-selection.mjs";
import { ConfigurationError } from "@pipedream/platform";
import { NotionConverter } from "notion-to-md";
import { DefaultExporter } from "notion-to-md/plugins/exporter";
import { NotionToMarkdown } from "notion-to-md";

export default {
type: "app",
Expand Down Expand Up @@ -358,19 +357,20 @@ export default {

return response.results;
},
async getPageAsMarkdown(pageId) {
const client = this._getNotionClient();
async getPageAsMarkdown(pageId, shouldRetrieveChildren) {
const notion = this._getNotionClient();

const buffer = {};
const exporter = new DefaultExporter({
outputType: "buffer",
buffer,
const n2m = new NotionToMarkdown({
notionClient: notion,
config: {
separateChildPage: true,
},
});

const n2m = new NotionConverter(client).withExporter(exporter);
await n2m.convert(pageId);

return Object.values(buffer)[0];
const blocks = await n2m.pageToMarkdown(pageId);
const output = n2m.toMarkdownString(blocks);
return shouldRetrieveChildren
? output
: output.parent;
},
},
};
4 changes: 2 additions & 2 deletions components/notion/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/notion",
"version": "0.6.1",
"version": "0.6.2",
"description": "Pipedream Notion Components",
"main": "notion.app.mjs",
"keywords": [
Expand All @@ -14,7 +14,7 @@
"@pipedream/platform": "^3.0.3",
"@tryfabric/martian": "^1.2.4",
"lodash-es": "^4.17.21",
"notion-to-md": "^4.0.0-alpha.4"
"notion-to-md": "3.1.8"
},
"publishConfig": {
"access": "public"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
key: "notion-new-comment-created",
name: "New Comment Created",
description: "Emit new event when a new comment is created in a page or block. [See the documentation](https://developers.notion.com/reference/retrieve-a-comment)",
version: "0.0.3",
version: "0.0.4",
type: "source",
dedupe: "unique",
props: {
...base.props,
infoLabel: {

Check warning on line 13 in components/notion/sources/new-comment-created/new-comment-created.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop infoLabel must have a label. See https://pipedream.com/docs/components/guidelines/#props
type: "alert",
alertType: "info",
content: "Ensure the selected page is shared with your Pipedream integration to receive events.",
Expand Down
2 changes: 1 addition & 1 deletion components/notion/sources/new-database/new-database.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "notion-new-database",
name: "New Database Created",
description: "Emit new event when a database is created. [See the documentation](https://developers.notion.com/reference/database)",
version: "0.0.10",
version: "0.0.11",
type: "source",
props: {
...base.props,
Expand Down
2 changes: 1 addition & 1 deletion components/notion/sources/new-page/new-page.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
key: "notion-new-page",
name: "New Page in Database",
description: "Emit new event when a page is created in the selected database. [See the documentation](https://developers.notion.com/reference/page)",
version: "0.0.12",
version: "0.0.13",
type: "source",
props: {
...base.props,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "notion-page-or-subpage-updated",
name: "Page or Subpage Updated", /* eslint-disable-line pipedream/source-name */
description: "Emit new event when the selected page or one of its sub-pages is updated. [See the documentation](https://developers.notion.com/reference/page)",
version: "0.0.8",
version: "0.0.9",
type: "source",
dedupe: "unique",
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "notion-updated-page-id",
name: "Page Updated", /* eslint-disable-line pipedream/source-name */
description: "Emit new event when a selected page is updated. [See the documentation](https://developers.notion.com/reference/page)",
version: "0.0.7",
version: "0.0.8",
type: "source",
dedupe: "unique",
props: {
Expand Down
2 changes: 1 addition & 1 deletion components/notion/sources/updated-page/updated-page.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default {
key: "notion-updated-page",
name: "New or Updated Page in Database", /* eslint-disable-line pipedream/source-name */
description: "Emit new event when a page is created or updated in the selected database. [See the documentation](https://developers.notion.com/reference/page)",
version: "0.1.6",
version: "0.1.7",
type: "source",
dedupe: "unique",
props: {
Expand Down
15 changes: 6 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading