mailgun.js 5.0.0 → 5.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 +7 -0
- package/dist/mailgun.js.d.ts +79 -20
- 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/domains.ts +1 -1
- package/lib/events.ts +4 -4
- package/lib/interfaces/Supressions.ts +61 -0
- package/lib/interfaces/Webhooks.ts +10 -0
- package/lib/stats.ts +3 -3
- package/lib/suppressions.ts +39 -18
- package/lib/webhooks.ts +7 -4
- package/package.json +1 -1
- package/tsconfig.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
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.1](https://github.com/mailgun/mailgun.js/compare/v5.0.0...v5.0.1) (2022-02-23)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* Resolve ts strict mode issues ([473f6a2](https://github.com/mailgun/mailgun.js/commits/473f6a2909bfa72e9d779d1233485767eac6f323))
|
|
11
|
+
|
|
5
12
|
## [5.0.0](https://github.com/mailgun/mailgun.js/compare/v4.2.2...v5.0.0) (2022-02-23)
|
|
6
13
|
|
|
7
14
|
|
package/dist/mailgun.js.d.ts
CHANGED
|
@@ -155,8 +155,8 @@ 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, UnsubscribeData, WhiteListData } from 'mailgun.js/interfaces/Supressions';
|
|
159
|
-
class Bounce {
|
|
158
|
+
import { BounceData, ComplaintData, IBounce, IComplaint, IUnsubscribe, IWhiteList, ParsedPage, ParsedPagesList, SuppressionList, SuppressionModels, UnsubscribeData, WhiteListData } from 'mailgun.js/interfaces/Supressions';
|
|
159
|
+
class Bounce implements IBounce {
|
|
160
160
|
type: string;
|
|
161
161
|
address: string;
|
|
162
162
|
code: number;
|
|
@@ -164,20 +164,20 @@ declare module 'mailgun.js/suppressions' {
|
|
|
164
164
|
created_at: Date;
|
|
165
165
|
constructor(data: BounceData);
|
|
166
166
|
}
|
|
167
|
-
class Complaint {
|
|
167
|
+
class Complaint implements IComplaint {
|
|
168
168
|
type: string;
|
|
169
169
|
address: any;
|
|
170
170
|
created_at: Date;
|
|
171
171
|
constructor(data: ComplaintData);
|
|
172
172
|
}
|
|
173
|
-
class Unsubscribe {
|
|
173
|
+
class Unsubscribe implements IUnsubscribe {
|
|
174
174
|
type: string;
|
|
175
175
|
address: string;
|
|
176
176
|
tags: any;
|
|
177
177
|
created_at: Date;
|
|
178
178
|
constructor(data: UnsubscribeData);
|
|
179
179
|
}
|
|
180
|
-
class WhiteList {
|
|
180
|
+
class WhiteList implements IWhiteList {
|
|
181
181
|
type: string;
|
|
182
182
|
value: string;
|
|
183
183
|
reason: string;
|
|
@@ -194,28 +194,23 @@ declare module 'mailgun.js/suppressions' {
|
|
|
194
194
|
whitelists: typeof WhiteList;
|
|
195
195
|
};
|
|
196
196
|
constructor(request: Request);
|
|
197
|
-
_parsePage(id: string, pageUrl: string):
|
|
198
|
-
id: string;
|
|
199
|
-
page: string | string[];
|
|
200
|
-
address: string | string[];
|
|
201
|
-
url: string;
|
|
202
|
-
};
|
|
197
|
+
_parsePage(id: string, pageUrl: string): ParsedPage;
|
|
203
198
|
_parsePageLinks(response: {
|
|
204
199
|
body: {
|
|
205
200
|
paging: any;
|
|
206
201
|
};
|
|
207
|
-
}):
|
|
202
|
+
}): ParsedPagesList;
|
|
208
203
|
_parseList(response: {
|
|
209
204
|
body: {
|
|
210
205
|
items: any;
|
|
211
206
|
paging: any;
|
|
212
207
|
};
|
|
213
|
-
}, Model: TModel):
|
|
208
|
+
}, Model: TModel): SuppressionList;
|
|
214
209
|
_parseItem(response: {
|
|
215
210
|
body: any;
|
|
216
|
-
}, Model: TModel):
|
|
217
|
-
list(domain: string, type:
|
|
218
|
-
get(domain: string, type:
|
|
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>;
|
|
219
214
|
create(domain: string, type: string, data: any): any;
|
|
220
215
|
destroy(domain: string, type: string, address: string): any;
|
|
221
216
|
}
|
|
@@ -223,12 +218,12 @@ declare module 'mailgun.js/suppressions' {
|
|
|
223
218
|
}
|
|
224
219
|
|
|
225
220
|
declare module 'mailgun.js/webhooks' {
|
|
226
|
-
import { ValidationResponse, WebhookList, WebhookResponse, WebhooksQuery } from 'mailgun.js/interfaces/Webhooks';
|
|
221
|
+
import { ValidationResponse, WebhookList, WebhookResponse, WebhooksIds, WebhooksQuery } from 'mailgun.js/interfaces/Webhooks';
|
|
227
222
|
import Request from 'mailgun.js/request';
|
|
228
223
|
class Webhook {
|
|
229
224
|
id: string;
|
|
230
|
-
url: string;
|
|
231
|
-
constructor(id: string, url: string);
|
|
225
|
+
url: string | undefined;
|
|
226
|
+
constructor(id: string, url: string | undefined);
|
|
232
227
|
}
|
|
233
228
|
export default class WebhookClient {
|
|
234
229
|
request: Request;
|
|
@@ -249,7 +244,7 @@ declare module 'mailgun.js/webhooks' {
|
|
|
249
244
|
message: string;
|
|
250
245
|
};
|
|
251
246
|
list(domain: string, query: WebhooksQuery): Promise<WebhookList>;
|
|
252
|
-
get(domain: string, id:
|
|
247
|
+
get(domain: string, id: WebhooksIds): Promise<Webhook>;
|
|
253
248
|
create(domain: string, id: string, url: string, test?: boolean): Promise<Webhook | ValidationResponse>;
|
|
254
249
|
update(domain: string, id: string, url: string): Promise<Webhook>;
|
|
255
250
|
destroy(domain: string, id: string): Promise<Webhook>;
|
|
@@ -1253,6 +1248,61 @@ declare module 'mailgun.js/interfaces/Supressions' {
|
|
|
1253
1248
|
reason: string;
|
|
1254
1249
|
createdAt: string | Date;
|
|
1255
1250
|
}
|
|
1251
|
+
export interface IBounce {
|
|
1252
|
+
type: string;
|
|
1253
|
+
address: string;
|
|
1254
|
+
code: number;
|
|
1255
|
+
error: string;
|
|
1256
|
+
created_at: Date;
|
|
1257
|
+
}
|
|
1258
|
+
export interface IComplaint {
|
|
1259
|
+
type: string;
|
|
1260
|
+
address: any;
|
|
1261
|
+
created_at: Date;
|
|
1262
|
+
}
|
|
1263
|
+
export interface IUnsubscribe {
|
|
1264
|
+
type: string;
|
|
1265
|
+
address: string;
|
|
1266
|
+
tags: any;
|
|
1267
|
+
created_at: Date;
|
|
1268
|
+
}
|
|
1269
|
+
export interface IWhiteList {
|
|
1270
|
+
type: string;
|
|
1271
|
+
value: string;
|
|
1272
|
+
reason: string;
|
|
1273
|
+
createdAt: Date;
|
|
1274
|
+
}
|
|
1275
|
+
export interface ParsedPage {
|
|
1276
|
+
id: string;
|
|
1277
|
+
page: string | undefined;
|
|
1278
|
+
address: string | undefined;
|
|
1279
|
+
url: string;
|
|
1280
|
+
}
|
|
1281
|
+
export interface ParsedPagesList {
|
|
1282
|
+
previous: ParsedPage;
|
|
1283
|
+
first: ParsedPage;
|
|
1284
|
+
last: ParsedPage;
|
|
1285
|
+
next: ParsedPage;
|
|
1286
|
+
}
|
|
1287
|
+
export interface SuppressionList {
|
|
1288
|
+
items: IBounce[] | IComplaint[] | IUnsubscribe[] | IWhiteList[];
|
|
1289
|
+
pages: ParsedPagesList;
|
|
1290
|
+
}
|
|
1291
|
+
export interface PagesList {
|
|
1292
|
+
previous: string;
|
|
1293
|
+
first: string;
|
|
1294
|
+
last: string;
|
|
1295
|
+
next: string;
|
|
1296
|
+
}
|
|
1297
|
+
export enum SuppressionModels {
|
|
1298
|
+
BOUNCES = "bounces",
|
|
1299
|
+
COMPLAINTS = "complaints",
|
|
1300
|
+
UNSUBSCRIBES = "unsubscribes",
|
|
1301
|
+
WHITELISTS = "whitelists"
|
|
1302
|
+
}
|
|
1303
|
+
export interface PagesListAccumulator {
|
|
1304
|
+
[index: string]: ParsedPage;
|
|
1305
|
+
}
|
|
1256
1306
|
}
|
|
1257
1307
|
|
|
1258
1308
|
declare module 'mailgun.js/interfaces/Webhooks' {
|
|
@@ -1281,6 +1331,15 @@ declare module 'mailgun.js/interfaces/Webhooks' {
|
|
|
1281
1331
|
code: number;
|
|
1282
1332
|
message: string;
|
|
1283
1333
|
}
|
|
1334
|
+
export enum WebhooksIds {
|
|
1335
|
+
CLICKED = "clicked",
|
|
1336
|
+
COMPLAINED = "complained",
|
|
1337
|
+
DELIVERED = "delivered",
|
|
1338
|
+
OPENED = "opened",
|
|
1339
|
+
PERMANENT_FAIL = "permanent_fail",
|
|
1340
|
+
TEMPORARY_FAIL = "temporary_fail",
|
|
1341
|
+
UNSUBSCRIBED = "unsubscribe"
|
|
1342
|
+
}
|
|
1284
1343
|
}
|
|
1285
1344
|
|
|
1286
1345
|
declare module 'mailgun.js/interfaces/routes' {
|