-
Notifications
You must be signed in to change notification settings - Fork 5.5k
17823 notion #18005
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
17823 notion #18005
Changes from 5 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
953a017
Update Notion component with new actions and enhancements
luancazarine 595ac19
pnpm update
luancazarine 5707dd0
pnpm update
luancazarine a3f7414
Update components/notion/actions/create-file-upload/create-file-uploa…
luancazarine 94ba762
Merge branch 'master' into 17823-notion
michelle0927 92eadc8
versions
michelle0927 8aff361
versions
michelle0927 749f1a3
Fix optional chaining in base-page-builder and update block descripti…
luancazarine 4dacc38
Refactor update-block action to utilize utility function for content …
luancazarine 540efea
Merge branch 'master' into 17823-notion
luancazarine 6b5f4cc
pnpm update
luancazarine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
components/notion/actions/complete-file-upload/complete-file-upload.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
| }, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
components/notion/actions/create-database/create-database.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
| }, | ||
| }; | ||
70 changes: 70 additions & 0 deletions
70
components/notion/actions/create-file-upload/create-file-upload.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
| }, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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
|
||
| 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", | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.notion.deleteBlock(this.blockId); | ||
| $.export("$summary", `Successfully deleted block with ID ${this.blockId}`); | ||
| return response; | ||
| }, | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
components/notion/actions/list-all-users/list-all-users.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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
28
components/notion/actions/list-file-uploads/list-file-uploads.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
components/notion/actions/retrieve-file-upload/retrieve-file-upload.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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-retrieve-file-upload", | ||
| name: "Retrieve File Upload", | ||
| description: "Use this action to retrieve a file upload. [See the documentation](https://developers.notion.com/reference/retrieve-a-file-upload)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| notion, | ||
| fileUploadId: { | ||
| propDefinition: [ | ||
| notion, | ||
| "fileUploadId", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.notion.retrieveFileUpload({ | ||
| file_upload_id: this.fileUploadId, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully retrieved file upload with ID ${this.fileUploadId}`); | ||
| return response; | ||
| }, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import notion from "../../notion.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "notion-retrieve-user", | ||
| name: "Retrieve User", | ||
| description: "Returns a user using the ID specified. [See the documentation](https://developers.notion.com/reference/get-user)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| notion, | ||
| userId: { | ||
| propDefinition: [ | ||
| notion, | ||
| "userId", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.notion.getUser(this.userId); | ||
| $.export("$summary", `Successfully retrieved user with ID ${this.userId}`); | ||
| return response; | ||
| }, | ||
| }; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.