Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nexmo

Package Overview
Dependencies
Maintainers
5
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nexmo - npm Package Compare versions

Comparing version 2.8.0 to 2.9.0

28

CHANGELOG.md

@@ -5,18 +5,31 @@ # Changelog

## 2.9.0
- FIXED: #295 - Nexmo constructor changes of given options object
- ADDED: Optional `target_api_key` parameter for the `number.buy()` and `number.cancel()` methods.
- ADDED: Typings for Messages API
- UPDATED: Private Key strings now replaces `\n` with newlines for easier usage in environment variables.
## 2.8.0
- ADDED: Support for Verify PSD2 requests via `nexmo.verify.psd2()`.
## 2.7.0
- ADDED: Made `apiKey` and `apiSecret` optional when `applicationId` and `privateKey` are present in Nexmo constructor.
## 2.6.0
- ADDED: Change host via the config object, using `apiHost` & `restHost`
## 2.5.3
- FIXED: URI Encode Signed SMS Message
## 2.5.2
- ADDED: Pricing API support
## 2.5.1
- ADDED: typings for Verify API

@@ -26,2 +39,3 @@ - ADDED: Applications API V2 support

## 2.4.2
- Added message signing for for sending SMS

@@ -66,9 +80,9 @@ - Added `Nexmo.generateSignature` to verify signed messages

- ADDED: Functionality is now namespaced:
- `nexmo.message`
- `nexmo.calls`
- `nexmo.number`
- `nexmo.verify`
- `nexmo.numberInsight`
- `nexmo.account`
- `nexmo.voice` - legacy voice functionality
- `nexmo.message`
- `nexmo.calls`
- `nexmo.number`
- `nexmo.verify`
- `nexmo.numberInsight`
- `nexmo.account`
- `nexmo.voice` - legacy voice functionality
- CHANGED: `var Nexmo = require('nexmo');` returns a class definition which should be created using the `new` operator e.g. `var nexmo = new Nexmo(args...);`.

@@ -75,0 +89,0 @@ - REMOVED: `var nexmo = require('nexmo');` no longer exposes singleton functions offered by "easynexmo".

@@ -6,8 +6,5 @@ "use strict";

});
exports.default = void 0;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var Account = function () {
class Account {
/**

@@ -19,11 +16,7 @@ * @param {Credentials} credentials

*/
function Account(credentials) {
constructor(credentials) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
_classCallCheck(this, Account);
this.creds = credentials;
this.options = options;
}
/**

@@ -34,54 +27,52 @@ * TODO: document

_createClass(Account, [{
key: "checkBalance",
value: function checkBalance(callback) {
return this.options.rest.get("/account/get-balance", callback);
}
}, {
key: "updatePassword",
value: function updatePassword(newSecret, callback) {
return this.options.rest.postUseQueryString("/account/settings", { newSecret: newSecret }, callback);
}
}, {
key: "updateSMSCallback",
value: function updateSMSCallback(moCallBackUrl, callback) {
return this.options.rest.postUseQueryString("/account/settings", { moCallBackUrl: moCallBackUrl }, callback);
}
}, {
key: "updateDeliveryReceiptCallback",
value: function updateDeliveryReceiptCallback(drCallBackUrl, callback) {
return this.options.rest.postUseQueryString("/account/settings", { drCallBackUrl: drCallBackUrl }, callback);
}
}, {
key: "topUp",
value: function topUp(trx, callback) {
return this.options.rest.postUseQueryString("/account/top-up", { trx: trx }, callback);
}
}, {
key: "listSecrets",
value: function listSecrets(apiKey, callback) {
return this.options.api.get("/accounts/" + apiKey + "/secrets", {}, callback, false, true);
}
}, {
key: "getSecret",
value: function getSecret(apiKey, id, callback) {
return this.options.api.get("/accounts/" + apiKey + "/secrets/" + id, {}, callback, false, true);
}
}, {
key: "createSecret",
value: function createSecret(apiKey, secret, callback) {
return this.options.api.postJson("/accounts/" + apiKey + "/secrets/", { secret: secret }, callback, false, true);
}
}, {
key: "deleteSecret",
value: function deleteSecret(apiKey, id, callback) {
return this.options.api.delete("/accounts/" + apiKey + "/secrets/" + id, callback, false, true);
}
}]);
checkBalance(callback) {
return this.options.rest.get("/account/get-balance", callback);
}
return Account;
}();
updatePassword(newSecret, callback) {
return this.options.rest.postUseQueryString("/account/settings", {
newSecret
}, callback);
}
exports.default = Account;
module.exports = exports["default"];
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9BY2NvdW50LmpzIl0sIm5hbWVzIjpbIkFjY291bnQiLCJjcmVkZW50aWFscyIsIm9wdGlvbnMiLCJjcmVkcyIsImNhbGxiYWNrIiwicmVzdCIsImdldCIsIm5ld1NlY3JldCIsInBvc3RVc2VRdWVyeVN0cmluZyIsIm1vQ2FsbEJhY2tVcmwiLCJkckNhbGxCYWNrVXJsIiwidHJ4IiwiYXBpS2V5IiwiYXBpIiwiaWQiLCJzZWNyZXQiLCJwb3N0SnNvbiIsImRlbGV0ZSJdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7Ozs7Ozs7SUFFTUEsTztBQUNKOzs7Ozs7QUFNQSxtQkFBWUMsV0FBWixFQUF1QztBQUFBLFFBQWRDLE9BQWMsdUVBQUosRUFBSTs7QUFBQTs7QUFDckMsU0FBS0MsS0FBTCxHQUFhRixXQUFiO0FBQ0EsU0FBS0MsT0FBTCxHQUFlQSxPQUFmO0FBQ0Q7O0FBRUQ7Ozs7Ozs7aUNBR2FFLFEsRUFBVTtBQUNyQixhQUFPLEtBQUtGLE9BQUwsQ0FBYUcsSUFBYixDQUFrQkMsR0FBbEIsQ0FBc0Isc0JBQXRCLEVBQThDRixRQUE5QyxDQUFQO0FBQ0Q7OzttQ0FFY0csUyxFQUFXSCxRLEVBQVU7QUFDbEMsYUFBTyxLQUFLRixPQUFMLENBQWFHLElBQWIsQ0FBa0JHLGtCQUFsQixDQUNMLG1CQURLLEVBRUwsRUFBRUQsb0JBQUYsRUFGSyxFQUdMS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AgICAgIHRydWVcbiAgICApO1xuICB9XG5cbiAgZ2V0U2VjcmV0KGFwaUtleSwgaWQsIGNhbGxiYWNrKSB7XG4gICAgcmV0dXJuIHRoaXMub3B0aW9ucy5hcGkuZ2V0KFxuICAgICAgXCIvYWNjb3VudHMvXCIgKyBhcGlLZXkgKyBcIi9zZWNyZXRzL1wiICsgaWQsXG4gICAgICB7fSxcbiAgICAgIGNhbGxiYWNrLFxuICAgICAgZmFsc2UsXG4gICAgICB0cnVlXG4gICAgKTtcbiAgfVxuXG4gIGNyZWF0ZVNlY3JldChhcGlLZXksIHNlY3JldCwgY2FsbGJhY2spIHtcbiAgICByZXR1cm4gdGhpcy5vcHRpb25zLmFwaS5wb3N0SnNvbihcbiAgICAgIFwiL2FjY291bnRzL1wiICsgYXBpS2V5ICsgXCIvc2VjcmV0cy9cIixcbiAgICAgIHsgc2VjcmV0OiBzZWNyZXQgfSxcbiAgICAgIGNhbGxiYWNrLFxuICAgICAgZmFsc2UsXG4gICAgICB0cnVlXG4gICAgKTtcbiAgfVxuXG4gIGRlbGV0ZVNlY3JldChhcGlLZXksIGlkLCBjYWxsYmFjaykge1xuICAgIHJldHVybiB0aGlzLm9wdGlvbnMuYXBpLmRlbGV0ZShcbiAgICAgIFwiL2FjY291bnRzL1wiICsgYXBpS2V5ICsgXCIvc2VjcmV0cy9cIiArIGlkLFxuICAgICAgY2FsbGJhY2ssXG4gICAgICBmYWxzZSxcbiAgICAgIHRydWVcbiAgICApO1xuICB9XG59XG5cbmV4cG9ydCBkZWZhdWx0IEFjY291bnQ7XG4iXX0=
updateSMSCallback(moCallBackUrl, callback) {
return this.options.rest.postUseQueryString("/account/settings", {
moCallBackUrl
}, callback);
}
updateDeliveryReceiptCallback(drCallBackUrl, callback) {
return this.options.rest.postUseQueryString("/account/settings", {
drCallBackUrl
}, callback);
}
topUp(trx, callback) {
return this.options.rest.postUseQueryString("/account/top-up", {
trx
}, callback);
}
listSecrets(apiKey, callback) {
return this.options.api.get("/accounts/" + apiKey + "/secrets", {}, callback, false, true);
}
getSecret(apiKey, id, callback) {
return this.options.api.get("/accounts/" + apiKey + "/secrets/" + id, {}, callback, false, true);
}
createSecret(apiKey, secret, callback) {
return this.options.api.postJson("/accounts/" + apiKey + "/secrets/", {
secret: secret
}, callback, false, true);
}
deleteSecret(apiKey, id, callback) {
return this.options.api.delete("/accounts/" + apiKey + "/secrets/" + id, callback, false, true);
}
}
var _default = Account;
exports.default = _default;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9BY2NvdW50LmpzIl0sIm5hbWVzIjpbIkFjY291bnQiLCJjb25zdHJ1Y3RvciIsImNyZWRlbnRpYWxzIiwib3B0aW9ucyIsImNyZWRzIiwiY2hlY2tCYWxhbmNlIiwiY2FsbGJhY2siLCJyZXN0IiwiZ2V0IiwidXBkYXRlUGFzc3dvcmQiLCJuZXdTZWNyZXQiLCJwb3N0VXNlUXVlcnlTdHJpbmciLCJ1cGRhdGVTTVNDYWxsYmFjayIsIm1vQ2FsbEJhY2tVcmwiLCJ1cGRhdGVEZWxpdmVyeVJlY2VpcHRDYWxsYmFjayIsImRyQ2FsbEJhY2tVcmwiLCJ0b3BVcCIsInRyeCIsImxpc3RTZWNyZXRzIiwiYXBpS2V5IiwiYXBpIiwiZ2V0U2VjcmV0IiwiaWQiLCJjcmVhdGVTZWNyZXQiLCJzZWNyZXQiLCJwb3N0SnNvbiIsImRlbGV0ZVNlY3JldCIsImRlbGV0ZSJdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7Ozs7QUFFQSxNQUFNQSxPQUFOLENBQWM7QUFDWjs7Ozs7O0FBTUFDLEVBQUFBLFdBQVcsQ0FBQ0MsV0FBRCxFQUE0QjtBQUFBLFFBQWRDLE9BQWMsdUVBQUosRUFBSTtBQUNyQyxTQUFLQyxLQUFMLEdBQWFGLFdBQWI7QUFDQSxTQUFLQyxPQUFMLEdBQWVBLE9BQWY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XCIsXG4gICAgICB7IHNlY3JldDogc2VjcmV0IH0sXG4gICAgICBjYWxsYmFjayxcbiAgICAgIGZhbHNlLFxuICAgICAgdHJ1ZVxuICAgICk7XG4gIH1cblxuICBkZWxldGVTZWNyZXQoYXBpS2V5LCBpZCwgY2FsbGJhY2spIHtcbiAgICByZXR1cm4gdGhpcy5vcHRpb25zLmFwaS5kZWxldGUoXG4gICAgICBcIi9hY2NvdW50cy9cIiArIGFwaUtleSArIFwiL3NlY3JldHMvXCIgKyBpZCxcbiAgICAgIGNhbGxiYWNrLFxuICAgICAgZmFsc2UsXG4gICAgICB0cnVlXG4gICAgKTtcbiAgfVxufVxuXG5leHBvcnQgZGVmYXVsdCBBY2NvdW50O1xuIl19

@@ -6,39 +6,25 @@ "use strict";

});
exports.default = void 0;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _Utils = _interopRequireDefault(require("./Utils"));
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _Utils = require("./Utils");
var _Utils2 = _interopRequireDefault(_Utils);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
class App {
/**
* Provides access to the `applications` version 2 endpoint.
*/
static get PATH() {
return "/v2/applications";
}
/**
* @param {Credentials} credentials
* credentials to be used when interacting with the API.
* @param {Object} options
* Addition App options.
*/
var App = function () {
_createClass(App, null, [{
key: "PATH",
/**
* Provides access to the `applications` version 2 endpoint.
*/
get: function get() {
return "/v2/applications";
}
/**
* @param {Credentials} credentials
* credentials to be used when interacting with the API.
* @param {Object} options
* Addition App options.
*/
}]);
function App(credentials) {
constructor(credentials) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
_classCallCheck(this, App);
this.creds = credentials;

@@ -48,223 +34,207 @@ this.options = options;

_createClass(App, [{
key: "_convertMethodSignature",
value: function _convertMethodSignature(name, type, answerUrl, eventUrl, options) {
var capability = {};
switch (type) {
case "voice":
capability = {
voice: {
webhooks: {
answer_url: {
address: answerUrl,
http_method: "GET"
},
event_url: {
address: eventUrl,
http_method: "POST"
}
_convertMethodSignature(name, type, answerUrl, eventUrl, options) {
var capability = {};
switch (type) {
case "voice":
capability = {
voice: {
webhooks: {
answer_url: {
address: answerUrl,
http_method: "GET"
},
event_url: {
address: eventUrl,
http_method: "POST"
}
}
};
break;
case "messages":
capability = {
messages: {
webhooks: {
inbound_url: {
address: options.inbound_url,
http_method: "POST"
},
status_url: {
address: options.status_url,
http_method: "POST"
}
}
};
break;
case "messages":
capability = {
messages: {
webhooks: {
inbound_url: {
address: options.inbound_url,
http_method: "POST"
},
status_url: {
address: options.status_url,
http_method: "POST"
}
}
};
break;
case "rtc":
capability = {
rtc: {
webhooks: {
event_url: {
address: eventUrl,
http_method: "POST"
}
}
};
break;
case "rtc":
capability = {
rtc: {
webhooks: {
event_url: {
address: eventUrl,
http_method: "POST"
}
}
};
break;
}
return {
name: name,
capabilities: capability
};
}
}, {
key: "_convertApplicationResponse",
value: function _convertApplicationResponse(application) {
for (var capability in application.capabilities) {
application[capability] = {
webhooks: []
}
};
for (var webhook in application.capabilities[capability].webhooks) {
application[capability].webhooks.push({
endpoint_type: webhook,
endpoint: application.capabilities[capability].webhooks[webhook].address,
http_method: application.capabilities[capability].webhooks[webhook].http_method
});
}
}
delete application.capabilities;
return application;
break;
}
}, {
key: "_convertApplicationListResponse",
value: function _convertApplicationListResponse(applicationResponseHandler) {
return function (response) {
response.count = response.total_items;
response.page_index = response.page;
for (var i in response._embedded.applications) {
response._embedded.applications[i] = applicationResponseHandler(response._embedded.applications[i]);
}
return response;
return {
name: name,
capabilities: capability
};
}
_convertApplicationResponse(application) {
for (var capability in application.capabilities) {
application[capability] = {
webhooks: []
};
for (var webhook in application.capabilities[capability].webhooks) {
application[capability].webhooks.push({
endpoint_type: webhook,
endpoint: application.capabilities[capability].webhooks[webhook].address,
http_method: application.capabilities[capability].webhooks[webhook].http_method
});
}
}
/**
* TODO: document
*/
delete application.capabilities;
return application;
}
}, {
key: "create",
value: function create(name, type, answerUrl, eventUrl, options, callback) {
var params = {};
var responseParser = null;
_convertApplicationListResponse(applicationResponseHandler) {
return response => {
response.count = response.total_items;
response.page_index = response.page;
if (arguments.length > 2) {
params = JSON.stringify(this._convertMethodSignature(name, type, answerUrl, eventUrl, options));
responseParser = this._convertApplicationResponse;
} else {
params = JSON.stringify(name);
callback = type;
for (var i in response._embedded.applications) {
response._embedded.applications[i] = applicationResponseHandler(response._embedded.applications[i]);
}
var authorization = this.creds.apiKey + ":" + this.creds.apiSecret;
return response;
};
}
/**
* TODO: document
*/
var config = {
host: this.options.apiHost || "api.nexmo.com",
path: App.PATH,
method: "POST",
body: params,
headers: {
"Content-Type": "application/json",
Authorization: "Basic " + Buffer.from(authorization).toString("base64")
}
};
this.options.httpClient.request(config, callback, callback, false, responseParser);
create(name, type, answerUrl, eventUrl, options, callback) {
var params = {};
var responseParser = null;
if (arguments.length > 2) {
params = JSON.stringify(this._convertMethodSignature(name, type, answerUrl, eventUrl, options));
responseParser = this._convertApplicationResponse;
} else {
params = JSON.stringify(name);
callback = type;
}
/**
* TODO: document
*/
}, {
key: "get",
value: function get(params, callback) {
var v2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
var authorization = this.creds.apiKey + ":" + this.creds.apiSecret;
var responseParser = null;
if ((typeof params === "undefined" ? "undefined" : _typeof(params)) !== "object") {
responseParser = this._convertApplicationResponse;
} else {
responseParser = this._convertApplicationListResponse(this._convertApplicationResponse);
var authorization = "".concat(this.creds.apiKey, ":").concat(this.creds.apiSecret);
var config = {
host: this.options.apiHost || "api.nexmo.com",
path: App.PATH,
method: "POST",
body: params,
headers: {
"Content-Type": "application/json",
Authorization: "Basic ".concat(Buffer.from(authorization).toString("base64"))
}
};
this.options.httpClient.request(config, callback, callback, false, responseParser);
}
/**
* TODO: document
*/
if (v2) {
responseParser = null;
}
var config = {
host: this.options.apiHost || "api.nexmo.com",
path: _Utils2.default.createPathWithQuery(App.PATH, params),
method: "GET",
body: undefined,
headers: {
"Content-Type": "application/json",
Authorization: "Basic " + Buffer.from(authorization).toString("base64")
}
};
get(params, callback) {
var v2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
var authorization = "".concat(this.creds.apiKey, ":").concat(this.creds.apiSecret);
var responseParser = null;
this.options.httpClient.request(config, callback, callback, false, responseParser);
if (typeof params !== "object") {
responseParser = this._convertApplicationResponse;
} else {
responseParser = this._convertApplicationListResponse(this._convertApplicationResponse);
}
/**
* TODO: document
*/
if (v2) {
responseParser = null;
}
}, {
key: "update",
value: function update(appId, name, type, answerUrl, eventUrl, options, callback) {
var params = {};
var responseParser = null;
if (arguments.length > 3) {
params = JSON.stringify(this._convertMethodSignature(name, type, answerUrl, eventUrl, options));
responseParser = this._convertApplicationResponse;
} else {
params = JSON.stringify(name);
callback = type;
var config = {
host: this.options.apiHost || "api.nexmo.com",
path: _Utils.default.createPathWithQuery(App.PATH, params),
method: "GET",
body: undefined,
headers: {
"Content-Type": "application/json",
Authorization: "Basic ".concat(Buffer.from(authorization).toString("base64"))
}
};
this.options.httpClient.request(config, callback, callback, false, responseParser);
}
/**
* TODO: document
*/
var authorization = this.creds.apiKey + ":" + this.creds.apiSecret;
var config = {
host: this.options.apiHost || "api.nexmo.com",
path: App.PATH + "/" + appId,
method: "PUT",
body: params,
headers: {
"Content-Type": "application/json",
Authorization: "Basic " + Buffer.from(authorization).toString("base64")
}
};
update(appId, name, type, answerUrl, eventUrl, options, callback) {
var params = {};
var responseParser = null;
this.options.httpClient.request(config, callback, callback, false, responseParser);
if (arguments.length > 3) {
params = JSON.stringify(this._convertMethodSignature(name, type, answerUrl, eventUrl, options));
responseParser = this._convertApplicationResponse;
} else {
params = JSON.stringify(name);
callback = type;
}
/**
* TODO: document
*/
var authorization = "".concat(this.creds.apiKey, ":").concat(this.creds.apiSecret);
var config = {
host: this.options.apiHost || "api.nexmo.com",
path: "".concat(App.PATH, "/").concat(appId),
method: "PUT",
body: params,
headers: {
"Content-Type": "application/json",
Authorization: "Basic ".concat(Buffer.from(authorization).toString("base64"))
}
};
this.options.httpClient.request(config, callback, callback, false, responseParser);
}
/**
* TODO: document
*/
}, {
key: "delete",
value: function _delete(appId, callback) {
var authorization = this.creds.apiKey + ":" + this.creds.apiSecret;
var config = {
host: this.options.apiHost || "api.nexmo.com",
path: App.PATH + "/" + appId,
method: "DELETE",
body: "{}",
headers: {
"Content-Type": "application/json",
Authorization: "Basic " + Buffer.from(authorization).toString("base64")
}
};
delete(appId, callback) {
var authorization = "".concat(this.creds.apiKey, ":").concat(this.creds.apiSecret);
var config = {
host: this.options.apiHost || "api.nexmo.com",
path: "".concat(App.PATH, "/").concat(appId),
method: "DELETE",
body: "{}",
headers: {
"Content-Type": "application/json",
Authorization: "Basic ".concat(Buffer.from(authorization).toString("base64"))
}
};
this.options.httpClient.request(config, callback);
}
this.options.httpClient.request(config, callback);
}
}]);
}
return App;
}();
exports.default = App;
module.exports = exports["default"];
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9BcHAuanMiXSwibmFtZXMiOlsiQXBwIiwiY3JlZGVudGlhbHMiLCJvcHRpb25zIiwiY3JlZHMiLCJuYW1lIiwidHlwZSIsImFuc3dlclVybCIsImV2ZW50VXJsIiwiY2FwYWJpbGl0eSIsInZvaWNlIiwid2ViaG9va3MiL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bHMsIG9wdGlvbnMgPSB7fSkge1xuICAgIHRoaXMuY3JlZHMgPSBjcmVkZW50aWFscztcbiAgICB0aGlzLm9wdGlvbnMgPSBvcHRpb25zO1xuICB9XG5cbiAgX2NvbnZlcnRNZXRob2RTaWduYXR1cmUobmFtZSwgdHlwZSwgYW5zd2VyVXJsLCBldmVudFVybCwgb3B0aW9ucykge1xuICAgIGxldCBjYXBhYmlsaXR5ID0ge307XG4gICAgc3dpdGNoICh0eXBlKSB7XG4gICAgICBjYXNlIFwidm9pY2VcIjpcbiAgICAgICAgY2FwYWJpbGl0eSA9IHtcbiAgICAgICAgICB2b2ljZToge1xuICAgICAgICAgICAgd2ViaG9va3M6IHtcbiAgICAgICAgICAgICAgYW5zd2VyX3VybDoge1xuICAgICAgICAgICAgICAgIGFkZHJlc3M6IGFuc3dlclVybCxcbiAgICAgICAgICAgICAgICBodHRwX21ldGhvZDogXCJHRVRcIlxuICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICBldmVudF91cmw6IHtcbiAgICAgICAgICAgICAgICBhZGRyZXNzOiBldmVudFVybCxcbiAgICAgICAgICAgICAgICBodHRwX21ldGhvZDogXCJQT1NUXCJcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfTtcbiAgICAgICAgYnJlYWs7XG4gICAgICBjYXNlIFwibWVzc2FnZXNcIjpcbiAgICAgICAgY2FwYWJpbGl0eSA9IHtcbiAgICAgICAgICBtZXNzYWdlczoge1xuICAgICAgICAgICAgd2ViaG9va3M6IHtcbiAgICAgICAgICAgICAgaW5ib3VuZF91cmw6IHtcbiAgICAgICAgICAgICAgICBhZGRyZXNzOiBvcHRpb25zLmluYm91bmRfdXJsLFxuICAgICAgICAgICAgICAgIGh0dHBfbWV0aG9kOiBcIlBPU1RcIlxuICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICBzdGF0dXNfdXJsOiB7XG4gICAgICAgICAgICAgICAgYWRkcmVzczogb3B0aW9ucy5zdGF0dXNfdXJsLFxuICAgICAgICAgICAgICAgIGh0dHBfbWV0aG9kOiBcIlBPU1RcIlxuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICB9O1xuICAgICAgICBicmVhaztcbiAgICAgIGNhc2UgXCJydGNcIjpcbiAgICAgICAgY2FwYWJpbGl0eSA9IHtcbiAgICAgICAgICBydGM6IHtcbiAgICAgICAgICAgIHdlYmhvb2tzOiB7XG4gICAgICAgICAgICAgIGV2ZW50X3VybDoge1xuICAgICAgICAgICAgICAgIGFkZHJlc3M6IGV2ZW50VXJsLFxuICAgICAgICAgICAgICAgIGh0dHBfbWV0aG9kOiBcIlBPU1RcIlxuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICB9O1xuICAgICAgICBicmVhaztcbiAgICB9XG5cbiAgICByZXR1cm4ge1xuICAgICAgbmFtZTogbmFtZSxcbiAgICAgIGNhcGFiaWxpdGllczogY2FwYWJpbGl0eVxuICAgIH07XG4gIH1cblxuICBfY29udmVydEFwcGxpY2F0aW9uUmVzcG9uc2UoYXBwbGljYXRpb24pIHtcbiAgICBmb3IgKGxldCBjYXBhYmlsaXR5IGluIGFwcGxpY2F0aW9uLmNhcGFiaWxpdGllcykge1xuICAgICAgYXBwbGljYXRpb25bY2FwYWJpbGl0eV0gPSB7XG4gICAgICAgIHdlYmhvb2tzOiBbXVxuICAgICAgfTtcbiAgICAgIGZvciAobGV0IHdlYmhvb2sgaW4gYXBwbGljYXRpb24uY2FwYWJpbGl0aWVzW2NhcGFiaWxpdHldLndlYmhvb2tzKSB7XG4gICAgICAgIGFwcGxpY2F0aW9uW2NhcGFiaWxpdHldLndlYmhvb2tzLnB1c2goe1xuICAgICAgICAgIGVuZHBvaW50X3R5cGU6IHdlYmhvb2ssXG4gICAgICAgICAgZW5kcG9pbnQ6XG4gICAgICAgICAgICBhcHBsaWNhdGlvbi5jYXB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VxuXG5leHBvcnQgZGVmYXVsdCBBcHA7XG4iXX0=
var _default = App;
exports.default = _default;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9BcHAuanMiXSwibmFtZXMiOlsiQXBwIiwiUEFUSCIsImNvbnN0cnVjdG9yIiwiY3JlZGVudGlhbHMiLCJvcHRpb25zIiwiY3JlZHMiLCJfY29udmVydE1ldGhvZFNpZ25hdHVyZSIsIm5hbWUiLCJ0eXBlIiwiYW5zd2VyVXJsIiwiZXZlbnRVcmwiLCJjYXBhYmlsaXR5Iiwidm9pY2UiLCJ3ZWJob29rcyIsImFuc3dlcl91cmwiLCJhZGRyZXNzIiwiaHR0cF9tZXRob2QiLCJldmVudF91cmwiLCJtZXNzYWdlcyIsImluYm91bmRfdXJsIiwic3RhdHVzX3VybCIsInJ0YyIsImNhcGFiaWxpdGllcyIsIl9jb252ZXJ0QXBwbGljYXRpb25SZXNwb25zZSIsImFwcGxpY2F0aW9uIiwid2ViaG9vayIsInB1c2giLCJlbmRwb2ludF90eXBlIiwiZW5kcG9pbnQiLCJfY29udmVydEFwcGxpY2F0aW9uTGlzdFJlc3BvbnNlIiwiYXBwbGljYXRpb25SZXNwb25zZUhhbmRsZXIiLCJyZXNwb25zZSIsImNvdW50IiwidG90YWxfaXRlbXMiLCJwYWdlX2luZGV4IiwicGFnZSIsImkiLCJfZW1iZWRkZWQiLCJhcHBsaWNhdGlvbnMiLCJjcmVhdGUiLCJjYWxsYmFjayIsInBhcmFtcyIsInJlc3BvbnNlUGFyc2VyIiwiYXJndW1lbnRzIiwibGVuZ3RoIiwiSlNPTiIsInN0cmluZ2lmeSIsImF1dGhvcml6YXRpb24iLCJhcGlLZXkiLCJhcGlTZWNyZXQiLCJjb25maWciLCJob3N0IiwiYXBpSG9zdCIsInBhdGgiLCJtZXRob2QiLCJib2R5IiwiaGVhZGVycyIsIkF1dGhvcml6YXRpb24iLCJCdWZmZX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3dlclVybCwgZXZlbnRVcmwsIG9wdGlvbnMpIHtcbiAgICBsZXQgY2FwYWJpbGl0eSA9IHt9O1xuICAgIHN3aXRjaCAodHlwZSkge1xuICAgICAgY2FzZSBcInZvaWNlXCI6XG4gICAgICAgIGNhcGFiaWxpdHkgPSB7XG4gICAgICAgICAgdm9pY2U6IHtcbiAgICAgICAgICAgIHdlYmhvb2tzOiB7XG4gICAgICAgICAgICAgIGFuc3dlcl91cmw6IHtcbiAgICAgICAgICAgICAgICBhZGRyZXNzOiBhbnN3ZXJVcmwsXG4gICAgICAgICAgICAgICAgaHR0cF9tZXRob2Q6IFwiR0VUXCJcbiAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgZXZlbnRfdXJsOiB7XG4gICAgICAgICAgICAgICAgYWRkcmVzczogZXZlbnRVcmwsXG4gICAgICAgICAgICAgICAgaHR0cF9tZXRob2Q6IFwiUE9TVFwiXG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH07XG4gICAgICAgIGJyZWFrO1xuICAgICAgY2FzZSBcIm1lc3NhZ2VzXCI6XG4gICAgICAgIGNhcGFiaWxpdHkgPSB7XG4gICAgICAgICAgbWVzc2FnZXM6IHtcbiAgICAgICAgICAgIHdlYmhvb2tzOiB7XG4gICAgICAgICAgICAgIGluYm91bmRfdXJsOiB7XG4gICAgICAgICAgICAgICAgYWRkcmVzczogb3B0aW9ucy5pbmJvdW5kX3VybCxcbiAgICAgICAgICAgICAgICBodHRwX21ldGhvZDogXCJQT1NUXCJcbiAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgc3RhdHVzX3VybDoge1xuICAgICAgICAgICAgICAgIGFkZHJlc3M6IG9wdGlvbnMuc3RhdHVzX3VybCxcbiAgICAgICAgICAgICAgICBodHRwX21ldGhvZDogXCJQT1NUXCJcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfTtcbiAgICAgICAgYnJlYWs7XG4gICAgICBjYXNlIFwicnRjXCI6XG4gICAgICAgIGNhcGFiaWxpdHkgPSB7XG4gICAgICAgICAgcnRjOiB7XG4gICAgICAgICAgICB3ZWJob29rczoge1xuICAgICAgICAgICAgICBldmVudF91cmw6IHtcbiAgICAgICAgICAgICAgICBhZGRyZXNzOiBldmVudFVybCxcbiAgICAgICAgICAgICAgICBodHRwX21ldGhvZDogXCJQT1NUXCJcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfTtcbiAgICAgICAgYnJlYWs7XG4gICAgfVxuXG4gICAgcmV0dXJuIHtcbiAgICAgIG5hbWU6IG5hbWUsXG4gICAgICBjYXBhYmlsaXRpZXM6IGNhcGFiaWxpdHlcbiAgICB9O1xuICB9XG5cbiAgX2NvbnZlcnRBcHBsaWNhdGlvblJlc3BvbnNlKGFwcGxpY2F0aW9uKSB7XG4gICAgZm9yIChsZXQgY2FwYWJpbGl0eSBpbiBhcHBsaWNhdGlvbi5jYXBhYmlsaXRpZXMpIHtcbiAgICAgIGFwcGxpY2F0aW9uW2NhcGFiaWxpdHldID0ge1xuICAgICAgICB3ZWJob29rczogW11cbiAgICAgIH07XG4gICAgICBmb3IgKGxldCB3ZWJob29rIGluIGFwcGxpY2F0aW9uLmNhcGFiaWxpdGllc1tjYXBhYmlsaXR5XS53ZWJob29rcykge1xuICAgICAgICBhcHBsaWNhdGlvbltjYXBhYmlsaXR5XS53ZWJob29rcy5wdXNoKHtcbiAgICAgICAgICBlbmRwb2ludF90eXBlOiB3ZWJob29rLFxuICAgICAgICAgIGVuZHBvaW50OlxuICAgICAgICAgICAgYXBwbGljYXRpb24uY2FwYWJpbGl0aWVzW2NhcGFiaWxpdHldLndlYmhvb2tzW3dlYmhvb2tdLmFkZHJlc3MsXG4gICAgICAgICAgaHR0cF9tZXRob2Q6XG4gICAgICAgICAgICBhcHBsaWNhdGlvbi5jYXBhYmlsaXRpZX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ZyhcImJhc2U2NFwiKX1gXG4gICAgICB9XG4gICAgfTtcblxuICAgIHRoaXMub3B0aW9ucy5odHRwQ2xpZW50LnJlcXVlc3QoXG4gICAgICBjb25maWcsXG4gICAgICBjYWxsYmFjayxcbiAgICAgIGNhbGxiYWNrLFxuICAgICAgZmFsc2UsXG4gICAgICByZXNwb25zZVBhcnNlclxuICAgICk7XG4gIH1cblxuICAvKipcbiAgICogVE9ETzogZG9jdW1lbnRcbiAgICovXG4gIGRlbGV0ZShhcHBJZCwgY2FsbGJhY2spIHtcbiAgICBjb25zdCBhdXRob3JpemF0aW9uID0gYCR7dGhpcy5jcmVkcy5hcGlLZXl9OiR7dGhpcy5jcmVkcy5hcGlTZWNyZXR9YDtcblxuICAgIHZhciBjb25maWcgPSB7XG4gICAgICBob3N0OiB0aGlzLm9wdGlvbnMuYXBpSG9zdCB8fCBcImFwaS5uZXhtby5jb21cIixcbiAgICAgIHBhdGg6IGAke0FwcC5QQVRIfS8ke2FwcElkfWAsXG4gICAgICBtZXRob2Q6IFwiREVMRVRFXCIsXG4gICAgICBib2R5OiBcInt9XCIsXG4gICAgICBoZWFkZXJzOiB7XG4gICAgICAgIFwiQ29udGVudC1UeXBlXCI6IFwiYXBwbGljYXRpb24vanNvblwiLFxuICAgICAgICBBdXRob3JpemF0aW9uOiBgQmFzaWMgJHtCdWZmZXIuZnJvbShhdXRob3JpemF0aW9uKS50b1N0cmluZyhcImJhc2U2NFwiKX1gXG4gICAgICB9XG4gICAgfTtcblxuICAgIHRoaXMub3B0aW9ucy5odHRwQ2xpZW50LnJlcXVlc3QoY29uZmlnLCBjYWxsYmFjayk7XG4gIH1cbn1cblxuZXhwb3J0IGRlZmF1bHQgQXBwO1xuIl19

@@ -6,72 +6,51 @@ "use strict";

});
exports.default = void 0;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _querystring = _interopRequireDefault(require("querystring"));
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _StreamResource = _interopRequireDefault(require("./StreamResource"));
var _querystring = require("querystring");
var _TalkResource = _interopRequireDefault(require("./TalkResource"));
var _querystring2 = _interopRequireDefault(_querystring);
var _DtmfResource = _interopRequireDefault(require("./DtmfResource"));
var _StreamResource = require("./StreamResource");
var _StreamResource2 = _interopRequireDefault(_StreamResource);
var _TalkResource = require("./TalkResource");
var _TalkResource2 = _interopRequireDefault(_TalkResource);
var _DtmfResource = require("./DtmfResource");
var _DtmfResource2 = _interopRequireDefault(_DtmfResource);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/**
* Provides access to the `calls` resource.
*/
var CallsResource = function () {
_createClass(CallsResource, null, [{
key: "PATH",
class CallsResource {
/**
* The path to the `calls` resource.
*/
static get PATH() {
return "/v1/calls";
}
/**
* Creates a new CallsResource.
*
* @param {Credentials} creds - Credentials used when interacting with the Nexmo API.
* @param {Object} options - additional options for the class.
*/
/**
* The path to the `calls` resource.
*/
get: function get() {
return "/v1/calls";
}
/**
* Creates a new CallsResource.
*
* @param {Credentials} creds - Credentials used when interacting with the Nexmo API.
* @param {Object} options - additional options for the class.
*/
}]);
function CallsResource(creds, options) {
_classCallCheck(this, CallsResource);
constructor(creds, options) {
this.creds = creds;
this.options = options;
/**
* @type StreamController
*/
this.stream = new _StreamResource2.default(this.creds, this.options);
this.stream = new _StreamResource.default(this.creds, this.options);
/**
* @type TalkResource
*/
this.talk = new _TalkResource2.default(this.creds, this.options);
this.talk = new _TalkResource.default(this.creds, this.options);
/**
* @type DtmfResource
*/
this.dtmf = new _DtmfResource2.default(this.creds, this.options);
this.dtmf = new _DtmfResource.default(this.creds, this.options);
}
/**

@@ -85,91 +64,82 @@ * Create a new call.

_createClass(CallsResource, [{
key: "create",
value: function create(params, callback) {
params = JSON.stringify(params);
create(params, callback) {
params = JSON.stringify(params);
var config = {
host: this.options.apiHost || "api.nexmo.com",
path: CallsResource.PATH,
method: "POST",
body: params,
headers: {
"Content-Type": "application/json",
"Content-Length": Buffer.byteLength(params),
Authorization: "Bearer ".concat(this.creds.generateJwt())
}
};
this.options.httpClient.request(config, callback);
}
/**
* Get an existing call.
*
* @param {string|object} query - The unique identifier for the call to retrieve
* or a set of filter parameters for the query. For more information
* see https://docs.nexmo.com/voice/voice-api/api-reference#call_retrieve
* @param {function} callback - function to be called when the request completes.
*/
var config = {
host: this.options.apiHost || "api.nexmo.com",
path: CallsResource.PATH,
method: "POST",
body: params,
headers: {
"Content-Type": "application/json",
"Content-Length": Buffer.byteLength(params),
Authorization: "Bearer " + this.creds.generateJwt()
}
};
this.options.httpClient.request(config, callback);
get(query, callback) {
if (!query) {
throw new Error('"query" is a required parameter');
}
/**
* Get an existing call.
*
* @param {string|object} query - The unique identifier for the call to retrieve
* or a set of filter parameters for the query. For more information
* see https://docs.nexmo.com/voice/voice-api/api-reference#call_retrieve
* @param {function} callback - function to be called when the request completes.
*/
var pathExt = "";
}, {
key: "get",
value: function get(query, callback) {
if (!query) {
throw new Error('"query" is a required parameter');
}
if (typeof query === "string") {
// single call Id
pathExt = "/".concat(query);
} else if (typeof query === "object" && Object.keys(query).length > 0) {
// filter
pathExt = "?".concat(_querystring.default.stringify(query));
}
var pathExt = "";
if (typeof query === "string") {
// single call Id
pathExt = "/" + query;
} else if ((typeof query === "undefined" ? "undefined" : _typeof(query)) === "object" && Object.keys(query).length > 0) {
// filter
pathExt = "?" + _querystring2.default.stringify(query);
var config = {
host: this.options.apiHost || "api.nexmo.com",
path: "".concat(CallsResource.PATH).concat(pathExt),
method: "GET",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer ".concat(this.creds.generateJwt())
}
};
this.options.httpClient.request(config, callback);
}
/**
* Update an existing call.
*
* @param {string} [callId] - The unique identifier for the call to update.
* @param {Object} params - Parameters used when updating the call. See https://developer.nexmo.com/api/voice#modify-an-existing-call for more information.
* @param {function} callback - function to be called when the request completes.
*/
var config = {
host: this.options.apiHost || "api.nexmo.com",
path: "" + CallsResource.PATH + pathExt,
method: "GET",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + this.creds.generateJwt()
}
};
this.options.httpClient.request(config, callback);
}
/**
* Update an existing call.
*
* @param {string} [callId] - The unique identifier for the call to update.
* @param {Object} params - Parameters used when updating the call. See https://developer.nexmo.com/api/voice#modify-an-existing-call for more information.
* @param {function} callback - function to be called when the request completes.
*/
update(callId, params, callback) {
params = JSON.stringify(params);
var config = {
host: this.options.apiHost || "api.nexmo.com",
path: "".concat(CallsResource.PATH, "/").concat(callId),
method: "PUT",
body: params,
headers: {
"Content-Type": "application/json",
"Content-Length": Buffer.byteLength(params),
Authorization: "Bearer ".concat(this.creds.generateJwt())
}
};
this.options.httpClient.request(config, callback);
}
}, {
key: "update",
value: function update(callId, params, callback) {
params = JSON.stringify(params);
}
var config = {
host: this.options.apiHost || "api.nexmo.com",
path: CallsResource.PATH + "/" + callId,
method: "PUT",
body: params,
headers: {
"Content-Type": "application/json",
"Content-Length": Buffer.byteLength(params),
Authorization: "Bearer " + this.creds.generateJwt()
}
};
this.options.httpClient.request(config, callback);
}
}]);
return CallsResource;
}();
exports.default = CallsResource;
module.exports = exports["default"];
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9DYWxsc1Jlc291cmNlLmpzIl0sIm5hbWVzIjpbIkNhbGxzUmVzb3VyY2UiLCJjcmVkcy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mFjaykge1xuICAgIHBhcmFtcyA9IEpTT04uc3RyaW5naWZ5KHBhcmFtcyk7XG5cbiAgICB2YXIgY29uZmlnID0ge1xuICAgICAgaG9zdDogdGhpcy5vcHRpb25zLmFwaUhvc3QgfHwgXCJhcGkubmV4bW8uY29tXCIsXG4gICAgICBwYXRoOiBgJHtDYWxsc1Jlc291cmNlLlBBVEh9LyR7Y2FsbElkfWAsXG4gICAgICBtZXRob2Q6IFwiUFVUXCIsXG4gICAgICBib2R5OiBwYXJhbXMsXG4gICAgICBoZWFkZXJzOiB7XG4gICAgICAgIFwiQ29udGVudC1UeXBlXCI6IFwiYXBwbGljYXRpb24vanNvblwiLFxuICAgICAgICBcIkNvbnRlbnQtTGVuZ3RoXCI6IEJ1ZmZlci5ieXRlTGVuZ3RoKHBhcmFtcyksXG4gICAgICAgIEF1dGhvcml6YXRpb246IGBCZWFyZXIgJHt0aGlzLmNyZWRzLmdlbmVyYXRlSnd0KCl9YFxuICAgICAgfVxuICAgIH07XG4gICAgdGhpcy5vcHRpb25zLmh0dHBDbGllbnQucmVxdWVzdChjb25maWcsIGNhbGxiYWNrKTtcbiAgfVxufVxuXG5leHBvcnQgZGVmYXVsdCBDYWxsc1Jlc291cmNlO1xuIl19
var _default = CallsResource;
exports.default = _default;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9DYWxsc1Jlc291cmNlLmpzIl0sIm5hbWVzIjpbIkNhbGxzUmVzb3VyY2UiLCJQQVRIIiwiY29uc3RydWN0b3IiLCJjcmVkcyIsIm9wdGlvbnMiLCJzdHJlYW0iLCJTdHJlYW1SZXNvdXJjZSIsInRhbGsiLCJUYWxrUmVzb3VyY2UiLCJkdG1mIiwiRHRtZlJlc291cmNlIiwiY3JlYXRlIiwicGFyYW1zIiwiY2FsbGJhY2siLCJKU09OIiwic3RyaW5naWZ5IiwiY29uZmlnIiwiaG9zdCIsImFwaUhvc3QiLCJ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,42 @@ "use strict";

});
exports.default = void 0;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _NullLogger = _interopRequireDefault(require("./NullLogger"));
var _NullLogger2 = require("./NullLogger");
var _NullLogger3 = _interopRequireDefault(_NullLogger2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
class ConsoleLogger extends _NullLogger.default {
constructor(consoleOverride) {
super();
this.out = consoleOverride || console;
}
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
log(level) {
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
this.out.log("".concat(level, ":"), ...args);
}
var ConsoleLogger = function (_NullLogger) {
_inherits(ConsoleLogger, _NullLogger);
warn() {
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
function ConsoleLogger(consoleOverride) {
_classCallCheck(this, ConsoleLogger);
var _this = _possibleConstructorReturn(this, (ConsoleLogger.__proto__ || Object.getPrototypeOf(ConsoleLogger)).call(this));
_this.out = consoleOverride || console;
return _this;
this.log("warn", ...args);
}
_createClass(ConsoleLogger, [{
key: "log",
value: function log(level) {
var _out;
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
(_out = this.out).log.apply(_out, [level + ":"].concat(args));
error() {
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
args[_key3] = arguments[_key3];
}
}, {
key: "warn",
value: function warn() {
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
this.log.apply(this, ["warn"].concat(args));
}
}, {
key: "error",
value: function error() {
var _out2;
this.out.error("error:", ...args);
}
for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
args[_key3] = arguments[_key3];
}
}
(_out2 = this.out).error.apply(_out2, ["error:"].concat(args));
}
}]);
return ConsoleLogger;
}(_NullLogger3.default);
exports.default = ConsoleLogger;
module.exports = exports["default"];
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9Db25zb2xlTG9nZ2VyLmpzIl0sIm5hbWVzIjpbIkNvbnNvbGVMb2dnZXIiLCJjb25zb2xlT3ZlcnJpZGUiLCJvdXQiLCJjb25zb2xlIiwibGV2ZWwiLCJhcmdzIiwibG9nIiwiZXJyb3IiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7O0FBQUE7Ozs7Ozs7Ozs7OztJQUVNQSxhOzs7QUFDSix5QkFBWUMsZUFBWixFQUE2QjtBQUFBOztBQUFBOztBQUczQixVQUFLQyxHQUFMLEdBQVdELG1CQUFtQkUsT0FBOUI7QUFIMkI7QUFJNUI7Ozs7d0JBRUdDLEssRUFBZ0I7QUFBQTs7QUFBQSx3Q0FBTkMsSUFBTTtBQUFOQSxZQUFNO0FBQUE7O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9nZ2VyIGV4dGVuZHMgTnVsbExvZ2dlciB7XG4gIGNvbnN0cnVjdG9yKGNvbnNvbGVPdmVycmlkZSkge1xuICAgIHN1cGVyKCk7XG5cbiAgICB0aGlzLm91dCA9IGNvbnNvbGVPdmVycmlkZSB8fCBjb25zb2xlO1xuICB9XG5cbiAgbG9nKGxldmVsLCAuLi5hcmdzKSB7XG4gICAgdGhpcy5vdXQubG9nKGAke2xldmVsfTpgLCAuLi5hcmdzKTtcbiAgfVxuXG4gIHdhcm4oLi4uYXJncykge1xuICAgIHRoaXMubG9nKFwid2FyblwiLCAuLi5hcmdzKTtcbiAgfVxuXG4gIGVycm9yKC4uLmFyZ3MpIHtcbiAgICB0aGlzLm91dC5lcnJvcihcImVycm9yOlwiLCAuLi5hcmdzKTtcbiAgfVxufVxuXG5leHBvcnQgZGVmYXVsdCBDb25zb2xlTG9nZ2VyO1xuIl19

@@ -6,37 +6,30 @@ "use strict";

});
exports.default = void 0;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
class Conversion {
constructor(credentials, options) {
this.creds = credentials;
this.options = options;
}
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
voice(message_id, delivered, timestamp, callback) {
return this.submit("voice", message_id, delivered, timestamp, callback);
}
var Conversion = function () {
function Conversion(credentials, options) {
_classCallCheck(this, Conversion);
sms(message_id, delivered, timestamp, callback) {
return this.submit("sms", message_id, delivered, timestamp, callback);
}
this.creds = credentials;
this.options = options;
submit(type, message_id, delivered, timestamp, callback) {
return this.options.api.postUseQueryString("/conversions/" + type, {
"message-id": message_id,
delivered,
timestamp
}, this.options.api._addLimitedAccessMessageToErrors(callback, 402));
}
_createClass(Conversion, [{
key: "voice",
value: function voice(message_id, delivered, timestamp, callback) {
return this.submit("voice", message_id, delivered, timestamp, callback);
}
}, {
key: "sms",
value: function sms(message_id, delivered, timestamp, callback) {
return this.submit("sms", message_id, delivered, timestamp, callback);
}
}, {
key: "submit",
value: function submit(type, message_id, delivered, timestamp, callback) {
return this.options.api.postUseQueryString("/conversions/" + type, { "message-id": message_id, delivered: delivered, timestamp: timestamp }, this.options.api._addLimitedAccessMessageToErrors(callback, 402));
}
}]);
}
return Conversion;
}();
exports.default = Conversion;
module.exports = exports["default"];
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9Db252ZXJzaW9uLmpzIl0sIm5hbWVzIjpbIkNvbnZlcnNpb24iLCJjcmVkZW50aWFscyIsIm9wdGlvbnMiLCJjcmVkcyIsIm1lc3NhZ2VfaWQiLCJkZWxpdmVyZWQiLCJ0aW1lc3RhbXAiLCJjYWxsYmFjayIsInN1Ym1pdCIsInR5cGUiLCJhcGkiLCJwb3N0VXNlUXVlcnlTdHJpbmciLCJfYWRkTGltaXRlZEFjY2Vzc01lc3NhZ2VUb0Vycm9ycyJdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7Ozs7Ozs7SUFFTUEsVTtBQUNKLHNCQUFZQyxXQUFaLEVBQXlCQyxPQUF6QixFQUFrQztBQUFBOztBQUNoQyxTQUFLQyxLQUFMLEdBQWFGLFdBQWI7QUFDQSxTQUFLQyxPQUFMLEdBQWVBLE9BQWY7QUFDRDs7OzswQkFFS0UsVSxFQUFZQyxTLEVBQVdDLFMsRUFBV0MsUSxFQUFVO0FBQ2hELGFBQU8sS0FBS0MsTUFBTCxDQUFZLE9BQVosRUFBcUJKLFVBQXJCLEVBQWlDQyxTQUFqQyxFQUE0Q0MsU0FBNUMsRUFBdURDLFFBQXZELENBQVA7QUFDRDs7O3dCQU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gICAgdGhpcy5jcmVkcyA9IGNyZWRlbnRpYWxzO1xuICAgIHRoaXMub3B0aW9ucyA9IG9wdGlvbnM7XG4gIH1cblxuICB2b2ljZShtZXNzYWdlX2lkLCBkZWxpdmVyZWQsIHRpbWVzdGFtcCwgY2FsbGJhY2spIHtcbiAgICByZXR1cm4gdGhpcy5zdWJtaXQoXCJ2b2ljZVwiLCBtZXNzYWdlX2lkLCBkZWxpdmVyZWQsIHRpbWVzdGFtcCwgY2FsbGJhY2spO1xuICB9XG5cbiAgc21zKG1lc3NhZ2VfaWQsIGRlbGl2ZXJlZCwgdGltZXN0YW1wLCBjYWxsYmFjaykge1xuICAgIHJldHVybiB0aGlzLnN1Ym1pdChcInNtc1wiLCBtZXNzYWdlX2lkLCBkZWxpdmVyZWQsIHRpbWVzdGFtcCwgY2FsbGJhY2spO1xuICB9XG5cbiAgc3VibWl0KHR5cGUsIG1lc3NhZ2VfaWQsIGRlbGl2ZXJlZCwgdGltZXN0YW1wLCBjYWxsYmFjaykge1xuICAgIHJldHVybiB0aGlzLm9wdGlvbnMuYXBpLnBvc3RVc2VRdWVyeVN0cmluZyhcbiAgICAgIFwiL2NvbnZlcnNpb25zL1wiICsgdHlwZSxcbiAgICAgIHsgXCJtZXNzYWdlLWlkXCI6IG1lc3NhZ2VfaWQsIGRlbGl2ZXJlZCwgdGltZXN0YW1wIH0sXG4gICAgICB0aGlzLm9wdGlvbnMuYXBpLl9hZGRMaW1pdGVkQWNjZXNzTWVzc2FnZVRvRXJyb3JzKGNhbGxiYWNrLCA0MDIpXG4gICAgKTtcbiAgfVxufVxuXG5leHBvcnQgZGVmYXVsdCBDb252ZXJzaW9uO1xuIl19

@@ -6,21 +6,12 @@ "use strict";

});
exports.default = void 0;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _fs = _interopRequireDefault(require("fs"));
var _fs = require("fs");
var _JwtGenerator = _interopRequireDefault(require("./JwtGenerator"));
var _fs2 = _interopRequireDefault(_fs);
var _HashGenerator = _interopRequireDefault(require("./HashGenerator"));
var _JwtGenerator = require("./JwtGenerator");
var _JwtGenerator2 = _interopRequireDefault(_JwtGenerator);
var _HashGenerator = require("./HashGenerator");
var _HashGenerator2 = _interopRequireDefault(_HashGenerator);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/**

@@ -41,12 +32,8 @@ * Right now only key/secret credentials are supported.

*/
var Credentials = function () {
function Credentials(apiKey, apiSecret, privateKey, applicationId, signatureSecret, signatureMethod) {
_classCallCheck(this, Credentials);
class Credentials {
constructor(apiKey, apiSecret, privateKey, applicationId, signatureSecret, signatureMethod) {
this.apiKey = apiKey;
this.apiSecret = apiSecret;
this.privateKey = null;
this.applicationId = applicationId;
this.signatureSecret = signatureSecret;

@@ -56,17 +43,21 @@ this.signatureMethod = signatureMethod;

if (privateKey instanceof Buffer) {
// it is already a buffer, use it as-is
this.privateKey = privateKey;
} else if (typeof privateKey === "string" && privateKey.startsWith("-----BEGIN PRIVATE KEY-----")) {
this.privateKey = new Buffer(privateKey);
// It's a key string. Check for \n, replace with newlines
privateKey = privateKey.replace(/\\n/g, "\n");
this.privateKey = Buffer.from(privateKey, "utf-8");
} else if (privateKey !== undefined) {
if (!_fs2.default.existsSync(privateKey)) {
throw new Error("File \"" + privateKey + "\" not found.");
if (!_fs.default.existsSync(privateKey)) {
throw new Error("File \"".concat(privateKey, "\" not found."));
}
this.privateKey = _fs2.default.readFileSync(privateKey);
this.privateKey = _fs.default.readFileSync(privateKey);
}
/** @private */
/** @private */
this._jwtGenerator = new _JwtGenerator2.default();
this._hashGenerator = new _HashGenerator2.default();
this._jwtGenerator = new _JwtGenerator.default();
this._hashGenerator = new _HashGenerator.default();
}
/**

@@ -84,67 +75,56 @@ * Generate a Jwt using the Private Key in the Credentials.

_createClass(Credentials, [{
key: "generateJwt",
value: function generateJwt() {
var applicationId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.applicationId;
var privateKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.privateKey;
generateJwt() {
var applicationId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.applicationId;
var privateKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.privateKey;
var claims = {
application_id: applicationId
};
var claims = {
application_id: applicationId
};
var token = this._jwtGenerator.generate(privateKey, claims);
return token;
}
}, {
key: "generateSignature",
value: function generateSignature(params) {
var signatureSecret = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.signatureSecret;
var signatureMethod = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.signatureMethod;
var token = this._jwtGenerator.generate(privateKey, claims);
return this._hashGenerator.generate(signatureMethod, signatureSecret, params);
}
return token;
}
/**
* @private
* Used for testing purposes only.
*/
generateSignature(params) {
var signatureSecret = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.signatureSecret;
var signatureMethod = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.signatureMethod;
return this._hashGenerator.generate(signatureMethod, signatureSecret, params);
}
/**
* @private
* Used for testing purposes only.
*/
}, {
key: "_setJwtGenerator",
value: function _setJwtGenerator(generator) {
this._jwtGenerator = generator;
}
/**
* @private
* Used for testing purposes only.
*/
_setJwtGenerator(generator) {
this._jwtGenerator = generator;
}
/**
* @private
* Used for testing purposes only.
*/
}, {
key: "_setHashGenerator",
value: function _setHashGenerator(generator) {
this._hashGenerator = generator;
}
/**
* Ensures a credentials instance is used.
*
* Key/Secret credentials are only supported at present.
*/
_setHashGenerator(generator) {
this._hashGenerator = generator;
}
/**
* Ensures a credentials instance is used.
*
* Key/Secret credentials are only supported at present.
*/
}], [{
key: "parse",
value: function parse(obj) {
if (obj instanceof Credentials) {
return obj;
} else {
return new Credentials(obj.apiKey, obj.apiSecret, obj.privateKey, obj.applicationId, obj.signatureSecret, obj.signatureMethod);
}
static parse(obj) {
if (obj instanceof Credentials) {
return obj;
} else {
return new Credentials(obj.apiKey, obj.apiSecret, obj.privateKey, obj.applicationId, obj.signatureSecret, obj.signatureMethod);
}
}]);
}
return Credentials;
}();
}
exports.default = Credentials;
module.exports = exports["default"];
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9DcmVkZW50aWFscy5qcyJdLCJuYW1lcyI6WyJDcmVkZW50aWFscyIsImFwaUtleSIsImFwaVNlY3JldCIsInByaXZhdGVLZXkiLCJhcHBsaWNhdGlvbklkIiwic2lnbmF0dXJlU2VjcmV0Iiwic2lnbmF0dXJlTWV0aG9kIiwiQnVmZmVyIiwic3RhcnRzV2l0aCIsInVuZGVmaW5lZCIsImV4aXN0c1N5bmMiLCJFcnJvciIsInJlYWRGaWxlU3luYyIsIl9qd3RHZW5lcmF0b3IiLCJfaGFzaEdlbmVyYXRvciIsImNsYWltcyIsImFwcGxpY2F0aW9uX2lkIiwidG9rZW4iLCJnZW5lcmF0ZSIsInBhcmFtcyIsImdlbmVyYXRvciIsIm9iaiJdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7Ozs7O0FBRUE7Ozs7QUFDQTs7OztBQUNBOzs7Ozs7OztBQUVBOzs7Ozs7Ozs7Ozs7Ozs7SUFlTUEsVztBQUNKLHVCQUNFQyxNQURGLEVBRUVDLFNBRkYsRUFHRUMsVUFIRixFQUlFQyxhQUpGLEVBS0VDLGVBTEYsRUFNRUMsZUFORixFQU9FO0FBQUE7O0FBQ0EsU0FBS0wsTUFBTCxHQUFjQSxNQUFkO0FBQ0EsU0FBS0MsU0FBTCxHQUFp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AgIG9iai5wcml2YXRlS2V5LFxuICAgICAgICBvYmouYXBwbGljYXRpb25JZCxcbiAgICAgICAgb2JqLnNpZ25hdHVyZVNlY3JldCxcbiAgICAgICAgb2JqLnNpZ25hdHVyZU1ldGhvZFxuICAgICAgKTtcbiAgICB9XG4gIH1cbn1cblxuZXhwb3J0IGRlZmF1bHQgQ3JlZGVudGlhbHM7XG4iXX0=
var _default = Credentials;
exports.default = _default;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9DcmVkZW50aWFscy5qcyJdLCJuYW1lcyI6WyJDcmVkZW50aWFscyIsImNvbnN0cnVjdG9yIiwiYXBpS2V5IiwiYXBpU2VjcmV0IiwicHJpdmF0ZUtleSIsImFwcGxpY2F0aW9uSWQiLCJzaWduYXR1cmVTZWNyZXQiLCJzaWduYXR1cmVNZXRob2QiLCJCdWZmZXIiLCJzdGFydHNXaXRoIiwicmVwbGFjZSIsImZyb20iLCJ1bmRlZmluZWQiLCJmcyIsImV4aXN0c1N5bmMiLCJFcnJvciIsInJlYWRGaWxlU3luYyIsIl9qd3RHZW5lcmF0b3IiLCJKd3RHZW5lcmF0b3IiLCJfaGFzaEdlbmVyYXRvciIsIkhhc2hHZW5lcmF0b3IiLCJnZW5lcmF0ZUp3dCIsImNsYWltcyIsImFwcGxpY2F0aW9uX2lkIiwidG9rZW4iLCJnZW5lcmF0ZSIsImdlbmVyYXRlU2lnbmF0dXJlIiwicGFyYW1zIiwiX3NldEp3dEdlbmVyYXRvciIsImdlbmVyYXRvciIsIl9zZXRIYXNoR2VuZXJhdG9yIiwicGFyc2UiLCJvYmoiXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7O0FBRUE7O0FBQ0E7O0FBQ0E7Ozs7QUFFQTs7Ozs7Ozs7Ozs7Ozs7O0FBZUEsTUFBTUEsV0FBTixDQUFrQjtBQUNoQkMsRUFBQUEsV0FBVyxDQUNUQyxNQURTL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BwdXJwb3NlcyBvbmx5LlxuICAgKi9cbiAgX3NldEp3dEdlbmVyYXRvcihnZW5lcmF0b3IpIHtcbiAgICB0aGlzLl9qd3RHZW5lcmF0b3IgPSBnZW5lcmF0b3I7XG4gIH1cblxuICAvKipcbiAgICogQHByaXZhdGVcbiAgICogVXNlZCBmb3IgdGVzdGluZyBwdXJwb3NlcyBvbmx5LlxuICAgKi9cbiAgX3NldEhhc2hHZW5lcmF0b3IoZ2VuZXJhdG9yKSB7XG4gICAgdGhpcy5faGFzaEdlbmVyYXRvciA9IGdlbmVyYXRvcjtcbiAgfVxuXG4gIC8qKlxuICAgKiBFbnN1cmVzIGEgY3JlZGVudGlhbHMgaW5zdGFuY2UgaXMgdXNlZC5cbiAgICpcbiAgICogS2V5L1NlY3JldCBjcmVkZW50aWFscyBhcmUgb25seSBzdXBwb3J0ZWQgYXQgcHJlc2VudC5cbiAgICovXG4gIHN0YXRpYyBwYXJzZShvYmopIHtcbiAgICBpZiAob2JqIGluc3RhbmNlb2YgQ3JlZGVudGlhbHMpIHtcbiAgICAgIHJldHVybiBvYmo7XG4gICAgfSBlbHNlIHtcbiAgICAgIHJldHVybiBuZXcgQ3JlZGVudGlhbHMoXG4gICAgICAgIG9iai5hcGlLZXksXG4gICAgICAgIG9iai5hcGlTZWNyZXQsXG4gICAgICAgIG9iai5wcml2YXRlS2V5LFxuICAgICAgICBvYmouYXBwbGljYXRpb25JZCxcbiAgICAgICAgb2JqLnNpZ25hdHVyZVNlY3JldCxcbiAgICAgICAgb2JqLnNpZ25hdHVyZU1ldGhvZFxuICAgICAgKTtcbiAgICB9XG4gIH1cbn1cblxuZXhwb3J0IGRlZmF1bHQgQ3JlZGVudGlhbHM7XG4iXX0=

@@ -6,37 +6,26 @@ "use strict";

});
exports.default = void 0;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/**
* Provides access to the `dtmf` resource.
*/
var DtmfResource = function () {
_createClass(DtmfResource, null, [{
key: "PATH",
class DtmfResource {
/**
* The path to the `dtmf` resource.
*/
static get PATH() {
return "/v1/calls/{call_uuid}/dtmf";
}
/**
* Creates a new DtmfResource.
*
* @param {Credentials} creds - Credentials used when interacting with the Nexmo API.
* @param {Object} options - additional options for the class.
*/
/**
* The path to the `dtmf` resource.
*/
get: function get() {
return "/v1/calls/{call_uuid}/dtmf";
}
/**
* Creates a new DtmfResource.
*
* @param {Credentials} creds - Credentials used when interacting with the Nexmo API.
* @param {Object} options - additional options for the class.
*/
}]);
function DtmfResource(creds, options) {
_classCallCheck(this, DtmfResource);
constructor(creds, options) {
this.creds = creds;
this.options = options;
}
/**

@@ -50,27 +39,22 @@ * Sends DTMF to a call.

_createClass(DtmfResource, [{
key: "send",
value: function send(callId, params, callback) {
params = JSON.stringify(params);
send(callId, params, callback) {
params = JSON.stringify(params);
var config = {
host: this.options.apiHost || "api.nexmo.com",
path: DtmfResource.PATH.replace("{call_uuid}", callId),
method: "PUT",
body: params,
headers: {
"Content-Type": "application/json",
"Content-Length": Buffer.byteLength(params),
Authorization: "Bearer ".concat(this.creds.generateJwt())
}
};
this.options.httpClient.request(config, callback);
}
var config = {
host: this.options.apiHost || "api.nexmo.com",
path: DtmfResource.PATH.replace("{call_uuid}", callId),
method: "PUT",
body: params,
headers: {
"Content-Type": "application/json",
"Content-Length": Buffer.byteLength(params),
Authorization: "Bearer " + this.creds.generateJwt()
}
};
this.options.httpClient.request(config, callback);
}
}]);
}
return DtmfResource;
}();
exports.default = DtmfResource;
module.exports = exports["default"];
//# sourceMappingURL=data:application/json;charset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IHVzZWQgd2hlbiBzZW5kaW5nIHRoZSBkdG1mIHRvIHRoZSBjYWxsLiBTZWUgaHR0cHM6Ly9kZXZlbG9wZXIubmV4bW8uY29tL2FwaS92b2ljZSNkdG1mIGZvciBtb3JlIGluZm9ybWF0aW9uLlxuICAgKiBAcGFyYW0ge2Z1bmN0aW9ufSBjYWxsYmFjayAtIGZ1bmN0aW9uIHRvIGJlIGNhbGxlZCB3aGVuIHRoZSByZXF1ZXN0IGNvbXBsZXRlcy5cbiAgICovXG4gIHNlbmQoY2FsbElkLCBwYXJhbXMsIGNhbGxiYWNrKSB7XG4gICAgcGFyYW1zID0gSlNPTi5zdHJpbmdpZnkocGFyYW1zKTtcblxuICAgIHZhciBjb25maWcgPSB7XG4gICAgICBob3N0OiB0aGlzLm9wdGlvbnMuYXBpSG9zdCB8fCBcImFwaS5uZXhtby5jb21cIixcbiAgICAgIHBhdGg6IER0bWZSZXNvdXJjZS5QQVRILnJlcGxhY2UoXCJ7Y2FsbF91dWlkfVwiLCBjYWxsSWQpLFxuICAgICAgbWV0aG9kOiBcIlBVVFwiLFxuICAgICAgYm9keTogcGFyYW1zLFxuICAgICAgaGVhZGVyczoge1xuICAgICAgICBcIkNvbnRlbnQtVHlwZVwiOiBcImFwcGxpY2F0aW9uL2pzb25cIixcbiAgICAgICAgXCJDb250ZW50LUxlbmd0aFwiOiBCdWZmZXIuYnl0ZUxlbmd0aChwYXJhbXMpLFxuICAgICAgICBBdXRob3JpemF0aW9uOiBgQmVhcmVyICR7dGhpcy5jcmVkcy5nZW5lcmF0ZUp3dCgpfWBcbiAgICAgIH1cbiAgICB9O1xuICAgIHRoaXMub3B0aW9ucy5odHRwQ2xpZW50LnJlcXVlc3QoY29uZmlnLCBjYWxsYmFjayk7XG4gIH1cbn1cblxuZXhwb3J0IGRlZmF1bHQgRHRtZlJlc291cmNlO1xuIl19
var _default = DtmfResource;
exports.default = _default;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9u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lcXVlc3QoY29uZmlnLCBjYWxsYmFjayk7XG4gIH1cbn1cblxuZXhwb3J0IGRlZmF1bHQgRHRtZlJlc291cmNlO1xuIl19

@@ -6,36 +6,25 @@ "use strict";

});
exports.default = void 0;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var fs = require("fs");
var FilesResource = function () {
_createClass(FilesResource, null, [{
key: "PATH",
class FilesResource {
/**
* The path to the `calls` resource.
*/
static get PATH() {
return "/v1/files";
}
/**
* Creates a new FilesResource.
*
* @param {Credentials} creds - Credentials used when interacting with the Nexmo API.
* @param {Object} options - additional options for the class.
*/
/**
* The path to the `calls` resource.
*/
get: function get() {
return "/v1/files";
}
/**
* Creates a new FilesResource.
*
* @param {Credentials} creds - Credentials used when interacting with the Nexmo API.
* @param {Object} options - additional options for the class.
*/
}]);
function FilesResource(creds, options) {
_classCallCheck(this, FilesResource);
constructor(creds, options) {
this.creds = creds;
this.options = options;
}
/**

@@ -49,63 +38,52 @@ * Get stream for a remote File

_createClass(FilesResource, [{
key: "get",
value: function get(fileIdOrUrl, callback) {
if (!fileIdOrUrl) {
throw new Error('"fileIdOrUrl" is a required parameter');
get(fileIdOrUrl, callback) {
if (!fileIdOrUrl) {
throw new Error('"fileIdOrUrl" is a required parameter');
}
fileIdOrUrl = fileIdOrUrl.split("/").pop(-1);
var config = {
host: this.options.apiHost || "api.nexmo.com",
path: "".concat(FilesResource.PATH, "/").concat(fileIdOrUrl),
method: "GET",
headers: {
"Content-Type": "application/octet-stream",
Authorization: "Bearer ".concat(this.creds.generateJwt())
}
};
this.options.httpClient.request(config, callback);
}
/**
* Save remote File locally
*
* @param {string} [fileIdOrUrl] - The unique identifier or URL for the file
* @param {string} [file] - Filename or file descriptor
* @param {function} callback - function to be called when the request completes.
*/
fileIdOrUrl = fileIdOrUrl.split("/").pop(-1);
var config = {
host: this.options.apiHost || "api.nexmo.com",
path: FilesResource.PATH + "/" + fileIdOrUrl,
method: "GET",
headers: {
"Content-Type": "application/octet-stream",
Authorization: "Bearer " + this.creds.generateJwt()
}
};
save(fileIdOrUrl, file, callback) {
this.get(fileIdOrUrl, (error, data) => {
if (error) {
callback(error, null);
} else {
this.__storeFile(data, file, callback);
}
});
}
this.options.httpClient.request(config, callback);
}
__storeFile(data, file, callback) {
fs.writeFile(file, data, error => {
if (error) {
callback(error, null);
} else {
callback(null, file);
}
});
}
/**
* Save remote File locally
*
* @param {string} [fileIdOrUrl] - The unique identifier or URL for the file
* @param {string} [file] - Filename or file descriptor
* @param {function} callback - function to be called when the request completes.
*/
}
}, {
key: "save",
value: function save(fileIdOrUrl, file, callback) {
var _this = this;
this.get(fileIdOrUrl, function (error, data) {
if (error) {
callback(error, null);
} else {
_this.__storeFile(data, file, callback);
}
});
}
}, {
key: "__storeFile",
value: function __storeFile(data, file, callback) {
fs.writeFile(file, data, function (error) {
if (error) {
callback(error, null);
} else {
callback(null, file);
}
});
}
}]);
return FilesResource;
}();
exports.default = FilesResource;
module.exports = exports["default"];
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9GaWxlc1Jlc291cmNlLmpzIl0sIm5hbWVzIjpbImZzIiwicmVxdWlyZSIsIkZpbGVzUmVzb3VyY2UiLCJjcmVkcyIsIm9wdGlvbnMiLCJmaWxlSWRPclVybCIsImNhbGxiYWNrIiwiRXJyb3IiLCJzcGxpdCIsInBvcCIsImNvbmZpZyIsImhvc3QiLCJhcGlIb3N0IiwicGF0aCIsIlBBVEgiLCJt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ZpZywgY2FsbGJhY2spO1xuICB9XG5cbiAgLyoqXG4gICAqIFNhdmUgcmVtb3RlIEZpbGUgbG9jYWxseVxuICAgKlxuICAgKiBAcGFyYW0ge3N0cmluZ30gW2ZpbGVJZE9yVXJsXSAtIFRoZSB1bmlxdWUgaWRlbnRpZmllciBvciBVUkwgZm9yIHRoZSBmaWxlXG4gICAqIEBwYXJhbSB7c3RyaW5nfSBbZmlsZV0gLSBGaWxlbmFtZSBvciBmaWxlIGRlc2NyaXB0b3JcbiAgICogQHBhcmFtIHtmdW5jdGlvbn0gY2FsbGJhY2sgLSBmdW5jdGlvbiB0byBiZSBjYWxsZWQgd2hlbiB0aGUgcmVxdWVzdCBjb21wbGV0ZXMuXG4gICAqL1xuICBzYXZlKGZpbGVJZE9yVXJsLCBmaWxlLCBjYWxsYmFjaykge1xuICAgIHRoaXMuZ2V0KGZpbGVJZE9yVXJsLCAoZXJyb3IsIGRhdGEpID0+IHtcbiAgICAgIGlmIChlcnJvcikge1xuICAgICAgICBjYWxsYmFjayhlcnJvciwgbnVsbCk7XG4gICAgICB9IGVsc2Uge1xuICAgICAgICB0aGlzLl9fc3RvcmVGaWxlKGRhdGEsIGZpbGUsIGNhbGxiYWNrKTtcbiAgICAgIH1cbiAgICB9KTtcbiAgfVxuXG4gIF9fc3RvcmVGaWxlKGRhdGEsIGZpbGUsIGNhbGxiYWNrKSB7XG4gICAgZnMud3JpdGVGaWxlKGZpbGUsIGRhdGEsIGVycm9yID0+IHtcbiAgICAgIGlmIChlcnJvcikge1xuICAgICAgICBjYWxsYmFjayhlcnJvciwgbnVsbCk7XG4gICAgICB9IGVsc2Uge1xuICAgICAgICBjYWxsYmFjayhudWxsLCBmaWxlKTtcbiAgICAgIH1cbiAgICB9KTtcbiAgfVxufVxuXG5leHBvcnQgZGVmYXVsdCBGaWxlc1Jlc291cmNlO1xuIl19
"use strict";
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var crypto = require("crypto");
var HashGenerator = function () {
function HashGenerator() {
_classCallCheck(this, HashGenerator);
}
class HashGenerator {
/**
* Generate a Signature Hash.
*
* @param {String} method - the method to be used when creating the hash
* @param {String} secret - the secret to be used when creating the hash
* @param {Object} params - params to generate hash from
*
* @returns {String} the generated token
*/
generate(method, secret, params) {
params = params || {};
var signedQuery = "";
params = JSON.parse(JSON.stringify(params));
_createClass(HashGenerator, [{
key: "generate",
if (params.sig) {
delete params.sig;
}
/**
* Generate a Signature Hash.
*
* @param {String} method - the method to be used when creating the hash
* @param {String} secret - the secret to be used when creating the hash
* @param {Object} params - params to generate hash from
*
* @returns {String} the generated token
*/
value: function generate(method, secret, params) {
params = params || {};
var signedQuery = "";
Object.keys(params).sort().forEach(key => {
// replace & and = with _
signedQuery += "&" + key + "=" + params[key].replace(/\&|\=/g, "_");
});
var hash = "";
params = JSON.parse(JSON.stringify(params));
switch (method) {
case "md5hash":
signedQuery += secret;
hash = crypto.createHash("md5").update(signedQuery).digest("hex");
break;
if (params.sig) {
delete params.sig;
}
case "md5":
case "sha1":
case "sha256":
case "sha512":
hash = crypto.createHmac(method, secret).update(signedQuery).digest("hex");
break;
Object.keys(params).sort().forEach(function (key) {
// replace & and = with _
signedQuery += "&" + key + "=" + params[key].replace(/\&|\=/g, "_");
});
default:
throw "Unknown signature algorithm: ".concat(method, ". Expected: md5hash, md5, sha1, sha256, or sha512");
}
var hash = "";
return hash;
}
switch (method) {
case "md5hash":
signedQuery += secret;
hash = crypto.createHash("md5").update(signedQuery).digest("hex");
break;
case "md5":
case "sha1":
case "sha256":
case "sha512":
hash = crypto.createHmac(method, secret).update(signedQuery).digest("hex");
break;
}
default:
throw "Unknown signature algorithm: " + method + ". Expected: md5hash, md5, sha1, sha256, or sha512";
}
return hash;
}
}]);
return HashGenerator;
}();
module.exports = HashGenerator;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9IYXNoR2VuZXJhdG9yLmpzIl0sIm5hbWVzIjpbImNyeXB0byIsInJlcXVpcmUiLCJIYXNoR2VuZXJhdG9yIiwibWV0aG9kIiwic2VjcmV0IiwicGFyYW1zIiwic2lnbmVkUXVlcnkiLCJKU09OIiwicGFyc2UiLCJzdHJpbmdpZnkiLCJzaWciLCJPYmplY3QiLCJrZXlzIiwic29ydCIsImZvckVhY2giLCJrZXkiLCJyZXBsYWNlIiwiaGFzaCIsImNyZWF0ZUhhc2giLCJ1cGRhdGUiLCJkaWdlc3QiLCJjcmVhdGVIbWFjIiwibW9kdWxlIiwiZXhwb3J0cyJdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBQUEsSUFBTUEsU0FBU0MsUUFBUSxRQUFSLENBQWY7O0lBRU1DLGE7Ozs7Ozs7O0FBQ0o7Ozs7Ozs7Ozs2QkFTU0MsTSxFQUFRQyxNLEVBQVFDLE0sRUFBUTtBQUMvQkEsZUFBU0EsVUFBVSxFQUFuQjtBQUNBLFVBQUlDLGNBQWMsRUFBbEI7O0FBRUFELGVBQVNFLEtBQUtDLEtBQUwsQ0FBV0QsS0FBS0UsU0FBTCxDQUFlSixNQUFmLENBQVgsQ0FBVDs7QUFFQSxVQUFJQSxPQUFPSyxHQUFYLEVBQWdCO0FBQ2QsZUFBT0wsT0FBT0ssR0FBZDtBQUNEOztBQUVEQyxhQUFPQyxJQUFQLENBQVlQLE1BQVosRUFDR1EsSUFESCxHQUVHQyxPQUZILENBRVcsZUFBTztBQUNkO0FBQ0FSLHVCQUFlLE1BQU1TLEdBQU4sR0FBWSxHQ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goa2V5ID0+IHtcbiAgICAgICAgLy8gcmVwbGFjZSAmIGFuZCA9IHdpdGggX1xuICAgICAgICBzaWduZWRRdWVyeSArPSBcIiZcIiArIGtleSArIFwiPVwiICsgcGFyYW1zW2tleV0ucmVwbGFjZSgvXFwmfFxcPS9nLCBcIl9cIik7XG4gICAgICB9KTtcblxuICAgIHZhciBoYXNoID0gXCJcIjtcblxuICAgIHN3aXRjaCAobWV0aG9kKSB7XG4gICAgICBjYXNlIFwibWQ1aGFzaFwiOlxuICAgICAgICBzaWduZWRRdWVyeSArPSBzZWNyZXQ7XG4gICAgICAgIGhhc2ggPSBjcnlwdG9cbiAgICAgICAgICAuY3JlYXRlSGFzaChcIm1kNVwiKVxuICAgICAgICAgIC51cGRhdGUoc2lnbmVkUXVlcnkpXG4gICAgICAgICAgLmRpZ2VzdChcImhleFwiKTtcbiAgICAgICAgYnJlYWs7XG4gICAgICBjYXNlIFwibWQ1XCI6XG4gICAgICBjYXNlIFwic2hhMVwiOlxuICAgICAgY2FzZSBcInNoYTI1NlwiOlxuICAgICAgY2FzZSBcInNoYTUxMlwiOlxuICAgICAgICBoYXNoID0gY3J5cHRvXG4gICAgICAgICAgLmNyZWF0ZUhtYWMobWV0aG9kLCBzZWNyZXQpXG4gICAgICAgICAgLnVwZGF0ZShzaWduZWRRdWVyeSlcbiAgICAgICAgICAuZGlnZXN0KFwiaGV4XCIpO1xuICAgICAgICBicmVhaztcblxuICAgICAgZGVmYXVsdDpcbiAgICAgICAgdGhyb3cgYFVua25vd24gc2lnbmF0dXJlIGFsZ29yaXRobTogJHttZXRob2R9LiBFeHBlY3RlZDogbWQ1aGFzaCwgbWQ1LCBzaGExLCBzaGEyNTYsIG9yIHNoYTUxMmA7XG4gICAgfVxuXG4gICAgcmV0dXJuIGhhc2g7XG4gIH1cbn1cblxubW9kdWxlLmV4cG9ydHMgPSBIYXNoR2VuZXJhdG9yO1xuIl19

@@ -6,16 +6,14 @@ "use strict";

});
exports.default = void 0;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var https = require("https");
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var http = require("http");
var https = require("https");
var http = require("http");
var request = require("request");
var querystring = require("querystring");
var HttpClient = function () {
function HttpClient(options, credentials) {
_classCallCheck(this, HttpClient);
class HttpClient {
constructor(options, credentials) {
this.credentials = credentials;

@@ -39,324 +37,268 @@ this.host = options.host || "rest.nexmo.com";

_createClass(HttpClient, [{
key: "request",
value: function request(endpoint, method, callback) {
var _this = this;
request(endpoint, method, callback) {
var skipJsonParsing = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
var customResponseParser = arguments.length > 4 ? arguments[4] : undefined;
var skipJsonParsing = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
var customResponseParser = arguments[4];
if (typeof method === "function") {
callback = method;
endpoint.method = endpoint.method || "GET";
} else if (typeof method !== "undefined") {
endpoint.method = method;
}
if (typeof method === "function") {
callback = method;
endpoint.method = endpoint.method || "GET";
} else if (typeof method !== "undefined") {
endpoint.method = method;
}
if (endpoint.method === "POST" || endpoint.method === "DELETE") {// TODO: verify the following fix is required
// Fix broken due ot 411 Content-Length error now sent by Nexmo API
// PL 2016-Sept-6 - commented out Content-Length 0
// headers['Content-Length'] = 0;
}
if (endpoint.method === "POST" || endpoint.method === "DELETE") {
// TODO: verify the following fix is required
// Fix broken due ot 411 Content-Length error now sent by Nexmo API
// PL 2016-Sept-6 - commented out Content-Length 0
// headers['Content-Length'] = 0;
}
var options = {
host: endpoint.host ? endpoint.host : this.host,
port: this.port,
path: endpoint.path,
method: endpoint.method,
headers: Object.assign({}, this.headers)
};
var options = {
host: endpoint.host ? endpoint.host : this.host,
port: this.port,
path: endpoint.path,
method: endpoint.method,
headers: Object.assign({}, this.headers)
};
if (this.timeout !== undefined) {
options.timeout = this.timeout;
}
if (this.timeout !== undefined) {
options.timeout = this.timeout;
} // Allow existing headers to be overridden
// Allow new headers to be added
// Allow existing headers to be overridden
// Allow new headers to be added
if (endpoint.headers) {
Object.keys(endpoint.headers).forEach(function (key) {
options.headers[key] = endpoint.headers[key];
});
}
if (this.credentials.signatureSecret && this.credentials.signatureMethod) {
var splitPath = options.path.split(/\?(.+)/);
var path = splitPath[0];
if (endpoint.headers) {
Object.keys(endpoint.headers).forEach(function (key) {
options.headers[key] = endpoint.headers[key];
});
}
var params = querystring.decode(splitPath[1]);
if (this.credentials.signatureSecret && this.credentials.signatureMethod) {
var splitPath = options.path.split(/\?(.+)/);
var path = splitPath[0];
var params = querystring.decode(splitPath[1]); // add timestamp if not already present
// add timestamp if not already present
if (!params.timestamp) {
params.timestamp = new Date().getTime() / 1000 | 0; // floor to seconds
params.timestamp = params.timestamp.toString();
}
if (!params.timestamp) {
params.timestamp = new Date().getTime() / 1000 | 0; // floor to seconds
// strip API Secret
delete params.api_secret;
params.timestamp = params.timestamp.toString();
} // strip API Secret
var hash = this.credentials.generateSignature(params);
var query = "";
delete params.api_secret;
var hash = this.credentials.generateSignature(params);
var query = ""; // rebuild query
// rebuild query
Object.keys(params).sort().forEach(function (key) {
query += "&" + key + "=" + encodeURI(params[key]);
});
Object.keys(params).sort().forEach(key => {
query += "&" + key + "=" + encodeURI(params[key]);
}); // replace the first & with ?
// replace the first & with ?
query = query.replace(/&/i, "?");
query = query.replace(/&/i, "?");
options.path = "".concat(path).concat(query, "&sig=").concat(hash);
}
options.path = "" + path + query + "&sig=" + hash;
}
this.logger.info("Request:", options, "\nBody:", endpoint.body);
var request;
this.logger.info("Request:", options, "\nBody:", endpoint.body);
var request;
if (options.port === 443) {
request = this.https.request(options);
} else {
request = this.http.request(options);
}
if (options.port === 443) {
request = this.https.request(options);
} else {
request = this.http.request(options);
request.end(endpoint.body); // Keep an array of String or Buffers,
// depending on content type (binary or JSON) of response
var responseData = [];
request.on("response", response => {
var isBinary = response.headers["content-type"] === "application/octet-stream";
if (!isBinary) {
response.setEncoding("utf8");
}
request.end(endpoint.body);
response.on("data", chunk => {
responseData.push(chunk);
});
response.on("end", () => {
this.logger.info("response ended:", response.statusCode);
// Keep an array of String or Buffers,
// depending on content type (binary or JSON) of response
var responseData = [];
if (callback) {
if (isBinary) {
responseData = Buffer.concat(responseData);
}
request.on("response", function (response) {
var isBinary = response.headers["content-type"] === "application/octet-stream";
if (!isBinary) {
response.setEncoding("utf8");
this.__parseResponse(response, responseData, endpoint.method, callback, skipJsonParsing, customResponseParser);
}
});
response.on("close", e => {
if (e) {
this.logger.error("problem with API request detailed stacktrace below ");
this.logger.error(e);
callback(e);
}
});
});
request.on("error", e => {
this.logger.error("problem with API request detailed stacktrace below ");
this.logger.error(e);
callback(e);
});
}
response.on("data", function (chunk) {
responseData.push(chunk);
});
__parseResponse(httpResponse, data, method, callback, skipJsonParsing, customResponseParser) {
var isArrayOrBuffer = data instanceof Array || data instanceof Buffer;
response.on("end", function () {
_this.logger.info("response ended:", response.statusCode);
if (callback) {
if (isBinary) {
responseData = Buffer.concat(responseData);
}
_this.__parseResponse(response, responseData, endpoint.method, callback, skipJsonParsing, customResponseParser);
}
});
response.on("close", function (e) {
if (e) {
_this.logger.error("problem with API request detailed stacktrace below ");
_this.logger.error(e);
callback(e);
}
});
});
request.on("error", function (e) {
_this.logger.error("problem with API request detailed stacktrace below ");
_this.logger.error(e);
callback(e);
});
if (!isArrayOrBuffer) {
throw new Error("data should be of type Array or Buffer");
}
}, {
key: "__parseResponse",
value: function __parseResponse(httpResponse, data, method, callback, skipJsonParsing, customResponseParser) {
var isArrayOrBuffer = data instanceof Array || data instanceof Buffer;
if (!isArrayOrBuffer) {
throw new Error("data should be of type Array or Buffer");
}
var status = httpResponse.statusCode;
var headers = httpResponse.headers;
var status = httpResponse.statusCode;
var headers = httpResponse.headers;
var response = null;
var error = null;
var response = null;
var error = null;
try {
if (status >= 500) {
error = {
message: "Server Error",
statusCode: status
};
} else if (httpResponse.headers["content-type"] === "application/octet-stream") {
response = data;
} else if (status === 429) {
// 429 does not return a parsable body
if (!headers["retry-after"]) {
// retry based on allowed per second
var retryAfterMillis = method === "POST" ? 1000 / 2 : 1000 / 5;
headers["retry-after"] = retryAfterMillis;
}
error = {
body: data.join("")
};
} else if (status === 204) {
response = null;
} else if (status >= 400 || status < 200) {
error = {
body: JSON.parse(data.join("")),
headers: headers
};
} else if (method !== "DELETE") {
if (!!skipJsonParsing) {
response = data.join("");
} else {
response = JSON.parse(data.join(""));
}
} else {
response = data;
try {
if (status >= 500) {
error = {
message: "Server Error",
statusCode: status
};
} else if (httpResponse.headers["content-type"] === "application/octet-stream") {
response = data;
} else if (status === 429) {
// 429 does not return a parsable body
if (!headers["retry-after"]) {
// retry based on allowed per second
var retryAfterMillis = method === "POST" ? 1000 / 2 : 1000 / 5;
headers["retry-after"] = retryAfterMillis;
}
} catch (parseError) {
this.logger.error(parseError);
this.logger.error("could not convert API response to JSON, above error is ignored and raw API response is returned to client");
this.logger.error("Raw Error message from API ");
this.logger.error("\"" + data + "\"");
error = {
status: status,
message: "The API response could not be parsed.",
body: data.join(""),
parseError: parseError
body: data.join("")
};
}
if (error) {
error.statusCode = status;
error.headers = headers;
}
if (typeof callback === "function") {
if (typeof customResponseParser === "function") {
// don't try to parse the response on errors
if (response) {
response = customResponseParser(response);
}
} else if (status === 204) {
response = null;
} else if (status >= 400 || status < 200) {
error = {
body: JSON.parse(data.join("")),
headers
};
} else if (method !== "DELETE") {
if (!!skipJsonParsing) {
response = data.join("");
} else {
response = JSON.parse(data.join(""));
}
callback(error, response);
} else {
response = data;
}
} catch (parseError) {
this.logger.error(parseError);
this.logger.error("could not convert API response to JSON, above error is ignored and raw API response is returned to client");
this.logger.error("Raw Error message from API ");
this.logger.error("\"".concat(data, "\""));
error = {
status: status,
message: "The API response could not be parsed.",
body: data.join(""),
parseError: parseError
};
}
}, {
key: "_addLimitedAccessMessageToErrors",
value: function _addLimitedAccessMessageToErrors(callback, limitedAccessStatus) {
return function (err, data) {
if (err && err.status == limitedAccessStatus) {
err._INFO_ = "This endpoint may need activating on your account. Please email support@nexmo.com for more information";
}
return callback(err, data);
};
if (error) {
error.statusCode = status;
error.headers = headers;
}
}, {
key: "get",
value: function get(path, params, callback) {
var useJwt = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
var useBasicAuth = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
if (!callback) {
if (typeof params == "function") {
callback = params;
params = {};
if (typeof callback === "function") {
if (typeof customResponseParser === "function") {
// don't try to parse the response on errors
if (response) {
response = customResponseParser(response);
}
}
params = params || {};
if (!useJwt && !useBasicAuth) {
params["api_key"] = this.credentials.apiKey;
params["api_secret"] = this.credentials.apiSecret;
callback(error, response);
}
}
_addLimitedAccessMessageToErrors(callback, limitedAccessStatus) {
return function (err, data) {
if (err && err.status == limitedAccessStatus) {
err._INFO_ = "This endpoint may need activating on your account. Please email support@nexmo.com for more information";
}
path = path + "?" + querystring.stringify(params);
return callback(err, data);
};
}
var headers = {
"Content-Type": "application/json"
};
if (useJwt) {
headers["Authorization"] = "Bearer " + this.credentials.generateJwt();
get(path, params, callback) {
var useJwt = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
var useBasicAuth = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
if (!callback) {
if (typeof params == "function") {
callback = params;
params = {};
}
if (useBasicAuth) {
headers["Authorization"] = "Basic " + Buffer.from(this.credentials.apiKey + ":" + this.credentials.apiSecret).toString("base64");
}
}
this.request({
path: path,
headers: headers
}, "GET", callback);
params = params || {};
if (!useJwt && !useBasicAuth) {
params["api_key"] = this.credentials.apiKey;
params["api_secret"] = this.credentials.apiSecret;
}
}, {
key: "delete",
value: function _delete(path, callback, useJwt, useBasicAuth) {
var params = {};
if (!useJwt && !useBasicAuth) {
params["api_key"] = this.credentials.apiKey;
params["api_secret"] = this.credentials.apiSecret;
}
var headers = {};
path = path + "?" + querystring.stringify(params);
var headers = {
"Content-Type": "application/json"
};
if (useBasicAuth) {
headers["Authorization"] = "Basic " + Buffer.from(this.credentials.apiKey + ":" + this.credentials.apiSecret).toString("base64");
}
path = path + "?" + querystring.stringify(params);
if (useJwt) {
headers["Authorization"] = "Bearer ".concat(this.credentials.generateJwt());
}
this.request({
path: path,
headers: headers
}, "DELETE", callback);
if (useBasicAuth) {
headers["Authorization"] = "Basic ".concat(Buffer.from(this.credentials.apiKey + ":" + this.credentials.apiSecret).toString("base64"));
}
}, {
key: "postFile",
value: function postFile(path, options, callback, useJwt) {
var qs = {};
if (!useJwt) {
qs["api_key"] = this.credentials.apiKey;
qs["api_secret"] = this.credentials.apiSecret;
}
if (Object.keys(qs).length) {
var joinChar = "?";
if (path.indexOf(joinChar) !== -1) {
joinChar = "&";
}
path = path + joinChar + querystring.stringify(qs);
}
this.request({
path: path,
headers
}, "GET", callback);
}
var file = options.file;
delete options.file; // We don't send this as metadata
delete(path, callback, useJwt, useBasicAuth) {
var params = {};
var formData = {};
if (!useJwt && !useBasicAuth) {
params["api_key"] = this.credentials.apiKey;
params["api_secret"] = this.credentials.apiSecret;
}
if (file) {
formData["filedata"] = {
value: file,
options: {
filename: options.filename || null
}
};
}
var headers = {};
if (options.info) {
formData.info = JSON.stringify(options.info);
}
if (useBasicAuth) {
headers["Authorization"] = "Basic ".concat(Buffer.from(this.credentials.apiKey + ":" + this.credentials.apiSecret).toString("base64"));
}
if (options.url) {
formData.url = options.url;
}
path = path + "?" + querystring.stringify(params);
this.request({
path: path,
headers
}, "DELETE", callback);
}
this.requestLib.post({
url: "https://" + this.host + path,
formData: formData,
headers: {
Authorization: "Bearer " + this.credentials.generateJwt()
}
}, callback);
postFile(path, options, callback, useJwt) {
var qs = {};
if (!useJwt) {
qs["api_key"] = this.credentials.apiKey;
qs["api_secret"] = this.credentials.apiSecret;
}
}, {
key: "post",
value: function post(path, params, callback, useJwt) {
var qs = {};
if (!useJwt) {
qs["api_key"] = this.credentials.apiKey;
qs["api_secret"] = this.credentials.apiSecret;
}
if (Object.keys(qs).length) {
var joinChar = "?";
if (path.indexOf(joinChar) !== -1) {

@@ -367,59 +309,104 @@ joinChar = "&";

path = path + joinChar + querystring.stringify(qs);
this.request({
path: path,
body: querystring.stringify(params)
}, "POST", callback);
}
}, {
key: "postJson",
value: function postJson(path, params, callback, useJwt, useBasicAuth) {
var qs = {};
if (!useJwt && !useBasicAuth) {
qs["api_key"] = this.credentials.apiKey;
qs["api_secret"] = this.credentials.apiSecret;
}
var joinChar = "?";
if (path.indexOf(joinChar) !== -1) {
joinChar = "&";
}
var file = options.file;
delete options.file; // We don't send this as metadata
path = path + joinChar + querystring.stringify(qs);
var formData = {};
var headers = {
"Content-Type": "application/json"
if (file) {
formData["filedata"] = {
value: file,
options: {
filename: options.filename || null
}
};
if (useBasicAuth) {
headers["Authorization"] = "Basic " + Buffer.from(this.credentials.apiKey + ":" + this.credentials.apiSecret).toString("base64");
}
}
this.request({
path: path,
body: JSON.stringify(params),
headers: headers
}, "POST", callback);
if (options.info) {
formData.info = JSON.stringify(options.info);
}
}, {
key: "postUseQueryString",
value: function postUseQueryString(path, params, callback, useJwt) {
params = params || {};
if (!useJwt) {
params["api_key"] = this.credentials.apiKey;
params["api_secret"] = this.credentials.apiSecret;
if (options.url) {
formData.url = options.url;
}
this.requestLib.post({
url: "https://" + this.host + path,
formData: formData,
headers: {
Authorization: "Bearer ".concat(this.credentials.generateJwt())
}
}, callback);
}
path = path + "?" + querystring.stringify(params);
post(path, params, callback, useJwt) {
var qs = {};
this.request({
path: path
}, "POST", callback);
if (!useJwt) {
qs["api_key"] = this.credentials.apiKey;
qs["api_secret"] = this.credentials.apiSecret;
}
}]);
return HttpClient;
}();
var joinChar = "?";
exports.default = HttpClient;
module.exports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AgcmVzcG9uc2VEYXRhID0gQnVmZmVyLmNvbmNhdChyZXNwb25zZURhdGEpO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIHRoaXMuX19wYXJzZVJlc3BvbnNlKFxuICAgICAgICAgICAgcmVzcG9uc2UsXG4gICAgICAgICAgICByZXNwb25zZURhdGEsXG4gICAgICAgICAgICBlbmRwb2ludC5tZXRob2QsXG4gICAgICAgICAgICBjYWxsYmFjayxcbiAgICAgICAgICAgIHNraXBKc29uUGFyc2luZyxcbiAgICAgICAgICAgIGN1c3RvbVJlc3BvbnNlUGFyc2VyXG4gICAgICAgICAgKTtcbiAgICAgICAgfVxuICAgICAgfSk7XG4gICAgICByZXNwb25zZS5vbihcImNsb3NlXCIsIGUgPT4ge1xuICAgICAgICBpZiAoZSkge1xuICAgICAgICAgIHRoaXMubG9nZ2VyLmVycm9yKFxuICAgICAgICAgICAgXCJwcm9ibGVtIHdpdGggQVBJIHJlcXVlc3QgZGV0YWlsZWQgc3RhY2t0cmFjZSBiZWxvdyBcIlxuICAgICAgICAgICk7XG4gICAgICAgICAgdGhpcy5sb2dnZXIuZXJyb3IoZSk7XG4gICAgICAgICAgY2FsbGJhY2soZSk7XG4gICAgICAgIH1cbiAgICAgIH0pO1xuICAgIH0pO1xuICAgIHJlcXVlc3Qub24oXCJlcnJvclwiLCBlID0+IHtcbiAgICAgIHRoaXMubG9nZ2VyLmVycm9yKFwicHJvYmxlbSB3aXRoIEFQSSByZXF1ZXN0IGRldGFpbGVkIHN0YWNrdHJhY2UgYmVsb3cgXCIpO1xuICAgICAgdGhpcy5sb2dnZXIuZXJyb3IoZSk7XG4gICAgICBjYWxsYmFjayhlKTtcbiAgICB9KTtcbiAgfVxuXG4gIF9fcGFyc2VSZXNwb25zZShcbiAgICBodHRwUmVzcG9uc2UsXG4gICAgZGF0YSxcbiAgICBtZXRob2QsXG4gICAgY2FsbGJhY2ssXG4gICAgc2tpcEpzb25QYXJzaW5nLFxuICAgIGN1c3RvbVJlc3B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gICAgcGF0aDogcGF0aCxcbiAgICAgICAgYm9keTogSlNPTi5zdHJpbmdpZnkocGFyYW1zKSxcbiAgICAgICAgaGVhZGVyc1xuICAgICAgfSxcbiAgICAgIFwiUE9TVFwiLFxuICAgICAgY2FsbGJhY2tcbiAgICApO1xuICB9XG5cbiAgcG9zdFVzZVF1ZXJ5U3RyaW5nKHBhdGgsIHBhcmFtcywgY2FsbGJhY2ssIHVzZUp3dCkge1xuICAgIHBhcmFtcyA9IHBhcmFtcyB8fCB7fTtcbiAgICBpZiAoIXVzZUp3dCkge1xuICAgICAgcGFyYW1zW1wiYXBpX2tleVwiXSA9IHRoaXMuY3JlZGVudGlhbHMuYXBpS2V5O1xuICAgICAgcGFyYW1zW1wiYXBpX3NlY3JldFwiXSA9IHRoaXMuY3JlZGVudGlhbHMuYXBpU2VjcmV0O1xuICAgIH1cblxuICAgIHBhdGggPSBwYXRoICsgXCI/XCIgKyBxdWVyeXN0cmluZy5zdHJpbmdpZnkocGFyYW1zKTtcblxuICAgIHRoaXMucmVxdWVzdChcbiAgICAgIHtcbiAgICAgICAgcGF0aDogcGF0aFxuICAgICAgfSxcbiAgICAgIFwiUE9TVFwiLFxuICAgICAgY2FsbGJhY2tcbiAgICApO1xuICB9XG59XG5cbmV4cG9ydCBkZWZhdWx0IEh0dHBDbGllbnQ7XG4iXX0=
if (path.indexOf(joinChar) !== -1) {
joinChar = "&";
}
path = path + joinChar + querystring.stringify(qs);
this.request({
path: path,
body: querystring.stringify(params)
}, "POST", callback);
}
postJson(path, params, callback, useJwt, useBasicAuth) {
var qs = {};
if (!useJwt && !useBasicAuth) {
qs["api_key"] = this.credentials.apiKey;
qs["api_secret"] = this.credentials.apiSecret;
}
var joinChar = "?";
if (path.indexOf(joinChar) !== -1) {
joinChar = "&";
}
path = path + joinChar + querystring.stringify(qs);
var headers = {
"Content-Type": "application/json"
};
if (useBasicAuth) {
headers["Authorization"] = "Basic ".concat(Buffer.from(this.credentials.apiKey + ":" + this.credentials.apiSecret).toString("base64"));
}
this.request({
path: path,
body: JSON.stringify(params),
headers
}, "POST", callback);
}
postUseQueryString(path, params, callback, useJwt) {
params = params || {};
if (!useJwt) {
params["api_key"] = this.credentials.apiKey;
params["api_secret"] = this.credentials.apiSecret;
}
path = path + "?" + querystring.stringify(params);
this.request({
path: path
}, "POST", callback);
}
}
var _default = HttpClient;
exports.default = _default;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9IdHRwQ2xpZW50LmpzIl0sIm5hbWVzIjpbImh0dHBzIiwicmVxdWlyZSIsImh0dHAiLCJyZXF1ZXN0IiwicXVlcnlzdHJpbmciLCJIdHRwQ2xpZW50IiwiY29uc3RydWN0b3IiLCJvcHRpb25zIiwiY3JlZGVudGlhbHMiLCJob3N0IiwicG9ydCIsImhlYWRlcnMiLCJBY2NlcHQiLCJsb2dnZXIiLCJ0aW1lb3V0IiwicmVxdWVzdExpYiIsInVzZXJBZ2VudCIsImVuZHBvaW50IiwibWV0aG9kIiwiY2FsbGJhY2siLCJza2lwSnNvblBhcnNpbmciLCJjdXN0b21SZXNwb25zZVBhcnNlciIsInBhdGgiLCJPYmplY3QiLCJhc3NpZ24iLCJ1bmRlZmluZWQiLCJrZXlzIiwiZm9yRWFjaCIsImtleSIsInNpZ25hdHVyZVNlY3JldCIsInNpZ25hdHVyZU1ldGhvZCIsInNwbGl0UGF0aCIsInNwbGl0IiwicGFyYW1zIiwiZGVjb2RlIiwidGltZXN0YW1wIiwiRGF0ZSIsImdldFRpbWUiLCJ0b1N0cmluZyIsImFwaV9zZWNyZXQiLCJoYXNoIiwiZ2VuZXJhdGVTaWduYXR1cmUiLCJxdWVyeSIsInNvcnQiLCJlbmNvZGVVUkkiLCJyZXBsYWNlIiwiaW5mbyIsImJvZHkiLCJlbmQiLCJyZXNwb25zZURhdGEiLCJvbiIsInJlc3BvbnNlIiwiaXNCaW5hcnkiLCJzZXRFbmNvZGlu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XMuY3JlZGVudGlhbHMuYXBpU2VjcmV0XG4gICAgICApLnRvU3RyaW5nKFwiYmFzZTY0XCIpfWA7XG4gICAgfVxuXG4gICAgdGhpcy5yZXF1ZXN0KFxuICAgICAge1xuICAgICAgICBwYXRoOiBwYXRoLFxuICAgICAgICBib2R5OiBKU09OLnN0cmluZ2lmeShwYXJhbXMpLFxuICAgICAgICBoZWFkZXJzXG4gICAgICB9LFxuICAgICAgXCJQT1NUXCIsXG4gICAgICBjYWxsYmFja1xuICAgICk7XG4gIH1cblxuICBwb3N0VXNlUXVlcnlTdHJpbmcocGF0aCwgcGFyYW1zLCBjYWxsYmFjaywgdXNlSnd0KSB7XG4gICAgcGFyYW1zID0gcGFyYW1zIHx8IHt9O1xuICAgIGlmICghdXNlSnd0KSB7XG4gICAgICBwYXJhbXNbXCJhcGlfa2V5XCJdID0gdGhpcy5jcmVkZW50aWFscy5hcGlLZXk7XG4gICAgICBwYXJhbXNbXCJhcGlfc2VjcmV0XCJdID0gdGhpcy5jcmVkZW50aWFscy5hcGlTZWNyZXQ7XG4gICAgfVxuXG4gICAgcGF0aCA9IHBhdGggKyBcIj9cIiArIHF1ZXJ5c3RyaW5nLnN0cmluZ2lmeShwYXJhbXMpO1xuXG4gICAgdGhpcy5yZXF1ZXN0KFxuICAgICAge1xuICAgICAgICBwYXRoOiBwYXRoXG4gICAgICB9LFxuICAgICAgXCJQT1NUXCIsXG4gICAgICBjYWxsYmFja1xuICAgICk7XG4gIH1cbn1cblxuZXhwb3J0IGRlZmF1bHQgSHR0cENsaWVudDtcbiJdfQ==
"use strict";
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _uuid = _interopRequireDefault(require("uuid"));
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _jsonwebtoken = _interopRequireDefault(require("jsonwebtoken"));
var _uuid = require("uuid");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _uuid2 = _interopRequireDefault(_uuid);
class JwtGenerator {
/**
* Generate a JSON Web Token (JWT).
*
* @param {Buffer} cert - the private key certificate to be used when signing
* the claims.
* @param {Object} claims - additional claims to include within the generated
* JWT.
*
* @returns {String} the generated token
*/
generate(cert) {
var claims = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var _jsonwebtoken = require("jsonwebtoken");
if (!(cert instanceof Buffer)) {
throw new Error("cert must be of type Buffer");
}
var _jsonwebtoken2 = _interopRequireDefault(_jsonwebtoken);
if (typeof claims !== "object") {
throw new Error("claims must be of type object");
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var toSign = {
iat: claims.issuedAt || parseInt(Date.now() / 1000, 10),
jti: claims.jti || _uuid.default.v1()
};
Object.keys(claims).forEach(key => {
toSign[key] = claims[key];
});
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var token = _jsonwebtoken.default.sign(toSign, cert, {
algorithm: "RS256"
});
var JwtGenerator = function () {
function JwtGenerator() {
_classCallCheck(this, JwtGenerator);
return token;
}
_createClass(JwtGenerator, [{
key: "generate",
}
/**
* Generate a JSON Web Token (JWT).
*
* @param {Buffer} cert - the private key certificate to be used when signing
* the claims.
* @param {Object} claims - additional claims to include within the generated
* JWT.
*
* @returns {String} the generated token
*/
value: function generate(cert) {
var claims = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
if (!(cert instanceof Buffer)) {
throw new Error("cert must be of type Buffer");
}
if ((typeof claims === "undefined" ? "undefined" : _typeof(claims)) !== "object") {
throw new Error("claims must be of type object");
}
var toSign = {
iat: claims.issuedAt || parseInt(Date.now() / 1000, 10),
jti: claims.jti || _uuid2.default.v1()
};
Object.keys(claims).forEach(function (key) {
toSign[key] = claims[key];
});
var token = _jsonwebtoken2.default.sign(toSign, cert, { algorithm: "RS256" });
return token;
}
}]);
return JwtGenerator;
}();
module.exports = JwtGenerator;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9Kd3RHZW5lcmF0b3IuanMiXSwibmFtZXMiOlsiSnd0R2VuZXJhdG9yIiwiY2VydCIsImNsYWltcyIsIkJ1ZmZlciIsIkVycm9yIiwidG9TaWduIiwiaWF0IiwiaXNzdWVkQXQiLCJwYXJzZUludCIsIkRhdGUiLCJub3ciLCJqdGkiLCJ2MSIsIk9iamVjdCIsImtleXMiLCJmb3JFYWNoIiwia2V5IiwidG9rZW4iLCJzaWduIiwiYWxnb3JpdGhtIiwibW9kdWxlIiwiZXhwb3J0cyJdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBQUE7Ozs7QUFDQTs7Ozs7Ozs7SUFFTUEsWTs7Ozs7Ozs7QUFDSjs7Ozs7Ozs7Ozs2QkFVU0MsSSxFQUFtQjtBQUFBLFVBQWJDLE1BQWEsdUVBQUosRUFBSTs7QUFDMUIsVUFBSSxFQUFFRCxnQkFBZ0JFLE1BQWxCLENBQUosRUFBK0I7QUFDN0IsY0FBTSxJQUFJQyxLQUFKLENBQVUsNkJBQVYsQ0FBTjtBQUNEO0FBQ0QsVUFBSSxRQUFPRixNQUFQLHlDQUFPQSxNQUFQLE9BQWtCLFFBQXRCLEVBQWdDO0FBQzlCLGNBQU0sSUFBSUUsS0FBSixDQUFVLCtCQUFWLENBQU47QUFDRDs7QUFFRCxVQUFJQyxTQUFTO0FBQ1hDLGFBQUtKLE9BQU9LLFFBQVAsSUFBbUJDLFNBQVN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Y2xhaW1zLmp0aSB8fCB1dWlkLnYxKClcbiAgICB9O1xuICAgIE9iamVjdC5rZXlzKGNsYWltcykuZm9yRWFjaChrZXkgPT4ge1xuICAgICAgdG9TaWduW2tleV0gPSBjbGFpbXNba2V5XTtcbiAgICB9KTtcblxuICAgIHZhciB0b2tlbiA9IGp3dC5zaWduKHRvU2lnbiwgY2VydCwgeyBhbGdvcml0aG06IFwiUlMyNTZcIiB9KTtcbiAgICByZXR1cm4gdG9rZW47XG4gIH1cbn1cblxubW9kdWxlLmV4cG9ydHMgPSBKd3RHZW5lcmF0b3I7XG4iXX0=

@@ -6,28 +6,16 @@ "use strict";

});
exports.default = void 0;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _fs = _interopRequireDefault(require("fs"));
var _fs = require("fs");
var _querystring = _interopRequireDefault(require("querystring"));
var _fs2 = _interopRequireDefault(_fs);
var _querystring = require("querystring");
var _querystring2 = _interopRequireDefault(_querystring);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
class Media {
static get PATH() {
return "/v3/media";
}
var Media = function () {
_createClass(Media, null, [{
key: "PATH",
get: function get() {
return "/v3/media";
}
}]);
function Media(credentials, options) {
_classCallCheck(this, Media);
constructor(credentials, options) {
this.creds = credentials;

@@ -37,96 +25,85 @@ this.options = options;

_createClass(Media, [{
key: "upload",
value: function upload(opts, callback) {
opts = opts || {};
if (!opts.file && !opts.url) {
throw new Error("You must provide either 'file' or 'url' to upload a file");
}
upload(opts, callback) {
opts = opts || {};
if (opts.file) {
opts.file = _fs2.default.createReadStream(opts.file);
if (!opts.file && !opts.url) {
throw new Error("You must provide either 'file' or 'url' to upload a file");
}
if (opts.file) {
opts.file = _fs.default.createReadStream(opts.file);
}
return this.options.api.postFile(Media.PATH, opts, function (err, response, body) {
if (err) {
return callback(err);
}
return this.options.api.postFile(Media.PATH, opts, function (err, response, body) {
if (err) {
return callback(err);
}
var location = "";
if (response && response.headers) {
location = response.headers.location;
}
var location = "";
return callback(null, location);
}, true);
}
}, {
key: "search",
value: function search(options, callback) {
if (typeof options == "function" && !callback) {
callback = options;
options = {};
if (response && response.headers) {
location = response.headers.location;
}
options = options || {};
return callback(null, location);
}, true);
}
return this._makeRequest("GET", Media.PATH, options, {}, callback);
search(options, callback) {
if (typeof options == "function" && !callback) {
callback = options;
options = {};
}
// If If-Modified-Since header is provided and the data hasn't changed, the
// user will receive an empty body in the callback, NOT an error
options = options || {};
return this._makeRequest("GET", Media.PATH, options, {}, callback);
} // If If-Modified-Since header is provided and the data hasn't changed, the
// user will receive an empty body in the callback, NOT an error
}, {
key: "download",
value: function download(id, headers, callback) {
if (!callback && typeof headers == "function") {
callback = headers;
headers = {};
}
return this._makeRequest("GET", Media.PATH + "/" + id, {}, headers, callback, true);
download(id, headers, callback) {
if (!callback && typeof headers == "function") {
callback = headers;
headers = {};
}
}, {
key: "delete",
value: function _delete(id, callback) {
return this._makeRequest("DELETE", Media.PATH + "/" + id, {}, {}, callback);
}
}, {
key: "get",
value: function get(id, callback) {
return this._makeRequest("GET", Media.PATH + "/" + id + "/info", {}, {}, callback);
}
}, {
key: "update",
value: function update(id, opts, callback) {
return this._makeRequest("PUT", Media.PATH + "/" + id + "/info", opts, {}, callback);
}
}, {
key: "_makeRequest",
value: function _makeRequest(verb, path, options, headers, callback, skipJsonParsing) {
headers = Object.assign({
"Content-Type": "application/json",
Authorization: "Bearer " + this.creds.generateJwt()
}, headers);
var req = {};
if (verb.toUpperCase() === "GET") {
if (Object.keys(options).length) {
path = path + "?" + _querystring2.default.stringify(options);
}
} else {
req["body"] = JSON.stringify(options);
}
return this._makeRequest("GET", "".concat(Media.PATH, "/").concat(id), {}, headers, callback, true);
}
req["path"] = path;
req["headers"] = headers;
delete(id, callback) {
return this._makeRequest("DELETE", "".concat(Media.PATH, "/").concat(id), {}, {}, callback);
}
return this.options.api.request(req, verb, callback, skipJsonParsing);
get(id, callback) {
return this._makeRequest("GET", "".concat(Media.PATH, "/").concat(id, "/info"), {}, {}, callback);
}
update(id, opts, callback) {
return this._makeRequest("PUT", "".concat(Media.PATH, "/").concat(id, "/info"), opts, {}, callback);
}
_makeRequest(verb, path, options, headers, callback, skipJsonParsing) {
headers = Object.assign({
"Content-Type": "application/json",
Authorization: "Bearer ".concat(this.creds.generateJwt())
}, headers);
var req = {};
if (verb.toUpperCase() === "GET") {
if (Object.keys(options).length) {
path = path + "?" + _querystring.default.stringify(options);
}
} else {
req["body"] = JSON.stringify(options);
}
}]);
return Media;
}();
req["path"] = path;
req["headers"] = headers;
return this.options.api.request(req, verb, callback, skipJsonParsing);
}
exports.default = Media;
module.exports = exports["default"];
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9NZWRpYS5qcyJdLCJuYW1lcyI6WyJNZWRpYSIsImNyZWRlbnRpYWxzIiwib3B0aW9ucyIsImNyZWRzIiwib3B0cyIsImNhbGxiYWNrIiwiZmlsZSIsInVybCIsIkVycm9yIiwiY3JlYXRlUmVhZFN0cmVhbSIsImFwaSIsInBvc3RGaWxlIiwiUEFUSCIsImVyciIsInJlc3BvbnNlIiwiYm9keSIsImxvY2F0aW9uIiwiaGVhZGVycyIsIl9tYWtlUmVxdWVzdCIsImlkIiwidmVyYiIsInBhdGgiLCJza2lwSnNvblBhcnNpbmciLCJPYmplY3QiLCJhc3NpZ24iLCJBdXRob3JpemF0aW9uIiwiZ2VuZXJhdGVKd3QiLCJyZXEiLCJ0b1VwcGVyQ2FzZSIsIm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oKSB7XG4gICAgICAgIHBhdGggPSBwYXRoICsgXCI/XCIgKyBxdWVyeXN0cmluZy5zdHJpbmdpZnkob3B0aW9ucyk7XG4gICAgICB9XG4gICAgfSBlbHNlIHtcbiAgICAgIHJlcVtcImJvZHlcIl0gPSBKU09OLnN0cmluZ2lmeShvcHRpb25zKTtcbiAgICB9XG5cbiAgICByZXFbXCJwYXRoXCJdID0gcGF0aDtcbiAgICByZXFbXCJoZWFkZXJzXCJdID0gaGVhZGVycztcblxuICAgIHJldHVybiB0aGlzLm9wdGlvbnMuYXBpLnJlcXVlc3QocmVxLCB2ZXJiLCBjYWxsYmFjaywgc2tpcEpzb25QYXJzaW5nKTtcbiAgfVxufVxuXG5leHBvcnQgZGVmYXVsdCBNZWRpYTtcbiJdfQ==
}
var _default = Media;
exports.default = _default;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9NZWRpYS5qcyJdLCJuYW1lcyI6WyJNZWRpYSIsIlBBVEgiLCJjb25zdHJ1Y3RvciIsImNyZWRlbnRpYWxzIiwib3B0aW9ucyIsImNyZWRzIiwidXBsb2FkIiwib3B0cyIsImNhbGxiYWNrIiwiZmlsZSIsInVybCIsIkVycm9yIiwiZnMiLCJjcmVhdGVSZWFkU3RyZWFtIiwiYXBpIiwicG9zdEZpbGUiLCJlcnIiLCJyZXNwb25zZSIsImJvZHkiLCJsb2NhdGlvbiIsImhlYWRlcnMiLCJzZWFyY2giLCJfbWFrZVJlcXVlc3QiLCJkb3dubG9hZCIsImlkIiwiZGVsZXRlIiwiZ2V0IiwidXBkYXRlIiwidmVyYiIsInBhdGgiLCJza2lwSnNvblBhcnNpbmciLCJPYmplY3QiLCJhc3NpZ24iLCJBdXRob3JpemF0aW9uIiwiZ2VuZXJhdGVKd3QiLCJyZXEiLCJ0b1VwcGVyQ2FzZSIsImtleXMiLCJsZW5ndGgiLCJxdWVyeXN0cmluZyIsInN0cmluZ2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biAgICAgIFwiUFVUXCIsXG4gICAgICBgJHtNZWRpYS5QQVRIfS8ke2lkfS9pbmZvYCxcbiAgICAgIG9wdHMsXG4gICAgICB7fSxcbiAgICAgIGNhbGxiYWNrXG4gICAgKTtcbiAgfVxuXG4gIF9tYWtlUmVxdWVzdCh2ZXJiLCBwYXRoLCBvcHRpb25zLCBoZWFkZXJzLCBjYWxsYmFjaywgc2tpcEpzb25QYXJzaW5nKSB7XG4gICAgaGVhZGVycyA9IE9iamVjdC5hc3NpZ24oXG4gICAgICB7XG4gICAgICAgIFwiQ29udGVudC1UeXBlXCI6IFwiYXBwbGljYXRpb24vanNvblwiLFxuICAgICAgICBBdXRob3JpemF0aW9uOiBgQmVhcmVyICR7dGhpcy5jcmVkcy5nZW5lcmF0ZUp3dCgpfWBcbiAgICAgIH0sXG4gICAgICBoZWFkZXJzXG4gICAgKTtcblxuICAgIGxldCByZXEgPSB7fTtcbiAgICBpZiAodmVyYi50b1VwcGVyQ2FzZSgpID09PSBcIkdFVFwiKSB7XG4gICAgICBpZiAoT2JqZWN0LmtleXMob3B0aW9ucykubGVuZ3RoKSB7XG4gICAgICAgIHBhdGggPSBwYXRoICsgXCI/XCIgKyBxdWVyeXN0cmluZy5zdHJpbmdpZnkob3B0aW9ucyk7XG4gICAgICB9XG4gICAgfSBlbHNlIHtcbiAgICAgIHJlcVtcImJvZHlcIl0gPSBKU09OLnN0cmluZ2lmeShvcHRpb25zKTtcbiAgICB9XG5cbiAgICByZXFbXCJwYXRoXCJdID0gcGF0aDtcbiAgICByZXFbXCJoZWFkZXJzXCJdID0gaGVhZGVycztcblxuICAgIHJldHVybiB0aGlzLm9wdGlvbnMuYXBpLnJlcXVlc3QocmVxLCB2ZXJiLCBjYWxsYmFjaywgc2tpcEpzb25QYXJzaW5nKTtcbiAgfVxufVxuXG5leHBvcnQgZGVmYXVsdCBNZWRpYTtcbiJdfQ==

@@ -6,57 +6,42 @@ "use strict";

});
exports.default = void 0;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _Utils = _interopRequireDefault(require("./Utils"));
var _Utils = require("./Utils");
var _ShortCode = _interopRequireDefault(require("./ShortCode"));
var _Utils2 = _interopRequireDefault(_Utils);
var _ShortCode = require("./ShortCode");
var _ShortCode2 = _interopRequireDefault(_ShortCode);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var querystring = require("querystring");
var Message = function () {
_createClass(Message, null, [{
key: "ERROR_MESSAGES",
get: function get() {
return {
sender: "Invalid from address",
to: "Invalid to address",
msg: "Invalid Text Message",
body: "Invalid Body value in Binary Message",
udh: "Invalid udh value in Binary Message",
title: "Invalid title in WAP Push message",
url: "Invalid url in WAP Push message"
};
}
}, {
key: "PATH",
get: function get() {
return "/sms/json";
}
class Message {
static get ERROR_MESSAGES() {
return {
sender: "Invalid from address",
to: "Invalid to address",
msg: "Invalid Text Message",
body: "Invalid Body value in Binary Message",
udh: "Invalid udh value in Binary Message",
title: "Invalid title in WAP Push message",
url: "Invalid url in WAP Push message"
};
}
/**
* @param {Credentials} credentials
* credentials to be used when interacting with the API.
* @param {Object} options
* Addition SMS options.
*/
static get PATH() {
return "/sms/json";
}
/**
* @param {Credentials} credentials
* credentials to be used when interacting with the API.
* @param {Object} options
* Addition SMS options.
*/
}]);
function Message(credentials) {
constructor(credentials) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
_classCallCheck(this, Message);
this.creds = credentials;
this.options = options;
var _shortcode = new _ShortCode2.default(this.creds, this.options);
var _shortcode = new _ShortCode.default(this.creds, this.options);

@@ -68,139 +53,134 @@ this.shortcodeAlert = _shortcode.shortcodeAlert.bind(_shortcode);

_createClass(Message, [{
key: "_sendRequest",
value: function _sendRequest(endpoint, method, callback) {
endpoint.path = endpoint.path + (endpoint.path.indexOf("?") > 0 ? "&" : "?") + querystring.stringify({
api_key: this.creds.apiKey,
api_secret: this.creds.apiSecret
_sendRequest(endpoint, method, callback) {
endpoint.path = endpoint.path + (endpoint.path.indexOf("?") > 0 ? "&" : "?") + querystring.stringify({
api_key: this.creds.apiKey,
api_secret: this.creds.apiSecret
});
this.options.httpClient.request(endpoint, method, callback);
}
_sendMessage(data, callback) {
if (!data.from) {
_Utils.default.sendError(callback, new Error(Message.ERROR_MESSAGES.sender));
} else if (!data.to) {
_Utils.default.sendError(callback, new Error(Message.ERROR_MESSAGES.to));
} else {
var path = Message.PATH + "?" + querystring.stringify(data);
this.options.logger.info("sending message from " + data.from + " to " + data.to + " with message " + data.text);
this._sendRequest({
host: this.options.restHost || "rest.nexmo.com",
path: path
}, "POST", function (err, apiResponse) {
if (!err && apiResponse.status && apiResponse.messages[0].status > 0) {
_Utils.default.sendError(callback, new Error(apiResponse.messages[0]["error-text"]), apiResponse);
} else {
if (callback) callback(err, apiResponse);
}
});
this.options.httpClient.request(endpoint, method, callback);
}
}, {
key: "_sendMessage",
value: function _sendMessage(data, callback) {
if (!data.from) {
_Utils2.default.sendError(callback, new Error(Message.ERROR_MESSAGES.sender));
} else if (!data.to) {
_Utils2.default.sendError(callback, new Error(Message.ERROR_MESSAGES.to));
} else {
var path = Message.PATH + "?" + querystring.stringify(data);
this.options.logger.info("sending message from " + data.from + " to " + data.to + " with message " + data.text);
this._sendRequest({
host: this.options.restHost || "rest.nexmo.com",
path: path
}, "POST", function (err, apiResponse) {
if (!err && apiResponse.status && apiResponse.messages[0].status > 0) {
_Utils2.default.sendError(callback, new Error(apiResponse.messages[0]["error-text"]), apiResponse);
} else {
if (callback) callback(err, apiResponse);
}
});
}
/**
* TODO: document
*/
sendSms(sender, recipient, message, opts, callback) {
if (!message) {
_Utils.default.sendError(callback, new Error(Message.ERROR_MESSAGES.msg));
} else {
if (!callback) {
callback = opts;
opts = {};
}
opts["from"] = sender;
opts["to"] = recipient;
opts["text"] = message;
this._sendMessage(opts, callback);
}
}
/**
* TODO: document
*/
/**
* TODO: document
*/
}, {
key: "sendSms",
value: function sendSms(sender, recipient, message, opts, callback) {
if (!message) {
_Utils2.default.sendError(callback, new Error(Message.ERROR_MESSAGES.msg));
} else {
if (!callback) {
callback = opts;
opts = {};
}
opts["from"] = sender;
opts["to"] = recipient;
opts["text"] = message;
this._sendMessage(opts, callback);
sendBinaryMessage(sender, recipient, body, udh, opts, callback) {
if (!body) {
_Utils.default.sendError(callback, new Error(Message.ERROR_MESSAGES.body));
} else if (!udh) {
_Utils.default.sendError(callback, new Error(Message.ERROR_MESSAGES.udh));
} else {
if (!callback) {
callback = opts;
opts = {};
}
}
/**
* TODO: document
*/
opts["from"] = sender;
opts["to"] = recipient;
opts["type"] = "binary";
opts["body"] = body;
opts["udh"] = udh;
}, {
key: "sendBinaryMessage",
value: function sendBinaryMessage(sender, recipient, body, udh, opts, callback) {
if (!body) {
_Utils2.default.sendError(callback, new Error(Message.ERROR_MESSAGES.body));
} else if (!udh) {
_Utils2.default.sendError(callback, new Error(Message.ERROR_MESSAGES.udh));
} else {
if (!callback) {
callback = opts;
opts = {};
}
opts["from"] = sender;
opts["to"] = recipient;
opts["type"] = "binary";
opts["body"] = body;
opts["udh"] = udh;
this._sendMessage(opts, callback);
}
this._sendMessage(opts, callback);
}
}
/**
* TODO: document
*/
/**
* TODO: document
*/
}, {
key: "sendWapPushMessage",
value: function sendWapPushMessage(sender, recipient, title, url, validity, opts, callback) {
if (!title) {
_Utils2.default.sendError(callback, new Error(Message.ERROR_MESSAGES.title));
} else if (!url) {
_Utils2.default.sendError(callback, new Error(Message.ERROR_MESSAGES.url));
} else {
if (typeof validity === "function") {
callback = validity;
opts = {};
validity = 86400000;
}
if (typeof opts === "function") {
callback = opts;
opts = {};
}
opts["from"] = sender;
opts["to"] = recipient;
opts["type"] = "wappush";
opts["title"] = title;
opts["validity"] = validity;
opts["url"] = url;
this._sendMessage(opts, callback);
sendWapPushMessage(sender, recipient, title, url, validity, opts, callback) {
if (!title) {
_Utils.default.sendError(callback, new Error(Message.ERROR_MESSAGES.title));
} else if (!url) {
_Utils.default.sendError(callback, new Error(Message.ERROR_MESSAGES.url));
} else {
if (typeof validity === "function") {
callback = validity;
opts = {};
validity = 86400000;
}
}
}, {
key: "search",
value: function search(id, callback) {
if (typeof id == "string") {
return this.options.rest.get("/search/message", {
id: id
}, callback);
if (typeof opts === "function") {
callback = opts;
opts = {};
}
// Otherwise we expect an array
return this.options.rest.get("/search/messages", {
ids: id
}, callback);
opts["from"] = sender;
opts["to"] = recipient;
opts["type"] = "wappush";
opts["title"] = title;
opts["validity"] = validity;
opts["url"] = url;
this._sendMessage(opts, callback);
}
}, {
key: "searchRejections",
value: function searchRejections(to, date, callback) {
return this.options.rest.get("/search/rejections", {
to: to,
date: date
}
search(id, callback) {
if (typeof id == "string") {
return this.options.rest.get("/search/message", {
id: id
}, callback);
}
}]);
} // Otherwise we expect an array
return Message;
}();
exports.default = Message;
module.exports = exports["default"];
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9NZXNzYWdlLmpzIl0sIm5hbWVzIjpbInF1ZXJ5c3RyaW5nIiwicmVxdWlyZSIsIk1lc3NhZ2UiLCJzZW5kZXIiLCJ0byIsIm1zZyIsImJvZHkiLCJ1ZGgiLCJ0aXRsZSIsInVybCIsImNyZWRlbnRpYWxzIiwib3B0aW9ucyIsImNyZWRzIiwiX3Nob3J0Y29kZSIsInNob3J0Y29kZUFsZXJ0IiwiYmluZCIsInNob3J0Y29kZTJGQSIsInNob3J0Y29kZU1hcmtldGluZyIsImVuZHBvaW50IiwibWV0aG9kIiwiY2Fsb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FnZSBmcm9tIFwiICtcbiAgICAgICAgICBkYXRhLmZyb20gK1xuICAgICAgICAgIFwiIHRvIFwiICtcbiAgICAgICAgICBkYXRhLnRvICtcbiAgICAgICAgICBcIiB3aXRoIG1lc3NhZ2UgXCIgK1xuICAgICAgICAgIGRhdGEudGV4dFxuICAgICAgKTtcbiAgICAgIHRoaXMuX3NlbmRSZXF1ZXN0KFxuICAgICAgICB7XG4gICAgICAgICAgaG9zdDogdGhpcy5vcHRpb25zLnJlc3RIb3N0IHx8IFwicmVzdC5uZXhtby5jb21cIixcbiAgICAgICAgICBwYXRoOiBwYXRoXG4gICAgICAgIH0sXG4gICAgICAgIFwiUE9TVFwiLFxuICAgICAgICBmdW5jdGlvbihlcnIsIGFwaVJlc3BvbnNlKSB7XG4gICAgICAgICAgaWYgKFxuICAgICAgICAgICAgIWVyciAmJlxuICAgICAgICAgICAgYXBpUmVzcG9uc2Uuc3RhdHVzICYmXG4gICAgICAgICAgICBhcGlSZXNwb25zZS5tZXNzYWdlc1swXS5zdGF0dXMgPiAwXG4gICAgICAgICAgKSB7XG4gICAgICAgICAgICBVdGlscy5zZW5kRXJyb3IoXG4gICAgICAgICAgICAgIGNhbGxiYWNrLFxuICAgICAgICAgICAgICBuZXcgRXJyb3IoYXBpUmVzcG9uc2UubWVzc2FnZXNbMF1bXCJlcnJvci10ZXh0XCJdKSxcbiAgICAgICAgICAgICAgYXBpUmVzcG9uc2VcbiAgICAgICAgICAgICk7XG4gICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGlmIChjYWxsYmFjaykgY2FsbGJhY2soZXJyLCBhcGlSZXNwb25zZSk7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICApO1xuICAgIH1cbiAgfVxuXG4gIC8qKlxuICAgKiBUT0RPOiBkb2N1bWVudFxuICAgKi9cbiAgc2VuZFNtcyhzZW5kZXIsIHJlY2lwaWVudCwgbWVzc2FnZSwgb3B0cywgY2FsbGJhY2spIHtcbiAgICBpZi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aXR5XCJdID0gdmFsaWRpdHk7XG4gICAgICBvcHRzW1widXJsXCJdID0gdXJsO1xuICAgICAgdGhpcy5fc2VuZE1lc3NhZ2Uob3B0cywgY2FsbGJhY2spO1xuICAgIH1cbiAgfVxuXG4gIHNlYXJjaChpZCwgY2FsbGJhY2spIHtcbiAgICBpZiAodHlwZW9mIGlkID09IFwic3RyaW5nXCIpIHtcbiAgICAgIHJldHVybiB0aGlzLm9wdGlvbnMucmVzdC5nZXQoXG4gICAgICAgIFwiL3NlYXJjaC9tZXNzYWdlXCIsXG4gICAgICAgIHtcbiAgICAgICAgICBpZDogaWRcbiAgICAgICAgfSxcbiAgICAgICAgY2FsbGJhY2tcbiAgICAgICk7XG4gICAgfVxuXG4gICAgLy8gT3RoZXJ3aXNlIHdlIGV4cGVjdCBhbiBhcnJheVxuICAgIHJldHVybiB0aGlzLm9wdGlvbnMucmVzdC5nZXQoXG4gICAgICBcIi9zZWFyY2gvbWVzc2FnZXNcIixcbiAgICAgIHtcbiAgICAgICAgaWRzOiBpZFxuICAgICAgfSxcbiAgICAgIGNhbGxiYWNrXG4gICAgKTtcbiAgfVxuXG4gIHNlYXJjaFJlamVjdGlvbnModG8sIGRhdGUsIGNhbGxiYWNrKSB7XG4gICAgcmV0dXJuIHRoaXMub3B0aW9ucy5yZXN0LmdldChcbiAgICAgIFwiL3NlYXJjaC9yZWplY3Rpb25zXCIsXG4gICAgICB7XG4gICAgICAgIHRvLFxuICAgICAgICBkYXRlXG4gICAgICB9LFxuICAgICAgY2FsbGJhY2tcbiAgICApO1xuICB9XG59XG5cbmV4cG9ydCBkZWZhdWx0IE1lc3NhZ2U7XG4iXX0=
return this.options.rest.get("/search/messages", {
ids: id
}, callback);
}
searchRejections(to, date, callback) {
return this.options.rest.get("/search/rejections", {
to,
date
}, callback);
}
}
var _default = Message;
exports.default = _default;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9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dldChcbiAgICAgIFwiL3NlYXJjaC9tZXNzYWdlc1wiLFxuICAgICAge1xuICAgICAgICBpZHM6IGlkXG4gICAgICB9LFxuICAgICAgY2FsbGJhY2tcbiAgICApO1xuICB9XG5cbiAgc2VhcmNoUmVqZWN0aW9ucyh0bywgZGF0ZSwgY2FsbGJhY2spIHtcbiAgICByZXR1cm4gdGhpcy5vcHRpb25zLnJlc3QuZ2V0KFxuICAgICAgXCIvc2VhcmNoL3JlamVjdGlvbnNcIixcbiAgICAgIHtcbiAgICAgICAgdG8sXG4gICAgICAgIGRhdGVcbiAgICAgIH0sXG4gICAgICBjYWxsYmFja1xuICAgICk7XG4gIH1cbn1cblxuZXhwb3J0IGRlZmF1bHQgTWVzc2FnZTtcbiJdfQ==

@@ -6,97 +6,52 @@ "use strict";

});
exports.default = void 0;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _fs = _interopRequireDefault(require("fs"));
var _fs = require("fs");
var _path = _interopRequireDefault(require("path"));
var _fs2 = _interopRequireDefault(_fs);
var _Credentials = _interopRequireDefault(require("./Credentials"));
var _path = require("path");
var _JwtGenerator = _interopRequireDefault(require("./JwtGenerator"));
var _path2 = _interopRequireDefault(_path);
var _HashGenerator = _interopRequireDefault(require("./HashGenerator"));
var _Credentials = require("./Credentials");
var _Message = _interopRequireDefault(require("./Message"));
var _Credentials2 = _interopRequireDefault(_Credentials);
var _Voice = _interopRequireDefault(require("./Voice"));
var _JwtGenerator = require("./JwtGenerator");
var _Number = _interopRequireDefault(require("./Number"));
var _JwtGenerator2 = _interopRequireDefault(_JwtGenerator);
var _Verify = _interopRequireDefault(require("./Verify"));
var _HashGenerator = require("./HashGenerator");
var _NumberInsight = _interopRequireDefault(require("./NumberInsight"));
var _HashGenerator2 = _interopRequireDefault(_HashGenerator);
var _App = _interopRequireDefault(require("./App"));
var _Message = require("./Message");
var _Account = _interopRequireDefault(require("./Account"));
var _Message2 = _interopRequireDefault(_Message);
var _CallsResource = _interopRequireDefault(require("./CallsResource"));
var _Voice = require("./Voice");
var _FilesResource = _interopRequireDefault(require("./FilesResource"));
var _Voice2 = _interopRequireDefault(_Voice);
var _Conversion = _interopRequireDefault(require("./Conversion"));
var _Number = require("./Number");
var _Media = _interopRequireDefault(require("./Media"));
var _Number2 = _interopRequireDefault(_Number);
var _Redact = _interopRequireDefault(require("./Redact"));
var _Verify = require("./Verify");
var _Pricing = _interopRequireDefault(require("./Pricing"));
var _Verify2 = _interopRequireDefault(_Verify);
var _HttpClient = _interopRequireDefault(require("./HttpClient"));
var _NumberInsight = require("./NumberInsight");
var _NullLogger = _interopRequireDefault(require("./NullLogger"));
var _NumberInsight2 = _interopRequireDefault(_NumberInsight);
var _ConsoleLogger = _interopRequireDefault(require("./ConsoleLogger"));
var _App = require("./App");
var _App2 = _interopRequireDefault(_App);
var _Account = require("./Account");
var _Account2 = _interopRequireDefault(_Account);
var _CallsResource = require("./CallsResource");
var _CallsResource2 = _interopRequireDefault(_CallsResource);
var _FilesResource = require("./FilesResource");
var _FilesResource2 = _interopRequireDefault(_FilesResource);
var _Conversion = require("./Conversion");
var _Conversion2 = _interopRequireDefault(_Conversion);
var _Media = require("./Media");
var _Media2 = _interopRequireDefault(_Media);
var _Redact = require("./Redact");
var _Redact2 = _interopRequireDefault(_Redact);
var _Pricing = require("./Pricing");
var _Pricing2 = _interopRequireDefault(_Pricing);
var _HttpClient = require("./HttpClient");
var _HttpClient2 = _interopRequireDefault(_HttpClient);
var _NullLogger = require("./NullLogger");
var _NullLogger2 = _interopRequireDefault(_NullLogger);
var _ConsoleLogger = require("./ConsoleLogger");
var _ConsoleLogger2 = _interopRequireDefault(_ConsoleLogger);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var jwtGeneratorInstance = new _JwtGenerator.default();
var hashGeneratorInstance = new _HashGenerator.default();
var jwtGeneratorInstance = new _JwtGenerator2.default();
var hashGeneratorInstance = new _HashGenerator2.default();
var Nexmo = function () {
class Nexmo {
/**

@@ -112,58 +67,63 @@ * @param {Credentials} credentials - Nexmo API credentials

*/
function Nexmo(credentials) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { debug: false };
constructor(credentials) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
debug: false
};
this.credentials = _Credentials.default.parse(credentials);
this.options = Object.assign({}, options); // If no logger has been supplied but debug has been set
// default to using the ConsoleLogger
_classCallCheck(this, Nexmo);
this.credentials = _Credentials2.default.parse(credentials);
this.options = options;
// If no logger has been supplied but debug has been set
// default to using the ConsoleLogger
if (!this.options.logger && this.options.debug) {
this.options.logger = new _ConsoleLogger2.default();
this.options.logger = new _ConsoleLogger.default();
} else if (!this.options.logger) {
// Swallow the logging
this.options.logger = new _NullLogger2.default();
this.options.logger = new _NullLogger.default();
}
var userAgent = "nexmo-node/UNKNOWN node/UNKNOWN";
try {
var packageDetails = require(_path2.default.join(__dirname, "..", "package.json"));
userAgent = "nexmo-node/" + packageDetails.version + " node/" + process.version.replace("v", "");
var packageDetails = require(_path.default.join(__dirname, "..", "package.json"));
userAgent = "nexmo-node/".concat(packageDetails.version, " node/").concat(process.version.replace("v", ""));
} catch (e) {
console.warn("Could not load package details");
}
this.options.userAgent = userAgent;
if (this.options.appendToUserAgent) {
this.options.userAgent += " " + this.options.appendToUserAgent;
}
this.options.userAgent += " ".concat(this.options.appendToUserAgent);
} // This is legacy, everything should use rest or api going forward
// This is legacy, everything should use rest or api going forward
this.options.httpClient = new _HttpClient2.default(Object.assign({ host: this.options.restHost || "rest.nexmo.com" }, this.options), this.credentials);
// We have two different hosts, so we use two different HttpClients
this.options.api = new _HttpClient2.default(Object.assign({ host: this.options.apiHost || "api.nexmo.com" }, this.options), this.credentials);
this.options.rest = new _HttpClient2.default(Object.assign({ host: this.options.restHost || "rest.nexmo.com" }, this.options), this.credentials);
this.options.httpClient = new _HttpClient.default(Object.assign({
host: this.options.restHost || "rest.nexmo.com"
}, this.options), this.credentials); // We have two different hosts, so we use two different HttpClients
this.message = new _Message2.default(this.credentials, this.options);
this.voice = new _Voice2.default(this.credentials, this.options);
this.number = new _Number2.default(this.credentials, this.options);
this.verify = new _Verify2.default(this.credentials, this.options);
this.numberInsight = new _NumberInsight2.default(this.credentials, this.options);
this.applications = new _App2.default(this.credentials, this.options);
this.account = new _Account2.default(this.credentials, this.options);
this.calls = new _CallsResource2.default(this.credentials, this.options);
this.files = new _FilesResource2.default(this.credentials, this.options);
this.conversion = new _Conversion2.default(this.credentials, this.options);
this.media = new _Media2.default(this.credentials, this.options);
this.redact = new _Redact2.default(this.credentials, this.options);
this.pricing = new _Pricing2.default(this.credentials, this.options);
this.options.api = new _HttpClient.default(Object.assign({
host: this.options.apiHost || "api.nexmo.com"
}, this.options), this.credentials);
this.options.rest = new _HttpClient.default(Object.assign({
host: this.options.restHost || "rest.nexmo.com"
}, this.options), this.credentials);
this.message = new _Message.default(this.credentials, this.options);
this.voice = new _Voice.default(this.credentials, this.options);
this.number = new _Number.default(this.credentials, this.options);
this.verify = new _Verify.default(this.credentials, this.options);
this.numberInsight = new _NumberInsight.default(this.credentials, this.options);
this.applications = new _App.default(this.credentials, this.options);
this.account = new _Account.default(this.credentials, this.options);
this.calls = new _CallsResource.default(this.credentials, this.options);
this.files = new _FilesResource.default(this.credentials, this.options);
this.conversion = new _Conversion.default(this.credentials, this.options);
this.media = new _Media.default(this.credentials, this.options);
this.redact = new _Redact.default(this.credentials, this.options);
this.pricing = new _Pricing.default(this.credentials, this.options);
/**
* @deprecated Please use nexmo.applications
*/
this.app = this.applications;
}
/**

@@ -182,31 +142,26 @@ * Generate a JSON Web Token (JWT).

_createClass(Nexmo, [{
key: "generateJwt",
value: function generateJwt() {
var claims = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
if (claims.application_id === undefined) {
claims.application_id = this.credentials.applicationId;
}
return Nexmo.generateJwt(this.credentials.privateKey, claims);
generateJwt() {
var claims = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
if (claims.application_id === undefined) {
claims.application_id = this.credentials.applicationId;
}
/**
* Generate a Signature Hash.
*
* @param {Object} params - params to generate hash from
*
* @returns {String} the generated token
*/
return Nexmo.generateJwt(this.credentials.privateKey, claims);
}
/**
* Generate a Signature Hash.
*
* @param {Object} params - params to generate hash from
*
* @returns {String} the generated token
*/
}, {
key: "generateSignature",
value: function generateSignature(params) {
return this.credentials.generateSignature(params);
}
}]);
return Nexmo;
}();
generateSignature(params) {
return this.credentials.generateSignature(params);
}
}
/**

@@ -223,13 +178,13 @@ * Generate a JSON Web Token (JWT).

Nexmo.generateJwt = function (privateKey, claims) {
Nexmo.generateJwt = (privateKey, claims) => {
if (!(privateKey instanceof Buffer)) {
if (!_fs2.default.existsSync(privateKey)) {
throw new Error("File \"" + privateKey + "\" not found.");
if (!_fs.default.existsSync(privateKey)) {
throw new Error("File \"".concat(privateKey, "\" not found."));
} else {
privateKey = _fs2.default.readFileSync(privateKey);
privateKey = _fs.default.readFileSync(privateKey);
}
}
return jwtGeneratorInstance.generate(privateKey, claims);
};
/**

@@ -244,8 +199,10 @@ * Generate a Signature Hash.

*/
Nexmo.generateSignature = function (method, secret, params) {
Nexmo.generateSignature = (method, secret, params) => {
return hashGeneratorInstance.generate(method, secret, params);
};
exports.default = Nexmo;
module.exports = exports["default"];
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9OZXhtby5qcyJdLCJuYW1lcyI6WyJqd3RHZW5lcmF0b3JJbnN0YW5jZSIsIm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uICAgIH1cbiAgfVxuICByZXR1cm4gand0R2VuZXJhdG9ySW5zdGFuY2UuZ2VuZXJhdGUocHJpdmF0ZUtleSwgY2xhaW1zKTtcbn07XG5cbi8qKlxuICogR2VuZXJhdGUgYSBTaWduYXR1cmUgSGFzaC5cbiAqXG4gKiBAcGFyYW0ge1N0cmluZ30gbWV0aG9kIC0gdGhlIG1ldGhvZCB0byBiZSB1c2VkIHdoZW4gY3JlYXRpbmcgdGhlIGhhc2hcbiAqIEBwYXJhbSB7U3RyaW5nfSBzZWNyZXQgLSB0aGUgc2VjcmV0IHRvIGJlIHVzZWQgd2hlbiBjcmVhdGluZyB0aGUgaGFzaFxuICogQHBhcmFtIHtPYmplY3R9IHBhcmFtcyAtIHBhcmFtcyB0byBnZW5lcmF0ZSBoYXNoIGZyb21cbiAqXG4gKiBAcmV0dXJucyB7U3RyaW5nfSB0aGUgZ2VuZXJhdGVkIHRva2VuXG4gKi9cbk5leG1vLmdlbmVyYXRlU2lnbmF0dXJlID0gKG1ldGhvZCwgc2VjcmV0LCBwYXJhbXMpID0+IHtcbiAgcmV0dXJuIGhhc2hHZW5lcmF0b3JJbnN0YW5jZS5nZW5lcmF0ZShtZXRob2QsIHNlY3JldCwgcGFyYW1zKTtcbn07XG5cbmV4cG9ydCBkZWZhdWx0IE5leG1vO1xuIl19
var _default = Nexmo;
exports.default = _default;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9OZXhtby5qcyJdLCJuYW1lcyI6WyJqd3RHZW5lcmF0b3JJbnN0YW5jZSIsIkp3dEdlbmVyYXRvciIsImhhc2hHZW5lcmF0b3JJbnN0YW5jZSIsIkhhc2hHZW5lcmF0b3IiLCJOZXhtbyIsImNvbnN0cnVjdG9yIiwiY3JlZGVudGlhbHMiLCJvcHRpb25zIiwiZGVidWciLCJDcmVkZW50aWFscyIsInBhcnNlIiwiT2JqZWN0IiwiYXNzaWduIiwibG9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GhlIHNlY3JldCB0byBiZSB1c2VkIHdoZW4gY3JlYXRpbmcgdGhlIGhhc2hcbiAqIEBwYXJhbSB7T2JqZWN0fSBwYXJhbXMgLSBwYXJhbXMgdG8gZ2VuZXJhdGUgaGFzaCBmcm9tXG4gKlxuICogQHJldHVybnMge1N0cmluZ30gdGhlIGdlbmVyYXRlZCB0b2tlblxuICovXG5OZXhtby5nZW5lcmF0ZVNpZ25hdHVyZSA9IChtZXRob2QsIHNlY3JldCwgcGFyYW1zKSA9PiB7XG4gIHJldHVybiBoYXNoR2VuZXJhdG9ySW5zdGFuY2UuZ2VuZXJhdGUobWV0aG9kLCBzZWNyZXQsIHBhcmFtcyk7XG59O1xuXG5leHBvcnQgZGVmYXVsdCBOZXhtbztcbiJdfQ==
"use strict";
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
class NullLogger {
log(level) {}
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
info() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var NullLogger = function () {
function NullLogger() {
_classCallCheck(this, NullLogger);
this.log("info", ...args);
}
_createClass(NullLogger, [{
key: "log",
value: function log(level) {}
}, {
key: "info",
value: function info() {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
this.log.apply(this, ["info"].concat(args));
warn() {
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
}, {
key: "warn",
value: function warn() {
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
this.log.apply(this, ["warn"].concat(args));
}
}, {
key: "error",
value: function error() {
for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
args[_key3] = arguments[_key3];
}
this.log("warn", ...args);
}
this.log.apply(this, ["error"].concat(args));
error() {
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
args[_key3] = arguments[_key3];
}
}]);
return NullLogger;
}();
this.log("error", ...args);
}
}
module.exports = NullLogger;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9OdWxsTG9nZ2VyLmpzIl0sIm5hbWVzIjpbIk51bGxMb2dnZXIiLCJsZXZlbCIsImFyZ3MiLCJsb2ciLCJtb2R1bGUiLCJleHBvcnRzIl0sIm1hcHBpbmdzIjoiOzs7Ozs7SUFBTUEsVTs7Ozs7Ozt3QkFDQUMsSyxFQUFnQixDQUFFOzs7MkJBRVI7QUFBQSx3Q0FBTkMsSUFBTTtBQUFOQSxZQUFNO0FBQUE7O0FBQ1osV0FBS0MsR0FBTCxjQUFTLE1BQVQsU0FBb0JELElBQXBCO0FBQ0Q7OzsyQkFFYTtBQUFBLHlDQUFOQSxJQUFNO0FBQU5BLFlBQU07QUFBQTs7QUFDWixXQUFLQyxHQUFMLGNBQVMsTUFBVCxTQUFvQkQsSUFBcEI7QUFDRDs7OzRCQUVjO0FBQUEseUNBQU5BLElBQU07QUFBTkEsWUFBTTtBQUFBOztBQUNiLFdBQUtDLEdBQUwsY0FBUyxPQUFULFNBQXFCRCxJQUFyQjtBQUNEOzs7Ozs7QUFHSEUsT0FBT0MsT0FBUCxHQUFpQkwsVUFBakIiLCJmaWxlIjoiTnVsbExvZ2dlci5qcyIsInNvdXJjZXNDb250ZW50IjpbImNsYXNzIE51bGxMb2dnZXIge1xuICBsb2cobGV2ZWwsIC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BckI7QUFDRDs7QUFiYzs7QUFnQmpCRyxNQUFNLENBQUNDLE9BQVAsR0FBaUJSLFVBQWpCIiwic291cmNlc0NvbnRlbnQiOlsiY2xhc3MgTnVsbExvZ2dlciB7XG4gIGxvZyhsZXZlbCwgLi4uYXJncykge31cblxuICBpbmZvKC4uLmFyZ3MpIHtcbiAgICB0aGlzLmxvZyhcImluZm9cIiwgLi4uYXJncyk7XG4gIH1cblxuICB3YXJuKC4uLmFyZ3MpIHtcbiAgICB0aGlzLmxvZyhcIndhcm5cIiwgLi4uYXJncyk7XG4gIH1cblxuICBlcnJvciguLi5hcmdzKSB7XG4gICAgdGhpcy5sb2coXCJlcnJvclwiLCAuLi5hcmdzKTtcbiAgfVxufVxuXG5tb2R1bGUuZXhwb3J0cyA9IE51bGxMb2dnZXI7XG4iXX0=

@@ -6,54 +6,44 @@ "use strict";

});
exports.default = void 0;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _Pricing = _interopRequireDefault(require("./Pricing"));
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _Utils = _interopRequireDefault(require("./Utils"));
var _Pricing = require("./Pricing");
var _Pricing2 = _interopRequireDefault(_Pricing);
var _Utils = require("./Utils");
var _Utils2 = _interopRequireDefault(_Utils);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
class Number {
static get PATH() {
return "/number";
}
var Number = function () {
_createClass(Number, null, [{
key: "PATH",
get: function get() {
return "/number";
}
}, {
key: "ERROR_MESSAGES",
get: function get() {
return {
optionsNotAnObject: "Options parameter should be a dictionary. Check the docs for valid properties for options",
countrycode: "Invalid Country Code",
msisdn: "Invalid MSISDN passed"
};
}
/**
* @param {Credentials} credentials
* credentials to be used when interacting with the API.
* @param {Object} options
* Addition Number options.
*/
static get ERROR_MESSAGES() {
return {
optionsNotAnObject: "Options parameter should be a dictionary. Check the docs for valid properties for options",
countrycode: "Invalid Country Code",
msisdn: "Invalid MSISDN passed"
};
}
/**
* @param {Credentials} credentials
* credentials to be used when interacting with the API.
* @param {Object} options
* Addition Number options.
*/
}]);
function Number(credentials) {
constructor(credentials) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
_classCallCheck(this, Number);
this.creds = credentials;
this.options = options;
this._pricing = new _Pricing.default(credentials, options);
}
/**
* TODO: remove with next major release
*/
this._pricing = new _Pricing2.default(credentials, options);
getPricing() {
this._pricing.get.apply(this, arguments);
}
/**

@@ -64,145 +54,138 @@ * TODO: remove with next major release

_createClass(Number, [{
key: "getPricing",
value: function getPricing() {
this._pricing.get.apply(this, arguments);
}
getPhonePricing() {
this._pricing.getPhone.apply(this, arguments);
}
/**
* TODO: document
*/
/**
* TODO: remove with next major release
*/
}, {
key: "getPhonePricing",
value: function getPhonePricing() {
this._pricing.getPhone.apply(this, arguments);
get(options, callback) {
if (typeof options === "function") {
callback = options;
options = {};
} else if (typeof options !== "object") {
_Utils.default.sendError(callback, new Error(Number.ERROR_MESSAGES.optionsNotAnObject));
}
/**
* TODO: document
*/
options.api_key = options.api_key || this.creds.apiKey;
options.api_secret = options.api_secret || this.creds.apiSecret;
this.options.httpClient.request({
path: _Utils.default.createPathWithQuery("/account".concat(Number.PATH, "s"), options)
}, callback);
}
/**
* TODO: document
*/
}, {
key: "get",
value: function get(options, callback) {
if (typeof options === "function") {
callback = options;
options = {};
} else if ((typeof options === "undefined" ? "undefined" : _typeof(options)) !== "object") {
_Utils2.default.sendError(callback, new Error(Number.ERROR_MESSAGES.optionsNotAnObject));
search(countryCode, pattern, callback) {
var params = {
api_key: this.creds.apiKey,
api_secret: this.creds.apiSecret
};
if (!countryCode || countryCode.length !== 2) {
_Utils.default.sendError(callback, new Error(Number.ERROR_MESSAGES.countrycode));
} else {
params["country"] = countryCode;
if (typeof pattern === "function") {
callback = pattern;
} else if (typeof pattern === "object") {
for (var arg in pattern) {
params[arg] = pattern[arg];
}
} else {
params["pattern"] = pattern;
}
options.api_key = options.api_key || this.creds.apiKey;
options.api_secret = options.api_secret || this.creds.apiSecret;
this.options.httpClient.request({
path: _Utils2.default.createPathWithQuery("/account" + Number.PATH + "s", options)
path: _Utils.default.createPathWithQuery("".concat(Number.PATH, "/search"), params)
}, callback);
}
}
/**
* TODO: document
*/
/**
* TODO: document
*/
}, {
key: "search",
value: function search(countryCode, pattern, callback) {
var params = {
buy(countryCode, msisdn, targetApiKey, callback) {
if (!countryCode || countryCode.length !== 2) {
_Utils.default.sendError(callback, new Error(Number.ERROR_MESSAGES.countrycode));
} else if (!msisdn) {
_Utils.default.sendError(callback, new Error(Number.ERROR_MESSAGES.msisdn));
} else {
var opts = {
country: countryCode,
msisdn,
api_key: this.creds.apiKey,
api_secret: this.creds.apiSecret
};
if (!countryCode || countryCode.length !== 2) {
_Utils2.default.sendError(callback, new Error(Number.ERROR_MESSAGES.countrycode));
if (targetApiKey instanceof Function) {
callback = targetApiKey;
} else {
params["country"] = countryCode;
if (typeof pattern === "function") {
callback = pattern;
} else if ((typeof pattern === "undefined" ? "undefined" : _typeof(pattern)) === "object") {
for (var arg in pattern) {
params[arg] = pattern[arg];
}
} else {
params["pattern"] = pattern;
}
this.options.httpClient.request({
path: _Utils2.default.createPathWithQuery(Number.PATH + "/search", params)
}, callback);
opts.target_api_key = targetApiKey;
}
this.options.httpClient.request({
path: _Utils.default.createPathWithQuery("".concat(Number.PATH, "/buy"), opts)
}, "POST", callback);
}
}
/**
* TODO: document
*/
/**
* TODO: document
*/
}, {
key: "buy",
value: function buy(countryCode, msisdn, callback) {
if (!countryCode || countryCode.length !== 2) {
_Utils2.default.sendError(callback, new Error(Number.ERROR_MESSAGES.countrycode));
} else if (!msisdn) {
_Utils2.default.sendError(callback, new Error(Number.ERROR_MESSAGES.msisdn));
cancel(countryCode, msisdn, targetApiKey, callback) {
if (!countryCode || countryCode.length !== 2) {
_Utils.default.sendError(callback, new Error(Number.ERROR_MESSAGES.countrycode));
} else if (!msisdn) {
_Utils.default.sendError(callback, new Error(Number.ERROR_MESSAGES.msisdn));
} else {
var opts = {
country: countryCode,
msisdn,
api_key: this.creds.apiKey,
api_secret: this.creds.apiSecret
};
if (targetApiKey instanceof Function) {
callback = targetApiKey;
} else {
this.options.httpClient.request({
path: _Utils2.default.createPathWithQuery(Number.PATH + "/buy", {
country: countryCode,
msisdn: msisdn,
api_key: this.creds.apiKey,
api_secret: this.creds.apiSecret
})
}, "POST", callback);
opts.target_api_key = targetApiKey;
}
}
/**
* TODO: document
*/
}, {
key: "cancel",
value: function cancel(countryCode, msisdn, callback) {
if (!countryCode || countryCode.length !== 2) {
_Utils2.default.sendError(callback, new Error(Number.ERROR_MESSAGES.countrycode));
} else if (!msisdn) {
_Utils2.default.sendError(callback, new Error(Number.ERROR_MESSAGES.msisdn));
} else {
this.options.httpClient.request({
path: _Utils2.default.createPathWithQuery(Number.PATH + "/cancel", {
country: countryCode,
msisdn: msisdn,
api_key: this.creds.apiKey,
api_secret: this.creds.apiSecret
})
}, "POST", callback);
}
this.options.httpClient.request({
path: _Utils.default.createPathWithQuery("".concat(Number.PATH, "/cancel"), opts)
}, "POST", callback);
}
}
/**
* TODO: document
*/
/**
* TODO: document
*/
}, {
key: "update",
value: function update(countryCode, msisdn, params, callback) {
if (!countryCode || countryCode.length !== 2) {
_Utils2.default.sendError(callback, new Error(Number.ERROR_MESSAGES.countrycode));
} else if (!msisdn) {
_Utils2.default.sendError(callback, new Error(Number.ERROR_MESSAGES.msisdn));
} else {
params["country"] = countryCode;
params["msisdn"] = msisdn;
params["api_key"] = this.creds.apiKey;
params["api_secret"] = this.creds.apiSecret;
this.options.httpClient.request({
path: _Utils2.default.createPathWithQuery(Number.PATH + "/update", params)
}, "POST", callback);
}
update(countryCode, msisdn, params, callback) {
if (!countryCode || countryCode.length !== 2) {
_Utils.default.sendError(callback, new Error(Number.ERROR_MESSAGES.countrycode));
} else if (!msisdn) {
_Utils.default.sendError(callback, new Error(Number.ERROR_MESSAGES.msisdn));
} else {
params["country"] = countryCode;
params["msisdn"] = msisdn;
params["api_key"] = this.creds.apiKey;
params["api_secret"] = this.creds.apiSecret;
this.options.httpClient.request({
path: _Utils.default.createPathWithQuery("".concat(Number.PATH, "/update"), params)
}, "POST", callback);
}
}]);
}
return Number;
}();
}
exports.default = Number;
module.exports = exports["default"];
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9OdW1iZXIuanMiXSwibmFtZXMiOlsiTnVtYmVyIiwib3B0aW9uc05vdEFuT2JqZWN0IiwiY291bnRyeWNvZGUiLCJtc2lzZG4iLCJjcmVkZW50aWFscyIsIm9wdGlvbnMiLCJjcmVkcyIsIl9wcmljaW5nIiwiZ2V0IiwiYXBwbHkiLCJhcmd1bWVudHMiLCJnZXRQaG9uZSIsImNhbGxiYWNrIiwic2VuZEVycm9yIiwiRXJyb3IiLCJFUlJPUl9NRVNTQUdFUyIsImFwaV9rZXkiLCJhcGlLZXkiLCJhcGlfc2VjcmV0IiwiYXBpU2VjcmV0IiwiaHR0cENsaWVudCIsInJlcXVlc3QiLCJwYXRoIiwiY3JlYXRlUGF0aFdpdGhRdWVyeSIsIlBBVEgiLCJjb3VudHJ5Q29kZSIsInBhdHRlcm4iLCJwYXJhbXMiLCJsZW5ndGgiLCJhcmciLCJjb3VudHJ5Il0sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7Ozs7OztB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gICAgfSxcbiAgICAgICAgXCJQT1NUXCIsXG4gICAgICAgIGNhbGxiYWNrXG4gICAgICApO1xuICAgIH1cbiAgfVxufVxuXG5leHBvcnQgZGVmYXVsdCBOdW1iZXI7XG4iXX0=
var _default = Number;
exports.default = _default;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9OdW1iZXIuanMiXSwibmFtZXMiOlsiTnVtYmVyIiwiUEFUSCIsIkVSUk9SX01FU1NBR0VTIiwib3B0aW9uc05vdEFuT2JqZWN0IiwiY291bnRyeWNvZGUiLCJtc2lzZG4iLCJjb25zdHJ1Y3RvciIsImNyZWRlbnRpYWxzIiwib3B0aW9ucyIsImNyZWRzIiwiX3ByaWNpbmciLCJQcmljaW5nIiwiZ2V0UHJpY2luZyIsImdldCIsImFwcGx5IiwiYXJndW1lbnRzIiwiZ2V0UGhvbmVQcmljaW5nIiwiZ2V0UGhvbmUiLCJjYWxsYmFjayIsIlV0aWxzIiwic2VuZEVycm9yIiwiRXJyb3IiLCJhcGlfa2V5IiwiYXBpS2V5IiwiYXBpX3NlY3JldCIsImFwaVNlY3JldCIsImh0dHBDbGllbnQiLCJyZXF1ZXN0IiwicGF0aCIsImNyZWF0ZVBhdGhXaXRoUXVlcnkiLCJzZWFyY2giLCJjb3VudHJ5Q29kZSIsInBhdHRlcm4iLCJwYXJhbXMiLCJsZW5ndGgiLCJhcmciLCJidXkiLCJ0YXJnZXRBcGlLZXkiLCJvcHRzIiwiY291bnRyeSIsIkZ1bmN0aW9uIiwidGFyZ2V0X2FwaV9rZXkiLCJjYW5jZWwiLCJ1cGRhdGUiXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7O0FBRUE7O0FBRUE7Ozs7QUFFQSxNQUFNQSxNQUFOLENBQWE7QUFDWCxhQUFXQyxJQUFYLEdBQWtCO0FBQ2hCLFdBQU8sU0FBUDtBQUNEOztBQUVELGFBQVdDLGNBQVgsR0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gZWxzZSBpZiAoIW1zaXNkbikge1xuICAgICAgVXRpbHMuc2VuZEVycm9yKGNhbGxiYWNrLCBuZXcgRXJyb3IoTnVtYmVyLkVSUk9SX01FU1NBR0VTLm1zaXNkbikpO1xuICAgIH0gZWxzZSB7XG4gICAgICBwYXJhbXNbXCJjb3VudHJ5XCJdID0gY291bnRyeUNvZGU7XG4gICAgICBwYXJhbXNbXCJtc2lzZG5cIl0gPSBtc2lzZG47XG4gICAgICBwYXJhbXNbXCJhcGlfa2V5XCJdID0gdGhpcy5jcmVkcy5hcGlLZXk7XG4gICAgICBwYXJhbXNbXCJhcGlfc2VjcmV0XCJdID0gdGhpcy5jcmVkcy5hcGlTZWNyZXQ7XG5cbiAgICAgIHRoaXMub3B0aW9ucy5odHRwQ2xpZW50LnJlcXVlc3QoXG4gICAgICAgIHtcbiAgICAgICAgICBwYXRoOiBVdGlscy5jcmVhdGVQYXRoV2l0aFF1ZXJ5KGAke051bWJlci5QQVRIfS91cGRhdGVgLCBwYXJhbXMpXG4gICAgICAgIH0sXG4gICAgICAgIFwiUE9TVFwiLFxuICAgICAgICBjYWxsYmFja1xuICAgICAgKTtcbiAgICB9XG4gIH1cbn1cblxuZXhwb3J0IGRlZmF1bHQgTnVtYmVyO1xuIl19

@@ -6,48 +6,33 @@ "use strict";

});
exports.default = void 0;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _Utils = _interopRequireDefault(require("./Utils"));
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _Utils = require("./Utils");
var _Utils2 = _interopRequireDefault(_Utils);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
class NumberInsight {
static get PATH() {
return "/ni/{type}/json";
}
var NumberInsight = function () {
_createClass(NumberInsight, null, [{
key: "PATH",
get: function get() {
return "/ni/{type}/json";
}
}, {
key: "ERROR_MESSAGES",
get: function get() {
return {
numberInsightAdvancedValidation: "Missing Mandatory fields (number and/or callback url)",
numberInsightValidation: "Missing Mandatory field - number",
numberInsightPatternFailure: "Number can contain digits and may include any or all of the following: white space, -,+, (, )."
};
}
/**
* @param {Credentials} credentials
* credentials to be used when interacting with the API.
* @param {Object} options
* Addition NumberInsight options.
*/
static get ERROR_MESSAGES() {
return {
numberInsightAdvancedValidation: "Missing Mandatory fields (number and/or callback url)",
numberInsightValidation: "Missing Mandatory field - number",
numberInsightPatternFailure: "Number can contain digits and may include any or all of the following: white space, -,+, (, )."
};
}
/**
* @param {Credentials} credentials
* credentials to be used when interacting with the API.
* @param {Object} options
* Addition NumberInsight options.
*/
}]);
function NumberInsight(credentials) {
constructor(credentials) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
_classCallCheck(this, NumberInsight);
this.creds = credentials;
this.options = options;
}
/**

@@ -101,77 +86,74 @@ * Get insight on the provided number.

_createClass(NumberInsight, [{
key: "get",
value: function get(options, callback) {
var level = options.level;
// remove 'level' as it's a library-only parameter
delete options.level;
get(options, callback) {
var level = options.level; // remove 'level' as it's a library-only parameter
if (level === "advanced" || level === "advancedAsync") {
if (level === "advanced") {
console.warn('DEPRECATION WARNING: Number Insight Advanced with a level of "advanced" will be synchronous in v2.0+. Consider using the level "advancedAsync" to keep using the async option.');
}
this._numberInsightAsync(options, callback);
} else if (level === "advancedSync") {
this._numberInsightCommon("advanced", options, callback);
} else if (level === "standard") {
this._numberInsightCommon("standard", options, callback);
} else {
this._numberInsightCommon("basic", options, callback);
delete options.level;
if (level === "advanced" || level === "advancedAsync") {
if (level === "advanced") {
console.warn('DEPRECATION WARNING: Number Insight Advanced with a level of "advanced" will be synchronous in v2.0+. Consider using the level "advancedAsync" to keep using the async option.');
}
this._numberInsightAsync(options, callback);
} else if (level === "advancedSync") {
this._numberInsightCommon("advanced", options, callback);
} else if (level === "standard") {
this._numberInsightCommon("standard", options, callback);
} else {
this._numberInsightCommon("basic", options, callback);
}
}, {
key: "_numberInsightAsync",
value: function _numberInsightAsync(inputParams, callback) {
if (!inputParams.number || !inputParams.callback) {
_Utils2.default.sendError(callback, new Error(NumberInsight.ERROR_MESSAGES.numberInsightAdvancedValidation));
}
_numberInsightAsync(inputParams, callback) {
if (!inputParams.number || !inputParams.callback) {
_Utils.default.sendError(callback, new Error(NumberInsight.ERROR_MESSAGES.numberInsightAdvancedValidation));
} else {
inputParams["api_key"] = this.creds.apiKey;
inputParams["api_secret"] = this.creds.apiSecret;
this.options.httpClient.request({
host: this.options.apiHost || "api.nexmo.com",
path: _Utils.default.createPathWithQuery("".concat(NumberInsight.PATH.replace("{type}", "advanced/async")), inputParams)
}, callback);
}
}
_numberInsightCommon(type, inputParams, callback) {
if (this._validateNumber(inputParams, callback)) {
var inputObj;
if (typeof inputParams !== "object") {
inputObj = {
number: inputParams
};
} else {
inputParams["api_key"] = this.creds.apiKey;
inputParams["api_secret"] = this.creds.apiSecret;
this.options.httpClient.request({
host: this.options.apiHost || "api.nexmo.com",
path: _Utils2.default.createPathWithQuery("" + NumberInsight.PATH.replace("{type}", "advanced/async"), inputParams)
}, callback);
inputObj = inputParams;
}
inputObj["api_key"] = this.creds.apiKey;
inputObj["api_secret"] = this.creds.apiSecret;
this.options.httpClient.request({
host: this.options.apiHost || "api.nexmo.com",
path: _Utils.default.createPathWithQuery("".concat(NumberInsight.PATH.replace("{type}", type)), inputObj)
}, callback);
}
}, {
key: "_numberInsightCommon",
value: function _numberInsightCommon(type, inputParams, callback) {
if (this._validateNumber(inputParams, callback)) {
var inputObj;
if ((typeof inputParams === "undefined" ? "undefined" : _typeof(inputParams)) !== "object") {
inputObj = {
number: inputParams
};
} else {
inputObj = inputParams;
}
inputObj["api_key"] = this.creds.apiKey;
inputObj["api_secret"] = this.creds.apiSecret;
this.options.httpClient.request({
host: this.options.apiHost || "api.nexmo.com",
path: _Utils2.default.createPathWithQuery("" + NumberInsight.PATH.replace("{type}", type), inputObj)
}, callback);
}
}
}, {
key: "_validateNumber",
value: function _validateNumber(inputParams, callback) {
var numberPattern = new RegExp("^[0-9 +()-]*$");
}
if ((typeof inputParams === "undefined" ? "undefined" : _typeof(inputParams)) === "object" && !inputParams.number) {
_Utils2.default.sendError(callback, new Error(NumberInsight.ERROR_MESSAGES.numberInsightValidation));
} else if ((typeof inputParams === "undefined" ? "undefined" : _typeof(inputParams)) === "object" && !numberPattern.test(inputParams.number)) {
_Utils2.default.sendError(callback, new Error(NumberInsight.ERROR_MESSAGES.numberInsightPatternFailure));
} else if ((typeof inputParams === "undefined" ? "undefined" : _typeof(inputParams)) !== "object" && (!inputParams || !numberPattern.test(inputParams))) {
_Utils2.default.sendError(callback, new Error(NumberInsight.ERROR_MESSAGES.numberInsightPatternFailure));
}
return true;
_validateNumber(inputParams, callback) {
var numberPattern = new RegExp("^[0-9 +()-]*$");
if (typeof inputParams === "object" && !inputParams.number) {
_Utils.default.sendError(callback, new Error(NumberInsight.ERROR_MESSAGES.numberInsightValidation));
} else if (typeof inputParams === "object" && !numberPattern.test(inputParams.number)) {
_Utils.default.sendError(callback, new Error(NumberInsight.ERROR_MESSAGES.numberInsightPatternFailure));
} else if (typeof inputParams !== "object" && (!inputParams || !numberPattern.test(inputParams))) {
_Utils.default.sendError(callback, new Error(NumberInsight.ERROR_MESSAGES.numberInsightPatternFailure));
}
}]);
return NumberInsight;
}();
return true;
}
exports.default = NumberInsight;
module.exports = exports["default"];
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2Z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gZnJvbS5cbiAgICogQHBhcmFtIHtBcnJheX0gIG9wdGlvbnMuZmVhdHVyZXMgLSAnYWR2YW5jZWQnIG9ubHkuXG4gICAqICAgICAgICAgICAgICAgICBBbiBBcnJheSBkZXRhaWxpbmcgdGhlIGluZm9ybWF0aW9uIHlvdSB3YW50IGZvciB0aGlzIHBob25lXG4gICAqICAgICAgICAgICAgICAgICBudW1iZXIuIFBvc3NpYmxlIEFycmF5IGVsZW1lbnRzIGFyZTpcbiAgICogICAgICAgICAgICAgICAgIC0gdHlwZTogbnVtYmVyIGlzIG9uZSBvZiB0aGUgZm9sbG93aW5nOiBtb2JpbGUsIGxhbmRsaW5lLFxuICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgbGFuZGxpbmVfcHJlbWl1bSBvciB1bmtub3duIHBob25lIG51bWJlci5cbiAgICogICAgICAgICAgICAgICAgIC0gdmFsaWQ6IG51bWJlciBleGlzdHMuXG4gICAqICAgICAgICAgICAgICAgICAtIHJlYWNoYWJsZTogaXMgbnVtYmVyIGF2YWlsYWJsZSBub3cuXG4gICAqICAgICAgICAgICAgICAgICAtIGNhcnJpZXI6IHRoZSBNQ0NNTkMgZm9yIHRoZSBjYXJyaWVyIG51bWJlciBpcyByZWdpc3RlcmVkXG4gICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aXRoLiBUaGlzIGlzIGVpdGhlcjogPElTTyBjb3VudHJ5IGNvZGU+LUZJWEVEXG4gICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvciA8SVNPIGNvdW50cnkgY29kZT4tUFJFTUlVTS5cbiAgICogICAgICAgICAgICAgICAgIC0gcG9ydGVkOiBpZiB0aGUgdXNlciBoYXMgY2hhbmdlZCBjYXJyaWVyIGZvciBudW1iZXIuXG4gICAqICAgICAgICAgICAgICAgICAtIHJvYW1pbmc6IHRoZSBzdWJzY3JpYmVyIGlzIG91dHNpZGUgdGhlaXIgaG9tZSBuZXR3b3JrXG4gICAqXG4gICAqIEBwYXJ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iYWNrLFxuICAgICAgICBuZXcgRXJyb3IoTnVtYmVySW5zaWdodC5FUlJPUl9NRVNTQUdFUy5udW1iZXJJbnNpZ2h0UGF0dGVybkZhaWx1cmUpXG4gICAgICApO1xuICAgIH1cbiAgICByZXR1cm4gdHJ1ZTtcbiAgfVxufVxuXG5leHBvcnQgZGVmYXVsdCBOdW1iZXJJbnNpZ2h0O1xuIl19
}
var _default = NumberInsight;
exports.default = _default;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9OdW1iZXJJbnNpZ2h0LmpzIl0sIm5hbWVzIjpbIk51bWJlckluc2lnaHQiLCJQQVRIIiwiRVJST1JfTUVTU0FHRVMiLCJudW1iZXJJbnNpZ2h0QWR2YW5jZWRWYWxpZGF0aW9uIiwibnVtYmVySW5zaWdodFZhbGlkYXRpb24iLCJudW1iZXJJbnNpZ2h0UGF0dGVybkZhaWx1cmUiLCJjb25zdHJ1Y3RvciIsImNyZWRlbnRpYWxzIiwib3B0aW9ucyIsImNyZWRzIiwiZ2V0IiwiY2FsbGJhY2siLCJsZXZlbCIsImNvbnNvbGUiLCJ3YXJuIiwiX251bWJlckluc2lnaHRBc3luYyIsIl9udW1iZXJJbnNpZ2h0Q29tbW9uIiwiaW5wdXRQYXJhbXMiLCJudW1iZXIiLCJVdGlscyIsInNlbmRFcnJvciIsIkVycm9yIiwiYXBpS2V5IiwiYXBpU2VjcmV0IiwiaHR0cENsaWVudCIsInJlcXVlc3QiLCJob3N0IiwiYXBpSG9zdCIsInBhdGgiLCJjcmVhdGVQYXRoV2l0aFF1ZXJ5IiwicmVwbGFjZSIsInR5cGUiLCJfdmFsaWRhdGVOdW1iZXIiLCJpbnB1dE9iaiIsIm51bWJlclBhdHRlcm4iLCJSZWdFeHAiLCJ0ZXN0Il0sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7OztBQUVBOzs7O0FBRUEsTUFBTUEsYUFBTixDQUFvQ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bnVtYmVyIGlzIG9uZSBvZiB0aGUgZm9sbG93aW5nOiBtb2JpbGUsIGxhbmRsaW5lLFxuICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgbGFuZGxpbmVfcHJlbWl1bSBvciB1bmtub3duIHBob25lIG51bWJlci5cbiAgICogICAgICAgICAgICAgICAgIC0gdmFsaWQ6IG51bWJlciBleGlzdHMuXG4gICAqICAgICAgICAgICAgICAgICAtIHJlYWNoYWJsZTogaXMgbnVtYmVyIGF2YWlsYWJsZSBub3cuXG4gICAqICAgICAgICAgICAgICAgICAtIGNhcnJpZXI6IHRoZSBNQ0NNTkMgZm9yIHRoZSBjYXJyaWVyIG51bWJlciBpcyByZWdpc3RlcmVkXG4gICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aXRoLiBUaGlzIGlzIGVpdGhlcjogPElTTyBjb3VudHJ5IGNvZGU+LUZJWEVEXG4gICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvciA8SVNPIGNvdW50cnkgY29kZT4tUFJFTUlVTS5cbiAgICogICAgICAgICAgICAgICAgIC0gcG9ydGVkOiBpZiB0aGUgdXNlciBoYXMgY2hhbmdlZCBjYXJyaWVyIGZvciBudW1iZXIuXG4gICAqICAgICAgICAgICAgICAgICAtIHJvYW1pbmc6IHRoZSBzdWJzY3JpYmVyIGlzIG91dHNpZGUgdGhlaXIgaG9tZSBuZXR3b3JrXG4gICAqXG4gICAqIEBwYXJhbSB7c3RyaW5nfSBvcHRpb25zLmNhbGxiYWNrIC0gJ2FkdmFuY2VkJyBvbmx5LlxuICAgKiAgICAgICAgICAgICAgICAgVGhlIGNhbGxiYWNrIHRvIGJlIGNhbGxlZCB3aGVuIHRoZSBBUEkgY2FsbCBjb21wbGV0ZXMuXG4gICAqIEBwYXJhbSB7TnVtYmVyfSBvcHRpb25zLmNhbGxiYWNrX3RpbWVvdXQgLSAnYWR2YW5jZWQnIG9ubHkuXG4gICAqICAgICAgICAgICAgICAgICBUaGUgbWF4aW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gaWYgKHR5cGVvZiBpbnB1dFBhcmFtcyA9PT0gXCJvYmplY3RcIiAmJiAhaW5wdXRQYXJhbXMubnVtYmVyKSB7XG4gICAgICBVdGlscy5zZW5kRXJyb3IoXG4gICAgICAgIGNhbGxiYWNrLFxuICAgICAgICBuZXcgRXJyb3IoTnVtYmVySW5zaWdodC5FUlJPUl9NRVNTQUdFUy5udW1iZXJJbnNpZ2h0VmFsaWRhdGlvbilcbiAgICAgICk7XG4gICAgfSBlbHNlIGlmIChcbiAgICAgIHR5cGVvZiBpbnB1dFBhcmFtcyA9PT0gXCJvYmplY3RcIiAmJlxuICAgICAgIW51bWJlclBhdHRlcm4udGVzdChpbnB1dFBhcmFtcy5udW1iZXIpXG4gICAgKSB7XG4gICAgICBVdGlscy5zZW5kRXJyb3IoXG4gICAgICAgIGNhbGxiYWNrLFxuICAgICAgICBuZXcgRXJyb3IoTnVtYmVySW5zaWdodC5FUlJPUl9NRVNTQUdFUy5udW1iZXJJbnNpZ2h0UGF0dGVybkZhaWx1cmUpXG4gICAgICApO1xuICAgIH0gZWxzZSBpZiAoXG4gICAgICB0eXBlb2YgaW5wdXRQYXJhbXMgIT09IFwib2JqZWN0XCIgJiZcbiAgICAgICghaW5wdXRQYXJhbXMgfHwgIW51bWJlclBhdHRlcm4udGVzdChpbnB1dFBhcmFtcykpXG4gICAgKSB7XG4gICAgICBVdGlscy5zZW5kRXJyb3IoXG4gICAgICAgIGNhbGxiYWNrLFxuICAgICAgICBuZXcgRXJyb3IoTnVtYmVySW5zaWdodC5FUlJPUl9NRVNTQUdFUy5udW1iZXJJbnNpZ2h0UGF0dGVybkZhaWx1cmUpXG4gICAgICApO1xuICAgIH1cbiAgICByZXR1cm4gdHJ1ZTtcbiAgfVxufVxuXG5leHBvcnQgZGVmYXVsdCBOdW1iZXJJbnNpZ2h0O1xuIl19

@@ -6,55 +6,44 @@ "use strict";

});
exports.default = void 0;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _Utils = _interopRequireDefault(require("./Utils"));
var _Utils = require("./Utils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _Utils2 = _interopRequireDefault(_Utils);
class Pricing {
static get PATH() {
return "/account/{endpoint}/outbound/{type}";
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
constructor(credentials, options) {
this.creds = credentials;
this.options = options;
}
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
get(type, country, callback) {
return this.options.rest.get(Pricing.PATH.replace("{endpoint}", "get-pricing").replace("{type}", type), {
country
}, callback);
}
var Pricing = function () {
_createClass(Pricing, null, [{
key: "PATH",
get: function get() {
return "/account/{endpoint}/outbound/{type}";
}
}]);
getFull(type, callback) {
return this.options.rest.get(Pricing.PATH.replace("{endpoint}", "get-full-pricing").replace("{type}", type), callback);
}
function Pricing(credentials, options) {
_classCallCheck(this, Pricing);
getPrefix(type, prefix, callback) {
return this.options.rest.get(Pricing.PATH.replace("{endpoint}", "get-prefix-pricing").replace("{type}", type), {
prefix
}, callback);
}
this.creds = credentials;
this.options = options;
getPhone(type, phone, callback) {
return this.options.rest.get(Pricing.PATH.replace("{endpoint}", "get-phone-pricing").replace("{type}", type), {
phone
}, callback);
}
_createClass(Pricing, [{
key: "get",
value: function get(type, country, callback) {
return this.options.rest.get(Pricing.PATH.replace("{endpoint}", "get-pricing").replace("{type}", type), { country: country }, callback);
}
}, {
key: "getFull",
value: function getFull(type, callback) {
return this.options.rest.get(Pricing.PATH.replace("{endpoint}", "get-full-pricing").replace("{type}", type), callback);
}
}, {
key: "getPrefix",
value: function getPrefix(type, prefix, callback) {
return this.options.rest.get(Pricing.PATH.replace("{endpoint}", "get-prefix-pricing").replace("{type}", type), { prefix: prefix }, callback);
}
}, {
key: "getPhone",
value: function getPhone(type, phone, callback) {
return this.options.rest.get(Pricing.PATH.replace("{endpoint}", "get-phone-pricing").replace("{type}", type), { phone: phone }, callback);
}
}]);
}
return Pricing;
}();
exports.default = Pricing;
module.exports = exports["default"];
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9QcmljaW5nLmpzIl0sIm5hbWVzIjpbIlByaWNpbmciLCJjcmVkZW50aWFscyIsIm9wdGlvbnMiLCJjcmVkcyIsInR5cGUiLCJjb3VudHJ5IiwiY2FsbGJhY2siLCJyZXN0IiwiZ2V0IiwiUEFUSCIsInJlcGxhY2UiLCJwcmVmaXgiLCJwaG9uZSJdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7Ozs7O0FBRUE7Ozs7Ozs7O0lBRU1BLE87Ozt3QkFDYztBQUNoQixhQUFPLHFDQUFQO0FBQ0Q7OztBQUVELG1CQUFZQyxXQUFaLEVBQXlCQyxPQUF6QixFQUFrQztBQUFBOztBQUNoQyxTQUFLQyxLQUFMLEdBQWFGLFdBQWI7QUFDQSxTQUFLQyxPQUFMLEdBQWVBLE9BQWY7QUFDRDs7Ozt3QkFFR0UsSSxFQUFNQyxPLEVBQVNDLFEsRUFBVTtBQUMzQixhQUFPLEtBQUtKLE9BQUwsQ0FBYUssSUFBYixDQUFrQkMsR0FBbEIsQ0FDTFIsUUFBUVMsSUFBUixDQUFhQyxPQUFiLENBQXFCLFlBQXJCLEVBQW1DLGFBQW5DLEVBQWtEQSxPQUFsRCxDQUEwRCxRQUExRCxFQUFvRU4sSUFBcEUsQ0FESyxFQUVMLEVBQUVDLGdCQUFGLEVBRkssRUFHTEMsUUFISyxDQUFQO0FBS0Q7Ozs0QkFFT0YsSSxFQUFNRSxRLEVBQVU7Q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AgICBQcmljaW5nLlBBVEgucmVwbGFjZShcIntlbmRwb2ludH1cIiwgXCJnZXQtcGhvbmUtcHJpY2luZ1wiKS5yZXBsYWNlKFxuICAgICAgICBcInt0eXBlfVwiLFxuICAgICAgICB0eXBlXG4gICAgICApLFxuICAgICAgeyBwaG9uZSB9LFxuICAgICAgY2FsbGJhY2tcbiAgICApO1xuICB9XG59XG5cbmV4cG9ydCBkZWZhdWx0IFByaWNpbmc7XG4iXX0=
var _default = Pricing;
exports.default = _default;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9QcmljaW5nLmpzIl0sIm5hbWVzIjpbIlByaWNpbmciLCJQQVRIIiwiY29uc3RydWN0b3IiLCJjcmVkZW50aWFscyIsIm9wdGlvbnMiLCJjcmVkcyIsImdldCIsInR5cGUiLCJjb3VudHJ5IiwiY2FsbGJhY2siLCJyZXN0IiwicmVwbGFjZSIsImdldEZ1bGwiLCJnZXRQcmVmaXgiLCJwcmVmaXgiLCJnZXRQaG9uZSIsInBob25lIl0sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7OztBQUVBOzs7O0FBRUEsTUFBTUEsT0FBTixDQUFjO0FBQ1osYUFBV0MsSUFBWCxHQUFrQjtBQUNoQixXQUFPLHFDQUFQO0FBQ0Q7O0FBRURDLEVBQUFBLFdBQVcsQ0FBQ0MsV0FBRCxFQUFjQyxPQUFkLEVBQXVCO0FBQ2hDLFNBQUtDLEtBQUwsR0FBYUYsV0FBYjtBQUNBLFNBQUtDLE9BQUwsR0FBZUEsT0FBZjtBQUNEOztBQUVERSxFQUFBQSxHQUFHLENBQUNDLElBQUQsRUFBT0MsT0FBUCxFQUFnQkMsUUFBaEIsRUFBMEI7QUFDM0IsV0FBTyxLQUFLTCxPQUFMLENBQWFNLElBQWIsQ0FBa0JKLEdBQWxCLENBQ0xOLE9BQU8sQ0FBQ0MsSUFBUixDQUFhVSxPQUFiLENBQXFCL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FUSC5yZXBsYWNlKFwie2VuZHBvaW50fVwiLCBcImdldC1wcmVmaXgtcHJpY2luZ1wiKS5yZXBsYWNlKFxuICAgICAgICBcInt0eXBlfVwiLFxuICAgICAgICB0eXBlXG4gICAgICApLFxuICAgICAgeyBwcmVmaXggfSxcbiAgICAgIGNhbGxiYWNrXG4gICAgKTtcbiAgfVxuXG4gIGdldFBob25lKHR5cGUsIHBob25lLCBjYWxsYmFjaykge1xuICAgIHJldHVybiB0aGlzLm9wdGlvbnMucmVzdC5nZXQoXG4gICAgICBQcmljaW5nLlBBVEgucmVwbGFjZShcIntlbmRwb2ludH1cIiwgXCJnZXQtcGhvbmUtcHJpY2luZ1wiKS5yZXBsYWNlKFxuICAgICAgICBcInt0eXBlfVwiLFxuICAgICAgICB0eXBlXG4gICAgICApLFxuICAgICAgeyBwaG9uZSB9LFxuICAgICAgY2FsbGJhY2tcbiAgICApO1xuICB9XG59XG5cbmV4cG9ydCBkZWZhdWx0IFByaWNpbmc7XG4iXX0=

@@ -6,30 +6,22 @@ "use strict";

});
exports.default = void 0;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _fs = _interopRequireDefault(require("fs"));
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _querystring = _interopRequireDefault(require("querystring"));
var _fs = require("fs");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _fs2 = _interopRequireDefault(_fs);
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
var _querystring = require("querystring");
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
var _querystring2 = _interopRequireDefault(_querystring);
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
class Redact {
static get PATH() {
return "/v1/redact";
}
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var Redact = function () {
_createClass(Redact, null, [{
key: "PATH",
get: function get() {
return "/v1/redact";
}
}]);
function Redact(credentials, options) {
_classCallCheck(this, Redact);
constructor(credentials, options) {
this.creds = credentials;

@@ -39,27 +31,25 @@ this.options = options;

_createClass(Redact, [{
key: "transaction",
value: function transaction(id, product, opts, callback) {
if (typeof callback === "undefined" && typeof opts === "function") {
callback = opts;
opts = {};
transaction(id, product, opts, callback) {
if (typeof callback === "undefined" && typeof opts === "function") {
callback = opts;
opts = {};
}
opts = opts || {};
return this.options.api.postJson("".concat(Redact.PATH, "/transaction"), _objectSpread({
id,
product
}, opts), function (err, response, body) {
if (err) {
return callback(err);
}
opts = opts || {};
return callback(null, body);
});
}
return this.options.api.postJson(Redact.PATH + "/transaction", _extends({ id: id, product: product }, opts), function (err, response, body) {
if (err) {
return callback(err);
}
}
return callback(null, body);
});
}
}]);
return Redact;
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ke1JlZGFjdC5QQVRIfS90cmFuc2FjdGlvbmAsXG4gICAgICB7IGlkLCBwcm9kdWN0LCAuLi5vcHRzIH0sXG4gICAgICBmdW5jdGlvbihlcnIsIHJlc3BvbnNlLCBib2R5KSB7XG4gICAgICAgIGlmIChlcnIpIHtcbiAgICAgICAgICByZXR1cm4gY2FsbGJhY2soZXJyKTtcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBjYWxsYmFjayhudWxsLCBib2R5KTtcbiAgICAgIH1cbiAgICApO1xuICB9XG59XG5cbmV4cG9ydCBkZWZhdWx0IFJlZGFjdDtcbiJdfQ==

@@ -6,15 +6,9 @@ "use strict";

});
exports.default = void 0;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _Utils = _interopRequireDefault(require("./Utils"));
var _Utils = require("./Utils");
var _Utils2 = _interopRequireDefault(_Utils);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var querystring = require("querystring");
/**

@@ -24,31 +18,24 @@ * Provides access to the `ShortCode` endpoint.

var ShortCode = function () {
_createClass(ShortCode, null, [{
key: "PATH",
get: function get() {
return "/sc/us/${type}/json";
}
}, {
key: "ERROR_MESSAGES",
get: function get() {
return {
to: "Invalid to address",
msgParams: "Invalid shortcode message parameters"
};
}
/**
* @param {Credentials} credentials
* credentials to be used when interacting with the API.
* @param {Object} options
* Additional ShortCode options.
*/
class ShortCode {
static get PATH() {
return "/sc/us/${type}/json";
}
}]);
static get ERROR_MESSAGES() {
return {
to: "Invalid to address",
msgParams: "Invalid shortcode message parameters"
};
}
/**
* @param {Credentials} credentials
* credentials to be used when interacting with the API.
* @param {Object} options
* Additional ShortCode options.
*/
function ShortCode(credentials) {
constructor(credentials) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
_classCallCheck(this, ShortCode);
this.creds = credentials;

@@ -58,61 +45,56 @@ this.options = options;

_createClass(ShortCode, [{
key: "_sendRequest",
value: function _sendRequest(endpoint, method, callback) {
endpoint.path = endpoint.path + (endpoint.path.indexOf("?") > 0 ? "&" : "?") + querystring.stringify({
api_key: this.creds.apiKey,
api_secret: this.creds.apiSecret
});
this.options.httpClient.request(endpoint, method, callback);
_sendRequest(endpoint, method, callback) {
endpoint.path = endpoint.path + (endpoint.path.indexOf("?") > 0 ? "&" : "?") + querystring.stringify({
api_key: this.creds.apiKey,
api_secret: this.creds.apiSecret
});
this.options.httpClient.request(endpoint, method, callback);
}
_sendViaShortcode(type, recipient, messageParams, opts, callback) {
if (!recipient) {
_Utils.default.sendError(callback, new Error(ShortCode.ERROR_MESSAGES.to));
}
}, {
key: "_sendViaShortcode",
value: function _sendViaShortcode(type, recipient, messageParams, opts, callback) {
if (!recipient) {
_Utils2.default.sendError(callback, new Error(ShortCode.ERROR_MESSAGES.to));
}
if (!messageParams || !Object.keys(messageParams)) {
_Utils2.default.sendError(callback, new Error(ShortCode.ERROR_MESSAGES.msgParams));
}
opts = opts || {};
var path = ShortCode.PATH.replace("${type}", type);
Object.keys(messageParams).forEach(function (key) {
opts[key] = messageParams[key];
});
opts.to = recipient;
path += "?" + querystring.stringify(opts);
this.options.logger.info("sending message from shortcode " + type + " to " + recipient + " with parameters " + JSON.stringify(messageParams));
this._sendRequest({
host: this.options.restHost || "rest.nexmo.com",
path: path
}, "POST", function (err, apiResponse) {
if (!err && apiResponse.status && apiResponse.messages[0].status > 0) {
_Utils2.default.sendError(callback, new Error(apiResponse.messages[0]["error-text"]), apiResponse);
} else {
if (callback) callback(err, apiResponse);
}
});
if (!messageParams || !Object.keys(messageParams)) {
_Utils.default.sendError(callback, new Error(ShortCode.ERROR_MESSAGES.msgParams));
}
}, {
key: "shortcodeAlert",
value: function shortcodeAlert(recipient, messageParams, opts, callback) {
this._sendViaShortcode("alert", recipient, messageParams, opts, callback);
}
}, {
key: "shortcode2FA",
value: function shortcode2FA(recipient, messageParams, opts, callback) {
this._sendViaShortcode("2fa", recipient, messageParams, opts, callback);
}
}, {
key: "shortcodeMarketing",
value: function shortcodeMarketing(recipient, messageParams, opts, callback) {
this._sendViaShortcode("marketing", recipient, messageParams, opts, callback);
}
}]);
return ShortCode;
}();
opts = opts || {};
var path = ShortCode.PATH.replace("${type}", type);
Object.keys(messageParams).forEach(function (key) {
opts[key] = messageParams[key];
});
opts.to = recipient;
path += "?" + querystring.stringify(opts);
this.options.logger.info("sending message from shortcode " + type + " to " + recipient + " with parameters " + JSON.stringify(messageParams));
exports.default = ShortCode;
module.exports = exports["default"];
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9TaG9ydENvZGUuanMiXSwibmFtZXMiOlsicXVlcnlzdHJpbmciLCJyZXF1aXJlIiwiU2hvcnRDb2RlIiwidG8iLCJtc2dQYXJhbXMiLCJjcmVkZW50aWFscyIsIm9wdGlvbnMiLCJjcmVkcyIsImVuZHBvaW50IiwibWV0aG9kIiwiY2FsbGJhY2siLCJwYXRoIiwiaW5kZXhPZiIsInN0cmluZ2lmeSIsImFwaV9rZXkiLCJhcGlLZXkiLCJhcGlfc2VjcmV0IiwiYXBpU2VjcmV0IiwiaHR0cENsaWVudCIsInJlcXVlc3QiLCJ0eXBlIiwicmVjaXBpZW50IiwibWVzc2FnZVBhcmFtcyIsIm9wdHMiLCJzZW5kRXJyb3IiLCJFcnJvciIsIkVSUk9SX01FU1NBR0VTIiwiT2JqZWN0Iiwia2V5cyIsIlBBVEgiLCJyZXBsYWNlIiwiZm9yRWFjaCIsImtleSIsImxvZ2dl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CByZWNpcGllbnQsIG1lc3NhZ2VQYXJhbXMsIG9wdHMsIGNhbGxiYWNrKTtcbiAgfVxuICBzaG9ydGNvZGUyRkEocmVjaXBpZW50LCBtZXNzYWdlUGFyYW1zLCBvcHRzLCBjYWxsYmFjaykge1xuICAgIHRoaXMuX3NlbmRWaWFTaG9ydGNvZGUoXCIyZmFcIiwgcmVjaXBpZW50LCBtZXNzYWdlUGFyYW1zLCBvcHRzLCBjYWxsYmFjayk7XG4gIH1cbiAgc2hvcnRjb2RlTWFya2V0aW5nKHJlY2lwaWVudCwgbWVzc2FnZVBhcmFtcywgb3B0cywgY2FsbGJhY2spIHtcbiAgICB0aGlzLl9zZW5kVmlhU2hvcnRjb2RlKFxuICAgICAgXCJtYXJrZXRpbmdcIixcbiAgICAgIHJlY2lwaWVudCxcbiAgICAgIG1lc3NhZ2VQYXJhbXMsXG4gICAgICBvcHRzLFxuICAgICAgY2FsbGJhY2tcbiAgICApO1xuICB9XG59XG5cbmV4cG9ydCBkZWZhdWx0IFNob3J0Q29kZTtcbiJdfQ==
this._sendRequest({
host: this.options.restHost || "rest.nexmo.com",
path: path
}, "POST", function (err, apiResponse) {
if (!err && apiResponse.status && apiResponse.messages[0].status > 0) {
_Utils.default.sendError(callback, new Error(apiResponse.messages[0]["error-text"]), apiResponse);
} else {
if (callback) callback(err, apiResponse);
}
});
}
shortcodeAlert(recipient, messageParams, opts, callback) {
this._sendViaShortcode("alert", recipient, messageParams, opts, callback);
}
shortcode2FA(recipient, messageParams, opts, callback) {
this._sendViaShortcode("2fa", recipient, messageParams, opts, callback);
}
shortcodeMarketing(recipient, messageParams, opts, callback) {
this._sendViaShortcode("marketing", recipient, messageParams, opts, callback);
}
}
var _default = ShortCode;
exports.default = _default;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9TaG9ydENvZGUuanMiXSwibmFtZXMiOlsicXVlcnlzdHJpbmciLCJyZXF1a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iYWxlcnRcIiwgcmVjaXBpZW50LCBtZXNzYWdlUGFyYW1zLCBvcHRzLCBjYWxsYmFjayk7XG4gIH1cbiAgc2hvcnRjb2RlMkZBKHJlY2lwaWVudCwgbWVzc2FnZVBhcmFtcywgb3B0cywgY2FsbGJhY2spIHtcbiAgICB0aGlzLl9zZW5kVmlhU2hvcnRjb2RlKFwiMmZhXCIsIHJlY2lwaWVudCwgbWVzc2FnZVBhcmFtcywgb3B0cywgY2FsbGJhY2spO1xuICB9XG4gIHNob3J0Y29kZU1hcmtldGluZyhyZWNpcGllbnQsIG1lc3NhZ2VQYXJhbXMsIG9wdHMsIGNhbGxiYWNrKSB7XG4gICAgdGhpcy5fc2VuZFZpYVNob3J0Y29kZShcbiAgICAgIFwibWFya2V0aW5nXCIsXG4gICAgICByZWNpcGllbnQsXG4gICAgICBtZXNzYWdlUGFyYW1zLFxuICAgICAgb3B0cyxcbiAgICAgIGNhbGxiYWNrXG4gICAgKTtcbiAgfVxufVxuXG5leHBvcnQgZGVmYXVsdCBTaG9ydENvZGU7XG4iXX0=

@@ -6,37 +6,26 @@ "use strict";

});
exports.default = void 0;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/**
* Provides access to the `stream` resource.
*/
var StreamResource = function () {
_createClass(StreamResource, null, [{
key: "PATH",
class StreamResource {
/**
* The path to the `stream` resource.
*/
static get PATH() {
return "/v1/calls/{call_uuid}/stream";
}
/**
* Creates a new StreamResource.
*
* @param {Credentials} creds - Credentials used when interacting with the Nexmo API.
* @param {Object} options - additional options for the class.
*/
/**
* The path to the `stream` resource.
*/
get: function get() {
return "/v1/calls/{call_uuid}/stream";
}
/**
* Creates a new StreamResource.
*
* @param {Credentials} creds - Credentials used when interacting with the Nexmo API.
* @param {Object} options - additional options for the class.
*/
}]);
function StreamResource(creds, options) {
_classCallCheck(this, StreamResource);
constructor(creds, options) {
this.creds = creds;
this.options = options;
}
/**

@@ -50,49 +39,42 @@ * Starts a stream in a call.

_createClass(StreamResource, [{
key: "start",
value: function start(callId, params, callback) {
params = JSON.stringify(params);
start(callId, params, callback) {
params = JSON.stringify(params);
var config = {
host: this.options.apiHost || "api.nexmo.com",
path: StreamResource.PATH.replace("{call_uuid}", callId),
method: "PUT",
body: params,
headers: {
"Content-Type": "application/json",
"Content-Length": Buffer.byteLength(params),
Authorization: "Bearer ".concat(this.creds.generateJwt())
}
};
this.options.httpClient.request(config, callback);
}
/**
* Stop a stream in a call.
*
* @param {string} callId - The unique identifier for the call for the stream to be stopped in.
* @param {function} callback - function to be called when the request completes.
*/
var config = {
host: this.options.apiHost || "api.nexmo.com",
path: StreamResource.PATH.replace("{call_uuid}", callId),
method: "PUT",
body: params,
headers: {
"Content-Type": "application/json",
"Content-Length": Buffer.byteLength(params),
Authorization: "Bearer " + this.creds.generateJwt()
}
};
this.options.httpClient.request(config, callback);
}
/**
* Stop a stream in a call.
*
* @param {string} callId - The unique identifier for the call for the stream to be stopped in.
* @param {function} callback - function to be called when the request completes.
*/
stop(callId, callback) {
var config = {
host: this.options.apiHost || "api.nexmo.com",
path: StreamResource.PATH.replace("{call_uuid}", callId),
method: "DELETE",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer ".concat(this.creds.generateJwt())
}
};
this.options.httpClient.request(config, callback);
}
}, {
key: "stop",
value: function stop(callId, callback) {
var config = {
host: this.options.apiHost || "api.nexmo.com",
path: StreamResource.PATH.replace("{call_uuid}", callId),
method: "DELETE",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + this.creds.generateJwt()
}
};
this.options.httpClient.request(config, callback);
}
}]);
}
return StreamResource;
}();
exports.default = StreamResource;
module.exports = exports["default"];
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9TdHJlYW1SZXNvdXJjZS5qcyJdLCJuYW1lcyI6WyJTdHJlYW1SZXNvdXJjZSIsImNyZWRzIiwib3B0aW9ucyIsImNhbGxJZCIsInBhcmFtcyIsImNhbGxiYWNrIiwiSlNPTiIsInN0cmluZ2lmeSIsImNvbmZpZyIsImhvc3QiLCJhcGlIb3N0IiwicGF0aCIsIlBBVEgiLCJyZXBsYWNlIiwibWV0aG9kIiwiYm9keSIsImhlYWRlcnMiLCJCdWZmZXIiLCJieXRlTGVuZ3RoIiwiQXV0aG9yaXphdGlvbiIsImdlbmVyYXRlSnd0IiwiaHR0cENsaWVudCIsInJlcXVlc3QiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFBQTs7O0lBR01BLGM7Ozs7QUFDSjs7O3dCQUdrQjtBQUNoQixhQUFPLDhCQUFQO0FBQ0Q7O0FBRUQ7Ozs7Ozs7OztBQU1BLDBCQUFZQyxLQUFaLEVBQW1CQyxPQUFuQixFQUE0QjtBQUFBOztBQUMxQixTQUFLRCxLQUFMLEdBQWFBLEtBQWI7QUFDQSxTQUFLQyxPQUFMLEdBQWVBLE9BQWY7QUFDRDs7QUFFRDs7Ozs7Ozs7OzswQkFNTUMsTSxFQUFRQyxNLEVBQVFDLFEsRUFBVTtBQUM5QkQsZUFBU0UsS0FBS0MsU0FBTCxDQUFlSCxNQUFmLENBQVQ7O0FBRUEsVUFBSUksU0FBUztBQUNYQyxjQUFNLEtBQUtQLE9BQUwsQ0FBYVEsT0FBYixJQUF3QixlQURuQjtBQUVYQyxjQUFNWCxlQUFlWSxJQUFmLENBQW9CQyxPQUFwQixDQUE0QixhQUE1QixFQUEyQ1YsTUFBM0MsQ0FGSztBQUdYVyxnQkFBUSxLQUhHO0F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ZW50LVR5cGVcIjogXCJhcHBsaWNhdGlvbi9qc29uXCIsXG4gICAgICAgIEF1dGhvcml6YXRpb246IGBCZWFyZXIgJHt0aGlzLmNyZWRzLmdlbmVyYXRlSnd0KCl9YFxuICAgICAgfVxuICAgIH07XG4gICAgdGhpcy5vcHRpb25zLmh0dHBDbGllbnQucmVxdWVzdChjb25maWcsIGNhbGxiYWNrKTtcbiAgfVxufVxuXG5leHBvcnQgZGVmYXVsdCBTdHJlYW1SZXNvdXJjZTtcbiJdfQ==
var _default = StreamResource;
exports.default = _default;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9TdHJlYW1SZXNvdXJjZS5qcyJdLCJuYW1lcyI6WyJTdHJlYW1SZXNvdXJjZSIsIlBBVEgiLCJjb25zdHJ1Y3RvciIsImNyZWRzIiwib3B0aW9ucyIsInN0YXJ0IiwiY2FsbElkIiwicGFyYW1zIiwiY2FsbGJhY2siLCJKU09OIiwic3RyaW5naWZ5IiwiY29uZmlnIiwiaG9zdCIsImFwaUhvc3QiLCJwYXRoIiwicmVwbGFjZSIsIm1ldGhvZCIsImJvZHkiLCJoZWFkZXJzIiwiQnVmZmVyIiwiYnl0ZUxlbmd0aCIsIkF1dGhvcml6YXRpb24iLCJnZW5lcmF0ZUp3dCIsImh0dHBDbGllbnQiLCJyZXF1ZXN0Iiwic3RvcCJdLCJtYXBwaW5ncyI6Ijs7Ozs7OztBQUFBOzs7QUFHQSxNQUFNQSxjQUFOLENBQXFCO0FBQ25COzs7QUFHQSxhQUFXQyxJQUFYLEdBQWtCO0FBQ2hCLFdBQU8sOEJBQVA7QUFDRDtBQUVEOzs7Ozs7OztBQU1BQyxFQUFBQSxXQUFXLENBQUNDLEtBQUQsRUFBUUMsT0FBUixFQUFpQjtBQUMxQixTQUFLRCxLQUFMLEdBQWFBLEtBQWI7QUFDQSxTQUFLQyxPQUFMLEdBQWVBLE9BQWY7QUFDR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QHBhcmFtIHtzdHJpbmd9IGNhbGxJZCAtIFRoZSB1bmlxdWUgaWRlbnRpZmllciBmb3IgdGhlIGNhbGwgZm9yIHRoZSBzdHJlYW0gdG8gYmUgc3RvcHBlZCBpbi5cbiAgICogQHBhcmFtIHtmdW5jdGlvbn0gY2FsbGJhY2sgLSBmdW5jdGlvbiB0byBiZSBjYWxsZWQgd2hlbiB0aGUgcmVxdWVzdCBjb21wbGV0ZXMuXG4gICAqL1xuICBzdG9wKGNhbGxJZCwgY2FsbGJhY2spIHtcbiAgICB2YXIgY29uZmlnID0ge1xuICAgICAgaG9zdDogdGhpcy5vcHRpb25zLmFwaUhvc3QgfHwgXCJhcGkubmV4bW8uY29tXCIsXG4gICAgICBwYXRoOiBTdHJlYW1SZXNvdXJjZS5QQVRILnJlcGxhY2UoXCJ7Y2FsbF91dWlkfVwiLCBjYWxsSWQpLFxuICAgICAgbWV0aG9kOiBcIkRFTEVURVwiLFxuICAgICAgaGVhZGVyczoge1xuICAgICAgICBcIkNvbnRlbnQtVHlwZVwiOiBcImFwcGxpY2F0aW9uL2pzb25cIixcbiAgICAgICAgQXV0aG9yaXphdGlvbjogYEJlYXJlciAke3RoaXMuY3JlZHMuZ2VuZXJhdGVKd3QoKX1gXG4gICAgICB9XG4gICAgfTtcbiAgICB0aGlzLm9wdGlvbnMuaHR0cENsaWVudC5yZXF1ZXN0KGNvbmZpZywgY2FsbGJhY2spO1xuICB9XG59XG5cbmV4cG9ydCBkZWZhdWx0IFN0cmVhbVJlc291cmNlO1xuIl19

@@ -6,37 +6,26 @@ "use strict";

});
exports.default = void 0;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/**
* Provides access to the `talk` resource.
*/
var TalkResource = function () {
_createClass(TalkResource, null, [{
key: "PATH",
class TalkResource {
/**
* The path to the `talk` resource.
*/
static get PATH() {
return "/v1/calls/{call_uuid}/talk";
}
/**
* Creates a new TalkResource.
*
* @param {Credentials} creds - Credentials used when interacting with the Nexmo API.
* @param {Object} options - additional options for the class.
*/
/**
* The path to the `talk` resource.
*/
get: function get() {
return "/v1/calls/{call_uuid}/talk";
}
/**
* Creates a new TalkResource.
*
* @param {Credentials} creds - Credentials used when interacting with the Nexmo API.
* @param {Object} options - additional options for the class.
*/
}]);
function TalkResource(creds, options) {
_classCallCheck(this, TalkResource);
constructor(creds, options) {
this.creds = creds;
this.options = options;
}
/**

@@ -50,49 +39,42 @@ * Starts a talk in a call.

_createClass(TalkResource, [{
key: "start",
value: function start(callId, params, callback) {
params = JSON.stringify(params);
start(callId, params, callback) {
params = JSON.stringify(params);
var config = {
host: this.options.apiHost || "api.nexmo.com",
path: TalkResource.PATH.replace("{call_uuid}", callId),
method: "PUT",
body: params,
headers: {
"Content-Type": "application/json",
"Content-Length": Buffer.byteLength(params),
Authorization: "Bearer ".concat(this.creds.generateJwt())
}
};
this.options.httpClient.request(config, callback);
}
/**
* Stop a talk in a call.
*
* @param {string} callId - The unique identifier for the call for the talk to be stopped in.
* @param {function} callback - function to be called when the request completes.
*/
var config = {
host: this.options.apiHost || "api.nexmo.com",
path: TalkResource.PATH.replace("{call_uuid}", callId),
method: "PUT",
body: params,
headers: {
"Content-Type": "application/json",
"Content-Length": Buffer.byteLength(params),
Authorization: "Bearer " + this.creds.generateJwt()
}
};
this.options.httpClient.request(config, callback);
}
/**
* Stop a talk in a call.
*
* @param {string} callId - The unique identifier for the call for the talk to be stopped in.
* @param {function} callback - function to be called when the request completes.
*/
stop(callId, callback) {
var config = {
host: this.options.apiHost || "api.nexmo.com",
path: TalkResource.PATH.replace("{call_uuid}", callId),
method: "DELETE",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer ".concat(this.creds.generateJwt())
}
};
this.options.httpClient.request(config, callback);
}
}, {
key: "stop",
value: function stop(callId, callback) {
var config = {
host: this.options.apiHost || "api.nexmo.com",
path: TalkResource.PATH.replace("{call_uuid}", callId),
method: "DELETE",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + this.creds.generateJwt()
}
};
this.options.httpClient.request(config, callback);
}
}]);
}
return TalkResource;
}();
exports.default = TalkResource;
module.exports = exports["default"];
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9UYWxrUmVzb3VyY2UuanMiXSwibmFtZXMiOlsiVGFsa1Jlc291cmNlIiwiY3JlZHMiLCJvcHRpb25zIiwiY2FsbElkIiwicGFyYW1zIiwiY2FsbGJhY2siLCJKU09OIiwic3RyaW5naWZ5IiwiY29uZmlnIiwiaG9zdCIsImFwaUhvc3QiLCJwYXRoIiwiUEFUSCIsInJlcGxhY2UiLCJtZXRob2QiLCJib2R5IiwiaGVhZGVycyIsIkJ1ZmZlciIsImJ5dGVMZW5ndGgiLCJBdXRob3JpemF0aW9uIiwiZ2VuZXJhdGVKd3QiLCJodHRwQ2xpZW50IiwicmVxdWVzdCJdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7OztBQUFBOzs7SUFHTUEsWTs7OztBQUNKOzs7d0JBR2tCO0FBQ2hCLGFBQU8sNEJBQVA7QUFDRDs7QUFFRDs7Ozs7Ozs7O0FBTUEsd0JBQVlDLEtBQVosRUFBbUJDLE9BQW5CLEVBQTRCO0FBQUE7O0FBQzFCLFNBQUtELEtBQUwsR0FBYUEsS0FBYjtBQUNBLFNBQUtDLE9BQUwsR0FBZUEsT0FBZjtBQUNEOztBQUVEOzs7Ozs7Ozs7OzBCQU1NQyxNLEVBQVFDLE0sRUFBUUMsUSxFQUFVO0FBQzlC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c3QgfHwgXCJhcGkubmV4bW8uY29tXCIsXG4gICAgICBwYXRoOiBUYWxrUmVzb3VyY2UuUEFUSC5yZXBsYWNlKFwie2NhbGxfdXVpZH1cIiwgY2FsbElkKSxcbiAgICAgIG1ldGhvZDogXCJERUxFVEVcIixcbiAgICAgIGhlYWRlcnM6IHtcbiAgICAgICAgXCJDb250ZW50LVR5cGVcIjogXCJhcHBsaWNhdGlvbi9qc29uXCIsXG4gICAgICAgIEF1dGhvcml6YXRpb246IGBCZWFyZXIgJHt0aGlzLmNyZWRzLmdlbmVyYXRlSnd0KCl9YFxuICAgICAgfVxuICAgIH07XG4gICAgdGhpcy5vcHRpb25zLmh0dHBDbGllbnQucmVxdWVzdChjb25maWcsIGNhbGxiYWNrKTtcbiAgfVxufVxuXG5leHBvcnQgZGVmYXVsdCBUYWxrUmVzb3VyY2U7XG4iXX0=
var _default = TalkResource;
exports.default = _default;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9UYWxrUmVzb3VyY2UuanMiXSwibmFtZXMiOlsiVGFsa1Jlc291cmNlIiwiUEFUSCIsImNvbnN0cnVjdG9yIiwiY3JlZHMiLCJvcHRpb25zIiwic3RhcnQiLCJjYWxsSWQiLCJwYXJhbXMiLCJjYWxsYmFjayIsIkpTT04iLCJzdHJpbmdpZnkiLCJjb25maWciLCJob3N0IiwiYXBpSG9zdCIsInBhdGgiLCJyZXBsYWNlIiwibWV0aG9kIiwiYm9keSIsImhlYWRlcnMiLCJCdWZmZXIiLCJieXRlTGVuZ3RoIiwiQXV0aG9yaXphdGlvbiIsImdlbmVyYXRlSnd0IiwiaHR0cENsaWVudCIsInJlcXVlc3QiLCJzdG9wIl0sIm1hcHBpbmdzIjoiOzs7Ozs7O0FBQUE7OztBQUdBLE1BQU1BLFlBQU4sQ0FBbUI7QUFDakI7OztBQUdBLGFBQVdDLElBQVgsR0FBa0I7QUFDaEIsV0FBTyw0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ZXJhdGVKd3QoKX1gXG4gICAgICB9XG4gICAgfTtcbiAgICB0aGlzLm9wdGlvbnMuaHR0cENsaWVudC5yZXF1ZXN0KGNvbmZpZywgY2FsbGJhY2spO1xuICB9XG5cbiAgLyoqXG4gICAqIFN0b3AgYSB0YWxrIGluIGEgY2FsbC5cbiAgICpcbiAgICogQHBhcmFtIHtzdHJpbmd9IGNhbGxJZCAtIFRoZSB1bmlxdWUgaWRlbnRpZmllciBmb3IgdGhlIGNhbGwgZm9yIHRoZSB0YWxrIHRvIGJlIHN0b3BwZWQgaW4uXG4gICAqIEBwYXJhbSB7ZnVuY3Rpb259IGNhbGxiYWNrIC0gZnVuY3Rpb24gdG8gYmUgY2FsbGVkIHdoZW4gdGhlIHJlcXVlc3QgY29tcGxldGVzLlxuICAgKi9cbiAgc3RvcChjYWxsSWQsIGNhbGxiYWNrKSB7XG4gICAgdmFyIGNvbmZpZyA9IHtcbiAgICAgIGhvc3Q6IHRoaXMub3B0aW9ucy5hcGlIb3N0IHx8IFwiYXBpLm5leG1vLmNvbVwiLFxuICAgICAgcGF0aDogVGFsa1Jlc291cmNlLlBBVEgucmVwbGFjZShcIntjYWxsX3V1aWR9XCIsIGNhbGxJZCksXG4gICAgICBtZXRob2Q6IFwiREVMRVRFXCIsXG4gICAgICBoZWFkZXJzOiB7XG4gICAgICAgIFwiQ29udGVudC1UeXBlXCI6IFwiYXBwbGljYXRpb24vanNvblwiLFxuICAgICAgICBBdXRob3JpemF0aW9uOiBgQmVhcmVyICR7dGhpcy5jcmVkcy5nZW5lcmF0ZUp3dCgpfWBcbiAgICAgIH1cbiAgICB9O1xuICAgIHRoaXMub3B0aW9ucy5odHRwQ2xpZW50LnJlcXVlc3QoY29uZmlnLCBjYWxsYmFjayk7XG4gIH1cbn1cblxuZXhwb3J0IGRlZmF1bHQgVGFsa1Jlc291cmNlO1xuIl19
"use strict";
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var querystring = require("querystring");

@@ -13,11 +11,12 @@

var pathExt = "";
if (typeof query === "string") {
// single call Id
pathExt = "/" + query;
} else if ((typeof query === "undefined" ? "undefined" : _typeof(query)) === "object" && Object.keys(query).length > 0) {
pathExt = "/".concat(query);
} else if (typeof query === "object" && Object.keys(query).length > 0) {
// filter
pathExt = "?" + querystring.stringify(query);
pathExt = "?".concat(querystring.stringify(query));
}
return "" + path + pathExt;
return "".concat(path).concat(pathExt);
};

@@ -37,2 +36,2 @@

};
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9VdGlscy5qcyJdLCJuYW1lcyI6WyJxdWVyeXN0cmluZyIsInJlcXVpcmUiLCJleHBvcnRzIiwiY3JlYXRlUGF0aFdpdGhRdWVyeSIsInBhdGgiLCJxdWVyeSIsIkVycm9yIiwicGF0aEV4dCIsIk9iamVjdCIsImtleXMiLCJsZW5ndGgiLCJzdHJpbmdpZnkiLCJzZW5kRXJyb3IiLCJjYWxsYmFjayIsImVyciIsInJldHVybkRhdGEiLCJjbG9uZSIsImEiLCJKU09OIiwicGFyc2UiXSwibWFwcGluZ3MiOiI7Ozs7QUFBQSxJQUFJQSxjQUFjQyxRQUFRLGFBQVIsQ0FBbEI7O0FBRUFDLFFBQVFDLG1CQUFSLEdBQThCLFVBQVNDLElBQVQsRUFBZUMsS0FBZixFQUFzQjtBQUNsRCxNQUFJLENBQUNBLEtBQUwsRUFBWTtBQUNWLFVBQU0sSUFBSUMsS0FBSixDQUFVLGlDQUFWLENBQU47QUFDRDs7QUFFRCxNQUFJQyxVQUFVLEVBQWQ7QUFDQSxNQUFJLE9BQU9GLEtBQVAsS0FBaUIsUUFBckIsRUFBK0I7QUFDN0I7QUFDQUUsb0JBQWNGLEtBQWQ7QUFDRCxHQUhELE1BR08sSUFBSSxRQUFPQS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ict";

});
exports.default = void 0;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _Utils = _interopRequireDefault(require("./Utils"));
var _Utils = require("./Utils");
var _Utils2 = _interopRequireDefault(_Utils);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
class Verify {
static get PATH() {
return "/verify{action}/json";
}
var Verify = function () {
_createClass(Verify, null, [{
key: "PATH",
get: function get() {
return "/verify{action}/json";
}
}, {
key: "ERROR_MESSAGES",
get: function get() {
return {
verifyValidation: "Missing Mandatory fields (number and/or brand)",
checkVerifyValidation: "Missing Mandatory fields (request_id and/or code)",
controlVerifyValidation: "Missing Mandatory fields (request_id and/or cmd-command)",
searchVerifyValidation: "Missing Mandatory fields (request_id or request_ids)"
};
}
/**
* @param {Credentials} credentials
* credentials to be used when interacting with the API.
* @param {Object} options
* Addition Verify options.
*/
static get ERROR_MESSAGES() {
return {
verifyValidation: "Missing Mandatory fields (number and/or brand)",
checkVerifyValidation: "Missing Mandatory fields (request_id and/or code)",
controlVerifyValidation: "Missing Mandatory fields (request_id and/or cmd-command)",
searchVerifyValidation: "Missing Mandatory fields (request_id or request_ids)"
};
}
/**
* @param {Credentials} credentials
* credentials to be used when interacting with the API.
* @param {Object} options
* Addition Verify options.
*/
}]);
function Verify(credentials) {
constructor(credentials) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
_classCallCheck(this, Verify);
this.creds = credentials;
this.options = options;
}
/**

@@ -57,24 +44,36 @@ * TODO: document

_createClass(Verify, [{
key: "request",
value: function request(inputParams, callback) {
if (!inputParams.number || !inputParams.brand) {
_Utils2.default.sendError(callback, new Error(Verify.ERROR_MESSAGES.verifyValidation));
} else {
inputParams["api_key"] = this.creds.apiKey;
inputParams["api_secret"] = this.creds.apiSecret;
this.options.httpClient.request({
host: this.options.apiHost || "api.nexmo.com",
path: _Utils2.default.createPathWithQuery("" + Verify.PATH.replace("{action}", ""), inputParams)
}, callback);
}
request(inputParams, callback) {
if (!inputParams.number || !inputParams.brand) {
_Utils.default.sendError(callback, new Error(Verify.ERROR_MESSAGES.verifyValidation));
} else {
inputParams["api_key"] = this.creds.apiKey;
inputParams["api_secret"] = this.creds.apiSecret;
this.options.httpClient.request({
host: this.options.apiHost || "api.nexmo.com",
path: _Utils.default.createPathWithQuery("".concat(Verify.PATH.replace("{action}", "")), inputParams)
}, callback);
}
}
/**
* TODO: document
*/
/**
* TODO: document
*/
}, {
key: "psd2",
value: function psd2(inputParams, callback) {
psd2(inputParams, callback) {
inputParams["api_key"] = this.creds.apiKey;
inputParams["api_secret"] = this.creds.apiSecret;
this.options.httpClient.request({
host: this.options.apiHost || "api.nexmo.com",
path: _Utils.default.createPathWithQuery("".concat(Verify.PATH.replace("{action}", "/psd2")), inputParams)
}, callback);
}
/**
* TODO: document
*/
check(inputParams, callback) {
if (!inputParams.request_id || !inputParams.code) {
_Utils.default.sendError(callback, new Error(Verify.ERROR_MESSAGES.checkVerifyValidation));
} else {
inputParams["api_key"] = this.creds.apiKey;

@@ -84,79 +83,57 @@ inputParams["api_secret"] = this.creds.apiSecret;

host: this.options.apiHost || "api.nexmo.com",
path: _Utils2.default.createPathWithQuery("" + Verify.PATH.replace("{action}", "/psd2"), inputParams)
path: _Utils.default.createPathWithQuery("".concat(Verify.PATH.replace("{action}", "/check")), inputParams)
}, callback);
}
}
/**
* TODO: document
*/
/**
* TODO: document
*/
}, {
key: "check",
value: function check(inputParams, callback) {
if (!inputParams.request_id || !inputParams.code) {
_Utils2.default.sendError(callback, new Error(Verify.ERROR_MESSAGES.checkVerifyValidation));
} else {
inputParams["api_key"] = this.creds.apiKey;
inputParams["api_secret"] = this.creds.apiSecret;
this.options.httpClient.request({
host: this.options.apiHost || "api.nexmo.com",
path: _Utils2.default.createPathWithQuery("" + Verify.PATH.replace("{action}", "/check"), inputParams)
}, callback);
}
control(inputParams, callback) {
if (!inputParams.request_id || !inputParams.cmd) {
_Utils.default.sendError(callback, new Error(Verify.ERROR_MESSAGES.controlVerifyValidation));
} else {
inputParams["api_key"] = this.creds.apiKey;
inputParams["api_secret"] = this.creds.apiSecret;
this.options.httpClient.request({
host: this.options.apiHost || "api.nexmo.com",
path: _Utils.default.createPathWithQuery("".concat(Verify.PATH.replace("{action}", "/control")), inputParams)
}, callback);
}
}
/**
* TODO: document
*/
/**
* TODO: document
*/
}, {
key: "control",
value: function control(inputParams, callback) {
if (!inputParams.request_id || !inputParams.cmd) {
_Utils2.default.sendError(callback, new Error(Verify.ERROR_MESSAGES.controlVerifyValidation));
} else {
inputParams["api_key"] = this.creds.apiKey;
inputParams["api_secret"] = this.creds.apiSecret;
this.options.httpClient.request({
host: this.options.apiHost || "api.nexmo.com",
path: _Utils2.default.createPathWithQuery("" + Verify.PATH.replace("{action}", "/control"), inputParams)
}, callback);
}
}
search(requestIds, callback) {
var requestIdParam = {};
/**
* TODO: document
*/
}, {
key: "search",
value: function search(requestIds, callback) {
var requestIdParam = {};
if (!requestIds) {
_Utils2.default.sendError(callback, new Error(Verify.ERROR_MESSAGES.searchVerifyValidation));
} else {
if (Array.isArray(requestIds)) {
if (requestIds.length === 1) {
requestIdParam.request_id = requestIds;
} else {
requestIdParam.request_ids = requestIds;
}
if (!requestIds) {
_Utils.default.sendError(callback, new Error(Verify.ERROR_MESSAGES.searchVerifyValidation));
} else {
if (Array.isArray(requestIds)) {
if (requestIds.length === 1) {
requestIdParam.request_id = requestIds;
} else {
requestIdParam.request_id = requestIds;
requestIdParam.request_ids = requestIds;
}
requestIdParam["api_key"] = this.creds.apiKey;
requestIdParam["api_secret"] = this.creds.apiSecret;
this.options.httpClient.request({
host: this.options.apiHost || "api.nexmo.com",
path: _Utils2.default.createPathWithQuery("" + Verify.PATH.replace("{action}", "/search"), requestIdParam)
}, callback);
} else {
requestIdParam.request_id = requestIds;
}
requestIdParam["api_key"] = this.creds.apiKey;
requestIdParam["api_secret"] = this.creds.apiSecret;
this.options.httpClient.request({
host: this.options.apiHost || "api.nexmo.com",
path: _Utils.default.createPathWithQuery("".concat(Verify.PATH.replace("{action}", "/search")), requestIdParam)
}, callback);
}
}]);
}
return Verify;
}();
}
exports.default = Verify;
module.exports = exports["default"];
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9WZXJpZnkuanMiXSwibmFtZXMiOlsiVmVyaWZ5IiwidmVyaWZ5VmFsaWRhdGlvbiIsImNoZWNrVmVyaWZ5VmFsaWRhdGlvbiIsImNvbnRyb2xWZXJpZnlWYWxpZGF0aW9uIiwic2VhcmNoVmVyaWZ5VmFsaWRhdGlvbiIsImNyZWRlbnRpYWxzIiwib3B0aW9ucyIsImNyZWRzIiwiaW5wdXRQYXJhbXMiLCJjYWxsYmFjayIsIm51bWJlciIsImJyYW5kIiwic2VuZEVycm9yIiwiRXJyb3IiLCJFUlJPUl9NRVNTQUdFUyIsImFwaUtleSIsImFwaVNlY3JldCIsImh0dHBDbGllbnQiLCJyZXF1ZXN0IiwiaG9zdCIsImFwaUhvc3QiLCJwYXRoIiwiY3JlYXRlUGF0aFdpdGhRdWVyeSIsIlBBVEgiLCJyZXBsYWNlIiwicmVxdWVzdF9pZCIsImNvZGUiLCJjbWQiLCJyZXF1ZXN0SWRzIiwicmVxdWVzdElkUGFyYW0iLCJBcnJheSIsImlzQXJyYXkiLCJsZW5ndGgiLCJyZXF1ZXN0X2lkcyJdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7Ozs7O0FBRUE7Ozs7Ozs7O0lBRU1BLE07Ozt3Qk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ICApO1xuICAgIH0gZWxzZSB7XG4gICAgICBpZiAoQXJyYXkuaXNBcnJheShyZXF1ZXN0SWRzKSkge1xuICAgICAgICBpZiAocmVxdWVzdElkcy5sZW5ndGggPT09IDEpIHtcbiAgICAgICAgICByZXF1ZXN0SWRQYXJhbS5yZXF1ZXN0X2lkID0gcmVxdWVzdElkcztcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICByZXF1ZXN0SWRQYXJhbS5yZXF1ZXN0X2lkcyA9IHJlcXVlc3RJZHM7XG4gICAgICAgIH1cbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIHJlcXVlc3RJZFBhcmFtLnJlcXVlc3RfaWQgPSByZXF1ZXN0SWRzO1xuICAgICAgfVxuICAgICAgcmVxdWVzdElkUGFyYW1bXCJhcGlfa2V5XCJdID0gdGhpcy5jcmVkcy5hcGlLZXk7XG4gICAgICByZXF1ZXN0SWRQYXJhbVtcImFwaV9zZWNyZXRcIl0gPSB0aGlzLmNyZWRzLmFwaVNlY3JldDtcbiAgICAgIHRoaXMub3B0aW9ucy5odHRwQ2xpZW50LnJlcXVlc3QoXG4gICAgICAgIHtcbiAgICAgICAgICBob3N0OiB0aGlzLm9wdGlvbnMuYXBpSG9zdCB8fCBcImFwaS5uZXhtby5jb21cIixcbiAgICAgICAgICBwYXRoOiBVdGlscy5jcmVhdGVQYXRoV2l0aFF1ZXJ5KFxuICAgICAgICAgICAgYCR7VmVyaWZ5LlBBVEgucmVwbGFjZShcInthY3Rpb259XCIsIFwiL3NlYXJjaFwiKX1gLFxuICAgICAgICAgICAgcmVxdWVzdElkUGFyYW1cbiAgICAgICAgICApXG4gICAgICAgIH0sXG4gICAgICAgIGNhbGxiYWNrXG4gICAgICApO1xuICAgIH1cbiAgfVxufVxuXG5leHBvcnQgZGVmYXVsdCBWZXJpZnk7XG4iXX0=
var _default = Verify;
exports.default = _default;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2Vz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c3Q6IHRoaXMub3B0aW9ucy5hcGlIb3N0IHx8IFwiYXBpLm5leG1vLmNvbVwiLFxuICAgICAgICAgIHBhdGg6IFV0aWxzLmNyZWF0ZVBhdGhXaXRoUXVlcnkoXG4gICAgICAgICAgICBgJHtWZXJpZnkuUEFUSC5yZXBsYWNlKFwie2FjdGlvbn1cIiwgXCIvc2VhcmNoXCIpfWAsXG4gICAgICAgICAgICByZXF1ZXN0SWRQYXJhbVxuICAgICAgICAgIClcbiAgICAgICAgfSxcbiAgICAgICAgY2FsbGJhY2tcbiAgICAgICk7XG4gICAgfVxuICB9XG59XG5cbmV4cG9ydCBkZWZhdWx0IFZlcmlmeTtcbiJdfQ==

@@ -6,41 +6,30 @@ "use strict";

});
exports.default = void 0;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _Utils = _interopRequireDefault(require("./Utils"));
var _Utils = require("./Utils");
var _Utils2 = _interopRequireDefault(_Utils);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
class Voice {
static get ERROR_MESSAGES() {
return {
to: "Invalid to address",
msg: "Invalid Text Message",
maxDigits: "Invalid max digits for TTS prompt",
byeText: "Invalid bye text for TTS prompt",
pinCode: "Invalid pin code for TTS confirm",
failedText: "Invalid failed text for TTS confirm",
answerUrl: "Invalid answer URL for call"
};
}
/**
* @param {Credentials} credentials
* credentials to be used when interacting with the API.
* @param {Object} options
* Addition options.
*/
var Voice = function () {
_createClass(Voice, null, [{
key: "ERROR_MESSAGES",
get: function get() {
return {
to: "Invalid to address",
msg: "Invalid Text Message",
maxDigits: "Invalid max digits for TTS prompt",
byeText: "Invalid bye text for TTS prompt",
pinCode: "Invalid pin code for TTS confirm",
failedText: "Invalid failed text for TTS confirm",
answerUrl: "Invalid answer URL for call"
};
}
/**
* @param {Credentials} credentials
* credentials to be used when interacting with the API.
* @param {Object} options
* Addition options.
*/
}]);
function Voice(credentials) {
constructor(credentials) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
_classCallCheck(this, Voice);
this.creds = credentials;

@@ -50,136 +39,132 @@ this.options = options;

_createClass(Voice, [{
key: "_sendVoiceMessage",
value: function _sendVoiceMessage(endpoint, data, callback) {
if (!data.to) {
_Utils2.default.sendError(callback, new Error(Voice.ERROR_MESSAGES.to));
} else {
data["api_key"] = this.creds.apiKey;
data["api_secret"] = this.creds.apiSecret;
this.options.logger.info("sending TTS message to " + data.to + " with message " + data.text);
this.options.httpClient.request({
host: endpoint.host,
path: _Utils2.default.createPathWithQuery(endpoint.path, data)
}, "POST", function (err, apiResponse) {
if (!err && apiResponse.status && apiResponse.status > 0) {
_Utils2.default.sendError(callback, new Error(apiResponse["error-text"]), apiResponse);
} else {
if (callback) callback(err, apiResponse);
}
});
}
_sendVoiceMessage(endpoint, data, callback) {
if (!data.to) {
_Utils.default.sendError(callback, new Error(Voice.ERROR_MESSAGES.to));
} else {
data["api_key"] = this.creds.apiKey;
data["api_secret"] = this.creds.apiSecret;
this.options.logger.info("sending TTS message to " + data.to + " with message " + data.text);
this.options.httpClient.request({
host: endpoint.host,
path: _Utils.default.createPathWithQuery(endpoint.path, data)
}, "POST", (err, apiResponse) => {
if (!err && apiResponse.status && apiResponse.status > 0) {
_Utils.default.sendError(callback, new Error(apiResponse["error-text"]), apiResponse);
} else {
if (callback) callback(err, apiResponse);
}
});
}
}
/**
* TODO: document
*/
/**
* TODO: document
*/
}, {
key: "sendTTSMessage",
value: function sendTTSMessage(recipient, message, opts, callback) {
if (!message) {
_Utils2.default.sendError(callback, new Error(Voice.ERROR_MESSAGES.msg));
} else {
if (!opts) {
opts = {};
}
opts["to"] = recipient;
opts["text"] = message;
this._sendVoiceMessage({
host: this.options.apiHost || "api.nexmo.com",
path: "/tts/json"
}, opts, callback);
sendTTSMessage(recipient, message, opts, callback) {
if (!message) {
_Utils.default.sendError(callback, new Error(Voice.ERROR_MESSAGES.msg));
} else {
if (!opts) {
opts = {};
}
opts["to"] = recipient;
opts["text"] = message;
this._sendVoiceMessage({
host: this.options.apiHost || "api.nexmo.com",
path: "/tts/json"
}, opts, callback);
}
}
/**
* TODO: remove with next major version, API is 404
*/
/**
* TODO: remove with next major version, API is 404
*/
}, {
key: "sendTTSPromptWithCapture",
value: function sendTTSPromptWithCapture(recipient, message, maxDigits, byeText, opts, callback) {
if (!message) {
_Utils2.default.sendError(callback, new Error(Voice.ERROR_MESSAGES.msg));
} else if (!maxDigits || isNaN(maxDigits) || maxDigits.length > 16) {
_Utils2.default.sendError(callback, new Error(Voice.ERROR_MESSAGES.maxDigits));
} else if (!byeText) {
_Utils2.default.sendError(callback, new Error(Voice.ERROR_MESSAGES.byeText));
} else {
if (!opts) {
opts = {};
}
opts["to"] = recipient;
opts["text"] = message;
opts["max_digits"] = maxDigits;
opts["bye_text"] = byeText;
this._sendVoiceMessage({
host: this.options.apiHost || "api.nexmo.com",
path: "/tts-prompt/json"
}, opts, callback);
sendTTSPromptWithCapture(recipient, message, maxDigits, byeText, opts, callback) {
if (!message) {
_Utils.default.sendError(callback, new Error(Voice.ERROR_MESSAGES.msg));
} else if (!maxDigits || isNaN(maxDigits) || maxDigits.length > 16) {
_Utils.default.sendError(callback, new Error(Voice.ERROR_MESSAGES.maxDigits));
} else if (!byeText) {
_Utils.default.sendError(callback, new Error(Voice.ERROR_MESSAGES.byeText));
} else {
if (!opts) {
opts = {};
}
opts["to"] = recipient;
opts["text"] = message;
opts["max_digits"] = maxDigits;
opts["bye_text"] = byeText;
this._sendVoiceMessage({
host: this.options.apiHost || "api.nexmo.com",
path: "/tts-prompt/json"
}, opts, callback);
}
}
/**
* TODO: remove with next major version, API is 404
*/
/**
* TODO: remove with next major version, API is 404
*/
}, {
key: "sendTTSPromptWithConfirm",
value: function sendTTSPromptWithConfirm(recipient, message, maxDigits, pinCode, byeText, failedText, opts, callback) {
if (!message) {
_Utils2.default.sendError(callback, new Error(Voice.ERROR_MESSAGES.msg));
} else if (!maxDigits || isNaN(maxDigits) || maxDigits.length > 16) {
_Utils2.default.sendError(callback, new Error(Voice.ERROR_MESSAGES.maxDigits));
} else if (!pinCode || pinCode.length !== maxDigits) {
_Utils2.default.sendError(callback, new Error(Voice.ERROR_MESSAGES.pinCode));
} else if (!byeText) {
_Utils2.default.sendError(callback, new Error(Voice.ERROR_MESSAGES.byeText));
} else if (!failedText) {
_Utils2.default.sendError(callback, new Error(Voice.ERROR_MESSAGES.failedText));
} else {
if (!opts) {
opts = {};
}
opts["to"] = recipient;
opts["text"] = message;
opts["max_digits"] = maxDigits;
opts["pin_code"] = pinCode;
opts["bye_text"] = byeText;
opts["failed_text"] = failedText;
this._sendVoiceMessage({
host: this.options.apiHost || "api.nexmo.com",
path: "/tts-prompt/json"
}, opts, callback);
sendTTSPromptWithConfirm(recipient, message, maxDigits, pinCode, byeText, failedText, opts, callback) {
if (!message) {
_Utils.default.sendError(callback, new Error(Voice.ERROR_MESSAGES.msg));
} else if (!maxDigits || isNaN(maxDigits) || maxDigits.length > 16) {
_Utils.default.sendError(callback, new Error(Voice.ERROR_MESSAGES.maxDigits));
} else if (!pinCode || pinCode.length !== maxDigits) {
_Utils.default.sendError(callback, new Error(Voice.ERROR_MESSAGES.pinCode));
} else if (!byeText) {
_Utils.default.sendError(callback, new Error(Voice.ERROR_MESSAGES.byeText));
} else if (!failedText) {
_Utils.default.sendError(callback, new Error(Voice.ERROR_MESSAGES.failedText));
} else {
if (!opts) {
opts = {};
}
opts["to"] = recipient;
opts["text"] = message;
opts["max_digits"] = maxDigits;
opts["pin_code"] = pinCode;
opts["bye_text"] = byeText;
opts["failed_text"] = failedText;
this._sendVoiceMessage({
host: this.options.apiHost || "api.nexmo.com",
path: "/tts-prompt/json"
}, opts, callback);
}
}
/**
* TODO: remove with next major version, API is 404
*/
/**
* TODO: remove with next major version, API is 404
*/
}, {
key: "call",
value: function call(recipient, answerUrl, opts, callback) {
if (!answerUrl) {
_Utils2.default.sendError(callback, new Error(Voice.ERROR_MESSAGES.answerUrl));
} else {
if (!opts) {
opts = {};
}
opts["to"] = recipient;
opts["answer_url"] = answerUrl;
this._sendVoiceMessage({
host: this.options.restHost || "rest.nexmo.com",
path: "/call/json"
}, opts, callback);
call(recipient, answerUrl, opts, callback) {
if (!answerUrl) {
_Utils.default.sendError(callback, new Error(Voice.ERROR_MESSAGES.answerUrl));
} else {
if (!opts) {
opts = {};
}
opts["to"] = recipient;
opts["answer_url"] = answerUrl;
this._sendVoiceMessage({
host: this.options.restHost || "rest.nexmo.com",
path: "/call/json"
}, opts, callback);
}
}]);
}
return Voice;
}();
}
exports.default = Voice;
module.exports = exports["default"];
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9Wb2ljZS5qcyJdLCJuYW1lcyI6WyJWb2ljZSIsInRvIiwibXNnIiwibWF4RGlnaXRzIiwiYnllVGV4dCIsInBpbkNvZGUiLCJmYWlsZWRUZXh0IiwiYW5zd2VyVXJsIiwiY3JlZGVudGlhbHMiLCJvcHRpb25zIiwiY3JlZHMiLCJlbmRwb2ludCIsImRhdGEiLCJjYWxsYmFjayIsInNlbmRFcnJvciIsIkVycm9yIiwiRVJST1JfTUVTU0FHRVMiLCJhcGlLZXkiLCJhcGlTZWNyZXQiLCJsb2dnZXIiLCJpbmZvIiwidGV4dCIsImh0dHBDbGllbnQiLCJyZXF1ZXN0IiwiaG9zdCIsInBhdGgiLCJjcmVhdGVQYXRoV2l0aFF1ZXJ5IiwiZXJyIiwiYXBpUmVzcG9uc2UiLCJzdGF0dXMiLCJy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IixcbiAgICAgICAgICBwYXRoOiBcIi9jYWxsL2pzb25cIlxuICAgICAgICB9LFxuICAgICAgICBvcHRzLFxuICAgICAgICBjYWxsYmFja1xuICAgICAgKTtcbiAgICB9XG4gIH1cbn1cblxuZXhwb3J0IGRlZmF1bHQgVm9pY2U7XG4iXX0=
var _default = Voice;
exports.default = _default;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9Wb2ljZS5qcyJdLCJuYW1lcyI6WyJWb2ljZSIsIkVSUk9SX01FU1NBR0VTIiwidG8iLCJtc2ciLCJtYXhEaWdpdHMiLCJieWVUZXh0IiwicGluQ29kZSIsImZhaWxlZFRleHQiLCJhbnN3ZXJVcmwiLCJjb25zdHJ1Y3RvciIsImNyZWRlbnRpYWxzIiwib3B0aW9ucyIsImNyZWRzIiwiX3NlbmRWb2ljZU1lc3NhZ2UiLCJlbmRwb2ludCIsImRhdGEiLCJjYWxsYmFjayIsIlV0aWxzIiwic2VuZEVycm9yIiwiRXJyb3IiLCJhcGlLZXkiLCJhcGlTZWNyZXQiLCJsb2dnZXIiLCJpbmZvIiwidGV4dCIsImh0dHBDbGllbnQiLCJyZXF1ZXN0IiwiaG9zdCIsInBhdGgiLCJjcmVhdGVQYXRoV2l0aFF1ZXJ5IiwiZXJyIiwiYXBpUmVzcG9uc2UiLCJzdGF0dXMiLCJzZW5kVFRTTWVzc2FnZSIsInJlY2lwaWVudCIsIm1lc3NhZ2UiLCJvcHRzIiwiYXBpSG9zdCIsInNlbmRUVFNQcm9tcHRXaXRoQ2FwdHVyZSIsImlzTmFOIiwibGVuZ3RoIiwic2VuZFRUU1Byb21wdFdpdGhDb25maXJtIiwiY2FsbCIsInJlc3RIb3N0Il0sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7OztBQUVBOzs7O0FBRUEsTUFBTUEsS0FBTixDQUFZO0FBQ1YsYUFBV0MsY0FBWCxHQUE0QjtBQUMxQixX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WNlO1xuIl19
{
"name": "nexmo",
"author": "nexmo",
"version": "2.8.0",
"version": "2.9.0",
"main": "lib/Nexmo",

@@ -37,3 +37,3 @@ "types": "./typings/index.d.ts",

"test-coverage-html": "cross-env NODE_ENV=test nyc --reporter html mocha",
"test-no-lint": "npm run compile && mocha --require ./node_modules/.bin/_mocha --require babel-register ./test/*-test.js",
"test-no-lint": "npm run compile && mocha --require ./node_modules/.bin/_mocha --require @babel/register ./test/*-test.js",
"test-watch": "nodemon --watch src --watch test -x 'npm run test-no-lint'",

@@ -46,8 +46,8 @@ "lint": "eslint src test",

"devDependencies": {
"babel-cli": "^6.26.0",
"babel-plugin-add-module-exports": "^0.2.1",
"@babel/cli": "^7.10.5",
"@babel/core": "^7.10.5",
"@babel/plugin-proposal-object-rest-spread": "^7.10.4",
"@babel/preset-env": "^7.10.4",
"@babel/register": "^7.10.5",
"babel-plugin-istanbul": "^4.1.6",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-es2015": "^6.9.0",
"babel-register": "^6.7.2",
"bluebird": "^3.5.3",

@@ -65,3 +65,3 @@ "body-parser": "^1.18.3",

"ngrok": "^2.2.2",
"nodemon": "^1.18.9",
"nodemon": "^2.0.4",
"nyc": "^14.1.1",

@@ -68,0 +68,0 @@ "prettier": "^1.16.3",

@@ -535,2 +535,5 @@ # Nexmo Client Library for Node.js

nexmo.number.buy(countryCode, msisdn, callback);
// optional target_api_key option
nexmo.number.buy(countryCode, msisdn, target_api_key, callback);
```

@@ -544,2 +547,5 @@

nexmo.number.cancel(countryCode, msisdn, callback);
// optional target_api_key option
nexmo.number.cancel(countryCode, msisdn, target_api_key, callback);
```

@@ -546,0 +552,0 @@

@@ -0,1 +1,13 @@

/*
* TOOD: add prefix for Verify api's typings like Message api on next major update.
* RequestObject -> VerifyRequestObject
* RequestResponse -> VerifyRequestResponse
* RequestResponseStatusCode -> VerifyRequestResponseStatusCode
* ControlObject -> VerifyControlObject
* ControlResponse -> VerifyControlResponse
* ControlResponseStatusCode -> VerifyControlResponseStatusCode
* CheckObject -> VerifyCheckObject
* CheckResponse -> VerifyCheckResponse
*/
declare module 'nexmo' {

@@ -22,2 +34,95 @@ /* general */

/* message API */
export enum MessageRequestResponseStatusCode {
Success = '0',
Throttled = '1',
MissingParameters = '2',
InvalidParameters = '3',
InvalidCredentials = '4',
InternalError = '5',
InvalidMessage = '6',
NumberBarred = '7',
PartnerAccountBarred = '8',
PartnerQuotaViolation = '9',
TooManyExistingBinds = '10',
AccountNotEnabledForHTTP = '11',
MessageTooLong = '12',
InvalidSignature = '14',
InvalidSenderAddress = '15',
InvalidNetworkCode = '22',
InvalidCallbackURL = '23',
NonWhitelistedDestination = '29',
SignatureAndAPISecretDisallowed = '32',
NumberDeActivated = '33',
}
export interface MessageRequestResponseSuccess {
to: string,
'message-id': string,
status: MessageRequestResponseStatusCode,
'remaining-balance': string,
'message-price': string,
'network': string,
'account-ref': string,
}
export interface MessageError {
status: MessageRequestResponseStatusCode;
error_text: string;
}
export interface MessageRequestResponse {
'message-count': number;
messages: (MessageRequestResponseSuccess | MessageError)[];
}
export interface SendSmsOptions {
from: string;
to: string;
text?: string;
sig?: string;
ttl?: number;
'status-report-req'?: boolean;
callback?: string;
'message-class'?: number;
type?: string;
vcard?: string | any;
vcal?: string | any;
body?: string;
udh?: string;
'protocol-id'?: number;
title?: string;
url?: string;
validity?: string;
'client-ref'?: string;
'account-ref'?: string;
}
export type SendSms = (
sender: string,
recipient: string,
message: string,
opts: Partial<SendSmsOptions>,
callback: (err: MessageError, data: MessageRequestResponse) => void
) => void;
export class Message {
constructor(credentials: CredentialsObject, options: { [key: string]: any });
sendSms: SendSms;
/**
* TODO: typing
*/
sendBinaryMessage: any;
sendWapPushMessage: any;
shortcodeAlert: any;
shortcode2FA: any;
shortcodeMarketing: any;
search: any;
searchRejections: any;
__proto__: any;
[key: string]: any;
}
/* verify API */

@@ -104,2 +209,3 @@ export interface VerifyError extends NexmoApiError {

/* Nexmo */

@@ -109,3 +215,4 @@ export default class Nexmo {

public readonly verify: Verify;
public readonly message: Message;
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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