@fonoster/ctl 0.3.2 → 0.3.6-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/README.md +173 -52
  2. package/dist/base/delete.js +10 -5
  3. package/dist/commands/agents/create.js +6 -6
  4. package/dist/commands/agents/get.js +4 -4
  5. package/dist/commands/agents/list.js +2 -2
  6. package/dist/commands/agents/update.js +5 -5
  7. package/dist/commands/apps/create.d.ts +6 -0
  8. package/dist/commands/apps/create.js +186 -0
  9. package/dist/commands/apps/delete.d.ts +9 -0
  10. package/dist/commands/apps/delete.js +36 -0
  11. package/dist/commands/apps/list.d.ts +10 -0
  12. package/dist/commands/apps/list.js +89 -0
  13. package/dist/commands/apps/update.d.ts +9 -0
  14. package/dist/commands/apps/update.js +205 -0
  15. package/dist/commands/auth/login.js +8 -8
  16. package/dist/commands/auth/logout.js +5 -5
  17. package/dist/commands/bug.js +2 -5
  18. package/dist/commands/domains/create.js +6 -6
  19. package/dist/commands/domains/get.js +4 -4
  20. package/dist/commands/domains/list.js +2 -2
  21. package/dist/commands/domains/update.js +5 -5
  22. package/dist/commands/feedback.js +2 -5
  23. package/dist/commands/numbers/create.js +6 -6
  24. package/dist/commands/numbers/get.js +4 -4
  25. package/dist/commands/numbers/list.js +2 -2
  26. package/dist/commands/numbers/update.js +20 -9
  27. package/dist/commands/projects/create.js +6 -6
  28. package/dist/commands/projects/get.js +4 -4
  29. package/dist/commands/projects/list.js +2 -2
  30. package/dist/commands/projects/renew.js +5 -5
  31. package/dist/commands/projects/use.js +5 -5
  32. package/dist/commands/providers/create.js +7 -7
  33. package/dist/commands/providers/get.js +4 -4
  34. package/dist/commands/providers/list.js +2 -2
  35. package/dist/commands/providers/update.js +5 -5
  36. package/dist/commands/secrets/create.d.ts +14 -0
  37. package/dist/commands/secrets/create.js +64 -0
  38. package/dist/commands/secrets/delete.d.ts +10 -0
  39. package/dist/commands/secrets/delete.js +57 -0
  40. package/dist/commands/secrets/list.d.ts +10 -0
  41. package/dist/commands/secrets/list.js +71 -0
  42. package/dist/data/voices.d.ts +1 -0
  43. package/dist/data/voices.js +319 -0
  44. package/dist/decorators/project_guard.d.ts +9 -0
  45. package/dist/decorators/project_guard.js +26 -0
  46. package/dist/help.d.ts +3 -1
  47. package/dist/help.js +21 -16
  48. package/oclif.manifest.json +1 -1
  49. package/package.json +24 -43
@@ -4,7 +4,7 @@ require("../../config");
4
4
  const domains_1 = require("@fonoster/domains");
5
5
  const errors_1 = require("@oclif/errors");
6
6
  const command_1 = require("@oclif/command");
7
- const cli_ux_1 = require("cli-ux");
7
+ const core_1 = require("@oclif/core");
8
8
  const config_1 = require("../../config");
9
9
  const Numbers = require("@fonoster/numbers");
10
10
  const Domains = require("@fonoster/domains");
@@ -87,19 +87,19 @@ class CreateCommand extends command_1.Command {
87
87
  delete answers.egressRule;
88
88
  delete answers.egressNumberRef;
89
89
  }
90
- cli_ux_1.cli.action.start(`Creating Domain ${answers.name}`);
90
+ core_1.CliUx.ux.action.start(`Creating Domain ${answers.name}`);
91
91
  const domains = new Domains((0, config_1.getProjectConfig)());
92
92
  const domain = await domains.createDomain(answers);
93
- await cli_ux_1.cli.wait(1000);
94
- cli_ux_1.cli.action.stop(domain.ref);
93
+ await core_1.CliUx.ux.wait(1000);
94
+ core_1.CliUx.ux.action.stop(domain.ref);
95
95
  }
96
96
  catch (e) {
97
- cli_ux_1.cli.action.stop();
97
+ core_1.CliUx.ux.action.stop();
98
98
  if (e.code === 9) {
99
99
  throw new errors_1.CLIError("This Domain already exist");
100
100
  }
101
101
  else {
102
- throw new errors_1.CLIError(e);
102
+ throw new errors_1.CLIError(e.message);
103
103
  }
104
104
  }
105
105
  }
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  require("../../config");
4
4
  const errors_1 = require("@oclif/errors");
5
5
  const command_1 = require("@oclif/command");
6
- const cli_ux_1 = require("cli-ux");
6
+ const core_1 = require("@oclif/core");
7
7
  const prettyjson_1 = require("prettyjson");
8
8
  const config_1 = require("../../config");
9
9
  const Domains = require("@fonoster/domains");
@@ -16,7 +16,7 @@ class GetCommand extends command_1.Command {
16
16
  const { args } = this.parse(GetCommand);
17
17
  try {
18
18
  const domains = new Domains((0, config_1.getProjectConfig)());
19
- cli_ux_1.cli.action.start(`Getting domain ${args.ref}`);
19
+ core_1.CliUx.ux.action.start(`Getting domain ${args.ref}`);
20
20
  const domain = await domains.getDomain(args.ref);
21
21
  console.log("geting domain: ");
22
22
  const allow = domain.accessDeny.length > 0 ? domain.accessDeny.join(",") : "None";
@@ -31,8 +31,8 @@ class GetCommand extends command_1.Command {
31
31
  Created: moment(domain.createTime).fromNow(),
32
32
  Updated: moment(domain.updateTime).fromNow()
33
33
  };
34
- await cli_ux_1.cli.wait(1000);
35
- cli_ux_1.cli.action.stop("");
34
+ await core_1.CliUx.ux.wait(1000);
35
+ core_1.CliUx.ux.action.stop("");
36
36
  console.log((0, prettyjson_1.render)(jsonObj, { noColor: true }));
37
37
  }
38
38
  catch (e) {
@@ -4,7 +4,7 @@ require("../../config");
4
4
  const domains_1 = require("@fonoster/domains");
5
5
  const errors_1 = require("@oclif/errors");
6
6
  const command_1 = require("@oclif/command");
7
- const cli_ux_1 = require("cli-ux");
7
+ const core_1 = require("@oclif/core");
8
8
  const config_1 = require("../../config");
9
9
  const Domains = require("@fonoster/domains");
10
10
  const inquirer = require("inquirer");
@@ -36,7 +36,7 @@ class ListCommand extends command_1.Command {
36
36
  if (list.length < 1)
37
37
  break;
38
38
  const showTable = (showHeader, data) => {
39
- cli_ux_1.cli.table(data, {
39
+ core_1.CliUx.ux.table(data, {
40
40
  ref: { minWidth: 15 },
41
41
  name: { header: "Name", minWidth: 15 },
42
42
  domainUri: { header: "Domain URI", minWidth: 15 },
@@ -4,7 +4,7 @@ require("../../config");
4
4
  const domains_1 = require("@fonoster/domains");
5
5
  const errors_1 = require("@oclif/errors");
6
6
  const command_1 = require("@oclif/command");
7
- const cli_ux_1 = require("cli-ux");
7
+ const core_1 = require("@oclif/core");
8
8
  const config_1 = require("../../config");
9
9
  const Numbers = require("@fonoster/numbers");
10
10
  const Domains = require("@fonoster/domains");
@@ -86,13 +86,13 @@ class UpdateCommand extends command_1.Command {
86
86
  const accessAllow = answers.accessAllow;
87
87
  answers.accessDeny = accessDeny ? accessDeny.split(",") : [];
88
88
  answers.accessAllow = accessAllow ? accessAllow.split(",") : [];
89
- cli_ux_1.cli.action.start(`Updating domain ${answers.name}`);
89
+ core_1.CliUx.ux.action.start(`Updating domain ${answers.name}`);
90
90
  await domains.updateDomain(answers);
91
- await cli_ux_1.cli.wait(1000);
92
- cli_ux_1.cli.action.stop("Done");
91
+ await core_1.CliUx.ux.wait(1000);
92
+ core_1.CliUx.ux.action.stop("Done");
93
93
  }
94
94
  catch (e) {
95
- cli_ux_1.cli.action.stop();
95
+ core_1.CliUx.ux.action.stop();
96
96
  throw new errors_1.CLIError(e.message);
97
97
  }
98
98
  }
@@ -1,14 +1,11 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  require("../config");
7
- const cli_ux_1 = __importDefault(require("cli-ux"));
4
+ const core_1 = require("@oclif/core");
8
5
  const command_1 = require("@oclif/command");
9
6
  class default_1 extends command_1.Command {
10
7
  async run() {
11
- await cli_ux_1.default.open("https://docs.google.com/forms/d/e/1FAIpQLSd1G2ahRYqkbksOvz7XhNHfSLepUh3KzRHsXh2HXfZr68nhtQ/viewform?vc=0&c=0&w=1&flr=0");
8
+ await core_1.CliUx.ux.open("https://docs.google.com/forms/d/e/1FAIpQLSd1G2ahRYqkbksOvz7XhNHfSLepUh3KzRHsXh2HXfZr68nhtQ/viewform?vc=0&c=0&w=1&flr=0");
12
9
  }
13
10
  }
14
11
  exports.default = default_1;
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  require("../../config");
4
4
  const errors_1 = require("@oclif/errors");
5
5
  const command_1 = require("@oclif/command");
6
- const cli_ux_1 = require("cli-ux");
6
+ const core_1 = require("@oclif/core");
7
7
  const numbers_1 = require("@fonoster/numbers");
8
8
  const config_1 = require("../../config");
9
9
  const Providers = require("@fonoster/providers");
@@ -74,20 +74,20 @@ class CreateCommand extends command_1.Command {
74
74
  console.log("Aborted");
75
75
  }
76
76
  else {
77
- cli_ux_1.cli.action.start(`Creating Number ${answers.e164Number}`);
77
+ core_1.CliUx.ux.action.start(`Creating Number ${answers.e164Number}`);
78
78
  const numbers = new Numbers((0, config_1.getProjectConfig)());
79
79
  const result = await numbers.createNumber(answers);
80
- await cli_ux_1.cli.wait(1000);
81
- cli_ux_1.cli.action.stop(result.ref);
80
+ await core_1.CliUx.ux.wait(1000);
81
+ core_1.CliUx.ux.action.stop(result.ref);
82
82
  }
83
83
  }
84
84
  catch (e) {
85
- cli_ux_1.cli.action.stop();
85
+ core_1.CliUx.ux.action.stop();
86
86
  if (e.code === 9) {
87
87
  throw new errors_1.CLIError("This Number already exist");
88
88
  }
89
89
  else {
90
- throw new errors_1.CLIError(e);
90
+ throw new errors_1.CLIError(e.message);
91
91
  }
92
92
  }
93
93
  }
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  require("../../config");
4
4
  const errors_1 = require("@oclif/errors");
5
5
  const command_1 = require("@oclif/command");
6
- const cli_ux_1 = require("cli-ux");
6
+ const core_1 = require("@oclif/core");
7
7
  const prettyjson_1 = require("prettyjson");
8
8
  const config_1 = require("../../config");
9
9
  const Numbers = require("@fonoster/numbers");
@@ -16,7 +16,7 @@ class GetCommand extends command_1.Command {
16
16
  const { args } = this.parse(GetCommand);
17
17
  try {
18
18
  const numbers = new Numbers((0, config_1.getProjectConfig)());
19
- cli_ux_1.cli.action.start(`Getting number ${args.ref}`);
19
+ core_1.CliUx.ux.action.start(`Getting number ${args.ref}`);
20
20
  const number = await numbers.getNumber(args.ref);
21
21
  const jsonObj = {
22
22
  Ref: number.ref,
@@ -27,8 +27,8 @@ class GetCommand extends command_1.Command {
27
27
  Created: moment(number.createTime).fromNow(),
28
28
  Updated: moment(number.updateTime).fromNow()
29
29
  };
30
- await cli_ux_1.cli.wait(1000);
31
- cli_ux_1.cli.action.stop("");
30
+ await core_1.CliUx.ux.wait(1000);
31
+ core_1.CliUx.ux.action.stop("");
32
32
  console.log((0, prettyjson_1.render)(jsonObj, { noColor: true }));
33
33
  }
34
34
  catch (e) {
@@ -4,7 +4,7 @@ require("../../config");
4
4
  const errors_1 = require("@oclif/errors");
5
5
  const command_1 = require("@oclif/command");
6
6
  const numbers_1 = require("@fonoster/numbers");
7
- const cli_ux_1 = require("cli-ux");
7
+ const core_1 = require("@oclif/core");
8
8
  const config_1 = require("../../config");
9
9
  const Numbers = require("@fonoster/numbers");
10
10
  const inquirer = require("inquirer");
@@ -40,7 +40,7 @@ class ListCommand extends command_1.Command {
40
40
  if (list.length < 1)
41
41
  break;
42
42
  const showTable = (showHeader, data) => {
43
- cli_ux_1.cli.table(data, {
43
+ core_1.CliUx.ux.table(data, {
44
44
  ref: { minWidth: 15 },
45
45
  providerRef: { header: "Provider Ref", minWidth: 15 },
46
46
  e164Number: { header: "E164 Number", minWidth: 15 },
@@ -1,21 +1,29 @@
1
1
  "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
2
8
  Object.defineProperty(exports, "__esModule", { value: true });
3
9
  exports.UpdateCommand = void 0;
4
10
  require("../../config");
5
11
  const errors_1 = require("@oclif/errors");
6
12
  const command_1 = require("@oclif/command");
7
- const cli_ux_1 = require("cli-ux");
13
+ const core_1 = require("@oclif/core");
8
14
  const config_1 = require("../../config");
15
+ const project_guard_1 = require("../../decorators/project_guard");
9
16
  const Numbers = require("@fonoster/numbers");
10
17
  const inquirer = require("inquirer");
11
18
  class UpdateCommand extends command_1.Command {
12
19
  async run() {
13
- if (!(0, config_1.hasProjectConfig)()) {
14
- throw new errors_1.CLIError("you must set a default project");
15
- }
16
20
  console.log("This utility will help you update an existing Fonoster Number");
17
21
  console.log("Press ^C at any time to quit.");
18
22
  const { args } = this.parse(UpdateCommand);
23
+ if (!args.ref) {
24
+ core_1.CliUx.ux.action.stop();
25
+ throw new errors_1.CLIError("You must provide a Number ref before continuing");
26
+ }
19
27
  const numbers = new Numbers((0, config_1.getProjectConfig)());
20
28
  const answers = await inquirer.prompt([
21
29
  {
@@ -55,21 +63,24 @@ class UpdateCommand extends command_1.Command {
55
63
  const accessAllow = answers.accessAllow;
56
64
  answers.accessDeny = accessDeny ? accessDeny.split(",") : [];
57
65
  answers.accessAllow = accessAllow ? accessAllow.split(",") : [];
58
- cli_ux_1.cli.action.start(`Updating number`);
66
+ core_1.CliUx.ux.action.start(`Updating number`);
59
67
  await numbers.updateNumber(answers);
60
- await cli_ux_1.cli.wait(1000);
61
- cli_ux_1.cli.action.stop("Done");
68
+ await core_1.CliUx.ux.wait(1000);
69
+ core_1.CliUx.ux.action.stop("Done");
62
70
  }
63
71
  catch (e) {
64
- cli_ux_1.cli.action.stop();
72
+ core_1.CliUx.ux.action.stop();
65
73
  throw new errors_1.CLIError(e.message);
66
74
  }
67
75
  }
68
76
  }
69
77
  }
70
- exports.UpdateCommand = UpdateCommand;
71
78
  UpdateCommand.description = `update a Fonoster Number
72
79
  ...
73
80
  Update a Fonoster Number
74
81
  `;
75
82
  UpdateCommand.args = [{ name: "ref" }];
83
+ __decorate([
84
+ (0, project_guard_1.ProjectGuard)()
85
+ ], UpdateCommand.prototype, "run", null);
86
+ exports.UpdateCommand = UpdateCommand;
@@ -4,7 +4,7 @@ require("../../config");
4
4
  const Projects = require("@fonoster/projects");
5
5
  const errors_1 = require("@oclif/errors");
6
6
  const command_1 = require("@oclif/command");
7
- const cli_ux_1 = require("cli-ux");
7
+ const core_1 = require("@oclif/core");
8
8
  const inquirer = require("inquirer");
9
9
  class default_1 extends command_1.Command {
10
10
  async run() {
@@ -32,19 +32,19 @@ class default_1 extends command_1.Command {
32
32
  }
33
33
  else {
34
34
  try {
35
- cli_ux_1.cli.action.start(`Creating Project ${answers.name}`);
35
+ core_1.CliUx.ux.action.start(`Creating Project ${answers.name}`);
36
36
  const projects = new Projects();
37
37
  const project = await projects.createProject(answers);
38
- await cli_ux_1.cli.wait(1000);
39
- cli_ux_1.cli.action.stop(project.ref);
38
+ await core_1.CliUx.ux.wait(1000);
39
+ core_1.CliUx.ux.action.stop(project.ref);
40
40
  }
41
41
  catch (e) {
42
- cli_ux_1.cli.action.stop();
42
+ core_1.CliUx.ux.action.stop();
43
43
  if (e.code === 9) {
44
44
  throw new errors_1.CLIError("This Project already exist");
45
45
  }
46
46
  else {
47
- throw new errors_1.CLIError(e);
47
+ throw new errors_1.CLIError(e.message);
48
48
  }
49
49
  }
50
50
  }
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  require("../../config");
4
4
  const errors_1 = require("@oclif/errors");
5
5
  const command_1 = require("@oclif/command");
6
- const cli_ux_1 = require("cli-ux");
6
+ const core_1 = require("@oclif/core");
7
7
  const prettyjson_1 = require("prettyjson");
8
8
  const Projects = require("@fonoster/projects");
9
9
  const moment = require("moment");
@@ -12,7 +12,7 @@ class GetCommand extends command_1.Command {
12
12
  const { args } = this.parse(GetCommand);
13
13
  try {
14
14
  const projects = new Projects();
15
- cli_ux_1.cli.action.start(`Getting Project ${args.ref}`);
15
+ core_1.CliUx.ux.action.start(`Getting Project ${args.ref}`);
16
16
  const p = await projects.getProject(args.ref);
17
17
  const jsonObj = {
18
18
  Name: p.name,
@@ -23,8 +23,8 @@ class GetCommand extends command_1.Command {
23
23
  Created: moment(p.createTime).fromNow(),
24
24
  Updated: moment(p.updateTime).fromNow()
25
25
  };
26
- await cli_ux_1.cli.wait(1000);
27
- cli_ux_1.cli.action.stop("");
26
+ await core_1.CliUx.ux.wait(1000);
27
+ core_1.CliUx.ux.action.stop("");
28
28
  console.log((0, prettyjson_1.render)(jsonObj, { noColor: true }));
29
29
  }
30
30
  catch (e) {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  require("../../config");
4
4
  const errors_1 = require("@oclif/errors");
5
5
  const command_1 = require("@oclif/command");
6
- const cli_ux_1 = require("cli-ux");
6
+ const core_1 = require("@oclif/core");
7
7
  const Projects = require("@fonoster/projects");
8
8
  class ListCommand extends command_1.Command {
9
9
  async run() {
@@ -11,7 +11,7 @@ class ListCommand extends command_1.Command {
11
11
  const projects = new Projects();
12
12
  // Gets the list
13
13
  const result = await projects.listProjects({});
14
- cli_ux_1.cli.table(result.projects, {
14
+ core_1.CliUx.ux.table(result.projects, {
15
15
  accessKeyId: { header: "Ref / Access Key Id", minWidth: 30 },
16
16
  name: { header: "Name", minWidth: 12 }
17
17
  });
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  require("../../config");
4
4
  const errors_1 = require("@oclif/errors");
5
5
  const command_1 = require("@oclif/command");
6
- const cli_ux_1 = require("cli-ux");
6
+ const core_1 = require("@oclif/core");
7
7
  const Projects = require("@fonoster/projects");
8
8
  class UpdateCommand extends command_1.Command {
9
9
  async run() {
@@ -11,12 +11,12 @@ class UpdateCommand extends command_1.Command {
11
11
  try {
12
12
  const projects = new Projects();
13
13
  const project = await projects.renewAccessKeySecret({ ref: args.ref });
14
- cli_ux_1.cli.action.start(`Renewing credentials for ${args.ref}`);
15
- await cli_ux_1.cli.wait(1000);
16
- cli_ux_1.cli.action.stop(project.accessKeySecret);
14
+ core_1.CliUx.ux.action.start(`Renewing credentials for ${args.ref}`);
15
+ await core_1.CliUx.ux.wait(1000);
16
+ core_1.CliUx.ux.action.stop(project.accessKeySecret);
17
17
  }
18
18
  catch (e) {
19
- cli_ux_1.cli.action.stop();
19
+ core_1.CliUx.ux.action.stop();
20
20
  throw new errors_1.CLIError(e.message);
21
21
  }
22
22
  }
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  require("../../config");
4
4
  const errors_1 = require("@oclif/errors");
5
5
  const command_1 = require("@oclif/command");
6
- const cli_ux_1 = require("cli-ux");
6
+ const core_1 = require("@oclif/core");
7
7
  const config_1 = require("../../config");
8
8
  const Projects = require("@fonoster/projects");
9
9
  class UpdateCommand extends command_1.Command {
@@ -12,7 +12,7 @@ class UpdateCommand extends command_1.Command {
12
12
  try {
13
13
  const projects = new Projects();
14
14
  const project = await projects.getProject(args.ref);
15
- cli_ux_1.cli.action.start(`Setting default Project to ${args.ref}`);
15
+ core_1.CliUx.ux.action.start(`Setting default Project to ${args.ref}`);
16
16
  const config = (0, config_1.getConfig)();
17
17
  const { accessKeyId, accessKeySecret, endpoint } = config;
18
18
  (0, config_1.setConfig)({
@@ -25,11 +25,11 @@ class UpdateCommand extends command_1.Command {
25
25
  accessKeySecret: project.accessKeySecret
26
26
  }
27
27
  });
28
- await cli_ux_1.cli.wait(1000);
29
- cli_ux_1.cli.action.stop("Done");
28
+ await core_1.CliUx.ux.wait(1000);
29
+ core_1.CliUx.ux.action.stop("Done");
30
30
  }
31
31
  catch (e) {
32
- cli_ux_1.cli.action.stop();
32
+ core_1.CliUx.ux.action.stop();
33
33
  throw new errors_1.CLIError(e.message);
34
34
  }
35
35
  }
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  require("../../config");
4
4
  const errors_1 = require("@oclif/errors");
5
5
  const command_1 = require("@oclif/command");
6
- const cli_ux_1 = require("cli-ux");
6
+ const core_1 = require("@oclif/core");
7
7
  const config_1 = require("../../config");
8
8
  const Providers = require("@fonoster/providers");
9
9
  const inquirer = require("inquirer");
@@ -53,7 +53,7 @@ class CreateCommand extends command_1.Command {
53
53
  }
54
54
  return true;
55
55
  },
56
- default: 300
56
+ default: 600
57
57
  },
58
58
  {
59
59
  name: "confirm",
@@ -66,19 +66,19 @@ class CreateCommand extends command_1.Command {
66
66
  }
67
67
  else {
68
68
  try {
69
- cli_ux_1.cli.action.start(`Creating Provider ${answers.name}`);
69
+ core_1.CliUx.ux.action.start(`Creating Provider ${answers.name}`);
70
70
  const providers = new Providers((0, config_1.getProjectConfig)());
71
71
  const provider = await providers.createProvider(answers);
72
- await cli_ux_1.cli.wait(1000);
73
- cli_ux_1.cli.action.stop(provider.ref);
72
+ await core_1.CliUx.ux.wait(1000);
73
+ core_1.CliUx.ux.action.stop(provider.ref);
74
74
  }
75
75
  catch (e) {
76
- cli_ux_1.cli.action.stop();
76
+ core_1.CliUx.ux.action.stop();
77
77
  if (e.code === 9) {
78
78
  throw new errors_1.CLIError("This Provider already exist");
79
79
  }
80
80
  else {
81
- throw new errors_1.CLIError(e);
81
+ throw new errors_1.CLIError(e.message);
82
82
  }
83
83
  }
84
84
  }
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  require("../../config");
4
4
  const errors_1 = require("@oclif/errors");
5
5
  const command_1 = require("@oclif/command");
6
- const cli_ux_1 = require("cli-ux");
6
+ const core_1 = require("@oclif/core");
7
7
  const prettyjson_1 = require("prettyjson");
8
8
  const config_1 = require("../../config");
9
9
  const Providers = require("@fonoster/providers");
@@ -16,7 +16,7 @@ class GetCommand extends command_1.Command {
16
16
  const { args } = this.parse(GetCommand);
17
17
  try {
18
18
  const providers = new Providers((0, config_1.getProjectConfig)());
19
- cli_ux_1.cli.action.start(`getting provider ${args.ref}`);
19
+ core_1.CliUx.ux.action.start(`getting provider ${args.ref}`);
20
20
  const provider = await providers.getProvider(args.ref);
21
21
  const jsonObj = {
22
22
  Ref: provider.ref,
@@ -28,8 +28,8 @@ class GetCommand extends command_1.Command {
28
28
  Created: moment(provider.createTime).fromNow(),
29
29
  Updated: moment(provider.updateTime).fromNow()
30
30
  };
31
- await cli_ux_1.cli.wait(1000);
32
- cli_ux_1.cli.action.stop("");
31
+ await core_1.CliUx.ux.wait(1000);
32
+ core_1.CliUx.ux.action.stop("");
33
33
  console.log((0, prettyjson_1.render)(jsonObj, { noColor: true }));
34
34
  }
35
35
  catch (e) {
@@ -4,7 +4,7 @@ require("../../config");
4
4
  const errors_1 = require("@oclif/errors");
5
5
  const command_1 = require("@oclif/command");
6
6
  const providers_1 = require("@fonoster/providers");
7
- const cli_ux_1 = require("cli-ux");
7
+ const core_1 = require("@oclif/core");
8
8
  const config_1 = require("../../config");
9
9
  const Providers = require("@fonoster/providers");
10
10
  const inquirer = require("inquirer");
@@ -40,7 +40,7 @@ class ListCommand extends command_1.Command {
40
40
  if (list.length < 1)
41
41
  break;
42
42
  const showTable = (showHeader, data) => {
43
- cli_ux_1.cli.table(data, {
43
+ core_1.CliUx.ux.table(data, {
44
44
  ref: { minWidth: 13 },
45
45
  name: { header: "Name", minWidth: 13 },
46
46
  username: {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  require("../../config");
4
4
  const errors_1 = require("@oclif/errors");
5
5
  const command_1 = require("@oclif/command");
6
- const cli_ux_1 = require("cli-ux");
6
+ const core_1 = require("@oclif/core");
7
7
  const config_1 = require("../../config");
8
8
  const Providers = require("@fonoster/providers");
9
9
  const inquirer = require("inquirer");
@@ -69,13 +69,13 @@ class UpdateCommand extends command_1.Command {
69
69
  }
70
70
  else {
71
71
  try {
72
- cli_ux_1.cli.action.start(`Updating Provider ${answers.name}`);
72
+ core_1.CliUx.ux.action.start(`Updating Provider ${answers.name}`);
73
73
  await providers.updateProvider(answers);
74
- await cli_ux_1.cli.wait(1000);
75
- cli_ux_1.cli.action.stop("Done");
74
+ await core_1.CliUx.ux.wait(1000);
75
+ core_1.CliUx.ux.action.stop("Done");
76
76
  }
77
77
  catch (e) {
78
- cli_ux_1.cli.action.stop();
78
+ core_1.CliUx.ux.action.stop();
79
79
  throw new errors_1.CLIError(e.message);
80
80
  }
81
81
  }
@@ -0,0 +1,14 @@
1
+ import "../../config";
2
+ import { Command, flags } from "@oclif/command";
3
+ export default class CreateCommand extends Command {
4
+ static description: string;
5
+ static args: {
6
+ name: string;
7
+ }[];
8
+ static flags: {
9
+ help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
10
+ "from-literal": flags.IOptionFlag<string>;
11
+ "from-stdin": import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
12
+ };
13
+ run(): Promise<void>;
14
+ }
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ /*
10
+ * Copyright (C) 2021 by Fonoster Inc (https://fonoster.com)
11
+ * http://github.com/fonoster/plugin-funcs
12
+ *
13
+ * This file is part of Fonoster
14
+ *
15
+ * Licensed under the MIT License (the "License");
16
+ * you may not use this file except in compliance with
17
+ * the License. You may obtain a copy of the License at
18
+ *
19
+ * https://opensource.org/licenses/MIT
20
+ *
21
+ * Unless required by applicable law or agreed to in writing, software
22
+ * distributed under the License is distributed on an "AS IS" BASIS,
23
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24
+ * See the License for the specific language governing permissions and
25
+ * limitations under the License.
26
+ */
27
+ require("../../config");
28
+ const command_1 = require("@oclif/command");
29
+ const errors_1 = require("@oclif/errors");
30
+ const config_1 = require("../../config");
31
+ const project_guard_1 = require("../../decorators/project_guard");
32
+ const getStdin = require("get-stdin-with-tty");
33
+ const Secrets = require("@fonoster/secrets");
34
+ class CreateCommand extends command_1.Command {
35
+ async run() {
36
+ const secretsManager = new Secrets((0, config_1.getProjectConfig)());
37
+ const { args, flags } = this.parse(CreateCommand);
38
+ let secret = flags["from-stdin"] ? await getStdin() : flags["from-literal"];
39
+ if (!args.name || !secret) {
40
+ throw new errors_1.CLIError("Cant create a secret without a name or a secret-value. Type [secrets:create --help] for more information");
41
+ }
42
+ try {
43
+ const result = await secretsManager.createSecret({
44
+ name: args.name,
45
+ secret
46
+ });
47
+ console.log(result.name);
48
+ }
49
+ catch (e) {
50
+ throw new errors_1.CLIError(e.message);
51
+ }
52
+ }
53
+ }
54
+ CreateCommand.description = "create a Fonoster secret.";
55
+ CreateCommand.args = [{ name: "name" }];
56
+ CreateCommand.flags = {
57
+ help: command_1.flags.help({ char: "h" }),
58
+ "from-literal": command_1.flags.string({ char: "l", description: "pass from literal" }),
59
+ "from-stdin": command_1.flags.boolean({ char: "s", description: "pass from stdin" })
60
+ };
61
+ __decorate([
62
+ (0, project_guard_1.ProjectGuard)()
63
+ ], CreateCommand.prototype, "run", null);
64
+ exports.default = CreateCommand;
@@ -0,0 +1,10 @@
1
+ import "../../config";
2
+ import { Command } from "@oclif/command";
3
+ export default class DeleteCommand extends Command {
4
+ static description: string;
5
+ static aliases: string[];
6
+ static args: {
7
+ name: string;
8
+ }[];
9
+ run(): Promise<void>;
10
+ }