mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
33 lines
794 B
TypeScript
33 lines
794 B
TypeScript
import type {
|
|
IDisplayOptions,
|
|
IExecuteFunctions,
|
|
INodeExecutionData,
|
|
INodeProperties,
|
|
} from 'n8n-workflow';
|
|
|
|
import { getAddRow, makeAddRow } from '../../common/addRow';
|
|
import { getDataTableProxyExecute } from '../../common/utils';
|
|
|
|
export const FIELD: string = 'insert';
|
|
|
|
const displayOptions: IDisplayOptions = {
|
|
show: {
|
|
resource: ['row'],
|
|
operation: [FIELD],
|
|
},
|
|
};
|
|
|
|
export const description: INodeProperties[] = [makeAddRow(FIELD, displayOptions)];
|
|
|
|
export async function execute(
|
|
this: IExecuteFunctions,
|
|
index: number,
|
|
): Promise<INodeExecutionData[]> {
|
|
const dataStoreProxy = await getDataTableProxyExecute(this, index);
|
|
|
|
const row = getAddRow(this, index);
|
|
|
|
const insertedRows = await dataStoreProxy.insertRows([row]);
|
|
return insertedRows.map((json) => ({ json }));
|
|
}
|