fix(Freshdesk Node): Fix types issue (#14730)

This commit is contained in:
Michael Kret
2025-04-18 11:38:39 +03:00
committed by GitHub
parent 09806c36ae
commit 38eaef97fe

View File

@@ -18,25 +18,21 @@ import {
// validateJSON, // validateJSON,
} from './GenericFunctions'; } from './GenericFunctions';
const Statuses = { const Status = {
Open: 2, Open: 2,
Pending: 3, Pending: 3,
Resolved: 4, Resolved: 4,
Closed: 5, Closed: 5,
} as const; } as const;
type Status = (typeof Statuses)[keyof typeof Statuses]; const Priority = {
const Priorities = {
Low: 1, Low: 1,
Medium: 2, Medium: 2,
High: 3, High: 3,
Urgent: 4, Urgent: 4,
} as const; } as const;
type Priority = (typeof Priorities)[keyof typeof Priorities]; const Source = {
const Sources = {
Email: 1, Email: 1,
Portal: 2, Portal: 2,
Phone: 3, Phone: 3,
@@ -46,7 +42,13 @@ const Sources = {
OutboundEmail: 10, OutboundEmail: 10,
} as const; } as const;
type Source = (typeof Sources)[keyof typeof Sources]; type StatusKey = keyof typeof Status;
type PriorityKey = keyof typeof Priority;
type SourceKey = keyof typeof Source;
type StatusValue = (typeof Status)[keyof typeof Status];
type PriorityValue = (typeof Priority)[keyof typeof Priority];
type SourceValue = (typeof Source)[keyof typeof Source];
interface ICreateTicketBody { interface ICreateTicketBody {
name?: string; name?: string;
@@ -58,8 +60,8 @@ interface ICreateTicketBody {
unique_external_id?: string; unique_external_id?: string;
subject?: string | null; subject?: string | null;
type?: string; type?: string;
status?: Status; status?: StatusValue;
priority?: Priority; priority?: PriorityValue;
description?: string; description?: string;
responder_id?: number; responder_id?: number;
cc_emails?: [string]; cc_emails?: [string];
@@ -69,7 +71,7 @@ interface ICreateTicketBody {
fr_due_by?: string; fr_due_by?: string;
group_id?: number; group_id?: number;
product_id?: number; product_id?: number;
source?: Source; source?: SourceValue;
tags?: [string]; tags?: [string];
company_id?: number; company_id?: number;
} }
@@ -1114,12 +1116,9 @@ export class Freshdesk implements INodeType {
const options = this.getNodeParameter('options', i); const options = this.getNodeParameter('options', i);
//const jsonActive = this.getNodeParameter('jsonParameters') as boolean; //const jsonActive = this.getNodeParameter('jsonParameters') as boolean;
const body: ICreateTicketBody = { const body: ICreateTicketBody = {
// @ts-ignore status: Status[capitalize(status) as StatusKey],
status: Status[capitalize(status)], priority: Priority[capitalize(priority) as PriorityKey],
// @ts-ignore source: Source[capitalize(source) as SourceKey],
priority: Priority[capitalize(priority)],
// @ts-ignore
source: Source[capitalize(source)],
}; };
if (requester === 'requesterId') { if (requester === 'requesterId') {