@fonoster/ctl 0.27.0 → 0.30.0

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 (63) hide show
  1. package/README.md +586 -88
  2. package/dist/AuthenticatedCommand.d.ts +5 -0
  3. package/dist/AuthenticatedCommand.js +12 -1
  4. package/dist/commands/applications/create.d.ts +23 -0
  5. package/dist/commands/applications/create.js +68 -169
  6. package/dist/commands/applications/eval.d.ts +1 -1
  7. package/dist/commands/applications/eval.js +46 -33
  8. package/dist/commands/applications/get.d.ts +2 -0
  9. package/dist/commands/applications/get.js +55 -24
  10. package/dist/commands/applications/list.js +19 -3
  11. package/dist/commands/applications/rotate-secret.d.ts +9 -0
  12. package/dist/commands/applications/rotate-secret.js +97 -0
  13. package/dist/commands/applications/update.d.ts +22 -1
  14. package/dist/commands/applications/update.js +17 -168
  15. package/dist/commands/providers/catalog.d.ts +10 -0
  16. package/dist/commands/providers/catalog.js +128 -0
  17. package/dist/commands/providers/keys/delete.d.ts +9 -0
  18. package/dist/commands/providers/keys/delete.js +92 -0
  19. package/dist/commands/providers/keys/list.d.ts +6 -0
  20. package/dist/commands/providers/keys/list.js +97 -0
  21. package/dist/commands/providers/keys/set.d.ts +12 -0
  22. package/dist/commands/providers/keys/set.js +110 -0
  23. package/dist/commands/records/download.d.ts +15 -0
  24. package/dist/commands/records/download.js +132 -0
  25. package/dist/commands/records/get.d.ts +15 -0
  26. package/dist/commands/records/get.js +146 -0
  27. package/dist/commands/records/list.d.ts +15 -0
  28. package/dist/commands/records/list.js +136 -0
  29. package/dist/commands/sipnet/calls/create.d.ts +3 -3
  30. package/dist/commands/sipnet/calls/create.js +35 -52
  31. package/dist/commands/webhooks/create.d.ts +10 -0
  32. package/dist/commands/webhooks/create.js +104 -0
  33. package/dist/commands/webhooks/delete.d.ts +9 -0
  34. package/dist/commands/webhooks/delete.js +92 -0
  35. package/dist/commands/webhooks/deliveries.d.ts +12 -0
  36. package/dist/commands/webhooks/deliveries.js +119 -0
  37. package/dist/commands/webhooks/get.d.ts +9 -0
  38. package/dist/commands/webhooks/get.js +110 -0
  39. package/dist/commands/webhooks/list.d.ts +9 -0
  40. package/dist/commands/webhooks/list.js +104 -0
  41. package/dist/commands/webhooks/resend.d.ts +9 -0
  42. package/dist/commands/webhooks/resend.js +95 -0
  43. package/dist/commands/webhooks/rotate.d.ts +9 -0
  44. package/dist/commands/webhooks/rotate.js +98 -0
  45. package/dist/commands/webhooks/update.d.ts +13 -0
  46. package/dist/commands/webhooks/update.js +103 -0
  47. package/dist/commands/workspaces/login.d.ts +5 -0
  48. package/dist/commands/workspaces/login.js +27 -1
  49. package/dist/utils/applicationFlags.d.ts +25 -0
  50. package/dist/utils/applicationFlags.js +95 -0
  51. package/dist/utils/applicationRequest.d.ts +43 -0
  52. package/dist/utils/applicationRequest.js +209 -0
  53. package/dist/utils/createOrUpdateApplication.d.ts +26 -1
  54. package/dist/utils/createOrUpdateApplication.js +23 -27
  55. package/dist/utils/format.d.ts +20 -0
  56. package/dist/utils/format.js +31 -0
  57. package/dist/utils/index.d.ts +1 -0
  58. package/dist/utils/index.js +1 -0
  59. package/dist/utils/trackCallStatus.d.ts +4 -0
  60. package/dist/utils/trackCallStatus.js +67 -0
  61. package/dist/utils/webhookFlags.d.ts +3 -0
  62. package/dist/utils/webhookFlags.js +34 -0
  63. package/package.json +6 -6
@@ -0,0 +1,97 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
+ return new (P || (P = Promise))(function (resolve, reject) {
38
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
42
+ });
43
+ };
44
+ var __importDefault = (this && this.__importDefault) || function (mod) {
45
+ return (mod && mod.__esModule) ? mod : { "default": mod };
46
+ };
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ /**
49
+ * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
50
+ * http://github.com/fonoster/fonoster
51
+ *
52
+ * This file is part of Fonoster
53
+ *
54
+ * Licensed under the MIT License (the "License");
55
+ * you may not use this file except in compliance with
56
+ * the License. You may obtain a copy of the License at
57
+ *
58
+ * https://opensource.org/licenses/MIT
59
+ *
60
+ * Unless required by applicable law or agreed to in writing, software
61
+ * distributed under the License is distributed on an "AS IS" BASIS,
62
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
63
+ * See the License for the specific language governing permissions and
64
+ * limitations under the License.
65
+ */
66
+ const SDK = __importStar(require("@fonoster/sdk"));
67
+ const core_1 = require("@oclif/core");
68
+ const AuthenticatedCommand_1 = require("../../AuthenticatedCommand");
69
+ const errorHandler_1 = __importDefault(require("../../errorHandler"));
70
+ class RotateSecret extends AuthenticatedCommand_1.AuthenticatedCommand {
71
+ run() {
72
+ return __awaiter(this, void 0, void 0, function* () {
73
+ const { args } = yield this.parse(RotateSecret);
74
+ try {
75
+ const client = yield this.createSdkClient();
76
+ const applications = new SDK.Applications(client);
77
+ const response = yield applications.rotateSigningSecret(args.ref);
78
+ this.log(`Signing secret: ${response.signingSecret}`);
79
+ this.log("Save it now: it is shown only once.");
80
+ }
81
+ catch (e) {
82
+ (0, errorHandler_1.default)(e, this.error.bind(this));
83
+ }
84
+ });
85
+ }
86
+ }
87
+ RotateSecret.description = "issue a new signing secret for an Application (the old one stops working)";
88
+ RotateSecret.examples = [
89
+ "<%= config.bin %> <%= command.id %> <ref>"
90
+ ];
91
+ RotateSecret.args = {
92
+ ref: core_1.Args.string({
93
+ description: "the Application whose secret to rotate",
94
+ required: true
95
+ })
96
+ };
97
+ exports.default = RotateSecret;
@@ -1,12 +1,33 @@
1
1
  import { AuthenticatedCommand } from "../../AuthenticatedCommand";
2
2
  export default class Update extends AuthenticatedCommand<typeof Update> {
3
- static readonly description = "modify the configuration of an Application";
3
+ static readonly description = "modify an Application (only the fields you pass change)";
4
4
  static readonly examples: string[];
5
5
  static readonly args: {
6
6
  ref: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
7
7
  };
8
8
  static readonly flags: {
9
9
  "from-file": import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
10
+ name: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
11
+ url: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
12
+ protocol: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
13
+ agent: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
14
+ flavor: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
15
+ assistant: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
16
+ voice: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
17
+ language: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
18
+ "stt-model": import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
19
+ "tts-model": import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
20
+ "silence-timeout": import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
21
+ patience: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
22
+ "audio-codec": import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
23
+ "audio-rate": import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
24
+ "fallback-app": import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
25
+ "fallback-message": import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
26
+ listener: import("@oclif/core/lib/interfaces").OptionFlag<string[], import("@oclif/core/lib/interfaces").CustomOptions>;
27
+ "clear-listeners": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
28
+ recording: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
29
+ amd: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
30
+ "amd-window": import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
10
31
  };
11
32
  run(): Promise<void>;
12
33
  }
@@ -1,37 +1,4 @@
1
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -63,144 +30,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
63
30
  * See the License for the specific language governing permissions and
64
31
  * limitations under the License.
65
32
  */
66
- const SDK = __importStar(require("@fonoster/sdk"));
67
- const prompts_1 = require("@inquirer/prompts");
68
33
  const core_1 = require("@oclif/core");
69
34
  const AuthenticatedCommand_1 = require("../../AuthenticatedCommand");
70
35
  const errorHandler_1 = __importDefault(require("../../errorHandler"));
36
+ const applicationFlags_1 = require("../../utils/applicationFlags");
71
37
  const createOrUpdateApplication_1 = require("../../utils/createOrUpdateApplication");
72
38
  class Update extends AuthenticatedCommand_1.AuthenticatedCommand {
73
39
  run() {
74
40
  return __awaiter(this, void 0, void 0, function* () {
75
- var _a, _b, _c, _d, _e, _f, _g, _h;
76
41
  const { args, flags } = yield this.parse(Update);
77
- const { ref } = args;
78
- if (flags["from-file"]) {
79
- try {
80
- const client = yield this.createSdkClient();
81
- yield (0, createOrUpdateApplication_1.createOrUpdateApplication)(client, flags["from-file"], ref, true);
82
- this.log("Done!");
83
- return;
84
- }
85
- catch (e) {
86
- (0, errorHandler_1.default)(e, this.error.bind(this));
87
- return;
88
- }
89
- }
90
- if (!ref) {
42
+ if (!args.ref && !flags["from-file"]) {
91
43
  this.error("An Application ref is required. Pass it as the positional argument or use --from-file with a `ref` field.");
92
44
  }
93
- const client = yield this.createSdkClient();
94
- const applications = new SDK.Applications(client);
95
- const applicationFromDB = yield applications.getApplication(ref);
96
- if (!applicationFromDB) {
97
- this.error("Application not found.");
98
- }
99
- this.log("This utility will help you update an Application.");
100
- this.log("Press ^C at any time to quit.");
101
- const answers = {
102
- name: yield (0, prompts_1.input)({
103
- message: "Name",
104
- required: true,
105
- default: applicationFromDB.name
106
- }),
107
- type: yield (0, prompts_1.select)({
108
- message: "Type",
109
- choices: [{ name: "External", value: "External" }],
110
- default: applicationFromDB.type
111
- }),
112
- endpoint: yield (0, prompts_1.input)({
113
- message: "Endpoint",
114
- required: true,
115
- default: applicationFromDB.endpoint
116
- }),
117
- speechToText: {
118
- productRef: yield (0, prompts_1.select)({
119
- message: "SST Vendor",
120
- choices: [{ name: "Deepgram", value: "stt.deepgram" }],
121
- default: (_a = applicationFromDB.speechToText) === null || _a === void 0 ? void 0 : _a.productRef
122
- }),
123
- config: {
124
- languageCode: yield (0, prompts_1.select)({
125
- message: "STT Language",
126
- choices: [
127
- { name: "English", value: "en-US" },
128
- { name: "Spanish", value: "es-ES" },
129
- { name: "Multilingual (Nova 3 or Nova 2)", value: "multi" }
130
- ],
131
- default: (_b = applicationFromDB.speechToText) === null || _b === void 0 ? void 0 : _b.config.languageCode
132
- }),
133
- model: yield (0, prompts_1.select)({
134
- message: "STT Model",
135
- choices: [
136
- { name: "Nova 3", value: "nova-3" },
137
- { name: "Nova 2", value: "nova-2" },
138
- { name: "Nova 2 Phone Call", value: "nova-2-phonecall" },
139
- {
140
- name: "Nova 2 Conversational AI",
141
- value: "nova-2-conversationalai"
142
- }
143
- ],
144
- default: (_c = applicationFromDB.speechToText) === null || _c === void 0 ? void 0 : _c.config.model
145
- })
146
- }
147
- },
148
- textToSpeech: {
149
- productRef: yield (0, prompts_1.select)({
150
- message: "TTS Vendor",
151
- choices: [
152
- { name: "Deepgram", value: "tts.deepgram" },
153
- { name: "ElevenLabs", value: "tts.elevenlabs" },
154
- { name: "Google", value: "tts.google" },
155
- { name: "Azure", value: "tts.azure" }
156
- ],
157
- default: (_d = applicationFromDB.textToSpeech) === null || _d === void 0 ? void 0 : _d.productRef
158
- }),
159
- config: {}
160
- }
161
- };
162
- const answersPartTwo = {
163
- textToSpeech: {
164
- config: {
165
- model: answers.textToSpeech.productRef === "tts.elevenlabs"
166
- ? yield (0, prompts_1.select)({
167
- message: "TTS Model",
168
- choices: [
169
- {
170
- name: "Multilingual v2",
171
- value: "eleven_multilingual_v2"
172
- },
173
- { name: "Flash v2.5", value: "eleven_flash_v2_5" },
174
- { name: "Flash v2", value: "eleven_flash_v" },
175
- { name: "Turbo v2", value: "eleven_turbo_v2" },
176
- { name: "Turbo v2.5", value: "eleven_turbo_v2_5" },
177
- {
178
- name: "Multilingual Speech to Speech",
179
- value: "eleven_multilingual_sts_v2"
180
- }
181
- ],
182
- default: (_f = (_e = applicationFromDB.textToSpeech) === null || _e === void 0 ? void 0 : _e.config) === null || _f === void 0 ? void 0 : _f.model
183
- })
184
- : null,
185
- voice: yield (0, prompts_1.input)({
186
- message: "TTS Voice",
187
- required: true,
188
- default: (_h = (_g = applicationFromDB.textToSpeech) === null || _g === void 0 ? void 0 : _g.config) === null || _h === void 0 ? void 0 : _h.voice
189
- })
190
- }
191
- },
192
- confirm: yield (0, prompts_1.confirm)({
193
- message: "Ready?"
194
- })
195
- };
196
- if (!answersPartTwo.confirm) {
197
- this.log("Aborted!");
198
- return;
199
- }
200
- answers.textToSpeech.config = Object.assign(Object.assign({}, answers.textToSpeech.config), answersPartTwo.textToSpeech.config);
201
45
  try {
202
- yield applications.updateApplication(Object.assign({ ref }, answers));
203
- this.log("Done!");
46
+ const client = yield this.createSdkClient();
47
+ const response = yield (0, createOrUpdateApplication_1.createOrUpdateApplication)(client, flags["from-file"], args.ref, true, flags);
48
+ this.log(`Application updated: ${response.ref}`);
49
+ if (response.signingSecret) {
50
+ this.log(`New signing secret: ${response.signingSecret}\n` +
51
+ "Save it now: it is shown only once.");
52
+ }
204
53
  }
205
54
  catch (e) {
206
55
  (0, errorHandler_1.default)(e, this.error.bind(this));
@@ -208,17 +57,17 @@ class Update extends AuthenticatedCommand_1.AuthenticatedCommand {
208
57
  });
209
58
  }
210
59
  }
211
- Update.description = "modify the configuration of an Application";
212
- Update.examples = ["<%= config.bin %> <%= command.id %>"];
60
+ Update.description = "modify an Application (only the fields you pass change)";
61
+ Update.examples = [
62
+ "<%= config.bin %> <%= command.id %> <ref> --voice elevenlabs/rachel --patience high",
63
+ "<%= config.bin %> <%= command.id %> <ref> --agent agent.yaml",
64
+ "<%= config.bin %> <%= command.id %> <ref> --clear-listeners --listener wss://rec.example.com/ws,inbound",
65
+ "<%= config.bin %> <%= command.id %> --from-file app.yaml # with `ref` in the file"
66
+ ];
213
67
  Update.args = {
214
68
  ref: core_1.Args.string({
215
69
  description: "the Application to update (optional when `ref` is set in --from-file)"
216
70
  })
217
71
  };
218
- Update.flags = {
219
- "from-file": core_1.Flags.string({
220
- char: "f",
221
- description: "update Application from YAML or JSON file"
222
- })
223
- };
72
+ Update.flags = applicationFlags_1.applicationFlags;
224
73
  exports.default = Update;
@@ -0,0 +1,10 @@
1
+ import { AuthenticatedCommand } from "../../AuthenticatedCommand";
2
+ export default class Catalog extends AuthenticatedCommand<typeof Catalog> {
3
+ static readonly description = "list the provider catalog: the providers, models and voices apps can use (catalog ids)";
4
+ static readonly examples: string[];
5
+ static readonly flags: {
6
+ kind: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
7
+ type: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
8
+ };
9
+ run(): Promise<void>;
10
+ }
@@ -0,0 +1,128 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
+ return new (P || (P = Promise))(function (resolve, reject) {
38
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
42
+ });
43
+ };
44
+ var __importDefault = (this && this.__importDefault) || function (mod) {
45
+ return (mod && mod.__esModule) ? mod : { "default": mod };
46
+ };
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ /**
49
+ * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
50
+ * http://github.com/fonoster/fonoster
51
+ *
52
+ * This file is part of Fonoster
53
+ *
54
+ * Licensed under the MIT License (the "License");
55
+ * you may not use this file except in compliance with
56
+ * the License. You may obtain a copy of the License at
57
+ *
58
+ * https://opensource.org/licenses/MIT
59
+ *
60
+ * Unless required by applicable law or agreed to in writing, software
61
+ * distributed under the License is distributed on an "AS IS" BASIS,
62
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
63
+ * See the License for the specific language governing permissions and
64
+ * limitations under the License.
65
+ */
66
+ const SDK = __importStar(require("@fonoster/sdk"));
67
+ const core_1 = require("@oclif/core");
68
+ const cliui_1 = __importDefault(require("cliui"));
69
+ const AuthenticatedCommand_1 = require("../../AuthenticatedCommand");
70
+ const errorHandler_1 = __importDefault(require("../../errorHandler"));
71
+ class Catalog extends AuthenticatedCommand_1.AuthenticatedCommand {
72
+ run() {
73
+ return __awaiter(this, void 0, void 0, function* () {
74
+ const { flags } = yield this.parse(Catalog);
75
+ try {
76
+ const client = yield this.createSdkClient();
77
+ const { items } = yield new SDK.Providers(client).listCatalog({
78
+ kind: flags.kind,
79
+ type: flags.type
80
+ });
81
+ const ui = (0, cliui_1.default)({ width: 200 });
82
+ ui.div({ text: "ID", padding: [0, 0, 0, 0], width: 44 }, { text: "KIND", padding: [0, 0, 0, 0], width: 10 }, { text: "TYPE", padding: [0, 0, 0, 0], width: 6 }, { text: "STATE", padding: [0, 0, 0, 0], width: 40 }, { text: "LANGUAGES", padding: [0, 0, 0, 0] });
83
+ items.forEach((item) => {
84
+ var _a, _b;
85
+ const languages = (_a = item.languages) !== null && _a !== void 0 ? _a : [];
86
+ ui.div({ text: item.id, padding: [0, 0, 0, 0], width: 44 }, { text: item.kind, padding: [0, 0, 0, 0], width: 10 }, {
87
+ text: (_b = item.type) !== null && _b !== void 0 ? _b : "-",
88
+ padding: [0, 0, 0, 0],
89
+ width: 6
90
+ }, {
91
+ text: item.state === "deprecated" && item.replacement
92
+ ? `deprecated → ${item.replacement}`
93
+ : item.state,
94
+ padding: [0, 0, 0, 0],
95
+ width: 40
96
+ }, {
97
+ text: languages.slice(0, 6).join(", ") +
98
+ (languages.length > 6 ? ` +${languages.length - 6}` : ""),
99
+ padding: [0, 0, 0, 0]
100
+ });
101
+ });
102
+ this.log(ui.toString());
103
+ }
104
+ catch (e) {
105
+ (0, errorHandler_1.default)(e, this.error.bind(this));
106
+ }
107
+ });
108
+ }
109
+ }
110
+ Catalog.description = "list the provider catalog: the providers, models and voices apps can use (catalog ids)";
111
+ Catalog.examples = [
112
+ "<%= config.bin %> <%= command.id %>",
113
+ "<%= config.bin %> <%= command.id %> --kind voice",
114
+ "<%= config.bin %> <%= command.id %> --kind model --type stt"
115
+ ];
116
+ Catalog.flags = {
117
+ kind: core_1.Flags.string({
118
+ char: "k",
119
+ description: "only this kind of item",
120
+ options: ["provider", "model", "voice"]
121
+ }),
122
+ type: core_1.Flags.string({
123
+ char: "t",
124
+ description: "only this capability",
125
+ options: ["stt", "tts", "llm"]
126
+ })
127
+ };
128
+ exports.default = Catalog;
@@ -0,0 +1,9 @@
1
+ import { AuthenticatedCommand } from "../../../AuthenticatedCommand";
2
+ export default class Delete extends AuthenticatedCommand<typeof Delete> {
3
+ static readonly description = "remove the Workspace's key for a vendor (calls fall back to the platform's key, if any)";
4
+ static readonly examples: string[];
5
+ static readonly args: {
6
+ provider: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
7
+ };
8
+ run(): Promise<void>;
9
+ }
@@ -0,0 +1,92 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
+ return new (P || (P = Promise))(function (resolve, reject) {
38
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
42
+ });
43
+ };
44
+ var __importDefault = (this && this.__importDefault) || function (mod) {
45
+ return (mod && mod.__esModule) ? mod : { "default": mod };
46
+ };
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ /**
49
+ * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
50
+ * http://github.com/fonoster/fonoster
51
+ *
52
+ * This file is part of Fonoster
53
+ *
54
+ * Licensed under the MIT License (the "License");
55
+ * you may not use this file except in compliance with
56
+ * the License. You may obtain a copy of the License at
57
+ *
58
+ * https://opensource.org/licenses/MIT
59
+ *
60
+ * Unless required by applicable law or agreed to in writing, software
61
+ * distributed under the License is distributed on an "AS IS" BASIS,
62
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
63
+ * See the License for the specific language governing permissions and
64
+ * limitations under the License.
65
+ */
66
+ const SDK = __importStar(require("@fonoster/sdk"));
67
+ const core_1 = require("@oclif/core");
68
+ const AuthenticatedCommand_1 = require("../../../AuthenticatedCommand");
69
+ const errorHandler_1 = __importDefault(require("../../../errorHandler"));
70
+ class Delete extends AuthenticatedCommand_1.AuthenticatedCommand {
71
+ run() {
72
+ return __awaiter(this, void 0, void 0, function* () {
73
+ const { args } = yield this.parse(Delete);
74
+ try {
75
+ const client = yield this.createSdkClient();
76
+ yield new SDK.Providers(client).deleteProviderKey(args.provider);
77
+ this.log("Done!");
78
+ }
79
+ catch (e) {
80
+ (0, errorHandler_1.default)(e, this.error.bind(this));
81
+ }
82
+ });
83
+ }
84
+ }
85
+ Delete.description = "remove the Workspace's key for a vendor (calls fall back to the platform's key, if any)";
86
+ Delete.examples = [
87
+ "<%= config.bin %> <%= command.id %> deepgram"
88
+ ];
89
+ Delete.args = {
90
+ provider: core_1.Args.string({ description: "the provider id", required: true })
91
+ };
92
+ exports.default = Delete;
@@ -0,0 +1,6 @@
1
+ import { AuthenticatedCommand } from "../../../AuthenticatedCommand";
2
+ export default class List extends AuthenticatedCommand<typeof List> {
3
+ static readonly description = "list the vendors the Workspace has its own key for (keys are never shown)";
4
+ static readonly examples: string[];
5
+ run(): Promise<void>;
6
+ }