Socket
Socket
Sign inDemoInstall

mailgun.js

Package Overview
Dependencies
Maintainers
7
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mailgun.js - npm Package Compare versions

Comparing version 5.0.2 to 5.0.3

15

CHANGELOG.md

@@ -5,2 +5,17 @@ # Changelog

### [5.0.3](https://github.com/mailgun/mailgun.js/compare/v5.0.2...v5.0.3) (2022-03-23)
### Bug Fixes
* Remove deprecated url package ([406eb56](https://github.com/mailgun/mailgun.js/commits/406eb56916bd52ca8e3d9b1ffacf419d42db5a86))
* TypeError -> mailgun_js_1.default is not a constructor ([ff91333](https://github.com/mailgun/mailgun.js/commits/ff91333c3f34434c54e993da62a61dc38d6196f4))
* Update DomainsQuery interface for mg.domains.list ([b55eb52](https://github.com/mailgun/mailgun.js/commits/b55eb52c18eb6d81dd3e6fcb991a8b7b5a75a4ab))
* Update get method in Domain templates client interface to have an optional parameter ([12868a8](https://github.com/mailgun/mailgun.js/commits/12868a88e5465d4f3dcb3e3797522c7b4fc552a0))
### Other changes
* Update webpack release config ([240038a](https://github.com/mailgun/mailgun.js/commits/240038a180eb0ad6a704bf24ed01e3c241bef5d5))
### [5.0.2](https://github.com/mailgun/mailgun.js/compare/v5.0.1...v5.0.2) (2022-03-14)

@@ -7,0 +22,0 @@

159

dist/mailgun.js.d.ts

@@ -9,7 +9,7 @@ // Generated by dts-bundle v0.7.3

import Options from 'mailgun.js/interfaces/Options';
class Mailgun {
export default class Mailgun {
static get default(): typeof Mailgun;
constructor(FormData: InputFormData);
client(options: Options): Client;
}
export = Mailgun;
}

@@ -48,3 +48,3 @@

declare module 'mailgun.js/interfaces/IFormData' {
import NodeFormData from 'form-data';
import * as NodeFormData from 'form-data';
export interface IFormDataOptions {

@@ -160,5 +160,8 @@ [key: string]: any;

import Request from 'mailgun.js/request';
import { BounceData, ComplaintData, IBounce, IComplaint, IUnsubscribe, IWhiteList, ParsedPage, ParsedPagesList, SuppressionList, SuppressionModels, UnsubscribeData, WhiteListData } from 'mailgun.js/interfaces/Supressions';
class Bounce implements IBounce {
import { BounceData, ComplaintData, ParsedPage, ParsedPagesList, SuppressionCreationData, SuppressionCreationResult, SuppressionDestroyResult, SuppressionList, SuppressionListQuery, SuppressionListResponse, SuppressionModels, UnsubscribeData, WhiteListData } from 'mailgun.js/interfaces/Supressions';
export class Suppression {
type: string;
constructor(type: SuppressionModels);
}
export class Bounce extends Suppression {
address: string;

@@ -170,17 +173,14 @@ code: number;

}
class Complaint implements IComplaint {
type: string;
address: any;
export class Complaint extends Suppression {
address: string | undefined;
created_at: Date;
constructor(data: ComplaintData);
}
class Unsubscribe implements IUnsubscribe {
type: string;
export class Unsubscribe extends Suppression {
address: string;
tags: any;
tags: string[];
created_at: Date;
constructor(data: UnsubscribeData);
}
class WhiteList implements IWhiteList {
type: string;
export class WhiteList extends Suppression {
value: string;

@@ -191,33 +191,19 @@ reason: string;

}
type TModel = typeof Bounce | typeof Complaint | typeof Unsubscribe | typeof WhiteList;
export default class SuppressionClient {
request: any;
models: {
bounces: typeof Bounce;
complaints: typeof Complaint;
unsubscribes: typeof Unsubscribe;
whitelists: typeof WhiteList;
};
request: Request;
models: Map<string, any>;
constructor(request: Request);
_parsePage(id: string, pageUrl: string): ParsedPage;
_parsePageLinks(response: {
body: {
paging: any;
};
}): ParsedPagesList;
_parseList(response: {
body: {
items: any;
paging: any;
};
}, Model: TModel): SuppressionList;
_parseItem(response: {
body: any;
}, Model: TModel): IBounce | IComplaint | IUnsubscribe | IWhiteList;
list(domain: string, type: SuppressionModels, query: any): Promise<SuppressionList>;
get(domain: string, type: SuppressionModels, address: string): Promise<IBounce | IComplaint | IUnsubscribe | IWhiteList>;
create(domain: string, type: string, data: any): any;
destroy(domain: string, type: string, address: string): any;
_parsePageLinks(response: SuppressionListResponse): ParsedPagesList;
_parseList(response: SuppressionListResponse, Model: {
new (data: BounceData | ComplaintData | UnsubscribeData | WhiteListData): Bounce | Complaint | Unsubscribe | WhiteList;
}): SuppressionList;
_parseItem<T extends Suppression>(data: BounceData | ComplaintData | UnsubscribeData | WhiteListData, Model: {
new (data: BounceData | ComplaintData | UnsubscribeData | WhiteListData): T;
}): T;
list(domain: string, type: string, query?: SuppressionListQuery): Promise<SuppressionList>;
get(domain: string, type: string, address: string): Promise<Bounce | Complaint | Unsubscribe | WhiteList>;
create(domain: string, type: string, data: SuppressionCreationData | SuppressionCreationData[]): Promise<SuppressionCreationResult>;
destroy(domain: string, type: string, address: string): Promise<SuppressionDestroyResult>;
}
export {};
}

@@ -351,6 +337,6 @@

export interface DomainsQuery {
authority: string;
state: 'active' | 'unverified' | 'disabled';
limit: number;
skip: number;
authority?: string;
state?: 'active' | 'unverified' | 'disabled';
limit?: number;
skip?: number;
}

@@ -483,3 +469,3 @@ export interface DomainInfo {

declare module 'mailgun.js/request' {
import NodeFormData from 'form-data';
import * as NodeFormData from 'form-data';
import RequestOptions from 'mailgun.js/interfaces/RequestOptions';

@@ -798,3 +784,3 @@ import { InputFormData } from 'mailgun.js/interfaces/IFormData';

list(domain: string, query?: DomainTemplatesQuery): Promise<ListDomainTemplatesResult>;
get(domain: string, templateName: string, query: TemplateQuery): Promise<DomainTemplateItem>;
get(domain: string, templateName: string, query?: TemplateQuery): Promise<DomainTemplateItem>;
create(domain: string, data: DomainTemplateData): Promise<DomainTemplateItem>;

@@ -1239,2 +1225,3 @@ update(domain: string, templateName: string, data: DomainTemplateUpdateData): Promise<UpdateOrDeleteDomainTemplateResult>;

declare module 'mailgun.js/interfaces/Supressions' {
import { Bounce, Complaint, Unsubscribe, WhiteList } from 'mailgun.js/suppressions';
export interface BounceData {

@@ -1261,30 +1248,6 @@ address: string;

}
export interface IBounce {
type: string;
address: string;
code: number;
error: string;
created_at: Date;
}
export interface IComplaint {
type: string;
address: any;
created_at: Date;
}
export interface IUnsubscribe {
type: string;
address: string;
tags: any;
created_at: Date;
}
export interface IWhiteList {
type: string;
value: string;
reason: string;
createdAt: Date;
}
export interface ParsedPage {
id: string;
page: string | undefined;
address: string | undefined;
page: string | null | undefined;
address: string | null | undefined;
url: string;

@@ -1299,3 +1262,3 @@ }

export interface SuppressionList {
items: IBounce[] | IComplaint[] | IUnsubscribe[] | IWhiteList[];
items: (Bounce | Complaint | Unsubscribe | WhiteList)[];
pages: ParsedPagesList;

@@ -1318,2 +1281,52 @@ }

}
export interface SuppressionListQuery {
limit?: number;
}
export interface SuppressionListResponse {
body: {
items: BounceData[] | ComplaintData[] | UnsubscribeData[] | WhiteListData[];
paging: PagesList;
};
status: number;
}
export interface SuppressionResponse {
body: BounceData | ComplaintData | UnsubscribeData | WhiteListData;
status: number;
}
export interface SuppressionDestroyResponse {
body: {
message: string;
value?: string;
address?: string;
};
status: number;
}
export interface SuppressionDestroyResult {
message: string;
value: string;
address: string;
status: number;
}
export interface SuppressionCreationData {
address: string;
code?: number;
error?: string;
domain?: string;
tag?: string;
created_at?: string;
}
export interface SuppressionCreationResponse {
body: {
message: string;
type?: string;
value?: string;
};
status: number;
}
export interface SuppressionCreationResult {
message: string;
type: string;
value: string;
status: number;
}
}

@@ -1320,0 +1333,0 @@

@@ -5,2 +5,2 @@ /*! MIT License © Sindre Sorhus */

/*! mailgun.js v5.0.1 */
/*! mailgun.js v5.0.2 */

@@ -5,4 +5,2 @@ /*! MIT License © Sindre Sorhus */

/*! https://mths.be/punycode v1.3.2 by @mathias */
/*! mailgun.js v5.0.1 */
/*! mailgun.js v5.0.2 */
/* eslint-disable no-console */
const fs = require('fs');
const mailgun = require('../index');
const mailgun = require('../lib/index');

@@ -5,0 +5,0 @@ const mg = mailgun.client({ username: 'api', key: process.env.MAILGUN_API_KEY || '', timeout: 60000 });

@@ -5,3 +5,4 @@ import Client from './client';

class Mailgun {
export default class Mailgun {
static get default(): typeof Mailgun { return this; }
private formData: InputFormData

@@ -17,3 +18,1 @@

}
export = Mailgun;
/* eslint-disable camelcase */
export interface DomainsQuery {
authority : string;
state: 'active' | 'unverified' | 'disabled';
limit: number;
skip: number;
authority? : string;
state?: 'active' | 'unverified' | 'disabled';
limit?: number;
skip?: number;
}

@@ -8,0 +8,0 @@

@@ -241,3 +241,2 @@ /* eslint-disable camelcase */

export interface IDomainTagsClient {

@@ -244,0 +243,0 @@ list(domain: string): Promise<DomainTagsList>

@@ -209,3 +209,3 @@ import { DomainTemplateItem } from '../domainsTemplates';

list(domain: string, query?: DomainTemplatesQuery): Promise<ListDomainTemplatesResult>
get(domain: string, templateName: string, query: TemplateQuery): Promise<DomainTemplateItem>
get(domain: string, templateName: string, query?: TemplateQuery): Promise<DomainTemplateItem>
create(domain: string, data: DomainTemplateData): Promise<DomainTemplateItem>

@@ -212,0 +212,0 @@ update(

@@ -1,2 +0,2 @@

import NodeFormData from 'form-data';
import * as NodeFormData from 'form-data';

@@ -3,0 +3,0 @@ export interface IFormDataOptions {

@@ -0,1 +1,5 @@

import {
Bounce, Complaint, Unsubscribe, WhiteList
} from '../suppressions';
/* eslint-disable camelcase */

@@ -27,31 +31,6 @@ export interface BounceData {

export interface IBounce {
type: string;
address: string;
code: number;
error: string;
created_at: Date;
}
export interface IComplaint {
type: string;
address: any;
created_at: Date;
}
export interface IUnsubscribe {
type: string;
address: string;
tags: any;
created_at: Date;
}
export interface IWhiteList {
type: string;
value: string;
reason: string;
createdAt: Date;
}
export interface ParsedPage {
id: string;
page: string | undefined;
address: string | undefined;
page: string | null | undefined;
address: string | null | undefined;
url: string

@@ -67,3 +46,3 @@ }

export interface SuppressionList {
items: IBounce[] | IComplaint[] | IUnsubscribe[] | IWhiteList[];
items: (Bounce | Complaint | Unsubscribe | WhiteList)[];
pages: ParsedPagesList;

@@ -89,1 +68,59 @@ }

}
export interface SuppressionListQuery {
limit?: number;
}
export interface SuppressionListResponse {
body: {
items: BounceData[] | ComplaintData[] | UnsubscribeData[] | WhiteListData[];
paging: PagesList;
}
status: number;
}
export interface SuppressionResponse {
body: BounceData | ComplaintData | UnsubscribeData | WhiteListData;
status: number;
}
export interface SuppressionDestroyResponse {
body: {
message: string;
value?: string;
address?: string;
}
status: number;
}
export interface SuppressionDestroyResult {
message: string;
value: string;
address: string;
status: number;
}
export interface SuppressionCreationData {
address: string;
code?: number;
error?: string;
domain?: string;
tag?: string;
created_at?: string ;
}
export interface SuppressionCreationResponse {
body:{
message:string;
type?: string;
value?: string;
}
status: number;
}
export interface SuppressionCreationResult {
message:string;
type: string;
value: string;
status: number;
}

@@ -1,3 +0,3 @@

import NodeFormData from 'form-data';
import base64 from 'base-64';
import * as NodeFormData from 'form-data';
import * as base64 from 'base-64';
import urljoin from 'url-join';

@@ -4,0 +4,0 @@ import ky from 'ky-universal';

/* eslint-disable camelcase */
import url from 'url';
import urljoin from 'url-join';

@@ -9,6 +8,2 @@

ComplaintData,
IBounce,
IComplaint,
IUnsubscribe,
IWhiteList,
PagesList,

@@ -18,7 +13,17 @@ PagesListAccumulator,

ParsedPagesList,
SuppressionCreationData,
SuppressionCreationResponse,
SuppressionCreationResult,
SuppressionDestroyResponse,
SuppressionDestroyResult,
SuppressionList,
SuppressionListQuery,
SuppressionListResponse,
SuppressionModels,
SuppressionResponse,
UnsubscribeData,
WhiteListData
WhiteListData,
} from './interfaces/Supressions';
import APIError from './error';
import APIErrorOptions from './interfaces/APIErrorOptions';

@@ -28,5 +33,9 @@ const createOptions = {

};
class Bounce implements IBounce {
export class Suppression {
type: string;
constructor(type: SuppressionModels) {
this.type = type;
}
}
export class Bounce extends Suppression {
address: string;

@@ -38,3 +47,3 @@ code: number;

constructor(data: BounceData) {
this.type = 'bounces';
super(SuppressionModels.BOUNCES);
this.address = data.address;

@@ -47,9 +56,8 @@ this.code = +data.code;

class Complaint implements IComplaint {
type: string;
address: any;
export class Complaint extends Suppression {
address: string | undefined;
created_at: Date;
constructor(data: ComplaintData) {
this.type = 'complaints';
super(SuppressionModels.COMPLAINTS);
this.address = data.address;

@@ -60,10 +68,9 @@ this.created_at = new Date(data.created_at);

class Unsubscribe implements IUnsubscribe {
type: string;
export class Unsubscribe extends Suppression {
address: string;
tags: any;
tags: string[];
created_at: Date;
constructor(data: UnsubscribeData) {
this.type = 'unsubscribes';
super(SuppressionModels.UNSUBSCRIBES);
this.address = data.address;

@@ -75,4 +82,3 @@ this.tags = data.tags;

class WhiteList implements IWhiteList {
type: string;
export class WhiteList extends Suppression {
value: string;

@@ -83,3 +89,3 @@ reason: string;

constructor(data: WhiteListData) {
this.type = 'whitelists';
super(SuppressionModels.WHITELISTS);
this.value = data.value;

@@ -91,31 +97,22 @@ this.reason = data.reason;

type TModel = typeof Bounce | typeof Complaint | typeof Unsubscribe | typeof WhiteList;
export default class SuppressionClient {
request: any;
models: {
bounces: typeof Bounce;
complaints: typeof Complaint;
unsubscribes: typeof Unsubscribe;
whitelists: typeof WhiteList;
};
request: Request;
models: Map<string, any>;
constructor(request: Request) {
this.request = request;
this.models = {
bounces: Bounce,
complaints: Complaint,
unsubscribes: Unsubscribe,
whitelists: WhiteList,
};
this.models = new Map();
this.models.set('bounces', Bounce);
this.models.set('complaints', Complaint);
this.models.set('unsubscribes', Unsubscribe);
this.models.set('whitelists', WhiteList);
}
_parsePage(id: string, pageUrl: string) : ParsedPage {
const parsedUrl = url.parse(pageUrl, true);
const { query } = parsedUrl;
const parsedUrl = new URL(pageUrl);
const { searchParams } = parsedUrl;
return {
id,
page: query.page as string,
address: query.address as string,
page: searchParams.has('page') ? searchParams.get('page') : undefined,
address: searchParams.has('address') ? searchParams.get('address') : undefined,
url: pageUrl

@@ -125,3 +122,3 @@ };

_parsePageLinks(response: { body: { paging: any } }): ParsedPagesList {
_parsePageLinks(response: SuppressionListResponse): ParsedPagesList {
const pages = Object.entries(response.body.paging as PagesList);

@@ -139,8 +136,11 @@ return pages.reduce(

_parseList(
response: { body: { items: any, paging: any } }, Model: TModel
response: SuppressionListResponse,
Model: {
new(data: BounceData | ComplaintData | UnsubscribeData | WhiteListData):
Bounce | Complaint | Unsubscribe | WhiteList
}
): SuppressionList {
const data = {} as SuppressionList;
data.items = response.body.items.map((item) => new Model(item));
data.items = response.body.items.map((d: any) => new Model(d));
data.pages = this._parsePageLinks(response);

@@ -151,21 +151,60 @@

_parseItem(
response: { body: any },
Model: TModel
): IBounce | IComplaint | IUnsubscribe | IWhiteList {
return new Model(response.body);
_parseItem<T extends Suppression>(
data : BounceData | ComplaintData | UnsubscribeData | WhiteListData,
Model: {
new(data: BounceData | ComplaintData | UnsubscribeData | WhiteListData):
T
}
): T {
return new Model(data);
}
private createWhiteList(domain: string, data: any) {
private createWhiteList(
domain: string,
data: SuppressionCreationData | SuppressionCreationData[]
): Promise<SuppressionCreationResult> {
if (Array.isArray(data)) {
throw new APIError({
status: 400,
statusText: 'Data property should be an object',
body: {
message: 'Whitelist\'s creation process does not support multiple creations. Data property should be an object'
}
} as APIErrorOptions);
}
return this.request
.postWithFD(urljoin('v3', domain, 'whitelists'), data, createOptions)
.then((response: { body: any }) => response.body);
.postWithFD(urljoin('v3', domain, 'whitelists'), data)
.then(this.prepareResponse);
}
list(domain: string, type: SuppressionModels, query: any) : Promise<SuppressionList> {
const model = (this.models)[type];
private checkType(type: string) {
if (!this.models.has(type)) {
throw new APIError({
status: 400,
statusText: 'Unknown type value',
body: { message: 'Type may be only one of [bounces, complaints, unsubscribes, whitelists]' }
} as APIErrorOptions);
}
}
private prepareResponse(response: SuppressionCreationResponse): SuppressionCreationResult {
return {
message: response.body.message,
type: response.body.type || '',
value: response.body.value || '',
status: response.status
};
}
list(
domain: string,
type: string,
query?: SuppressionListQuery
): Promise<SuppressionList> {
this.checkType(type);
const model = this.models.get(type);
return this.request
.get(urljoin('v3', domain, type), query)
.then((response: { body: { items: any, paging: any } }) => this._parseList(response, model));
.then((response: SuppressionListResponse) => this._parseList(response, model));
}

@@ -175,13 +214,19 @@

domain: string,
type: SuppressionModels,
type: string,
address: string
): Promise<IBounce | IComplaint | IUnsubscribe | IWhiteList> {
const model = (this.models)[type];
): Promise<Bounce | Complaint | Unsubscribe | WhiteList> {
this.checkType(type);
const model = this.models.get(type);
return this.request
.get(urljoin('v3', domain, type, encodeURIComponent(address)))
.then((response: { body: any }) => this._parseItem(response, model));
.then((response: SuppressionResponse) => this._parseItem<typeof model>(response.body, model));
}
create(domain: string, type: string, data: any) {
create(
domain: string,
type: string,
data: SuppressionCreationData | SuppressionCreationData[]
): Promise<SuppressionCreationResult> {
this.checkType(type);
// supports adding multiple suppressions by default

@@ -201,9 +246,19 @@ let postData;

.post(urljoin('v3', domain, type), JSON.stringify(postData), createOptions)
.then((response: { body: any }) => response.body);
.then(this.prepareResponse);
}
destroy(domain: string, type: string, address: string) {
destroy(
domain: string,
type: string,
address: string
): Promise<SuppressionDestroyResult> {
this.checkType(type);
return this.request
.delete(urljoin('v3', domain, type, encodeURIComponent(address)))
.then((response: { body: any }) => response.body);
.then((response: SuppressionDestroyResponse) => ({
message: response.body.message,
value: response.body.value || '',
address: response.body.address || '',
status: response.status
}));
}

@@ -210,0 +265,0 @@ }

{
"name": "mailgun.js",
"version": "5.0.2",
"version": "5.0.3",
"main": "dist/mailgun.node.js",

@@ -41,4 +41,3 @@ "browser": "dist/mailgun.web.js",

"ky-universal": "^0.8.2",
"url": "^0.11.0",
"url-join": "0.0.1",
"url-join": "^4.0.1",
"web-streams-polyfill": "^3.0.1",

@@ -55,3 +54,3 @@ "webpack-merge": "^5.4.0"

"@types/mocha": "^8.2.0",
"@types/url-join": "^4.0.0",
"@types/url-join": "^4.0.1",
"@typescript-eslint/eslint-plugin": "^4.26.0",

@@ -58,0 +57,0 @@ "@typescript-eslint/parser": "^4.26.0",

@@ -9,2 +9,3 @@ import chai, { expect } from 'chai';

import { InputFormData } from '../lib/interfaces/IFormData';
import { WhiteListData } from '../lib/interfaces/Supressions';

@@ -127,2 +128,34 @@ chai.should();

it('fetches WhiteLists', function () {
response.items = [{
type: 'whitelists',
value: 'brad@example.com',
reason: 'first reason',
createdAt: '2021-11-30T10:38:56.000Z'
}, {
type: 'whitelists',
value: 'roman@example.com',
reason: 'second reason',
createdAt: '2021-11-30T10:38:56.000Z'
}];
api.get('/v3/domain.com/whitelists').reply(200, response);
return client.list('domain.com', 'whitelists')
.then(function (complaints: { items: WhiteListData[] }) {
let c;
c = complaints.items[0];
c.type.should.eql('whitelists');
c.value.should.eql('brad@example.com');
c.reason.should.eql('first reason');
c.createdAt.should.eql(new Date('2021-11-30T10:38:56.000Z'));
c = complaints.items[1];
c.type.should.eql('whitelists');
c.value.should.eql('roman@example.com');
c.reason.should.eql('second reason');
c.createdAt.should.eql(new Date('2021-11-30T10:38:56.000Z'));
});
});
it('parses page links', function () {

@@ -191,17 +224,68 @@ api.get('/v3/domain.com/bounces').reply(200, response);

});
describe('create', function () {
describe('create bounce', function () {
it('creates suppression', function () {
api.post('/v3/domain.com/bounces').reply(200, {
message: '1 addresses have been added to the bounces table'
});
describe('create', function () {
it('creates suppression', function () {
api.post('/v3/domain.com/bounces').reply(200, {
message: 'Bounced address has been inserted',
address: 'myaddress'
return client.create('domain.com', 'bounces', {
address: 'myaddress',
code: 550
}).then(function (data: { message: string }) {
data.message.should.eql('1 addresses have been added to the bounces table');
});
});
});
return client.create('domain.com', 'bounces', {
address: 'myaddress',
code: 550
}).then(function (data: { address: string }) {
data.address.should.eql('myaddress');
describe('create multiple bounces', function () {
it('creates bounces', async function () {
const message = '2 addresses have been added to the bounces table';
api.post('/v3/domain.com/bounces').reply(200, {
message
});
return client.create('domain.com', 'bounces',
[{ address: 'myaddress' }, { address: 'myaddress1' }])
.then(function (data: { message: string }) {
data.message.should.eql(message);
});
});
});
describe('create whitelists', function () {
it('creates whitelist', async function () {
const message = '1 addresses have been added to the whitelists table';
api.post('/v3/domain.com/whitelists').reply(200, {
message
});
return client.create('domain.com', 'whitelists',
{ address: 'myaddress' })
.then(function (data: { message: string }) {
data.message.should.eql(message);
});
});
});
describe('create multiple whitelists', function () {
it('throws in case multiple whitelists provided', async function () {
try {
await client.create('domain.com', 'whitelists',
[{ address: 'myaddress' }, { address: 'myaddress1' }]);
} catch (error: any) {
error.message.should.eql('Data property should be an object');
error.details.should.eql("Whitelist's creation process does not support multiple creations. Data property should be an object");
error.status.should.eql(400);
}
});
});
it('throws in case type is unknown', async function () {
try {
await client.create('domain.com', 'wrong type',
{ address: 'myaddress' });
} catch (error: any) {
error.message.should.eql('Unknown type value');
error.details.should.eql('Type may be only one of [bounces, complaints, unsubscribes, whitelists]');
error.status.should.eql(400);
}
});
});

@@ -208,0 +292,0 @@

@@ -19,3 +19,2 @@ const webpack = require('webpack');

library: 'mailgun',
libraryTarget: 'umd',
globalObject: 'this',

@@ -22,0 +21,0 @@ },

@@ -7,3 +7,8 @@ const { merge } = require('webpack-merge');

output: {
filename: 'mailgun.node.js'
filename: 'mailgun.node.js',
library: {
name: 'mailgun',
type: 'umd',
export: 'default',
}
},

@@ -20,3 +25,6 @@ watchOptions: {

output: {
filename: 'mailgun.web.js'
filename: 'mailgun.web.js',
library: {
type: 'amd'
}
},

@@ -23,0 +31,0 @@ watchOptions: {

@@ -27,3 +27,8 @@ /* eslint-disable import/no-extraneous-dependencies */

output: {
filename: 'mailgun.node.js'
filename: 'mailgun.node.js',
library: {
name: 'mailgun',
type: 'umd',
export: 'default',
}
}

@@ -35,5 +40,8 @@ });

output: {
filename: 'mailgun.web.js'
filename: 'mailgun.web.js',
library: {
type: 'amd'
}
}
});
module.exports = [nodeConf, webConf];

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc