@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,110 @@
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
+ const webhookFlags_1 = require("../../utils/webhookFlags");
72
+ class Get extends AuthenticatedCommand_1.AuthenticatedCommand {
73
+ run() {
74
+ return __awaiter(this, void 0, void 0, function* () {
75
+ const { args } = yield this.parse(Get);
76
+ try {
77
+ const client = yield this.createSdkClient();
78
+ const webhooks = new SDK.Webhooks(client);
79
+ const webhook = yield webhooks.getWebhook(args.ref);
80
+ const ui = (0, cliui_1.default)({ width: 200 });
81
+ ui.div("WEBHOOK DETAILS\n" +
82
+ "---------------\n" +
83
+ `REF: \t${webhook.ref}\n` +
84
+ `URL: \t${webhook.url}\n` +
85
+ `EVENTS: \t${webhook.events.join(", ")}\n` +
86
+ `SECRET: \t${webhook.secretHint || "-"}\n` +
87
+ (webhook.previousSecretUntil
88
+ ? `PREVIOUS SECRET VALID UNTIL: \t${(0, webhookFlags_1.formatDate)(webhook.previousSecretUntil)}\n`
89
+ : "") +
90
+ `CREATED: \t${(0, webhookFlags_1.formatDate)(webhook.createdAt)}\n` +
91
+ `UPDATED: \t${(0, webhookFlags_1.formatDate)(webhook.updatedAt)}`);
92
+ this.log(ui.toString());
93
+ }
94
+ catch (e) {
95
+ (0, errorHandler_1.default)(e, this.error.bind(this));
96
+ }
97
+ });
98
+ }
99
+ }
100
+ Get.description = "retrieve details of a Webhook by reference";
101
+ Get.examples = [
102
+ "<%= config.bin %> <%= command.id %> <ref>"
103
+ ];
104
+ Get.args = {
105
+ ref: core_1.Args.string({
106
+ description: "the Webhook to show details about",
107
+ required: true
108
+ })
109
+ };
110
+ exports.default = Get;
@@ -0,0 +1,9 @@
1
+ import { AuthenticatedCommand } from "../../AuthenticatedCommand";
2
+ export default class List extends AuthenticatedCommand<typeof List> {
3
+ static readonly description = "display all Webhooks in the active Workspace";
4
+ static readonly examples: string[];
5
+ static readonly flags: {
6
+ "page-size": import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
7
+ };
8
+ run(): Promise<void>;
9
+ }
@@ -0,0 +1,104 @@
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 List extends AuthenticatedCommand_1.AuthenticatedCommand {
72
+ run() {
73
+ return __awaiter(this, void 0, void 0, function* () {
74
+ const { flags } = yield this.parse(List);
75
+ try {
76
+ const client = yield this.createSdkClient();
77
+ const webhooks = new SDK.Webhooks(client);
78
+ const response = yield webhooks.listWebhooks({
79
+ pageSize: parseInt(flags["page-size"])
80
+ });
81
+ const ui = (0, cliui_1.default)({ width: 200 });
82
+ ui.div({ text: "REF", padding: [0, 2, 0, 0], width: 46 }, { text: "URL", padding: [0, 0, 0, 0], width: 60 }, { text: "EVENTS", padding: [0, 0, 0, 0] });
83
+ response.items.forEach((webhook) => {
84
+ ui.div({ text: webhook.ref, padding: [0, 2, 0, 0], width: 46 }, { text: webhook.url, padding: [0, 0, 0, 0], width: 60 }, { text: webhook.events.join(", "), padding: [0, 0, 0, 0] });
85
+ });
86
+ this.log(ui.toString());
87
+ }
88
+ catch (e) {
89
+ (0, errorHandler_1.default)(e, this.error.bind(this));
90
+ }
91
+ });
92
+ }
93
+ }
94
+ List.description = "display all Webhooks in the active Workspace";
95
+ List.examples = ["<%= config.bin %> <%= command.id %>"];
96
+ List.flags = {
97
+ "page-size": core_1.Flags.string({
98
+ char: "s",
99
+ description: "the number of items to show",
100
+ default: "1000",
101
+ required: false
102
+ })
103
+ };
104
+ exports.default = List;
@@ -0,0 +1,9 @@
1
+ import { AuthenticatedCommand } from "../../AuthenticatedCommand";
2
+ export default class Resend extends AuthenticatedCommand<typeof Resend> {
3
+ static readonly description = "send a delivery again (same event id, so receivers can dedupe)";
4
+ static readonly examples: string[];
5
+ static readonly args: {
6
+ ref: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
7
+ };
8
+ run(): Promise<void>;
9
+ }
@@ -0,0 +1,95 @@
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 Resend extends AuthenticatedCommand_1.AuthenticatedCommand {
71
+ run() {
72
+ return __awaiter(this, void 0, void 0, function* () {
73
+ const { args } = yield this.parse(Resend);
74
+ try {
75
+ const client = yield this.createSdkClient();
76
+ const delivery = yield new SDK.Webhooks(client).resendWebhookDelivery(args.ref);
77
+ this.log(`Resent ${delivery.eventType} (${delivery.eventId}) as ${delivery.ref}: ${delivery.status}`);
78
+ }
79
+ catch (e) {
80
+ (0, errorHandler_1.default)(e, this.error.bind(this));
81
+ }
82
+ });
83
+ }
84
+ }
85
+ Resend.description = "send a delivery again (same event id, so receivers can dedupe)";
86
+ Resend.examples = [
87
+ "<%= config.bin %> <%= command.id %> <delivery-ref>"
88
+ ];
89
+ Resend.args = {
90
+ ref: core_1.Args.string({
91
+ description: "the delivery to resend (see webhooks:deliveries)",
92
+ required: true
93
+ })
94
+ };
95
+ exports.default = Resend;
@@ -0,0 +1,9 @@
1
+ import { AuthenticatedCommand } from "../../AuthenticatedCommand";
2
+ export default class Rotate extends AuthenticatedCommand<typeof Rotate> {
3
+ static readonly description = "issue a new signing secret for a Webhook (the old one keeps working for a while)";
4
+ static readonly examples: string[];
5
+ static readonly args: {
6
+ ref: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
7
+ };
8
+ run(): Promise<void>;
9
+ }
@@ -0,0 +1,98 @@
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
+ const webhookFlags_1 = require("../../utils/webhookFlags");
71
+ class Rotate extends AuthenticatedCommand_1.AuthenticatedCommand {
72
+ run() {
73
+ return __awaiter(this, void 0, void 0, function* () {
74
+ const { args } = yield this.parse(Rotate);
75
+ try {
76
+ const client = yield this.createSdkClient();
77
+ const response = yield new SDK.Webhooks(client).rotateWebhookSecret(args.ref);
78
+ this.log(`Signing secret: ${response.secret}`);
79
+ this.log("Save it now: it is shown only once.");
80
+ this.log(`The previous secret stays valid until ${(0, webhookFlags_1.formatDate)(response.previousSecretUntil)}.`);
81
+ }
82
+ catch (e) {
83
+ (0, errorHandler_1.default)(e, this.error.bind(this));
84
+ }
85
+ });
86
+ }
87
+ }
88
+ Rotate.description = "issue a new signing secret for a Webhook (the old one keeps working for a while)";
89
+ Rotate.examples = [
90
+ "<%= config.bin %> <%= command.id %> <ref>"
91
+ ];
92
+ Rotate.args = {
93
+ ref: core_1.Args.string({
94
+ description: "the Webhook whose secret to rotate",
95
+ required: true
96
+ })
97
+ };
98
+ exports.default = Rotate;
@@ -0,0 +1,13 @@
1
+ import { AuthenticatedCommand } from "../../AuthenticatedCommand";
2
+ export default class Update extends AuthenticatedCommand<typeof Update> {
3
+ static readonly description = "change a Webhook's URL or events (--event replaces the list)";
4
+ static readonly examples: string[];
5
+ static readonly args: {
6
+ ref: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
7
+ };
8
+ static readonly flags: {
9
+ url: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
10
+ event: import("@oclif/core/lib/interfaces").OptionFlag<string[], import("@oclif/core/lib/interfaces").CustomOptions>;
11
+ };
12
+ run(): Promise<void>;
13
+ }
@@ -0,0 +1,103 @@
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
+ const webhookFlags_1 = require("../../utils/webhookFlags");
71
+ class Update extends AuthenticatedCommand_1.AuthenticatedCommand {
72
+ run() {
73
+ return __awaiter(this, void 0, void 0, function* () {
74
+ var _a, _b;
75
+ const { args, flags } = yield this.parse(Update);
76
+ if (!flags.url && !((_a = flags.event) === null || _a === void 0 ? void 0 : _a.length)) {
77
+ this.error("Nothing to update: pass --url and/or --event.");
78
+ }
79
+ try {
80
+ const client = yield this.createSdkClient();
81
+ const webhooks = new SDK.Webhooks(client);
82
+ yield webhooks.updateWebhook(Object.assign(Object.assign({ ref: args.ref }, (flags.url ? { url: flags.url } : {})), (((_b = flags.event) === null || _b === void 0 ? void 0 : _b.length) ? { events: flags.event } : {})));
83
+ this.log("Done!");
84
+ }
85
+ catch (e) {
86
+ (0, errorHandler_1.default)(e, this.error.bind(this));
87
+ }
88
+ });
89
+ }
90
+ }
91
+ Update.description = "change a Webhook's URL or events (--event replaces the list)";
92
+ Update.examples = [
93
+ "<%= config.bin %> <%= command.id %> <ref> -e call.started -e call.ended",
94
+ "<%= config.bin %> <%= command.id %> <ref> --url https://example.com/new"
95
+ ];
96
+ Update.args = {
97
+ ref: core_1.Args.string({ description: "the Webhook to update", required: true })
98
+ };
99
+ Update.flags = {
100
+ url: core_1.Flags.string({ char: "u", description: "the new endpoint" }),
101
+ event: (0, webhookFlags_1.eventFlag)(false)
102
+ };
103
+ exports.default = Update;
@@ -2,6 +2,11 @@ import { BaseCommand } from "../../BaseCommand";
2
2
  export default class Login extends BaseCommand<typeof Login> {
3
3
  static description: string;
4
4
  static examples: string[];
5
+ static flags: {
6
+ endpoint: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
7
+ "access-key-id": import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
8
+ "access-key-secret": import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
9
+ };
5
10
  run(): Promise<void>;
6
11
  private saveConfig;
7
12
  private getWorkspaceFromDB;
@@ -62,6 +62,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
62
62
  */
63
63
  const SDK = __importStar(require("@fonoster/sdk"));
64
64
  const prompts_1 = require("@inquirer/prompts");
65
+ const core_1 = require("@oclif/core");
65
66
  const BaseCommand_1 = require("../../BaseCommand");
66
67
  const config_1 = require("../../config");
67
68
  const saveConfig_1 = require("../../config/saveConfig");
@@ -69,6 +70,18 @@ const constants_1 = require("../../constants");
69
70
  class Login extends BaseCommand_1.BaseCommand {
70
71
  run() {
71
72
  return __awaiter(this, void 0, void 0, function* () {
73
+ var _a;
74
+ const { flags } = yield this.parse(Login);
75
+ if (flags["access-key-id"] && flags["access-key-secret"]) {
76
+ const answers = {
77
+ endpoint: (_a = flags.endpoint) !== null && _a !== void 0 ? _a : "api.fonoster.com",
78
+ accessKeyId: flags["access-key-id"],
79
+ accessKeySecret: flags["access-key-secret"]
80
+ };
81
+ const workspaceFromDB = yield this.getWorkspaceFromDB(answers);
82
+ this.saveConfig(Object.assign(Object.assign({}, answers), { workspaceAccessKeyId: workspaceFromDB.accessKeyId, ref: workspaceFromDB.ref, name: workspaceFromDB.name }));
83
+ return;
84
+ }
72
85
  this.log("This utility will help you add a Workspace.");
73
86
  this.log("Press ^C at any time to quit.");
74
87
  const answers = {
@@ -140,5 +153,18 @@ class Login extends BaseCommand_1.BaseCommand {
140
153
  }
141
154
  }
142
155
  Login.description = "link a Workspace to the local environment";
143
- Login.examples = ["<%= config.bin %> <%= command.id %>"];
156
+ Login.examples = [
157
+ "<%= config.bin %> <%= command.id %>",
158
+ "<%= config.bin %> <%= command.id %> --insecure --endpoint localhost:16449 --access-key-id WO... --access-key-secret ..."
159
+ ];
160
+ Login.flags = {
161
+ endpoint: core_1.Flags.string({
162
+ char: "e",
163
+ description: "the API endpoint (skips the questions with the key flags)"
164
+ }),
165
+ "access-key-id": core_1.Flags.string({ description: "a Workspace API key id" }),
166
+ "access-key-secret": core_1.Flags.string({
167
+ description: "the API key secret"
168
+ })
169
+ };
144
170
  exports.default = Login;
@@ -0,0 +1,25 @@
1
+ /** Flags shared by `applications:create` and `applications:update` (a stream or an Autopilot agent). */
2
+ export declare const applicationFlags: {
3
+ "from-file": import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
4
+ name: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
5
+ url: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
6
+ protocol: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
7
+ agent: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
8
+ flavor: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
9
+ assistant: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
10
+ voice: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
11
+ language: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
12
+ "stt-model": import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
13
+ "tts-model": import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
14
+ "silence-timeout": import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
15
+ patience: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
16
+ "audio-codec": import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
17
+ "audio-rate": import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
18
+ "fallback-app": import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
19
+ "fallback-message": import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
20
+ listener: import("@oclif/core/lib/interfaces").OptionFlag<string[], import("@oclif/core/lib/interfaces").CustomOptions>;
21
+ "clear-listeners": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
22
+ recording: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
23
+ amd: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
24
+ "amd-window": import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
25
+ };