@fonoster/ctl 0.7.43 → 0.7.45
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.
- package/README.md +1 -1
- package/bin/run.js +3 -3
- package/dist/AuthenticatedCommand.d.ts +6 -0
- package/dist/AuthenticatedCommand.js +92 -0
- package/dist/BaseCommand.d.ts +1 -1
- package/dist/BaseCommand.js +1 -1
- package/dist/commands/apikeys/create.d.ts +10 -0
- package/dist/commands/apikeys/create.js +99 -0
- package/dist/commands/apikeys/delete.d.ts +9 -0
- package/dist/commands/apikeys/delete.js +87 -0
- package/dist/commands/apikeys/list.d.ts +9 -0
- package/dist/commands/apikeys/list.js +105 -0
- package/dist/commands/apikeys/regenerate.d.ts +9 -0
- package/dist/commands/apikeys/regenerate.js +91 -0
- package/dist/commands/applications/create.d.ts +4 -4
- package/dist/commands/applications/create.js +9 -18
- package/dist/commands/applications/delete.d.ts +5 -5
- package/dist/commands/applications/delete.js +11 -23
- package/dist/commands/applications/get.d.ts +5 -5
- package/dist/commands/applications/get.js +4 -17
- package/dist/commands/applications/list.d.ts +5 -5
- package/dist/commands/applications/list.js +5 -18
- package/dist/commands/applications/update.d.ts +5 -5
- package/dist/commands/applications/update.js +11 -26
- package/dist/commands/bug.js +1 -1
- package/dist/commands/feedback.js +2 -2
- package/dist/commands/secrets/create.d.ts +6 -0
- package/dist/commands/secrets/create.js +106 -0
- package/dist/commands/secrets/delete.d.ts +9 -0
- package/dist/commands/secrets/delete.js +87 -0
- package/dist/commands/secrets/get.d.ts +9 -0
- package/dist/commands/secrets/get.js +95 -0
- package/dist/commands/secrets/list.d.ts +9 -0
- package/dist/commands/secrets/list.js +99 -0
- package/dist/commands/secrets/update.d.ts +9 -0
- package/dist/commands/secrets/update.js +116 -0
- package/dist/commands/sipnet/acls/create.d.ts +6 -0
- package/dist/commands/sipnet/acls/create.js +107 -0
- package/dist/commands/sipnet/acls/delete.d.ts +9 -0
- package/dist/commands/sipnet/acls/delete.js +87 -0
- package/dist/commands/sipnet/acls/get.d.ts +9 -0
- package/dist/commands/sipnet/acls/get.js +100 -0
- package/dist/commands/sipnet/acls/list.d.ts +9 -0
- package/dist/commands/sipnet/acls/list.js +99 -0
- package/dist/commands/sipnet/acls/update.d.ts +9 -0
- package/dist/commands/sipnet/acls/update.js +123 -0
- package/dist/commands/sipnet/agents/create.d.ts +6 -0
- package/dist/commands/sipnet/agents/create.js +132 -0
- package/dist/commands/sipnet/agents/delete.d.ts +9 -0
- package/dist/commands/sipnet/agents/delete.js +87 -0
- package/dist/commands/sipnet/agents/get.d.ts +9 -0
- package/dist/commands/sipnet/agents/get.js +109 -0
- package/dist/commands/sipnet/agents/list.d.ts +9 -0
- package/dist/commands/sipnet/agents/list.js +99 -0
- package/dist/commands/sipnet/agents/update.d.ts +9 -0
- package/dist/commands/sipnet/agents/update.js +149 -0
- package/dist/commands/sipnet/calls/create.d.ts +13 -0
- package/dist/commands/sipnet/calls/create.js +156 -0
- package/dist/commands/sipnet/calls/get.d.ts +9 -0
- package/dist/commands/sipnet/calls/get.js +104 -0
- package/dist/commands/sipnet/calls/list.d.ts +9 -0
- package/dist/commands/sipnet/calls/list.js +108 -0
- package/dist/commands/sipnet/credentials/create.d.ts +6 -0
- package/dist/commands/sipnet/credentials/create.js +110 -0
- package/dist/commands/sipnet/credentials/delete.d.ts +9 -0
- package/dist/commands/sipnet/credentials/delete.js +87 -0
- package/dist/commands/sipnet/credentials/get.d.ts +9 -0
- package/dist/commands/sipnet/credentials/get.js +100 -0
- package/dist/commands/sipnet/credentials/list.d.ts +9 -0
- package/dist/commands/sipnet/credentials/list.js +99 -0
- package/dist/commands/sipnet/credentials/update.d.ts +9 -0
- package/dist/commands/sipnet/credentials/update.js +121 -0
- package/dist/commands/sipnet/domains/create.d.ts +6 -0
- package/dist/commands/sipnet/domains/create.js +107 -0
- package/dist/commands/sipnet/domains/delete.d.ts +9 -0
- package/dist/commands/sipnet/domains/delete.js +87 -0
- package/dist/commands/sipnet/domains/get.d.ts +9 -0
- package/dist/commands/sipnet/domains/get.js +100 -0
- package/dist/commands/sipnet/domains/list.d.ts +9 -0
- package/dist/commands/sipnet/domains/list.js +99 -0
- package/dist/commands/sipnet/domains/update.d.ts +9 -0
- package/dist/commands/sipnet/domains/update.js +118 -0
- package/dist/commands/sipnet/numbers/create.d.ts +6 -0
- package/dist/commands/sipnet/numbers/create.js +148 -0
- package/dist/commands/sipnet/numbers/delete.d.ts +9 -0
- package/dist/commands/sipnet/numbers/delete.js +87 -0
- package/dist/commands/sipnet/numbers/get.d.ts +9 -0
- package/dist/commands/{numbers → sipnet/numbers}/get.js +7 -13
- package/dist/commands/sipnet/numbers/linkTwilioNumber.d.ts +10 -0
- package/dist/commands/{numbers → sipnet/numbers}/linkTwilioNumber.js +12 -17
- package/dist/commands/sipnet/numbers/list.d.ts +9 -0
- package/dist/commands/{numbers → sipnet/numbers}/list.js +9 -14
- package/dist/commands/sipnet/numbers/update.d.ts +9 -0
- package/dist/commands/sipnet/numbers/update.js +136 -0
- package/dist/commands/sipnet/trunks/create.d.ts +6 -0
- package/dist/commands/sipnet/trunks/create.js +156 -0
- package/dist/commands/sipnet/trunks/delete.d.ts +9 -0
- package/dist/commands/sipnet/trunks/delete.js +87 -0
- package/dist/commands/sipnet/trunks/get.d.ts +9 -0
- package/dist/commands/sipnet/trunks/get.js +120 -0
- package/dist/commands/sipnet/trunks/list.d.ts +9 -0
- package/dist/commands/sipnet/trunks/list.js +99 -0
- package/dist/commands/sipnet/trunks/update.d.ts +9 -0
- package/dist/commands/sipnet/trunks/update.js +174 -0
- package/dist/commands/workspaces/current.js +1 -1
- package/dist/commands/workspaces/list.js +1 -1
- package/dist/commands/workspaces/login.js +2 -2
- package/dist/commands/workspaces/logout.d.ts +3 -3
- package/dist/commands/workspaces/logout.js +7 -6
- package/dist/commands/workspaces/use.d.ts +3 -3
- package/dist/commands/workspaces/use.js +8 -8
- package/dist/config/getCurrentWorkspace.d.ts +1 -1
- package/dist/config/getCurrentWorkspace.js +1 -5
- package/dist/errorHandler.d.ts +2 -0
- package/dist/errorHandler.js +31 -0
- package/dist/utils/calculateFutureDate.d.ts +2 -0
- package/dist/utils/calculateFutureDate.js +37 -0
- package/dist/utils/getOutboundUri.d.ts +7 -0
- package/dist/utils/getOutboundUri.js +10 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/package.json +6 -7
- package/dist/commands/numbers/get.d.ts +0 -9
- package/dist/commands/numbers/linkTwilioNumber.d.ts +0 -10
- package/dist/commands/numbers/list.d.ts +0 -9
|
@@ -63,37 +63,25 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
63
63
|
*/
|
|
64
64
|
const SDK = __importStar(require("@fonoster/sdk"));
|
|
65
65
|
const core_1 = require("@oclif/core");
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
const constants_1 = require("../../constants");
|
|
69
|
-
class Delete extends BaseCommand_1.BaseCommand {
|
|
66
|
+
const AuthenticatedCommand_1 = require("../../AuthenticatedCommand");
|
|
67
|
+
class Delete extends AuthenticatedCommand_1.AuthenticatedCommand {
|
|
70
68
|
run() {
|
|
71
69
|
return __awaiter(this, void 0, void 0, function* () {
|
|
72
|
-
const { args
|
|
73
|
-
const
|
|
74
|
-
const
|
|
75
|
-
if (!currentWorkspace) {
|
|
76
|
-
this.error("No active workspace found.");
|
|
77
|
-
}
|
|
78
|
-
if (!args.ref) {
|
|
79
|
-
this.error("Missing Application reference");
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
const client = new SDK.Client({
|
|
83
|
-
endpoint: currentWorkspace.endpoint,
|
|
84
|
-
accessKeyId: `WO${currentWorkspace.workspaceRef.replaceAll("-", "")}`,
|
|
85
|
-
allowInsecure: flags.insecure
|
|
86
|
-
});
|
|
87
|
-
yield client.loginWithApiKey(currentWorkspace.accessKeyId, currentWorkspace.accessKeySecret);
|
|
70
|
+
const { args } = yield this.parse(Delete);
|
|
71
|
+
const { ref } = args;
|
|
72
|
+
const client = yield this.createSdkClient();
|
|
88
73
|
const applications = new SDK.Applications(client);
|
|
89
|
-
yield applications.deleteApplication(
|
|
74
|
+
yield applications.deleteApplication(ref);
|
|
90
75
|
this.log("Done!");
|
|
91
76
|
});
|
|
92
77
|
}
|
|
93
78
|
}
|
|
94
|
-
Delete.description = "
|
|
79
|
+
Delete.description = "delete an Application from the active Workspace";
|
|
95
80
|
Delete.examples = ["<%= config.bin %> <%= command.id %>"];
|
|
96
81
|
Delete.args = {
|
|
97
|
-
ref: core_1.Args.string({
|
|
82
|
+
ref: core_1.Args.string({
|
|
83
|
+
description: "the Application to delete",
|
|
84
|
+
required: true
|
|
85
|
+
})
|
|
98
86
|
};
|
|
99
87
|
exports.default = Delete;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export default class Get extends
|
|
3
|
-
static description
|
|
4
|
-
static examples: string[];
|
|
5
|
-
static args: {
|
|
1
|
+
import { AuthenticatedCommand } from "../../AuthenticatedCommand";
|
|
2
|
+
export default class Get extends AuthenticatedCommand<typeof Get> {
|
|
3
|
+
static readonly description = "retrieve details of an Application by reference";
|
|
4
|
+
static readonly examples: string[];
|
|
5
|
+
static readonly args: {
|
|
6
6
|
ref: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
7
|
};
|
|
8
8
|
run(): Promise<void>;
|
|
@@ -68,26 +68,13 @@ const SDK = __importStar(require("@fonoster/sdk"));
|
|
|
68
68
|
const core_1 = require("@oclif/core");
|
|
69
69
|
const cliui_1 = __importDefault(require("cliui"));
|
|
70
70
|
const moment_1 = __importDefault(require("moment"));
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
const constants_1 = require("../../constants");
|
|
74
|
-
class Get extends BaseCommand_1.BaseCommand {
|
|
71
|
+
const AuthenticatedCommand_1 = require("../../AuthenticatedCommand");
|
|
72
|
+
class Get extends AuthenticatedCommand_1.AuthenticatedCommand {
|
|
75
73
|
run() {
|
|
76
74
|
return __awaiter(this, void 0, void 0, function* () {
|
|
77
75
|
var _a, _b, _c, _d;
|
|
78
|
-
const { flags } = yield this.parse(Get);
|
|
79
76
|
const { args } = yield this.parse(Get);
|
|
80
|
-
const
|
|
81
|
-
const currentWorkspace = workspaces.find((w) => w.active);
|
|
82
|
-
if (!currentWorkspace) {
|
|
83
|
-
this.error("No active workspace found.");
|
|
84
|
-
}
|
|
85
|
-
const client = new SDK.Client({
|
|
86
|
-
endpoint: currentWorkspace.endpoint,
|
|
87
|
-
accessKeyId: `WO${currentWorkspace.workspaceRef.replaceAll("-", "")}`,
|
|
88
|
-
allowInsecure: flags.insecure
|
|
89
|
-
});
|
|
90
|
-
yield client.loginWithApiKey(currentWorkspace.accessKeyId, currentWorkspace.accessKeySecret);
|
|
77
|
+
const client = yield this.createSdkClient();
|
|
91
78
|
const applications = new SDK.Applications(client);
|
|
92
79
|
const response = yield applications.getApplication(args.ref);
|
|
93
80
|
const ui = (0, cliui_1.default)({ width: 200 });
|
|
@@ -112,7 +99,7 @@ class Get extends BaseCommand_1.BaseCommand {
|
|
|
112
99
|
});
|
|
113
100
|
}
|
|
114
101
|
}
|
|
115
|
-
Get.description = "
|
|
102
|
+
Get.description = "retrieve details of an Application by reference";
|
|
116
103
|
Get.examples = ["<%= config.bin %> <%= command.id %>"];
|
|
117
104
|
Get.args = {
|
|
118
105
|
ref: core_1.Args.string({ description: "The Application to show details about" })
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export default class List extends
|
|
3
|
-
static description
|
|
4
|
-
static examples: string[];
|
|
5
|
-
static flags: {
|
|
1
|
+
import { AuthenticatedCommand } from "../../AuthenticatedCommand";
|
|
2
|
+
export default class List extends AuthenticatedCommand<typeof List> {
|
|
3
|
+
static readonly description = "display all Applications in the active Workspace";
|
|
4
|
+
static readonly examples: string[];
|
|
5
|
+
static readonly flags: {
|
|
6
6
|
"page-size": import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
7
7
|
};
|
|
8
8
|
run(): Promise<void>;
|
|
@@ -67,28 +67,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
67
67
|
const SDK = __importStar(require("@fonoster/sdk"));
|
|
68
68
|
const core_1 = require("@oclif/core");
|
|
69
69
|
const cliui_1 = __importDefault(require("cliui"));
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
const constants_1 = require("../../constants");
|
|
73
|
-
class List extends BaseCommand_1.BaseCommand {
|
|
70
|
+
const AuthenticatedCommand_1 = require("../../AuthenticatedCommand");
|
|
71
|
+
class List extends AuthenticatedCommand_1.AuthenticatedCommand {
|
|
74
72
|
run() {
|
|
75
73
|
return __awaiter(this, void 0, void 0, function* () {
|
|
76
74
|
const { flags } = yield this.parse(List);
|
|
77
|
-
const
|
|
78
|
-
const currentWorkspace = workspaces.find((w) => w.active);
|
|
79
|
-
if (!currentWorkspace) {
|
|
80
|
-
this.error("No active workspace found.");
|
|
81
|
-
}
|
|
82
|
-
const client = new SDK.Client({
|
|
83
|
-
endpoint: currentWorkspace.endpoint,
|
|
84
|
-
accessKeyId: `WO${currentWorkspace.workspaceRef.replaceAll("-", "")}`,
|
|
85
|
-
allowInsecure: flags.insecure
|
|
86
|
-
});
|
|
87
|
-
yield client.loginWithApiKey(currentWorkspace.accessKeyId, currentWorkspace.accessKeySecret);
|
|
75
|
+
const client = yield this.createSdkClient();
|
|
88
76
|
const applications = new SDK.Applications(client);
|
|
89
77
|
const response = yield applications.listApplications({
|
|
90
|
-
pageSize: parseInt(flags["page-size"])
|
|
91
|
-
pageToken: ""
|
|
78
|
+
pageSize: parseInt(flags["page-size"])
|
|
92
79
|
});
|
|
93
80
|
const ui = (0, cliui_1.default)({ width: 170 });
|
|
94
81
|
ui.div({ text: "REF", padding: [0, 0, 0, 0], width: 40 }, { text: "NAME", padding: [0, 0, 0, 0], width: 30 }, { text: "TYPE", padding: [0, 0, 0, 0], width: 10 }, { text: "ENDPOINT", padding: [0, 0, 0, 0] });
|
|
@@ -99,7 +86,7 @@ class List extends BaseCommand_1.BaseCommand {
|
|
|
99
86
|
});
|
|
100
87
|
}
|
|
101
88
|
}
|
|
102
|
-
List.description = "
|
|
89
|
+
List.description = "display all Applications in the active Workspace";
|
|
103
90
|
List.examples = ["<%= config.bin %> <%= command.id %>"];
|
|
104
91
|
List.flags = {
|
|
105
92
|
"page-size": core_1.Flags.string({
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export default class Update extends
|
|
3
|
-
static description
|
|
4
|
-
static examples: string[];
|
|
5
|
-
static args: {
|
|
1
|
+
import { AuthenticatedCommand } from "../../AuthenticatedCommand";
|
|
2
|
+
export default class Update extends AuthenticatedCommand<typeof Update> {
|
|
3
|
+
static readonly description = "modify the configuration of an Application";
|
|
4
|
+
static readonly examples: string[];
|
|
5
|
+
static readonly args: {
|
|
6
6
|
ref: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
7
|
};
|
|
8
8
|
run(): Promise<void>;
|
|
@@ -41,6 +41,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
41
41
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
42
|
});
|
|
43
43
|
};
|
|
44
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
45
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
|
+
};
|
|
44
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
48
|
/* eslint-disable import/no-unresolved */
|
|
46
49
|
/*
|
|
@@ -64,31 +67,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
64
67
|
const SDK = __importStar(require("@fonoster/sdk"));
|
|
65
68
|
const prompts_1 = require("@inquirer/prompts");
|
|
66
69
|
const core_1 = require("@oclif/core");
|
|
67
|
-
const
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
class Update extends BaseCommand_1.BaseCommand {
|
|
70
|
+
const AuthenticatedCommand_1 = require("../../AuthenticatedCommand");
|
|
71
|
+
const errorHandler_1 = __importDefault(require("../../errorHandler"));
|
|
72
|
+
class Update extends AuthenticatedCommand_1.AuthenticatedCommand {
|
|
71
73
|
run() {
|
|
72
74
|
return __awaiter(this, void 0, void 0, function* () {
|
|
73
75
|
var _a, _b, _c, _d, _e;
|
|
74
|
-
const {
|
|
75
|
-
const
|
|
76
|
-
const currentWorkspace = workspaces.find((w) => w.active);
|
|
77
|
-
if (!currentWorkspace) {
|
|
78
|
-
this.error("No active workspace found.");
|
|
79
|
-
}
|
|
80
|
-
const client = new SDK.Client({
|
|
81
|
-
endpoint: currentWorkspace.endpoint,
|
|
82
|
-
accessKeyId: `WO${currentWorkspace.workspaceRef.replaceAll("-", "")}`,
|
|
83
|
-
allowInsecure: flags.insecure
|
|
84
|
-
});
|
|
85
|
-
yield client.loginWithApiKey(currentWorkspace.accessKeyId, currentWorkspace.accessKeySecret);
|
|
76
|
+
const { args } = yield this.parse(Update);
|
|
77
|
+
const client = yield this.createSdkClient();
|
|
86
78
|
const applications = new SDK.Applications(client);
|
|
87
79
|
const currentApplication = yield applications.getApplication(args.ref);
|
|
88
80
|
if (!currentApplication) {
|
|
89
81
|
this.error("Application not found.");
|
|
90
82
|
}
|
|
91
|
-
this.log("This utility will help you
|
|
83
|
+
this.log("This utility will help you update an Application.");
|
|
92
84
|
this.log("Press ^C at any time to quit.");
|
|
93
85
|
const answers = {
|
|
94
86
|
name: yield (0, prompts_1.input)({
|
|
@@ -163,23 +155,16 @@ class Update extends BaseCommand_1.BaseCommand {
|
|
|
163
155
|
return;
|
|
164
156
|
}
|
|
165
157
|
try {
|
|
166
|
-
const client = new SDK.Client({
|
|
167
|
-
endpoint: currentWorkspace.endpoint,
|
|
168
|
-
accessKeyId: `WO${currentWorkspace.workspaceRef.replaceAll("-", "")}`,
|
|
169
|
-
allowInsecure: flags.insecure
|
|
170
|
-
});
|
|
171
|
-
yield client.loginWithApiKey(currentWorkspace.accessKeyId, currentWorkspace.accessKeySecret);
|
|
172
|
-
const applications = new SDK.Applications(client);
|
|
173
158
|
yield applications.updateApplication(Object.assign({ ref: args.ref }, answers));
|
|
174
159
|
this.log("Done!");
|
|
175
160
|
}
|
|
176
161
|
catch (e) {
|
|
177
|
-
this.error(
|
|
162
|
+
(0, errorHandler_1.default)(e, this.error.bind(this));
|
|
178
163
|
}
|
|
179
164
|
});
|
|
180
165
|
}
|
|
181
166
|
}
|
|
182
|
-
Update.description = "
|
|
167
|
+
Update.description = "modify the configuration of an Application";
|
|
183
168
|
Update.examples = ["<%= config.bin %> <%= command.id %>"];
|
|
184
169
|
Update.args = {
|
|
185
170
|
ref: core_1.Args.string({ description: "the Application to update" })
|
package/dist/commands/bug.js
CHANGED
|
@@ -33,11 +33,11 @@ class Feedback extends core_1.Command {
|
|
|
33
33
|
run() {
|
|
34
34
|
return __awaiter(this, void 0, void 0, function* () {
|
|
35
35
|
const link = " https://docs.google.com/forms/d/e/1FAIpQLSd1G2ahRYqkbksOvz7XhNHfSLepUh3KzRHsXh2HXfZr68nhtQ/viewform?vc=0&c=0&w=1&flr=0";
|
|
36
|
-
this.log(`Please
|
|
36
|
+
this.log(`Please provide feedback on your experience by filling out the form below:\n${link}`);
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
Feedback.description = `
|
|
40
|
+
Feedback.description = `provide feedback on your experience
|
|
41
41
|
...
|
|
42
42
|
Help us improve by providing some feedback
|
|
43
43
|
`;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AuthenticatedCommand } from "../../AuthenticatedCommand";
|
|
2
|
+
export default class Create extends AuthenticatedCommand<typeof Create> {
|
|
3
|
+
static readonly description = "add a new Secret to the active Workspace";
|
|
4
|
+
static readonly examples: string[];
|
|
5
|
+
run(): Promise<void>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
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
|
+
/* eslint-disable import/no-unresolved */
|
|
49
|
+
/*
|
|
50
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
51
|
+
* http://github.com/fonoster/fonoster
|
|
52
|
+
*
|
|
53
|
+
* This file is part of Fonoster
|
|
54
|
+
*
|
|
55
|
+
* Licensed under the MIT License (the "License");
|
|
56
|
+
* you may not use this file except in compliance with
|
|
57
|
+
* the License. You may obtain a copy of the License at
|
|
58
|
+
*
|
|
59
|
+
* https://opensource.org/licenses/MIT
|
|
60
|
+
*
|
|
61
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
62
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
63
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
64
|
+
* See the License for the specific language governing permissions and
|
|
65
|
+
* limitations under the License.
|
|
66
|
+
*/
|
|
67
|
+
const SDK = __importStar(require("@fonoster/sdk"));
|
|
68
|
+
const prompts_1 = require("@inquirer/prompts");
|
|
69
|
+
const AuthenticatedCommand_1 = require("../../AuthenticatedCommand");
|
|
70
|
+
const errorHandler_1 = __importDefault(require("../../errorHandler"));
|
|
71
|
+
class Create extends AuthenticatedCommand_1.AuthenticatedCommand {
|
|
72
|
+
run() {
|
|
73
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
this.log("This utility will help you add a new Secret to the active Workspace.");
|
|
75
|
+
this.log("Press ^C at any time to quit.");
|
|
76
|
+
const answers = {
|
|
77
|
+
name: yield (0, prompts_1.input)({
|
|
78
|
+
message: "Name",
|
|
79
|
+
required: true
|
|
80
|
+
}),
|
|
81
|
+
secret: yield (0, prompts_1.password)({
|
|
82
|
+
message: "Secret"
|
|
83
|
+
}),
|
|
84
|
+
confirm: yield (0, prompts_1.confirm)({
|
|
85
|
+
message: "Ready?"
|
|
86
|
+
})
|
|
87
|
+
};
|
|
88
|
+
if (!answers.confirm) {
|
|
89
|
+
this.log("Aborted!");
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
try {
|
|
93
|
+
const client = yield this.createSdkClient();
|
|
94
|
+
const secrets = new SDK.Secrets(client);
|
|
95
|
+
yield secrets.createSecret(answers);
|
|
96
|
+
this.log("Done!");
|
|
97
|
+
}
|
|
98
|
+
catch (e) {
|
|
99
|
+
(0, errorHandler_1.default)(e, this.error.bind(this));
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
Create.description = "add a new Secret to the active Workspace";
|
|
105
|
+
Create.examples = ["<%= config.bin %> <%= command.id %>"];
|
|
106
|
+
exports.default = Create;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AuthenticatedCommand } from "../../AuthenticatedCommand";
|
|
2
|
+
export default class Delete extends AuthenticatedCommand<typeof Delete> {
|
|
3
|
+
static readonly description = "delete a Secret from the active Workspace";
|
|
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,87 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
/* eslint-disable import/no-unresolved */
|
|
46
|
+
/*
|
|
47
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
48
|
+
* http://github.com/fonoster/fonoster
|
|
49
|
+
*
|
|
50
|
+
* This file is part of Fonoster
|
|
51
|
+
*
|
|
52
|
+
* Licensed under the MIT License (the "License");
|
|
53
|
+
* you may not use this file except in compliance with
|
|
54
|
+
* the License. You may obtain a copy of the License at
|
|
55
|
+
*
|
|
56
|
+
* https://opensource.org/licenses/MIT
|
|
57
|
+
*
|
|
58
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
59
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
60
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
61
|
+
* See the License for the specific language governing permissions and
|
|
62
|
+
* limitations under the License.
|
|
63
|
+
*/
|
|
64
|
+
const SDK = __importStar(require("@fonoster/sdk"));
|
|
65
|
+
const core_1 = require("@oclif/core");
|
|
66
|
+
const AuthenticatedCommand_1 = require("../../AuthenticatedCommand");
|
|
67
|
+
class Delete extends AuthenticatedCommand_1.AuthenticatedCommand {
|
|
68
|
+
run() {
|
|
69
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
+
const { args } = yield this.parse(Delete);
|
|
71
|
+
const { ref } = args;
|
|
72
|
+
const client = yield this.createSdkClient();
|
|
73
|
+
const secrets = new SDK.Secrets(client);
|
|
74
|
+
yield secrets.deleteSecret(ref);
|
|
75
|
+
this.log("Done!");
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
Delete.description = "delete a Secret from the active Workspace";
|
|
80
|
+
Delete.examples = ["<%= config.bin %> <%= command.id %>"];
|
|
81
|
+
Delete.args = {
|
|
82
|
+
ref: core_1.Args.string({
|
|
83
|
+
description: "the Secret reference",
|
|
84
|
+
required: true
|
|
85
|
+
})
|
|
86
|
+
};
|
|
87
|
+
exports.default = Delete;
|
|
@@ -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 Secret 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,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
|
+
/* eslint-disable import/no-unresolved */
|
|
49
|
+
/*
|
|
50
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
51
|
+
* http://github.com/fonoster/fonoster
|
|
52
|
+
*
|
|
53
|
+
* This file is part of Fonoster
|
|
54
|
+
*
|
|
55
|
+
* Licensed under the MIT License (the "License");
|
|
56
|
+
* you may not use this file except in compliance with
|
|
57
|
+
* the License. You may obtain a copy of the License at
|
|
58
|
+
*
|
|
59
|
+
* https://opensource.org/licenses/MIT
|
|
60
|
+
*
|
|
61
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
62
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
63
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
64
|
+
* See the License for the specific language governing permissions and
|
|
65
|
+
* limitations under the License.
|
|
66
|
+
*/
|
|
67
|
+
const SDK = __importStar(require("@fonoster/sdk"));
|
|
68
|
+
const core_1 = require("@oclif/core");
|
|
69
|
+
const cliui_1 = __importDefault(require("cliui"));
|
|
70
|
+
const moment_1 = __importDefault(require("moment"));
|
|
71
|
+
const AuthenticatedCommand_1 = require("../../AuthenticatedCommand");
|
|
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
|
+
const client = yield this.createSdkClient();
|
|
77
|
+
const secrets = new SDK.Secrets(client);
|
|
78
|
+
const response = yield secrets.getSecret(args.ref);
|
|
79
|
+
const ui = (0, cliui_1.default)({ width: 200 });
|
|
80
|
+
ui.div("APPLICATION DETAILS\n" +
|
|
81
|
+
"------------------\n" +
|
|
82
|
+
`NAME: \t${response.name}\n` +
|
|
83
|
+
`REF: \t${response.ref}\n` +
|
|
84
|
+
`CREATED: \t${(0, moment_1.default)(response.createdAt).format("YYYY-MM-DD HH:mm:ss")}\n` +
|
|
85
|
+
`UPDATED: \t${(0, moment_1.default)(response.updatedAt).format("YYYY-MM-DD HH:mm:ss")}`);
|
|
86
|
+
this.log(ui.toString());
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
Get.description = "retrieve details of a Secret by reference";
|
|
91
|
+
Get.examples = ["<%= config.bin %> <%= command.id %>"];
|
|
92
|
+
Get.args = {
|
|
93
|
+
ref: core_1.Args.string({ description: "The Secret to show details about" })
|
|
94
|
+
};
|
|
95
|
+
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 Secrets 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
|
+
}
|