mailgun.js 5.0.2 → 5.0.3
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 +1 -1
- package/CHANGELOG.md +15 -0
- package/dist/mailgun.js.d.ts +86 -73
- 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 -3
- package/examples/send-email.js +1 -1
- package/lib/index.ts +2 -3
- package/lib/interfaces/DomainTags.ts +0 -1
- package/lib/interfaces/DomainTemplates.ts +1 -1
- package/lib/interfaces/Domains.ts +4 -4
- package/lib/interfaces/IFormData.ts +1 -1
- package/lib/interfaces/Supressions.ts +65 -28
- package/lib/request.ts +2 -2
- package/lib/suppressions.ts +118 -63
- package/package.json +3 -4
- package/test/suppressions.test.ts +94 -10
- package/webpack/webpack.common.config.js +0 -1
- package/webpack/webpack.dev.config.js +10 -2
- package/webpack/webpack.release.config.js +10 -2
package/.eslintrc
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,21 @@
|
|
|
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
|
+
### [5.0.3](https://github.com/mailgun/mailgun.js/compare/v5.0.2...v5.0.3) (2022-03-23)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* Remove deprecated url package ([406eb56](https://github.com/mailgun/mailgun.js/commits/406eb56916bd52ca8e3d9b1ffacf419d42db5a86))
|
|
11
|
+
* TypeError -> mailgun_js_1.default is not a constructor ([ff91333](https://github.com/mailgun/mailgun.js/commits/ff91333c3f34434c54e993da62a61dc38d6196f4))
|
|
12
|
+
* Update DomainsQuery interface for mg.domains.list ([b55eb52](https://github.com/mailgun/mailgun.js/commits/b55eb52c18eb6d81dd3e6fcb991a8b7b5a75a4ab))
|
|
13
|
+
* Update get method in Domain templates client interface to have an optional parameter ([12868a8](https://github.com/mailgun/mailgun.js/commits/12868a88e5465d4f3dcb3e3797522c7b4fc552a0))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Other changes
|
|
17
|
+
|
|
18
|
+
* Update webpack release config ([240038a](https://github.com/mailgun/mailgun.js/commits/240038a180eb0ad6a704bf24ed01e3c241bef5d5))
|
|
19
|
+
|
|
5
20
|
### [5.0.2](https://github.com/mailgun/mailgun.js/compare/v5.0.1...v5.0.2) (2022-03-14)
|
|
6
21
|
|
|
7
22
|
|
package/dist/mailgun.js.d.ts
CHANGED
|
@@ -6,11 +6,11 @@ declare module 'mailgun.js' {
|
|
|
6
6
|
import Client from 'mailgun.js/client';
|
|
7
7
|
import { InputFormData } from 'mailgun.js/interfaces/IFormData';
|
|
8
8
|
import Options from 'mailgun.js/interfaces/Options';
|
|
9
|
-
class Mailgun {
|
|
9
|
+
export default class Mailgun {
|
|
10
|
+
static get default(): typeof Mailgun;
|
|
10
11
|
constructor(FormData: InputFormData);
|
|
11
12
|
client(options: Options): Client;
|
|
12
13
|
}
|
|
13
|
-
export = Mailgun;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
declare module 'mailgun.js/client' {
|
|
@@ -44,7 +44,7 @@ declare module 'mailgun.js/client' {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
declare module 'mailgun.js/interfaces/IFormData' {
|
|
47
|
-
import NodeFormData from 'form-data';
|
|
47
|
+
import * as NodeFormData from 'form-data';
|
|
48
48
|
export interface IFormDataOptions {
|
|
49
49
|
[key: string]: any;
|
|
50
50
|
}
|
|
@@ -155,66 +155,52 @@ declare module 'mailgun.js/stats' {
|
|
|
155
155
|
|
|
156
156
|
declare module 'mailgun.js/suppressions' {
|
|
157
157
|
import Request from 'mailgun.js/request';
|
|
158
|
-
import { BounceData, ComplaintData,
|
|
159
|
-
class
|
|
158
|
+
import { BounceData, ComplaintData, ParsedPage, ParsedPagesList, SuppressionCreationData, SuppressionCreationResult, SuppressionDestroyResult, SuppressionList, SuppressionListQuery, SuppressionListResponse, SuppressionModels, UnsubscribeData, WhiteListData } from 'mailgun.js/interfaces/Supressions';
|
|
159
|
+
export class Suppression {
|
|
160
160
|
type: string;
|
|
161
|
+
constructor(type: SuppressionModels);
|
|
162
|
+
}
|
|
163
|
+
export class Bounce extends Suppression {
|
|
161
164
|
address: string;
|
|
162
165
|
code: number;
|
|
163
166
|
error: string;
|
|
164
167
|
created_at: Date;
|
|
165
168
|
constructor(data: BounceData);
|
|
166
169
|
}
|
|
167
|
-
class Complaint
|
|
168
|
-
|
|
169
|
-
address: any;
|
|
170
|
+
export class Complaint extends Suppression {
|
|
171
|
+
address: string | undefined;
|
|
170
172
|
created_at: Date;
|
|
171
173
|
constructor(data: ComplaintData);
|
|
172
174
|
}
|
|
173
|
-
class Unsubscribe
|
|
174
|
-
type: string;
|
|
175
|
+
export class Unsubscribe extends Suppression {
|
|
175
176
|
address: string;
|
|
176
|
-
tags:
|
|
177
|
+
tags: string[];
|
|
177
178
|
created_at: Date;
|
|
178
179
|
constructor(data: UnsubscribeData);
|
|
179
180
|
}
|
|
180
|
-
class WhiteList
|
|
181
|
-
type: string;
|
|
181
|
+
export class WhiteList extends Suppression {
|
|
182
182
|
value: string;
|
|
183
183
|
reason: string;
|
|
184
184
|
createdAt: Date;
|
|
185
185
|
constructor(data: WhiteListData);
|
|
186
186
|
}
|
|
187
|
-
type TModel = typeof Bounce | typeof Complaint | typeof Unsubscribe | typeof WhiteList;
|
|
188
187
|
export default class SuppressionClient {
|
|
189
|
-
request:
|
|
190
|
-
models:
|
|
191
|
-
bounces: typeof Bounce;
|
|
192
|
-
complaints: typeof Complaint;
|
|
193
|
-
unsubscribes: typeof Unsubscribe;
|
|
194
|
-
whitelists: typeof WhiteList;
|
|
195
|
-
};
|
|
188
|
+
request: Request;
|
|
189
|
+
models: Map<string, any>;
|
|
196
190
|
constructor(request: Request);
|
|
197
191
|
_parsePage(id: string, pageUrl: string): ParsedPage;
|
|
198
|
-
_parsePageLinks(response:
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
_parseItem(response: {
|
|
210
|
-
body: any;
|
|
211
|
-
}, Model: TModel): IBounce | IComplaint | IUnsubscribe | IWhiteList;
|
|
212
|
-
list(domain: string, type: SuppressionModels, query: any): Promise<SuppressionList>;
|
|
213
|
-
get(domain: string, type: SuppressionModels, address: string): Promise<IBounce | IComplaint | IUnsubscribe | IWhiteList>;
|
|
214
|
-
create(domain: string, type: string, data: any): any;
|
|
215
|
-
destroy(domain: string, type: string, address: string): any;
|
|
192
|
+
_parsePageLinks(response: SuppressionListResponse): ParsedPagesList;
|
|
193
|
+
_parseList(response: SuppressionListResponse, Model: {
|
|
194
|
+
new (data: BounceData | ComplaintData | UnsubscribeData | WhiteListData): Bounce | Complaint | Unsubscribe | WhiteList;
|
|
195
|
+
}): SuppressionList;
|
|
196
|
+
_parseItem<T extends Suppression>(data: BounceData | ComplaintData | UnsubscribeData | WhiteListData, Model: {
|
|
197
|
+
new (data: BounceData | ComplaintData | UnsubscribeData | WhiteListData): T;
|
|
198
|
+
}): T;
|
|
199
|
+
list(domain: string, type: string, query?: SuppressionListQuery): Promise<SuppressionList>;
|
|
200
|
+
get(domain: string, type: string, address: string): Promise<Bounce | Complaint | Unsubscribe | WhiteList>;
|
|
201
|
+
create(domain: string, type: string, data: SuppressionCreationData | SuppressionCreationData[]): Promise<SuppressionCreationResult>;
|
|
202
|
+
destroy(domain: string, type: string, address: string): Promise<SuppressionDestroyResult>;
|
|
216
203
|
}
|
|
217
|
-
export {};
|
|
218
204
|
}
|
|
219
205
|
|
|
220
206
|
declare module 'mailgun.js/webhooks' {
|
|
@@ -343,10 +329,10 @@ declare module 'mailgun.js/lists' {
|
|
|
343
329
|
|
|
344
330
|
declare module 'mailgun.js/interfaces/Domains' {
|
|
345
331
|
export interface DomainsQuery {
|
|
346
|
-
authority
|
|
347
|
-
state
|
|
348
|
-
limit
|
|
349
|
-
skip
|
|
332
|
+
authority?: string;
|
|
333
|
+
state?: 'active' | 'unverified' | 'disabled';
|
|
334
|
+
limit?: number;
|
|
335
|
+
skip?: number;
|
|
350
336
|
}
|
|
351
337
|
export interface DomainInfo {
|
|
352
338
|
name: string;
|
|
@@ -474,7 +460,7 @@ declare module 'mailgun.js/interfaces/ApiResponse' {
|
|
|
474
460
|
}
|
|
475
461
|
|
|
476
462
|
declare module 'mailgun.js/request' {
|
|
477
|
-
import NodeFormData from 'form-data';
|
|
463
|
+
import * as NodeFormData from 'form-data';
|
|
478
464
|
import RequestOptions from 'mailgun.js/interfaces/RequestOptions';
|
|
479
465
|
import { InputFormData } from 'mailgun.js/interfaces/IFormData';
|
|
480
466
|
import APIResponse from 'mailgun.js/interfaces/ApiResponse';
|
|
@@ -788,7 +774,7 @@ declare module 'mailgun.js/interfaces/DomainTemplates' {
|
|
|
788
774
|
}
|
|
789
775
|
export interface IDomainTemplatesClient {
|
|
790
776
|
list(domain: string, query?: DomainTemplatesQuery): Promise<ListDomainTemplatesResult>;
|
|
791
|
-
get(domain: string, templateName: string, query
|
|
777
|
+
get(domain: string, templateName: string, query?: TemplateQuery): Promise<DomainTemplateItem>;
|
|
792
778
|
create(domain: string, data: DomainTemplateData): Promise<DomainTemplateItem>;
|
|
793
779
|
update(domain: string, templateName: string, data: DomainTemplateUpdateData): Promise<UpdateOrDeleteDomainTemplateResult>;
|
|
794
780
|
destroy(domain: string, templateName: string): Promise<UpdateOrDeleteDomainTemplateResult>;
|
|
@@ -1228,6 +1214,7 @@ declare module 'mailgun.js/interfaces/StatsOptions' {
|
|
|
1228
1214
|
}
|
|
1229
1215
|
|
|
1230
1216
|
declare module 'mailgun.js/interfaces/Supressions' {
|
|
1217
|
+
import { Bounce, Complaint, Unsubscribe, WhiteList } from 'mailgun.js/suppressions';
|
|
1231
1218
|
export interface BounceData {
|
|
1232
1219
|
address: string;
|
|
1233
1220
|
code: number;
|
|
@@ -1249,34 +1236,10 @@ declare module 'mailgun.js/interfaces/Supressions' {
|
|
|
1249
1236
|
reason: string;
|
|
1250
1237
|
createdAt: string | Date;
|
|
1251
1238
|
}
|
|
1252
|
-
export interface IBounce {
|
|
1253
|
-
type: string;
|
|
1254
|
-
address: string;
|
|
1255
|
-
code: number;
|
|
1256
|
-
error: string;
|
|
1257
|
-
created_at: Date;
|
|
1258
|
-
}
|
|
1259
|
-
export interface IComplaint {
|
|
1260
|
-
type: string;
|
|
1261
|
-
address: any;
|
|
1262
|
-
created_at: Date;
|
|
1263
|
-
}
|
|
1264
|
-
export interface IUnsubscribe {
|
|
1265
|
-
type: string;
|
|
1266
|
-
address: string;
|
|
1267
|
-
tags: any;
|
|
1268
|
-
created_at: Date;
|
|
1269
|
-
}
|
|
1270
|
-
export interface IWhiteList {
|
|
1271
|
-
type: string;
|
|
1272
|
-
value: string;
|
|
1273
|
-
reason: string;
|
|
1274
|
-
createdAt: Date;
|
|
1275
|
-
}
|
|
1276
1239
|
export interface ParsedPage {
|
|
1277
1240
|
id: string;
|
|
1278
|
-
page: string | undefined;
|
|
1279
|
-
address: string | undefined;
|
|
1241
|
+
page: string | null | undefined;
|
|
1242
|
+
address: string | null | undefined;
|
|
1280
1243
|
url: string;
|
|
1281
1244
|
}
|
|
1282
1245
|
export interface ParsedPagesList {
|
|
@@ -1286,7 +1249,7 @@ declare module 'mailgun.js/interfaces/Supressions' {
|
|
|
1286
1249
|
next: ParsedPage;
|
|
1287
1250
|
}
|
|
1288
1251
|
export interface SuppressionList {
|
|
1289
|
-
items:
|
|
1252
|
+
items: (Bounce | Complaint | Unsubscribe | WhiteList)[];
|
|
1290
1253
|
pages: ParsedPagesList;
|
|
1291
1254
|
}
|
|
1292
1255
|
export interface PagesList {
|
|
@@ -1304,6 +1267,56 @@ declare module 'mailgun.js/interfaces/Supressions' {
|
|
|
1304
1267
|
export interface PagesListAccumulator {
|
|
1305
1268
|
[index: string]: ParsedPage;
|
|
1306
1269
|
}
|
|
1270
|
+
export interface SuppressionListQuery {
|
|
1271
|
+
limit?: number;
|
|
1272
|
+
}
|
|
1273
|
+
export interface SuppressionListResponse {
|
|
1274
|
+
body: {
|
|
1275
|
+
items: BounceData[] | ComplaintData[] | UnsubscribeData[] | WhiteListData[];
|
|
1276
|
+
paging: PagesList;
|
|
1277
|
+
};
|
|
1278
|
+
status: number;
|
|
1279
|
+
}
|
|
1280
|
+
export interface SuppressionResponse {
|
|
1281
|
+
body: BounceData | ComplaintData | UnsubscribeData | WhiteListData;
|
|
1282
|
+
status: number;
|
|
1283
|
+
}
|
|
1284
|
+
export interface SuppressionDestroyResponse {
|
|
1285
|
+
body: {
|
|
1286
|
+
message: string;
|
|
1287
|
+
value?: string;
|
|
1288
|
+
address?: string;
|
|
1289
|
+
};
|
|
1290
|
+
status: number;
|
|
1291
|
+
}
|
|
1292
|
+
export interface SuppressionDestroyResult {
|
|
1293
|
+
message: string;
|
|
1294
|
+
value: string;
|
|
1295
|
+
address: string;
|
|
1296
|
+
status: number;
|
|
1297
|
+
}
|
|
1298
|
+
export interface SuppressionCreationData {
|
|
1299
|
+
address: string;
|
|
1300
|
+
code?: number;
|
|
1301
|
+
error?: string;
|
|
1302
|
+
domain?: string;
|
|
1303
|
+
tag?: string;
|
|
1304
|
+
created_at?: string;
|
|
1305
|
+
}
|
|
1306
|
+
export interface SuppressionCreationResponse {
|
|
1307
|
+
body: {
|
|
1308
|
+
message: string;
|
|
1309
|
+
type?: string;
|
|
1310
|
+
value?: string;
|
|
1311
|
+
};
|
|
1312
|
+
status: number;
|
|
1313
|
+
}
|
|
1314
|
+
export interface SuppressionCreationResult {
|
|
1315
|
+
message: string;
|
|
1316
|
+
type: string;
|
|
1317
|
+
value: string;
|
|
1318
|
+
status: number;
|
|
1319
|
+
}
|
|
1307
1320
|
}
|
|
1308
1321
|
|
|
1309
1322
|
declare module 'mailgun.js/interfaces/Webhooks' {
|