@activepieces/piece-validatedmails 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,44 @@
1
+ # @activepieces/piece-validatedmails
2
+
3
+ ValidatedMails is an email validation API integration for Activepieces that validates a single email address and returns a consistent, flat response contract suitable for routing, scoring, and downstream decision steps.
4
+
5
+ ## Example workflow
6
+
7
+ 1. Trigger on a new lead submission.
8
+ 2. Run **ValidatedMails → Validate Email**.
9
+ 3. Branch on `status` (`valid`, `invalid`, `unknown`) to continue, reject, or review the lead.
10
+
11
+ ## Field guide
12
+
13
+ | Field | Type | Description |
14
+ |---|---|---|
15
+ | `is_valid` | boolean | Final validity decision. |
16
+ | `status` | string | High-level status (`valid`, `invalid`, `unknown`). |
17
+ | `score` | number | Confidence score returned by API. |
18
+ | `reason` | string | Primary reason label. |
19
+ | `state` | string | Provider state label. |
20
+ | `email` | string | Submitted email. |
21
+ | `normalized` | string | Normalized email string. |
22
+ | `domain` | string | Parsed domain part. |
23
+ | `free` | boolean | `true` for free-provider domains. |
24
+ | `role` | boolean | `true` for role-based mailboxes. |
25
+ | `disposable` | boolean | `true` for disposable domains. |
26
+ | `accept_all` | boolean | `true` when domain appears catch-all. |
27
+ | `tag` | boolean | `true` when plus-tagging is detected. |
28
+ | `smtp_ok` | boolean | SMTP signal outcome when available. |
29
+ | `syntax_ok` | boolean | Syntax validation result. |
30
+ | `mx_ok` | boolean | MX resolution result. |
31
+ | `a_ok` | boolean | A-record fallback result. |
32
+ | `response_ms` | number | End-to-end API latency in milliseconds. |
33
+ | `mx_record` | string \| undefined | Primary MX host when available. |
34
+ | `mx_hosts` | string[] | MX host list returned by API. |
35
+ | `reasons` | string[] | Detailed reason list. |
36
+ | `trace_id` | string | Request identifier for support. |
37
+
38
+ ## Authentication
39
+
40
+ Create a ValidatedMails API key in your ValidatedMails dashboard and connect it as `API Key` in Activepieces. Connection validation calls `GET /api-keys/me`.
41
+
42
+ ## Support
43
+
44
+ info@validatedmails.com
package/package.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "@activepieces/piece-validatedmails",
3
+ "version": "0.0.1",
4
+ "type": "commonjs",
5
+ "main": "./src/index.js",
6
+ "types": "./src/index.d.ts",
7
+ "dependencies": {
8
+ "@sinclair/typebox": "0.34.11",
9
+ "ai": "^6.0.0",
10
+ "axios": "1.13.1",
11
+ "axios-retry": "4.4.1",
12
+ "deepmerge-ts": "7.1.0",
13
+ "form-data": "4.0.4",
14
+ "mime-types": "2.1.35",
15
+ "nanoid": "3.3.8",
16
+ "semver": "7.6.0",
17
+ "socket.io-client": "4.8.1",
18
+ "tslib": "^2.3.0",
19
+ "zod": "4.1.13",
20
+ "@activepieces/pieces-common": "0.11.5",
21
+ "@activepieces/pieces-framework": "0.25.3",
22
+ "@activepieces/shared": "0.36.0"
23
+ },
24
+ "resolutions": {
25
+ "rollup": "npm:@rollup/wasm-node"
26
+ }
27
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare const validatedmails: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").SecretTextProperty<true>>;
package/src/index.js ADDED
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validatedmails = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_common_1 = require("@activepieces/pieces-common");
6
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
7
+ const shared_1 = require("@activepieces/shared");
8
+ const validate_email_1 = require("./lib/actions/validate-email");
9
+ const auth_1 = require("./lib/common/auth");
10
+ exports.validatedmails = (0, pieces_framework_1.createPiece)({
11
+ displayName: 'ValidatedMails',
12
+ auth: auth_1.validatedMailsAuth,
13
+ minimumSupportedRelease: '0.36.1',
14
+ logoUrl: 'https://cdn.activepieces.com/pieces/validatedmails.png',
15
+ categories: [shared_1.PieceCategory.COMMUNICATION],
16
+ description: 'ValidatedMails validates email addresses in real time and returns status, score, and domain-level deliverability signals.',
17
+ authors: ['fatiht8a'],
18
+ actions: [
19
+ validate_email_1.validateEmail,
20
+ (0, pieces_common_1.createCustomApiCallAction)({
21
+ auth: auth_1.validatedMailsAuth,
22
+ baseUrl: () => 'https://api.validatedmails.com',
23
+ authLocation: 'headers',
24
+ authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
25
+ return {
26
+ Authorization: `Bearer ${auth.secret_text}`,
27
+ };
28
+ }),
29
+ }),
30
+ ],
31
+ triggers: [],
32
+ });
33
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/validatedmails/src/index.ts"],"names":[],"mappings":";;;;AAAA,+DAAwE;AACxE,qEAA6D;AAC7D,iDAAqD;AACrD,iEAA6D;AAC7D,4CAAuD;AAE1C,QAAA,cAAc,GAAG,IAAA,8BAAW,EAAC;IACxC,WAAW,EAAE,gBAAgB;IAC7B,IAAI,EAAE,yBAAkB;IACxB,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,wDAAwD;IACjE,UAAU,EAAE,CAAC,sBAAa,CAAC,aAAa,CAAC;IACzC,WAAW,EACT,2HAA2H;IAC7H,OAAO,EAAE,CAAC,UAAU,CAAC;IACrB,OAAO,EAAE;QACP,8BAAa;QACb,IAAA,yCAAyB,EAAC;YACxB,IAAI,EAAE,yBAAkB;YACxB,OAAO,EAAE,GAAG,EAAE,CAAC,gCAAgC;YAC/C,YAAY,EAAE,SAAS;YACvB,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAC1B,OAAO;oBACL,aAAa,EAAE,UAAU,IAAI,CAAC,WAAW,EAAE;iBAC5C,CAAC;YACJ,CAAC,CAAA;SACF,CAAC;KACH;IACD,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare const validateEmail: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
2
+ email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ dnsTimeoutMs: import("@activepieces/pieces-framework").NumberProperty<false>;
4
+ mode: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
5
+ }>;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateEmail = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const auth_1 = require("../common/auth");
7
+ const validate_email_helpers_1 = require("../common/validate-email-helpers");
8
+ exports.validateEmail = (0, pieces_framework_1.createAction)({
9
+ auth: auth_1.validatedMailsAuth,
10
+ name: 'validateEmail',
11
+ displayName: 'Validate Email',
12
+ description: 'Validate a single email address using the ValidatedMails API.',
13
+ props: {
14
+ email: pieces_framework_1.Property.ShortText({
15
+ displayName: 'Email Address',
16
+ description: 'The email address to validate.',
17
+ required: true,
18
+ }),
19
+ dnsTimeoutMs: pieces_framework_1.Property.Number({
20
+ displayName: 'DNS Timeout (ms)',
21
+ description: 'DNS timeout in milliseconds. Value is clamped between 200 and 5000.',
22
+ required: false,
23
+ defaultValue: 1500,
24
+ }),
25
+ mode: pieces_framework_1.Property.StaticDropdown({
26
+ displayName: 'Mode',
27
+ description: 'HTTP method used for validation request.',
28
+ required: true,
29
+ defaultValue: 'POST',
30
+ options: {
31
+ options: [
32
+ { label: 'POST', value: 'POST' },
33
+ { label: 'GET', value: 'GET' },
34
+ ],
35
+ },
36
+ }),
37
+ },
38
+ run(context) {
39
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
40
+ return (0, validate_email_helpers_1.executeValidateEmailRequest)(Object.assign(Object.assign({}, context.propsValue), { mode: context.propsValue.mode }), context.auth.secret_text);
41
+ });
42
+ },
43
+ });
44
+ //# sourceMappingURL=validate-email.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-email.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/validatedmails/src/lib/actions/validate-email.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,yCAAoD;AACpD,6EAA+E;AAElE,QAAA,aAAa,GAAG,IAAA,+BAAY,EAAC;IACxC,IAAI,EAAE,yBAAkB;IACxB,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EAAE,+DAA+D;IAC5E,KAAK,EAAE;QACL,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,eAAe;YAC5B,WAAW,EAAE,gCAAgC;YAC7C,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,YAAY,EAAE,2BAAQ,CAAC,MAAM,CAAC;YAC5B,WAAW,EAAE,kBAAkB;YAC/B,WAAW,EAAE,qEAAqE;YAClF,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,IAAI;SACnB,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAC5B,WAAW,EAAE,MAAM;YACnB,WAAW,EAAE,0CAA0C;YACvD,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,MAAM;YACpB,OAAO,EAAE;gBACP,OAAO,EAAE;oBACP,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;oBAChC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE;iBAC/B;aACF;SACF,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,OAAO,IAAA,oDAA2B,kCAC7B,OAAO,CAAC,UAAU,KACrB,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,IAAsB,KAC9C,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC/B,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const validatedMailsAuth: import("@activepieces/pieces-framework").SecretTextProperty<true>;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validatedMailsAuth = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_common_1 = require("@activepieces/pieces-common");
6
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
7
+ exports.validatedMailsAuth = pieces_framework_1.PieceAuth.SecretText({
8
+ displayName: 'API Key',
9
+ description: 'Your ValidatedMails API key. You can find it in your ValidatedMails dashboard.',
10
+ required: true,
11
+ validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
12
+ try {
13
+ yield pieces_common_1.httpClient.sendRequest({
14
+ method: pieces_common_1.HttpMethod.GET,
15
+ url: 'https://api.validatedmails.com/api-keys/me',
16
+ headers: {
17
+ Authorization: `Bearer ${auth}`,
18
+ 'Content-Type': 'application/json',
19
+ },
20
+ timeout: 5000,
21
+ });
22
+ return {
23
+ valid: true,
24
+ };
25
+ }
26
+ catch (_b) {
27
+ return {
28
+ valid: false,
29
+ error: 'Unauthorized: Invalid API key',
30
+ };
31
+ }
32
+ }),
33
+ });
34
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/validatedmails/src/lib/common/auth.ts"],"names":[],"mappings":";;;;AAAA,+DAAqE;AACrE,qEAA2D;AAE9C,QAAA,kBAAkB,GAAG,4BAAS,CAAC,UAAU,CAAC;IACrD,WAAW,EAAE,SAAS;IACtB,WAAW,EACT,gFAAgF;IAClF,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;QACvB,IAAI,CAAC;YACH,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC3B,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG,EAAE,4CAA4C;gBACjD,OAAO,EAAE;oBACP,aAAa,EAAE,UAAU,IAAI,EAAE;oBAC/B,cAAc,EAAE,kBAAkB;iBACnC;gBACD,OAAO,EAAE,IAAI;aACd,CAAC,CAAC;YAEH,OAAO;gBACL,KAAK,EAAE,IAAI;aACZ,CAAC;QACJ,CAAC;QAAC,WAAM,CAAC;YACP,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,+BAA+B;aACvC,CAAC;QACJ,CAAC;IACH,CAAC,CAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,30 @@
1
+ export type ValidationStatus = 'valid' | 'invalid' | 'unknown';
2
+ export type ValidatedMailsValidationResponse = {
3
+ is_valid: boolean;
4
+ score: number;
5
+ email: string;
6
+ normalized: string;
7
+ state: string;
8
+ reason: string;
9
+ domain: string;
10
+ free: boolean;
11
+ role: boolean;
12
+ disposable: boolean;
13
+ accept_all: boolean;
14
+ tag: boolean;
15
+ smtp_ok: boolean;
16
+ mx_record?: string;
17
+ syntax_ok: boolean;
18
+ mx_ok: boolean;
19
+ a_ok: boolean;
20
+ response_ms: number;
21
+ mx_hosts: string[];
22
+ status: ValidationStatus;
23
+ reasons: string[];
24
+ trace_id: string;
25
+ };
26
+ export type ValidateEmailProps = {
27
+ email: string;
28
+ dnsTimeoutMs?: number;
29
+ mode: 'POST' | 'GET';
30
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/validatedmails/src/lib/common/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ import { ValidateEmailProps, ValidatedMailsValidationResponse } from './types';
2
+ export declare function sanitizeEmail(email: string): string;
3
+ export declare function assertEmailInput(email: string): void;
4
+ export declare function normalizeDnsTimeoutMs(dnsTimeoutMs?: number): number;
5
+ export declare function mapHttpStatusToError(status: number): Error;
6
+ export declare function isTransportOrServerError(error: unknown): boolean;
7
+ export declare function toValidationOutput(body: Record<string, unknown>): ValidatedMailsValidationResponse;
8
+ export declare function executeValidateEmailRequest(propsValue: ValidateEmailProps, apiKey: string, requestSender?: <ResponseBody extends unknown = any>(request: import("@activepieces/pieces-common").HttpRequest<import("dist/packages/pieces/community/common/src/lib/http/core/http-request-body").HttpRequestBody>, axiosClient?: import("axios").AxiosInstance) => Promise<import("@activepieces/pieces-common").HttpResponse<ResponseBody>>): Promise<ValidatedMailsValidationResponse>;
@@ -0,0 +1,170 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sanitizeEmail = sanitizeEmail;
4
+ exports.assertEmailInput = assertEmailInput;
5
+ exports.normalizeDnsTimeoutMs = normalizeDnsTimeoutMs;
6
+ exports.mapHttpStatusToError = mapHttpStatusToError;
7
+ exports.isTransportOrServerError = isTransportOrServerError;
8
+ exports.toValidationOutput = toValidationOutput;
9
+ exports.executeValidateEmailRequest = executeValidateEmailRequest;
10
+ const tslib_1 = require("tslib");
11
+ const pieces_common_1 = require("@activepieces/pieces-common");
12
+ const MIN_DNS_TIMEOUT_MS = 200;
13
+ const MAX_DNS_TIMEOUT_MS = 5000;
14
+ const DEFAULT_DNS_TIMEOUT_MS = 1500;
15
+ const ERR_UNAUTHORIZED = 'Unauthorized: Invalid API key';
16
+ const ERR_INSUFFICIENT_CREDITS = 'Insufficient credits';
17
+ const ERR_RATE_LIMITED = 'Rate limited';
18
+ const ERR_SERVICE_UNAVAILABLE = 'Service unavailable';
19
+ const VALIDATE_URL = 'https://api.validatedmails.com/validate';
20
+ const VALIDATE_URL_FALLBACK = 'https://api.validatedmails.com/validate/';
21
+ function sanitizeEmail(email) {
22
+ return email.trim();
23
+ }
24
+ function assertEmailInput(email) {
25
+ const sanitizedEmail = sanitizeEmail(email);
26
+ if (!sanitizedEmail.includes('@')) {
27
+ throw new Error('Email address must contain @');
28
+ }
29
+ }
30
+ function normalizeDnsTimeoutMs(dnsTimeoutMs) {
31
+ if (dnsTimeoutMs === undefined || Number.isNaN(dnsTimeoutMs)) {
32
+ return DEFAULT_DNS_TIMEOUT_MS;
33
+ }
34
+ return Math.min(Math.max(Math.round(dnsTimeoutMs), MIN_DNS_TIMEOUT_MS), MAX_DNS_TIMEOUT_MS);
35
+ }
36
+ function mapHttpStatusToError(status) {
37
+ if (status === 401) {
38
+ return new Error(ERR_UNAUTHORIZED);
39
+ }
40
+ if (status === 402) {
41
+ return new Error(ERR_INSUFFICIENT_CREDITS);
42
+ }
43
+ if (status === 429) {
44
+ return new Error(ERR_RATE_LIMITED);
45
+ }
46
+ if (status >= 500) {
47
+ return new Error(ERR_SERVICE_UNAVAILABLE);
48
+ }
49
+ return new Error('Request failed');
50
+ }
51
+ function isTransportOrServerError(error) {
52
+ if (!(error instanceof Error)) {
53
+ return false;
54
+ }
55
+ const maybeResponse = error.response;
56
+ if ((maybeResponse === null || maybeResponse === void 0 ? void 0 : maybeResponse.status) && maybeResponse.status >= 500) {
57
+ return true;
58
+ }
59
+ return !maybeResponse;
60
+ }
61
+ function getErrorStatus(error) {
62
+ var _a;
63
+ if (!(error instanceof Error)) {
64
+ return undefined;
65
+ }
66
+ return (_a = error.response) === null || _a === void 0 ? void 0 : _a.status;
67
+ }
68
+ function shouldRetryWithFallbackUrl(error) {
69
+ const status = getErrorStatus(error);
70
+ return status === 307 || status === 308 || status === 404 || status === 405;
71
+ }
72
+ function toValidationOutput(body) {
73
+ var _a, _b, _c, _d, _e, _f, _g, _h;
74
+ return {
75
+ is_valid: Boolean(body['is_valid']),
76
+ score: Number((_a = body['score']) !== null && _a !== void 0 ? _a : 0),
77
+ email: String((_b = body['email']) !== null && _b !== void 0 ? _b : ''),
78
+ normalized: String((_c = body['normalized']) !== null && _c !== void 0 ? _c : ''),
79
+ state: String((_d = body['state']) !== null && _d !== void 0 ? _d : ''),
80
+ reason: String((_e = body['reason']) !== null && _e !== void 0 ? _e : ''),
81
+ domain: String((_f = body['domain']) !== null && _f !== void 0 ? _f : ''),
82
+ free: Boolean(body['free']),
83
+ role: Boolean(body['role']),
84
+ disposable: Boolean(body['disposable']),
85
+ accept_all: Boolean(body['accept_all']),
86
+ tag: Boolean(body['tag']),
87
+ smtp_ok: Boolean(body['smtp_ok']),
88
+ mx_record: typeof body['mx_record'] === 'string' ? String(body['mx_record']) : undefined,
89
+ syntax_ok: Boolean(body['syntax_ok']),
90
+ mx_ok: Boolean(body['mx_ok']),
91
+ a_ok: Boolean(body['a_ok']),
92
+ response_ms: Number((_g = body['response_ms']) !== null && _g !== void 0 ? _g : 0),
93
+ mx_hosts: Array.isArray(body['mx_hosts'])
94
+ ? body['mx_hosts'].map((item) => String(item))
95
+ : [],
96
+ status: asStatus(body['status']),
97
+ reasons: Array.isArray(body['reasons'])
98
+ ? body['reasons'].map((item) => String(item))
99
+ : [],
100
+ trace_id: String((_h = body['trace_id']) !== null && _h !== void 0 ? _h : ''),
101
+ };
102
+ }
103
+ function asStatus(value) {
104
+ if (value === 'valid' || value === 'invalid' || value === 'unknown') {
105
+ return value;
106
+ }
107
+ return 'unknown';
108
+ }
109
+ function executeValidateEmailRequest(propsValue_1, apiKey_1) {
110
+ return tslib_1.__awaiter(this, arguments, void 0, function* (propsValue, apiKey, requestSender = pieces_common_1.httpClient.sendRequest) {
111
+ const sanitizedEmail = sanitizeEmail(propsValue.email);
112
+ assertEmailInput(sanitizedEmail);
113
+ const dnsTimeoutMs = normalizeDnsTimeoutMs(propsValue.dnsTimeoutMs);
114
+ const request = {
115
+ headers: {
116
+ Authorization: `Bearer ${apiKey}`,
117
+ 'Content-Type': 'application/json',
118
+ },
119
+ timeout: 10000,
120
+ };
121
+ const send = (url) => tslib_1.__awaiter(this, void 0, void 0, function* () {
122
+ if (propsValue.mode === 'GET') {
123
+ return requestSender(Object.assign(Object.assign({ method: pieces_common_1.HttpMethod.GET, url }, request), { queryParams: {
124
+ email: sanitizedEmail,
125
+ dns_timeout_ms: String(dnsTimeoutMs),
126
+ } }));
127
+ }
128
+ return requestSender(Object.assign(Object.assign({ method: pieces_common_1.HttpMethod.POST, url }, request), { body: {
129
+ email: sanitizedEmail,
130
+ dns_timeout_ms: dnsTimeoutMs,
131
+ } }));
132
+ });
133
+ const sendWithFallbackUrl = () => tslib_1.__awaiter(this, void 0, void 0, function* () {
134
+ try {
135
+ return yield send(VALIDATE_URL);
136
+ }
137
+ catch (error) {
138
+ if (shouldRetryWithFallbackUrl(error)) {
139
+ return send(VALIDATE_URL_FALLBACK);
140
+ }
141
+ throw error;
142
+ }
143
+ });
144
+ try {
145
+ const response = yield sendWithFallbackUrl();
146
+ return toValidationOutput(response.body);
147
+ }
148
+ catch (error) {
149
+ if (isTransportOrServerError(error)) {
150
+ try {
151
+ const retriedResponse = yield sendWithFallbackUrl();
152
+ return toValidationOutput(retriedResponse.body);
153
+ }
154
+ catch (retryError) {
155
+ const status = getErrorStatus(retryError);
156
+ if (status) {
157
+ throw mapHttpStatusToError(status);
158
+ }
159
+ throw new Error(ERR_SERVICE_UNAVAILABLE);
160
+ }
161
+ }
162
+ const status = getErrorStatus(error);
163
+ if (status) {
164
+ throw mapHttpStatusToError(status);
165
+ }
166
+ throw new Error('Request failed');
167
+ }
168
+ });
169
+ }
170
+ //# sourceMappingURL=validate-email-helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-email-helpers.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/validatedmails/src/lib/common/validate-email-helpers.ts"],"names":[],"mappings":";;AAiBA,sCAEC;AAED,4CAMC;AAED,sDAMC;AAED,oDAkBC;AAED,4DAWC;AAeD,gDAgCC;AASD,kEA4EC;;AAxMD,+DAAqE;AAMrE,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAC/B,MAAM,kBAAkB,GAAG,IAAI,CAAC;AAChC,MAAM,sBAAsB,GAAG,IAAI,CAAC;AAEpC,MAAM,gBAAgB,GAAG,+BAA+B,CAAC;AACzD,MAAM,wBAAwB,GAAG,sBAAsB,CAAC;AACxD,MAAM,gBAAgB,GAAG,cAAc,CAAC;AACxC,MAAM,uBAAuB,GAAG,qBAAqB,CAAC;AACtD,MAAM,Y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