n8n-3867-progressively-apply-prettier-to-all (#3873)
* 🔨 formatting nodes with prettier
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
@@ -38,10 +36,7 @@ import {
|
||||
loadWebinarSessions,
|
||||
} from './GenericFunctions';
|
||||
|
||||
import {
|
||||
isEmpty,
|
||||
omit,
|
||||
} from 'lodash';
|
||||
import { isEmpty, omit } from 'lodash';
|
||||
|
||||
import moment from 'moment-timezone';
|
||||
|
||||
@@ -139,10 +134,14 @@ export class GoToWebinar implements INodeType {
|
||||
}
|
||||
return returnData;
|
||||
},
|
||||
async getRegistranSimpleQuestions(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
async getRegistranSimpleQuestions(
|
||||
this: ILoadOptionsFunctions,
|
||||
): Promise<INodePropertyOptions[]> {
|
||||
return await loadRegistranSimpleQuestions.call(this);
|
||||
},
|
||||
async getRegistranMultiChoiceQuestions(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
async getRegistranMultiChoiceQuestions(
|
||||
this: ILoadOptionsFunctions,
|
||||
): Promise<INodePropertyOptions[]> {
|
||||
return await loadRegistranMultiChoiceQuestions.call(this);
|
||||
},
|
||||
},
|
||||
@@ -157,19 +156,16 @@ export class GoToWebinar implements INodeType {
|
||||
let responseData;
|
||||
const returnData: IDataObject[] = [];
|
||||
|
||||
const { oauthTokenData } = await this.getCredentials('goToWebinarOAuth2Api') as {
|
||||
oauthTokenData: { account_key: string, organizer_key: string }
|
||||
const { oauthTokenData } = (await this.getCredentials('goToWebinarOAuth2Api')) as {
|
||||
oauthTokenData: { account_key: string; organizer_key: string };
|
||||
};
|
||||
|
||||
const accountKey = oauthTokenData.account_key;
|
||||
const organizerKey = oauthTokenData.organizer_key;
|
||||
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
|
||||
try {
|
||||
|
||||
if (resource === 'attendee') {
|
||||
|
||||
// *********************************************************************
|
||||
// attendee
|
||||
// *********************************************************************
|
||||
@@ -177,7 +173,6 @@ export class GoToWebinar implements INodeType {
|
||||
// https://developer.goto.com/GoToWebinarV2/#tag/Attendees
|
||||
|
||||
if (operation === 'get') {
|
||||
|
||||
// ----------------------------------
|
||||
// attendee: get
|
||||
// ----------------------------------
|
||||
@@ -188,9 +183,7 @@ export class GoToWebinar implements INodeType {
|
||||
|
||||
const endpoint = `organizers/${organizerKey}/webinars/${webinarKey}/sessions/${sessionKey}/attendees/${registrantKey}`;
|
||||
responseData = await goToWebinarApiRequest.call(this, 'GET', endpoint, {}, {});
|
||||
|
||||
} else if (operation === 'getAll') {
|
||||
|
||||
// ----------------------------------
|
||||
// attendee: getAll
|
||||
// ----------------------------------
|
||||
@@ -200,9 +193,7 @@ export class GoToWebinar implements INodeType {
|
||||
|
||||
const endpoint = `organizers/${organizerKey}/webinars/${webinarKey}/sessions/${sessionKey}/attendees`;
|
||||
responseData = await handleGetAll.call(this, endpoint, {}, {}, resource);
|
||||
|
||||
} else if (operation === 'getDetails') {
|
||||
|
||||
// ----------------------------------
|
||||
// attendee: getDetails
|
||||
// ----------------------------------
|
||||
@@ -214,11 +205,8 @@ export class GoToWebinar implements INodeType {
|
||||
|
||||
const endpoint = `organizers/${organizerKey}/webinars/${webinarKey}/sessions/${sessionKey}/attendees/${registrantKey}/${details}`;
|
||||
responseData = await goToWebinarApiRequest.call(this, 'GET', endpoint, {}, {});
|
||||
|
||||
}
|
||||
|
||||
} else if (resource === 'coorganizer') {
|
||||
|
||||
// *********************************************************************
|
||||
// coorganizer
|
||||
// *********************************************************************
|
||||
@@ -226,7 +214,6 @@ export class GoToWebinar implements INodeType {
|
||||
// https://developer.goto.com/GoToWebinarV2/#tag/Co-organizers
|
||||
|
||||
if (operation === 'create') {
|
||||
|
||||
// ----------------------------------
|
||||
// coorganizer: create
|
||||
// ----------------------------------
|
||||
@@ -248,9 +235,7 @@ export class GoToWebinar implements INodeType {
|
||||
|
||||
const endpoint = `organizers/${organizerKey}/webinars/${webinarKey}/coorganizers`;
|
||||
responseData = await goToWebinarApiRequest.call(this, 'POST', endpoint, {}, [body]);
|
||||
|
||||
} else if (operation === 'delete') {
|
||||
|
||||
// ----------------------------------
|
||||
// coorganizer: delete
|
||||
// ----------------------------------
|
||||
@@ -265,9 +250,7 @@ export class GoToWebinar implements INodeType {
|
||||
const endpoint = `organizers/${organizerKey}/webinars/${webinarKey}/coorganizers/${coorganizerKey}`;
|
||||
responseData = await goToWebinarApiRequest.call(this, 'DELETE', endpoint, qs, {});
|
||||
responseData = { success: true };
|
||||
|
||||
} else if (operation === 'getAll') {
|
||||
|
||||
// ----------------------------------
|
||||
// coorganizer: getAll
|
||||
// ----------------------------------
|
||||
@@ -276,9 +259,7 @@ export class GoToWebinar implements INodeType {
|
||||
|
||||
const endpoint = `organizers/${organizerKey}/webinars/${webinarKey}/coorganizers`;
|
||||
responseData = await handleGetAll.call(this, endpoint, {}, {}, resource);
|
||||
|
||||
} else if (operation === 'reinvite') {
|
||||
|
||||
// ----------------------------------
|
||||
// coorganizer: reinvite
|
||||
// ----------------------------------
|
||||
@@ -294,11 +275,8 @@ export class GoToWebinar implements INodeType {
|
||||
|
||||
responseData = await goToWebinarApiRequest.call(this, 'POST', endpoint, qs, {});
|
||||
responseData = { success: true };
|
||||
|
||||
}
|
||||
|
||||
} else if (resource === 'panelist') {
|
||||
|
||||
// *********************************************************************
|
||||
// panelist
|
||||
// *********************************************************************
|
||||
@@ -306,7 +284,6 @@ export class GoToWebinar implements INodeType {
|
||||
// https://developer.goto.com/GoToWebinarV2/#tag/Panelists
|
||||
|
||||
if (operation === 'create') {
|
||||
|
||||
// ----------------------------------
|
||||
// panelist: create
|
||||
// ----------------------------------
|
||||
@@ -322,9 +299,7 @@ export class GoToWebinar implements INodeType {
|
||||
|
||||
const endpoint = `organizers/${organizerKey}/webinars/${webinarKey}/panelists`;
|
||||
responseData = await goToWebinarApiRequest.call(this, 'POST', endpoint, {}, body);
|
||||
|
||||
} else if (operation === 'delete') {
|
||||
|
||||
// ----------------------------------
|
||||
// panelist: delete
|
||||
// ----------------------------------
|
||||
@@ -335,9 +310,7 @@ export class GoToWebinar implements INodeType {
|
||||
const endpoint = `organizers/${organizerKey}/webinars/${webinarKey}/panelists/${panelistKey}`;
|
||||
responseData = await goToWebinarApiRequest.call(this, 'DELETE', endpoint, {}, {});
|
||||
responseData = { success: true };
|
||||
|
||||
} else if (operation === 'getAll') {
|
||||
|
||||
// ----------------------------------
|
||||
// panelist: getAll
|
||||
// ----------------------------------
|
||||
@@ -346,9 +319,7 @@ export class GoToWebinar implements INodeType {
|
||||
|
||||
const endpoint = `organizers/${organizerKey}/webinars/${webinarKey}/panelists`;
|
||||
responseData = await handleGetAll.call(this, endpoint, {}, {}, resource);
|
||||
|
||||
} else if (operation === 'reinvite') {
|
||||
|
||||
// ----------------------------------
|
||||
// panelist: reinvite
|
||||
// ----------------------------------
|
||||
@@ -359,11 +330,8 @@ export class GoToWebinar implements INodeType {
|
||||
const endpoint = `organizers/${organizerKey}/webinars/${webinarKey}/panelists/${panelistKey}/resendInvitation`;
|
||||
responseData = await goToWebinarApiRequest.call(this, 'POST', endpoint, {}, {});
|
||||
responseData = { success: true };
|
||||
|
||||
}
|
||||
|
||||
} else if (resource === 'registrant') {
|
||||
|
||||
// *********************************************************************
|
||||
// registrant
|
||||
// *********************************************************************
|
||||
@@ -371,7 +339,6 @@ export class GoToWebinar implements INodeType {
|
||||
// https://developer.goto.com/GoToWebinarV2/#tag/Registrants
|
||||
|
||||
if (operation === 'create') {
|
||||
|
||||
// ----------------------------------
|
||||
// registrant: create
|
||||
// ----------------------------------
|
||||
@@ -387,16 +354,12 @@ export class GoToWebinar implements INodeType {
|
||||
} as IDataObject;
|
||||
|
||||
let additionalFields = this.getNodeParameter('additionalFields', i) as Partial<{
|
||||
resendConfirmation: boolean,
|
||||
resendConfirmation: boolean;
|
||||
fullAddress: {
|
||||
details: { [key: string]: string }
|
||||
}
|
||||
simpleResponses: [
|
||||
{ [key: string]: string }
|
||||
],
|
||||
multiChoiceResponses: [
|
||||
{ [key: string]: string }
|
||||
],
|
||||
details: { [key: string]: string };
|
||||
};
|
||||
simpleResponses: [{ [key: string]: string }];
|
||||
multiChoiceResponses: [{ [key: string]: string }];
|
||||
}>;
|
||||
|
||||
if (additionalFields.resendConfirmation) {
|
||||
@@ -425,9 +388,7 @@ export class GoToWebinar implements INodeType {
|
||||
|
||||
const endpoint = `organizers/${organizerKey}/webinars/${webinarKey}/registrants`;
|
||||
responseData = await goToWebinarApiRequest.call(this, 'POST', endpoint, qs, body);
|
||||
|
||||
} else if (operation === 'delete') {
|
||||
|
||||
// ----------------------------------
|
||||
// registrant: delete
|
||||
// ----------------------------------
|
||||
@@ -438,9 +399,7 @@ export class GoToWebinar implements INodeType {
|
||||
const endpoint = `organizers/${organizerKey}/webinars/${webinarKey}/registrants/${registrantKey}`;
|
||||
responseData = await goToWebinarApiRequest.call(this, 'DELETE', endpoint, {}, {});
|
||||
responseData = { success: true };
|
||||
|
||||
} else if (operation === 'get') {
|
||||
|
||||
// ----------------------------------
|
||||
// registrant: get
|
||||
// ----------------------------------
|
||||
@@ -450,9 +409,7 @@ export class GoToWebinar implements INodeType {
|
||||
|
||||
const endpoint = `organizers/${organizerKey}/webinars/${webinarKey}/registrants/${registrantKey}`;
|
||||
responseData = await goToWebinarApiRequest.call(this, 'GET', endpoint, {}, {});
|
||||
|
||||
} else if (operation === 'getAll') {
|
||||
|
||||
// ----------------------------------
|
||||
// registrant: getAll
|
||||
// ----------------------------------
|
||||
@@ -462,9 +419,7 @@ export class GoToWebinar implements INodeType {
|
||||
const endpoint = `organizers/${organizerKey}/webinars/${webinarKey}/registrants`;
|
||||
responseData = await handleGetAll.call(this, endpoint, {}, {}, resource);
|
||||
}
|
||||
|
||||
} else if (resource === 'session') {
|
||||
|
||||
// *********************************************************************
|
||||
// session
|
||||
// *********************************************************************
|
||||
@@ -472,7 +427,6 @@ export class GoToWebinar implements INodeType {
|
||||
// https://developer.goto.com/GoToWebinarV2/#tag/Sessions
|
||||
|
||||
if (operation === 'get') {
|
||||
|
||||
// ----------------------------------
|
||||
// session: get
|
||||
// ----------------------------------
|
||||
@@ -482,9 +436,7 @@ export class GoToWebinar implements INodeType {
|
||||
|
||||
const endpoint = `organizers/${organizerKey}/webinars/${webinarKey}/sessions/${sessionKey}`;
|
||||
responseData = await goToWebinarApiRequest.call(this, 'GET', endpoint, {}, {});
|
||||
|
||||
} else if (operation === 'getAll') {
|
||||
|
||||
// ----------------------------------
|
||||
// session: getAll
|
||||
// ----------------------------------
|
||||
@@ -497,15 +449,12 @@ export class GoToWebinar implements INodeType {
|
||||
qs.limit = this.getNodeParameter('limit', 0) as number;
|
||||
}
|
||||
|
||||
const {
|
||||
webinarKey,
|
||||
times,
|
||||
} = this.getNodeParameter('additionalFields', i) as {
|
||||
filterByWebinar: boolean,
|
||||
webinarKey: string,
|
||||
const { webinarKey, times } = this.getNodeParameter('additionalFields', i) as {
|
||||
filterByWebinar: boolean;
|
||||
webinarKey: string;
|
||||
times: {
|
||||
timesProperties: { [key: string]: string }
|
||||
}
|
||||
timesProperties: { [key: string]: string };
|
||||
};
|
||||
};
|
||||
|
||||
if (times) {
|
||||
@@ -517,18 +466,27 @@ export class GoToWebinar implements INodeType {
|
||||
}
|
||||
|
||||
if (webinarKey !== undefined) {
|
||||
|
||||
const endpoint = `organizers/${organizerKey}/webinars/${webinarKey}/sessions`;
|
||||
responseData = await goToWebinarApiRequestAllItems.call(this, 'GET', endpoint, qs, {}, resource);
|
||||
|
||||
responseData = await goToWebinarApiRequestAllItems.call(
|
||||
this,
|
||||
'GET',
|
||||
endpoint,
|
||||
qs,
|
||||
{},
|
||||
resource,
|
||||
);
|
||||
} else {
|
||||
|
||||
const endpoint = `organizers/${organizerKey}/sessions`;
|
||||
responseData = await goToWebinarApiRequestAllItems.call(this, 'GET', endpoint, qs, {}, resource);
|
||||
responseData = await goToWebinarApiRequestAllItems.call(
|
||||
this,
|
||||
'GET',
|
||||
endpoint,
|
||||
qs,
|
||||
{},
|
||||
resource,
|
||||
);
|
||||
}
|
||||
|
||||
} else if (operation === 'getDetails') {
|
||||
|
||||
// ----------------------------------
|
||||
// session: getDetails
|
||||
// ----------------------------------
|
||||
@@ -539,11 +497,8 @@ export class GoToWebinar implements INodeType {
|
||||
|
||||
const endpoint = `organizers/${organizerKey}/webinars/${webinarKey}/sessions/${sessionKey}/${details}`;
|
||||
responseData = await goToWebinarApiRequest.call(this, 'GET', endpoint, {}, {});
|
||||
|
||||
}
|
||||
|
||||
} else if (resource === 'webinar') {
|
||||
|
||||
// *********************************************************************
|
||||
// webinar
|
||||
// *********************************************************************
|
||||
@@ -551,12 +506,15 @@ export class GoToWebinar implements INodeType {
|
||||
// https://developer.goto.com/GoToWebinarV2/#tag/Webinars
|
||||
|
||||
if (operation === 'create') {
|
||||
|
||||
// ----------------------------------
|
||||
// webinar: create
|
||||
// ----------------------------------
|
||||
|
||||
const timesProperties = this.getNodeParameter('times.timesProperties', i, []) as IDataObject;
|
||||
const timesProperties = this.getNodeParameter(
|
||||
'times.timesProperties',
|
||||
i,
|
||||
[],
|
||||
) as IDataObject;
|
||||
|
||||
const body = {
|
||||
subject: this.getNodeParameter('subject', i) as string,
|
||||
@@ -568,16 +526,17 @@ export class GoToWebinar implements INodeType {
|
||||
|
||||
const endpoint = `organizers/${organizerKey}/webinars`;
|
||||
responseData = await goToWebinarApiRequest.call(this, 'POST', endpoint, {}, body);
|
||||
|
||||
} else if (operation === 'delete') {
|
||||
|
||||
// ----------------------------------
|
||||
// webinar: delete
|
||||
// ----------------------------------
|
||||
|
||||
const webinarKey = this.getNodeParameter('webinarKey', i) as string;
|
||||
|
||||
const { sendCancellationEmails } = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||
const { sendCancellationEmails } = this.getNodeParameter(
|
||||
'additionalFields',
|
||||
i,
|
||||
) as IDataObject;
|
||||
|
||||
const qs = {} as IDataObject;
|
||||
|
||||
@@ -588,9 +547,7 @@ export class GoToWebinar implements INodeType {
|
||||
const endpoint = `organizers/${organizerKey}/webinars/${webinarKey}`;
|
||||
await goToWebinarApiRequest.call(this, 'DELETE', endpoint, qs, {});
|
||||
responseData = { success: true };
|
||||
|
||||
} else if (operation === 'get') {
|
||||
|
||||
// ----------------------------------
|
||||
// webinar: get
|
||||
// ----------------------------------
|
||||
@@ -599,9 +556,7 @@ export class GoToWebinar implements INodeType {
|
||||
|
||||
const endpoint = `organizers/${organizerKey}/webinars/${webinarKey}`;
|
||||
responseData = await goToWebinarApiRequest.call(this, 'GET', endpoint, {}, {});
|
||||
|
||||
} else if (operation === 'getAll') {
|
||||
|
||||
// ----------------------------------
|
||||
// webinar: getAll
|
||||
// ----------------------------------
|
||||
@@ -616,8 +571,8 @@ export class GoToWebinar implements INodeType {
|
||||
|
||||
const { times } = this.getNodeParameter('additionalFields', i) as {
|
||||
times: {
|
||||
timesProperties: { [key: string]: string }
|
||||
}
|
||||
timesProperties: { [key: string]: string };
|
||||
};
|
||||
};
|
||||
|
||||
if (times) {
|
||||
@@ -629,10 +584,15 @@ export class GoToWebinar implements INodeType {
|
||||
}
|
||||
|
||||
const endpoint = `accounts/${accountKey}/webinars`;
|
||||
responseData = await goToWebinarApiRequestAllItems.call(this, 'GET', endpoint, qs, {}, resource);
|
||||
|
||||
responseData = await goToWebinarApiRequestAllItems.call(
|
||||
this,
|
||||
'GET',
|
||||
endpoint,
|
||||
qs,
|
||||
{},
|
||||
resource,
|
||||
);
|
||||
} else if (operation === 'update') {
|
||||
|
||||
// ----------------------------------
|
||||
// webinar: update
|
||||
// ----------------------------------
|
||||
@@ -649,7 +609,7 @@ export class GoToWebinar implements INodeType {
|
||||
|
||||
if (updateFields.times) {
|
||||
const { times } = updateFields as {
|
||||
times: { timesProperties: Array<{ startTime: string, endTime: string }> }
|
||||
times: { timesProperties: Array<{ startTime: string; endTime: string }> };
|
||||
};
|
||||
|
||||
body = {
|
||||
@@ -662,7 +622,11 @@ export class GoToWebinar implements INodeType {
|
||||
Object.assign(body, updateFields);
|
||||
|
||||
if (isEmpty(updateFields)) {
|
||||
throw new NodeOperationError(this.getNode(), `Please enter at least one field to update for the ${resource}.`, { itemIndex: i });
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
`Please enter at least one field to update for the ${resource}.`,
|
||||
{ itemIndex: i },
|
||||
);
|
||||
}
|
||||
|
||||
const endpoint = `organizers/${organizerKey}/webinars/${webinarKey}`;
|
||||
@@ -670,7 +634,6 @@ export class GoToWebinar implements INodeType {
|
||||
responseData = { success: true };
|
||||
}
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
|
||||
Reference in New Issue
Block a user