first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
import { ApplicationError } from '@n8n/errors';
|
||||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IHookFunctions,
|
||||
IHttpRequestMethods,
|
||||
ILoadOptionsFunctions,
|
||||
IRequestOptions,
|
||||
IWebhookFunctions,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export async function mailCheckApiRequest(
|
||||
this: IWebhookFunctions | IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
|
||||
body: any = {},
|
||||
qs: IDataObject = {},
|
||||
uri?: string,
|
||||
headers: IDataObject = {},
|
||||
option: IDataObject = {},
|
||||
): Promise<any> {
|
||||
const credentials = await this.getCredentials('mailcheckApi');
|
||||
|
||||
let options: IRequestOptions = {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${credentials.apiKey}`,
|
||||
},
|
||||
method,
|
||||
body,
|
||||
qs,
|
||||
uri: uri || `https://api.mailcheck.co/v1${resource}`,
|
||||
json: true,
|
||||
};
|
||||
try {
|
||||
options = Object.assign({}, options, option);
|
||||
if (Object.keys(headers).length !== 0) {
|
||||
options.headers = Object.assign({}, options.headers, headers);
|
||||
}
|
||||
if (Object.keys(body as IDataObject).length === 0) {
|
||||
delete options.body;
|
||||
}
|
||||
return await this.helpers.request.call(this, options);
|
||||
} catch (error) {
|
||||
if (error.response?.body?.message) {
|
||||
// Try to return the error prettier
|
||||
throw new ApplicationError(
|
||||
`Mailcheck error response [${error.statusCode}]: ${error.response.body.message}`,
|
||||
{ level: 'warning' },
|
||||
);
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"node": "n8n-nodes-base.mailcheck",
|
||||
"nodeVersion": "1.0",
|
||||
"codexVersion": "1.0",
|
||||
"categories": ["Utility", "Marketing"],
|
||||
"resources": {
|
||||
"credentialDocumentation": [
|
||||
{
|
||||
"url": "https://docs.n8n.io/integrations/builtin/credentials/mailcheck/"
|
||||
}
|
||||
],
|
||||
"primaryDocumentation": [
|
||||
{
|
||||
"url": "https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.mailcheck/"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
import type {
|
||||
IExecuteFunctions,
|
||||
IDataObject,
|
||||
INodeExecutionData,
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeConnectionTypes } from 'n8n-workflow';
|
||||
|
||||
import { mailCheckApiRequest } from './GenericFunctions';
|
||||
|
||||
export class Mailcheck implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
displayName: 'Mailcheck',
|
||||
name: 'mailcheck',
|
||||
icon: 'file:mailcheck.svg',
|
||||
group: ['transform'],
|
||||
version: 1,
|
||||
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
||||
description: 'Consume Mailcheck API',
|
||||
defaults: {
|
||||
name: 'Mailcheck',
|
||||
},
|
||||
usableAsTool: true,
|
||||
inputs: [NodeConnectionTypes.Main],
|
||||
outputs: [NodeConnectionTypes.Main],
|
||||
credentials: [
|
||||
{
|
||||
name: 'mailcheckApi',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
properties: [
|
||||
{
|
||||
displayName: 'Resource',
|
||||
name: 'resource',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
options: [
|
||||
{
|
||||
name: 'Email',
|
||||
value: 'email',
|
||||
},
|
||||
],
|
||||
default: 'email',
|
||||
},
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['email'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Check',
|
||||
value: 'check',
|
||||
action: 'Check an email',
|
||||
},
|
||||
],
|
||||
default: 'check',
|
||||
},
|
||||
{
|
||||
displayName: 'Email',
|
||||
name: 'email',
|
||||
type: 'string',
|
||||
placeholder: 'name@email.com',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['email'],
|
||||
operation: ['check'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'Email address to check',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const length = items.length;
|
||||
let responseData;
|
||||
|
||||
const resource = this.getNodeParameter('resource', 0);
|
||||
const operation = this.getNodeParameter('operation', 0);
|
||||
for (let i = 0; i < length; i++) {
|
||||
try {
|
||||
if (resource === 'email') {
|
||||
if (operation === 'check') {
|
||||
const email = this.getNodeParameter('email', i) as string;
|
||||
responseData = await mailCheckApiRequest.call(this, 'POST', '/singleEmail:check', {
|
||||
email,
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"githubUsername": {
|
||||
"type": "string"
|
||||
},
|
||||
"isNotDisposable": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"isNotSmtpCatchAll": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"microsoftAccountExists": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"mxExists": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"smtpExists": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"trustRate": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"version": 1
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="60" height="60" fill="none"><rect width="60" height="60" fill="url(#a)" rx="8"/><path fill="#fff" fill-rule="evenodd" d="m9.524 25 1.175-7.483L13.753 25h1.41l3.217-7.483L19.555 25h3.524l-2.314-13H17.26l-2.71 6.931L11.818 12H8.313L6 25zm20.025-4.828 1.59-4.327 1.59 4.327zM34.483 25h3.777l-5.187-13h-3.868L24.02 25h3.777l.813-2.259h5.06zm5.331-13v13h3.542V12zm6.397 0v13H54v-2.862h-4.247V12zM13.968 37.539a7.4 7.4 0 0 0-1.265-.41 5.8 5.8 0 0 0-1.22-.129q-1.091 0-2.086.406a5.45 5.45 0 0 0-2.947 2.86A5.3 5.3 0 0 0 6 42.473q0 1.204.456 2.22a5.7 5.7 0 0 0 1.21 1.755A5.42 5.42 0 0 0 11.47 48a5.4 5.4 0 0 0 1.063-.105 8.5 8.5 0 0 0 1.16-.323l.276-.097v-3.206q-1.036 1.106-2.333 1.105a2.77 2.77 0 0 1-2.59-1.74 3 3 0 0 1-.216-1.148q0-.608.215-1.133.214-.526.586-.907.371-.38.89-.602.517-.22 1.126-.221 1.38-.001 2.32 1.147zm4.419-.249H15.68v10.42h2.707v-4.298h3.908v4.298H25V37.29h-2.706v4.022h-3.908V37.29zm14.72 0h-5.924v10.42h5.924v-2.294H29.89v-1.797h3.038v-2.294H29.89v-1.74h3.217zm9.445.249a7.4 7.4 0 0 0-1.262-.41A6 6 0 0 0 40.067 37q-1.091 0-2.085.406a5.5 5.5 0 0 0-1.749 1.133 5.5 5.5 0 0 0-1.201 1.728 5.3 5.3 0 0 0-.447 2.203q0 1.203.455 2.219a5.7 5.7 0 0 0 1.21 1.755 5.42 5.42 0 0 0 4.866 1.448q.54-.104 1.16-.323l.276-.097V44.27q-1.036 1.106-2.333 1.105a2.77 2.77 0 0 1-2.59-1.74 3 3 0 0 1-.216-1.148q0-.608.215-1.133.214-.526.586-.907.372-.38.889-.602.517-.22 1.127-.221 1.38-.001 2.32 1.147V37.54zm4.42-.249h-2.707v10.42h2.706v-4.52l3.522 4.519H54l-4.516-5.486 4.13-4.934h-3.342l-3.3 4.298zM54 29.5H6v3h48z" clip-rule="evenodd"/><defs><linearGradient id="a" x1="0" x2="60" y1="-1" y2="60" gradientUnits="userSpaceOnUse"><stop stop-color="#4849C2"/><stop offset="1" stop-color="#2327A5"/></linearGradient></defs></svg>
|
||||
|
After Width: | Height: | Size: 1.7 KiB |
Reference in New Issue
Block a user