mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
31 lines
770 B
TypeScript
31 lines
770 B
TypeScript
import type {
|
|
FieldValueOption,
|
|
ILocalLoadOptionsFunctions,
|
|
ResourceMapperField,
|
|
ResourceMapperFields,
|
|
} from 'n8n-workflow';
|
|
|
|
export async function getWorkflowInputs(
|
|
this: ILocalLoadOptionsFunctions,
|
|
): Promise<ResourceMapperFields> {
|
|
const workflowInputFields = (await this.getWorkflowInputValues()) as FieldValueOption[];
|
|
|
|
const fields: ResourceMapperField[] = workflowInputFields.map((currentWorkflowInput) => {
|
|
const field: ResourceMapperField = {
|
|
id: currentWorkflowInput.name,
|
|
displayName: currentWorkflowInput.name,
|
|
required: false,
|
|
defaultMatch: true,
|
|
display: true,
|
|
canBeUsedToMatch: true,
|
|
};
|
|
|
|
if (currentWorkflowInput.type !== 'any') {
|
|
field.type = currentWorkflowInput.type;
|
|
}
|
|
|
|
return field;
|
|
});
|
|
return { fields };
|
|
}
|