diff --git a/packages/nodes-base/credentials/PagerDutyOAuth2Api.credentials.ts b/packages/nodes-base/credentials/PagerDutyOAuth2Api.credentials.ts index d8e29cf2f7..edc5f8245b 100644 --- a/packages/nodes-base/credentials/PagerDutyOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/PagerDutyOAuth2Api.credentials.ts @@ -36,11 +36,11 @@ export class PagerDutyOAuth2Api implements ICredentialType { default: '', }, { - displayName: 'Authentication', - name: 'authentication', - type: 'hidden' as NodePropertyTypes, - default: 'header', - description: 'Method of authentication.', - }, + displayName: 'Authentication', + name: 'authentication', + type: 'hidden' as NodePropertyTypes, + default: 'header', + description: 'Method of authentication.', + }, ]; } diff --git a/packages/nodes-base/credentials/SalesforceOAuth2Api.credentials.ts b/packages/nodes-base/credentials/SalesforceOAuth2Api.credentials.ts index e02489256a..eea91f8078 100644 --- a/packages/nodes-base/credentials/SalesforceOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/SalesforceOAuth2Api.credentials.ts @@ -37,5 +37,12 @@ export class SalesforceOAuth2Api implements ICredentialType { type: 'hidden' as NodePropertyTypes, default: '', }, + { + displayName: 'Authentication', + name: 'authentication', + type: 'hidden' as NodePropertyTypes, + default: 'header', + description: 'Method of authentication.', + }, ]; } diff --git a/packages/nodes-base/nodes/Salesforce/GenericFunctions.ts b/packages/nodes-base/nodes/Salesforce/GenericFunctions.ts index d7bdc7ddb3..3c76dfc03a 100644 --- a/packages/nodes-base/nodes/Salesforce/GenericFunctions.ts +++ b/packages/nodes-base/nodes/Salesforce/GenericFunctions.ts @@ -1,21 +1,25 @@ -import { OptionsWithUri } from 'request'; +import { + OptionsWithUri, + } from 'request'; + import { IExecuteFunctions, IExecuteSingleFunctions, ILoadOptionsFunctions, } from 'n8n-core'; + import { IDataObject } from 'n8n-workflow'; -export async function salesforceApiRequest(this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise { // tslint:disable-line:no-any +export async function salesforceApiRequest(this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, endpoint: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise { // tslint:disable-line:no-any const credentials = this.getCredentials('salesforceOAuth2Api'); const subdomain = ((credentials!.accessTokenUrl as string).match(/https:\/\/(.+).salesforce\.com/) || [])[1]; const options: OptionsWithUri = { method, body: method === "GET" ? undefined : body, qs, - uri: uri || `https://${subdomain}.salesforce.com/services/data/v39.0${resource}`, + uri: `https://${subdomain}.salesforce.com/services/data/v39.0${uri || endpoint}`, json: true }; try { @@ -39,7 +43,7 @@ export async function salesforceApiRequestAllItems(this: IExecuteFunctions | ILo do { responseData = await salesforceApiRequest.call(this, method, endpoint, body, query, uri); - uri = responseData.nextRecordsUrl; + uri = `${endpoint}/${responseData.nextRecordsUrl?.split('/')?.pop()}`; returnData.push.apply(returnData, responseData[propertyName]); } while ( responseData.nextRecordsUrl !== undefined && diff --git a/packages/nodes-base/nodes/Salesforce/Salesforce.node.ts b/packages/nodes-base/nodes/Salesforce/Salesforce.node.ts index 6ccb8676d2..4f6ddecc85 100644 --- a/packages/nodes-base/nodes/Salesforce/Salesforce.node.ts +++ b/packages/nodes-base/nodes/Salesforce/Salesforce.node.ts @@ -15,66 +15,84 @@ import { accountFields, accountOperations, } from './AccountDescription'; + import { IAccount, } from './AccountInterface'; + import { attachmentFields, attachmentOperations, } from './AttachmentDescription'; + import { IAttachment, } from './AttachmentInterface'; + import { ICampaignMember, } from './CampaignMemberInterface'; + import { caseFields, caseOperations, } from './CaseDescription'; + import { ICase, ICaseComment, } from './CaseInterface'; + import { contactFields, contactOperations, } from './ContactDescription'; + import { IContact, } from './ContactInterface'; + import { salesforceApiRequest, salesforceApiRequestAllItems, } from './GenericFunctions'; + import { leadFields, leadOperations, } from './LeadDescription'; + import { ILead, } from './LeadInterface'; + import { INote, } from './NoteInterface'; + import { opportunityFields, opportunityOperations, } from './OpportunityDescription'; + import { IOpportunity, } from './OpportunityInterface'; + import { taskFields, taskOperations, } from './TaskDescription'; + import { ITask, } from './TaskInterface'; + import { userFields, userOperations, } from './UserDescription'; + import { IUser, } from './UserInterface';