From b805e8ddb896cfa37240100e2aaa26e244457053 Mon Sep 17 00:00:00 2001 From: Tomi Turtiainen <10324676+tomi@users.noreply.github.com> Date: Thu, 22 Aug 2024 09:32:05 +0300 Subject: [PATCH] refactor(editor): Add types to importCurlEventBus (no-changelog) (#10497) --- packages/editor-ui/src/components/NodeSettings.vue | 9 ++++----- packages/editor-ui/src/event-bus/import-curl.ts | 8 +++++++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/packages/editor-ui/src/components/NodeSettings.vue b/packages/editor-ui/src/components/NodeSettings.vue index fd2f5b4e3..d9b8a734c 100644 --- a/packages/editor-ui/src/components/NodeSettings.vue +++ b/packages/editor-ui/src/components/NodeSettings.vue @@ -189,7 +189,6 @@ import type { INodeProperties, NodeParameterValue, ConnectionTypes, - NodeParameterValueType, } from 'n8n-workflow'; import { NodeHelpers, @@ -201,6 +200,7 @@ import { displayParameter, } from 'n8n-workflow'; import type { + CurlToJSONResponse, INodeUi, INodeUpdatePropertiesInformation, IUpdateInformation, @@ -235,9 +235,8 @@ import { useCredentialsStore } from '@/stores/credentials.store'; import type { EventBus } from 'n8n-design-system'; import { useExternalHooks } from '@/composables/useExternalHooks'; import { useNodeHelpers } from '@/composables/useNodeHelpers'; -import { importCurlEventBus } from '@/event-bus'; +import { importCurlEventBus, ndvEventBus } from '@/event-bus'; import { useToast } from '@/composables/useToast'; -import { ndvEventBus } from '@/event-bus'; export default defineComponent({ name: 'NodeSettings', @@ -489,12 +488,12 @@ export default defineComponent({ ndvEventBus.off('updateParameterValue', this.valueChanged); }, methods: { - setHttpNodeParameters(parameters: NodeParameterValueType) { + setHttpNodeParameters(parameters: CurlToJSONResponse) { try { this.valueChanged({ node: this.node?.name, name: 'parameters', - value: parameters, + value: parameters as unknown as INodeParameters, }); } catch {} }, diff --git a/packages/editor-ui/src/event-bus/import-curl.ts b/packages/editor-ui/src/event-bus/import-curl.ts index 7a517bf3f..3ff4df697 100644 --- a/packages/editor-ui/src/event-bus/import-curl.ts +++ b/packages/editor-ui/src/event-bus/import-curl.ts @@ -1,3 +1,9 @@ +import type { CurlToJSONResponse } from '@/Interface'; import { createEventBus } from 'n8n-design-system/utils'; -export const importCurlEventBus = createEventBus(); +export interface ImportCurlEventBusEvents { + /** Command to set the HTTP node parameters based on the curl to JSON response */ + setHttpNodeParameters: CurlToJSONResponse; +} + +export const importCurlEventBus = createEventBus();