mailgun.js 3.7.1 → 4.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/CHANGELOG.md +31 -0
- package/README.md +335 -1
- package/dist/lib/client.d.ts +0 -4
- package/dist/lib/domains.d.ts +19 -13
- package/dist/lib/domainsCredentials.d.ts +14 -0
- package/dist/lib/events.d.ts +3 -3
- package/dist/lib/interfaces/DomainCredentials.d.ts +52 -0
- package/dist/lib/interfaces/DomainTracking.d.ts +4 -4
- package/dist/lib/interfaces/Domains.d.ts +53 -3
- package/dist/lib/interfaces/Events.d.ts +66 -2
- package/dist/lib/interfaces/MultipleValidation.d.ts +55 -0
- package/dist/lib/interfaces/Validate.d.ts +12 -0
- package/dist/lib/interfaces/Webhooks.d.ts +5 -1
- package/dist/lib/interfaces/lists.d.ts +1 -1
- package/dist/lib/multipleValidation.d.ts +10 -0
- package/dist/lib/parse.d.ts +0 -6
- package/dist/lib/request.d.ts +4 -1
- package/dist/lib/validate.d.ts +5 -2
- package/dist/lib/webhooks.d.ts +3 -3
- package/dist/mailgun.node.js +2 -2
- package/dist/mailgun.node.js.LICENSE.txt +1 -1
- package/dist/mailgun.web.js +2 -2
- package/dist/mailgun.web.js.LICENSE.txt +1 -1
- package/lib/client.ts +6 -12
- package/lib/domains.ts +82 -26
- package/lib/domainsCredentials.ts +88 -0
- package/lib/events.ts +6 -6
- package/lib/interfaces/DomainCredentials.ts +68 -0
- package/lib/interfaces/DomainTracking.ts +4 -4
- package/lib/interfaces/Domains.ts +65 -4
- package/lib/interfaces/Events.ts +66 -2
- package/lib/interfaces/MultipleValidation.ts +62 -0
- package/lib/interfaces/Validate.ts +15 -0
- package/lib/interfaces/Webhooks.ts +6 -1
- package/lib/interfaces/lists.ts +1 -1
- package/lib/multipleValidation.ts +37 -0
- package/lib/request.ts +75 -34
- package/lib/validate.ts +10 -4
- package/lib/webhooks.ts +19 -10
- package/package.json +6 -6
- package/test/client.test.ts +21 -5
- package/test/data/emailsValidation1.csv +3 -0
- package/test/domains.test.ts +118 -15
- package/test/domainsCredentials.test.ts +97 -0
- package/test/events.test.ts +15 -24
- package/test/multipleValidation.test.ts +159 -0
- package/test/validate.test.ts +7 -4
- package/test/webhooks.test.ts +6 -6
- package/webpack/webpack.dev.config.js +10 -0
- package/lib/parse.ts +0 -27
- package/test/parse.test.ts +0 -75
package/lib/parse.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/* eslint-disable camelcase */
|
|
2
|
-
import Request from './request';
|
|
3
|
-
|
|
4
|
-
export default class ParseClient {
|
|
5
|
-
request: Request;
|
|
6
|
-
|
|
7
|
-
constructor(request: Request) {
|
|
8
|
-
this.request = request;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
get(addresses: string[] | string, enableDnsEspChecks: boolean) {
|
|
12
|
-
const query = {} as { addresses: string, syntax_only: boolean };
|
|
13
|
-
|
|
14
|
-
if (Array.isArray(addresses)) {
|
|
15
|
-
query.addresses = addresses.join(',');
|
|
16
|
-
} else {
|
|
17
|
-
query.addresses = addresses;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
if (enableDnsEspChecks) {
|
|
21
|
-
query.syntax_only = false;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return this.request.get('/v3/address/parse', query)
|
|
25
|
-
.then((response) => response.body);
|
|
26
|
-
}
|
|
27
|
-
}
|
package/test/parse.test.ts
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import formData from 'form-data';
|
|
2
|
-
|
|
3
|
-
import { URLSearchParams } from 'url';
|
|
4
|
-
import nock from 'nock';
|
|
5
|
-
import Request from '../lib/request';
|
|
6
|
-
import ParseClient from '../lib/parse';
|
|
7
|
-
|
|
8
|
-
import RequestOptions from '../lib/interfaces/RequestOptions';
|
|
9
|
-
import { InputFormData } from '../lib/interfaces/IFormData';
|
|
10
|
-
|
|
11
|
-
interface Data {
|
|
12
|
-
parsed: string[],
|
|
13
|
-
unparseable: string[]
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
describe('ParseClient', function () {
|
|
17
|
-
let client: any;
|
|
18
|
-
let api: any;
|
|
19
|
-
|
|
20
|
-
beforeEach(function () {
|
|
21
|
-
client = new ParseClient(new Request({ url: 'https://api.mailgun.net' } as RequestOptions, formData as InputFormData));
|
|
22
|
-
api = nock('https://api.mailgun.net');
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
afterEach(function () {
|
|
26
|
-
api.done();
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
describe('get', function () {
|
|
30
|
-
it('parses a single email addresses', function () {
|
|
31
|
-
const data: Data = {
|
|
32
|
-
parsed: ['foo@example.com'],
|
|
33
|
-
unparseable: []
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const query = new URLSearchParams({ addresses: data.parsed });
|
|
37
|
-
|
|
38
|
-
api.get('/v3/address/parse').query(query).reply(200, data);
|
|
39
|
-
|
|
40
|
-
return client.get('foo@example.com').then(function (response: Data) {
|
|
41
|
-
response.should.eql(data);
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it('parses an array email addresses', function () {
|
|
46
|
-
const data: Data = {
|
|
47
|
-
parsed: ['foo@example.com'],
|
|
48
|
-
unparseable: ['example.com']
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
api.get('/v3/address/parse')
|
|
52
|
-
.query({ addresses: 'foo@example.com,example.com' })
|
|
53
|
-
.reply(200, data);
|
|
54
|
-
|
|
55
|
-
return client.get(['foo@example.com', 'example.com']).then(function (response: Data) {
|
|
56
|
-
response.should.eql(data);
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
it('parses email addresses with dns and esp checks', function () {
|
|
61
|
-
const data: Data = {
|
|
62
|
-
parsed: [],
|
|
63
|
-
unparseable: ['foo@example.com']
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
api.get('/v3/address/parse')
|
|
67
|
-
.query({ addresses: 'foo@example.com', syntax_only: false })
|
|
68
|
-
.reply(200, data);
|
|
69
|
-
|
|
70
|
-
return client.get('foo@example.com', true).then(function (response: Data) {
|
|
71
|
-
response.should.eql(data);
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
});
|