Socket
Socket
Sign inDemoInstall

@vonage/cli-plugin-numbers

Package Overview
Dependencies
Maintainers
19
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vonage/cli-plugin-numbers - npm Package Compare versions

Comparing version 1.0.0-beta.11 to 1.0.0-rc.0

dist/types.d.ts

1

dist/commands/numbers/buy.d.ts

@@ -9,2 +9,3 @@ import NumberCommand from '../../number_base';

run(): Promise<void>;
catch(error: any): Promise<void>;
}

@@ -21,5 +21,13 @@ "use strict";

let resp = yield this.numberBuy(args);
this.log(resp);
this.log(`Number ${args.number} has been purchased.`);
});
}
catch(error) {
const _super = Object.create(null, {
catch: { get: () => super.catch }
});
return __awaiter(this, void 0, void 0, function* () {
return _super.catch.call(this, error);
});
}
}

@@ -26,0 +34,0 @@ exports.default = NumberBuy;

@@ -9,2 +9,3 @@ import NumberCommand from '../../number_base';

run(): Promise<void>;
catch(error: any): Promise<void>;
}

@@ -22,5 +22,13 @@ "use strict";

let resp = yield this.numberCancel(args);
this.log(resp);
this.log(`Number ${args.number} has been cancelled.`);
});
}
catch(error) {
const _super = Object.create(null, {
catch: { get: () => super.catch }
});
return __awaiter(this, void 0, void 0, function* () {
return _super.catch.call(this, error);
});
}
}

@@ -27,0 +35,0 @@ exports.default = NumberCancel;

@@ -9,2 +9,3 @@ import NumberCommand from '../../number_base';

run(): Promise<void>;
catch(error: any): Promise<void>;
}

47

dist/commands/numbers/index.js

@@ -21,20 +21,33 @@ "use strict";

const flags = this.parsedFlags;
let numberData = yield this.allNumbers;
cli_ux_1.default.table(numberData.numbers, {
country: {},
msisdn: {
header: "Number"
},
type: {},
features: {
get: (row) => row.features.join(',')
},
app_id: {
header: "Application",
get: (row) => row.app_id || ""
}
}, Object.assign({}, flags));
let numberData = yield this.getAllNumbers({});
try {
cli_ux_1.default.table(numberData.numbers, {
country: {},
msisdn: {
header: "Number"
},
type: {},
features: {
get: (row) => row.features.join(',')
},
app_id: {
header: "Application",
get: (row) => row.app_id || ""
}
}, Object.assign({}, flags));
}
catch (error) {
this.error('No results found.');
}
this.exit();
});
}
catch(error) {
const _super = Object.create(null, {
catch: { get: () => super.catch }
});
return __awaiter(this, void 0, void 0, function* () {
return _super.catch.call(this, error);
});
}
}

@@ -44,5 +57,3 @@ exports.default = NumberList;

NumberList.examples = [
`$ vonage number
list all numbers
`,
`vonage number`,
];

@@ -49,0 +60,0 @@ NumberList.flags = Object.assign(Object.assign({}, number_base_1.default.flags), cli_ux_1.default.table.flags({

@@ -12,7 +12,8 @@ import NumberCommand from '../../number_base';

static description: string;
static examples: any[];
static examples: string[];
static flags: OutputFlags<typeof NumberCommand.flags> & searchFlags;
static args: OutputArgs<typeof NumberCommand.args>;
run(): Promise<void>;
catch(error: any): Promise<void>;
}
export {};

@@ -18,21 +18,2 @@ "use strict";

const cli_ux_1 = __importDefault(require("cli-ux"));
function parseFlags(flagData) {
let searchResponse = {};
if (flagData.startsWith) {
searchResponse['pattern'] = flagData.startsWith;
searchResponse['search_pattern'] = 0;
delete flagData.startsWith;
}
if (flagData.endsWith) {
searchResponse['pattern'] = flagData.endsWith;
searchResponse['search_pattern'] = 2;
delete flagData.endsWith;
}
if (flagData.contains) {
searchResponse['pattern'] = flagData.contains;
searchResponse['search_pattern'] = 0;
delete flagData.contains;
}
return Object.assign({}, flagData, searchResponse);
}
class NumberSearch extends number_base_1.default {

@@ -43,27 +24,43 @@ run() {

const args = this.parsedArgs;
let options = parseFlags(flags);
let resp = yield this.numberSearch(args.countryCode, options);
cli_ux_1.default.table(resp.numbers, {
country: {},
msisdn: {
header: "Number"
},
type: {},
cost: {},
features: {
get: (row) => row.features.join(',')
}
}, Object.assign({}, flags));
let resp = yield this.numberSearch(args.countryCode, flags);
try {
cli_ux_1.default.table(resp.numbers, {
country: {},
msisdn: {
header: "Number"
},
type: {},
cost: {},
features: {
get: (row) => row.features.join(',')
}
}, Object.assign({}, flags));
}
catch (error) {
this.error('No results found.');
}
this.exit();
});
}
catch(error) {
const _super = Object.create(null, {
catch: { get: () => super.catch }
});
return __awaiter(this, void 0, void 0, function* () {
return _super.catch.call(this, error);
});
}
}
exports.default = NumberSearch;
NumberSearch.description = 'search for available Vonage numbers';
NumberSearch.examples = [];
NumberSearch.examples = [
`vonage numbers:search US`,
`vonage numbers:search US --startsWith=1555`,
`vonage numbers:search US --features=VOICE,SMS --endsWith=1234`
];
NumberSearch.flags = Object.assign(Object.assign({}, number_base_1.default.flags), { 'type': command_1.flags.string({
description: '',
description: 'Filter by type of number, such as mobile or landline',
options: ['landline', 'mobile-lvn', 'landline-toll-free']
}), 'startsWith': command_1.flags.string({
description: '',
description: 'Search for numbers that start with certain numbers.',
exclusive: ['endsWith', 'contains']

@@ -70,0 +67,0 @@ }), 'endsWith': command_1.flags.string({

@@ -6,3 +6,5 @@ import BaseCommand from '@vonage/cli-utils';

static args: any[];
get allNumbers(): any;
catch(error: any): Promise<void>;
protected _parseParams(params: any): any;
getAllNumbers(params: any): any;
numberBuy(params: {

@@ -12,8 +14,3 @@ number: string;

}): any;
numberSearch(countryCode: string, options: {
type?: string;
pattern?: string;
search_pattern?: string;
features?: [];
}): any;
numberSearch(countryCode: string, options: any): any;
numberUpdate(number: string, countryCode: string, options: {

@@ -20,0 +17,0 @@ voiceCallbackType: string;

"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());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {

@@ -8,5 +17,29 @@ return (mod && mod.__esModule) ? mod : { "default": mod };

class NumberCommand extends cli_utils_1.default {
get allNumbers() {
catch(error) {
return __awaiter(this, void 0, void 0, function* () {
this.error(error);
});
}
_parseParams(params) {
let searchResponse = {};
if (params.startsWith) {
searchResponse['pattern'] = params.startsWith;
searchResponse['search_pattern'] = 0;
delete params.startsWith;
}
if (params.endsWith) {
searchResponse['pattern'] = params.endsWith;
searchResponse['search_pattern'] = 2;
delete params.endsWith;
}
if (params.contains) {
searchResponse['pattern'] = params.contains;
searchResponse['search_pattern'] = 0;
delete params.contains;
}
return Object.assign({}, params, searchResponse);
}
getAllNumbers(params) {
return new Promise((res, rej) => {
this.vonage.number.get({}, (error, response) => {
this.vonage.number.get(params, (error, response) => {
if (error) {

@@ -36,3 +69,3 @@ rej(error);

return new Promise((res, rej) => {
this.vonage.number.search(countryCode, options, (error, response) => {
this.vonage.number.search(countryCode, this._parseParams(options), (error, response) => {
if (error) {

@@ -39,0 +72,0 @@ rej(error);

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

{"version":"1.0.0-beta.11","commands":{"numbers:buy":{"id":"numbers:buy","description":"buy a Vonage number","pluginName":"@vonage/cli-plugin-numbers","pluginType":"core","aliases":[],"examples":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"apiKey":{"name":"apiKey","type":"option","hidden":true},"apiSecret":{"name":"apiSecret","type":"option","hidden":true},"appId":{"name":"appId","type":"option","hidden":true},"keyFile":{"name":"keyFile","type":"option","hidden":true},"trace":{"name":"trace","type":"boolean","hidden":true,"allowNo":false}},"args":[{"name":"number","required":false},{"name":"countryCode","required":false}]},"numbers:cancel":{"id":"numbers:cancel","description":"cancel a Vonage number","pluginName":"@vonage/cli-plugin-numbers","pluginType":"core","aliases":[],"examples":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"apiKey":{"name":"apiKey","type":"option","hidden":true},"apiSecret":{"name":"apiSecret","type":"option","hidden":true},"appId":{"name":"appId","type":"option","hidden":true},"keyFile":{"name":"keyFile","type":"option","hidden":true},"trace":{"name":"trace","type":"boolean","hidden":true,"allowNo":false}},"args":[{"name":"number","required":false},{"name":"countryCode","required":false}]},"numbers":{"id":"numbers","description":"manage your Vonage numbers","pluginName":"@vonage/cli-plugin-numbers","pluginType":"core","aliases":[],"examples":["$ vonage number\nlist all numbers\n"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"apiKey":{"name":"apiKey","type":"option","hidden":true},"apiSecret":{"name":"apiSecret","type":"option","hidden":true},"appId":{"name":"appId","type":"option","hidden":true},"keyFile":{"name":"keyFile","type":"option","hidden":true},"trace":{"name":"trace","type":"boolean","hidden":true,"allowNo":false},"sort":{"name":"sort","type":"option","description":"property to sort by (prepend '-' for descending)"},"filter":{"name":"filter","type":"option","description":"filter property by partial string matching, ex: name=foo"},"output":{"name":"output","type":"option","description":"output in a more machine friendly format","options":["csv","json","yaml"]},"extended":{"name":"extended","type":"boolean","char":"x","description":"show extra columns","allowNo":false},"no-header":{"name":"no-header","type":"boolean","description":"hide table header from output","allowNo":false}},"args":[]},"numbers:search":{"id":"numbers:search","description":"search for available Vonage numbers","pluginName":"@vonage/cli-plugin-numbers","pluginType":"core","aliases":[],"examples":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"apiKey":{"name":"apiKey","type":"option","hidden":true},"apiSecret":{"name":"apiSecret","type":"option","hidden":true},"appId":{"name":"appId","type":"option","hidden":true},"keyFile":{"name":"keyFile","type":"option","hidden":true},"trace":{"name":"trace","type":"boolean","hidden":true,"allowNo":false},"type":{"name":"type","type":"option","description":"","options":["landline","mobile-lvn","landline-toll-free"]},"startsWith":{"name":"startsWith","type":"option","description":""},"endsWith":{"name":"endsWith","type":"option","description":""},"contains":{"name":"contains","type":"option","description":""},"features":{"name":"features","type":"option","description":""}},"args":[{"name":"countryCode","required":false}]}}}
{"version":"1.0.0-rc.0","commands":{"numbers:buy":{"id":"numbers:buy","description":"buy a Vonage number","pluginName":"@vonage/cli-plugin-numbers","pluginType":"core","aliases":[],"examples":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"apiKey":{"name":"apiKey","type":"option","hidden":true},"apiSecret":{"name":"apiSecret","type":"option","hidden":true},"appId":{"name":"appId","type":"option","hidden":true},"keyFile":{"name":"keyFile","type":"option","hidden":true},"trace":{"name":"trace","type":"boolean","hidden":true,"allowNo":false}},"args":[{"name":"number","required":false},{"name":"countryCode","required":false}]},"numbers:cancel":{"id":"numbers:cancel","description":"cancel a Vonage number","pluginName":"@vonage/cli-plugin-numbers","pluginType":"core","aliases":[],"examples":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"apiKey":{"name":"apiKey","type":"option","hidden":true},"apiSecret":{"name":"apiSecret","type":"option","hidden":true},"appId":{"name":"appId","type":"option","hidden":true},"keyFile":{"name":"keyFile","type":"option","hidden":true},"trace":{"name":"trace","type":"boolean","hidden":true,"allowNo":false}},"args":[{"name":"number","required":false},{"name":"countryCode","required":false}]},"numbers":{"id":"numbers","description":"manage your Vonage numbers","pluginName":"@vonage/cli-plugin-numbers","pluginType":"core","aliases":[],"examples":["vonage number"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"apiKey":{"name":"apiKey","type":"option","hidden":true},"apiSecret":{"name":"apiSecret","type":"option","hidden":true},"appId":{"name":"appId","type":"option","hidden":true},"keyFile":{"name":"keyFile","type":"option","hidden":true},"trace":{"name":"trace","type":"boolean","hidden":true,"allowNo":false},"sort":{"name":"sort","type":"option","description":"property to sort by (prepend '-' for descending)"},"filter":{"name":"filter","type":"option","description":"filter property by partial string matching, ex: name=foo"},"output":{"name":"output","type":"option","description":"output in a more machine friendly format","options":["csv","json","yaml"]},"extended":{"name":"extended","type":"boolean","char":"x","description":"show extra columns","allowNo":false},"no-header":{"name":"no-header","type":"boolean","description":"hide table header from output","allowNo":false}},"args":[]},"numbers:search":{"id":"numbers:search","description":"search for available Vonage numbers","pluginName":"@vonage/cli-plugin-numbers","pluginType":"core","aliases":[],"examples":["vonage numbers:search US","vonage numbers:search US --startsWith=1555","vonage numbers:search US --features=VOICE,SMS --endsWith=1234"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"apiKey":{"name":"apiKey","type":"option","hidden":true},"apiSecret":{"name":"apiSecret","type":"option","hidden":true},"appId":{"name":"appId","type":"option","hidden":true},"keyFile":{"name":"keyFile","type":"option","hidden":true},"trace":{"name":"trace","type":"boolean","hidden":true,"allowNo":false},"type":{"name":"type","type":"option","description":"Filter by type of number, such as mobile or landline","options":["landline","mobile-lvn","landline-toll-free"]},"startsWith":{"name":"startsWith","type":"option","description":"Search for numbers that start with certain numbers."},"endsWith":{"name":"endsWith","type":"option","description":""},"contains":{"name":"contains","type":"option","description":""},"features":{"name":"features","type":"option","description":""}},"args":[{"name":"countryCode","required":false}]}}}
{
"name": "@vonage/cli-plugin-numbers",
"version": "1.0.0-beta.11",
"version": "1.0.0-rc.0",
"author": "Vonage Dev Rel <devrel@vonage.com>",

@@ -12,3 +12,3 @@ "bugs": "https://github.com/Vonage/vonage-cli/issues",

"@types/node": "^16.6.1",
"@vonage/cli-utils": "^1.0.0-beta.11",
"@vonage/cli-utils": "^1.0.0-rc.0",
"chalk": "^2.4.2",

@@ -52,3 +52,3 @@ "cli-ux": "^5.6.3",

},
"gitHead": "980f3f40ecd46b4e9b06482c43319866b6dc3dc8"
"gitHead": "c33b7df344c1f4b0b69127ae7c090be7a255706d"
}

@@ -22,3 +22,3 @@ @vonage/cli-plugin-numbers

$ oclif-example (-v|--version|version)
@vonage/cli-plugin-numbers/1.0.0-beta.11 linux-x64 node-v12.18.2
@vonage/cli-plugin-numbers/1.0.0-rc.0 linux-x64 node-v12.18.2
$ oclif-example --help [COMMAND]

@@ -54,7 +54,6 @@ USAGE

EXAMPLE
$ vonage number
list all numbers
vonage number
```
_See code: [dist/commands/numbers/index.js](https://github.com/Vonage/vonage-cli/blob/v1.0.0-beta.11/dist/commands/numbers/index.js)_
_See code: [dist/commands/numbers/index.js](https://github.com/Vonage/vonage-cli/blob/v1.0.0-rc.0/dist/commands/numbers/index.js)_

@@ -73,3 +72,3 @@ ## `oclif-example numbers:buy [NUMBER] [COUNTRYCODE]`

_See code: [dist/commands/numbers/buy.js](https://github.com/Vonage/vonage-cli/blob/v1.0.0-beta.11/dist/commands/numbers/buy.js)_
_See code: [dist/commands/numbers/buy.js](https://github.com/Vonage/vonage-cli/blob/v1.0.0-rc.0/dist/commands/numbers/buy.js)_

@@ -88,3 +87,3 @@ ## `oclif-example numbers:cancel [NUMBER] [COUNTRYCODE]`

_See code: [dist/commands/numbers/cancel.js](https://github.com/Vonage/vonage-cli/blob/v1.0.0-beta.11/dist/commands/numbers/cancel.js)_
_See code: [dist/commands/numbers/cancel.js](https://github.com/Vonage/vonage-cli/blob/v1.0.0-rc.0/dist/commands/numbers/cancel.js)_

@@ -104,7 +103,12 @@ ## `oclif-example numbers:search [COUNTRYCODE]`

--features=features
--startsWith=startsWith
--type=landline|mobile-lvn|landline-toll-free
--startsWith=startsWith Search for numbers that start with certain numbers.
--type=landline|mobile-lvn|landline-toll-free Filter by type of number, such as mobile or landline
EXAMPLES
vonage numbers:search US
vonage numbers:search US --startsWith=1555
vonage numbers:search US --features=VOICE,SMS --endsWith=1234
```
_See code: [dist/commands/numbers/search.js](https://github.com/Vonage/vonage-cli/blob/v1.0.0-beta.11/dist/commands/numbers/search.js)_
_See code: [dist/commands/numbers/search.js](https://github.com/Vonage/vonage-cli/blob/v1.0.0-rc.0/dist/commands/numbers/search.js)_
<!-- commandsstop -->
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