mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
fix(Mailjet Trigger Node): Fix issue that node could not get activated (#3281)
* 🔨 fix and clean up * ⚡ Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
This commit is contained in:
@@ -3,12 +3,8 @@ import {
|
||||
} from 'n8n-core';
|
||||
|
||||
import {
|
||||
ICredentialDataDecryptedObject,
|
||||
ICredentialsDecrypted,
|
||||
ICredentialTestFunctions,
|
||||
IDataObject,
|
||||
ILoadOptionsFunctions,
|
||||
INodeCredentialTestResult,
|
||||
INodeExecutionData,
|
||||
INodePropertyOptions,
|
||||
INodeType,
|
||||
@@ -20,7 +16,6 @@ import {
|
||||
import {
|
||||
IMessage,
|
||||
mailjetApiRequest,
|
||||
validateCredentials,
|
||||
validateJSON,
|
||||
} from './GenericFunctions';
|
||||
|
||||
@@ -51,7 +46,6 @@ export class Mailjet implements INodeType {
|
||||
{
|
||||
name: 'mailjetEmailApi',
|
||||
required: true,
|
||||
testedBy: 'mailjetEmailApiTest',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
@@ -77,6 +71,7 @@ export class Mailjet implements INodeType {
|
||||
displayName: 'Resource',
|
||||
name: 'resource',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
options: [
|
||||
{
|
||||
name: 'Email',
|
||||
@@ -88,7 +83,7 @@ export class Mailjet implements INodeType {
|
||||
},
|
||||
],
|
||||
default: 'email',
|
||||
description: 'Resource to consume.',
|
||||
description: 'Resource to consume',
|
||||
},
|
||||
...emailOperations,
|
||||
...emailFields,
|
||||
@@ -98,25 +93,6 @@ export class Mailjet implements INodeType {
|
||||
};
|
||||
|
||||
methods = {
|
||||
credentialTest: {
|
||||
async mailjetEmailApiTest(this: ICredentialTestFunctions, credential: ICredentialsDecrypted): Promise<INodeCredentialTestResult> {
|
||||
try {
|
||||
await validateCredentials.call(this, credential.data as ICredentialDataDecryptedObject);
|
||||
} catch (error) {
|
||||
const err = error as JsonObject;
|
||||
if (err.statusCode === 401) {
|
||||
return {
|
||||
status: 'Error',
|
||||
message: `Invalid credentials`,
|
||||
};
|
||||
}
|
||||
}
|
||||
return {
|
||||
status: 'OK',
|
||||
message: 'Authentication successful',
|
||||
};
|
||||
},
|
||||
},
|
||||
loadOptions: {
|
||||
// Get all the available custom fields to display them to user so that he can
|
||||
// select them easily
|
||||
@@ -273,7 +249,7 @@ export class Mailjet implements INodeType {
|
||||
body.Variables![variable.name as string] = variable.value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (additionalFields.bccEmail) {
|
||||
const bccEmail = (additionalFields.bccEmail as string).split(',') as string[];
|
||||
for (const email of bccEmail) {
|
||||
|
||||
Reference in New Issue
Block a user