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
38 lines
1.3 KiB
TypeScript
38 lines
1.3 KiB
TypeScript
import type { ILoadOptionsFunctions, INodePropertyOptions } from 'n8n-workflow';
|
|
import type * as oracleDBTypes from 'oracledb';
|
|
|
|
import type { OracleDBNodeCredentials } from '../helpers/interfaces';
|
|
import { getColumnMetaData } from '../helpers/utils';
|
|
import { configureOracleDB } from '../transport';
|
|
|
|
export async function getColumns(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
|
const credentials = await this.getCredentials<OracleDBNodeCredentials>('oracleDBApi');
|
|
const options = { nodeVersion: this.getNode().typeVersion };
|
|
|
|
const pool: oracleDBTypes.Pool = await configureOracleDB.call(this, credentials, options);
|
|
|
|
const schema = this.getNodeParameter('schema', 0, {
|
|
extractValue: true,
|
|
}) as string;
|
|
|
|
const table = this.getNodeParameter('table', 0, {
|
|
extractValue: true,
|
|
}) as string;
|
|
|
|
const columns = await getColumnMetaData(this.getNode(), pool, schema, table);
|
|
|
|
return columns.map((column) => ({
|
|
name: column.columnName,
|
|
value: column.columnName,
|
|
description: `Type: ${column.dataType.toUpperCase()}, Nullable: ${column.isNullable}`,
|
|
}));
|
|
}
|
|
|
|
export async function getColumnsMultiOptions(
|
|
this: ILoadOptionsFunctions,
|
|
): Promise<INodePropertyOptions[]> {
|
|
const returnData = await getColumns.call(this);
|
|
const returnAll = { name: '*', value: '*', description: 'All columns' };
|
|
return [returnAll, ...returnData];
|
|
}
|