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.7 to 1.0.8

dist/classes/Error/MessageSendAllFailure.js.map

7

dist/classes/Error/MessageSendAllFailure.js

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

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

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

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

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

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

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

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

@@ -1,7 +0,4 @@

"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; } });
import { SMS } from './sms';
export { COLLECTION_FORMATS, } from './types';
export { SMS };
//# sourceMappingURL=index.js.map

@@ -1,61 +0,47 @@

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SMS = void 0;
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 __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);
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'];
}
for (let i = 0; i < messageCount; i++) {
if (messageData.messages[i].status !== '0') {
failures++;
}
if (element['remaining-balance']) {
message.remainingBalance = element['remaining-balance'];
}
if (failures === messageCount) {
throw new MessageSendAllFailure_1.MessageSendAllFailure('All SMS messages failed to send', messageData);
if (element['message-price']) {
message.messagePrice = element['message-price'];
}
if (failures > 0) {
throw new MessageSendPartialFailure_1.MessageSendPartialFailure('Some SMS messages failed to send', messageData);
if (element['client-ref']) {
message.clientRef = element['client-ref'];
}
return 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;
}
}
exports.SMS = SMS;
//# sourceMappingURL=sms.js.map

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

/// <reference types="node" />
import { AuthOpts, AuthInterface } from '@vonage/auth';
import { VetchResponse, VetchOptions } from '@vonage/vetch';
export declare type SMSClassParameters = AuthOpts & VetchOptions & {
export type SMSClassParameters = AuthOpts & VetchOptions & {
auth?: AuthInterface;

@@ -17,5 +18,2 @@ };

export interface SendSMSResponse {
/**
* @deprecated Use messageCount instead
*/
'message-count': string;

@@ -75,27 +73,12 @@ messageCount: number;

messageId?: string;
/**
* @deprecated Use messageId instead
*/
'message-id'?: string;
status?: string;
remainingBalance?: string;
/**
* @deprecated Use remainingBalance instead
*/
'remaining-balance'?: string;
messagePrice?: string;
/**
* @deprecated Use messagePrice
*/
'message-price'?: string;
network?: string;
clientRef?: string;
/**
* @deprecated Use clientRef instead
*/
'client-ref'?: string;
accountRef?: string;
/**
* @deprecated Use accountRef instead
*/
'account-ref'?: string;

@@ -102,0 +85,0 @@ }

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

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

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

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

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

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

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

TypeEnum["Vcard"] = "vcard";
})(TypeEnum = exports.TypeEnum || (exports.TypeEnum = {}));
})(TypeEnum || (TypeEnum = {}));
//# sourceMappingURL=types.js.map
{
"name": "@vonage/sms",
"version": "1.0.7",
"description": "> TODO: description",
"version": "1.0.8",
"description": "Vonage SMS API SDK package",
"homepage": "https://github.com/vonage/vonage-node-sdk/tree/master/packages/sms#readme",

@@ -26,23 +26,12 @@ "bugs": {

"build": "npm run clean && npm run compile",
"clean": "tsc -b --clean",
"compile": "tsc -p tsconfig.json",
"format": "prettier --write \"lib/**/*.ts\" \"__tests__/**/*.ts\"",
"lint": "tslint -p tsconfig.json",
"prepublishOnly": "npm run build && npm run test && npm run lint",
"test": "npx jest",
"test-watch": "npx jest --watch",
"preversion": "npm run lint",
"version": "npm run format && git add -A lib"
"clean": "npx shx rm -rf dist tsconfig.tsbuildinfo",
"compile": "npx tsc --build --verbose"
},
"dependencies": {
"@vonage/server-client": "^1.0.6"
"@vonage/auth": "^1.0.4",
"@vonage/server-client": "^1.0.7",
"@vonage/vetch": "^1.0.5"
},
"devDependencies": {
"@types/jest": "^28.1.6",
"nock": "^13.2.9",
"prettier": "^2.7.1",
"ts-jest": "^28.0.7",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0",
"typescript": "^4.7.4"
"nock": "^13.2.9"
},

@@ -52,3 +41,3 @@ "publishConfig": {

},
"gitHead": "b5818afa99349dec888eb9c7bc7c3ced3c10bece"
"gitHead": "328f18e5c8a458cb4d06d7955ec2399a6ce6f5d8"
}
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