@velaro/cli 1.4.235 → 1.4.237
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/bin/velaro.js
CHANGED
|
@@ -108,6 +108,7 @@ import { packageBuilderCommand } from '../lib/commands/package-builder.js';
|
|
|
108
108
|
import { routingCommand } from '../lib/commands/routing.js';
|
|
109
109
|
import { statusNotifyCommand } from '../lib/commands/status-notify.js';
|
|
110
110
|
import { callbackCommand } from '../lib/commands/callback.js';
|
|
111
|
+
import { ticketNumberingCommand } from '../lib/commands/ticket-numbering.js';
|
|
111
112
|
import { cobrowseCommand } from '../lib/commands/cobrowse.js';
|
|
112
113
|
import { callpresenceCommand } from '../lib/commands/callpresence.js';
|
|
113
114
|
import { signupFormCommand } from '../lib/commands/signup-form.js';
|
|
@@ -288,6 +289,7 @@ await (registerStaffCommands ? registerStaffCommands(baseYargs) : baseYargs)
|
|
|
288
289
|
.command(routingCommand)
|
|
289
290
|
.command(statusNotifyCommand)
|
|
290
291
|
.command(callbackCommand)
|
|
292
|
+
.command(ticketNumberingCommand)
|
|
291
293
|
// The staff build already registers a cobrowse group that includes seats/seat set; only the public build adds this one.
|
|
292
294
|
.command(registerStaffCommands ? { command: 'cobrowse-seats-in-staff-group', describe: false, builder: (y) => y, handler: () => {} } : cobrowseCommand)
|
|
293
295
|
.command(callpresenceCommand)
|
|
@@ -133,7 +133,7 @@ export const ivrCommand = { command: 'ivr', ...group('IVR voice configurations,
|
|
|
133
133
|
async (a) => {
|
|
134
134
|
const existing = await get(`/IVRVoiceConfigurations/${a.id}`);
|
|
135
135
|
if (!existing) throw new Error(`Voice config ${a.id} not found.`);
|
|
136
|
-
const map = { 'idle-check-in-seconds': 'idleCheckInSeconds', 'idle-check-in-message': 'idleCheckInMessage', 'idle-hangup-seconds': 'idleHangupSeconds',
|
|
136
|
+
const map = { 'idle-check-in-seconds': 'idleCheckInSeconds', 'idle-check-in-message': 'idleCheckInMessage', 'idle-hangup-seconds': 'idleHangupSeconds', 'idle-max-check-ins': 'idleMaxCheckIns', 'idle-goodbye-message': 'idleGoodbyeMessage',
|
|
137
137
|
'escalation-bridge-enabled': 'escalationBridgeEnabled', 'escalation-callback-enabled': 'escalationCallbackEnabled',
|
|
138
138
|
'transfer-no-answer-message': 'transferNoAnswerMessage', 'welcome-greeting': 'welcomeGreeting', 'always-transfer-number': 'alwaysTransferNumber',
|
|
139
139
|
'transfer-mode': 'transferMode', 'no-agent-fallback': 'noAgentFallback', 'after-hours-fallback': 'afterHoursFallback' };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { messagingGet, messagingPut } from '../api.js';
|
|
2
|
+
import { runCommand } from '../run.js';
|
|
3
|
+
|
|
4
|
+
// -- velaro ticket-numbering ----------------------------------------------------
|
|
5
|
+
// Ticket numbering per department (team): prefix, next number, increment.
|
|
6
|
+
// Endpoint lives in velaro-messaging at Teams/{teamId}/ticket-numbering. The site comes from the
|
|
7
|
+
// credential header (see api.js messagingRequest), never from CLI args.
|
|
8
|
+
|
|
9
|
+
function print(view) {
|
|
10
|
+
console.log(`\nTicket numbering for ${view.teamName ?? 'team ' + view.teamId}`);
|
|
11
|
+
if (!view.configured) {
|
|
12
|
+
console.log(' This team uses the site numbering.');
|
|
13
|
+
} else {
|
|
14
|
+
console.log(` Prefix: ${view.effectivePrefix}`);
|
|
15
|
+
console.log(` Next number: ${view.effectiveNextNumber}`);
|
|
16
|
+
console.log(` Increment: ${view.effectiveIncrement}`);
|
|
17
|
+
}
|
|
18
|
+
console.log(` Next ticket: ${view.example}\n`);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async function getHandler(argv) {
|
|
22
|
+
print(await messagingGet(`/Teams/${argv.team}/ticket-numbering`));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async function setHandler(argv) {
|
|
26
|
+
const body = {};
|
|
27
|
+
if (argv.prefix !== undefined) body.prefix = String(argv.prefix);
|
|
28
|
+
if (argv.next !== undefined) body.nextNumber = argv.next;
|
|
29
|
+
if (argv.increment !== undefined) body.increment = argv.increment;
|
|
30
|
+
if (argv.reset) body.reset = true;
|
|
31
|
+
if (!Object.keys(body).length) {
|
|
32
|
+
throw new Error('Pass at least one of --prefix, --next, --increment or --reset.');
|
|
33
|
+
}
|
|
34
|
+
print(await messagingPut(`/Teams/${argv.team}/ticket-numbering`, body));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const getCommand = {
|
|
38
|
+
command: 'get',
|
|
39
|
+
describe: 'Show how a department numbers its tickets',
|
|
40
|
+
builder: (y) => y.option('team', { describe: 'Team (department) id', type: 'number', demandOption: true }),
|
|
41
|
+
handler: runCommand(getHandler),
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const setCommand = {
|
|
45
|
+
command: 'set',
|
|
46
|
+
describe: 'Set a department\'s ticket prefix, next number and increment (only the options you pass change)',
|
|
47
|
+
builder: (y) => y
|
|
48
|
+
.option('team', { describe: 'Team (department) id', type: 'number', demandOption: true })
|
|
49
|
+
.option('prefix', { describe: 'Prefix such as TK- (blank means the default TK-)', type: 'string' })
|
|
50
|
+
.option('next', { describe: 'The number the next ticket gets', type: 'number' })
|
|
51
|
+
.option('increment', { describe: 'How much the number grows after each ticket', type: 'number' })
|
|
52
|
+
.option('reset', { describe: 'Clear all three and use the site numbering', type: 'boolean' }),
|
|
53
|
+
handler: runCommand(setHandler),
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const ticketNumberingCommand = {
|
|
57
|
+
command: 'ticket-numbering <subcommand>',
|
|
58
|
+
describe: 'Ticket numbering per department (prefix, next number, increment)',
|
|
59
|
+
builder: (y) => y
|
|
60
|
+
.command(getCommand)
|
|
61
|
+
.command(setCommand)
|
|
62
|
+
.demandCommand(1, 'Specify a subcommand: get, set'),
|
|
63
|
+
handler: () => {},
|
|
64
|
+
};
|
package/package.json
CHANGED