mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
refactor: Format nodes-base package (A-F) (#3800)
* 🔨 prettier formated nodes - A * 🔨 prettier formated nodes - B * ⚡ prettier formated nodes - C * ⚡ prettier formated nodes - D * ⚡ prettier formated nodes - E-F * 🎨 Adjust nodes-base formatting command (#3805) * Format additional files in nodes A-F (#3811) * ⚡ fixes * 🎨 Add Mindee to ignored dirs Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
This commit is contained in:
@@ -1,7 +1,4 @@
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions, ILoadOptionsFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
ICredentialsDecrypted,
|
||||
@@ -39,7 +36,7 @@ export async function emeliaApiRequest(
|
||||
body: object = {},
|
||||
qs: object = {},
|
||||
) {
|
||||
const { apiKey } = await this.getCredentials('emeliaApi') as { apiKey: string };
|
||||
const { apiKey } = (await this.getCredentials('emeliaApi')) as { apiKey: string };
|
||||
|
||||
const options = {
|
||||
headers: {
|
||||
@@ -55,7 +52,7 @@ export async function emeliaApiRequest(
|
||||
try {
|
||||
return await this.helpers.request!.call(this, options);
|
||||
} catch (error) {
|
||||
throw new NodeApiError(this.getNode(), (error as JsonObject));
|
||||
throw new NodeApiError(this.getNode(), error as JsonObject);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +63,7 @@ export async function loadResource(
|
||||
this: ILoadOptionsFunctions,
|
||||
resource: 'campaign' | 'contactList',
|
||||
): Promise<INodePropertyOptions[]> {
|
||||
const mapping: { [key in 'campaign' | 'contactList']: { query: string, key: string } } = {
|
||||
const mapping: { [key in 'campaign' | 'contactList']: { query: string; key: string } } = {
|
||||
campaign: {
|
||||
query: `
|
||||
query GetCampaigns {
|
||||
@@ -91,13 +88,18 @@ export async function loadResource(
|
||||
|
||||
const responseData = await emeliaGraphqlRequest.call(this, { query: mapping[resource].query });
|
||||
|
||||
return responseData.data[mapping[resource].key].map((campaign: { name: string, _id: string }) => ({
|
||||
name: campaign.name,
|
||||
value: campaign._id,
|
||||
}));
|
||||
return responseData.data[mapping[resource].key].map(
|
||||
(campaign: { name: string; _id: string }) => ({
|
||||
name: campaign.name,
|
||||
value: campaign._id,
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
export async function emeliaApiTest(this: ICredentialTestFunctions, credential: ICredentialsDecrypted): Promise<INodeCredentialTestResult> {
|
||||
export async function emeliaApiTest(
|
||||
this: ICredentialTestFunctions,
|
||||
credential: ICredentialsDecrypted,
|
||||
): Promise<INodeCredentialTestResult> {
|
||||
const credentials = credential.data;
|
||||
|
||||
const body = {
|
||||
|
||||
Reference in New Issue
Block a user