@fonoster/ctl 0.27.0 → 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +586 -88
- package/dist/AuthenticatedCommand.d.ts +5 -0
- package/dist/AuthenticatedCommand.js +12 -1
- package/dist/commands/applications/create.d.ts +23 -0
- package/dist/commands/applications/create.js +68 -169
- package/dist/commands/applications/eval.d.ts +1 -1
- package/dist/commands/applications/eval.js +46 -33
- package/dist/commands/applications/get.d.ts +2 -0
- package/dist/commands/applications/get.js +55 -24
- package/dist/commands/applications/list.js +19 -3
- package/dist/commands/applications/rotate-secret.d.ts +9 -0
- package/dist/commands/applications/rotate-secret.js +97 -0
- package/dist/commands/applications/update.d.ts +22 -1
- package/dist/commands/applications/update.js +17 -168
- package/dist/commands/providers/catalog.d.ts +10 -0
- package/dist/commands/providers/catalog.js +128 -0
- package/dist/commands/providers/keys/delete.d.ts +9 -0
- package/dist/commands/providers/keys/delete.js +92 -0
- package/dist/commands/providers/keys/list.d.ts +6 -0
- package/dist/commands/providers/keys/list.js +97 -0
- package/dist/commands/providers/keys/set.d.ts +12 -0
- package/dist/commands/providers/keys/set.js +110 -0
- package/dist/commands/records/download.d.ts +15 -0
- package/dist/commands/records/download.js +132 -0
- package/dist/commands/records/get.d.ts +15 -0
- package/dist/commands/records/get.js +146 -0
- package/dist/commands/records/list.d.ts +15 -0
- package/dist/commands/records/list.js +136 -0
- package/dist/commands/sipnet/calls/create.d.ts +3 -3
- package/dist/commands/sipnet/calls/create.js +35 -52
- package/dist/commands/webhooks/create.d.ts +10 -0
- package/dist/commands/webhooks/create.js +104 -0
- package/dist/commands/webhooks/delete.d.ts +9 -0
- package/dist/commands/webhooks/delete.js +92 -0
- package/dist/commands/webhooks/deliveries.d.ts +12 -0
- package/dist/commands/webhooks/deliveries.js +119 -0
- package/dist/commands/webhooks/get.d.ts +9 -0
- package/dist/commands/webhooks/get.js +110 -0
- package/dist/commands/webhooks/list.d.ts +9 -0
- package/dist/commands/webhooks/list.js +104 -0
- package/dist/commands/webhooks/resend.d.ts +9 -0
- package/dist/commands/webhooks/resend.js +95 -0
- package/dist/commands/webhooks/rotate.d.ts +9 -0
- package/dist/commands/webhooks/rotate.js +98 -0
- package/dist/commands/webhooks/update.d.ts +13 -0
- package/dist/commands/webhooks/update.js +103 -0
- package/dist/commands/workspaces/login.d.ts +5 -0
- package/dist/commands/workspaces/login.js +27 -1
- package/dist/utils/applicationFlags.d.ts +25 -0
- package/dist/utils/applicationFlags.js +95 -0
- package/dist/utils/applicationRequest.d.ts +43 -0
- package/dist/utils/applicationRequest.js +209 -0
- package/dist/utils/createOrUpdateApplication.d.ts +26 -1
- package/dist/utils/createOrUpdateApplication.js +23 -27
- package/dist/utils/format.d.ts +20 -0
- package/dist/utils/format.js +31 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/trackCallStatus.d.ts +4 -0
- package/dist/utils/trackCallStatus.js +67 -0
- package/dist/utils/webhookFlags.d.ts +3 -0
- package/dist/utils/webhookFlags.js +34 -0
- package/package.json +6 -6
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
45
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
|
+
};
|
|
47
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
+
/**
|
|
49
|
+
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
50
|
+
* http://github.com/fonoster/fonoster
|
|
51
|
+
*
|
|
52
|
+
* This file is part of Fonoster
|
|
53
|
+
*
|
|
54
|
+
* Licensed under the MIT License (the "License");
|
|
55
|
+
* you may not use this file except in compliance with
|
|
56
|
+
* the License. You may obtain a copy of the License at
|
|
57
|
+
*
|
|
58
|
+
* https://opensource.org/licenses/MIT
|
|
59
|
+
*
|
|
60
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
61
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
62
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
63
|
+
* See the License for the specific language governing permissions and
|
|
64
|
+
* limitations under the License.
|
|
65
|
+
*/
|
|
66
|
+
const SDK = __importStar(require("@fonoster/sdk"));
|
|
67
|
+
const cliui_1 = __importDefault(require("cliui"));
|
|
68
|
+
const AuthenticatedCommand_1 = require("../../../AuthenticatedCommand");
|
|
69
|
+
const errorHandler_1 = __importDefault(require("../../../errorHandler"));
|
|
70
|
+
const format_1 = require("../../../utils/format");
|
|
71
|
+
class List extends AuthenticatedCommand_1.AuthenticatedCommand {
|
|
72
|
+
run() {
|
|
73
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
yield this.parse(List);
|
|
75
|
+
try {
|
|
76
|
+
const client = yield this.createSdkClient();
|
|
77
|
+
const { items } = yield new SDK.Providers(client).listProviderKeys();
|
|
78
|
+
const ui = (0, cliui_1.default)({ width: 120 });
|
|
79
|
+
ui.div({ text: "PROVIDER", padding: [0, 0, 0, 0], width: 20 }, { text: "REF", padding: [0, 0, 0, 0], width: 40 }, { text: "UPDATED", padding: [0, 0, 0, 0] });
|
|
80
|
+
items.forEach((item) => {
|
|
81
|
+
var _a;
|
|
82
|
+
ui.div({ text: item.providerId, padding: [0, 0, 0, 0], width: 20 }, { text: item.ref, padding: [0, 0, 0, 0], width: 40 }, {
|
|
83
|
+
text: (0, format_1.formatDate)((_a = item.updatedAt) !== null && _a !== void 0 ? _a : item.createdAt),
|
|
84
|
+
padding: [0, 0, 0, 0]
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
this.log(ui.toString());
|
|
88
|
+
}
|
|
89
|
+
catch (e) {
|
|
90
|
+
(0, errorHandler_1.default)(e, this.error.bind(this));
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
List.description = "list the vendors the Workspace has its own key for (keys are never shown)";
|
|
96
|
+
List.examples = ["<%= config.bin %> <%= command.id %>"];
|
|
97
|
+
exports.default = List;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AuthenticatedCommand } from "../../../AuthenticatedCommand";
|
|
2
|
+
export default class Set extends AuthenticatedCommand<typeof Set> {
|
|
3
|
+
static readonly description = "set the Workspace's own key for a speech or LLM vendor (replaces any previous key)";
|
|
4
|
+
static readonly examples: string[];
|
|
5
|
+
static readonly args: {
|
|
6
|
+
provider: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
|
+
};
|
|
8
|
+
static readonly flags: {
|
|
9
|
+
key: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
|
+
};
|
|
11
|
+
run(): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
45
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
|
+
};
|
|
47
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
+
/**
|
|
49
|
+
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
50
|
+
* http://github.com/fonoster/fonoster
|
|
51
|
+
*
|
|
52
|
+
* This file is part of Fonoster
|
|
53
|
+
*
|
|
54
|
+
* Licensed under the MIT License (the "License");
|
|
55
|
+
* you may not use this file except in compliance with
|
|
56
|
+
* the License. You may obtain a copy of the License at
|
|
57
|
+
*
|
|
58
|
+
* https://opensource.org/licenses/MIT
|
|
59
|
+
*
|
|
60
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
61
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
62
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
63
|
+
* See the License for the specific language governing permissions and
|
|
64
|
+
* limitations under the License.
|
|
65
|
+
*/
|
|
66
|
+
const SDK = __importStar(require("@fonoster/sdk"));
|
|
67
|
+
const prompts_1 = require("@inquirer/prompts");
|
|
68
|
+
const core_1 = require("@oclif/core");
|
|
69
|
+
const AuthenticatedCommand_1 = require("../../../AuthenticatedCommand");
|
|
70
|
+
const errorHandler_1 = __importDefault(require("../../../errorHandler"));
|
|
71
|
+
class Set extends AuthenticatedCommand_1.AuthenticatedCommand {
|
|
72
|
+
run() {
|
|
73
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
var _a;
|
|
75
|
+
const { args, flags } = yield this.parse(Set);
|
|
76
|
+
try {
|
|
77
|
+
const key = (_a = flags.key) !== null && _a !== void 0 ? _a : (yield (0, prompts_1.password)({ message: `${args.provider} key` }));
|
|
78
|
+
if (!key) {
|
|
79
|
+
this.error("A key is required.");
|
|
80
|
+
}
|
|
81
|
+
const client = yield this.createSdkClient();
|
|
82
|
+
const saved = yield new SDK.Providers(client).setProviderKey({
|
|
83
|
+
providerId: args.provider,
|
|
84
|
+
key
|
|
85
|
+
});
|
|
86
|
+
this.log(`Key set for ${saved.providerId || args.provider}.`);
|
|
87
|
+
}
|
|
88
|
+
catch (e) {
|
|
89
|
+
(0, errorHandler_1.default)(e, this.error.bind(this));
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
Set.description = "set the Workspace's own key for a speech or LLM vendor (replaces any previous key)";
|
|
95
|
+
Set.examples = [
|
|
96
|
+
"<%= config.bin %> <%= command.id %> deepgram # asks for the key",
|
|
97
|
+
"<%= config.bin %> <%= command.id %> elevenlabs --key $ELEVENLABS_API_KEY"
|
|
98
|
+
];
|
|
99
|
+
Set.args = {
|
|
100
|
+
provider: core_1.Args.string({
|
|
101
|
+
description: "the provider id (see providers:catalog --kind provider)",
|
|
102
|
+
required: true
|
|
103
|
+
})
|
|
104
|
+
};
|
|
105
|
+
Set.flags = {
|
|
106
|
+
key: core_1.Flags.string({
|
|
107
|
+
description: "the vendor key (omit to type it without echo)"
|
|
108
|
+
})
|
|
109
|
+
};
|
|
110
|
+
exports.default = Set;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AuthenticatedCommand } from "../../AuthenticatedCommand";
|
|
2
|
+
export default class Download extends AuthenticatedCommand<typeof Download> {
|
|
3
|
+
static readonly description = "save a call's recording (WAV), vCon (JSON) or signed vCon (JWS) to a file";
|
|
4
|
+
static readonly examples: string[];
|
|
5
|
+
static readonly args: {
|
|
6
|
+
ref: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
|
+
};
|
|
8
|
+
static readonly flags: {
|
|
9
|
+
part: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
|
+
output: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
|
+
version: import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
|
+
original: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
};
|
|
14
|
+
run(): Promise<void>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
45
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
|
+
};
|
|
47
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
+
/**
|
|
49
|
+
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
50
|
+
* http://github.com/fonoster/fonoster
|
|
51
|
+
*
|
|
52
|
+
* This file is part of Fonoster
|
|
53
|
+
*
|
|
54
|
+
* Licensed under the MIT License (the "License");
|
|
55
|
+
* you may not use this file except in compliance with
|
|
56
|
+
* the License. You may obtain a copy of the License at
|
|
57
|
+
*
|
|
58
|
+
* https://opensource.org/licenses/MIT
|
|
59
|
+
*
|
|
60
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
61
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
62
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
63
|
+
* See the License for the specific language governing permissions and
|
|
64
|
+
* limitations under the License.
|
|
65
|
+
*/
|
|
66
|
+
const fs_1 = require("fs");
|
|
67
|
+
const SDK = __importStar(require("@fonoster/sdk"));
|
|
68
|
+
const core_1 = require("@oclif/core");
|
|
69
|
+
const AuthenticatedCommand_1 = require("../../AuthenticatedCommand");
|
|
70
|
+
const errorHandler_1 = __importDefault(require("../../errorHandler"));
|
|
71
|
+
const EXTENSIONS = {
|
|
72
|
+
recording: "wav",
|
|
73
|
+
vcon: "vcon.json",
|
|
74
|
+
signed: "vcon.jws.json"
|
|
75
|
+
};
|
|
76
|
+
class Download extends AuthenticatedCommand_1.AuthenticatedCommand {
|
|
77
|
+
run() {
|
|
78
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
79
|
+
var _a;
|
|
80
|
+
const { args, flags } = yield this.parse(Download);
|
|
81
|
+
const output = (_a = flags.output) !== null && _a !== void 0 ? _a : `${args.ref}.${EXTENSIONS[flags.part]}`;
|
|
82
|
+
const options = { version: flags.version, original: flags.original };
|
|
83
|
+
try {
|
|
84
|
+
const client = yield this.createSdkClient();
|
|
85
|
+
const records = new SDK.CallRecords(client);
|
|
86
|
+
if (flags.part === "recording") {
|
|
87
|
+
const recording = yield records.getRecording(args.ref, options);
|
|
88
|
+
(0, fs_1.writeFileSync)(output, Buffer.from(recording.data));
|
|
89
|
+
this.log(`Saved ${output} (${recording.data.byteLength} bytes, ${recording.contentType}` +
|
|
90
|
+
(recording.contentHash ? `, ${recording.contentHash})` : ")"));
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const record = yield records.getRecord(args.ref, options);
|
|
94
|
+
const body = flags.part === "vcon" ? record.vcon : record.jws;
|
|
95
|
+
(0, fs_1.writeFileSync)(output, JSON.stringify(body, null, 2) + "\n");
|
|
96
|
+
this.log(`Saved ${output} (version ${record.version})`);
|
|
97
|
+
}
|
|
98
|
+
catch (e) {
|
|
99
|
+
(0, errorHandler_1.default)(e, this.error.bind(this));
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
Download.description = "save a call's recording (WAV), vCon (JSON) or signed vCon (JWS) to a file";
|
|
105
|
+
Download.examples = [
|
|
106
|
+
"<%= config.bin %> <%= command.id %> <call-ref> # <call-ref>.wav",
|
|
107
|
+
"<%= config.bin %> <%= command.id %> <call-ref> --part vcon -o call.json",
|
|
108
|
+
"<%= config.bin %> <%= command.id %> <call-ref> --part signed # verifiable JWS"
|
|
109
|
+
];
|
|
110
|
+
Download.args = {
|
|
111
|
+
ref: core_1.Args.string({ description: "the call (callRef)", required: true })
|
|
112
|
+
};
|
|
113
|
+
Download.flags = {
|
|
114
|
+
part: core_1.Flags.string({
|
|
115
|
+
char: "p",
|
|
116
|
+
description: "what to download",
|
|
117
|
+
options: Object.keys(EXTENSIONS),
|
|
118
|
+
default: "recording"
|
|
119
|
+
}),
|
|
120
|
+
output: core_1.Flags.string({
|
|
121
|
+
char: "o",
|
|
122
|
+
description: "the file to write (default <call-ref>.<ext>)"
|
|
123
|
+
}),
|
|
124
|
+
version: core_1.Flags.integer({
|
|
125
|
+
description: "a record version (default latest)"
|
|
126
|
+
}),
|
|
127
|
+
original: core_1.Flags.boolean({
|
|
128
|
+
description: "the unredacted record (owner or admin)",
|
|
129
|
+
default: false
|
|
130
|
+
})
|
|
131
|
+
};
|
|
132
|
+
exports.default = Download;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CallRecordDetail } from "@fonoster/types";
|
|
2
|
+
import { AuthenticatedCommand } from "../../AuthenticatedCommand";
|
|
3
|
+
export declare function formatRecord(r: CallRecordDetail): string;
|
|
4
|
+
export default class Get extends AuthenticatedCommand<typeof Get> {
|
|
5
|
+
static readonly description = "show the summary of a call record (use records:download for the files)";
|
|
6
|
+
static readonly examples: string[];
|
|
7
|
+
static readonly args: {
|
|
8
|
+
ref: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
9
|
+
};
|
|
10
|
+
static readonly flags: {
|
|
11
|
+
version: import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
|
+
original: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
};
|
|
14
|
+
run(): Promise<void>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
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
|
+
exports.formatRecord = formatRecord;
|
|
49
|
+
/**
|
|
50
|
+
* Copyright (C) 2025 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 AuthenticatedCommand_1 = require("../../AuthenticatedCommand");
|
|
71
|
+
const errorHandler_1 = __importDefault(require("../../errorHandler"));
|
|
72
|
+
const format_1 = require("../../utils/format");
|
|
73
|
+
// The summary lists part names; the detail lists manifest entries ({ name, size, ... }).
|
|
74
|
+
function partLabel(part) {
|
|
75
|
+
if (typeof part === "string")
|
|
76
|
+
return part;
|
|
77
|
+
const p = part;
|
|
78
|
+
return p.size ? `${p.name} (${p.size} bytes)` : String(p.name);
|
|
79
|
+
}
|
|
80
|
+
function formatRecord(r) {
|
|
81
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
82
|
+
const vcon = ((_a = r.vcon) !== null && _a !== void 0 ? _a : {});
|
|
83
|
+
const transcript = ((_b = vcon.analysis) !== null && _b !== void 0 ? _b : []).find((a) => a.type === "transcript");
|
|
84
|
+
const turns = Array.isArray(transcript === null || transcript === void 0 ? void 0 : transcript.body)
|
|
85
|
+
? transcript.body.length
|
|
86
|
+
: undefined;
|
|
87
|
+
return [
|
|
88
|
+
"CALL RECORD",
|
|
89
|
+
"-----------",
|
|
90
|
+
`CALL REF: \t${r.callRef}`,
|
|
91
|
+
`APP: \t${(_c = r.appRef) !== null && _c !== void 0 ? _c : "-"}`,
|
|
92
|
+
`FROM: \t${(_d = r.from) !== null && _d !== void 0 ? _d : "-"}`,
|
|
93
|
+
`TO: \t${(_e = r.to) !== null && _e !== void 0 ? _e : "-"}`,
|
|
94
|
+
`DIRECTION: \t${(_f = r.direction) !== null && _f !== void 0 ? _f : "-"}`,
|
|
95
|
+
`STATUS: \t${r.status}`,
|
|
96
|
+
`END REASON: \t${(_g = r.endReason) !== null && _g !== void 0 ? _g : "-"}`,
|
|
97
|
+
...(r.failureReason ? [`FAILURE: \t${r.failureReason}`] : []),
|
|
98
|
+
...(r.sipStatus ? [`SIP STATUS: \t${r.sipStatus}`] : []),
|
|
99
|
+
`STARTED: \t${(0, format_1.formatDate)(r.startedAt)}`,
|
|
100
|
+
`ENDED: \t${(0, format_1.formatDate)(r.endedAt)}`,
|
|
101
|
+
`DURATION: \t${Math.round((_h = r.durationSeconds) !== null && _h !== void 0 ? _h : 0)}s`,
|
|
102
|
+
`REGION: \t${r.region || "-"}`,
|
|
103
|
+
`VERSION: \t${r.version} of ${(_j = r.currentVersion) !== null && _j !== void 0 ? _j : r.version}${r.redacted ? " (redacted)" : ""}`,
|
|
104
|
+
`PARTS: \t${((_k = r.parts) !== null && _k !== void 0 ? _k : []).map(partLabel).join(", ") || "-"}`,
|
|
105
|
+
...(turns !== undefined ? [`TRANSCRIPT: \t${turns} entries`] : []),
|
|
106
|
+
`SIZE: \t${(_l = r.size) !== null && _l !== void 0 ? _l : 0} bytes`
|
|
107
|
+
].join("\n");
|
|
108
|
+
}
|
|
109
|
+
class Get extends AuthenticatedCommand_1.AuthenticatedCommand {
|
|
110
|
+
run() {
|
|
111
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
+
const { args, flags } = yield this.parse(Get);
|
|
113
|
+
try {
|
|
114
|
+
const client = yield this.createSdkClient();
|
|
115
|
+
const record = yield new SDK.CallRecords(client).getRecord(args.ref, {
|
|
116
|
+
version: flags.version,
|
|
117
|
+
original: flags.original
|
|
118
|
+
});
|
|
119
|
+
const ui = (0, cliui_1.default)({ width: 200 });
|
|
120
|
+
ui.div(formatRecord(record));
|
|
121
|
+
this.log(ui.toString());
|
|
122
|
+
}
|
|
123
|
+
catch (e) {
|
|
124
|
+
(0, errorHandler_1.default)(e, this.error.bind(this));
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
Get.description = "show the summary of a call record (use records:download for the files)";
|
|
130
|
+
Get.examples = [
|
|
131
|
+
"<%= config.bin %> <%= command.id %> <call-ref>",
|
|
132
|
+
"<%= config.bin %> <%= command.id %> <call-ref> --original --version 1"
|
|
133
|
+
];
|
|
134
|
+
Get.args = {
|
|
135
|
+
ref: core_1.Args.string({ description: "the call (callRef)", required: true })
|
|
136
|
+
};
|
|
137
|
+
Get.flags = {
|
|
138
|
+
version: core_1.Flags.integer({
|
|
139
|
+
description: "a record version (default latest)"
|
|
140
|
+
}),
|
|
141
|
+
original: core_1.Flags.boolean({
|
|
142
|
+
description: "the unredacted record (owner or admin)",
|
|
143
|
+
default: false
|
|
144
|
+
})
|
|
145
|
+
};
|
|
146
|
+
exports.default = Get;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AuthenticatedCommand } from "../../AuthenticatedCommand";
|
|
2
|
+
export default class List extends AuthenticatedCommand<typeof List> {
|
|
3
|
+
static readonly description = "search the call records (vCon) of the active Workspace, newest first";
|
|
4
|
+
static readonly examples: string[];
|
|
5
|
+
static readonly flags: {
|
|
6
|
+
after: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
7
|
+
before: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
|
+
number: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
|
+
app: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
|
+
status: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
|
+
"page-size": import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
|
+
"page-token": import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
|
+
};
|
|
14
|
+
run(): Promise<void>;
|
|
15
|
+
}
|