refactor(core): Introduce overload for boolean-type node parameter (no-changelog) (#4647)

* 📘 Set up overloads

* 📘 Add temporary assertion

* 🔥 Remove inferrable boolean assertions

*  Undo autoformatting
This commit is contained in:
Iván Ovejero
2022-11-18 14:31:38 +01:00
committed by GitHub
parent 919cb9180d
commit 6757c9a2ea
163 changed files with 559 additions and 529 deletions

View File

@@ -992,7 +992,7 @@ export class Hubspot implements INodeType {
//https://developers.hubspot.com/docs/methods/companies/create_company
if (operation === 'upsert') {
const email = this.getNodeParameter('email', i) as string;
const resolveData = this.getNodeParameter('resolveData', i) as boolean;
const resolveData = this.getNodeParameter('resolveData', i);
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
const body: IDataObject[] = [];
if (additionalFields.annualRevenue) {
@@ -1339,7 +1339,7 @@ export class Hubspot implements INodeType {
//https://developers.hubspot.com/docs/methods/contacts/get_contacts
if (operation === 'getAll') {
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
const returnAll = this.getNodeParameter('returnAll', 0) as boolean;
const returnAll = this.getNodeParameter('returnAll', 0);
if (additionalFields.formSubmissionMode) {
qs.formSubmissionMode = additionalFields.formSubmissionMode as string;
}
@@ -1371,7 +1371,7 @@ export class Hubspot implements INodeType {
//https://developers.hubspot.com/docs/methods/contacts/get_recently_created_contacts
if (operation === 'getRecentlyCreatedUpdated') {
let endpoint;
const returnAll = this.getNodeParameter('returnAll', 0) as boolean;
const returnAll = this.getNodeParameter('returnAll', 0);
const filters = this.getNodeParameter('filters', i) as IDataObject;
if (filters.formSubmissionMode) {
qs.formSubmissionMode = filters.formSubmissionMode as string;
@@ -1412,7 +1412,7 @@ export class Hubspot implements INodeType {
//https://developers.hubspot.com/docs/api/crm/search
if (operation === 'search') {
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
const returnAll = this.getNodeParameter('returnAll', 0) as boolean;
const returnAll = this.getNodeParameter('returnAll', 0);
const filtersGroupsUi = this.getNodeParameter('filterGroupsUi', i) as IDataObject;
const sortBy = additionalFields.sortBy || 'createdate';
const direction = additionalFields.direction || 'DESCENDING';
@@ -1931,7 +1931,7 @@ export class Hubspot implements INodeType {
//https://developers.hubspot.com/docs/methods/companies/get-all-companies
if (operation === 'getAll') {
const options = this.getNodeParameter('options', i) as IDataObject;
const returnAll = this.getNodeParameter('returnAll', 0) as boolean;
const returnAll = this.getNodeParameter('returnAll', 0);
if (options.includeMergeAudits) {
qs.includeMergeAudits = options.includeMergeAudits as boolean;
}
@@ -1960,7 +1960,7 @@ export class Hubspot implements INodeType {
//https://developers.hubspot.com/docs/methods/companies/get_companies_modified
if (operation === 'getRecentlyCreated' || operation === 'getRecentlyModified') {
let endpoint;
const returnAll = this.getNodeParameter('returnAll', 0) as boolean;
const returnAll = this.getNodeParameter('returnAll', 0);
if (operation === 'getRecentlyCreated') {
endpoint = `/companies/v2/companies/recent/created`;
} else {
@@ -1989,7 +1989,7 @@ export class Hubspot implements INodeType {
if (operation === 'searchByDomain') {
const domain = this.getNodeParameter('domain', i) as string;
const options = this.getNodeParameter('options', i) as IDataObject;
const returnAll = this.getNodeParameter('returnAll', 0) as boolean;
const returnAll = this.getNodeParameter('returnAll', 0);
const body: IDataObject = {
requestOptions: {},
};
@@ -2163,7 +2163,7 @@ export class Hubspot implements INodeType {
}
if (operation === 'getAll') {
const filters = this.getNodeParameter('filters', i) as IDataObject;
const returnAll = this.getNodeParameter('returnAll', 0) as boolean;
const returnAll = this.getNodeParameter('returnAll', 0);
if (filters.includeAssociations) {
qs.includeAssociations = filters.includeAssociations as boolean;
}
@@ -2198,7 +2198,7 @@ export class Hubspot implements INodeType {
if (operation === 'getRecentlyCreated' || operation === 'getRecentlyModified') {
let endpoint;
const filters = this.getNodeParameter('filters', i) as IDataObject;
const returnAll = this.getNodeParameter('returnAll', 0) as boolean;
const returnAll = this.getNodeParameter('returnAll', 0);
if (filters.since) {
qs.since = new Date(filters.since as string).getTime();
}
@@ -2233,7 +2233,7 @@ export class Hubspot implements INodeType {
//https://developers.hubspot.com/docs/api/crm/search
if (operation === 'search') {
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
const returnAll = this.getNodeParameter('returnAll', 0) as boolean;
const returnAll = this.getNodeParameter('returnAll', 0);
const filtersGroupsUi = this.getNodeParameter('filterGroupsUi', i) as IDataObject;
const sortBy = additionalFields.sortBy || 'createdate';
const direction = additionalFields.direction || 'DESCENDING';
@@ -2353,7 +2353,7 @@ export class Hubspot implements INodeType {
}
//https://legacydocs.hubspot.com/docs/methods/engagements/get-all-engagements
if (operation === 'getAll') {
const returnAll = this.getNodeParameter('returnAll', 0) as boolean;
const returnAll = this.getNodeParameter('returnAll', 0);
const endpoint = `/engagements/v1/engagements/paged`;
if (returnAll) {
responseData = await hubspotApiRequestAllItems.call(
@@ -2573,7 +2573,7 @@ export class Hubspot implements INodeType {
//https://developers.hubspot.com/docs/methods/tickets/get-all-tickets
if (operation === 'getAll') {
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
const returnAll = this.getNodeParameter('returnAll', 0) as boolean;
const returnAll = this.getNodeParameter('returnAll', 0);
if (additionalFields.properties) {
qs.properties = additionalFields.properties as string[];
}