refactor(editor): Add types to importCurlEventBus (no-changelog) (#10497)

This commit is contained in:
Tomi Turtiainen
2024-08-22 09:32:05 +03:00
committed by GitHub
parent 8ab7fea32c
commit b805e8ddb8
2 changed files with 11 additions and 6 deletions

View File

@@ -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 {}
},

View File

@@ -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<ImportCurlEventBusEvents>();