2020-11-25 04:08:59 -08:00
import {
INodeProperties ,
} from 'n8n-workflow' ;
2021-12-03 00:44:16 -08:00
export const recordOperations : INodeProperties [ ] = [
2020-11-25 04:08:59 -08:00
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
2022-05-20 14:47:24 -07:00
noDataExpression : true ,
2020-11-25 04:08:59 -08:00
displayOptions : {
show : {
resource : [
'record' ,
] ,
} ,
} ,
options : [
{
name : 'Create' ,
value : 'create' ,
description : 'Create a record' ,
} ,
2022-06-03 10:23:49 -07:00
{
name : 'Create or Update' ,
value : 'upsert' ,
description : 'Create a new record, or update the current one if it already exists (upsert)' ,
} ,
2020-11-25 04:08:59 -08:00
{
name : 'Delete' ,
value : 'delete' ,
description : 'Delete a record' ,
} ,
{
name : 'Get All' ,
value : 'getAll' ,
description : 'Get all records' ,
} ,
{
name : 'Update' ,
value : 'update' ,
description : 'Update a record' ,
} ,
] ,
default : 'create' ,
} ,
2021-12-03 00:44:16 -08:00
] ;
2020-11-25 04:08:59 -08:00
2021-12-03 00:44:16 -08:00
export const recordFields : INodeProperties [ ] = [
2020-11-25 04:08:59 -08:00
/* -------------------------------------------------------------------------- */
/* record:create */
/* -------------------------------------------------------------------------- */
{
displayName : 'Table ID' ,
name : 'tableId' ,
type : 'string' ,
default : '' ,
required : true ,
displayOptions : {
show : {
resource : [
'record' ,
] ,
operation : [
'create' ,
] ,
} ,
} ,
description : 'The table identifier' ,
} ,
{
2021-04-30 19:49:15 -07:00
displayName : 'Columns' ,
2020-11-25 04:08:59 -08:00
name : 'columns' ,
type : 'string' ,
displayOptions : {
show : {
resource : [
'record' ,
] ,
operation : [
'create' ,
] ,
} ,
} ,
default : '' ,
2020-11-25 04:09:58 -08:00
required : true ,
2021-04-30 19:48:40 -07:00
placeholder : 'Select Fields...' ,
2022-05-06 14:01:25 -07:00
description : 'Comma-separated list of the properties which should used as columns for the new rows' ,
2020-11-25 04:08:59 -08:00
} ,
2021-04-30 19:48:40 -07:00
{
2022-05-20 14:47:24 -07:00
displayName : 'Simplify' ,
2020-11-25 04:08:59 -08:00
name : 'simple' ,
type : 'boolean' ,
displayOptions : {
show : {
resource : [
'record' ,
] ,
operation : [
'create' ,
] ,
} ,
} ,
default : true ,
2022-05-20 14:47:24 -07:00
description : 'Whether to return a simplified version of the response instead of the raw data' ,
2020-11-25 04:08:59 -08:00
} ,
{
displayName : 'Options' ,
name : 'options' ,
type : 'collection' ,
placeholder : 'Add Option' ,
default : { } ,
displayOptions : {
show : {
resource : [
'record' ,
] ,
operation : [
'create' ,
] ,
} ,
} ,
options : [
{
2021-04-30 19:48:40 -07:00
displayName : 'Return Fields' ,
2020-11-25 04:08:59 -08:00
name : 'fields' ,
type : 'multiOptions' ,
typeOptions : {
loadOptionsMethod : 'getTableFields' ,
loadOptionsDependsOn : [
'tableId' ,
] ,
} ,
default : [ ] ,
2022-05-06 14:01:25 -07:00
description : 'Specify an array of field IDs that will return data for any updates or added record. Record ID (FID 3) is always returned if any field ID is requested.' ,
2021-04-30 19:49:15 -07:00
} ,
{
displayName : 'Use Field IDs' ,
name : 'useFieldIDs' ,
type : 'boolean' ,
default : false ,
2022-05-06 14:01:25 -07:00
description : 'Use Field IDs instead of Field Names in Columns' ,
2021-04-30 19:49:15 -07:00
} ,
2020-11-25 04:08:59 -08:00
] ,
} ,
/* -------------------------------------------------------------------------- */
/* record:delete */
/* -------------------------------------------------------------------------- */
{
displayName : 'Table ID' ,
name : 'tableId' ,
type : 'string' ,
default : '' ,
required : true ,
displayOptions : {
show : {
resource : [
'record' ,
] ,
operation : [
'delete' ,
] ,
} ,
} ,
description : 'The table identifier' ,
} ,
{
displayName : 'Where' ,
name : 'where' ,
type : 'string' ,
default : '' ,
required : true ,
displayOptions : {
show : {
resource : [
'record' ,
] ,
operation : [
'delete' ,
] ,
} ,
} ,
2022-05-06 14:01:25 -07:00
description : 'The filter to delete records. To delete all records specify a filter that will include all records, for example {3.GT.0} where 3 is the ID of the Record ID field.' ,
2020-11-25 04:08:59 -08:00
} ,
/* -------------------------------------------------------------------------- */
/* record:getAll */
/* -------------------------------------------------------------------------- */
{
displayName : 'Table ID' ,
name : 'tableId' ,
type : 'string' ,
default : '' ,
required : true ,
displayOptions : {
show : {
resource : [
'record' ,
] ,
operation : [
'getAll' ,
] ,
} ,
} ,
description : 'The table identifier' ,
} ,
{
displayName : 'Return All' ,
name : 'returnAll' ,
type : 'boolean' ,
displayOptions : {
show : {
resource : [
'record' ,
] ,
operation : [
'getAll' ,
] ,
} ,
} ,
default : false ,
2022-05-06 14:01:25 -07:00
description : 'Whether to return all results or only up to a given limit' ,
2020-11-25 04:08:59 -08:00
} ,
{
displayName : 'Limit' ,
name : 'limit' ,
type : 'number' ,
displayOptions : {
show : {
resource : [
'record' ,
] ,
operation : [
'getAll' ,
] ,
returnAll : [
false ,
] ,
} ,
} ,
typeOptions : {
minValue : 1 ,
maxValue : 100 ,
} ,
default : 50 ,
2022-05-06 14:01:25 -07:00
description : 'Max number of results to return' ,
2020-11-25 04:08:59 -08:00
} ,
{
displayName : 'Options' ,
name : 'options' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
resource : [
'record' ,
] ,
operation : [
'getAll' ,
] ,
} ,
} ,
options : [
{
displayName : 'Select' ,
name : 'select' ,
type : 'multiOptions' ,
typeOptions : {
loadOptionsMethod : 'getTableFields' ,
} ,
default : [ ] ,
2022-05-06 14:01:25 -07:00
description : 'An array of field IDs for the fields that should be returned in the response. If empty, the default columns on the table will be returned.' ,
2020-11-25 04:08:59 -08:00
} ,
{
displayName : 'Sort By' ,
name : 'sortByUi' ,
placeholder : 'Add Sort By' ,
type : 'fixedCollection' ,
typeOptions : {
multipleValues : true ,
} ,
default : { } ,
options : [
{
name : 'sortByValues' ,
displayName : 'Sort By' ,
values : [
{
2022-06-03 10:23:49 -07:00
displayName : 'Field Name or ID' ,
2020-11-25 04:08:59 -08:00
name : 'fieldId' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getTableFields' ,
} ,
default : '' ,
2022-06-03 10:23:49 -07:00
description : 'The unique identifier of a field in a table. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>.' ,
2020-11-25 04:08:59 -08:00
} ,
{
displayName : 'Order' ,
name : 'order' ,
type : 'options' ,
options : [
{
name : 'ASC' ,
value : 'ASC' ,
} ,
{
name : 'DESC' ,
value : 'DESC' ,
} ,
] ,
default : 'ASC' ,
} ,
] ,
} ,
] ,
2022-05-06 14:01:25 -07:00
description : 'By default, queries will be sorted by the given sort fields or the default sort if the query does not provide any. Set to false to avoid sorting when the order of the data returned is not important. Returning data without sorting can improve performance.' ,
2020-11-25 04:08:59 -08:00
} ,
{
displayName : 'Where' ,
name : 'where' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'The filter, using the <a href="https://help.quickbase.com/api-guide/componentsquery.html">Quick Base query language</a>, which determines the records to return' ,
2020-11-25 04:08:59 -08:00
} ,
] ,
} ,
/* -------------------------------------------------------------------------- */
/* record:update */
/* -------------------------------------------------------------------------- */
{
displayName : 'Table ID' ,
name : 'tableId' ,
type : 'string' ,
default : '' ,
required : true ,
displayOptions : {
show : {
resource : [
'record' ,
] ,
operation : [
'update' ,
] ,
} ,
} ,
description : 'The table identifier' ,
} ,
{
displayName : 'Columns' ,
name : 'columns' ,
type : 'string' ,
displayOptions : {
show : {
resource : [
'record' ,
] ,
operation : [
'update' ,
] ,
} ,
} ,
default : '' ,
2020-11-25 04:09:58 -08:00
required : true ,
2022-06-03 10:23:49 -07:00
// eslint-disable-next-line n8n-nodes-base/node-param-placeholder-miscased-id
2020-11-25 04:08:59 -08:00
placeholder : 'id,name,description' ,
2022-05-06 14:01:25 -07:00
description : 'Comma-separated list of the properties which should used as columns for the new rows' ,
2020-11-25 04:08:59 -08:00
} ,
{
displayName : 'Update Key' ,
name : 'updateKey' ,
type : 'string' ,
displayOptions : {
show : {
resource : [
'record' ,
] ,
operation : [
'update' ,
] ,
} ,
} ,
default : '' ,
2022-06-03 10:23:49 -07:00
description : 'Update can use the key field on the table, or any other supported unique field' ,
2020-11-25 04:08:59 -08:00
} ,
{
2022-05-20 14:47:24 -07:00
displayName : 'Simplify' ,
2020-11-25 04:08:59 -08:00
name : 'simple' ,
type : 'boolean' ,
displayOptions : {
show : {
resource : [
'record' ,
] ,
operation : [
'update' ,
] ,
} ,
} ,
default : true ,
2022-05-20 14:47:24 -07:00
description : 'Whether to return a simplified version of the response instead of the raw data' ,
2020-11-25 04:08:59 -08:00
} ,
{
displayName : 'Options' ,
name : 'options' ,
type : 'collection' ,
placeholder : 'Add Option' ,
default : { } ,
displayOptions : {
show : {
resource : [
'record' ,
] ,
operation : [
'update' ,
] ,
} ,
} ,
options : [
{
displayName : 'Fields' ,
name : 'fields' ,
type : 'multiOptions' ,
typeOptions : {
loadOptionsMethod : 'getTableFields' ,
loadOptionsDependsOn : [
'tableId' ,
] ,
} ,
default : [ ] ,
2022-05-06 14:01:25 -07:00
description : 'Specify an array of field IDs that will return data for any updates or added record. Record ID (FID 3) is always returned if any field ID is requested.' ,
2020-11-25 04:08:59 -08:00
} ,
2021-04-30 19:49:15 -07:00
{
displayName : 'Use Field IDs' ,
name : 'useFieldIDs' ,
type : 'boolean' ,
default : false ,
2022-05-06 14:01:25 -07:00
description : 'Use Field IDs instead of Field Names in Columns' ,
2021-04-30 19:49:15 -07:00
} ,
2020-11-25 04:08:59 -08:00
// {
// displayName: 'Merge Field ID',
// name: 'mergeFieldId',
// type: 'options',
// typeOptions: {
// loadOptionsMethod: 'getUniqueTableFields',
// },
// default: '',
2021-11-25 09:10:06 -08:00
// description: `You're updating records in a Quick Base table with data from an external file. In order for a merge like this to work,
// Quick Base needs a way to match records in the source data with corresponding records in the destination table. You make this possible by
2020-11-25 04:08:59 -08:00
// choosing the field in the app table that holds unique matching values. This is called a merge field.`,
// },
] ,
} ,
/* -------------------------------------------------------------------------- */
/* record:upsert */
/* -------------------------------------------------------------------------- */
{
displayName : 'Table ID' ,
name : 'tableId' ,
type : 'string' ,
default : '' ,
required : true ,
displayOptions : {
show : {
resource : [
'record' ,
] ,
operation : [
'upsert' ,
] ,
} ,
} ,
description : 'The table identifier' ,
} ,
{
displayName : 'Columns' ,
name : 'columns' ,
type : 'string' ,
displayOptions : {
show : {
resource : [
'record' ,
] ,
operation : [
'upsert' ,
] ,
} ,
} ,
default : '' ,
2020-11-25 04:09:58 -08:00
required : true ,
2022-06-03 10:23:49 -07:00
// eslint-disable-next-line n8n-nodes-base/node-param-placeholder-miscased-id
2020-11-25 04:08:59 -08:00
placeholder : 'id,name,description' ,
2022-05-06 14:01:25 -07:00
description : 'Comma-separated list of the properties which should used as columns for the new rows' ,
2020-11-25 04:08:59 -08:00
} ,
{
displayName : 'Update Key' ,
name : 'updateKey' ,
type : 'string' ,
displayOptions : {
show : {
resource : [
'record' ,
] ,
operation : [
'upsert' ,
] ,
} ,
} ,
default : '' ,
2022-06-03 10:23:49 -07:00
description : 'Update can use the key field on the table, or any other supported unique field' ,
2020-11-25 04:08:59 -08:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Merge Field Name or ID' ,
2020-11-25 04:08:59 -08:00
name : 'mergeFieldId' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getUniqueTableFields' ,
} ,
displayOptions : {
show : {
resource : [
'record' ,
] ,
operation : [
'upsert' ,
] ,
} ,
} ,
default : '' ,
2022-06-03 10:23:49 -07:00
description : '<p>You\'re updating records in a Quick Base table with data from an external file. In order for a merge like this to work, Quick Base needs a way to match records in the source data with corresponding records in the destination table.</p><p>You make this possible by choosing the field in the app table that holds unique matching values. This is called a merge field.</p>. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>.' ,
2020-11-25 04:08:59 -08:00
} ,
{
2022-05-20 14:47:24 -07:00
displayName : 'Simplify' ,
2020-11-25 04:08:59 -08:00
name : 'simple' ,
type : 'boolean' ,
displayOptions : {
show : {
resource : [
'record' ,
] ,
operation : [
'upsert' ,
] ,
} ,
} ,
default : true ,
2022-05-20 14:47:24 -07:00
description : 'Whether to return a simplified version of the response instead of the raw data' ,
2020-11-25 04:08:59 -08:00
} ,
{
displayName : 'Options' ,
name : 'options' ,
type : 'collection' ,
placeholder : 'Add Option' ,
default : { } ,
displayOptions : {
show : {
resource : [
'record' ,
] ,
operation : [
'upsert' ,
] ,
} ,
} ,
options : [
{
displayName : 'Fields' ,
name : 'fields' ,
type : 'multiOptions' ,
typeOptions : {
loadOptionsMethod : 'getTableFields' ,
loadOptionsDependsOn : [
'tableId' ,
] ,
} ,
default : [ ] ,
2022-05-06 14:01:25 -07:00
description : 'Specify an array of field IDs that will return data for any updates or added record. Record ID (FID 3) is always returned if any field ID is requested.' ,
2020-11-25 04:08:59 -08:00
} ,
2021-04-30 19:49:15 -07:00
{
displayName : 'Use Field IDs' ,
name : 'useFieldIDs' ,
type : 'boolean' ,
default : false ,
2022-05-06 14:01:25 -07:00
description : 'Use Field IDs instead of Field Names in Columns' ,
2021-04-30 19:49:15 -07:00
} ,
2020-11-25 04:08:59 -08:00
] ,
} ,
2021-12-03 00:44:16 -08:00
] ;