Socket
Socket
Sign inDemoInstall

@vonage/number-insights

Package Overview
Dependencies
Maintainers
37
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vonage/number-insights - npm Package Compare versions

Comparing version 1.0.6 to 1.0.7

dist/enums/CallerType.js.map

8

dist/enums/CallerType.js

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

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CallerType = void 0;
var CallerType;
export var CallerType;
(function (CallerType) {

@@ -9,2 +6,3 @@ CallerType["UNKNOWN"] = "unknown";

CallerType["CONSUMER"] = "consumer,";
})(CallerType = exports.CallerType || (exports.CallerType = {}));
})(CallerType || (CallerType = {}));
//# sourceMappingURL=CallerType.js.map

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

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LookupOutcome = void 0;
var LookupOutcome;
export var LookupOutcome;
(function (LookupOutcome) {

@@ -9,2 +6,3 @@ LookupOutcome[LookupOutcome["SUCCESS"] = 0] = "SUCCESS";

LookupOutcome[LookupOutcome["FAILED"] = 2] = "FAILED";
})(LookupOutcome = exports.LookupOutcome || (exports.LookupOutcome = {}));
})(LookupOutcome || (LookupOutcome = {}));
//# sourceMappingURL=LookupOutcome.js.map

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

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NetworkType = void 0;
var NetworkType;
export var NetworkType;
(function (NetworkType) {

@@ -13,2 +10,3 @@ NetworkType["MOBILE"] = "mobile";

NetworkType["PAGER"] = "pager";
})(NetworkType = exports.NetworkType || (exports.NetworkType = {}));
})(NetworkType || (NetworkType = {}));
//# sourceMappingURL=NetworkType.js.map

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

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Reachable = void 0;
var Reachable;
export var Reachable;
(function (Reachable) {

@@ -12,2 +9,3 @@ Reachable["UNKNOWN"] = "unknown";

Reachable["BLACKLISTED"] = "blacklisted";
})(Reachable = exports.Reachable || (exports.Reachable = {}));
})(Reachable || (Reachable = {}));
//# sourceMappingURL=Reachable.js.map

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

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ValidNumber = void 0;
var ValidNumber;
export var ValidNumber;
(function (ValidNumber) {

@@ -11,2 +8,3 @@ ValidNumber["UNKNOWN"] = "unknown";

ValidNumber["INFERRED_NOT_VALID"] = "inferred_not_valid";
})(ValidNumber = exports.ValidNumber || (exports.ValidNumber = {}));
})(ValidNumber || (ValidNumber = {}));
//# sourceMappingURL=ValidNumber.js.map

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

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NumberInsights = void 0;
var number_insights_1 = require("./number-insights");
Object.defineProperty(exports, "NumberInsights", { enumerable: true, get: function () { return number_insights_1.NumberInsights; } });
export { NumberInsights } from './number-insights';
//# sourceMappingURL=index.js.map

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@@ -1,44 +0,24 @@

"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.NumberInsights = void 0;
const server_client_1 = require("@vonage/server-client");
class NumberInsights extends server_client_1.Client {
advancedLookup(phoneNumber, options) {
return __awaiter(this, void 0, void 0, function* () {
const params = Object.assign({ number: phoneNumber }, options);
const resp = yield this.sendGetRequest(`${this.config.apiHost}/ni/advanced/json`, params);
return resp.data;
});
import { Client } from '@vonage/server-client';
export class NumberInsights extends Client {
async advancedLookup(phoneNumber, options) {
const params = { number: phoneNumber, ...options };
const resp = await this.sendGetRequest(`${this.config.apiHost}/ni/advanced/json`, params);
return resp.data;
}
asyncAdvancedLookup(phoneNumber, callback, options) {
return __awaiter(this, void 0, void 0, function* () {
const params = Object.assign({ number: phoneNumber, callback }, options);
const resp = yield this.sendGetRequest(`${this.config.apiHost}/ni/advanced/async/json`, params);
return resp.data;
});
async asyncAdvancedLookup(phoneNumber, callback, options) {
const params = { number: phoneNumber, callback, ...options };
const resp = await this.sendGetRequest(`${this.config.apiHost}/ni/advanced/async/json`, params);
return resp.data;
}
basicLookup(phoneNumber, options) {
return __awaiter(this, void 0, void 0, function* () {
const params = Object.assign({ number: phoneNumber }, options);
const resp = yield this.sendGetRequest(`${this.config.apiHost}/ni/basic/json`, params);
return resp.data;
});
async basicLookup(phoneNumber, options) {
const params = { number: phoneNumber, ...options };
const resp = await this.sendGetRequest(`${this.config.apiHost}/ni/basic/json`, params);
return resp.data;
}
standardLookup(phoneNumber, options) {
return __awaiter(this, void 0, void 0, function* () {
const params = Object.assign({ number: phoneNumber }, options);
const resp = yield this.sendGetRequest(`${this.config.apiHost}/ni/standard/json`, params);
return resp.data;
});
async standardLookup(phoneNumber, options) {
const params = { number: phoneNumber, ...options };
const resp = await this.sendGetRequest(`${this.config.apiHost}/ni/standard/json`, params);
return resp.data;
}
}
exports.NumberInsights = NumberInsights;
//# sourceMappingURL=number-insights.js.map
import { AuthInterface, AuthOpts } from '@vonage/auth';
import { VetchOptions } from '@vonage/vetch';
export declare type NumberInsightsClassParameters = AuthOpts & VetchOptions & {
export type NumberInsightsClassParameters = AuthOpts & VetchOptions & {
auth?: AuthInterface;
};

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

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
export {};
//# sourceMappingURL=NumberInsightsClassParameters.js.map
{
"name": "@vonage/number-insights",
"version": "1.0.6",
"version": "1.0.7",
"description": "Vonage Number Insights API",

@@ -26,18 +26,17 @@ "homepage": "https://developer.vonage.com",

"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": {
"nock": "^13.2.9"
},
"publishConfig": {
"directory": "dist"
}
},
"gitHead": "328f18e5c8a458cb4d06d7955ec2399a6ce6f5d8"
}
# Vonage Number Insights SDK for Node.js
![GitHub Workflow Status (branch)](https://img.shields.io/github/workflow/status/vonage/vonage-node-sdk/Vonage/3.x?logo=github&style=flat-square&label=Workflow%20Build) [![Codecov](https://img.shields.io/codecov/c/github/vonage/vonage-node-sdk?label=Codecov&logo=codecov&style=flat-square)](https://codecov.io/gh/Vonage/vonage-server-sdk) ![Latest Release](https://img.shields.io/github/v/release/vonage/vonage-node-sdk?logo=npm&style=flat-square)
![GitHub Workflow Status (branch)](https://img.shields.io/github/workflow/status/vonage/vonage-node-sdk/Vonage/3.x?logo=github&style=flat-square&label=Workflow%20Build)
[![Codecov](https://img.shields.io/codecov/c/github/vonage/vonage-node-sdk?label=Codecov&logo=codecov&style=flat-square)](https://codecov.io/gh/Vonage/vonage-server-sdk)
![Latest Release](https://img.shields.io/npm/v/@vonage/number-insights)
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg?style=flat-square)](../../CODE_OF_CONDUCT.md)
[![License](https://img.shields.io/npm/l/@vonage/number-insights?label=License&style=flat-square)][license]
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg?style=flat-square)](../../CODE_OF_CONDUCT.md) [![License](https://img.shields.io/npm/l/@vonage/server-sdk?label=License&style=flat-square)][../../LICENSE.TXT]
<img src="https://developer.nexmo.com/images/logos/vbc-logo.svg" height="48px" alt="Vonage" />
This is the Vonage Number Insights SDK for Node.js for use with [Vonage APIs](https://www.vonage.com/). To use it you will need a Vonage account. Sign up [for free at vonage.com][signup].
This is the Vonage Number Insights SDK for Node.js for use with
[Vonage APIs](https://www.vonage.com/). To use it you will need a Vonage
account. Sign up [for free at vonage.com][signup].
We recommend using this package as part of the overall [`@vonage/server-sdk` package](https://github.com/vonage/vonage-node-sdk).
We recommend using this package as part of the overall [
`@vonage/server-sdk` package](https://github.com/vonage/vonage-node-sdk).

@@ -16,13 +21,15 @@ For full API documentation refer to [developer.nexmo.com](https://developer.nexmo.com/).

* [Installation](#installation)
* [Constructor](#constructor)
* [Callbacks](#callbacks)
* [Usage](#using-the-vonage-number-insights-sdk)
* [Promises](#promises)
* [Testing](#testing)
* [Examples](#examples)
* [Supported APIs](#supported-apis)
## Installation
We recommend using this SDK as part of the overall [`@vonage/server-sdk` package](https://github.com/vonage/vonage-node-sdk). Please see the main package for installation.
We recommend using this SDK as part of the overall [
`@vonage/server-sdk` package](https://github.com/vonage/vonage-node-sdk).
Please see the main package for installation.
You can also use this SDK standalone if you only need access to just the Messages API.
You can also use this SDK standalone if you only need access to just the
Messages API.
### With NPM

@@ -44,11 +51,15 @@

If you are using this SDK as part of the Vonage Server SDK, you can access it as the `messages` property off of the client that you instantiate.
If you are using this SDK as part of the Vonage Server SDK, you can access it
as the `messages` property off of the client that you instantiate.
```js
const { Auth } = require('@vonage/auth);
const { Vonage } = require('@vonage/server-sdk');
const vonage = new Vonage({
const credentials = new Auth({
apiKey: API_KEY,
apiSecret: API_SECRET
}, options);
});
const options = {};
const vonage = new Vonage(credentials, options);

@@ -62,3 +73,7 @@ vonage.numberInsights.basicLookup(PHONE_NUMBER)

The SDK can be used standalone from the main [Vonage Server SDK for Node.js](https://github.com/vonage/vonage-node-sdk) if you only need to use the Messages API. All you need to do is `require('@vonage/messages')`, and use the returned object to create your own client.
The SDK can be used standalone from the main [
Vonage Server SDK for Node.js](https://github.com/vonage/vonage-node-sdk) if
you only need to use the Messages API. All you need to do is
`require('@vonage/messages')`, and use the returned object to create your own
client.

@@ -69,38 +84,18 @@ ```js

const niClient = new NumberInsights(new Auth({
const credentials = new Auth({
apiKey: API_KEY,
apiSecret: API_SECRET,
}), options);
apiSecret: API_SECRET
});
const options = {};
const niClient = new NumberInsights(credentials, options);
```
* `apiKey` - API Key from Vonage API. If `applicationId` and `privateKey` are present, `apiKey` is optional.
* `apiSecret` - API Secret from Vonage API. If `applicationId` and `privateKey` are present, `apiSecret` is optional.
* `options` is an object that can contain:
Where `credentials` is any option from [`@vonage/auth`](https://github.com/Vonage/vonage-node-sdk/tree/3.x/readme/packages/auth#options),
and `options` is any option from [`@vonage/server-client`](https://github.com/Vonage/vonage-node-sdk/tree/3.x/readme/packages/server-client#options)
```js
{
// If true, log information to the console
debug: true|false,
// append info the the User-Agent sent to Nexmo
// e.g. pass 'my-app' for /nexmo-node/1.0.0/4.2.7/my-app
appendToUserAgent: string,
// Set a custom logger
logger: {
log: function() {level, args...}
info: function() {args...},
warn: function() {args...}
},
// Set a custom timeout for requests to Nexmo in milliseconds. Defaults to the standard for Node http requests, which is 120,000 ms.
timeout: integer,
// Set a custom host for requests instead of api.nexmo.com
apiHost: string,
// Set a custom host for requests instead of rest.nexmo.com
restHost: string
}
```
## Promises
Most methods that interact with the Vonage API uses Promises. You can either resolve these yourself, or use `await` to
wait for a response.
Most methods that interact with the Vonage API uses Promises. You can either
resolve these yourself, or use `await` to wait for a response.

@@ -107,0 +102,0 @@ ```js

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