Files
alighasami 3d5eaf9445
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
first commit
2026-03-17 16:22:57 +03:30

54 lines
1.6 KiB
TypeScript

import type { IExecuteFunctions, IDataObject, INodeExecutionData } from 'n8n-workflow';
import * as asset from './asset';
import * as base from './base';
import type { SeaTable } from './Interfaces';
import * as link from './link';
import * as row from './row';
export async function router(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
const items = this.getInputData();
const operationResult: INodeExecutionData[] = [];
let responseData: IDataObject | IDataObject[] = [];
for (let i = 0; i < items.length; i++) {
const resource = this.getNodeParameter<SeaTable>('resource', i);
const operation = this.getNodeParameter('operation', i);
const seatable = {
resource,
operation,
} as SeaTable;
try {
if (seatable.resource === 'row') {
responseData = await row[seatable.operation].execute.call(this, i);
} else if (seatable.resource === 'base') {
responseData = await base[seatable.operation].execute.call(this, i);
} else if (seatable.resource === 'link') {
responseData = await link[seatable.operation].execute.call(this, i);
} else if (seatable.resource === 'asset') {
responseData = await asset[seatable.operation].execute.call(this, i);
}
const executionData = this.helpers.constructExecutionMetaData(
responseData as INodeExecutionData[],
{
itemData: { item: i },
},
);
operationResult.push(...executionData);
} catch (error) {
if (this.continueOnFail()) {
operationResult.push({ json: this.getInputData(i)[0].json, error });
} else {
if (error.context) error.context.itemIndex = i;
throw error;
}
}
}
return [operationResult];
}