mailgun.js
Advanced tools
Comparing version 3.4.1 to 3.5.0
@@ -62,19 +62,7 @@ import Request from './request'; | ||
getIps(domain: string): Promise<string[]>; | ||
assignIp(domain: string, ip: string): Promise<{ | ||
body: any; | ||
status: number; | ||
}>; | ||
deleteIp(domain: string, ip: string): Promise<{ | ||
body: any; | ||
status: number; | ||
}>; | ||
linkIpPool(domain: string, pool_id: string): Promise<{ | ||
body: any; | ||
status: number; | ||
}>; | ||
unlinkIpPoll(domain: string, pool_id: string, ip: string): Promise<{ | ||
body: any; | ||
status: number; | ||
}>; | ||
assignIp(domain: string, ip: string): Promise<import("./interfaces/ApiResponse").default>; | ||
deleteIp(domain: string, ip: string): Promise<import("./interfaces/ApiResponse").default>; | ||
linkIpPool(domain: string, pool_id: string): Promise<import("./interfaces/ApiResponse").default>; | ||
unlinkIpPoll(domain: string, pool_id: string, ip: string): Promise<import("./interfaces/ApiResponse").default>; | ||
} | ||
export {}; |
import RequestOptions from './interfaces/RequestOptions'; | ||
import IFormData from './interfaces/IFormData'; | ||
interface APIResponse { | ||
status: number; | ||
body: any; | ||
} | ||
import APIResponse from './interfaces/ApiResponse'; | ||
declare class Request { | ||
@@ -8,0 +5,0 @@ private username; |
/*! MIT License © Sindre Sorhus */ | ||
/*! mailgun.js v3.4.1 */ | ||
/*! https://mths.be/base64 v1.0.0 by @mathias | MIT license */ | ||
/*! mailgun.js v3.5.0 */ |
@@ -1,2 +0,2 @@ | ||
import Btoa from 'btoa'; | ||
import base64 from 'base-64'; | ||
import urljoin from 'url-join'; | ||
@@ -8,7 +8,4 @@ import ky from 'ky-universal'; | ||
import IFormData from './interfaces/IFormData'; | ||
import APIResponse from './interfaces/ApiResponse'; | ||
interface APIResponse { | ||
status: number; | ||
body: any; | ||
} | ||
const isStream = (attachment: any) => typeof attachment === 'object' && typeof attachment.pipe === 'function'; | ||
@@ -64,3 +61,3 @@ | ||
const options = { ...inputOptions }; | ||
const basic = Btoa(`${this.username}:${this.key}`); | ||
const basic = base64.encode(`${this.username}:${this.key}`); | ||
const headers = { | ||
@@ -67,0 +64,0 @@ Authorization: `Basic ${basic}`, |
{ | ||
"name": "mailgun.js", | ||
"version": "3.4.1", | ||
"version": "3.5.0", | ||
"main": "dist/mailgun.js", | ||
@@ -33,4 +33,4 @@ "types": "dist/index.d.ts", | ||
"dependencies": { | ||
"base-64": "^1.0.0", | ||
"bluebird": "^3.7.2", | ||
"btoa": "^1.1.2", | ||
"ky": "^0.25.1", | ||
@@ -46,3 +46,3 @@ "ky-universal": "^0.8.2", | ||
"@babel/preset-env": "^7.12.1", | ||
"@types/btoa": "^1.2.3", | ||
"@types/base-64": "^1.0.0", | ||
"@types/chai": "^4.2.14", | ||
@@ -49,0 +49,0 @@ "@types/mocha": "^8.2.0", |
// jscs:disable requireDotNotation | ||
const formData = require('form-data'); | ||
import formData from 'form-data'; | ||
import btoa from 'btoa'; | ||
import base64 from 'base-64'; | ||
import nock from 'nock'; | ||
import { expect } from 'chai'; | ||
import Request from '../lib/request'; | ||
import RequestOptions from '../lib/interfaces/RequestOptions'; | ||
import { expect } from 'chai'; | ||
import APIError from '../dist/lib/error.d'; | ||
import APIResponse from '../lib/interfaces/ApiResponse'; | ||
interface Response { | ||
status: number; | ||
body: { id: number, message: string }; | ||
} | ||
interface Error { | ||
status: number; | ||
message: string; | ||
} | ||
describe('Request', function () { | ||
@@ -26,3 +17,3 @@ let headers: { [key: string]: string }; | ||
headers = {}; | ||
headers.Authorization = `Basic ${btoa('api:key')}`; | ||
headers.Authorization = `Basic ${base64.encode('api:key')}`; | ||
}); | ||
@@ -48,8 +39,6 @@ | ||
const res = req.request('get', '/v2/some/resource1', { | ||
await req.request('get', '/v2/some/resource1', { | ||
headers: { Test: 'Custom Header', 'X-CSRF-Token': 'protectme' }, | ||
query: { some: 'parameter' } | ||
}); | ||
return await res; | ||
}); | ||
@@ -64,3 +53,3 @@ | ||
const res = req.request('get', '/v2/some/resource') | ||
.then(function (response: Response) { | ||
.then(function (response: APIResponse) { | ||
expect(response.status).to.eql(200); | ||
@@ -98,5 +87,3 @@ expect(response.body).to.eql({ id: 1, message: 'hello' }); | ||
const req = new Request({ url: 'https://api.mailgun.com' } as RequestOptions, formData); | ||
const res = await req.query('get', '/v2/some/resource2', search); | ||
return await res; | ||
await req.query('get', '/v2/some/resource2', search); | ||
}); | ||
@@ -103,0 +90,0 @@ }); |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1900081
148
3811
+ Addedbase-64@^1.0.0
+ Addedbase-64@1.0.0(transitive)
- Removedbtoa@^1.1.2
- Removedbtoa@1.2.1(transitive)