2023-01-27 03:22:44 -08:00
|
|
|
import type { INodeProperties } from 'n8n-workflow';
|
2021-07-12 04:26:21 -07:00
|
|
|
|
2021-12-03 00:44:16 -08:00
|
|
|
export const operationFields: INodeProperties[] = [
|
2021-07-12 04:26:21 -07:00
|
|
|
// ----------------------------------
|
|
|
|
// shared
|
|
|
|
// ----------------------------------
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
displayName: 'Database Name or ID',
|
2021-07-12 04:26:21 -07:00
|
|
|
name: 'databaseId',
|
|
|
|
type: 'options',
|
|
|
|
default: '',
|
|
|
|
required: true,
|
2022-08-01 13:47:55 -07:00
|
|
|
description:
|
|
|
|
'Database to operate on. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
2021-07-12 04:26:21 -07:00
|
|
|
typeOptions: {
|
|
|
|
loadOptionsMethod: 'getDatabaseIds',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
displayName: 'Table Name or ID',
|
2021-07-12 04:26:21 -07:00
|
|
|
name: 'tableId',
|
|
|
|
type: 'options',
|
|
|
|
default: '',
|
|
|
|
required: true,
|
2022-08-01 13:47:55 -07:00
|
|
|
description:
|
|
|
|
'Table to operate on. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
2021-07-12 04:26:21 -07:00
|
|
|
typeOptions: {
|
2022-08-01 13:47:55 -07:00
|
|
|
loadOptionsDependsOn: ['databaseId'],
|
2021-07-12 04:26:21 -07:00
|
|
|
loadOptionsMethod: 'getTableIds',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// ----------------------------------
|
|
|
|
// get
|
|
|
|
// ----------------------------------
|
|
|
|
{
|
|
|
|
displayName: 'Row ID',
|
|
|
|
name: 'rowId',
|
|
|
|
type: 'string',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
operation: ['get'],
|
2021-07-12 04:26:21 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
required: true,
|
|
|
|
description: 'ID of the row to return',
|
|
|
|
},
|
|
|
|
|
|
|
|
// ----------------------------------
|
|
|
|
// update
|
|
|
|
// ----------------------------------
|
|
|
|
{
|
|
|
|
displayName: 'Row ID',
|
|
|
|
name: 'rowId',
|
|
|
|
type: 'string',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
operation: ['update'],
|
2021-07-12 04:26:21 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
required: true,
|
|
|
|
description: 'ID of the row to update',
|
|
|
|
},
|
|
|
|
|
|
|
|
// ----------------------------------
|
|
|
|
// create/update
|
|
|
|
// ----------------------------------
|
|
|
|
{
|
|
|
|
displayName: 'Data to Send',
|
|
|
|
name: 'dataToSend',
|
|
|
|
type: 'options',
|
|
|
|
options: [
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
name: 'Auto-Map Input Data to Columns',
|
2021-07-12 04:26:21 -07:00
|
|
|
value: 'autoMapInputData',
|
|
|
|
description: 'Use when node input properties match destination column names',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Define Below for Each Column',
|
|
|
|
value: 'defineBelow',
|
|
|
|
description: 'Set the value for each destination column',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
operation: ['create', 'update'],
|
2021-07-12 04:26:21 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
default: 'defineBelow',
|
|
|
|
description: 'Whether to insert the input data this node receives in the new row',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Inputs to Ignore',
|
|
|
|
name: 'inputsToIgnore',
|
|
|
|
type: 'string',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
operation: ['create', 'update'],
|
|
|
|
dataToSend: ['autoMapInputData'],
|
2021-07-12 04:26:21 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
2022-08-01 13:47:55 -07:00
|
|
|
description:
|
|
|
|
'List of input properties to avoid sending, separated by commas. Leave empty to send all properties.',
|
2021-07-12 04:26:21 -07:00
|
|
|
placeholder: 'Enter properties...',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Fields to Send',
|
|
|
|
name: 'fieldsUi',
|
|
|
|
placeholder: 'Add Field',
|
|
|
|
type: 'fixedCollection',
|
|
|
|
typeOptions: {
|
|
|
|
multipleValueButtonText: 'Add Field to Send',
|
|
|
|
multipleValues: true,
|
|
|
|
},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
operation: ['create', 'update'],
|
|
|
|
dataToSend: ['defineBelow'],
|
2021-07-12 04:26:21 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
default: {},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Field',
|
|
|
|
name: 'fieldValues',
|
|
|
|
values: [
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
displayName: 'Field Name or ID',
|
2021-07-12 04:26:21 -07:00
|
|
|
name: 'fieldId',
|
|
|
|
type: 'options',
|
2022-08-01 13:47:55 -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-07-12 04:26:21 -07:00
|
|
|
typeOptions: {
|
2022-08-01 13:47:55 -07:00
|
|
|
loadOptionsDependsOn: ['tableId'],
|
2021-07-12 04:26:21 -07:00
|
|
|
loadOptionsMethod: 'getTableFields',
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Field Value',
|
|
|
|
name: 'fieldValue',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
|
|
|
|
// ----------------------------------
|
|
|
|
// delete
|
|
|
|
// ----------------------------------
|
|
|
|
{
|
|
|
|
displayName: 'Row ID',
|
|
|
|
name: 'rowId',
|
|
|
|
type: 'string',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
operation: ['delete'],
|
2021-07-12 04:26:21 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
required: true,
|
|
|
|
description: 'ID of the row to delete',
|
|
|
|
},
|
|
|
|
|
|
|
|
// ----------------------------------
|
|
|
|
// getAll
|
|
|
|
// ----------------------------------
|
|
|
|
{
|
|
|
|
displayName: 'Return All',
|
|
|
|
name: 'returnAll',
|
|
|
|
type: 'boolean',
|
|
|
|
default: false,
|
|
|
|
description: 'Whether to return all results or only up to a given limit',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
operation: ['getAll'],
|
2021-07-12 04:26:21 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Limit',
|
|
|
|
name: 'limit',
|
|
|
|
type: 'number',
|
|
|
|
default: 50,
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Max number of results to return',
|
2021-07-12 04:26:21 -07:00
|
|
|
typeOptions: {
|
|
|
|
minValue: 1,
|
|
|
|
maxValue: 100,
|
|
|
|
},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
operation: ['getAll'],
|
|
|
|
returnAll: [false],
|
2021-07-12 04:26:21 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Options',
|
|
|
|
name: 'additionalOptions',
|
|
|
|
type: 'collection',
|
|
|
|
placeholder: 'Add Option',
|
|
|
|
default: {},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
operation: ['getAll'],
|
2021-07-12 04:26:21 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Filters',
|
|
|
|
name: 'filters',
|
|
|
|
placeholder: 'Add Filter',
|
|
|
|
description: 'Filter rows based on comparison operators',
|
|
|
|
type: 'fixedCollection',
|
|
|
|
typeOptions: {
|
|
|
|
multipleValues: true,
|
|
|
|
},
|
|
|
|
default: {},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'fields',
|
|
|
|
displayName: 'Field',
|
|
|
|
values: [
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
displayName: 'Field Name or ID',
|
2021-07-12 04:26:21 -07:00
|
|
|
name: 'field',
|
|
|
|
type: 'options',
|
|
|
|
default: '',
|
2022-08-01 13:47:55 -07:00
|
|
|
description:
|
|
|
|
'Field to compare. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
2021-07-12 04:26:21 -07:00
|
|
|
typeOptions: {
|
2022-08-01 13:47:55 -07:00
|
|
|
loadOptionsDependsOn: ['tableId'],
|
2021-07-12 04:26:21 -07:00
|
|
|
loadOptionsMethod: 'getTableFields',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Filter',
|
|
|
|
name: 'operator',
|
|
|
|
description: 'Operator to compare field and value with',
|
|
|
|
type: 'options',
|
|
|
|
options: [
|
2021-09-11 01:31:43 -07:00
|
|
|
{
|
|
|
|
name: 'Contains',
|
|
|
|
value: 'contains',
|
|
|
|
description: 'Field contains value',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Contains Not',
|
|
|
|
value: 'contains_not',
|
|
|
|
description: 'Field does not contain value',
|
|
|
|
},
|
2022-06-03 10:23:49 -07:00
|
|
|
{
|
|
|
|
name: 'Date After Date',
|
|
|
|
value: 'date_after',
|
2022-08-01 13:47:55 -07:00
|
|
|
description: "Field after this date. Format: 'YYYY-MM-DD'.",
|
2022-06-03 10:23:49 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Date Before Date',
|
|
|
|
value: 'date_before',
|
2022-08-01 13:47:55 -07:00
|
|
|
description: "Field before this date. Format: 'YYYY-MM-DD'.",
|
2022-06-03 10:23:49 -07:00
|
|
|
},
|
2021-07-12 04:26:21 -07:00
|
|
|
{
|
|
|
|
name: 'Date Equal',
|
|
|
|
value: 'date_equal',
|
2022-08-01 13:47:55 -07:00
|
|
|
description: "Field is date. Format: 'YYYY-MM-DD'.",
|
2021-07-12 04:26:21 -07:00
|
|
|
},
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
name: 'Date Equals Month',
|
|
|
|
value: 'date_equals_month',
|
|
|
|
description: 'Field in this month. Format: string.',
|
2021-07-12 04:26:21 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Date Equals Today',
|
|
|
|
value: 'date_equals_today',
|
2022-04-22 09:29:51 -07:00
|
|
|
description: 'Field is today. Format: string.',
|
2021-07-12 04:26:21 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Date Equals Year',
|
|
|
|
value: 'date_equals_year',
|
2022-04-22 09:29:51 -07:00
|
|
|
description: 'Field in this year. Format: string.',
|
2021-07-12 04:26:21 -07:00
|
|
|
},
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
name: 'Date Not Equal',
|
|
|
|
value: 'date_not_equal',
|
2022-08-01 13:47:55 -07:00
|
|
|
description: "Field is not date. Format: 'YYYY-MM-DD'.",
|
2021-07-12 04:26:21 -07:00
|
|
|
},
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
name: 'Equal',
|
|
|
|
value: 'equal',
|
|
|
|
description: 'Field is equal to value',
|
2021-07-12 04:26:21 -07:00
|
|
|
},
|
|
|
|
{
|
2021-09-11 01:31:43 -07:00
|
|
|
name: 'Filename Contains',
|
|
|
|
value: 'filename_contains',
|
|
|
|
description: 'Field filename contains value',
|
2021-07-12 04:26:21 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Higher Than',
|
|
|
|
value: 'higher_than',
|
|
|
|
description: 'Field is higher than value',
|
|
|
|
},
|
|
|
|
{
|
2021-09-11 01:31:43 -07:00
|
|
|
name: 'Is Empty',
|
|
|
|
value: 'empty',
|
|
|
|
description: 'Field is empty',
|
2021-07-12 04:26:21 -07:00
|
|
|
},
|
|
|
|
{
|
2021-09-11 01:31:43 -07:00
|
|
|
name: 'Is Not Empty',
|
|
|
|
value: 'not_empty',
|
|
|
|
description: 'Field is not empty',
|
2021-07-12 04:26:21 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Is True',
|
|
|
|
value: 'boolean',
|
|
|
|
description: 'Boolean field is true',
|
|
|
|
},
|
2022-06-03 10:23:49 -07:00
|
|
|
{
|
|
|
|
name: 'Link Row Does Not Have',
|
|
|
|
value: 'link_row_has_not',
|
|
|
|
description: 'Field does not have link ID',
|
|
|
|
},
|
2021-07-12 04:26:21 -07:00
|
|
|
{
|
2021-09-11 01:31:43 -07:00
|
|
|
name: 'Link Row Has',
|
|
|
|
value: 'link_row_has',
|
|
|
|
description: 'Field has link ID',
|
2021-07-12 04:26:21 -07:00
|
|
|
},
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
name: 'Lower Than',
|
|
|
|
value: 'lower_than',
|
|
|
|
description: 'Field is lower than value',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Not Equal',
|
|
|
|
value: 'not_equal',
|
|
|
|
description: 'Field is not equal to value',
|
2021-09-11 01:31:43 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Single Select Equal',
|
|
|
|
value: 'single_select_equal',
|
|
|
|
description: 'Field selected option is value',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Single Select Not Equal',
|
|
|
|
value: 'single_select_not_equal',
|
|
|
|
description: 'Field selected option is not value',
|
2021-07-12 04:26:21 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
default: 'equal',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Value',
|
|
|
|
name: 'value',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
description: 'Value to compare to',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Filter Type',
|
|
|
|
name: 'filterType',
|
|
|
|
type: 'options',
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'AND',
|
|
|
|
value: 'AND',
|
|
|
|
description: 'Indicates that the rows must match all the provided filters',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'OR',
|
|
|
|
value: 'OR',
|
|
|
|
description: 'Indicates that the rows only have to match one of the filters',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
default: 'AND',
|
2022-08-01 13:47:55 -07:00
|
|
|
description:
|
|
|
|
'This works only if two or more filters are provided. Defaults to <code>AND</code>',
|
2021-07-12 04:26:21 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Search Term',
|
|
|
|
name: 'search',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
description: 'Text to match (can be in any column)',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Sorting',
|
|
|
|
name: 'order',
|
|
|
|
placeholder: 'Add Sort Order',
|
|
|
|
description: 'Set the sort order of the result rows',
|
|
|
|
type: 'fixedCollection',
|
|
|
|
typeOptions: {
|
|
|
|
multipleValues: true,
|
|
|
|
},
|
|
|
|
default: {},
|
|
|
|
options: [
|
|
|
|
{
|
2022-03-05 01:41:14 -08:00
|
|
|
name: 'fields',
|
2021-07-12 04:26:21 -07:00
|
|
|
displayName: 'Field',
|
|
|
|
values: [
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
displayName: 'Field Name or ID',
|
2021-07-12 04:26:21 -07:00
|
|
|
name: 'field',
|
|
|
|
type: 'options',
|
|
|
|
default: '',
|
2022-08-01 13:47:55 -07:00
|
|
|
description:
|
|
|
|
'Field name to sort by. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
2021-07-12 04:26:21 -07:00
|
|
|
typeOptions: {
|
2022-08-01 13:47:55 -07:00
|
|
|
loadOptionsDependsOn: ['tableId'],
|
2021-07-12 04:26:21 -07:00
|
|
|
loadOptionsMethod: 'getTableFields',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Direction',
|
|
|
|
name: 'direction',
|
|
|
|
type: 'options',
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'ASC',
|
|
|
|
value: '',
|
|
|
|
description: 'Sort in ascending order',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'DESC',
|
|
|
|
value: '-',
|
|
|
|
description: 'Sort in descending order',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
default: '',
|
|
|
|
description: 'Sort direction, either ascending or descending',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2021-12-03 00:44:16 -08:00
|
|
|
];
|