@fonoster/ctl 0.27.0 → 0.31.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 (66) hide show
  1. package/README.md +588 -90
  2. package/dist/AuthenticatedCommand.d.ts +5 -0
  3. package/dist/AuthenticatedCommand.js +12 -1
  4. package/dist/commands/applications/create.d.ts +22 -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 +67 -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 +21 -1
  14. package/dist/commands/applications/update.js +18 -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/sipnet/numbers/linkTwilioNumber.js +4 -3
  32. package/dist/commands/webhooks/create.d.ts +10 -0
  33. package/dist/commands/webhooks/create.js +104 -0
  34. package/dist/commands/webhooks/delete.d.ts +9 -0
  35. package/dist/commands/webhooks/delete.js +92 -0
  36. package/dist/commands/webhooks/deliveries.d.ts +12 -0
  37. package/dist/commands/webhooks/deliveries.js +119 -0
  38. package/dist/commands/webhooks/get.d.ts +9 -0
  39. package/dist/commands/webhooks/get.js +110 -0
  40. package/dist/commands/webhooks/list.d.ts +9 -0
  41. package/dist/commands/webhooks/list.js +104 -0
  42. package/dist/commands/webhooks/resend.d.ts +9 -0
  43. package/dist/commands/webhooks/resend.js +95 -0
  44. package/dist/commands/webhooks/rotate.d.ts +9 -0
  45. package/dist/commands/webhooks/rotate.js +98 -0
  46. package/dist/commands/webhooks/update.d.ts +13 -0
  47. package/dist/commands/webhooks/update.js +103 -0
  48. package/dist/commands/workspaces/login.d.ts +5 -0
  49. package/dist/commands/workspaces/login.js +28 -2
  50. package/dist/constants.d.ts +1 -2
  51. package/dist/constants.js +2 -3
  52. package/dist/utils/applicationFlags.d.ts +24 -0
  53. package/dist/utils/applicationFlags.js +95 -0
  54. package/dist/utils/applicationRequest.d.ts +42 -0
  55. package/dist/utils/applicationRequest.js +215 -0
  56. package/dist/utils/createOrUpdateApplication.d.ts +26 -1
  57. package/dist/utils/createOrUpdateApplication.js +23 -27
  58. package/dist/utils/format.d.ts +20 -0
  59. package/dist/utils/format.js +31 -0
  60. package/dist/utils/index.d.ts +1 -0
  61. package/dist/utils/index.js +1 -0
  62. package/dist/utils/trackCallStatus.d.ts +4 -0
  63. package/dist/utils/trackCallStatus.js +67 -0
  64. package/dist/utils/webhookFlags.d.ts +3 -0
  65. package/dist/utils/webhookFlags.js +34 -0
  66. package/package.json +6 -7
@@ -0,0 +1,119 @@
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 Deliveries extends AuthenticatedCommand_1.AuthenticatedCommand {
73
+ run() {
74
+ return __awaiter(this, void 0, void 0, function* () {
75
+ const { args, flags } = yield this.parse(Deliveries);
76
+ try {
77
+ const client = yield this.createSdkClient();
78
+ const response = yield new SDK.Webhooks(client).listWebhookDeliveries({
79
+ webhookRef: args.ref,
80
+ pageSize: parseInt(flags["page-size"])
81
+ });
82
+ const ui = (0, cliui_1.default)({ width: 200 });
83
+ ui.div({ text: "REF", padding: [0, 2, 0, 0], width: 46 }, { text: "EVENT", padding: [0, 0, 0, 0], width: 22 }, { text: "STATUS", padding: [0, 0, 0, 0], width: 11 }, { text: "ATTEMPTS", padding: [0, 0, 0, 0], width: 10 }, { text: "HTTP", padding: [0, 0, 0, 0], width: 6 }, { text: "LAST ATTEMPT", padding: [0, 0, 0, 0], width: 22 }, { text: "EVENT ID", padding: [0, 0, 0, 0] });
84
+ response.items.forEach((d) => {
85
+ ui.div({ text: d.ref, padding: [0, 2, 0, 0], width: 46 }, { text: d.eventType, padding: [0, 0, 0, 0], width: 22 }, { text: d.status, padding: [0, 0, 0, 0], width: 11 }, { text: String(d.attempts), padding: [0, 0, 0, 0], width: 10 }, {
86
+ text: d.lastStatus ? String(d.lastStatus) : "-",
87
+ padding: [0, 0, 0, 0],
88
+ width: 6
89
+ }, {
90
+ text: (0, webhookFlags_1.formatDate)(d.lastAttemptAt),
91
+ padding: [0, 0, 0, 0],
92
+ width: 22
93
+ }, { text: d.eventId, padding: [0, 0, 0, 0] });
94
+ });
95
+ this.log(ui.toString());
96
+ }
97
+ catch (e) {
98
+ (0, errorHandler_1.default)(e, this.error.bind(this));
99
+ }
100
+ });
101
+ }
102
+ }
103
+ Deliveries.description = "show the delivery log (all Webhooks, or one)";
104
+ Deliveries.examples = [
105
+ "<%= config.bin %> <%= command.id %>",
106
+ "<%= config.bin %> <%= command.id %> <webhook-ref> -s 20"
107
+ ];
108
+ Deliveries.args = {
109
+ ref: core_1.Args.string({ description: "only this Webhook's deliveries" })
110
+ };
111
+ Deliveries.flags = {
112
+ "page-size": core_1.Flags.string({
113
+ char: "s",
114
+ description: "the number of items to show",
115
+ default: "50",
116
+ required: false
117
+ })
118
+ };
119
+ exports.default = Deliveries;
@@ -0,0 +1,9 @@
1
+ import { AuthenticatedCommand } from "../../AuthenticatedCommand";
2
+ export default class Get extends AuthenticatedCommand<typeof Get> {
3
+ static readonly description = "retrieve details of a Webhook by reference";
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,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
+ }