@fonoster/ctl 0.7.42 → 0.7.44
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 +8 -410
- package/bin/run.js +21 -3
- package/package.json +6 -7
- package/dist/BaseCommand.d.ts +0 -15
- package/dist/BaseCommand.js +0 -80
- package/dist/Help.d.ts +0 -6
- package/dist/Help.js +0 -52
- package/dist/commands/applications/create.d.ts +0 -6
- package/dist/commands/applications/create.js +0 -164
- package/dist/commands/applications/delete.d.ts +0 -9
- package/dist/commands/applications/delete.js +0 -99
- package/dist/commands/applications/get.d.ts +0 -9
- package/dist/commands/applications/get.js +0 -120
- package/dist/commands/applications/list.d.ts +0 -9
- package/dist/commands/applications/list.js +0 -112
- package/dist/commands/applications/update.d.ts +0 -9
- package/dist/commands/applications/update.js +0 -187
- package/dist/commands/bug.d.ts +0 -6
- package/dist/commands/bug.js +0 -42
- package/dist/commands/feedback.d.ts +0 -6
- package/dist/commands/feedback.js +0 -45
- package/dist/commands/numbers/get.d.ts +0 -9
- package/dist/commands/numbers/get.js +0 -125
- package/dist/commands/numbers/linkTwilioNumber.d.ts +0 -10
- package/dist/commands/numbers/linkTwilioNumber.js +0 -155
- package/dist/commands/numbers/list.d.ts +0 -9
- package/dist/commands/numbers/list.js +0 -116
- package/dist/commands/workspaces/current.d.ts +0 -6
- package/dist/commands/workspaces/current.js +0 -46
- package/dist/commands/workspaces/list.d.ts +0 -6
- package/dist/commands/workspaces/list.js +0 -53
- package/dist/commands/workspaces/login.d.ts +0 -8
- package/dist/commands/workspaces/login.js +0 -145
- package/dist/commands/workspaces/logout.d.ts +0 -9
- package/dist/commands/workspaces/logout.js +0 -54
- package/dist/commands/workspaces/use.d.ts +0 -9
- package/dist/commands/workspaces/use.js +0 -57
- package/dist/config/addWorkspace.d.ts +0 -3
- package/dist/config/addWorkspace.js +0 -15
- package/dist/config/getConfig.d.ts +0 -3
- package/dist/config/getConfig.js +0 -34
- package/dist/config/getCurrentWorkspace.d.ts +0 -3
- package/dist/config/getCurrentWorkspace.js +0 -10
- package/dist/config/index.d.ts +0 -7
- package/dist/config/index.js +0 -41
- package/dist/config/removeWorkspace.d.ts +0 -3
- package/dist/config/removeWorkspace.js +0 -6
- package/dist/config/saveConfig.d.ts +0 -3
- package/dist/config/saveConfig.js +0 -32
- package/dist/config/setCurrentWorkspace.d.ts +0 -3
- package/dist/config/setCurrentWorkspace.js +0 -11
- package/dist/config/types.d.ts +0 -4
- package/dist/config/types.js +0 -2
- package/dist/config/validations.d.ts +0 -27
- package/dist/config/validations.js +0 -34
- package/dist/constants.d.ts +0 -6
- package/dist/constants.js +0 -29
- package/dist/utils/assignTwilioNumberToTrunk.d.ts +0 -3
- package/dist/utils/assignTwilioNumberToTrunk.js +0 -33
- package/dist/utils/createTwilioTrunk.d.ts +0 -4
- package/dist/utils/createTwilioTrunk.js +0 -54
- package/dist/utils/getFonosterNumberByTelUrl.d.ts +0 -4
- package/dist/utils/getFonosterNumberByTelUrl.js +0 -76
- package/dist/utils/getFonosterTrunkByInboundUri.d.ts +0 -4
- package/dist/utils/getFonosterTrunkByInboundUri.js +0 -76
- package/dist/utils/getTwilioNumber.d.ts +0 -4
- package/dist/utils/getTwilioNumber.js +0 -23
- package/dist/utils/getTwilioTrunk.d.ts +0 -4
- package/dist/utils/getTwilioTrunk.js +0 -23
- package/dist/utils/index.d.ts +0 -8
- package/dist/utils/index.js +0 -42
- package/dist/utils/linkTwilioNumberToApplication.d.ts +0 -5
- package/dist/utils/linkTwilioNumberToApplication.js +0 -128
- package/dist/utils/types.d.ts +0 -14
- package/dist/utils/types.js +0 -2
|
@@ -1,164 +0,0 @@
|
|
|
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 prompts_1 = require("@inquirer/prompts");
|
|
66
|
-
const BaseCommand_1 = require("../../BaseCommand");
|
|
67
|
-
const config_1 = require("../../config");
|
|
68
|
-
const constants_1 = require("../../constants");
|
|
69
|
-
class Create extends BaseCommand_1.BaseCommand {
|
|
70
|
-
run() {
|
|
71
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
72
|
-
const { flags } = yield this.parse(Create);
|
|
73
|
-
const workspaces = (0, config_1.getConfig)(constants_1.CONFIG_FILE);
|
|
74
|
-
const currentWorkspace = workspaces.find((w) => w.active);
|
|
75
|
-
if (!currentWorkspace) {
|
|
76
|
-
this.error("No active workspace found.");
|
|
77
|
-
}
|
|
78
|
-
this.log("This utility will help you create an Application.");
|
|
79
|
-
this.log("Press ^C at any time to quit.");
|
|
80
|
-
const answers = {
|
|
81
|
-
name: yield (0, prompts_1.input)({
|
|
82
|
-
message: "Name",
|
|
83
|
-
required: true
|
|
84
|
-
}),
|
|
85
|
-
type: yield (0, prompts_1.select)({
|
|
86
|
-
message: "Type",
|
|
87
|
-
choices: [{ name: "External", value: "External" }]
|
|
88
|
-
}),
|
|
89
|
-
endpoint: yield (0, prompts_1.input)({
|
|
90
|
-
message: "Endpoint",
|
|
91
|
-
required: true
|
|
92
|
-
}),
|
|
93
|
-
speechToText: {
|
|
94
|
-
productRef: yield (0, prompts_1.select)({
|
|
95
|
-
message: "SST Vendor",
|
|
96
|
-
choices: [{ name: "Deepgram", value: "stt.deepgram" }]
|
|
97
|
-
}),
|
|
98
|
-
config: {
|
|
99
|
-
languageCode: yield (0, prompts_1.select)({
|
|
100
|
-
message: "STT Language",
|
|
101
|
-
choices: [
|
|
102
|
-
{ name: "English", value: "en-US" },
|
|
103
|
-
{ name: "Spanish", value: "es-ES" }
|
|
104
|
-
]
|
|
105
|
-
}),
|
|
106
|
-
model: yield (0, prompts_1.select)({
|
|
107
|
-
message: "STT Model",
|
|
108
|
-
choices: [
|
|
109
|
-
{ name: "Nova 2", value: "nova-2" },
|
|
110
|
-
{ name: "Nova 2 Phone Call", value: "nova-2-phonecall" },
|
|
111
|
-
{
|
|
112
|
-
name: "Nova 2 Conversational AI",
|
|
113
|
-
value: "nova-2-conversationalai"
|
|
114
|
-
}
|
|
115
|
-
],
|
|
116
|
-
default: "nova-2"
|
|
117
|
-
})
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
textToSpeech: {
|
|
121
|
-
productRef: yield (0, prompts_1.select)({
|
|
122
|
-
message: "TTV Vendor",
|
|
123
|
-
choices: [
|
|
124
|
-
{ name: "Deepgram", value: "tts.deepgram" },
|
|
125
|
-
{ name: "ElevenLabs", value: "tts.elevenlabs" },
|
|
126
|
-
{ name: "Google", value: "tts.google" },
|
|
127
|
-
{ name: "Azure", value: "tts.azure" }
|
|
128
|
-
]
|
|
129
|
-
}),
|
|
130
|
-
config: {
|
|
131
|
-
voice: yield (0, prompts_1.input)({
|
|
132
|
-
message: "TTS Voice",
|
|
133
|
-
required: true
|
|
134
|
-
})
|
|
135
|
-
}
|
|
136
|
-
},
|
|
137
|
-
confirm: yield (0, prompts_1.confirm)({
|
|
138
|
-
message: "Ready?"
|
|
139
|
-
})
|
|
140
|
-
};
|
|
141
|
-
if (!answers.confirm) {
|
|
142
|
-
this.log("Aborted!");
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
try {
|
|
146
|
-
const client = new SDK.Client({
|
|
147
|
-
endpoint: currentWorkspace.endpoint,
|
|
148
|
-
accessKeyId: `WO${currentWorkspace.workspaceRef.replaceAll("-", "")}`,
|
|
149
|
-
allowInsecure: flags.insecure
|
|
150
|
-
});
|
|
151
|
-
yield client.loginWithApiKey(currentWorkspace.accessKeyId, currentWorkspace.accessKeySecret);
|
|
152
|
-
const applications = new SDK.Applications(client);
|
|
153
|
-
yield applications.createApplication(answers);
|
|
154
|
-
this.log("Done!");
|
|
155
|
-
}
|
|
156
|
-
catch (e) {
|
|
157
|
-
this.error(e);
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
Create.description = "create a new Application";
|
|
163
|
-
Create.examples = ["<%= config.bin %> <%= command.id %>"];
|
|
164
|
-
exports.default = Create;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { BaseCommand } from "../../BaseCommand";
|
|
2
|
-
export default class Delete extends BaseCommand<typeof Delete> {
|
|
3
|
-
static description: string;
|
|
4
|
-
static examples: string[];
|
|
5
|
-
static args: {
|
|
6
|
-
ref: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
|
-
};
|
|
8
|
-
run(): Promise<void>;
|
|
9
|
-
}
|
|
@@ -1,99 +0,0 @@
|
|
|
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 BaseCommand_1 = require("../../BaseCommand");
|
|
67
|
-
const config_1 = require("../../config");
|
|
68
|
-
const constants_1 = require("../../constants");
|
|
69
|
-
class Delete extends BaseCommand_1.BaseCommand {
|
|
70
|
-
run() {
|
|
71
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
72
|
-
const { args, flags } = yield this.parse(Delete);
|
|
73
|
-
const workspaces = (0, config_1.getConfig)(constants_1.CONFIG_FILE);
|
|
74
|
-
const currentWorkspace = workspaces.find((w) => w.active);
|
|
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);
|
|
88
|
-
const applications = new SDK.Applications(client);
|
|
89
|
-
yield applications.deleteApplication(args.ref);
|
|
90
|
-
this.log("Done!");
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
Delete.description = "remove an Application from the system";
|
|
95
|
-
Delete.examples = ["<%= config.bin %> <%= command.id %>"];
|
|
96
|
-
Delete.args = {
|
|
97
|
-
ref: core_1.Args.string({ description: "the Application to delete" })
|
|
98
|
-
};
|
|
99
|
-
exports.default = Delete;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { BaseCommand } from "../../BaseCommand";
|
|
2
|
-
export default class Get extends BaseCommand<typeof Get> {
|
|
3
|
-
static description: string;
|
|
4
|
-
static examples: string[];
|
|
5
|
-
static args: {
|
|
6
|
-
ref: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
|
-
};
|
|
8
|
-
run(): Promise<void>;
|
|
9
|
-
}
|
|
@@ -1,120 +0,0 @@
|
|
|
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 BaseCommand_1 = require("../../BaseCommand");
|
|
72
|
-
const config_1 = require("../../config");
|
|
73
|
-
const constants_1 = require("../../constants");
|
|
74
|
-
class Get extends BaseCommand_1.BaseCommand {
|
|
75
|
-
run() {
|
|
76
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
-
var _a, _b, _c, _d;
|
|
78
|
-
const { flags } = yield this.parse(Get);
|
|
79
|
-
const { args } = yield this.parse(Get);
|
|
80
|
-
const workspaces = (0, config_1.getConfig)(constants_1.CONFIG_FILE);
|
|
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);
|
|
91
|
-
const applications = new SDK.Applications(client);
|
|
92
|
-
const response = yield applications.getApplication(args.ref);
|
|
93
|
-
const ui = (0, cliui_1.default)({ width: 200 });
|
|
94
|
-
// STT or none of productRef is undefined
|
|
95
|
-
const stt = ((_a = response.speechToText) === null || _a === void 0 ? void 0 : _a.productRef)
|
|
96
|
-
? (_b = response.speechToText) === null || _b === void 0 ? void 0 : _b.productRef.replace("stt.", "")
|
|
97
|
-
: "none";
|
|
98
|
-
const tts = ((_c = response.textToSpeech) === null || _c === void 0 ? void 0 : _c.productRef)
|
|
99
|
-
? (_d = response.textToSpeech) === null || _d === void 0 ? void 0 : _d.productRef.replace("tts.", "")
|
|
100
|
-
: "none";
|
|
101
|
-
ui.div("APPLICATION DETAILS\n" +
|
|
102
|
-
"------------------\n" +
|
|
103
|
-
`NAME: \t${response.name}\n` +
|
|
104
|
-
`REF: \t${response.ref}\n` +
|
|
105
|
-
`STT: \t${stt}\n` +
|
|
106
|
-
`TTS: \t${tts}\n` +
|
|
107
|
-
`TYPE: \t${response.type}\n` +
|
|
108
|
-
`ENDPOINT: \t${response.endpoint}\n` +
|
|
109
|
-
`CREATED: \t${(0, moment_1.default)(response.createdAt).format("YYYY-MM-DD HH:mm:ss")}\n` +
|
|
110
|
-
`UPDATED: \t${(0, moment_1.default)(response.updatedAt).format("YYYY-MM-DD HH:mm:ss")}`);
|
|
111
|
-
this.log(ui.toString());
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
Get.description = "get an Application by reference";
|
|
116
|
-
Get.examples = ["<%= config.bin %> <%= command.id %>"];
|
|
117
|
-
Get.args = {
|
|
118
|
-
ref: core_1.Args.string({ description: "The Application to show details about" })
|
|
119
|
-
};
|
|
120
|
-
exports.default = Get;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { BaseCommand } from "../../BaseCommand";
|
|
2
|
-
export default class List extends BaseCommand<typeof List> {
|
|
3
|
-
static description: string;
|
|
4
|
-
static examples: string[];
|
|
5
|
-
static flags: {
|
|
6
|
-
"page-size": import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
7
|
-
};
|
|
8
|
-
run(): Promise<void>;
|
|
9
|
-
}
|
|
@@ -1,112 +0,0 @@
|
|
|
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 BaseCommand_1 = require("../../BaseCommand");
|
|
71
|
-
const config_1 = require("../../config");
|
|
72
|
-
const constants_1 = require("../../constants");
|
|
73
|
-
class List extends BaseCommand_1.BaseCommand {
|
|
74
|
-
run() {
|
|
75
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
-
const { flags } = yield this.parse(List);
|
|
77
|
-
const workspaces = (0, config_1.getConfig)(constants_1.CONFIG_FILE);
|
|
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);
|
|
88
|
-
const applications = new SDK.Applications(client);
|
|
89
|
-
const response = yield applications.listApplications({
|
|
90
|
-
pageSize: parseInt(flags["page-size"]),
|
|
91
|
-
pageToken: ""
|
|
92
|
-
});
|
|
93
|
-
const ui = (0, cliui_1.default)({ width: 170 });
|
|
94
|
-
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] });
|
|
95
|
-
response.items.forEach((application) => {
|
|
96
|
-
ui.div({ text: application.ref, padding: [0, 0, 0, 0], width: 40 }, { text: application.name, padding: [0, 0, 0, 0], width: 30 }, { text: application.type, padding: [0, 0, 0, 0], width: 10 }, { text: application.endpoint, padding: [0, 0, 0, 0] });
|
|
97
|
-
});
|
|
98
|
-
this.log(ui.toString());
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
List.description = "list all existing Applications";
|
|
103
|
-
List.examples = ["<%= config.bin %> <%= command.id %>"];
|
|
104
|
-
List.flags = {
|
|
105
|
-
"page-size": core_1.Flags.string({
|
|
106
|
-
char: "s",
|
|
107
|
-
description: "the number of items to show",
|
|
108
|
-
default: "1000",
|
|
109
|
-
required: false
|
|
110
|
-
})
|
|
111
|
-
};
|
|
112
|
-
exports.default = List;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { BaseCommand } from "../../BaseCommand";
|
|
2
|
-
export default class Update extends BaseCommand<typeof Update> {
|
|
3
|
-
static description: string;
|
|
4
|
-
static examples: string[];
|
|
5
|
-
static args: {
|
|
6
|
-
ref: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
|
-
};
|
|
8
|
-
run(): Promise<void>;
|
|
9
|
-
}
|