2022-08-17 08:50:24 -07:00
import { INodeProperties } from 'n8n-workflow' ;
2021-09-29 16:28:27 -07:00
2021-12-03 00:44:16 -08:00
export const rowOperations : INodeProperties [ ] = [
2021-09-29 16:28:27 -07:00
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
2022-05-20 14:47:24 -07:00
noDataExpression : true ,
2021-09-29 16:28:27 -07:00
options : [
{
name : 'Create' ,
value : 'create' ,
description : 'Create a row' ,
2022-07-10 13:50:51 -07:00
action : 'Create a row' ,
2021-09-29 16:28:27 -07:00
} ,
{
name : 'Delete' ,
value : 'delete' ,
description : 'Delete a row' ,
2022-07-10 13:50:51 -07:00
action : 'Delete a row' ,
2021-09-29 16:28:27 -07:00
} ,
{
name : 'Get' ,
value : 'get' ,
description : 'Get a row' ,
2022-07-10 13:50:51 -07:00
action : 'Get a row' ,
2021-09-29 16:28:27 -07:00
} ,
{
2022-09-07 07:51:14 -07:00
name : 'Get Many' ,
2021-09-29 16:28:27 -07:00
value : 'getAll' ,
description : 'Get all rows' ,
2022-09-08 08:10:13 -07:00
action : 'Get many rows' ,
2021-09-29 16:28:27 -07:00
} ,
{
name : 'Update' ,
value : 'update' ,
description : 'Update a row' ,
2022-07-10 13:50:51 -07:00
action : 'Update a row' ,
2021-09-29 16:28:27 -07:00
} ,
] ,
default : 'create' ,
description : 'The operation being performed' ,
} ,
2021-12-03 00:44:16 -08:00
] ;
2021-09-29 16:28:27 -07:00
2021-12-03 00:44:16 -08:00
export const rowFields : INodeProperties [ ] = [
2021-09-29 16:28:27 -07:00
// ----------------------------------
// shared
// ----------------------------------
{
2022-06-03 10:23:49 -07:00
displayName : 'Table Name or ID' ,
2021-09-29 16:28:27 -07:00
name : 'tableName' ,
type : 'options' ,
placeholder : 'Name of table' ,
required : true ,
typeOptions : {
loadOptionsMethod : 'getTableNames' ,
} ,
displayOptions : {
hide : {
2022-08-17 08:50:24 -07:00
operation : [ 'get' ] ,
2021-09-29 16:28:27 -07:00
} ,
} ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'The name of SeaTable table to access. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-09-29 16:28:27 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Table Name or ID' ,
2021-09-29 16:28:27 -07:00
name : 'tableId' ,
type : 'options' ,
placeholder : 'Name of table' ,
required : true ,
typeOptions : {
loadOptionsMethod : 'getTableIds' ,
} ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'get' ] ,
2021-09-29 16:28:27 -07:00
} ,
} ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'The name of SeaTable table to access. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-09-29 16:28:27 -07:00
} ,
// ----------------------------------
// update
// ----------------------------------
{
displayName : 'Row ID' ,
name : 'rowId' ,
type : 'string' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'update' ] ,
2021-09-29 16:28:27 -07:00
} ,
} ,
default : '' ,
} ,
// ----------------------------------
// create
// ----------------------------------
{
displayName : 'Data to Send' ,
name : 'fieldsToSend' ,
type : 'options' ,
options : [
{
name : 'Auto-Map Input Data to Columns' ,
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-17 08:50:24 -07:00
operation : [ 'create' , 'update' ] ,
2021-09-29 16:28:27 -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-17 08:50:24 -07:00
operation : [ 'create' , 'update' ] ,
fieldsToSend : [ 'autoMapInputData' ] ,
2021-09-29 16:28:27 -07:00
} ,
} ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'List of input properties to avoid sending, separated by commas. Leave empty to send all properties.' ,
2021-09-29 16:28:27 -07:00
placeholder : 'Enter properties...' ,
} ,
{
displayName : 'Columns to Send' ,
name : 'columnsUi' ,
placeholder : 'Add Column' ,
type : 'fixedCollection' ,
typeOptions : {
multipleValueButtonText : 'Add Column to Send' ,
multipleValues : true ,
} ,
options : [
{
displayName : 'Column' ,
name : 'columnValues' ,
values : [
{
2022-06-03 10:23:49 -07:00
displayName : 'Column Name or ID' ,
2021-09-29 16:28:27 -07:00
name : 'columnName' ,
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-09-29 16:28:27 -07:00
typeOptions : {
2022-08-17 08:50:24 -07:00
loadOptionsDependsOn : [ 'table' ] ,
2021-09-29 16:28:27 -07:00
loadOptionsMethod : 'getTableUpdateAbleColumns' ,
} ,
default : '' ,
} ,
{
displayName : 'Column Value' ,
name : 'columnValue' ,
type : 'string' ,
default : '' ,
} ,
] ,
} ,
] ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'create' , 'update' ] ,
fieldsToSend : [ 'defineBelow' ] ,
2021-09-29 16:28:27 -07:00
} ,
} ,
default : { } ,
description : 'Add destination column with its value' ,
} ,
// ----------------------------------
// delete
// ----------------------------------
{
displayName : 'Row ID' ,
name : 'rowId' ,
type : 'string' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'delete' ] ,
2021-09-29 16:28:27 -07:00
} ,
} ,
default : '' ,
} ,
// ----------------------------------
// get
// ----------------------------------
{
displayName : 'Row ID' ,
name : 'rowId' ,
type : 'string' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'get' ] ,
2021-09-29 16:28:27 -07:00
} ,
} ,
default : '' ,
} ,
// ----------------------------------
// getAll
// ----------------------------------
{
displayName : 'Return All' ,
name : 'returnAll' ,
type : 'boolean' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'getAll' ] ,
2021-09-29 16:28:27 -07:00
} ,
} ,
default : true ,
description : 'Whether to return all results or only up to a given limit' ,
} ,
{
displayName : 'Limit' ,
name : 'limit' ,
type : 'number' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'getAll' ] ,
returnAll : [ false ] ,
2021-09-29 16:28:27 -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-09-29 16:28:27 -07:00
} ,
{
displayName : 'Filters' ,
name : 'filters' ,
type : 'collection' ,
placeholder : 'Add Filter' ,
default : { } ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'getAll' ] ,
2021-09-29 16:28:27 -07:00
} ,
} ,
options : [
{
2022-06-03 10:23:49 -07:00
displayName : 'View Name or ID' ,
2021-09-29 16:28:27 -07:00
name : 'view_name' ,
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-09-29 16:28:27 -07:00
typeOptions : {
loadOptionsMethod : 'getViews' ,
} ,
default : '' ,
} ,
] ,
} ,
{
displayName : 'Options' ,
name : 'options' ,
type : 'collection' ,
placeholder : 'Add Option' ,
default : { } ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'getAll' ] ,
2021-09-29 16:28:27 -07:00
} ,
} ,
options : [
{
displayName : 'Convert Link ID' ,
name : 'convert_link_id' ,
type : 'boolean' ,
default : false ,
2022-08-17 08:50:24 -07:00
description :
'Whether the link column in the returned row is the ID of the linked row or the name of the linked row' ,
2021-09-29 16:28:27 -07:00
} ,
{
displayName : 'Direction' ,
name : 'direction' ,
type : 'options' ,
options : [
{
name : 'Ascending' ,
value : 'asc' ,
} ,
{
name : 'Descending' ,
value : 'desc' ,
} ,
] ,
default : 'asc' ,
2022-05-06 14:01:25 -07:00
description : 'The direction of the sort, ascending (asc) or descending (desc)' ,
2021-09-29 16:28:27 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
2021-09-29 16:28:27 -07:00
displayName : 'Order By' ,
name : 'order_by' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getAllSortableColumns' ,
} ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'A column\'s name or ID, use this column to sort the rows. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-09-29 16:28:27 -07:00
} ,
] ,
} ,
2021-12-03 00:44:16 -08:00
] ;