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
40 lines
1.2 KiB
TypeScript
40 lines
1.2 KiB
TypeScript
import type { ILoadOptionsFunctions, ResourceMapperFields, FieldType } from 'n8n-workflow';
|
|
|
|
import type { OracleDBNodeCredentials } from '../helpers/interfaces';
|
|
import { getColumnMetaData, mapDbType } from '../helpers/utils';
|
|
import { configureOracleDB } from '../transport';
|
|
|
|
export async function getMappingColumns(
|
|
this: ILoadOptionsFunctions,
|
|
): Promise<ResourceMapperFields> {
|
|
const credentials = await this.getCredentials<OracleDBNodeCredentials>('oracleDBApi');
|
|
|
|
const pool = await configureOracleDB.call(this, credentials);
|
|
|
|
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);
|
|
const fields = columns.map((col) => {
|
|
const type = mapDbType(col.dataType).n8nType as FieldType;
|
|
const nullable = col.isNullable;
|
|
const hasDefault = col.columnDefault === 'YES';
|
|
const isGenerated = col.isGenerated === 'ALWAYS';
|
|
|
|
return {
|
|
id: col.columnName,
|
|
displayName: col.columnName,
|
|
required: !nullable && !hasDefault && !isGenerated,
|
|
display: true,
|
|
type,
|
|
defaultMatch: true,
|
|
};
|
|
});
|
|
return { fields };
|
|
}
|