refactor: Fix type issues for parameter input components (#9449)

This commit is contained in:
Elias Meire
2024-05-21 15:04:20 +02:00
committed by GitHub
parent cd751e7cc8
commit 711c46f205
36 changed files with 315 additions and 243 deletions

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import type { IUpdateInformation, ResourceMapperReqParams } from '@/Interface';
import type { IUpdateInformation, DynamicNodeParameters } from '@/Interface';
import { resolveRequiredParameters } from '@/composables/useWorkflowHelpers';
import { useNodeTypesStore } from '@/stores/nodeTypes.store';
import type {
@@ -37,6 +37,7 @@ const workflowsStore = useWorkflowsStore();
const props = withDefaults(defineProps<Props>(), {
teleported: true,
dependentParametersValues: null,
});
const emit = defineEmits<{
@@ -235,7 +236,13 @@ async function loadFieldsToMap(): Promise<void> {
if (!props.node) {
return;
}
const requestParams: ResourceMapperReqParams = {
const methodName = props.parameter.typeOptions?.resourceMapper?.resourceMapperMethod;
if (typeof methodName !== 'string') {
return;
}
const requestParams: DynamicNodeParameters.ResourceMapperFieldsRequest = {
nodeTypeAndVersion: {
name: props.node?.type,
version: props.node.typeVersion,
@@ -245,7 +252,7 @@ async function loadFieldsToMap(): Promise<void> {
props.node.parameters,
) as INodeParameters,
path: props.path,
methodName: props.parameter.typeOptions?.resourceMapper?.resourceMapperMethod,
methodName,
credentials: props.node.credentials,
};
const fetchedFields = await nodeTypesStore.getResourceMapperFields(requestParams);
@@ -310,7 +317,7 @@ function setDefaultFieldValues(forceMatchingFieldsUpdate = false): void {
function updateNodeIssues(): void {
if (props.node) {
const parameterIssues = NodeHelpers.getNodeParametersIssues(
nodeType.value?.properties || [],
nodeType.value?.properties ?? [],
props.node,
);
if (parameterIssues) {
@@ -319,10 +326,10 @@ function updateNodeIssues(): void {
}
}
function onMatchingColumnsChanged(matchingColumns: string[]): void {
function onMatchingColumnsChanged(columns: string[]): void {
state.paramValue = {
...state.paramValue,
matchingColumns,
matchingColumns: columns,
};
// Set all matching fields to be visible
state.paramValue.schema.forEach((field) => {