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

@vonage/sms

Package Overview
Dependencies
Maintainers
43
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.13.1 to 1.14.0

22

dist/lib/classes/Error/index.js

@@ -1,4 +0,20 @@

export * from './MessageSendAllFailure';
export * from './MessageSendPartialFailure';
export * from './SMSFailure';
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./MessageSendAllFailure"), exports);
__exportStar(require("./MessageSendPartialFailure"), exports);
__exportStar(require("./SMSFailure"), exports);
//# sourceMappingURL=index.js.map

8

dist/lib/classes/Error/MessageSendAllFailure.js

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

import { SMSFailure } from './SMSFailure';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MessageSendAllFailure = void 0;
const SMSFailure_1 = require("./SMSFailure");
/**

@@ -7,3 +10,3 @@ * Class representing a failure when sending all SMS messages.

*/
export class MessageSendAllFailure extends SMSFailure {
class MessageSendAllFailure extends SMSFailure_1.SMSFailure {
/**

@@ -18,2 +21,3 @@ * Creates an instance of MessageSendAllFailure.

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

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

import { SMSFailure } from './SMSFailure';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MessageSendPartialFailure = void 0;
const SMSFailure_1 = require("./SMSFailure");
/**

@@ -7,3 +10,3 @@ * Class representing a partial failure when sending SMS messages.

*/
export class MessageSendPartialFailure extends SMSFailure {
class MessageSendPartialFailure extends SMSFailure_1.SMSFailure {
/**

@@ -18,2 +21,3 @@ * Creates an instance of MessageSendPartialFailure.

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

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

import { SMSStatus } from '../../enums';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SMSFailure = void 0;
const enums_1 = require("../../enums");
/**

@@ -7,3 +10,3 @@ * Class representing a failure response when sending SMS messages.

*/
export class SMSFailure extends Error {
class SMSFailure extends Error {
/**

@@ -37,3 +40,3 @@ * The response containing details about the SMS messages.

getFailedMessages() {
return this.getMessages().filter(({ status }) => status !== SMSStatus.SUCCESS);
return this.getMessages().filter(({ status }) => status !== enums_1.SMSStatus.SUCCESS);
}

@@ -54,5 +57,6 @@ /**

getSuccessfulMessages() {
return this.getMessages().filter(({ status }) => status === SMSStatus.SUCCESS);
return this.getMessages().filter(({ status }) => status === enums_1.SMSStatus.SUCCESS);
}
}
exports.SMSFailure = SMSFailure;
//# sourceMappingURL=SMSFailure.js.map

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

export * from './Error';
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./Error"), exports);
//# sourceMappingURL=index.js.map

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

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.COLLECTION_FORMATS = void 0;
/**

@@ -6,3 +9,3 @@ * Collection Formats for API Parameter Serialization.

*/
export const COLLECTION_FORMATS = {
exports.COLLECTION_FORMATS = {
/**

@@ -9,0 +12,0 @@ * Comma-separated values collection format.

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

export * from './CollectionFormats';
export * from './MessageClassEnum';
export * from './SMSStatus';
export * from './TypeEnum';
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./CollectionFormats"), exports);
__exportStar(require("./MessageClassEnum"), exports);
__exportStar(require("./SMSStatus"), exports);
__exportStar(require("./TypeEnum"), exports);
//# sourceMappingURL=index.js.map

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

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MessageClassEnum = void 0;
/**

@@ -6,3 +9,3 @@ * Enumeration representing the possible message classes.

*/
export var MessageClassEnum;
var MessageClassEnum;
(function (MessageClassEnum) {

@@ -25,3 +28,3 @@ /**

MessageClassEnum[MessageClassEnum["NUMBER_3"] = 3] = "NUMBER_3";
})(MessageClassEnum || (MessageClassEnum = {}));
})(MessageClassEnum || (exports.MessageClassEnum = MessageClassEnum = {}));
//# sourceMappingURL=MessageClassEnum.js.map

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

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SMSErrors = void 0;
/**

@@ -9,3 +12,3 @@ * Enumeration representing possible SMS status codes.

*/
export var SMSErrors;
var SMSErrors;
(function (SMSErrors) {

@@ -94,3 +97,3 @@ /**

SMSErrors["NUMBER_DEACTIVATED"] = "33";
})(SMSErrors || (SMSErrors = {}));
})(SMSErrors || (exports.SMSErrors = SMSErrors = {}));
//# sourceMappingURL=SMSErrors.js.map

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

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SMSStatus = void 0;
/**

@@ -9,3 +12,3 @@ * Enumeration representing possible SMS status codes.

*/
export var SMSStatus;
var SMSStatus;
(function (SMSStatus) {

@@ -94,3 +97,3 @@ /**

SMSStatus["NUMBER_DEACTIVATED"] = "33";
})(SMSStatus || (SMSStatus = {}));
})(SMSStatus || (exports.SMSStatus = SMSStatus = {}));
//# sourceMappingURL=SMSStatus.js.map

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

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TypeEnum = void 0;
/**

@@ -6,3 +9,3 @@ * Enumeration representing possible message types for SMS.

*/
export var TypeEnum;
var TypeEnum;
(function (TypeEnum) {

@@ -21,3 +24,3 @@ /**

TypeEnum["UNICODE"] = "unicode";
})(TypeEnum || (TypeEnum = {}));
})(TypeEnum || (exports.TypeEnum = TypeEnum = {}));
//# sourceMappingURL=TypeEnum.js.map

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

export * from './classes';
export * from './enums';
export * from './sms';
export * from './types';
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./classes"), exports);
__exportStar(require("./enums"), exports);
__exportStar(require("./sms"), exports);
__exportStar(require("./types"), exports);
//# sourceMappingURL=index.js.map

@@ -1,6 +0,12 @@

import { Client, AuthenticationType } from '@vonage/server-client';
import { MessageSendAllFailure, MessageSendPartialFailure } from './classes';
import { SMSStatus } from './enums';
import crypto from 'crypto';
import { AlgorithmTypes } from '@vonage/auth';
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SMS = void 0;
const server_client_1 = require("@vonage/server-client");
const classes_1 = require("./classes");
const enums_1 = require("./enums");
const crypto_1 = __importDefault(require("crypto"));
const auth_1 = require("@vonage/auth");
/**

@@ -45,4 +51,4 @@ * Client for sending legacy SMS messages using the Vonage API.

*/
export class SMS extends Client {
authType = AuthenticationType.KEY_SECRET;
class SMS extends server_client_1.Client {
authType = server_client_1.AuthenticationType.KEY_SECRET;
/**

@@ -67,7 +73,7 @@ * Sends an SMS message using the legacy Vonage SMS API.

async send(params) {
const resp = await this.sendPostRequest(`${this.config.restHost}/sms/json`, Client.transformers.kebabCaseObjectKeys(params || {}));
const messageData = Client.transformers.camelCaseObjectKeys(resp.data, true, true);
const resp = await this.sendPostRequest(`${this.config.restHost}/sms/json`, server_client_1.Client.transformers.kebabCaseObjectKeys(params || {}));
const messageData = server_client_1.Client.transformers.camelCaseObjectKeys(resp.data, true, true);
const totalMessages = messageData.messageCount || 0;
const messages = messageData.messages || [];
const failures = messages.reduce((failures, { status }) => status !== SMSStatus.SUCCESS ? failures + 1 : failures, 0);
const failures = messages.reduce((failures, { status }) => status !== enums_1.SMSStatus.SUCCESS ? failures + 1 : failures, 0);
if (failures < 1) {

@@ -77,5 +83,5 @@ return messageData;

if (failures === totalMessages) {
throw new MessageSendAllFailure(messageData);
throw new classes_1.MessageSendAllFailure(messageData);
}
throw new MessageSendPartialFailure(messageData);
throw new classes_1.MessageSendPartialFailure(messageData);
}

@@ -126,17 +132,17 @@ /**

const hashMap = {};
hashMap[AlgorithmTypes.md5hmac] = 'md5';
hashMap[AlgorithmTypes.sha1hmac] = 'sha1';
hashMap[AlgorithmTypes.sha256hmac] = 'sha256';
hashMap[AlgorithmTypes.sha512hmac] = 'sha512';
hashMap[auth_1.AlgorithmTypes.md5hmac] = 'md5';
hashMap[auth_1.AlgorithmTypes.sha1hmac] = 'sha1';
hashMap[auth_1.AlgorithmTypes.sha256hmac] = 'sha256';
hashMap[auth_1.AlgorithmTypes.sha512hmac] = 'sha512';
let hash = '';
switch (algorithm) {
case AlgorithmTypes.md5hash:
case auth_1.AlgorithmTypes.md5hash:
signedQuery += signatureSecret;
hash = crypto.createHash('md5').update(signedQuery).digest('hex');
hash = crypto_1.default.createHash('md5').update(signedQuery).digest('hex');
break;
case AlgorithmTypes.md5hmac:
case AlgorithmTypes.sha1hmac:
case AlgorithmTypes.sha256hmac:
case AlgorithmTypes.sha512hmac:
hash = crypto
case auth_1.AlgorithmTypes.md5hmac:
case auth_1.AlgorithmTypes.sha1hmac:
case auth_1.AlgorithmTypes.sha256hmac:
case auth_1.AlgorithmTypes.sha512hmac:
hash = crypto_1.default
.createHmac(hashMap[algorithm], signatureSecret)

@@ -152,2 +158,3 @@ .update(signedQuery)

}
exports.SMS = SMS;
//# sourceMappingURL=sms.js.map

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

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=ErrorMessage.js.map

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

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=InboundMessage.js.map

@@ -1,8 +0,24 @@

export * from './SMSParams';
export * from './ErrorMessage';
export * from './InboundMessage';
export * from './Message';
export * from './Responses';
export * from './Requests';
export * from './SMSMessages';
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./SMSParams"), exports);
__exportStar(require("./ErrorMessage"), exports);
__exportStar(require("./InboundMessage"), exports);
__exportStar(require("./Message"), exports);
__exportStar(require("./Responses"), exports);
__exportStar(require("./Requests"), exports);
__exportStar(require("./SMSMessages"), exports);
//# sourceMappingURL=index.js.map

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

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=Message.js.map

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

export * from './SMSRequestBody';
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./SMSRequestBody"), exports);
//# sourceMappingURL=index.js.map

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

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=SMSRequestBody.js.map

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

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=DeliveryReceipt.js.map

@@ -1,7 +0,23 @@

export * from './DeliveryReceipt';
export * from './SMSEmptyResponse';
export * from './SMSGeneralResponse';
export * from './SMSMessageResponse';
export * from './SMSResponse';
export * from './SendSMSResponse';
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./DeliveryReceipt"), exports);
__exportStar(require("./SMSEmptyResponse"), exports);
__exportStar(require("./SMSGeneralResponse"), exports);
__exportStar(require("./SMSMessageResponse"), exports);
__exportStar(require("./SMSResponse"), exports);
__exportStar(require("./SendSMSResponse"), exports);
//# sourceMappingURL=index.js.map

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

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=SendSMSResponse.js.map

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

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=SMSEmptyResponse.js.map

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

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=SMSErrorMessageResponse.js.map

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

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=SMSGeneralResponse.js.map

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

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=SMSMessageResponse.js.map

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

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=SMSResponse.js.map

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

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=SMSMessages.js.map

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

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=SMSParams.js.map
{
"$schema": "https://json.schemastore.org/package.json",
"name": "@vonage/sms",
"version": "1.13.1",
"version": "1.14.0",
"description": "Vonage SMS API SDK package",

@@ -29,3 +29,2 @@ "homepage": "https://github.com/vonage/vonage-node-sdk/tree/master/packages/sms#readme",

],
"type": "module",
"main": "dist/lib/index.js",

@@ -47,4 +46,4 @@ "types": "dist/lib/index.d.ts",

"dependencies": {
"@vonage/auth": "^1.10.1",
"@vonage/server-client": "^1.12.1"
"@vonage/auth": "^1.11.0",
"@vonage/server-client": "^1.13.0"
},

@@ -51,0 +50,0 @@ "publishConfig": {

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

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

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

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