2023-01-27 03:22:44 -08:00
import type { INodeProperties } from 'n8n-workflow' ;
2021-05-20 14:31:23 -07:00
2024-03-05 05:45:36 -08:00
import { getConditions , getSearchFilters } from '../GenericFunctions' ;
2021-12-29 14:23:22 -08:00
2022-08-17 08:50:24 -07:00
import { blocks , text } from './Blocks' ;
2021-05-20 14:31:23 -07:00
2022-08-17 08:50:24 -07:00
import { filters } from './Filters' ;
2021-05-20 14:31:23 -07:00
2022-07-04 02:12:08 -07:00
export const databasePageOperations : INodeProperties [ ] = [
2021-05-20 14:31:23 -07:00
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
2022-05-20 14:47:24 -07:00
noDataExpression : true ,
2021-05-20 14:31:23 -07:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'databasePage' ] ,
2021-05-20 14:31:23 -07:00
} ,
2023-11-29 06:11:54 -08:00
hide : {
'@version' : [ 1 ] ,
} ,
2021-05-20 14:31:23 -07:00
} ,
options : [
{
name : 'Create' ,
value : 'create' ,
description : 'Create a pages in a database' ,
2022-07-10 13:50:51 -07:00
action : 'Create a database page' ,
2021-05-20 14:31:23 -07:00
} ,
2021-12-29 14:23:22 -08:00
{
name : 'Get' ,
value : 'get' ,
description : 'Get a page in a database' ,
2022-07-10 13:50:51 -07:00
action : 'Get a database page' ,
2021-12-29 14:23:22 -08:00
} ,
2021-05-20 14:31:23 -07:00
{
2022-09-07 07:51:14 -07:00
name : 'Get Many' ,
2021-05-20 14:31:23 -07:00
value : 'getAll' ,
2022-09-13 03:36:36 -07:00
description : 'Get many pages in a database' ,
2022-09-08 08:10:13 -07:00
action : 'Get many database pages' ,
2021-05-20 14:31:23 -07:00
} ,
{
name : 'Update' ,
value : 'update' ,
description : 'Update pages in a database' ,
2022-07-10 13:50:51 -07:00
action : 'Update a database page' ,
2021-05-20 14:31:23 -07:00
} ,
] ,
default : 'create' ,
} ,
2021-12-29 14:23:22 -08:00
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
2022-05-20 14:47:24 -07:00
noDataExpression : true ,
2021-12-29 14:23:22 -08:00
displayOptions : {
show : {
2023-06-23 04:21:08 -07:00
'@version' : [ 1 ] ,
2022-08-17 08:50:24 -07:00
resource : [ 'databasePage' ] ,
2021-12-29 14:23:22 -08:00
} ,
} ,
options : [
{
name : 'Create' ,
value : 'create' ,
description : 'Create a pages in a database' ,
2022-07-10 13:50:51 -07:00
action : 'Create a database page' ,
2021-12-29 14:23:22 -08:00
} ,
{
2022-09-07 07:51:14 -07:00
name : 'Get Many' ,
2021-12-29 14:23:22 -08:00
value : 'getAll' ,
2022-09-13 03:36:36 -07:00
description : 'Get many pages in a database' ,
2022-09-08 08:10:13 -07:00
action : 'Get many database pages' ,
2021-12-29 14:23:22 -08:00
} ,
{
name : 'Update' ,
value : 'update' ,
description : 'Update pages in a database' ,
2022-07-10 13:50:51 -07:00
action : 'Update a database page' ,
2021-12-29 14:23:22 -08:00
} ,
] ,
default : 'create' ,
} ,
2022-07-04 02:12:08 -07:00
] ;
2021-05-20 14:31:23 -07:00
2022-11-09 02:26:13 -08:00
export const databasePageFields : INodeProperties [ ] = [
2021-05-20 14:31:23 -07:00
/* -------------------------------------------------------------------------- */
2021-12-29 14:23:22 -08:00
/* databasePage:create */
2021-05-20 14:31:23 -07:00
/* -------------------------------------------------------------------------- */
{
2022-11-11 04:37:52 -08:00
displayName : 'Database' ,
2021-05-20 14:31:23 -07:00
name : 'databaseId' ,
2022-11-11 04:37:52 -08:00
type : 'resourceLocator' ,
default : { mode : 'list' , value : '' } ,
2021-05-20 14:31:23 -07:00
required : true ,
2022-11-11 04:37:52 -08:00
modes : [
{
displayName : 'Database' ,
name : 'list' ,
type : 'list' ,
placeholder : 'Select a Database...' ,
typeOptions : {
searchListMethod : 'getDatabases' ,
searchable : true ,
} ,
} ,
{
displayName : 'Link' ,
name : 'url' ,
type : 'string' ,
placeholder :
'https://www.notion.so/0fe2f7de558b471eab07e9d871cdf4a9?v=f2d424ba0c404733a3f500c78c881610' ,
validation : [
{
type : 'regex' ,
properties : {
regex :
2022-11-22 04:43:28 -08:00
'(?:https|http)://www.notion.so/(?:[a-z0-9-]{2,}/)?([0-9a-f]{8}[0-9a-f]{4}4[0-9a-f]{3}[89ab][0-9a-f]{3}[0-9a-f]{12}).*' ,
2022-11-11 04:37:52 -08:00
errorMessage : 'Not a valid Notion Database URL' ,
} ,
} ,
] ,
extractValue : {
type : 'regex' ,
2022-11-22 04:43:28 -08:00
regex :
'(?:https|http)://www.notion.so/(?:[a-z0-9-]{2,}/)?([0-9a-f]{8}[0-9a-f]{4}4[0-9a-f]{3}[89ab][0-9a-f]{3}[0-9a-f]{12})' ,
2022-11-11 04:37:52 -08:00
} ,
} ,
{
displayName : 'ID' ,
name : 'id' ,
type : 'string' ,
placeholder : 'ab1545b247fb49fa92d6f4b49f4d8116' ,
validation : [
{
type : 'regex' ,
properties : {
2022-11-22 04:43:28 -08:00
regex :
'^(([0-9a-f]{8}[0-9a-f]{4}4[0-9a-f]{3}[89ab][0-9a-f]{3}[0-9a-f]{12})|([0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}))[ \t]*' ,
2022-11-11 04:37:52 -08:00
errorMessage : 'Not a valid Notion Database ID' ,
} ,
} ,
] ,
extractValue : {
type : 'regex' ,
regex : '^([0-9a-f]{8}-?[0-9a-f]{4}-?4[0-9a-f]{3}-?[89ab][0-9a-f]{3}-?[0-9a-f]{12})' ,
} ,
url : '=https://www.notion.so/{{$value.replace(/-/g, "")}}' ,
} ,
] ,
2021-05-20 14:31:23 -07:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'databasePage' ] ,
operation : [ 'create' ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
2022-11-22 04:43:28 -08:00
description : 'The Notion Database to operate on' ,
2021-05-20 14:31:23 -07:00
} ,
{
2021-12-29 14:23:22 -08:00
displayName : 'Title' ,
name : 'title' ,
type : 'string' ,
default : '' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'databasePage' ] ,
operation : [ 'create' ] ,
2021-12-29 14:23:22 -08:00
} ,
2023-11-29 06:11:54 -08:00
hide : {
'@version' : [ 1 ] ,
} ,
2021-12-29 14:23:22 -08:00
} ,
2022-04-22 09:29:51 -07:00
description : 'Page title. Appears at the top of the page and can be found via Quick Find.' ,
2021-12-29 14:23:22 -08:00
} ,
{
2022-05-20 14:47:24 -07:00
displayName : 'Simplify' ,
2021-05-20 14:31:23 -07:00
name : 'simple' ,
type : 'boolean' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'databasePage' ] ,
operation : [ 'create' ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
default : true ,
2021-12-29 14:23:22 -08:00
description : 'Whether to return a simplified version of the response instead of the raw data' ,
2021-05-20 14:31:23 -07:00
} ,
{
displayName : 'Properties' ,
name : 'propertiesUi' ,
type : 'fixedCollection' ,
typeOptions : {
multipleValues : true ,
} ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'databasePage' ] ,
operation : [ 'create' ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
2022-04-22 09:29:51 -07:00
default : { } ,
2021-05-20 14:31:23 -07:00
placeholder : 'Add Property' ,
options : [
{
name : 'propertyValues' ,
displayName : 'Property' ,
values : [
{
2022-06-03 10:23:49 -07:00
displayName : 'Key Name or ID' ,
2021-05-20 14:31:23 -07:00
name : 'key' ,
type : 'options' ,
2022-08-17 08:50:24 -07:00
description :
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>' ,
2021-05-20 14:31:23 -07:00
typeOptions : {
loadOptionsMethod : 'getDatabaseProperties' ,
2022-08-17 08:50:24 -07:00
loadOptionsDependsOn : [ 'databaseId' ] ,
2021-05-20 14:31:23 -07:00
} ,
default : '' ,
} ,
{
displayName : 'Type' ,
name : 'type' ,
type : 'hidden' ,
default : '={{$parameter["&key"].split("|")[1]}}' ,
} ,
{
displayName : 'Title' ,
name : 'title' ,
type : 'string' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
type : [ 'title' ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
default : '' ,
} ,
{
displayName : 'Rich Text' ,
name : 'richText' ,
type : 'boolean' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
type : [ 'rich_text' ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
default : false ,
} ,
{
displayName : 'Text' ,
name : 'textContent' ,
type : 'string' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
type : [ 'rich_text' ] ,
richText : [ false ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
default : '' ,
} ,
. . . text ( {
show : {
2022-08-17 08:50:24 -07:00
type : [ 'rich_text' ] ,
richText : [ true ] ,
2021-05-20 14:31:23 -07:00
} ,
} ) ,
{
displayName : 'Phone Number' ,
name : 'phoneValue' ,
type : 'string' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
type : [ 'phone_number' ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
default : '' ,
2022-04-22 09:29:51 -07:00
description : 'Phone number. No structure is enforced.' ,
2021-05-20 14:31:23 -07:00
} ,
{
2022-06-20 07:54:01 -07:00
displayName : 'Option Names or IDs' ,
2021-05-20 14:31:23 -07:00
name : 'multiSelectValue' ,
type : 'multiOptions' ,
typeOptions : {
loadOptionsMethod : 'getPropertySelectValues' ,
} ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
type : [ 'multi_select' ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
default : [ ] ,
2022-08-17 08:50:24 -07:00
description :
'Name of the options you want to set. Multiples can be defined separated by comma. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-05-20 14:31:23 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Option Name or ID' ,
2021-05-20 14:31:23 -07:00
name : 'selectValue' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getPropertySelectValues' ,
} ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
type : [ 'select' ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'Name of the option you want to set. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-05-20 14:31:23 -07:00
} ,
2022-11-11 04:37:52 -08:00
{
displayName : 'Status Name or ID' ,
name : 'statusValue' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getPropertySelectValues' ,
} ,
displayOptions : {
show : {
type : [ 'status' ] ,
} ,
} ,
default : '' ,
description :
'Name of the option you want to set. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
} ,
2021-05-20 14:31:23 -07:00
{
displayName : 'Email' ,
name : 'emailValue' ,
type : 'string' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
type : [ 'email' ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
default : '' ,
2021-12-29 14:23:22 -08:00
description : 'Email address' ,
2021-05-20 14:31:23 -07:00
} ,
2022-07-20 04:34:52 -07:00
{
displayName : 'Ignore If Empty' ,
name : 'ignoreIfEmpty' ,
type : 'boolean' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
type : [ 'url' ] ,
2022-07-20 04:34:52 -07:00
} ,
} ,
default : false ,
} ,
2021-05-20 14:31:23 -07:00
{
displayName : 'URL' ,
name : 'urlValue' ,
type : 'string' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
type : [ 'url' ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
default : '' ,
2021-12-29 14:23:22 -08:00
description : 'Web address' ,
2021-05-20 14:31:23 -07:00
} ,
{
2022-06-20 07:54:01 -07:00
displayName : 'User Names or IDs' ,
2021-05-20 14:31:23 -07:00
name : 'peopleValue' ,
type : 'multiOptions' ,
typeOptions : {
loadOptionsMethod : 'getUsers' ,
} ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
type : [ 'people' ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
default : [ ] ,
2022-08-17 08:50:24 -07:00
description :
'List of users. Multiples can be defined separated by comma. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-05-20 14:31:23 -07:00
} ,
{
displayName : 'Relation IDs' ,
name : 'relationValue' ,
type : 'string' ,
typeOptions : {
multipleValues : true ,
} ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
type : [ 'relation' ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
default : [ ] ,
2022-08-17 08:50:24 -07:00
description :
'List of databases that belong to another database. Multiples can be defined separated by comma.' ,
2021-05-20 14:31:23 -07:00
} ,
{
displayName : 'Checked' ,
name : 'checkboxValue' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
type : [ 'checkbox' ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
type : 'boolean' ,
default : false ,
2022-08-17 08:50:24 -07:00
description :
'Whether or not the checkbox is checked. <code>true</code> represents checked. <code>false</code> represents unchecked.' ,
2021-05-20 14:31:23 -07:00
} ,
{
displayName : 'Number' ,
name : 'numberValue' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
type : [ 'number' ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
type : 'number' ,
default : 0 ,
2021-12-29 14:23:22 -08:00
description : 'Number value' ,
2021-05-20 14:31:23 -07:00
} ,
{
displayName : 'Range' ,
name : 'range' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
type : [ 'date' ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
type : 'boolean' ,
default : false ,
2022-06-20 07:54:01 -07:00
description : 'Whether or not you want to define a date range' ,
2021-05-20 14:31:23 -07:00
} ,
2021-06-12 09:06:47 -07:00
{
displayName : 'Include Time' ,
name : 'includeTime' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
type : [ 'date' ] ,
2021-06-12 09:06:47 -07:00
} ,
} ,
type : 'boolean' ,
default : true ,
2022-06-20 07:54:01 -07:00
description : 'Whether or not to include the time in the date' ,
2021-06-12 09:06:47 -07:00
} ,
2021-05-20 14:31:23 -07:00
{
displayName : 'Date' ,
name : 'date' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
range : [ false ] ,
type : [ 'date' ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
type : 'dateTime' ,
default : '' ,
2021-12-29 14:23:22 -08:00
description : 'An ISO 8601 format date, with optional time' ,
2021-05-20 14:31:23 -07:00
} ,
{
displayName : 'Date Start' ,
name : 'dateStart' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
range : [ true ] ,
type : [ 'date' ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
type : 'dateTime' ,
default : '' ,
2021-12-29 14:23:22 -08:00
description : 'An ISO 8601 format date, with optional time' ,
2021-05-20 14:31:23 -07:00
} ,
{
displayName : 'Date End' ,
name : 'dateEnd' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
range : [ true ] ,
type : [ 'date' ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
type : 'dateTime' ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'An ISO 8601 formatted date, with optional time. Represents the end of a date range.' ,
2021-05-20 14:31:23 -07:00
} ,
2021-08-13 11:57:18 -07:00
{
2022-06-03 10:23:49 -07:00
displayName : 'Timezone Name or ID' ,
2021-08-13 11:57:18 -07:00
name : 'timezone' ,
type : 'options' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
type : [ 'date' ] ,
2021-08-13 11:57:18 -07:00
} ,
} ,
typeOptions : {
loadOptionsMethod : 'getTimezones' ,
} ,
default : 'default' ,
2022-08-17 08:50:24 -07:00
description :
'Time zone to use. By default n8n timezone is used. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-12-29 14:23:22 -08:00
} ,
{
displayName : 'File URLs' ,
name : 'fileUrls' ,
placeholder : 'Add File' ,
type : 'fixedCollection' ,
typeOptions : {
multipleValues : true ,
sortable : true ,
} ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
type : [ 'files' ] ,
2021-12-29 14:23:22 -08:00
} ,
2023-11-29 06:11:54 -08:00
hide : {
'@version' : [ 1 ] ,
} ,
2021-12-29 14:23:22 -08:00
} ,
default : { } ,
options : [
{
name : 'fileUrl' ,
displayName : 'File' ,
values : [
{
displayName : 'Name' ,
name : 'name' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'File URL' ,
name : 'url' ,
type : 'string' ,
default : '' ,
description : 'Link to externally hosted file' ,
} ,
] ,
} ,
] ,
2021-08-13 11:57:18 -07:00
} ,
2021-05-20 14:31:23 -07:00
] ,
} ,
] ,
} ,
. . . blocks ( 'databasePage' , 'create' ) ,
2023-02-16 01:00:54 -08:00
{
displayName : 'Options' ,
name : 'options' ,
type : 'collection' ,
displayOptions : {
show : {
resource : [ 'databasePage' ] ,
operation : [ 'create' ] ,
} ,
} ,
default : { } ,
placeholder : 'Add Option' ,
options : [
{
displayName : 'Icon Type' ,
name : 'iconType' ,
type : 'options' ,
options : [
{
name : 'Emoji' ,
value : 'emoji' ,
description : 'Use an Emoji for the icon' ,
} ,
{
name : 'File' ,
value : 'file' ,
description : 'Use a file for the icon' ,
} ,
] ,
default : 'emoji' ,
description : 'The icon type for the database page, Either a URL or an Emoji' ,
} ,
{
displayName : 'Icon' ,
name : 'icon' ,
type : 'string' ,
default : '' ,
description : 'Emoji or File URL to use as the icon' ,
} ,
] ,
} ,
2021-05-20 14:31:23 -07:00
/* -------------------------------------------------------------------------- */
2021-12-29 14:23:22 -08:00
/* databasePage:update */
2021-05-20 14:31:23 -07:00
/* -------------------------------------------------------------------------- */
{
2022-11-11 04:37:52 -08:00
displayName : 'Database Page' ,
2021-05-20 14:31:23 -07:00
name : 'pageId' ,
2022-11-11 04:37:52 -08:00
type : 'resourceLocator' ,
default : { mode : 'url' , value : '' } ,
2021-05-20 14:31:23 -07:00
required : true ,
2022-11-11 04:37:52 -08:00
modes : [
{
displayName : 'Link' ,
name : 'url' ,
type : 'string' ,
2022-11-22 04:43:28 -08:00
placeholder : 'https://www.notion.so/My-Database-Page-b4eeb113e118403ba450af65ac25f0b9' ,
2022-11-11 04:37:52 -08:00
validation : [
{
type : 'regex' ,
properties : {
regex :
2022-11-22 04:43:28 -08:00
'(?:https|http)://www.notion.so/(?:[a-z0-9-]{2,}/)?(?:[a-zA-Z0-9-]{2,}-)?([0-9a-f]{8}[0-9a-f]{4}4[0-9a-f]{3}[89ab][0-9a-f]{3}[0-9a-f]{12}).*' ,
2022-11-11 04:37:52 -08:00
errorMessage : 'Not a valid Notion Database Page URL' ,
} ,
} ,
] ,
extractValue : {
type : 'regex' ,
2022-11-22 04:43:28 -08:00
regex :
'(?:https|http)://www.notion.so/(?:[a-z0-9-]{2,}/)?(?:[a-zA-Z0-9-]{2,}-)?([0-9a-f]{8}[0-9a-f]{4}4[0-9a-f]{3}[89ab][0-9a-f]{3}[0-9a-f]{12})' ,
2022-11-11 04:37:52 -08:00
} ,
} ,
{
displayName : 'ID' ,
name : 'id' ,
type : 'string' ,
placeholder : 'ab1545b247fb49fa92d6f4b49f4d8116' ,
validation : [
{
type : 'regex' ,
properties : {
2022-11-22 04:43:28 -08:00
regex :
'^(([0-9a-f]{8}[0-9a-f]{4}4[0-9a-f]{3}[89ab][0-9a-f]{3}[0-9a-f]{12})|([0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}))[ \t]*' ,
2022-11-11 04:37:52 -08:00
errorMessage : 'Not a valid Notion Database Page ID' ,
} ,
} ,
] ,
extractValue : {
type : 'regex' ,
regex : '^([0-9a-f]{8}-?[0-9a-f]{4}-?4[0-9a-f]{3}-?[89ab][0-9a-f]{3}-?[0-9a-f]{12})' ,
} ,
url : '=https://www.notion.so/{{$value.replace(/-/g, "")}}' ,
} ,
] ,
2021-05-20 14:31:23 -07:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'databasePage' ] ,
operation : [ 'update' ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
2022-11-22 04:43:28 -08:00
description : 'The Notion Database Page to update' ,
2021-05-20 14:31:23 -07:00
} ,
{
2022-05-20 14:47:24 -07:00
displayName : 'Simplify' ,
2021-05-20 14:31:23 -07:00
name : 'simple' ,
type : 'boolean' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'databasePage' ] ,
operation : [ 'update' ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
default : true ,
2021-12-29 14:23:22 -08:00
description : 'Whether to return a simplified version of the response instead of the raw data' ,
2021-05-20 14:31:23 -07:00
} ,
{
displayName : 'Properties' ,
name : 'propertiesUi' ,
type : 'fixedCollection' ,
typeOptions : {
multipleValues : true ,
} ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'databasePage' ] ,
operation : [ 'update' ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
2022-04-22 09:29:51 -07:00
default : { } ,
2021-05-20 14:31:23 -07:00
placeholder : 'Add Property' ,
options : [
{
name : 'propertyValues' ,
displayName : 'Property' ,
values : [
{
2022-06-03 10:23:49 -07:00
displayName : 'Key Name or ID' ,
2021-05-20 14:31:23 -07:00
name : 'key' ,
type : 'options' ,
2022-08-17 08:50:24 -07:00
description :
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>' ,
2021-05-20 14:31:23 -07:00
typeOptions : {
loadOptionsMethod : 'getDatabaseIdFromPage' ,
2022-08-17 08:50:24 -07:00
loadOptionsDependsOn : [ 'pageId' ] ,
2021-05-20 14:31:23 -07:00
} ,
default : '' ,
} ,
{
displayName : 'Type' ,
name : 'type' ,
type : 'hidden' ,
default : '={{$parameter["&key"].split("|")[1]}}' ,
} ,
{
displayName : 'Title' ,
name : 'title' ,
type : 'string' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
type : [ 'title' ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
default : '' ,
} ,
{
displayName : 'Rich Text' ,
name : 'richText' ,
type : 'boolean' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
type : [ 'rich_text' ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
default : false ,
} ,
{
displayName : 'Text' ,
name : 'textContent' ,
type : 'string' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
type : [ 'rich_text' ] ,
richText : [ false ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
default : '' ,
} ,
. . . text ( {
show : {
2022-08-17 08:50:24 -07:00
type : [ 'rich_text' ] ,
richText : [ true ] ,
2021-05-20 14:31:23 -07:00
} ,
} ) ,
{
displayName : 'Phone Number' ,
name : 'phoneValue' ,
type : 'string' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
type : [ 'phone_number' ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
default : '' ,
2022-04-22 09:29:51 -07:00
description : 'Phone number. No structure is enforced.' ,
2021-05-20 14:31:23 -07:00
} ,
{
2022-06-20 07:54:01 -07:00
displayName : 'Option Names or IDs' ,
2021-05-20 14:31:23 -07:00
name : 'multiSelectValue' ,
type : 'multiOptions' ,
2022-08-17 08:50:24 -07:00
description :
'Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>' ,
2021-05-20 14:31:23 -07:00
typeOptions : {
loadOptionsMethod : 'getDatabaseOptionsFromPage' ,
} ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
type : [ 'multi_select' ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
default : [ ] ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Option Name or ID' ,
2021-05-20 14:31:23 -07:00
name : 'selectValue' ,
type : 'options' ,
2022-08-17 08:50:24 -07:00
description :
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>' ,
2021-05-20 14:31:23 -07:00
typeOptions : {
loadOptionsMethod : 'getDatabaseOptionsFromPage' ,
} ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
type : [ 'select' ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
default : '' ,
} ,
2022-11-11 04:37:52 -08:00
{
displayName : 'Status Name or ID' ,
name : 'statusValue' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getDatabaseOptionsFromPage' ,
} ,
displayOptions : {
show : {
type : [ 'status' ] ,
} ,
} ,
default : '' ,
description :
'Name of the option you want to set. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
} ,
2021-05-20 14:31:23 -07:00
{
displayName : 'Email' ,
name : 'emailValue' ,
type : 'string' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
type : [ 'email' ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
default : '' ,
} ,
2022-07-20 04:34:52 -07:00
{
displayName : 'Ignore If Empty' ,
name : 'ignoreIfEmpty' ,
type : 'boolean' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
type : [ 'url' ] ,
2022-07-20 04:34:52 -07:00
} ,
} ,
default : false ,
} ,
2021-05-20 14:31:23 -07:00
{
displayName : 'URL' ,
name : 'urlValue' ,
type : 'string' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
type : [ 'url' ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
default : '' ,
2021-12-29 14:23:22 -08:00
description : 'Web address' ,
2021-05-20 14:31:23 -07:00
} ,
{
2022-06-20 07:54:01 -07:00
displayName : 'User Names or IDs' ,
2021-05-20 14:31:23 -07:00
name : 'peopleValue' ,
type : 'multiOptions' ,
typeOptions : {
loadOptionsMethod : 'getUsers' ,
} ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
type : [ 'people' ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
default : [ ] ,
2022-08-17 08:50:24 -07:00
description :
'List of users. Multiples can be defined separated by comma. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-05-20 14:31:23 -07:00
} ,
{
displayName : 'Relation IDs' ,
name : 'relationValue' ,
type : 'string' ,
typeOptions : {
multipleValues : true ,
} ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
type : [ 'relation' ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
default : [ ] ,
2022-08-17 08:50:24 -07:00
description :
'List of databases that belong to another database. Multiples can be defined separated by comma.' ,
2021-05-20 14:31:23 -07:00
} ,
{
displayName : 'Checked' ,
name : 'checkboxValue' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
type : [ 'checkbox' ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
type : 'boolean' ,
default : false ,
2022-08-17 08:50:24 -07:00
description :
'Whether or not the checkbox is checked. <code>true</code> represents checked. <code>false</code> represents unchecked.' ,
2021-05-20 14:31:23 -07:00
} ,
{
displayName : 'Number' ,
name : 'numberValue' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
type : [ 'number' ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
type : 'number' ,
default : 0 ,
2021-12-29 14:23:22 -08:00
description : 'Number value' ,
2021-05-20 14:31:23 -07:00
} ,
{
displayName : 'Range' ,
name : 'range' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
type : [ 'date' ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
type : 'boolean' ,
default : false ,
2022-06-20 07:54:01 -07:00
description : 'Whether or not you want to define a date range' ,
2021-05-20 14:31:23 -07:00
} ,
2021-06-12 09:06:47 -07:00
{
displayName : 'Include Time' ,
name : 'includeTime' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
type : [ 'date' ] ,
2021-06-12 09:06:47 -07:00
} ,
} ,
type : 'boolean' ,
default : true ,
2022-06-20 07:54:01 -07:00
description : 'Whether or not to include the time in the date' ,
2021-06-12 09:06:47 -07:00
} ,
2021-05-20 14:31:23 -07:00
{
displayName : 'Date' ,
name : 'date' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
range : [ false ] ,
type : [ 'date' ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
type : 'dateTime' ,
default : '' ,
2021-12-29 14:23:22 -08:00
description : 'An ISO 8601 format date, with optional time' ,
2021-05-20 14:31:23 -07:00
} ,
{
displayName : 'Date Start' ,
name : 'dateStart' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
range : [ true ] ,
type : [ 'date' ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
type : 'dateTime' ,
default : '' ,
2021-12-29 14:23:22 -08:00
description : 'An ISO 8601 format date, with optional time' ,
2021-05-20 14:31:23 -07:00
} ,
{
displayName : 'Date End' ,
name : 'dateEnd' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
range : [ true ] ,
type : [ 'date' ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
type : 'dateTime' ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'An ISO 8601 formatted date, with optional time. Represents the end of a date range.' ,
2021-05-20 14:31:23 -07:00
} ,
2021-08-13 11:57:18 -07:00
{
2022-06-03 10:23:49 -07:00
displayName : 'Timezone Name or ID' ,
2021-08-13 11:57:18 -07:00
name : 'timezone' ,
type : 'options' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
type : [ 'date' ] ,
2021-08-13 11:57:18 -07:00
} ,
} ,
typeOptions : {
loadOptionsMethod : 'getTimezones' ,
} ,
default : 'default' ,
2022-08-17 08:50:24 -07:00
description :
'Time zone to use. By default n8n timezone is used. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-12-29 14:23:22 -08:00
} ,
{
displayName : 'File URLs' ,
name : 'fileUrls' ,
placeholder : 'Add File' ,
type : 'fixedCollection' ,
typeOptions : {
multipleValues : true ,
sortable : true ,
} ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
type : [ 'files' ] ,
2021-12-29 14:23:22 -08:00
} ,
2023-11-29 06:11:54 -08:00
hide : {
'@version' : [ 1 ] ,
} ,
2021-12-29 14:23:22 -08:00
} ,
default : { } ,
options : [
{
name : 'fileUrl' ,
displayName : 'File' ,
values : [
{
displayName : 'Name' ,
name : 'name' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'File URL' ,
name : 'url' ,
type : 'string' ,
default : '' ,
description : 'Link to externally hosted file' ,
} ,
] ,
} ,
] ,
2021-08-13 11:57:18 -07:00
} ,
2021-05-20 14:31:23 -07:00
] ,
} ,
] ,
} ,
2023-07-04 07:43:53 -07:00
{
displayName : 'Options' ,
name : 'options' ,
type : 'collection' ,
displayOptions : {
show : {
resource : [ 'databasePage' ] ,
operation : [ 'update' ] ,
} ,
} ,
default : { } ,
placeholder : 'Add Option' ,
options : [
{
displayName : 'Icon Type' ,
name : 'iconType' ,
type : 'options' ,
options : [
{
name : 'Emoji' ,
value : 'emoji' ,
description : 'Use an Emoji for the icon' ,
} ,
{
name : 'File' ,
value : 'file' ,
description : 'Use a file for the icon' ,
} ,
] ,
default : 'emoji' ,
description : 'The icon type for the database page, Either a URL or an Emoji' ,
} ,
{
displayName : 'Icon' ,
name : 'icon' ,
type : 'string' ,
default : '' ,
description : 'Emoji or File URL to use as the icon' ,
} ,
] ,
} ,
2021-05-20 14:31:23 -07:00
/* -------------------------------------------------------------------------- */
2021-12-29 14:23:22 -08:00
/* databasePage:get */
/* -------------------------------------------------------------------------- */
{
2022-11-11 04:37:52 -08:00
displayName : 'Database Page' ,
2021-12-29 14:23:22 -08:00
name : 'pageId' ,
2022-11-11 04:37:52 -08:00
type : 'resourceLocator' ,
default : { mode : 'url' , value : '' } ,
2021-12-29 14:23:22 -08:00
required : true ,
2022-11-11 04:37:52 -08:00
modes : [
{
displayName : 'Link' ,
name : 'url' ,
type : 'string' ,
2022-11-22 04:43:28 -08:00
placeholder : 'https://www.notion.so/My-Database-Page-b4eeb113e118403ba450af65ac25f0b9' ,
2022-11-11 04:37:52 -08:00
validation : [
{
type : 'regex' ,
properties : {
regex :
2022-11-22 04:43:28 -08:00
'(?:https|http)://www.notion.so/(?:[a-z0-9-]{2,}/)?(?:[a-zA-Z0-9-]{2,}-)?([0-9a-f]{8}[0-9a-f]{4}4[0-9a-f]{3}[89ab][0-9a-f]{3}[0-9a-f]{12}).*' ,
2022-11-11 04:37:52 -08:00
errorMessage : 'Not a valid Notion Database Page URL' ,
} ,
} ,
] ,
extractValue : {
type : 'regex' ,
2022-11-22 04:43:28 -08:00
regex :
'(?:https|http)://www.notion.so/(?:[a-z0-9-]{2,}/)?(?:[a-zA-Z0-9-]{2,}-)?([0-9a-f]{8}[0-9a-f]{4}4[0-9a-f]{3}[89ab][0-9a-f]{3}[0-9a-f]{12})' ,
2022-11-11 04:37:52 -08:00
} ,
} ,
{
displayName : 'ID' ,
name : 'id' ,
type : 'string' ,
placeholder : 'ab1545b247fb49fa92d6f4b49f4d8116' ,
validation : [
{
type : 'regex' ,
properties : {
2022-11-22 04:43:28 -08:00
regex :
'^(([0-9a-f]{8}[0-9a-f]{4}4[0-9a-f]{3}[89ab][0-9a-f]{3}[0-9a-f]{12})|([0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}))[ \t]*' ,
2022-11-11 04:37:52 -08:00
errorMessage : 'Not a valid Notion Database Page ID' ,
} ,
} ,
] ,
extractValue : {
type : 'regex' ,
regex : '^([0-9a-f]{8}-?[0-9a-f]{4}-?4[0-9a-f]{3}-?[89ab][0-9a-f]{3}-?[0-9a-f]{12})' ,
} ,
url : '=https://www.notion.so/{{$value.replace(/-/g, "")}}' ,
} ,
] ,
2021-12-29 14:23:22 -08:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'databasePage' ] ,
operation : [ 'get' ] ,
2021-12-29 14:23:22 -08:00
} ,
2023-11-29 06:11:54 -08:00
hide : {
'@version' : [ 1 ] ,
} ,
2021-12-29 14:23:22 -08:00
} ,
2022-11-22 04:43:28 -08:00
description : 'The Notion Database Page to get' ,
2021-12-29 14:23:22 -08:00
} ,
{
2022-05-20 14:47:24 -07:00
displayName : 'Simplify' ,
2021-12-29 14:23:22 -08:00
name : 'simple' ,
type : 'boolean' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'databasePage' ] ,
operation : [ 'get' ] ,
2021-12-29 14:23:22 -08:00
} ,
2023-11-29 06:11:54 -08:00
hide : {
'@version' : [ 1 ] ,
} ,
2021-12-29 14:23:22 -08:00
} ,
default : true ,
description : 'Whether to return a simplified version of the response instead of the raw data' ,
} ,
/* -------------------------------------------------------------------------- */
2021-05-20 14:31:23 -07:00
/* databasePage:getAll */
/* -------------------------------------------------------------------------- */
{
2022-11-11 04:37:52 -08:00
displayName : 'Database' ,
2021-05-20 14:31:23 -07:00
name : 'databaseId' ,
2022-11-11 04:37:52 -08:00
type : 'resourceLocator' ,
default : { mode : 'list' , value : '' } ,
2021-05-20 14:31:23 -07:00
required : true ,
2022-11-11 04:37:52 -08:00
modes : [
{
displayName : 'Database' ,
name : 'list' ,
type : 'list' ,
placeholder : 'Select a Database...' ,
typeOptions : {
searchListMethod : 'getDatabases' ,
searchable : true ,
} ,
} ,
{
displayName : 'Link' ,
name : 'url' ,
type : 'string' ,
placeholder :
'https://www.notion.so/0fe2f7de558b471eab07e9d871cdf4a9?v=f2d424ba0c404733a3f500c78c881610' ,
validation : [
{
type : 'regex' ,
properties : {
regex :
2022-11-22 04:43:28 -08:00
'(?:https|http)://www.notion.so/(?:[a-z0-9-]{2,}/)?([0-9a-f]{8}[0-9a-f]{4}4[0-9a-f]{3}[89ab][0-9a-f]{3}[0-9a-f]{12}).*' ,
2022-11-11 04:37:52 -08:00
errorMessage : 'Not a valid Notion Database URL' ,
} ,
} ,
] ,
extractValue : {
type : 'regex' ,
2022-11-22 04:43:28 -08:00
regex :
'(?:https|http)://www.notion.so/(?:[a-z0-9-]{2,}/)?([0-9a-f]{8}[0-9a-f]{4}4[0-9a-f]{3}[89ab][0-9a-f]{3}[0-9a-f]{12})' ,
2022-11-11 04:37:52 -08:00
} ,
} ,
{
displayName : 'ID' ,
name : 'id' ,
type : 'string' ,
placeholder : 'ab1545b247fb49fa92d6f4b49f4d8116' ,
validation : [
{
type : 'regex' ,
properties : {
2022-11-22 04:43:28 -08:00
regex :
'^(([0-9a-f]{8}[0-9a-f]{4}4[0-9a-f]{3}[89ab][0-9a-f]{3}[0-9a-f]{12})|([0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}))[ \t]*' ,
2022-11-11 04:37:52 -08:00
errorMessage : 'Not a valid Notion Database ID' ,
} ,
} ,
] ,
extractValue : {
type : 'regex' ,
regex : '^([0-9a-f]{8}-?[0-9a-f]{4}-?4[0-9a-f]{3}-?[89ab][0-9a-f]{3}-?[0-9a-f]{12})' ,
} ,
url : '=https://www.notion.so/{{$value.replace(/-/g, "")}}' ,
} ,
] ,
2021-05-20 14:31:23 -07:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'databasePage' ] ,
operation : [ 'getAll' ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
2022-11-22 04:43:28 -08:00
description : 'The Notion Database to operate on' ,
2021-05-20 14:31:23 -07:00
} ,
{
displayName : 'Return All' ,
name : 'returnAll' ,
type : 'boolean' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'databasePage' ] ,
operation : [ 'getAll' ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
default : false ,
2021-12-29 14:23:22 -08:00
description : 'Whether to return all results or only up to a given limit' ,
2021-05-20 14:31:23 -07:00
} ,
{
displayName : 'Limit' ,
name : 'limit' ,
type : 'number' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'databasePage' ] ,
operation : [ 'getAll' ] ,
returnAll : [ false ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
typeOptions : {
minValue : 1 ,
maxValue : 100 ,
} ,
default : 50 ,
2022-05-06 14:01:25 -07:00
description : 'Max number of results to return' ,
2021-05-20 14:31:23 -07:00
} ,
{
2022-05-20 14:47:24 -07:00
displayName : 'Simplify' ,
2021-05-20 14:31:23 -07:00
name : 'simple' ,
type : 'boolean' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'databasePage' ] ,
operation : [ 'getAll' ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
default : true ,
2021-12-29 14:23:22 -08:00
description : 'Whether to return a simplified version of the response instead of the raw data' ,
2021-05-20 14:31:23 -07:00
} ,
2021-12-29 14:23:22 -08:00
. . . getSearchFilters ( 'databasePage' ) ,
2021-05-20 14:31:23 -07:00
{
displayName : 'Options' ,
name : 'options' ,
type : 'collection' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'getAll' ] ,
resource : [ 'databasePage' ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
default : { } ,
placeholder : 'Add Field' ,
options : [
2021-12-29 14:23:22 -08:00
{
displayName : 'Download Files' ,
name : 'downloadFiles' ,
type : 'boolean' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
'/resource' : [ 'databasePage' ] ,
'/operation' : [ 'getAll' ] ,
2021-12-29 14:23:22 -08:00
} ,
2023-11-29 06:11:54 -08:00
hide : {
'@version' : [ 1 ] ,
} ,
2021-12-29 14:23:22 -08:00
} ,
default : false ,
2022-08-17 08:50:24 -07:00
description : "Whether to download a file if a database's field contains it" ,
2021-12-29 14:23:22 -08:00
} ,
2021-05-20 14:31:23 -07:00
{
displayName : 'Filters' ,
name : 'filter' ,
placeholder : 'Add Filter' ,
type : 'fixedCollection' ,
typeOptions : {
multipleValues : false ,
} ,
2021-12-29 14:23:22 -08:00
displayOptions : {
show : {
2023-06-23 04:21:08 -07:00
'@version' : [ 1 ] ,
2021-12-29 14:23:22 -08:00
} ,
} ,
2021-05-20 14:31:23 -07:00
default : { } ,
options : [
{
displayName : 'Single Condition' ,
name : 'singleCondition' ,
2022-08-17 08:50:24 -07:00
values : [ . . . filters ( getConditions ( ) ) ] ,
2021-05-20 14:31:23 -07:00
} ,
{
displayName : 'Multiple Condition' ,
name : 'multipleCondition' ,
values : [
{
displayName : 'Condition' ,
name : 'condition' ,
placeholder : 'Add Condition' ,
type : 'fixedCollection' ,
typeOptions : {
multipleValues : true ,
} ,
default : { } ,
options : [
{
displayName : 'OR' ,
name : 'or' ,
2022-08-17 08:50:24 -07:00
values : [ . . . filters ( getConditions ( ) ) ] ,
2021-05-20 14:31:23 -07:00
} ,
{
displayName : 'AND' ,
name : 'and' ,
2022-08-17 08:50:24 -07:00
values : [ . . . filters ( getConditions ( ) ) ] ,
2021-05-20 14:31:23 -07:00
} ,
] ,
} ,
] ,
} ,
] ,
} ,
{
displayName : 'Sort' ,
name : 'sort' ,
placeholder : 'Add Sort' ,
type : 'fixedCollection' ,
typeOptions : {
multipleValues : true ,
} ,
default : { } ,
options : [
{
displayName : 'Sort' ,
name : 'sortValue' ,
values : [
{
displayName : 'Timestamp' ,
name : 'timestamp' ,
type : 'boolean' ,
default : false ,
2022-08-17 08:50:24 -07:00
description : "Whether or not to use the record's timestamp to sort the response" ,
2021-05-20 14:31:23 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Property Name or ID' ,
2021-05-20 14:31:23 -07:00
name : 'key' ,
type : 'options' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
timestamp : [ false ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
typeOptions : {
loadOptionsMethod : 'getFilterProperties' ,
2022-08-17 08:50:24 -07:00
loadOptionsDependsOn : [ 'datatabaseId' ] ,
2021-05-20 14:31:23 -07:00
} ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'The name of the property to filter by. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-05-20 14:31:23 -07:00
} ,
{
displayName : 'Property Name' ,
name : 'key' ,
type : 'options' ,
options : [
{
name : 'Created Time' ,
value : 'created_time' ,
} ,
{
name : 'Last Edited Time' ,
value : 'last_edited_time' ,
} ,
] ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
timestamp : [ true ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
default : '' ,
2021-12-29 14:23:22 -08:00
description : 'The name of the property to filter by' ,
2021-05-20 14:31:23 -07:00
} ,
{
displayName : 'Type' ,
name : 'type' ,
type : 'hidden' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
timestamp : [ true ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
default : '={{$parameter["&key"].split("|")[1]}}' ,
} ,
{
displayName : 'Direction' ,
name : 'direction' ,
type : 'options' ,
options : [
{
name : 'Ascending' ,
value : 'ascending' ,
} ,
{
name : 'Descending' ,
value : 'descending' ,
} ,
] ,
default : '' ,
2021-12-29 14:23:22 -08:00
description : 'The direction to sort' ,
2021-05-20 14:31:23 -07:00
} ,
] ,
} ,
] ,
} ,
] ,
} ,
2021-12-29 14:23:22 -08:00
] as INodeProperties [ ] ;