mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
refactor(core): Standardize filename casing for environments and eventbus (no-changelog) (#10527)
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
import { AbstractEventMessage, isEventMessageOptionsWithType } from './abstract-event-message';
|
||||
import type { EventNamesAiNodesType, JsonObject } from 'n8n-workflow';
|
||||
import { EventMessageTypeNames } from 'n8n-workflow';
|
||||
import type { AbstractEventMessageOptions } from './abstract-event-message-options';
|
||||
import type { AbstractEventPayload } from './abstract-event-payload';
|
||||
|
||||
// --------------------------------------
|
||||
// EventMessage class for Node events
|
||||
// --------------------------------------
|
||||
export interface EventPayloadAiNode extends AbstractEventPayload {
|
||||
msg?: string;
|
||||
executionId: string;
|
||||
nodeName: string;
|
||||
workflowId?: string;
|
||||
workflowName: string;
|
||||
nodeType?: string;
|
||||
}
|
||||
|
||||
export interface EventMessageAiNodeOptions extends AbstractEventMessageOptions {
|
||||
eventName: EventNamesAiNodesType;
|
||||
|
||||
payload?: EventPayloadAiNode | undefined;
|
||||
}
|
||||
|
||||
export class EventMessageAiNode extends AbstractEventMessage {
|
||||
readonly __type = EventMessageTypeNames.aiNode;
|
||||
|
||||
eventName: EventNamesAiNodesType;
|
||||
|
||||
payload: EventPayloadAiNode;
|
||||
|
||||
constructor(options: EventMessageAiNodeOptions) {
|
||||
super(options);
|
||||
if (options.payload) this.setPayload(options.payload);
|
||||
if (options.anonymize) {
|
||||
this.anonymize();
|
||||
}
|
||||
}
|
||||
|
||||
setPayload(payload: EventPayloadAiNode): this {
|
||||
this.payload = payload;
|
||||
return this;
|
||||
}
|
||||
|
||||
deserialize(data: JsonObject): this {
|
||||
if (isEventMessageOptionsWithType(data, this.__type)) {
|
||||
this.setOptionsOrDefault(data);
|
||||
if (data.payload) this.setPayload(data.payload as EventPayloadAiNode);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user