@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
package/bin/run.js ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+
3
+ // eslint-disable-next-line unicorn/prefer-top-level-await
4
+ (async () => {
5
+ const oclif = await import('@oclif/core')
6
+ await oclif.execute({dir: __dirname})
7
+ })()
@@ -0,0 +1,6 @@
1
+ import { Command } from "@oclif/core";
2
+ export default class AuthLogin extends Command {
3
+ static description: string;
4
+ static examples: string[];
5
+ run(): Promise<void>;
6
+ }
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ /* eslint-disable import/no-unresolved */
13
+ /*
14
+ * Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
15
+ * http://github.com/fonoster/fonoster
16
+ *
17
+ * This file is part of Fonoster
18
+ *
19
+ * Licensed under the MIT License (the "License");
20
+ * you may not use this file except in compliance with
21
+ * the License. You may obtain a copy of the License at
22
+ *
23
+ * https://opensource.org/licenses/MIT
24
+ *
25
+ * Unless required by applicable law or agreed to in writing, software
26
+ * distributed under the License is distributed on an "AS IS" BASIS,
27
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
28
+ * See the License for the specific language governing permissions and
29
+ * limitations under the License.
30
+ */
31
+ const sdk_1 = require("@fonoster/sdk");
32
+ const prompts_1 = require("@inquirer/prompts");
33
+ const core_1 = require("@oclif/core");
34
+ const config_1 = require("../../config");
35
+ const saveConfig_1 = require("../../config/saveConfig");
36
+ const constants_1 = require("../../constants");
37
+ class AuthLogin extends core_1.Command {
38
+ run() {
39
+ return __awaiter(this, void 0, void 0, function* () {
40
+ this.log("This utility will help you link to a Workspace.");
41
+ this.log("Press ^C at any time to quit.");
42
+ const answers = {
43
+ endpoint: yield (0, prompts_1.input)({
44
+ message: "Endpoint",
45
+ default: "api.fonoster.dev"
46
+ }),
47
+ accessKeyId: yield (0, prompts_1.input)({
48
+ message: "Access Key Id",
49
+ required: true
50
+ }),
51
+ accessKeySecret: yield (0, prompts_1.password)({
52
+ message: "Access Key Secret"
53
+ }),
54
+ confirm: yield (0, prompts_1.confirm)({
55
+ message: "Ready?"
56
+ })
57
+ };
58
+ if (!answers.confirm) {
59
+ this.log("Aborted!");
60
+ return;
61
+ }
62
+ // Get Workspace configuration (which validates the login)
63
+ const client = new sdk_1.Client({
64
+ endpoint: answers.endpoint,
65
+ accessKeyId: answers.accessKeyId,
66
+ allowInsecure: true
67
+ });
68
+ yield client.loginWithApiKey(answers.accessKeySecret);
69
+ this.log("Saving configuration...");
70
+ const config = (0, config_1.getConfig)(constants_1.CONFIG_FILE);
71
+ const answerWithoutConfirm = Object.assign(Object.assign({}, answers), { confirm: undefined });
72
+ const updatedConfig = (0, config_1.addWorkspace)(answerWithoutConfirm, config);
73
+ (0, saveConfig_1.saveConfig)(constants_1.CONFIG_FILE, updatedConfig);
74
+ this.log("Done!");
75
+ });
76
+ }
77
+ }
78
+ AuthLogin.description = "log in to a Fonoster deployment";
79
+ AuthLogin.examples = ["<%= config.bin %> <%= command.id %>"];
80
+ exports.default = AuthLogin;
@@ -0,0 +1,3 @@
1
+ import { WorkspaceConfig } from "./types";
2
+ declare function addWorkspace(config: WorkspaceConfig, workspaces: WorkspaceConfig[]): WorkspaceConfig[];
3
+ export { addWorkspace };
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addWorkspace = addWorkspace;
4
+ function addWorkspace(config, workspaces) {
5
+ const workspaceIndex = workspaces.findIndex((workspace) => workspace.workspaceRef === config.workspaceRef);
6
+ if (workspaceIndex === -1) {
7
+ return workspaces.concat(Object.assign(Object.assign({}, config), { active: true }));
8
+ }
9
+ workspaces[workspaceIndex] = Object.assign(Object.assign({}, config), { active: true });
10
+ }
@@ -0,0 +1,3 @@
1
+ import { WorkspaceConfig } from "./types";
2
+ declare function getConfig(path: string): WorkspaceConfig[];
3
+ export { getConfig };
@@ -3,8 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getConfig = getConfig;
6
7
  /*
7
- * Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
8
+ * Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
8
9
  * http://github.com/fonoster/fonoster
9
10
  *
10
11
  * This file is part of Fonoster
@@ -21,18 +22,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
21
22
  * See the License for the specific language governing permissions and
22
23
  * limitations under the License.
23
24
  */
24
- const delete_1 = __importDefault(require("../../base/delete"));
25
- const Projects = require("@fonoster/projects");
26
- const config_1 = require("../../config");
27
- class default_1 extends delete_1.default {
28
- async run() {
29
- await super.deleteResource(new Projects(), "deleteProject");
30
- if ((0, config_1.isDefaultProject)(this.ref)) {
31
- (0, config_1.unsetDefaultProject)();
32
- }
25
+ const fs_1 = __importDefault(require("fs"));
26
+ // import { workspaceConfigSchema } from "./validations";
27
+ function getConfig(path) {
28
+ if (!fs_1.default.existsSync(path)) {
29
+ return [];
33
30
  }
31
+ const data = fs_1.default.readFileSync(path, "utf8");
32
+ // workspaceConfigSchema.parse(config);
33
+ return JSON.parse(data);
34
34
  }
35
- default_1.description = "delete a Fonoster Project";
36
- default_1.args = [{ name: "ref" }];
37
- default_1.aliases = ["projects:del", "projects:rm"];
38
- exports.default = default_1;
@@ -0,0 +1,3 @@
1
+ import { WorkspaceConfig } from "./types";
2
+ declare function getCurrentWorkspace(workspaces: WorkspaceConfig[]): string;
3
+ export { getCurrentWorkspace };
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCurrentWorkspace = getCurrentWorkspace;
4
+ function getCurrentWorkspace(workspaces) {
5
+ const workspace = workspaces.find((w) => w.active === true);
6
+ if (!workspace) {
7
+ throw new Error("No active workspace found");
8
+ }
9
+ return `Current Workspace: ${workspace.workspaceName} (${workspace.workspaceRef})`;
10
+ }
@@ -0,0 +1,7 @@
1
+ export * from "./addWorkspace";
2
+ export * from "./getConfig";
3
+ export * from "./getCurrentWorkspace";
4
+ export * from "./removeWorkspace";
5
+ export * from "./saveConfig";
6
+ export * from "./setCurrentWorkspace";
7
+ export * from "./types";
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ /*
18
+ * Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
19
+ * http://github.com/fonoster/fonoster
20
+ *
21
+ * This file is part of Fonoster
22
+ *
23
+ * Licensed under the MIT License (the "License");
24
+ * you may not use this file except in compliance with
25
+ * the License. You may obtain a copy of the License at
26
+ *
27
+ * https://opensource.org/licenses/MIT
28
+ *
29
+ * Unless required by applicable law or agreed to in writing, software
30
+ * distributed under the License is distributed on an "AS IS" BASIS,
31
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
32
+ * See the License for the specific language governing permissions and
33
+ * limitations under the License.
34
+ */
35
+ __exportStar(require("./addWorkspace"), exports);
36
+ __exportStar(require("./getConfig"), exports);
37
+ __exportStar(require("./getCurrentWorkspace"), exports);
38
+ __exportStar(require("./removeWorkspace"), exports);
39
+ __exportStar(require("./saveConfig"), exports);
40
+ __exportStar(require("./setCurrentWorkspace"), exports);
41
+ __exportStar(require("./types"), exports);
@@ -0,0 +1,3 @@
1
+ import { WorkspaceConfig } from "./types";
2
+ declare function removeWorkspace(ref: string, workspaces: WorkspaceConfig[]): WorkspaceConfig[];
3
+ export { removeWorkspace };
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.removeWorkspace = removeWorkspace;
4
+ function removeWorkspace(ref, workspaces) {
5
+ return workspaces.filter((w) => w.workspaceRef !== ref);
6
+ }
@@ -0,0 +1,3 @@
1
+ import { WorkspaceConfig } from "./types";
2
+ declare function saveConfig(path: string, config: WorkspaceConfig[]): void;
3
+ export { saveConfig };
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.saveConfig = saveConfig;
3
7
  /*
4
- * Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
8
+ * Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
5
9
  * http://github.com/fonoster/fonoster
6
10
  *
7
11
  * This file is part of Fonoster
@@ -18,16 +22,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
18
22
  * See the License for the specific language governing permissions and
19
23
  * limitations under the License.
20
24
  */
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://docs.google.com/forms/d/e/1FAIpQLSd1G2ahRYqkbksOvz7XhNHfSLepUh3KzRHsXh2HXfZr68nhtQ/viewform?vc=0&c=0&w=1&flr=0");
25
+ const fs_1 = __importDefault(require("fs"));
26
+ const constants_1 = require("../constants");
27
+ function saveConfig(path, config) {
28
+ if (!fs_1.default.existsSync(constants_1.BASE_DIR)) {
29
+ fs_1.default.mkdirSync(constants_1.BASE_DIR, { recursive: true });
27
30
  }
31
+ fs_1.default.writeFileSync(path, JSON.stringify(config, null, 2));
28
32
  }
29
- default_1.description = `let us know how we're doing
30
- ...
31
- Help us improve by providing some feedback
32
- `;
33
- exports.default = default_1;
@@ -0,0 +1,3 @@
1
+ import { WorkspaceConfig } from "./types";
2
+ declare function setCurrentWorkspace(ref: string, workspaces: WorkspaceConfig[]): WorkspaceConfig[];
3
+ export { setCurrentWorkspace };
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setCurrentWorkspace = setCurrentWorkspace;
4
+ function setCurrentWorkspace(ref, workspaces) {
5
+ return workspaces.map((w) => {
6
+ if (w.workspaceRef === ref) {
7
+ return Object.assign(Object.assign({}, w), { active: true });
8
+ }
9
+ return Object.assign(Object.assign({}, w), { active: false });
10
+ });
11
+ }
@@ -0,0 +1,4 @@
1
+ import { z } from "zod";
2
+ import { workspaceConfigSchema } from "./validations";
3
+ type WorkspaceConfig = z.infer<typeof workspaceConfigSchema>;
4
+ export type { WorkspaceConfig };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,24 @@
1
+ import { z } from "zod";
2
+ declare const workspaceConfigSchema: z.ZodObject<{
3
+ endpoint: z.ZodString;
4
+ accessKeyId: z.ZodString;
5
+ accessKeySecret: z.ZodString;
6
+ workspaceRef: z.ZodString;
7
+ workspaceName: z.ZodString;
8
+ active: z.ZodOptional<z.ZodBoolean>;
9
+ }, "strip", z.ZodTypeAny, {
10
+ endpoint?: string;
11
+ accessKeyId?: string;
12
+ accessKeySecret?: string;
13
+ workspaceRef?: string;
14
+ workspaceName?: string;
15
+ active?: boolean;
16
+ }, {
17
+ endpoint?: string;
18
+ accessKeyId?: string;
19
+ accessKeySecret?: string;
20
+ workspaceRef?: string;
21
+ workspaceName?: string;
22
+ active?: boolean;
23
+ }>;
24
+ export { workspaceConfigSchema };
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.run = void 0;
3
+ exports.workspaceConfigSchema = void 0;
4
4
  /*
5
- * Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
5
+ * Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
6
6
  * http://github.com/fonoster/fonoster
7
7
  *
8
8
  * This file is part of Fonoster
@@ -19,5 +19,13 @@ exports.run = void 0;
19
19
  * See the License for the specific language governing permissions and
20
20
  * limitations under the License.
21
21
  */
22
- var command_1 = require("@oclif/command");
23
- Object.defineProperty(exports, "run", { enumerable: true, get: function () { return command_1.run; } });
22
+ const zod_1 = require("zod");
23
+ const workspaceConfigSchema = zod_1.z.object({
24
+ endpoint: zod_1.z.string().min(1, "The endpoint value is required"),
25
+ accessKeyId: zod_1.z.string().min(1, "The accessKeyId value is required"),
26
+ accessKeySecret: zod_1.z.string().min(1, "The accessKeySecret value is required"),
27
+ workspaceRef: zod_1.z.string().min(1, "The workspaceRef value is required"),
28
+ workspaceName: zod_1.z.string().min(1, "The workspaceName value is required"),
29
+ active: zod_1.z.boolean().optional()
30
+ });
31
+ exports.workspaceConfigSchema = workspaceConfigSchema;
@@ -0,0 +1,3 @@
1
+ export declare const BASE_DIR: string;
2
+ export declare const CONFIG_FILE: string;
3
+ export declare const WORKSPACE_ENDPOINT = "api.fonoster.dev";
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toPascalCase = void 0;
3
+ exports.WORKSPACE_ENDPOINT = exports.CONFIG_FILE = exports.BASE_DIR = void 0;
4
4
  /*
5
- * Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
5
+ * Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
6
6
  * http://github.com/fonoster/fonoster
7
7
  *
8
8
  * This file is part of Fonoster
@@ -19,11 +19,8 @@ exports.toPascalCase = void 0;
19
19
  * See the License for the specific language governing permissions and
20
20
  * limitations under the License.
21
21
  */
22
- function toPascalCase(str) {
23
- return str
24
- .replace(/(?:^\w|[A-Z]|\b\w)/g, function (word, index) {
25
- return index === 0 ? word.toUpperCase() : word.toLowerCase();
26
- })
27
- .replace(/\s+/g, "");
28
- }
29
- exports.toPascalCase = toPascalCase;
22
+ const os_1 = require("os");
23
+ const path_1 = require("path");
24
+ exports.BASE_DIR = (0, path_1.join)((0, os_1.homedir)(), ".fonoster");
25
+ exports.CONFIG_FILE = (0, path_1.join)((0, os_1.homedir)(), ".fonoster", "config.json");
26
+ exports.WORKSPACE_ENDPOINT = "api.fonoster.dev";
package/package.json CHANGED
@@ -1,49 +1,25 @@
1
1
  {
2
2
  "name": "@fonoster/ctl",
3
- "version": "0.4.8",
4
- "description": "Command-Line for Fonoster",
3
+ "version": "0.7.37",
4
+ "description": "Fonoster Command Line Interface",
5
5
  "author": "Pedro Sanders <psanders@fonoster.com>",
6
6
  "homepage": "https://github.com/fonoster/fonoster#readme",
7
7
  "license": "MIT",
8
- "main": "dist/index.js",
9
- "types": "dist/index.js",
10
- "bin": {
11
- "fonoster": "./bin/run"
12
- },
13
- "engines": {
14
- "node": ">=14.16.0"
8
+ "main": "dist/index",
9
+ "types": "dist/index",
10
+ "directories": {
11
+ "src": "src",
12
+ "test": "test"
15
13
  },
16
14
  "scripts": {
17
15
  "prebuild": "rimraf ./dist tsconfig.tsbuildinfo",
18
- "build": "tsc -b tsconfig.json"
19
- },
20
- "directories": {
21
- "src": "src",
22
- "test": "test",
23
- "bin": "bin"
16
+ "build": "tsc -b tsconfig.json",
17
+ "clean": "rimraf ./dist node_modules tsconfig.tsbuildinfo",
18
+ "generate:readme": "node ../../.scripts/gen-readme.js"
24
19
  },
25
20
  "files": [
26
- "/bin",
27
- "/npm-shrinkwrap.json",
28
- "/oclif.manifest.json",
29
- "/dist"
21
+ "dist"
30
22
  ],
31
- "oclif": {
32
- "commands": "./dist/commands",
33
- "helpClass": "./dist/help",
34
- "bin": "fonoster",
35
- "plugins": [
36
- "@oclif/plugin-help",
37
- "@oclif/plugin-plugins",
38
- "@oclif/plugin-not-found",
39
- "@fonoster/plugin-warn-if-update-available"
40
- ],
41
- "warn-if-update-available": {
42
- "timeoutInDays": 1,
43
- "nagTimeoutInDays": 1,
44
- "message": "\n <%= config.name %> update available from <%= chalk.greenBright(config.version) %> to <%= chalk.greenBright(latest) %>."
45
- }
46
- },
47
23
  "publishConfig": {
48
24
  "access": "public"
49
25
  },
@@ -54,36 +30,25 @@
54
30
  "bugs": {
55
31
  "url": "https://github.com/fonoster/fonoster/issues"
56
32
  },
33
+ "gitHead": "b9696f512b3abfd6a798045b16ed9f102d58b11a",
34
+ "bin": {
35
+ "fonoster": "./bin/run.js"
36
+ },
37
+ "oclif": {
38
+ "bin": "fonoster",
39
+ "commands": "./dist/commands",
40
+ "dirname": "fonoster",
41
+ "topicSeparator": ":"
42
+ },
57
43
  "dependencies": {
58
- "@fonoster/agents": "^0.4.8",
59
- "@fonoster/apps": "^0.4.8",
60
- "@fonoster/domains": "^0.4.8",
61
- "@fonoster/logger": "^0.4.7",
62
- "@fonoster/numbers": "^0.4.8",
63
- "@fonoster/plugin-warn-if-update-available": "github:fonoster/plugin-warn-if-update-available",
64
- "@fonoster/projects": "^0.4.8",
65
- "@fonoster/providers": "^0.4.8",
66
- "@fonoster/secrets": "^0.4.8",
67
- "@oclif/command": "^1.8.16",
68
- "@oclif/config": "^1.18.3",
69
- "@oclif/core": "^1.3.4",
70
- "@oclif/errors": "^1.3.5",
71
- "@oclif/plugin-help": "^3.3.1",
72
- "@oclif/plugin-not-found": "^2.3.1",
73
- "@oclif/plugin-plugins": "^2.1.0",
74
- "easy-table": "^1.2.0",
75
- "figlet": "^1.5.2",
76
- "get-stdin-with-tty": "^6.0.0",
77
- "inquirer": "^7.3.3",
78
- "moment": "^2.29.4",
79
- "phone": "^2.4.22",
80
- "prettyjson": "^1.2.5",
81
- "update-notifier": "^6.0.2"
44
+ "@fonoster/sdk": "^0.7.37",
45
+ "@fonoster/websdk": "^0.4.13",
46
+ "@inquirer/prompts": "^7.1.0",
47
+ "@oclif/core": "^4.0.34",
48
+ "zod": "^3.23.8"
82
49
  },
83
50
  "devDependencies": {
84
- "@types/inquirer": "^9.0.3",
85
- "@types/prettyjson": "0.0.29",
86
- "rimraf": "^3.0.2"
87
- },
88
- "gitHead": "e594d9c289ce814090b8133d3efb03561cfa7598"
51
+ "@types/node": "^18.19.67",
52
+ "ts-node": "^10.9.2"
53
+ }
89
54
  }
package/bin/run DELETED
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- require('@oclif/command').run()
4
- .then(require('@oclif/command/flush'))
5
- .catch(require('@oclif/errors/handle'))
package/bin/run.cmd DELETED
@@ -1,3 +0,0 @@
1
- @echo off
2
-
3
- node "%~dp0\run" %*
@@ -1,9 +0,0 @@
1
- import "../config";
2
- import Command from "@oclif/command";
3
- export default abstract class extends Command {
4
- ref: string;
5
- deleteResource(API: any, funcName: string): Promise<void>;
6
- init(): Promise<void>;
7
- catch(err: any): Promise<any>;
8
- finally(err: any): Promise<any>;
9
- }
@@ -1,50 +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
- require("../config");
25
- const command_1 = __importDefault(require("@oclif/command"));
26
- const core_1 = require("@oclif/core");
27
- const errors_1 = require("@oclif/errors");
28
- class default_1 extends command_1.default {
29
- async deleteResource(API, funcName) {
30
- if (!this.ref) {
31
- core_1.CliUx.ux.action.stop();
32
- throw new errors_1.CLIError("You must provide a resource ref before continuing");
33
- }
34
- core_1.CliUx.ux.action.start(`Deleting resource ${this.ref}`);
35
- const results = await API[funcName](this.ref);
36
- await core_1.CliUx.ux.wait(1000);
37
- core_1.CliUx.ux.action.stop(results ? "Done" : "Failed");
38
- }
39
- async init() {
40
- const { args } = this.parse(this.constructor);
41
- this.ref = args.ref;
42
- }
43
- async catch(err) {
44
- return super.catch(err);
45
- }
46
- async finally(err) {
47
- return super.finally(err);
48
- }
49
- }
50
- 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
- }