fixed linter errors and new action get row links

This commit is contained in:
Christoph Dyllick-Brenzinger 2024-06-14 15:25:15 +02:00
parent 6f41c759eb
commit 3b0325a7e8
32 changed files with 423 additions and 114 deletions

View file

@ -69,7 +69,8 @@ export class SeaTableTrigger implements INodeType {
default: 'newRow',
},
{
displayName: 'Table Name or ID',
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Table Name',
name: 'tableName',
type: 'options',
required: true,
@ -77,11 +78,13 @@ export class SeaTableTrigger implements INodeType {
loadOptionsMethod: 'getTableNames',
},
default: '',
// eslint-disable-next-line n8n-nodes-base/node-param-description-wrong-for-dynamic-options
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>.',
'The name of SeaTable table to access. Choose from the list, or specify the name using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
{
displayName: 'View Name or ID',
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'View Name',
name: 'viewName',
type: 'options',
displayOptions: {
@ -94,11 +97,13 @@ export class SeaTableTrigger implements INodeType {
loadOptionsMethod: 'getTableViews',
},
default: '',
// eslint-disable-next-line n8n-nodes-base/node-param-description-wrong-for-dynamic-options
description:
'The name of SeaTable view to access. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
'The name of SeaTable view to access. Choose from the list, or specify the name using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
{
displayName: 'Signature Column Name or ID',
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Signature Column',
name: 'assetColumn',
type: 'options',
required: true,
@ -112,8 +117,9 @@ export class SeaTableTrigger implements INodeType {
loadOptionsMethod: 'getSignatureColumns',
},
default: '',
// eslint-disable-next-line n8n-nodes-base/node-param-description-wrong-for-dynamic-options
description:
'Select the digital-signature column that should be tracked. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
'Select the digital-signature column that should be tracked. Choose from the list, or specify the name using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
{
displayName: 'Simplify',

View file

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="60" height="60"><path fill="url(#a)" d="M16.787 43.213 28.574 55l16.943-16.942a7.87 7.87 0 0 0 0-11.132l-6.22-6.221-.112-.111-18.611 18.57.13.131z"/><path fill="#ff8000" d="m20.704 39.295 22.51-22.507L31.425 5 14.483 21.942a7.87 7.87 0 0 0 0 11.133z"/><defs><linearGradient id="a" x1="0" x2="1" y1="0" y2="0" gradientTransform="rotate(-109.048 29.213 6.813)scale(10.08407)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#ff8000"/><stop offset="1" stop-color="#ec2837"/></linearGradient></defs></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="60" height="60"><path d="M16.787 43.213L28.574 55l16.943-16.942a7.872 7.872 0 000-11.132l-6.22-6.221-.112-.111-18.611 18.57.13.131z" fill="url(#g1)"/><path d="M20.704 39.295l22.51-22.507L31.425 5 14.483 21.942a7.872 7.872 0 000 11.133z" fill="#ff8000"/><defs id="d1"><linearGradient id="g1" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="scale(-10.08407) rotate(70.952 .948 -4.065)"><stop offset="0" id="stop905" stop-color="#ff8000" stop-opacity="1"/><stop offset="1" id="stop907" stop-color="#ec2837" stop-opacity="1"/></linearGradient></defs></svg>

Before

Width:  |  Height:  |  Size: 560 B

After

Width:  |  Height:  |  Size: 629 B

View file

@ -49,10 +49,11 @@ export const rowFields: INodeProperties[] = [
// ----------------------------------
{
displayName: 'Table Name or ID',
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Table Name',
name: 'tableName',
type: 'options',
placeholder: 'Name of table',
placeholder: 'Name of the table',
required: true,
typeOptions: {
loadOptionsMethod: 'getTableNames',
@ -63,14 +64,16 @@ export const rowFields: INodeProperties[] = [
},
},
default: '',
// eslint-disable-next-line n8n-nodes-base/node-param-description-wrong-for-dynamic-options
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>.',
'The name of SeaTable table to access. Choose from the list, or specify the name using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
{
displayName: 'Table Name or ID',
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Table ID',
name: 'tableId',
type: 'options',
placeholder: 'Name of table',
placeholder: 'ID of the table',
required: true,
typeOptions: {
loadOptionsMethod: 'getTableIds',
@ -81,6 +84,7 @@ export const rowFields: INodeProperties[] = [
},
},
default: '',
// eslint-disable-next-line n8n-nodes-base/node-param-description-wrong-for-dynamic-options
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>.',
},
@ -157,11 +161,13 @@ export const rowFields: INodeProperties[] = [
name: 'columnValues',
values: [
{
displayName: 'Column Name or ID',
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Column Name',
name: 'columnName',
type: 'options',
// eslint-disable-next-line n8n-nodes-base/node-param-description-wrong-for-dynamic-options
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
'Choose from the list, or specify the name using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
typeOptions: {
loadOptionsDependsOn: ['table'],
loadOptionsMethod: 'getTableUpdateAbleColumns',
@ -243,7 +249,6 @@ export const rowFields: INodeProperties[] = [
},
typeOptions: {
minValue: 1,
maxValue: 100,
},
default: 50,
description: 'Max number of results to return',
@ -261,11 +266,13 @@ export const rowFields: INodeProperties[] = [
},
options: [
{
displayName: 'View Name or ID',
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'View Name',
name: 'view_name',
type: 'options',
// eslint-disable-next-line n8n-nodes-base/node-param-description-wrong-for-dynamic-options
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
'Choose from the list, or specify an View Name using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
typeOptions: {
loadOptionsMethod: 'getViews',
},
@ -291,7 +298,7 @@ export const rowFields: INodeProperties[] = [
type: 'boolean',
default: false,
description:
'Whether the link column in the returned row is the ID of the linked row or the name of the linked row',
'Whether the ID of the linked row is returned in the link column (true). Otherwise, it return the name of the linked row (false).',
},
{
displayName: 'Direction',
@ -312,15 +319,16 @@ export const rowFields: INodeProperties[] = [
},
{
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Order By',
displayName: 'Order By Column',
name: 'order_by',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getAllSortableColumns',
},
default: '',
// eslint-disable-next-line n8n-nodes-base/node-param-description-wrong-for-dynamic-options
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>.',
'Choose from the list, or specify a Column using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
},
],
},

View file

@ -0,0 +1,40 @@
import type { INodeTypeDescription } from 'n8n-workflow';
import { rowFields, rowOperations } from './RowDescription';
export const versionDescription: INodeTypeDescription = {
displayName: 'SeaTable',
name: 'seaTable',
icon: 'file:seaTable.svg',
group: ['input'],
version: 1,
subtitle: '={{$parameter["resource"] + ": " + $parameter["operation"]}}',
description: 'Consume the SeaTable API',
defaults: {
name: 'SeaTable',
},
inputs: ['main'],
outputs: ['main'],
credentials: [
{
name: 'seaTableApi',
required: true,
},
],
properties: [
{
displayName: 'Resource',
name: 'resource',
type: 'options',
noDataExpression: true,
options: [
{
name: 'Row',
value: 'row',
},
],
default: 'row',
},
...rowOperations,
...rowFields,
],
};

View file

@ -25,7 +25,7 @@ import {
import type { TColumnsUiValues, TColumnValue } from './types';
import type { ICtx, IRow, IRowObject } from './Interfaces';
import { versionDescription } from './VersionDescription';
import { versionDescription } from './SeaTable.node';
export class SeaTableV1 implements INodeType {
description: INodeTypeDescription;

View file

@ -9,8 +9,8 @@ export type TSeaTableServerEdition = 'enterprise edition';
// dtable
// ----------------------------------
import type { ICredentialDataDecryptedObject } from 'n8n-workflow';
import type { IDtableMetadataColumn, IDtableMetadataTable, TDtableViewColumn } from './Interfaces';
import type { ICredentialDataDecryptedObject } from 'n8n-workflow';
export type TInheritColumnTypeTime = 'ctime' | 'mtime';
export type TInheritColumnTypeUser = 'creator' | 'last-modifier';

View file

@ -5,7 +5,7 @@ import type {
INodeTypeBaseDescription,
} from 'n8n-workflow';
import { versionDescription } from './actions/versionDescription';
import { versionDescription } from './actions/SeaTable.node';
import { loadOptions } from './methods';
import { router } from './actions/router';

View file

@ -3,7 +3,7 @@ import type { AllEntities, Entity, PropertiesOf } from 'n8n-workflow';
type SeaTableMap = {
row: 'create' | 'get' | 'search' | 'update' | 'remove' | 'lock' | 'unlock' | 'list';
base: 'snapshot' | 'metadata' | 'apiCall' | 'collaborator';
link: 'add' | 'remove';
link: 'add' | 'list' | 'remove';
asset: 'upload' | 'getPublicURL';
};

View file

@ -0,0 +1,57 @@
import type { INodeTypeDescription } from 'n8n-workflow';
import * as row from './row';
import * as base from './base';
import * as link from './link';
import * as asset from './asset';
export const versionDescription: INodeTypeDescription = {
displayName: 'SeaTable',
name: 'seaTable',
icon: 'file:seatable.svg',
group: ['output'],
version: 2,
subtitle: '={{$parameter["resource"] + ": " + $parameter["operation"]}}',
description: 'Consume the SeaTable API',
defaults: {
name: 'SeaTable',
},
inputs: ['main'],
outputs: ['main'],
credentials: [
{
name: 'seaTableApi',
required: true,
},
],
properties: [
{
displayName: 'Resource',
name: 'resource',
type: 'options',
noDataExpression: true,
options: [
{
name: 'Row',
value: 'row',
},
{
name: 'Base',
value: 'base',
},
{
name: 'Link',
value: 'link',
},
{
name: 'Asset',
value: 'asset',
},
],
default: 'row',
},
...row.descriptions,
...base.descriptions,
...link.descriptions,
...asset.descriptions,
],
};

View file

@ -2,7 +2,7 @@ import type { AssetProperties } from '../../Interfaces';
export const assetGetPublicURLDescription: AssetProperties = [
{
displayName: 'Asset path',
displayName: 'Asset Path',
name: 'assetPath',
type: 'string',
placeholder: '/images/2023-09/logo.png',
@ -14,6 +14,5 @@ export const assetGetPublicURLDescription: AssetProperties = [
},
},
default: '',
description: '',
},
];

View file

@ -26,7 +26,7 @@ export const descriptions: INodeProperties[] = [
name: 'Upload',
value: 'upload',
description: 'Add a file/image to an existing row',
action: 'Upload a file/image',
action: 'Upload a file or image',
},
],
default: 'upload',

View file

@ -2,6 +2,7 @@ import type { AssetProperties } from '../../Interfaces';
export const assetUploadDescription: AssetProperties = [
{
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Table Name',
name: 'tableName',
type: 'options',
@ -17,11 +18,13 @@ export const assetUploadDescription: AssetProperties = [
},
},
default: '',
// eslint-disable-next-line n8n-nodes-base/node-param-description-wrong-for-dynamic-options
description:
'The name of SeaTable table to access. Choose from the list, or specify a name using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
{
displayName: 'Column',
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Column Name',
name: 'uploadColumn',
type: 'options',
displayOptions: {
@ -36,12 +39,17 @@ export const assetUploadDescription: AssetProperties = [
},
required: true,
default: '',
description: 'Select the column for the upload.',
// eslint-disable-next-line n8n-nodes-base/node-param-description-wrong-for-dynamic-options
description:
'Select the column for the upload. Choose from the list, or specify the name using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
{
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Row ID',
name: 'rowId',
type: 'options',
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
required: true,
typeOptions: {
loadOptionsDependsOn: ['tableName'],
@ -70,7 +78,7 @@ export const assetUploadDescription: AssetProperties = [
description: 'Name of the binary property which contains the data for the file to be written',
},
{
displayName: 'Replace existing file',
displayName: 'Replace Existing File',
name: 'replace',
type: 'boolean',
default: true,
@ -81,10 +89,10 @@ export const assetUploadDescription: AssetProperties = [
},
},
description:
'Replace existing asset with the same name. Otherwise a new version with another name (numeral in parentheses) will be uploaded.',
'Whether to replace the existing asset with the same name (true). Otherwise, a new version with a different name (numeral in parentheses) will be uploaded (false).',
},
{
displayName: 'Append to column',
displayName: 'Append to Column',
name: 'append',
type: 'boolean',
default: true,
@ -95,6 +103,6 @@ export const assetUploadDescription: AssetProperties = [
},
},
description:
'Keep existing files/images in the column and append the new asset. Otherwise the existing files/images are remove from the column.',
'Whether to keep existing files/images in the column and append the new asset (true). Otherwise, the existing files/images are removed from the column (false).',
},
];

View file

@ -30,7 +30,7 @@ export const baseApiCallDescription: BaseProperties = [
},
},
required: true,
default: '',
default: 'POST',
},
{
displayName: 'Hint: The Authentication header is included automatically.',
@ -56,20 +56,17 @@ export const baseApiCallDescription: BaseProperties = [
required: true,
default: '',
placeholder: '/dtable-server/...',
description:
'The URL has to start with /dtable-server/ or /dtable-db/. All possible requests can be found at the SeaTable API Reference at https://api.seatable.io \
Please be aware that only request from the section Base Operations that use an Base-Token for the authentication are allowed to use.',
description: 'The URL has to start with /dtable-server/ or /dtable-db/. All possible requests can be found at the SeaTable API Reference at https://api.seatable.io Please be aware that only request from the section Base Operations that use an Base-Token for the authentication are allowed to use.',
},
{
displayName: 'Query String Parameters',
name: 'apiParams',
type: 'fixedCollection',
default: '',
default: {},
typeOptions: {
multipleValues: true,
},
description:
'These params will be URL-encoded and appended to the URL when making the request.',
description: 'These params will be URL-encoded and appended to the URL when making the request',
options: [
{
name: 'apiParamsValues',
@ -115,11 +112,10 @@ export const baseApiCallDescription: BaseProperties = [
'Only valid JSON is accepted. n8n will pass anything you enter as raw input. For example, {"foo", "bar"} is perfectly valid. Of cause you can use variables from n8n inside your JSON.',
},
{
displayName: 'Response object parameter name',
displayName: 'Response Object Parameter Name',
name: 'responseObjectName',
type: 'string',
placeholder: 'Leave it empty or use a value like "rows", "metadata", "views" etc.',
required: false,
displayOptions: {
show: {
resource: ['base'],

View file

@ -23,7 +23,7 @@ export const descriptions: INodeProperties[] = [
name: 'Snapshot',
value: 'snapshot',
description: 'Create a snapshot of the base',
action: 'Create a Snapshot',
action: 'Create a snapshot',
},
{
name: 'Metadata',
@ -35,16 +35,16 @@ export const descriptions: INodeProperties[] = [
name: 'API Call',
value: 'apiCall',
description: 'Perform an authorized API call (Base Operation)',
action: 'Make an API Call',
action: 'Make an api call',
},
{
name: 'Collaborator',
value: 'collaborator',
description: 'Get this username from the email or name of a collaborator.',
description: 'Get this username from the email or name of a collaborator',
action: 'Get username from email or name',
},
],
default: '',
default: 'snapshot',
},
...snapshot.description,
...metadata.description,

View file

@ -2,6 +2,7 @@ import type { LinkProperties } from '../../Interfaces';
export const linkAddDescription: LinkProperties = [
{
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Table Name (Source)',
name: 'tableName',
type: 'options',
@ -17,10 +18,13 @@ export const linkAddDescription: LinkProperties = [
},
},
default: '',
description: 'If you use an expression, provide it in the way "<table_name>:::<table_id>".',
// eslint-disable-next-line n8n-nodes-base/node-param-description-wrong-for-dynamic-options
description:
'Choose from the list, of specify by using an expression. Provide it in the way "table_name:::table_id".',
},
{
displayName: 'Link column',
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Link Column',
name: 'linkColumn',
type: 'options',
displayOptions: {
@ -35,11 +39,12 @@ export const linkAddDescription: LinkProperties = [
},
required: true,
default: '',
// eslint-disable-next-line n8n-nodes-base/node-param-description-wrong-for-dynamic-options
description:
'If you use an expression, provide it in the way "<column_name>:::<link_id>:::<other_table_id>".',
'Choose from the list of specify the Link Column by using an expression. You have to provide it in the way "column_name:::link_id:::other_table_id".',
},
{
displayName: 'Row ID from the source table',
displayName: 'Row ID From the Source Table',
name: 'linkColumnSourceId',
type: 'string',
displayOptions: {
@ -50,10 +55,10 @@ export const linkAddDescription: LinkProperties = [
},
required: true,
default: '',
description: 'Provide the row ID of table you selected.',
description: 'Provide the row ID of table you selected',
},
{
displayName: 'Row ID from the target',
displayName: 'Row ID From the Target',
name: 'linkColumnTargetId',
type: 'string',
displayOptions: {
@ -64,6 +69,6 @@ export const linkAddDescription: LinkProperties = [
},
required: true,
default: '',
description: 'Provide the row ID of table you want to link.',
description: 'Provide the row ID of table you want to link',
},
];

View file

@ -1,8 +1,9 @@
import * as add from './add';
import * as list from './list';
import * as remove from './remove';
import type { INodeProperties } from 'n8n-workflow';
export { add, remove };
export { add, list, remove };
export const descriptions: INodeProperties[] = [
{
@ -22,6 +23,12 @@ export const descriptions: INodeProperties[] = [
description: 'Create a link between two rows in a link column',
action: 'Add a row link',
},
{
name: 'List',
value: 'list',
description: 'List all links of a specific row',
action: 'List row links',
},
{
name: 'Remove',
value: 'remove',
@ -32,5 +39,6 @@ export const descriptions: INodeProperties[] = [
default: 'add',
},
...add.description,
...list.description,
...remove.description,
];

View file

@ -0,0 +1,66 @@
import type { LinkProperties } from '../../Interfaces';
export const listLinkDescription: LinkProperties = [
{
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Table Name 32',
name: 'tableName',
type: 'options',
placeholder: 'Select a table',
required: true,
typeOptions: {
loadOptionsMethod: 'getTableNameAndId',
},
displayOptions: {
show: {
resource: ['link'],
operation: ['list'],
},
},
default: '',
// eslint-disable-next-line n8n-nodes-base/node-param-description-wrong-for-dynamic-options
description:
'Choose from the list, of specify by using an expression. Provide it in the way "table_name:::table_id".',
},
{
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Link Column',
name: 'linkColumn',
type: 'options',
displayOptions: {
show: {
resource: ['link'],
operation: ['list'],
},
},
typeOptions: {
loadOptionsDependsOn: ['tableName'],
loadOptionsMethod: 'getLinkColumnsWithColumnKey',
},
required: true,
default: '',
// eslint-disable-next-line n8n-nodes-base/node-param-description-wrong-for-dynamic-options
description:
'Choose from the list of specify the Link Column by using an expression. You have to provide it in the way "column_name:::link_id:::other_table_id:::column_key".',
},
{
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Row ID',
name: 'rowId',
type: 'options',
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
required: true,
typeOptions: {
loadOptionsDependsOn: ['tableName'],
loadOptionsMethod: 'getRowIds',
},
displayOptions: {
show: {
resource: ['link'],
operation: ['list'],
},
},
default: '',
},
];

View file

@ -0,0 +1,29 @@
import type { IExecuteFunctions, IDataObject, INodeExecutionData } from 'n8n-workflow';
import { seaTableApiRequest } from '../../../GenericFunctions';
export async function list(this: IExecuteFunctions, index: number): Promise<INodeExecutionData[]> {
// get parameters
const tableName = this.getNodeParameter('tableName', index) as string;
const linkColumn = this.getNodeParameter('linkColumn', index) as string;
const rowId = this.getNodeParameter('rowId', index) as string;
// get rows
let responseData = await seaTableApiRequest.call(
this,
{},
'POST',
'/dtable-db/api/v1/linked-records/{{dtable_uuid}}/',
{
table_id: tableName.split(':::')[1],
link_column: linkColumn.split(':::')[3],
rows: [
{
row_id: rowId,
offset: 0,
limit: 100,
},
],
},
);
return this.helpers.returnJsonArray(responseData[rowId] as IDataObject[]);
}

View file

@ -0,0 +1,4 @@
import { list as execute } from './execute';
import { listLinkDescription as description } from './description';
export { description, execute };

View file

@ -2,6 +2,7 @@ import type { LinkProperties } from '../../Interfaces';
export const linkRemoveDescription: LinkProperties = [
{
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Table Name (Source)',
name: 'tableName',
type: 'options',
@ -17,10 +18,13 @@ export const linkRemoveDescription: LinkProperties = [
},
},
default: '',
description: 'If you use an expression, provide it in the way "<table_name>:::<table_id>".',
// eslint-disable-next-line n8n-nodes-base/node-param-description-wrong-for-dynamic-options
description:
'Choose from the list, of specify by using an expression. Provide it in the way "table_name:::table_id".',
},
{
displayName: 'Link column',
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Link Column',
name: 'linkColumn',
type: 'options',
displayOptions: {
@ -35,10 +39,12 @@ export const linkRemoveDescription: LinkProperties = [
},
required: true,
default: '',
description: 'If you use an expression, provide it in the way "<column_name>:::<link_id>:::<other_table_id>".',
// eslint-disable-next-line n8n-nodes-base/node-param-description-wrong-for-dynamic-options
description:
'Choose from the list of specify the Link Column by using an expression. You have to provide it in the way "column_name:::link_id:::other_table_id".',
},
{
displayName: 'Row ID from the source table',
displayName: 'Row ID From the Source Table',
name: 'linkColumnSourceId',
type: 'string',
displayOptions: {
@ -49,10 +55,10 @@ export const linkRemoveDescription: LinkProperties = [
},
required: true,
default: '',
description: 'Provide the row ID of table you selected.',
description: 'Provide the row ID of table you selected',
},
{
displayName: 'Row ID from the target',
displayName: 'Row ID From the Target Table',
name: 'linkColumnTargetId',
type: 'string',
displayOptions: {
@ -63,6 +69,6 @@ export const linkRemoveDescription: LinkProperties = [
},
required: true,
default: '',
description: 'Provide the row ID of table you want to link.',
description: 'Provide the row ID of table you want to link',
},
];

View file

@ -2,6 +2,7 @@ import type { RowProperties } from '../../Interfaces';
export const rowCreateDescription: RowProperties = [
{
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Table Name',
name: 'tableName',
type: 'options',
@ -17,6 +18,7 @@ export const rowCreateDescription: RowProperties = [
},
},
default: '',
// eslint-disable-next-line n8n-nodes-base/node-param-description-wrong-for-dynamic-options
description:
'The name of SeaTable table to access. Choose from the list, or specify a name using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
@ -76,9 +78,11 @@ export const rowCreateDescription: RowProperties = [
name: 'columnValues',
values: [
{
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Column Name',
name: 'columnName',
type: 'options',
// eslint-disable-next-line n8n-nodes-base/node-param-description-wrong-for-dynamic-options
description:
'Choose from the list, or specify the column name using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
typeOptions: {
@ -105,10 +109,10 @@ export const rowCreateDescription: RowProperties = [
},
default: {},
description:
'Add destination column with its value. Provide the value in this way:<br>Date: YYYY-MM-DD or YYYY-MM-DD hh:mm<br>Duration: time in seconds<br>Checkbox: true, on or 1<br>Multi-Select: comma separated list',
'Add destination column with its value. Provide the value in this way. Date: YYYY-MM-DD or YYYY-MM-DD hh:mm. Duration: time in seconds. Checkbox: true, on or 1. Multi-Select: comma-separated list.',
},
{
displayName: 'Save to "Big Data" backend',
displayName: 'Save to "Big Data" Backend',
name: 'bigdata',
type: 'boolean',
displayOptions: {
@ -118,7 +122,8 @@ export const rowCreateDescription: RowProperties = [
},
},
default: false,
description: 'This requires the activation of the Big Data backend in the base.',
description:
'Whether write to Big Data backend (true) or not (false). True requires the activation of the Big Data backend in the base.',
},
{
displayName: 'Hint: Link, files, images or digital signatures have to be added separately.',

View file

@ -64,7 +64,6 @@ export async function create(
// save to normal backend
else {
body.row = rowInput;
const responseData = await seaTableApiRequest.call(
this,
{},

View file

@ -2,6 +2,7 @@ import type { RowProperties } from '../../Interfaces';
export const rowGetDescription: RowProperties = [
{
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Table Name',
name: 'tableName',
type: 'options',
@ -17,13 +18,17 @@ export const rowGetDescription: RowProperties = [
},
},
default: '',
// eslint-disable-next-line n8n-nodes-base/node-param-description-wrong-for-dynamic-options
description:
'The name of SeaTable table to access. Choose from the list, or specify a name using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
{
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Row ID',
name: 'rowId',
type: 'options',
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
required: true,
typeOptions: {
loadOptionsDependsOn: ['tableName'],
@ -38,7 +43,7 @@ export const rowGetDescription: RowProperties = [
default: '',
},
{
displayName: 'Simplify output',
displayName: 'Simplify',
name: 'simple',
type: 'boolean',
displayOptions: {
@ -48,7 +53,6 @@ export const rowGetDescription: RowProperties = [
},
},
default: true,
description:
'Simplified returns only the columns of your base. Non-simplified will return additional columns like _ctime (=creation time), _mtime (=modification time) etc.',
description: 'Whether to return a simplified version of the response instead of the raw data',
},
];

View file

@ -28,6 +28,12 @@ export const descriptions: INodeProperties[] = [
description: 'Create a new row',
action: 'Create a row',
},
{
name: 'Delete',
value: 'remove',
description: 'Delete a row',
action: 'Delete a row',
},
{
name: 'Get',
value: 'get',
@ -37,39 +43,33 @@ export const descriptions: INodeProperties[] = [
{
name: 'Get Many',
value: 'list',
description: 'Get many rows from a table of view',
description: 'Get many rows from a table or a table view',
action: 'Get many rows',
},
{
name: 'Lock',
value: 'lock',
description: 'Lock a row to prevent further changes',
action: 'Add a row lock',
},
{
name: 'Search',
value: 'search',
description: 'Search one or multiple rows',
action: 'Search a row by keyword',
},
{
name: 'Update',
value: 'update',
description: 'Update the content of a row',
action: 'Update a row',
},
{
name: 'Delete',
value: 'remove',
description: 'Delete a row',
action: 'Delete a row',
},
{
name: 'Lock',
value: 'lock',
description: 'Lock a row to prevent further changes.',
action: 'Add a row lock',
},
{
name: 'Unlock',
value: 'unlock',
description: 'Remove the lock from a row',
action: 'Remove a row lock',
},
{
name: 'Update',
value: 'update',
description: 'Update the content of a row',
action: 'Update a row',
},
],
default: 'create',
},

View file

@ -2,13 +2,14 @@ import type { RowProperties } from '../../Interfaces';
export const rowListDescription: RowProperties = [
{
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Table Name',
name: 'tableName',
type: 'options',
placeholder: 'Select a table',
required: true,
typeOptions: {
loadOptionsMethod: 'getTableNames',
loadOptionsMethod: 'getTableNameAndId',
},
displayOptions: {
show: {
@ -17,14 +18,15 @@ export const rowListDescription: RowProperties = [
},
},
default: '',
// eslint-disable-next-line n8n-nodes-base/node-param-description-wrong-for-dynamic-options
description:
'The name of SeaTable table to access. Choose from the list, or specify a name using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
'Choose from the list, or specify by using an expression. Provide it in the way "table_name:::table_id".',
},
{
displayName: 'View Name or ID (optional)',
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'View Name',
name: 'viewName',
type: 'options',
required: false,
displayOptions: {
show: {
resource: ['row'],
@ -36,10 +38,12 @@ export const rowListDescription: RowProperties = [
loadOptionsMethod: 'getTableViews',
},
default: '',
description: 'The name of SeaTable view to access. Choose from the list, or specify ...',
// eslint-disable-next-line n8n-nodes-base/node-param-description-wrong-for-dynamic-options
description:
'The name of SeaTable view to access, or specify by using an expression. Provide it in the way "col.name:::col.type".',
},
{
displayName: 'Simplify output',
displayName: 'Simplify',
name: 'simple',
type: 'boolean',
displayOptions: {
@ -49,7 +53,6 @@ export const rowListDescription: RowProperties = [
},
},
default: true,
description:
'Simplified returns only the columns of your base. Non-simplified will return additional columns like _ctime (=creation time), _mtime (=modification time) etc.',
description: 'Whether to return a simplified version of the response instead of the raw data',
},
];

View file

@ -2,6 +2,7 @@ import type { RowProperties } from '../../Interfaces';
export const rowLockDescription: RowProperties = [
{
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Table Name',
name: 'tableName',
type: 'options',
@ -17,13 +18,18 @@ export const rowLockDescription: RowProperties = [
},
},
default: '',
// eslint-disable-next-line n8n-nodes-base/node-param-description-wrong-for-dynamic-options
description:
'The name of SeaTable table to access. Choose from the list, or specify a name using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
{
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Row ID',
name: 'rowId',
type: 'options',
// eslint-disable-next-line n8n-nodes-base/node-param-description-wrong-for-dynamic-options
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
required: true,
typeOptions: {
loadOptionsDependsOn: ['tableName'],

View file

@ -2,6 +2,7 @@ import type { RowProperties } from '../../Interfaces';
export const rowRemoveDescription: RowProperties = [
{
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Table Name',
name: 'tableName',
type: 'options',
@ -17,10 +18,12 @@ export const rowRemoveDescription: RowProperties = [
},
},
default: '',
// eslint-disable-next-line n8n-nodes-base/node-param-description-wrong-for-dynamic-options
description:
'The name of SeaTable table to access. Choose from the list, or specify a name using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
{
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Row ID',
name: 'rowId',
type: 'options',
@ -36,6 +39,8 @@ export const rowRemoveDescription: RowProperties = [
},
},
default: '',
description: 'Remove any row from the normal or big data backend based on its unique row ID.',
// eslint-disable-next-line n8n-nodes-base/node-param-description-wrong-for-dynamic-options
description:
'Remove any row from the normal or big data backend based on its unique row ID. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
];

View file

@ -2,6 +2,7 @@ import type { RowProperties } from '../../Interfaces';
export const rowSearchDescription: RowProperties = [
{
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Table Name',
name: 'tableName',
type: 'options',
@ -17,11 +18,13 @@ export const rowSearchDescription: RowProperties = [
},
},
default: '',
// eslint-disable-next-line n8n-nodes-base/node-param-description-wrong-for-dynamic-options
description:
'The name of SeaTable table to access. Choose from the list, or specify a name using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
{
displayName: 'Column',
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Column Name',
name: 'searchColumn',
type: 'options',
displayOptions: {
@ -36,10 +39,12 @@ export const rowSearchDescription: RowProperties = [
},
required: true,
default: '',
description: 'Select the column to be searched. Not all column types are supported for search.',
// eslint-disable-next-line n8n-nodes-base/node-param-description-wrong-for-dynamic-options
description:
'Select the column to be searched. Not all column types are supported for search. Choose from the list, or specify a name using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
{
displayName: 'Search term',
displayName: 'Search Term',
name: 'searchTerm',
type: 'string',
displayOptions: {
@ -64,10 +69,10 @@ export const rowSearchDescription: RowProperties = [
},
default: false,
description:
'FALSE: The search distinguish between uppercase and lowercase characters. TRUE: Search ignores case sensitivity.',
'Whether the search ignores case sensitivity (true). Otherwise, it distinguishes between uppercase and lowercase characters.',
},
{
displayName: 'Activate wildcard search',
displayName: 'Activate Wildcard Search',
name: 'wildcard',
type: 'boolean',
displayOptions: {
@ -78,10 +83,10 @@ export const rowSearchDescription: RowProperties = [
},
default: false,
description:
'FALSE: The search only results perfect matches. TRUE: Finds a row even if the search value is part of a string.',
'Whether the search only results perfect matches (true). Otherwise, it finds a row even if the search value is part of a string (false).',
},
{
displayName: 'Simplify output',
displayName: 'Simplify',
name: 'simple',
type: 'boolean',
default: true,
@ -91,7 +96,6 @@ export const rowSearchDescription: RowProperties = [
operation: ['search'],
},
},
description:
'Simplified returns only the columns of your base. Non-simplified will return additional columns like _ctime (=creation time), _mtime (=modification time) etc.',
description: 'Whether to return a simplified version of the response instead of the raw data',
},
];

View file

@ -13,7 +13,8 @@ export async function search(
): Promise<INodeExecutionData[]> {
const tableName = this.getNodeParameter('tableName', index) as string;
const searchColumn = this.getNodeParameter('searchColumn', index) as string;
let searchTerm = this.getNodeParameter('searchTerm', index) as any; // string or integer
const searchTerm = this.getNodeParameter('searchTerm', index) as string | number;
let searchTermString = String(searchTerm) as string;
const insensitive = this.getNodeParameter('insensitive', index) as boolean;
const wildcard = this.getNodeParameter('wildcard', index) as boolean;
const simple = this.getNodeParameter('simple', index) as boolean;
@ -25,14 +26,12 @@ export async function search(
let sqlQuery = `SELECT * FROM \`${tableName}\` WHERE \`${searchColumn}\``;
if (insensitive) {
searchTerm = searchTerm.toLowerCase();
searchTermString = searchTermString.toLowerCase();
sqlQuery = `SELECT * FROM \`${tableName}\` WHERE lower(\`${searchColumn}\`)`;
}
if (wildcard && isNaN(searchTerm)) sqlQuery = sqlQuery + ' LIKE "%' + searchTerm + '%"';
else if (!wildcard && isNaN(searchTerm)) sqlQuery = sqlQuery + ' = "' + searchTerm + '"';
else if (wildcard && !isNaN(searchTerm)) sqlQuery = sqlQuery + ' LIKE %' + searchTerm + '%';
else if (!wildcard && !isNaN(searchTerm)) sqlQuery = sqlQuery + ' = ' + searchTerm;
if (wildcard) sqlQuery = sqlQuery + ' LIKE "%' + searchTermString + '%"';
else if (!wildcard) sqlQuery = sqlQuery + ' = "' + searchTermString + '"';
const sqlResult = (await seaTableApiRequest.call(
this,

View file

@ -2,6 +2,7 @@ import type { RowProperties } from '../../Interfaces';
export const rowUnlockDescription: RowProperties = [
{
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Table Name',
name: 'tableName',
type: 'options',
@ -17,13 +18,17 @@ export const rowUnlockDescription: RowProperties = [
},
},
default: '',
// eslint-disable-next-line n8n-nodes-base/node-param-description-wrong-for-dynamic-options
description:
'The name of SeaTable table to access. Choose from the list, or specify a name using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
{
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Row ID',
name: 'rowId',
type: 'options',
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
required: true,
typeOptions: {
loadOptionsDependsOn: ['tableName'],

View file

@ -2,6 +2,7 @@ import type { RowProperties } from '../../Interfaces';
export const rowUpdateDescription: RowProperties = [
{
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Table Name',
name: 'tableName',
type: 'options',
@ -17,13 +18,18 @@ export const rowUpdateDescription: RowProperties = [
},
},
default: '',
// eslint-disable-next-line n8n-nodes-base/node-param-description-wrong-for-dynamic-options
description:
'The name of SeaTable table to access. Choose from the list, or specify a name using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
{
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Row ID',
name: 'rowId',
type: 'options',
// eslint-disable-next-line n8n-nodes-base/node-param-description-wrong-for-dynamic-options
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
required: true,
typeOptions: {
loadOptionsDependsOn: ['tableName'],
@ -93,9 +99,11 @@ export const rowUpdateDescription: RowProperties = [
name: 'columnValues',
values: [
{
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Column Name',
name: 'columnName',
type: 'options',
// eslint-disable-next-line n8n-nodes-base/node-param-description-wrong-for-dynamic-options
description:
'Choose from the list, or specify the column name using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
typeOptions: {
@ -122,7 +130,7 @@ export const rowUpdateDescription: RowProperties = [
},
default: {},
description:
'Add destination column with its value. Provide the value in this way:<br>Date: YYYY-MM-DD or YYYY-MM-DD hh:mm<br>Duration: time in seconds<br>Checkbox: true, on or 1<br>Multi-Select: comma separated list',
'Add destination column with its value. Provide the value in this way:Date: YYYY-MM-DD or YYYY-MM-DD hh:mmDuration: time in secondsCheckbox: true, on or 1Multi-Select: comma-separated list.',
},
{
displayName: 'Hint: Link, files, images or digital signatures have to be added separately.',

View file

@ -110,6 +110,40 @@ export async function getLinkColumns(this: ILoadOptionsFunctions): Promise<INode
return returnData;
}
export async function getLinkColumnsWithColumnKey(
this: ILoadOptionsFunctions,
): Promise<INodePropertyOptions[]> {
const returnData: INodePropertyOptions[] = [];
const table = this.getCurrentNodeParameter('tableName') as string;
const tableName = table.split(':::')[0];
const tableId = table.split(':::')[1];
if (tableName) {
const columns = await seaTableApiRequest.call(
this,
{},
'GET',
'/dtable-server/api/v1/dtables/{{dtable_uuid}}/columns',
{},
{ table_name: tableName },
);
for (const col of columns.columns) {
if (col.type === 'link') {
// make sure that the "other table id" is returned and not the same table id again.
const otid =
tableId !== col.data.other_table_id ? col.data.other_table_id : col.data.table_id;
returnData.push({
name: col.name,
value: col.name + ':::' + col.data.link_id + ':::' + otid + ':::' + col.key,
});
}
}
}
return returnData;
}
export async function getAssetColumns(
this: ILoadOptionsFunctions,
): Promise<INodePropertyOptions[]> {
@ -179,9 +213,14 @@ export async function getTableUpdateAbleColumns(
}
export async function getRowIds(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
const tableName = this.getNodeParameter('tableName') as string;
const returnData: INodePropertyOptions[] = [];
const table = this.getCurrentNodeParameter('tableName') as string;
let tableName = table;
if (table.indexOf(':::') !== -1) {
tableName = table.split(':::')[0];
}
const returnData: INodePropertyOptions[] = [];
if (tableName) {
const sqlResult = await seaTableApiRequest.call(
this,