n8n-nodes-base
Version:
Base nodes of n8n
73 lines • 2.7 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.description = exports.properties = void 0;
exports.execute = execute;
/* 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 */
const n8n_workflow_1 = require("n8n-workflow");
const GenericFunctions_1 = require("../../GenericFunctions");
exports.properties = [
{
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'],
},
};
exports.description = (0, n8n_workflow_1.updateDisplayOptions)(displayOptions, exports.properties);
async function execute(index) {
// get parameters
const tableName = this.getNodeParameter('tableName', index);
const linkColumn = this.getNodeParameter('linkColumn', index);
const rowId = this.getNodeParameter('rowId', index);
// get rows
const responseData = await GenericFunctions_1.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);
}
//# sourceMappingURL=list.operation.js.map