mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
refactor(core): Introduce overload for record-type node parameter (no-changelog) (#4648)
* 📘 Set up overload * 🔥 Remove inferrable record assertions * 👕 Fix semicolon * 👕 Fix another semicolon
This commit is contained in:
@@ -262,7 +262,7 @@ export class Keap implements INodeType {
|
||||
const phones = (this.getNodeParameter('phonesUi', i) as IDataObject)
|
||||
.phonesValues as IDataObject[];
|
||||
const companyName = this.getNodeParameter('companyName', i) as string;
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i);
|
||||
const body: ICompany = {
|
||||
company_name: companyName,
|
||||
};
|
||||
@@ -282,7 +282,7 @@ export class Keap implements INodeType {
|
||||
//https://developer.infusionsoft.com/docs/rest/#!/Company/listCompaniesUsingGET
|
||||
if (operation === 'getAll') {
|
||||
const returnAll = this.getNodeParameter('returnAll', i);
|
||||
const options = this.getNodeParameter('options', i) as IDataObject;
|
||||
const options = this.getNodeParameter('options', i);
|
||||
keysToSnakeCase(options);
|
||||
Object.assign(qs, options);
|
||||
if (qs.fields) {
|
||||
@@ -319,7 +319,7 @@ export class Keap implements INodeType {
|
||||
.socialAccountsValues as IDataObject[];
|
||||
const phones = (this.getNodeParameter('phonesUi', i) as IDataObject)
|
||||
.phonesValues as IDataObject[];
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i);
|
||||
const body: IContact = {
|
||||
duplicate_option: pascalCase(duplicateOption),
|
||||
};
|
||||
@@ -407,7 +407,7 @@ export class Keap implements INodeType {
|
||||
//https://developer.infusionsoft.com/docs/rest/#!/Contact/getContactUsingGET
|
||||
if (operation === 'get') {
|
||||
const contactId = parseInt(this.getNodeParameter('contactId', i) as string, 10);
|
||||
const options = this.getNodeParameter('options', i) as IDataObject;
|
||||
const options = this.getNodeParameter('options', i);
|
||||
if (options.fields) {
|
||||
qs.optional_properties = options.fields as string;
|
||||
}
|
||||
@@ -416,7 +416,7 @@ export class Keap implements INodeType {
|
||||
//https://developer.infusionsoft.com/docs/rest/#!/Contact/listContactsUsingGET
|
||||
if (operation === 'getAll') {
|
||||
const returnAll = this.getNodeParameter('returnAll', i);
|
||||
const options = this.getNodeParameter('options', i) as IDataObject;
|
||||
const options = this.getNodeParameter('options', i);
|
||||
if (options.email) {
|
||||
qs.email = options.email as boolean;
|
||||
}
|
||||
@@ -459,7 +459,7 @@ export class Keap implements INodeType {
|
||||
if (operation === 'create') {
|
||||
const userId = this.getNodeParameter('userId', i) as number;
|
||||
const contactId = parseInt(this.getNodeParameter('contactId', i) as string, 10);
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i);
|
||||
const body: INote = {
|
||||
user_id: userId,
|
||||
contact_id: contactId,
|
||||
@@ -485,7 +485,7 @@ export class Keap implements INodeType {
|
||||
//https://developer.infusionsoft.com/docs/rest/#!/Note/listNotesUsingGET
|
||||
if (operation === 'getAll') {
|
||||
const returnAll = this.getNodeParameter('returnAll', i);
|
||||
const filters = this.getNodeParameter('filters', i) as IDataObject;
|
||||
const filters = this.getNodeParameter('filters', i);
|
||||
keysToSnakeCase(filters);
|
||||
Object.assign(qs, filters);
|
||||
if (returnAll) {
|
||||
@@ -506,7 +506,7 @@ export class Keap implements INodeType {
|
||||
//https://developer.infusionsoft.com/docs/rest/#!/Note/updatePropertiesOnNoteUsingPATCH
|
||||
if (operation === 'update') {
|
||||
const noteId = this.getNodeParameter('noteId', i) as string;
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i);
|
||||
const body: INote = {};
|
||||
keysToSnakeCase(additionalFields);
|
||||
if (additionalFields.type) {
|
||||
@@ -582,7 +582,7 @@ export class Keap implements INodeType {
|
||||
.orderItemsValues as IDataObject[];
|
||||
const shippingAddress = (this.getNodeParameter('addressUi', i) as IDataObject)
|
||||
.addressValues as IDataObject;
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i);
|
||||
const body: IEcommerceOrder = {
|
||||
contact_id: contactId,
|
||||
order_date: orderDate,
|
||||
@@ -616,7 +616,7 @@ export class Keap implements INodeType {
|
||||
//https://developer.infusionsoft.com/docs/rest/#!/E-Commerce/listOrdersUsingGET
|
||||
if (operation === 'getAll') {
|
||||
const returnAll = this.getNodeParameter('returnAll', i);
|
||||
const options = this.getNodeParameter('options', i) as IDataObject;
|
||||
const options = this.getNodeParameter('options', i);
|
||||
keysToSnakeCase(options);
|
||||
Object.assign(qs, options);
|
||||
if (returnAll) {
|
||||
@@ -639,7 +639,7 @@ export class Keap implements INodeType {
|
||||
//https://developer.infusionsoft.com/docs/rest/#!/Product/createProductUsingPOST
|
||||
if (operation === 'create') {
|
||||
const productName = this.getNodeParameter('productName', i) as string;
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i);
|
||||
const body: IEcommerceProduct = {
|
||||
product_name: productName,
|
||||
};
|
||||
@@ -661,7 +661,7 @@ export class Keap implements INodeType {
|
||||
//https://developer.infusionsoft.com/docs/rest/#!/Product/listProductsUsingGET
|
||||
if (operation === 'getAll') {
|
||||
const returnAll = this.getNodeParameter('returnAll', i);
|
||||
const filters = this.getNodeParameter('filters', i) as IDataObject;
|
||||
const filters = this.getNodeParameter('filters', i);
|
||||
keysToSnakeCase(filters);
|
||||
Object.assign(qs, filters);
|
||||
if (returnAll) {
|
||||
@@ -685,7 +685,7 @@ export class Keap implements INodeType {
|
||||
if (operation === 'createRecord') {
|
||||
const sentFromAddress = this.getNodeParameter('sentFromAddress', i) as string;
|
||||
const sendToAddress = this.getNodeParameter('sentToAddress', i) as string;
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i);
|
||||
const body: IDataObject = {
|
||||
sent_to_address: sendToAddress,
|
||||
sent_from_address: sentFromAddress,
|
||||
@@ -703,7 +703,7 @@ export class Keap implements INodeType {
|
||||
//https://developer.infusionsoft.com/docs/rest/#!/Email/listEmailsUsingGET
|
||||
if (operation === 'getAll') {
|
||||
const returnAll = this.getNodeParameter('returnAll', i);
|
||||
const filters = this.getNodeParameter('filters', i) as IDataObject;
|
||||
const filters = this.getNodeParameter('filters', i);
|
||||
keysToSnakeCase(filters);
|
||||
Object.assign(qs, filters);
|
||||
if (returnAll) {
|
||||
@@ -728,7 +728,7 @@ export class Keap implements INodeType {
|
||||
(this.getNodeParameter('contactIds', i) as string).split(',') as string[]
|
||||
).map((e) => parseInt(e, 10));
|
||||
const subject = this.getNodeParameter('subject', i) as string;
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i);
|
||||
const body: IEmail = {
|
||||
user_id: userId,
|
||||
contacts: contactIds,
|
||||
@@ -788,7 +788,7 @@ export class Keap implements INodeType {
|
||||
//https://developer.infusionsoft.com/docs/rest/#!/File/listFilesUsingGET
|
||||
if (operation === 'getAll') {
|
||||
const returnAll = this.getNodeParameter('returnAll', i);
|
||||
const filters = this.getNodeParameter('filters', i) as IDataObject;
|
||||
const filters = this.getNodeParameter('filters', i);
|
||||
keysToSnakeCase(filters);
|
||||
Object.assign(qs, filters);
|
||||
if (qs.permission) {
|
||||
|
||||
Reference in New Issue
Block a user