@fonoster/ctl 0.4.8 → 0.7.37

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 (112) hide show
  1. package/LICENSE +2 -2
  2. package/README.md +349 -606
  3. package/bin/run.js +7 -0
  4. package/dist/commands/workspace/login.d.ts +6 -0
  5. package/dist/commands/workspace/login.js +80 -0
  6. package/dist/config/addWorkspace.d.ts +3 -0
  7. package/dist/config/addWorkspace.js +10 -0
  8. package/dist/config/getConfig.d.ts +3 -0
  9. package/dist/{commands/projects/delete.js → config/getConfig.js} +10 -14
  10. package/dist/config/getCurrentWorkspace.d.ts +3 -0
  11. package/dist/config/getCurrentWorkspace.js +10 -0
  12. package/dist/config/index.d.ts +7 -0
  13. package/dist/config/index.js +41 -0
  14. package/dist/config/removeWorkspace.d.ts +3 -0
  15. package/dist/config/removeWorkspace.js +6 -0
  16. package/dist/config/saveConfig.d.ts +3 -0
  17. package/dist/{commands/feedback.js → config/saveConfig.js} +11 -12
  18. package/dist/config/setCurrentWorkspace.d.ts +3 -0
  19. package/dist/config/setCurrentWorkspace.js +11 -0
  20. package/dist/config/types.d.ts +4 -0
  21. package/dist/config/types.js +2 -0
  22. package/dist/config/validations.d.ts +24 -0
  23. package/dist/{index.js → config/validations.js} +12 -4
  24. package/dist/constants.d.ts +3 -0
  25. package/dist/{utils.js → constants.js} +7 -10
  26. package/package.json +29 -64
  27. package/bin/run +0 -5
  28. package/bin/run.cmd +0 -3
  29. package/dist/base/delete.d.ts +0 -9
  30. package/dist/base/delete.js +0 -50
  31. package/dist/commands/agents/create.d.ts +0 -6
  32. package/dist/commands/agents/create.js +0 -112
  33. package/dist/commands/agents/delete.d.ts +0 -9
  34. package/dist/commands/agents/delete.js +0 -39
  35. package/dist/commands/agents/get.d.ts +0 -9
  36. package/dist/commands/agents/get.js +0 -60
  37. package/dist/commands/agents/list.d.ts +0 -10
  38. package/dist/commands/agents/list.js +0 -92
  39. package/dist/commands/agents/update.d.ts +0 -9
  40. package/dist/commands/agents/update.js +0 -90
  41. package/dist/commands/apps/create.d.ts +0 -6
  42. package/dist/commands/apps/create.js +0 -213
  43. package/dist/commands/apps/delete.d.ts +0 -9
  44. package/dist/commands/apps/delete.js +0 -54
  45. package/dist/commands/apps/list.d.ts +0 -10
  46. package/dist/commands/apps/list.js +0 -107
  47. package/dist/commands/apps/update.d.ts +0 -9
  48. package/dist/commands/apps/update.js +0 -235
  49. package/dist/commands/auth/login.d.ts +0 -6
  50. package/dist/commands/auth/login.js +0 -84
  51. package/dist/commands/auth/logout.d.ts +0 -6
  52. package/dist/commands/auth/logout.js +0 -46
  53. package/dist/commands/bug.d.ts +0 -6
  54. package/dist/commands/bug.js +0 -33
  55. package/dist/commands/domains/create.d.ts +0 -6
  56. package/dist/commands/domains/create.js +0 -130
  57. package/dist/commands/domains/delete.d.ts +0 -9
  58. package/dist/commands/domains/delete.js +0 -49
  59. package/dist/commands/domains/get.d.ts +0 -9
  60. package/dist/commands/domains/get.js +0 -63
  61. package/dist/commands/domains/list.d.ts +0 -10
  62. package/dist/commands/domains/list.js +0 -95
  63. package/dist/commands/domains/update.d.ts +0 -9
  64. package/dist/commands/domains/update.js +0 -124
  65. package/dist/commands/feedback.d.ts +0 -6
  66. package/dist/commands/numbers/create.d.ts +0 -6
  67. package/dist/commands/numbers/create.js +0 -117
  68. package/dist/commands/numbers/delete.d.ts +0 -9
  69. package/dist/commands/numbers/delete.js +0 -49
  70. package/dist/commands/numbers/get.d.ts +0 -9
  71. package/dist/commands/numbers/get.js +0 -59
  72. package/dist/commands/numbers/list.d.ts +0 -10
  73. package/dist/commands/numbers/list.js +0 -100
  74. package/dist/commands/numbers/update.d.ts +0 -9
  75. package/dist/commands/numbers/update.js +0 -104
  76. package/dist/commands/projects/create.d.ts +0 -6
  77. package/dist/commands/projects/create.js +0 -75
  78. package/dist/commands/projects/delete.d.ts +0 -9
  79. package/dist/commands/projects/get.d.ts +0 -9
  80. package/dist/commands/projects/get.js +0 -55
  81. package/dist/commands/projects/list.d.ts +0 -6
  82. package/dist/commands/projects/list.js +0 -50
  83. package/dist/commands/projects/renew.d.ts +0 -9
  84. package/dist/commands/projects/renew.js +0 -47
  85. package/dist/commands/projects/use.d.ts +0 -9
  86. package/dist/commands/projects/use.js +0 -60
  87. package/dist/commands/providers/create.d.ts +0 -6
  88. package/dist/commands/providers/create.js +0 -114
  89. package/dist/commands/providers/delete.d.ts +0 -9
  90. package/dist/commands/providers/delete.js +0 -49
  91. package/dist/commands/providers/get.d.ts +0 -9
  92. package/dist/commands/providers/get.js +0 -61
  93. package/dist/commands/providers/list.d.ts +0 -10
  94. package/dist/commands/providers/list.js +0 -98
  95. package/dist/commands/providers/update.d.ts +0 -9
  96. package/dist/commands/providers/update.js +0 -113
  97. package/dist/commands/secrets/create.d.ts +0 -14
  98. package/dist/commands/secrets/create.js +0 -69
  99. package/dist/commands/secrets/delete.d.ts +0 -10
  100. package/dist/commands/secrets/delete.js +0 -57
  101. package/dist/commands/secrets/list.d.ts +0 -10
  102. package/dist/commands/secrets/list.js +0 -71
  103. package/dist/config.d.ts +0 -29
  104. package/dist/config.js +0 -73
  105. package/dist/data/voices.d.ts +0 -1
  106. package/dist/data/voices.js +0 -337
  107. package/dist/decorators/project_guard.d.ts +0 -9
  108. package/dist/decorators/project_guard.js +0 -44
  109. package/dist/help.d.ts +0 -6
  110. package/dist/help.js +0 -47
  111. package/dist/index.d.ts +0 -1
  112. package/dist/utils.d.ts +0 -1
@@ -1,49 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- /*
7
- * Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
8
- * http://github.com/fonoster/fonoster
9
- *
10
- * This file is part of Fonoster
11
- *
12
- * Licensed under the MIT License (the "License");
13
- * you may not use this file except in compliance with
14
- * the License. You may obtain a copy of the License at
15
- *
16
- * https://opensource.org/licenses/MIT
17
- *
18
- * Unless required by applicable law or agreed to in writing, software
19
- * distributed under the License is distributed on an "AS IS" BASIS,
20
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
- * See the License for the specific language governing permissions and
22
- * limitations under the License.
23
- */
24
- const delete_1 = __importDefault(require("../../base/delete"));
25
- const errors_1 = require("@oclif/errors");
26
- const config_1 = require("../../config");
27
- const Numbers = require("@fonoster/numbers");
28
- class DeleteCommand extends delete_1.default {
29
- async run() {
30
- if (!(0, config_1.hasProjectConfig)()) {
31
- throw new errors_1.CLIError("you must set a default project");
32
- }
33
- try {
34
- await super.deleteResource(new Numbers((0, config_1.getProjectConfig)()), "deleteNumber");
35
- }
36
- catch (e) {
37
- if (e.code === 9) {
38
- throw new errors_1.CLIError("unable to delete: please ensure no Domain is using this Fonoster Number");
39
- }
40
- else {
41
- throw new errors_1.CLIError(e.message);
42
- }
43
- }
44
- }
45
- }
46
- DeleteCommand.description = "delete a Fonoster Number";
47
- DeleteCommand.args = [{ name: "ref" }];
48
- DeleteCommand.aliases = ["numbers:del", "numbers:rm"];
49
- exports.default = DeleteCommand;
@@ -1,9 +0,0 @@
1
- import "../../config";
2
- import { Command } from "@oclif/command";
3
- export default class GetCommand extends Command {
4
- static description: string;
5
- static args: {
6
- name: string;
7
- }[];
8
- run(): Promise<void>;
9
- }
@@ -1,59 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- /*
4
- * Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
5
- * http://github.com/fonoster/fonoster
6
- *
7
- * This file is part of Fonoster
8
- *
9
- * Licensed under the MIT License (the "License");
10
- * you may not use this file except in compliance with
11
- * the License. You may obtain a copy of the License at
12
- *
13
- * https://opensource.org/licenses/MIT
14
- *
15
- * Unless required by applicable law or agreed to in writing, software
16
- * distributed under the License is distributed on an "AS IS" BASIS,
17
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
- * See the License for the specific language governing permissions and
19
- * limitations under the License.
20
- */
21
- require("../../config");
22
- const errors_1 = require("@oclif/errors");
23
- const command_1 = require("@oclif/command");
24
- const core_1 = require("@oclif/core");
25
- const prettyjson_1 = require("prettyjson");
26
- const config_1 = require("../../config");
27
- const Numbers = require("@fonoster/numbers");
28
- const moment = require("moment");
29
- class GetCommand extends command_1.Command {
30
- async run() {
31
- if (!(0, config_1.hasProjectConfig)()) {
32
- throw new errors_1.CLIError("you must set a default project");
33
- }
34
- const { args } = this.parse(GetCommand);
35
- try {
36
- const numbers = new Numbers((0, config_1.getProjectConfig)());
37
- core_1.CliUx.ux.action.start(`Getting number ${args.ref}`);
38
- const number = await numbers.getNumber(args.ref);
39
- const jsonObj = {
40
- Ref: number.ref,
41
- "Provider Ref": number.providerRef,
42
- "E164 Number": number.e164Number,
43
- "Address of Record": number.aorLink ? number.aorLink : "--",
44
- Webhook: number.ingressInfo ? number.ingressInfo.webhook : "--",
45
- Created: moment(number.createTime).fromNow(),
46
- Updated: moment(number.updateTime).fromNow()
47
- };
48
- await core_1.CliUx.ux.wait(1000);
49
- core_1.CliUx.ux.action.stop("");
50
- console.log((0, prettyjson_1.render)(jsonObj, { noColor: true }));
51
- }
52
- catch (e) {
53
- throw new errors_1.CLIError(e.message);
54
- }
55
- }
56
- }
57
- GetCommand.description = "get a Fonoster Number";
58
- GetCommand.args = [{ name: "ref" }];
59
- exports.default = GetCommand;
@@ -1,10 +0,0 @@
1
- import "../../config";
2
- import { Command } from "@oclif/command";
3
- export default class ListCommand extends Command {
4
- static description: string;
5
- static flags: {
6
- size: import("@oclif/parser/lib/flags").IOptionFlag<number>;
7
- };
8
- static aliases: string[];
9
- run(): Promise<void>;
10
- }
@@ -1,100 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- /*
4
- * Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
5
- * http://github.com/fonoster/fonoster
6
- *
7
- * This file is part of Fonoster
8
- *
9
- * Licensed under the MIT License (the "License");
10
- * you may not use this file except in compliance with
11
- * the License. You may obtain a copy of the License at
12
- *
13
- * https://opensource.org/licenses/MIT
14
- *
15
- * Unless required by applicable law or agreed to in writing, software
16
- * distributed under the License is distributed on an "AS IS" BASIS,
17
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
- * See the License for the specific language governing permissions and
19
- * limitations under the License.
20
- */
21
- require("../../config");
22
- const errors_1 = require("@oclif/errors");
23
- const command_1 = require("@oclif/command");
24
- const numbers_1 = require("@fonoster/numbers");
25
- const core_1 = require("@oclif/core");
26
- const config_1 = require("../../config");
27
- const Numbers = require("@fonoster/numbers");
28
- const inquirer = require("inquirer");
29
- class ListCommand extends command_1.Command {
30
- async run() {
31
- if (!(0, config_1.hasProjectConfig)()) {
32
- throw new errors_1.CLIError("you must set a default project");
33
- }
34
- const { flags } = this.parse(ListCommand);
35
- try {
36
- const numbers = new Numbers((0, config_1.getProjectConfig)());
37
- let firstBatch = true;
38
- let pageToken = "1";
39
- const pageSize = flags.size;
40
- const view = numbers_1.CommonPB.View.BASIC;
41
- while (true) {
42
- // Get a list
43
- const result = await numbers.listNumbers({
44
- pageSize,
45
- pageToken,
46
- view
47
- });
48
- const list = result.numbers;
49
- pageToken = result.nextPageToken;
50
- // Dont ask this if is the first time or empty data
51
- if (list.length > 0 && !firstBatch) {
52
- const answer = await inquirer.prompt([
53
- { name: "q", message: "More", type: "confirm" }
54
- ]);
55
- if (!answer.q)
56
- break;
57
- }
58
- if (list.length < 1)
59
- break;
60
- const showTable = (showHeader, data) => {
61
- core_1.CliUx.ux.table(data, {
62
- ref: { minWidth: 15 },
63
- providerRef: { header: "Provider Ref", minWidth: 15 },
64
- e164Number: { header: "E164 Number", minWidth: 15 },
65
- aorLink: {
66
- header: "Address of Record",
67
- minWidth: 15,
68
- get: (row) => (row["aorLink"] ? row["aorLink"] : "--")
69
- },
70
- ingressInfo: {
71
- header: "Webhook",
72
- minWidth: 15,
73
- get: (row) => row["ingressInfo"] ? row["ingressInfo"].webhook : "--"
74
- }
75
- }, { "no-header": !showHeader });
76
- };
77
- showTable(firstBatch, list);
78
- firstBatch = false;
79
- if (!pageToken)
80
- break;
81
- }
82
- }
83
- catch (e) {
84
- throw new errors_1.CLIError(e.message);
85
- }
86
- }
87
- }
88
- ListCommand.description = `list all Fonoster Numbers you have access to
89
- ...
90
- List all Fonoster Numbers you have access to
91
- `;
92
- ListCommand.flags = {
93
- size: command_1.flags.integer({
94
- char: "s",
95
- default: 25,
96
- description: "number of result per page"
97
- })
98
- };
99
- ListCommand.aliases = ["numbers:ls"];
100
- exports.default = ListCommand;
@@ -1,9 +0,0 @@
1
- import "../../config";
2
- import { Command } from "@oclif/command";
3
- export declare class UpdateCommand extends Command {
4
- static description: string;
5
- static args: {
6
- name: string;
7
- }[];
8
- run(): Promise<void>;
9
- }
@@ -1,104 +0,0 @@
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
- exports.UpdateCommand = void 0;
10
- /*
11
- * Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
12
- * http://github.com/fonoster/fonoster
13
- *
14
- * This file is part of Fonoster
15
- *
16
- * Licensed under the MIT License (the "License");
17
- * you may not use this file except in compliance with
18
- * the License. You may obtain a copy of the License at
19
- *
20
- * https://opensource.org/licenses/MIT
21
- *
22
- * Unless required by applicable law or agreed to in writing, software
23
- * distributed under the License is distributed on an "AS IS" BASIS,
24
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25
- * See the License for the specific language governing permissions and
26
- * limitations under the License.
27
- */
28
- require("../../config");
29
- const errors_1 = require("@oclif/errors");
30
- const command_1 = require("@oclif/command");
31
- const core_1 = require("@oclif/core");
32
- const config_1 = require("../../config");
33
- const project_guard_1 = require("../../decorators/project_guard");
34
- const Numbers = require("@fonoster/numbers");
35
- const inquirer = require("inquirer");
36
- class UpdateCommand extends command_1.Command {
37
- async run() {
38
- console.log("This utility will help you update an existing Fonoster Number");
39
- console.log("Press ^C at any time to quit.");
40
- const { args } = this.parse(UpdateCommand);
41
- if (!args.ref) {
42
- core_1.CliUx.ux.action.stop();
43
- throw new errors_1.CLIError("You must provide a Number ref before continuing");
44
- }
45
- const numbers = new Numbers((0, config_1.getProjectConfig)());
46
- const answers = await inquirer.prompt([
47
- {
48
- name: "aorLink",
49
- message: "address of record",
50
- type: "input",
51
- default: null
52
- }
53
- ]);
54
- if (!answers.aorLink) {
55
- const webhookPrompt = await inquirer.prompt([
56
- {
57
- name: "webhook",
58
- message: "webhook",
59
- type: "input",
60
- default: null
61
- }
62
- ]);
63
- answers.ingressInfo = {};
64
- answers.ingressInfo.webhook = webhookPrompt.webhook;
65
- }
66
- const confirmPrompt = await inquirer.prompt([
67
- {
68
- name: "confirm",
69
- message: "ready?",
70
- type: "confirm"
71
- }
72
- ]);
73
- answers.confirm = confirmPrompt.confirm;
74
- answers.ref = args.ref;
75
- if (!answers.confirm) {
76
- console.log("Aborted");
77
- }
78
- else {
79
- try {
80
- const accessDeny = answers.accessDeny;
81
- const accessAllow = answers.accessAllow;
82
- answers.accessDeny = accessDeny ? accessDeny.split(",") : [];
83
- answers.accessAllow = accessAllow ? accessAllow.split(",") : [];
84
- core_1.CliUx.ux.action.start("Updating number");
85
- await numbers.updateNumber(answers);
86
- await core_1.CliUx.ux.wait(1000);
87
- core_1.CliUx.ux.action.stop("Done");
88
- }
89
- catch (e) {
90
- core_1.CliUx.ux.action.stop();
91
- throw new errors_1.CLIError(e.message);
92
- }
93
- }
94
- }
95
- }
96
- UpdateCommand.description = `update a Fonoster Number
97
- ...
98
- Update a Fonoster Number
99
- `;
100
- UpdateCommand.args = [{ name: "ref" }];
101
- __decorate([
102
- (0, project_guard_1.ProjectGuard)()
103
- ], UpdateCommand.prototype, "run", null);
104
- exports.UpdateCommand = UpdateCommand;
@@ -1,6 +0,0 @@
1
- import "../../config";
2
- import { Command } from "@oclif/command";
3
- export default class extends Command {
4
- static description: string;
5
- run(): Promise<void>;
6
- }
@@ -1,75 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- /*
4
- * Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
5
- * http://github.com/fonoster/fonoster
6
- *
7
- * This file is part of Fonoster
8
- *
9
- * Licensed under the MIT License (the "License");
10
- * you may not use this file except in compliance with
11
- * the License. You may obtain a copy of the License at
12
- *
13
- * https://opensource.org/licenses/MIT
14
- *
15
- * Unless required by applicable law or agreed to in writing, software
16
- * distributed under the License is distributed on an "AS IS" BASIS,
17
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
- * See the License for the specific language governing permissions and
19
- * limitations under the License.
20
- */
21
- require("../../config");
22
- const Projects = require("@fonoster/projects");
23
- const errors_1 = require("@oclif/errors");
24
- const command_1 = require("@oclif/command");
25
- const core_1 = require("@oclif/core");
26
- const inquirer = require("inquirer");
27
- class default_1 extends command_1.Command {
28
- async run() {
29
- console.log("This utility will help you create a new Fonoster Project");
30
- console.log("Press ^C at any time to quit.");
31
- const answers = await inquirer.prompt([
32
- {
33
- name: "name",
34
- message: "friendly name",
35
- type: "input"
36
- },
37
- {
38
- name: "allowExperiments",
39
- message: "enable experimental APIs",
40
- type: "confirm"
41
- },
42
- {
43
- name: "confirm",
44
- message: "ready?",
45
- type: "confirm"
46
- }
47
- ]);
48
- if (!answers.confirm) {
49
- console.log("Aborted");
50
- }
51
- else {
52
- try {
53
- core_1.CliUx.ux.action.start(`Creating Project ${answers.name}`);
54
- const projects = new Projects();
55
- const project = await projects.createProject(answers);
56
- await core_1.CliUx.ux.wait(1000);
57
- core_1.CliUx.ux.action.stop(project.ref);
58
- }
59
- catch (e) {
60
- core_1.CliUx.ux.action.stop();
61
- if (e.code === 9) {
62
- throw new errors_1.CLIError("This Project already exist");
63
- }
64
- else {
65
- throw new errors_1.CLIError(e.message);
66
- }
67
- }
68
- }
69
- }
70
- }
71
- default_1.description = `create a new Fonoster Project
72
- ...
73
- Create a new Fonoster Project
74
- `;
75
- exports.default = default_1;
@@ -1,9 +0,0 @@
1
- import Command from "../../base/delete";
2
- export default class extends Command {
3
- static description: string;
4
- static args: {
5
- name: string;
6
- }[];
7
- static aliases: string[];
8
- run(): Promise<void>;
9
- }
@@ -1,9 +0,0 @@
1
- import "../../config";
2
- import { Command } from "@oclif/command";
3
- export default class GetCommand extends Command {
4
- static description: string;
5
- static args: {
6
- name: string;
7
- }[];
8
- run(): Promise<void>;
9
- }
@@ -1,55 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- /*
4
- * Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
5
- * http://github.com/fonoster/fonoster
6
- *
7
- * This file is part of Fonoster
8
- *
9
- * Licensed under the MIT License (the "License");
10
- * you may not use this file except in compliance with
11
- * the License. You may obtain a copy of the License at
12
- *
13
- * https://opensource.org/licenses/MIT
14
- *
15
- * Unless required by applicable law or agreed to in writing, software
16
- * distributed under the License is distributed on an "AS IS" BASIS,
17
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
- * See the License for the specific language governing permissions and
19
- * limitations under the License.
20
- */
21
- require("../../config");
22
- const errors_1 = require("@oclif/errors");
23
- const command_1 = require("@oclif/command");
24
- const core_1 = require("@oclif/core");
25
- const prettyjson_1 = require("prettyjson");
26
- const Projects = require("@fonoster/projects");
27
- const moment = require("moment");
28
- class GetCommand extends command_1.Command {
29
- async run() {
30
- const { args } = this.parse(GetCommand);
31
- try {
32
- const projects = new Projects();
33
- core_1.CliUx.ux.action.start(`Getting Project ${args.ref}`);
34
- const p = await projects.getProject(args.ref);
35
- const jsonObj = {
36
- Name: p.name,
37
- Ref: p.ref,
38
- "Access Key Id": p.accessKeyId,
39
- "Access Key Secret": p.accessKeySecret,
40
- "Allow Experiments": p.allowExperiments,
41
- Created: moment(p.createTime).fromNow(),
42
- Updated: moment(p.updateTime).fromNow()
43
- };
44
- await core_1.CliUx.ux.wait(1000);
45
- core_1.CliUx.ux.action.stop("");
46
- console.log((0, prettyjson_1.render)(jsonObj, { noColor: true }));
47
- }
48
- catch (e) {
49
- throw new errors_1.CLIError(e.message);
50
- }
51
- }
52
- }
53
- GetCommand.description = "get a Fonoster Project";
54
- GetCommand.args = [{ name: "ref" }];
55
- exports.default = GetCommand;
@@ -1,6 +0,0 @@
1
- import { Command } from "@oclif/command";
2
- export default class ListCommand extends Command {
3
- static description: string;
4
- static aliases: string[];
5
- run(): Promise<void>;
6
- }
@@ -1,50 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- /*
4
- * Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
5
- * http://github.com/fonoster/fonoster
6
- *
7
- * This file is part of Fonoster
8
- *
9
- * Licensed under the MIT License (the "License");
10
- * you may not use this file except in compliance with
11
- * the License. You may obtain a copy of the License at
12
- *
13
- * https://opensource.org/licenses/MIT
14
- *
15
- * Unless required by applicable law or agreed to in writing, software
16
- * distributed under the License is distributed on an "AS IS" BASIS,
17
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
- * See the License for the specific language governing permissions and
19
- * limitations under the License.
20
- */
21
- const errors_1 = require("@oclif/errors");
22
- const command_1 = require("@oclif/command");
23
- const core_1 = require("@oclif/core");
24
- const config_1 = require("../../config");
25
- const Projects = require("@fonoster/projects");
26
- class ListCommand extends command_1.Command {
27
- async run() {
28
- try {
29
- const projects = new Projects();
30
- // Gets the list
31
- const result = await projects.listProjects({});
32
- const projs = result.projects?.map((p) => Object.assign(p, {
33
- name: (0, config_1.isDefaultProject)(p.ref) ? `${p.name} *` : p.name
34
- }));
35
- core_1.CliUx.ux.table(projs, {
36
- accessKeyId: { header: "Ref / Access Key Id", minWidth: 30 },
37
- name: { header: "Name", minWidth: 12 }
38
- });
39
- }
40
- catch (e) {
41
- throw new errors_1.CLIError(e.message);
42
- }
43
- }
44
- }
45
- ListCommand.description = `list all Fonoster Projects you have access to
46
- ...
47
- List all Fonoster Projects you have access to
48
- `;
49
- ListCommand.aliases = ["projects:ls"];
50
- exports.default = ListCommand;
@@ -1,9 +0,0 @@
1
- import "../../config";
2
- import { Command } from "@oclif/command";
3
- export default class UpdateCommand extends Command {
4
- static args: {
5
- name: string;
6
- }[];
7
- static description: string;
8
- run(): Promise<void>;
9
- }
@@ -1,47 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- /*
4
- * Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
5
- * http://github.com/fonoster/fonoster
6
- *
7
- * This file is part of Fonoster
8
- *
9
- * Licensed under the MIT License (the "License");
10
- * you may not use this file except in compliance with
11
- * the License. You may obtain a copy of the License at
12
- *
13
- * https://opensource.org/licenses/MIT
14
- *
15
- * Unless required by applicable law or agreed to in writing, software
16
- * distributed under the License is distributed on an "AS IS" BASIS,
17
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
- * See the License for the specific language governing permissions and
19
- * limitations under the License.
20
- */
21
- require("../../config");
22
- const errors_1 = require("@oclif/errors");
23
- const command_1 = require("@oclif/command");
24
- const core_1 = require("@oclif/core");
25
- const Projects = require("@fonoster/projects");
26
- class UpdateCommand extends command_1.Command {
27
- async run() {
28
- const { args } = this.parse(UpdateCommand);
29
- try {
30
- const projects = new Projects();
31
- const project = await projects.renewAccessKeySecret({ ref: args.ref });
32
- core_1.CliUx.ux.action.start(`Renewing credentials for ${args.ref}`);
33
- await core_1.CliUx.ux.wait(1000);
34
- core_1.CliUx.ux.action.stop(project.accessKeySecret);
35
- }
36
- catch (e) {
37
- core_1.CliUx.ux.action.stop();
38
- throw new errors_1.CLIError(e.message);
39
- }
40
- }
41
- }
42
- UpdateCommand.args = [{ name: "ref" }];
43
- UpdateCommand.description = `renew the credentials of a Fonoster Project
44
- ...
45
- Renew the credentials of a Fonoster Project
46
- `;
47
- exports.default = UpdateCommand;
@@ -1,9 +0,0 @@
1
- import "../../config";
2
- import { Command } from "@oclif/command";
3
- export default class UpdateCommand extends Command {
4
- static args: {
5
- name: string;
6
- }[];
7
- static description: string;
8
- run(): Promise<void>;
9
- }