mailgun.js 3.5.9 → 3.7.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/.eslintrc +27 -11
- package/CHANGELOG.md +30 -0
- package/commitlint.config.js +1 -2
- package/dist/index.d.ts +2 -2
- package/dist/lib/client.d.ts +2 -2
- package/dist/lib/events.d.ts +9 -25
- package/dist/lib/interfaces/APIErrorOptions.d.ts +2 -1
- package/dist/lib/interfaces/ApiResponse.d.ts +2 -1
- package/dist/lib/interfaces/Events.d.ts +24 -0
- package/dist/lib/interfaces/IFormData.d.ts +4 -12
- package/dist/lib/interfaces/IpPools.d.ts +12 -0
- package/dist/lib/interfaces/Options.d.ts +2 -1
- package/dist/lib/interfaces/RequestOptions.d.ts +2 -1
- package/dist/lib/interfaces/StatsOptions.d.ts +2 -1
- package/dist/lib/interfaces/mailListMembers.d.ts +6 -6
- package/dist/lib/ip-pools.d.ts +11 -14
- package/dist/lib/ips.d.ts +6 -6
- package/dist/lib/messages.d.ts +1 -1
- package/dist/lib/request.d.ts +4 -3
- package/dist/lib/suppressions.d.ts +1 -1
- package/dist/mailgun.node.js +3 -0
- package/dist/{mailgun.js.LICENSE.txt → mailgun.node.js.LICENSE.txt} +1 -1
- package/dist/mailgun.web.js +3 -0
- package/dist/mailgun.web.js.LICENSE.txt +7 -0
- package/examples/addresses.js +1 -0
- package/examples/list-domains.js +1 -0
- package/examples/send-email.js +1 -0
- package/index.ts +3 -3
- package/lib/client.ts +4 -3
- package/lib/events.ts +21 -19
- package/lib/interfaces/APIErrorOptions.ts +3 -1
- package/lib/interfaces/ApiResponse.ts +3 -1
- package/lib/interfaces/Events.ts +25 -0
- package/lib/interfaces/IFormData.ts +5 -14
- package/lib/interfaces/IpPools.ts +16 -1
- package/lib/interfaces/Ips.ts +1 -0
- package/lib/interfaces/Options.ts +5 -2
- package/lib/interfaces/RequestOptions.ts +4 -2
- package/lib/interfaces/StatsOptions.ts +4 -2
- package/lib/interfaces/Supressions.ts +1 -1
- package/lib/interfaces/lists.ts +1 -0
- package/lib/interfaces/mailListMembers.ts +18 -12
- package/lib/interfaces/routes.ts +1 -0
- package/lib/ip-pools.ts +8 -7
- package/lib/ips.ts +3 -3
- package/lib/lists.ts +1 -1
- package/lib/messages.ts +1 -1
- package/lib/parse.ts +4 -3
- package/lib/request.ts +18 -8
- package/lib/stats.ts +3 -2
- package/lib/suppressions.ts +16 -11
- package/lib/validate.ts +0 -1
- package/package.json +9 -9
- package/test/client.test.ts +9 -3
- package/test/domains.test.ts +2 -1
- package/test/events.test.ts +3 -3
- package/test/ips.test.ts +4 -2
- package/test/lists.test.ts +7 -8
- package/test/mailListMembers.test.ts +49 -44
- package/test/messageAttachment.test.ts +5 -5
- package/test/messages.test.ts +3 -2
- package/test/parse.test.ts +4 -3
- package/test/request.test.ts +6 -5
- package/test/routes.test.ts +3 -1
- package/test/stats.test.ts +3 -2
- package/test/suppressions.test.ts +14 -11
- package/test/validate.test.ts +3 -2
- package/test/webhooks.test.ts +3 -3
- package/tsconfig.webpack.json +1 -1
- package/webpack/webpack.common.config.js +47 -0
- package/webpack/webpack.dev.config.js +18 -0
- package/webpack/webpack.release.config.js +37 -0
- package/dist/mailgun.js +0 -3
- package/webpack.config.js +0 -49
- package/webpack.release.config.js +0 -29
package/.eslintrc
CHANGED
|
@@ -7,20 +7,17 @@
|
|
|
7
7
|
"mocha": true
|
|
8
8
|
},
|
|
9
9
|
"extends": [
|
|
10
|
-
"airbnb-base"
|
|
11
|
-
"plugin:@typescript-eslint/eslint-recommended",
|
|
12
|
-
"plugin:@typescript-eslint/recommended"
|
|
10
|
+
"airbnb-base"
|
|
13
11
|
],
|
|
14
|
-
"plugins": [
|
|
15
|
-
"eslint-plugin-tsdoc",
|
|
16
|
-
"@typescript-eslint"
|
|
17
|
-
],
|
|
18
|
-
"parser": "@typescript-eslint/parser",
|
|
19
12
|
"parserOptions": {
|
|
20
13
|
"ecmaVersion": 12
|
|
21
14
|
},
|
|
22
15
|
"settings": {
|
|
23
|
-
|
|
16
|
+
"import/resolver": {
|
|
17
|
+
"node": {
|
|
18
|
+
"extensions": [".js", ".jsx", ".ts", ".tsx"]
|
|
19
|
+
}
|
|
20
|
+
}
|
|
24
21
|
},
|
|
25
22
|
"ignorePatterns": ["docs/assets/js/*", "dist/**"],
|
|
26
23
|
"rules": {
|
|
@@ -33,6 +30,25 @@
|
|
|
33
30
|
"class-methods-use-this": 0,
|
|
34
31
|
"prefer-destructuring": 0,
|
|
35
32
|
"import/extensions": 0,
|
|
36
|
-
"lines-between-class-members": ["error", "always", { "exceptAfterSingleLine": true }]
|
|
37
|
-
|
|
33
|
+
"lines-between-class-members": ["error", "always", { "exceptAfterSingleLine": true }],
|
|
34
|
+
"import/no-extraneous-dependencies" :["error", {"devDependencies": true, "optionalDependencies": false, "peerDependencies": false}]
|
|
35
|
+
},
|
|
36
|
+
"overrides": [
|
|
37
|
+
{
|
|
38
|
+
"files": ["*.ts", "*.tsx"],
|
|
39
|
+
"extends": [
|
|
40
|
+
"plugin:@typescript-eslint/eslint-recommended",
|
|
41
|
+
"plugin:@typescript-eslint/recommended"
|
|
42
|
+
],
|
|
43
|
+
"parser": "@typescript-eslint/parser",
|
|
44
|
+
"rules": {
|
|
45
|
+
"import/extensions": 0
|
|
46
|
+
// "import/no-extraneous-dependencies" :["error", {"devDependencies": true, "optionalDependencies": false, "peerDependencies": false}]
|
|
47
|
+
},
|
|
48
|
+
"plugins": [
|
|
49
|
+
"eslint-plugin-tsdoc",
|
|
50
|
+
"@typescript-eslint"
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
]
|
|
38
54
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,36 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [3.7.1](https://github.com/mailgun/mailgun-js/compare/v3.7.0...v3.7.1) (2021-10-28)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* Fix TS2345 error ([e20b8d7](https://github.com/mailgun/mailgun-js/commits/e20b8d7fd03cc94fd49a1c82b4936d5b115024a3))
|
|
11
|
+
|
|
12
|
+
## [3.7.0](https://github.com/mailgun/mailgun-js/compare/v3.6.1...v3.7.0) (2021-10-20)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* Fix linter errors ([126ba03](https://github.com/mailgun/mailgun-js/commits/126ba039bccfbdb257ddde7d17a58790e4cd30a3))
|
|
18
|
+
|
|
19
|
+
### [3.6.1](https://github.com/mailgun/mailgun-js/compare/v3.6.0...v3.6.1) (2021-10-18)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Other changes
|
|
23
|
+
|
|
24
|
+
* Update eslint dependency. Regenerate package-lock file ([0e1fef6](https://github.com/mailgun/mailgun-js/commits/0e1fef683b86e05852a04c6e2f6199db0e39ff22))
|
|
25
|
+
* Update mocha to v9 ([768ed1f](https://github.com/mailgun/mailgun-js/commits/768ed1f5896c2bbb7fff59f4fbb68d425ea5a594))
|
|
26
|
+
|
|
27
|
+
## [3.6.0](https://github.com/mailgun/mailgun-js/compare/v3.5.9...v3.6.0) (2021-10-13)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Features
|
|
31
|
+
|
|
32
|
+
* Split the distro for different targets ([1a55085](https://github.com/mailgun/mailgun-js/commits/1a550854765c7cdbb68b13b32c1f1392003abf30))
|
|
33
|
+
* Update commitlint rules ([262ce0c](https://github.com/mailgun/mailgun-js/commits/262ce0ccd594bbcd97c9aa9ba5f11ad6ce6fc8c5))
|
|
34
|
+
|
|
5
35
|
### [3.5.9](https://github.com/mailgun/mailgun-js/compare/v3.5.8...v3.5.9) (2021-09-16)
|
|
6
36
|
|
|
7
37
|
|
package/commitlint.config.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
extends: ['@commitlint/config-conventional'],
|
|
3
3
|
rules: {
|
|
4
|
-
'type-enum': [2, 'always', ['
|
|
5
|
-
'type-case': [2, 'always', 'pascal-case'],
|
|
4
|
+
'type-enum': [2, 'always', ['breaking', 'feature', 'fix', 'other']],
|
|
6
5
|
'subject-case': [2, 'always', 'sentence-case']
|
|
7
6
|
},
|
|
8
7
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import Client from './lib/client';
|
|
2
|
+
import { InputFormData } from './lib/interfaces/IFormData';
|
|
2
3
|
import Options from './lib/interfaces/Options';
|
|
3
|
-
import IFormData from './lib/interfaces/IFormData';
|
|
4
4
|
declare class Mailgun {
|
|
5
5
|
private formData;
|
|
6
|
-
constructor(FormData:
|
|
6
|
+
constructor(FormData: InputFormData);
|
|
7
7
|
client(options: Options): Client;
|
|
8
8
|
}
|
|
9
9
|
export = Mailgun;
|
package/dist/lib/client.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ import ParseClient from './parse';
|
|
|
12
12
|
import IpsClient from './ips';
|
|
13
13
|
import IpPoolsClient from './ip-pools';
|
|
14
14
|
import ListsClient from './lists';
|
|
15
|
-
import
|
|
15
|
+
import { InputFormData } from './interfaces/IFormData';
|
|
16
16
|
export default class Client {
|
|
17
17
|
private request;
|
|
18
18
|
domains: DomainClient;
|
|
@@ -28,5 +28,5 @@ export default class Client {
|
|
|
28
28
|
ips: IpsClient;
|
|
29
29
|
ip_pools: IpPoolsClient;
|
|
30
30
|
lists: ListsClient;
|
|
31
|
-
constructor(options: Options, formData:
|
|
31
|
+
constructor(options: Options, formData: InputFormData);
|
|
32
32
|
}
|
package/dist/lib/events.d.ts
CHANGED
|
@@ -1,29 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import { EventsList, EventsPage, EventsResponse, PagesList } from './interfaces/Events';
|
|
2
|
+
import Request from './request';
|
|
2
3
|
export default class EventClient {
|
|
3
|
-
request:
|
|
4
|
-
constructor(request:
|
|
4
|
+
request: Request;
|
|
5
|
+
constructor(request: Request);
|
|
5
6
|
_parsePageNumber(url: string): string;
|
|
6
|
-
_parsePage(id: string, url: string):
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
url: string;
|
|
10
|
-
};
|
|
11
|
-
_parsePageLinks(response: {
|
|
12
|
-
body: {
|
|
13
|
-
paging: any;
|
|
14
|
-
};
|
|
15
|
-
}): any;
|
|
16
|
-
_parseEventList(response: {
|
|
17
|
-
body: {
|
|
18
|
-
items: any;
|
|
19
|
-
paging: any;
|
|
20
|
-
};
|
|
21
|
-
}): {
|
|
22
|
-
items: any;
|
|
23
|
-
pages: any;
|
|
24
|
-
};
|
|
7
|
+
_parsePage(id: string, url: string): EventsPage;
|
|
8
|
+
_parsePageLinks(response: EventsResponse): PagesList;
|
|
9
|
+
_parseEventList(response: EventsResponse): EventsList;
|
|
25
10
|
get(domain: string, query: {
|
|
26
|
-
page:
|
|
27
|
-
}):
|
|
11
|
+
page: string;
|
|
12
|
+
}): Promise<EventsList>;
|
|
28
13
|
}
|
|
29
|
-
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface EventsPage {
|
|
2
|
+
id: string;
|
|
3
|
+
number: string;
|
|
4
|
+
url: string;
|
|
5
|
+
}
|
|
6
|
+
export interface PagesList {
|
|
7
|
+
previous: string;
|
|
8
|
+
first: string;
|
|
9
|
+
last: string;
|
|
10
|
+
next: string;
|
|
11
|
+
}
|
|
12
|
+
export interface EventsResponse {
|
|
13
|
+
body: {
|
|
14
|
+
items: [];
|
|
15
|
+
paging: PagesList;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export interface EventsList {
|
|
19
|
+
items: [];
|
|
20
|
+
pages: PagesList;
|
|
21
|
+
}
|
|
22
|
+
export interface PagesListAccumulator {
|
|
23
|
+
[index: string]: EventsPage;
|
|
24
|
+
}
|
|
@@ -1,15 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import NodeFormData from 'form-data';
|
|
2
|
+
export interface IFormDataOptions {
|
|
2
3
|
[key: string]: any;
|
|
3
4
|
}
|
|
4
|
-
interface
|
|
5
|
-
|
|
6
|
-
knownLength?: number;
|
|
7
|
-
filename?: string;
|
|
8
|
-
filepath?: string;
|
|
9
|
-
contentType?: string;
|
|
5
|
+
export interface InputFormData {
|
|
6
|
+
new (options?: HTMLFormElement | IFormDataOptions): NodeFormData | FormData;
|
|
10
7
|
}
|
|
11
|
-
export default abstract class IFormData {
|
|
12
|
-
constructor();
|
|
13
|
-
abstract append(key: string, value: any, options?: AppendOptions | string): void;
|
|
14
|
-
}
|
|
15
|
-
export {};
|
|
@@ -5,3 +5,15 @@ export interface IpPool {
|
|
|
5
5
|
name: string;
|
|
6
6
|
pool_id: string;
|
|
7
7
|
}
|
|
8
|
+
export interface IpPoolListResponse {
|
|
9
|
+
body: {
|
|
10
|
+
ip_pools: IpPool;
|
|
11
|
+
message: string;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export interface IpPoolUpdateData {
|
|
15
|
+
name: string;
|
|
16
|
+
description: string;
|
|
17
|
+
add_ip: string;
|
|
18
|
+
remove_ip: string;
|
|
19
|
+
}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { MailingList } from './lists';
|
|
2
|
+
export interface MailListMember {
|
|
3
|
+
address: string;
|
|
4
|
+
name: string;
|
|
5
|
+
subscribed: boolean;
|
|
6
|
+
vars: string | any;
|
|
7
|
+
}
|
|
2
8
|
export interface MailListMembersQuery {
|
|
3
9
|
subscribed?: 'yes' | 'no';
|
|
4
10
|
limit?: number;
|
|
@@ -25,12 +31,6 @@ export interface CreateUpdateMailListMembersReq {
|
|
|
25
31
|
subscribed?: 'yes' | 'no' | boolean;
|
|
26
32
|
upsert?: 'yes' | 'no';
|
|
27
33
|
}
|
|
28
|
-
export interface MailListMember {
|
|
29
|
-
address: string;
|
|
30
|
-
name: string;
|
|
31
|
-
subscribed: boolean;
|
|
32
|
-
vars: string | any;
|
|
33
|
-
}
|
|
34
34
|
export interface DeletedMember {
|
|
35
35
|
member: {
|
|
36
36
|
address: string;
|
package/dist/lib/ip-pools.d.ts
CHANGED
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
import { IpPool } from
|
|
1
|
+
import Request from './request';
|
|
2
|
+
import { IpPool, IpPoolUpdateData } from './interfaces/IpPools';
|
|
3
3
|
export default class IpPoolsClient {
|
|
4
|
-
request:
|
|
5
|
-
constructor(request:
|
|
6
|
-
list(query: any): IpPool[]
|
|
4
|
+
request: Request;
|
|
5
|
+
constructor(request: Request);
|
|
6
|
+
list(query: any): Promise<IpPool[]>;
|
|
7
7
|
create(data: {
|
|
8
8
|
name: string;
|
|
9
9
|
description?: string;
|
|
10
10
|
ips?: string[];
|
|
11
|
-
}):
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
remove_ip: string;
|
|
17
|
-
}): any;
|
|
11
|
+
}): Promise<{
|
|
12
|
+
message: string;
|
|
13
|
+
pool_id: string;
|
|
14
|
+
}>;
|
|
15
|
+
update(poolId: string, data: IpPoolUpdateData): Promise<any>;
|
|
18
16
|
delete(poolId: string, data: {
|
|
19
17
|
id: string;
|
|
20
18
|
pool_id: string;
|
|
21
|
-
}): any
|
|
19
|
+
}): Promise<any>;
|
|
22
20
|
private parseIpPoolsResponse;
|
|
23
21
|
}
|
|
24
|
-
export {};
|
package/dist/lib/ips.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import MgRequest from './request';
|
|
2
|
+
import { IpData, IpsListResponseBody } from './interfaces/Ips';
|
|
2
3
|
export default class IpsClient {
|
|
3
|
-
request:
|
|
4
|
-
constructor(request:
|
|
5
|
-
list(query: any):
|
|
6
|
-
get(ip: string):
|
|
4
|
+
request: MgRequest;
|
|
5
|
+
constructor(request: MgRequest);
|
|
6
|
+
list(query: any): Promise<IpsListResponseBody | IpData>;
|
|
7
|
+
get(ip: string): Promise<IpsListResponseBody | IpData>;
|
|
7
8
|
private parseIpsResponse;
|
|
8
9
|
}
|
|
9
|
-
export {};
|
package/dist/lib/messages.d.ts
CHANGED
package/dist/lib/request.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import NodeFormData from 'form-data';
|
|
1
2
|
import RequestOptions from './interfaces/RequestOptions';
|
|
2
|
-
import
|
|
3
|
+
import { InputFormData } from './interfaces/IFormData';
|
|
3
4
|
import APIResponse from './interfaces/ApiResponse';
|
|
4
5
|
declare class Request {
|
|
5
6
|
private username;
|
|
@@ -8,7 +9,7 @@ declare class Request {
|
|
|
8
9
|
private timeout;
|
|
9
10
|
private headers;
|
|
10
11
|
private formData;
|
|
11
|
-
constructor(options: RequestOptions, formData:
|
|
12
|
+
constructor(options: RequestOptions, formData: InputFormData);
|
|
12
13
|
request(method: string, url: string, inputOptions?: any): Promise<APIResponse>;
|
|
13
14
|
query(method: string, url: string, query: any, options?: any): Promise<APIResponse>;
|
|
14
15
|
command(method: string, url: string, data: any, options?: any): Promise<APIResponse>;
|
|
@@ -18,7 +19,7 @@ declare class Request {
|
|
|
18
19
|
post(url: string, data: any, options?: any): Promise<APIResponse>;
|
|
19
20
|
postWithFD(url: string, data: any): Promise<APIResponse>;
|
|
20
21
|
putWithFD(url: string, data: any): Promise<APIResponse>;
|
|
21
|
-
createFormData(data: any):
|
|
22
|
+
createFormData(data: any): NodeFormData | FormData;
|
|
22
23
|
put(url: string, data: any, options?: any): Promise<APIResponse>;
|
|
23
24
|
patch(url: string, data: any, options?: any): Promise<APIResponse>;
|
|
24
25
|
delete(url: string, data?: any, options?: any): Promise<APIResponse>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import Request from './request';
|
|
2
2
|
import { BounceData, ComplaintData, UnsubscribeData } from './interfaces/Supressions';
|
|
3
|
-
declare type TModel = typeof Bounce | typeof Complaint | typeof Unsubscribe;
|
|
4
3
|
declare class Bounce {
|
|
5
4
|
type: string;
|
|
6
5
|
address: string;
|
|
@@ -22,6 +21,7 @@ declare class Unsubscribe {
|
|
|
22
21
|
created_at: Date;
|
|
23
22
|
constructor(data: UnsubscribeData);
|
|
24
23
|
}
|
|
24
|
+
declare type TModel = typeof Bounce | typeof Complaint | typeof Unsubscribe;
|
|
25
25
|
export default class SuppressionClient {
|
|
26
26
|
request: any;
|
|
27
27
|
models: {
|