Add Notion node V2 (#2437)

*  Add versioning

*  Add credentials verification

*  Add folmula filtering

*  Add file support

*  Apply internal review

*  Improvements

*  Add page updated event to trigger

*  Use name instead of id when setting expression in select type

*  improvements

*  Improvements

*  Improvement to descriptions

*  Add filter to databasePage:getAll

*  Improvements

*  Add database:search operation

*  Add page:archive operation

*  Allow clearing fields date type

*  Allow setting single value in people type field

* asasas

* asasas

* aaaaa

*  Improvements

*  Fix merging issues

* 🐛 Fix filename

*  Minor fix

Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
This commit is contained in:
Ricardo Espinoza
2021-12-29 17:23:22 -05:00
committed by GitHub
parent aab5f5ddab
commit 7a8425a152
15 changed files with 2434 additions and 722 deletions

View File

@@ -6,13 +6,16 @@ import {
blocks,
} from './Blocks';
export const pageOperations: INodeProperties[] = [
export const pageOperations = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
displayOptions: {
show: {
version: [
1,
],
resource: [
'page',
],
@@ -36,17 +39,93 @@ export const pageOperations: INodeProperties[] = [
},
],
default: 'create',
description: 'The operation to perform.',
},
];
{
displayName: 'Operation',
name: 'operation',
type: 'options',
displayOptions: {
show: {
version: [
2,
],
resource: [
'page',
],
},
},
options: [
{
name: 'Archive',
value: 'archive',
description: 'Archive a page',
},
{
name: 'Create',
value: 'create',
description: 'Create a page',
},
{
name: 'Search',
value: 'search',
description: 'Text search of pages',
},
],
default: 'create',
},
] as INodeProperties[];
export const pageFields: INodeProperties[] = [
export const pageFields = [
/* -------------------------------------------------------------------------- */
/* page:archive */
/* -------------------------------------------------------------------------- */
{
displayName: 'Page Link or ID',
name: 'pageId',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
version: [
2,
],
resource: [
'page',
],
operation: [
'archive',
],
},
},
description: `The Page URL from Notion's 'copy link' functionality (or just the ID contained within the URL)`,
},
{
displayName: 'Simplify Output',
name: 'simple',
type: 'boolean',
displayOptions: {
show: {
version: [
2,
],
resource: [
'page',
],
operation: [
'archive',
],
},
},
default: true,
description: 'Whether to return a simplified version of the response instead of the raw data',
},
/* -------------------------------------------------------------------------- */
/* page:create */
/* -------------------------------------------------------------------------- */
{
displayName: 'Parent Page ID',
displayName: 'Parent Page ID or Link',
name: 'pageId',
type: 'string',
default: '',
@@ -61,7 +140,7 @@ export const pageFields: INodeProperties[] = [
],
},
},
description: 'The ID of the parent page that this child page belongs to.',
description: `The URL from Notion's 'copy link' functionality (or just the ID contained within the URL)`,
},
{
displayName: 'Title',
@@ -79,10 +158,10 @@ export const pageFields: INodeProperties[] = [
],
},
},
description: 'Page title. Appears at the top of the page and can be found via Quick Find.',
description: 'Page title. Appears at the top of the page and can be found via Quick Find',
},
{
displayName: 'Simple',
displayName: 'Simplify Output',
name: 'simple',
type: 'boolean',
displayOptions: {
@@ -96,20 +175,23 @@ export const pageFields: INodeProperties[] = [
},
},
default: true,
description: 'When set to true a simplify version of the response will be used else the raw data.',
description: 'Whether to return a simplified version of the response instead of the raw data',
},
...blocks('page', 'create'),
/* -------------------------------------------------------------------------- */
/* page:get */
/* -------------------------------------------------------------------------- */
{
displayName: 'Page ID',
displayName: 'Page Link or ID',
name: 'pageId',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
version: [
1,
],
resource: [
'page',
],
@@ -118,13 +200,17 @@ export const pageFields: INodeProperties[] = [
],
},
},
description: `The Page URL from Notion's 'copy link' functionality (or just the ID contained within the URL)`,
},
{
displayName: 'Simple',
displayName: 'Simplify Output',
name: 'simple',
type: 'boolean',
displayOptions: {
show: {
version: [
1,
],
resource: [
'page',
],
@@ -134,7 +220,7 @@ export const pageFields: INodeProperties[] = [
},
},
default: true,
description: 'When set to true a simplify version of the response will be used else the raw data.',
description: 'Whether to return a simplified version of the response instead of the raw data',
},
/* -------------------------------------------------------------------------- */
/* page:search */
@@ -154,7 +240,7 @@ export const pageFields: INodeProperties[] = [
],
},
},
description: 'The text to search for.',
description: 'The text to search for',
},
{
displayName: 'Return All',
@@ -171,7 +257,7 @@ export const pageFields: INodeProperties[] = [
},
},
default: false,
description: 'If all results should be returned or only up to a given limit.',
description: 'Whether to return all results or only up to a given limit',
},
{
displayName: 'Limit',
@@ -195,10 +281,10 @@ export const pageFields: INodeProperties[] = [
maxValue: 100,
},
default: 50,
description: 'How many results to return.',
description: 'How many results to return',
},
{
displayName: 'Simple',
displayName: 'Simplify Output',
name: 'simple',
type: 'boolean',
displayOptions: {
@@ -212,7 +298,7 @@ export const pageFields: INodeProperties[] = [
},
},
default: true,
description: 'When set to true a simplify version of the response will be used else the raw data.',
description: 'Whether to return a simplified version of the response instead of the raw data',
},
{
displayName: 'Options',
@@ -256,7 +342,7 @@ export const pageFields: INodeProperties[] = [
},
],
default: 'object',
description: 'The name of the property to filter by.',
description: 'The name of the property to filter by',
},
{
displayName: 'Value',
@@ -273,7 +359,7 @@ export const pageFields: INodeProperties[] = [
},
],
default: '',
description: 'The value of the property to filter by.',
description: 'The value of the property to filter by',
},
],
},
@@ -307,8 +393,8 @@ export const pageFields: INodeProperties[] = [
value: 'descending',
},
],
default: '',
description: 'The direction to sort.',
default: 'descending',
description: 'The direction to sort',
},
{
displayName: 'Timestamp',
@@ -321,7 +407,7 @@ export const pageFields: INodeProperties[] = [
},
],
default: 'last_edited_time',
description: `The name of the timestamp to sort against.`,
description: `The name of the timestamp to sort against`,
},
],
},
@@ -329,4 +415,4 @@ export const pageFields: INodeProperties[] = [
},
],
},
];
] as INodeProperties[];