@adtrackify/at-service-common 3.3.6 → 3.3.7
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/dist/cjs/clients/third-party/emailable-client.d.ts +1 -1
- package/dist/cjs/clients/third-party/emailable-client.js +5 -8
- package/dist/cjs/clients/third-party/emailable-client.js.map +1 -1
- package/dist/esm/clients/third-party/emailable-client.d.ts +1 -1
- package/dist/esm/clients/third-party/emailable-client.js +5 -8
- package/dist/esm/clients/third-party/emailable-client.js.map +1 -1
- package/package.json +1 -1
|
@@ -3,5 +3,5 @@ import { EmailableVerifyEmailResponse } from '@adtrackify/at-tracking-event-type
|
|
|
3
3
|
export declare class EmailableClient {
|
|
4
4
|
private EMAILABLE_API_KEY;
|
|
5
5
|
constructor(emailableApiKey: string);
|
|
6
|
-
verifyEmail: (email: string, retries?: number,
|
|
6
|
+
verifyEmail: (email: string, retries?: number, delay?: number) => Promise<ApiResponse<EmailableVerifyEmailResponse>>;
|
|
7
7
|
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EmailableClient = void 0;
|
|
4
4
|
const generic_1 = require("../generic");
|
|
5
|
-
const helpers_1 = require("../../helpers");
|
|
6
5
|
const EMAILABLE_API_URL = 'https://api.emailable.com/v1';
|
|
7
6
|
const client = (0, generic_1.axiosHttpService)({
|
|
8
7
|
baseURL: EMAILABLE_API_URL
|
|
@@ -12,14 +11,12 @@ class EmailableClient {
|
|
|
12
11
|
constructor(emailableApiKey) {
|
|
13
12
|
this.EMAILABLE_API_KEY = emailableApiKey;
|
|
14
13
|
}
|
|
15
|
-
verifyEmail = async (email, retries =
|
|
14
|
+
verifyEmail = async (email, retries = 3, delay = 3000) => {
|
|
16
15
|
const response = await client.get('/verify', { params: { api_key: this.EMAILABLE_API_KEY, email } });
|
|
17
|
-
if (response.status
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
await
|
|
21
|
-
helpers_1.Logger.info('Retrying to verify email', { email, retries, maxRetries, retryDelay });
|
|
22
|
-
return await this.verifyEmail(email, retries + 1, maxRetries, retryDelay);
|
|
16
|
+
if (response.status !== 200) {
|
|
17
|
+
if (retries > 0) {
|
|
18
|
+
await new Promise(resolve => setTimeout(resolve, delay));
|
|
19
|
+
return await this.verifyEmail(email, retries - 1, delay * 2);
|
|
23
20
|
}
|
|
24
21
|
}
|
|
25
22
|
return response;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emailable-client.js","sourceRoot":"","sources":["../../../../src/clients/third-party/emailable-client.ts"],"names":[],"mappings":";;;AAAA,wCAA8C;
|
|
1
|
+
{"version":3,"file":"emailable-client.js","sourceRoot":"","sources":["../../../../src/clients/third-party/emailable-client.ts"],"names":[],"mappings":";;;AAAA,wCAA8C;AAI9C,MAAM,iBAAiB,GAAG,8BAA8B,CAAC;AACzD,MAAM,MAAM,GAAG,IAAA,0BAAgB,EAAC;IAC9B,OAAO,EAAE,iBAAiB;CAC3B,CAAC,CAAC;AAEH,MAAa,eAAe;IAClB,iBAAiB,CAAS;IAElC,YAAY,eAAuB;QACjC,IAAI,CAAC,iBAAiB,GAAG,eAAe,CAAC;IAC3C,CAAC;IAEM,WAAW,GAAG,KAAK,EAAE,KAAa,EAAE,OAAO,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,EAAsD,EAAE;QAC1H,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,iBAAiB,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QACrG,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE;YAC3B,IAAI,OAAO,GAAG,CAAC,EAAE;gBACf,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;gBACzD,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;aAC9D;SACF;QACD,OAAO,QAAqD,CAAC;IAC/D,CAAC,CAAA;CACF;AAjBD,0CAiBC"}
|
|
@@ -3,5 +3,5 @@ import { EmailableVerifyEmailResponse } from '@adtrackify/at-tracking-event-type
|
|
|
3
3
|
export declare class EmailableClient {
|
|
4
4
|
private EMAILABLE_API_KEY;
|
|
5
5
|
constructor(emailableApiKey: string);
|
|
6
|
-
verifyEmail: (email: string, retries?: number,
|
|
6
|
+
verifyEmail: (email: string, retries?: number, delay?: number) => Promise<ApiResponse<EmailableVerifyEmailResponse>>;
|
|
7
7
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { axiosHttpService } from '../generic';
|
|
2
|
-
import { Logger } from '../../helpers';
|
|
3
2
|
const EMAILABLE_API_URL = 'https://api.emailable.com/v1';
|
|
4
3
|
const client = axiosHttpService({
|
|
5
4
|
baseURL: EMAILABLE_API_URL
|
|
@@ -9,14 +8,12 @@ export class EmailableClient {
|
|
|
9
8
|
constructor(emailableApiKey) {
|
|
10
9
|
this.EMAILABLE_API_KEY = emailableApiKey;
|
|
11
10
|
}
|
|
12
|
-
verifyEmail = async (email, retries =
|
|
11
|
+
verifyEmail = async (email, retries = 3, delay = 3000) => {
|
|
13
12
|
const response = await client.get('/verify', { params: { api_key: this.EMAILABLE_API_KEY, email } });
|
|
14
|
-
if (response.status
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
await
|
|
18
|
-
Logger.info('Retrying to verify email', { email, retries, maxRetries, retryDelay });
|
|
19
|
-
return await this.verifyEmail(email, retries + 1, maxRetries, retryDelay);
|
|
13
|
+
if (response.status !== 200) {
|
|
14
|
+
if (retries > 0) {
|
|
15
|
+
await new Promise(resolve => setTimeout(resolve, delay));
|
|
16
|
+
return await this.verifyEmail(email, retries - 1, delay * 2);
|
|
20
17
|
}
|
|
21
18
|
}
|
|
22
19
|
return response;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emailable-client.js","sourceRoot":"","sources":["../../../../src/clients/third-party/emailable-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"emailable-client.js","sourceRoot":"","sources":["../../../../src/clients/third-party/emailable-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAI9C,MAAM,iBAAiB,GAAG,8BAA8B,CAAC;AACzD,MAAM,MAAM,GAAG,gBAAgB,CAAC;IAC9B,OAAO,EAAE,iBAAiB;CAC3B,CAAC,CAAC;AAEH,MAAM,OAAO,eAAe;IAClB,iBAAiB,CAAS;IAElC,YAAY,eAAuB;QACjC,IAAI,CAAC,iBAAiB,GAAG,eAAe,CAAC;IAC3C,CAAC;IAEM,WAAW,GAAG,KAAK,EAAE,KAAa,EAAE,OAAO,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,EAAsD,EAAE;QAC1H,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,iBAAiB,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QACrG,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE;YAC3B,IAAI,OAAO,GAAG,CAAC,EAAE;gBACf,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;gBACzD,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;aAC9D;SACF;QACD,OAAO,QAAqD,CAAC;IAC/D,CAAC,CAAA;CACF"}
|