@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,54 +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
- var __importDefault = (this && this.__importDefault) || function (mod) {
9
- return (mod && mod.__esModule) ? mod : { "default": mod };
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- /*
13
- * Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
14
- * http://github.com/fonoster/fonoster
15
- *
16
- * This file is part of Fonoster
17
- *
18
- * Licensed under the MIT License (the "License");
19
- * you may not use this file except in compliance with
20
- * the License. You may obtain a copy of the License at
21
- *
22
- * https://opensource.org/licenses/MIT
23
- *
24
- * Unless required by applicable law or agreed to in writing, software
25
- * distributed under the License is distributed on an "AS IS" BASIS,
26
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
27
- * See the License for the specific language governing permissions and
28
- * limitations under the License.
29
- */
30
- const delete_1 = __importDefault(require("../../base/delete"));
31
- const errors_1 = require("@oclif/errors");
32
- const config_1 = require("../../config");
33
- const project_guard_1 = require("../../decorators/project_guard");
34
- const Apps = require("@fonoster/apps");
35
- class DeleteCommand extends delete_1.default {
36
- async run() {
37
- try {
38
- await super.deleteResource(new Apps((0, config_1.getProjectConfig)()), "deleteApp");
39
- }
40
- catch (e) {
41
- const message = e.code === 9
42
- ? "unable to delete: please ensure no Resource is using this Fonoster Application"
43
- : e.message;
44
- throw new errors_1.CLIError(message);
45
- }
46
- }
47
- }
48
- DeleteCommand.description = "delete a Fonoster Application";
49
- DeleteCommand.args = [{ name: "ref" }];
50
- DeleteCommand.aliases = ["apps:del", "apps:rm"];
51
- __decorate([
52
- (0, project_guard_1.ProjectGuard)()
53
- ], DeleteCommand.prototype, "run", null);
54
- exports.default = DeleteCommand;
@@ -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,107 +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
- /*
10
- * Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
11
- * http://github.com/fonoster/fonoster
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 domains_1 = require("@fonoster/domains");
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 Apps = require("@fonoster/apps");
35
- class ListCommand extends command_1.Command {
36
- async run() {
37
- const { flags } = this.parse(ListCommand);
38
- try {
39
- const apps = new Apps((0, config_1.getProjectConfig)());
40
- let firstBatch = true;
41
- let pageToken = "1";
42
- const pageSize = flags.size;
43
- const view = domains_1.CommonPB.View.BASIC;
44
- // while (true) {
45
- // Get a list
46
- const result = await apps.listApps({ pageSize, pageToken, view });
47
- const list = result.apps;
48
- pageToken = result.nextPageToken;
49
- /**
50
- * @todo Uncomment when pagination is applied in backend.
51
- *
52
- * if (list.length > 0 && !firstBatch) {
53
- const answer: any = await inquirer.prompt([
54
- {name: "q", message: "More", type: "confirm"}
55
- ]);
56
-
57
- if (!answer.q) break;
58
- }
59
- */
60
- // if (list.length < 1) break;
61
- const showTable = (showHeader, data) => {
62
- core_1.CliUx.ux.table(data, {
63
- ref: { minWidth: 15 },
64
- name: { header: "Name", minWidth: 15 },
65
- projectId: {
66
- header: "Project ID",
67
- minWidth: 15,
68
- get: (row) => row.intentsEngineConfig?.projectId || "N/A"
69
- },
70
- voice: {
71
- header: "Voice",
72
- minWidth: 20,
73
- get: (row) => row.speechConfig?.voice || "N/A"
74
- },
75
- welcomeIntentId: {
76
- header: "Welcome Intent ID",
77
- minWidth: 15,
78
- get: (row) => row.intentsEngineConfig?.welcomeIntentId || "N/A"
79
- }
80
- }, { "no-header": !showHeader });
81
- };
82
- showTable(firstBatch, list);
83
- firstBatch = false;
84
- // if (!pageToken) break;
85
- // }
86
- }
87
- catch (e) {
88
- throw new errors_1.CLIError(e.message);
89
- }
90
- }
91
- }
92
- ListCommand.description = `list all Fonoster Apps you have access to
93
- ...
94
- List all Fonoster Apps you have access to
95
- `;
96
- ListCommand.flags = {
97
- size: command_1.flags.integer({
98
- char: "s",
99
- default: 25,
100
- description: "number of result per page"
101
- })
102
- };
103
- ListCommand.aliases = ["apps:ls"];
104
- __decorate([
105
- (0, project_guard_1.ProjectGuard)()
106
- ], ListCommand.prototype, "run", null);
107
- 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,235 +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
- /*
10
- * Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
11
- * http://github.com/fonoster/fonoster
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 errors_1 = require("@oclif/errors");
29
- const command_1 = require("@oclif/command");
30
- const core_1 = require("@oclif/core");
31
- const config_1 = require("../../config");
32
- const project_guard_1 = require("../../decorators/project_guard");
33
- const voices_1 = require("../../data/voices");
34
- const Apps = require("@fonoster/apps");
35
- const Secrets = require("@fonoster/secrets");
36
- const inquirer = require("inquirer");
37
- const validator = (value, message = "This field is required") => Boolean(value?.trim()?.length) || message;
38
- class UpdateCommand extends command_1.Command {
39
- async run() {
40
- try {
41
- const { args } = this.parse(UpdateCommand);
42
- if (!args.ref)
43
- throw new errors_1.CLIError("Please provide the reference of your Fonoster Application");
44
- const { secrets: response } = await new Secrets((0, config_1.getProjectConfig)()).listSecrets({
45
- pageSize: 25,
46
- pageToken: "1"
47
- });
48
- const secrets = response.map(({ name }) => name) || [];
49
- const appsManager = new Apps((0, config_1.getProjectConfig)());
50
- const app = await appsManager.getApp(args.ref);
51
- if (!app)
52
- throw new errors_1.CLIError("App not found");
53
- const answers = await inquirer.prompt([
54
- {
55
- name: "name",
56
- message: "Application Name",
57
- type: "input",
58
- default: app.name,
59
- validate: (value) => validator(value, "You must enter a name for your Application, try something friendly.")
60
- },
61
- {
62
- name: "speechConfig.voice",
63
- message: "Voice name",
64
- type: "list",
65
- default: app.speechConfig.voice,
66
- choices: voices_1.voices,
67
- validate: (value) => validator(value, "You must select a voice")
68
- },
69
- {
70
- name: "speechConfig.secretName",
71
- message: "Speech Config Secret",
72
- type: "list",
73
- choices: secrets,
74
- default: app.speechConfig.secretName,
75
- validate: (value) => validator(value, "You must select a Secret")
76
- },
77
- {
78
- name: "intentsEngineConfig.welcomeIntentId",
79
- message: "Type the welcome intent ID (e.g. WELCOME)",
80
- type: "input",
81
- default: app.intentsEngineConfig.welcomeIntentId
82
- },
83
- {
84
- name: "engine",
85
- message: "Select Intents Engine Type",
86
- type: "list",
87
- choices: ["DialogflowES"],
88
- validate: (value) => validator(value, "You must select a engine")
89
- },
90
- {
91
- name: "intentsEngineConfig.projectId",
92
- message: "Type a project ID",
93
- type: "input",
94
- default: app.intentsEngineConfig.projectId,
95
- validate: (value) => validator(value, "You must enter a project ID for your Application.")
96
- },
97
- {
98
- name: "intentsEngineConfig.secretName",
99
- message: "Intents Engine Secret",
100
- type: "list",
101
- choices: secrets,
102
- default: app.intentsEngineConfig.secretName,
103
- validate: (value) => validator(value, "You must select a Secret")
104
- },
105
- // Disabled until we add support for DialogFlow CX
106
- /*
107
- {
108
- name: "intentsEngineConfig.agent",
109
- message: "Type a agent",
110
- type: "input",
111
- default: app.intentsEngineConfig.agent,
112
- when: (answers) => answers.engine === "DialogflowES",
113
- validate: (value: string) =>
114
- validator(value, "You must enter a agent for your Application.")
115
- },
116
- {
117
- name: "intentsEngineConfig.location",
118
- message: "Type a location",
119
- type: "input",
120
- default: app.intentsEngineConfig.location,
121
- when: (answers) => answers.engine === "DialogflowES",
122
- validate: (value: string) =>
123
- validator(value, "You must enter a location for your Application.")
124
- },
125
- */
126
- {
127
- name: "showAdvanceOptions",
128
- message: "Show advance options?",
129
- type: "confirm",
130
- default: true
131
- },
132
- {
133
- name: "initialDtmf",
134
- message: "Initial DTMF (optional)",
135
- type: "input",
136
- default: app.initialDtmf,
137
- when: (answers) => answers.showAdvanceOptions,
138
- validate: (value) => {
139
- const regex = /^[0-9*#]*$/;
140
- if (value && !regex.test(value)) {
141
- return "You must enter a valid DTMF. It’s a string that allows 1234567890#*";
142
- }
143
- return true;
144
- }
145
- },
146
- {
147
- name: "enableEvents",
148
- message: "Enable Events",
149
- type: "confirm",
150
- default: app.enableEvents,
151
- when: (answers) => answers.showAdvanceOptions
152
- },
153
- {
154
- name: "activationIntentId",
155
- message: "Type the activation intent ID (optional)",
156
- type: "input",
157
- default: app.activationIntentId,
158
- when: (answers) => answers.showAdvanceOptions
159
- },
160
- {
161
- name: "activationTimeout",
162
- message: "Type the activation timeout (e.g. 15000)",
163
- type: "input",
164
- default: app.activationTimeout,
165
- when: (answers) => answers.showAdvanceOptions,
166
- validate: (value) => {
167
- const regex = /^[0-9]*$/;
168
- if (value && !regex.test(value)) {
169
- return "You must enter a valid timeout. It’s a number in milliseconds";
170
- }
171
- return true;
172
- }
173
- },
174
- {
175
- name: "interactionTimeout",
176
- message: "Type the interaction timeout (e.g. 10000)",
177
- type: "input",
178
- default: app.interactionTimeout,
179
- when: (answers) => answers.showAdvanceOptions,
180
- validate: (value) => {
181
- const regex = /^[0-9]*$/;
182
- if (value && !regex.test(value)) {
183
- return "You must enter a valid timeout. It’s a number in milliseconds";
184
- }
185
- return true;
186
- }
187
- },
188
- {
189
- name: "transferConfig.message",
190
- message: "Type a transfer message (e.g. Please wait while we transfer you)",
191
- type: "input",
192
- default: app.transferConfig.message,
193
- when: (answers) => answers.showAdvanceOptions
194
- },
195
- {
196
- name: "intentsEngineConfig.emulateTelephonyPlatform",
197
- message: "Emulate Telephony Platform",
198
- type: "confirm",
199
- default: app.intentsEngineConfig.emulateTelephonyPlatform,
200
- when: (answers) => answers.showAdvanceOptions
201
- }
202
- ]);
203
- const confirmPrompt = await inquirer.prompt([
204
- {
205
- name: "confirm",
206
- message: "Ready to update your App?",
207
- type: "confirm"
208
- }
209
- ]);
210
- if (!confirmPrompt.confirm)
211
- return console.log("Aborted");
212
- core_1.CliUx.ux.action.start(`Updating App ${answers.name}`);
213
- const apps = new Apps((0, config_1.getProjectConfig)());
214
- delete answers.showAdvanceOptions;
215
- delete answers.engine;
216
- answers.ref = args.ref;
217
- const result = await apps.updateApp(answers);
218
- await core_1.CliUx.ux.wait(1000);
219
- core_1.CliUx.ux.action.stop(`App ${result.ref} updated`);
220
- }
221
- catch (e) {
222
- core_1.CliUx.ux.action.stop();
223
- throw new errors_1.CLIError(e.code === 9 ? "This App already exist" : e.message);
224
- }
225
- }
226
- }
227
- UpdateCommand.args = [{ name: "ref" }];
228
- UpdateCommand.description = `update a new Fonoster App
229
- ...
230
- Update a new Fonoster App
231
- `;
232
- __decorate([
233
- (0, project_guard_1.ProjectGuard)()
234
- ], UpdateCommand.prototype, "run", null);
235
- exports.default = 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,84 +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 config_1 = require("../../config");
26
- const Projects = require("@fonoster/projects");
27
- const inquirer = require("inquirer");
28
- class default_1 extends command_1.Command {
29
- async run() {
30
- console.log("Access your Fonoster infrastructure");
31
- console.log("Press ^C at any time to quit.");
32
- const answers = await inquirer.prompt([
33
- {
34
- name: "endpoint",
35
- message: "api endpoint",
36
- type: "input",
37
- default: "api.fonoster.io"
38
- },
39
- {
40
- name: "accessKeyId",
41
- message: "access key id",
42
- type: "input"
43
- },
44
- {
45
- name: "accessKeySecret",
46
- message: "access key token",
47
- mask: true,
48
- type: "password"
49
- },
50
- {
51
- name: "confirm",
52
- message: "ready?",
53
- type: "confirm"
54
- }
55
- ]);
56
- if (!answers.confirm) {
57
- console.log("Aborted");
58
- }
59
- else {
60
- try {
61
- core_1.CliUx.ux.action.start(`Accessing endpoint ${answers.endpoint}`);
62
- try {
63
- const projects = new Projects(answers);
64
- await projects.listProjects();
65
- answers.confirm = void 0;
66
- (0, config_1.setConfig)(answers);
67
- await core_1.CliUx.ux.wait(1000);
68
- core_1.CliUx.ux.action.stop("Done");
69
- }
70
- catch (e) {
71
- console.error(e.message);
72
- await core_1.CliUx.ux.wait(1000);
73
- core_1.CliUx.ux.action.stop("Invalid credentials or endpoint");
74
- }
75
- }
76
- catch (e) {
77
- core_1.CliUx.ux.action.stop();
78
- throw new errors_1.CLIError(e.message);
79
- }
80
- }
81
- }
82
- }
83
- default_1.description = "log in to a Fonoster deployment";
84
- exports.default = default_1;
@@ -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,46 +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 path_1 = require("path");
26
- const os_1 = require("os");
27
- const BASE_DIR = (0, path_1.join)((0, os_1.homedir)(), ".fonoster");
28
- const fs = require("fs");
29
- class default_1 extends command_1.Command {
30
- async run() {
31
- core_1.CliUx.ux.action.start(`Login out`);
32
- if (fs.existsSync(BASE_DIR)) {
33
- try {
34
- fs.rmSync(BASE_DIR, { recursive: true });
35
- await core_1.CliUx.ux.wait(1000);
36
- }
37
- catch (e) {
38
- core_1.CliUx.ux.action.stop();
39
- throw new errors_1.CLIError(e.message);
40
- }
41
- }
42
- core_1.CliUx.ux.action.stop("Done");
43
- }
44
- }
45
- default_1.description = "log out from a fonoster deployment";
46
- exports.default = default_1;
@@ -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,33 +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 core_1 = require("@oclif/core");
23
- const command_1 = require("@oclif/command");
24
- class default_1 extends command_1.Command {
25
- async run() {
26
- await core_1.CliUx.ux.open("https://github.com/fonoster/fonoster/issues/new?assignees=&labels=&template=bug_report.md&title=");
27
- }
28
- }
29
- default_1.description = `start a bug report 🐞
30
- ...
31
- Opens github issues with a predefine bug template
32
- `;
33
- exports.default = default_1;
@@ -1,6 +0,0 @@
1
- import "../../config";
2
- import { Command } from "@oclif/command";
3
- export default class CreateCommand extends Command {
4
- static description: string;
5
- run(): Promise<void>;
6
- }