first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
import {
|
||||
type IDataObject,
|
||||
type INodeExecutionData,
|
||||
type INodeProperties,
|
||||
type IExecuteFunctions,
|
||||
updateDisplayOptions,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { seaTableApiRequest } from '../../GenericFunctions';
|
||||
|
||||
export const properties: INodeProperties[] = [
|
||||
{
|
||||
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
|
||||
displayName: 'Table Name (Source)',
|
||||
name: 'tableName',
|
||||
type: 'options',
|
||||
placeholder: 'Name of table',
|
||||
required: true,
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getTableNameAndId',
|
||||
},
|
||||
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',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['tableName'],
|
||||
loadOptionsMethod: 'getLinkColumns',
|
||||
},
|
||||
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".',
|
||||
},
|
||||
{
|
||||
displayName: 'Row ID From the Source Table',
|
||||
name: 'linkColumnSourceId',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
description: 'Provide the row ID of table you selected',
|
||||
},
|
||||
{
|
||||
displayName: 'Row ID From the Target',
|
||||
name: 'linkColumnTargetId',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
description: 'Provide the row ID of table you want to link',
|
||||
},
|
||||
];
|
||||
|
||||
const displayOptions = {
|
||||
show: {
|
||||
resource: ['link'],
|
||||
operation: ['add'],
|
||||
},
|
||||
};
|
||||
|
||||
export const description = updateDisplayOptions(displayOptions, properties);
|
||||
|
||||
export async function execute(
|
||||
this: IExecuteFunctions,
|
||||
index: number,
|
||||
): Promise<INodeExecutionData[]> {
|
||||
const tableName = this.getNodeParameter('tableName', index) as string;
|
||||
const linkColumn = this.getNodeParameter('linkColumn', index) as any;
|
||||
const linkColumnSourceId = this.getNodeParameter('linkColumnSourceId', index) as string;
|
||||
const linkColumnTargetId = this.getNodeParameter('linkColumnTargetId', index) as string;
|
||||
|
||||
const body = {
|
||||
link_id: linkColumn.split(':::')[1],
|
||||
table_id: tableName.split(':::')[1],
|
||||
other_table_id: linkColumn.split(':::')[2],
|
||||
other_rows_ids_map: {
|
||||
[linkColumnSourceId]: [linkColumnTargetId],
|
||||
},
|
||||
};
|
||||
|
||||
const responseData = await seaTableApiRequest.call(
|
||||
this,
|
||||
{},
|
||||
'POST',
|
||||
'/api-gateway/api/v2/dtables/{{dtable_uuid}}/links/',
|
||||
body,
|
||||
);
|
||||
|
||||
return this.helpers.returnJsonArray(responseData as IDataObject[]);
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import * as add from './add.operation';
|
||||
import * as list from './list.operation';
|
||||
import * as remove from './remove.operation';
|
||||
|
||||
export { add, list, remove };
|
||||
|
||||
export const descriptions: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['link'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Add',
|
||||
value: 'add',
|
||||
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',
|
||||
description: 'Remove a link between two rows from a link column',
|
||||
action: 'Remove a row link',
|
||||
},
|
||||
],
|
||||
default: 'add',
|
||||
},
|
||||
...add.description,
|
||||
...list.description,
|
||||
...remove.description,
|
||||
];
|
||||
@@ -0,0 +1,92 @@
|
||||
/* eslint-disable n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options */
|
||||
/* eslint-disable n8n-nodes-base/node-param-description-wrong-for-dynamic-options */
|
||||
import {
|
||||
type IDataObject,
|
||||
type INodeExecutionData,
|
||||
type INodeProperties,
|
||||
type IExecuteFunctions,
|
||||
updateDisplayOptions,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { seaTableApiRequest } from '../../GenericFunctions';
|
||||
|
||||
export const properties: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Table Name',
|
||||
name: 'tableName',
|
||||
type: 'options',
|
||||
placeholder: 'Select a table',
|
||||
required: true,
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getTableNameAndId',
|
||||
},
|
||||
default: '',
|
||||
description:
|
||||
'Choose from the list, of specify by using an expression. Provide it in the way "table_name:::table_id".',
|
||||
},
|
||||
{
|
||||
displayName: 'Link Column',
|
||||
name: 'linkColumn',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['tableName'],
|
||||
loadOptionsMethod: 'getLinkColumnsWithColumnKey',
|
||||
},
|
||||
required: true,
|
||||
default: '',
|
||||
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".',
|
||||
},
|
||||
{
|
||||
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/expressions/">expression</a>',
|
||||
required: true,
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['tableName'],
|
||||
loadOptionsMethod: 'getRowIds',
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
];
|
||||
|
||||
const displayOptions = {
|
||||
show: {
|
||||
resource: ['link'],
|
||||
operation: ['list'],
|
||||
},
|
||||
};
|
||||
|
||||
export const description = updateDisplayOptions(displayOptions, properties);
|
||||
|
||||
export async function execute(
|
||||
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
|
||||
const responseData = await seaTableApiRequest.call(
|
||||
this,
|
||||
{},
|
||||
'POST',
|
||||
'/api-gateway/api/v2/dtables/{{dtable_uuid}}/query-links/',
|
||||
{
|
||||
table_id: tableName.split(':::')[1],
|
||||
link_column_key: linkColumn.split(':::')[3],
|
||||
rows: [
|
||||
{
|
||||
row_id: rowId,
|
||||
offset: 0,
|
||||
limit: 100,
|
||||
},
|
||||
],
|
||||
},
|
||||
);
|
||||
return this.helpers.returnJsonArray(responseData as IDataObject[]);
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
/* eslint-disable n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options */
|
||||
/* eslint-disable n8n-nodes-base/node-param-description-wrong-for-dynamic-options */
|
||||
import {
|
||||
type IDataObject,
|
||||
type INodeExecutionData,
|
||||
type INodeProperties,
|
||||
type IExecuteFunctions,
|
||||
updateDisplayOptions,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { seaTableApiRequest } from '../../GenericFunctions';
|
||||
|
||||
export const properties: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Table Name (Source)',
|
||||
name: 'tableName',
|
||||
type: 'options',
|
||||
placeholder: 'Name of table',
|
||||
required: true,
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getTableNameAndId',
|
||||
},
|
||||
default: '',
|
||||
description:
|
||||
'Choose from the list, of specify by using an expression. Provide it in the way "table_name:::table_id".',
|
||||
},
|
||||
{
|
||||
displayName: 'Link Column',
|
||||
name: 'linkColumn',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['tableName'],
|
||||
loadOptionsMethod: 'getLinkColumns',
|
||||
},
|
||||
required: true,
|
||||
default: '',
|
||||
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',
|
||||
name: 'linkColumnSourceId',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
description: 'Provide the row ID of table you selected',
|
||||
},
|
||||
{
|
||||
displayName: 'Row ID From the Target Table',
|
||||
name: 'linkColumnTargetId',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
description: 'Provide the row ID of table you want to link',
|
||||
},
|
||||
];
|
||||
|
||||
const displayOptions = {
|
||||
show: {
|
||||
resource: ['link'],
|
||||
operation: ['remove'],
|
||||
},
|
||||
};
|
||||
|
||||
export const description = updateDisplayOptions(displayOptions, properties);
|
||||
|
||||
export async function execute(
|
||||
this: IExecuteFunctions,
|
||||
index: number,
|
||||
): Promise<INodeExecutionData[]> {
|
||||
const tableName = this.getNodeParameter('tableName', index) as string;
|
||||
const linkColumn = this.getNodeParameter('linkColumn', index) as any;
|
||||
const linkColumnSourceId = this.getNodeParameter('linkColumnSourceId', index) as string;
|
||||
const linkColumnTargetId = this.getNodeParameter('linkColumnTargetId', index) as string;
|
||||
|
||||
const body = {
|
||||
link_id: linkColumn.split(':::')[1],
|
||||
table_id: tableName.split(':::')[1],
|
||||
other_table_id: linkColumn.split(':::')[2],
|
||||
other_rows_ids_map: {
|
||||
[linkColumnSourceId]: [linkColumnTargetId],
|
||||
},
|
||||
};
|
||||
|
||||
const responseData = await seaTableApiRequest.call(
|
||||
this,
|
||||
{},
|
||||
'DELETE',
|
||||
'/api-gateway/api/v2/dtables/{{dtable_uuid}}/links/',
|
||||
body,
|
||||
);
|
||||
|
||||
return this.helpers.returnJsonArray(responseData as IDataObject[]);
|
||||
}
|
||||
Reference in New Issue
Block a user