@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,187 +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 core_1 = require("@oclif/core");
|
|
67
|
-
const BaseCommand_1 = require("../../BaseCommand");
|
|
68
|
-
const config_1 = require("../../config");
|
|
69
|
-
const constants_1 = require("../../constants");
|
|
70
|
-
class Update extends BaseCommand_1.BaseCommand {
|
|
71
|
-
run() {
|
|
72
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
-
var _a, _b, _c, _d, _e;
|
|
74
|
-
const { flags, args } = yield this.parse(Update);
|
|
75
|
-
const workspaces = (0, config_1.getConfig)(constants_1.CONFIG_FILE);
|
|
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);
|
|
86
|
-
const applications = new SDK.Applications(client);
|
|
87
|
-
const currentApplication = yield applications.getApplication(args.ref);
|
|
88
|
-
if (!currentApplication) {
|
|
89
|
-
this.error("Application not found.");
|
|
90
|
-
}
|
|
91
|
-
this.log("This utility will help you create an Application.");
|
|
92
|
-
this.log("Press ^C at any time to quit.");
|
|
93
|
-
const answers = {
|
|
94
|
-
name: yield (0, prompts_1.input)({
|
|
95
|
-
message: "Name",
|
|
96
|
-
required: true,
|
|
97
|
-
default: currentApplication.name
|
|
98
|
-
}),
|
|
99
|
-
type: yield (0, prompts_1.select)({
|
|
100
|
-
message: "Type",
|
|
101
|
-
choices: [{ name: "External", value: "External" }],
|
|
102
|
-
default: currentApplication.type
|
|
103
|
-
}),
|
|
104
|
-
endpoint: yield (0, prompts_1.input)({
|
|
105
|
-
message: "Endpoint",
|
|
106
|
-
required: true,
|
|
107
|
-
default: currentApplication.endpoint
|
|
108
|
-
}),
|
|
109
|
-
speechToText: {
|
|
110
|
-
productRef: yield (0, prompts_1.select)({
|
|
111
|
-
message: "SST Vendor",
|
|
112
|
-
choices: [{ name: "Deepgram", value: "stt.deepgram" }],
|
|
113
|
-
default: (_a = currentApplication.speechToText) === null || _a === void 0 ? void 0 : _a.productRef
|
|
114
|
-
}),
|
|
115
|
-
config: {
|
|
116
|
-
languageCode: yield (0, prompts_1.select)({
|
|
117
|
-
message: "STT Language",
|
|
118
|
-
choices: [
|
|
119
|
-
{ name: "English", value: "en-US" },
|
|
120
|
-
{ name: "Spanish", value: "es-ES" }
|
|
121
|
-
],
|
|
122
|
-
default: (_b = currentApplication.speechToText) === null || _b === void 0 ? void 0 : _b.config.languageCode
|
|
123
|
-
}),
|
|
124
|
-
model: yield (0, prompts_1.select)({
|
|
125
|
-
message: "STT Model",
|
|
126
|
-
choices: [
|
|
127
|
-
{ name: "Nova 2", value: "nova-2" },
|
|
128
|
-
{ name: "Nova 2 Phone Call", value: "nova-2-phonecall" },
|
|
129
|
-
{
|
|
130
|
-
name: "Nova 2 Conversational AI",
|
|
131
|
-
value: "nova-2-conversationalai"
|
|
132
|
-
}
|
|
133
|
-
],
|
|
134
|
-
default: (_c = currentApplication.speechToText) === null || _c === void 0 ? void 0 : _c.config.model
|
|
135
|
-
})
|
|
136
|
-
}
|
|
137
|
-
},
|
|
138
|
-
textToSpeech: {
|
|
139
|
-
productRef: yield (0, prompts_1.select)({
|
|
140
|
-
message: "TTV Vendor",
|
|
141
|
-
choices: [
|
|
142
|
-
{ name: "Deepgram", value: "tts.deepgram" },
|
|
143
|
-
{ name: "ElevenLabs", value: "tts.elevenlabs" },
|
|
144
|
-
{ name: "Google", value: "tts.google" },
|
|
145
|
-
{ name: "Azure", value: "tts.azure" }
|
|
146
|
-
],
|
|
147
|
-
default: (_d = currentApplication.textToSpeech) === null || _d === void 0 ? void 0 : _d.productRef
|
|
148
|
-
}),
|
|
149
|
-
config: {
|
|
150
|
-
voice: yield (0, prompts_1.input)({
|
|
151
|
-
message: "TTS Voice",
|
|
152
|
-
required: true,
|
|
153
|
-
default: (_e = currentApplication.textToSpeech) === null || _e === void 0 ? void 0 : _e.config.voice
|
|
154
|
-
})
|
|
155
|
-
}
|
|
156
|
-
},
|
|
157
|
-
confirm: yield (0, prompts_1.confirm)({
|
|
158
|
-
message: "Ready?"
|
|
159
|
-
})
|
|
160
|
-
};
|
|
161
|
-
if (!answers.confirm) {
|
|
162
|
-
this.log("Aborted!");
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
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
|
-
yield applications.updateApplication(Object.assign({ ref: args.ref }, answers));
|
|
174
|
-
this.log("Done!");
|
|
175
|
-
}
|
|
176
|
-
catch (e) {
|
|
177
|
-
this.error(e);
|
|
178
|
-
}
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
Update.description = "update an existing Application";
|
|
183
|
-
Update.examples = ["<%= config.bin %> <%= command.id %>"];
|
|
184
|
-
Update.args = {
|
|
185
|
-
ref: core_1.Args.string({ description: "the Application to update" })
|
|
186
|
-
};
|
|
187
|
-
exports.default = Update;
|
package/dist/commands/bug.d.ts
DELETED
package/dist/commands/bug.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
/* eslint-disable import/no-unresolved */
|
|
13
|
-
/*
|
|
14
|
-
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
15
|
-
* http://github.com/fonoster/fonoster
|
|
16
|
-
*
|
|
17
|
-
* This file is part of Fonoster
|
|
18
|
-
*
|
|
19
|
-
* Licensed under the MIT License (the "License");
|
|
20
|
-
* you may not use this file except in compliance with
|
|
21
|
-
* the License. You may obtain a copy of the License at
|
|
22
|
-
*
|
|
23
|
-
* https://opensource.org/licenses/MIT
|
|
24
|
-
*
|
|
25
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
26
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
27
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
28
|
-
* See the License for the specific language governing permissions and
|
|
29
|
-
* limitations under the License.
|
|
30
|
-
*/
|
|
31
|
-
const core_1 = require("@oclif/core");
|
|
32
|
-
class Bug extends core_1.Command {
|
|
33
|
-
run() {
|
|
34
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
-
const link = " https://github.com/fonoster/fonoster/issues/new?assignees=&labels=bug&projects=&template=bug_report.yaml&title=%5BBUG%5D%3A+";
|
|
36
|
-
this.log(`Please report bugs to the link below:\n${link}`);
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
Bug.description = "start a bug report 🐞";
|
|
41
|
-
Bug.examples = ["<%= config.bin %> <%= command.id %>"];
|
|
42
|
-
exports.default = Bug;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
/* eslint-disable import/no-unresolved */
|
|
13
|
-
/*
|
|
14
|
-
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
15
|
-
* http://github.com/fonoster/fonoster
|
|
16
|
-
*
|
|
17
|
-
* This file is part of Fonoster
|
|
18
|
-
*
|
|
19
|
-
* Licensed under the MIT License (the "License");
|
|
20
|
-
* you may not use this file except in compliance with
|
|
21
|
-
* the License. You may obtain a copy of the License at
|
|
22
|
-
*
|
|
23
|
-
* https://opensource.org/licenses/MIT
|
|
24
|
-
*
|
|
25
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
26
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
27
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
28
|
-
* See the License for the specific language governing permissions and
|
|
29
|
-
* limitations under the License.
|
|
30
|
-
*/
|
|
31
|
-
const core_1 = require("@oclif/core");
|
|
32
|
-
class Feedback extends core_1.Command {
|
|
33
|
-
run() {
|
|
34
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
-
const link = " https://docs.google.com/forms/d/e/1FAIpQLSd1G2ahRYqkbksOvz7XhNHfSLepUh3KzRHsXh2HXfZr68nhtQ/viewform?vc=0&c=0&w=1&flr=0";
|
|
36
|
-
this.log(`Please let us know how we're doing by filling out the form below:\n${link}`);
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
Feedback.description = `let us know how we're doing
|
|
41
|
-
...
|
|
42
|
-
Help us improve by providing some feedback
|
|
43
|
-
`;
|
|
44
|
-
Feedback.examples = ["<%= config.bin %> <%= command.id %>"];
|
|
45
|
-
exports.default = Feedback;
|
|
@@ -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,125 +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, _e, _f;
|
|
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 numbers = new SDK.Numbers(client);
|
|
92
|
-
const response = yield numbers.getNumber(args.ref);
|
|
93
|
-
const apps = new SDK.Applications(client);
|
|
94
|
-
let app;
|
|
95
|
-
try {
|
|
96
|
-
app = yield apps.getApplication(response.appRef);
|
|
97
|
-
}
|
|
98
|
-
catch (e) {
|
|
99
|
-
// You can only try
|
|
100
|
-
}
|
|
101
|
-
const ui = (0, cliui_1.default)({ width: 200 });
|
|
102
|
-
ui.div("NUMBERS DETAILS\n" +
|
|
103
|
-
"------------------\n" +
|
|
104
|
-
`NAME: \t${response.name}\n` +
|
|
105
|
-
`REF: \t${response.ref}\n` +
|
|
106
|
-
`TEL URL: \t${response.telUrl}\n` +
|
|
107
|
-
`APP: \t${(_a = app === null || app === void 0 ? void 0 : app.name) !== null && _a !== void 0 ? _a : ""}\n` +
|
|
108
|
-
`APP REF: \t${(_b = app === null || app === void 0 ? void 0 : app.ref) !== null && _b !== void 0 ? _b : ""}\n` +
|
|
109
|
-
`CITY: \t${response.city}\n` +
|
|
110
|
-
`TRUNK NAME: \t${(_d = (_c = response.trunk) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : ""}\n` +
|
|
111
|
-
`TRUNK REF: \t${(_f = (_e = response.trunk) === null || _e === void 0 ? void 0 : _e.ref) !== null && _f !== void 0 ? _f : ""}\n` +
|
|
112
|
-
`COUNTRY ISO CODE: \t${response.countryIsoCode}\n` +
|
|
113
|
-
`COUNTRY: \t${response.country}\n` +
|
|
114
|
-
`CREATED: \t${(0, moment_1.default)(response.createdAt).format("YYYY-MM-DD HH:mm:ss")}\n` +
|
|
115
|
-
`UPDATED: \t${(0, moment_1.default)(response.updatedAt).format("YYYY-MM-DD HH:mm:ss")}`);
|
|
116
|
-
this.log(ui.toString());
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
Get.description = "get an Number by reference";
|
|
121
|
-
Get.examples = ["<%= config.bin %> <%= command.id %>"];
|
|
122
|
-
Get.args = {
|
|
123
|
-
ref: core_1.Args.string({ description: "the Number to show details about" })
|
|
124
|
-
};
|
|
125
|
-
exports.default = Get;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { BaseCommand } from "../../BaseCommand";
|
|
2
|
-
export default class LinkTwilioNumber extends BaseCommand<typeof LinkTwilioNumber> {
|
|
3
|
-
static description: string;
|
|
4
|
-
static examples: string[];
|
|
5
|
-
static flags: {
|
|
6
|
-
"outbound-uri-base": import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
7
|
-
"access-control-list": import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
|
-
};
|
|
9
|
-
run(): Promise<void>;
|
|
10
|
-
}
|
|
@@ -1,155 +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 Fonoster = __importStar(require("@fonoster/sdk"));
|
|
65
|
-
const prompts_1 = require("@inquirer/prompts");
|
|
66
|
-
const core_1 = require("@oclif/core");
|
|
67
|
-
const twilio_1 = require("twilio");
|
|
68
|
-
const BaseCommand_1 = require("../../BaseCommand");
|
|
69
|
-
const config_1 = require("../../config");
|
|
70
|
-
const constants_1 = require("../../constants");
|
|
71
|
-
const utils_1 = require("../../utils");
|
|
72
|
-
class LinkTwilioNumber extends BaseCommand_1.BaseCommand {
|
|
73
|
-
run() {
|
|
74
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
-
const { flags } = yield this.parse(LinkTwilioNumber);
|
|
76
|
-
const workspaces = (0, config_1.getConfig)(constants_1.CONFIG_FILE);
|
|
77
|
-
const currentWorkspace = workspaces.find((w) => w.active);
|
|
78
|
-
const accessKeyId = `WO${currentWorkspace.workspaceRef.replaceAll("-", "")}`;
|
|
79
|
-
if (!currentWorkspace) {
|
|
80
|
-
this.error("No active workspace found.");
|
|
81
|
-
}
|
|
82
|
-
const fonosterClient = new Fonoster.Client({
|
|
83
|
-
endpoint: currentWorkspace.endpoint,
|
|
84
|
-
accessKeyId,
|
|
85
|
-
allowInsecure: flags.insecure
|
|
86
|
-
});
|
|
87
|
-
yield fonosterClient.loginWithApiKey(currentWorkspace.accessKeyId, currentWorkspace.accessKeySecret);
|
|
88
|
-
const applications = new Fonoster.Applications(fonosterClient);
|
|
89
|
-
const appsList = yield applications.listApplications({ pageSize: 1000 });
|
|
90
|
-
this.log("This utility will help you create an Application.");
|
|
91
|
-
this.log("Press ^C at any time to quit.");
|
|
92
|
-
const answers = {
|
|
93
|
-
number: yield (0, prompts_1.input)({
|
|
94
|
-
message: "Number to link (E.164 format)",
|
|
95
|
-
required: true
|
|
96
|
-
}),
|
|
97
|
-
friendlyName: yield (0, prompts_1.input)({
|
|
98
|
-
message: "Friendly Name"
|
|
99
|
-
}),
|
|
100
|
-
applicationRef: yield (0, prompts_1.select)({
|
|
101
|
-
message: "Application",
|
|
102
|
-
choices: appsList.items.map((app) => ({
|
|
103
|
-
name: app.name,
|
|
104
|
-
value: app.ref
|
|
105
|
-
}))
|
|
106
|
-
}),
|
|
107
|
-
twilioAccountSid: yield (0, prompts_1.input)({
|
|
108
|
-
message: "Twilio Account SID",
|
|
109
|
-
required: true
|
|
110
|
-
}),
|
|
111
|
-
twilioAuthToken: yield (0, prompts_1.password)({
|
|
112
|
-
message: "Twilio Auth Token"
|
|
113
|
-
}),
|
|
114
|
-
confirm: yield (0, prompts_1.confirm)({
|
|
115
|
-
message: "Ready?"
|
|
116
|
-
})
|
|
117
|
-
};
|
|
118
|
-
if (!answers.confirm) {
|
|
119
|
-
this.log("Aborted!");
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
try {
|
|
123
|
-
const twilioClient = new twilio_1.Twilio(answers.twilioAccountSid, answers.twilioAuthToken);
|
|
124
|
-
yield (0, utils_1.linkTwilioNumberToApplication)(twilioClient, fonosterClient, {
|
|
125
|
-
phoneNumber: answers.number,
|
|
126
|
-
accessKeyId,
|
|
127
|
-
aclEntries: flags["access-control-list"].split(","),
|
|
128
|
-
originationUriBase: flags["outbound-uri-base"],
|
|
129
|
-
applicationRef: answers.applicationRef,
|
|
130
|
-
friendlyName: answers.friendlyName
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
catch (error) {
|
|
134
|
-
this.error(`Failed to link number: ${error.message}`);
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
LinkTwilioNumber.description = "connect a Twilio number to a Fonoster application";
|
|
140
|
-
LinkTwilioNumber.examples = ["<%= config.bin %> <%= command.id %>"];
|
|
141
|
-
LinkTwilioNumber.flags = {
|
|
142
|
-
"outbound-uri-base": core_1.Flags.string({
|
|
143
|
-
char: "b",
|
|
144
|
-
description: "the uri to point twilio to for outbound calls (use if running your Fonoster instance)",
|
|
145
|
-
default: constants_1.FONOSTER_ORIGINATION_URI_BASE,
|
|
146
|
-
required: false
|
|
147
|
-
}),
|
|
148
|
-
"access-control-list": core_1.Flags.string({
|
|
149
|
-
char: "a",
|
|
150
|
-
description: "the access control list to allow (use if running your Fonoster instance)",
|
|
151
|
-
default: constants_1.FONOSTER_ACCESS_CONTROL_LIST.join(","),
|
|
152
|
-
required: false
|
|
153
|
-
})
|
|
154
|
-
};
|
|
155
|
-
exports.default = LinkTwilioNumber;
|
|
@@ -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
|
-
}
|