Skip to content
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.5",
version: "0.3.6",
type: "action",
props: {
notion,
Expand Down
2 changes: 1 addition & 1 deletion components/notion/actions/common/base-page-builder.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export default {
.map((property) => ({
type: properties[property]?.type ?? property,
label: property,
value: this[property] || this.properties[property],
value: this[property] || this.properties?.[property],
}));
},
/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import notion from "../../notion.app.mjs";
import base from "../common/base-page-builder.mjs";

export default {
...base,
key: "notion-complete-file-upload",
name: "Complete File Upload",
description: "Use this action to finalize a `mode=multi_part` file upload after all of the parts have been sent successfully. [See the documentation](https://developers.notion.com/reference/complete-a-file-upload)",
version: "0.0.1",
type: "action",
props: {
notion,
fileUploadId: {
propDefinition: [
notion,
"fileUploadId",
() => ({
status: "pending",
}),
],
},
},
async run({ $ }) {
const response = await this.notion.completeFileUpload({
file_upload_id: this.fileUploadId,
});

$.export("$summary", `Successfully completed file upload with ID ${this.fileUploadId}`);
return response;
},
};
4 changes: 2 additions & 2 deletions components/notion/actions/create-comment/create-comment.mjs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import notion from "../../notion.app.mjs";
import { ConfigurationError } from "@pipedream/platform";
import notion from "../../notion.app.mjs";

export default {
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.5",
version: "0.0.6",
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 description. 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 label. 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
54 changes: 54 additions & 0 deletions components/notion/actions/create-database/create-database.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import utils from "../../common/utils.mjs";
import notion from "../../notion.app.mjs";
import base from "../common/base-page-builder.mjs";

export default {
...base,
key: "notion-create-database",
name: "Create Database",
description: "Create a database. [See the documentation](https://developers.notion.com/reference/create-a-database)",
version: "0.0.1",
type: "action",
props: {
notion,
parent: {
propDefinition: [
notion,
"pageId",
],
label: "Parent Page ID",
description: "Select a parent page or provide a page ID",
},
title: {
type: "string",
label: "Title",
description: "Title of database as it appears in Notion. An array of [rich text objects](https://developers.notion.com/reference/rich-text).",
optional: true,
},
properties: {
type: "object",
label: "Properties",
description: "Property schema of database. The keys are the names of properties as they appear in Notion and the values are [property schema objects](https://developers.notion.com/reference/property-schema-object).",
},
},
async run({ $ }) {
const response = await this.notion.createDatabase({
parent: {
type: "page_id",
page_id: this.parent,
},
title: [
{
type: "text",
text: {
content: this.title,
},
},
],
properties: utils.parseObject(this.properties),
});

$.export("$summary", `Successfully created database with ID ${response.id}`);
return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import notion from "../../notion.app.mjs";
import base from "../common/base-page-builder.mjs";

export default {
...base,
key: "notion-create-file-upload",
name: "Create File Upload",
description: "Create a file upload. [See the documentation](https://developers.notion.com/reference/create-a-file-upload)",
version: "0.0.1",
type: "action",
props: {
notion,
mode: {
type: "string",
label: "Mode",
description: "How the file is being sent. Use `Multi Part` for files larger than 20MB. Use `External URL` for files that are temporarily hosted publicly elsewhere.",
options: [
{
label: "Single Part",
value: "single_part",
},
{
label: "Multi Part",
value: "multi_part",
},
{
label: "External URL",
value: "external_url",
},
],
optional: true,
},
filename: {
type: "string",
label: "Filename",
description: "Name of the file to be created. Required when mode is multi_part or external_url. Otherwise optional, and used to override the filename. Must include an extension.",
optional: true,
},
contentType: {
type: "string",
label: "Content Type",
description: "MIME type of the file to be created. Recommended when sending the file in multiple parts. Must match the content type of the file that's sent, and the extension of the `filename` parameter if any.",
optional: true,
},
numberOfParts: {
type: "integer",
label: "Number of Parts",
description: "When mode is `Multi Part`, the number of parts you are uploading. Must be between 1 and 1,000. This must match the number of parts as well as the final part_number you send.",
optional: true,
},
externalUrl: {
type: "string",
label: "External URL",
description: "When mode is `External URL`, provide the HTTPS URL of a publicly accessible file to import into your workspace.",
optional: true,
},
},
async run({ $ }) {
const response = await this.notion.createFileUpload({
mode: this.mode,
filename: this.filename,
content_type: this.contentType,
number_of_parts: this.numberOfParts,
external_url: this.externalUrl,
});

$.export("$summary", `Successfully created file upload with ID ${response.id}`);
return response;
},
};
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import notion from "../../notion.app.mjs";
import base from "../common/base-page-builder.mjs";
import NOTION_ICONS from "../../common/notion-icons.mjs";
import utils from "../../common/utils.mjs";
import notion from "../../notion.app.mjs";
import base from "../common/base-page-builder.mjs";

export default {
...base,
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.2.2",
version: "0.2.3",
type: "action",
props: {
notion,
Expand Down Expand Up @@ -45,7 +45,7 @@
description: "Cover [External URL](https://developers.notion.com/reference/file-object#external-file-objects)",
optional: true,
},
alert: {

Check warning on line 48 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 48 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 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.18",
version: "0.2.19",
type: "action",
props: {
notion,
Expand Down
29 changes: 29 additions & 0 deletions components/notion/actions/delete-block/delete-block.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import notion from "../../notion.app.mjs";
import base from "../common/base-page-builder.mjs";

export default {
...base,
key: "notion-delete-block",
name: "Delete Block",
description: "Sets a Block object, including page blocks, to archived: true using the ID specified. [See the documentation](https://developers.notion.com/reference/delete-a-block)",
version: "0.0.1",
type: "action",
props: {
notion,
infoLabel: {

Check warning on line 13 in components/notion/actions/delete-block/delete-block.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

Check warning on line 13 in components/notion/actions/delete-block/delete-block.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: "**Note:** In the Notion UI application, this moves the block to the \"Trash\" where it can still be accessed and restored.",
},
blockId: {
type: "string",
label: "Block ID",
description: "Block ID retrieved from the **Retrieve Page Content** action",
},
},
async run({ $ }) {
const response = await this.notion.deleteBlock(this.blockId);
$.export("$summary", `Successfully deleted block with ID ${this.blockId}`);
return response;
},
};
4 changes: 2 additions & 2 deletions components/notion/actions/duplicate-page/duplicate-page.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import utils from "../../common/utils.mjs";
import notion from "../../notion.app.mjs";
import base from "../common/base-page-builder.mjs";
import utils from "../../common/utils.mjs";

export default {
...base,
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.15",
version: "0.0.16",
type: "action",
props: {
notion,
Expand Down
23 changes: 23 additions & 0 deletions components/notion/actions/list-all-users/list-all-users.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import notion from "../../notion.app.mjs";

export default {
key: "notion-list-all-users",
name: "List All Users",
description: "Returns all users in the workspace. [See the documentation](https://developers.notion.com/reference/get-users)",
version: "0.0.1",
type: "action",
props: {
notion,
},
async run({ $ }) {
const response = this.notion.paginate({
fn: this.notion.getUsers,
});
const users = [];
for await (const user of response) {
users.push(user);
}
$.export("$summary", `Successfully retrieved ${users.length} users`);
return users;
},
};
28 changes: 28 additions & 0 deletions components/notion/actions/list-file-uploads/list-file-uploads.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import notion from "../../notion.app.mjs";
import base from "../common/base-page-builder.mjs";

export default {
...base,
key: "notion-list-file-uploads",
name: "List File Uploads",
description: "Use this action to list file uploads. [See the documentation](https://developers.notion.com/reference/list-file-uploads)",
version: "0.0.1",
type: "action",
props: {
notion,
},
async run({ $ }) {
const response = this.notion.paginate({
fn: this.notion.listFileUploads,
});

const responseArray = [];

for await (const item of response) {
responseArray.push(item);
}

$.export("$summary", `Successfully retrieved ${responseArray.length} file uploads`);
return responseArray;
},
};
14 changes: 11 additions & 3 deletions components/notion/actions/query-database/query-database.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import notion from "../../notion.app.mjs";
import utils from "../../common/utils.mjs";
import notion from "../../notion.app.mjs";

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.13",
version: "0.1.0",
type: "action",
props: {
notion,
Expand All @@ -20,12 +20,20 @@ export default {
description: "The filter to apply, as a JSON-stringified object. [See the documentation for available filters](https://developers.notion.com/reference/post-database-query-filter). Example: `{ \"property\": \"Name\", \"title\": { \"contains\": \"title to search for\" } }`",
type: "string",
},
sorts: {
label: "Sorts",
description: "The sort order for the query. [See the documentation for available sorts](https://developers.notion.com/reference/post-database-query-sort). Example: `[ { \"property\": \"Name\", \"direction\": \"ascending\" } ]`",
type: "string[]",
},
},
async run({ $ }) {
const { filter } = this;
const {
filter, sorts,
} = this;

const response = await this.notion.queryDatabase(this.databaseId, {
filter: utils.parseStringToJSON(filter),
sorts: utils.parseObject(sorts),
});

const length = response?.results?.length;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
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.3",
version: "0.2.4",
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-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.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-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.9",
version: "0.0.10",
type: "action",
props: {
notion,
Expand Down
Loading
Loading