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

@vonage/sms

Package Overview
Dependencies
Maintainers
37
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vonage/sms - npm Package Compare versions

Comparing version 1.0.8 to 1.0.9

6

dist/classes/Error/MessageSendAllFailure.js

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

export class MessageSendAllFailure extends Error {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MessageSendAllFailure = void 0;
class MessageSendAllFailure extends Error {
constructor(message, response) {

@@ -11,2 +14,3 @@ super(message);

}
exports.MessageSendAllFailure = MessageSendAllFailure;
//# sourceMappingURL=MessageSendAllFailure.js.map

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

export class MessageSendPartialFailure extends Error {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MessageSendPartialFailure = void 0;
class MessageSendPartialFailure extends Error {
constructor(message, response) {

@@ -29,2 +32,3 @@ super(message);

}
exports.MessageSendPartialFailure = MessageSendPartialFailure;
//# sourceMappingURL=MessageSendPartialFailure.js.map

10

dist/index.js

@@ -1,4 +0,8 @@

import { SMS } from './sms';
export { COLLECTION_FORMATS, } from './types';
export { SMS };
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SMS = exports.COLLECTION_FORMATS = void 0;
const sms_1 = require("./sms");
Object.defineProperty(exports, "SMS", { enumerable: true, get: function () { return sms_1.SMS; } });
var types_1 = require("./types");
Object.defineProperty(exports, "COLLECTION_FORMATS", { enumerable: true, get: function () { return types_1.COLLECTION_FORMATS; } });
//# sourceMappingURL=index.js.map

@@ -1,47 +0,54 @@

import { Client } from '@vonage/server-client';
import { MessageSendAllFailure } from './classes/Error/MessageSendAllFailure';
import { MessageSendPartialFailure } from './classes/Error/MessageSendPartialFailure';
export class SMS extends Client {
async send(params) {
const resp = await this.sendPostRequest(`${this.config.restHost}/sms/json`, params);
let failures = 0;
const messageCount = parseInt(resp.data['message-count'], 10);
const messageData = {
messageCount,
'message-count': resp.data['message-count'],
messages: [],
};
for (const element of resp.data.messages) {
const message = element;
if (element['message-id']) {
message.messageId = element['message-id'];
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SMS = void 0;
const tslib_1 = require("tslib");
const server_client_1 = require("@vonage/server-client");
const MessageSendAllFailure_1 = require("./classes/Error/MessageSendAllFailure");
const MessageSendPartialFailure_1 = require("./classes/Error/MessageSendPartialFailure");
class SMS extends server_client_1.Client {
send(params) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const resp = yield this.sendPostRequest(`${this.config.restHost}/sms/json`, params);
let failures = 0;
const messageCount = parseInt(resp.data['message-count'], 10);
const messageData = {
messageCount,
'message-count': resp.data['message-count'],
messages: [],
};
for (const element of resp.data.messages) {
const message = element;
if (element['message-id']) {
message.messageId = element['message-id'];
}
if (element['remaining-balance']) {
message.remainingBalance = element['remaining-balance'];
}
if (element['message-price']) {
message.messagePrice = element['message-price'];
}
if (element['client-ref']) {
message.clientRef = element['client-ref'];
}
if (element['account-ref']) {
message.accountRef = element['account-ref'];
}
messageData.messages.push(message);
}
if (element['remaining-balance']) {
message.remainingBalance = element['remaining-balance'];
for (let i = 0; i < messageCount; i++) {
if (messageData.messages[i].status !== '0') {
failures++;
}
}
if (element['message-price']) {
message.messagePrice = element['message-price'];
if (failures === messageCount) {
throw new MessageSendAllFailure_1.MessageSendAllFailure('All SMS messages failed to send', messageData);
}
if (element['client-ref']) {
message.clientRef = element['client-ref'];
if (failures > 0) {
throw new MessageSendPartialFailure_1.MessageSendPartialFailure('Some SMS messages failed to send', messageData);
}
if (element['account-ref']) {
message.accountRef = element['account-ref'];
}
messageData.messages.push(message);
}
for (let i = 0; i < messageCount; i++) {
if (messageData.messages[i].status !== '0') {
failures++;
}
}
if (failures === messageCount) {
throw new MessageSendAllFailure('All SMS messages failed to send', messageData);
}
if (failures > 0) {
throw new MessageSendPartialFailure('Some SMS messages failed to send', messageData);
}
return messageData;
return messageData;
});
}
}
exports.SMS = SMS;
//# sourceMappingURL=sms.js.map

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

export const COLLECTION_FORMATS = {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TypeEnum = exports.MessageClassEnum = exports.COLLECTION_FORMATS = void 0;
exports.COLLECTION_FORMATS = {
csv: ',',

@@ -7,3 +10,3 @@ ssv: ' ',

};
export var MessageClassEnum;
var MessageClassEnum;
(function (MessageClassEnum) {

@@ -14,4 +17,4 @@ MessageClassEnum[MessageClassEnum["NUMBER_0"] = 0] = "NUMBER_0";

MessageClassEnum[MessageClassEnum["NUMBER_3"] = 3] = "NUMBER_3";
})(MessageClassEnum || (MessageClassEnum = {}));
export var TypeEnum;
})(MessageClassEnum = exports.MessageClassEnum || (exports.MessageClassEnum = {}));
var TypeEnum;
(function (TypeEnum) {

@@ -24,3 +27,3 @@ TypeEnum["Text"] = "text";

TypeEnum["Vcard"] = "vcard";
})(TypeEnum || (TypeEnum = {}));
})(TypeEnum = exports.TypeEnum || (exports.TypeEnum = {}));
//# sourceMappingURL=types.js.map
{
"name": "@vonage/sms",
"version": "1.0.8",
"version": "1.0.9",
"description": "Vonage SMS API SDK package",

@@ -30,5 +30,6 @@ "homepage": "https://github.com/vonage/vonage-node-sdk/tree/master/packages/sms#readme",

"dependencies": {
"@vonage/auth": "^1.0.4",
"@vonage/server-client": "^1.0.7",
"@vonage/vetch": "^1.0.5"
"@vonage/auth": "^1.0.5",
"@vonage/server-client": "^1.0.8",
"@vonage/vetch": "^1.0.6",
"tslib": "^2.4.1"
},

@@ -35,0 +36,0 @@ "devDependencies": {

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 not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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